@slashsuite/ui-react 0.12.1 → 0.13.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 (367) hide show
  1. package/MIGRATING.md +386 -8
  2. package/README.md +89 -44
  3. package/agent-docs/components/app-shell.md +9 -6
  4. package/agent-docs/components/article-layout.md +140 -0
  5. package/agent-docs/components/audio.md +42 -0
  6. package/agent-docs/components/badge.md +2 -1
  7. package/agent-docs/components/body-text.md +26 -15
  8. package/agent-docs/components/bottom-sheet.md +27 -17
  9. package/agent-docs/components/breadcrumbs.md +10 -6
  10. package/agent-docs/components/button.md +2 -2
  11. package/agent-docs/components/call-to-action.md +59 -0
  12. package/agent-docs/components/callout.md +4 -3
  13. package/agent-docs/components/card-grid.md +15 -7
  14. package/agent-docs/components/card.md +33 -18
  15. package/agent-docs/components/cart-button.md +63 -0
  16. package/agent-docs/components/chat-composer.md +4 -3
  17. package/agent-docs/components/checkbox.md +11 -5
  18. package/agent-docs/components/cluster.md +10 -8
  19. package/agent-docs/components/code-example.md +2 -2
  20. package/agent-docs/components/code.md +7 -5
  21. package/agent-docs/components/colour-scheme-toggle.md +12 -6
  22. package/agent-docs/components/colour-swatch.md +41 -0
  23. package/agent-docs/components/combobox.md +88 -0
  24. package/agent-docs/components/confirm-dialog.md +98 -0
  25. package/agent-docs/components/container.md +2 -1
  26. package/agent-docs/components/copy-button.md +7 -5
  27. package/agent-docs/components/copy-line.md +6 -5
  28. package/agent-docs/components/date-field.md +14 -11
  29. package/agent-docs/components/date-range-picker.md +16 -9
  30. package/agent-docs/components/date-time-field.md +73 -0
  31. package/agent-docs/components/dialog.md +22 -68
  32. package/agent-docs/components/disclosure.md +4 -0
  33. package/agent-docs/components/docs-layout.md +10 -6
  34. package/agent-docs/components/drawer.md +13 -4
  35. package/agent-docs/components/embed-frame.md +48 -0
  36. package/agent-docs/components/empty-state.md +4 -1
  37. package/agent-docs/components/field-dialog.md +6 -5
  38. package/agent-docs/components/field.md +10 -7
  39. package/agent-docs/components/fieldset.md +4 -4
  40. package/agent-docs/components/flow-diagram.md +87 -0
  41. package/agent-docs/components/form-layout.md +4 -1
  42. package/agent-docs/components/form-row.md +7 -7
  43. package/agent-docs/components/full-bleed-layout.md +0 -2
  44. package/agent-docs/components/headings.md +13 -7
  45. package/agent-docs/components/hero.md +11 -2
  46. package/agent-docs/components/icon-button.md +1 -3
  47. package/agent-docs/components/icon.md +6 -13
  48. package/agent-docs/components/image.md +24 -14
  49. package/agent-docs/components/input.md +8 -7
  50. package/agent-docs/components/key-value-list.md +4 -1
  51. package/agent-docs/components/lightbox.md +1 -1
  52. package/agent-docs/components/list-layout.md +5 -7
  53. package/agent-docs/components/list-row.md +37 -34
  54. package/agent-docs/components/loading.md +2 -2
  55. package/agent-docs/components/markdown.md +13 -13
  56. package/agent-docs/components/media-tile.md +8 -4
  57. package/agent-docs/components/menu.md +19 -12
  58. package/agent-docs/components/meta-list.md +2 -2
  59. package/agent-docs/components/morph.md +11 -5
  60. package/agent-docs/components/navigation-progress.md +2 -2
  61. package/agent-docs/components/number-field.md +75 -0
  62. package/agent-docs/components/outline-region.md +19 -8
  63. package/agent-docs/components/page-fade.md +2 -1
  64. package/agent-docs/components/pill.md +7 -6
  65. package/agent-docs/components/popover.md +63 -0
  66. package/agent-docs/components/price.md +49 -0
  67. package/agent-docs/components/product-tile.md +78 -0
  68. package/agent-docs/components/promo-banner.md +46 -0
  69. package/agent-docs/components/prose-layout.md +1 -1
  70. package/agent-docs/components/radio-group.md +9 -6
  71. package/agent-docs/components/scroll-strip.md +3 -3
  72. package/agent-docs/components/segmented-control.md +4 -2
  73. package/agent-docs/components/select.md +8 -3
  74. package/agent-docs/components/show.md +2 -2
  75. package/agent-docs/components/side-column.md +13 -9
  76. package/agent-docs/components/sidebar-layout.md +1 -1
  77. package/agent-docs/components/site-footer.md +4 -4
  78. package/agent-docs/components/site-search.md +21 -9
  79. package/agent-docs/components/slider.md +59 -0
  80. package/agent-docs/components/sortable-list.md +15 -10
  81. package/agent-docs/components/stack.md +3 -3
  82. package/agent-docs/components/stacked-bar.md +7 -4
  83. package/agent-docs/components/state-machine.md +95 -0
  84. package/agent-docs/components/status-pages.md +13 -6
  85. package/agent-docs/components/stepper.md +54 -0
  86. package/agent-docs/components/switch.md +4 -4
  87. package/agent-docs/components/table-of-contents.md +78 -0
  88. package/agent-docs/components/table.md +35 -24
  89. package/agent-docs/components/tabs.md +24 -26
  90. package/agent-docs/components/text-link.md +12 -7
  91. package/agent-docs/components/textarea.md +4 -2
  92. package/agent-docs/components/toast.md +19 -14
  93. package/agent-docs/components/video.md +7 -2
  94. package/agent-docs/llms.txt +22 -3
  95. package/dist/AppShell.d.ts +25 -9
  96. package/dist/AppShell.js +67 -33
  97. package/dist/AppShellMenu.d.ts +31 -18
  98. package/dist/AppShellMenu.js +72 -45
  99. package/dist/ArticleLayout.d.ts +36 -0
  100. package/dist/ArticleLayout.js +27 -0
  101. package/dist/Audio.d.ts +16 -0
  102. package/dist/Audio.js +11 -0
  103. package/dist/Badge.d.ts +2 -1
  104. package/dist/Badge.js +3 -2
  105. package/dist/BottomSheet.d.ts +17 -6
  106. package/dist/BottomSheet.js +62 -11
  107. package/dist/Breadcrumbs.d.ts +8 -6
  108. package/dist/Breadcrumbs.js +17 -7
  109. package/dist/Button.d.ts +1 -0
  110. package/dist/Button.js +4 -3
  111. package/dist/CallToAction.d.ts +25 -0
  112. package/dist/CallToAction.js +17 -0
  113. package/dist/Callout.d.ts +2 -2
  114. package/dist/Callout.js +2 -2
  115. package/dist/Card.d.ts +88 -31
  116. package/dist/Card.js +55 -92
  117. package/dist/CardBody.d.ts +2 -0
  118. package/dist/CardBody.js +33 -3
  119. package/dist/CardGrid.d.ts +32 -4
  120. package/dist/CardGrid.js +42 -8
  121. package/dist/CardParts.d.ts +7 -1
  122. package/dist/CardParts.js +7 -2
  123. package/dist/CartButton.d.ts +33 -0
  124. package/dist/CartButton.js +18 -0
  125. package/dist/ChatComposer.d.ts +10 -4
  126. package/dist/ChatComposer.js +35 -13
  127. package/dist/Checkbox.d.ts +21 -3
  128. package/dist/Checkbox.js +66 -20
  129. package/dist/Chevron.js +1 -1
  130. package/dist/Cluster.d.ts +28 -15
  131. package/dist/Cluster.js +21 -4
  132. package/dist/Code.d.ts +15 -3
  133. package/dist/Code.js +23 -3
  134. package/dist/CodeBlock.d.ts +4 -4
  135. package/dist/CodeBlock.js +2 -2
  136. package/dist/CodeBody.d.ts +1 -1
  137. package/dist/CodeBody.js +4 -10
  138. package/dist/CodeExample.d.ts +1 -1
  139. package/dist/CodeExample.js +3 -2
  140. package/dist/ColourSchemeToggle.d.ts +21 -5
  141. package/dist/ColourSchemeToggle.js +15 -9
  142. package/dist/ColourSwatch.d.ts +15 -0
  143. package/dist/ColourSwatch.js +14 -0
  144. package/dist/Combobox.d.ts +42 -0
  145. package/dist/Combobox.js +43 -0
  146. package/dist/ConfirmDialog.d.ts +40 -0
  147. package/dist/ConfirmDialog.js +36 -0
  148. package/dist/Container.d.ts +3 -3
  149. package/dist/Container.js +1 -1
  150. package/dist/CopyButton.d.ts +8 -2
  151. package/dist/CopyButton.js +38 -28
  152. package/dist/CopyLine.d.ts +4 -2
  153. package/dist/CopyLine.js +4 -4
  154. package/dist/DateCalendar.d.ts +2 -0
  155. package/dist/DateCalendar.js +11 -9
  156. package/dist/DateField.d.ts +52 -21
  157. package/dist/DateField.js +73 -37
  158. package/dist/DateFieldCalendar.d.ts +12 -8
  159. package/dist/DateFieldCalendar.js +37 -18
  160. package/dist/DateRangePicker.d.ts +23 -3
  161. package/dist/DateRangePicker.js +10 -8
  162. package/dist/DateTimeField.d.ts +31 -0
  163. package/dist/DateTimeField.js +19 -0
  164. package/dist/Dialog.d.ts +42 -6
  165. package/dist/Dialog.js +50 -12
  166. package/dist/Disclosure.js +9 -1
  167. package/dist/DocsLayout.d.ts +13 -5
  168. package/dist/DocsLayout.js +11 -9
  169. package/dist/Drawer.d.ts +22 -7
  170. package/dist/Drawer.js +89 -8
  171. package/dist/EmbedFrame.d.ts +36 -0
  172. package/dist/EmbedFrame.js +18 -0
  173. package/dist/Field.d.ts +41 -4
  174. package/dist/Field.js +61 -25
  175. package/dist/FieldDialog.d.ts +8 -3
  176. package/dist/FieldDialog.js +19 -9
  177. package/dist/Fieldset.d.ts +3 -3
  178. package/dist/Fieldset.js +7 -9
  179. package/dist/FileDrop.js +2 -1
  180. package/dist/FlowDiagram.d.ts +92 -0
  181. package/dist/FlowDiagram.js +100 -0
  182. package/dist/FormRow.d.ts +6 -4
  183. package/dist/FormRow.js +11 -9
  184. package/dist/Hero.d.ts +30 -7
  185. package/dist/Hero.js +23 -9
  186. package/dist/Icon.d.ts +1 -1
  187. package/dist/Icon.js +1 -1
  188. package/dist/IconButton.js +1 -1
  189. package/dist/Image.d.ts +33 -9
  190. package/dist/Image.js +61 -16
  191. package/dist/Input.d.ts +1 -1
  192. package/dist/Input.js +4 -4
  193. package/dist/InputShell.d.ts +7 -0
  194. package/dist/InputShell.js +18 -3
  195. package/dist/KeyValueList.d.ts +2 -2
  196. package/dist/Lightbox.js +5 -3
  197. package/dist/ListRow.d.ts +4 -5
  198. package/dist/ListRow.js +36 -26
  199. package/dist/Mark.d.ts +10 -0
  200. package/dist/Mark.js +9 -0
  201. package/dist/Markdown.d.ts +18 -4
  202. package/dist/Markdown.js +176 -37
  203. package/dist/MediaTile.d.ts +9 -3
  204. package/dist/MediaTile.js +8 -4
  205. package/dist/Menu.d.ts +19 -8
  206. package/dist/Menu.js +13 -11
  207. package/dist/MetaList.d.ts +4 -3
  208. package/dist/MetaList.js +12 -4
  209. package/dist/Morph.d.ts +15 -1
  210. package/dist/Morph.js +70 -22
  211. package/dist/NavigationProgress.d.ts +2 -2
  212. package/dist/NavigationProgress.js +7 -5
  213. package/dist/NumberField.d.ts +66 -0
  214. package/dist/NumberField.js +68 -0
  215. package/dist/OutlineRegion.d.ts +41 -10
  216. package/dist/OutlineRegion.js +31 -6
  217. package/dist/PageFade.d.ts +9 -5
  218. package/dist/PageFade.js +39 -8
  219. package/dist/PageLayouts.d.ts +15 -5
  220. package/dist/PageLayouts.js +3 -3
  221. package/dist/Pill.d.ts +9 -4
  222. package/dist/Pill.js +15 -6
  223. package/dist/Popover.d.ts +31 -0
  224. package/dist/Popover.js +43 -0
  225. package/dist/Price.d.ts +21 -0
  226. package/dist/Price.js +34 -0
  227. package/dist/ProductTile.d.ts +36 -0
  228. package/dist/ProductTile.js +31 -0
  229. package/dist/ProgressBar.js +4 -2
  230. package/dist/PromoBanner.d.ts +25 -0
  231. package/dist/PromoBanner.js +16 -0
  232. package/dist/RadioGroup.d.ts +18 -8
  233. package/dist/RadioGroup.js +42 -18
  234. package/dist/ScrollStrip.d.ts +1 -1
  235. package/dist/ScrollStrip.js +1 -1
  236. package/dist/SearchInput.d.ts +17 -2
  237. package/dist/SearchInput.js +72 -13
  238. package/dist/SegmentedField.d.ts +15 -0
  239. package/dist/SegmentedField.js +15 -0
  240. package/dist/Select.js +5 -4
  241. package/dist/Show.d.ts +1 -1
  242. package/dist/Show.js +1 -1
  243. package/dist/SideColumn.d.ts +42 -15
  244. package/dist/SideColumn.js +45 -19
  245. package/dist/SiteFooter.d.ts +3 -3
  246. package/dist/SiteFooter.js +4 -3
  247. package/dist/SiteSearch.d.ts +57 -27
  248. package/dist/SiteSearch.js +13 -93
  249. package/dist/Slider.d.ts +27 -0
  250. package/dist/Slider.js +58 -0
  251. package/dist/SortableList.d.ts +19 -35
  252. package/dist/SortableList.js +36 -88
  253. package/dist/Stack.d.ts +4 -4
  254. package/dist/StackedBar.d.ts +13 -4
  255. package/dist/StackedBar.js +12 -7
  256. package/dist/StateMachine.d.ts +65 -0
  257. package/dist/StateMachine.js +113 -0
  258. package/dist/StatusPages.d.ts +28 -10
  259. package/dist/StatusPages.js +10 -10
  260. package/dist/Stepper.d.ts +21 -0
  261. package/dist/Stepper.js +33 -0
  262. package/dist/Steps.js +4 -3
  263. package/dist/Switch.d.ts +3 -3
  264. package/dist/Switch.js +18 -14
  265. package/dist/Table.d.ts +32 -9
  266. package/dist/Table.js +50 -20
  267. package/dist/TableCells.d.ts +24 -21
  268. package/dist/TableCells.js +68 -27
  269. package/dist/TableEditCell.d.ts +1 -1
  270. package/dist/TableOfContents.d.ts +34 -0
  271. package/dist/TableOfContents.js +23 -0
  272. package/dist/Tabs.d.ts +31 -16
  273. package/dist/Tabs.js +97 -22
  274. package/dist/TextLink.d.ts +18 -5
  275. package/dist/TextLink.js +19 -6
  276. package/dist/Textarea.d.ts +12 -1
  277. package/dist/Textarea.js +15 -2
  278. package/dist/ToastRegion.d.ts +17 -9
  279. package/dist/ToastRegion.js +70 -13
  280. package/dist/Tooltip.d.ts +10 -2
  281. package/dist/Tooltip.js +32 -11
  282. package/dist/Video.d.ts +19 -4
  283. package/dist/Video.js +15 -5
  284. package/dist/cardContext.d.ts +7 -0
  285. package/dist/cardContext.js +14 -0
  286. package/dist/cardControl.d.ts +15 -0
  287. package/dist/cardControl.js +32 -0
  288. package/dist/cardForm.d.ts +39 -0
  289. package/dist/cardForm.js +81 -0
  290. package/dist/cardWait.js +2 -1
  291. package/dist/colourScheme.d.ts +12 -2
  292. package/dist/colourScheme.js +32 -6
  293. package/dist/control.d.ts +30 -8
  294. package/dist/control.js +74 -7
  295. package/dist/copyScript.d.ts +7 -8
  296. package/dist/copyScript.js +8 -9
  297. package/dist/cx.d.ts +22 -3
  298. package/dist/cx.js +22 -3
  299. package/dist/dateLocale.d.ts +17 -0
  300. package/dist/dateLocale.js +30 -0
  301. package/dist/density.d.ts +15 -1
  302. package/dist/density.js +27 -8
  303. package/dist/emptySlot.d.ts +1 -0
  304. package/dist/fieldAnnounce.d.ts +11 -0
  305. package/dist/fieldAnnounce.js +36 -0
  306. package/dist/fieldControl.d.ts +7 -2
  307. package/dist/fieldControl.js +6 -2
  308. package/dist/fieldWait.d.ts +3 -3
  309. package/dist/fieldWait.js +3 -4
  310. package/dist/flowLayout.d.ts +68 -0
  311. package/dist/flowLayout.js +105 -0
  312. package/dist/fromXState.d.ts +73 -0
  313. package/dist/fromXState.js +110 -0
  314. package/dist/icons.d.ts +1 -1
  315. package/dist/icons.js +15 -0
  316. package/dist/index.d.ts +37 -11
  317. package/dist/index.js +24 -2
  318. package/dist/isoDate.d.ts +8 -1
  319. package/dist/isoDate.js +20 -1
  320. package/dist/labelWords.d.ts +16 -7
  321. package/dist/labelWords.js +14 -12
  322. package/dist/listRowProps.d.ts +17 -15
  323. package/dist/modal.d.ts +5 -0
  324. package/dist/modal.js +21 -1
  325. package/dist/navFold.js +6 -3
  326. package/dist/optionCard.d.ts +18 -0
  327. package/dist/optionCard.js +16 -0
  328. package/dist/scrollBody.d.ts +16 -0
  329. package/dist/scrollBody.js +15 -0
  330. package/dist/scrollEdges.d.ts +7 -0
  331. package/dist/scrollEdges.js +39 -5
  332. package/dist/scrollStop.d.ts +6 -2
  333. package/dist/scrollStop.js +24 -8
  334. package/dist/shownDate.d.ts +28 -10
  335. package/dist/shownDate.js +41 -22
  336. package/dist/siteSearchBody.d.ts +34 -0
  337. package/dist/siteSearchBody.js +117 -0
  338. package/dist/size.d.ts +7 -1
  339. package/dist/sortableDrop.d.ts +44 -0
  340. package/dist/sortableDrop.js +78 -0
  341. package/dist/sortableSlide.d.ts +9 -0
  342. package/dist/sortableSlide.js +70 -0
  343. package/dist/sortableTitle.d.ts +10 -0
  344. package/dist/sortableTitle.js +48 -0
  345. package/dist/stateMachineDots.d.ts +45 -0
  346. package/dist/stateMachineDots.js +162 -0
  347. package/dist/stickyColumn.d.ts +2 -2
  348. package/dist/stickyColumn.js +2 -2
  349. package/dist/switcher.d.ts +10 -5
  350. package/dist/switcher.js +7 -5
  351. package/dist/tableColumns.d.ts +17 -0
  352. package/dist/tableColumns.js +30 -2
  353. package/dist/tableEmpty.js +5 -5
  354. package/dist/tableRow.d.ts +26 -2
  355. package/dist/tableRow.js +23 -1
  356. package/dist/tableSort.d.ts +10 -5
  357. package/dist/tableSort.js +15 -4
  358. package/dist/target.d.ts +12 -0
  359. package/dist/target.js +12 -0
  360. package/dist/textBox.js +1 -1
  361. package/dist/truncated.d.ts +31 -0
  362. package/dist/truncated.js +51 -0
  363. package/dist/typography.d.ts +19 -11
  364. package/dist/typography.js +11 -13
  365. package/dist/useFlowLayout.d.ts +27 -0
  366. package/dist/useFlowLayout.js +119 -0
  367. package/package.json +3 -2
