feat(ui): the shared page frame and toolbar kit: Page, PageHeader, Toolbar, Dropdown (multi-select), SearchInput, FilterChip, Segmented, Tabs
Owner's UI review (2026-11-20): pages that don't scroll and sit on the left, native selects in toolbars, controls of different heights, labels too loud. Everything is global in @xenia/ui so no page rebuilds it: - Page: scrolls on its own, fills the area up to a 16:9 screen's width (--x-page-max = max(1280px, 100vh*16/9)), centred beyond (ultrawides); width="form" for settings; top= keeps a tab strip above the scroll - Dropdown: portal list, flips above, keyboard, search for long lists, multiple (array value, [] = all, allLabel), dots and hints; Input heights - SearchInput, FilterChip (tone + count), Segmented, Tabs (sideways scroll only, no 1px up/down scroll), Toolbar/ToolbarSpacer - InfoTip opens on hover too; Dialog size xl (920px) - tokens: --x-text-overline (11px), --x-pad-card(-y), muted ink-2 (contrast test still passes in every look); preset: text-overline, p-card, max-w-page, the special tone - component labels (search, clear, all, nothing found) in en/el Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,12 @@
|
|||||||
"pinProgress": "{{count}} από {{total}} ψηφία",
|
"pinProgress": "{{count}} από {{total}} ψηφία",
|
||||||
"submit": "OK",
|
"submit": "OK",
|
||||||
"decrease": "Λιγότερο",
|
"decrease": "Λιγότερο",
|
||||||
"increase": "Περισσότερο"
|
"increase": "Περισσότερο",
|
||||||
|
"search": "Αναζήτηση",
|
||||||
|
"clear": "Καθαρισμός",
|
||||||
|
"all": "Όλα",
|
||||||
|
"noOptions": "Δεν βρέθηκε τίποτα",
|
||||||
|
"selected": "{{count}} επιλεγμένα"
|
||||||
},
|
},
|
||||||
"override": {
|
"override": {
|
||||||
"title": "Έγκριση υπευθύνου",
|
"title": "Έγκριση υπευθύνου",
|
||||||
|
|||||||
@@ -34,7 +34,12 @@
|
|||||||
"pinProgress": "{{count}} of {{total}} digits entered",
|
"pinProgress": "{{count}} of {{total}} digits entered",
|
||||||
"submit": "OK",
|
"submit": "OK",
|
||||||
"decrease": "Less",
|
"decrease": "Less",
|
||||||
"increase": "More"
|
"increase": "More",
|
||||||
|
"search": "Search",
|
||||||
|
"clear": "Clear",
|
||||||
|
"all": "All",
|
||||||
|
"noOptions": "Nothing found",
|
||||||
|
"selected": "{{count}} selected"
|
||||||
},
|
},
|
||||||
"override": {
|
"override": {
|
||||||
"title": "Manager approval",
|
"title": "Manager approval",
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ export function useUiLabels() {
|
|||||||
decrease: t('ui.decrease'),
|
decrease: t('ui.decrease'),
|
||||||
increase: t('ui.increase'),
|
increase: t('ui.increase'),
|
||||||
submit: t('ui.submit'),
|
submit: t('ui.submit'),
|
||||||
|
search: t('ui.search'),
|
||||||
|
clear: t('ui.clear'),
|
||||||
|
all: t('ui.all'),
|
||||||
|
noOptions: t('ui.noOptions'),
|
||||||
|
selected: count => t('ui.selected', { count }),
|
||||||
pinProgress: (count, total) => t('ui.pinProgress', { count, total }),
|
pinProgress: (count, total) => t('ui.pinProgress', { count, total }),
|
||||||
}), [t, language]) // eslint-disable-line react-hooks/exhaustive-deps
|
}), [t, language]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
|
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.x-dialog, .x-sheet, .x-toast, .x-input, .x-select__control { color-scheme: var(--x-color-scheme); }
|
.x-dialog, .x-sheet, .x-toast, .x-input, .x-select__control, .x-dropdown__menu { color-scheme: var(--x-color-scheme); }
|
||||||
|
|
||||||
/* ── Spinner ─────────────────────────────────────────────────────────────── */
|
/* ── Spinner ─────────────────────────────────────────────────────────────── */
|
||||||
.x-spinner { display: inline-flex; flex-shrink: 0; color: currentColor; }
|
.x-spinner { display: inline-flex; flex-shrink: 0; color: currentColor; }
|
||||||
@@ -81,6 +81,7 @@
|
|||||||
.x-dialog--sm { max-width: 400px; }
|
.x-dialog--sm { max-width: 400px; }
|
||||||
.x-dialog--md { max-width: 520px; }
|
.x-dialog--md { max-width: 520px; }
|
||||||
.x-dialog--lg { max-width: 720px; }
|
.x-dialog--lg { max-width: 720px; }
|
||||||
|
.x-dialog--xl { max-width: 920px; }
|
||||||
|
|
||||||
.x-sheet--bottom {
|
.x-sheet--bottom {
|
||||||
width: 100%; max-width: 640px; max-height: 90vh;
|
width: 100%; max-width: 640px; max-height: 90vh;
|
||||||
@@ -334,3 +335,166 @@
|
|||||||
/* always light behind the code, in dark themes too: scanners need the contrast */
|
/* always light behind the code, in dark themes too: scanners need the contrast */
|
||||||
.x-qr__tile { padding: var(--x-space-3); border-radius: var(--x-radius-card); border: var(--x-border-width) solid var(--x-line); background: var(--x-on-colour); line-height: 0; }
|
.x-qr__tile { padding: var(--x-space-3); border-radius: var(--x-radius-card); border: var(--x-border-width) solid var(--x-line); background: var(--x-on-colour); line-height: 0; }
|
||||||
.x-qr__caption { font-size: var(--x-text-label); color: var(--x-ink-2); text-align: center; }
|
.x-qr__caption { font-size: var(--x-text-label); color: var(--x-ink-2); text-align: center; }
|
||||||
|
|
||||||
|
/* ── Page, PageHeader, Toolbar (the page rule, 2026-11-20) ─────────────────
|
||||||
|
* A page scrolls on its own and is as wide as a 16:9 screen allows, centred beyond. */
|
||||||
|
.x-page { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; }
|
||||||
|
.x-page__top { flex-shrink: 0; border-bottom: var(--x-border-width) solid var(--x-line); background: var(--x-surface); }
|
||||||
|
.x-page__top-inner { box-sizing: border-box; width: 100%; max-width: var(--x-page-max); margin-inline: auto; padding: 0 var(--x-page-pad); }
|
||||||
|
.x-page__scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
|
||||||
|
.x-page__body {
|
||||||
|
box-sizing: border-box; width: 100%; max-width: var(--x-page-max); margin-inline: auto;
|
||||||
|
padding: var(--x-page-pad);
|
||||||
|
display: grid; gap: var(--x-page-gap); align-content: start; grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
.x-page__body--form { max-width: var(--x-page-form-max); }
|
||||||
|
.x-page__top-inner.x-page__body--form { padding-top: 0; padding-bottom: 0; }
|
||||||
|
.x-page__body--flush { padding: 0; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.x-page__body, .x-page__top-inner { padding-inline: var(--x-space-4); }
|
||||||
|
.x-page__body { padding-block: var(--x-space-4); }
|
||||||
|
.x-page__body--flush { padding: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.x-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--x-space-3); }
|
||||||
|
.x-page-header__titles { flex: 1; min-width: 0; }
|
||||||
|
.x-page-header__title { margin: 0; display: flex; align-items: center; gap: var(--x-space-1); font-size: var(--x-text-title); line-height: var(--x-leading-title); font-weight: var(--x-weight-semibold); color: var(--x-ink); }
|
||||||
|
.x-page-header__subtitle { margin: var(--x-space-0-5) 0 0; font-size: var(--x-text-label); line-height: var(--x-leading-label); color: var(--x-ink-2); }
|
||||||
|
.x-page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--x-space-2); }
|
||||||
|
|
||||||
|
.x-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--x-space-2); }
|
||||||
|
.x-toolbar > .x-search { flex: 1 1 16rem; }
|
||||||
|
.x-toolbar__spacer { flex: 1; }
|
||||||
|
|
||||||
|
/* ── SearchInput ─────────────────────────────────────────────────────────── */
|
||||||
|
.x-search { position: relative; display: block; min-width: 12rem; }
|
||||||
|
.x-search__icon { position: absolute; left: var(--x-space-3); top: 50%; transform: translateY(-50%); display: flex; color: var(--x-ink-3); pointer-events: none; }
|
||||||
|
.x-search__input { padding-left: var(--x-space-10); padding-right: var(--x-space-10); }
|
||||||
|
.x-search__input::-webkit-search-cancel-button { display: none; }
|
||||||
|
.x-search__clear {
|
||||||
|
position: absolute; right: var(--x-space-2); top: 50%; transform: translateY(-50%);
|
||||||
|
display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
|
||||||
|
border: 0; border-radius: var(--x-radius-full); background: transparent; color: var(--x-ink-3); cursor: pointer;
|
||||||
|
}
|
||||||
|
.x-search__clear:hover { background: var(--x-surface-2); color: var(--x-ink); }
|
||||||
|
.x-search__clear:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
|
||||||
|
|
||||||
|
/* ── Dropdown ────────────────────────────────────────────────────────────── */
|
||||||
|
.x-dropdown {
|
||||||
|
display: inline-flex; align-items: center; gap: var(--x-space-2);
|
||||||
|
box-sizing: border-box; min-width: 10rem; max-width: 100%;
|
||||||
|
min-height: var(--x-control-md); padding: 0 var(--x-space-3);
|
||||||
|
background: var(--x-surface); color: var(--x-ink);
|
||||||
|
border: var(--x-border-width) solid var(--x-line-strong); border-radius: var(--x-radius-control);
|
||||||
|
font: inherit; font-size: var(--x-text-body); line-height: var(--x-leading-body); text-align: left;
|
||||||
|
cursor: pointer; color-scheme: var(--x-color-scheme);
|
||||||
|
transition: border-color var(--x-duration-fast) var(--x-ease), box-shadow var(--x-duration-fast) var(--x-ease);
|
||||||
|
}
|
||||||
|
.x-dropdown:hover:not(:disabled) { border-color: var(--x-ink-3); }
|
||||||
|
.x-dropdown:focus-visible, .x-dropdown--open { outline: none; border-color: var(--x-accent); box-shadow: var(--x-focus-ring); }
|
||||||
|
.x-dropdown:disabled { background: var(--x-surface-2); color: var(--x-ink-3); cursor: not-allowed; }
|
||||||
|
.x-dropdown--sm { min-height: var(--x-control-sm); }
|
||||||
|
.x-dropdown--lg { min-height: var(--x-control-lg); font-size: var(--x-text-body-lg); }
|
||||||
|
.x-dropdown--filtered { border-color: var(--x-accent); background: var(--x-accent-soft); color: var(--x-accent-ink); }
|
||||||
|
.x-dropdown__icon { display: flex; color: var(--x-ink-3); }
|
||||||
|
.x-dropdown--filtered .x-dropdown__icon, .x-dropdown--filtered .x-dropdown__chevron { color: inherit; }
|
||||||
|
.x-dropdown__value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--x-weight-medium); }
|
||||||
|
.x-dropdown__value--placeholder { color: var(--x-ink-3); font-weight: var(--x-weight-regular); }
|
||||||
|
.x-dropdown__count { padding: 0 var(--x-space-1-5); border-radius: var(--x-radius-full); background: var(--x-accent); color: var(--x-accent-fg); font-size: var(--x-text-caption); font-weight: var(--x-weight-bold); }
|
||||||
|
.x-dropdown__chevron { flex-shrink: 0; color: var(--x-ink-3); transition: transform var(--x-duration-fast) var(--x-ease); }
|
||||||
|
.x-dropdown--open .x-dropdown__chevron { transform: rotate(180deg); }
|
||||||
|
|
||||||
|
.x-dropdown__menu {
|
||||||
|
position: fixed; z-index: var(--x-z-popover); box-sizing: border-box;
|
||||||
|
display: flex; flex-direction: column; max-width: min(420px, calc(100vw - 16px)); overflow: hidden;
|
||||||
|
background: var(--x-surface); color: var(--x-ink);
|
||||||
|
border: var(--x-border-width) solid var(--x-line); border-radius: var(--x-radius-card);
|
||||||
|
box-shadow: var(--x-shadow-popover); outline: none;
|
||||||
|
animation: x-fade-in var(--x-duration-fast) var(--x-ease);
|
||||||
|
}
|
||||||
|
.x-dropdown__search { padding: var(--x-space-2); border-bottom: var(--x-border-width) solid var(--x-line); }
|
||||||
|
.x-dropdown__list { list-style: none; margin: 0; padding: var(--x-space-1); overflow-y: auto; min-height: 0; }
|
||||||
|
.x-dropdown__option {
|
||||||
|
display: flex; align-items: center; gap: var(--x-space-2-5);
|
||||||
|
min-height: 38px; padding: var(--x-space-1-5) var(--x-space-3); border-radius: var(--x-radius-sm);
|
||||||
|
font-size: var(--x-text-body); line-height: var(--x-leading-body); cursor: pointer; user-select: none;
|
||||||
|
}
|
||||||
|
.x-dropdown__option--active { background: var(--x-surface-2); }
|
||||||
|
.x-dropdown__option--on { font-weight: var(--x-weight-semibold); }
|
||||||
|
.x-dropdown__option--disabled { opacity: 0.45; cursor: not-allowed; }
|
||||||
|
.x-dropdown__text { flex: 1; min-width: 0; display: grid; }
|
||||||
|
.x-dropdown__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.x-dropdown__hint { font-size: var(--x-text-caption); line-height: var(--x-leading-caption); color: var(--x-ink-3); font-weight: var(--x-weight-regular); }
|
||||||
|
.x-dropdown__tick { display: flex; color: var(--x-accent); }
|
||||||
|
.x-dropdown__dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
|
||||||
|
.x-dropdown__box {
|
||||||
|
display: flex; align-items: center; justify-content: center; flex-shrink: 0;
|
||||||
|
width: 18px; height: 18px; box-sizing: border-box;
|
||||||
|
border: 1.5px solid var(--x-line-strong); border-radius: 5px; background: var(--x-surface); color: var(--x-accent-fg);
|
||||||
|
}
|
||||||
|
.x-dropdown__box--on { background: var(--x-accent); border-color: var(--x-accent); }
|
||||||
|
.x-dropdown__none { padding: var(--x-space-3); font-size: var(--x-text-label); color: var(--x-ink-3); text-align: center; }
|
||||||
|
.x-dropdown__foot { padding: var(--x-space-1-5) var(--x-space-2); border-top: var(--x-border-width) solid var(--x-line); }
|
||||||
|
.x-dropdown__clear {
|
||||||
|
width: 100%; padding: var(--x-space-1-5) var(--x-space-2); border: 0; border-radius: var(--x-radius-sm);
|
||||||
|
background: transparent; color: var(--x-accent-ink); font: inherit; font-size: var(--x-text-label); font-weight: var(--x-weight-semibold); text-align: left; cursor: pointer;
|
||||||
|
}
|
||||||
|
.x-dropdown__clear:hover { background: var(--x-surface-2); }
|
||||||
|
|
||||||
|
/* ── FilterChip ──────────────────────────────────────────────────────────── */
|
||||||
|
.x-chip {
|
||||||
|
--x-chip-tone: var(--x-ink-3); --x-chip-soft: var(--x-surface-2); --x-chip-ink: var(--x-ink-2);
|
||||||
|
display: inline-flex; align-items: center; gap: var(--x-space-2);
|
||||||
|
box-sizing: border-box; min-height: var(--x-control-md); padding: 0 var(--x-space-4);
|
||||||
|
border: var(--x-border-width) solid var(--x-line-strong); border-radius: var(--x-radius-full);
|
||||||
|
background: var(--x-surface); color: var(--x-ink-2);
|
||||||
|
font: inherit; font-size: var(--x-text-label); font-weight: var(--x-weight-semibold); white-space: nowrap; cursor: pointer;
|
||||||
|
transition: background-color var(--x-duration-fast) var(--x-ease), border-color var(--x-duration-fast) var(--x-ease);
|
||||||
|
}
|
||||||
|
.x-chip--sm { min-height: var(--x-control-sm); padding: 0 var(--x-space-3); }
|
||||||
|
.x-chip:hover { background: var(--x-surface-2); }
|
||||||
|
.x-chip:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
|
||||||
|
.x-chip__dot { width: 8px; height: 8px; border-radius: var(--x-radius-full); background: var(--x-chip-tone); }
|
||||||
|
.x-chip__count { color: var(--x-ink); font-variant-numeric: tabular-nums; }
|
||||||
|
.x-chip--on, .x-chip--on:hover { background: var(--x-chip-soft); color: var(--x-chip-ink); border-color: var(--x-chip-tone); }
|
||||||
|
.x-chip--on .x-chip__count { color: inherit; }
|
||||||
|
.x-chip--success { --x-chip-tone: var(--x-success); --x-chip-soft: var(--x-success-soft); --x-chip-ink: var(--x-success-ink); }
|
||||||
|
.x-chip--info { --x-chip-tone: var(--x-info); --x-chip-soft: var(--x-info-soft); --x-chip-ink: var(--x-info-ink); }
|
||||||
|
.x-chip--accent { --x-chip-tone: var(--x-accent); --x-chip-soft: var(--x-accent-soft); --x-chip-ink: var(--x-accent-ink); }
|
||||||
|
.x-chip--warning { --x-chip-tone: var(--x-warning); --x-chip-soft: var(--x-warning-soft); --x-chip-ink: var(--x-warning-ink); }
|
||||||
|
.x-chip--danger { --x-chip-tone: var(--x-danger); --x-chip-soft: var(--x-danger-soft); --x-chip-ink: var(--x-danger-ink); }
|
||||||
|
|
||||||
|
/* ── Segmented ───────────────────────────────────────────────────────────── */
|
||||||
|
.x-segmented {
|
||||||
|
display: inline-flex; box-sizing: border-box; min-height: var(--x-control-md); padding: 3px; gap: 2px;
|
||||||
|
border: var(--x-border-width) solid var(--x-line-strong); border-radius: var(--x-radius-control); background: var(--x-surface-2);
|
||||||
|
}
|
||||||
|
.x-segmented--sm { min-height: var(--x-control-sm); }
|
||||||
|
.x-segmented__item {
|
||||||
|
display: inline-flex; align-items: center; gap: var(--x-space-1-5); padding: 0 var(--x-space-3);
|
||||||
|
border: 0; border-radius: calc(var(--x-radius-control) - 3px); background: transparent; color: var(--x-ink-2);
|
||||||
|
font: inherit; font-size: var(--x-text-label); font-weight: var(--x-weight-medium); cursor: pointer;
|
||||||
|
}
|
||||||
|
.x-segmented__item:hover { color: var(--x-ink); }
|
||||||
|
.x-segmented__item:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
|
||||||
|
.x-segmented__item--on, .x-segmented__item--on:hover { background: var(--x-surface); color: var(--x-ink); font-weight: var(--x-weight-semibold); box-shadow: var(--x-shadow-raised); }
|
||||||
|
|
||||||
|
/* ── Tabs ────────────────────────────────────────────────────────────────── */
|
||||||
|
.x-tabs { display: flex; align-items: center; gap: var(--x-space-2); box-shadow: inset 0 calc(-1 * var(--x-border-width)) 0 var(--x-line); }
|
||||||
|
.x-page__top .x-tabs { box-shadow: none; }
|
||||||
|
.x-tabs__list { flex: 1; min-width: 0; display: flex; gap: var(--x-space-1); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
|
||||||
|
.x-tabs__list::-webkit-scrollbar { display: none; }
|
||||||
|
.x-tabs__tab {
|
||||||
|
display: inline-flex; align-items: center; gap: var(--x-space-1-5); flex-shrink: 0;
|
||||||
|
padding: var(--x-space-2-5) var(--x-space-3); border: 0; background: transparent;
|
||||||
|
box-shadow: inset 0 -2px 0 transparent; color: var(--x-ink-2);
|
||||||
|
font: inherit; font-size: var(--x-text-label); font-weight: var(--x-weight-medium); white-space: nowrap; cursor: pointer;
|
||||||
|
transition: color var(--x-duration-fast) var(--x-ease), box-shadow var(--x-duration-fast) var(--x-ease);
|
||||||
|
}
|
||||||
|
.x-tabs--lg .x-tabs__tab { padding: var(--x-space-3) var(--x-space-4); font-size: var(--x-text-body); }
|
||||||
|
.x-tabs__tab:hover { color: var(--x-ink); }
|
||||||
|
.x-tabs__tab:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
|
||||||
|
.x-tabs__tab--on, .x-tabs__tab--on:hover { color: var(--x-ink); font-weight: var(--x-weight-semibold); box-shadow: inset 0 -2px 0 var(--x-accent); }
|
||||||
|
.x-tabs__badge { min-width: 18px; padding: 0 var(--x-space-1-5); box-sizing: border-box; border-radius: var(--x-radius-full); background: var(--x-surface-2); color: var(--x-ink-2); font-size: var(--x-text-caption); font-weight: var(--x-weight-bold); text-align: center; font-variant-numeric: tabular-nums; }
|
||||||
|
.x-tabs__badge--warn { background: var(--x-danger-soft); color: var(--x-danger-ink); }
|
||||||
|
.x-tabs__end { flex-shrink: 0; display: flex; align-items: center; gap: var(--x-space-2); }
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import { cx } from '../internal/cx.js'
|
||||||
|
import { useLabels } from './labels.js'
|
||||||
|
|
||||||
|
const SearchIcon = () => (
|
||||||
|
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7" /><path d="M20 20l-3.5-3.5" /></svg>
|
||||||
|
)
|
||||||
|
const ClearIcon = () => (
|
||||||
|
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A search box: icon, input, a clear button while there is text. Same heights as <Input>.
|
||||||
|
* <SearchInput value={q} onChange={setQ} placeholder="Search contacts" />
|
||||||
|
* onChange receives the text (not an event). Grows to fill a <Toolbar>.
|
||||||
|
*/
|
||||||
|
export function SearchInput({ value = '', onChange, placeholder, size = 'md', className, 'aria-label': ariaLabel, ...rest }) {
|
||||||
|
const labels = useLabels()
|
||||||
|
return (
|
||||||
|
<div className={cx('x-search', className)}>
|
||||||
|
<span className="x-search__icon"><SearchIcon /></span>
|
||||||
|
<input type="search" className={cx('x-input', `x-input--${size}`, 'x-search__input')} value={value} placeholder={placeholder ?? labels.search}
|
||||||
|
aria-label={ariaLabel ?? placeholder ?? labels.search} onChange={e => onChange?.(e.target.value)} {...rest} />
|
||||||
|
{value && (
|
||||||
|
<button type="button" className="x-search__clear" aria-label={labels.clear} onClick={() => onChange?.('')}><ClearIcon /></button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A toggle filter in a toolbar: a state, a status… with an optional coloured dot and a count.
|
||||||
|
* tone: 'success' | 'info' | 'accent' | 'warning' | 'danger' | 'neutral' (the dot and the "on" look).
|
||||||
|
*/
|
||||||
|
export function FilterChip({ pressed = false, tone = 'neutral', count, size = 'md', className, children, ...rest }) {
|
||||||
|
return (
|
||||||
|
<button type="button" aria-pressed={pressed} className={cx('x-chip', `x-chip--${size}`, `x-chip--${tone}`, pressed && 'x-chip--on', className)} {...rest}>
|
||||||
|
<span className="x-chip__dot" aria-hidden="true" />
|
||||||
|
{children}
|
||||||
|
{count != null && <span className="x-chip__count">{count}</span>}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A few mutually exclusive views (List / Map). options: [{ value, label, icon? }].
|
||||||
|
* <Segmented value={view} onChange={setView} options={[…]} aria-label="View" />
|
||||||
|
*/
|
||||||
|
export function Segmented({ options = [], value, onChange, size = 'md', className, ...rest }) {
|
||||||
|
return (
|
||||||
|
<div role="group" className={cx('x-segmented', `x-segmented--${size}`, className)} {...rest}>
|
||||||
|
{options.map(o => (
|
||||||
|
<button key={o.value} type="button" aria-pressed={o.value === value} className={cx('x-segmented__item', o.value === value && 'x-segmented__item--on')}
|
||||||
|
onClick={() => onChange?.(o.value)} data-testid={o.testId}>
|
||||||
|
{o.icon}{o.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tabs with an underline: a page's or a dialog's sections. Scrolls sideways when they don't fit,
|
||||||
|
* never up and down. tabs: [{ id, label, badge?, warn?, testId? }].
|
||||||
|
* <Tabs tabs={tabs} value={tab} onChange={setTab} />
|
||||||
|
* end: an element at the right end of the strip (a refresh button…).
|
||||||
|
*/
|
||||||
|
export function Tabs({ tabs = [], value, onChange, size = 'md', end, className, ...rest }) {
|
||||||
|
return (
|
||||||
|
<div className={cx('x-tabs', `x-tabs--${size}`, className)} {...rest}>
|
||||||
|
<div className="x-tabs__list" role="tablist">
|
||||||
|
{tabs.map(tb => (
|
||||||
|
<button key={tb.id} type="button" role="tab" aria-selected={tb.id === value} data-testid={tb.testId}
|
||||||
|
className={cx('x-tabs__tab', tb.id === value && 'x-tabs__tab--on')} onClick={() => onChange?.(tb.id)}>
|
||||||
|
{tb.icon}{tb.label}
|
||||||
|
{tb.badge != null && tb.badge !== false && <span className={cx('x-tabs__badge', tb.warn && 'x-tabs__badge--warn')}>{tb.badge}</span>}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{end && <div className="x-tabs__end">{end}</div>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||||
|
import { cx } from '../internal/cx.js'
|
||||||
|
import { Portal } from '../internal/Portal.jsx'
|
||||||
|
import { useLabels } from './labels.js'
|
||||||
|
|
||||||
|
const GAP = 6
|
||||||
|
const MARGIN = 8
|
||||||
|
|
||||||
|
const Chevron = () => (
|
||||||
|
<svg className="x-dropdown__chevron" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6" /></svg>
|
||||||
|
)
|
||||||
|
const Tick = () => (
|
||||||
|
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 12l5 5 9-10" /></svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The one dropdown of the product (2026-11-20): single or multiple choice, a floating list
|
||||||
|
* (portal, flips above when there's no room), keyboard (↑ ↓ Enter Escape), a search box for long
|
||||||
|
* lists. Same heights as <Input> (size 'sm' | 'md' | 'lg'), so it lines up with a search bar.
|
||||||
|
*
|
||||||
|
* <Dropdown value={type} onChange={setType} options={[{ value: 'supplier', label: 'Supplier' }]} />
|
||||||
|
* <Dropdown multiple value={zones} onChange={setZones} allLabel="All zones" options={…} />
|
||||||
|
*
|
||||||
|
* multiple: value is an array; an empty array means "all" (shown as allLabel) — the usual filter.
|
||||||
|
* options: [{ value, label, hint?, dot? (a colour the venue chose, e.g. a zone's), disabled? }].
|
||||||
|
* onChange receives the new value (not an event). searchable: default when > 8 options.
|
||||||
|
* icon: an element shown before the text (a filter icon…).
|
||||||
|
*/
|
||||||
|
export function Dropdown({
|
||||||
|
options = [], value, onChange, multiple = false, placeholder, allLabel, size = 'md',
|
||||||
|
searchable, icon, disabled = false, className, menuClassName, id, ...rest
|
||||||
|
}) {
|
||||||
|
const labels = useLabels()
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
const [pos, setPos] = useState(null)
|
||||||
|
const [query, setQuery] = useState('')
|
||||||
|
const [active, setActive] = useState(0)
|
||||||
|
const button = useRef(null)
|
||||||
|
const menu = useRef(null)
|
||||||
|
const search = useRef(null)
|
||||||
|
const listId = useId()
|
||||||
|
const chosen = multiple ? (Array.isArray(value) ? value : []) : value
|
||||||
|
const isOn = v => (multiple ? chosen.includes(v) : chosen === v)
|
||||||
|
const withSearch = searchable ?? options.length > 8
|
||||||
|
|
||||||
|
const shown = useMemo(() => {
|
||||||
|
const q = query.trim().toLocaleLowerCase()
|
||||||
|
return q ? options.filter(o => String(o.label).toLocaleLowerCase().includes(q)) : options
|
||||||
|
}, [options, query])
|
||||||
|
|
||||||
|
const place = useCallback(() => {
|
||||||
|
const b = button.current?.getBoundingClientRect()
|
||||||
|
const m = menu.current?.getBoundingClientRect()
|
||||||
|
if (!b) return
|
||||||
|
const height = m?.height ?? 0
|
||||||
|
const below = window.innerHeight - b.bottom - GAP - MARGIN
|
||||||
|
const above = b.top - GAP - MARGIN
|
||||||
|
const up = height > below && above > below
|
||||||
|
const width = Math.max(b.width, m?.width ?? 0)
|
||||||
|
const left = Math.min(Math.max(MARGIN, b.left), window.innerWidth - MARGIN - width)
|
||||||
|
setPos({ left, minWidth: b.width, top: up ? undefined : b.bottom + GAP, bottom: up ? window.innerHeight - b.top + GAP : undefined, maxHeight: Math.max(160, up ? above : below) })
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useLayoutEffect(() => { if (open) place() }, [open, place, shown.length])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return
|
||||||
|
const onDown = e => {
|
||||||
|
if (button.current?.contains(e.target) || menu.current?.contains(e.target)) return
|
||||||
|
setOpen(false)
|
||||||
|
}
|
||||||
|
const onScroll = e => { if (!menu.current?.contains(e.target)) place() }
|
||||||
|
document.addEventListener('pointerdown', onDown)
|
||||||
|
window.addEventListener('resize', place)
|
||||||
|
window.addEventListener('scroll', onScroll, true)
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('pointerdown', onDown)
|
||||||
|
window.removeEventListener('resize', place)
|
||||||
|
window.removeEventListener('scroll', onScroll, true)
|
||||||
|
}
|
||||||
|
}, [open, place])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return
|
||||||
|
setQuery('')
|
||||||
|
const first = options.findIndex(o => isOn(o.value))
|
||||||
|
setActive(first >= 0 ? first : 0)
|
||||||
|
requestAnimationFrame(() => (search.current ?? menu.current)?.focus())
|
||||||
|
}, [open]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
menu.current?.querySelector(`[data-index="${active}"]`)?.scrollIntoView({ block: 'nearest' })
|
||||||
|
}, [active])
|
||||||
|
|
||||||
|
function pick(o) {
|
||||||
|
if (!o || o.disabled) return
|
||||||
|
if (multiple) {
|
||||||
|
onChange?.(isOn(o.value) ? chosen.filter(v => v !== o.value) : [...chosen, o.value])
|
||||||
|
} else {
|
||||||
|
onChange?.(o.value)
|
||||||
|
setOpen(false)
|
||||||
|
button.current?.focus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKey(e) {
|
||||||
|
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); setOpen(false); button.current?.focus() }
|
||||||
|
else if (e.key === 'Tab') setOpen(false)
|
||||||
|
else if (e.key === 'ArrowDown') { e.preventDefault(); setActive(i => Math.min(shown.length - 1, i + 1)) }
|
||||||
|
else if (e.key === 'ArrowUp') { e.preventDefault(); setActive(i => Math.max(0, i - 1)) }
|
||||||
|
else if (e.key === 'Enter' || (e.key === ' ' && e.target !== search.current)) { e.preventDefault(); pick(shown[active]) }
|
||||||
|
}
|
||||||
|
|
||||||
|
const label = (() => {
|
||||||
|
if (!multiple) return options.find(o => o.value === chosen)?.label
|
||||||
|
if (chosen.length === 0) return allLabel ?? placeholder
|
||||||
|
const names = options.filter(o => chosen.includes(o.value)).map(o => o.label)
|
||||||
|
return names.length === options.length && allLabel ? allLabel : names.join(', ')
|
||||||
|
})()
|
||||||
|
const empty = multiple ? chosen.length === 0 && !allLabel : label == null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
ref={button} id={id} type="button" disabled={disabled}
|
||||||
|
className={cx('x-dropdown', `x-dropdown--${size}`, open && 'x-dropdown--open', multiple && chosen.length > 0 && 'x-dropdown--filtered', className)}
|
||||||
|
aria-haspopup="listbox" aria-expanded={open} aria-controls={open ? listId : undefined}
|
||||||
|
onClick={() => setOpen(o => !o)}
|
||||||
|
onKeyDown={e => { if (!open && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); setOpen(true) } }}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{icon && <span className="x-dropdown__icon" aria-hidden="true">{icon}</span>}
|
||||||
|
<span className={cx('x-dropdown__value', empty && 'x-dropdown__value--placeholder')}>{label ?? placeholder ?? ' '}</span>
|
||||||
|
{multiple && chosen.length > 1 && <span className="x-dropdown__count">{chosen.length}</span>}
|
||||||
|
<Chevron />
|
||||||
|
</button>
|
||||||
|
{open && (
|
||||||
|
<Portal>
|
||||||
|
<div
|
||||||
|
ref={menu} tabIndex={-1} onKeyDown={onKey}
|
||||||
|
className={cx('x-dropdown__menu', menuClassName)}
|
||||||
|
style={pos ? { left: pos.left, top: pos.top, bottom: pos.bottom, minWidth: pos.minWidth, maxHeight: pos.maxHeight } : { left: 0, top: 0, visibility: 'hidden' }}
|
||||||
|
>
|
||||||
|
{withSearch && (
|
||||||
|
<div className="x-dropdown__search">
|
||||||
|
<input ref={search} className="x-input x-input--sm" value={query} placeholder={labels.search} aria-label={labels.search}
|
||||||
|
onChange={e => { setQuery(e.target.value); setActive(0) }} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<ul id={listId} role="listbox" aria-multiselectable={multiple || undefined} className="x-dropdown__list">
|
||||||
|
{shown.length === 0 && <li className="x-dropdown__none">{labels.noOptions}</li>}
|
||||||
|
{shown.map((o, i) => {
|
||||||
|
const on = isOn(o.value)
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={String(o.value)} role="option" aria-selected={on} aria-disabled={o.disabled || undefined} data-index={i}
|
||||||
|
className={cx('x-dropdown__option', on && 'x-dropdown__option--on', i === active && 'x-dropdown__option--active', o.disabled && 'x-dropdown__option--disabled')}
|
||||||
|
onMouseEnter={() => setActive(i)} onClick={() => pick(o)}
|
||||||
|
>
|
||||||
|
{multiple
|
||||||
|
? <span className={cx('x-dropdown__box', on && 'x-dropdown__box--on')} aria-hidden="true">{on && <Tick />}</span>
|
||||||
|
: null}
|
||||||
|
{o.dot && <span className="x-dropdown__dot" style={{ background: o.dot }} aria-hidden="true" />}
|
||||||
|
<span className="x-dropdown__text">
|
||||||
|
<span className="x-dropdown__label">{o.label}</span>
|
||||||
|
{o.hint && <span className="x-dropdown__hint">{o.hint}</span>}
|
||||||
|
</span>
|
||||||
|
{!multiple && on && <span className="x-dropdown__tick" aria-hidden="true"><Tick /></span>}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
{multiple && chosen.length > 0 && (
|
||||||
|
<div className="x-dropdown__foot">
|
||||||
|
<button type="button" className="x-dropdown__clear" onClick={() => onChange?.([])}>{allLabel ? `${labels.clear} · ${allLabel}` : labels.clear}</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</Portal>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -8,8 +8,8 @@ const MARGIN = 8
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The "(i)" help tip next to a setting or label (D-12: every manager page gets them).
|
* The "(i)" help tip next to a setting or label (D-12: every manager page gets them).
|
||||||
* Opens on click/tap (works on touch screens), closes on Escape, a click outside, or
|
* Opens while the pointer rests on it (2026-11-20) and on click/tap (touch screens: a tap keeps
|
||||||
* a second click. Placed above the button, or below when there's no room.
|
* it open), closes on Escape, a click outside, a second click or the pointer leaving. Placed above the button, or below when there's no room.
|
||||||
*
|
*
|
||||||
* <label>Alert after failures <InfoTip>How many failed print attempts before managers are notified. 0 turns it off.</InfoTip></label>
|
* <label>Alert after failures <InfoTip>How many failed print attempts before managers are notified. 0 turns it off.</InfoTip></label>
|
||||||
*
|
*
|
||||||
@@ -17,7 +17,14 @@ const MARGIN = 8
|
|||||||
*/
|
*/
|
||||||
export function InfoTip({ children, label, side = 'top', className }) {
|
export function InfoTip({ children, label, side = 'top', className }) {
|
||||||
const labels = useLabels()
|
const labels = useLabels()
|
||||||
const [open, setOpen] = useState(false)
|
const [pinned, setPinned] = useState(false)
|
||||||
|
const [hover, setHover] = useState(false)
|
||||||
|
const leaveTimer = useRef(null)
|
||||||
|
const open = pinned || hover
|
||||||
|
const setOpen = v => { setPinned(v); if (!v) setHover(false) }
|
||||||
|
const enter = () => { clearTimeout(leaveTimer.current); setHover(true) }
|
||||||
|
const leave = () => { clearTimeout(leaveTimer.current); leaveTimer.current = setTimeout(() => setHover(false), 120) }
|
||||||
|
useEffect(() => () => clearTimeout(leaveTimer.current), [])
|
||||||
const [pos, setPos] = useState(null)
|
const [pos, setPos] = useState(null)
|
||||||
const button = useRef(null)
|
const button = useRef(null)
|
||||||
const tip = useRef(null)
|
const tip = useRef(null)
|
||||||
@@ -66,7 +73,9 @@ export function InfoTip({ children, label, side = 'top', className }) {
|
|||||||
aria-label={label ?? labels.moreInfo}
|
aria-label={label ?? labels.moreInfo}
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
aria-describedby={open ? id : undefined}
|
aria-describedby={open ? id : undefined}
|
||||||
onClick={() => setOpen(o => !o)}
|
onClick={() => setOpen(!pinned)}
|
||||||
|
onPointerEnter={e => { if (e.pointerType === 'mouse') enter() }}
|
||||||
|
onPointerLeave={e => { if (e.pointerType === 'mouse') leave() }}
|
||||||
>
|
>
|
||||||
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">
|
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">
|
||||||
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" strokeWidth="1.5" />
|
<circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" strokeWidth="1.5" />
|
||||||
@@ -80,6 +89,8 @@ export function InfoTip({ children, label, side = 'top', className }) {
|
|||||||
ref={tip}
|
ref={tip}
|
||||||
id={id}
|
id={id}
|
||||||
role="tooltip"
|
role="tooltip"
|
||||||
|
onPointerEnter={enter}
|
||||||
|
onPointerLeave={leave}
|
||||||
className={cx('x-infotip__popover', pos && (pos.above ? 'x-infotip__popover--above' : 'x-infotip__popover--below'))}
|
className={cx('x-infotip__popover', pos && (pos.above ? 'x-infotip__popover--above' : 'x-infotip__popover--below'))}
|
||||||
style={pos ? { top: pos.top, left: pos.left, '--x-arrow-x': `${pos.arrow}px` } : { top: 0, left: 0, visibility: 'hidden' }}
|
style={pos ? { top: pos.top, left: pos.left, '--x-arrow-x': `${pos.arrow}px` } : { top: 0, left: 0, visibility: 'hidden' }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { cx } from '../internal/cx.js'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The page rule (2026-11-20): every app page's root. It scrolls on its own, fills the area up to
|
||||||
|
* a 16:9 screen's width (--x-page-max) and is centred beyond it (ultrawides), with the same
|
||||||
|
* padding and gaps everywhere. Never put padding, max-width or overflow on a page's root yourself.
|
||||||
|
*
|
||||||
|
* <Page testId="contacts-page">
|
||||||
|
* <PageHeader title="Contacts" subtitle="12 contacts" actions={<Button>New</Button>} />
|
||||||
|
* <Toolbar><SearchInput … /><Dropdown … /></Toolbar>
|
||||||
|
* …
|
||||||
|
* </Page>
|
||||||
|
*
|
||||||
|
* top: an element kept above the scrolling part (a tab strip), as wide as the content.
|
||||||
|
* width: 'full' (default: lists, tables, dashboards) | 'form' (settings and forms, --x-page-form-max).
|
||||||
|
* flush: no padding (a page that draws edge to edge, e.g. a map).
|
||||||
|
*/
|
||||||
|
export function Page({ top, width = 'full', flush = false, className, bodyClassName, testId, children, ...rest }) {
|
||||||
|
return (
|
||||||
|
<div className={cx('x-page', className)} data-testid={testId} {...rest}>
|
||||||
|
{top && <div className="x-page__top"><div className={cx('x-page__top-inner', width === 'form' && 'x-page__body--form')}>{top}</div></div>}
|
||||||
|
<div className="x-page__scroll">
|
||||||
|
<div className={cx('x-page__body', width === 'form' && 'x-page__body--form', flush && 'x-page__body--flush', bodyClassName)}>{children}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A page's title row: title, an optional line under it, actions on the right. */
|
||||||
|
export function PageHeader({ title, subtitle, actions, info, className }) {
|
||||||
|
return (
|
||||||
|
<header className={cx('x-page-header', className)}>
|
||||||
|
<div className="x-page-header__titles">
|
||||||
|
{title && <h1 className="x-page-header__title">{title}{info}</h1>}
|
||||||
|
{subtitle && <p className="x-page-header__subtitle">{subtitle}</p>}
|
||||||
|
</div>
|
||||||
|
{actions && <div className="x-page-header__actions">{actions}</div>}
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A row of filters and actions over a list. Every control in it has the same height
|
||||||
|
* (size 'md' by default: <SearchInput>, <Dropdown>, <FilterChip>, <Segmented>, <Button>).
|
||||||
|
* <ToolbarSpacer /> pushes what follows to the right.
|
||||||
|
*/
|
||||||
|
export function Toolbar({ className, children, ...rest }) {
|
||||||
|
return <div className={cx('x-toolbar', className)} {...rest}>{children}</div>
|
||||||
|
}
|
||||||
|
export function ToolbarSpacer() {
|
||||||
|
return <span className="x-toolbar__spacer" aria-hidden="true" />
|
||||||
|
}
|
||||||
@@ -15,6 +15,11 @@ export const DEFAULT_LABELS = {
|
|||||||
decrease: 'Less',
|
decrease: 'Less',
|
||||||
increase: 'More',
|
increase: 'More',
|
||||||
submit: 'OK',
|
submit: 'OK',
|
||||||
|
search: 'Search',
|
||||||
|
clear: 'Clear',
|
||||||
|
all: 'All',
|
||||||
|
noOptions: 'Nothing found',
|
||||||
|
selected: n => `${n} selected`,
|
||||||
pinProgress: (n, total) => `${n} of ${total} digits entered`,
|
pinProgress: (n, total) => `${n} of ${total} digits entered`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ export { InfoTip } from './components/InfoTip.jsx'
|
|||||||
export { EmptyState } from './components/EmptyState.jsx'
|
export { EmptyState } from './components/EmptyState.jsx'
|
||||||
export { Spinner } from './components/Spinner.jsx'
|
export { Spinner } from './components/Spinner.jsx'
|
||||||
export { Field, Input, Textarea, Select } from './components/Field.jsx'
|
export { Field, Input, Textarea, Select } from './components/Field.jsx'
|
||||||
|
export { Dropdown } from './components/Dropdown.jsx'
|
||||||
|
export { Page, PageHeader, Toolbar, ToolbarSpacer } from './components/Page.jsx'
|
||||||
|
export { SearchInput, FilterChip, Segmented, Tabs } from './components/Controls.jsx'
|
||||||
export { Switch } from './components/Switch.jsx'
|
export { Switch } from './components/Switch.jsx'
|
||||||
export { Stepper } from './components/Stepper.jsx'
|
export { Stepper } from './components/Stepper.jsx'
|
||||||
export { ReasonPicker, reasonText } from './components/ReasonPicker.jsx'
|
export { ReasonPicker, reasonText } from './components/ReasonPicker.jsx'
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
--x-line-rgb: 226 232 240;
|
--x-line-rgb: 226 232 240;
|
||||||
--x-line-strong-rgb: 203 213 225;
|
--x-line-strong-rgb: 203 213 225;
|
||||||
--x-ink-rgb: 15 23 42;
|
--x-ink-rgb: 15 23 42;
|
||||||
--x-ink-2-rgb: 71 85 105;
|
--x-ink-2-rgb: 94 109 132; /* secondary text: muted (2026-11-20) */
|
||||||
--x-ink-3-rgb: 100 116 139;
|
--x-ink-3-rgb: 100 116 139;
|
||||||
--x-success-rgb: 21 128 61;
|
--x-success-rgb: 21 128 61;
|
||||||
--x-success-fg-rgb: 255 255 255;
|
--x-success-fg-rgb: 255 255 255;
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
--x-line-rgb: 37 50 69;
|
--x-line-rgb: 37 50 69;
|
||||||
--x-line-strong-rgb: 58 77 104;
|
--x-line-strong-rgb: 58 77 104;
|
||||||
--x-ink-rgb: 237 242 247;
|
--x-ink-rgb: 237 242 247;
|
||||||
--x-ink-2-rgb: 148 163 184;
|
--x-ink-2-rgb: 140 156 177;
|
||||||
--x-ink-3-rgb: 122 143 166;
|
--x-ink-3-rgb: 122 143 166;
|
||||||
--x-success-rgb: 34 197 94;
|
--x-success-rgb: 34 197 94;
|
||||||
--x-success-fg-rgb: 5 46 22;
|
--x-success-fg-rgb: 5 46 22;
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
--x-line-rgb: 37 50 69;
|
--x-line-rgb: 37 50 69;
|
||||||
--x-line-strong-rgb: 58 77 104;
|
--x-line-strong-rgb: 58 77 104;
|
||||||
--x-ink-rgb: 237 242 247;
|
--x-ink-rgb: 237 242 247;
|
||||||
--x-ink-2-rgb: 148 163 184;
|
--x-ink-2-rgb: 140 156 177;
|
||||||
--x-ink-3-rgb: 122 143 166;
|
--x-ink-3-rgb: 122 143 166;
|
||||||
--x-success-rgb: 34 197 94;
|
--x-success-rgb: 34 197 94;
|
||||||
--x-success-fg-rgb: 5 46 22;
|
--x-success-fg-rgb: 5 46 22;
|
||||||
@@ -556,6 +556,7 @@
|
|||||||
/* Type */
|
/* Type */
|
||||||
--x-font-sans: "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
--x-font-sans: "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||||
--x-font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
|
--x-font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
|
||||||
|
--x-text-overline: 11px; --x-leading-overline: 14px; /* small uppercase labels over figures and sections */
|
||||||
--x-text-caption: 12px; --x-leading-caption: 16px;
|
--x-text-caption: 12px; --x-leading-caption: 16px;
|
||||||
--x-text-label: 13px; --x-leading-label: 18px;
|
--x-text-label: 13px; --x-leading-label: 18px;
|
||||||
--x-text-body: 14px; --x-leading-body: 20px;
|
--x-text-body: 14px; --x-leading-body: 20px;
|
||||||
@@ -583,6 +584,17 @@
|
|||||||
--x-space-12: 48px;
|
--x-space-12: 48px;
|
||||||
--x-space-16: 64px;
|
--x-space-16: 64px;
|
||||||
|
|
||||||
|
/* Inside a card / panel / section: the gap between its border and its content */
|
||||||
|
--x-pad-card: 20px;
|
||||||
|
--x-pad-card-y: 14px; /* a card's header row and list rows */
|
||||||
|
|
||||||
|
/* Pages (the page rule, 2026-11-20): a page fills its area up to a 16:9 screen's width and
|
||||||
|
is centred beyond it, so ultrawides keep a 16:9 page instead of stretched content. */
|
||||||
|
--x-page-max: max(1280px, calc(100vh * 16 / 9));
|
||||||
|
--x-page-pad: 24px;
|
||||||
|
--x-page-gap: 20px;
|
||||||
|
--x-page-form-max: 880px; /* forms and settings that read badly when stretched */
|
||||||
|
|
||||||
/* Radius */
|
/* Radius */
|
||||||
--x-radius-sm: 8px; /* chips, small controls */
|
--x-radius-sm: 8px; /* chips, small controls */
|
||||||
--x-radius-control: 12px; /* buttons, inputs (the manager's rounded-xl) */
|
--x-radius-control: 12px; /* buttons, inputs (the manager's rounded-xl) */
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ export default {
|
|||||||
warning: tone('warning'),
|
warning: tone('warning'),
|
||||||
danger: tone('danger'),
|
danger: tone('danger'),
|
||||||
info: tone('info'),
|
info: tone('info'),
|
||||||
|
special: tone('special'), // offers, deals, money left on tabs
|
||||||
// the board design language (kitchen display): bg-board-bg, text-board-ink-2, bg-board-late…
|
// the board design language (kitchen display): bg-board-bg, text-board-ink-2, bg-board-late…
|
||||||
board: Object.fromEntries(BOARD.map(n => [n, c(`board-${n}`)])),
|
board: Object.fromEntries(BOARD.map(n => [n, c(`board-${n}`)])),
|
||||||
// the manager's navigation rail (6.14b): bg-nav-bg, text-nav-ink-2, bg-nav-active…
|
// the manager's navigation rail (6.14b): bg-nav-bg, text-nav-ink-2, bg-nav-active…
|
||||||
nav: Object.fromEntries(['bg', 'raised', 'active', 'line', 'ink', 'ink-2', 'ink-3', 'dot'].map(n => [n, c(`nav-${n}`)])),
|
nav: Object.fromEntries(['bg', 'raised', 'active', 'line', 'ink', 'ink-2', 'ink-3', 'dot'].map(n => [n, c(`nav-${n}`)])),
|
||||||
},
|
},
|
||||||
fontSize: {
|
fontSize: {
|
||||||
|
overline: ['var(--x-text-overline)', { lineHeight: 'var(--x-leading-overline)' }], // small uppercase labels (2026-11-20)
|
||||||
caption: ['var(--x-text-caption)', { lineHeight: 'var(--x-leading-caption)' }],
|
caption: ['var(--x-text-caption)', { lineHeight: 'var(--x-leading-caption)' }],
|
||||||
label: ['var(--x-text-label)', { lineHeight: 'var(--x-leading-label)' }],
|
label: ['var(--x-text-label)', { lineHeight: 'var(--x-leading-label)' }],
|
||||||
body: ['var(--x-text-body)', { lineHeight: 'var(--x-leading-body)' }],
|
body: ['var(--x-text-body)', { lineHeight: 'var(--x-leading-body)' }],
|
||||||
@@ -61,6 +63,9 @@ export default {
|
|||||||
overlay: 'var(--x-shadow-overlay)',
|
overlay: 'var(--x-shadow-overlay)',
|
||||||
focus: 'var(--x-focus-ring)',
|
focus: 'var(--x-focus-ring)',
|
||||||
},
|
},
|
||||||
|
// inside a card / panel: p-card, px-card, py-card-y (2026-11-20)
|
||||||
|
spacing: { card: 'var(--x-pad-card)', 'card-y': 'var(--x-pad-card-y)' },
|
||||||
|
maxWidth: { page: 'var(--x-page-max)' },
|
||||||
minHeight: { control: 'var(--x-control-md)' },
|
minHeight: { control: 'var(--x-control-md)' },
|
||||||
height: { 'control-sm': 'var(--x-control-sm)', control: 'var(--x-control-md)', 'control-lg': 'var(--x-control-lg)' },
|
height: { 'control-sm': 'var(--x-control-sm)', control: 'var(--x-control-md)', 'control-lg': 'var(--x-control-lg)' },
|
||||||
transitionDuration: { fast: 'var(--x-duration-fast)', base: 'var(--x-duration-base)' },
|
transitionDuration: { fast: 'var(--x-duration-fast)', base: 'var(--x-duration-base)' },
|
||||||
|
|||||||
Reference in New Issue
Block a user