@charcuterie/ui 4.30.0 → 4.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +7 -2
  2. package/docs/README.md +573 -0
  3. package/docs/building-an-app.md +231 -0
  4. package/docs/components/Accordion.md +106 -0
  5. package/docs/components/ActionMenu.md +63 -0
  6. package/docs/components/ActionTiles.md +233 -0
  7. package/docs/components/AdaptiveGrid.md +215 -0
  8. package/docs/components/Alert.md +99 -0
  9. package/docs/components/AnchorLink.md +23 -0
  10. package/docs/components/Avatar.md +153 -0
  11. package/docs/components/Badge.md +81 -0
  12. package/docs/components/BadgeButton.md +84 -0
  13. package/docs/components/Board.md +277 -0
  14. package/docs/components/Breadcrumbs.md +87 -0
  15. package/docs/components/Button.md +72 -0
  16. package/docs/components/ButtonLink.md +81 -0
  17. package/docs/components/Card.md +114 -0
  18. package/docs/components/CatalogPicker.md +250 -0
  19. package/docs/components/Chart.md +39 -0
  20. package/docs/components/Checkbox.md +197 -0
  21. package/docs/components/ColorPicker.md +99 -0
  22. package/docs/components/ColorSchemeSwitcher.md +92 -0
  23. package/docs/components/ColorSchemeToggle.md +98 -0
  24. package/docs/components/Combobox.md +175 -0
  25. package/docs/components/CommandPalette.md +120 -0
  26. package/docs/components/ComparisonChart.md +31 -0
  27. package/docs/components/CopyButton.md +112 -0
  28. package/docs/components/DataTable.md +170 -0
  29. package/docs/components/DatePicker.md +225 -0
  30. package/docs/components/Dialog.md +134 -0
  31. package/docs/components/DropRail.md +107 -0
  32. package/docs/components/EmptyState.md +65 -0
  33. package/docs/components/Field.md +215 -0
  34. package/docs/components/FieldGroup.md +45 -0
  35. package/docs/components/FileDropZone.md +98 -0
  36. package/docs/components/GroupedList.md +189 -0
  37. package/docs/components/Header.md +76 -0
  38. package/docs/components/HtmlEditor-html-editor.md +76 -0
  39. package/docs/components/HtmlView-html-editor.md +47 -0
  40. package/docs/components/HtmlView-html-view.md +47 -0
  41. package/docs/components/IconButton.md +52 -0
  42. package/docs/components/LaneTimeline.md +254 -0
  43. package/docs/components/Lightbox.md +101 -0
  44. package/docs/components/Listbox.md +109 -0
  45. package/docs/components/LiveStatusIndicator.md +60 -0
  46. package/docs/components/LogViewer.md +142 -0
  47. package/docs/components/Main.md +247 -0
  48. package/docs/components/MarkdownEditor.md +262 -0
  49. package/docs/components/MarkdownEditorCodeMirror-markdown-editor-codemirror.md +230 -0
  50. package/docs/components/MarkdownLine.md +187 -0
  51. package/docs/components/MarkdownView-markdown-editor-codemirror.md +235 -0
  52. package/docs/components/MediaTile.md +106 -0
  53. package/docs/components/Menu.md +209 -0
  54. package/docs/components/MetricCard.md +38 -0
  55. package/docs/components/Modal.md +89 -0
  56. package/docs/components/Nav.md +167 -0
  57. package/docs/components/NavBar.md +190 -0
  58. package/docs/components/Picker.md +132 -0
  59. package/docs/components/Popover.md +135 -0
  60. package/docs/components/PortraitTiles.md +169 -0
  61. package/docs/components/ProgressBar.md +70 -0
  62. package/docs/components/ProgressCard.md +65 -0
  63. package/docs/components/QueryBuilder.md +132 -0
  64. package/docs/components/RadioGroup.md +165 -0
  65. package/docs/components/Rail.md +79 -0
  66. package/docs/components/RangeSlider.md +144 -0
  67. package/docs/components/ReactRouterAdapter-react-router.md +27 -0
  68. package/docs/components/ReactRouterLink-react-router.md +23 -0
  69. package/docs/components/ReorderList.md +143 -0
  70. package/docs/components/RouterLinkProvider.md +33 -0
  71. package/docs/components/ScheduleBoard.md +41 -0
  72. package/docs/components/ScrollMemoryProvider.md +33 -0
  73. package/docs/components/SearchInput.md +46 -0
  74. package/docs/components/SegmentedControl.md +98 -0
  75. package/docs/components/Select.md +169 -0
  76. package/docs/components/Shell.md +162 -0
  77. package/docs/components/Skeleton.md +48 -0
  78. package/docs/components/Slider.md +128 -0
  79. package/docs/components/SortableTableHeader.md +84 -0
  80. package/docs/components/Spinner.md +50 -0
  81. package/docs/components/Stepper.md +121 -0
  82. package/docs/components/Swatch.md +79 -0
  83. package/docs/components/Switch.md +80 -0
  84. package/docs/components/TableColumns.md +29 -0
  85. package/docs/components/TableViewport.md +42 -0
  86. package/docs/components/Tabs.md +184 -0
  87. package/docs/components/TextLink.md +106 -0
  88. package/docs/components/TimecodeInput.md +222 -0
  89. package/docs/components/Toast.md +108 -0
  90. package/docs/components/ToastRegion.md +35 -0
  91. package/docs/components/Toolbar.md +118 -0
  92. package/docs/components/Tooltip.md +94 -0
  93. package/docs/components/UnstyledLink.md +21 -0
  94. package/docs/components/ValuePairs.md +30 -0
  95. package/docs/components/VirtualizedGrid.md +204 -0
  96. package/docs/components/VisuallyHidden.md +39 -0
  97. package/docs/components/WeekdayIndicator.md +39 -0
  98. package/docs/hooks/useAdaptiveColumns.md +111 -0
  99. package/docs/hooks/useCommandPalette.md +40 -0
  100. package/docs/hooks/useCommandPaletteHotkeys.md +33 -0
  101. package/docs/hooks/useDeploymentUpdate.md +39 -0
  102. package/docs/hooks/useLastPresentValue.md +23 -0
  103. package/docs/hooks/useListMotion.md +65 -0
  104. package/docs/hooks/useNavLayout.md +59 -0
  105. package/docs/hooks/usePresence.md +39 -0
  106. package/docs/hooks/useRouterLink.md +22 -0
  107. package/docs/hooks/useValueChangeMotion.md +28 -0
  108. package/package.json +7 -5
  109. package/skills/charcuterie/SKILL.md +17 -0
  110. package/skills/charcuterie/references/build-a-screen.md +6 -0
  111. package/skills/charcuterie/references/create-a-component.md +6 -0
  112. package/src/AdaptiveGrid/AdaptiveGrid.stories.tsx +1 -1
  113. package/src/Tabs/Tabs.stories.tsx +1 -1
  114. package/src/VirtualizedGrid/VirtualizedGrid.stories.tsx +65 -28
  115. package/src/VirtualizedGrid/VirtualizedGrid.test.tsx +29 -0
  116. package/src/shell.storyHelpers.tsx +3 -3
  117. package/src/sourceRules.test.ts +16 -2