@@ -0,0 +1,110 @@
1
+ const text = (value) => typeof value === "string" && value !== "" ? value : undefined;
2
+ const KINDS = ["initial", "normal", "human", "terminal", "failed"];
3
+ const isKind = (value) => KINDS.some((kind) => kind === value);
4
+ const listOf = (value) => {
5
+ if (value === undefined)
6
+ return [];
7
+ return isList(value) ? value : [value];
8
+ };
9
+ function isList(value) {
10
+ return Array.isArray(value);
11
+ }
12
+ /** Every way a node moves on, each with the event name it is drawn with. */
13
+ function movesOf(node) {
14
+ const after = Object.entries(node.after ?? {}).map(([ms, t]) => [`after ${ms}`, t]);
15
+ const invoked = listOf(node.invoke).flatMap((i) => [
16
+ ["done", i.onDone],
17
+ ["error", i.onError],
18
+ ]);
19
+ return [...Object.entries(node.on ?? {}), ["always", node.always], ...after, ...invoked];
20
+ }
21
+ /** A node's kind: its `meta.kind`, else what its `type` and the machine's `initial` say. */
22
+ function kindOf(id, node, initial) {
23
+ const meta = node.meta?.["kind"];
24
+ if (isKind(meta))
25
+ return meta;
26
+ if (node.type === "final")
27
+ return "terminal";
28
+ const start = typeof initial === "object" ? initial.target : initial;
29
+ return id === start ? "initial" : "normal";
30
+ }
31
+ /**
32
+ * The top-level state a target names: `#machine.review`, `review.waiting` and `#rev` (the `id` of
33
+ * `review` or of a state inside it) are all `review`, and `.waiting` (a child of the state it
34
+ * leaves) is that state. Only the machine's top level is drawn, so a nested target lands on its
35
+ * parent.
36
+ */
37
+ function targetState(target, from, ids) {
38
+ if (target.startsWith("."))
39
+ return from;
40
+ if (!target.startsWith("#"))
41
+ return target.split(".")[0] ?? target;
42
+ const [id = "", next] = target.slice(1).split(".");
43
+ if (id === ids.machine)
44
+ return next ?? "";
45
+ return ids.nodes.get(id) ?? id;
46
+ }
47
+ /** Each node `id` in `node` and below it, mapped to `top`, the top-level state it is in. */
48
+ function nodeIds(top, node, into) {
49
+ if (node.id !== undefined)
50
+ into.set(node.id, top);
51
+ for (const child of Object.values(node.states ?? {}))
52
+ nodeIds(top, child, into);
53
+ }
54
+ function targets(config) {
55
+ if (config === undefined)
56
+ return { to: [], meta: undefined };
57
+ if (typeof config === "string")
58
+ return { to: [config], meta: undefined };
59
+ const target = config.target ?? [];
60
+ const to = typeof target === "string" ? [target] : target.filter((t) => t !== undefined);
61
+ return { to, meta: config.meta };
62
+ }
63
+ /**
64
+ * Turns an xstate v5 machine (the machine, or its config) into a `StateMachine` definition: one
65
+ * state per top-level state node, one transition per target in each node's `on`.
66
+ *
67
+ * - A state's `label` is its `meta.label`, else its key; its `owner` is `meta.owner`; its `kind`
68
+ * is `meta.kind` when that is one of the five, else `terminal` for a `type: "final"` node,
69
+ * `initial` for the machine's `initial`, and `normal` for the rest.
70
+ * - Each `on` event, `always`, each `after` delay and each `invoke`'s `onDone` and `onError` is a
71
+ * transition. Its `event` is its `meta.label`, else the event's name (`always`, `after 500`,
72
+ * `done`, `error`). A transition with no target
73
+ * (it stays where it is), one that stays inside its own state, or one whose target is not a
74
+ * top-level state is left out.
75
+ * - `state` adjusts each state, for a machine whose meta says it another way: return the state to
76
+ * draw, given its key, its config and the state the rules above made of it.
77
+ *
78
+ * Only the top level is read: a nested state is drawn as its parent.
79
+ */
80
+ export function fromXState(machine, options = {}) {
81
+ const config = "config" in machine ? machine.config : machine;
82
+ const nodes = Object.entries(config.states ?? {});
83
+ const keys = new Set(nodes.map(([id]) => id));
84
+ const found = new Map();
85
+ for (const [id, node] of nodes)
86
+ nodeIds(id, node, found);
87
+ // xstate names a machine with no `id` "(machine)".
88
+ const ids = { machine: config.id ?? "(machine)", nodes: found };
89
+ const states = nodes.map(([id, node]) => {
90
+ const meta = node.meta ?? {};
91
+ const kind = kindOf(id, node, config.initial);
92
+ const owner = text(meta["owner"]);
93
+ const state = {
94
+ id,
95
+ label: text(meta["label"]) ?? id,
96
+ kind,
97
+ ...(owner === undefined ? {} : { owner }),
98
+ };
99
+ return options.state ? options.state({ id, node, state }) : state;
100
+ });
101
+ const transitions = nodes.flatMap(([from, node]) => movesOf(node).flatMap(([event, on]) => listOf(on).flatMap((one) => {
102
+ const { to, meta } = targets(one);
103
+ const name = text(meta?.["label"]) ?? event;
104
+ return to
105
+ .map((t) => targetState(t, from, ids))
106
+ .filter((t) => t !== from && keys.has(t))
107
+ .map((t) => ({ from, to: t, event: name }));
108
+ })));
109
+ return { states, transitions };
110
+ }
package/dist/icons.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { ReactElement } from "react";
6
6
  * icon's own shapes carry no `fill`, `stroke` or `stroke-width` (`Icon.test.tsx` holds them to
