@charcuterie/ui 4.29.0 → 4.31.0

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 (134) hide show
  1. package/README.md +7 -2
  2. package/dist/CatalogPicker/CatalogPicker.d.ts +7 -2
  3. package/dist/CatalogPicker/CatalogPicker.d.ts.map +1 -1
  4. package/dist/CatalogPicker/CatalogPicker.js +6 -3
  5. package/dist/CatalogPicker/CatalogPicker.js.map +1 -1
  6. package/dist/CatalogPicker/CatalogPickerOption.d.ts +1 -1
  7. package/dist/CatalogPicker/CatalogPickerOption.d.ts.map +1 -1
  8. package/dist/CatalogPicker/CatalogPickerOption.js +5 -4
  9. package/dist/CatalogPicker/CatalogPickerOption.js.map +1 -1
  10. package/dist/CatalogPicker/catalogPickerView.d.ts +13 -1
  11. package/dist/CatalogPicker/catalogPickerView.d.ts.map +1 -1
  12. package/dist/CatalogPicker/catalogPickerView.js +10 -0
  13. package/dist/CatalogPicker/catalogPickerView.js.map +1 -1
  14. package/docs/README.md +573 -0
  15. package/docs/building-an-app.md +231 -0
  16. package/docs/components/Accordion.md +106 -0
  17. package/docs/components/ActionMenu.md +63 -0
  18. package/docs/components/ActionTiles.md +233 -0
  19. package/docs/components/AdaptiveGrid.md +215 -0
  20. package/docs/components/Alert.md +99 -0
  21. package/docs/components/AnchorLink.md +23 -0
  22. package/docs/components/Avatar.md +153 -0
  23. package/docs/components/Badge.md +81 -0
  24. package/docs/components/BadgeButton.md +84 -0
  25. package/docs/components/Board.md +277 -0
  26. package/docs/components/Breadcrumbs.md +87 -0
  27. package/docs/components/Button.md +72 -0
  28. package/docs/components/ButtonLink.md +81 -0
  29. package/docs/components/Card.md +114 -0
  30. package/docs/components/CatalogPicker.md +250 -0
  31. package/docs/components/Chart.md +39 -0
  32. package/docs/components/Checkbox.md +197 -0
  33. package/docs/components/ColorPicker.md +99 -0
  34. package/docs/components/ColorSchemeSwitcher.md +92 -0
  35. package/docs/components/ColorSchemeToggle.md +98 -0
  36. package/docs/components/Combobox.md +175 -0
  37. package/docs/components/CommandPalette.md +120 -0
  38. package/docs/components/ComparisonChart.md +31 -0
  39. package/docs/components/CopyButton.md +112 -0
  40. package/docs/components/DataTable.md +170 -0
  41. package/docs/components/DatePicker.md +225 -0
  42. package/docs/components/Dialog.md +134 -0
  43. package/docs/components/DropRail.md +107 -0
  44. package/docs/components/EmptyState.md +65 -0
  45. package/docs/components/Field.md +215 -0
  46. package/docs/components/FieldGroup.md +45 -0
  47. package/docs/components/FileDropZone.md +98 -0
  48. package/docs/components/GroupedList.md +189 -0
  49. package/docs/components/Header.md +76 -0
  50. package/docs/components/HtmlEditor-html-editor.md +76 -0
  51. package/docs/components/HtmlView-html-editor.md +47 -0
  52. package/docs/components/HtmlView-html-view.md +47 -0
  53. package/docs/components/IconButton.md +52 -0
  54. package/docs/components/LaneTimeline.md +254 -0
  55. package/docs/components/Lightbox.md +101 -0
  56. package/docs/components/Listbox.md +109 -0
  57. package/docs/components/LiveStatusIndicator.md +60 -0
  58. package/docs/components/LogViewer.md +142 -0
  59. package/docs/components/Main.md +247 -0
  60. package/docs/components/MarkdownEditor.md +262 -0
  61. package/docs/components/MarkdownEditorCodeMirror-markdown-editor-codemirror.md +230 -0
  62. package/docs/components/MarkdownLine.md +187 -0
  63. package/docs/components/MarkdownView-markdown-editor-codemirror.md +235 -0
  64. package/docs/components/MediaTile.md +106 -0
  65. package/docs/components/Menu.md +209 -0
  66. package/docs/components/MetricCard.md +38 -0
  67. package/docs/components/Modal.md +89 -0
  68. package/docs/components/Nav.md +167 -0
  69. package/docs/components/NavBar.md +190 -0
  70. package/docs/components/Picker.md +132 -0
  71. package/docs/components/Popover.md +135 -0
  72. package/docs/components/PortraitTiles.md +169 -0
  73. package/docs/components/ProgressBar.md +70 -0
  74. package/docs/components/ProgressCard.md +65 -0
  75. package/docs/components/QueryBuilder.md +132 -0
  76. package/docs/components/RadioGroup.md +165 -0
  77. package/docs/components/Rail.md +79 -0
  78. package/docs/components/RangeSlider.md +144 -0
  79. package/docs/components/ReactRouterAdapter-react-router.md +27 -0
  80. package/docs/components/ReactRouterLink-react-router.md +23 -0
  81. package/docs/components/ReorderList.md +143 -0
  82. package/docs/components/RouterLinkProvider.md +33 -0
  83. package/docs/components/ScheduleBoard.md +41 -0
  84. package/docs/components/ScrollMemoryProvider.md +33 -0
  85. package/docs/components/SearchInput.md +46 -0
  86. package/docs/components/SegmentedControl.md +98 -0
  87. package/docs/components/Select.md +169 -0
  88. package/docs/components/Shell.md +162 -0
  89. package/docs/components/Skeleton.md +48 -0
  90. package/docs/components/Slider.md +128 -0
  91. package/docs/components/SortableTableHeader.md +84 -0
  92. package/docs/components/Spinner.md +50 -0
  93. package/docs/components/Stepper.md +121 -0
  94. package/docs/components/Swatch.md +79 -0
  95. package/docs/components/Switch.md +80 -0
  96. package/docs/components/TableColumns.md +29 -0
  97. package/docs/components/TableViewport.md +42 -0
  98. package/docs/components/Tabs.md +184 -0
  99. package/docs/components/TextLink.md +106 -0
  100. package/docs/components/TimecodeInput.md +222 -0
  101. package/docs/components/Toast.md +108 -0
  102. package/docs/components/ToastRegion.md +35 -0
  103. package/docs/components/Toolbar.md +118 -0
  104. package/docs/components/Tooltip.md +94 -0
  105. package/docs/components/UnstyledLink.md +21 -0
  106. package/docs/components/ValuePairs.md +30 -0
  107. package/docs/components/VirtualizedGrid.md +204 -0
  108. package/docs/components/VisuallyHidden.md +39 -0
  109. package/docs/components/WeekdayIndicator.md +39 -0
  110. package/docs/hooks/useAdaptiveColumns.md +111 -0
  111. package/docs/hooks/useCommandPalette.md +40 -0
  112. package/docs/hooks/useCommandPaletteHotkeys.md +33 -0
  113. package/docs/hooks/useDeploymentUpdate.md +39 -0
  114. package/docs/hooks/useLastPresentValue.md +23 -0
  115. package/docs/hooks/useListMotion.md +65 -0
  116. package/docs/hooks/useNavLayout.md +59 -0
  117. package/docs/hooks/usePresence.md +39 -0
  118. package/docs/hooks/useRouterLink.md +22 -0
  119. package/docs/hooks/useValueChangeMotion.md +28 -0
  120. package/package.json +7 -5
  121. package/skills/charcuterie/SKILL.md +17 -0
  122. package/skills/charcuterie/references/build-a-screen.md +6 -0
  123. package/skills/charcuterie/references/create-a-component.md +6 -0
  124. package/src/AdaptiveGrid/AdaptiveGrid.stories.tsx +1 -1
  125. package/src/CatalogPicker/CatalogPicker.mdx +36 -1
  126. package/src/CatalogPicker/CatalogPicker.test.tsx +264 -24
  127. package/src/CatalogPicker/CatalogPicker.tsx +14 -3
  128. package/src/CatalogPicker/CatalogPickerOption.tsx +19 -6
  129. package/src/CatalogPicker/catalogPickerView.test.ts +19 -0
  130. package/src/CatalogPicker/catalogPickerView.ts +20 -1
  131. package/src/Tabs/Tabs.stories.tsx +1 -1
  132. package/src/VirtualizedGrid/VirtualizedGrid.stories.tsx +65 -28
  133. package/src/VirtualizedGrid/VirtualizedGrid.test.tsx +29 -0
  134. package/src/shell.storyHelpers.tsx +3 -3
