feat(ui): Pane and Page fit/header, inset/fill Tabs, quiet tones, dialog toolbar

- Page `fit` + `Pane`: panes scroll on their own, the page doesn't (from 768 px);
  Page `header`: the title and description above the tabs; the scrollbar's room
  is always kept, so short and long tabs are the same width.
- Tabs `inset` (a card's header: room around the end button) and `fill`.
- IconButton tone: grey at rest, the colour on hover; Button tone (ghost text
  that turns red on hover).
- Dialog / Sheet `toolbar`: stays under the title while the body scrolls.
- A Switch without a label lines up with the buttons beside it.
- DESIGN.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 17:51:16 +02:00
co-authored by Claude Opus 5.5
parent 1053703f0d
commit 181b2f16b0
8 changed files with 90 additions and 22 deletions
+10 -3
View File
@@ -31,11 +31,14 @@ Every page's root is `<Page>` from `@xenia/ui`. It provides:
``` ```
- `top={<Tabs … />}` keeps a tab strip above the scrolling part (Online orders, Settings). The tab is kept in the address (`?tab=`). - `top={<Tabs … />}` keeps a tab strip above the scrolling part (Online orders, Settings). The tab is kept in the address (`?tab=`).
- `header={<PageHeader … />}` with `top`: the page's title and description come **first**, then the tabs (Offers & pricing). Each tab then starts with its own head: title, description, its "New" button at the top right.
- `fit`: the page is exactly the screen's height and doesn't scroll; its `Pane`s do, each on its own (Products). Put them in an element with `x-page__fill`. Phones scroll as usual.
- The scrollbar's room is always kept (`scrollbar-gutter: stable`), so a short tab is exactly as wide as a long one.
- `width="form"` for settings and forms (centred at `--x-page-form-max`, 880 px). Lists, tables and dashboards use the default (full). - `width="form"` for settings and forms (centred at `--x-page-form-max`, 880 px). Lists, tables and dashboards use the default (full).
- **Never** put `p-*`, `max-w-*`, `mx-auto`, `h-full` or `overflow-*` on a page's root, and never nest a second width limit inside it. - **Never** put `p-*`, `max-w-*`, `mx-auto`, `h-full` or `overflow-*` on a page's root, and never nest a second width limit inside it.
- Checked by `tests/e2e/manager_layout.mjs` (1920×1080 and 3440×1440: every page fills / is centred, and scrolls). Add a new page to its `PAGES` list. - Checked by `tests/e2e/manager_layout.mjs` (1920×1080 and 3440×1440: every page fills / is centred, and scrolls). Add a new page to its `PAGES` list.
Every page is on `<Page>` except Inventory → Stock (a placeholder). Two-column pages (Products: the category tree and the list; the floor editor: the map and its panels) put each side in its own container (`rounded-card border bg-surface shadow-raised`), the narrow side `sticky` so it stays in view while the page scrolls. Every page is on `<Page>` except Inventory → Stock (a placeholder). Two-column pages put each side in its own container. Products is a `Page fit` with two `Pane`s (header and footer stay, only the list scrolls; the list's body `sunken`, a shade darker, so the white product rows stand out). The floor editor: the map and its panels, the narrow side `sticky`.
## 3. Components (`@xenia/ui`) ## 3. Components (`@xenia/ui`)
@@ -47,11 +50,15 @@ Every page is on `<Page>` except Inventory → Stock (a placeholder). Two-column
| Choose one / several | `Dropdown` (`multiple`) | **never a native `<select>` in a toolbar.** Multi: value is an array, `[]` = all (`allLabel`). Options can carry a `dot` (a zone's colour) and a `hint`. Search box from 9 options. Same heights as `Input`. Native `Select` stays only inside forms where the phone's own picker is better | | Choose one / several | `Dropdown` (`multiple`) | **never a native `<select>` in a toolbar.** Multi: value is an array, `[]` = all (`allLabel`). Options can carry a `dot` (a zone's colour) and a `hint`. Search box from 9 options. Same heights as `Input`. Native `Select` stays only inside forms where the phone's own picker is better |
| A toggle filter (a state) | `FilterChip` (`tone`, `count`) | | | A toggle filter (a state) | `FilterChip` (`tone`, `count`) | |
| Two or three views (List / Map / QR) | `Segmented` | the view in the address (`?view=`) | | Two or three views (List / Map / QR) | `Segmented` | the view in the address (`?view=`) |
| Sections of a page or a dialog | `Tabs` (`size="lg"` on pages) | scrolls sideways only, never up/down | | Sections of a page or a dialog | `Tabs` (`size="lg"` on pages) | scrolls sideways only, never up/down. `inset`: the strip is a card's header (card padding at the sides, the same room above and below a button in `end`). `fill`: the tabs share the width equally (a narrow column) |
| A container whose list scrolls | `Pane` (`header`, `footer`, `sunken`) | header and footer stay, the body scrolls; one side of a `Page fit` |
| A help tip | `InfoTip` | opens on hover (mouse) and on tap. Beside a switch: `Switch info={<InfoTip>…}` puts it right after the text, never after the switch | | A help tip | `InfoTip` | opens on hover (mouse) and on tap. Beside a switch: `Switch info={<InfoTip>…}` puts it right after the text, never after the switch |
| Row actions that stand apart | `IconButton tone` | `danger` delete / archive · `warning` block · `info` zones · `accent` edit · `success` unblock: a pastel button (soft background, ink icon). Neutral actions stay `ghost` | | Row actions that stand apart | `IconButton tone` | `danger` delete / archive · `warning` block · `info` zones · `accent` edit · `success` unblock: a **grey** square at rest; under the pointer the icon takes the colour (2026-11-21: quiet at rest). Neutral actions stay `ghost` |
| A quiet text action that warns | `Button variant="ghost" tone="danger"` | grey text, red under the pointer ("Remove" a picture) |
| A switch on its own in a row of buttons | `Switch` without a label | lines up with the buttons (centred), never with a text baseline |
| Dialogs | `Dialog` `sm` 400 · `md` 520 · `lg` 720 · `xl` 920 · `wide` (~88 % of a 16:9 screen, capped on ultrawides) | the day summary is `xl`, the product editor `wide` | | Dialogs | `Dialog` `sm` 400 · `md` 520 · `lg` 720 · `xl` 920 · `wide` (~88 % of a 16:9 screen, capped on ultrawides) | the day summary is `xl`, the product editor `wide` |
| A side drawer | `Sheet side="right"` (`size="wide"`: 600 px) | the permissions editor is `wide` | | A side drawer | `Sheet side="right"` (`size="wide"`: 600 px) | the permissions editor is `wide` |
| Something that stays at the top of a dialog or drawer | `toolbar` (Dialog / Sheet) | under the title, doesn't scroll: the permissions' search box |
| Print only this | `PrintArea` (+ `PrintSheet` for cards to cut out) | rendered into `<body>`, hidden on screen; while mounted, printing prints only it. One per page | | Print only this | `PrintArea` (+ `PrintSheet` for cards to cut out) | rendered into `<body>`, hidden on screen; while mounted, printing prints only it. One per page |
| Section titles inside a panel or drawer | `text-overline font-semibold uppercase tracking-wide text-ink-3` + a `flex-1 border-t border-line` rule after it | as the navigation's group titles | | Section titles inside a panel or drawer | `text-overline font-semibold uppercase tracking-wide text-ink-3` + a `flex-1 border-t border-line` rule after it | as the navigation's group titles |
+34 -5
View File
@@ -52,9 +52,13 @@
.x-btn--danger:hover:not(:disabled) { background: rgb(var(--x-danger-rgb) / 0.88); } .x-btn--danger:hover:not(:disabled) { background: rgb(var(--x-danger-rgb) / 0.88); }
.x-btn--icon { padding: 0; width: var(--x-control-md); } .x-btn--icon { padding: 0; width: var(--x-control-md); }
/* a pastel tone on a button (IconButton tone=…): soft background, ink icon */ /* a tone on a button (2026-11-21): quiet at rest, its colour only under the pointer.
.x-btn--tone { background: rgb(var(--x-tone-soft)); color: rgb(var(--x-tone-ink)); } * IconButton tone=…: a grey square, the icon in the tone's ink on hover / focus.
.x-btn--tone:hover:not(:disabled) { background: rgb(var(--x-tone) / 0.24); color: rgb(var(--x-tone-ink)); } * Button tone=… (ghost): plain text, the tone's ink on hover (e.g. "Remove" turns red). */
.x-btn--tone { color: var(--x-ink-2); }
.x-btn--tone:hover:not(:disabled), .x-btn--tone:focus-visible { color: rgb(var(--x-tone-ink)); }
.x-btn--icon.x-btn--tone { background: var(--x-surface-2); }
.x-btn--icon.x-btn--tone:hover:not(:disabled) { background: var(--x-surface-3); }
.x-btn--tone-danger { --x-tone: var(--x-danger-rgb); --x-tone-soft: var(--x-danger-soft-rgb); --x-tone-ink: var(--x-danger-ink-rgb); } .x-btn--tone-danger { --x-tone: var(--x-danger-rgb); --x-tone-soft: var(--x-danger-soft-rgb); --x-tone-ink: var(--x-danger-ink-rgb); }
.x-btn--tone-warning { --x-tone: var(--x-warning-rgb); --x-tone-soft: var(--x-warning-soft-rgb); --x-tone-ink: var(--x-warning-ink-rgb); } .x-btn--tone-warning { --x-tone: var(--x-warning-rgb); --x-tone-soft: var(--x-warning-soft-rgb); --x-tone-ink: var(--x-warning-ink-rgb); }
.x-btn--tone-info { --x-tone: var(--x-info-rgb); --x-tone-soft: var(--x-info-soft-rgb); --x-tone-ink: var(--x-info-ink-rgb); } .x-btn--tone-info { --x-tone: var(--x-info-rgb); --x-tone-soft: var(--x-info-soft-rgb); --x-tone-ink: var(--x-info-ink-rgb); }
@@ -121,6 +125,7 @@
.x-modal__title { margin: 0; font-size: var(--x-text-title); line-height: var(--x-leading-title); font-weight: var(--x-weight-semibold); } .x-modal__title { margin: 0; font-size: var(--x-text-title); line-height: var(--x-leading-title); font-weight: var(--x-weight-semibold); }
.x-modal__description { margin: var(--x-space-1) 0 0; font-size: var(--x-text-body); line-height: var(--x-leading-body); color: var(--x-ink-2); } .x-modal__description { margin: var(--x-space-1) 0 0; font-size: var(--x-text-body); line-height: var(--x-leading-body); color: var(--x-ink-2); }
.x-modal__close { margin: calc(-1 * var(--x-space-1)) calc(-1 * var(--x-space-1)) 0 0; } .x-modal__close { margin: calc(-1 * var(--x-space-1)) calc(-1 * var(--x-space-1)) 0 0; }
.x-modal__toolbar { flex-shrink: 0; padding: var(--x-space-2) var(--x-space-6) var(--x-space-3); border-bottom: var(--x-border-width) solid var(--x-line); }
.x-modal__body { .x-modal__body {
flex: 1; min-height: 0; overflow-y: auto; flex: 1; min-height: 0; overflow-y: auto;
padding: var(--x-space-2) var(--x-space-6) var(--x-space-6); padding: var(--x-space-2) var(--x-space-6) var(--x-space-6);
@@ -325,6 +330,8 @@
.x-switch:focus-visible { outline: none; box-shadow: var(--x-focus-ring); } .x-switch:focus-visible { outline: none; box-shadow: var(--x-focus-ring); }
.x-switch:disabled { opacity: 0.45; cursor: not-allowed; } .x-switch:disabled { opacity: 0.45; cursor: not-allowed; }
/* a switch on its own (no label) lines up with the buttons beside it, not with a text baseline */
.x-switch-bare { display: inline-flex; align-items: center; vertical-align: middle; }
.x-switch-row { display: flex; align-items: center; gap: var(--x-space-4); } .x-switch-row { display: flex; align-items: center; gap: var(--x-space-4); }
.x-switch-row__text { flex: 1; min-width: 0; } .x-switch-row__text { flex: 1; min-width: 0; }
.x-switch-row__head { display: flex; align-items: center; gap: var(--x-space-1-5); } .x-switch-row__head { display: flex; align-items: center; gap: var(--x-space-1-5); }
@@ -355,9 +362,12 @@
/* ── Page, PageHeader, Toolbar (the page rule, 2026-11-20) ───────────────── /* ── 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. */ * 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 { 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 { flex-shrink: 0; border-bottom: var(--x-border-width) solid var(--x-line); background: var(--x-surface); overflow: hidden; scrollbar-gutter: stable; }
.x-page__top--header .x-page__top-inner { padding-top: var(--x-page-pad); display: grid; gap: var(--x-space-3); }
.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__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; } /* the scrollbar's room is always kept (2026-11-21): a short tab is as wide as a long one, and the
* strip above stays aligned with the body */
.x-page__scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.x-page__body { .x-page__body {
box-sizing: border-box; width: 100%; max-width: var(--x-page-max); margin-inline: auto; box-sizing: border-box; width: 100%; max-width: var(--x-page-max); margin-inline: auto;
padding: var(--x-page-pad); padding: var(--x-page-pad);
@@ -365,6 +375,7 @@
} }
.x-page__body--form { max-width: var(--x-page-form-max); } .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__top-inner.x-page__body--form { padding-top: 0; padding-bottom: 0; }
.x-page__top--header .x-page__top-inner.x-page__body--form { padding-top: var(--x-page-pad); }
.x-page__body--flush { padding: 0; } .x-page__body--flush { padding: 0; }
@media (max-width: 768px) { @media (max-width: 768px) {
.x-page__body, .x-page__top-inner { padding-inline: var(--x-space-4); } .x-page__body, .x-page__top-inner { padding-inline: var(--x-space-4); }
@@ -372,6 +383,20 @@
.x-page__body--flush { padding: 0; } .x-page__body--flush { padding: 0; }
} }
/* Page fit + Pane (2026-11-21): panes scroll on their own, the page doesn't (from 768 px) */
.x-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
border: var(--x-border-width) solid var(--x-line); border-radius: var(--x-radius-card); background: var(--x-surface); box-shadow: var(--x-shadow-raised); }
.x-pane__header, .x-pane__footer { flex-shrink: 0; }
.x-pane__header { border-bottom: var(--x-border-width) solid var(--x-line); }
.x-pane__footer { border-top: var(--x-border-width) solid var(--x-line); }
.x-pane__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.x-pane__body--sunken { background: var(--x-surface-2); }
@media (min-width: 768px) {
.x-page--fit .x-page__scroll { overflow: hidden; }
.x-page--fit .x-page__body { height: 100%; display: flex; flex-direction: column; }
.x-page--fit .x-page__body > * { flex-shrink: 0; }
.x-page--fit .x-page__body > .x-page__fill { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
}
.x-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--x-space-3); } .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__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__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); }
@@ -514,6 +539,10 @@
.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 { 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__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); } .x-tabs__end { flex-shrink: 0; display: flex; align-items: center; gap: var(--x-space-2); }
.x-tabs--inset { align-items: stretch; padding-inline: var(--x-pad-card); min-height: calc(var(--x-control-sm) + 2 * var(--x-pad-card)); }
.x-tabs--inset .x-tabs__list { align-items: flex-end; }
.x-tabs--inset .x-tabs__end { padding-block: var(--x-pad-card); }
.x-tabs--fill .x-tabs__tab { flex: 1 1 0; justify-content: center; }
/* ── Print (PrintArea / PrintSheet, 2026-11-20) ───────────────────────────── /* ── Print (PrintArea / PrintSheet, 2026-11-20) ─────────────────────────────
* A mounted .x-print-area is the only thing printed; on screen it is hidden. */ * A mounted .x-print-area is the only thing printed; on screen it is hidden. */
+7 -5
View File
@@ -6,16 +6,18 @@ import { Spinner } from './Spinner.jsx'
* size: 'sm' (36px) | 'md' (44px, the touch minimum) | 'lg' (52px) * size: 'sm' (36px) | 'md' (44px, the touch minimum) | 'lg' (52px)
* loading: shows a spinner, disables the button and sets aria-busy * loading: shows a spinner, disables the button and sets aria-busy
* icon / iconEnd: an element (e.g. a lucide icon) before / after the label * icon / iconEnd: an element (e.g. a lucide icon) before / after the label
* tone: 'danger' | 'warning' | … with variant 'ghost': the text takes that colour under the pointer
* (a quiet "Remove" that turns red on hover)
*/ */
export function Button({ export function Button({
variant = 'primary', size = 'md', loading = false, block = false, variant = 'primary', size = 'md', loading = false, block = false, tone,
icon, iconEnd, type = 'button', disabled, className, children, ref, ...rest icon, iconEnd, type = 'button', disabled, className, children, ref, ...rest
}) { }) {
return ( return (
<button <button
ref={ref} ref={ref}
type={type} type={type}
className={cx('x-btn', `x-btn--${variant}`, `x-btn--${size}`, block && 'x-btn--block', className)} className={cx('x-btn', `x-btn--${variant}`, `x-btn--${size}`, block && 'x-btn--block', tone && `x-btn--tone x-btn--tone-${tone}`, className)}
disabled={disabled || loading} disabled={disabled || loading}
aria-busy={loading || undefined} aria-busy={loading || undefined}
{...rest} {...rest}
@@ -29,9 +31,9 @@ export function Button({
/** /**
* A square button with only an icon. `label` is required: it becomes aria-label and the tooltip. * A square button with only an icon. `label` is required: it becomes aria-label and the tooltip.
* tone: 'danger' | 'warning' | 'info' | 'success' | 'special' | 'accent' — a pastel button in that * tone: 'danger' | 'warning' | 'info' | 'success' | 'special' | 'accent' — a grey square whose icon
* colour (soft background, ink icon), for row actions that should stand apart (delete red, block * takes that colour under the pointer, for row actions that should stand apart (delete red, block
* orange, zones blue: DESIGN.md §3). * orange, zones blue: DESIGN.md §3). Quiet at rest (2026-11-21).
*/ */
export function IconButton({ export function IconButton({
label, variant = 'ghost', size = 'md', tone, type = 'button', className, children, ref, ...rest label, variant = 'ghost', size = 'md', tone, type = 'button', className, children, ref, ...rest
+5 -2
View File
@@ -63,10 +63,13 @@ export function Segmented({ options = [], value, onChange, size = 'md', classNam
* never up and down. tabs: [{ id, label, badge?, warn?, testId? }]. * never up and down. tabs: [{ id, label, badge?, warn?, testId? }].
* <Tabs tabs={tabs} value={tab} onChange={setTab} /> * <Tabs tabs={tabs} value={tab} onChange={setTab} />
* end: an element at the right end of the strip (a refresh button…). * end: an element at the right end of the strip (a refresh button…).
* inset: the strip is the header of a card / panel: the card's padding at the sides, and the same
* room above and below `end` (a button never touches the card's edge or the line).
* fill: the tabs share the width equally, each label centred (a narrow column's tabs).
*/ */
export function Tabs({ tabs = [], value, onChange, size = 'md', end, className, ...rest }) { export function Tabs({ tabs = [], value, onChange, size = 'md', end, inset = false, fill = false, className, ...rest }) {
return ( return (
<div className={cx('x-tabs', `x-tabs--${size}`, className)} {...rest}> <div className={cx('x-tabs', `x-tabs--${size}`, inset && 'x-tabs--inset', fill && 'x-tabs--fill', className)} {...rest}>
<div className="x-tabs__list" role="tablist"> <div className="x-tabs__list" role="tablist">
{tabs.map(tb => ( {tabs.map(tb => (
<button key={tb.id} type="button" role="tab" aria-selected={tb.id === value} data-testid={tb.testId} <button key={tb.id} type="button" role="tab" aria-selected={tb.id === value} data-testid={tb.testId}
+28 -3
View File
@@ -12,13 +12,22 @@ import { cx } from '../internal/cx.js'
* </Page> * </Page>
* *
* top: an element kept above the scrolling part (a tab strip), as wide as the content. * top: an element kept above the scrolling part (a tab strip), as wide as the content.
* header: a <PageHeader> shown above `top` (2026-11-21): the page's title and description come
* first, then its tabs; each tab then has its own head (title, description, its "New" button).
* width: 'full' (default: lists, tables, dashboards) | 'form' (settings and forms, --x-page-form-max). * 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). * flush: no padding (a page that draws edge to edge, e.g. a map).
* fit: the page is exactly the screen's height and does not scroll itself: its <Pane>s do, each on
* its own (two-column pages: Products). Put the panes in an element with `x-page__fill`; what comes
* before it (a header) stays. Phones: the page scrolls as usual.
*/ */
export function Page({ top, width = 'full', flush = false, className, bodyClassName, testId, children, ...rest }) { export function Page({ top, header, width = 'full', flush = false, fit = false, className, bodyClassName, testId, children, ...rest }) {
return ( return (
<div className={cx('x-page', className)} data-testid={testId} {...rest}> <div className={cx('x-page', fit && 'x-page--fit', 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>} {(top || header) && (
<div className={cx('x-page__top', header && 'x-page__top--header')}>
<div className={cx('x-page__top-inner', width === 'form' && 'x-page__body--form')}>{header}{top}</div>
</div>
)}
<div className="x-page__scroll"> <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 className={cx('x-page__body', width === 'form' && 'x-page__body--form', flush && 'x-page__body--flush', bodyClassName)}>{children}</div>
</div> </div>
@@ -50,3 +59,19 @@ export function Toolbar({ className, children, ...rest }) {
export function ToolbarSpacer() { export function ToolbarSpacer() {
return <span className="x-toolbar__spacer" aria-hidden="true" /> return <span className="x-toolbar__spacer" aria-hidden="true" />
} }
/**
* A pane: a container whose header and footer stay while its body scrolls (2026-11-21).
* One side of a <Page fit> (Products: the categories, the list), or any panel with a long list.
* <Pane header={<h2>…</h2>} footer={…} sunken>…the list…</Pane>
* sunken: the body a shade darker than the pane, so white cards in it stand out.
*/
export function Pane({ header, footer, sunken = false, as: Tag = 'section', className, bodyClassName, children, ...rest }) {
return (
<Tag className={cx('x-pane', className)} {...rest}>
{header && <div className="x-pane__header">{header}</div>}
<div className={cx('x-pane__body', sunken && 'x-pane__body--sunken', bodyClassName)}>{children}</div>
{footer && <div className="x-pane__footer">{footer}</div>}
</Tag>
)
}
+1 -1
View File
@@ -29,7 +29,7 @@ export function Switch({ checked, onChange, label, description, info, disabled =
</button> </button>
) )
if (!label && !description) return <span className={className}>{control}</span> if (!label && !description) return <span className={cx('x-switch-bare', className)}>{control}</span>
return ( return (
<div className={cx('x-switch-row', disabled && 'x-switch-row--disabled', className)}> <div className={cx('x-switch-row', disabled && 'x-switch-row--disabled', className)}>
<div className="x-switch-row__text"> <div className="x-switch-row__text">
+1 -1
View File
@@ -21,7 +21,7 @@ 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 { Dropdown } from './components/Dropdown.jsx'
export { Page, PageHeader, Toolbar, ToolbarSpacer } from './components/Page.jsx' export { Page, PageHeader, Pane, Toolbar, ToolbarSpacer } from './components/Page.jsx'
export { SearchInput, FilterChip, Segmented, Tabs } from './components/Controls.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'
+4 -2
View File
@@ -11,9 +11,9 @@ const CloseIcon = () => (
</svg> </svg>
) )
/** The shared body of Dialog and Sheet: backdrop, panel, header with ×, body, footer. */ /** The shared body of Dialog and Sheet: backdrop, panel, header with ×, toolbar, body, footer. */
export function ModalFrame({ export function ModalFrame({
open, onClose, title, description, children, footer, open, onClose, title, description, toolbar, children, footer,
dismissible = true, closeLabel, initialFocus, dismissible = true, closeLabel, initialFocus,
overlayClass, panelClass, grip = false, bodyClass, overlayClass, panelClass, grip = false, bodyClass,
}) { }) {
@@ -54,6 +54,8 @@ export function ModalFrame({
)} )}
</div> </div>
)} )}
{/* toolbar: stays under the header while the body scrolls (a search box…) */}
{toolbar && <div className="x-modal__toolbar">{toolbar}</div>}
{children != null && <div className={cx('x-modal__body', bodyClass)}>{children}</div>} {children != null && <div className={cx('x-modal__body', bodyClass)}>{children}</div>}
{footer && <div className="x-modal__footer">{footer}</div>} {footer && <div className="x-modal__footer">{footer}</div>}
</div> </div>