7
7
  * that). A name is the idea or action the icon stands for, not a product.
8
8
  */
9
- declare const NAMES: readonly ["diff", "baseline", "review", "ci", "self-host", "privacy", "capture", "branch", "theme", "speed", "search", "chevron-right", "chevron-down", "close", "external-link", "settings", "bell", "check", "plus", "more", "grid", "window", "type", "card", "pointer", "field", "table", "compass", "page", "briefcase"];
9
+ declare const NAMES: readonly ["diff", "baseline", "review", "ci", "self-host", "privacy", "capture", "branch", "theme", "speed", "search", "chevron-right", "chevron-down", "close", "external-link", "settings", "bell", "check", "alert", "plus", "minus", "more", "grid", "window", "type", "card", "pointer", "field", "table", "compass", "page", "briefcase", "cart", "pause", "play"];
10
10
  /** The names of the icon set: feature ideas, then UI glyphs, then the ideas the docs sections stand for. */
11
11
  export type IconName = (typeof NAMES)[number];
12
12
  /** The icon `name` as an `<svg>`: the set's one grid, stroke, caps and joins, drawn in `currentColor`. */
package/dist/icons.js CHANGED
@@ -25,7 +25,9 @@ const NAMES = [
25
25
  "settings",
26
26
  "bell",
27
27
  "check",
28
+ "alert",
28
29
  "plus",
30
+ "minus",
29
31
  "more",
30
32
  "grid",
31
33
  "window",
@@ -37,6 +39,9 @@ const NAMES = [
37
39
  "compass",
38
40
  "page",
39
41
  "briefcase",
42
+ "cart",
43
+ "pause",
44
+ "play",
40
45
  ];
41
46
  const GLYPHS = {
42
47
  /** Before and after, side by side: a minus on the left, a plus on the right. */
@@ -75,8 +80,12 @@ const GLYPHS = {
75
80
  bell: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M6 9.5a6 6 0 0 1 12 0c0 5 2 6.5 2 6.5H4s2-1.5 2-6.5Z" }), _jsx("path", { d: "M10 19.5a2.2 2.2 0 0 0 4 0" })] })),
76
81
  /** Done or selected: a single tick. */
77
82
  check: _jsx("path", { d: "m4.5 12.5 5 5L19.5 7" }),
83
+ /** Something is wrong: an exclamation mark in a ring. */
84
+ alert: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M12 7.5v5.5M12 16.5v.01" })] })),
78
85
  /** Add or create: two strokes crossing, upright. */
79
86
  plus: _jsx("path", { d: "M12 5v14M5 12h14" }),
87
+ /** Less: one bar, the plus without its upright (a stepper's decrement). */
88
+ minus: _jsx("path", { d: "M5 12h14" }),
80
89
  /** More actions behind a menu: three dots in a row. */
81
90
  more: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "5.5", cy: "12", r: "1" }), _jsx("circle", { cx: "12", cy: "12", r: "1" }), _jsx("circle", { cx: "18.5", cy: "12", r: "1" })] })),
