@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,134 @@
1
+ ## SidebarLayout
2
+
3
+ Group: Page layouts
4
+
5
+ When to use: A section with several sub-pages, such as settings, where the rail is the way between them.
6
+
7
+ ### The one right way
8
+ A vertical pill `Tabs` is the rail: a short list of sections beside the page.
9
+ ```tsx
10
+ import { Card, Tabs, PageHeader, SidebarLayout, Text } from "@slashsuite/ui-react";
11
+
12
+ <SidebarLayout
13
+ aside={
14
+ <Tabs
15
+ orientation="vertical"
16
+ label="Settings"
17
+ items={[
18
+ { label: "Profile", href: "#profile", selected: true },
19
+ { label: "Billing", href: "#billing" },
20
+ { label: "Team", href: "#team" },
21
+ ]}
22
+ />
23
+ }
24
+ >
25
+ <PageHeader title="Profile" description="Your name and email." />
26
+ <Card title="Account">
27
+ <Text>Naledi Mokoena, naledi@example.com</Text>
28
+ </Card>
29
+ </SidebarLayout>
30
+ ```
31
+
32
+ ### Full page
33
+ A whole page with a rail: the shell with its brand and nav, then the layout with a vertical `Tabs` in `aside` and the page in `children`.
34
+ ```tsx
35
+ import {
36
+ AppShell,
37
+ Button,
38
+ Card,
39
+ Tabs,
40
+ PageHeader,
41
+ SidebarLayout,
42
+ Text,
43
+ } from "@slashsuite/ui-react";
44
+
45
+ <AppShell
46
+ brand={<a href="#">Hack Cove</a>}
47
+ nav={
48
+ <Tabs
49
+ label="Main"
50
+ items={[
51
+ { label: "Quotes", href: "#quotes", selected: true },
52
+ { label: "Clients", href: "#clients" },
53
+ ]}
54
+ />
55
+ }
56
+ >
57
+ <SidebarLayout
58
+ aside={
59
+ <Tabs
60
+ orientation="vertical"
61
+ label="Organisations"
62
+ items={[
63
+ { label: "Hack Cove", href: "#hack-cove", selected: true },
64
+ { label: "Acme", href: "#acme" },
65
+ { label: "Northwind", href: "#northwind" },
66
+ ]}
67
+ />
68
+ }
69
+ >
70
+ <PageHeader
71
+ title="Hack Cove"
72
+ description="3 projects"
73
+ actions={<Button>New project</Button>}
74
+ />
75
+ <Card title="Projects">
76
+ <Text>Storybook, Dashboard, Site.</Text>
77
+ </Card>
78
+ </SidebarLayout>
79
+ </AppShell>
80
+ ```
81
+
82
+ ### Do
83
+ - The `aside` is `Tabs` of links with `orientation="vertical"` (the pill rail), one link per section and the current one `selected`.
84
+ - The `children` are the section's page: its `PageHeader`, then the content.
85
+ - From `md` the rail is a fixed width beside the page; below it, the rail stacks above the page.
86
+ - From `md` the rail stays in view under the shell's header as a long page scrolls, with or without `asideLabel`; it is always on, not an option. A rail taller than the screen scrolls inside itself, so its last link is reachable. Below `md` nothing sticks.
87
+ - The rail has no background or border: it is a list of links on the page.
88
+ - Once the page has loaded, a rail that scrolls shows its current link (the one with `aria-current`) in view, with its own themed scrollbar, and the folded disclosure reads `asideLabel` and the current link, such as "All components: Button". Nothing to set; in Astro, hydrate the layout (`client:load`).
89
+ - Facts about one record go in `DetailLayout`'s aside, not a rail.
90
+ - A docs site uses `DocsLayout`, which is this rail with the docs page's title, contents list and neighbours fixed.
91
+
92
+ ### Don't
93
+ The default, horizontal pill `Tabs` wraps into a ragged block in the rail. Give the rail `orientation="vertical"`.
94
+ ```tsx
95
+ import { Card, Tabs, PageHeader, SidebarLayout, Text } from "@slashsuite/ui-react";
96
+
97
+ <SidebarLayout
98
+ aside={
99
+ <Tabs
100
+ label="Settings"
101
+ items={[
102
+ { label: "Profile", href: "#profile", selected: true },
103
+ { label: "Billing", href: "#billing" },
104
+ { label: "Team", href: "#team" },
105
+ ]}
106
+ />
107
+ }
108
+ >
109
+ <PageHeader title="Profile" description="Your name and email." />
110
+ <Card title="Account">
111
+ <Text>Naledi Mokoena, naledi@example.com</Text>
112
+ </Card>
113
+ </SidebarLayout>
114
+ ```
115
+
116
+ ### Accessibility
117
+ - The rail is an `<aside>` holding the `Tabs`, which is a `<nav>` named by its `label`. `asideLabel` also names the `<aside>`, so a page with a second complementary landmark (a `DetailLayout` aside) can tell them apart.
118
+ - The current link has `aria-current="page"`.
119
+ - In the DOM the rail comes first, so it is first in the tab order; folded, the summary is that first stop and the links are skipped until it is opened.
120
+ - With `asideLabel` the rail is a native `<details>` disclosure: its `<summary>` is the toggle, on the keyboard like any button. From `md` the `<details>` is open for real (after the page loads; before that, and with no JavaScript, the CSS shows it), so the links are in the accessibility tree.
121
+ - A rail that scrolls itself is still in the tab order, and a focus ring on a link in it is not cut off at the rail's edge. A rail of links has no tab stop of its own; a rail that scrolls and holds no link takes one, named by `asideLabel`.
122
+
123
+ ### Props
124
+ ### SidebarLayout
125
+ An `aside` of links (the rail) beside the `children` canvas, in the Container the shell already gives every page (a plain `<AppShell>`, no `bleed`): the rail starts at the header logo's x and the canvas ends at the header's right edge. The rail has no background and no border, so it is a list of links on the page; a `Tabs orientation="vertical"` is its content. From `md` it is `w-56` with the canvas filling the rest, and it stays in view under the shell's header as a long page scrolls; a rail taller than the screen scrolls itself, so its last link is reachable. Below `md` it stacks above the canvas and nothing sticks. A long rail sets `asideLabel`: below `md` it then folds behind a disclosure of that name, closed, so the page comes first on a phone, and from `md` it is the same rail; `asideLabel` also names the rail's `<aside>` landmark. Once the page has loaded, a rail that scrolls shows its current link (the one with `aria-current`) in view, and the folded disclosure reads `asideLabel` and the current link's name ("All components: Button"); both need the layout to hydrate. While `loading` the canvas waits (the rail is navigation, drawn as itself) and the layout owns the wait.
126
+ - aside: ReactNode (required). The links beside the canvas, usually a `Tabs orientation="vertical"`.
127
+ - asideLabel: string. Folds the rail behind a disclosure with this name below `md` (a long rail), and names the rail's
128
+ `<aside>` landmark. Left out, the rail is always open and the aside is unnamed.
129
+
130
+ Folded, the page comes first on a phone; from `md` it is the same rail.
131
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
132
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
133
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
134
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
@@ -0,0 +1,63 @@
1
+ ## SiteFooter
2
+
3
+ Group: Layout
4
+
5
+ When to use: The footer of a marketing site or a docs site, in `AppShell`'s `footer` slot. An app with no footer leaves the slot empty.
6
+
7
+ ### The one right way
8
+ A site's footer is a `SiteFooter` in `AppShell`'s `footer` slot: the shell draws the one footer landmark around it.
9
+ ```tsx
10
+ import { SiteFooter, Text } from "@slashsuite/ui-react";
11
+
12
+ <SiteFooter
13
+ links={[
14
+ { label: "Privacy", href: "/privacy" },
15
+ { label: "Terms", href: "/terms" },
16
+ ]}
17
+ notes={["Hack Cove (Pty) Ltd"]}
18
+ >
19
+ <Text>Email hello@example.com</Text>
20
+ </SiteFooter>
21
+ ```
22
+
23
+ ### Do
24
+ - Put it in `AppShell`'s `footer` slot: `<AppShell footer={<SiteFooter ... />}>`.
25
+ - `brand` is the site's mark, linked to `brandHref` (the `LinkProvider`'s `home` by default, else `/`) and named by `brandLabel`. `children` is the contact line beside it, at body size.
26
+ - `links` are the site's own pages (Privacy, Terms, GitHub, a mail address), one wrapping row; `external` opens one in a new tab. `notes` are lines of fine print under them (a licence, a legal name, a credit), one paragraph each.
27
+ - Links go through the app's `LinkProvider`, like every link.
28
+
29
+ ### Don't
30
+ - Do not add link columns, a newsletter form or social icons: a site footer is this and nothing else.
31
+
32
+ A footer built from a `Stack` of `Caption`s and a `MetaList` by hand drifts from every other site's.
33
+ ```tsx
34
+ import { Caption, MetaList, Stack, Text, TextLink } from "@slashsuite/ui-react";
35
+
36
+ <Stack gap="xs">
37
+ <Text>Email hello@example.com</Text>
38
+ <MetaList>
39
+ <TextLink href="/privacy">Privacy</TextLink>
40
+ <TextLink href="/terms">Terms</TextLink>
41
+ </MetaList>
42
+ <Caption>Hack Cove (Pty) Ltd</Caption>
43
+ </Stack>
44
+ ```
45
+
46
+ ### Accessibility
47
+ - It is not a `<footer>`: `AppShell` draws the one `contentinfo` landmark around its slot, so the page has exactly one.
48
+ - The brand is one link named by `brandLabel`, or by its own text.
49
+ - The links are a list, so a screen reader counts them.
50
+
51
+ ### Props
52
+ ### SiteFooter
53
+ The footer a site puts in `AppShell`'s `footer` slot: the site's mark linked home with a contact line beside it, a row of the site's own links (Privacy, Terms, GitHub), then lines of fine print. It is not a `<footer>`: the shell draws the one `contentinfo` landmark around its slot. No link columns, newsletter form or social icons: a site footer is this and nothing else.
54
+ - brand: ReactNode. The site's mark (a wordmark, a logo), linked to `brandHref`. Left out, there is no brand.
55
+ - brandHref: string (default the nearest `LinkProvider`'s `home`, else "/"). Where the brand links. Needs `brand`.
56
+ - brandLabel: string. Names the brand link for assistive tech ("PixelSlash home"). Needs `brand`.
57
+ - children: ReactNode. A sentence at body size beside the brand: the contact line ("Email hello@...").
58
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
59
+ - links: readonly SiteFooterLink[] (default []). The site's own links (Privacy, Terms, GitHub, a mail address), one wrapping row.
60
+ - notes: readonly ReactNode[] (default []). Lines of fine print under the links (a licence, a trademark, a credit), one paragraph each.
61
+
62
+ ### Types
63
+ - SiteFooterLink: `{ label: string; href: string; external?: boolean }`. One link in a `SiteFooter`'s row: its words, where it goes, and whether it opens a new tab.
@@ -0,0 +1,79 @@
1
+ ## SiteSearch
2
+
3
+ Group: Navigation
4
+
5
+ When to use: A site with more pages than a reader can scan in its nav: a docs site, an app with many sections.
6
+
7
+ ### The one right way
8
+ `SiteSearch` in the header's `controls`, beside the colour toggle, given every page: one search, on every page, with a shortcut.
9
+ ```tsx
10
+ import { Cluster, ColourSchemeToggle, SiteSearch } from "@slashsuite/ui-react";
11
+
12
+ <Cluster gap="sm">
13
+ <SiteSearch
14
+ label="Search components"
15
+ items={[
16
+ { label: "Dialog", description: "A modal window.", href: "#dialog" },
17
+ { label: "Tabs", description: "Switch a view in place.", href: "#tabs" },
18
+ ]}
19
+ />
20
+ <ColourSchemeToggle size="sm" store={false} />
21
+ </Cluster>
22
+ ```
23
+
24
+ ### Do
25
+ - Put one `SiteSearch` in `AppShell`'s `controls`, on every page, and pass every page as `items`: `{ label, description, href, keywords }`.
26
+ - `label` names the phone's icon button and titles the dialog: say what is searched ("Search components"). For an app in another language: `resultsLabel` names the list of matches ("Results"), `buttonLabel` is the wide button's text ("Search"), `placeholder` the field's ("Search"), `hintLabel` the line before typing ("Type a name"), `noResultsLabel` the words before the typed text when nothing matches ("No results for"), `allResultsLabel` the words before it on the full results link ("See all results for") and `countLabel` turns the count into what a screen reader hears ("3 results").
27
+ - Give `items` in the nav's order: results of the same rank keep it.
28
+ - `keywords` are other names a page answers to (the exports it documents); they match but are not shown.
29
+ - A result ranks by the name starting with the text, then the name containing it, then a keyword, then the description.
30
+ - From `sm` up the button reads `buttonLabel` (Search) with its key (Ctrl K, or ⌘ K on a Mac); below `sm` it is the search icon alone.
31
+ - It searches names, not page text, and needs no service. A site that also has a full text search page passes `resultsHref`, the page's address for a query (`(query) => '/search?q=' + encodeURIComponent(query)`): its link is the last row once something is typed, matches or not, and Enter in the field goes there.
32
+ - `size` sets the button's height on a `Button`'s scale (default `sm`), so it lines up with the header's other controls of the same size.
33
+
34
+ ### Don't
35
+ A field and a hand-filtered list in the page body is a second search with no shortcut, no keys and no count read out. Use `SiteSearch`.
36
+ ```tsx
37
+ import { Input, ListRow, Stack } from "@slashsuite/ui-react";
38
+
39
+ <Stack gap="sm">
40
+ <Input type="search" aria-label="Filter" icon="search" defaultValue="dia" />
41
+ <Stack divided>
42
+ <ListRow href="#dialog" size="sm">
43
+ Dialog
44
+ </ListRow>
45
+ <ListRow href="#field-dialog" size="sm">
46
+ FieldDialog
47
+ </ListRow>
48
+ </Stack>
49
+ </Stack>
50
+ ```
51
+
52
+ ### Accessibility
53
+ - Ctrl+K or Cmd+K opens it from anywhere on the page; the button carries `aria-keyshortcuts`.
54
+ - It opens a `Dialog` titled by `label` with focus in the search field; Esc closes it and focus goes back to where it was.
55
+ - The field is a `search` landmark. Enter opens the first result, or with `resultsHref` the full results page; an Enter that commits an input method's composition does nothing. ArrowDown moves from the field to the results and ArrowUp and ArrowDown move between them; they are links, so Tab reaches them too.
56
+ - A polite live region reads the result count as you type ("3 results").
57
+
58
+ ### Props
59
+ ### SiteSearch
60
+ The site's search: a header button that opens a dialog with a search field over a list of links to the pages that match. Put it in `AppShell`'s `controls` and pass every page as `items`. Ctrl+K (⌘ K on a Mac) opens it from anywhere on the page, and the button shows that key. Typing filters by name, then by `keywords`, then by description; Enter opens the first result (or, with `resultsHref`, the full results page), the arrow keys move through them, and Esc closes it and puts focus back where it was. The field is a `<search>` landmark. Render it once per page.
61
+ - allResultsLabel: string (default See all results for). The full results link's text; the typed text follows it: "See all results for tabel".
62
+ - buttonLabel: string (default Search). The wide button's text, which is also its accessible name.
63
+ - countLabel: ((count: number) => string) (default `No results`, `1 result`, `4 results`). What a screen reader hears for the number of matches once something is typed.
64
+ - hintLabel: string (default Type a name). The muted line under the field before anything is typed.
65
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
66
+ - items: readonly SiteSearchItem[] (required). Every page to search, in the order ties are listed (the rail's order).
67
+ - label: string (required). The dialog's title and the phone's icon button's accessible name: "Search components". The wide
68
+ button is named by its own text, `buttonLabel`.
69
+ - noResultsLabel: string (default No results for). The muted line when nothing matches; the typed text follows it: "No results for tabel".
70
+ - placeholder: string (default Search). The search field's placeholder.
71
+ - resultsHref: ((query: string) => string). The site's full results page for a query, built from the typed text (trimmed):
72
+ `(query) => "/search?q=" + encodeURIComponent(query)`. Given, a link to it is the last row
73
+ once something is typed, matches or not, and Enter in the field goes there.
74
+ - resultsLabel: string (default Results). The name of the list of matches, for an app in another language.
75
+ - size: "sm" | "md" | "lg" (default sm). The trigger's height and text, on the scale of a `Button` and an `IconButton`, so it lines up
76
+ with the other controls in a header row.
77
+
78
+ ### Types
79
+ - SiteSearchItem: `{ label: string; description?: string; href: string; keywords?: string[] }`. One page the search can find.
@@ -0,0 +1,59 @@
1
+ ## Slider
2
+
3
+ Group: Forms
4
+
5
+ When to use: A value set by eye where near enough is fine: an opacity, a volume, a price range filter.
6
+
7
+ ### The one right way
8
+ A level set by eye (an opacity, a volume) is a `Slider` in a `Field`, its value written beside it.
9
+ ```tsx
10
+ import { Field, Slider } from "@slashsuite/ui-react";
11
+
12
+ <Field label="Overlay opacity">
13
+ <Slider defaultValue={0.6} min={0} max={1} step={0.05} formatOptions={{ style: "percent" }} />
14
+ </Field>
15
+ ```
16
+
17
+ ### Do
18
+ - Put a `Slider` in a `Field`, which names it and draws its hint and error, as an `Input`.
19
+ - Set `min`, `max` and `step`; without them it runs 0 to 100 in steps of 1 and starts halfway.
20
+ - Its value is written beside the track; `formatOptions` sets how (`{ style: "percent" }` for 0 to 1) and assistive tech reads it the same way.
21
+ - Keep it with `defaultValue`, or control it with `value` and the input's own `onChange`.
22
+ - `size` and `width` are the same choices as on `Input`.
23
+ - A figure the person must hit exactly is a `NumberField`.
24
+
25
+ ### Don't
26
+ A figure the person must hit exactly is typed: a `NumberField`, not a `Slider`.
27
+ ```tsx
28
+ import { NumberField } from "@slashsuite/ui-react";
29
+
30
+ <NumberField
31
+ label="Overlay opacity"
32
+ defaultValue={0.6}
33
+ minValue={0}
34
+ maxValue={1}
35
+ step={0.05}
36
+ formatOptions={{ style: "percent" }}
37
+ />
38
+ ```
39
+
40
+ ### Accessibility
41
+ - A native `<input type="range">`: arrow keys, Page Up, Page Down, Home and End move it, and it keeps the browser's touch handling.
42
+ - `aria-valuetext` is the written value, so a screen reader hears "40%", not "0.4".
43
+ - The focus ring comes from the component.
44
+
45
+ ### Props
46
+ ### Slider
47
+ A range slider for one number between `min` and `max` (0 and 100 unless given), in steps of `step`: the browser's own `<input type="range">` in the accent colour, with its value written beside the track (`formatOptions` sets how) and read out the same way. Put it in a `Field`, which names it and draws the hint and the error, as an `Input`. Arrow keys, Page Up, Page Down, Home and End move it. `size` sets its height and the value's type, to line up with an `Input` of that size; `width` is an `Input`'s. `onChange` is the input's own, on every move. The `ref` reaches the `<input>`.
48
+ - defaultValue: number. The number it starts with, uncontrolled. Without one it starts halfway, as the browser's does.
49
+ - formatOptions: NumberFormatOptions. How the value beside the track is written, in the locale of the app's `I18nProvider` or else
50
+ the browser's: `{ style: "percent" }` (for a value from 0 to 1), `{ style: "currency",
51
+ currency: "EUR" }`, `{ style: "unit", unit: "kilogram" }`. Assistive tech reads it the same way.
52
+ - ref: Ref<HTMLInputElement>. The `<input>` itself, for focus control.
53
+ - size: Size | ResponsiveSize (default md). `sm` is compact, `text-sm` with less padding, for dense forms and table rows; `md` is `text-base`;
54
+ `lg` is `text-lg` with more padding, for a hero form. Under an `AppShell density="compact"` each
55
+ is one type step down, and on a touch screen a field is never under 16px.
56
+ `{ base: "md", md: "lg" }` changes size at the `md` breakpoint (48rem), in CSS, as a `Button`'s
57
+ does: give the field and the buttons in its row the same value, so the row stays aligned.
58
+ - value: number. The number it holds, controlled, with `onChange`.
59
+ - width: "sm" | "md" | "lg" | "auto" | "xs" | "fill" | "full" (default full). `full` (default) fills the parent; `fill` grows to fill the room left in a row beside other items (it can shrink to nothing, so buttons stay on the line); `xs`, `sm`, `md`, `lg` are fixed; `auto` adds no width class, so the control is as wide as the browser makes it.
@@ -0,0 +1,112 @@
1
+ ## SortableList
2
+
3
+ Group: Data
4
+
5
+ When to use: A list the user puts in order, such as a priority queue: tasks under priority bands, the next one on top.
6
+
7
+ ### The one right way
8
+ The list reports a move and the app applies it to its own data, so a drag or the keyboard reorders it.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import { SortableItem, SortableList } from "@slashsuite/ui-react";
12
+
13
+ function Example() {
14
+ const [tasks, setTasks] = useState([
15
+ "Ship the invoice export",
16
+ "Book the car service",
17
+ "Review the quote",
18
+ ]);
19
+ return (
20
+ <SortableList
21
+ label="Queue"
22
+ onReorder={(move) => {
23
+ const rest = tasks.filter((task) => task !== move.id);
24
+ const after = move.target?.position === "after" ? 1 : 0;
25
+ const at = move.target ? rest.indexOf(move.target.id) + after : rest.length;
26
+ setTasks([...rest.slice(0, at), move.id, ...rest.slice(at)]);
27
+ }}
28
+ >
29
+ {tasks.map((task) => (
30
+ <SortableItem key={task} id={task} title={task} />
31
+ ))}
32
+ </SortableList>
33
+ );
34
+ }
35
+ ```
36
+
37
+ ### Do
38
+ - Map your data straight to the parts: a `SortableList` with a `label`, a `SortableSection` per group (`id`, `title`) and a `SortableItem` per row (`id`, `title`). Each item is a direct child of its section, and each section a direct child of the list; an item wrapped in your own component is not counted or placed.
39
+ - `onReorder` reports each drop as `{ id, section, target }`: the item that moved, the section it lands in, and `{ id, position }`, the item it was dropped before or after. Apply it to your own data and render again. The list never reorders itself.
40
+ - Moving an item into another section is how the user changes its group, such as a ticket's priority: read `section`, not the old one.
41
+ - An empty section shows a quiet "Drop here" row and still takes a drop. A drop there reports `{ id, section }` with no `target`.
42
+ - Put a meta line in a `SortableItem`'s children: `Pill`s, an `Avatar`.
43
+ - A list with no groups takes `SortableItem`s directly, and its moves have no `section`. Two lists on one page never take each other's items.
44
+
45
+ ### Don't
46
+ - Do not put buttons or links in a row: the arrow keys move between rows and the handle.
47
+ - Do not add up and down buttons to rows: the drag and the keyboard already move an item, and buttons cannot move it into another section.
48
+
49
+ Up and down buttons on every row are a wall of controls, and they cannot move a task into another band.
50
+ ```tsx
51
+ import { Button, Card, ListRow, Stack } from "@slashsuite/ui-react";
52
+
53
+ <Card flush>
54
+ <Stack divided>
55
+ {["Ship the invoice export", "Book the car service", "Review the quote"].map((task) => (
56
+ <ListRow
57
+ key={task}
58
+
59
+ actions={
60
+ <>
61
+ <Button size="sm" variant="outline">
62
+ Up
63
+ </Button>
64
+ <Button size="sm" variant="outline">
65
+ Down
66
+ </Button>
67
+ </>
68
+ }
69
+ >
70
+ {task}
71
+ </ListRow>
72
+ ))}
73
+ </Stack>
74
+ </Card>
75
+ ```
76
+
77
+ ### Accessibility
78
+ - The list is a grid with one row per item. Tab moves into it, and the arrow keys move between rows.
79
+ - To move an item from the keyboard: on its row, press the Right arrow to reach its grip handle, named "Reorder <title>" (`reorderLabel` renames the word), and press Enter. Each Up or Down arrow moves the drop line one gap, across section headings and into an empty section's "Drop here" row, and Enter drops. Escape cancels, leaves the order as it was and puts focus back on the handle. Tab does not leave the list during a move: it steps between the page's drop areas, and only Enter or Escape ends it.
80
+ - While an item is moved, a screen reader announces it by its `title` and announces each drop position.
81
+ - A `title` too long for the row is cut with an ellipsis and shows in full in a tooltip on hover, a tap and while its row has keyboard focus; the row's name is already the whole title.
82
+ - A pointer drags an item by its grip handle only, so text in a row can still be selected; on a touch screen a long press on the handle starts the drag. The other rows slide to their new places, with no motion under `prefers-reduced-motion`.
83
+ - Section headings are row headers with the section's title, and the "Drop here" row cannot be focused or dragged.
84
+
85
+ ### Props
86
+ ### SortableList
87
+ A list the user puts in order: items under section headings, moved by dragging a row or from the keyboard (each row's grip handle, Enter, the arrow keys, Enter to drop, Escape to cancel). A drop reports `onReorder` with the item, the section it lands in and the item it lands next to; the app applies it to its own data. The list never reorders itself: it shows what its children say. Its children are `SortableSection`s, or `SortableItem`s directly for a list with no sections, each a direct child (map your data straight to them). Moving an item into another section is how the app changes its group, such as a ticket's priority. Two lists on one page never take each other's items.
88
+ - children: ReactNode (required). `SortableSection`s, or `SortableItem`s for a list with no sections.
89
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
90
+ - label: string (required). The list's accessible name, read by a screen reader.
91
+ - onReorder: (move: SortableMove) => void (required). Called once per drop with the move; apply it to your data.
92
+
93
+ ### SortableSection
94
+ One group of a `SortableList` under a heading that shows its title and how many items it holds. An empty section still takes a drop: it shows a quiet "Drop here" row in place of items.
95
+ - children: ReactNode. Its `SortableItem`s, each a direct child. With none it shows a quiet `emptyLabel` row.
96
+ - emptyLabel: string (default Drop here). The quiet row an empty section shows, where a drop lands.
97
+ - endLabel: string (default End of). The word before `title` in the name of the section's last drop place, which a screen reader
98
+ announces while a move lands there: "End of Doing".
99
+ - id: string. The section's id, reported as `section` in a move that lands in it.
100
+ The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
101
+ - title: string (required). The heading over its items.
102
+
103
+ ### SortableItem
104
+ One row of a `SortableList`: a grip handle, the title, and an optional meta line under it. A pointer drags the row by its handle only (a drag that starts anywhere else on the row is no drag); the handle (`reorderLabel` and the title, "Reorder <title>") is also how a keyboard or screen reader starts a move. A title cut to one line shows in full in a tooltip on hover, on the row's keyboard focus and on a tap.
105
+ - children: ReactNode. A meta line under the title: `Pill`s, an `Avatar`.
106
+ - id: string. The item's id, reported in a move.
107
+ The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
108
+ - reorderLabel: string (default Reorder). The word before `title` in the handle's accessible name: "Reorder Write the brief".
109
+ - title: string (required). Its one line; also what a screen reader announces while it is dragged.
110
+
111
+ ### Types
112
+ - SortableMove: `{ id: string; section?: string; target?: { id: string; position: "before" | "after" } }`. A move the user made: which item, the section it lands in, and the item it lands next to.
@@ -0,0 +1,54 @@
1
+ ## SplitBar
2
+
3
+ Group: Data
4
+
5
+ When to use: Two sides of one total: a pot split between two goals, for and against.
6
+
7
+ ### The one right way
8
+ Give `names` so a screen reader hears whose share is whose, and draw the names under the bar for everyone else.
9
+ ```tsx
10
+ import { Caption, Cluster, SplitBar, Stack } from "@slashsuite/ui-react";
11
+
12
+ <Stack gap="xs">
13
+ <SplitBar a={35} b={65} label="Pot split" names={["Debt", "Renos"]} />
14
+ <Cluster justify="between">
15
+ <Caption as="span">Debt 35%</Caption>
16
+ <Caption as="span">Renos 65%</Caption>
17
+ </Cluster>
18
+ </Stack>
19
+ ```
20
+
21
+ ### Do
22
+ - `a` is the left party and `b` the right; each is sized by its share of `a + b`.
23
+ - Give `names` as `[left, right]`, and draw the same names under the bar yourself; the bar draws no text.
24
+ - `toneA` defaults to `danger` and `toneB` to `positive`. Set both when neither side is good or bad, e.g. `accent` and `warn`. `size` is `sm`, `md` (default) or `lg`.
25
+ - More than two parts are a `StackedBar`; progress toward a total is a `ProgressBar`.
26
+
27
+ ### Don't
28
+ No `names` and nothing under the bar: the two colours are never explained, and a screen reader hears two bare percentages.
29
+ ```tsx
30
+ import { SplitBar } from "@slashsuite/ui-react";
31
+
32
+ <SplitBar a={35} b={65} label="Pot split" />
33
+
34
+ ```
35
+
36
+ ### Accessibility
37
+ - A SplitBar has `role="img"` and an `aria-label` of `label` followed by each side's whole percent.
38
+ - With `names` it hears each name before its percent; without, only two bare percentages.
39
+ - Colour alone does not name the parties, so draw their names under the bar.
40
+
41
+ ### Props
42
+ ### SplitBar
43
+ A bar split between two parties, `a` on the left and `b` on the right, each sized by its share of `a + b`. `label` names the split for a screen reader, which hears both percentages; give `names` (left, right) so it hears whose is whose. Put the parties' names under the bar yourself. While `loading` it is one bone the bar's size, since 0 is a real value.
44
+ - a: number (required). The left party's amount; its share is `a` over `a + b`.
45
+ - b: number (required). The right party's amount; its share is `b` over `a + b`.
46
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
47
+ - label: string (required). What the split is, for a screen reader, which hears it before both percentages.
48
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
49
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
50
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
51
+ - names: readonly [string, string]. The left and right parties, spoken before their percentages.
52
+ - size: "sm" | "md" | "lg" (default md). The bar's height: `sm` 6px, `md` 8px, `lg` 12px.
53
+ - toneA: "positive" | "warn" | "danger" | "accent" (default danger). The left part's colour, by what it means (`accent`, `positive`, `warn` or `danger`). Defaults to "danger".
54
+ - toneB: "positive" | "warn" | "danger" | "accent" (default positive). The right part's colour, by what it means (`accent`, `positive`, `warn` or `danger`). Defaults to "positive".