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:
+165
-24
@@ -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%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user