82
91
  /** Things laid out in a grid: four tiles. */
@@ -99,6 +108,12 @@ const GLYPHS = {
99
108
  page: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M7.5 3H14l5 5v10.5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 5 18.5v-13A2.5 2.5 0 0 1 7.5 3Z" }), _jsx("path", { d: "M14 3v3.5A1.5 1.5 0 0 0 15.5 8H19M9 13h6M9 16.5h6" })] })),
100
109
  /** Work for hire: a briefcase with its handle and clasp. */
101
110
  briefcase: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "7.5", width: "18", height: "12", rx: "2.5" }), _jsx("path", { d: "M8.5 7.5V6a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v1.5M3 13h18M12 12v2.5" })] })),
111
+ /** A shopping bag: what a visitor has picked to buy (the cart). */
112
+ cart: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M5.5 8h13l-1 11.5a1.5 1.5 0 0 1-1.5 1.5H8a1.5 1.5 0 0 1-1.5-1.5Z" }), _jsx("path", { d: "M9 10.5V7a3 3 0 0 1 6 0v3.5" })] })),
113
+ /** Stop a moving thing for now: two upright bars. */
114
+ pause: _jsx("path", { d: "M9 6v12M15 6v12" }),
115
+ /** Start a moving thing: a triangle pointing forward. */
116
+ play: _jsx("path", { d: "M8 5.5v13l10-6.5Z" }),
102
117
  };