@@ -0,0 +1,170 @@
1
+ # DataTable
2
+
3
+ ```ts
4
+ import { DataTable } from "@charcuterie/ui"
5
+ ```
6
+
7
+ **A table that reflows instead of scrolling, sized by its container.** Columns, rows, an
8
+ optional selection column, and the sort *announcement* — the data itself stays the
9
+ consumer's.
10
+
11
+ ## It composes `SortableTableHeader`
12
+
13
+ Every sortable column renders [`SortableTableHeader`](SortableTableHeader.md),
14
+ which shipped first and stays shipped. It is in a published `1.0.0` with a consumer of its
15
+ own, so subsuming it would have been a breaking change bought for nothing — and there is
16
+ value in exactly one place in the fleet knowing that `aria-sort` belongs on the `<th>` while
17
+ the click target is a `<button>` inside it.
18
+
19
+ That composition is also why this is a **real `<table>`** rather than a grid of
20
+ `<div role="row">`s: a div grid cannot host a `<th>` at all, so it would have meant either
21
+ duplicating the header component or breaking it.
22
+
23
+ | | `<table>` | `<div role="grid">` |
24
+ | --- | --- | --- |
25
+ | Hosts `SortableTableHeader` | yes | no |
26
+ | Column widths | the browser's auto layout, free | you write the track list |
27
+ | Screen-reader table mode | native | depends on the roles being complete |
28
+ | Keyboard model | ordinary controls in document order | a roving focus you now own |
29
+
30
+ A `grid` is the right answer for a spreadsheet — cell-by-cell arrow navigation, editable
31
+ cells. This is a **table**: rows of data with the odd control in them.
32
+
33
+ ## Narrow means reflow, never a sideways scroll
34
+
35
+ Below `--cq-md` (32rem) each row becomes a labelled block — the column name beside its
36
+ value — and the header row wraps into a strip of sort controls that stays reachable.
37
+ Long column labels wrap within their label space instead of hiding their endings. Above
38
+ it, an ordinary table. Dense comparisons can set `reflowAt="lg"` (48rem) or
39
+ `reflowAt="xl"` (64rem). `layout="stacked"` keeps the labelled list at every width,
40
+ with all columns and sorting still available. The default remains `md` (32rem).
41
+
42
+ The two alternatives, and why neither:
43
+
44
+ - **Horizontal scroll.** WCAG 2.2 SC 1.4.10 (Reflow) exists because of it, and the consumer
45
+ this was built for bans it outright: *"No horizontal scroll, ever."* A pan surface also
46
+ hides the *existence* of the off-screen columns.
47
+ - **Dropping low-priority columns.** Cheapest to build, and the only option that loses data:
48
+ the assignee column does not come back, and no gesture asks for it.
49
+
50
+ ## Container queries, never a media query
51
+
52
+ The width that decides the layout is **this element's**, not the window's. A table in a
53
+ three-up board lane is narrow on a 4K monitor, and a reader browsing at 175% zoom has ~860
54
+ effective pixels in a 1500px window — so a `@media (max-width: …)` here is measuring
55
+ something that is not the question.
56
+
57
+ The `@container` is declared on the wrapper and queried by its descendants, because
58
+ [a container query never matches the element that declares it](../building-an-app.md).
59
+ `Responsive` is the only honest way to see it: three widths, one window, no viewport change
60
+ at all.
61
+
62
+ ## What it does not own
63
+
64
+ **Sorting the data.** `sort` says which column is sorted; `onSortChange` asks for a
65
+ different one; the rows arrive already ordered. Comparing two values is per-column app logic
66
+ — `priority` in the stories sorts high → medium → low, which is not its alphabetical order —
67
+ and a table that sorted itself would need a comparator per column to do it, which is the
68
+ same code in a worse place.
69
+
70
+ **The selected set.** `selection.selectedRowKeys` is authoritative and lives with the
71
+ consumer, because every *use* of a selection — the count in a toolbar, the bulk action, the
72
+ undo — is outside this component. That is the opposite of
73
+ [`Checkbox`](Checkbox.md), and for a stated reason: the platform
74
+ owns one checkbox's checkedness, and nothing at all owns "these five rows".
75
+
76
+ **Column widths.** No drag handle and no measured layout. The browser's own auto table
77
+ layout sizes columns to their content, and `column.className` overrides it — `w-32` on a
78
+ column lands on that column's `<th>` and every one of its `<td>`s.
79
+ In a stacked list those comparison widths are reset, so the label and value have the
80
+ whole record width even when a wider column utility is active. Drag-to-resize is a
81
+ *persistence* question (whose widths, stored where, keyed on what) that a component cannot
82
+ answer for its consumer.
83
+
84
+ **Virtualisation.** Deliberately absent. Every row is in the DOM, which is what keeps the
85
+ accessibility tree honest and the auto column layout possible; the measurements and the
86
+ cliff are in
87
+ [the decision record](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-19-the-data-table-composes-sortabletableheader-reflows-and-does-not-virtualise.md).
88
+ Past a few thousand rows, filter or page — a virtualised table is a different component,
89
+ because it has to fix row heights and column widths to work at all.
90
+
91
+ ## Selection is written to the input, not re-mounted
92
+
93
+ `Checkbox` is uncontrolled by design — `isChecked` seeds the first paint and the `<input>`
94
+ is the store from then on. Keeping a controlled `selectedRowKeys` authoritative therefore
95
+ means **writing to the store**: an effect sets `input.checked` on every render. The
96
+ alternative, a state-bearing `key` that re-mounts the box, throws the focus away one row
97
+ into a keyboard pass down the column.
98
+
99
+ It is also the only way to express the header box's third state: `indeterminate` is a DOM
100
+ property with **no HTML attribute at all**, so no markup could have set it.
101
+
102
+ The row carries `data-is-selected` for the paint, and **not** `aria-selected`: that property
103
+ belongs to `grid` and `treegrid` rows. In a `table`, the row's own checkbox is what states
104
+ the fact — and it is a control that can also change it.
105
+
106
+ ## Keyboard
107
+
108
+ There is no custom key handling, and that is the design. `Tab` reaches each sortable
109
+ header's button and each row's checkbox in document order; `Enter`/`Space` sorts; `Space`
110
+ ticks. A table is not a `grid`, so there is no roving focus and no arrow-key cell
111
+ navigation — a screen reader's own table mode moves through the data, and everything
112
+ interactive is a real control the browser already knows how to reach.
113
+
114
+ ```tsx
115
+ <DataTable
116
+ columns={[{ header: "Name", key: "name", renderCell: (row) => row.name }]}
117
+ getRowKey={(row) => row.id}
118
+ label="Projects"
119
+ rows={[{ id: "plan", name: "Planning" }]}
120
+ />
121
+ ```
122
+
123
+ ## Published TypeScript API
124
+
125
+ ```ts
126
+ const DataTable: <Row>({ className, columns, emptyState, getRowKey, isLabelVisible, label, layout, reflowAt, onSortChange, rows, selection, sort, }: DataTableProps<Row>) => ReactNode
127
+
128
+ type DataTableProps<Row> = {
129
+ /** Auto uses the container width; stacked keeps the labelled list at every width. */
130
+ layout?: "auto" | "stacked";
131
+ /** Dense tables can reflow earlier: md=32rem, lg=48rem, xl=64rem. */
132
+ reflowAt?: DataTableReflowAt;
133
+ className?: string;
134
+ columns: readonly DataTableColumn<Row>[];
135
+ /**
136
+ * What fills the table when `rows` is empty — an `EmptyState`,
137
+ * normally. Rendered in a `colSpan` cell **inside** the table, so
138
+ * the header row and the sort the reader just performed are still
139
+ * there. Swapping the whole table out for a message is how a
140
+ * filter that matches nothing takes the controls away with it.
141
+ */
142
+ emptyState?: ReactNode;
143
+ getRowKey: (row: Row) => string;
144
+ /**
145
+ * Shows the `<caption>`. Off by default: most tables sit under a
146
+ * heading the page already renders, and printing the name twice is
147
+ * how a table ends up with two titles.
148
+ */
149
+ isLabelVisible?: boolean;
150
+ /**
151
+ * The table's accessible name, as a real `<caption>`. Required,
152
+ * because a screen reader listing "table with 6 columns, 40 rows"
153
+ * and no name is a table nobody can choose to enter.
154
+ */
155
+ label: string;
156
+ onSortChange?: (sort: DataTableSort) => void;
157
+ rows: readonly Row[];
158
+ selection?: DataTableSelection<Row>;
159
+ /**
160
+ * Which column is sorted and which way — **the fact, not the
161
+ * doing.** The rows arrive already ordered; this only says which
162
+ * header lights up and what `aria-sort` announces.
163
+ */
164
+ sort?: DataTableSort;
165
+ };
166
+
167
+ Row
168
+ ```
169
+
170
+ [Full declarations](../../dist/DataTable/DataTable.d.ts)
@@ -0,0 +1,225 @@
1
+ # DatePicker
2
+
3
+ ```ts
4
+ import { DatePicker } from "@charcuterie/ui"
5
+ ```
6
+
7
+ A date field: a text input you can actually type into, and a calendar dialog hanging off
8
+ it. The consumer that shaped it is **Docket** — due dates, scheduled dates, phase start/end
9
+ ranges, and a staleness threshold counted in days
10
+ ([decision](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-19-a-date-is-a-calendar-date-not-an-instant.md)).
11
+
12
+ ## The value is a calendar date, never an instant
13
+
14
+ `onChange` reports an ISO **`YYYY-MM-DD`** string — the same format `<input type="date">`
15
+ uses — and never a `Date`.
16
+
17
+ A `Date` is a count of milliseconds, so every read of one goes through the browser's
18
+ timezone. Pick the 19th at 23:30 in Denver, store `new Date("2026-08-19").toISOString()`,
19
+ and the server, the next device, and the same device after a flight disagree about which
20
+ day you meant. It is a one-day error, it only appears near midnight or after travel, and it
21
+ is invisible in every test written at noon. `plainDate.test.ts` runs the whole arithmetic
22
+ suite under UTC, `America/Denver`, UTC+14 and UTC-11 and asserts every answer is identical.
23
+
24
+ There is **no `Date` arithmetic** underneath: every operation is integer maths on a day
25
+ number (Hinnant's `days_from_civil`, the algorithm C++20's `<chrono>` uses), so adding a day
26
+ is `+ 1` and there is no DST to make a fortnight 13.958 days. A `Date` appears in exactly two
27
+ fenced places — `getLocalPlainDate`, the one instant-to-date conversion, which makes you name
28
+ the zone; and `Intl`, which is always handed a UTC-midnight instant and `timeZone: "UTC"`.
29
+
30
+ `Temporal.PlainDate` is this type done properly and it is **not** used: the polyfill is
31
+ ~50 KB gz, an order of magnitude more than this whole component. The public API is ISO
32
+ strings precisely so that swap is invisible when `Temporal` is baseline.
33
+
34
+
35
+
36
+ ## Typing is the feature, and nothing guesses in silence
37
+
38
+ The grid is the fallback. All of these resolve, in the active locale, against the injected
39
+ `today`:
40
+
41
+ | Typed | Resolves to (today = Wed 19 Aug 2026) |
42
+ | --- | --- |
43
+ | `2026-08-19` | 19 Aug 2026 — ISO is tried first, so it is never read as a d-m-y |
44
+ | `tomorrow`, `yesterday`, `today` | 20 / 18 / 19 Aug |
45
+ | `+14d`, `+14`, `-7d`, `+2w`, `+1m`, `in 3 days` | 2 Sep / 2 Sep / 12 Aug / 2 Sep / 19 Sep / 22 Aug |
46
+ | `next week`, `next month`, `last week` | 26 Aug / 19 Sep / 12 Aug |
47
+ | `fri`, `next friday`, `last fri` | 21 Aug / 21 Aug / 14 Aug — always the **next** one, never today |
48
+ | `aug 19`, `19 aug`, `August 19, 2027` | 19 Aug 2026 / 19 Aug 2026 / 19 Aug 2027 |
49
+ | `8/19`, `3/4`, `19/8` | locale order; see below |
50
+ | `19` | the 19th of the month on screen |
51
+
52
+ Three mechanisms keep that from being dangerous, and they are the whole design:
53
+
54
+ 1. **The grammar is ordered and total.** Each rule is anchored on the *whole* input, the
55
+ first match wins, and if none does the answer is a stated failure. `8/` is not the first
56
+ of August.
57
+ 2. **Ambiguity is a named failure, not a coin flip.** `ju 19` comes back as *"ju" could be
58
+ June or July — type more of it*, not as June. Every library that "just works" takes the
59
+ first match, which is how a July task lands in June and nothing ever says so.
60
+ 3. **Nothing commits without an echo.** The resolved date is rendered in full underneath the
61
+ field, in a `role="status"` live region, wired into the input's `aria-describedby`.
62
+ Commit is Enter or blur; a keystroke never commits.
63
+
64
+ A value that will not parse leaves the text **exactly as typed**, marks the field invalid,
65
+ and says why. Clearing it would throw away what the user has to edit; rewriting it to the
66
+ last good value would discard what they meant.
67
+
68
+ ### `3/4`, and the one place a reading is swapped
69
+
70
+ Field order comes from `Intl.DateTimeFormat().formatToParts` — not a country table — so
71
+ `3/4` is 4 March in `en-US` and 3 April in `en-GB`, and the echo says which. `19/8` in
72
+ `en-US` has no month-first reading at all, so the swapped one is taken: **swap only when
73
+ exactly one arrangement is a real date**, which is deduction rather than preference. Two
74
+ digit years use the POSIX `%y` window (00-68 → 2000s, 69-99 → 1900s) rather than a
75
+ boundary of our own. A yearless input is **this** year, always — "the nearest occurrence"
76
+ would make the same keystrokes mean different years depending on the day you typed them.
77
+
78
+ Month names, weekday names and the first day of the week all come from `Intl`; the only
79
+ English in the parser is the relative-word table, which is the `keywords` prop.
80
+
81
+ ## Range is a mode, not a sibling component
82
+
83
+ `isRange` gives you two inputs, two months, and a band between them. It follows
84
+ [Combobox's `isMultiple`](Combobox.md) for the same three reasons,
85
+ which hold harder here:
86
+
87
+ - **No distinct ARIA role.** The family is named by role. A range picker is the same
88
+ `role="dialog"` over the same `role="grid"` — there is no `daterange` role for a
89
+ `DateRangePicker` to be named after, so the name would describe a presentation.
90
+ - **The delta is small and the shared part is everything** — parser, locale plumbing,
91
+ min/max clamp, keyboard grid, panel, presets, echo line.
92
+ - **`Combobox` already set the value shape.** Its `selectedValue` is
93
+ `readonly string[] | string`; this one is `DateRange | string`, and `onChange` reports
94
+ `{ end, start }`. A discriminated props union types better and was rejected for that
95
+ consistency — and because Storybook's docgen renders a union props type as an untyped
96
+ object control.
97
+
98
+ Picking an end before the start **swaps** rather than refusing: throwing the pair away
99
+ would discard the day just clicked.
100
+
101
+ ## Keyboard, and the ARIA a date grid actually needs
102
+
103
+ The input is `role="combobox"` with `aria-haspopup="dialog"`; the panel is a
104
+ `role="dialog"` (named, because a dialog takes no name from its content) over a real
105
+ `<table role="grid">` with `columnheader`s. Focus **stays in the input** until you ask for
106
+ the grid — a calendar that steals the caret on open is a calendar you cannot type into.
107
+
108
+ | Key | In the input | In the grid |
109
+ | --- | --- | --- |
110
+ | ArrowDown | opens and moves focus into the grid | + 1 week |
111
+ | ArrowUp / ArrowLeft / ArrowRight | — | − 1 week / − 1 day / + 1 day |
112
+ | PageUp / PageDown | — | ∓ 1 month (Shift: ∓ 1 year) |
113
+ | Home / End | — | first / last day of that week |
114
+ | Enter | commits the typed text | selects the focused day |
115
+ | Escape | — | closes and returns the caret to the input |
116
+
117
+ The roving tabindex is **arithmetic, not registration**: `useRovingFocus` is a registration
118
+ kind whose `next`/`previous` walk a member list, and ArrowRight on 31 August has to land on
119
+ 1 September — a day this grid has not rendered and no member has registered. So the focused
120
+ *date* is the state and the DOM follows it. Exactly one cell is in the tab order, and each
121
+ cell's accessible name is the whole date ("Wednesday, August 19, 2026"), not `19`.
122
+
123
+ ## The panel is a container, and it is queried as one
124
+
125
+ `@container` sits on the panel, so everything inside sizes to the **panel's own inline
126
+ size** rather than to the window: one-letter weekday headers and 32px cells below
127
+ `--cq-xs`, two letters and 36px above it, 40px above `--cq-sm`, and in range mode the two
128
+ months stack below `--cq-sm` and sit side by side above it.
129
+
130
+ That is not the question a media query asks. The panel is portalled and clamped by
131
+ floating-ui's `size` middleware to the space actually available, so a 390px phone and a
132
+ desktop window at 200% zoom are the same measurement — and the window's width is not it.
133
+
134
+ ## Inside a `Field`, and the clock
135
+
136
+ `Field` clones `id`, `aria-describedby`, `aria-invalid` and `required` onto this component,
137
+ and they are forwarded to the input — pass the **same** `label` text as the `Field`'s, since
138
+ they are the same name (WCAG 2.5.3).
139
+
140
+ `today` is the injected clock, as an ISO date. Every relative form, the `aria-current="date"`
141
+ marker and the preset row resolve against it. Omit it and it is read **once**, at mount, from
142
+ `timeZone` or the device. Supply it in every test and story: a date component tested against
143
+ the real "today" passes on the day it was written and fails silently afterwards.
144
+
145
+ `getDaysBetween`, `addDays`, `parseIsoDate`, `toIsoDate`, `formatPlainDate` and
146
+ `parseDateInput` are exported from the barrel too — Docket counts staleness in days, and it
147
+ should not have to reimplement the subtraction this component already got right.
148
+
149
+ ```tsx
150
+ import type { ComponentProps } from "react"
151
+
152
+ function DueDate({ onChange }: Pick<ComponentProps<typeof DatePicker>, "onChange">) {
153
+ return <DatePicker label="Due date" onChange={onChange} value="2026-06-01" />
154
+ }
155
+ ```
156
+
157
+ ## Published TypeScript API
158
+
159
+ ```ts
160
+ const DatePicker: ({ className, firstDayOfWeek, isDisabled, isRange, keywords, label, locale, maxValue, minValue, onChange, placeholder, presets, size, timeZone, today, value, ...receivedSlotProps }: DatePickerProps) => ReactNode
161
+
162
+ type DatePickerProps = SlotProps & {
163
+ className?: string;
164
+ /**
165
+ * Sunday 0 through Saturday 6. Omit and the locale decides, via
166
+ * `Intl.Locale`'s `getWeekInfo` — which is why there is no
167
+ * `isMondayFirst` here.
168
+ */
169
+ firstDayOfWeek?: number;
170
+ isDisabled?: boolean;
171
+ /**
172
+ * Start-and-end mode. A **mode, not a sibling component** — see
173
+ * the component docblock, and the `Combobox` `isMultiple`
174
+ * precedent it follows.
175
+ */
176
+ isRange?: boolean;
177
+ /** Override the English relative words (`today`, `next`, `+3d`). */
178
+ keywords?: DateInputKeywords;
179
+ /**
180
+ * Required. It names the field for a screen reader **and** names
181
+ * the calendar dialog and its grids, which a `role="dialog"` takes
182
+ * from nothing else. Inside a `Field`, pass the same text as the
183
+ * `Field`'s own `label` — they are the same name and WCAG 2.5.3
184
+ * wants them to agree.
185
+ */
186
+ label: string;
187
+ /** Omit for the platform's resolved locale. */
188
+ locale?: string;
189
+ /** ISO `YYYY-MM-DD`. Days after this are unselectable. */
190
+ maxValue?: string;
191
+ /** ISO `YYYY-MM-DD`. Days before this are unselectable. */
192
+ minValue?: string;
193
+ /**
194
+ * An ISO `YYYY-MM-DD` in single mode, a `{ end, start }` of them in
195
+ * range mode, and `null` when cleared. Never a `Date`, and that is
196
+ * the point — see the docblock.
197
+ */
198
+ onChange?: (value: DateRange | null | string) => void;
199
+ placeholder?: string;
200
+ /** Pass `[]` to drop the shortcut row entirely. */
201
+ presets?: readonly DatePreset[];
202
+ size?: ControlSize;
203
+ /**
204
+ * Which zone's calendar "today" is read from, when `today` is
205
+ * omitted. Ignored when `today` is supplied — which is what every
206
+ * test and every story does.
207
+ */
208
+ timeZone?: string;
209
+ /**
210
+ * The clock, injected, as an ISO `YYYY-MM-DD`.
211
+ *
212
+ * Every relative form (`tomorrow`, `next fri`, `+14d`), the
213
+ * `aria-current="date"` marker, and the preset row resolve against
214
+ * this. Supplying it is what makes the component testable at all:
215
+ * a date picker tested against the real "today" passes on the day
216
+ * it was written and fails silently afterwards. Omitted, it is
217
+ * read **once**, at mount, from `timeZone` or the device.
218
+ */
219
+ today?: string;
220
+ /** **Initial** only, like every other value prop in this library. */
221
+ value?: DateRange | string;
222
+ };
223
+ ```
224
+
225
+ [Full declarations](../../dist/DatePicker/DatePicker.d.ts)
@@ -0,0 +1,134 @@
1
+ # Dialog
2
+
3
+ ```ts
4
+ import { Dialog } from "@charcuterie/ui"
5
+ ```
6
+
7
+ `Dialog` is [`Modal`](Modal.md) plus the chrome: a heading, a
8
+ Close button, a scrolling body, an optional footer, and five sizes. This is what `Modal`
9
+ *was* before the M8 rebuild — a dialog is one kind of modal, so it takes the specific name
10
+ and hands the generic one back to the base layer
11
+ ([decision](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-03-modal-is-the-base-layer-and-dialog-is-the-component.md)).
12
+
13
+ ## Everything modal is `Modal`'s
14
+
15
+ The portal, the scrim, the focus trap, the scroll lock, Escape, an outside press, and the
16
+ stacking all live in `Modal` (via `OverlayPanel`). `Dialog` is just the box's contents and
17
+ the size it wants — `SIZE_CLASS` composed over `Modal`'s default surface, which is why
18
+ `full` carries `rounded-none` to square off the base's `rounded-lg` at the viewport edge.
19
+
20
+
21
+
22
+ `onClose` is every route out — the close button, Escape, a backdrop press — so there is
23
+ one place to wire and no way to end up with the element shut and the state still open.
24
+ `heading` is required: it names both the visible header and, through `aria-labelledby`,
25
+ the dialog itself.
26
+
27
+ ## Escape is pressable now
28
+
29
+ The old `Modal` was a native `<dialog>`, whose trusted `cancel` a story's synthetic
30
+ `userEvent` could not fire — so its tests dispatched a fake close request. `useDismiss`
31
+ listens for a plain keydown instead, so `userEvent.keyboard("{Escape}")` is a real close
32
+ request. `isDismissable={false}` disables it at the dismiss layer, so a dialog the app
33
+ still owns cannot be closed behind its back. `AllStates` pairs the refusal with a
34
+ differential — the dialog that ignores Escape is then closed by its own button — because
35
+ "still open" is also true of a dialog nothing can close at all.
36
+
37
+ ## Pickers inside a draft
38
+
39
+ An open picker, menu, or popover owns the first Escape or outside press inside a
40
+ modal. Dismissing that child keeps the enclosing dialog and its unsaved fields open.
41
+ After the child closes, Escape dismisses the dialog normally. Selecting a picker
42
+ option also keeps the draft open and returns focus to its trigger.
43
+
44
+ ## Stacking, and the one shared scrim
45
+
46
+ A lone dialog needs no setup. Stack one over another and an `OverlayStackProvider` at the
47
+ app root renders a **single** scrim behind both, keeps the second on top, marks the first
48
+ `inert`, and closes them top-first on Escape or a backdrop press. The scroll lock
49
+ ref-counts through the stack, so the page frees only when the last closes.
50
+
51
+ ## `dvh`, and the scrim token
52
+
53
+ Every size clamps at `85dvh`; `full` takes the lot. `dvh` rather than `vh` because on a
54
+ phone the two differ by the address bar, and a dialog whose footer is under it is a dialog
55
+ with no buttons.
56
+
57
+ The scrim reads `--color-scrim`, a **variant** token: `legible` dims at 0.84 and
58
+ `daylight` at 0.66, because how hard a direction separates a dialog from the page is
59
+ exactly the sort of thing a visual direction decides. ePaper's is `transparent` — a panel
60
+ with no opacity cannot dim, so it says so instead of faking it. `Responsive` asserts the
61
+ computed scrim colour is really there, since a `var()` that failed to resolve would just
62
+ look like a design choice.
63
+
64
+ ## A dialog is not a container-query citizen
65
+
66
+ It gets no `ContainerBoard`. Its size is measured against the viewport by definition — it
67
+ is the thing covering the viewport — so boarding it at three container widths would be
68
+ measuring something with no bearing on it.
69
+
70
+ ```tsx
71
+ import { Button } from "@charcuterie/ui"
72
+ import { useVisibility } from "@charcuterie/logic"
73
+
74
+ function Details() {
75
+ const { isVisible, show, hide } = useVisibility()
76
+ return <>
77
+ <Button onClick={show}>Show details</Button>
78
+ <Dialog heading="Project details" isVisible={isVisible} onClose={hide}>
79
+ <p>The project is ready to review.</p>
80
+ </Dialog>
81
+ </>
82
+ }
83
+ ```
84
+
85
+ ## Published TypeScript API
86
+
87
+ ```ts
88
+ const Dialog: ({ children, className, footer, heading, hasMotion, headingLevel, initialFocus, isDismissable, isVisible, onClose, size, }: DialogProps) => ReactNode
89
+
90
+ type DialogProps = {
91
+ /**
92
+ * The scrolling body. Optional: a confirm dialog whose question is
93
+ * its `heading` and whose answers are its `footer` has no body, and
94
+ * the old chrome `Modal` (which extended `<dialog>`'s DOM props)
95
+ * allowed that — `Dialog` keeps it.
96
+ */
97
+ children?: ReactNode;
98
+ className?: string;
99
+ /** The footer row. Buttons, usually. */
100
+ footer?: ReactNode;
101
+ heading: string;
102
+ headingLevel?: 2 | 3 | 4;
103
+ /**
104
+ * Escape and a backdrop press both close. Off for the one honest
105
+ * case — a destructive confirm the user has to answer.
106
+ */
107
+ /**
108
+ * Which element takes the caret when the dialog opens.
109
+ *
110
+ * A dialog wrapping a form wants its first field, not the Close
111
+ * button the focus manager would otherwise pick — and a consumer
112
+ * cannot fix that from outside, because focusing in its own
113
+ * effect races the manager and loses. Docket's capture dialog is
114
+ * the case: every keystroke landed on "Close".
115
+ */
116
+ initialFocus?: RefObject<HTMLElement | null>;
117
+ /**
118
+ * `false` only for a caller that animates the panel itself, as
119
+ * `TableViewport` does when it grows a table out of the page. Every
120
+ * other panel keeps the library's enter and exit motion.
121
+ */
122
+ hasMotion?: boolean;
123
+ isDismissable?: boolean;
124
+ isVisible: boolean;
125
+ /**
126
+ * Every route out lands here: the close button, Escape, a backdrop
127
+ * press. Wire it to a `useVisibility()`'s `hide`.
128
+ */
129
+ onClose: () => void;
130
+ size?: DialogSize;
131
+ };
132
+ ```
133
+
134
+ [Full declarations](../../dist/Dialog/Dialog.d.ts)
@@ -0,0 +1,107 @@
1
+ # DropRail
2
+
3
+ ```ts
4
+ import { DropRail } from "@charcuterie/ui"
5
+ ```
6
+
7
+ Every destination at once, brought to the pointer instead of the pointer being carried to
8
+ it.
9
+
10
+ ## The measurement this exists for
11
+
12
+ `Board` moves a card with a `Menu` on the card, and for a board that is the right control:
13
+ three or four lanes, all of them on screen, and the menu opens where your hand already is.
14
+
15
+ It stops being the right control at the size the fleet's real lists reach. Docket's Backlog
16
+ draws **34 project groups down one page**, of which about four fit on a display. Dragging a
17
+ card from the first group to the thirty-fourth means holding a pointer down while the page
18
+ scrolls under it, and a menu of 34 items is a scrolling list inside a popup — which is the
19
+ same problem in a smaller box.
20
+
21
+ A rail answers both halves. It pins to the top for the length of the move, so no destination
22
+ is ever off screen, and there is no travel: every destination is the same short distance
23
+ away.
24
+
25
+ ## One control, three drivers
26
+
27
+ WCAG 2.5.7 (AA since 2.2) requires a single-pointer alternative to any dragging movement,
28
+ and `FileDropZone` says the same thing about its own gesture: build the accessible path
29
+ first and let the drag be the enhancement.
30
+
31
+ So this is **not** a drag affordance with a fallback bolted on. It is a listbox that three
32
+ things drive, all committing through one `onPick`:
33
+
34
+ | Driver | Active chip | Commits on |
35
+ | --- | --- | --- |
36
+ | Pointer | the chip under the pointer, while a button is held | release over a chip |
37
+ | Tap | the chip you touch | the tap |
38
+ | Keyboard | walked with the arrow keys | <kbd>Enter</kbd> |
39
+
40
+ The rail does not know which of the three opened it, and the host does not have to say. It
41
+ reads `event.buttons` on the first pointer event it sees — a button already down means a
42
+ drag is in flight.
43
+
44
+ ## It takes no drag-and-drop dependency
45
+
46
+ The [board's decision](https://github.com/Sawtaytoes/charcuterie) priced four drag-and-drop
47
+ libraries and took none of them, because a published library's dependency list is inherited
48
+ by every consumer — including one with 60 KB gzipped to spend in total. Nothing here changes
49
+ that arithmetic, and this component needs far less than `Board` does: a chip is a box under
50
+ the pointer, so `elementFromPoint` answers the only geometric question there is. No
51
+ snapshot, no collision strategy, no sortable transform.
52
+
53
+ ## It is not `Rail`
54
+
55
+ `Rail` is the app shell's side rail — a landmark, an `<aside>` or a `<nav>`, permanent
56
+ furniture down one edge of a page. `DropRail` is a horizontal strip of drop targets that
57
+ exists only for the length of a move, and it is a `listbox`. They share four letters and
58
+ nothing else; `FileDropZone` is the precedent for the prefix carrying the distinction.
59
+
60
+ ## The three chip states
61
+
62
+ The destination the item is **already in** stays visible and unofferable rather than being
63
+ filtered out. A rail whose contents change depending on what you grabbed is a rail whose
64
+ chips move under the pointer between one move and the next, and muscle memory is the only
65
+ reason this control is faster than a menu.
66
+
67
+ Neither that state nor the disabled one is marked by colour alone. The current chip carries
68
+ visually hidden text — *"— where it is now"* — and both carry `aria-disabled`, because the
69
+ one chip a person must not aim for is exactly the one that must not rely on being dimmer
70
+ (WCAG 1.4.1).
71
+
72
+ ## What it deliberately does not do
73
+
74
+ It does not render the thing being dragged, own the handle, or know what a move means. The
75
+ host keeps all three, which is what lets the same rail sit above a board, a card grid, or a
76
+ list of accordions without any of them being modelled here.
77
+
78
+ ```tsx
79
+ function MoveTargets({ isMoving, move }: { isMoving: boolean; move: (key: string) => void }) {
80
+ return <DropRail isOpen={isMoving} label="Move to" onPick={move}
81
+ targets={[{ key: "archive", label: "Archive" }]} />
82
+ }
83
+ ```
84
+
85
+ ## Published TypeScript API
86
+
87
+ ```ts
88
+ const DropRail: ({ className, isOpen, label, onDismiss, onPick, targets, }: DropRailProps) => ReactNode
89
+
90
+ type DropRailProps = {
91
+ className?: string;
92
+ /**
93
+ * Whether the rail is showing. The host owns this, because only
94
+ * the host knows a move started — and it is the same boolean
95
+ * whether the move began as a pointer drag or as a tap on a
96
+ * handle.
97
+ */
98
+ isOpen: boolean;
99
+ /** The rail's accessible name. Required — it is a listbox. */
100
+ label: string;
101
+ onDismiss?: () => void;
102
+ onPick: (targetKey: string) => void;
103
+ targets: readonly DropRailTarget[];
104
+ };
105
+ ```
106
+
107
+ [Full declarations](../../dist/DropRail/DropRail.d.ts)