@slashsuite/ui-react 0.12.0 → 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 (388) hide show
  1. package/MIGRATING.md +386 -8
  2. package/README.md +101 -44
  3. package/agent-docs/components/app-shell.md +139 -0
  4. package/agent-docs/components/article-layout.md +140 -0
  5. package/agent-docs/components/audio.md +42 -0
  6. package/agent-docs/components/avatar-stack.md +64 -0
  7. package/agent-docs/components/avatar.md +76 -0
  8. package/agent-docs/components/badge.md +62 -0
  9. package/agent-docs/components/body-text.md +169 -0
  10. package/agent-docs/components/bottom-sheet.md +105 -0
  11. package/agent-docs/components/breadcrumbs.md +66 -0
  12. package/agent-docs/components/bullet-list.md +54 -0
  13. package/agent-docs/components/button.md +135 -0
  14. package/agent-docs/components/call-to-action.md +59 -0
  15. package/agent-docs/components/callout.md +87 -0
  16. package/agent-docs/components/card-grid.md +116 -0
  17. package/agent-docs/components/card.md +128 -0
  18. package/agent-docs/components/cart-button.md +63 -0
  19. package/agent-docs/components/centered-layout.md +90 -0
  20. package/agent-docs/components/chat-composer.md +49 -0
  21. package/agent-docs/components/chat-message.md +61 -0
  22. package/agent-docs/components/chat-thread.md +49 -0
  23. package/agent-docs/components/checkbox.md +81 -0
  24. package/agent-docs/components/cluster.md +108 -0
  25. package/agent-docs/components/code-example.md +48 -0
  26. package/agent-docs/components/code.md +72 -0
  27. package/agent-docs/components/colour-scheme-toggle.md +98 -0
  28. package/agent-docs/components/colour-swatch.md +41 -0
  29. package/agent-docs/components/combobox.md +88 -0
  30. package/agent-docs/components/confirm-dialog.md +98 -0
  31. package/agent-docs/components/container.md +51 -0
  32. package/agent-docs/components/copy-button.md +63 -0
  33. package/agent-docs/components/copy-line.md +55 -0
  34. package/agent-docs/components/date-field.md +106 -0
  35. package/agent-docs/components/date-range-picker.md +108 -0
  36. package/agent-docs/components/date-time-field.md +73 -0
  37. package/agent-docs/components/detail-layout.md +147 -0
  38. package/agent-docs/components/dialog.md +132 -0
  39. package/agent-docs/components/disclosure.md +70 -0
  40. package/agent-docs/components/divider.md +62 -0
  41. package/agent-docs/components/docs-layout.md +164 -0
  42. package/agent-docs/components/drawer.md +137 -0
  43. package/agent-docs/components/embed-frame.md +48 -0
  44. package/agent-docs/components/empty-state.md +70 -0
  45. package/agent-docs/components/field-dialog.md +98 -0
  46. package/agent-docs/components/field.md +71 -0
  47. package/agent-docs/components/fieldset.md +82 -0
  48. package/agent-docs/components/file-drop.md +52 -0
  49. package/agent-docs/components/flow-diagram.md +87 -0
  50. package/agent-docs/components/form-layout.md +144 -0
  51. package/agent-docs/components/form-row.md +93 -0
  52. package/agent-docs/components/full-bleed-layout.md +114 -0
  53. package/agent-docs/components/headings.md +107 -0
  54. package/agent-docs/components/hero.md +68 -0
  55. package/agent-docs/components/icon-button.md +90 -0
  56. package/agent-docs/components/icon.md +59 -0
  57. package/agent-docs/components/image.md +74 -0
  58. package/agent-docs/components/input.md +84 -0
  59. package/agent-docs/components/kbd.md +38 -0
  60. package/agent-docs/components/key-value-list.md +84 -0
  61. package/agent-docs/components/lightbox.md +97 -0
  62. package/agent-docs/components/list-layout.md +152 -0
  63. package/agent-docs/components/list-row.md +119 -0
  64. package/agent-docs/components/loading.md +69 -0
  65. package/agent-docs/components/markdown.md +51 -0
  66. package/agent-docs/components/media-tile.md +101 -0
  67. package/agent-docs/components/menu.md +110 -0
  68. package/agent-docs/components/meta-list.md +69 -0
  69. package/agent-docs/components/morph.md +134 -0
  70. package/agent-docs/components/navigation-progress.md +56 -0
  71. package/agent-docs/components/number-field.md +75 -0
  72. package/agent-docs/components/outline-region.md +74 -0
  73. package/agent-docs/components/page-fade.md +117 -0
  74. package/agent-docs/components/page-header.md +93 -0
  75. package/agent-docs/components/pagination.md +64 -0
  76. package/agent-docs/components/pill.md +105 -0
  77. package/agent-docs/components/popover.md +63 -0
  78. package/agent-docs/components/price.md +49 -0
  79. package/agent-docs/components/product-tile.md +78 -0
  80. package/agent-docs/components/progress-bar.md +66 -0
  81. package/agent-docs/components/promo-banner.md +46 -0
  82. package/agent-docs/components/prose-layout.md +87 -0
  83. package/agent-docs/components/prose.md +41 -0
  84. package/agent-docs/components/radio-group.md +77 -0
  85. package/agent-docs/components/scroll-strip.md +48 -0
  86. package/agent-docs/components/segmented-control.md +135 -0
  87. package/agent-docs/components/select.md +70 -0
  88. package/agent-docs/components/show.md +120 -0
  89. package/agent-docs/components/side-column.md +74 -0
  90. package/agent-docs/components/sidebar-layout.md +134 -0
  91. package/agent-docs/components/site-footer.md +63 -0
  92. package/agent-docs/components/site-search.md +79 -0
  93. package/agent-docs/components/slider.md +59 -0
  94. package/agent-docs/components/sortable-list.md +112 -0
  95. package/agent-docs/components/split-bar.md +54 -0
  96. package/agent-docs/components/stack.md +197 -0
  97. package/agent-docs/components/stacked-bar.md +91 -0
  98. package/agent-docs/components/stat-tile.md +69 -0
  99. package/agent-docs/components/state-machine.md +95 -0
  100. package/agent-docs/components/status-pages.md +112 -0
  101. package/agent-docs/components/stepper.md +54 -0
  102. package/agent-docs/components/steps.md +74 -0
  103. package/agent-docs/components/sticky-bar.md +51 -0
  104. package/agent-docs/components/switch.md +79 -0
  105. package/agent-docs/components/table-of-contents.md +78 -0
  106. package/agent-docs/components/table.md +384 -0
  107. package/agent-docs/components/tabs.md +178 -0
  108. package/agent-docs/components/text-link.md +110 -0
  109. package/agent-docs/components/textarea.md +53 -0
  110. package/agent-docs/components/timeline.md +79 -0
  111. package/agent-docs/components/toast.md +91 -0
  112. package/agent-docs/components/trend-chart.md +61 -0
  113. package/agent-docs/components/video.md +49 -0
  114. package/agent-docs/llms.txt +174 -0
  115. package/dist/AppShell.d.ts +25 -9
  116. package/dist/AppShell.js +67 -33
  117. package/dist/AppShellMenu.d.ts +31 -18
  118. package/dist/AppShellMenu.js +72 -45
  119. package/dist/ArticleLayout.d.ts +36 -0
  120. package/dist/ArticleLayout.js +27 -0
  121. package/dist/Audio.d.ts +16 -0
  122. package/dist/Audio.js +11 -0
  123. package/dist/Badge.d.ts +2 -1
  124. package/dist/Badge.js +3 -2
  125. package/dist/BottomSheet.d.ts +17 -6
  126. package/dist/BottomSheet.js +62 -11
  127. package/dist/Breadcrumbs.d.ts +8 -6
  128. package/dist/Breadcrumbs.js +17 -7
  129. package/dist/Button.d.ts +1 -0
  130. package/dist/Button.js +4 -3
  131. package/dist/CallToAction.d.ts +25 -0
  132. package/dist/CallToAction.js +17 -0
  133. package/dist/Callout.d.ts +2 -2
  134. package/dist/Callout.js +2 -2
  135. package/dist/Card.d.ts +88 -31
  136. package/dist/Card.js +55 -92
  137. package/dist/CardBody.d.ts +2 -0
  138. package/dist/CardBody.js +33 -3
  139. package/dist/CardGrid.d.ts +32 -4
  140. package/dist/CardGrid.js +42 -8
  141. package/dist/CardParts.d.ts +7 -1
  142. package/dist/CardParts.js +7 -2
  143. package/dist/CartButton.d.ts +33 -0
  144. package/dist/CartButton.js +18 -0
  145. package/dist/ChatComposer.d.ts +10 -4
  146. package/dist/ChatComposer.js +35 -13
  147. package/dist/Checkbox.d.ts +21 -3
  148. package/dist/Checkbox.js +66 -20
  149. package/dist/Chevron.js +1 -1
  150. package/dist/Cluster.d.ts +28 -15
  151. package/dist/Cluster.js +21 -4
  152. package/dist/Code.d.ts +15 -3
  153. package/dist/Code.js +23 -3
  154. package/dist/CodeBlock.d.ts +4 -4
  155. package/dist/CodeBlock.js +2 -2
  156. package/dist/CodeBody.d.ts +1 -1
  157. package/dist/CodeBody.js +4 -10
  158. package/dist/CodeExample.d.ts +1 -1
  159. package/dist/CodeExample.js +3 -2
  160. package/dist/ColourSchemeToggle.d.ts +21 -5
  161. package/dist/ColourSchemeToggle.js +15 -9
  162. package/dist/ColourSwatch.d.ts +15 -0
  163. package/dist/ColourSwatch.js +14 -0
  164. package/dist/Combobox.d.ts +42 -0
  165. package/dist/Combobox.js +43 -0
  166. package/dist/ConfirmDialog.d.ts +40 -0
  167. package/dist/ConfirmDialog.js +36 -0
  168. package/dist/Container.d.ts +3 -3
  169. package/dist/Container.js +1 -1
  170. package/dist/CopyButton.d.ts +8 -2
  171. package/dist/CopyButton.js +38 -28
  172. package/dist/CopyLine.d.ts +4 -2
  173. package/dist/CopyLine.js +4 -4
  174. package/dist/DateCalendar.d.ts +2 -0
  175. package/dist/DateCalendar.js +11 -9
  176. package/dist/DateField.d.ts +52 -21
  177. package/dist/DateField.js +73 -37
  178. package/dist/DateFieldCalendar.d.ts +12 -8
  179. package/dist/DateFieldCalendar.js +37 -18
  180. package/dist/DateRangePicker.d.ts +23 -3
  181. package/dist/DateRangePicker.js +10 -8
  182. package/dist/DateTimeField.d.ts +31 -0
  183. package/dist/DateTimeField.js +19 -0
  184. package/dist/Dialog.d.ts +42 -6
  185. package/dist/Dialog.js +50 -12
  186. package/dist/Disclosure.js +9 -1
  187. package/dist/DocsLayout.d.ts +13 -5
  188. package/dist/DocsLayout.js +11 -9
  189. package/dist/Drawer.d.ts +22 -7
  190. package/dist/Drawer.js +89 -8
  191. package/dist/EmbedFrame.d.ts +36 -0
  192. package/dist/EmbedFrame.js +18 -0
  193. package/dist/Field.d.ts +41 -4
  194. package/dist/Field.js +61 -25
  195. package/dist/FieldDialog.d.ts +8 -3
  196. package/dist/FieldDialog.js +19 -9
  197. package/dist/Fieldset.d.ts +3 -3
  198. package/dist/Fieldset.js +7 -9
  199. package/dist/FileDrop.js +2 -1
  200. package/dist/FlowDiagram.d.ts +92 -0
  201. package/dist/FlowDiagram.js +100 -0
  202. package/dist/FormRow.d.ts +6 -4
  203. package/dist/FormRow.js +11 -9
  204. package/dist/Hero.d.ts +30 -7
  205. package/dist/Hero.js +23 -9
  206. package/dist/Icon.d.ts +1 -1
  207. package/dist/Icon.js +1 -1
  208. package/dist/IconButton.js +1 -1
  209. package/dist/Image.d.ts +33 -9
  210. package/dist/Image.js +61 -16
  211. package/dist/Input.d.ts +1 -1
  212. package/dist/Input.js +4 -4
  213. package/dist/InputShell.d.ts +7 -0
  214. package/dist/InputShell.js +18 -3
  215. package/dist/KeyValueList.d.ts +2 -2
  216. package/dist/Lightbox.js +5 -3
  217. package/dist/ListRow.d.ts +4 -5
  218. package/dist/ListRow.js +36 -26
  219. package/dist/Mark.d.ts +10 -0
  220. package/dist/Mark.js +9 -0
  221. package/dist/Markdown.d.ts +18 -4
  222. package/dist/Markdown.js +176 -37
  223. package/dist/MediaTile.d.ts +9 -3
  224. package/dist/MediaTile.js +8 -4
  225. package/dist/Menu.d.ts +19 -8
  226. package/dist/Menu.js +13 -11
  227. package/dist/MetaList.d.ts +4 -3
  228. package/dist/MetaList.js +12 -4
  229. package/dist/Morph.d.ts +15 -1
  230. package/dist/Morph.js +70 -22
  231. package/dist/NavigationProgress.d.ts +2 -2
  232. package/dist/NavigationProgress.js +7 -5
  233. package/dist/NumberField.d.ts +66 -0
  234. package/dist/NumberField.js +68 -0
  235. package/dist/OutlineRegion.d.ts +41 -10
  236. package/dist/OutlineRegion.js +31 -6
  237. package/dist/PageFade.d.ts +9 -5
  238. package/dist/PageFade.js +39 -8
  239. package/dist/PageLayouts.d.ts +15 -5
  240. package/dist/PageLayouts.js +3 -3
  241. package/dist/Pill.d.ts +9 -4
  242. package/dist/Pill.js +15 -6
  243. package/dist/Popover.d.ts +31 -0
  244. package/dist/Popover.js +43 -0
  245. package/dist/Price.d.ts +21 -0
  246. package/dist/Price.js +34 -0
  247. package/dist/ProductTile.d.ts +36 -0
  248. package/dist/ProductTile.js +31 -0
  249. package/dist/ProgressBar.js +4 -2
  250. package/dist/PromoBanner.d.ts +25 -0
  251. package/dist/PromoBanner.js +16 -0
  252. package/dist/RadioGroup.d.ts +18 -8
  253. package/dist/RadioGroup.js +42 -18
  254. package/dist/ScrollStrip.d.ts +1 -1
  255. package/dist/ScrollStrip.js +1 -1
  256. package/dist/SearchInput.d.ts +17 -2
  257. package/dist/SearchInput.js +72 -13
  258. package/dist/SegmentedField.d.ts +15 -0
  259. package/dist/SegmentedField.js +15 -0
  260. package/dist/Select.js +5 -4
  261. package/dist/Show.d.ts +1 -1
  262. package/dist/Show.js +1 -1
  263. package/dist/SideColumn.d.ts +42 -15
  264. package/dist/SideColumn.js +45 -19
  265. package/dist/SiteFooter.d.ts +3 -3
  266. package/dist/SiteFooter.js +4 -3
  267. package/dist/SiteSearch.d.ts +57 -27
  268. package/dist/SiteSearch.js +13 -93
  269. package/dist/Slider.d.ts +27 -0
  270. package/dist/Slider.js +58 -0
  271. package/dist/SortableList.d.ts +19 -35
  272. package/dist/SortableList.js +36 -88
  273. package/dist/Stack.d.ts +4 -4
  274. package/dist/StackedBar.d.ts +13 -4
  275. package/dist/StackedBar.js +12 -7
  276. package/dist/StateMachine.d.ts +65 -0
  277. package/dist/StateMachine.js +113 -0
  278. package/dist/StatusPages.d.ts +28 -10
  279. package/dist/StatusPages.js +10 -10
  280. package/dist/Stepper.d.ts +21 -0
  281. package/dist/Stepper.js +33 -0
  282. package/dist/Steps.js +4 -3
  283. package/dist/Switch.d.ts +3 -3
  284. package/dist/Switch.js +18 -14
  285. package/dist/Table.d.ts +32 -9
  286. package/dist/Table.js +50 -20
  287. package/dist/TableCells.d.ts +24 -21
  288. package/dist/TableCells.js +68 -27
  289. package/dist/TableEditCell.d.ts +1 -1
  290. package/dist/TableOfContents.d.ts +34 -0
  291. package/dist/TableOfContents.js +23 -0
  292. package/dist/Tabs.d.ts +31 -16
  293. package/dist/Tabs.js +97 -22
  294. package/dist/TextLink.d.ts +18 -5
  295. package/dist/TextLink.js +19 -6
  296. package/dist/Textarea.d.ts +12 -1
  297. package/dist/Textarea.js +15 -2
  298. package/dist/ToastRegion.d.ts +17 -9
  299. package/dist/ToastRegion.js +70 -13
  300. package/dist/Tooltip.d.ts +10 -2
  301. package/dist/Tooltip.js +32 -11
  302. package/dist/Video.d.ts +19 -4
  303. package/dist/Video.js +15 -5
  304. package/dist/cardContext.d.ts +7 -0
  305. package/dist/cardContext.js +14 -0
  306. package/dist/cardControl.d.ts +15 -0
  307. package/dist/cardControl.js +32 -0
  308. package/dist/cardForm.d.ts +39 -0
  309. package/dist/cardForm.js +81 -0
  310. package/dist/cardWait.js +2 -1
  311. package/dist/colourScheme.d.ts +12 -2
  312. package/dist/colourScheme.js +32 -6
  313. package/dist/control.d.ts +30 -8
  314. package/dist/control.js +74 -7
  315. package/dist/copyScript.d.ts +7 -8
  316. package/dist/copyScript.js +8 -9
  317. package/dist/cx.d.ts +22 -3
  318. package/dist/cx.js +22 -3
  319. package/dist/dateLocale.d.ts +17 -0
  320. package/dist/dateLocale.js +30 -0
  321. package/dist/density.d.ts +15 -1
  322. package/dist/density.js +27 -8
  323. package/dist/emptySlot.d.ts +1 -0
  324. package/dist/fieldAnnounce.d.ts +11 -0
  325. package/dist/fieldAnnounce.js +36 -0
  326. package/dist/fieldControl.d.ts +7 -2
  327. package/dist/fieldControl.js +6 -2
  328. package/dist/fieldWait.d.ts +3 -3
  329. package/dist/fieldWait.js +3 -4
  330. package/dist/flowLayout.d.ts +68 -0
  331. package/dist/flowLayout.js +105 -0
  332. package/dist/fromXState.d.ts +73 -0
  333. package/dist/fromXState.js +110 -0
  334. package/dist/icons.d.ts +1 -1
  335. package/dist/icons.js +15 -0
  336. package/dist/index.d.ts +37 -11
  337. package/dist/index.js +24 -2
  338. package/dist/isoDate.d.ts +8 -1
  339. package/dist/isoDate.js +20 -1
  340. package/dist/labelWords.d.ts +16 -7
  341. package/dist/labelWords.js +14 -12
  342. package/dist/listRowProps.d.ts +17 -15
  343. package/dist/modal.d.ts +5 -0
  344. package/dist/modal.js +21 -1
  345. package/dist/navFold.js +6 -3
  346. package/dist/optionCard.d.ts +18 -0
  347. package/dist/optionCard.js +16 -0
  348. package/dist/scrollBody.d.ts +16 -0
  349. package/dist/scrollBody.js +15 -0
  350. package/dist/scrollEdges.d.ts +7 -0
  351. package/dist/scrollEdges.js +39 -5
  352. package/dist/scrollStop.d.ts +6 -2
  353. package/dist/scrollStop.js +24 -8
  354. package/dist/shownDate.d.ts +28 -10
  355. package/dist/shownDate.js +41 -22
  356. package/dist/siteSearchBody.d.ts +34 -0
  357. package/dist/siteSearchBody.js +117 -0
  358. package/dist/size.d.ts +7 -1
  359. package/dist/sortableDrop.d.ts +44 -0
  360. package/dist/sortableDrop.js +78 -0
  361. package/dist/sortableSlide.d.ts +9 -0
  362. package/dist/sortableSlide.js +70 -0
  363. package/dist/sortableTitle.d.ts +10 -0
  364. package/dist/sortableTitle.js +48 -0
  365. package/dist/stateMachineDots.d.ts +45 -0
  366. package/dist/stateMachineDots.js +162 -0
  367. package/dist/stickyColumn.d.ts +2 -2
  368. package/dist/stickyColumn.js +2 -2
  369. package/dist/switcher.d.ts +10 -5
  370. package/dist/switcher.js +7 -5
  371. package/dist/tableColumns.d.ts +17 -0
  372. package/dist/tableColumns.js +30 -2
  373. package/dist/tableEmpty.js +5 -5
  374. package/dist/tableRow.d.ts +26 -2
  375. package/dist/tableRow.js +23 -1
  376. package/dist/tableSort.d.ts +10 -5
  377. package/dist/tableSort.js +15 -4
  378. package/dist/target.d.ts +12 -0
  379. package/dist/target.js +12 -0
  380. package/dist/textBox.js +1 -1
  381. package/dist/truncated.d.ts +31 -0
  382. package/dist/truncated.js +51 -0
  383. package/dist/typography.d.ts +19 -11
  384. package/dist/typography.js +11 -13
  385. package/dist/useFlowLayout.d.ts +27 -0
  386. package/dist/useFlowLayout.js +119 -0
  387. package/package.json +7 -3
  388. package/skills/uislash/SKILL.md +20 -0
