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.
This commit is contained in:
2026-09-18 19:04:48 +02:00
parent 1286a0e3d9
commit dc74b1b97b
11 changed files with 489 additions and 74 deletions
+38
View File
@@ -80,6 +80,44 @@ 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
inversion des tokens light (voir `figma-kit-audit.md`, section "Découverte majeure").
## 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"
/>
```
## Développer le package
```bash
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -1,18 +1,22 @@
import { ButtonHTMLAttributes, forwardRef } from 'react';
export type ButtonVariant = 'primary' | 'secondary';
export type ButtonSize = 'regular' | 'compact';
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ButtonVariant;
/** "regular" (défaut, inchangé) ou "compact" (~34px, usages denses). */
size?: ButtonSize;
}
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 sizeClass = size === 'compact' ? `${variantClass}--compact` : undefined;
return (
<button
ref={ref}
className={[variantClass, className].filter(Boolean).join(' ')}
className={[variantClass, sizeClass, className].filter(Boolean).join(' ')}
{...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';
export interface ListRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
export interface ListRowProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
title: ReactNode;
subtitle?: 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 (
<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 className="list-row__title">{title}</div>
{subtitle && <div className="list-row__subtitle">{subtitle}</div>}
</div>
{trailing && <div>{trailing}</div>}
</div>
</Tag>
);
}
@@ -1,12 +1,22 @@
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>(
({ className, ...props }, ref) => {
({ size = 'regular', className, ...props }, ref) => {
const compact = size === 'compact';
return (
<div className="select-wrapper">
<select ref={ref} className={['select', className].filter(Boolean).join(' ')} {...props} />
<div className={['select-wrapper', compact && 'select-wrapper--compact'].filter(Boolean).join(' ')}>
<select
ref={ref}
className={['select', compact && 'select--compact', className].filter(Boolean).join(' ')}
{...props}
/>
<span className="select-chevron" aria-hidden="true">
<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" />
@@ -1,21 +1,21 @@
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>(
({ className, style, ...props }, ref) => {
({ size = 'regular', className, ...props }, ref) => {
const compact = size === 'compact';
return (
<input
ref={ref}
className={['text-field', 'text-body', className].filter(Boolean).join(' ')}
style={{
border: 'none',
outline: 'none',
width: '100%',
background: 'transparent',
color: 'var(--label-primary)',
...style,
}}
className={['text-field', 'text-body', compact && 'text-field--compact', className]
.filter(Boolean)
.join(' ')}
{...props}
/>
);
+6 -3
View File
@@ -1,7 +1,7 @@
import './tokens.css';
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 type { SegmentedControlProps, SegmentedControlOption } from './components/SegmentedControl';
@@ -10,7 +10,7 @@ export { Toggle } from './components/Toggle';
export type { ToggleProps } from './components/Toggle';
export { TextField } from './components/TextField';
export type { TextFieldProps } from './components/TextField';
export type { TextFieldProps, TextFieldSize } from './components/TextField';
export { ListRow } 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 { Select } from './components/Select';
export type { SelectProps } from './components/Select';
export type { SelectProps, SelectSize } from './components/Select';
export { Spinner } 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 type { ToolbarProps } from './components/Toolbar';
export { ColorPicker } from './components/ColorPicker';
export type { ColorPickerProps } from './components/ColorPicker';
+160 -24
View File
@@ -47,6 +47,24 @@
/* ===== Cible tactile minimale ===== */
--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) =====
Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait
@@ -144,10 +162,15 @@
border: none;
border-radius: var(--radius-pill);
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);
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) */
.btn-secondary {
@@ -156,21 +179,26 @@
border: none;
border-radius: var(--radius-pill);
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);
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 {
display: inline-flex;
background: var(--fill-tertiary);
border-radius: var(--radius-pill);
padding: 2px;
gap: 2px;
padding: var(--space-1);
gap: var(--space-1);
}
.segmented-control__item {
padding: 3px 12px;
padding: 3px var(--space-4);
border-radius: var(--radius-pill);
font-size: 13.3px;
font-weight: 510;
@@ -198,28 +226,40 @@
width: 24px; height: 24px;
border-radius: var(--radius-pill);
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 {
border-top: 1px solid var(--separator);
padding: 0 16px;
padding: 0 var(--space-5);
min-height: 52px;
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__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); }
.list-row--interactive { cursor: pointer; }
/* Text field */
.text-field {
border-top: 1px solid var(--separator);
padding: 16px;
padding: var(--space-5);
min-height: 52px;
}
.text-field--placeholder { color: var(--label-tertiary); }
.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) */
.icon-badge {
@@ -266,7 +306,7 @@
.card {
background: var(--bg-grouped);
border-radius: var(--radius-card-lg);
padding: 18px;
padding: var(--space-5);
}
/* ============================================================
@@ -275,8 +315,8 @@
.badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 9px;
gap: var(--space-2);
padding: 3px var(--space-3);
border-radius: 8px;
font-size: var(--text-caption1-size);
font-weight: 600;
@@ -312,17 +352,28 @@
border: none;
border-top: 1px solid var(--separator);
background: transparent;
padding: 16px 32px 16px 0;
padding: var(--space-5) 32px var(--space-5) 0;
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
color: var(--label-primary);
cursor: pointer;
}
.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;
color: var(--label-tertiary);
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).
@@ -344,27 +395,27 @@
flex-direction: column;
align-items: center;
text-align: center;
gap: 12px;
padding: 48px 24px;
gap: var(--space-4);
padding: var(--space-8) var(--space-7);
}
.dialog-overlay {
position: fixed; inset: 0;
background: rgba(0, 0, 0, 0.4);
display: flex; align-items: center; justify-content: center;
padding: 20px;
padding: var(--space-6);
z-index: 1000;
}
.dialog {
width: 100%; max-width: 270px;
border-radius: 20px;
padding: 14px;
display: flex; flex-direction: column; gap: 12px;
padding: var(--space-4);
display: flex; flex-direction: column; gap: var(--space-4);
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__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 {
border: none;
border-radius: var(--radius-pill);
@@ -380,7 +431,7 @@
NAVIGATION — tab bar flottante et toolbar, toutes deux en
"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 {
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
min-width: 56px; min-height: var(--tap-target-min);
@@ -393,10 +444,95 @@
.tab-bar__item--active { color: var(--napps-accent); }
.toolbar {
display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 0 6px 0 16px;
display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
padding: 0 6px 0 var(--space-5);
min-height: 52px;
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__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.
============================================================ */
: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;
}
@media (hover: hover) {
.btn-primary:hover { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.btn-secondary:hover { 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,
.btn-secondary:active,
.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%;
}
+165 -24
View File
@@ -47,6 +47,24 @@
/* ===== Cible tactile minimale ===== */
--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) =====
Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait
@@ -144,10 +162,15 @@
border: none;
border-radius: var(--radius-pill);
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);
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) */
.btn-secondary {
@@ -156,21 +179,26 @@
border: none;
border-radius: var(--radius-pill);
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);
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 {
display: inline-flex;
background: var(--fill-tertiary);
border-radius: var(--radius-pill);
padding: 2px;
gap: 2px;
padding: var(--space-1);
gap: var(--space-1);
}
.segmented-control__item {
padding: 3px 12px;
padding: 3px var(--space-4);
border-radius: var(--radius-pill);
font-size: 13.3px;
font-weight: 510;
@@ -198,28 +226,45 @@
width: 24px; height: 24px;
border-radius: var(--radius-pill);
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 {
border-top: 1px solid var(--separator);
padding: 0 16px;
padding: 0 var(--space-5);
min-height: 52px;
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__subtitle { font-size: var(--text-subheadline-size); color: var(--label-secondary); }
.list-row--interactive { cursor: pointer; }
/* Text field */
.text-field {
border: none;
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;
}
.text-field--placeholder { color: var(--label-tertiary); }
.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) */
.icon-badge {
@@ -266,7 +311,7 @@
.card {
background: var(--bg-grouped);
border-radius: var(--radius-card-lg);
padding: 18px;
padding: var(--space-5);
}
/* ============================================================
@@ -275,8 +320,8 @@
.badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 9px;
gap: var(--space-2);
padding: 3px var(--space-3);
border-radius: 8px;
font-size: var(--text-caption1-size);
font-weight: 600;
@@ -312,17 +357,28 @@
border: none;
border-top: 1px solid var(--separator);
background: transparent;
padding: 16px 32px 16px 0;
padding: var(--space-5) 32px var(--space-5) 0;
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
color: var(--label-primary);
cursor: pointer;
}
.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;
color: var(--label-tertiary);
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).
@@ -344,27 +400,27 @@
flex-direction: column;
align-items: center;
text-align: center;
gap: 12px;
padding: 48px 24px;
gap: var(--space-4);
padding: var(--space-8) var(--space-7);
}
.dialog-overlay {
position: fixed; inset: 0;
background: rgba(0, 0, 0, 0.4);
display: flex; align-items: center; justify-content: center;
padding: 20px;
padding: var(--space-6);
z-index: 1000;
}
.dialog {
width: 100%; max-width: 270px;
border-radius: 20px;
padding: 14px;
display: flex; flex-direction: column; gap: 12px;
padding: var(--space-4);
display: flex; flex-direction: column; gap: var(--space-4);
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__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 {
border: none;
border-radius: var(--radius-pill);
@@ -380,7 +436,7 @@
NAVIGATION — tab bar flottante et toolbar, toutes deux en
"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 {
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
min-width: 56px; min-height: var(--tap-target-min);
@@ -393,10 +449,95 @@
.tab-bar__item--active { color: var(--napps-accent); }
.toolbar {
display: flex; align-items: center; justify-content: space-between; gap: 12px;
padding: 0 6px 0 16px;
display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
padding: 0 6px 0 var(--space-5);
min-height: 52px;
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__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.
============================================================ */
: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;
}
@media (hover: hover) {
.btn-primary:hover { background: color-mix(in srgb, var(--napps-accent) 88%, black); }
.btn-secondary:hover { 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,
.btn-secondary:active,
.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%;
}