Files
design-system/tokens.css
T
nathanduquet 7878054b70 Initial commit — direction A4, design tokens, et package @napps/design-system
Direction artistique explorée (A1-A4), audit complet du kit Figma iOS 27
d'Apple pour calibrer les mécaniques du design system (hiérarchie de texte
par opacité, échelle de fills, deux familles de matière), tokens formalisés
dans tokens.css, et première version du package de composants React.
2026-09-16 11:15:30 +02:00

262 lines
11 KiB
CSS

/*
nApps — Design Tokens (v1)
Direction retenue : A4 — Précision / Vibrance
Source : audit du kit Figma "iOS and iPadOS 27 (Community)" — voir figma-kit-audit.md
Principe : les MÉCANIQUES (hiérarchie par opacité, échelle de fills, deux familles de
matière) sont reprises du vrai système Apple. Les VALEURS de marque (accent, typographie,
rayons) restent propres à nApps — jamais de copie de SF Pro / SF Symbols / bleu système.
*/
:root {
/* ===== Accent — propre à nApps, jamais le bleu système Apple (#0088FF) ===== */
--napps-accent: #0B6CFF;
--napps-success: #1FA968;
--napps-warning: #D68C1B;
--napps-error: #E6483D;
/* ===== Labels — hiérarchie par OPACITÉ du noir, pas par des gris séparés =====
Découverte de l'audit : Apple encode primary/secondary/tertiary en assombrissant
un seul noir, jamais avec une palette de gris. Un token qui s'adapte à n'importe
quel fond au lieu d'une variante par contexte. */
--label-primary: rgba(0, 0, 0, 1);
--label-secondary: rgba(0, 0, 0, 0.6);
--label-tertiary: rgba(0, 0, 0, 0.3);
--label-quaternary: rgba(0, 0, 0, 0.18);
/* ===== Fills — fonds de contrôle translucides, 3 paliers d'opacité =====
primary > secondary > tertiary : plus une surface est "au premier plan"
(un bouton qu'on presse), plus l'opacité est haute. */
--fill-primary: rgba(0, 0, 0, 0.2);
--fill-secondary: rgba(0, 0, 0, 0.16);
--fill-tertiary: rgba(0, 0, 0, 0.12);
--separator: rgba(0, 0, 0, 0.1);
/* ===== Surfaces — hiérarchie de fond par couleur, PAS par ombre =====
page → groupée → imbriquée. Jamais d'ombre pour distinguer les niveaux. */
--bg-page: #F5F6F9;
--bg-grouped: #FFFFFF;
--bg-nested: #EDEFF3;
/* ===== Rayons ===== */
--radius-pill: 999px;
--radius-card: 16px;
--radius-card-lg: 20px;
--radius-sheet-top: 24px;
--radius-sheet-bottom: 32px;
/* ===== Cible tactile minimale ===== */
--tap-target-min: 44px;
/* ===== Typographie — échelle réelle (points Apple), police nApps (Manrope) =====
Taille/graisse/interligne/tracking vérifiés sur le kit — la hiérarchie se fait
autant par le POIDS que par la taille (Headline et Body partagent 17pt). */
--font-family: 'Manrope', sans-serif;
--text-large-title-size: 34px; --text-large-title-line: 41px; --text-large-title-weight: 800; --text-large-title-tracking: -0.02em;
--text-title1-size: 28px; --text-title1-line: 34px; --text-title1-weight: 700;
--text-title2-size: 22px; --text-title2-line: 28px; --text-title2-weight: 700;
--text-title3-size: 20px; --text-title3-line: 25px; --text-title3-weight: 600;
--text-headline-size: 17px; --text-headline-line: 22px; --text-headline-weight: 700; --text-headline-tracking: -0.43px;
--text-body-size: 17px; --text-body-line: 22px; --text-body-weight: 400; --text-body-tracking: -0.43px;
--text-callout-size: 16px; --text-callout-line: 21px; --text-callout-weight: 400;
--text-subheadline-size: 15px; --text-subheadline-line: 20px; --text-subheadline-weight: 400;
--text-footnote-size: 13px; --text-footnote-line: 18px; --text-footnote-weight: 400;
--text-caption1-size: 12px; --text-caption1-line: 16px; --text-caption1-weight: 400;
--text-caption2-size: 11px; --text-caption2-line: 13px; --text-caption2-weight: 400;
}
/* ============================================================
DARK MODE — les tokens ne sont jamais une simple inversion.
Découverte de l'audit : fills/secondary passe de 16% à 32% en
dark (pas juste "même valeur sur fond sombre") ; les surfaces
s'ÉCLAIRCISSENT en montant (page < groupée < imbriquée), à
l'inverse du light. Chaque token dark est vérifié, pas déduit.
============================================================ */
:root[data-theme="dark"] {
--napps-accent: #4C93FF;
--napps-success: #43C283;
--napps-warning: #E8AC52;
--napps-error: #F17B70;
--label-primary: rgba(255, 255, 255, 1);
--label-secondary: rgba(255, 255, 255, 0.6);
--label-tertiary: rgba(255, 255, 255, 0.3);
--label-quaternary: rgba(255, 255, 255, 0.18);
--fill-primary: rgba(255, 255, 255, 0.24);
--fill-secondary: rgba(255, 255, 255, 0.32);
--fill-tertiary: rgba(255, 255, 255, 0.16);
--separator: rgba(255, 255, 255, 0.12);
--bg-page: #15171C;
--bg-grouped: #1D1F26;
--bg-nested: #262930;
}
/* ============================================================
MATÉRIAUX — DEUX familles seulement (pas une par composant) :
1. "control" — bouton flottant, barre d'outils, capsule isolée
2. "panel" — grande surface de dialogue (feuille, menu contextuel)
============================================================ */
.material-control {
background: rgba(255, 255, 255, 0.55);
backdrop-filter: blur(46px) saturate(1.6);
-webkit-backdrop-filter: blur(46px) 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 8px 15px rgba(0, 0, 0, 0.02);
}
:root[data-theme="dark"] .material-control {
background: rgba(38, 41, 48, 0.5);
backdrop-filter: blur(46px) saturate(1.4);
-webkit-backdrop-filter: blur(46px) 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);
}
.material-panel {
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(30px);
-webkit-backdrop-filter: blur(30px);
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.25);
}
:root[data-theme="dark"] .material-panel {
background: rgba(20, 20, 20, 0.85);
backdrop-filter: blur(30px);
-webkit-backdrop-filter: blur(30px);
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
}
/* ============================================================
COMPOSANTS de référence — construits uniquement à partir des
tokens ci-dessus. Aucune valeur ad hoc.
============================================================ */
/* Bouton primaire (= Bordered-Prominent d'Apple) */
.btn-primary {
background: var(--napps-accent);
color: #FFFFFF;
border: none;
border-radius: var(--radius-pill);
min-height: var(--tap-target-min);
padding: 0 22px;
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking);
}
/* Bouton secondaire discret (= Bordered d'Apple — PAS un contour) */
.btn-secondary {
background: var(--fill-tertiary);
color: var(--napps-accent);
border: none;
border-radius: var(--radius-pill);
min-height: var(--tap-target-min);
padding: 0 22px;
font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family);
letter-spacing: var(--text-body-tracking);
}
/* Segmented control */
.segmented-control {
display: inline-flex;
background: var(--fill-tertiary);
border-radius: var(--radius-pill);
padding: 2px;
gap: 2px;
}
.segmented-control__item {
padding: 3px 12px;
border-radius: var(--radius-pill);
font-size: 13.3px;
font-weight: 510;
color: var(--label-primary);
min-height: 28px;
display: flex;
align-items: center;
}
.segmented-control__item--selected {
background: var(--bg-grouped);
font-weight: 600;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
/* Toggle */
.toggle {
width: 64px;
height: 28px;
border-radius: var(--radius-pill);
background: var(--label-tertiary);
position: relative;
}
.toggle--on { background: var(--napps-success); }
.toggle__knob {
width: 24px; height: 24px;
border-radius: var(--radius-pill);
background: #FFFFFF;
position: absolute; top: 2px; left: 2px;
}
.toggle--on .toggle__knob { left: auto; right: 2px; }
/* List row */
.list-row {
border-top: 1px solid var(--separator);
padding: 0 16px;
min-height: 52px;
display: flex; align-items: center;
}
.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); }
/* Text field */
.text-field {
border-top: 1px solid var(--separator);
padding: 16px;
min-height: 52px;
}
.text-field--placeholder { color: var(--label-tertiary); }
.text-field__cursor { width: 2px; height: 22px; border-radius: 10px; background: var(--napps-accent); }
/* Empty state — badge circulaire réutilisable (Activity View + Empty State du kit) */
.icon-badge {
width: 50px; height: 50px;
border-radius: var(--radius-pill);
display: flex; align-items: center; justify-content: center;
}
.icon-badge--neutral { background: var(--fill-tertiary); color: var(--label-primary); }
.icon-badge--accent { background: color-mix(in srgb, var(--napps-accent) 15%, transparent); color: var(--napps-accent); }
/* ============================================================
SURFACES — hiérarchie de fond, jamais d'ombre pour distinguer
les niveaux (voir "Couches de couleur" dans les planches A4).
============================================================ */
.surface-page { background: var(--bg-page); }
.surface-grouped { background: var(--bg-grouped); border-radius: var(--radius-card); }
.surface-nested { background: var(--bg-nested); border-radius: calc(var(--radius-card) - 4px); }
/* ============================================================
TYPOGRAPHIE — une classe par échelon. La hiérarchie se lit
dans le POIDS autant que dans la taille (headline == body en
taille, 17px, seul le poids change).
============================================================ */
.text-large-title { font: var(--text-large-title-weight) var(--text-large-title-size)/var(--text-large-title-line) var(--font-family); letter-spacing: var(--text-large-title-tracking); margin: 0; }
.text-title1 { font: var(--text-title1-weight) var(--text-title1-size)/var(--text-title1-line) var(--font-family); margin: 0; }
.text-title2 { font: var(--text-title2-weight) var(--text-title2-size)/var(--text-title2-line) var(--font-family); margin: 0; }
.text-title3 { font: var(--text-title3-weight) var(--text-title3-size)/var(--text-title3-line) var(--font-family); margin: 0; }
.text-headline { font: var(--text-headline-weight) var(--text-headline-size)/var(--text-headline-line) var(--font-family); letter-spacing: var(--text-headline-tracking); margin: 0; }
.text-body { font: var(--text-body-weight) var(--text-body-size)/var(--text-body-line) var(--font-family); letter-spacing: var(--text-body-tracking); margin: 0; }
.text-callout { font: var(--text-callout-weight) var(--text-callout-size)/var(--text-callout-line) var(--font-family); margin: 0; }
.text-subheadline { font: var(--text-subheadline-weight) var(--text-subheadline-size)/var(--text-subheadline-line) var(--font-family); margin: 0; }
.text-footnote { font: var(--text-footnote-weight) var(--text-footnote-size)/var(--text-footnote-line) var(--font-family); margin: 0; }
.text-caption1 { font: var(--text-caption1-weight) var(--text-caption1-size)/var(--text-caption1-line) var(--font-family); margin: 0; }
.text-caption2 { font: var(--text-caption2-weight) var(--text-caption2-size)/var(--text-caption2-line) var(--font-family); margin: 0; }
.text-primary { color: var(--label-primary); }
.text-secondary { color: var(--label-secondary); }
.text-tertiary { color: var(--label-tertiary); }
.text-quaternary { color: var(--label-quaternary); }