103
118
  /** The icon `name` as an `<svg>`: the set's one grid, stroke, caps and joins, drawn in `currentColor`. */
104
119
  export function iconGlyph(name) {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,16 @@
1
- export { Card } from "./Card.js";
1
+ export { Card, type CardHue } from "./Card.js";
2
+ export { CardGridRow } from "./CardGrid.js";
2
3
  export { Pill, type PillTone } from "./Pill.js";
3
4
  export { Badge } from "./Badge.js";
4
5
  export { StatTile, type StatTileTone } from "./StatTile.js";
5
6
  export { ProgressBar, type BarSize, type BarTone } from "./ProgressBar.js";
6
7
  export { SplitBar } from "./SplitBar.js";
7
- export { Legend, StackedBar, type LegendItem, type StackedSegment, type VizTone, } from "./StackedBar.js";
8
+ export { Legend, StackedBar, type LegendItem, type SegmentTone, type StackedSegment, type VizTone, type CategoryTone, } from "./StackedBar.js";
8
9
  export { TrendChart, type TrendSeries } from "./TrendChart.js";
10
+ export { FlowDiagram, type FlowEdge, type FlowNode } from "./FlowDiagram.js";
11
+ export type { FlowBox, FlowDirection, FlowEdgePath, FlowLayout, FlowNodeBox, FlowPoint, } from "./flowLayout.js";
12
+ export { StateMachine, type StateMachineDefinition, type StateMachineItem, type StateMachineKind, type StateMachineState, type StateMachineTransition, } from "./StateMachine.js";
13
+ export { fromXState, type XStateMachineLike, type XStateNodeConfig, type XStateStateInput, type XStateTransitionConfig, } from "./fromXState.js";
9
14
  export { Markdown } from "./Markdown.js";
10
15
  export { AppShell, AppShellBrand, type AppShellDensity, appShellRootClassFor } from "./AppShell.js";
11
16
  export { SiteFooter, type SiteFooterLink } from "./SiteFooter.js";
@@ -13,13 +18,15 @@ export { Container } from "./Container.js";
13
18
  export { PageHeader } from "./PageHeader.js";
14
19
  export { Hero } from "./Hero.js";
15
20
  export { CardGrid, CenteredLayout, DetailLayout, FormLayout, FullBleedLayout, ListLayout, ProseLayout, } from "./PageLayouts.js";
21
+ export { ArticleLayout } from "./ArticleLayout.js";
16
22
  export { SidebarLayout } from "./SidebarLayout.js";
17
23
  export { DocsLayout, type DocsHeading, type DocsNavGroup, type DocsNeighbour, } from "./DocsLayout.js";
18
- export { SideColumn, type SideColumnWidth } from "./SideColumn.js";
24
+ export { SideColumn, type SideColumnSide, type SideColumnWidth } from "./SideColumn.js";
19
25
  export { StickyBar } from "./StickyBar.js";
20
26
  export { ErrorPage, Forbidden, Maintenance, NotFound, Offline } from "./StatusPages.js";
21
27
  export { Cluster, ClusterGrow, type ClusterAlign, type ClusterGrowMinWidth, type ClusterGap, type ClusterJustify, } from "./Cluster.js";
22
28
  export { Section, type SectionSize } from "./Section.js";
29
+ export type { HeadingLevel } from "./headingLevel.js";
23
30
  export { Stack, type StackAlign, type StackGap, type StackRowFrom, type StackWidth, } from "./Stack.js";
24
31
  export { Show, type Breakpoint } from "./Show.js";
25
32
  export { Button, type ButtonSize, type ButtonTone, type ButtonVariant } from "./Button.js";
@@ -28,18 +35,20 @@ export { type LinkAdapter, type LinkAdapterProps, LinkProvider } from "./link.js
28
35
  export { Avatar, type AvatarShape, type AvatarSize } from "./Avatar.js";
29
36
  export { AvatarStack, type AvatarStackPerson } from "./AvatarStack.js";
30
37
  export { Breadcrumbs, type Crumb } from "./Breadcrumbs.js";
38
+ export { Stepper } from "./Stepper.js";
31
39
  export { Pagination } from "./Pagination.js";
32
40
  export { BulletItem, BulletList } from "./BulletList.js";
33
41
  export { Callout } from "./Callout.js";
34
42
  export { ToastRegion, type Toast } from "./ToastRegion.js";
35
43
  export { ListRow } from "./ListRow.js";
36
44
  export { SortableItem, SortableList, type SortableMove, SortableSection } from "./SortableList.js";
37
- export { OutlineRegion, RegionFrame, type RegionRect } from "./OutlineRegion.js";
45
+ export { OutlineRegion, type OutlineRegionTone, RegionFrame, type RegionRect, } from "./OutlineRegion.js";
38
46
  export { type CellTone, Table, TableBody, TableCell, TableFoot, TableGroupRow, TableHead, TableExpandCell, TableHeaderCell, TableRow, type TableSort, } from "./Table.js";
39
- export type { RowTone } from "./tableRow.js";
47
+ export type { CellAlign, RowTone } from "./tableRow.js";
40
48
  export { InlineEdit } from "./InlineEdit.js";
41
49
  export { TableEditCell } from "./TableEditCell.js";
42
50
  export { EmptyState } from "./EmptyState.js";
51
+ export type { EmptySize } from "./emptySlot.js";
43
52
  export { Step, Steps, type StepsSize } from "./Steps.js";
44
53
  export { Timeline, TimelineItem } from "./Timeline.js";
45
54
  export { ChatComposer } from "./ChatComposer.js";
@@ -63,10 +72,12 @@ export { Icon } from "./Icon.js";
63
72
  export type { IconName } from "./icons.js";
64
73
  export { IconButton, type IconButtonTone, type IconButtonVariant } from "./IconButton.js";
65
74
  export { Menu, type MenuAction } from "./Menu.js";
75
+ export { Popover } from "./Popover.js";
66
76
  export { ColourSchemeToggle } from "./ColourSchemeToggle.js";
67
77
  export { applyColourScheme, schemeClass, type ColourSchemeClasses, colourSchemeScript, readColourScheme, storeColourScheme, type ColourScheme, } from "./colourScheme.js";
68
- export { Tabs, type Tab } from "./Tabs.js";
78
+ export { Tabs, type Tab, type TabButton } from "./Tabs.js";
69
79
  export { SegmentedControl, type Segment } from "./SegmentedControl.js";
80
+ export type { SwitchButton, SwitchLink } from "./switcher.js";
70
81
  export { Fieldset } from "./Fieldset.js";
71
82
  export { Checkbox } from "./Checkbox.js";
72
83
  export { Switch } from "./Switch.js";
@@ -78,22 +89,37 @@ export { CopyLine } from "./CopyLine.js";
78
89
  export { Field } from "./Field.js";
79
90
  export { FormGrid, FormRow, FormRowField, type FormRowSpan } from "./FormRow.js";
80
91
  export { FieldDialog } from "./FieldDialog.js";
92
+ export { ConfirmDialog } from "./ConfirmDialog.js";
81
93
  export { Input } from "./Input.js";
82
94
  export type { ControlSize, ControlWidth } from "./control.js";
83
95
  export type { ResponsiveSize, Size } from "./size.js";
84
96
  export type { Tone } from "./tone.js";
85
97
  export { MetaList, type MetaListSeparator } from "./MetaList.js";
86
98
  export { Kbd } from "./Kbd.js";
87
- export { KeyValue, KeyValueList } from "./KeyValueList.js";
88
- export { Select } from "./Select.js";
99
+ export { KeyValue, KeyValueList, type KeyValueAlign } from "./KeyValueList.js";
100
+ export { Select, type SelectItem } from "./Select.js";
101
+ export { Combobox } from "./Combobox.js";
102
+ export { NumberField } from "./NumberField.js";
103
+ export { Slider } from "./Slider.js";
89
104
  export { Textarea } from "./Textarea.js";
90
105
  export { Video } from "./Video.js";
106
+ export { Audio } from "./Audio.js";
107
+ export { EmbedFrame } from "./EmbedFrame.js";
108
+ export { ColourSwatch } from "./ColourSwatch.js";
91
109
  export { Image, type ImageAspect, type ImageWidth } from "./Image.js";
92
110
  export { MediaTile } from "./MediaTile.js";
111
+ export { Price } from "./Price.js";
112
+ export { ProductTile, type ProductTileStatus } from "./ProductTile.js";
113
+ export { CartButton } from "./CartButton.js";
114
+ export { PromoBanner } from "./PromoBanner.js";
115
+ export { CallToAction } from "./CallToAction.js";
93
116
  export { ScrollStrip } from "./ScrollStrip.js";
94
- export { TextLink, type TextLinkSize } from "./TextLink.js";
117
+ export { TextLink, type TextLinkSize, type TextLinkTone } from "./TextLink.js";
118
+ export { TableOfContents, type TableOfContentsItem } from "./TableOfContents.js";
95
119
  export { Caption, Display, Lead, Overline, PageHeading, Prose, SectionHeading, SubsectionHeading, type SubsectionHeadingSize, Text, type TextAlign, type TextLines, type TextMinWidth, type TextTone, } from "./typography.js";
120
+ export { Mark } from "./Mark.js";
96
121
  export { DateField } from "./DateField.js";
97
122
  export { DateRangePicker, type DateRange, type DateRangePreset } from "./DateRangePicker.js";
98
- export { fromISODate, toISODate } from "./isoDate.js";
99
- export type { CalendarDate } from "@internationalized/date";
123
+ export { DateTimeField } from "./DateTimeField.js";
124
+ export { fromISODate, fromISODateTime, toISODate, toISODateTime } from "./isoDate.js";
125
+ export type { CalendarDate, CalendarDateTime } from "@internationalized/date";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { Card } from "./Card.js";
2
+ export { CardGridRow } from "./CardGrid.js";
2
3
  export { Pill } from "./Pill.js";
3
4
  export { Badge } from "./Badge.js";
4
5
  export { StatTile } from "./StatTile.js";
@@ -6,6 +7,9 @@ export { ProgressBar } from "./ProgressBar.js";
6
7
  export { SplitBar } from "./SplitBar.js";
7
8
  export { Legend, StackedBar, } from "./StackedBar.js";
8
9
  export { TrendChart } from "./TrendChart.js";
10
+ export { FlowDiagram } from "./FlowDiagram.js";
11
+ export { StateMachine, } from "./StateMachine.js";
12
+ export { fromXState, } from "./fromXState.js";
9
13
  export { Markdown } from "./Markdown.js";
10
14
  export { AppShell, AppShellBrand, appShellRootClassFor } from "./AppShell.js";
11
15
  export { SiteFooter } from "./SiteFooter.js";
@@ -13,6 +17,7 @@ export { Container } from "./Container.js";
13
17
  export { PageHeader } from "./PageHeader.js";
14
18
  export { Hero } from "./Hero.js";
15
19
  export { CardGrid, CenteredLayout, DetailLayout, FormLayout, FullBleedLayout, ListLayout, ProseLayout, } from "./PageLayouts.js";
20
+ export { ArticleLayout } from "./ArticleLayout.js";
16
21
  export { SidebarLayout } from "./SidebarLayout.js";
17
22
  export { DocsLayout, } from "./DocsLayout.js";
18
23
  export { SideColumn } from "./SideColumn.js";
@@ -28,13 +33,14 @@ export { LinkProvider } from "./link.js";
28
33
  export { Avatar } from "./Avatar.js";
29
34
  export { AvatarStack } from "./AvatarStack.js";
30
35
  export { Breadcrumbs } from "./Breadcrumbs.js";
36
+ export { Stepper } from "./Stepper.js";
31
37
  export { Pagination } from "./Pagination.js";
32
38
  export { BulletItem, BulletList } from "./BulletList.js";
33
39
  export { Callout } from "./Callout.js";
34
40
  export { ToastRegion } from "./ToastRegion.js";
35
41
  export { ListRow } from "./ListRow.js";
36
42
  export { SortableItem, SortableList, SortableSection } from "./SortableList.js";
37
- export { OutlineRegion, RegionFrame } from "./OutlineRegion.js";
43
+ export { OutlineRegion, RegionFrame, } from "./OutlineRegion.js";
38
44
  export { Table, TableBody, TableCell, TableFoot, TableGroupRow, TableHead, TableExpandCell, TableHeaderCell, TableRow, } from "./Table.js";
39
45
  export { InlineEdit } from "./InlineEdit.js";
40
46
  export { TableEditCell } from "./TableEditCell.js";
@@ -60,6 +66,7 @@ export { Lightbox } from "./Lightbox.js";
60
66
  export { Icon } from "./Icon.js";
61
67
  export { IconButton } from "./IconButton.js";
62
68
  export { Menu } from "./Menu.js";
69
+ export { Popover } from "./Popover.js";
63
70
  export { ColourSchemeToggle } from "./ColourSchemeToggle.js";
64
71
  export { applyColourScheme, schemeClass, colourSchemeScript, readColourScheme, storeColourScheme, } from "./colourScheme.js";
65
72
  export { Tabs } from "./Tabs.js";
@@ -75,18 +82,33 @@ export { CopyLine } from "./CopyLine.js";
75
82
  export { Field } from "./Field.js";
76
83
  export { FormGrid, FormRow, FormRowField } from "./FormRow.js";
77
84
  export { FieldDialog } from "./FieldDialog.js";
85
+ export { ConfirmDialog } from "./ConfirmDialog.js";
78
86
  export { Input } from "./Input.js";
79
87
  export { MetaList } from "./MetaList.js";
80
88
  export { Kbd } from "./Kbd.js";
81
89
  export { KeyValue, KeyValueList } from "./KeyValueList.js";
82
90
  export { Select } from "./Select.js";
91
+ export { Combobox } from "./Combobox.js";
92
+ export { NumberField } from "./NumberField.js";
93
+ export { Slider } from "./Slider.js";
83
94
  export { Textarea } from "./Textarea.js";
84
95
  export { Video } from "./Video.js";
96
+ export { Audio } from "./Audio.js";
97
+ export { EmbedFrame } from "./EmbedFrame.js";
98
+ export { ColourSwatch } from "./ColourSwatch.js";
85
99
  export { Image } from "./Image.js";
86
100
  export { MediaTile } from "./MediaTile.js";
101
+ export { Price } from "./Price.js";
102
+ export { ProductTile } from "./ProductTile.js";
103
+ export { CartButton } from "./CartButton.js";
104
+ export { PromoBanner } from "./PromoBanner.js";
105
+ export { CallToAction } from "./CallToAction.js";
87
106
  export { ScrollStrip } from "./ScrollStrip.js";
88
107
  export { TextLink } from "./TextLink.js";
108
+ export { TableOfContents } from "./TableOfContents.js";
89
109
  export { Caption, Display, Lead, Overline, PageHeading, Prose, SectionHeading, SubsectionHeading, Text, } from "./typography.js";
110
+ export { Mark } from "./Mark.js";
90
111
  export { DateField } from "./DateField.js";
91
112
  export { DateRangePicker } from "./DateRangePicker.js";
92
- export { fromISODate, toISODate } from "./isoDate.js";
113
+ export { DateTimeField } from "./DateTimeField.js";
114
+ export { fromISODate, fromISODateTime, toISODate, toISODateTime } from "./isoDate.js";
package/dist/isoDate.d.ts CHANGED
@@ -1,5 +1,12 @@
1
- import { CalendarDate } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime } from "@internationalized/date";
2
2
  /** `"1990-05-17"` for `CalendarDate(1990, 5, 17)`; `""` for no date, so it drops into a form field. */
