diff --git a/README.md b/README.md index bb5fa46..8ab0b6d 100755 --- a/README.md +++ b/README.md @@ -80,6 +80,44 @@ Pour le thème sombre, ajouter `data-theme="dark"` sur l'élément racine (`Filtrer + +``` + +**Tokens d'espacement** : `--space-1` (2px) à `--space-8` (48px), dérivés des valeurs +réellement observées dans le kit audité (`--space-4` = 14px, padding exact de l'Action +Sheet ; `--space-6` = 20px, padding exact du bouton Bordered-Prominent). Tous les composants +existants ont été migrés dessus — à référencer plutôt que d'inventer un `px` dans une app. + +**ColorPicker** (18ᵉ composant) — déclencheur rond pour choisir une couleur (catégorie, +étiquette, tag). Sans `options` : ouvre le sélecteur natif du système. Avec `options` : +palette fermée de pastilles cliquables. + +```tsx + +``` + ## Développer le package ```bash diff --git a/package.json b/package.json index 58d3303..e64cb32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@napps/design-system", - "version": "0.1.2", + "version": "0.1.3", "private": false, "description": "Identité visuelle et bibliothèque de composants nApps — direction A4 (Précision / Vibrance)", "type": "module", diff --git a/packages/design-system/package.json b/packages/design-system/package.json index f231662..b6f763c 100755 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -1,6 +1,6 @@ { "name": "@napps/design-system", - "version": "0.1.2", + "version": "0.1.3", "private": false, "description": "Identité visuelle et bibliothèque de composants nApps — direction A4 (Précision / Vibrance)", "type": "module", diff --git a/packages/design-system/src/components/Button.tsx b/packages/design-system/src/components/Button.tsx index d91de11..8a2f32c 100755 --- a/packages/design-system/src/components/Button.tsx +++ b/packages/design-system/src/components/Button.tsx @@ -1,18 +1,22 @@ import { ButtonHTMLAttributes, forwardRef } from 'react'; export type ButtonVariant = 'primary' | 'secondary'; +export type ButtonSize = 'regular' | 'compact'; export interface ButtonProps extends ButtonHTMLAttributes { variant?: ButtonVariant; + /** "regular" (défaut, inchangé) ou "compact" (~34px, usages denses). */ + size?: ButtonSize; } export const Button = forwardRef( - ({ variant = 'primary', className, ...props }, ref) => { + ({ variant = 'primary', size = 'regular', className, ...props }, ref) => { const variantClass = variant === 'primary' ? 'btn-primary' : 'btn-secondary'; + const sizeClass = size === 'compact' ? `${variantClass}--compact` : undefined; return ( + ); +} + +export function ColorPicker({ value, onChange, options, disabled, ...props }: ColorPickerProps) { + const label = props['aria-label']; + + if (options && options.length > 0) { + return ( +
+ {options.map((color) => ( + onChange(color)} + /> + ))} +
+ ); + } + + return ( + + onChange(e.target.value)} + /> + + ); +} diff --git a/packages/design-system/src/components/ListRow.tsx b/packages/design-system/src/components/ListRow.tsx index 5b5d2e6..3d6bb03 100755 --- a/packages/design-system/src/components/ListRow.tsx +++ b/packages/design-system/src/components/ListRow.tsx @@ -1,19 +1,31 @@ import { HTMLAttributes, ReactNode } from 'react'; -export interface ListRowProps extends Omit, 'title'> { +export interface ListRowProps extends Omit, 'title'> { title: ReactNode; subtitle?: ReactNode; trailing?: ReactNode; } -export function ListRow({ title, subtitle, trailing, className, ...props }: ListRowProps) { +/** + * Rendue en