@@ -0,0 +1,197 @@
1
+ ## Stack
2
+
3
+ Group: Layout
4
+
5
+ When to use: Any blocks that follow each other: space is a Stack's `gap`, never a margin on a block.
6
+
7
+ ### Use instead
8
+ - FormLayout (form-layout.md): The whole page is one form: header, fields, then Save and Cancel.
9
+ - FormRow (form-row.md): Fields sit side by side: a `FormGrid` of `Field`s, or a `FormRow` to edit one record on a line.
10
+
11
+ ### The one right way
12
+ Blocks that follow each other go in a `Stack`: the gap is one step of the scale, `md` by default.
13
+ ```tsx
14
+ import { Card, Stack, Text } from "@slashsuite/ui-react";
15
+
16
+ <Stack>
17
+ <Card title="Build 412">
18
+ <Text>3 changed</Text>
19
+ </Card>
20
+ <Card title="Build 411">
21
+ <Text>No changes</Text>
22
+ </Card>
23
+ </Stack>
24
+ ```
25
+
26
+ ### Do
27
+ - `gap` is a scale: `xs` between lines of text, `sm` inside a group, `md` between blocks, `lg` between groups, `xl` between a page's top-level blocks (the one responsive page rhythm). Left out, it comes from where the Stack sits: `xs` inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, `md` on the page.
28
+ - `width` caps the column at the start edge: `compact` (one card or one picture's column), `narrow` (a reading measure), `wide`, `full`, or `default` for the parent's width. It is never re-centred. A width cap on any one block is a `Stack` around it: `<Stack width="compact"><Card>...</Card></Stack>`.
29
+ - `as` is `div` (default), `section`, `form`, `ul` or `ol`. `as="form"` takes the form props and spaces its fields; `as="ul"` and `as="ol"` draw no markers and their children are `<li>`s, and take `empty`, an `EmptyState` drawn as one muted line when the list has no children.
30
+ - A titled group is a `Section`: `title`, `actions` beside it, then the blocks, spaced as a `Stack`. It takes `gap` and `width` as `Stack` does. `rule` draws a hairline under the title row, `actions` included. Its title is an `h2` on the page, one level below the section that holds it, and a `Card` or `EmptyState` inside it is one below that; `level` sets it by hand.
31
+ - A small titled group (a panel's "Flaky" block, a card's "Ignore areas") is `Section size="sm"`: a small all-caps title, its blocks `xs` apart, `actions` at the end of the title row.
32
+ - `rowFrom` (`sm`, `md` or `lg`) turns the column into a row from that breakpoint and leaves it a column below: a main block beside a side column on a wide screen, stacked on a phone. Put the block that takes the width left in a `ClusterGrow`.
33
+ - A row that is a row at every width is a `Cluster`, not a Stack.
34
+ - `overline` puts a small label above a `Section`'s title, in the same `<header>`, and `description` a line under it that is not part of the heading's name.
35
+
36
+ ### Don't
37
+ - Never build a landing section from an `Overline`, a `Display` and a `Lead` by hand: it is unnamed and drifts from every other one.
38
+ - Do not build a small titled group from `Stack as="section"` and an `Overline as="h2"`: it is unnamed and its gap is a guess. It is `Section size="sm"`.
39
+
40
+ Blocks in a bare `div` touch each other. Space is the Stack's job, never left to the blocks.
41
+ ```tsx
42
+ import { Card, Text } from "@slashsuite/ui-react";
43
+
44
+ <div>
45
+ <Card title="Build 412">
46
+ <Text>3 changed</Text>
47
+ </Card>
48
+ <Card title="Build 411">
49
+ <Text>No changes</Text>
50
+ </Card>
51
+ </div>
52
+ ```
53
+
54
+ A heading row built by hand is not tied to its group: nothing names the region and the row's spacing is a guess. Use `Section`.
55
+ ```tsx
56
+ import { Button, Card, Cluster, SectionHeading, Stack, Text } from "@slashsuite/ui-react";
57
+
58
+ <Stack gap="sm">
59
+ <Cluster justify="between">
60
+ <SectionHeading>Recent builds</SectionHeading>
61
+ <Button variant="outline">All builds</Button>
62
+ </Cluster>
63
+ <Card>
64
+ <Text>Build 412 · 3 changed</Text>
65
+ </Card>
66
+ <Card>
67
+ <Text>Build 411 · no changes</Text>
68
+ </Card>
69
+ </Stack>
70
+ ```
71
+
72
+ The same cards in a plain Stack are two unrelated blocks: no list, no count, nothing to jump by.
73
+ ```tsx
74
+ import { Card, Stack, Text } from "@slashsuite/ui-react";
75
+
76
+ <Stack gap="sm">
77
+ <Card>
78
+ <Text>Build 412 · 3 changed</Text>
79
+ </Card>
80
+ <Card>
81
+ <Text>Build 411 · no changes</Text>
82
+ </Card>
83
+ </Stack>
84
+ ```
85
+
86
+ Left to the page, a small card stretches across it and its few lines float in a wide box.
87
+ ```tsx
88
+ import { Card, KeyValue, KeyValueList, Stack } from "@slashsuite/ui-react";
89
+
90
+ <Stack>
91
+ <Card title="Opening hours" size="sm">
92
+ <KeyValueList>
93
+ <KeyValue label="Mon to Fri">08:00 to 17:00</KeyValue>
94
+ <KeyValue label="Saturday">08:00 to 13:00</KeyValue>
95
+ <KeyValue label="Sunday">Closed</KeyValue>
96
+ </KeyValueList>
97
+ </Card>
98
+ </Stack>
99
+ ```
100
+
101
+ Built from a `Stack as="section"` and an `Overline as="h2"`, the group is an unnamed section whose gap is a guess.
102
+ ```tsx
103
+ import { Button, Card, Cluster, Overline, Stack, Text } from "@slashsuite/ui-react";
104
+
105
+ <Card>
106
+ <Stack gap="sm">
107
+ <Stack as="section" gap="xs">
108
+ <Cluster justify="between">
109
+ <Overline as="h2">Flaky</Overline>
110
+ <Button variant="ghost" size="sm">
111
+ Rerun
112
+ </Button>
113
+ </Cluster>
114
+ <Text>checkout.spec.ts failed once in the last 20 runs.</Text>
115
+ </Stack>
116
+ <Stack as="section" gap="xs">
117
+ <Overline as="h2">Ignore areas</Overline>
118
+ <Text>The clock in the header and the avatar.</Text>
119
+ </Stack>
120
+ </Stack>
121
+ </Card>
122
+ ```
123
+
124
+ An `Overline`, a `Display as="h2"` and a `Lead` by hand: nothing names the region and the spacing drifts from every other landing section.
125
+ ```tsx
126
+ import { Card, Display, Lead, Overline, Stack, Text } from "@slashsuite/ui-react";
127
+
128
+ <Stack as="section" gap="lg">
129
+ <Stack gap="sm">
130
+ <header>
131
+ <Overline mono>Fit</Overline>
132
+ <Display as="h2">Built for agents.</Display>
133
+ </header>
134
+ <Lead>A site from props alone, in every theme.</Lead>
135
+ </Stack>
136
+ <Card>
137
+ <Text>Each tool answers one question about a change.</Text>
138
+ </Card>
139
+ </Stack>
140
+ ```
141
+
142
+ ### Accessibility
143
+ - `Section` is a `<section>` named by its `title` (`aria-labelledby`), so it is a region; with no `title` give it an `aria-label`.
144
+ - A `Stack` with `as="ul"` or `as="ol"` is a real list: give it an `aria-label` when more than one list is on the page. `as="ul" divided` is still a list; the lines are only drawn.
145
+ - `as="form"` is a `<form>`; give it an `aria-label` or let a heading name it.
146
+ - A `div` Stack adds no role.
147
+
148
+ ### Props
149
+ ### Stack
150
+ A vertical column of blocks a fixed `gap` apart: `xs` between lines of text (a heading and the line under it), `sm` inside a group, `md` between blocks, `lg` between groups, `xl` between a page's top-level blocks (`gap-12`, `sm:gap-16`: the one responsive page rhythm). Left out, the gap comes from where the Stack sits: `xs` inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, and `md` on the page. `width` caps the column: `compact` is the width of one card or one picture's column (28rem), `narrow` is a reading measure, `wide` is wider again, `full` is the parent's whole width and `default` sets nothing. A capped Stack starts at its parent's start edge (it is never re-centred), so its first line lines up with every other block on the page. A width cap on any one block (a `Card`, an `Image`) is a Stack around it. `align="start"` keeps each child at its own width, capped at the column's (a `Button` under a form's fields); left out, every child spans the column. `divided` draws a line between each pair of children and sets them touching, with no gap: it is for rows that carry their own padding (`ListRow`s in a `Card flush`). Space and a line between blocks is a `Divider` in the Stack instead. `rowFrom` turns the column into a row from `sm`, `md` or `lg` (a column below it): the blocks sit side by side, `gap` apart, and a `ClusterGrow` around one of them takes the width left. Without it the Stack is always a column; a row that is a row at every width is a `Cluster`. `as` is a closed set: `div` (default), `section`, `form`, `ul` or `ol`. A `form` takes the form props (`onSubmit`, `action`, `method`, `noValidate`, ...). A `ul` or `ol` is drawn with no markers and its children are `<li>`s, as in `BulletList` and `Timeline`: the Stack does not wrap them, so a child is one list item and `Text as="li"` or a bare `<li>` both work. A `ul` or `ol` takes `empty` (an `EmptyState`, one muted line here), drawn in place of the list when it has no children.
151
+ - align: "start" | "stretch" (default stretch). Where the children sit across the column: `stretch` spans it, `start` keeps each child at its
152
+ own width (a `Button` under a form's fields).
153
+ - as: "form" | "div" | "ol" | "section" | "ul". The element: `div`, `section`, `form` (takes the form's props), `ul` or `ol` (no markers; each child is an `<li>`).
154
+ - divided: boolean. A line between each pair of children, which then touch (no gap): rows that carry their own
155
+ padding. Space and a line between blocks is a `Divider` in the Stack instead.
156
+
157
+ Such as `ListRow`s in a `Card flush`.
158
+ - empty: ReactNode. Drawn in place of the list when it has no children: an `EmptyState`.
159
+ - gap: "sm" | "md" | "lg" | "xs" | "xl" (default xs inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, else md). The space between blocks: `xs` gap-2, `sm` gap-4, `md` gap-6, `lg` gap-8, `xl` gap-12 (gap-16 from `sm`).
160
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
161
+ - rowFrom: "sm" | "md" | "lg". Turns the column into a row from this breakpoint (`sm`, `md` or `lg`), a column below it: a main
162
+ area beside a side column on a wide screen, stacked on a phone. In the row the blocks sit side by side
163
+ the same `gap` apart and are as tall as the tallest; wrap the one that takes the width left in a
164
+ `ClusterGrow`. Left out, the Stack is always a column.
165
+ - width: "compact" | "full" | "default" | "narrow" | "wide" (default default). Caps the column: `compact` max-w-md (one card or one picture's column), `narrow` max-w-3xl (a
166
+ reading measure), `wide` max-w-5xl, `full` the parent's whole width, `default` sets nothing.
167
+
168
+ ### Section
169
+ A `<section>` Stack with an optional title (which names it) and `actions`. Its blocks are `gap` apart, from where it sits as in a `Stack`. `level` is the title's heading level, one below the heading that holds the section (an `h2` on the page), and a heading inside it (a `Card`'s title) is one below that. A line between two sections is a `Divider` in the `Stack` that holds them. `size` picks the scale: - `md` (default): a page's section. A `SectionHeading` title with `actions` at the end of its row; `rule` draws a hairline under the row, `overline` a small label above the title and `description` a muted line under it. - `sm`: the small titled group inside a page, a card, a drawer or a side panel (a panel's "Flaky" block, a card's "Ignore areas"): the title small and all-caps like a `Card`'s, the blocks `xs` apart. Never build one from a `Stack as="section"` and an `Overline`. - `lg`: a landing page's section under the `Hero`: a mono `overline` kicker, the title at display size, `description` as a `Lead` and `actions` under it as its calls to action, the opening capped at the reading measure at the start edge, the blocks `lg` apart. It ignores the prose scale.
170
+ - actions: ReactNode. Buttons or links: at the end of the title row, or under the description at `size="lg"`.
171
+ - description: ReactNode. The line under the title, outside the heading: a muted line at `md`, a `Lead` at `lg`.
172
+ - gap: "sm" | "md" | "lg" | "xs" | "xl" (default xs at `size="sm"`, lg at `size="lg"`; else xs inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, else md). The space between blocks: `xs` gap-2, `sm` gap-4, `md` gap-6, `lg` gap-8, `xl` gap-12 (gap-16 from `sm`).
173
+ - id: string. Makes the section a link target: `#<id>` scrolls to its heading, which stops below the sticky
174
+ AppShell header, as every `id` inside the shell does; write no `scroll-margin`. Needs a `title`:
175
+ with no title the heading that carries it is not rendered.
176
+ The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
177
+ - level: 2 | 3 | 4 | 5 | 6 (default one below the heading that holds the section: 2 on the page). The title's heading level, 2 to 6. It does not change how the title looks.
178
+ - overline: ReactNode. A small label above the title, in the same `<header>` (mono at `size="lg"`). Needs a `title`.
179
+ - rule: boolean (default false). A hairline under the title row across the section's width, `actions` included. Needs a
180
+ `title` or `actions`.
181
+ - size: "sm" | "md" | "lg" (default md). `sm` a small titled group inside a page, a card or a panel, its title small and all-caps
182
+ and its blocks `xs` apart; `md` a page's section; `lg` a landing page's section, a display
183
+ title under a mono kicker, a `Lead`, then its calls to action.
184
+
185
+ A landing page's section under the `Hero` is `size="lg"`: its opening is capped at the
186
+ reading measure at the start edge and its blocks sit `lg` apart. A feature card in it is
187
+ a `Card href icon titleStyle="name"` in a `CardGrid`; text beside code is a `SideColumn`.
188
+ - title: ReactNode. The heading at the top, which names the section.
189
+ - width: "compact" | "full" | "default" | "narrow" | "wide" (default default). Caps the column: `compact` max-w-md (one card or one picture's column), `narrow` max-w-3xl (a
190
+ reading measure), `wide` max-w-5xl, `full` the parent's whole width, `default` sets nothing.
191
+
192
+ ### Types
193
+ - SectionSize: `"sm" | "md" | "lg"`. A `Section`'s scale: `sm` a small titled group, `md` a page's section, `lg` a landing page's section.
194
+ - StackAlign: `"start" | "stretch"`. Where a Stack's children sit across the column: `stretch` spans it, `start` keeps each child's own width.
195
+ - StackGap: `"sm" | "md" | "lg" | "xs" | "xl"`. The space between a `Stack`'s blocks, on the gap scale: `xs` 8px, `sm` 16px, `md` 24px, `lg` 32px, `xl` 48px (64px from `sm`).
196
+ - StackRowFrom: `"sm" | "md" | "lg"`. The breakpoint from which a `Stack` turns from a column into a row: `sm`, `md` or `lg`.
197
+ - StackWidth: `"compact" | "narrow" | "default" | "wide" | "full"`. A `Stack`'s width cap at the start edge: `compact`, `narrow` (a reading measure), `default`, `wide` or `full`.
@@ -0,0 +1,91 @@
1
+ ## StackedBar
2
+
3
+ Group: Data
4
+
5
+ When to use: The make-up of one whole in three or more parts: results by status, spend by group.
6
+
7
+ ### The one right way
8
+ `legend` names every colour in words, with its value, under the bar.
9
+ ```tsx
10
+ import { StackedBar } from "@slashsuite/ui-react";
11
+
12
+ <StackedBar
13
+ items={[
14
+ { label: "Changed", value: 24, tone: "warn" },
15
+ { label: "New", value: 9, tone: "info" },
16
+ { label: "Same", value: 163, tone: "muted" },
17
+ ]}
18
+ label="Screenshots by status"
19
+ legend
20
+ />
21
+ ```
22
+
23
+ ### Do
24
+ - `items` are `{ label, value, tone }` in the order to draw; `tone` is `muted`, `positive`, `warn`, `danger`, `info`, `neutral` (a grey apart from `muted`) or `accent`, and you map your own roles onto them. Five distinguishable parts are `warn`, `info`, `danger`, `neutral` and `muted`.
25
+ - Categories with no meaning (shops by kind, spend by group) take the categorical scale, `cat1` to `cat8`, from `cat1` upwards in order; good and bad take the meaning tones; never both in one chart. Each theme publishes the same eight as `--hc-cat-1` to `--hc-cat-8`, so a map pin can match its `Legend`.
26
+ - Set `legend` so every colour is named in words under the bar, with its value.
27
+ - The part that matters least (not measured, not counted) is `quiet`: no fill, so the bar's track shows through and the part reads as the bar's empty end. Put it last. It is under the contrast a chart mark needs, so a bar with a `quiet` part always draws its `Legend`, where the value is named.
28
+ - `Legend` alone is the key for colours drawn elsewhere, such as a `TableRow` `stripe`. An item with `swatch: "dashed"` is a dashed ring with no fill, the key for an outline drawn over the chart.
29
+ - `size` is `sm`, `md` (default) or `lg`. A part with no value is zero wide.
30
+ - Two parties are a `SplitBar`; progress toward a total is a `ProgressBar`.
31
+
32
+ ### Don't
33
+ Without `legend` the colours are never named, so the bar cannot be read by anyone who cannot tell them apart.
34
+ ```tsx
35
+ import { StackedBar } from "@slashsuite/ui-react";
36
+
37
+ <StackedBar
38
+ items={[
39
+ { label: "Changed", value: 24, tone: "warn" },
40
+ { label: "New", value: 9, tone: "info" },
41
+ { label: "Same", value: 163, tone: "muted" },
42
+ ]}
43
+ label="Screenshots by status"
44
+ />
45
+ ```
46
+
47
+ The meaning tones on categories make one read as a warning and another as a failure, which they are not.
48
+ ```tsx
49
+ import { StackedBar } from "@slashsuite/ui-react";
50
+
51
+ <StackedBar
52
+ items={[
53
+ { label: "Vintage", value: 14, tone: "warn" },
54
+ { label: "Books", value: 9, tone: "danger" },
55
+ { label: "Furniture", value: 7, tone: "positive" },
56
+ ]}
57
+ label="Shops by category"
58
+ legend
59
+ />
60
+ ```
61
+
62
+ ### Accessibility
63
+ - The bar has `role="img"` and an `aria-label` of `label` followed by every part's name and whole percent; rounded, they may not add up to exactly 100.
64
+ - A `Legend` is a list. Its swatches are hidden from assistive tech and its labels are always drawn, so colour is never the only signal.
65
+
66
+ ### Props
67
+ ### StackedBar
68
+ A bar of any number of parts, each sized by its share of the sum, in the order given. A part with no value is zero wide. `label` names the bar for a screen reader, which hears every part's name and whole percent (rounded, so they may not add up to exactly 100). `legend` draws a `Legend` under the bar, each part's label with its value, so the colours are named in words. While `loading` the bar is one bone (0 is a real value) and the key keeps the names it has, without their values.
69
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
70
+ - items: readonly StackedSegment[] (required). The parts in order, each a `label`, a `value` (its share is the value over the sum) and a `tone`.
71
+ - label: string (required). What the bar shows, for a screen reader, which hears it before every part's name and percent.
72
+ - legend: boolean (default false). Draw the key under the bar. Defaults to false; a bar with a `quiet` part always draws it.
73
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
74
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
75
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
76
+ - size: "sm" | "md" | "lg" (default md). The bar's height: `sm` 6px, `md` 8px, `lg` 12px.
77
+
78
+ ### Legend
79
+ A key to the colours of a chart or a row stripe: a swatch in the `VizTone` colour (a filled dot, or a dashed ring with `swatch="dashed"`), its `label` and an optional `detail` after it. Colour alone does not say it, so the label is always drawn. `StackedBar legend` draws one under the bar from its segments. While `loading` with no `items` it draws three entries of bones.
80
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
81
+ - items: readonly LegendItem[] (required). One entry per colour: its `label`, its `tone`, an optional `swatch` and `detail` (a count, a share).
82
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
83
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
84
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
85
+
86
+ ### Types
87
+ - CategoryTone: `"cat1" | "cat2" | "cat3" | "cat4" | "cat5" | "cat6" | "cat7" | "cat8"`. The categorical scale: eight colours that say only "this category", never good or bad.
88
+ - LegendItem: `{ label: string; tone: SegmentTone; swatch?: "solid" | "dashed"; detail?: string | number }`. One entry of a `Legend`: the `label` the colour stands for, its swatch, and an optional `detail` (a count, a share) after it.
89
+ - SegmentTone: `VizTone | "quiet"`. The colour of a `StackedBar` part or a `Legend` swatch: a `VizTone`, or `quiet`, the remainder that matters least (not measured, not counted). A quiet part has no fill, so the bar's track shows through and the part reads as the empty end of the bar, quieter than `neutral` in every theme; put it last, where the bar ends. It sits under the 3:1 a chart mark needs, so its value is always named in words: a bar with a quiet part draws its `Legend`, and the key's quiet swatch is the track colour with an edge.
90
+ - StackedSegment: `{ label: string; value: number; tone: SegmentTone }`. One part of a `StackedBar`: its `label`, its `value` (its share is `value` over the sum) and its colour.
91
+ - VizTone: `TextTone | CategoryTone`. The colour of a `StackedBar` segment, a `Legend` swatch or a `TrendChart` series: the `TextTone` names, painted as a fill, or a category colour, `cat1` to `cat8`. On a chart `neutral` is a grey of its own that sits apart from `muted` (for "unmeasured" next to "same"), and `accent` is the theme's accent, apart from `info`. Categories with no meaning take `cat1` upwards in order; good and bad take the meaning tones; one chart never mixes the two.
@@ -0,0 +1,69 @@
1
+ ## StatTile
2
+
3
+ Group: Data
4
+
5
+ When to use: A single number a person should see first: a total, a date, a balance.
6
+
7
+ ### The one right way
8
+ Pass the value already formatted, with its unit: `R 4 250`, `Mar 2029`, `12%`.
9
+ ```tsx
10
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
11
+
12
+ <CardGrid columns={2}>
13
+ <StatTile label="Left over" value="R 4 250" hint="after all bills" />
14
+ <StatTile label="Debt-free" value="Mar 2029" />
15
+ </CardGrid>
16
+ ```
17
+
18
+ ### Do
19
+ - Pass `value` already formatted, with its unit and grouping (`R 4 250`, `Mar 2029`); the tile does not format.
20
+ - `label` names the figure; `hint` is one short line under it.
21
+ - `tone` is `neutral`, `positive`, `warn` or `danger`. A tone colours the value, so give it a sign or a `hint` that says the same; `accent` adds a bar in the same tone across the top.
22
+ - Lay several tiles out in a `CardGrid`. A tile is not a button or a link.
23
+ - `trend` takes the figure over time, oldest first, and draws a small line under the value in its colour, on a scale from 0. The line is decoration, so say the trend in `hint` too (`up 12% on last month`). A chart with axes is a `TrendChart`.
24
+
25
+ ### Don't
26
+ A raw number has no unit or grouping, so the tile shows a figure nobody can read at a glance.
27
+ ```tsx
28
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
29
+
30
+ <CardGrid columns={2}>
31
+ <StatTile label="Left over" value={4250.5} />
32
+ <StatTile label="Savings" value={1250000} />
33
+ </CardGrid>
34
+ ```
35
+
36
+ The same tones with no sign and no hint: red and green are the only difference, so the meaning is lost without colour.
37
+ ```tsx
38
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
39
+
40
+ <CardGrid columns={2}>
41
+ <StatTile label="Left over" value="R 4 250" tone="positive" accent />
42
+ <StatTile label="Total interest" value="R 12 400" tone="danger" accent />
43
+ </CardGrid>
44
+ ```
45
+
46
+ ### Accessibility
47
+ - A StatTile is plain text in a `<div>`: the caption, the value and the hint are read in that order.
48
+ - The `accent` bar is decoration and hidden from assistive tech.
49
+ - Colour alone never carries the tone; a sign or the hint says it.
50
+
51
+ ### Props
52
+ ### StatTile
53
+ One headline figure: an uppercase caption over a large tabular-nums value, with an optional hint line beneath. `tone` colours the value; `accent` adds a bar across the top edge in the same tone. `trend` draws a small line under the value in the same colour. Pass the value already formatted. While `loading`, a `label` or `value` not here yet is a bone; the hint and the trend are drawn only once given.
54
+ - accent: boolean (default false). A bar across the top edge in the tone's colour.
55
+ - hint: ReactNode. A muted line under the value.
56
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
57
+ - label: ReactNode (required). The small uppercase caption over the value.
58
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
59
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
60
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
61
+ - tone: "neutral" | "positive" | "warn" | "danger" (default neutral). What the figure means: `neutral` (the default) a plain figure, `positive` good or on track,
62
+ `warn` at risk, `danger` failed or over. Say it in the text too: colour alone says nothing to a
63
+ screen reader.
64
+ - trend: readonly number[]. The figure over time, oldest first: a sparkline under the value, in its colour, on a scale
65
+ from 0. It is decoration, so say the trend in `hint` as well.
66
+ - value: ReactNode (required). The figure, already formatted, large and in tabular figures.
67
+
68
+ ### Types
69
+ - StatTileTone: `"neutral" | "positive" | "warn" | "danger"`. The colour of a tile's value (and of its accent bar): plain ink, green, amber or red.
@@ -0,0 +1,95 @@
1
+ ## StateMachine
2
+
3
+ Group: Data
4
+
5
+ When to use: The states a thing goes through and the events that move it, with where each thing is now: tickets in a workflow, orders in fulfilment, jobs in a queue.
6
+
7
+ ### The one right way
8
+ One state waits on a person, and only it is `human`: it stands out, and its tag says so.
9
+ ```tsx
10
+ import { StateMachine } from "@slashsuite/ui-react";
11
+
12
+ <StateMachine
13
+ label="Article flow"
14
+ states={[
15
+ { id: "draft", label: "Draft", kind: "initial", owner: "writer" },
16
+ { id: "review", label: "In review", kind: "human", owner: "editor" },
17
+ { id: "published", label: "Published", kind: "terminal" },
18
+ ]}
19
+ transitions={[
20
+ { from: "draft", to: "review", event: "submit" },
21
+ { from: "review", to: "draft", event: "send back" },
22
+ { from: "review", to: "published", event: "approve" },
23
+ ]}
24
+ items={[{ id: "A-12", label: "Spring launch post", state: "review" }]}
25
+ />
26
+ ```
27
+
28
+ ### Do
29
+ - Give it `states` (`{ id, label, kind, owner }`), `transitions` (`{ from, to, event }`) and `items` (`{ id, label, state, href }`), plain data with no layout: it is drawn like a `FlowDiagram`.
30
+ - `kind` says what a state is: `human` for a state waiting on a person (the warn tone), `failed` for an error (danger), `terminal` for done (muted), `initial` for the start. Each is also a tag in words. Leave the rest `normal`.
31
+ - `owner` is the role or lane that acts in a state, a tag on its box.
32
+ - An item's `id` is its short ref, shown by its dot; its `label` is the full name, its tooltip and what a screen reader says. Give `href` and the dot is a link.
33
+ - Change an item's `state` and its dot runs along the arrow to its new box; there is nothing to call.
34
+ - `active` rings the one state that is current, for a machine with one thing in it.
35
+ - Made with xstate? `fromXState(machine)` gives `states` and `transitions`; its `state` option maps your own `meta` onto `kind` and `owner`.
36
+
37
+ ### Don't
38
+ - Do not leave an item out because its state is unknown: it goes in the "Not in any state" box, where someone sees it.
39
+ - Do not mark every state `human` or `failed`: the one that needs a person no longer stands out.
40
+
41
+ Every state marked `human`: nothing stands out, and the tags say nothing.
42
+ ```tsx
43
+ import { StateMachine } from "@slashsuite/ui-react";
44
+
45
+ <StateMachine
46
+ label="Article flow"
47
+ states={[
48
+ { id: "draft", label: "Draft", kind: "human", owner: "writer" },
49
+ { id: "review", label: "In review", kind: "human", owner: "editor" },
50
+ { id: "published", label: "Published", kind: "human" },
51
+ ]}
52
+ transitions={[
53
+ { from: "draft", to: "review", event: "submit" },
54
+ { from: "review", to: "draft", event: "send back" },
55
+ { from: "review", to: "published", event: "approve" },
56
+ ]}
57
+ items={[{ id: "A-12", label: "Spring launch post", state: "review" }]}
58
+ />
59
+ ```
60
+
61
+ ### Accessibility
62
+ - The drawing is an image named by `label`, with the count of states and transitions; the box round it is a group named by `label`, and takes the keyboard focus so a machine that scrolls can be scrolled with the arrow keys.
63
+ - Each dot is named by its item's label and its state (`Fix the login, in Review`), and takes the focus; one with `href` is a link. A box with more than nine shows a `+N` button that shows the rest.
64
+ - A visually hidden list after it carries every state, its tags and the transitions out of it, as `FlowDiagram`'s does.
65
+ - With reduced motion a dot moves to its new state at once, with no run.
66
+
67
+ ### Props
68
+ ### StateMachine
69
+ A state machine, drawn, with the things moving through it: each state a box, each transition an arrow named by its event, laid out like a `FlowDiagram`. A state's `kind` sets its look and a tag that says it: `human` takes the warn tone, `failed` the danger tone, `terminal` is muted, and `initial` is tagged start. Its `owner` is a tag beside it. Each of the `items` is a coloured dot with its short `id`, in the box of its `state`, which counts them; a box shows up to nine and a `+N` for the rest. The dot's name and tooltip is its full `label`, and with an `href` it is a link. An item whose state is not in the machine goes in a box of its own, "Not in any state", so nothing is dropped. When an item's state changes, its dot runs along the arrow between the two (straight across when there is none); with reduced motion it moves at once. `active` rings the one state that is current. `fromXState` makes `states` and `transitions` from an xstate machine.
70
+ - active: string. The `id` of the one state to ring as current.
71
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
72
+ - items: readonly StateMachineItem[] (default []). The things in the machine, each in the state its `state` names.
73
+ - label: string (required). What the machine is: its accessible name.
74
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
75
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
76
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
77
+ - states: readonly StateMachineState[] (required). The states, each with a unique `id`.
78
+ - transitions: readonly StateMachineTransition[] (required). The moves between them. One whose `from` or `to` is not a state is not drawn.
79
+
80
+ ### Types
81
+ - StateMachineDefinition: `{ states: readonly StateMachineState[]; transitions: readonly StateMachineTransition[] }`. The machine: its states and the transitions between them. `fromXState` makes one from an xstate machine.
82
+ - StateMachineState: `{ id: string; label: string; kind?: StateMachineKind; owner?: string }`. One state: its `id` (what a transition's `from` and `to` and an item's `state` name), its `label`, its `kind`, and the role that `owner`s it.
83
+ - StateMachineKind: `"initial" | "normal" | "human" | "terminal" | "failed"`. What a state is: `initial` (where things start), `normal`, `human` (waiting on a person), `terminal` (done, nothing leaves it) or `failed` (stopped on an error).
84
+ - StateMachineTransition: `{ from: string; to: string; event?: string }`. One move between states, with the `event` that makes it, shown on the arrow.
85
+ - StateMachineItem: `{ id: string; label: string; state: string; href?: string }`. A thing in the machine: its short `id` (a ref, shown by its dot), its full `label` (the dot's name and tooltip), the `state` it is in, and an optional `href` its dot links to.
86
+ - XStateMachineLike: `{ id?: string | undefined; initial?: string | { target: string; } | undefined; states?: Record<string, XStateNodeConfig> | undefined; } | { config: { id?: string | undefined; initial?: string | { target: string; } | undefined; states?: Record<string, XStateNodeConfig> | undefined; }; }`. A machine's config, or what `setup(…).createMachine(config)` returns (it keeps it as `config`).
87
+ - XStateNodeConfig: `{ id?: string; type?: string; meta?: Record<string, unknown>; on?: Record<string, XStateTransitionConfig | readonly XStateTransitionConfig[]>; always?: XStateTransitionConfig | readonly XStateTransitionConfig[]; after?: Record<string, XStateTransitionConfig | readonly XStateTransitionConfig[]>; invoke?: { onDone?: XStateTransitionConfig | readonly XStateTransitionConfig[]; onError?: XStateTransitionConfig | readonly XStateTransitionConfig[] } | readonly { onDone?: XStateTransitionConfig | readonly XStateTransitionConfig[]; onError?: XStateTransitionConfig | readonly XStateTransitionConfig[] }[]; states?: Record<string, XStateNodeConfig> }`. The part of an xstate v5 state node `fromXState` reads: its `id`, `type` and `meta`, and the ways it moves on (`on`, `always`, `after`, and each `invoke`'s `onDone` and `onError`). Typed by shape, so the package does not depend on xstate.
88
+ - XStateTransitionConfig: `string | { target?: string | readonly (string | undefined)[] | undefined; meta?: Record<string, unknown> | undefined; } | undefined`. One transition: a target, or `{ target, meta }`, or a list of them (the first that passes its guard).
89
+ - XStateStateInput: `{ id: string; node: XStateNodeConfig; state: StateMachineState }`. What `fromXState` makes of one state node before `state` adjusts it.
90
+
91
+ ### Functions
92
+ - fromXState: `fromXState(machine: XStateMachineLike, options?: { state?: ((input: XStateStateInput) => StateMachineState) | undefined; }): StateMachineDefinition`. Turns an xstate v5 machine, or its config, into `states` and `transitions`: one state per top-level state node, one transition per target in its `on`. The package does not depend on xstate.
93
+ ```tsx
94
+ <StateMachine label="Orders" {...fromXState(orderMachine)} items={orders} />
95
+ ```
@@ -0,0 +1,112 @@
1
+ ## Status pages
2
+
3
+ Group: Pages
4
+
5
+ When to use: A route that cannot show its content: use the status page that names the state.
6
+
7
+ ### Use instead
8
+ - Callout (callout.md): Only a part of the page failed, and the rest of it shows.
9
+ - EmptyState (empty-state.md): The page works and has nothing in it yet.
10
+
11
+ ### The one right way
12
+ A missing page is `NotFound`: the reader needs a way home, and a retry would load the same nothing.
13
+ ```tsx
14
+ import { NotFound } from "@slashsuite/ui-react";
15
+
16
+ <NotFound />
17
+
18
+ ```
19
+
20
+ ### Do
21
+ - Pick the page by the state: `NotFound` for a missing page (404), `Forbidden` for a page the reader may not see (403), `ErrorPage` for a failure (500), `Offline` for no connection, `Maintenance` for a site that is down on purpose.
22
+ - The copy is fixed, so every site reads the same. Change the heading with `title` and the text with children only when the state needs a specific line.
23
+ - Every page but `Maintenance` links "Back to home", to `LinkProvider`'s `home` (`/` by default). `Maintenance` has none: home is the site that is down.
24
+ - Say where home is once, on the provider (`<LinkProvider home="/app">`).
25
+ - `onRetry` adds a "Try again" button on `ErrorPage` and `Offline`; `actions` replaces it with the buttons that fit, and the home link turns outline beside them.
26
+ - Another button goes in `actions`: it comes first, and "Back to home" stays beside it. `homeLabel` (default "Back to home"), `retryLabel` (default "Try again") and `ErrorPage`'s `detailLabel` (default "Error") only reword the built-in ones, for an app in another language.
27
+ - A part of a page that failed to load is not an `ErrorPage`: it is a `Callout tone="danger"` with a title and a retry `Button` in its `actions`, and the rest of the page stays.
28
+ - Render one as the content of an `AppShell`, or on its own in a `Container`.
29
+
30
+ ### Don't
31
+ - Do not offer a retry where trying again cannot help.
32
+ - Never put a stack trace in `detail`.
33
+ - Never wire a home link on each page; a page takes no home prop.
34
+
35
+ `ErrorPage` with a retry for a missing page promises that trying again helps, and it does not.
36
+ ```tsx
37
+ import { ErrorPage } from "@slashsuite/ui-react";
38
+
39
+ <ErrorPage onRetry={() => {}} />
40
+
41
+ ```
42
+
43
+ A stack trace shows the reader your internals and buries the one line they can act on.
44
+ ```tsx
45
+ import { ErrorPage } from "@slashsuite/ui-react";
46
+
47
+ <ErrorPage
48
+ detail={
49
+ "TypeError: Cannot read properties of undefined\n at loadBuild (build.ts:42:9)\n" +
50
+ " at async handler (route.ts:17:3)"
51
+ }
52
+ onRetry={() => {}}
53
+ />
54
+ ```
55
+
56
+ ### Accessibility
57
+ - Each page is a `CenteredLayout` card, so the title is the page's `h1` and the copy under it is a paragraph.
58
+ - `detail` is shown in a `CodeBlock` labelled "Error".
59
+ - The buttons are a `Button` and a `Button` with `href`, with their own focus rings; "Back to home" is a real link.
60
+ - The pages do not set an HTTP status; send the 404, 403 or 500 from the server.
61
+
62
+ ### Props
63
+ ### NotFound
64
+ 404: the page is not there. `numeral` draws a large "404" above the title, for a site whose 404 is a designed page; the digits are fixed. Off, the page is the title and copy alone.
65
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
66
+ way to add a button; `homeLabel` and `retryLabel` only reword the built-in ones.
67
+ - children: ReactNode. Replaces the default body copy.
68
+ - homeLabel: string (default Back to home). The button to the `LinkProvider`'s `home`, for an app in another language.
69
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
70
+ - numeral: boolean (default false). Draws a large "404" above the title. Off by default. The digits are fixed: there is no text prop.
71
+ - title: ReactNode. Replaces the default heading.
72
+
73
+ ### Forbidden
74
+ 403: signed in, or not, but not allowed here. The page for a route that exists and the reader may not see; a route that is not there is a `NotFound`.
75
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
76
+ way to add a button; `homeLabel` and `retryLabel` only reword the built-in ones.
77
+ - children: ReactNode. Replaces the default body copy.
78
+ - homeLabel: string (default Back to home). The button to the `LinkProvider`'s `home`, for an app in another language.
79
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
80
+ - title: ReactNode. Replaces the default heading.
81
+
82
+ ### ErrorPage
83
+ 500 or any failure. `detail` is the error text, shown in a `CodeBlock` under the copy; pass it only where a reader may see it (a request id, a message), never a stack trace. `onRetry` adds a "Try again" button, unless `actions` replaces it.
84
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
85
+ way to add a button; `homeLabel` and `retryLabel` only reword the built-in ones.
86
+ - children: ReactNode. Replaces the default body copy.
87
+ - detail: string. The error text, in a `CodeBlock` under the copy: a request id or a message a reader may see, never a stack trace.
88
+ - detailLabel: string (default Error). The name of the `detail` block, for an app in another language.
89
+ - homeLabel: string (default Back to home). The button to the `LinkProvider`'s `home`, for an app in another language.
90
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
91
+ - onRetry: () => void. Adds a "Try again" button that calls it, unless `actions` replaces the button.
92
+ - retryLabel: string (default Try again). The button `onRetry` adds, for an app in another language.
93
+ - title: ReactNode. Replaces the default heading.
94
+
95
+ ### Offline
96
+ The device has no connection. `onRetry` adds a "Try again" button, unless `actions` replaces it.
97
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
98
+ way to add a button; `homeLabel` and `retryLabel` only reword the built-in ones.
99
+ - children: ReactNode. Replaces the default body copy.
100
+ - homeLabel: string (default Back to home). The button to the `LinkProvider`'s `home`, for an app in another language.
101
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
102
+ - onRetry: () => void. Adds a "Try again" button that calls it, unless `actions` replaces the button.
103
+ - retryLabel: string (default Try again). The button `onRetry` adds, for an app in another language.
104
+ - title: ReactNode. Replaces the default heading.
105
+
106
+ ### Maintenance
107
+ The site is down on purpose and will be back: the page for planned downtime, such as an upgrade. A failure is an `ErrorPage`, and no connection is `Offline`. It has no "Back to home": home is the site that is down.
108
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
109
+ way to add a button; `homeLabel` and `retryLabel` only reword the built-in ones.
110
+ - children: ReactNode. Replaces the default body copy.
111
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
112
+ - title: ReactNode. Replaces the default heading.
@@ -0,0 +1,54 @@
1
+ ## Stepper
2
+
3
+ Group: Navigation
4
+
5
+ When to use: A flow of a few steps taken in order, such as checkout or setting up an account, where the reader should see what is done and what is left.
6
+
7
+ ### The one right way
8
+ A few short step names, the current one given: the reader sees what is done and what is left.
9
+ ```tsx
10
+ import { Stepper } from "@slashsuite/ui-react";
11
+
12
+ <Stepper
13
+ label="Checkout progress"
14
+ steps={["Cart", "Shipping", "Payment", "Review"]}
15
+ current={2}
16
+ />
17
+ ```
18
+
19
+ ### Do
20
+ - Give every step's name in order, one or two words each, and `current`, the step in progress, from 1. Past the last step, every step is done.
21
+ - `label` names the list ("Checkout progress"), and `doneLabel` is the word a screen reader hears after a done step, for an app in another language.
22
+ - It shows progress and does not navigate: the flow's own buttons move between steps.
23
+ - Put it above the step's form, once per page.
24
+
25
+ ### Don't
26
+ Sentences for step names crowd the row and hide where the reader is.
27
+ ```tsx
28
+ import { Stepper } from "@slashsuite/ui-react";
29
+
30
+ <Stepper
31
+ label="Checkout progress"
32
+ steps={[
33
+ "Check the items in your cart",
34
+ "Tell us where to send it",
35
+ "Pay with a card or a transfer",
36
+ "Read it all back once more",
37
+ ]}
38
+ current={2}
39
+ />
40
+ ```
41
+
42
+ ### Accessibility
43
+ - An ordered list named by `label`; the current step has `aria-current="step"`.
44
+ - A done step says so in words after its name ("Cart (done)"), not only with its tick; the numbers, the tick and the lines between steps are `aria-hidden`.
45
+ - The current step is told apart by more than colour: its marker is outlined and its name is medium weight.
46
+
47
+ ### Props
48
+ ### Stepper
49
+ Where the reader is in a fixed run of steps (checkout, a setup flow): each step done, current or still to come. An ordered list named by `label`, across from `sm` and down on a phone. `current` is the step in progress, from 1; past the last step every step is done. It shows progress and does not navigate: the flow's own buttons move between steps.
50
+ - current: number (required). The step in progress, from 1. Past the last step, every step is done.
51
+ - doneLabel: string (default done). What a screen reader hears after a done step's name, for an app in another language.
52
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
53
+ - label: string (required). The list's accessible name: "Checkout progress".
54
+ - steps: readonly string[] (required). The steps' names, in order: "Cart", "Shipping", "Payment", "Review". Short, one or two words.