@@ -0,0 +1,76 @@
1
+ # Header
2
+
3
+ ```ts
4
+ import { Header } from "@charcuterie/ui"
5
+ ```
6
+
7
+ The `<header>` landmark, the app's name, and the controls that belong to the frame rather
8
+ than to the page. Ten repos hand-roll this row; two of them wrote the same string.
9
+
10
+ ## `isSticky` sets `position` **and** `z-index`
11
+
12
+ That pairing is the entire reason the prop is a boolean rather than two class names.
13
+
14
+ mux-magic's `PageHeader` is documented as a sticky header and sets only `z-index`
15
+ (`PageHeader.tsx:173`). It never sets `position: sticky`, so it scrolls away like any other
16
+ block and the z-index it carries has nothing to stack against — it is a flex-column shell
17
+ wearing a sticky header's clothes. The CSS is valid, the intent is stated in a comment, and
18
+ nobody scrolls a component in a review.
19
+
20
+ The z-index is `--layer-sticky` (100) from the token scale, never a hand-picked number. The
21
+ fleet's headers currently sit at `z-40` (mail-sifter, points-market), `z-50` (rip-deck),
22
+ `z-10` (spoolbuddy) and `z-[100]` (mux-magic) with no ordering guarantee between a header
23
+ and anything else. On the scale, `sticky` is below `dropdown` (200), `modal` (400) and
24
+ `toast` (500) — so a `Menu` opened *from* the header paints over it, by construction.
25
+
26
+ ## It invents no colours
27
+
28
+ `bg-surface-raised/85`, `backdrop-blur-md`, `border-border-subtle`. The fleet's copy of this
29
+ line is `bg-surface-base/90` — the header at *the same colour as the page behind it*,
30
+ leaning entirely on the blur to separate the two, so it disappears against a page that has
31
+ not been scrolled. `raised` means *more separated from base*, which is the role this
32
+ element actually wants.
33
+
34
+ ## The width comes from `Shell`
35
+
36
+ The `<header>` is full-bleed — the border and the translucent fill run edge to edge — and
37
+ only its **inner row** is capped. That is what stops a constrained header from reading as a
38
+ floating island on an ultrawide, and it is the half points-market got right while its
39
+ `<main>` went uncapped.
40
+
41
+ The cap itself comes from `Shell`'s `contentWidth` through context, so the title always
42
+ sits directly above the content it names. Passing `contentWidth` here overrides it for the
43
+ rare case where they genuinely differ.
44
+
45
+ ## Slots, in render order
46
+
47
+ `heading` → `children` → `actions`. Every one is optional: a header with only actions is
48
+ image-viewer's `TitleBar`, one with only a heading is board-games'. `children` is the middle
49
+ — a search field, a breadcrumb, a status pill — and `actions` is pushed to the far end with
50
+ `ms-auto`, so it stays at the end in RTL too.
51
+
52
+ `headingLevel` defaults to `1`, because on most pages the app's name *is* the document's
53
+ top-level heading. An app whose page title is its `h1` sets `headingLevel={2}` here rather
54
+ than leaving two of them.
55
+
56
+ ```tsx
57
+ import { ButtonLink } from "@charcuterie/ui"
58
+
59
+ <Header heading="Projects" actions={<ButtonLink href="/projects/new">New project</ButtonLink>} />
60
+ ```
61
+
62
+ ## Published TypeScript API
63
+
64
+ ```ts
65
+ const Header: ({ actions, children, className, contentWidth, heading, headingLevel, isSticky, ...headerProps }: HeaderProps) => ReactNode
66
+
67
+ type HeaderProps = ComponentPropsWithRef<"header"> & {
68
+ actions?: ReactNode;
69
+ contentWidth?: ContentWidth;
70
+ heading?: string;
71
+ headingLevel?: 1 | 2;
72
+ isSticky?: boolean;
73
+ };
74
+ ```
75
+
76
+ [Full declarations](../../dist/Header/Header.d.ts)
@@ -0,0 +1,76 @@
1
+ # HtmlEditor
2
+
3
+ ```ts
4
+ import { HtmlEditor } from "@charcuterie/ui/html-editor"
5
+ ```
6
+
7
+ Rich authoring for records stored as **HTML**. It lives in the opt-in
8
+ `@charcuterie/ui/html-editor` subpath. Markdown remains a separate format.
9
+
10
+ ## Preserve untouched records
11
+
12
+ `defaultValue` initializes the document once. Focus, selection, blur and toolbar navigation
13
+ never call `onChange`. An optional `name` renders a hidden form control whose original HTML
14
+ bytes stay intact until a real edit. Changes emit sanitized HTML. A changed external default
15
+ does not replace the document or its undo history; use a React `key` to switch records.
16
+
17
+
18
+
19
+ The editor supports bold, italic, underline, lists, alignment, links, text colours, images and
20
+ undo/redo. Keyboard shortcuts and document history come from Tiptap/ProseMirror; controls,
21
+ overflow, dialogs and field wiring come from Charcuterie. Apps supply optional icons.
22
+
23
+ ## HTML is untrusted
24
+
25
+ Initial content and rich clipboard HTML pass through the same HTML5 parser and closed
26
+ document allowlist as `HtmlView`. Scripts, foreign namespaces, event handlers, arbitrary
27
+ attributes and resource-loading CSS are removed. URL attributes use the shared link/image
28
+ scheme guards. Colours and text alignment are the only retained inline CSS properties.
29
+ This is a safe display/edit projection, not an automatic rewrite of the stored source.
30
+
31
+ On the first real edit, unsupported markup is omitted from the edited HTML. Preserve the
32
+ original field for an untouched save. This format is intended for document notes, not arbitrary
33
+ web pages. Server-side authorization and storage validation remain the app's responsibility.
34
+
35
+ ## Install only when used
36
+
37
+ The subpath's optional peers are `parse5`, `@tiptap/core`, `@tiptap/react`, `@tiptap/pm`,
38
+ `@tiptap/starter-kit`, `@tiptap/extension-image`, `@tiptap/extension-text-style` and
39
+ `@tiptap/extension-text-align`. Importing the main UI entry loads none of them. A reader-only app uses `@charcuterie/ui/html-view`
40
+ and installs only `parse5`.
41
+
42
+ Give the editing surface a descriptive label. Keep editable HTML in the HTML editor family and use `HtmlView` for the read-only projection.
43
+
44
+ ## Example from the stories
45
+
46
+ See the full [story example](../../src/htmlEditor/HtmlEditor.stories.tsx).
47
+
48
+ ```tsx
49
+ <HtmlEditor
50
+ label="Empty notes"
51
+ toolbarLabel="Empty note formatting"
52
+ />
53
+ ```
54
+
55
+ ## Published TypeScript API
56
+
57
+ ```ts
58
+ const HtmlEditor: ({ className, defaultValue, icons, isDisabled, isReadOnly, label, name, onChange, toolbarLabel, ...slotProps }: HtmlEditorProps) => ReactNode
59
+
60
+ type HtmlEditorProps = SlotProps & {
61
+ className?: string;
62
+ /** Initial only. Remount with a key to switch documents. */
63
+ defaultValue?: string;
64
+ icons?: Readonly<Record<string, ReactNode>>;
65
+ isDisabled?: boolean;
66
+ isReadOnly?: boolean;
67
+ /** Omit inside a Field, which supplies the real label. */
68
+ label?: string;
69
+ /** Hidden form control; its original bytes survive until an edit. */
70
+ name?: string;
71
+ onChange?: (value: string) => void;
72
+ toolbarLabel?: string;
73
+ };
74
+ ```
75
+
76
+ [Full declarations](../../dist/htmlEditor/HtmlEditor.d.ts)
@@ -0,0 +1,47 @@
1
+ # HtmlView
2
+
3
+ ```ts
4
+ import { HtmlView } from "@charcuterie/ui/html-editor"
5
+ ```
6
+
7
+ Read saved HTML notes with the same safe document policy and document styling as `HtmlEditor`.
8
+ It renders React nodes, with no `innerHTML` and no editor instance. `value` is controlled because
9
+ a reader has no caret or undo history to preserve. `label` names the document. Its `@charcuterie/ui/html-view` entry requires only the optional
10
+ `parse5` peer and loads no editor core.
11
+
12
+
13
+
14
+ The parser decodes HTML entities before checking URL schemes. Only known document tags,
15
+ safe links/images, accessible image text, list start numbers and safe colour/alignment styles
16
+ reach the page. Scripts, embeds, event handlers, arbitrary classes/IDs, foreign namespaces and
17
+ resource-loading CSS cannot reach the DOM. Unknown wrappers retain ordinary readable children;
18
+ executable/foreign content is discarded. Safe links use the shared `TextLink` shape.
19
+
20
+ Reading a note never writes its filtered projection back to storage. Plain HTML source remains
21
+ available to its owner independently of this component; no conversion to markdown occurs.
22
+
23
+ ## Example from the stories
24
+
25
+ See the full [story example](../../src/htmlEditor/HtmlView.stories.tsx).
26
+
27
+ ```tsx
28
+ <HtmlView
29
+ label="Linked notes"
30
+ value='<p>Read <a href="./instructions">the instructions</a>.</p>'
31
+ />
32
+ ```
33
+
34
+ ## Published TypeScript API
35
+
36
+ ```ts
37
+ const HtmlView: ({ className, label, value, }: HtmlViewProps) => ReactNode
38
+
39
+ type HtmlViewProps = {
40
+ className?: string;
41
+ /** The readable document's accessible name. */
42
+ label: string;
43
+ value: string;
44
+ };
45
+ ```
46
+
47
+ [Full declarations](../../dist/htmlEditor/HtmlView.d.ts)
@@ -0,0 +1,47 @@
1
+ # HtmlView
2
+
3
+ ```ts
4
+ import { HtmlView } from "@charcuterie/ui/html-view"
5
+ ```
6
+
7
+ Read saved HTML notes with the same safe document policy and document styling as `HtmlEditor`.
8
+ It renders React nodes, with no `innerHTML` and no editor instance. `value` is controlled because
9
+ a reader has no caret or undo history to preserve. `label` names the document. Its `@charcuterie/ui/html-view` entry requires only the optional
10
+ `parse5` peer and loads no editor core.
11
+
12
+
13
+
14
+ The parser decodes HTML entities before checking URL schemes. Only known document tags,
15
+ safe links/images, accessible image text, list start numbers and safe colour/alignment styles
16
+ reach the page. Scripts, embeds, event handlers, arbitrary classes/IDs, foreign namespaces and
17
+ resource-loading CSS cannot reach the DOM. Unknown wrappers retain ordinary readable children;
18
+ executable/foreign content is discarded. Safe links use the shared `TextLink` shape.
19
+
20
+ Reading a note never writes its filtered projection back to storage. Plain HTML source remains
21
+ available to its owner independently of this component; no conversion to markdown occurs.
22
+
23
+ ## Example from the stories
24
+
25
+ See the full [story example](../../src/htmlEditor/HtmlView.stories.tsx).
26
+
27
+ ```tsx
28
+ <HtmlView
29
+ label="Linked notes"
30
+ value='<p>Read <a href="./instructions">the instructions</a>.</p>'
31
+ />
32
+ ```
33
+
34
+ ## Published TypeScript API
35
+
36
+ ```ts
37
+ const HtmlView: ({ className, label, value, }: HtmlViewProps) => ReactNode
38
+
39
+ type HtmlViewProps = {
40
+ className?: string;
41
+ /** The readable document's accessible name. */
42
+ label: string;
43
+ value: string;
44
+ };
45
+ ```
46
+
47
+ [Full declarations](../../dist/htmlEditor/HtmlView.d.ts)
@@ -0,0 +1,52 @@
1
+ # IconButton
2
+
3
+ ```ts
4
+ import { IconButton } from "@charcuterie/ui"
5
+ ```
6
+
7
+ Three repos, three strategies, **no names**: mux-magic hand-writes five SVG components,
8
+ castkit keeps an `ICON_PATHS` map, and plex-channels renders raw glyphs (`↶`, `↷`, `▶`,
9
+ `⚙`, `≡`) straight into a `<button>`.
10
+
11
+ A screen reader announces the last of those as "↶", and
12
+ `getByRole("button", { name: "Undo" })` finds nothing at all. That is the concrete reason
13
+ the fleet is not agent-drivable today, and the reason this component exists as something
14
+ other than `<Button sizing="icon">`.
15
+
16
+ ## The one rule
17
+
18
+ `label` is **required**, is a `string`, and becomes `aria-label`. There is no way to render
19
+ this component without a name, which is the point: the type system asks the question that
20
+ three hand-rolled versions forgot.
21
+
22
+ The library ships **no icons**. `children` is whatever the app already has — lucide (ISC)
23
+ is the fleet recommendation — and it is hidden from assistive technology, because the label
24
+ already names the control.
25
+
26
+ ```tsx
27
+ import type { ReactNode } from "react"
28
+
29
+ function UndoButton({ icon, undo }: { icon: ReactNode; undo: () => void }) {
30
+ return <IconButton label="Undo" onClick={undo}>{icon}</IconButton>
31
+ }
32
+ ```
33
+
34
+ ## Published TypeScript API
35
+
36
+ ```ts
37
+ const IconButton: ({ children, label, ...buttonProps }: IconButtonProps) => ReactNode
38
+
39
+ type IconButtonProps = Omit<ButtonProps, "aria-label" | "children" | "iconEnd" | "iconStart" | "sizing"> & {
40
+ /**
41
+ * Required, and this single line is most of the component's
42
+ * reason to exist. `label` cannot be defaulted, cannot be
43
+ * omitted, and is not a `ReactNode` — it becomes `aria-label`,
44
+ * which is a string by specification.
45
+ */
46
+ label: string;
47
+ /** The glyph. Anything — lucide, an inline SVG, a character. */
48
+ children: ReactNode;
49
+ };
50
+ ```
51
+
52
+ [Full declarations](../../dist/IconButton/IconButton.d.ts)
@@ -0,0 +1,254 @@
1
+ # LaneTimeline
2
+
3
+ ```ts
4
+ import { LaneTimeline } from "@charcuterie/ui"
5
+ ```
6
+
7
+ One horizontal lane per group, across a date axis, with anything that lasts more than a day
8
+ drawn as a **bar**.
9
+
10
+ ## What a month grid cannot do
11
+
12
+ Two things, and both of them are the reason this component exists.
13
+
14
+ - **A multi-day thing is one shape.** A grid breaks it into four cells and the fact that it
15
+ is one thing has to be inferred. A bar keeps its real extent, which is what a person means
16
+ when they say "the roofers are here Tuesday to Friday".
17
+ - **A grid cell is the same size no matter what is in it.** So a grid cannot show that one
18
+ lane is carrying most of the week. A lane can: overlapping items stack into rows, so a busy
19
+ lane is literally three times the height of a quiet one and the asymmetry reads from across
20
+ the room, before anybody counts anything.
21
+
22
+ It is **not a calendar**. There is no event, no attendee and no recurrence in this API,
23
+ because the same shape is wanted for things that are not calendars at all — phases over days,
24
+ a hire, a hold. The library owns the **shape**; the app owns the **data**.
25
+
26
+ ## `end` is inclusive, and it is the decision to know
27
+
28
+ **`end` is the last day the item covers.** `2026-04-06` to `2026-04-06` is one day, and a
29
+ Monday-to-Sunday week is `06` to `12` — seven columns, not eight.
30
+
31
+ This is stated three times — here, on the type, and in the geometry module — because an
32
+ off-by-one on a date range is invisible **in both directions**. A bar one day short and a bar
33
+ one day long are both bars, and no screenshot, no axe run and no type can tell you which one
34
+ you are looking at.
35
+
36
+ The alternative is a half-open interval, which is what `Date` ranges and iCalendar's `DTEND`
37
+ use, and it is the better model for *instants*. It is the wrong one here: nobody writes down
38
+ "Monday to Saturday" to mean a working week, so an exclusive end makes every consumer add a
39
+ day on the way in — and forget to on one of the paths.
40
+
41
+ ## The four edge cases
42
+
43
+ Each of these is a place a naive implementation draws nothing, or draws it somewhere else.
44
+ All four are in the first panel below.
45
+
46
+ | The item | What happens |
47
+ | --- | --- |
48
+ | **Zero width** — `end` before `start` | Folded to the single day at `start` and **drawn**. Not dropped, because a dropped row is a data fault nobody can see. Not drawn backwards, because there is no such shape — and `grid-column: 4 / span 0` is not a zero-width box, it is undefined behaviour that lands the bar somewhere plausible. |
49
+ | **A single day** — `start` equal to `end` | One column, with the same treatment as any other bar. Not a dot: a dot is a second mark, and the eye then has two vocabularies to learn on one axis. |
50
+ | **Starts before the range** | Clipped to column 1, square leading edge, and its own start date still in its name. The naive subtraction produces a negative column, and CSS grid reads a negative `grid-column-start` as counting back from the **end** of the row — so the bar appears, at the far side of the week, with nothing failing. |
51
+ | **Ends after the range** | Clipped to the last column, square trailing edge. The length it reports is the item's own, not the visible part of it. |
52
+
53
+ An item entirely outside the range is not drawn **and not counted**. Nothing is missing from
54
+ the picture; the picture is of another week.
55
+
56
+ ## The Narrow View is a list, not a pan surface
57
+
58
+ Thirty columns have no narrow layout, and the two obvious answers are both wrong. Horizontal
59
+ scrolling hides lanes behind a gesture with no affordance and fights the trackpad's own
60
+ back-navigation — *"no horizontal scroll, ever"*, the same rule
61
+ [Board](Board.md) settled. Squeezing thirty columns into
62
+ 390px gives each day 13 pixels, which is not a timeline, it is a texture.
63
+
64
+ So below the threshold the axis is **abandoned rather than shrunk**. Each lane becomes a
65
+ one-column list, each item a line of text with its span written out in words. Nothing is
66
+ hidden, nothing overflows, and the reading order is the one a text-heavy list already wants.
67
+
68
+ It is the **Narrow View**, never "mobile". The name is about the width, which is what the
69
+ component actually measures: a docked sidebar on a 4K monitor gets this layout and a tablet
70
+ in landscape does not.
71
+
72
+ ## It folds on a measurement, not a breakpoint
73
+
74
+ There is no `@media` and no `cq-` in this component, and neither could do the job. The
75
+ question is not *how wide is the box* but **how wide is one day** — which is the width
76
+ divided by a number that lives in the data.
77
+
78
+ Thirty columns in 900px is a readable month. Three hundred and sixty five columns in the
79
+ **same** 900px is a grey smear. No query can tell those two apart, because the box never
80
+ changed. `Nav` folds its bar on a measured width for the weaker version of this reason, and
81
+ `useToolbarOverflow` writes the general argument down: mux-magic collapses at a hardcoded
82
+ `480px` and plex-channels at `760px`, and neither number has a reason.
83
+
84
+ The second row there is the proof: the same three panels, one week and one month. The 24rem
85
+ panel keeps its axis for the week and loses it for the month, and the browser window never
86
+ moved.
87
+
88
+ ⚠️ **It must not be sized by its own contents.** The component reads its own box to decide
89
+ what to draw in it, so a shrink-wrapping parent makes the answer its own input. The root
90
+ declares `container-type: inline-size` — not to query it, the same reason `Main` declares one
91
+ — which forbids the element from being sized by what is inside it. In a story that is what
92
+ `align="stretch"` on the `StoryCell` is for.
93
+
94
+ ### The measurement is taken from a probe, not from the track
95
+
96
+ A zero-height `aria-hidden` cell that sits in the same grid column the axis would occupy, and
97
+ that renders in **both** layouts. Measuring the real track is a one-way door: the Narrow View
98
+ unmounts it, so the width never updates and the axis can never come back when the window
99
+ widens. Hiding the track with `display: none` instead is worse — a hidden box measures 0, and
100
+ if 0 meant "not measured yet" the component would show the axis, which hides the fallback,
101
+ which measures 0 again, every frame.
102
+
103
+ Which is why "has it been measured" is its own flag rather than `inlineSize > 0`: **zero is a
104
+ real width here**, because the track is a `minmax(0, 1fr)` column beside a fixed label rail.
105
+
106
+ ## A title wraps when its column has room
107
+
108
+ A bar's title is words, and one line is one line however wide the box gets: a week across
109
+ a desktop page gives every day about 7em, and a single-day bar in it still printed
110
+ `Regional Rob…`. So the timeline measures the column and chooses. At or above
111
+ `wrapColumnSize` (default `6`, in em of the timeline's own type) a title wraps onto up to
112
+ three lines; below it, the title clips to one line with an ellipsis, because three lines
113
+ of two letters each is neither the word nor a shape. The full title is in the bar's
114
+ `title` attribute and its accessible name either way.
115
+
116
+ The threshold is the **column's** width, not the box's, which is why the same 64rem panel
117
+ wraps a week's titles and clips a month's. It is decided by the timeline, never by the
118
+ bar, so every bar in a range agrees.
119
+
120
+ ## The labels thin; the type does not shrink
121
+
122
+ Type that shrinks to fit is type somebody cannot read, and the density axis already owns font
123
+ size. So a long range drops to one label a week, and then to one a month. The steps are whole
124
+ weeks — never 2 or 3 — so a labelled column is the same weekday every time; labels landing on
125
+ Tuesday, then Thursday, then Saturday give the eye nothing to lock onto.
126
+
127
+ ## Accessibility
128
+
129
+ - **Every bar says its own span in words.** A bar carries its meaning in *position and
130
+ length*, and neither of those reaches a screen reader. So the sentence — "Mon 6 Apr to Thu
131
+ 9 Apr, 4 days" — travels with it, and it uses the item's **own** dates rather than the
132
+ clipped ones: "when is this on" has one true answer and the viewport is not part of it.
133
+ - **The clipped edge is never the only signal.** A square corner says "this continues" to a
134
+ reader who has an unclipped bar beside it to compare against, and to nobody else. The name
135
+ says "starts before this range" out loud.
136
+ - **Colour is reinforcement, not information.** A lane's hue comes from the categorical
137
+ family and means *which lane* — and the lane is already a named `group` with its name in
138
+ text, so nothing is carried by hue alone. A lane's colour is
139
+ `lane.categorical ?? getCategoricalIndex(lane.key)`: hashed from the **key**, never the
140
+ label, so renaming a lane does not repaint a row the reader had learned to recognise.
141
+ - **The timeline is one landmark and each lane is a `group`.** Eight lanes as eight `region`s
142
+ would bury the page's real landmarks, and two timelines on one page would put two landmarks
143
+ with the same name in the document — axe's `landmark-unique`. It is a `<div role="group">`
144
+ rather than a `<section role="group">` because axe matches `section[aria-labelledby]` on the
145
+ element and audits it as a landmark even after the role is overridden.
146
+ - **The date axis is `aria-hidden`.** Deliberate, not an oversight: every bar already says its
147
+ own span, so an axis read aloud is thirty consecutive dates in front of the content. The
148
+ axis is a *visual* ruler for a mark whose position a sighted reader has to measure against
149
+ something.
150
+ - **`headingLevel` is yours.** Only the caller knows what the timeline sits under; an `<h3>`
151
+ directly below the page `<h1>` is an axe `heading-order` failure.
152
+
153
+ An item takes an `href` **or** an `onSelect`, never both — a union rather than two optionals,
154
+ the same call `BoardItem` makes. The first renders an `<a>` and the second a `<button>`, so an
155
+ item carrying both would be one of them with the other silently dropped, and the two are
156
+ identical on screen.
157
+
158
+ An interactive bar takes its name from an `aria-label` rather than from its own text plus a
159
+ `VisuallyHidden`. A name assembled from two elements is assembled by the **browser**, and the
160
+ engines disagree about whether to put a space between the runs — so
161
+ `getByRole("button", { name })` would match on one and not the other.
162
+
163
+ ## Where the line is drawn
164
+
165
+ | Not here | Because |
166
+ | --- | --- |
167
+ | **Time of day** | This is a calendar-date axis. Two things on one Tuesday stack; they do not sit at 09:00 and 14:00. An hour axis is a different component with a different fold, and the [plain-date decision](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-19-a-date-is-a-calendar-date-not-an-instant.md) is why this one has no `Date` in it at all. |
168
+ | **A range control** | It belongs to the page, and `DatePicker` already is one. |
169
+ | **Dragging a bar** | Moving a bar is a **write**, which is a different component with a different decision behind it — `Board` is the precedent for how much that costs. |
170
+ | **A "now" marker** | A line at today is a page's business, not a lane's, and putting one here would make the component ask what day it is — which is the one question `plainDate.ts` insists you answer out loud. |
171
+ | **Data, sorting, filtering** | All three are operations on the array you pass in. |
172
+
173
+ ## Never invent a token name
174
+
175
+ The bar fills come from the **categorical** family — ten hues, `--color-categorical-<n>-<role>`
176
+ — through `categoricalStyles.ts`, and every class name in that file is written out in full.
177
+ `` `bg-categorical-${index}-solid` `` generates nothing at all: the bar renders unstyled, with
178
+ no error, no warning and no failing test unless something checks. Docket shipped a board whose
179
+ every priority bar painted `--color-danger-9`, a name this token set has never had, and every
180
+ "is it rendered" assertion passed.
181
+
182
+ The grid track list is the same trap from the other side. It **must** be an inline style,
183
+ because Tailwind cannot scan `grid-cols-[repeat(30,minmax(0,1fr))]` out of an interpolated
184
+ string — the grid would silently fall back to one column and every bar would land on top of
185
+ every other one.
186
+
187
+ ```tsx
188
+ <LaneTimeline label="Release schedule" lanes={[]}
189
+ range={{ start: "2026-06-01", end: "2026-06-30" }} />
190
+ ```
191
+
192
+ ## Published TypeScript API
193
+
194
+ ```ts
195
+ const LaneTimeline: ({ className, emptyState, headingLevel, label, lanes, locale, maxRowCount, minColumnSize, range, wrapColumnSize, }: LaneTimelineProps) => ReactNode
196
+
197
+ type LaneTimelineProps = {
198
+ className?: string;
199
+ /**
200
+ * Shown when there are no lanes, or when `range` is not a pair of
201
+ * calendar dates. Defaults to a real `EmptyState` — *"real empty
202
+ * states"* is a standing requirement, and an empty timeline is
203
+ * what a household sees on a good week.
204
+ */
205
+ emptyState?: ReactNode;
206
+ /**
207
+ * What level the lane headings are. The caller's, because only
208
+ * the caller knows what the timeline sits under: one directly
209
+ * below a page `<h1>` wants `2`. Getting it wrong is an axe
210
+ * `heading-order` failure and a hole in the screen-reader
211
+ * outline.
212
+ */
213
+ headingLevel?: 2 | 3 | 4 | 5;
214
+ /** The timeline's accessible name. Required — it is a landmark. */
215
+ label: string;
216
+ lanes: readonly TimelineLane[];
217
+ /**
218
+ * BCP-47, for the dates only. Omitted, `Intl` uses the runtime's
219
+ * own — which is right on a personal machine and wrong on a
220
+ * server, so a server render should pass one rather than let two
221
+ * environments disagree about what "6 Apr" looks like.
222
+ */
223
+ locale?: string;
224
+ /** How many bars one lane may stack. Default 6. */
225
+ maxRowCount?: number;
226
+ /**
227
+ * The narrowest a day column may get before the axis is abandoned
228
+ * for the Narrow View, as a multiple of the timeline's **own font
229
+ * size**. Default 1.75.
230
+ *
231
+ * In em rather than pixels because every length in this token set
232
+ * moves with the density axis: a floor pinned at 20px is generous
233
+ * on a desktop and clips a two-digit date on the kiosk. Same
234
+ * argument `Avatar` makes about a chip that stays 20px while the
235
+ * prose around it scales.
236
+ */
237
+ minColumnSize?: number;
238
+ /**
239
+ * The days on screen. **Both ends inclusive**, like every other
240
+ * span in this component — a Monday-to-Sunday week is
241
+ * `2026-04-06` to `2026-04-12`, which is seven columns, not eight.
242
+ */
243
+ range: TimelineSpan;
244
+ /**
245
+ * The narrowest a day column may be before a bar's title wraps
246
+ * onto up to three lines instead of clipping to one, as a
247
+ * multiple of the timeline's **own font size**. Default 6. In em
248
+ * for the reason `minColumnSize` is.
249
+ */
250
+ wrapColumnSize?: number;
251
+ };
252
+ ```
253
+
254
+ [Full declarations](../../dist/LaneTimeline/LaneTimeline.d.ts)
@@ -0,0 +1,101 @@
1
+ # Lightbox
2
+
3
+ ```ts
4
+ import { Lightbox } from "@charcuterie/ui"
5
+ ```
6
+
7
+ A thumbnail that opens its own full-size view. Three apps hand-roll this — a poster,
8
+ a still, a scan the operator wants to read — and none get the focus trap or the scroll
9
+ lock right, because the interesting part is not the overlay, it is the dialog underneath.
10
+
11
+ So a `Lightbox` is a **skin over `Dialog`**, not a second dialog. `Dialog` (through
12
+ `Modal`/`OverlayPanel`) owns the portal, the scrim, Escape, the focus trap and
13
+ `lockScrollBehind`; this adds the image-specific part — a `cursor-zoom-in` trigger and an
14
+ `object-contain` image clamped to the viewport, so a 2:3 poster and a 16:9 still both land
15
+ whole.
16
+
17
+ ## The thumbnail is the trigger, and it carries the name
18
+
19
+ Pass the small image as `thumbnail` and the `Lightbox` wraps it in the button that opens
20
+ the overlay. That button carries the accessible name — `Enlarge {alt}` — so the
21
+ `thumbnail` inside it goes `alt=""`, exactly as `MediaTile` names its link and silences
22
+ the image within it. A button around an empty-alt image is otherwise `button-name` with
23
+ nothing to announce.
24
+
25
+
26
+
27
+ `alt` also names the dialog, through `heading`'s default. Pass `heading` when the two
28
+ should differ — a filename overlay whose thumbnail alt is already the title.
29
+
30
+ ## Controlled, when something else opens it
31
+
32
+ Omit `thumbnail` and pass `isOpen` / `onOpenChange`, and the `Lightbox` renders only the
33
+ overlay — a button elsewhere on the page owns the open state through its own
34
+ `useVisibility`. The internal store still runs (hooks cannot be conditional) but goes
35
+ unread; the caller is the one truth.
36
+
37
+ ## What it inherits, and does not re-test
38
+
39
+ Escape, the focus trap, focus restore to the trigger, the scrim and the scroll lock are
40
+ all `Dialog`'s (via `Modal`), asserted in their own tests. The lightbox's tests assert only
41
+ the skin: that the thumbnail opens the enlarged image, that the caption rides along, and
42
+ that the contract `Dialog` guarantees is not quietly dropped by the wrapper — Escape →
43
+ `onClose`, and focus back to the thumbnail.
44
+
45
+ ## An ordered gallery
46
+
47
+ Pass `images` and `initialIndex` to open a collection at the selected thumbnail.
48
+ Previous/Next controls and Left/Right arrow keys wrap through the collection. Escape
49
+ closes it and restores focus to the trigger. `heading` stays stable while the image,
50
+ caption, and announced position change. Omit `images` for the existing single-image view.
51
+
52
+ ```tsx
53
+ <Lightbox src="/images/site-plan.jpg" alt="Site plan" heading="Site plan" />
54
+ ```
55
+
56
+ ## Published TypeScript API
57
+
58
+ ```ts
59
+ const Lightbox: ({ alt, caption, className, heading, images, initialIndex, isOpen, onOpenChange, src, thumbnail, }: LightboxProps) => ReactNode
60
+
61
+ type LightboxProps = {
62
+ /** Optional ordered gallery. The trigger opens at initialIndex. */
63
+ images?: readonly LightboxImage[];
64
+ initialIndex?: number;
65
+ /**
66
+ * Required, and the whole reason this is not a bare `<img>` in a
67
+ * dialog. It names both the enlarged image and — via `heading`'s
68
+ * default below — the dialog itself, and a poster grid of unnamed
69
+ * images is unnavigable rather than merely imperfect. Same rule
70
+ * `MediaTile` makes.
71
+ */
72
+ alt: string;
73
+ /** Shown under the enlarged image. A year, a source, a filename. */
74
+ caption?: ReactNode;
75
+ /** Applied to the built-in trigger button, not the dialog. */
76
+ className?: string;
77
+ /**
78
+ * The dialog's accessible name and visible heading. Defaults to
79
+ * `alt`, which is right when the thumbnail's alt is already the
80
+ * title ("THE OUTFIT poster"); pass it when the two should differ.
81
+ */
82
+ heading?: string;
83
+ /**
84
+ * **Controlled** open state. Omit for the uncontrolled default,
85
+ * where the trigger owns it through `useVisibility`. Present means
86
+ * the caller owns it and the built-in trigger becomes a plain
87
+ * button that only *reports* intent through `onOpenChange`.
88
+ */
89
+ isOpen?: boolean;
90
+ onOpenChange?: (isOpen: boolean) => void;
91
+ src: string;
92
+ /**
93
+ * The clickable thumbnail — a smaller `<img>`, usually. Omitted in
94
+ * the controlled, trigger-elsewhere case, where something else in
95
+ * the page opens the lightbox and this renders only the overlay.
96
+ */
97
+ thumbnail?: ReactNode;
98
+ };
99
+ ```
100
+
101
+ [Full declarations](../../dist/Lightbox/Lightbox.d.ts)