@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,222 @@
1
+ # TimecodeInput
2
+
3
+ ```ts
4
+ import { TimecodeInput } from "@charcuterie/ui"
5
+ ```
6
+
7
+ A text field for a position in a piece of media — `hh:mm:ss.mmm` — with an `isRange` mode
8
+ for a section of a file. The consumer that shaped it is **QueuePilot**, which plays only a
9
+ chosen part of a video
10
+ ([decision](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-09-01-a-timecode-is-milliseconds-and-a-section-is-a-mode.md)).
11
+
12
+ ## The value is milliseconds, and the props say so
13
+
14
+ `onChange` reports an integer count of milliseconds from the start of the file. Not a
15
+ `Date`, not a clock time, not a string. A media position is a **duration**, the only
16
+ arithmetic anybody does with it is subtraction, and a number is the type that supports it.
17
+
18
+ Every prop carrying one keeps the `Ms` suffix — `durationMs`, `maxValueMs`, `minValueMs`,
19
+ `stepMs`, `valueMs` — because a duration's unit is genuinely ambiguous and this fleet has
20
+ both seconds and milliseconds in use. A `*At` timestamp is the opposite case and takes no
21
+ suffix.
22
+
23
+
24
+
25
+ ## Why this is not `<input type="time">`
26
+
27
+ Two reasons, and neither is taste.
28
+
29
+ A `time` input's value is a wall-clock `HH:MM` string capped at 24 hours, its smallest step
30
+ is a second unless `step` is fractional, and it has no way to say "1.5 hours into a file" as
31
+ a duration rather than as half past one. A clip boundary is milliseconds; the platform
32
+ control cannot carry them.
33
+
34
+ And it is painted by the operating system, out of `::-webkit-datetime-edit-*`
35
+ pseudo-elements no token reaches inside — the same mechanism that deprecated the native
36
+ `Select` and that kept `Slider` off `<input type="range">`.
37
+
38
+ ## Typing is the whole interface, so nothing guesses in silence
39
+
40
+ | Typed | Resolves to |
41
+ | --- | --- |
42
+ | `90` | `00:01:30.000` — a bare number is **seconds** |
43
+ | `1:30` | `00:01:30.000` |
44
+ | `90:00` | `01:30:00.000` — the largest field present is unbounded |
45
+ | `1:02:03` | `01:02:03.000` |
46
+ | `1:02:03.500`, `1:02:03,500` | `01:02:03.500` |
47
+ | `+90` | `00:01:30.000` — a leading `+` is tolerated |
48
+
49
+ Three mechanisms keep a grammar that permissive from being dangerous:
50
+
51
+ 1. **The grammar is ordered and total.** Each rule is anchored on the *whole* input, the
52
+ first match wins, and no match is a stated failure. `1:` is not one minute.
53
+ 2. **An overflow is a failure with a name, not a carry.** `1:90` comes back as *A minute
54
+ has 60 seconds, so "90" is not a seconds field. Type 02:30 to carry it, or 90 to mean 90
55
+ seconds.* Both legal spellings are offered and neither is taken. Carrying it silently
56
+ moves the position by a whole minute, which is the `1:60` trap mux-magic wrote down in
57
+ 2023.
58
+ 3. **Nothing commits without an echo.** The resolved position is rendered in full underneath
59
+ the field, in a `role="status"` live region wired into the input's `aria-describedby`.
60
+ Commit is Enter or blur; a keystroke never commits.
61
+
62
+ The echo is a **reading of the focused field**, so it leaves when the focus does. A
63
+ restatement left under an idle control is an unlabelled timecode floating on the page, which
64
+ reads as a value rather than as a report on the one above it.
65
+
66
+ A **refusal** is the other case and it stays up, both kinds of it. The zero-length complaint
67
+ is written at the commit — which *is* the blur — so a rule that cleared it on blur would mean
68
+ it was never readable. And a text the grammar cannot read keeps `aria-invalid` on the
69
+ control, so the sentence saying why has to stay with it: an invalid field with no message is
70
+ worse than the stray line this removes. Emptying a live region announces nothing, so none of
71
+ this makes a screen reader chatty.
72
+
73
+ **The largest field present is unbounded; every smaller one is 0–59.** That one sentence is
74
+ every bound in the grammar. It is also why a bare number is seconds: seconds is the smallest
75
+ unit the field prints, so the reading that needs no explanation is the one where the typist
76
+ appended nothing.
77
+
78
+ **Milliseconds are optional to read as well as to type.** The grammar has always accepted
79
+ `1:01:00`, and the field now writes it back as `01:01:00` rather than as `01:01:00.000` — you
80
+ write 3, not 3.000. A real fraction still prints in full: `1:01:00.5` commits as
81
+ `01:01:00.500`, because a fraction pads on the right.
82
+
83
+ Refused by name: a negative, a seconds or minutes field of 60 or more with a larger field
84
+ beside it, more than three colon-separated parts, a fraction longer than three digits, and
85
+ anything the accepting rules do not match. A refused value leaves the text **exactly as
86
+ typed**, marks the field invalid and says why.
87
+
88
+ ## A section is `isRange`, and both of its ends are optional
89
+
90
+ `{ end, start }` has four real states, not three plus an error:
91
+
92
+ | `start` | `end` | Means |
93
+ | --- | --- | --- |
94
+ | `null` | `null` | no window at all |
95
+ | set | `null` | from here to the end of the media |
96
+ | `null` | set | from the beginning, stopping here |
97
+ | set | set | the window between them |
98
+
99
+ So there is no `isEndOpen` prop — `null` already says it — and clearing one end never
100
+ touches the other. An open start is the **absence of a choice**, not zero, which is why a
101
+ half-open section is clamped but never compared.
102
+
103
+ Picking an end before the start **swaps**, following `DatePicker`: throwing the pair away
104
+ would discard the boundary just typed. An end **equal** to the start is **refused** by name,
105
+ which is where this parts company with a date range: a zero-length section plays nothing, so
106
+ swapping it would hide a typo behind a window that silently does not exist.
107
+
108
+ There is no `error` prop. `Field` and `FieldGroup` own the semantic error; this component
109
+ owns only the echo.
110
+
111
+ ## Keyboard
112
+
113
+ | Key | Does |
114
+ | --- | --- |
115
+ | Enter | commits the typed text |
116
+ | Tab / blur | commits the typed text |
117
+ | Escape | puts the last committed value back |
118
+ | ArrowUp / ArrowDown | steps by `stepMs` (default 1000) and **commits** |
119
+ | Shift + ArrowUp / ArrowDown | steps by ten times `stepMs` |
120
+
121
+ A step commits, and that is not an exception to "a keystroke never commits" — it is the
122
+ other side of it. Typing is a draft the echo reports on; a step is a whole gesture on a
123
+ value that already exists, the same act as clicking a day in `DatePicker`'s calendar. A
124
+ stepper that needed Enter afterwards is a stepper nobody presses twice.
125
+
126
+ The control keeps the plain `textbox` role. It is **not** a `role="spinbutton"`: that role
127
+ promises an `aria-valuenow`, and this field has no value at all while it is empty or while
128
+ its text is refused — which are exactly the states the echo exists for. A spinbutton with no
129
+ value is a widget that under-reports itself to a screen reader in its two most important
130
+ states.
131
+
132
+ ## The Narrow View stacks the two fields
133
+
134
+ A section is `[start] to [end]` in a row while there is room for it. Below `--cq-sm` the two
135
+ fields **stack**, and the `to` is replaced by a "Start" caption over the first and an "End"
136
+ caption over the second. Two `hh:mm:ss.mmm` fields and a word between them fill a 390px modal
137
+ edge to edge with no slack, which is where this was reported from.
138
+
139
+ It is a **container** query, not a window breakpoint. The box that ran out of room is this
140
+ field's own, and a 390px dialog on a 2560px monitor is the Wide View by every media query
141
+ ever written. The cost of `container-type: inline-size` is the `contain: inline-size` that
142
+ rides with it, so `TimecodeInput` takes its width from its parent rather than from its
143
+ content — give it a definite inline size, as with every container-query component here.
144
+
145
+ The captions are `aria-hidden`, exactly as the `to` always was. Each input already carries
146
+ `aria-label="<label> start"` / `"<label> end"`, and a real `<label>` would name the start
147
+ control a second time and fight the `id` a `Field` above clones onto it. **The accessible
148
+ name of each control is identical in both layouts**, and `TimecodeInput.test.tsx` asserts it
149
+ at two container widths.
150
+
151
+ ## The formatter is exported, because the fleet writes it repeatedly
152
+
153
+ `formatTimecode`, `parseTimecodeInput` and `clampTimecode` come out of the barrel. The
154
+ printing half is written five times across the fleet — queuepilot's `clock` and `toClock`,
155
+ castkit's `formatTime`, and mux-magic's two modal formatters — each with its own answer to
156
+ whether the hour is shown and whether the minute is padded. A read-only surface should call
157
+ the exported one rather than spell a sixth.
158
+
159
+ ```ts
160
+ formatTimecode(3_723_500) // "01:02:03.500"
161
+ formatTimecode(90_000, { isHoursShown: false }) // "01:30.000"
162
+ formatTimecode(1_999, { millisecondDigits: 0 }) // "00:00:01" — truncates
163
+ formatTimecode(3_660_000, { millisecondDigits: "auto" }) // "01:01:00" — no fraction to print
164
+ formatTimecode(3_660_500, { millisecondDigits: "auto" }) // "01:01:00.500"
165
+ ```
166
+
167
+ The **default is the canonical `hh:mm:ss.mmm`** and it stays that way, because a published
168
+ export is read by callers no change here can see. `TimecodeInput` opts in to `"auto"` for
169
+ both the text it writes back and its own echo, so the two agree on the page.
170
+
171
+ Either way it is one spelling per value: a re-read of the field parses to the number that
172
+ produced it, and a screenshot of the same value is the same picture.
173
+
174
+ ```tsx
175
+ <TimecodeInput label="Start time" durationMs={120000} valueMs={30000} />
176
+ ```
177
+
178
+ ## Published TypeScript API
179
+
180
+ ```ts
181
+ const TimecodeInput: ({ className, durationMs, isDisabled, isRange, label, maxValueMs, minValueMs, onChange, placeholder, size, stepMs, valueMs, ...receivedSlotProps }: TimecodeInputProps) => ReactNode
182
+
183
+ type TimecodeInputProps = SlotProps & {
184
+ className?: string;
185
+ /**
186
+ * How long the media is. It is the default `maxValueMs`, so a
187
+ * consumer that knows the file's length gets the clamp without
188
+ * stating a bound twice.
189
+ */
190
+ durationMs?: number;
191
+ isDisabled?: boolean;
192
+ /**
193
+ * Section mode — a start and an end. A **mode, not a sibling
194
+ * component**, following `DatePicker`'s `isRange` and `Combobox`'s
195
+ * `isMultiple`.
196
+ */
197
+ isRange?: boolean;
198
+ /**
199
+ * Required. In section mode it names **both** inputs, as
200
+ * "<label> start" and "<label> end", so the two stay separately
201
+ * addressable by a screen reader and by an agent.
202
+ */
203
+ label: string;
204
+ /** The end of the allowed window. Defaults to `durationMs`. */
205
+ maxValueMs?: number;
206
+ /** The start of the allowed window. Defaults to `0`. */
207
+ minValueMs?: number;
208
+ /**
209
+ * Milliseconds in single mode, a `{ end, start }` of them in
210
+ * section mode, and `null` when both ends are cleared.
211
+ */
212
+ onChange?: (value: null | number | TimecodeRange) => void;
213
+ placeholder?: string;
214
+ size?: ControlSize;
215
+ /** How far ArrowUp and ArrowDown move. Shift multiplies it by ten. */
216
+ stepMs?: number;
217
+ /** **Initial** only, like every other value prop in this library. */
218
+ valueMs?: number | TimecodeRange;
219
+ };
220
+ ```
221
+
222
+ [Full declarations](../../dist/TimecodeInput/TimecodeInput.d.ts)
@@ -0,0 +1,108 @@
1
+ # Toast
2
+
3
+ ```ts
4
+ import { Toast } from "@charcuterie/ui"
5
+ ```
6
+
7
+ The plan demoted this from P0 with the note *"its duplication evidence was almost entirely
8
+ those two"*, and the M6 survey confirmed it: **the React fleet has no toast at all.**
9
+ mux-magic's only hit is a comment about an undo-toast "rendered elsewhere"; the real ones
10
+ are in plex-channels' and study-buddy's vanilla JavaScript.
11
+
12
+ It ships anyway, on Kevin's call, and one thing here is genuinely new — the plan wrote a
13
+ machine down and M2 never built it:
14
+
15
+ > | Toast lifecycle | entering → visible → exiting → removed |
16
+
17
+ ## Why a `Status`, when a boolean and a timeout would do
18
+
19
+ Because a boolean cannot express **why** the node is still mounted. A toast that is leaving
20
+ is still painted, still occupies its slot, and must not be announced again — and
21
+ `isVisible === false` says none of that.
22
+
23
+ | Transition | Legal | Why |
24
+ | --- | --- | --- |
25
+ | `entering → visible` | yes | after one frame, so the enter animation has something to animate *from* |
26
+ | `visible → exiting` | yes | the duration elapsed, or the user dismissed |
27
+ | `visible → removed` | **no** | skipping the exit is the flicker every hand-rolled stack has |
28
+ | `exiting → visible` | yes | hovering a toast that is sliding away has to bring it back |
29
+ | `removed → anything` | **no** | terminal, so `onDismiss` fires exactly once |
30
+
31
+ The last row is not hypothetical. Hover-to-pause plus a dismiss button means two independent
32
+ timers can be in flight, and the hand-rolled version reconciles them with a `clearTimeout`
33
+ and a ref. Here the second one **throws**.
34
+
35
+ ## One region, and it is polite
36
+
37
+ Not two. The usual arrangement — a polite region and an assertive one, so a danger toast
38
+ interrupts — was rejected because **the interrupting case does not belong in a toast at
39
+ all.** A message that must be heard *now* is one the user has to be able to go back and
40
+ read, and a toast is gone in five seconds. If it matters that much it is an `Alert` on the
41
+ page, which this library already ships and which stays put.
42
+
43
+ `Field` draws the same line for its error text. This library announces **once**, in the
44
+ place the user can act on it.
45
+
46
+ `role="status"` is `aria-live="polite"` *plus `aria-atomic="true"`* by default, and atomic is
47
+ wrong here — it re-reads the entire stack every time one arrives. `aria-atomic="false"` sits
48
+ beside it for exactly that reason.
49
+
50
+ ## The stack does not own the toasts
51
+
52
+ `toasts` comes in and `onDismiss` goes out. There is no `toast()` function, no imperative
53
+ queue, and no context provider — an app already has a store (mux-magic has Jotai, rip-deck
54
+ has its own), and a component library that ships a second one is asking every consumer to
55
+ keep two lists of the same notifications in sync.
56
+
57
+ The lifecycle *inside* one toast is state a store cannot see, which is why `Toast` owns that
58
+ and nothing more.
59
+
60
+ ## `title` is a string
61
+
62
+ Not a `ReactNode`. It is what the region announces and what names each toast's own dismiss
63
+ button — a stack of three all offering "Dismiss" is three matches for one query, which
64
+ `expectAgentDrivable` treats as a failure.
65
+
66
+ ## `pointer-events-none` on the container
67
+
68
+ A fixed overlay across the bottom of the viewport swallows every click in that band,
69
+ including on the app behind it, and it does so invisibly. The container passes clicks through
70
+ and each toast takes them back.
71
+
72
+ ```tsx
73
+ function SavedNotice({ removeNotice }: { removeNotice: () => void }) {
74
+ return <Toast title="Project saved" onRemove={removeNotice} />
75
+ }
76
+ ```
77
+
78
+ ## Published TypeScript API
79
+
80
+ ```ts
81
+ const Toast: ({ children, className, duration, exitDuration, intent, onRemove, title, }: ToastProps) => ReactNode
82
+
83
+ type ToastProps = {
84
+ /** Detail under the title. Optional — many toasts are one line. */
85
+ children?: ReactNode;
86
+ className?: string;
87
+ /**
88
+ * Milliseconds at `visible` before it starts leaving. `0` pins it
89
+ * open, which is what a toast carrying an action has to do — WCAG
90
+ * 2.2.1 gives a user the right to finish reading.
91
+ */
92
+ duration?: number;
93
+ /** How long `exiting` lasts, matched to the transition below. */
94
+ exitDuration?: number;
95
+ intent?: IntentName;
96
+ /** Called once, when the machine reaches its terminal state. */
97
+ onRemove: () => void;
98
+ /**
99
+ * A string, not a `ReactNode`. It is what the region announces and
100
+ * what names this toast's own dismiss button — a stack of three
101
+ * toasts all offering "Dismiss" is three matches for one query,
102
+ * which `expectAgentDrivable` treats as a failure.
103
+ */
104
+ title: string;
105
+ };
106
+ ```
107
+
108
+ [Full declarations](../../dist/Toast/Toast.d.ts)
@@ -0,0 +1,35 @@
1
+ # ToastRegion
2
+
3
+ ```ts
4
+ import { ToastRegion } from "@charcuterie/ui"
5
+ ```
6
+
7
+ Place this region once to stack transient notifications and dismiss them through one callback. Use `Alert` for a persistent notice in the page. Give the live region an accessible name and keep important errors available elsewhere if the toasts expire.
8
+
9
+ ```tsx
10
+ import type { ComponentProps } from "react"
11
+
12
+ function Notifications({ toasts, onDismiss }: ComponentProps<typeof ToastRegion>) {
13
+ return <ToastRegion label="Notifications" toasts={toasts} onDismiss={onDismiss} />
14
+ }
15
+ ```
16
+
17
+ ## Published TypeScript API
18
+
19
+ ```ts
20
+ const ToastRegion: ({ className, label, onDismiss, toasts, }: ToastRegionProps) => ReactNode
21
+
22
+ type ToastRegionProps = {
23
+ className?: string;
24
+ /**
25
+ * The region's accessible name. `role="status"` takes **none from
26
+ * its content** — the trap `Spinner` walked into in M3 and
27
+ * `Popover` in M4.
28
+ */
29
+ label?: string;
30
+ onDismiss: (key: string) => void;
31
+ toasts: ToastRecord[];
32
+ };
33
+ ```
34
+
35
+ [Full declarations](../../dist/Toast/ToastRegion.d.ts)
@@ -0,0 +1,118 @@
1
+ # Toolbar
2
+
3
+ ```ts
4
+ import { Toolbar } from "@charcuterie/ui"
5
+ ```
6
+
7
+ A row of controls that collapses into an overflow when it runs out of room — measured, not
8
+ breakpointed, with **exactly one instance** of every control in the document.
9
+
10
+ ## What four repos got wrong
11
+
12
+ mux-magic's `PageHeader` is the fleet's original, and plex-channels' `Header` names it in
13
+ its own comments as the thing it copied. Both inherit all of this:
14
+
15
+ | Defect | There | Here |
16
+ | --- | --- | --- |
17
+ | `role="toolbar"`, no toolbar keyboard model | six sequential tab stops | one tab stop, arrow keys, `RovingFocus` |
18
+ | Toggles with no state | `Switch` is an `aria-hidden` `<span>`; Dry Run announces identically on and off | the control is the app's own, and `Switch` carries `role="switch"` |
19
+ | Triggers advertise nothing | zero `aria-expanded` / `aria-haspopup` / `aria-controls` in the file | written by `useRole`, inside `Menu` / `Popover` |
20
+ | No focus management | no focus-on-open, no return-to-trigger | `Menu` seeds the first item; `FloatingFocusManager` returns focus |
21
+ | Collapse by DOM duplication | every action rendered twice, one copy hidden by a documented CSS specificity coin-flip | one instance, relocated |
22
+ | Nothing decides what collapses | two hardcoded media queries at 480/481px, ⋮ shown at every width | measured, priority-ordered, trigger only when something overflowed |
23
+
24
+ ## The overflow's role is a **type**, not a flag
25
+
26
+ `role="menu"` permits only `menuitem`, `menuitemradio`, `menuitemcheckbox`, `group` and
27
+ `separator`. A header overflow usually is not a menu — it holds toggles — and
28
+ plex-channels puts a `ColorSchemeSwitcher` inside one today, which is invalid ARIA that no
29
+ gate catches.
30
+
31
+ So the caller cannot get it wrong:
32
+
33
+
34
+
35
+ Same instinct as
36
+ [`Menu`'s items being a discriminated union](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-05-menu-items-is-a-discriminated-union.md):
37
+ the kinds are told apart by the type system, in the data, rather than by a boolean prop or
38
+ a runtime warning.
39
+
40
+ ## Priority is the array order
41
+
42
+ `items[0]` is the last thing to collapse, and it is also paint order. One axis rather than
43
+ two, because a separate `priority` number beside a separate display order is a pair a
44
+ caller can put out of step.
45
+
46
+ ## Measured, not breakpointed
47
+
48
+ There is no `collapseAt` prop. The bar reads the widths its items actually have, so a
49
+ longer label, a different font, or `data-density="kiosk"` moves the collapse point on its
50
+ own — where `480px` is wrong the moment any of those change.
51
+
52
+ Two consequences worth knowing:
53
+
54
+ - **The root is `flex-1 min-w-0`, and must stay sized by its container.** A bar that
55
+ shrink-wraps its items would narrow when one collapsed, which would collapse another —
56
+ a loop with no error anywhere. `useAdaptiveColumns` documents the same trap from the
57
+ other end.
58
+ - **A collapsed item's width is remembered, not re-read.** It is not in the DOM to
59
+ measure. The first paint mounts everything, measures it, and collapses *before paint* in
60
+ a layout effect.
61
+
62
+ ## The keyboard model
63
+
64
+ Tab **once** to enter, then:
65
+
66
+ | Key | Does |
67
+ | --- | --- |
68
+ | `ArrowRight` / `ArrowLeft` | move to the next / previous member |
69
+ | `Home` / `End` | jump to the first / last member |
70
+ | `Tab` | leaves the toolbar entirely |
71
+
72
+ The overflow trigger is the group's last member, so the arrow keys reach it. Clicking a
73
+ member, or tabbing into the group, makes that member active — so the next arrow key
74
+ continues from where the user is.
75
+
76
+ A **disabled** action is simply not registered with the roving group, so the arrows skip it
77
+ while it stays in the DOM and stays announced — the same mechanism `Menu` and
78
+ `SegmentedControl` use.
79
+
80
+ ## Controls the toolbar does not render
81
+
82
+ A `control` item is the app's own element, and the tab stop is written onto the first
83
+ focusable in its subtree rather than cloned in as a prop: most components in this library
84
+ forward no `tabIndex`, so a clone would compile, do nothing, and leave the bar with one tab
85
+ stop per control.
86
+
87
+ A control holding **more than one** focusable is a nested composite this component does not
88
+ manage — only the first gets the tab stop. Put a `SegmentedControl` in a toolbar and it
89
+ brings its own arrow-key model; that is the APG's expectation too.
90
+
91
+ ## Relocating is a different job
92
+
93
+ Progressive collapse answers *what fits*. On a phone the whole bar often wants to leave the
94
+ header, which is a layout decision — `useMediaQuery` from `@charcuterie/logic`, over the
95
+ `matchMediaMatcher` seam, and one instance mounted in one place or the other.
96
+
97
+ ```tsx
98
+ function JobActions({ retry }: { retry: () => void }) {
99
+ return <Toolbar overflow="menu" label="Job actions"
100
+ items={[{ key: "retry", label: "Retry", onSelect: retry }]} />
101
+ }
102
+ ```
103
+
104
+ ## Published TypeScript API
105
+
106
+ ```ts
107
+ const Toolbar: ({ className, isOverflowVisible, items, label, overflow, overflowIcon, overflowLabel, size, }: ToolbarProps) => ReactNode
108
+
109
+ type ToolbarProps = ToolbarSharedProps & ({
110
+ items: readonly ToolbarAction[];
111
+ overflow: "menu";
112
+ } | {
113
+ items: readonly ToolbarItem[];
114
+ overflow: "panel";
115
+ });
116
+ ```
117
+
118
+ [Full declarations](../../dist/Toolbar/Toolbar.d.ts)
@@ -0,0 +1,94 @@
1
+ # Tooltip
2
+
3
+ ```ts
4
+ import { Tooltip } from "@charcuterie/ui"
5
+ ```
6
+
7
+ Replaces mux-magic's `FieldTooltip` — 130 lines of hand-rolled positioning, including a
8
+ `computePosition` that reimplements `flip` and `shift` against `window.innerHeight`.
9
+
10
+ ## Three defects, all of which render perfectly
11
+
12
+ 1. **Nothing references the tip.** It sets `role="tooltip"` and no `aria-describedby`
13
+ anywhere, so the control it belongs to never mentions it. `role="tooltip"` is **not** a
14
+ live region and does nothing on its own — the tip is a floating node nobody is pointed
15
+ at.
16
+ 2. **Pointer only.** `onPointerEnter`/`onPointerLeave` with no `onFocus`/`onBlur`, so a
17
+ keyboard user cannot open it at all. WCAG 2.1.1.
18
+ 3. **No dismiss.** Escape does nothing, which WCAG 1.4.13 requires of any content shown on
19
+ hover.
20
+
21
+ All three come from the same place: **the ARIA is written by hand beside the behaviour
22
+ instead of falling out of it.** Here `useRole` writes `aria-describedby` on the trigger and
23
+ `role` + `id` on the tip from one source, `useFocus` is what makes it keyboard-openable, and
24
+ `useDismiss` is Escape.
25
+
26
+ ## A tooltip adds; it is never the name
27
+
28
+ | | may be the only place the text exists | why |
29
+ | --- | --- | --- |
30
+ | `aria-label` | **yes** | it *is* the name |
31
+ | `Field` `description` | **yes** | bound with `aria-describedby`, read on focus |
32
+ | `Badge`'s `title` | no | repeats text already in `textContent` |
33
+ | `Tooltip` | **no** | absent on touch, absent when nothing hovers |
34
+
35
+ An `IconButton` under a tooltip still carries its own `aria-label`. `AllVariants` proves the
36
+ button stays findable by the same query whether or not the tip is open.
37
+
38
+ ## Portalled, and no focus manager
39
+
40
+ The tip renders in a `FloatingPortal` at `document.body` — the same reversal as the other
41
+ overlays
42
+ ([decision](https://github.com/Sawtaytoes/charcuterie/blob/master/docs/decisions/2026-08-03-overlays-portal-to-the-body-not-the-top-layer.md)):
43
+ `strategy: "fixed"` alone still let an `overflow: hidden` ancestor clip it, and a portal
44
+ does not. `--layer-tooltip` keeps it above a modal.
45
+
46
+ There is no `FloatingFocusManager`, unlike `Popover`. Focus never enters a tooltip — moving
47
+ it there is what would make one inescapable — so the tip stays out of the focus manager and
48
+ the overlay stack. A scoped query for the tip now reaches for `body`; `useRole` writes
49
+ `aria-describedby` on the trigger, so the link survives the boundary.
50
+
51
+ ## Touch has no hover, and this does not pretend otherwise
52
+
53
+ There is no long-press fallback. A tooltip is supplementary by construction, so on the kiosk
54
+ it simply never appears — and anything a touch user *must* read belongs in a `Field`'s
55
+ `description` instead.
56
+
57
+ Building a long-press would make the tip load-bearing on exactly the surface where it is
58
+ least reliable.
59
+
60
+ ```tsx
61
+ import { Button } from "@charcuterie/ui"
62
+
63
+ <Tooltip label="Re-run the current job"><Button>Retry</Button></Tooltip>
64
+ ```
65
+
66
+ ## Published TypeScript API
67
+
68
+ ```ts
69
+ const Tooltip: ({ children, className, delay, label, placement, ...receivedSlotProps }: TooltipProps) => ReactNode
70
+
71
+ type TooltipProps = SlotProps & {
72
+ /**
73
+ * The control the tip describes. **Cloned, not wrapped** — the
74
+ * same slot contract as `Popover`'s trigger.
75
+ *
76
+ * It has to be something focusable. A tooltip on a `<span>` is
77
+ * pointer-only, which is the state mux-magic's is in today.
78
+ */
79
+ children: ReactElement;
80
+ className?: string;
81
+ /** Milliseconds of hover before it opens. */
82
+ delay?: number;
83
+ /**
84
+ * Text, and text only. `role="tooltip"` has no way to move focus
85
+ * into itself, so a link or a button inside one is unreachable by
86
+ * keyboard and unreadable by touch — if it needs a control, it is
87
+ * a `Popover`.
88
+ */
89
+ label: string;
90
+ placement?: Placement;
91
+ };
92
+ ```
93
+
94
+ [Full declarations](../../dist/Tooltip/Tooltip.d.ts)
@@ -0,0 +1,21 @@
1
+ # UnstyledLink
2
+
3
+ ```ts
4
+ import { UnstyledLink } from "@charcuterie/ui"
5
+ ```
6
+
7
+ Use this for an existing app-specific link treatment that needs the shared router adapter. Use `TextLink` or `ButtonLink` when the library should provide the visual treatment. Keep a visible focus indicator in your custom styles.
8
+
9
+ ```tsx
10
+ <UnstyledLink className="project-link" href="/projects">Projects</UnstyledLink>
11
+ ```
12
+
13
+ ## Published TypeScript API
14
+
15
+ ```ts
16
+ const UnstyledLink: ({ href, ...linkProps }: UnstyledLinkProps) => ReactNode
17
+
18
+ type UnstyledLinkProps = RouterLinkProps;
19
+ ```
20
+
21
+ [Full declarations](../../dist/RouterLink/UnstyledLink.d.ts)
@@ -0,0 +1,30 @@
1
+ # ValuePairs
2
+
3
+ ```ts
4
+ import { ValuePairs } from "@charcuterie/ui"
5
+ ```
6
+
7
+ A label above each value, used identically in a card, row, table cell or dialog.
8
+ The app owns the values and units. The library owns spacing, type and wrapping.
9
+ Pairs keep their natural width; a single value does not drift to the far side of a column.
10
+
11
+ Give the group a descriptive label and pair each value with its visible term so the value has context.
12
+
13
+ ```tsx
14
+ <ValuePairs label="Job totals"
15
+ items={[{ id: "done", label: "Completed", value: "24" }]} />
16
+ ```
17
+
18
+ ## Published TypeScript API
19
+
20
+ ```ts
21
+ const ValuePairs: ({ className, items, label, }: ValuePairsProps) => ReactNode
22
+
23
+ type ValuePairsProps = {
24
+ className?: string;
25
+ items: readonly ValuePair[];
26
+ label: string;
27
+ };
28
+ ```
29
+
30
+ [Full declarations](../../dist/ValuePairs/ValuePairs.d.ts)