feat(ui): board design language as global tokens; KDS on tokens and shared components (platform-v2 3.2b-2)

- @xenia/ui: --x-board-* tokens (the kitchen display's look: dark board, light cards,
  status colours, card radius/shadows, number font), Tailwind board.* colours, contrast
  test for the board pairs; near-identical shades merged.
- New shared Stepper component (gallery + ui.mjs), labels ui.decrease / ui.increase.
- KDS: theme.js maps to the board tokens, no colour literals left (only stored setting
  values); decline / call waiter / settings use Dialog, Button, Switch, Select, Stepper;
  toasts are @xenia/ui toasts (ToastProvider at the terminal root).
- Terminal: apps can set their theme (APP_THEMES, KDS dark) while they run.
- CS-16: board screens and "no hard-coded colours in app code".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 20:02:35 +02:00
co-authored by Claude Opus 5.5
parent 5f6d4ab428
commit 77e0adbe9c
26 changed files with 485 additions and 383 deletions
+18
View File
@@ -271,6 +271,24 @@
.x-select__control { appearance: none; -webkit-appearance: none; padding-right: var(--x-space-10); cursor: pointer; }
.x-select__chevron { position: absolute; right: var(--x-space-3); top: 50%; transform: translateY(-50%); color: var(--x-ink-3); pointer-events: none; }
/* ── Stepper ─────────────────────────────────────────────────────────────── */
.x-stepper { display: inline-flex; align-items: center; gap: var(--x-space-1-5); flex-shrink: 0; }
.x-stepper__btn {
display: inline-flex; align-items: center; justify-content: center;
width: var(--x-control-md); height: var(--x-control-md); padding: 0;
border: 1px solid var(--x-line-strong); border-radius: var(--x-radius-control);
background: var(--x-surface-2); color: var(--x-ink); cursor: pointer;
transition: background-color var(--x-duration-fast) var(--x-ease);
-webkit-tap-highlight-color: transparent;
}
.x-stepper__btn:hover:not(:disabled) { background: var(--x-surface-3); }
.x-stepper__btn:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
.x-stepper__btn:disabled { color: var(--x-ink-3); opacity: 0.5; cursor: default; }
.x-stepper__value {
min-width: 64px; text-align: center; font-family: var(--x-font-mono);
font-size: var(--x-text-body-lg); font-weight: var(--x-weight-bold); color: var(--x-ink);
}
/* ── Switch ──────────────────────────────────────────────────────────────── */
.x-switch {
position: relative; flex-shrink: 0;
+31
View File
@@ -0,0 +1,31 @@
import { cx } from '../internal/cx.js'
import { useLabels } from './labels.js'
const Icon = ({ d }) => (
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="2.25" strokeLinecap="round" aria-hidden="true"><path d={d} /></svg>
)
/**
* − value + for numbers picked in steps on a touch screen (plan step 3.2b-2).
* <Stepper value={30} steps={[10, 15, 20, 30, 45, 60]} format={v => `${v}s`} onChange={setSeconds} />
* <Stepper value={5} min={1} max={12} onChange={setMinutes} /> (step 1)
* With `steps`, the value snaps to the nearest step; min/max limit the steps too.
* aria: the value is announced (aria-live); label names the group.
*/
export function Stepper({ value, onChange, steps, min = -Infinity, max = Infinity, step = 1, format = String, label, disabled = false, className, ...rest }) {
const labels = useLabels()
const options = steps ? steps.filter(s => s >= min && s <= max) : null
const cur = options?.length ? options.reduce((a, b) => (Math.abs(b - value) < Math.abs(a - value) ? b : a)) : value
const i = options ? options.indexOf(cur) : -1
const canDec = !disabled && (options ? i > 0 : cur - step >= min)
const canInc = !disabled && (options ? i < options.length - 1 : cur + step <= max)
const dec = () => canDec && onChange?.(options ? options[i - 1] : cur - step)
const inc = () => canInc && onChange?.(options ? options[i + 1] : cur + step)
return (
<div role="group" aria-label={label} className={cx('x-stepper', disabled && 'x-stepper--disabled', className)} {...rest}>
<button type="button" className="x-stepper__btn" onClick={dec} disabled={!canDec} aria-label={labels.decrease}><Icon d="M5 12h14" /></button>
<span className="x-stepper__value" aria-live="polite">{format(cur)}</span>
<button type="button" className="x-stepper__btn" onClick={inc} disabled={!canInc} aria-label={labels.increase}><Icon d="M12 5v14M5 12h14" /></button>
</div>
)
}
+2
View File
@@ -12,6 +12,8 @@ export const DEFAULT_LABELS = {
moreInfo: 'More info',
notifications: 'Notifications',
backspace: 'Delete',
decrease: 'Less',
increase: 'More',
submit: 'OK',
pinProgress: (n, total) => `${n} of ${total} digits entered`,
}
+1
View File
@@ -20,6 +20,7 @@ export { EmptyState } from './components/EmptyState.jsx'
export { Spinner } from './components/Spinner.jsx'
export { Field, Input, Textarea, Select } from './components/Field.jsx'
export { Switch } from './components/Switch.jsx'
export { Stepper } from './components/Stepper.jsx'
export { UiLabelsProvider, DEFAULT_LABELS } from './components/labels.js'
export { cx } from './internal/cx.js'
export { THEMES, THEME_STORAGE_KEY, applyTheme, getStoredTheme } from './theme.js'
+88
View File
@@ -246,6 +246,94 @@
}
}
/* ── Board (the kitchen display's design language, plan step 3.2b-2) ───────
* A dark board with light cards, for screens read from a distance (kitchen, bar,
* and any later "board" screen). Always dark: it doesn't follow data-theme; the
* dialogs on a board use the normal components in data-theme="dark".
* The age colours here are only defaults: each KDS screen stores its own. */
:root {
--x-board-bg-rgb: 29 35 43; /* the board behind the cards */
--x-board-rail-rgb: 22 27 33; /* side rail, side panels */
--x-board-topbar-rgb: 32 39 47; /* top bar */
--x-board-line-rgb: 43 51 61; /* dividers, tabs, badges */
--x-board-deep-rgb: 10 14 19; /* action bars, text on light badges, scrims */
--x-board-ink-rgb: 231 236 242; /* text on the board */
--x-board-ink-2-rgb: 170 180 192; /* secondary text, tabs */
--x-board-ink-3-rgb: 123 134 148; /* muted text, idle rail buttons */
--x-board-ink-4-rgb: 94 103 114; /* empty states */
--x-board-tab-active-rgb: 243 246 249; /* the selected tab */
--x-board-on-status-rgb: 255 255 255; /* text on coloured headers */
--x-board-card-rgb: 255 255 255; /* card body */
--x-board-card-ink-rgb: 31 36 43; /* item names */
--x-board-card-ink-2-rgb: 65 71 79; /* card footer text */
--x-board-card-muted-rgb: 174 180 188; /* done items, labels on the card */
--x-board-card-soft-rgb: 240 242 245; /* quantity badges, footer, scheduled orders */
--x-board-card-line-rgb: 232 235 239; /* lines inside a card */
--x-board-card-progress-rgb: 243 248 255; /* body of an order in progress */
--x-board-card-done-rgb: 244 247 244; /* body of a done order */
--x-board-note-rgb: 255 251 235; /* order note background */
--x-board-note-ink-rgb: 180 83 9; /* order note text */
--x-board-fresh-rgb: 52 181 106; /* new order (default age colour) */
--x-board-fresh-deep-rgb: 30 128 72; /* its subheader; extras on items */
--x-board-warning-rgb: 240 165 42; /* waiting a while */
--x-board-warning-deep-rgb: 184 115 16; /* its subheader; choices on items; call waiter */
--x-board-late-rgb: 232 81 63; /* late */
--x-board-late-deep-rgb: 160 45 30; /* its subheader; removed on items; decline */
--x-board-done-rgb: 61 71 87; /* done order header */
--x-board-done-deep-rgb: 42 49 64; /* its subheader */
--x-board-future-rgb: 74 85 104; /* scheduled order header */
--x-board-future-deep-rgb: 55 65 81; /* its subheader */
--x-board-future-glow-rgb: 109 208 138; /* scheduled: rail badge, card glow */
--x-board-progress-rgb: 47 127 240; /* in progress, selection, item notes */
--x-board-fresh-soft-rgb: 134 239 172; /* extras in the totals panel */
--x-board-warning-soft-rgb: 252 211 77; /* choices in the totals panel */
--x-board-late-soft-rgb: 252 165 165; /* removed in the totals panel */
--x-board-progress-soft-rgb: 147 197 253; /* notes in the totals panel */
--x-board-bg: rgb(var(--x-board-bg-rgb));
--x-board-rail: rgb(var(--x-board-rail-rgb));
--x-board-topbar: rgb(var(--x-board-topbar-rgb));
--x-board-line: rgb(var(--x-board-line-rgb));
--x-board-deep: rgb(var(--x-board-deep-rgb));
--x-board-ink: rgb(var(--x-board-ink-rgb));
--x-board-ink-2: rgb(var(--x-board-ink-2-rgb));
--x-board-ink-3: rgb(var(--x-board-ink-3-rgb));
--x-board-ink-4: rgb(var(--x-board-ink-4-rgb));
--x-board-tab-active: rgb(var(--x-board-tab-active-rgb));
--x-board-on-status: rgb(var(--x-board-on-status-rgb));
--x-board-card: rgb(var(--x-board-card-rgb));
--x-board-card-ink: rgb(var(--x-board-card-ink-rgb));
--x-board-card-ink-2: rgb(var(--x-board-card-ink-2-rgb));
--x-board-card-muted: rgb(var(--x-board-card-muted-rgb));
--x-board-card-soft: rgb(var(--x-board-card-soft-rgb));
--x-board-card-line: rgb(var(--x-board-card-line-rgb));
--x-board-card-progress: rgb(var(--x-board-card-progress-rgb));
--x-board-card-done: rgb(var(--x-board-card-done-rgb));
--x-board-note: rgb(var(--x-board-note-rgb));
--x-board-note-ink: rgb(var(--x-board-note-ink-rgb));
--x-board-fresh: rgb(var(--x-board-fresh-rgb));
--x-board-fresh-deep: rgb(var(--x-board-fresh-deep-rgb));
--x-board-warning: rgb(var(--x-board-warning-rgb));
--x-board-warning-deep: rgb(var(--x-board-warning-deep-rgb));
--x-board-late: rgb(var(--x-board-late-rgb));
--x-board-late-deep: rgb(var(--x-board-late-deep-rgb));
--x-board-done: rgb(var(--x-board-done-rgb));
--x-board-done-deep: rgb(var(--x-board-done-deep-rgb));
--x-board-future: rgb(var(--x-board-future-rgb));
--x-board-future-deep: rgb(var(--x-board-future-deep-rgb));
--x-board-future-glow: rgb(var(--x-board-future-glow-rgb));
--x-board-progress: rgb(var(--x-board-progress-rgb));
--x-board-fresh-soft: rgb(var(--x-board-fresh-soft-rgb));
--x-board-warning-soft: rgb(var(--x-board-warning-soft-rgb));
--x-board-late-soft: rgb(var(--x-board-late-soft-rgb));
--x-board-progress-soft: rgb(var(--x-board-progress-soft-rgb));
--x-board-radius-card: 10px;
--x-board-shadow-card: 0 1px 2px rgb(0 0 0 / 0.25), 0 6px 16px rgb(0 0 0 / 0.22);
--x-board-shadow-focus: 0 10px 24px rgb(0 0 0 / 0.40), 0 0 0 4px rgb(var(--x-board-progress-rgb) / 0.25);
--x-board-font-number: "Inter", "SF Pro Display", var(--x-font-sans);
}
/* ── Ready-to-use colours ────────────────────────────────────────────────────
* Redeclared wherever the channels can change, so a nested data-theme /
* data-venue-theme container gets its own values (custom properties are