@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,64 @@
1
+ ## Pagination
2
+
3
+ Group: Navigation
4
+
5
+ When to use: A list split into pages that the reader moves through: a directory, search results, an archive.
6
+
7
+ ### The one right way
8
+ `pageHref` gives the URL of each page, so the page lives in the URL: back, a new tab and a shared link all work.
9
+ ```tsx
10
+ import { Pagination } from "@slashsuite/ui-react";
11
+
12
+ <Pagination
13
+ label="Directory pages"
14
+ page={4}
15
+ pageCount={12}
16
+ pageHref={(page) => (page > 1 ? `?page=${page}` : "?")}
17
+ />
18
+ ```
19
+
20
+ ### Do
21
+ - Give `pageHref` the URL of a page; the page lives in the URL, so back, a new tab and a shared link work. Each link goes through the app's `LinkProvider`.
22
+ - `page` is the page shown, from 1, and `pageCount` how many there are; a stale page past the end draws the last one, and a single page draws nothing.
23
+ - One Pagination under the list; a long list may add one above it too, each with its own `label`.
24
+ - The count line ("21 to 40 of 312") is a `Caption` beside it, not part of it.
25
+ - `previousLabel`, `nextLabel` and `pageLabel` carry the words for another language.
26
+
27
+ ### Don't
28
+ Buttons that set the page in state: no URL, so the back button, a new tab and a shared link all lose the page.
29
+ ```tsx
30
+ import { Button, Cluster } from "@slashsuite/ui-react";
31
+
32
+ <Cluster gap="xs">
33
+ <Button size="sm" variant="outline" onClick={() => undefined}>
34
+ First
35
+ </Button>
36
+ <Button size="sm" variant="outline" onClick={() => undefined}>
37
+ Previous
38
+ </Button>
39
+ <span>Page 4 of 12</span>
40
+ <Button size="sm" variant="outline" onClick={() => undefined}>
41
+ Next
42
+ </Button>
43
+ <Button size="sm" variant="outline" onClick={() => undefined}>
44
+ Last
45
+ </Button>
46
+ </Cluster>
47
+ ```
48
+
49
+ ### Accessibility
50
+ - A `<nav>` named by `label`. Every page is a link, and the current one has `aria-current="page"`.
51
+ - Previous on the first page and Next on the last are plain text, not links, so there is no dead stop in the tab order.
52
+ - The gaps (`…`) are `aria-hidden`. Below `sm` the numbers give way to `pageLabel` ("Page 4 of 12") between Previous and Next.
53
+
54
+ ### Props
55
+ ### Pagination
56
+ Page links for a long list: Previous, the page numbers and Next, in a `<nav>` named by `label`. Each is a link to `pageHref(page)`, drawn by the app's router link through `LinkProvider`, so the page lives in the URL and back, a new tab and a shared link all work. The current page is a link with `aria-current="page"`. Below `sm` the numbers give way to `pageLabel` ("Page 2 of 4"). Renders nothing for one page. The count line ("21 to 40 of 312") is the caller's `Caption`.
57
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
58
+ - label: string (required). Names the `<nav>`. Two pagers on a page (above and below a list) each need their own.
59
+ - nextLabel: string (default Next). The next-page link's text.
60
+ - page: number (required). The page shown, from 1. Drawn clamped into `1` to `pageCount`.
61
+ - pageCount: number (required). How many pages there are. One or none draws nothing.
62
+ - pageHref: (page: number) => string (required). The URL of one page, called for every link drawn: `(page) => (page > 1 ? `?page=${page}` : "?")`.
63
+ - pageLabel: ((page: number, pageCount: number) => string) (default (at, count) => `Page ${at} of ${count}`). The summary shown in place of the numbers below `sm`. Default: `Page 2 of 4`.
64
+ - previousLabel: string (default Previous). The previous-page link's text.
@@ -0,0 +1,105 @@
1
+ ## Pill
2
+
3
+ Group: Content
4
+
5
+ When to use: A short word that says what state or kind something is: paid, draft, flaky.
6
+
7
+ ### Use instead
8
+ - Badge (badge.md): A count sits on an icon.
9
+
10
+ ### The one right way
11
+ The tone carries the meaning: `positive` for done, `warn` for waiting, `danger` for failed, and no tone for a draft.
12
+ ```tsx
13
+ import { Cluster, Pill } from "@slashsuite/ui-react";
14
+
15
+ <Cluster>
16
+ <Pill tone="positive" dot>
17
+ Paid
18
+ </Pill>
19
+ <Pill tone="warn" dot>
20
+ Due
21
+ </Pill>
22
+ <Pill tone="danger" dot>
23
+ Overdue
24
+ </Pill>
25
+ <Pill dot>Draft</Pill>
26
+ </Cluster>
27
+ ```
28
+
29
+ ### Do
30
+ - Choose `tone` by meaning: `positive` for done or good, `warn` for waiting or at risk, `danger` for failed, `neutral` (the default) for a draft or no state, `info` for a note; `accent` for a kind or category that is none of those.
31
+ - `size` is `sm`, `md` (default) or `lg`; with none, a Pill takes the size of the `Card`, `ListRow` or `Table` it sits in.
32
+ - `dot` adds a leading dot in the Pill's colour; `round` swaps the rounded-square corners for a full pill shape. Use one look across a view.
33
+ - A Pill's text never wraps onto a second line: keep it to a word or two, and let the row the Pills sit in wrap them.
34
+ - `name` makes a two-tone `name: value` pill (`<Pill name="Weight">72 kg</Pill>`): the name keeps the tone's tint and the children sit on the surface beside it. Keep the name to a word or two.
35
+ - `onRemove` adds an x button after the text, for a chip the reader can drop (an attachment, a filter); it is named `Remove` and the pill's text (`Remove invoice.pdf`) when that text is a string, and `removeLabel` replaces the whole name, for another wording or language. On a link or button Pill the x is a separate button beside it, never nested inside.
36
+ - A Pill that goes somewhere takes `href` (`external` for a new tab; an in-app one goes through your router's `Link` on `LinkProvider`); one that does something takes `onClick`.
37
+ - A Pill beside a card's title is the Card's `status`, not a hand-built row. A message to read is a `Callout`, and an action is a `Button`.
38
+
39
+ ### Don't
40
+ - Never make a row of clickable `Pill`s a filter: a filter is pressed `Button`s in a `Fieldset`.
41
+
42
+ One tone for every status says nothing: a reader cannot tell Paid from Overdue at a glance. Pick the tone by what the status means.
43
+ ```tsx
44
+ import { Cluster, Pill } from "@slashsuite/ui-react";
45
+
46
+ <Cluster>
47
+ <Pill tone="accent" dot>
48
+ Paid
49
+ </Pill>
50
+ <Pill tone="accent" dot>
51
+ Due
52
+ </Pill>
53
+ <Pill tone="accent" dot>
54
+ Overdue
55
+ </Pill>
56
+ </Cluster>
57
+ ```
58
+
59
+ A Pill inside a `TextLink` is two parts doing one job, and the Pill's own hover dim and focus ring go unused. Give the Pill the `href`.
60
+ ```tsx
61
+ import { Pill, TextLink } from "@slashsuite/ui-react";
62
+
63
+ <TextLink href="#flakes">
64
+ <Pill tone="warn" round>
65
+ 3 flaky
66
+ </Pill>
67
+ </TextLink>
68
+ ```
69
+
70
+ ### Accessibility
71
+ - A two-tone Pill reads "Weight: 72 kg" to a screen reader (a visually hidden colon follows the label). The x of `onRemove` is a `<button type="button">` with its name (`removeLabel`, or "Remove" and the pill's text) as its `aria-label` and its tooltip, with the icon `aria-hidden`.
72
+ - A plain Pill is a `<span>`; the dot is `aria-hidden`. The tone is colour only, so the text must say the status itself.
73
+ - With `href` it is a link and with `onClick` a `<button type="button">`; both dim on hover and show the focus ring.
74
+ - `external` adds `target="_blank"` and `rel="noreferrer"`.
75
+
76
+ ### Props
77
+ ### Pill
78
+ A small tinted label whose `tone` says what it means; `dot` adds a leading dot in the pill's own text colour, `round` swaps the rounded-md corners for a full pill shape, and `size` steps the text (with none, it takes its container's). `name` makes it two-tone, `name: value`: the name keeps the tone's tint and the children, the value, sit on the surface beside it. `href` makes it a link (the app's router link through `LinkProvider` for an in-app path, else a plain `<a>`; `external` opens a new tab) and `onClick` makes it a button, each with a hover dim and the focus ring. `onRemove` adds an x button after the text (named by `removeLabel`, by default `Remove` and the pill's text), a separate button beside a link or button pill rather than nested in it. `title` is its tooltip and description; a plain pill with one takes a tab stop. While `loading` with no text yet it is a bone of its size. Its text never wraps: a pill is one unit, so keep it to a word or two.
79
+ - children: ReactNode. The pill's text; while `loading`, none yet draws the pill as a bone of its size.
80
+ - dot: boolean. A leading dot in the pill's own text colour.
81
+ - external: boolean. Opens in a new tab: adds `target="_blank"` and `rel="noreferrer"`.
82
+ - href: string. Makes the pill a link to this URL; an in-app path goes through the app's `LinkProvider`.
83
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
84
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
85
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
86
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
87
+ - name: string. The name half of a two-tone `name: value` pill: `children` is the value. The name keeps the
88
+ tone's tint and the value sits on a plain surface beside it, in a hairline border. Keep the
89
+ name to a word or two (`Weight`, `Sleep`).
90
+ - onClick: MouseEventHandler<HTMLButtonElement>. A Pill that is a button: runs `onClick`. Defaults to `type="button"`.
91
+ - onRemove: (() => void). Adds a small x button after the text that calls this: for a chip the reader can drop (an attachment, a filter). It sits beside a link or button pill, never inside it.
92
+ - removeLabel: string (default Remove). The x button's whole accessible name and tooltip: `Remove invoice.pdf`. Left out, it is
93
+ `Remove` followed by the pill's text when that text is a string or a number, else `Remove`.
94
+ - round: boolean. A full pill shape in place of the rounded-md corners.
95
+ - size: "sm" | "md" | "lg" (default the container's, else md). `sm` is smaller text, for a dense row; `lg` larger, beside a heading. Left out, a Pill takes
96
+ the size of the `Card`, `ListRow` or `Table` it sits in, else `md`.
97
+ - title: string. The detail behind a pill whose text is short or cut off (the full status, a date): its tooltip
98
+ on hover, keyboard focus and a tap, and its description. A plain pill with a title is focusable.
99
+
100
+ Keep anything a reader needs on the pill itself.
101
+ - tone: "neutral" | "info" | "positive" | "warn" | "danger" | "accent" (default neutral). What the pill means: `neutral`, `info`, `positive`, `warn` or `danger`, or `accent` for a
102
+ category that is none of those.
103
+
104
+ ### Types
105
+ - PillTone: `Tone | "accent"`. A Pill's tones: the five meanings, and `accent` for a category that is none of them.
@@ -0,0 +1,63 @@
1
+ ## Popover
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A detail, a short explanation or a filter or two that belongs to one control and is not worth a page or a modal.
6
+
7
+ ### Use instead
8
+ - Menu (menu.md): The panel would be a list of actions.
9
+ - Disclosure (disclosure.md): The detail can open in the page and push what is below it down.
10
+
11
+ ### The one right way
12
+ A detail beside the thing it explains: the panel holds a few facts and closes on a click away.
13
+ ```tsx
14
+ import { KeyValue, KeyValueList, Popover } from "@slashsuite/ui-react";
15
+
16
+ <Popover label="Build details" icon="more">
17
+ <KeyValueList>
18
+ <KeyValue label="Commit">982a166</KeyValue>
19
+ <KeyValue label="Shots">412</KeyValue>
20
+ <KeyValue label="Took">3 min 12 s</KeyValue>
21
+ </KeyValueList>
22
+ </Popover>
23
+ ```
24
+
25
+ ### Do
26
+ - `label` names the trigger and the panel. Without `icon` the trigger is an outline button reading `label`; with `icon` it is a ghost square button, and `label` is its tooltip.
27
+ - Keep the panel small: a few lines, a short list of facts, a filter or two. It is never wider than 22rem or the screen.
28
+ - A list of actions is a `Menu`, which the arrow keys move through. A question to answer first is a `Dialog`.
29
+
30
+ ### Don't
31
+ - Do not put the only way to do something in a Popover: a reader who never opens it never finds it.
32
+ - Do not use one for a list of actions: a `Menu` is the one way.
33
+
34
+ A list of actions in a Popover: the arrow keys do not move through them and nothing says they are a menu.
35
+ ```tsx
36
+ import { Button, Popover } from "@slashsuite/ui-react";
37
+
38
+ <Popover label="Actions">
39
+ <Button variant="ghost">Rename</Button>
40
+ <Button variant="ghost">Duplicate</Button>
41
+ <Button variant="ghost" tone="danger">
42
+ Delete
43
+ </Button>
44
+ </Popover>
45
+ ```
46
+
47
+ ### Accessibility
48
+ - It is the browser's own popover: a click outside it, Esc or the trigger closes it, and Esc puts the focus back on the trigger.
49
+ - It is not modal: the page stays usable, and Tab moves from the trigger into the panel and on.
50
+ - The trigger says whether it is open (`aria-expanded`), and the panel is a `dialog` named by `label`.
51
+ - Where the browser positions by anchor, the panel sits under the trigger and flips above when there is no room; elsewhere it shows in the middle of the screen.
52
+
53
+ ### Props
54
+ ### Popover
55
+ A button that opens a small panel of content beside it: a detail, a short list, a filter. It is the browser's own popover, rendered in place: a click outside it, Esc or the trigger closes it, and the focus goes back to the trigger. It is not modal: the page stays usable, and Tab moves from the trigger into the panel and on. A list of actions is a `Menu`; a question to answer first is a `Dialog`. `data-*` and `aria-*` land on the trigger.
56
+ - children: ReactNode (required). What the panel holds: a few lines, a short list, a filter or two.
57
+ - defaultOpen: boolean (default false). Opens on mount, for a story or a test that shows the open panel.
58
+ - icon: "page" | "grid" | "search" | "alert" | "table" | "type" | "diff" | "baseline" | "review" | "ci" | "self-host" | "privacy" | "capture" | "branch" | "theme" | "speed" | "chevron-right" | "chevron-down" | "close" | "external-link" | "settings" | "bell" | "check" | "plus" | "minus" | "more" | "window" | "card" | "pointer" | "field" | "compass" | "briefcase" | "cart" | "pause" | "play". Makes the trigger a ghost square button holding this glyph, named by `label` (shown as its
59
+ tooltip). Without it the trigger is an outline `Button` reading `label`, with a chevron.
60
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
61
+ - label: string (required). The trigger's accessible name and the panel's. Without `icon` it is the trigger's visible text.
62
+ - size: "sm" | "md" | "lg" (default md). The trigger's height, the same steps as `IconButton` and `Button`: `sm` inside a row or a card
63
+ header. The panel does not change with it.
@@ -0,0 +1,49 @@
1
+ ## Price
2
+
3
+ Group: Content
4
+
5
+ When to use: Showing what something costs: on a product tile, a product's page or a cart line.
6
+
7
+ ### Use instead
8
+ - ProductTile (product-tile.md): The price is one thing for sale in a shop's grid.
9
+
10
+ ### The one right way
11
+ A sale is the price with the old one as `was`: struck through on the page, "R52, was R65" out loud.
12
+ ```tsx
13
+ import { Price } from "@slashsuite/ui-react";
14
+
15
+ <Price value="R52" was="R65" />
16
+
17
+ ```
18
+
19
+ ### Do
20
+ - `value` is the price already formatted for the reader ("R52", "€12.50"): the app owns the currency and the locale, and `Price` formats nothing.
21
+ - `was` is the price before a sale. It follows `value` struck through and a step smaller, and a screen reader hears "R52, was R65".
22
+ - `size` is `sm` for a dense row, `md` (the default) for a tile and `lg` for a product's own page.
23
+ - Figures are tabular, so a column of prices lines up.
24
+
25
+ ### Don't
26
+ - Do not strike a price through by hand: the strike is silent, so the old price reads as a second price.
27
+
28
+ A strike drawn by hand is silent: a screen reader hears two prices and cannot tell which one is paid.
29
+ ```tsx
30
+ <span>
31
+ R52 <s>R65</s>
32
+ </span>
33
+ ```
34
+
35
+ ### Accessibility
36
+ - The old price carries a screen-reader-only ", was ", since a strike says nothing out loud.
37
+ - While `loading` with no `value` yet it is a bone of its size and `aria-busy`.
38
+ - `id`, `data-*` and `aria-*` go on the price.
39
+
40
+ ### Props
41
+ ### Price
42
+ A price as the page already formatted it ("R52"), in tabular figures so a column of prices lines up. With `was` the old price follows it struck through, and a screen reader hears "R52, was R65", since a strike says nothing out loud. It formats nothing: the app owns the currency and the locale. While `loading` with no `value` yet it is a bone of its size.
43
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
44
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
45
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
46
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
47
+ - size: "sm" | "md" | "lg" (default md). `sm` for a dense row, `md` for a tile, `lg` for a product's own page.
48
+ - value: string | undefined (required). The price, formatted for the reader ("R52", "€12.50"). While `loading`, none yet is a bone.
49
+ - was: string. The price before a sale, struck through after `value`.
@@ -0,0 +1,78 @@
1
+ ## ProductTile
2
+
3
+ Group: Content
4
+
5
+ When to use: A shop's grid of products, or a row of them on a landing page.
6
+
7
+ ### Use instead
8
+ - Price (price.md): The price stands alone: a cart line or a product's own page.
9
+ - MediaTile (media-tile.md): The tile is a photo or a video to open, not a thing to buy.
10
+
11
+ ### The one right way
12
+ A shop's grid is `ProductTile`s in a `CardGrid`: each one link, named by its name and price.
13
+ ```tsx
14
+ import { CardGrid, ProductTile } from "@slashsuite/ui-react";
15
+
16
+ <CardGrid as="ul" columns={3} minColumns={2}>
17
+ <ProductTile href="#print-dusk" name="Print: harbour at dusk" src={first?.src} price="R420" />
18
+ <ProductTile
19
+ href="#print-hills"
20
+ name="Print: hills over the bay"
21
+ src={second?.src}
22
+ price="R380"
23
+ was="R450"
24
+ status="sale"
25
+ />
26
+ <ProductTile
27
+ href="#print-moon"
28
+ name="Print: the bay by moonlight"
29
+ src={third?.src}
30
+ price="R420"
31
+ status="sold-out"
32
+ />
33
+ </CardGrid>
34
+ ```
35
+
36
+ ### Do
37
+ - `href` is the product's page; the whole tile is one link, and an in-app path goes through `LinkProvider`.
38
+ - `name` and `price` are the tile's words; `was` adds the old price on a sale, as `Price` does.
39
+ - `status` puts a word on the picture's top-left corner: `sale` in the danger tone, `sold-out` on the media scrim. `statusLabel` is that word in the app's own language.
40
+ - `src` is the picture, cropped `square` (the default) or `3:4` for clothes on a person. It is decoration: the name says what it is.
41
+ - Put a set of them in a `CardGrid` with `as="ul"`, and `minColumns={2}` to keep two to a row on a phone.
42
+
43
+ ### Don't
44
+ - Do not link the picture and the name apart: that is two stops for a keyboard, and the picture's link has no name.
45
+
46
+ A picture with a separate link under it is two stops for a keyboard, and the picture's link has no name.
47
+ ```tsx
48
+ <div>
49
+ <a href="#print-dusk">
50
+ <img src={first?.src} alt="" />
51
+ </a>
52
+ <a href="#print-dusk">Print: harbour at dusk</a> R420
53
+ </div>
54
+ ```
55
+
56
+ ### Accessibility
57
+ - One link, named by what it says: "Linen shirt, R52, was R65, Sale". The picture has an empty `alt`.
58
+ - While `loading` the picture, name and price that are not here yet are bones and the link is `aria-busy`.
59
+ - `id`, `data-*` and `aria-*` go on the link.
60
+
61
+ ### Props
62
+ ### ProductTile
63
+ One thing for sale in a shop's grid: its picture, its name and its `Price` (with the was price on a sale), and a corner word for `sale` or `sold-out`. The whole tile is one link to the product's page, named by what it says: "Linen shirt, R52, was R65, Sale". The picture is decoration, since the name says what it is. It fills its column, so a set of them goes in a `CardGrid`. While `loading` the picture, the name and the price that are not here yet are bones.
64
+ - aspect: "square" | "3:4" (default square). The picture's shape: `square` for most things, `3:4` for clothes on a person.
65
+ - href: string (required). The product's page; an in-app path goes through `LinkProvider`.
66
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
67
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
68
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
69
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
70
+ - name: string | undefined (required). The product's name, the tile's first words. While `loading`, none yet is a bone.
71
+ - price: string | undefined (required). The price, formatted by the app ("R52"), as `Price`'s `value`.
72
+ - src: string. The product's picture. Left out, or if it fails to load, the picture's placeholder shows.
73
+ - status: "sale" | "sold-out". A word on the picture's top-left corner: `sale`, or `sold-out` when there are none left.
74
+ - statusLabel: string (default Sale, or Sold out). The corner's word, for an app in another language.
75
+ - was: string. The price before the sale, struck through after `price`.
76
+
77
+ ### Types
78
+ - ProductTileStatus: `"sale" | "sold-out"`. What a tile's corner says: the thing is on sale, or there are none left.
@@ -0,0 +1,66 @@
1
+ ## ProgressBar
2
+
3
+ Group: Data
4
+
5
+ When to use: How far something has got toward a whole: money saved, steps done.
6
+
7
+ ### The one right way
8
+ Say in words how far along it is, beside the bar. The bar shows the share and the words give the figures.
9
+ ```tsx
10
+ import { Caption, Cluster, ProgressBar, Stack, Text } from "@slashsuite/ui-react";
11
+
12
+ <Stack gap="xs">
13
+ <Cluster justify="between">
14
+ <Text as="span">Kitchen funded</Text>
15
+ <Caption as="span">R 45 000 of R 75 000</Caption>
16
+ </Cluster>
17
+ <ProgressBar value={45000} max={75000} label="Kitchen funded" />
18
+ </Stack>
19
+ ```
20
+
21
+ ### Do
22
+ - `value` is on the scale of `max`, which is 100 unless you pass one: three of twelve is `value={3} max={12}`. A fraction such as `0.25` is read as a quarter of one percent. A value past `max` is held at full.
23
+ - `label` is required and names what the bar measures.
24
+ - Say the figures in words beside the bar; the bar draws none.
25
+ - `tone` is `accent`, `positive`, `warn` or `danger`; `size` is `sm`, `md` (default) or `lg`.
26
+ - A share between two parties is a `SplitBar`; the parts of one whole are a `StackedBar`.
27
+
28
+ ### Don't
29
+ A bare bar: nobody can tell what it measures or how much it holds.
30
+ ```tsx
31
+ import { ProgressBar } from "@slashsuite/ui-react";
32
+
33
+ <ProgressBar value={60} label="Kitchen funded" />
34
+
35
+ ```
36
+
37
+ A fraction such as `0.25` is read as a quarter of one percent, not a quarter of the bar.
38
+ ```tsx
39
+ import { ProgressBar } from "@slashsuite/ui-react";
40
+
41
+ <ProgressBar value={0.25} label="Months saved" />
42
+
43
+ ```
44
+
45
+ ### Accessibility
46
+ - A ProgressBar has `role="progressbar"`, `aria-label` set to `label`, and `aria-valuemin`, `aria-valuemax` and `aria-valuenow` on a 0 to 100 scale.
47
+ - The announced percent is whole, and is never 0 or 100 unless the value truly is.
48
+ - The bar draws no text, so the words beside it carry the figures for everyone.
49
+
50
+ ### Props
51
+ ### ProgressBar
52
+ A thin horizontal bar with a filled share, for progress toward a total. `value` is held between 0 and `max`. `label` names what it measures, for a screen reader, which also hears the percentage. While `loading` it is one bone the bar's size, since 0 is a real value.
53
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
54
+ - label: string (required). What the bar measures, for a screen reader, which also hears the percentage.
55
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
56
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
57
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
58
+ - max: number (default 100). The value that fills the bar; `value` is drawn as its share of this. Defaults to 100.
59
+ - size: "sm" | "md" | "lg" (default md). The bar's height: `sm` 6px, `md` 8px, `lg` 12px.
60
+ - tone: "positive" | "warn" | "danger" | "accent" (default accent). What the progress means: `accent` (the default) plain progress, `positive` done or on track,
61
+ `warn` at risk, `danger` over a limit or failed.
62
+ - value: number (required). How far along, held between 0 and `max`.
63
+
64
+ ### Types
65
+ - BarSize: `"sm" | "md" | "lg"`. 6px, 8px or 12px tall.
66
+ - BarTone: `"positive" | "warn" | "danger" | "accent"`. The colour of a bar's fill.
@@ -0,0 +1,46 @@
1
+ ## PromoBanner
2
+
3
+ Group: Content
4
+
5
+ When to use: A shop's offer of the week, above the header or as the page's first block: one line and one action.
6
+
7
+ ### The one right way
8
+ One offer and one action whose words say where it goes.
9
+ ```tsx
10
+ import { PromoBanner } from "@slashsuite/ui-react";
11
+
12
+ <PromoBanner action="Shop refills" href="#refills">
13
+ Refills from R390 this week
14
+ </PromoBanner>
15
+ ```
16
+
17
+ ### Do
18
+ - `children` is the offer, one short line ("Refills from R390 this week"); `action` is the action's words ("Shop refills").
19
+ - `href` makes the action a link (an in-app path goes through `LinkProvider`); `onClick` a button, to open a dialog.
20
+ - Put it above the `AppShell`'s header or as the first block of the page, one per page. The fill and the action's colours are the theme's, held to AA in every theme.
21
+
22
+ ### Don't
23
+ - Do not make a strip from a `Callout` and a `Button`: a toned callout is a message about the page, and an outline button on its tint is not held to the offer's contrast.
24
+
25
+ A toned Callout is a message about the page, not an offer, and its button is not held to the strip's contrast.
26
+ ```tsx
27
+ import { Callout } from "@slashsuite/ui-react";
28
+
29
+ <Callout tone="positive" title="Refills from R390 this week">
30
+ Shop refills on the refills page.
31
+ </Callout>
32
+ ```
33
+
34
+ ### Accessibility
35
+ - The offer is a paragraph and the action a link or a button named by its words, so the action says what it does without the offer.
36
+ - The action's focus ring is drawn inside it, so it shows on the accent fill.
37
+ - `id`, `data-*` and `aria-*` go on the strip.
38
+
39
+ ### Props
40
+ ### PromoBanner
41
+ A slim full-width strip that carries one offer and one action: "Refills from R390 this week", then "Shop refills". It is the theme's accent fill with its label colour, and the action is a small surface pill on it, so both hold AA contrast in every theme. Put it above the `AppShell`'s header or as the first block of the page; one per page. The words wrap and stay centred on a phone. With `href` the action is a link (an in-app path goes through `LinkProvider`), with `onClick` a button.
42
+ - action: string (required). The action's words: "Shop refills".
43
+ - children: ReactNode (required). The offer, one short line: "Refills from R390 this week".
44
+ - href: string. Where the action goes; an in-app path goes through `LinkProvider`.
45
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
46
+ - onClick: MouseEventHandler<HTMLButtonElement>. The action as a button instead of a link: it opens a dialog, say.
@@ -0,0 +1,87 @@
1
+ ## ProseLayout
2
+
3
+ Group: Page layouts
4
+
5
+ When to use: Privacy, terms, help or any page that is mostly paragraphs.
6
+
7
+ ### The one right way
8
+ Text pages (privacy, terms, help) are one reading column; the header sits inside it.
9
+ ```tsx
10
+ import { ProseLayout, SectionHeading, Text } from "@slashsuite/ui-react";
11
+
12
+ <ProseLayout title="Privacy" description="How we handle your data.">
13
+ <SectionHeading>What we keep</SectionHeading>
14
+ <Text>We keep your account details and the quotes you send, and nothing else.</Text>
15
+ <SectionHeading>Who sees it</SectionHeading>
16
+ <Text>Only you and the people you invite to your organisation.</Text>
17
+ </ProseLayout>
18
+ ```
19
+
20
+ ### Full page
21
+ A whole text page: the shell with its brand and nav, then one reading column with the header inside it.
22
+ ```tsx
23
+ import { AppShell, Tabs, ProseLayout, SectionHeading, Text } from "@slashsuite/ui-react";
24
+
25
+ <AppShell
26
+ brand={<a href="#">Hack Cove</a>}
27
+ nav={
28
+ <Tabs
29
+ label="Main"
30
+ items={[
31
+ { label: "Quotes", href: "#quotes", selected: true },
32
+ { label: "Clients", href: "#clients" },
33
+ ]}
34
+ />
35
+ }
36
+ >
37
+ <ProseLayout title="Privacy" description="How we handle your data.">
38
+ <SectionHeading>What we keep</SectionHeading>
39
+ <Text>We keep your account details and the quotes you send, and nothing else.</Text>
40
+ <SectionHeading>Who sees it</SectionHeading>
41
+ <Text>Only you and the people you invite to your organisation.</Text>
42
+ </ProseLayout>
43
+ </AppShell>
44
+ ```
45
+
46
+ ### Do
47
+ - The text is the `children`: `SectionHeading`s and `Text` paragraphs, spaced `md` apart.
48
+ - `gap` picks another spacing from the same scale (`xs` to `xl`) for the whole page; the default is right for most pages.
49
+ - The header sits inside the column, so its `actions` stay beside the text.
50
+ - The `description` is the page's lede, set larger than the paragraphs after it, and the title above it is the strongest text on the page.
51
+ - `width` is `narrow` (the reading column, the default), `wide` or `full`. Use `wide` for a page that is not long prose, such as pricing, so it does not leave the right third empty; a paragraph and the lede keep their reading measure.
52
+ - Data or cards in a grid are not prose: use `ListLayout` or `CardGrid`.
53
+
54
+ ### Don't
55
+ `ListLayout` is for lists: its content runs the full width, so lines of text get too long to read. Use `ProseLayout`.
56
+ ```tsx
57
+ import { Card, ListLayout, Text } from "@slashsuite/ui-react";
58
+
59
+ <ListLayout title="Privacy" description="How we handle your data.">
60
+ <Card>
61
+ <Text>
62
+ We keep your account details and the quotes you send, and nothing else. Only you and the
63
+ people you invite to your organisation can see them.
64
+ </Text>
65
+ </Card>
66
+ </ListLayout>
67
+ ```
68
+
69
+ ### Accessibility
70
+ - The title is the page's `h1`.
71
+ - Use `SectionHeading` for sections so the outline runs h1 then h2.
72
+ - `data-*` and `aria-*` go on the column's wrapper.
73
+
74
+ ### Props
75
+ ### ProseLayout
76
+ A text page: header, then `children` stacked `gap` apart (`md` by default), all in one column that starts at the Container's start edge (it is not re-centred, so the title does not jump). `width` sets the column: `narrow` (`max-w-3xl`, the default) is a reading measure; `wide` (`max-w-5xl`) and `full` (the Container's whole width) suit a page that is not long prose, such as a pricing page. Paragraphs (`Text`) and the header's lede keep their own reading measure whatever the width. Unlike `FormLayout` the header sits inside the column, so its `actions` stay beside the text instead of at the Container's far edge. While `loading` it owns the wait and passes it to everything inside, the header too.
77
+ - actions: ReactNode. Right of the title on `sm` and up, below it on a phone.
78
+ - breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
79
+ - description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
80
+ - gap: "sm" | "md" | "lg" | "xs" | "xl" (default md). The space between blocks: `xs` gap-2, `sm` gap-4, `md` gap-6, `lg` gap-8, `xl` gap-12 (gap-16 from `sm`).
81
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
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
+ - tabs: ReactNode. A `Tabs` (or similar) under the title.
86
+ - title: ReactNode (required). The page's `h1`.
87
+ - width: "full" | "narrow" | "wide" (default narrow). The column's width, as a `Stack`'s: `narrow` max-w-3xl, `wide` max-w-5xl, `full` the Container's width.
@@ -0,0 +1,41 @@
1
+ ## Prose
2
+
3
+ Group: Text
4
+
5
+ When to use: The body of a docs page or an article, where a reader scans headings. An app screen never uses it.
6
+
7
+ ### The one right way
8
+ A docs page or an article wraps its body in `Prose`: body 16, the h4 at body size in semibold, the h3 at 20 and the h2 at 24.
9
+ ```tsx
10
+ import { Prose } from "@slashsuite/ui-react";
11
+
12
+ <Prose>
13
+ <ProseDoc />
14
+ </Prose>
15
+ ```
16
+
17
+ ### Do
18
+ - Wrap the body of a docs page or an article in `Prose`, inside a `ProseLayout`, a `SidebarLayout` or anywhere else. `ProseLayout` takes no prop for it.
19
+ - Write the page with the usual parts: `SectionHeading` is the h2, `SubsectionHeading` the h3 and `SubsectionHeading size="sm"` (as `h4`) the h4, `Text` the paragraph. Inside `Prose` they take the long-form sizes; nothing else about them changes.
20
+ - `Callout` text, `BulletList` items, inline `Code` and a `TextLink` follow the body size. `Caption`, `Overline`, `Table`, `CodeBlock` and the form controls keep theirs.
21
+ - A `Dialog`, `Drawer` or `EmptyState` inside `Prose` looks as it does on any app screen.
22
+ - The sizes are fixed: `Prose` has no size to choose.
23
+
24
+ ### Don't
25
+ - Never use `Prose` on an app screen. A dashboard, a form or a list keeps the app sizes.
26
+
27
+ Without `Prose` the same page has the dense app sizes: the h2 and the h3 are one size, only 2px above the body.
28
+ ```tsx
29
+ <ProseDoc />
30
+
31
+ ```
32
+
33
+ ### Accessibility
34
+ - `Prose` renders a `div` and adds nothing to the page outline or to what a screen reader announces.
35
+ - The heading elements are unchanged: pick `as` to keep the outline in order, as everywhere else.
36
+ - `id`, `aria-*` and `data-*` go on the `div`.
37
+
38
+ ### Props
39
+ ### Prose
40
+ Long-form content, for a docs page or an article. A block (`div`) that sets the long line height (leading-7) on itself and puts the text roles inside it on the prose scale: `Text` text-base/7 (the size it is outside, on a longer line), `SectionHeading` text-2xl/8, `SubsectionHeading` `lg` text-2xl/8, `md` text-xl/7 and `sm` text-base/7 (a semibold line at body size), and the box of a `Callout` text-base/7. Every other role keeps its size. Nothing outside a `Prose` changes, and a `Dialog`, `Drawer` or `EmptyState` inside one is back on the app scale. An app screen never uses it: wrap the body of a docs page or an article, inside a `ProseLayout`, a `SidebarLayout` or anywhere else. Its blocks (`Section`s, paragraphs) are a `Stack`'s gap apart, as they would be in a `Stack`.
41
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.