@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,152 @@
1
+ ## ListLayout
2
+
3
+ Group: Page layouts
4
+
5
+ When to use: An index of quotes, builds, members or any other collection; a single record is `DetailLayout`.
6
+
7
+ ### The one right way
8
+ `filters` sit under the header, then the rows: one `Card` per item.
9
+ ```tsx
10
+ import {
11
+ Button,
12
+ ButtonGroup,
13
+ Card,
14
+ Fieldset,
15
+ ListLayout,
16
+ Pill,
17
+ Text,
18
+ } from "@slashsuite/ui-react";
19
+
20
+ <ListLayout
21
+ title="Quotes"
22
+ description="Every quote you have sent."
23
+ actions={<Button>New quote</Button>}
24
+ filters={
25
+ <Fieldset label="Status">
26
+ <ButtonGroup>
27
+ <Button variant="outline" size="sm" pressed>
28
+ All
29
+ </Button>
30
+ <Button variant="outline" size="sm" pressed={false}>
31
+ Sent
32
+ </Button>
33
+ </ButtonGroup>
34
+ </Fieldset>
35
+ }
36
+ >
37
+ <Card title="Naledi Mokoena" status={<Pill tone="positive">Accepted</Pill>}>
38
+ <Text>Q-1042 · R 1 240 / mo</Text>
39
+ </Card>
40
+ <Card title="Pieter van Wyk" status={<Pill tone="neutral">Sent</Pill>}>
41
+ <Text>Q-1041 · R 860 / mo</Text>
42
+ </Card>
43
+ </ListLayout>
44
+ ```
45
+
46
+ ### Full page
47
+ A whole list page: the shell with its brand and nav, then the layout with its filters and rows.
48
+ ```tsx
49
+ import {
50
+ AppShell,
51
+ Button,
52
+ ButtonGroup,
53
+ Card,
54
+ Fieldset,
55
+ ListLayout,
56
+ Tabs,
57
+ Text,
58
+ } from "@slashsuite/ui-react";
59
+
60
+ <AppShell
61
+ brand={<a href="#">Hack Cove</a>}
62
+ nav={
63
+ <Tabs
64
+ label="Main"
65
+ items={[
66
+ { label: "Quotes", href: "#quotes", selected: true },
67
+ { label: "Clients", href: "#clients" },
68
+ ]}
69
+ />
70
+ }
71
+ >
72
+ <ListLayout
73
+ title="Quotes"
74
+ description="Every quote you have sent."
75
+ actions={<Button>New quote</Button>}
76
+ filters={
77
+ <Fieldset label="Status">
78
+ <ButtonGroup>
79
+ <Button variant="outline" size="sm" pressed>
80
+ All
81
+ </Button>
82
+ <Button variant="outline" size="sm" pressed={false}>
83
+ Sent
84
+ </Button>
85
+ <Button variant="outline" size="sm" pressed={false}>
86
+ Accepted
87
+ </Button>
88
+ </ButtonGroup>
89
+ </Fieldset>
90
+ }
91
+ >
92
+ <Card title="Naledi Mokoena" titleStyle="name">
93
+ <Text>Q-1042 · R 1 240 / mo</Text>
94
+ </Card>
95
+ <Card title="Pieter van Wyk" titleStyle="name">
96
+ <Text>Q-1041 · R 860 / mo</Text>
97
+ </Card>
98
+ </ListLayout>
99
+ </AppShell>
100
+ ```
101
+
102
+ ### Do
103
+ - Put the page's title, `description` and primary `actions` in the header props; `breadcrumbs` and `tabs` go there too.
104
+ - `filters` sit between the header and the list: a `Fieldset` of pressed-toggle `Button`s in a `ButtonGroup`.
105
+ - The items are the `children`, one `Card` per item, or a `Table`; the layout spaces them.
106
+ - Give `empty` an `EmptyState` that says what is missing and what to do next: it shows when there are no children, and with no `empty` an empty list is a blank page.
107
+
108
+ ### Don't
109
+ - Do not build the header and the list by hand with `PageHeader` and `Stack`: the layout is the one right header, filters and list.
110
+
111
+ A one-off header and stack drifts from every other list page; `ListLayout` is the one header, filters and list.
112
+ ```tsx
113
+ import { Card, PageHeader, Stack, Text } from "@slashsuite/ui-react";
114
+
115
+ <Stack>
116
+ <PageHeader title="Quotes" description="Every quote you have sent." />
117
+ <Card title="Naledi Mokoena">
118
+ <Text>Q-1042 · R 1 240 / mo</Text>
119
+ </Card>
120
+ </Stack>
121
+ ```
122
+
123
+ A muted line as `empty` says nothing is here and offers no way forward: a dead end.
124
+ ```tsx
125
+ import { ListLayout, Text } from "@slashsuite/ui-react";
126
+
127
+ <ListLayout
128
+ title="Quotes"
129
+ description="Every quote you have sent."
130
+ empty={<Text tone="muted">No quotes yet.</Text>}
131
+ />
132
+ ```
133
+
134
+ ### Accessibility
135
+ - The title is the page's `h1`.
136
+ - `filters` and `children` render as given, so each filter group keeps its own `fieldset` and legend.
137
+ - `data-*` and `aria-*` go on the list's wrapper.
138
+
139
+ ### Props
140
+ ### ListLayout
141
+ A list page: header, an optional `filters` slot, then the list, or `empty` when there are no children. While `loading` it owns the wait and passes it to everything inside, the header too. With no children yet it draws a card of row bones, never `empty`.
142
+ - actions: ReactNode. Right of the title on `sm` and up, below it on a phone.
143
+ - breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
144
+ - description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
145
+ - empty: ReactNode. Shown in place of `children` when there are none (no rows, an empty array, `null`): an `EmptyState`.
146
+ - filters: ReactNode. A row between the header and the list, e.g. a `Fieldset` of chips or an `Input type="search"`.
147
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
148
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
149
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
150
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
151
+ - tabs: ReactNode. A `Tabs` (or similar) under the title.
152
+ - title: ReactNode (required). The page's `h1`.
@@ -0,0 +1,119 @@
1
+ ## ListRow
2
+
3
+ Group: Data
4
+
5
+ When to use: A short list where each row opens something, toggles a section or holds its own buttons.
6
+
7
+ ### Use instead
8
+ - Table (table.md): The records are read and compared across columns.
9
+ - KeyValueList (key-value-list.md): One record's fields, each label beside its value.
10
+ - MetaList (meta-list.md): A few facts inline on one line, not rows to open.
11
+
12
+ ### The one right way
13
+ Rows sit in a `Stack divided` in a `Card flush`: the Stack draws the line between them.
14
+ ```tsx
15
+ import { Card, ListRow, Stack } from "@slashsuite/ui-react";
16
+
17
+ <Card flush>
18
+ <Stack divided>
19
+ <ListRow trailing="R 9 500">Rent</ListRow>
20
+ <ListRow trailing="R 1 850">Transport</ListRow>
21
+ <ListRow href="#bills" trailing="3">
22
+ Bills
23
+ </ListRow>
24
+ </Stack>
25
+ </Card>
26
+ ```
27
+
28
+ ### Do
29
+ - Put the rows in a `Stack divided` in a `Card flush`: the Stack draws the line between rows. `trailing` is a value, a count or a `Pill`; `leading` is an `Avatar` or an icon.
30
+ - A row with `onClick` is a button; with `href` it is a link. `external` opens a link in a new tab.
31
+ - `expanded` makes the row the header of a collapsible section: you own the state and the section, and pass `aria-controls` to name it.
32
+ - `selected` marks the one row whose detail is open; set it on a single row of a list. `focused` marks the row the keyboard cursor is on in a list you move through yourself: an inset accent ring, apart from `selected`'s fill.
33
+ - A button row (`onClick`) or a link row (`href`) can hold its own link or button in `trailing`: it sits above the row's button or link and takes its own click, with no class from you, so a row that selects can still carry a "View" link to its page. A row with no `href` and no `onClick` has no action of its own: its buttons go in `actions`, after `trailing`. They are always shown: an action that appears only on hover is one a touch or keyboard user cannot find. A long list keeps one action per row in view and the rest in a `Menu`.
34
+ - A row's own link or button goes in `trailing`, never in the label. `size="sm"` is the dense padding for a list that must fit more rows, `size="lg"` the roomy one for a short list of big targets; `md` is the default.
35
+ - A compact bordered list for read-only data, such as the lines of a split, is a `Card flush` around rows with no action at `size="sm"` in a `Stack divided`, with the amount in `trailing`. There is no separate part: a row with no action has no hover fill and no click target.
36
+ - `stripe` marks a row's status with a stripe on its leading edge, as a `Table` row's does; name the status in the row's words too. `leadingWidth="thumbnail"` gives a picture a fixed width, a step narrower on a phone (a screen narrower than `sm`), where `trailing` moves under the label so the label keeps its room.
37
+
38
+ ### Don't
39
+ - Do not add your own indent or a wrapper around the row.
40
+ - Do not lay out records with several columns to compare as rows: that is a `Table`.
41
+
42
+ Rows in a Card that is not `flush` sit inside its padding, so the hover fill stops short of the edges and the lines do not run across.
43
+ ```tsx
44
+ import { Card, ListRow, Stack } from "@slashsuite/ui-react";
45
+
46
+ <Card>
47
+ <Stack divided>
48
+ <ListRow trailing="R 9 500">Rent</ListRow>
49
+ <ListRow trailing="R 1 850">Transport</ListRow>
50
+ </Stack>
51
+ </Card>
52
+ ```
53
+
54
+ A row that silently ignores its click leaves the person tapping it again.
55
+ ```tsx
56
+ import { Card, ListRow, Stack } from "@slashsuite/ui-react";
57
+
58
+ <Card flush>
59
+ <Stack divided>
60
+ <ListRow onClick={() => undefined} trailing="R 1 850">
61
+ Rent
62
+ </ListRow>
63
+ <ListRow onClick={() => undefined} trailing="R 640">
64
+ Water
65
+ </ListRow>
66
+ </Stack>
67
+ </Card>
68
+ ```
69
+
70
+ ### Accessibility
71
+ - A button row is a `<div>` with a native `<button type="button">` stretched over it, named by the label alone; a link row is a `<div>` with a real link stretched over it, named by the whole row; a row with no `href` and no `onClick` is a plain `<div>` with no click target.
72
+ - `selected` sets `aria-current="true"` on the row.
73
+ - `expanded` sets `aria-expanded` and draws a chevron, which is hidden from assistive tech.
74
+ - A button or link row has a focus ring from the component; a button row's `disabled` fades the row and disables its button, so a tap on the row itself does nothing; a link or button in `trailing` still works.
75
+ - A button row with `disabledReason` fades and its button is `aria-disabled`, still in the tab order; a click, Enter and Space do nothing, and the reason shows as a tooltip on hover, keyboard focus and a tap, read out as its description (the native `title` without CSS anchor positioning).
76
+ - A static row's `actions` are always shown, never hidden until hover.
77
+ - A `stripe` is drawn only, hidden from assistive tech: the row's words say the status.
78
+
79
+ ### Props
80
+ ### ListRow
81
+ A full-width row that runs `onClick` (or, with `href`, opens a link) with a hover fill, a left-aligned label and `trailing` content at the far end. The row is a `<div>` with its `<button>` or link stretched over it, so a tap anywhere on the row runs it; a `TextLink`, `Button` or `Checkbox` in the row (in `trailing`, say a "View" link on a row that selects) sits above it and is clickable on its own. A button row's button is named by the label alone. With `expanded` it is the header of a collapsible section: `aria-expanded` and a chevron. Rows sit in a `Card flush`, in a `Stack divided` that draws the line between them. `secondary` is a second, muted line under the label. `leading` is content before the label (`leadingWidth="thumbnail"` gives it a fixed picture width), `selected` marks the row in view, `focused` the one the keyboard cursor is on and `highlighted` fills the row a list follows (`onPointerEnter`, `onPointerLeave` and `onFocus` reach every form; on a button or linked row the pointer handlers go on the row itself). The label is a `<div>`, so it can hold block content (a name over a path). A row with no `href` and no `onClick` is a plain `<div>` with no action of its own, for one that holds its own buttons: `actions` follow `trailing`, always shown, so a touch, a keyboard and a pointer find them alike. Such a row also takes a `panel`, content under the row that starts where the label does (a conversation that opens under its chat); in a `Stack divided` the line sits above the whole row, panel included. Inside a row a `Stack` is `xs` apart, and a `sm` row makes the buttons in it `sm`. While `loading` an empty label is a bone, and what the row holds waits with it.
82
+ - actions: ReactNode. Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`, a `Menu`. Always
83
+ shown: an action that shows only on hover is one a touch or keyboard user cannot find.
84
+ - disabledReason: string. Why the row cannot be pressed: it fades, `aria-disabled` and focusable, the reason its tooltip.
85
+ - expanded: boolean. Makes the row a collapsible header: sets `aria-expanded` and shows a chevron that turns down
86
+ when open. The caller owns the state and the section; pass `aria-controls` to name it.
87
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
88
+ - focused: boolean. Marks the row the keyboard cursor is on, for a list moved with the arrow keys or `j`/`k` while
89
+ focus stays on the list: the focus ring, drawn inside the row. It says nothing to a screen
90
+ reader (move real focus for that) and combines with `selected`.
91
+ - highlighted: boolean. Marks the row a list follows with the pointer and the keyboard alike (set it from
92
+ `onPointerEnter` and `onFocus`): a fill one step deeper than hover, so it shows on a white card
93
+ and on a tinted panel alike. It is the only fill a static row takes. `selected` wins.
94
+
95
+ Clear it from `onPointerLeave`.
96
+ - href: string. Makes the row a link to this URL; an in-app path goes through the app's `LinkProvider`.
97
+ - leading: ReactNode. Content before the label: an Avatar, a thumbnail, an icon.
98
+ - leadingWidth: "thumbnail". A fixed width for `leading`, for a thumbnail (an `<img>` fills it), so the labels of rows with
99
+ and without a picture still line up. Without it `leading` is as wide as its content.
100
+
101
+ For a row that shows a screenshot.
102
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
103
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
104
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
105
+ - onClick: MouseEventHandler<HTMLButtonElement> | MouseEventHandler<HTMLAnchorElement>. What the row does when pressed: it makes the row a button.
106
+ - onPointerEnter: PointerEventHandler<HTMLDivElement>. On the row, not its link or button, so a link or button in the row does not count as entering it.
107
+ - onPointerLeave: PointerEventHandler<HTMLDivElement>. On the row, not its link or button, so a link or button in the row does not count as leaving it.
108
+ - panel: ReactNode. Content under the row, lined up with the label rather than the row's edge (past `leading`): the
109
+ panel of a row that opens in place, such as a conversation under its chat. It sits inside the
110
+ row, so the fill and a `Stack divided` line cover it too. Only a row that is neither a
111
+ button nor a link takes it.
112
+ - secondary: ReactNode. A second, muted line under the label (a date, a note), like `TableCell`'s `secondary`.
113
+ - selected: boolean. Marks the row in view, the one whose detail is open: an accent fill and `aria-current="true"`.
114
+ Set it on one row of a list.
115
+ - size: "sm" | "md" | "lg" (default md). `sm` is dense padding, `lg` one step roomier than `md`. A `Button`, `IconButton` or `Pill` in a
116
+ `sm` row with no `size` of its own is `sm` too.
117
+ - stripe: "muted" | "info" | "positive" | "warn" | "danger" | "accent". The row's status, as a stripe on its leading edge in this tone, as a `Table` row's `stripe`. The
118
+ colour says it to the eye only, so the row's words say it too (a `Pill`, a status in `trailing`).
119
+ - trailing: ReactNode. Content at the far end of the row: a value, a count, a Pill.
@@ -0,0 +1,69 @@
1
+ ## Loading
2
+
3
+ Group: Feedback
4
+
5
+ When to use: Data that is on its way: give the layout or the part `loading` and keep the tree it draws with data.
6
+
7
+ ### The one right way
8
+ Give the part `loading` and the same tree it draws with data: the captions it knows stay, and a bone stands where each figure will land. A button lands the data here; an app passes its query's pending flag.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import { Button, Card, KeyValue, KeyValueList, Stack } from "@slashsuite/ui-react";
12
+
13
+ function Example() {
14
+ const [vat, setVat] = useState<string | undefined>(undefined);
15
+ return (
16
+ <Stack gap="md">
17
+ <Button variant="outline" onClick={() => setVat(vat === undefined ? "R 2 400" : undefined)}>
18
+ {vat === undefined ? "Land the data" : "Wait again"}
19
+ </Button>
20
+ <Card>
21
+ <KeyValueList loading={vat === undefined} loadingLabel="Loading the quote">
22
+ <KeyValue label="Customer">{vat && "Cove Hardware"}</KeyValue>
23
+ <KeyValue label="Lines">{vat && "R 16 000"}</KeyValue>
24
+ <KeyValue label="VAT">{vat}</KeyValue>
25
+ </KeyValueList>
26
+ </Card>
27
+ </Stack>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ### Do
33
+ - Set `loading` on the page layout, or on the one part that waits, and render the same tree you render with data: `<StatTile loading={q.isPending} label="Revenue" value={q.data?.revenue} />`. There is no separate skeleton component to keep in step.
34
+ - One rule for every part: what it has is drawn, and an empty slot (`null`, `undefined`, `false`, an empty string or array) is a bone of that slot's shape. A caption you know stays; the figure you are fetching is a bone. A part whose value is a number (`Badge`, the bars and charts) is all bone while loading, since 0 is a value.
35
+ - A part with nothing in it draws a fixed set of bones of its children's shape: a `ListLayout` with no records a `Card` of three row bones, a `CardGrid` one `Card` of bones per column (three for `auto`), a `Table` whose `TableBody` has no rows five rows with one bone per column, a `Card` three lines of text and a `flush` `Card` three `ListRow` bones, a `Timeline` three items, a `KeyValueList` three rows, a `MetaList` three items, an `AvatarStack` three avatars, a `Legend` three entries, a paragraph three lines and a heading one. There is no count to set.
36
+ - A part's own `loading` wins; left out, it takes the nearest loading layout's or part's, so one `loading` on a layout reaches everything inside. `loading={false}` opts a part out inside a loading page.
37
+ - Loading beats empty: while `loading`, an empty slot is a bone, never the `empty` state.
38
+ - Three words, three meanings: `loading` is data not here yet (a skeleton); `busy` is an action in flight on a control (`Button`, `Switch`, `ChatComposer`); `streaming` is content arriving piece by piece (`ChatMessage`). `NavigationProgress loading` is the bar for a page change, not a skeleton.
39
+ - Take `loading`. Page layouts, each the owner of its page's wait, passing it to everything inside, the header too: `PageHeader`, `ListLayout`, `DetailLayout`, `FormLayout`, `ProseLayout`, `ArticleLayout`, `SidebarLayout` (its canvas; the rail is navigation), `DocsLayout` (its article; the nav, contents and pager are navigation), `FullBleedLayout`, `CenteredLayout` and `CardGrid`. Text: `Text`, `Lead`, `Caption`, `Overline`, `Display`, `PageHeading`, `SectionHeading`, `SubsectionHeading` and `Markdown`. Data and content: `StatTile`, `KeyValueList`, `KeyValue`, `Badge`, `Pill`, `MetaList`, `Card`, `Table` and `TableCell` (`TableHead`, `TableBody`, `TableRow`, `TableFoot`, `TableGroupRow` and `TableHeaderCell` wait with their table), `ListRow`, `Timeline`, `TimelineItem`, `Avatar`, `AvatarStack`, `Image`, `RegionFrame`, `MediaTile`, `Price`, `ProductTile`, `ProgressBar`, `SplitBar`, `StackedBar`, `Legend`, `TrendChart`, `FlowDiagram` and `StateMachine`. Forms: `Field` and `FormRowField` draw their label and a bone the height of their control (read from the density around them, so a `sm` card's is `sm`), and `Checkbox`, `Switch`, `RadioGroup` with `Radio`, `DateField`, `DateTimeField`, `NumberField` and `Combobox` draw their labels with the box, track, circles or field as bones.
40
+ - Draw as themselves, by design. Actions and navigation are known before the data: `Button`, `ButtonGroup`, `IconButton`, `CopyButton`, `CopyLine`, `ColourSchemeToggle`, `Menu`, `Popover`, `Tabs`, `SegmentedControl`, `Breadcrumbs`, `Pagination`, `Stepper`, `TextLink`, `TableOfContents`, `SiteSearch`, `CartButton` and `TableExpandCell`; an action that needs the data says why it waits with `disabledReason`. Bare controls hold the caller's own state, and a fetched value waits in its `Field` or `FormRowField`: `Input`, `Select`, `Slider`, `Textarea`, `FileDrop`, `DateRangePicker`, `Fieldset`, `InlineEdit` and `TableEditCell`. Frames and primitives have no data of their own, and what they hold draws its own bones: `AppShell`, `AppShellBrand`, `Container`, `Stack`, `Section`, `CardGridRow`, `Cluster`, `ClusterGrow`, `SideColumn`, `StickyBar`, `Show`, `ScrollStrip`, `FormGrid`, `FormRow`, `Divider`, `Icon`, `Kbd`, `Code`, `Mark`, `Prose`, `BulletList`, `BulletItem`, `Steps`, `Step`, `Hero`, `PromoBanner`, `CallToAction`, `SiteFooter`, `Callout`, `EmptyState`, `Disclosure` and `LinkProvider`. Overlays open on an action and their contents draw bones: `Dialog`, `Drawer`, `BottomSheet`, `Lightbox`, `ConfirmDialog`, `FieldDialog` and `ToastRegion`. Static copy and authored code: `ErrorPage`, `NotFound`, `Forbidden`, `Offline`, `Maintenance`, `CodeBlock`, `CodeExample` and `ColourSwatch` (a value the page already has). In flight on their own terms: `ChatThread`, `ChatMessage` (`streaming`), `ChatComposer` (`busy`), `NavigationProgress`, `PageFade`, `Morph`, `Video` (the browser's poster), `Audio` (the browser's player) and `EmbedFrame` (`status`, since the embed loads on its own). `OutlineRegion` is drawn over its `RegionFrame` and waits with it. `SortableList`, `SortableItem` and `SortableSection` need their items to reorder; `ListRow` bones stand in.
41
+
42
+ ### Don't
43
+ - Do not build a grey box by hand or write a "Loading..." `Text`: it drops the captions the reader could already see, and the page jumps when the data lands.
44
+ - Do not hold a skeleton on screen for a minimum time or behind a delay: the part draws what `loading` says, the moment it says it.
45
+
46
+ A "Loading..." line drops every caption the reader could already see, and the page jumps when the rows arrive.
47
+ ```tsx
48
+ import { Card, Text } from "@slashsuite/ui-react";
49
+
50
+ <Card>
51
+ <Text tone="muted">Loading...</Text>
52
+ </Card>
53
+ ```
54
+
55
+ A page swapped for a "Loading..." line loses its header and actions, and jumps when the data lands.
56
+ ```tsx
57
+ import { Text } from "@slashsuite/ui-react";
58
+
59
+ <Text tone="muted">Loading quotes...</Text>
60
+
61
+ ```
62
+
63
+ ### Accessibility
64
+ - The part whose own `loading` is set is the owner: its root has `aria-busy="true"` and holds one visually hidden text, `loadingLabel` ("Loading" by default). Parts that inherit draw bones only, so one wait is one busy region and one announcement.
65
+ - Every bone is `aria-hidden`. A part keeps its role and accessible name while it loads: a heading is still its heading, a `Table` still its table named by its caption.
66
+ - Bones pulse only when the reader allows motion: under `prefers-reduced-motion: reduce` they are still.
67
+
68
+ ### Props
69
+
@@ -0,0 +1,51 @@
1
+ ## Markdown
2
+
3
+ Group: Text
4
+
5
+ When to use: Text that arrives as markdown, such as an agent's summary or a CMS article, shown on a page.
6
+
7
+ ### The one right way
8
+ `Markdown` renders headings, bullets and numbered lists, `**bold**`, links, pictures and tables, as React nodes and never as HTML.
9
+ ```tsx
10
+ import { Markdown } from "@slashsuite/ui-react";
11
+
12
+ <Markdown
13
+ md={
14
+ "## What I did\n- **HC-142** shipped the EmptyState\n- Fixed the Pill label wrap\n\n" +
15
+ "### Next\n1. Review the Steps copy\n2. Read [the ticket](https://example.com)"
16
+ }
17
+ />
18
+ ```
19
+
20
+ ### Do
21
+ - Pass the markdown as `md`. It renders `##` as a label heading, `###` as a subheading, lines starting `- ` or `* ` as bullets, `1. ` as a numbered list, `**bold**`, `[words](href)` as a `TextLink`, a line that is only `![alt](src)` as an `Image`, a GFM table as a `Table`, and plain paragraphs.
22
+ - A table is named by the heading above it; one with no heading is named by `tableLabel` (Table), so pass it in an app in another language.
23
+ - Nothing else is supported: no `#` title, code span, quote or HTML. Those show as plain text.
24
+ - The text becomes React nodes and never HTML, so untrusted text cannot inject markup. A link whose address is not a web, mail or phone address or a path on the site (a `javascript:` one) keeps its words and loses the link; a picture whose address is not a web, site or data-image one shows the placeholder.
25
+ - Text you write yourself is not markdown: use `Text`, `BulletList` and the heading components.
26
+
27
+ ### Don't
28
+ A `#` title, a code span, a quote or HTML is not supported: each shows as literal text.
29
+ ```tsx
30
+ import { Markdown } from "@slashsuite/ui-react";
31
+
32
+ <Markdown
33
+ md={"# What I did\n> Shipped the EmptyState\n\nRun `bun install`, then <b>restart</b>."}
34
+ />
35
+ ```
36
+
37
+ ### Accessibility
38
+ - `##` renders an `h2` and `###` an `h3`, bullets render a `ul` and numbers an `ol` with `li`s, bold a `strong` and a paragraph a `p`.
39
+ - The headings start at `h2`, so the page needs its own `h1` above.
40
+ - A link is underlined, since it sits in running text. A picture is named by its alt text, so write one.
41
+ - `aria-*` and `data-*` go on the root.
42
+
43
+ ### Props
44
+ ### Markdown
45
+ A small, safe Markdown renderer for notes and for rich text from a CMS: `## ` and `### ` headings, `- ` or `* ` bullets, `1. ` numbered lists, `**bold**`, `[links](href)`, a picture on a line of its own (`![alt](src)`), GFM tables and paragraphs. Text is rendered as React nodes, never as HTML. A link is a `TextLink` (an in-app path goes through `LinkProvider`) and is kept only if its address is a web, mail or phone address or a path on this site; any other (`javascript:`) keeps its words and drops the link. A picture is an `Image` in its own shape, and a table a `Table` named by the heading above it, or `tableLabel`. While `loading` with no `md` yet it draws a paragraph of bones. A `## ` heading is one level below the heading that holds the Markdown (an `h2` on the page, an `h3` in a `Section`, an `h4` in a titled `Card` there) and a `### ` one below that, never past `h6`, so the notes keep the page's outline.
46
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
47
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
48
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
49
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
50
+ - md: string | undefined (required). The Markdown source; while `loading`, none yet is a paragraph of bones.
51
+ - tableLabel: string (default Table). The name a table takes when no heading comes before it, for an app in another language.
@@ -0,0 +1,101 @@
1
+ ## MediaTile
2
+
3
+ Group: Content
4
+
5
+ When to use: A photo or video in a grid or a strip, that opens full size when it is picked: a status, a gallery, an attachment.
6
+
7
+ ### Use instead
8
+ - Image (image.md): The picture is only shown, with no label, click or remove.
9
+ - Video (video.md): The video plays in the page: the player.
10
+ - Lightbox (lightbox.md): One photo or video opens over the page, at full size.
11
+ - ProductTile (product-tile.md): The tile is a thing for sale, with its name and price.
12
+
13
+ ### The one right way
14
+ A thumbnail that opens a photo is a `MediaTile` with `onClick` that opens a `Lightbox`, which steps through the set.
15
+ ```tsx
16
+ import { useState } from "react";
17
+ import { Cluster, Lightbox, MediaTile } from "@slashsuite/ui-react";
18
+
19
+ function Example() {
20
+ const [at, setAt] = useState<number | null>(null);
21
+ const photo = at === null ? undefined : sampleScenes[at];
22
+ return (
23
+ <>
24
+ <Cluster>
25
+ {sampleScenes.map((scene, index) => (
26
+ <MediaTile
27
+ key={scene.src}
28
+ src={scene.src}
29
+ alt={scene.alt}
30
+ label="Anna"
31
+ caption={`09:1${index}`}
32
+ onClick={() => setAt(index)}
33
+ />
34
+ ))}
35
+ </Cluster>
36
+ {at !== null && photo && (
37
+ <Lightbox
38
+ label={photo.alt}
39
+ title="Anna"
40
+ caption={photo.caption}
41
+ onClose={() => setAt(null)}
42
+ onPrevious={at > 0 ? () => setAt(at - 1) : undefined}
43
+ onNext={at < sampleScenes.length - 1 ? () => setAt(at + 1) : undefined}
44
+ >
45
+ <img src={photo.src} alt={photo.alt} />
46
+ </Lightbox>
47
+ )}
48
+ </>
49
+ );
50
+ }
51
+ ```
52
+
53
+ ### Do
54
+ - `src` and `alt` are the thumbnail, cropped to `aspect` (portrait `3:4` by default; `natural` shows the picture whole at its own proportions, as a chat does) at `width` (`md`, 160px, by default; `full` fills a grid cell).
55
+ - `label` is a short line on the picture's bottom edge, on the same near-black scrim as the `Lightbox`, in every theme: who posted it, or "Earlier". `caption` is muted text under the picture, such as when.
56
+ - `video` draws a play mark; say it is a video in `alt` too. `badge` is a short word in the top corner on the same scrim, such as "New" or a count, and is part of the tile's name.
57
+ - `onRemove` adds a round remove button on the picture's corner, named "Remove" and `alt`: a photo attached to a form, until it is sent. It is its own button beside the tile's, so the tile can still open a `Lightbox`.
58
+ - `onClick` makes the whole tile one button. Open a `Lightbox` from it, and keep the open item in your own state. Without `onClick` the tile is a plain block.
59
+ - With no `src`, the tile shows the `Image` placeholder, so a tile that is only a label ("Earlier") needs no picture.
60
+ - A row of tiles that runs past the page is a `ScrollStrip`; a wrapping grid is a `CardGrid`.
61
+ - A picture that is only shown, with no label, click or remove, is an `Image`.
62
+
63
+ ### Don't
64
+ A bare `<img>` in a button has no shape, frame or label, and no placeholder when it fails to load.
65
+ ```tsx
66
+ <button type="button">
67
+ <img src={sampleScenes[0]?.src} alt={sampleScenes[0]?.alt} width={120} />
68
+ </button>
69
+ ```
70
+
71
+ ### Accessibility
72
+ - A tile with `onClick` is a real `<button type="button">` named by `alt` and `label`, with the focus ring from the component; Enter and Space open it.
73
+ - The play mark is decorative and hidden from a screen reader.
74
+ - `id`, `data-*` and `aria-*` go on the tile.
75
+
76
+ ### Props
77
+ ### MediaTile
78
+ A thumbnail tile: a picture in a fixed shape with an optional label on its bottom edge and a caption under it. With `onClick` the whole tile is one button, which is how a grid or a `ScrollStrip` of media opens each item in a `Lightbox`. The label sits on the same near-black media scrim as the Lightbox, in every theme. The thumbnail is cropped to fill its shape, or with `aspect="natural"` shown whole. With `href` the whole tile is one link instead. `onRemove` adds a remove button for a tile that can be taken back out. `badge` pins a short word to a top corner. While `loading` with no `src` yet the picture is a bone of its shape.
79
+ - alt: string (required). What the thumbnail shows; it is the tile's name, with `label`.
80
+ - aspect: "square" | "4:3" | "3:2" | "16:10" | "16:9" | "3:4" | "9:16" | "natural" (default 3:4). The shape of the thumbnail, as `Image`'s `aspect`; `natural` keeps the picture's own
81
+ proportions (a chat image) and crops nothing.
82
+ - badge: string. A short word pinned to the picture's top-right corner on the media scrim: a count, "New" or a
83
+ size. Text only; it is part of the tile's name. With `onRemove` the button takes that corner,
84
+ so the badge sits top-left.
85
+ - caption: ReactNode. Muted text under the picture, e.g. when.
86
+ - external: boolean (default false). Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
87
+ - href: string. Makes the whole tile one link, named as the button form is; an in-app path goes through `LinkProvider`.
88
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
89
+ - label: ReactNode. A short line on the bottom edge of the picture, on the media scrim: who posted it, or "Earlier".
90
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
91
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
92
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
93
+ - onClick: MouseEventHandler<HTMLButtonElement>. Makes the whole tile one button; open a `Lightbox` from it. Without it (or `href`) the
94
+ tile is a plain, non-interactive block.
95
+ - onRemove: (() => void). Adds a round remove button on the picture's top-right corner, named `removeLabel` and `alt`: a
96
+ photo attached to a form, until it is sent. It is its own button, beside the tile's, so a tile
97
+ with `onClick` still opens its `Lightbox`.
98
+ - removeLabel: string (default Remove). The remove button's word, before `alt` in its name and alone as its tooltip.
99
+ - src: string. The thumbnail, a local path or a data URL. Left out, or if it fails to load, a placeholder shows.
100
+ - video: boolean (default false). Draws a play mark on the thumbnail: the tile opens a video, not a photo. Say so in `alt` too.
101
+ - width: "sm" | "md" | "lg" | "xl" | "full" (default md). `sm` 96px, `md` 160px, `lg` 256px or `xl` 448px wide; `full` fills the parent (a tile in a grid).
@@ -0,0 +1,110 @@
1
+ ## Menu
2
+
3
+ Group: Actions
4
+
5
+ When to use: A row, card or header with more actions than fit: put the one main action in view and the rest in a Menu.
6
+
7
+ ### Use instead
8
+ - Popover (popover.md): The button opens a few lines to read or a small form, not actions.
9
+
10
+ ### The one right way
11
+ A row's secondary actions in one `Menu`, beside its one visible action.
12
+ ```tsx
13
+ import { Button, Card, ListRow, Menu } from "@slashsuite/ui-react";
14
+
15
+ <Card flush>
16
+ <ListRow
17
+ size="sm"
18
+ actions={
19
+ <>
20
+ <Button size="sm" variant="outline">
21
+ Reply
22
+ </Button>
23
+ <Menu
24
+ size="sm"
25
+ label="More actions"
26
+ items={[
27
+ { label: "Favourite", icon: "plus", onClick: () => undefined },
28
+ { label: "Settings", icon: "settings", onClick: () => undefined },
29
+ { label: "Hide chat", tone: "danger", onClick: () => undefined },
30
+ ]}
31
+ />
32
+ </>
33
+ }
34
+ >
35
+ Ada Lovelace
36
+ </ListRow>
37
+ </Card>
38
+ ```
39
+
40
+ ### Do
41
+ - Keep the one main action in view as a `Button` and put the rest in one `Menu` beside it; a row of several icon buttons is a `Menu`.
42
+ - `items` is data: each a `label` with `onClick`, or a link with `href` (through the app's `LinkProvider`; `external` opens a new tab). `icon` adds a leading glyph from the `Icon` set. An item that cannot be chosen yet takes `disabledReason`: it dims and shows the reason under its label.
43
+ - `open` and `onOpenChange` hold the menu open from the app's own state, such as a keyboard shortcut.
44
+ - A destructive item is `tone="danger"` and goes last, so it is never the first thing the arrows reach.
45
+ - The default trigger is a ghost three-dot button named by `label`; `trigger="button"` is an outline button reading `label`, for a menu whose name is worth a word ("Export"). `size="sm"` inside a row or a card header.
46
+ - In a `ListRow`, a row's `Menu` goes in its `actions`, shown on every row.
47
+
48
+ ### Don't
49
+ - Never put the only action of a row in a `Menu`: one action is a `Button` or an `IconButton`.
50
+ - Never dim an item with no reason: a dimmed item says why with `disabledReason`.
51
+
52
+ Four ghost buttons in a row crowd it, and every one of them is a tab stop.
53
+ ```tsx
54
+ import { Card, IconButton, ListRow } from "@slashsuite/ui-react";
55
+
56
+ <Card flush>
57
+ <ListRow
58
+ size="sm"
59
+ actions={
60
+ <>
61
+ <IconButton size="sm" variant="ghost" label="Reply" icon="chevron-right" />
62
+ <IconButton size="sm" variant="ghost" label="Favourite" icon="plus" />
63
+ <IconButton size="sm" variant="ghost" label="Settings" icon="settings" />
64
+ <IconButton size="sm" variant="ghost" tone="danger" label="Hide chat" icon="close" />
65
+ </>
66
+ }
67
+ >
68
+ Ada Lovelace
69
+ </ListRow>
70
+ </Card>
71
+ ```
72
+
73
+ A red item first is the one a quick Enter chooses.
74
+ ```tsx
75
+ import { Menu } from "@slashsuite/ui-react";
76
+
77
+ <Menu
78
+ label="More actions"
79
+ defaultOpen
80
+ items={[
81
+ { label: "Hide chat", tone: "danger", onClick: () => undefined },
82
+ { label: "Favourite", icon: "plus", onClick: () => undefined },
83
+ { label: "Settings", icon: "settings", onClick: () => undefined },
84
+ ]}
85
+ />
86
+ ```
87
+
88
+ ### Accessibility
89
+ - The trigger is a button with `aria-haspopup` and `aria-expanded`, named by `label`; the menu takes the same name.
90
+ - Enter, Space or ArrowDown open it on the first item, ArrowUp on the last; the arrows, Home, End and a typed letter move; Enter chooses; Escape closes it, and focus goes back to the trigger.
91
+ - A link item is a real link with `role="menuitem"`; an item with `disabledReason` is skipped by the arrows, and its reason is its description.
92
+ - Inside a `Dialog` the menu opens in the dialog, so it is not inert, and Escape closes only the menu.
93
+
94
+ ### Props
95
+ ### Menu
96
+ A button that opens a short list of actions: the overflow menu at the end of a row, a card header or a page header. Keep the one main action in view beside it and put the rest here, the `danger` one last. `items` are data: each a `label` with `onClick`, or a link with `href` (`external` for a new tab), an optional leading `icon`, `tone="danger"` and `disabledReason`. `open` and `onOpenChange` hold it open from the app's own state. `trigger="icon"` (the default) is a ghost three-dot button named by `label`; `trigger="button"` is an outline button reading `label`. The menu opens below the trigger, aligned to its end, and flips when there is no room. The keyboard is the menu button pattern: Enter, Space or ArrowDown open it on the first item, ArrowUp on the last; the arrows, Home, End and a letter move; Enter chooses; Escape closes, and focus goes back to the trigger. `data-*` and `aria-*` land on the trigger.
97
+ - defaultOpen: boolean (default false). Opens on mount, for a story or a test that shows the open menu.
98
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
99
+ - items: readonly [MenuAction, ...MenuAction[]] (required). The actions, in order.
100
+ - label: string (required). The trigger's accessible name and the menu's. With `trigger="button"` it is the visible text.
101
+ - onOpenChange: ((open: boolean) => void). Runs with the new state when the trigger, Escape, a click outside or a choice opens or shuts it.
102
+ - open: boolean. Holds the menu open or shut from the app's own state (a keyboard shortcut that opens it). Pass
103
+ `onOpenChange` with it, or the trigger, Escape and a choice cannot change it.
104
+ - size: "sm" | "md" | "lg" (default md). The trigger's height, the same steps as `IconButton` and `Button`: `sm` inside a row or a card
105
+ header. The menu's own text does not change with it.
106
+ - trigger: "button" | "icon" (default icon). `icon` is a ghost square button holding three dots, the overflow menu; `button` is an outline
107
+ `Button` with `label` as its text and a chevron after it, for a menu whose name is worth a word.
108
+
109
+ ### Types
110
+ - MenuAction: `{ label: string; icon?: IconName | undefined; tone?: IconButtonTone | undefined; disabledReason?: string | undefined; } & ({ onClick: () => void; href?: undefined; external?: undefined; } | { onClick?: undefined; href: string; external?: boolean | undefined; })`. One entry of a `Menu`: an action that runs `onClick`, or a link to `href`. Never both.