Étoffer la bibliothèque : Card, Badge, formulaires avancés, feedback, navigation

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.
This commit is contained in:
2026-09-17 12:33:01 +02:00
parent af9f2d92ba
commit 5faf478c1e
43 changed files with 590 additions and 0 deletions
Regular → Executable
+141
View File
@@ -259,3 +259,144 @@
.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; }