5 Commits
Author SHA1 Message Date
nathanduquet 208d03b7be v0.1.5 — 3e matière (popover), troncature Text/Select, correction diagnostic Tailwind
Trois retours d'usage réel (app Cars), applicables à toutes les apps
consommant le design system :

- Corrige le diagnostic Tailwind du README (v0.1.4 attribuait le problème
  à la spécificité :where() de space-y-*/space-x-* — le vrai mécanisme est
  les cascade layers : tokens.css n'utilise aucun @layer, et du CSS non
  calqué bat toujours du CSS calqué. Généralise la recommandation à tout
  utilitaire Tailwind de marge/padding/graisse, pas juste l'espacement.

- Ajoute Surface material="popover" : 3e recette de verre pour un menu/
  popover flottant directement sur du contenu de page sans scrim, distincte
  de "control" (élément isolé sur contenu qui défile) et "panel" (dialogue,
  toujours avec scrim, illisible sans). Calibrée sur la 3e nuance de verre
  auditée (Popovers, blur 65px, ombre 0 10px 50px — figma-kit-audit.md).
  Dark : réutilise tel quel .material-control dark (aucune nuance popover
  dark auditée indépendamment) plutôt que d'extrapoler une valeur non
  vérifiée — asymétrie documentée en commentaire dans tokens.css.

- Ajoute text-overflow: ellipsis à .text-field et .select, qui coupaient
  net une valeur trop longue dans un contrôle étroit (size="compact",
  barre de filtres) sans indication visuelle de troncature.

package.json racine et packages/design-system/package.json synchronisés
en 0.1.5.
2026-09-20 10:51:52 +02:00
nathanduquet 39dc123a93 v0.1.4 — corrige le padding gauche du Select et l'état :disabled de Button
Deux bugs remontés par l'usage réel (app Cars), applicables à toutes les
apps consommant le design system :

- .select (taille regular) avait un padding-left codé en dur à 0 au lieu
  de var(--space-5) — valeur collée au bord gauche de sa carte, contraire
  à la symétrie de .text-field. .select--compact n'était pas concerné.
- Button (.btn-primary/.btn-secondary) n'avait aucun style :disabled,
  contrairement à Checkbox/Radio qui l'ont déjà — ajouté avec la même
  opacité 0.5, et les hover/pressé v0.1.3 sont désormais exclus quand
  disabled (focus-visible n'a pas besoin du même garde-fou : un bouton
  disabled n'est jamais focusable).

Documente aussi le piège Tailwind space-y-*/space-x-* (spécificité
:where() nulle) écrasé par le margin:0 des classes .text-* — recommande
gap plutôt que space-y-*/space-x-* autour des éléments Text.

package.json racine et packages/design-system/package.json synchronisés
en 0.1.4.
2026-09-18 20:00:25 +02:00
nathanduquet dc74b1b97b v0.1.3 — états d'interaction, tailles compactes, tokens d'espacement, ColorPicker
Corrige 4 lacunes remontées par l'usage réel (app Cars), applicables à toutes
les apps consommant le design system :

- Hover/pressé/focus-visible sur Button, Select, Checkbox, Radio, Toggle,
  TabBar item, et ListRow (rendue en <button> avec onClick, focus clavier
  correct). Couleurs dérivées des tokens existants (color-mix, filter),
  aucune nouvelle valeur brute — pas de vérification dark distincte requise.
- Prop size="compact" sur Button/Select/TextField (~34px, recette du Search
  Field audité) en plus de size="regular" (comportement historique
  inchangé, zéro régression pour les apps déjà en prod).
- Échelle --space-1 (2px) à --space-8 (48px), dérivée des valeurs exactes
  du kit audité (space-4=14px, space-6=20px), composants existants migrés
  dessus.
- ColorPicker (18e composant) : déclencheur rond, palette fermée ou input
  natif selon la prop options.

package.json racine et packages/design-system/package.json synchronisés en
0.1.3.
2026-09-18 19:04:48 +02:00
nathanduquetandClaude Sonnet 5 1286a0e3d9 fix(package): ajoute un package.json racine proxy pour l'install git
npm install git+https://...#tag exige un manifeste à la racine du dépôt
cloné, mais le package réel vivait uniquement dans packages/design-system/.
Ajoute un package.json racine dont les champs main/module/types/exports
pointent vers packages/design-system/dist/, avec un script prepare qui
installe puis build le package imbriqué. Bump les deux manifestes à 0.1.2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17 12:46:15 +02:00
nathanduquet 3703c83159 Automatiser le build à l'installation via le script prepare
Une app qui installe le package depuis Gitea (npm install git+...) obtient
directement dist/ compilé, sans étape manuelle — npm exécute le script
prepare pour toute dépendance git.
2026-09-17 12:37:15 +02:00
13 changed files with 715 additions and 88 deletions
+116 -3
View File
@@ -6,6 +6,7 @@ Identité visuelle commune et bibliothèque de composants pour les applications
``` ```
nAppsDesign/ nAppsDesign/
├── package.json # Manifeste racine — proxy vers packages/design-system (voir note ci-dessous)
├── tokens.css # Design tokens de référence (copie canonique dans packages/design-system/src/) ├── tokens.css # Design tokens de référence (copie canonique dans packages/design-system/src/)
├── figma-kit-audit.md # Audit détaillé du kit Apple iOS 27 utilisé comme référence ├── figma-kit-audit.md # Audit détaillé du kit Apple iOS 27 utilisé comme référence
├── Main.dc.html, OptionA*.dc.html, canvas.json # Planches de direction artistique (A1-A4) ├── Main.dc.html, OptionA*.dc.html, canvas.json # Planches de direction artistique (A1-A4)
@@ -19,6 +20,15 @@ nAppsDesign/
└── package.json └── package.json
``` ```
**Pourquoi un `package.json` à la racine :** `npm install git+https://...` exige un
manifeste à la racine du dépôt cloné — mais le vrai package vit dans
`packages/design-system/`. Le `package.json` racine est un proxy : mêmes `name`/
`version`/`exports` que `packages/design-system/package.json`, mais ses champs
`main`/`module`/`types`/`exports` pointent vers `packages/design-system/dist/`, et
son script `prepare` installe puis build le package imbriqué (`npm install
--prefix packages/design-system && npm run build --prefix packages/design-system`).
Les deux `package.json` doivent rester synchronisés en version à chaque release.
## Direction retenue : A4 — Précision / Vibrance ## Direction retenue : A4 — Précision / Vibrance
Inspirée du vrai Human Interface Guidelines d'Apple (mécaniques : hiérarchie de texte par Inspirée du vrai Human Interface Guidelines d'Apple (mécaniques : hiérarchie de texte par
@@ -39,13 +49,18 @@ consommer directement depuis ce dépôt git :
```json ```json
{ {
"dependencies": { "dependencies": {
"@napps/design-system": "git+https://git.studio-n.fr/napps/design-system.git#main" "@napps/design-system": "git+https://git.studio-n.fr/napps/design-system.git#v0.1.1"
} }
} }
``` ```
Remplacer `#main` par un tag de version (ex. `#v0.1.0`) dès qu'une release est taguée, pour Toujours pointer sur un tag (`#v0.1.1`, jamais `#main`) pour qu'un `npm install` ne récupère
ne pas que chaque `npm install` récupère silencieusement les derniers changements. pas silencieusement des changements non prévus. À chaque évolution notable du design
system, tagger une nouvelle version (`git tag -a vX.Y.Z`) et mettre à jour cette référence
dans les apps qui doivent en profiter.
Le package se construit automatiquement à l'installation (script `prepare`) — un simple
`npm install` dans l'app suffit, pas d'étape manuelle supplémentaire.
```tsx ```tsx
import { Button, Text, Surface } from '@napps/design-system'; import { Button, Text, Surface } from '@napps/design-system';
@@ -65,6 +80,104 @@ Pour le thème sombre, ajouter `data-theme="dark"` sur l'élément racine (`<htm
conteneur) — tous les tokens ont leur propre valeur dark, ce n'est jamais une simple conteneur) — tous les tokens ont leur propre valeur dark, ce n'est jamais une simple
inversion des tokens light (voir `figma-kit-audit.md`, section "Découverte majeure"). inversion des tokens light (voir `figma-kit-audit.md`, section "Découverte majeure").
**Piège si l'app utilise aussi Tailwind (diagnostic corrigé en v0.1.5)** : le vrai mécanisme
n'est pas une histoire de spécificité `:where()` sur `space-y-*`/`space-x-*` spécifiquement —
c'est plus large. Tailwind range tous ses utilitaires dans des `@layer` CSS (cascade layers) ;
`tokens.css` n'utilise aucun layer. Par la spécification CSS, **du CSS non calqué (`tokens.css`)
bat toujours du CSS calqué (les utilitaires Tailwind), quelle que soit la spécificité ou l'ordre
des règles.** Ce n'est donc pas limité à l'espacement : `mb-*`, `mt-*`, `pt-*`, `font-semibold`,
ou n'importe quel autre utilitaire Tailwind appliqué directement sur un élément qui porte déjà
une classe du design system (`.text-*` ou autre) fixant la même propriété perdra systématiquement.
Aucun bug d'un côté ni de l'autre — deux mécanismes de cascade valides qui entrent en collision.
Pour tout espacement ou style autour d'un composant du design system, utiliser `gap` (flex/grid)
ou un style inline plutôt qu'un utilitaire Tailwind de marge/padding/graisse — les deux échappent
au problème (`gap` n'est pas une marge ; un style inline bat n'importe quelle classe, calquée ou
non, quoi qu'il arrive).
## v0.1.3 — états d'interaction, tailles compactes, espacement, ColorPicker
Retour d'usage réel (app Cars) : quatre lacunes du design system corrigées, applicables à
toutes les apps qui le consomment.
**États d'interaction** : `Button`, `Select`, `Checkbox`, `Radio`, `Toggle`, `TabBar` (item),
et `ListRow` (rendue interactive dès qu'un `onClick` est fourni) ont maintenant un hover
(pointeur uniquement), un état pressé discret (opacité + micro scale-down, sans animation
voyante) et un anneau de focus clavier visible (`:focus-visible` uniquement, jamais au clic
souris). Rien à changer côté usage — c'est automatique.
**Taille compacte** : `Button`, `Select` et `TextField` acceptent désormais `size="compact"`
(~34px, échelle pilule pleine — même recette que le Search Field du kit audité) en plus de
`size="regular"` (défaut, comportement historique inchangé) :
```tsx
<Button size="compact">Filtrer</Button>
<TextField size="compact" placeholder="Rechercher…" />
```
**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
<ColorPicker
value={color}
onChange={setColor}
options={['#0B6CFF', '#1FA968', '#D68C1B', '#E6483D']}
aria-label="Couleur de la catégorie"
/>
```
## v0.1.4 — corrections Select et Button:disabled
Deux bugs remontés par l'usage réel (app Cars), applicables à toutes les apps qui consomment
le design system :
- **`Select` (taille regular)** avait un padding gauche à `0` au lieu de `var(--space-5)` —
la valeur affichée se retrouvait collée au bord de sa carte, contrairement à `TextField`
qui a un padding symétrique. Corrigé. `size="compact"` n'était pas concerné.
- **`Button`** n'avait aucun style `:disabled` — un bouton désactivé était visuellement
identique à un bouton actif. Ajouté (`opacity: 0.5`, même valeur que `Checkbox`/`Radio`),
et les états hover/pressé de la v0.1.3 sont désormais exclus quand `disabled`.
Si votre app contournait l'un de ces deux bugs localement (règle CSS applicative pour le
padding du Select, style inline pour un Button désactivé), ce contournement peut être retiré
après la mise à jour vers v0.1.4.
## v0.1.5 — troisième matière (popover), troncature, correction du diagnostic Tailwind
Trois retours d'usage réel (app Cars), applicables à toutes les apps qui consomment le
design system :
- **Diagnostic Tailwind corrigé** — voir la note ci-dessus, section usage : le vrai
mécanisme est les cascade layers, pas une histoire de spécificité limitée à `space-y-*`.
- **`Surface material="popover"`** (nouvelle valeur, en plus de `"control"` et `"panel"`) —
pour un menu ou un popover flottant directement sur du contenu de page, sans scrim
assombri derrière. `.material-panel` reste réservé aux dialogues avec scrim (illisible
sans) ; `.material-control` aux éléments flottants isolés sur du contenu qui défile.
Calibré sur la 3ᵉ nuance de verre réellement observée dans l'audit (Popovers, blur 65px,
ombre `0 10px 50px`) — voir `figma-kit-audit.md`. Sa valeur dark réutilise telle quelle
celle de `.material-control` (aucune nuance popover dark n'a été auditée indépendamment ;
asymétrie assumée et documentée dans `tokens.css`, à corriger si une extraction dark
devient disponible).
```tsx
<Surface material="popover">Menu de navigation flottant</Surface>
```
- **`TextField` et `Select`** tronquent maintenant proprement (`text-overflow: ellipsis`) au
lieu de couper net une valeur trop longue dans un contrôle étroit (`size="compact"`, barre
de filtres, action de ligne).
Si votre app contournait l'un de ces bugs localement (`.surface-grouped` à la place d'un
matériau translucide, règle CSS applicative pour la troncature), ce contournement peut être
retiré après la mise à jour vers v0.1.5.
## Développer le package ## Développer le package
```bash ```bash
+32
View File
@@ -0,0 +1,32 @@
{
"name": "@napps/design-system",
"version": "0.1.5",
"private": false,
"description": "Identité visuelle et bibliothèque de composants nApps — direction A4 (Précision / Vibrance)",
"type": "module",
"main": "./packages/design-system/dist/index.cjs",
"module": "./packages/design-system/dist/index.js",
"types": "./packages/design-system/dist/index.d.ts",
"style": "./packages/design-system/dist/index.css",
"exports": {
".": {
"types": "./packages/design-system/dist/index.d.ts",
"import": "./packages/design-system/dist/index.js",
"require": "./packages/design-system/dist/index.cjs"
},
"./tokens.css": "./packages/design-system/dist/index.css"
},
"files": [
"packages/design-system/dist"
],
"sideEffects": [
"**/*.css"
],
"scripts": {
"prepare": "npm install --prefix packages/design-system && npm run build --prefix packages/design-system"
},
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "@napps/design-system", "name": "@napps/design-system",
"version": "0.1.0", "version": "0.1.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@napps/design-system", "name": "@napps/design-system",
"version": "0.1.0", "version": "0.1.2",
"devDependencies": { "devDependencies": {
"@types/react": "^18.3.0", "@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
+2 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@napps/design-system", "name": "@napps/design-system",
"version": "0.1.0", "version": "0.1.5",
"private": false, "private": false,
"description": "Identité visuelle et bibliothèque de composants nApps — direction A4 (Précision / Vibrance)", "description": "Identité visuelle et bibliothèque de composants nApps — direction A4 (Précision / Vibrance)",
"type": "module", "type": "module",
@@ -23,6 +23,7 @@
"**/*.css" "**/*.css"
], ],
"scripts": { "scripts": {
"prepare": "tsup",
"build": "tsup", "build": "tsup",
"dev": "tsup --watch", "dev": "tsup --watch",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"
@@ -1,18 +1,22 @@
import { ButtonHTMLAttributes, forwardRef } from 'react'; import { ButtonHTMLAttributes, forwardRef } from 'react';
export type ButtonVariant = 'primary' | 'secondary'; export type ButtonVariant = 'primary' | 'secondary';
export type ButtonSize = 'regular' | 'compact';
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ButtonVariant; variant?: ButtonVariant;
/** "regular" (défaut, inchangé) ou "compact" (~34px, usages denses). */
size?: ButtonSize;
} }
export const Button = forwardRef<HTMLButtonElement, ButtonProps>( export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ variant = 'primary', className, ...props }, ref) => { ({ variant = 'primary', size = 'regular', className, ...props }, ref) => {
const variantClass = variant === 'primary' ? 'btn-primary' : 'btn-secondary'; const variantClass = variant === 'primary' ? 'btn-primary' : 'btn-secondary';
const sizeClass = size === 'compact' ? `${variantClass}--compact` : undefined;
return ( return (
<button <button
ref={ref} ref={ref}
className={[variantClass, className].filter(Boolean).join(' ')} className={[variantClass, sizeClass, className].filter(Boolean).join(' ')}
{...props} {...props}
/> />
); );
@@ -0,0 +1,71 @@
import { ButtonHTMLAttributes } from 'react';
export interface ColorPickerProps {
/** Couleur courante (hex). */
value: string;
onChange: (color: string) => void;
/**
* Palette fermée nApps — si fournie, affiche des pastilles cliquables.
* Sinon, ouvre le sélecteur de couleur natif du système via un input
* caché superposé au déclencheur rond.
*/
options?: string[];
disabled?: boolean;
'aria-label': string;
}
function Swatch({
color,
selected,
...props
}: { color: string; selected?: boolean } & ButtonHTMLAttributes<HTMLButtonElement>) {
return (
<button
type="button"
className={['color-swatch', selected && 'color-swatch--selected'].filter(Boolean).join(' ')}
style={{ background: color }}
aria-pressed={selected}
{...props}
>
{selected && (
<svg className="color-swatch__check" width="12" height="12" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M4 12.5L9.5 18L20 6" stroke="currentColor" strokeWidth="3.5" strokeLinecap="round" strokeLinejoin="round" />
</svg>
)}
</button>
);
}
export function ColorPicker({ value, onChange, options, disabled, ...props }: ColorPickerProps) {
const label = props['aria-label'];
if (options && options.length > 0) {
return (
<div className="color-picker" role="radiogroup" aria-label={label}>
{options.map((color) => (
<Swatch
key={color}
color={color}
selected={color.toLowerCase() === value.toLowerCase()}
disabled={disabled}
aria-label={color}
onClick={() => onChange(color)}
/>
))}
</div>
);
}
return (
<span className="color-swatch" style={{ background: value }}>
<input
type="color"
className="color-picker__input"
value={value}
disabled={disabled}
aria-label={label}
onChange={(e) => onChange(e.target.value)}
/>
</span>
);
}
@@ -1,19 +1,31 @@
import { HTMLAttributes, ReactNode } from 'react'; import { HTMLAttributes, ReactNode } from 'react';
export interface ListRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> { export interface ListRowProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
title: ReactNode; title: ReactNode;
subtitle?: ReactNode; subtitle?: ReactNode;
trailing?: ReactNode; trailing?: ReactNode;
} }
export function ListRow({ title, subtitle, trailing, className, ...props }: ListRowProps) { /**
* Rendue en <button> (focus clavier, hover/pressé via .list-row--interactive)
* dès qu'un onClick est fourni ; sinon en <div> statique, comportement
* inchangé pour tout usage existant.
*/
export function ListRow({ title, subtitle, trailing, className, onClick, ...props }: ListRowProps) {
const interactive = Boolean(onClick);
const Tag = interactive ? 'button' : 'div';
return ( return (
<div className={['list-row', className].filter(Boolean).join(' ')} {...props}> <Tag
type={interactive ? 'button' : undefined}
className={['list-row', interactive && 'list-row--interactive', className].filter(Boolean).join(' ')}
onClick={onClick}
{...props}
>
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div className="list-row__title">{title}</div> <div className="list-row__title">{title}</div>
{subtitle && <div className="list-row__subtitle">{subtitle}</div>} {subtitle && <div className="list-row__subtitle">{subtitle}</div>}
</div> </div>
{trailing && <div>{trailing}</div>} {trailing && <div>{trailing}</div>}
</div> </Tag>
); );
} }
@@ -1,12 +1,22 @@
import { SelectHTMLAttributes, forwardRef } from 'react'; import { SelectHTMLAttributes, forwardRef } from 'react';
export type SelectProps = SelectHTMLAttributes<HTMLSelectElement>; export type SelectSize = 'regular' | 'compact';
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
/** "regular" (défaut, ligne à hairline inchangée) ou "compact" (pilule pleine, ~34px). */
size?: SelectSize;
}
export const Select = forwardRef<HTMLSelectElement, SelectProps>( export const Select = forwardRef<HTMLSelectElement, SelectProps>(
({ className, ...props }, ref) => { ({ size = 'regular', className, ...props }, ref) => {
const compact = size === 'compact';
return ( return (
<div className="select-wrapper"> <div className={['select-wrapper', compact && 'select-wrapper--compact'].filter(Boolean).join(' ')}>
<select ref={ref} className={['select', className].filter(Boolean).join(' ')} {...props} /> <select
ref={ref}
className={['select', compact && 'select--compact', className].filter(Boolean).join(' ')}
{...props}
/>
<span className="select-chevron" aria-hidden="true"> <span className="select-chevron" aria-hidden="true">
<svg width="10" height="10" viewBox="0 0 10 10" fill="none"> <svg width="10" height="10" viewBox="0 0 10 10" fill="none">
<path d="M1 3.5L5 7.5L9 3.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" /> <path d="M1 3.5L5 7.5L9 3.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
@@ -1,7 +1,7 @@
import { ElementType, HTMLAttributes, ReactNode } from 'react'; import { ElementType, HTMLAttributes, ReactNode } from 'react';
export type SurfaceLevel = 'page' | 'grouped' | 'nested'; export type SurfaceLevel = 'page' | 'grouped' | 'nested';
export type MaterialVariant = 'control' | 'panel'; export type MaterialVariant = 'control' | 'panel' | 'popover';
export interface SurfaceProps extends HTMLAttributes<HTMLElement> { export interface SurfaceProps extends HTMLAttributes<HTMLElement> {
level?: SurfaceLevel; level?: SurfaceLevel;
@@ -12,9 +12,12 @@ export interface SurfaceProps extends HTMLAttributes<HTMLElement> {
/** /**
* Couche de fond. `level` suit la hiérarchie page → grouped → nested (couleur, * Couche de fond. `level` suit la hiérarchie page → grouped → nested (couleur,
* jamais d'ombre). `material` superpose une des deux recettes de verre — * jamais d'ombre). `material` superpose une des trois recettes de verre —
* "control" pour un élément flottant isolé, "panel" pour une grande surface * "control" pour un élément flottant isolé sur du contenu qui défile,
* de dialogue — au lieu du niveau de couleur. * "panel" pour une grande surface de dialogue (toujours avec un scrim
* assombri derrière, sinon illisible), "popover" pour un menu/popover
* flottant directement sur du contenu de page sans scrim — au lieu du
* niveau de couleur.
*/ */
export function Surface({ level = 'grouped', material, as: Component = 'div', className, children, ...props }: SurfaceProps) { export function Surface({ level = 'grouped', material, as: Component = 'div', className, children, ...props }: SurfaceProps) {
const classes = material const classes = material
@@ -1,21 +1,21 @@
import { InputHTMLAttributes, forwardRef } from 'react'; import { InputHTMLAttributes, forwardRef } from 'react';
export type TextFieldProps = InputHTMLAttributes<HTMLInputElement>; export type TextFieldSize = 'regular' | 'compact';
export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
/** "regular" (défaut, ligne à hairline inchangée) ou "compact" (pilule pleine, ~34px). */
size?: TextFieldSize;
}
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>( export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
({ className, style, ...props }, ref) => { ({ size = 'regular', className, ...props }, ref) => {
const compact = size === 'compact';
return ( return (
<input <input
ref={ref} ref={ref}
className={['text-field', 'text-body', className].filter(Boolean).join(' ')} className={['text-field', 'text-body', compact && 'text-field--compact', className]
style={{ .filter(Boolean)
border: 'none', .join(' ')}
outline: 'none',
width: '100%',
background: 'transparent',
color: 'var(--label-primary)',
...style,
}}
{...props} {...props}
/> />
); );
+6 -3
View File
@@ -1,7 +1,7 @@
import './tokens.css'; import './tokens.css';
export { Button } from './components/Button'; export { Button } from './components/Button';
export type { ButtonProps, ButtonVariant } from './components/Button'; export type { ButtonProps, ButtonVariant, ButtonSize } from './components/Button';
export { SegmentedControl } from './components/SegmentedControl'; export { SegmentedControl } from './components/SegmentedControl';
export type { SegmentedControlProps, SegmentedControlOption } from './components/SegmentedControl'; export type { SegmentedControlProps, SegmentedControlOption } from './components/SegmentedControl';
@@ -10,7 +10,7 @@ export { Toggle } from './components/Toggle';
export type { ToggleProps } from './components/Toggle'; export type { ToggleProps } from './components/Toggle';
export { TextField } from './components/TextField'; export { TextField } from './components/TextField';
export type { TextFieldProps } from './components/TextField'; export type { TextFieldProps, TextFieldSize } from './components/TextField';
export { ListRow } from './components/ListRow'; export { ListRow } from './components/ListRow';
export type { ListRowProps } from './components/ListRow'; export type { ListRowProps } from './components/ListRow';
@@ -37,7 +37,7 @@ export { Radio } from './components/Radio';
export type { RadioProps } from './components/Radio'; export type { RadioProps } from './components/Radio';
export { Select } from './components/Select'; export { Select } from './components/Select';
export type { SelectProps } from './components/Select'; export type { SelectProps, SelectSize } from './components/Select';
export { Spinner } from './components/Spinner'; export { Spinner } from './components/Spinner';
export type { SpinnerProps, SpinnerSize } from './components/Spinner'; export type { SpinnerProps, SpinnerSize } from './components/Spinner';
@@ -53,3 +53,6 @@ export type { TabBarProps, TabBarItem } from './components/TabBar';
export { Toolbar } from './components/Toolbar'; export { Toolbar } from './components/Toolbar';
export type { ToolbarProps } from './components/Toolbar'; export type { ToolbarProps } from './components/Toolbar';
export { ColorPicker } from './components/ColorPicker';
export type { ColorPickerProps } from './components/ColorPicker';
+216 -27
View File
@@ -47,6 +47,24 @@
/* ===== Cible tactile minimale ===== */ /* ===== Cible tactile minimale ===== */
--tap-target-min: 44px; --tap-target-min: 44px;
--control-height-compact: 34px;
/* ===== Espacement — dérivé des valeurs réellement observées dans le kit
audité, pas d'une grille 4pt appliquée mécaniquement. --space-4 (14px)
vient exactement du padding de l'Action Sheet/Alert card ; --space-5
(16px) du padding des List Row/Text Field/Toolbar ; --space-6 (20px)
du padding horizontal du bouton Bordered-Prominent Large. --space-7/8
étendent la base à 6 crans demandée pour couvrir les grands espacements
déjà en usage (Empty State). Théorique et sans dépendance au thème —
aucune valeur dark distincte n'est nécessaire ici. */
--space-1: 2px;
--space-2: 4px;
--space-3: 8px;
--space-4: 14px;
--space-5: 16px;
--space-6: 20px;
--space-7: 24px;
--space-8: 48px;
/* ===== Typographie — échelle réelle (points Apple), police nApps (Manrope) ===== /* ===== Typographie — échelle réelle (points Apple), police nApps (Manrope) =====
Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait
@@ -96,9 +114,18 @@
} }
/* ============================================================ /* ============================================================
MATÉRIAUX — DEUX familles seulement (pas une par composant) : MATÉRIAUX — TROIS familles (pas une par composant) :
1. "control" — bouton flottant, barre d'outils, capsule isolée 1. "control" — bouton flottant, barre d'outils, capsule isolée,
2. "panel" — grande surface de dialogue (feuille, menu contextuel) posé sur du contenu qui défile derrière lui.
2. "panel" — grande surface de dialogue, TOUJOURS avec un scrim
assombri derrière (voir .dialog-overlay) — jamais directement
sur du contenu de page, il y devient illisible.
3. "popover" — menu/popover flottant SANS scrim, posé directement
sur du contenu de page réel (ex. un menu de navigation). Plus
opaque que "control" pour rester lisible sans fond assombri.
Calibré sur la 3e nuance de verre observée dans l'audit du kit
(Popovers, blur 65px, ombre 0 10px 50px) — voir
figma-kit-audit.md.
============================================================ */ ============================================================ */
.material-control { .material-control {
background: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.55);
@@ -132,6 +159,33 @@
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5); box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
} }
/* Popover — background/box-shadow light directement audités (0.72
d'opacité, ombre 0 10px 50px rgba(0,0,0,.3) exacte). En dark,
aucune nuance popover indépendante n'a été auditée : on réutilise
tel quel le fond et l'ombre de .material-control dark (déjà
vérifiés) plutôt que d'extrapoler une valeur non vérifiée — seul
le flou (65px, un paramètre physique, pas une couleur) est repris
du popover light. Asymétrie assumée, à corriger si un jour une
vraie extraction dark du popover est disponible. */
.material-popover {
background: rgba(255, 255, 255, 0.72);
backdrop-filter: blur(65px) saturate(1.6);
-webkit-backdrop-filter: blur(65px) saturate(1.6);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.6),
inset 0 -1px 0 rgba(0, 0, 0, 0.04),
0 10px 50px rgba(0, 0, 0, 0.3);
}
:root[data-theme="dark"] .material-popover {
background: rgba(38, 41, 48, 0.5);
backdrop-filter: blur(65px) saturate(1.4);
-webkit-backdrop-filter: blur(65px) saturate(1.4);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.06),
inset 0 -1px 0 rgba(0, 0, 0, 0.3),
0 8px 15px rgba(0, 0, 0, 0.35);
}
/* ============================================================ /* ============================================================
COMPOSANTS de référence — construits uniquement à partir des COMPOSANTS de référence — construits uniquement à partir des
tokens ci-dessus. Aucune valeur ad hoc. tokens ci-dessus. Aucune valeur ad hoc.
@@ -144,10 +198,15 @@
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
min-height: var(--tap-target-min); min-height: var(--tap-target-min);
padding: 0 22px; padding: 0 var(--space-6);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking); letter-spacing: var(--text-body-tracking);
} }
.btn-primary--compact {
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
font-size: var(--text-subheadline-size);
}
/* Bouton secondaire discret (= Bordered d'Apple — PAS un contour) */ /* Bouton secondaire discret (= Bordered d'Apple — PAS un contour) */
.btn-secondary { .btn-secondary {
@@ -156,21 +215,26 @@
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
min-height: var(--tap-target-min); min-height: var(--tap-target-min);
padding: 0 22px; padding: 0 var(--space-6);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking); letter-spacing: var(--text-body-tracking);
} }
.btn-secondary--compact {
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
font-size: var(--text-subheadline-size);
}
/* Segmented control */ /* Segmented control */
.segmented-control { .segmented-control {
display: inline-flex; display: inline-flex;
background: var(--fill-tertiary); background: var(--fill-tertiary);
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
padding: 2px; padding: var(--space-1);
gap: 2px; gap: var(--space-1);
} }
.segmented-control__item { .segmented-control__item {
padding: 3px 12px; padding: 3px var(--space-4);
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
font-size: 13.3px; font-size: 13.3px;
font-weight: 510; font-weight: 510;
@@ -198,28 +262,48 @@
width: 24px; height: 24px; width: 24px; height: 24px;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
background: #FFFFFF; background: #FFFFFF;
position: absolute; top: 2px; left: 2px; position: absolute; top: var(--space-1); left: var(--space-1);
} }
.toggle--on .toggle__knob { left: auto; right: 2px; } .toggle--on .toggle__knob { left: auto; right: var(--space-1); }
/* List row */ /* List row */
.list-row { .list-row {
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
padding: 0 16px; padding: 0 var(--space-5);
min-height: 52px; min-height: 52px;
display: flex; align-items: center; display: flex; align-items: center;
width: 100%;
text-align: left;
background: none;
font-family: inherit;
} }
.list-row__title { font-size: var(--text-body-size); color: var(--label-primary); } .list-row__title { font-size: var(--text-body-size); color: var(--label-primary); }
.list-row__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); } .list-row__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); }
.list-row--interactive { cursor: pointer; }
/* Text field */ /* Text field */
.text-field { .text-field {
border: none;
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
padding: 16px; outline: none;
width: 100%;
background: transparent;
color: var(--label-primary);
padding: var(--space-5);
min-height: 52px; min-height: 52px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.text-field--placeholder { color: var(--label-tertiary); } .text-field--placeholder { color: var(--label-tertiary); }
.text-field__cursor { width: 2px; height: 22px; border-radius: 10px; background: var(--napps-accent); } .text-field__cursor { width: 2px; height: 22px; border-radius: 10px; background: var(--napps-accent); }
.text-field--compact {
border-top: none;
background: var(--fill-secondary);
border-radius: var(--radius-pill);
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
}
/* Empty state — badge circulaire réutilisable (Activity View + Empty State du kit) */ /* Empty state — badge circulaire réutilisable (Activity View + Empty State du kit) */
.icon-badge { .icon-badge {
@@ -266,7 +350,7 @@
.card { .card {
background: var(--bg-grouped); background: var(--bg-grouped);
border-radius: var(--radius-card-lg); border-radius: var(--radius-card-lg);
padding: 18px; padding: var(--space-5);
} }
/* ============================================================ /* ============================================================
@@ -275,8 +359,8 @@
.badge { .badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 4px; gap: var(--space-2);
padding: 3px 9px; padding: 3px var(--space-3);
border-radius: 8px; border-radius: 8px;
font-size: var(--text-caption1-size); font-size: var(--text-caption1-size);
font-weight: 600; font-weight: 600;
@@ -312,17 +396,31 @@
border: none; border: none;
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
background: transparent; background: transparent;
padding: 16px 32px 16px 0; padding: var(--space-5) 32px var(--space-5) var(--space-5);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
color: var(--label-primary); color: var(--label-primary);
cursor: pointer; cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.select-chevron { .select-chevron {
position: absolute; right: 4px; top: 50%; transform: translateY(-50%); position: absolute; right: var(--space-2); top: 50%; transform: translateY(-50%);
pointer-events: none; pointer-events: none;
color: var(--label-tertiary); color: var(--label-tertiary);
font-size: 12px; font-size: 12px;
} }
/* Compacte — reprend la recette du Search Field du kit audité (fond
fill-secondary en pilule) plutôt que la ligne à hairline du regular,
adaptée aux barres de filtres / actions inline de liste. */
.select--compact {
border-top: none;
background: var(--fill-secondary);
border-radius: var(--radius-pill);
min-height: var(--control-height-compact);
padding: 0 var(--space-6) 0 var(--space-4);
}
.select-wrapper--compact .select-chevron { right: var(--space-3); }
/* ============================================================ /* ============================================================
FEEDBACK — spinner, empty state, dialog (verre de panneau). FEEDBACK — spinner, empty state, dialog (verre de panneau).
@@ -344,27 +442,27 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
gap: 12px; gap: var(--space-4);
padding: 48px 24px; padding: var(--space-8) var(--space-7);
} }
.dialog-overlay { .dialog-overlay {
position: fixed; inset: 0; position: fixed; inset: 0;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
padding: 20px; padding: var(--space-6);
z-index: 1000; z-index: 1000;
} }
.dialog { .dialog {
width: 100%; max-width: 270px; width: 100%; max-width: 270px;
border-radius: 20px; border-radius: 20px;
padding: 14px; padding: var(--space-4);
display: flex; flex-direction: column; gap: 12px; display: flex; flex-direction: column; gap: var(--space-4);
text-align: center; text-align: center;
} }
.dialog__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); margin: 0; } .dialog__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); margin: 0; }
.dialog__message { font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); color: var(--label-primary); margin: 0; } .dialog__message { font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); color: var(--label-primary); margin: 0; }
.dialog__actions { display: flex; flex-direction: column; gap: 8px; } .dialog__actions { display: flex; flex-direction: column; gap: var(--space-3); }
.dialog__action { .dialog__action {
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
@@ -380,7 +478,7 @@
NAVIGATION — tab bar flottante et toolbar, toutes deux en NAVIGATION — tab bar flottante et toolbar, toutes deux en
"verre de contrôle" (.material-control), jamais en aplat. "verre de contrôle" (.material-control), jamais en aplat.
============================================================ */ ============================================================ */
.tab-bar { display: inline-flex; gap: 4px; padding: 6px; } .tab-bar { display: inline-flex; gap: var(--space-2); padding: 6px; }
.tab-bar__item { .tab-bar__item {
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
min-width: 56px; min-height: var(--tap-target-min); min-width: 56px; min-height: var(--tap-target-min);
@@ -393,10 +491,101 @@
.tab-bar__item--active { color: var(--napps-accent); } .tab-bar__item--active { color: var(--napps-accent); }
.toolbar { .toolbar {
display: flex; align-items: center; justify-content: space-between; gap: 12px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
padding: 0 6px 0 16px; padding: 0 6px 0 var(--space-5);
min-height: 52px; min-height: 52px;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
} }
.toolbar__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); } .toolbar__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); }
.toolbar__actions { display: flex; align-items: center; gap: 4px; } .toolbar__actions { display: flex; align-items: center; gap: var(--space-2); }
/* ============================================================
ÉTATS D'INTERACTION — hover (pointeur uniquement, jamais collé
au tactile), pressé (discret, pas d'animation voyante), focus
clavier visible (focus-visible seulement, jamais au clic souris).
Limité strictement aux contrôles qui en manquaient : btn-primary,
btn-secondary, select, checkbox, radio, toggle, tab-bar__item,
list-row (variante --interactive). Toutes les couleurs viennent de
tokens déjà vérifiés indépendamment en dark — aucune nouvelle
valeur de couleur brute n'est introduite ici.
v0.1.4 : Button n'avait pas d'état :disabled (Checkbox/Radio si) —
ajouté avec la même opacité 0.5, et les hover/pressé de Button
sont désormais exclus quand disabled (focus-visible n'a pas besoin
du même garde-fou : un <button disabled> n'est jamais focusable).
============================================================ */
:where(.btn-primary, .btn-secondary, .select, .checkbox, .radio, .toggle, .tab-bar__item, .list-row--interactive) {
transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease, filter 120ms ease;
}
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) {
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.btn-secondary:hover:not(:disabled) { background: var(--fill-secondary); }
.select:hover { background: var(--fill-tertiary); }
.checkbox:not(.checkbox--checked):hover:not(:disabled),
.radio:not(.radio--checked):hover:not(:disabled) { background: var(--fill-secondary); }
.checkbox--checked:hover:not(:disabled),
.radio--checked:hover:not(:disabled) { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.toggle:hover { filter: brightness(0.96); }
.tab-bar__item:hover:not(.tab-bar__item--active) { color: var(--label-primary); }
.list-row--interactive:hover { background: var(--fill-tertiary); }
}
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.select:active,
.checkbox:active:not(:disabled),
.radio:active:not(:disabled),
.toggle:active,
.tab-bar__item:active,
.list-row--interactive:active {
opacity: 0.7;
transform: scale(0.97);
}
:where(.btn-primary, .btn-secondary, .select, .checkbox, .radio, .toggle, .tab-bar__item, .list-row--interactive):focus-visible {
outline: 2px solid var(--napps-accent);
outline-offset: 2px;
}
/* ============================================================
COLOR PICKER — sélecteur rond, même logique que icon-badge mais
dédié à afficher/choisir une couleur arbitraire (catégorie,
étiquette, tag). L'anneau vient de tokens de surface déjà
vérifiés en dark (bg-grouped, separator), pas de nouvelle valeur.
============================================================ */
.color-picker { display: inline-flex; gap: var(--space-3); flex-wrap: wrap; }
.color-swatch {
position: relative;
width: 28px; height: 28px;
border-radius: var(--radius-pill);
border: 2px solid var(--bg-grouped);
box-shadow: 0 0 0 1px var(--separator);
padding: 0;
cursor: pointer;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
.color-swatch--selected {
box-shadow: 0 0 0 2px var(--bg-grouped), 0 0 0 4px var(--napps-accent);
}
.color-swatch:focus-visible {
outline: 2px solid var(--napps-accent);
outline-offset: 2px;
}
.color-swatch__check {
color: #FFFFFF;
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}
.color-picker__input {
position: absolute; inset: 0;
opacity: 0;
cursor: pointer;
border: none;
padding: 0;
width: 100%;
height: 100%;
}
+216 -27
View File
@@ -47,6 +47,24 @@
/* ===== Cible tactile minimale ===== */ /* ===== Cible tactile minimale ===== */
--tap-target-min: 44px; --tap-target-min: 44px;
--control-height-compact: 34px;
/* ===== Espacement — dérivé des valeurs réellement observées dans le kit
audité, pas d'une grille 4pt appliquée mécaniquement. --space-4 (14px)
vient exactement du padding de l'Action Sheet/Alert card ; --space-5
(16px) du padding des List Row/Text Field/Toolbar ; --space-6 (20px)
du padding horizontal du bouton Bordered-Prominent Large. --space-7/8
étendent la base à 6 crans demandée pour couvrir les grands espacements
déjà en usage (Empty State). Théorique et sans dépendance au thème —
aucune valeur dark distincte n'est nécessaire ici. */
--space-1: 2px;
--space-2: 4px;
--space-3: 8px;
--space-4: 14px;
--space-5: 16px;
--space-6: 20px;
--space-7: 24px;
--space-8: 48px;
/* ===== Typographie — échelle réelle (points Apple), police nApps (Manrope) ===== /* ===== Typographie — échelle réelle (points Apple), police nApps (Manrope) =====
Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait
@@ -96,9 +114,18 @@
} }
/* ============================================================ /* ============================================================
MATÉRIAUX — DEUX familles seulement (pas une par composant) : MATÉRIAUX — TROIS familles (pas une par composant) :
1. "control" — bouton flottant, barre d'outils, capsule isolée 1. "control" — bouton flottant, barre d'outils, capsule isolée,
2. "panel" — grande surface de dialogue (feuille, menu contextuel) posé sur du contenu qui défile derrière lui.
2. "panel" — grande surface de dialogue, TOUJOURS avec un scrim
assombri derrière (voir .dialog-overlay) — jamais directement
sur du contenu de page, il y devient illisible.
3. "popover" — menu/popover flottant SANS scrim, posé directement
sur du contenu de page réel (ex. un menu de navigation). Plus
opaque que "control" pour rester lisible sans fond assombri.
Calibré sur la 3e nuance de verre observée dans l'audit du kit
(Popovers, blur 65px, ombre 0 10px 50px) — voir
figma-kit-audit.md.
============================================================ */ ============================================================ */
.material-control { .material-control {
background: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.55);
@@ -132,6 +159,33 @@
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5); box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
} }
/* Popover — background/box-shadow light directement audités (0.72
d'opacité, ombre 0 10px 50px rgba(0,0,0,.3) exacte). En dark,
aucune nuance popover indépendante n'a été auditée : on réutilise
tel quel le fond et l'ombre de .material-control dark (déjà
vérifiés) plutôt que d'extrapoler une valeur non vérifiée — seul
le flou (65px, un paramètre physique, pas une couleur) est repris
du popover light. Asymétrie assumée, à corriger si un jour une
vraie extraction dark du popover est disponible. */
.material-popover {
background: rgba(255, 255, 255, 0.72);
backdrop-filter: blur(65px) saturate(1.6);
-webkit-backdrop-filter: blur(65px) saturate(1.6);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.6),
inset 0 -1px 0 rgba(0, 0, 0, 0.04),
0 10px 50px rgba(0, 0, 0, 0.3);
}
:root[data-theme="dark"] .material-popover {
background: rgba(38, 41, 48, 0.5);
backdrop-filter: blur(65px) saturate(1.4);
-webkit-backdrop-filter: blur(65px) saturate(1.4);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.06),
inset 0 -1px 0 rgba(0, 0, 0, 0.3),
0 8px 15px rgba(0, 0, 0, 0.35);
}
/* ============================================================ /* ============================================================
COMPOSANTS de référence — construits uniquement à partir des COMPOSANTS de référence — construits uniquement à partir des
tokens ci-dessus. Aucune valeur ad hoc. tokens ci-dessus. Aucune valeur ad hoc.
@@ -144,10 +198,15 @@
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
min-height: var(--tap-target-min); min-height: var(--tap-target-min);
padding: 0 22px; padding: 0 var(--space-6);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking); letter-spacing: var(--text-body-tracking);
} }
.btn-primary--compact {
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
font-size: var(--text-subheadline-size);
}
/* Bouton secondaire discret (= Bordered d'Apple — PAS un contour) */ /* Bouton secondaire discret (= Bordered d'Apple — PAS un contour) */
.btn-secondary { .btn-secondary {
@@ -156,21 +215,26 @@
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
min-height: var(--tap-target-min); min-height: var(--tap-target-min);
padding: 0 22px; padding: 0 var(--space-6);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking); letter-spacing: var(--text-body-tracking);
} }
.btn-secondary--compact {
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
font-size: var(--text-subheadline-size);
}
/* Segmented control */ /* Segmented control */
.segmented-control { .segmented-control {
display: inline-flex; display: inline-flex;
background: var(--fill-tertiary); background: var(--fill-tertiary);
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
padding: 2px; padding: var(--space-1);
gap: 2px; gap: var(--space-1);
} }
.segmented-control__item { .segmented-control__item {
padding: 3px 12px; padding: 3px var(--space-4);
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
font-size: 13.3px; font-size: 13.3px;
font-weight: 510; font-weight: 510;
@@ -198,28 +262,48 @@
width: 24px; height: 24px; width: 24px; height: 24px;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
background: #FFFFFF; background: #FFFFFF;
position: absolute; top: 2px; left: 2px; position: absolute; top: var(--space-1); left: var(--space-1);
} }
.toggle--on .toggle__knob { left: auto; right: 2px; } .toggle--on .toggle__knob { left: auto; right: var(--space-1); }
/* List row */ /* List row */
.list-row { .list-row {
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
padding: 0 16px; padding: 0 var(--space-5);
min-height: 52px; min-height: 52px;
display: flex; align-items: center; display: flex; align-items: center;
width: 100%;
text-align: left;
background: none;
font-family: inherit;
} }
.list-row__title { font-size: var(--text-body-size); color: var(--label-primary); } .list-row__title { font-size: var(--text-body-size); color: var(--label-primary); }
.list-row__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); } .list-row__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); }
.list-row--interactive { cursor: pointer; }
/* Text field */ /* Text field */
.text-field { .text-field {
border: none;
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
padding: 16px; outline: none;
width: 100%;
background: transparent;
color: var(--label-primary);
padding: var(--space-5);
min-height: 52px; min-height: 52px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.text-field--placeholder { color: var(--label-tertiary); } .text-field--placeholder { color: var(--label-tertiary); }
.text-field__cursor { width: 2px; height: 22px; border-radius: 10px; background: var(--napps-accent); } .text-field__cursor { width: 2px; height: 22px; border-radius: 10px; background: var(--napps-accent); }
.text-field--compact {
border-top: none;
background: var(--fill-secondary);
border-radius: var(--radius-pill);
min-height: var(--control-height-compact);
padding: 0 var(--space-4);
}
/* Empty state — badge circulaire réutilisable (Activity View + Empty State du kit) */ /* Empty state — badge circulaire réutilisable (Activity View + Empty State du kit) */
.icon-badge { .icon-badge {
@@ -266,7 +350,7 @@
.card { .card {
background: var(--bg-grouped); background: var(--bg-grouped);
border-radius: var(--radius-card-lg); border-radius: var(--radius-card-lg);
padding: 18px; padding: var(--space-5);
} }
/* ============================================================ /* ============================================================
@@ -275,8 +359,8 @@
.badge { .badge {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 4px; gap: var(--space-2);
padding: 3px 9px; padding: 3px var(--space-3);
border-radius: 8px; border-radius: 8px;
font-size: var(--text-caption1-size); font-size: var(--text-caption1-size);
font-weight: 600; font-weight: 600;
@@ -312,17 +396,31 @@
border: none; border: none;
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
background: transparent; background: transparent;
padding: 16px 32px 16px 0; padding: var(--space-5) 32px var(--space-5) var(--space-5);
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
color: var(--label-primary); color: var(--label-primary);
cursor: pointer; cursor: pointer;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.select-chevron { .select-chevron {
position: absolute; right: 4px; top: 50%; transform: translateY(-50%); position: absolute; right: var(--space-2); top: 50%; transform: translateY(-50%);
pointer-events: none; pointer-events: none;
color: var(--label-tertiary); color: var(--label-tertiary);
font-size: 12px; font-size: 12px;
} }
/* Compacte — reprend la recette du Search Field du kit audité (fond
fill-secondary en pilule) plutôt que la ligne à hairline du regular,
adaptée aux barres de filtres / actions inline de liste. */
.select--compact {
border-top: none;
background: var(--fill-secondary);
border-radius: var(--radius-pill);
min-height: var(--control-height-compact);
padding: 0 var(--space-6) 0 var(--space-4);
}
.select-wrapper--compact .select-chevron { right: var(--space-3); }
/* ============================================================ /* ============================================================
FEEDBACK — spinner, empty state, dialog (verre de panneau). FEEDBACK — spinner, empty state, dialog (verre de panneau).
@@ -344,27 +442,27 @@
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
text-align: center; text-align: center;
gap: 12px; gap: var(--space-4);
padding: 48px 24px; padding: var(--space-8) var(--space-7);
} }
.dialog-overlay { .dialog-overlay {
position: fixed; inset: 0; position: fixed; inset: 0;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
display: flex; align-items: center; justify-content: center; display: flex; align-items: center; justify-content: center;
padding: 20px; padding: var(--space-6);
z-index: 1000; z-index: 1000;
} }
.dialog { .dialog {
width: 100%; max-width: 270px; width: 100%; max-width: 270px;
border-radius: 20px; border-radius: 20px;
padding: 14px; padding: var(--space-4);
display: flex; flex-direction: column; gap: 12px; display: flex; flex-direction: column; gap: var(--space-4);
text-align: center; text-align: center;
} }
.dialog__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); margin: 0; } .dialog__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); margin: 0; }
.dialog__message { font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); color: var(--label-primary); margin: 0; } .dialog__message { font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); color: var(--label-primary); margin: 0; }
.dialog__actions { display: flex; flex-direction: column; gap: 8px; } .dialog__actions { display: flex; flex-direction: column; gap: var(--space-3); }
.dialog__action { .dialog__action {
border: none; border: none;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
@@ -380,7 +478,7 @@
NAVIGATION — tab bar flottante et toolbar, toutes deux en NAVIGATION — tab bar flottante et toolbar, toutes deux en
"verre de contrôle" (.material-control), jamais en aplat. "verre de contrôle" (.material-control), jamais en aplat.
============================================================ */ ============================================================ */
.tab-bar { display: inline-flex; gap: 4px; padding: 6px; } .tab-bar { display: inline-flex; gap: var(--space-2); padding: 6px; }
.tab-bar__item { .tab-bar__item {
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
min-width: 56px; min-height: var(--tap-target-min); min-width: 56px; min-height: var(--tap-target-min);
@@ -393,10 +491,101 @@
.tab-bar__item--active { color: var(--napps-accent); } .tab-bar__item--active { color: var(--napps-accent); }
.toolbar { .toolbar {
display: flex; align-items: center; justify-content: space-between; gap: 12px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
padding: 0 6px 0 16px; padding: 0 6px 0 var(--space-5);
min-height: 52px; min-height: 52px;
border-radius: var(--radius-pill); border-radius: var(--radius-pill);
} }
.toolbar__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); } .toolbar__title { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); color: var(--label-primary); }
.toolbar__actions { display: flex; align-items: center; gap: 4px; } .toolbar__actions { display: flex; align-items: center; gap: var(--space-2); }
/* ============================================================
ÉTATS D'INTERACTION — hover (pointeur uniquement, jamais collé
au tactile), pressé (discret, pas d'animation voyante), focus
clavier visible (focus-visible seulement, jamais au clic souris).
Limité strictement aux contrôles qui en manquaient : btn-primary,
btn-secondary, select, checkbox, radio, toggle, tab-bar__item,
list-row (variante --interactive). Toutes les couleurs viennent de
tokens déjà vérifiés indépendamment en dark — aucune nouvelle
valeur de couleur brute n'est introduite ici.
v0.1.4 : Button n'avait pas d'état :disabled (Checkbox/Radio si) —
ajouté avec la même opacité 0.5, et les hover/pressé de Button
sont désormais exclus quand disabled (focus-visible n'a pas besoin
du même garde-fou : un <button disabled> n'est jamais focusable).
============================================================ */
:where(.btn-primary, .btn-secondary, .select, .checkbox, .radio, .toggle, .tab-bar__item, .list-row--interactive) {
transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease, filter 120ms ease;
}
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) {
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.btn-secondary:hover:not(:disabled) { background: var(--fill-secondary); }
.select:hover { background: var(--fill-tertiary); }
.checkbox:not(.checkbox--checked):hover:not(:disabled),
.radio:not(.radio--checked):hover:not(:disabled) { background: var(--fill-secondary); }
.checkbox--checked:hover:not(:disabled),
.radio--checked:hover:not(:disabled) { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.toggle:hover { filter: brightness(0.96); }
.tab-bar__item:hover:not(.tab-bar__item--active) { color: var(--label-primary); }
.list-row--interactive:hover { background: var(--fill-tertiary); }
}
.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.select:active,
.checkbox:active:not(:disabled),
.radio:active:not(:disabled),
.toggle:active,
.tab-bar__item:active,
.list-row--interactive:active {
opacity: 0.7;
transform: scale(0.97);
}
:where(.btn-primary, .btn-secondary, .select, .checkbox, .radio, .toggle, .tab-bar__item, .list-row--interactive):focus-visible {
outline: 2px solid var(--napps-accent);
outline-offset: 2px;
}
/* ============================================================
COLOR PICKER — sélecteur rond, même logique que icon-badge mais
dédié à afficher/choisir une couleur arbitraire (catégorie,
étiquette, tag). L'anneau vient de tokens de surface déjà
vérifiés en dark (bg-grouped, separator), pas de nouvelle valeur.
============================================================ */
.color-picker { display: inline-flex; gap: var(--space-3); flex-wrap: wrap; }
.color-swatch {
position: relative;
width: 28px; height: 28px;
border-radius: var(--radius-pill);
border: 2px solid var(--bg-grouped);
box-shadow: 0 0 0 1px var(--separator);
padding: 0;
cursor: pointer;
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: center;
}
.color-swatch--selected {
box-shadow: 0 0 0 2px var(--bg-grouped), 0 0 0 4px var(--napps-accent);
}
.color-swatch:focus-visible {
outline: 2px solid var(--napps-accent);
outline-offset: 2px;
}
.color-swatch__check {
color: #FFFFFF;
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.5));
}
.color-picker__input {
position: absolute; inset: 0;
opacity: 0;
cursor: pointer;
border: none;
padding: 0;
width: 100%;
height: 100%;
}