3
3
  export declare function toISODate(date: CalendarDate | null | undefined): string;
4
4
  /** The `CalendarDate` of a `"YYYY-MM-DD"` string; `null` for an empty, malformed or impossible one. */
5
5
  export declare function fromISODate(iso: string | null | undefined): CalendarDate | null;
6
+ /** `"2026-11-29T14:30"` for `CalendarDateTime(2026, 11, 29, 14, 30)`, seconds dropped; `""` for none. */
7
+ export declare function toISODateTime(value: CalendarDateTime | null | undefined): string;
8
+ /**
9
+ * The `CalendarDateTime` of a `"YYYY-MM-DDTHH:mm"` string; `null` for an empty, malformed or
10
+ * impossible one (a day the month does not have, an hour past 23).
11
+ */
12
+ export declare function fromISODateTime(iso: string | null | undefined): CalendarDateTime | null;
package/dist/isoDate.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CalendarDate } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime } from "@internationalized/date";
2
2
  const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
3
3
  /** `"1990-05-17"` for `CalendarDate(1990, 5, 17)`; `""` for no date, so it drops into a form field. */
4
4
  export function toISODate(date) {
@@ -14,3 +14,22 @@ export function fromISODate(iso) {
14
14
  // CalendarDate constrains 1990-02-31 to 1990-02-28; a string that does not survive is impossible.
15
15
  return date.toString() === iso ? date : null;
16
16
  }
17
+ const ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
18
+ /** `"2026-11-29T14:30"` for `CalendarDateTime(2026, 11, 29, 14, 30)`, seconds dropped; `""` for none. */
19
+ export function toISODateTime(value) {
20
+ return value ? value.toString().slice(0, 16) : "";
21
+ }
22
+ /**
23
+ * The `CalendarDateTime` of a `"YYYY-MM-DDTHH:mm"` string; `null` for an empty, malformed or
24
+ * impossible one (a day the month does not have, an hour past 23).
25
+ */
26
+ export function fromISODateTime(iso) {
27
+ const match = ISO_DATE_TIME.exec(iso ?? "");
28
+ if (!match)
29
+ return null;
30
+ const [year, month, day, hour, minute] = [1, 2, 3, 4, 5].map((at) => Number(match[at]));
31
+ if (Number(hour) > 23 || Number(minute) > 59)
32
+ return null;
33
+ const value = new CalendarDateTime(Number(year), Number(month), Number(day), Number(hour), Number(minute));
34
+ return toISODateTime(value) === iso ? value : null;
35
+ }
@@ -1,20 +1,29 @@
1
1
  import { type ReactNode } from "react";
2
+ /** The ids of a choice's two note lines. */
3
+ export type NoteIds = {
4
+ hint: string;
5
+ error: string;
6
+ };
2
7
  /**
3
- * The label, with its note under it when there is one: the error (`role="alert"`, red) when set,
4
- * else the muted hint.
8
+ * The label, with its notes under it when there are any: the muted hint, and under it the error
9
+ * (an alert icon and red text, announced politely) when set. The hint stays while the error shows.
5
10
  */
6
- export declare function Words({ label, hint, error, id, }: {
11
+ export declare function Words({ label, hint, error, ids, }: {
7
12
  label: ReactNode;
8
13
  hint: ReactNode;
9
14
  error: ReactNode;
10
- id: string | undefined;
15
+ ids: NoteIds | undefined;
11
16
  }): ReactNode;
12
17
  /**
13
- * The note's id (none without a hint or an error), the control's whole `aria-describedby`, and
14
- * whether it is invalid (an error is set). The error replaces the hint, as in a `Field`.
18
+ * The notes' ids (none without a hint or an error), the control's whole `aria-describedby` (the
19
+ * caller's, then the hint, then the error), and whether it is invalid (an error is set), as in a
20
+ * `Field`.
15
21
  */
16
22
  export declare function useNote(hint: ReactNode, error: ReactNode, describedBy: string | undefined): {
17
- noteId: string | undefined;
23
+ ids: {
24
+ hint: string;
25
+ error: string;
26
+ } | undefined;
18
27
  describedIds: string;
19
28
  invalid: boolean;
20
29
  };
@@ -1,28 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
+ import { ErrorLine, Hint, noteDescribedBy } from "./Field.js";
3
4
  /** Whether a note is set: `null`, `undefined`, `false` and `""` draw nothing. */
4
5
  const given = (note) => note != null && note !== false && note !== "";
5
6
  /**
6
- * The label, with its note under it when there is one: the error (`role="alert"`, red) when set,
7
- * else the muted hint.
7
+ * The label, with its notes under it when there are any: the muted hint, and under it the error
8
+ * (an alert icon and red text, announced politely) when set. The hint stays while the error shows.
8
9
  */
9
- export function Words({ label, hint, error, id, }) {
10
- if (id === undefined)
10
+ export function Words({ label, hint, error, ids, }) {
11
+ if (ids === undefined)
11
12
  return label;
12
- const failed = given(error);
13
- return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: label }), _jsx("span", { id: id, role: failed ? "alert" : undefined, className: failed ? "text-xs text-red-700" : "text-xs text-slate-500", children: failed ? error : hint })] }));
13
+ return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: label }), given(hint) ? _jsx(Hint, { id: ids.hint, children: hint }) : null, given(error) ? _jsx(ErrorLine, { id: ids.error, error: error }) : null] }));
14
14
  }
