@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,137 @@
1
+ ## Drawer
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A record or a form the reader works on beside the page, with actions that stay in view.
6
+
7
+ ### Use instead
8
+ - Dialog (dialog.md): A question, or a short form, must be answered before going on.
9
+ - BottomSheet (bottom-sheet.md): Content sits over a map or a canvas that must stay usable: not modal.
10
+ - FieldDialog (field-dialog.md): Only one text value is asked for.
11
+
12
+ ### The one right way
13
+ A record or a form beside the page: the title names it, the body scrolls and the actions stay pinned in `footer`.
14
+ ```tsx
15
+ import { useState } from "react";
16
+ import { Button, Drawer, KeyValue, KeyValueList } from "@slashsuite/ui-react";
17
+
18
+ function Example() {
19
+ const [open, setOpen] = useState(false);
20
+ return (
21
+ <>
22
+ <Button variant="outline" onClick={() => setOpen(true)}>
23
+ Open HC-65
24
+ </Button>
25
+ {open && (
26
+ <Drawer
27
+ title="HC-65 · Tabs"
28
+ onClose={() => setOpen(false)}
29
+ footer={
30
+ <>
31
+ <Button variant="ghost" onClick={() => setOpen(false)}>
32
+ Cancel
33
+ </Button>
34
+ <Button onClick={() => setOpen(false)}>Save</Button>
35
+ </>
36
+ }
37
+ >
38
+ <KeyValueList>
39
+ <KeyValue label="Status">In progress</KeyValue>
40
+ <KeyValue label="Owner">Jacobus</KeyValue>
41
+ </KeyValueList>
42
+ </Drawer>
43
+ )}
44
+ </>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### Do
50
+ - Render it only while it is open: `{open && <Drawer … onClose={() => setOpen(false)} />}`. It opens itself on mount.
51
+ - Use it for a record to read or edit, or a form with several fields; a yes-or-no question is a `Dialog`.
52
+ - The actions go in `footer`, pinned under the body, which scrolls between the header and the footer. A scroll that reaches the end of the body stops there and never moves the page behind.
53
+ - `width` is `sm`, `md` (the default) or `lg`; choose by the content, `sm` for one field and `lg` for a table. `description` is a muted line under the title, as on a `Dialog`.
54
+ - For a form, give it `onSubmit`, as on a `Dialog`: the body and the footer become one form, so a `Button type="submit"` in the footer or Enter in a field submits it. What went wrong with the whole submit is `error`, pinned above the footer; a field's own error is its `Field`'s.
55
+ - Set `closeLabel` to the reader's language when the page is not in English.
56
+ - It slides out again on close, but only while it is still in the DOM, so `onClose` is called once the exit has finished: put `setOpen(false)` there and nowhere else. Esc, the scrim and the close button close it that way already. A Cancel or Save button in the `footer` closes it by calling `.close()` on its `<dialog>`, which a click handler finds with `event.currentTarget.closest("dialog")`. A button that calls `setOpen(false)` itself unmounts the drawer at once, with no exit animation. After async work, keep the `<dialog>` from the event before the `await` and call `.close()` when it resolves.
57
+
58
+ ### Don't
59
+ A yes-or-no question is a `Dialog`: a full-height panel for one confirmation is more than it asks.
60
+ ```tsx
61
+ import { useState } from "react";
62
+ import { Button, Drawer, Text } from "@slashsuite/ui-react";
63
+
64
+ function Example() {
65
+ const [open, setOpen] = useState(false);
66
+ return (
67
+ <>
68
+ <Button variant="outline" onClick={() => setOpen(true)}>
69
+ Delete build
70
+ </Button>
71
+ {open && (
72
+ <Drawer
73
+ title="Delete build?"
74
+ width="sm"
75
+ onClose={() => setOpen(false)}
76
+ footer={<Button onClick={() => setOpen(false)}>Delete</Button>}
77
+ >
78
+ <Text>This removes the build and every snapshot in it.</Text>
79
+ </Drawer>
80
+ )}
81
+ </>
82
+ );
83
+ }
84
+ ```
85
+
86
+ A Save in the body scrolls out of view with a long form and leaves the footer empty.
87
+ ```tsx
88
+ import { useState } from "react";
89
+ import { Button, Drawer, Field, Input, Stack } from "@slashsuite/ui-react";
90
+
91
+ function Example() {
92
+ const [open, setOpen] = useState(false);
93
+ return (
94
+ <>
95
+ <Button variant="outline" onClick={() => setOpen(true)}>
96
+ Rename
97
+ </Button>
98
+ {open && (
99
+ <Drawer title="Rename" width="sm" onClose={() => setOpen(false)}>
100
+ <Stack>
101
+ <Field label="Name" htmlFor="drawer-rename-body">
102
+ <Input id="drawer-rename-body" defaultValue="Hack Cove" />
103
+ </Field>
104
+ <Button onClick={() => setOpen(false)}>Save</Button>
105
+ </Stack>
106
+ </Drawer>
107
+ )}
108
+ </>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ### Accessibility
114
+ - A Drawer is the browser's own `<dialog>` opened with `showModal()`: the page behind goes inert, focus stays inside it and Esc closes it.
115
+ - It is named by its `title`, an `h2`, through `aria-labelledby`.
116
+ - The header's close button is an `IconButton` named by `closeLabel` ("Close" by default); a click on the scrim closes it too.
117
+ - On a touch screen a swipe to the right drags it off: past a third of its width, or a quick flick, closes it, and a shorter one springs back. A vertical swipe scrolls the body, and a swipe that starts in a field or a slider is the field's own.
118
+ - Closing, or unmounting it, hands focus back to the element that opened it.
119
+ - The slide in and out is switched off under `prefers-reduced-motion: reduce`, and then it closes at once.
120
+
121
+ ### Props
122
+ ### Drawer
123
+ A modal slide-over anchored to the right edge, on the browser's own `<dialog>`: it is opened with `showModal()` on mount, so render it only while it is open. The page behind goes inert, Esc closes it and focus stays inside; a click on the scrim (the `<dialog>` element itself, not its contents) closes it too, and on touch a swipe to the right drags it off (a short one springs back). The header holds the title, an optional `description` under it and a close button; the body scrolls between it and an optional pinned `footer`, and a scroll in it never carries on to the page behind. `onSubmit` makes it a form and `error` shows what went wrong with the submit, as on a `Dialog`.
124
+ - closeLabel: string (default Close). The accessible name of the close button.
125
+ - description: ReactNode. A muted line under the title, as on a `Dialog`.
126
+ - error: ReactNode. What went wrong with the whole submit, as on a `Dialog`: a danger `Callout`, announced as an
127
+ alert, pinned between the body and the footer. An error about one field is that `Field`'s `error`.
128
+ - footer: ReactNode. Actions pinned under the scrolling body, right-aligned: Cancel (`variant="ghost"`), then the one main action.
129
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
130
+ - onClose: () => void (required). Called when the drawer closes: Esc, a click on the scrim, the close button or a swipe to the right on touch.
131
+ - onSubmit: ((event: FormEvent<HTMLFormElement>) => void | Promise<unknown>). Makes the drawer a form, as on a `Dialog`: one `<form noValidate>` holds the body, the `error`
132
+ and the footer, so a `Button type="submit"` in the footer or Enter in a field submits it. The
133
+ default is prevented before this runs, and a rejection is yours to catch and show as `error`.
134
+ Once the submit settles, the focus moves to the first field marked invalid
135
+ (`aria-invalid="true"`), if any.
136
+ - title: ReactNode (required). The drawer's accessible name, shown as its heading.
137
+ - width: "sm" | "md" | "lg" (default md). The panel's width: `md` holds a form or a record; `sm` (320px) is narrower and `lg` (640px) wider.
@@ -0,0 +1,48 @@
1
+ ## EmbedFrame
2
+
3
+ Group: Content
4
+
5
+ When to use: Showing a third party's map, player or form in an `<iframe>` inside your page.
6
+
7
+ ### Use instead
8
+ - Video (video.md): The video is your own file: the native player.
9
+
10
+ ### The one right way
11
+ The frame fixes the height and clips the corners; `status` covers the embed until its own load event says it is ready.
12
+ ```tsx
13
+ import { EmbedFrame } from "@slashsuite/ui-react";
14
+
15
+ <EmbedFrame label="Map of the shops" height="sm" status="loading">
16
+ <iframe title="Map of the shops" src="about:blank" sandbox="allow-scripts" />
17
+ </EmbedFrame>
18
+ ```
19
+
20
+ ### Do
21
+ - Put the `<iframe>` or the map's container as the child: it fills the frame, which rounds and clips its corners and draws the hairline.
22
+ - `height` is `sm` (18rem), `md` (24rem, the default) or `viewport`, 55% of the screen's height, for a map that is the page's main content.
23
+ - `status` is `ready` (the default), `loading` or `error`. Set it from the embed's own load and error events: `loading` lays a pulsing cover over the embed, `error` lays `errorLabel` over it.
24
+ - `label` names the frame for a screen reader; give the `<iframe>` its own `title` as well.
25
+ - `errorLabel` says what failed and what to do, as "The map could not load. Check the address below."; the default is "Could not load.".
26
+
27
+ ### Don't
28
+ A bare `<iframe>` keeps the browser's 150px height and square border, and shows a blank box while it loads or after it fails.
29
+ ```tsx
30
+ <iframe title="Map of the shops" src="about:blank" sandbox="allow-scripts" />
31
+ ```
32
+
33
+ ### Accessibility
34
+ - A region named by `label`. While `loading` it is `aria-busy` and says `loadingLabel` to a screen reader.
35
+ - The error words are an alert, announced when they appear. The embed stays mounted under both covers.
36
+
37
+ ### Props
38
+ ### EmbedFrame
39
+ A rounded, clipped frame with a hairline, at a fixed height, for a map or an `<iframe>`: the embed in `children` fills it. `status` lays a centred overlay over the embed while it loads or after it failed; the embed stays mounted under it, so it can finish loading. The frame is a region named by `label`.
40
+ - children: ReactNode (required). The embed: an `<iframe>` or a map's container. It fills the frame.
41
+ - errorLabel: string (default Could not load.). The words over the embed when `status` is `error`: say what failed and what to do.
42
+ - height: "sm" | "md" | "viewport" (default md). `sm` 18rem, `md` 24rem, or `viewport`, 55% of the small viewport's height, for a map that is
43
+ the page's main content.
44
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
45
+ - label: string (required). Names the frame's region: what the embed shows, as "Map of the shops".
46
+ - loadingLabel: string (default Loading). What a screen reader hears while `status` is `loading`.
47
+ - status: "loading" | "error" | "ready" (default ready). `loading` lays a pulsing cover over the embed and marks the region busy; `error` lays
48
+ `errorLabel` over it, announced. Set it from the embed's own load and error events.
@@ -0,0 +1,70 @@
1
+ ## EmptyState
2
+
3
+ Group: Feedback
4
+
5
+ When to use: A whole page or list with no content yet: say what belongs here and offer the first step.
6
+
7
+ ### Use instead
8
+ - Callout (callout.md): There is content, and a line or two about it must be seen.
9
+ - Status pages (status-pages.md): The route itself cannot show, not just its content.
10
+
11
+ ### The one right way
12
+ An empty page says what belongs here and offers the first step as the primary action.
13
+ ```tsx
14
+ import { Button, EmptyState, Text } from "@slashsuite/ui-react";
15
+
16
+ <EmptyState title="No builds yet" actions={<Button>Create a project</Button>}>
17
+ <Text>Builds appear here once a project has uploaded its first capture.</Text>
18
+ </EmptyState>
19
+ ```
20
+
21
+ ### Do
22
+ - Give it a `title`, one `Text` that says what belongs here, and the first step as `actions`, with the primary `Button` first.
23
+ - For a get-started list, put `Steps` after the `Text` in the children.
24
+ - The title's heading level comes from where it sits: an `h2` on the page, an `h3` in a `Section`, so the outline does not skip or repeat; `level` sets it by hand and the look does not change.
25
+ - On its own it draws a dashed frame round itself; inside a `Card` the card is the frame. `icon` sets one of the library's icons above the title.
26
+ - It is the one empty look. Give it to the part's `empty` slot (`ListLayout`, `CardGrid`, `ChatThread`, `TableBody`, `Timeline`, a `Stack as="ul"`), which shows it when the part has no children: `empty={<EmptyState title="No invoices yet." />}` everywhere.
27
+ - The slot picks the size: one muted line (`size="sm"`, no heading) in a `TableBody`, a `Timeline` or a `Stack as="ul"`; the titled block (`md`) on a page, in a `CardGrid` or a `ChatThread`. `size` sets it by hand.
28
+ - `padding="inset"` pads all four sides, for an EmptyState in a `Card flush`, whose body has no padding of its own; the default pads above and below.
29
+
30
+ ### Don't
31
+ - Do not leave it as a title alone: a page with nothing in it and nothing to do is a dead end.
32
+
33
+ A bare "Nothing here" is a dead end: it does not say what belongs here or what to do next.
34
+ ```tsx
35
+ import { EmptyState } from "@slashsuite/ui-react";
36
+
37
+ <EmptyState title="Nothing here" />
38
+
39
+ ```
40
+
41
+ A muted `Text` written by hand is a second empty look, and it stays on screen when the list fills.
42
+ ```tsx
43
+ import { Card, Text } from "@slashsuite/ui-react";
44
+
45
+ <Card title="Builds">
46
+ <Text tone="muted">No builds yet.</Text>
47
+ </Card>
48
+ ```
49
+
50
+ ### Accessibility
51
+ - At `md` an EmptyState is a `<section>` named by its `title`, which is an `h2` unless `level` says otherwise, so it is a landmark region a screen reader can jump to.
52
+ - At `sm` it is a plain block whose title is a paragraph, so a table cell or a list adds no heading or region to the outline.
53
+ - The actions are ordinary buttons and links, in reading order after the explanation.
54
+
55
+ ### Props
56
+ ### EmptyState
57
+ The one empty look: what a list, a table or a page shows when there is nothing in it yet. Give it to the part's `empty` slot (`ListLayout`, `CardGrid`, `TableBody`, `Timeline`, `ChatThread`, a `Stack as="ul"`), which shows it when the part has no children and picks its size. `md` is a centred `title`, the `children` as the explanation under it (a `Text`, then `Steps` for a "get started" list), and `actions` (buttons, links) in a centred row at the bottom, with an optional `icon` above the title. A named `<section>`. On its own it draws a dashed frame round itself; inside a `Card` the card is the frame. `level` is the title's heading level, one below the heading that holds it: a 2 on the page, a 3 in a `Section`. `sm` is the one-line form for inside a table, a timeline or a list: the title as one centred muted line, the `children` under it in the same small text and the `actions` after. It is a plain block with no heading and no landmark, so a table cell or a card does not grow a region.
58
+ - actions: ReactNode. Buttons or links in a centred row at the bottom.
59
+ - 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". One of the library's icons, at feature size in the muted ink above the title.
60
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
61
+ - level: 2 | 3 | 4 | 5 | 6 (default one below the heading that holds it: 2 on the page). The title's heading level, 2 to 6. It does not change how the title looks.
62
+ - padding: "default" | "inset" (default default). `inset` pads all four sides, for an empty state in a `Card flush`, whose body has no padding
63
+ of its own. `default` pads above and below only. On its own, outside a card, it pads all four
64
+ sides inside its frame either way.
65
+ - size: "sm" | "md" (default the slot's: sm in a TableBody, a Timeline or a Stack as="ul", else md). `md` is the titled block; `sm` one muted line with no heading, for inside a table, a timeline or
66
+ a list. `icon` and `level` do nothing at `sm`.
67
+ - title: ReactNode (required). The heading, centred: what is missing ("No projects yet"). It names the section.
68
+
69
+ ### Types
70
+ - EmptySize: `"sm" | "md"`. An `EmptyState`'s size: `md` a block with its heading, `sm` one muted line inside a card or a cell.
@@ -0,0 +1,98 @@
1
+ ## FieldDialog
2
+
3
+ Group: Feedback
4
+
5
+ When to use: Asking for a single name or value: new project, rename, a label.
6
+
7
+ ### Use instead
8
+ - FormLayout (form-layout.md): The form has several fields and a page of its own.
9
+ - Dialog (dialog.md): More than one field, or a question with no field.
10
+ - Drawer (drawer.md): A record or a long form with several fields.
11
+
12
+ ### The one right way
13
+ One value to ask for is a `FieldDialog`: it blocks an empty submit, shows the busy state and puts a rejection under the field.
14
+ ```tsx
15
+ import { useState } from "react";
16
+ import { Button, FieldDialog } from "@slashsuite/ui-react";
17
+
18
+ function Example() {
19
+ const [open, setOpen] = useState(false);
20
+ return (
21
+ <>
22
+ <Button variant="outline" onClick={() => setOpen(true)}>
23
+ New project
24
+ </Button>
25
+ {open && (
26
+ <FieldDialog
27
+ title="New project"
28
+ description="Projects hold your builds and their reviews."
29
+ label="Name"
30
+ placeholder="my-project"
31
+ hint="Letters, numbers and dashes."
32
+ emptyReason="Type a name first."
33
+ submit="Create"
34
+ busyLabel="Creating…"
35
+ onSubmit={() => Promise.resolve()}
36
+ onClose={() => setOpen(false)}
37
+ />
38
+ )}
39
+ </>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ### Do
45
+ - Render it only while it is open, and give every string it shows: `title`, `label`, `placeholder`, `hint`, `emptyReason`, `submit` and `busyLabel`, and a `description` under the title when the question needs a sentence. `cancelLabel` rewords Cancel, for an app in another language.
46
+ - `onSubmit` gets the trimmed value and returns a promise. Resolving closes the dialog; rejecting shows the error message under the field and keeps the dialog open.
47
+ - More than one field is a `Dialog` with `onSubmit` holding its `Field`s, or a `Drawer`.
48
+
49
+ ### Don't
50
+ A `Dialog` with a hand-built field has no empty check, no busy state and no error line, and each copy drifts from the next.
51
+ ```tsx
52
+ import { useState } from "react";
53
+ import { Button, Dialog, Field, Input } from "@slashsuite/ui-react";
54
+
55
+ function Example() {
56
+ const [open, setOpen] = useState(false);
57
+ return (
58
+ <>
59
+ <Button variant="outline" onClick={() => setOpen(true)}>
60
+ New project
61
+ </Button>
62
+ {open && (
63
+ <Dialog
64
+ title="New project"
65
+ onClose={() => setOpen(false)}
66
+ footer={<Button onClick={() => setOpen(false)}>Create</Button>}
67
+ >
68
+ <Field label="Name" htmlFor="project-name">
69
+ <Input id="project-name" placeholder="my-project" />
70
+ </Field>
71
+ </Dialog>
72
+ )}
73
+ </>
74
+ );
75
+ }
76
+ ```
77
+
78
+ ### Accessibility
79
+ - It is a `Dialog`: native `<dialog>`, page behind inert, focus kept inside, Esc closes, named by its `title`.
80
+ - The input has focus when it opens and is named by `label`.
81
+ - The submit button is never disabled: an empty submit marks the field invalid, shows `emptyReason` as its error (announced politely) and moves the focus to it. Typing clears the error.
82
+ - While `onSubmit` is pending the button is busy (`aria-busy`); a rejection shows in the field's error line, announced politely from a live region inside the dialog.
83
+
84
+ ### Props
85
+ ### FieldDialog
86
+ A `Dialog` with one text field and Cancel / submit buttons. Render it only while open.
87
+ - busyLabel: string (required). What the submit button says while `onSubmit` runs.
88
+ - cancelLabel: string (default Cancel). The button that closes the dialog without submitting, for an app in another language.
89
+ - description: string. A muted line under the title.
90
+ - emptyReason: string (required). The field's error when it is submitted empty: the submit button stays enabled, so this says what is missing.
91
+ - hint: string (required). A muted line under the field.
92
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
93
+ - label: string (required). The visible label above the field, which names it.
94
+ - onClose: () => void (required). Called when the dialog closes: Cancel, Esc, the backdrop, or a resolved `onSubmit`.
95
+ - onSubmit: (value: string) => Promise<unknown> (required). Gets the trimmed value. Resolving closes the dialog; a rejection shows its message in it.
96
+ - placeholder: string (required). The field's placeholder.
97
+ - submit: string (required). The submit button's text.
98
+ - title: string (required). The dialog's heading and accessible name.
@@ -0,0 +1,71 @@
1
+ ## Field
2
+
3
+ Group: Forms
4
+
5
+ When to use: Every text, select or file control: it gets a label, visible unless its purpose is plain from what surrounds it.
6
+
7
+ ### The one right way
8
+ Every control sits in a `Field`, with no `htmlFor` and no `id`: the Field ties its label and hint to the control itself.
9
+ ```tsx
10
+ import { Field, Input } from "@slashsuite/ui-react";
11
+
12
+ <Field label="Display name" hint="Shown on your reviews.">
13
+ <Input />
14
+ </Field>
15
+ ```
16
+
17
+ ### Do
18
+ - Wrap every `Input`, `Textarea` and `Select` in a `Field`, with no `htmlFor` and no `id` on the control: the `Field` links its label, hint and error to the control itself, and the `label` is always in the accessibility tree. Pass `htmlFor` only when something else must name the control by a fixed id.
19
+ - `labelHidden` draws no label text but keeps it for assistive tech: use it only when the control's purpose is plain from what surrounds it (a search box in a toolbar). Otherwise leave the label visible; a placeholder is not a label. With `layout="row"` it draws as a column.
20
+ - A `hint` is the one line of help under the control.
21
+ - `required` puts a red asterisk after the label (hidden from a screen reader, which hears the control's own required state) and marks the control required.
22
+ - A validation message is `error`, not `hint`: a red line with an alert icon under the hint, which stays in view while the value is fixed.
23
+ - Inside a `FormGrid` a `Field` takes one column; `span="full"` runs it across both.
24
+ - A `Checkbox`, a `Switch`, a `RadioGroup`, a `DateField` and a `NumberField` draw their own `label` and note (a `hint`, and an `error` under it); do not wrap them in a `Field`. A group of them is a `Fieldset`.
25
+ - `layout="row"` puts the label beside the control, for a compact setting or a drawer row: the hint or error sits under the control, and stacked rows line their controls up.
26
+
27
+ ### Don't
28
+ A placeholder is not a label: it vanishes as soon as the person types, and it names nothing for a screen reader.
29
+ ```tsx
30
+ import { Input } from "@slashsuite/ui-react";
31
+
32
+ <Input placeholder="Display name" />
33
+
34
+ ```
35
+
36
+ An error passed as the `hint` looks like help text: it is grey and is not announced.
37
+ ```tsx
38
+ import { Field, Input } from "@slashsuite/ui-react";
39
+
40
+ <Field label="Display name" hint="Pick a shorter name.">
41
+ <Input defaultValue="A very long display name indeed" />
42
+ </Field>
43
+ ```
44
+
45
+ ### Accessibility
46
+ - The label is a real `<label>` tied to the control, so clicking the text focuses the control and a screen reader reads it as the control's name.
47
+ - An `error` is not an alert: its text is announced once, politely, through the page's one live region for field errors (the open dialog's, inside a dialog), so several errors at once queue rather than interrupt each other.
48
+ - The control is described by the hint and then the error through `aria-describedby`, so a screen reader on the control hears both.
49
+ - The control is `aria-invalid="false"` until an error shows; an `error` marks it `aria-invalid` and turns its edge red. A value the browser finds invalid (`required`, `type="email"`) turns the edge red too, once the user has changed it or tried to submit.
50
+
51
+ ### Props
52
+ ### Field
53
+ A label above a control, with a hint line under it and, when set, an error line under the hint (an alert icon and red text, announced politely). The hint stays while the error shows. `required` marks the label with a red asterisk and makes the control inside `required`. Inside a `FormGrid`, `span="full"` runs the field across both columns. The `Input`, `Select`, `Textarea` or `FileDrop` inside takes the label, the note (`aria-describedby`) and, with an error, `aria-invalid` and a red edge by itself: give it no `id` and the Field no `htmlFor`. While `loading` the label is drawn and the control is a bone of its height, read from the density around it (`sm` in a `sm` card or table).
54
+ - error: ReactNode. A red line under the hint, with an alert icon; the control is `aria-invalid` while it shows.
55
+ - hint: ReactNode. A muted line under the control that says more.
56
+ - htmlFor: string. A fixed id for the control inside, only when something else must name it. Unset, the Field makes one.
57
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
58
+ - label: ReactNode (required). The text above the control.
59
+ - labelHidden: boolean (default false). Keeps the `label` in the page for assistive tech and draws no text, for a control whose purpose
60
+ is plain from what surrounds it (a search box in a toolbar). `label` stays required, so the
61
+ control always has a name. With `layout="row"` the field draws as a column: an empty label
62
+ column helps nobody.
63
+ - layout: "row" | "column" (default column). `row` puts the label beside the control, for a compact setting or a drawer row; the hint or
64
+ error sits under the control. Every row label takes the same fixed column, so stacked rows line
65
+ their controls up; a long label wraps inside it. `column` puts the label above it.
66
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
67
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
68
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
69
+ - required: boolean (default false). The control must be filled: a red asterisk after the label (hidden from assistive tech) and
70
+ `required` on the `Input`, `Select`, `Textarea` or `FileDrop` inside.
71
+ - span: "full". `full` spans every column of a `FormGrid`; unset takes one. It does nothing outside a `FormGrid`.
@@ -0,0 +1,82 @@
1
+ ## Fieldset
2
+
3
+ Group: Forms
4
+
5
+ When to use: Several controls that answer one question or belong together, under one name.
6
+
7
+ ### Use instead
8
+ - Tabs (tabs.md): One choice switches the panel right under the row.
9
+ - SegmentedControl (segmented-control.md): Exactly one of two to five options is on: a mode or a range.
10
+ - Button (button.md): One toggle on its own, not a named group: a `Button` with `pressed`.
11
+
12
+ ### The one right way
13
+ Checkboxes for one question go in a `Fieldset`, so a screen reader hears the question on entering the group.
14
+ ```tsx
15
+ import { Checkbox, Fieldset } from "@slashsuite/ui-react";
16
+
17
+ <Fieldset label="What is wrong?">
18
+ <Checkbox label="Wrong opening hours" />
19
+ <Checkbox label="Closed for good" />
20
+ </Fieldset>
21
+ ```
22
+
23
+ ### Do
24
+ - Several checkboxes answering one question: a `Fieldset` with the `Checkbox`es straight inside.
25
+ - A set of fields that belong together (opening hours, a low and high pair): a `Fieldset` round `Field`s, in a `FormGrid` for a row.
26
+ - The filter chips of one facet: a `Fieldset` round a `ButtonGroup` of `variant="outline"` `size="sm"` `Button`s with `pressed`. One `Fieldset` per facet; stack several in a `Stack`.
27
+ - The `label` names the group in the `Field` label's look. A `hint` is one muted line under the group, and an `error` goes under it in red.
28
+ - One choice of several is a `RadioGroup`, which is its own group: never put it in a `Fieldset`. One control is a `Field`, or a `Checkbox` or `Switch` on its own.
29
+
30
+ ### Don't
31
+ Bold text over loose checkboxes looks like a group, but the question is not their name.
32
+ ```tsx
33
+ import { Checkbox, Stack, Text } from "@slashsuite/ui-react";
34
+
35
+ <Stack gap="xs">
36
+ <Text strong>What is wrong?</Text>
37
+ <Checkbox label="Wrong opening hours" />
38
+ <Checkbox label="Closed for good" />
39
+ </Stack>
40
+ ```
41
+
42
+ Chips with no group have no name: a screen reader hears a row of buttons and not what they filter.
43
+ ```tsx
44
+ import { Button, Cluster } from "@slashsuite/ui-react";
45
+
46
+ <Cluster gap="xs" wrap>
47
+ <Button variant="outline" size="sm" pressed>
48
+ Vintage
49
+ </Button>
50
+ <Button variant="outline" size="sm" pressed={false}>
51
+ Books
52
+ </Button>
53
+ <Button variant="outline" size="sm" pressed={false}>
54
+ Now
55
+ </Button>
56
+ </Cluster>
57
+ ```
58
+
59
+ A `RadioGroup` inside a `Fieldset` is two names for one question.
60
+ ```tsx
61
+ import { Fieldset, Radio, RadioGroup } from "@slashsuite/ui-react";
62
+
63
+ <Fieldset label="Detection">
64
+ <RadioGroup label="Kind" defaultValue="layout">
65
+ <Radio value="layout" label="Layout" />
66
+ <Radio value="colour" label="Colour" />
67
+ </RadioGroup>
68
+ </Fieldset>
69
+ ```
70
+
71
+ ### Accessibility
72
+ - A `<fieldset>` named by its `<legend>`, so a screen reader announces the group's name on entering it.
73
+ - The hint and then the error are the group's `aria-describedby`; the error is announced politely when it appears.
74
+ - `disabled` on the group disables every control in it.
75
+
76
+ ### Props
77
+ ### Fieldset
78
+ A labelled group of controls: several `Checkbox`es answering one question, a set of `Field`s that belong together, or the filter chips of one facet (a `ButtonGroup` of `outline` `sm` pressed `Button`s). It is a `<fieldset>` named by its `label`, drawn as its `<legend>` in the `Field` label's look, over the children in one column; a `ButtonGroup` or a `FormGrid` inside lays out a row. `hint` is a muted line under the group and its `aria-describedby`; `error` adds a red line under it with an alert icon, announced politely. `disabled` disables every control inside. One choice of several is a `RadioGroup`, never inside a `Fieldset`. Other props go on the `<fieldset>`.
79
+ - children: ReactNode. `Checkbox`es, `Field`s (in a `FormGrid` for a row), or a `ButtonGroup` of chips.
80
+ - error: ReactNode. A red line under the hint, with an alert icon, announced politely.
81
+ - hint: ReactNode. A muted line under the group.
82
+ - label: ReactNode (required). The group's name, drawn as its `<legend>`.
@@ -0,0 +1,52 @@
1
+ ## FileDrop
2
+
3
+ Group: Forms
4
+
5
+ When to use: Uploading a file: a statement, a photo, an import.
6
+
7
+ ### The one right way
8
+ Name the file the zone wants in its prompt, restrict it with `accept`, and show the chosen file's name from `onChange`.
9
+ ```tsx
10
+ import { useState } from "react";
11
+ import { FileDrop } from "@slashsuite/ui-react";
12
+
13
+ function Example() {
14
+ const [name, setName] = useState("");
15
+ return (
16
+ <FileDrop accept=".csv" onChange={(event) => setName(event.target.files?.[0]?.name ?? "")}>
17
+ {name === "" ? "Drop a bank statement here or click to choose" : name}
18
+ </FileDrop>
19
+ );
20
+ }
21
+ ```
22
+
23
+ ### Do
24
+ - Say what the zone wants in its children, and restrict the type with `accept`.
25
+ - Show the chosen file's name in the children from `onChange`; the zone does not do it for you.
26
+ - `size="sm"` is a compact chip or tile, `size="lg"` a roomy drop zone; `md` is the default.
27
+ - `multiple`, `name` and `disabled` go on the zone like any file input; say why it is disabled in its `Field` hint.
28
+ - Put a `FileDrop` in a `Field` when it needs a label of its own above it.
29
+
30
+ ### Don't
31
+ A prompt that never changes leaves the person unsure the file was taken, and with no `accept` any file is.
32
+ ```tsx
33
+ import { FileDrop } from "@slashsuite/ui-react";
34
+
35
+ <FileDrop>Drop here</FileDrop>
36
+
37
+ ```
38
+
39
+ ### Accessibility
40
+ - A real `<input type="file">` covers the whole zone, invisible, so a click opens the file dialog, a dragged file is taken as by any file input, and the browser's keyboard handling applies.
41
+ - The zone is a `<label>`, so its children are the input's accessible name.
42
+ - The zone shows the keyboard focus ring while the input has focus.
43
+ - In a `Field`, the `Field` around it adds its label to the input's name and its hint or error as `aria-describedby`, and an error marks the input `aria-invalid` and turns the dashed edge red.
44
+
45
+ ### Props
46
+ ### FileDrop
47
+ A dashed drop zone around a file input. The input covers the whole zone, invisible, so a click opens the file dialog and a file dragged onto it is taken by the browser as it is by any file input. `children` is the prompt; show the chosen file's name there from `onChange`. The label also shows the keyboard focus ring, the input being invisible. Every prop (`accept`, `multiple`, `name`, `disabled`, `onChange`) goes on the input.
48
+ - accept: string (native). The file types it takes, as on `<input type="file">`: `"image/*"`, `".pdf"`.
49
+ - disabled: boolean (native). Disables the drop zone; say why in its `Field` hint.
50
+ - multiple: boolean (native). Takes several files at once.
51
+ - name: string (native). The key the files post under in a form.
52
+ - size: "sm" | "md" | "lg" (default md). `sm` is a compact chip or tile: dense padding; `lg` is one step roomier than `md`.