# @coton/ds — Design System v1.0 

Système de design du collectif **COTON**. Tokens, preset Tailwind et composants React typés. Bleu marine + or + crème.

---

## Installation

### 1. Copier le package dans votre repo

```bash
# Mono-repo
cp -R ds packages/coton-ds

# Ou dépendance locale
npm install ./ds
```

Dans `package.json` de votre app :
```json
"dependencies": {
  "@coton/ds": "file:../ds"
}
```

Puis :
```bash
npm install clsx tailwind-merge class-variance-authority
```

### 2. Importer les tokens CSS

Dans votre `app/globals.css` (Next.js) ou `src/index.css` :
```css
@import "@coton/ds/tokens.css";

/* Optionnel : appliquer le fond signature (taches crème floutées) */
body { @apply coton-bg-maison; }
```

### 3. Brancher Tailwind sur le preset

Dans `tailwind.config.ts` :
```ts
import cotonPreset from "@coton/ds/tailwind.preset";

export default {
  presets: [cotonPreset],
  content: [
    "./src/**/*.{ts,tsx}",
    "./node_modules/@coton/ds/**/*.{ts,tsx}",
  ],
} satisfies Config;
```

### 4. Charger les fonts

Dans `<head>` (ou via `next/font`) :
```html
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,400&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
```

---

## Utilisation

```tsx
import { Button, Card, CardTitle, CardDescription, Badge, Alert, Tabs, TabsList, TabsTrigger, TabsContent } from "@coton/ds";

export default function Page() {
  return (
    <div className="max-w-3xl mx-auto p-12 space-y-6">
      <h1 className="font-serif text-5xl tracking-tight">
        Le bon profil. <em className="text-or-400 italic">Du premier coup.</em>
      </h1>

      <div className="flex gap-3">
        <Button variant="primary">Trouver un freelance</Button>
        <Button variant="outline">Comment ça marche</Button>
      </div>

      <Card hover>
        <Badge variant="or" dot>Top pick</Badge>
        <CardTitle>Pierre M.</CardTitle>
        <CardDescription>Lead Frontend · React/TS · Lyon</CardDescription>
      </Card>

      <Alert variant="info" title="Note">
        Le système est composable, pas monolithique.
      </Alert>
    </div>
  );
}
```

---

## Composants

| Composant | Variantes |
|---|---|
| `<Button>` | primary, gold, outline, ghost, link · sm/md/lg |
| `<Card>` | + Header / Eyebrow / Title / Description / Content / Footer |
| `<Badge>` | marine, or, success, warning, error, info, outline, solid |
| `<Alert>` | info, success, warning, error |
| `<Input>` | + Label, HelpText |
| `<Tabs>` | + TabsList, TabsTrigger, TabsContent |
| `<Avatar>` | sm/md/lg/xl · marine/gold/cream/ink + AvatarStack |

---

## Logos

Dans `ds/assets/` :
- `logo-coton.svg` — encre marine (fonds clairs)
- `logo-coton-blanc.png` — blanc (fonds sombres / marine)
- `favicon.ico` — version par défaut
- `favicon-blanc.ico` — version inversée

---

## Tokens

Trois sources de vérité, synchronisées :

1. **`tokens.css`** — variables CSS `--coton-*` (consommables partout)
2. **`tokens.json`** — format **W3C Design Tokens** (compatible Tokens Studio Figma, Style Dictionary)
3. **`tailwind.preset.js`** — étend `theme` (couleurs, fontFamily, fontSize, radius, shadows, animations)

### Exemples de classes Tailwind disponibles

```html
<!-- Couleurs -->
<div class="bg-marine-700 text-ink-on-marine">…</div>
<div class="bg-or-100 text-or-700 border-or-200">…</div>
<div class="bg-creme">…</div>

<!-- Type -->
<h1 class="font-serif text-5xl tracking-tight">
  <em class="italic text-or-400">éditorial</em>
</h1>

<!-- Ombres signature -->
<button class="shadow-coton-marine">…</button>
<button class="shadow-coton-or">…</button>

<!-- Motion signature : shimmer (déjà dans Button primary/gold) -->
<span class="animate-coton-shimmer">…</span>
```

---

## Versions

- **v1.0**  (avril 2026) — palette marine + or + crème, Fraunces editorial, shimmer button.
- v3.0 — *Editorial* — long-form, drop-cap.
- v2.0 — *Product* — formulaires, tables denses.
- v1.0 — *Terminal* — PoC mono dark.

---

## Convention de contribution

1. Tout nouveau token passe d'abord dans `tokens.json` (source W3C), puis est répercuté dans `tokens.css` et `tailwind.preset.js`.
2. Tout nouveau composant React expose un `cva()` de variantes + un export typé `XxxProps`.
3. Tester sur fond blanc ET sur fond marine avant merge.

— *COTON Collectif · 2026*