15
15
  /**
16
- * The note's id (none without a hint or an error), the control's whole `aria-describedby`, and
17
- * whether it is invalid (an error is set). The error replaces the hint, as in a `Field`.
16
+ * The notes' ids (none without a hint or an error), the control's whole `aria-describedby` (the
17
+ * caller's, then the hint, then the error), and whether it is invalid (an error is set), as in a
18
+ * `Field`.
18
19
  */
19
20
  export function useNote(hint, error, describedBy) {
20
- const generatedId = useId();
21
+ const own = { hint: useId(), error: useId() };
21
22
  const invalid = given(error);
22
- const noteId = invalid || given(hint) ? generatedId : undefined;
23
+ const ids = invalid || given(hint) ? own : undefined;
24
+ const notes = noteDescribedBy(given(hint), invalid, own);
23
25
  return {
24
- noteId,
25
- describedIds: [describedBy, noteId].filter(Boolean).join(" "),
26
+ ids,
27
+ describedIds: [describedBy, notes].filter(Boolean).join(" "),
26
28
  invalid,
27
29
  };
28
30
  }
@@ -1,7 +1,8 @@
1
1
  import type { ComponentPropsWithoutRef, MouseEventHandler, PointerEventHandler, ReactNode } from "react";
2
- import type { Unstyled } from "./props.js";
2
+ import type { Passthrough, Unstyled } from "./props.js";
3
3
  import type { Size } from "./size.js";
