Ajoute Card, Badge, Checkbox, Radio, Select, Spinner, EmptyState, Dialog, TabBar et Toolbar au package @napps/design-system, tous construits à partir des tokens existants (fills, labels par opacité, deux familles de matière) — aucune valeur ad hoc introduite.
403 lines
17 KiB
CSS
Executable File
403 lines
17 KiB
CSS
Executable File
/*
|
|
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); }
|
|
|
|
/* ============================================================
|
|
CARD — surface groupée standard, contenu libre.
|
|
============================================================ */
|
|
.card {
|
|
background: var(--bg-grouped);
|
|
border-radius: var(--radius-card-lg);
|
|
padding: 18px;
|
|
}
|
|
|
|
/* ============================================================
|
|
BADGE — pastille de statut, jamais seul signal (toujours du texte).
|
|
============================================================ */
|
|
.badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
padding: 3px 9px;
|
|
border-radius: 8px;
|
|
font-size: var(--text-caption1-size);
|
|
font-weight: 600;
|
|
white-space: nowrap;
|
|
}
|
|
.badge--neutral { background: var(--fill-tertiary); color: var(--label-primary); }
|
|
.badge--accent { background: color-mix(in srgb, var(--napps-accent) 12%, transparent); color: var(--napps-accent); }
|
|
.badge--success { background: color-mix(in srgb, var(--napps-success) 15%, transparent); color: var(--napps-success); }
|
|
.badge--warning { background: color-mix(in srgb, var(--napps-warning) 15%, transparent); color: var(--napps-warning); }
|
|
.badge--error { background: color-mix(in srgb, var(--napps-error) 15%, transparent); color: var(--napps-error); }
|
|
|
|
/* ============================================================
|
|
FORMULAIRES AVANCÉS — checkbox, radio, select.
|
|
Même échelle de fill que le reste (fill-tertiary au repos).
|
|
============================================================ */
|
|
.checkbox, .radio {
|
|
width: 22px; height: 22px;
|
|
flex-shrink: 0;
|
|
display: inline-flex; align-items: center; justify-content: center;
|
|
border: none; cursor: pointer; padding: 0;
|
|
background: var(--fill-tertiary);
|
|
color: transparent;
|
|
}
|
|
.checkbox { border-radius: 6px; }
|
|
.radio { border-radius: var(--radius-pill); }
|
|
.checkbox--checked, .radio--checked { background: var(--napps-accent); color: #FFFFFF; }
|
|
.checkbox:disabled, .radio:disabled { opacity: 0.5; cursor: default; }
|
|
|
|
.select-wrapper { position: relative; }
|
|
.select {
|
|
appearance: none; -webkit-appearance: none;
|
|
width: 100%;
|
|
border: none;
|
|
border-top: 1px solid var(--separator);
|
|
background: transparent;
|
|
padding: 16px 32px 16px 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%);
|
|
pointer-events: none;
|
|
color: var(--label-tertiary);
|
|
font-size: 12px;
|
|
}
|
|
|
|
/* ============================================================
|
|
FEEDBACK — spinner, empty state, dialog (verre de panneau).
|
|
============================================================ */
|
|
.spinner {
|
|
border-radius: var(--radius-pill);
|
|
border: 2px solid var(--fill-tertiary);
|
|
border-top-color: var(--label-secondary);
|
|
animation: napps-spin 0.7s linear infinite;
|
|
display: inline-block;
|
|
}
|
|
.spinner--small { width: 14px; height: 14px; border-width: 2px; }
|
|
.spinner--regular { width: 20px; height: 20px; border-width: 2px; }
|
|
.spinner--large { width: 35px; height: 35px; border-width: 3px; }
|
|
@keyframes napps-spin { to { transform: rotate(360deg); } }
|
|
|
|
.empty-state {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
text-align: center;
|
|
gap: 12px;
|
|
padding: 48px 24px;
|
|
}
|
|
|
|
.dialog-overlay {
|
|
position: fixed; inset: 0;
|
|
background: rgba(0, 0, 0, 0.4);
|
|
display: flex; align-items: center; justify-content: center;
|
|
padding: 20px;
|
|
z-index: 1000;
|
|
}
|
|
.dialog {
|
|
width: 100%; max-width: 270px;
|
|
border-radius: 20px;
|
|
padding: 14px;
|
|
display: flex; flex-direction: column; gap: 12px;
|
|
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__action {
|
|
border: none;
|
|
border-radius: var(--radius-pill);
|
|
min-height: var(--tap-target-min);
|
|
font: 600 var(--text-body-size)/var(--text-body-line) var(--font-family);
|
|
cursor: pointer;
|
|
}
|
|
.dialog__action--default { background: var(--napps-accent); color: #FFFFFF; }
|
|
.dialog__action--cancel { background: var(--fill-secondary); color: var(--label-primary); }
|
|
.dialog__action--destructive { background: var(--fill-secondary); color: var(--napps-error); }
|
|
|
|
/* ============================================================
|
|
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__item {
|
|
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
|
|
min-width: 56px; min-height: var(--tap-target-min);
|
|
border-radius: var(--radius-pill);
|
|
font-size: var(--text-caption2-size);
|
|
font-weight: 600;
|
|
color: var(--label-secondary);
|
|
background: none; border: none; cursor: pointer;
|
|
}
|
|
.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;
|
|
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; }
|