4
4
  import type { LoadingProps } from "./skeleton.js";
5
+ import type { TextTone } from "./typography.js";
5
6
  type Shared = LoadingProps & {
6
7
  /**
7
8
  * `sm` is dense padding, `lg` one step roomier than `md`. A `Button`, `IconButton` or `Pill` in a
@@ -9,8 +10,6 @@ type Shared = LoadingProps & {
9
10
  * @default md
10
11
  */
11
12
  size?: Size | undefined;
12
- /** A hairline above the row: set it on every row after the first. */
13
- divided?: boolean | undefined;
14
13
  /** Content before the label: an Avatar, a thumbnail, an icon. */
15
14
  leading?: ReactNode | undefined;
16
15
  /** A second, muted line under the label (a date, a note), like `TableCell`'s `secondary`. */
@@ -31,8 +30,7 @@ type Shared = LoadingProps & {
31
30
  /**
32
31
  * Marks the row a list follows with the pointer and the keyboard alike (set it from
33
32
  * `onPointerEnter` and `onFocus`): a fill one step deeper than hover, so it shows on a white card
34
- * and on a tinted panel alike. On a static row it shows the fill without `revealOnHover`, and
35
- * shows `actions` that `revealOnHover` hides. `selected` wins.
33
+ * and on a tinted panel alike. It is the only fill a static row takes. `selected` wins.
36
34
  *
37
35
  * Clear it from `onPointerLeave`.
38
36
  */
@@ -44,11 +42,15 @@ type Shared = LoadingProps & {
44
42
  * For a row that shows a screenshot.
45
43
  */
46
44
  leadingWidth?: "thumbnail" | undefined;
45
+ /**
46
+ * The row's status, as a stripe on its leading edge in this tone, as a `Table` row's `stripe`. The
47
+ * colour says it to the eye only, so the row's words say it too (a `Pill`, a status in `trailing`).
48
+ */
49
+ stripe?: Exclude<TextTone, "neutral"> | undefined;
47
50
  children: ReactNode;
48
51
  };
49
52
  type NotStatic = {
50
53
  actions?: undefined;
51
- revealOnHover?: undefined;
52
54
  panel?: undefined;
53
55
  };
54
56
  export type ListRowButtonProps = Shared & NotStatic & {
@@ -81,21 +83,19 @@ export type ListRowLinkProps = Shared & NotStatic & {
81
83
  href: string;
82
84
  };
83
85
  /**
84
- * A row with no `href` and no `onClick`: a `<div>` with no click target and no hover fill (unless
85
- * `revealOnHover`), for one that holds its own controls, taking `actions` as well.
86
+ * A row with no `href` and no `onClick`: a `<div>` with no click target and no hover fill, for one
87
+ * that holds its own controls, taking `actions` as well.
86
88
  */
87
89
  export type ListRowStaticProps = Shared & {
88
- /** Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`. */
89
- actions?: ReactNode | undefined;
90
90
  /**
91
- * Hides `actions` until the row is hovered or something in it has focus, so a long list is not a
92
- * wall of buttons. A touch screen has no hover, so they are always shown there.
91
+ * Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`, a `Menu`. Always
92
+ * shown: an action that shows only on hover is one a touch or keyboard user cannot find.
93
93
  */
94
- revealOnHover?: boolean | undefined;
94
+ actions?: ReactNode | undefined;
95
95
  /**
96
96
  * Content under the row, lined up with the label rather than the row's edge (past `leading`): the
97
97
  * panel of a row that opens in place, such as a conversation under its chat. It sits inside the
98
- * row, so `divided`, the fill and `revealOnHover` cover it too. Only a row that is neither a
98
+ * row, so the fill and a `Stack divided` line cover it too. Only a row that is neither a
99
99
  * button nor a link takes it.
100
100
  */
101
101
  panel?: ReactNode | undefined;
@@ -103,6 +103,8 @@ export type ListRowStaticProps = Shared & {
103
103
  onClick?: undefined;
104
104
  disabledReason?: undefined;
105
105
  href?: undefined;
106
- } & Unstyled<Omit<ComponentPropsWithoutRef<"div">, "children" | "onClick">>;
106
+ } & Passthrough &
107
+ /** What sets and clears `highlighted`; focus events bubble up from the row's own controls. */
108
+ Pick<ComponentPropsWithoutRef<"div">, "onPointerEnter" | "onPointerLeave" | "onFocus" | "onBlur">;
107
109
  export type ListRowProps = ListRowButtonProps | ListRowLinkProps | ListRowStaticProps;
108
110
  export {};
package/dist/modal.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import { type RefObject } from "react";
2
+ /**
3
+ * Whether a `Dialog`, `Drawer` or `Lightbox` is open. `ToastRegion` holds its toasts back while one
4
+ * is: the page behind a modal is inert, so a toast there could be neither read nor reached.
5
+ */
6
+ export declare function useModalOpen(): boolean;
2
7
  /**
3
8
  * Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
4
9
  * (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
package/dist/modal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useLayoutEffect, useRef } from "react";
1
+ import { useLayoutEffect, useRef, useSyncExternalStore } from "react";
2
2
  /** Resolves when the transitions running on the dialog (and its backdrop) have ended. */
3
3
  async function exitTransitions(dialog) {
4
4
  // A browser without the Web Animations API (or jsdom) has nothing to wait for.
@@ -7,6 +7,24 @@ async function exitTransitions(dialog) {
7
7
  const running = dialog.getAnimations({ subtree: true }).filter((a) => "transitionProperty" in a);
8
8
  await Promise.allSettled(running.map((a) => a.finished));
9
9
  }
10
+ /** How many of the library's modals are open, and who wants to hear when that changes. */
11
+ let openModals = 0;
12
+ const watchers = new Set();
13
+ const opened = (by) => {
14
+ openModals += by;
15
+ for (const watcher of watchers)
16
+ watcher();
17
+ };
18
+ /**
19
+ * Whether a `Dialog`, `Drawer` or `Lightbox` is open. `ToastRegion` holds its toasts back while one
20
+ * is: the page behind a modal is inert, so a toast there could be neither read nor reached.
21
+ */
22
+ export function useModalOpen() {
23
+ return useSyncExternalStore((watcher) => {
24
+ watchers.add(watcher);
25
+ return () => watchers.delete(watcher);
26
+ }, () => openModals > 0, () => false);
27
+ }
10
28
  /**
11
29
  * Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
12
30
  * (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
@@ -22,9 +40,11 @@ export function useModal(dialog, onClose) {
22
40
  const el = dialog.current;
23
41
  mounted.current = true;
24
42
  el?.showModal();
43
+ opened(1);
25
44
  return () => {
26
45
  mounted.current = false;
27
46
  el?.close();
47
+ opened(-1);
28
48
  };
29
49
  }, [dialog]);
30
50
  return () => {