@slashsuite/ui-react 0.12.1 → 0.13.1

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 (385) hide show
  1. package/MIGRATING.md +386 -8
  2. package/README.md +89 -44
  3. package/agent-docs/components/app-shell.md +9 -6
  4. package/agent-docs/components/article-layout.md +140 -0
  5. package/agent-docs/components/audio.md +42 -0
  6. package/agent-docs/components/badge.md +2 -1
  7. package/agent-docs/components/body-text.md +26 -15
  8. package/agent-docs/components/bottom-sheet.md +27 -17
  9. package/agent-docs/components/breadcrumbs.md +10 -6
  10. package/agent-docs/components/button.md +2 -2
  11. package/agent-docs/components/call-to-action.md +59 -0
  12. package/agent-docs/components/callout.md +4 -3
  13. package/agent-docs/components/card-grid.md +15 -7
  14. package/agent-docs/components/card.md +33 -18
  15. package/agent-docs/components/cart-button.md +63 -0
  16. package/agent-docs/components/chat-composer.md +4 -3
  17. package/agent-docs/components/checkbox.md +11 -5
  18. package/agent-docs/components/cluster.md +10 -8
  19. package/agent-docs/components/code-example.md +2 -2
  20. package/agent-docs/components/code.md +7 -5
  21. package/agent-docs/components/colour-scheme-toggle.md +12 -6
  22. package/agent-docs/components/colour-swatch.md +41 -0
  23. package/agent-docs/components/combobox.md +88 -0
  24. package/agent-docs/components/confirm-dialog.md +98 -0
  25. package/agent-docs/components/container.md +2 -1
  26. package/agent-docs/components/copy-button.md +7 -5
  27. package/agent-docs/components/copy-line.md +6 -5
  28. package/agent-docs/components/date-field.md +14 -11
  29. package/agent-docs/components/date-range-picker.md +16 -9
  30. package/agent-docs/components/date-time-field.md +73 -0
  31. package/agent-docs/components/dialog.md +22 -68
  32. package/agent-docs/components/disclosure.md +4 -0
  33. package/agent-docs/components/docs-layout.md +10 -6
  34. package/agent-docs/components/drawer.md +13 -4
  35. package/agent-docs/components/embed-frame.md +48 -0
  36. package/agent-docs/components/empty-state.md +4 -1
  37. package/agent-docs/components/field-dialog.md +6 -5
  38. package/agent-docs/components/field.md +10 -7
  39. package/agent-docs/components/fieldset.md +4 -4
  40. package/agent-docs/components/flow-diagram.md +87 -0
  41. package/agent-docs/components/form-layout.md +4 -1
  42. package/agent-docs/components/form-row.md +7 -7
  43. package/agent-docs/components/full-bleed-layout.md +0 -2
  44. package/agent-docs/components/headings.md +13 -7
  45. package/agent-docs/components/hero.md +11 -2
  46. package/agent-docs/components/icon-button.md +1 -3
  47. package/agent-docs/components/icon.md +6 -13
  48. package/agent-docs/components/image.md +24 -14
  49. package/agent-docs/components/input.md +8 -7
  50. package/agent-docs/components/key-value-list.md +4 -1
  51. package/agent-docs/components/lightbox.md +1 -1
  52. package/agent-docs/components/list-layout.md +5 -7
  53. package/agent-docs/components/list-row.md +37 -34
  54. package/agent-docs/components/loading.md +2 -2
  55. package/agent-docs/components/markdown.md +13 -13
  56. package/agent-docs/components/media-tile.md +8 -4
  57. package/agent-docs/components/menu.md +19 -12
  58. package/agent-docs/components/meta-list.md +2 -2
  59. package/agent-docs/components/morph.md +11 -5
  60. package/agent-docs/components/navigation-progress.md +2 -2
  61. package/agent-docs/components/number-field.md +75 -0
  62. package/agent-docs/components/outline-region.md +19 -8
  63. package/agent-docs/components/page-fade.md +2 -1
  64. package/agent-docs/components/pill.md +7 -6
  65. package/agent-docs/components/popover.md +63 -0
  66. package/agent-docs/components/price.md +49 -0
  67. package/agent-docs/components/product-tile.md +78 -0
  68. package/agent-docs/components/promo-banner.md +46 -0
  69. package/agent-docs/components/prose-layout.md +1 -1
  70. package/agent-docs/components/radio-group.md +9 -6
  71. package/agent-docs/components/scroll-strip.md +3 -3
  72. package/agent-docs/components/segmented-control.md +4 -2
  73. package/agent-docs/components/select.md +8 -3
  74. package/agent-docs/components/show.md +2 -2
  75. package/agent-docs/components/side-column.md +13 -9
  76. package/agent-docs/components/sidebar-layout.md +1 -1
  77. package/agent-docs/components/site-footer.md +4 -4
  78. package/agent-docs/components/site-search.md +21 -9
  79. package/agent-docs/components/slider.md +59 -0
  80. package/agent-docs/components/sortable-list.md +15 -10
  81. package/agent-docs/components/stack.md +3 -3
  82. package/agent-docs/components/stacked-bar.md +7 -4
  83. package/agent-docs/components/state-machine.md +95 -0
  84. package/agent-docs/components/status-pages.md +13 -6
  85. package/agent-docs/components/stepper.md +54 -0
  86. package/agent-docs/components/switch.md +4 -4
  87. package/agent-docs/components/table-of-contents.md +78 -0
  88. package/agent-docs/components/table.md +35 -24
  89. package/agent-docs/components/tabs.md +24 -26
  90. package/agent-docs/components/text-link.md +12 -7
  91. package/agent-docs/components/textarea.md +4 -2
  92. package/agent-docs/components/toast.md +19 -14
  93. package/agent-docs/components/video.md +7 -2
  94. package/agent-docs/llms.txt +22 -3
  95. package/dist/AppShell.d.ts +25 -9
  96. package/dist/AppShell.js +67 -33
  97. package/dist/AppShellMenu.d.ts +31 -18
  98. package/dist/AppShellMenu.js +72 -45
  99. package/dist/ArticleLayout.d.ts +36 -0
  100. package/dist/ArticleLayout.js +27 -0
  101. package/dist/Audio.d.ts +16 -0
  102. package/dist/Audio.js +11 -0
  103. package/dist/Badge.d.ts +2 -1
  104. package/dist/Badge.js +3 -2
  105. package/dist/BottomSheet.d.ts +17 -6
  106. package/dist/BottomSheet.js +62 -11
  107. package/dist/Breadcrumbs.d.ts +8 -6
  108. package/dist/Breadcrumbs.js +17 -7
  109. package/dist/Button.d.ts +4 -2
  110. package/dist/Button.js +9 -87
  111. package/dist/CallToAction.d.ts +25 -0
  112. package/dist/CallToAction.js +17 -0
  113. package/dist/Callout.d.ts +2 -2
  114. package/dist/Callout.js +2 -2
  115. package/dist/Card.d.ts +88 -31
  116. package/dist/Card.js +55 -92
  117. package/dist/CardBody.d.ts +2 -0
  118. package/dist/CardBody.js +33 -3
  119. package/dist/CardGrid.d.ts +32 -4
  120. package/dist/CardGrid.js +42 -8
  121. package/dist/CardParts.d.ts +7 -1
  122. package/dist/CardParts.js +7 -2
  123. package/dist/CartButton.d.ts +33 -0
  124. package/dist/CartButton.js +18 -0
  125. package/dist/ChatComposer.d.ts +10 -4
  126. package/dist/ChatComposer.js +35 -13
  127. package/dist/Checkbox.d.ts +21 -3
  128. package/dist/Checkbox.js +66 -20
  129. package/dist/Chevron.js +1 -1
  130. package/dist/Cluster.d.ts +28 -15
  131. package/dist/Cluster.js +21 -4
  132. package/dist/Code.d.ts +15 -3
  133. package/dist/Code.js +23 -3
  134. package/dist/CodeBlock.d.ts +4 -4
  135. package/dist/CodeBlock.js +2 -2
  136. package/dist/CodeBody.d.ts +1 -1
  137. package/dist/CodeBody.js +4 -10
  138. package/dist/CodeExample.d.ts +1 -1
  139. package/dist/CodeExample.js +3 -2
  140. package/dist/ColourSchemeToggle.d.ts +21 -5
  141. package/dist/ColourSchemeToggle.js +15 -9
  142. package/dist/ColourSwatch.d.ts +15 -0
  143. package/dist/ColourSwatch.js +14 -0
  144. package/dist/Combobox.d.ts +42 -0
  145. package/dist/Combobox.js +43 -0
  146. package/dist/ConfirmDialog.d.ts +40 -0
  147. package/dist/ConfirmDialog.js +36 -0
  148. package/dist/Container.d.ts +3 -3
  149. package/dist/Container.js +1 -1
  150. package/dist/CopyButton.d.ts +8 -2
  151. package/dist/CopyButton.js +38 -28
  152. package/dist/CopyLine.d.ts +4 -2
  153. package/dist/CopyLine.js +4 -4
  154. package/dist/DateCalendar.d.ts +2 -0
  155. package/dist/DateCalendar.js +11 -9
  156. package/dist/DateField.d.ts +52 -21
  157. package/dist/DateField.js +73 -37
  158. package/dist/DateFieldCalendar.d.ts +12 -8
  159. package/dist/DateFieldCalendar.js +37 -18
  160. package/dist/DateRangePicker.d.ts +23 -3
  161. package/dist/DateRangePicker.js +10 -8
  162. package/dist/DateTimeField.d.ts +31 -0
  163. package/dist/DateTimeField.js +19 -0
  164. package/dist/Dialog.d.ts +42 -6
  165. package/dist/Dialog.js +50 -12
  166. package/dist/Disclosure.js +9 -1
  167. package/dist/DocsLayout.d.ts +13 -5
  168. package/dist/DocsLayout.js +11 -9
  169. package/dist/Drawer.d.ts +22 -7
  170. package/dist/Drawer.js +89 -8
  171. package/dist/EmbedFrame.d.ts +36 -0
  172. package/dist/EmbedFrame.js +18 -0
  173. package/dist/Field.d.ts +41 -4
  174. package/dist/Field.js +61 -25
  175. package/dist/FieldDialog.d.ts +8 -3
  176. package/dist/FieldDialog.js +19 -9
  177. package/dist/Fieldset.d.ts +3 -3
  178. package/dist/Fieldset.js +7 -9
  179. package/dist/FileDrop.js +2 -1
  180. package/dist/FlowDiagram.d.ts +92 -0
  181. package/dist/FlowDiagram.js +100 -0
  182. package/dist/FormRow.d.ts +6 -4
  183. package/dist/FormRow.js +11 -9
  184. package/dist/Hero.d.ts +30 -7
  185. package/dist/Hero.js +23 -9
  186. package/dist/Icon.d.ts +1 -1
  187. package/dist/Icon.js +1 -1
  188. package/dist/IconButton.js +1 -1
  189. package/dist/Image.d.ts +33 -9
  190. package/dist/Image.js +61 -16
  191. package/dist/Input.d.ts +1 -1
  192. package/dist/Input.js +4 -4
  193. package/dist/InputShell.d.ts +7 -0
  194. package/dist/InputShell.js +18 -3
  195. package/dist/KeyValueList.d.ts +2 -2
  196. package/dist/Lightbox.js +5 -3
  197. package/dist/ListRow.d.ts +4 -5
  198. package/dist/ListRow.js +36 -26
  199. package/dist/Mark.d.ts +10 -0
  200. package/dist/Mark.js +9 -0
  201. package/dist/Markdown.d.ts +18 -4
  202. package/dist/Markdown.js +176 -37
  203. package/dist/MediaTile.d.ts +9 -3
  204. package/dist/MediaTile.js +8 -4
  205. package/dist/Menu.d.ts +19 -8
  206. package/dist/Menu.js +13 -11
  207. package/dist/MetaList.d.ts +4 -3
  208. package/dist/MetaList.js +12 -4
  209. package/dist/Morph.d.ts +15 -1
  210. package/dist/Morph.js +70 -22
  211. package/dist/NavigationProgress.d.ts +2 -2
  212. package/dist/NavigationProgress.js +7 -5
  213. package/dist/NumberField.d.ts +66 -0
  214. package/dist/NumberField.js +68 -0
  215. package/dist/OutlineRegion.d.ts +41 -10
  216. package/dist/OutlineRegion.js +31 -6
  217. package/dist/PageFade.d.ts +9 -5
  218. package/dist/PageFade.js +39 -8
  219. package/dist/PageLayouts.d.ts +15 -5
  220. package/dist/PageLayouts.js +3 -3
  221. package/dist/Pill.d.ts +9 -4
  222. package/dist/Pill.js +15 -6
  223. package/dist/Popover.d.ts +31 -0
  224. package/dist/Popover.js +43 -0
  225. package/dist/Price.d.ts +21 -0
  226. package/dist/Price.js +34 -0
  227. package/dist/ProductTile.d.ts +36 -0
  228. package/dist/ProductTile.js +31 -0
  229. package/dist/ProgressBar.js +4 -2
  230. package/dist/PromoBanner.d.ts +25 -0
  231. package/dist/PromoBanner.js +16 -0
  232. package/dist/RadioGroup.d.ts +18 -8
  233. package/dist/RadioGroup.js +42 -18
  234. package/dist/ScrollStrip.d.ts +1 -1
  235. package/dist/ScrollStrip.js +1 -1
  236. package/dist/SearchInput.d.ts +17 -2
  237. package/dist/SearchInput.js +72 -13
  238. package/dist/SegmentedField.d.ts +15 -0
  239. package/dist/SegmentedField.js +15 -0
  240. package/dist/Select.js +5 -4
  241. package/dist/Show.d.ts +1 -1
  242. package/dist/Show.js +1 -1
  243. package/dist/SideColumn.d.ts +42 -15
  244. package/dist/SideColumn.js +45 -19
  245. package/dist/SiteFooter.d.ts +3 -3
  246. package/dist/SiteFooter.js +4 -3
  247. package/dist/SiteSearch.d.ts +57 -27
  248. package/dist/SiteSearch.js +13 -93
  249. package/dist/Slider.d.ts +27 -0
  250. package/dist/Slider.js +58 -0
  251. package/dist/SortableList.d.ts +19 -35
  252. package/dist/SortableList.js +36 -88
  253. package/dist/Stack.d.ts +4 -4
  254. package/dist/StackedBar.d.ts +13 -4
  255. package/dist/StackedBar.js +12 -7
  256. package/dist/StateMachine.d.ts +65 -0
  257. package/dist/StateMachine.js +116 -0
  258. package/dist/StatusPages.d.ts +28 -10
  259. package/dist/StatusPages.js +10 -10
  260. package/dist/Stepper.d.ts +21 -0
  261. package/dist/Stepper.js +33 -0
  262. package/dist/Steps.js +4 -3
  263. package/dist/Switch.d.ts +3 -3
  264. package/dist/Switch.js +18 -14
  265. package/dist/Table.d.ts +32 -9
  266. package/dist/Table.js +50 -20
  267. package/dist/TableCells.d.ts +24 -21
  268. package/dist/TableCells.js +68 -27
  269. package/dist/TableEditCell.d.ts +1 -1
  270. package/dist/TableOfContents.d.ts +34 -0
  271. package/dist/TableOfContents.js +23 -0
  272. package/dist/Tabs.d.ts +31 -16
  273. package/dist/Tabs.js +97 -22
  274. package/dist/TextLink.d.ts +18 -5
  275. package/dist/TextLink.js +19 -6
  276. package/dist/Textarea.d.ts +12 -1
  277. package/dist/Textarea.js +15 -2
  278. package/dist/ToastRegion.d.ts +17 -9
  279. package/dist/ToastRegion.js +70 -13
  280. package/dist/Tooltip.d.ts +10 -2
  281. package/dist/Tooltip.js +32 -11
  282. package/dist/Video.d.ts +19 -4
  283. package/dist/Video.js +15 -5
  284. package/dist/cardContext.d.ts +7 -0
  285. package/dist/cardContext.js +14 -0
  286. package/dist/cardControl.d.ts +15 -0
  287. package/dist/cardControl.js +32 -0
  288. package/dist/cardForm.d.ts +39 -0
  289. package/dist/cardForm.js +81 -0
  290. package/dist/cardWait.js +2 -1
  291. package/dist/colourScheme.d.ts +12 -2
  292. package/dist/colourScheme.js +32 -6
  293. package/dist/control.d.ts +30 -8
  294. package/dist/control.js +74 -7
  295. package/dist/copyScript.d.ts +7 -8
  296. package/dist/copyScript.js +8 -9
  297. package/dist/core/button.d.ts +33 -0
  298. package/dist/core/button.js +89 -0
  299. package/dist/core/control.d.ts +15 -0
  300. package/dist/core/control.js +14 -0
  301. package/dist/core/fixtures/button.d.ts +26 -0
  302. package/dist/core/fixtures/button.js +52 -0
  303. package/dist/core/fixtures/types.d.ts +13 -0
  304. package/dist/core/fixtures/types.js +10 -0
  305. package/dist/core/focus.d.ts +7 -0
  306. package/dist/core/focus.js +7 -0
  307. package/dist/core/index.d.ts +12 -0
  308. package/dist/core/index.js +12 -0
  309. package/dist/core/parity.d.ts +22 -0
  310. package/dist/core/parity.js +53 -0
  311. package/dist/core/themeNative.d.ts +62 -0
  312. package/dist/core/themeNative.js +290 -0
  313. package/dist/cx.d.ts +17 -5
  314. package/dist/cx.js +18 -5
  315. package/dist/dateLocale.d.ts +17 -0
  316. package/dist/dateLocale.js +30 -0
  317. package/dist/density.d.ts +17 -3
  318. package/dist/density.js +30 -19
  319. package/dist/emptySlot.d.ts +1 -0
  320. package/dist/fieldAnnounce.d.ts +11 -0
  321. package/dist/fieldAnnounce.js +36 -0
  322. package/dist/fieldControl.d.ts +7 -2
  323. package/dist/fieldControl.js +6 -2
  324. package/dist/fieldWait.d.ts +3 -3
  325. package/dist/fieldWait.js +3 -4
  326. package/dist/flowLayout.d.ts +68 -0
  327. package/dist/flowLayout.js +105 -0
  328. package/dist/focus.d.ts +2 -0
  329. package/dist/focus.js +9 -0
  330. package/dist/fromXState.d.ts +73 -0
  331. package/dist/fromXState.js +110 -0
  332. package/dist/icons.d.ts +1 -1
  333. package/dist/icons.js +15 -0
  334. package/dist/index.d.ts +37 -11
  335. package/dist/index.js +24 -2
  336. package/dist/isoDate.d.ts +8 -1
  337. package/dist/isoDate.js +20 -1
  338. package/dist/labelWords.d.ts +16 -7
  339. package/dist/labelWords.js +14 -12
  340. package/dist/listRowProps.d.ts +17 -15
  341. package/dist/modal.d.ts +5 -0
  342. package/dist/modal.js +21 -1
  343. package/dist/navFold.js +6 -3
  344. package/dist/optionCard.d.ts +18 -0
  345. package/dist/optionCard.js +16 -0
  346. package/dist/scrollBody.d.ts +16 -0
  347. package/dist/scrollBody.js +15 -0
  348. package/dist/scrollEdges.d.ts +7 -0
  349. package/dist/scrollEdges.js +39 -5
  350. package/dist/scrollStop.d.ts +6 -2
  351. package/dist/scrollStop.js +24 -8
  352. package/dist/shownDate.d.ts +28 -10
  353. package/dist/shownDate.js +41 -22
  354. package/dist/siteSearchBody.d.ts +34 -0
  355. package/dist/siteSearchBody.js +117 -0
  356. package/dist/size.d.ts +7 -1
  357. package/dist/sortableDrop.d.ts +44 -0
  358. package/dist/sortableDrop.js +78 -0
  359. package/dist/sortableSlide.d.ts +9 -0
  360. package/dist/sortableSlide.js +70 -0
  361. package/dist/sortableTitle.d.ts +10 -0
  362. package/dist/sortableTitle.js +48 -0
  363. package/dist/stateMachineDots.d.ts +77 -0
  364. package/dist/stateMachineDots.js +188 -0
  365. package/dist/stickyColumn.d.ts +2 -2
  366. package/dist/stickyColumn.js +2 -2
  367. package/dist/switcher.d.ts +10 -5
  368. package/dist/switcher.js +7 -5
  369. package/dist/tableColumns.d.ts +17 -0
  370. package/dist/tableColumns.js +30 -2
  371. package/dist/tableEmpty.js +5 -5
  372. package/dist/tableRow.d.ts +26 -2
  373. package/dist/tableRow.js +23 -1
  374. package/dist/tableSort.d.ts +10 -5
  375. package/dist/tableSort.js +15 -4
  376. package/dist/target.d.ts +12 -0
  377. package/dist/target.js +12 -0
  378. package/dist/textBox.js +1 -1
  379. package/dist/truncated.d.ts +31 -0
  380. package/dist/truncated.js +51 -0
  381. package/dist/typography.d.ts +19 -11
  382. package/dist/typography.js +11 -13
  383. package/dist/useFlowLayout.d.ts +38 -0
  384. package/dist/useFlowLayout.js +122 -0
  385. package/package.json +5 -3
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Button's tokens: the class tables `@slashsuite/ui-react` draws a Button from, and the sizes the
3
+ * native renderer measures against. The tables are the web's (Tailwind utilities, remapped by every
4
+ * theme); `parity.ts` reads the box sizes from them, so a change here moves both renderers.
5
+ */
6
+ export const BUTTON_SHAPE = "inline-flex items-center justify-center rounded-lg border font-medium transition";
7
+ // Size sets the padding; the text is the renderer's control text, from the size and the type step.
8
+ // The link variant has no box, so it takes the text size only.
9
+ export const BUTTON_BOX = {
10
+ sm: "gap-1.5 px-2.5 py-1",
11
+ md: "gap-2 px-4 py-2",
12
+ lg: "gap-2 px-5 py-2.5",
13
+ };
14
+ // `BUTTON_BOX` from the `md` breakpoint up, for a responsive size, every class written out in full.
15
+ export const BUTTON_BOX_MD = {
16
+ sm: "md:gap-1.5 md:px-2.5 md:py-1",
17
+ md: "md:gap-2 md:px-4 md:py-2",
18
+ lg: "md:gap-2 md:px-5 md:py-2.5",
19
+ };
20
+ /** The gap of the link variant, which has no box. */
21
+ export const BUTTON_LINK_GAP = "gap-1.5";
22
+ /** The dashed variant fills its container. */
23
+ export const BUTTON_DASHED_BOX = "w-full border-dashed";
24
+ // A plain `disabled` washes out and ignores the pointer. A busy button is disabled too, but keeps
25
+ // pointer events (the cursor says why) and does not take this; a blocked one is `aria-disabled`.
26
+ export const BUTTON_DISABLED_PLAIN = "disabled:pointer-events-none disabled:opacity-50";
27
+ const LINK = "underline-offset-2";
28
+ export const BUTTON_TONE = {
29
+ neutral: {
30
+ primary: {
31
+ color: "border-violet-600 bg-violet-600 text-violet-50",
32
+ hover: "hover:bg-violet-700",
33
+ },
34
+ outline: { color: "border-violet-600 text-violet-600", hover: "hover:bg-violet-50" },
35
+ ghost: { color: "border-transparent text-slate-600", hover: "hover:bg-slate-100" },
36
+ link: {
37
+ color: `border-transparent text-violet-600 ${LINK}`,
38
+ hover: "hover:text-violet-700 hover:underline",
39
+ },
40
+ },
41
+ positive: {
42
+ primary: {
43
+ color: "border-emerald-600 bg-emerald-600 text-emerald-50",
44
+ hover: "hover:bg-emerald-700",
45
+ },
46
+ outline: { color: "border-emerald-200 text-emerald-700", hover: "hover:bg-emerald-50" },
47
+ ghost: { color: "border-transparent text-emerald-700", hover: "hover:bg-emerald-50" },
48
+ link: { color: `border-transparent text-emerald-700 ${LINK}`, hover: "hover:underline" },
49
+ },
50
+ danger: {
51
+ primary: { color: "border-red-600 bg-red-600 text-red-50", hover: "hover:bg-red-700" },
52
+ outline: { color: "border-red-200 text-red-700", hover: "hover:bg-red-50" },
53
+ ghost: { color: "border-transparent text-red-700", hover: "hover:bg-red-50" },
54
+ link: { color: `border-transparent text-red-700 ${LINK}`, hover: "hover:underline" },
55
+ },
56
+ };
57
+ // The add row: Card dashed's outline and muted text, lit with the accent on hover. One look, so
58
+ // `tone` does not apply to it.
59
+ export const BUTTON_DASHED = {
60
+ color: "border-slate-300 text-slate-500",
61
+ hover: "hover:border-violet-400 hover:text-violet-700",
62
+ };
63
+ // An outline or ghost Button with `pressed` set is a toggle, such as a filter chip: off is neutral
64
+ // (the surface, a hairline, muted text, lit with the accent on hover), on is the tone's primary
65
+ // fill, so the selected one stands out in every theme.
66
+ export const BUTTON_TOGGLE_OFF = {
67
+ color: "border-slate-200 bg-white text-slate-600",
68
+ hover: "hover:border-violet-400",
69
+ };
70
+ // The count chip: a pill in the button's own text colour (a hairline of `currentColor`), so it reads
71
+ // on every variant and tone and needs no palette entry. The size is a Badge's: rem text and a
72
+ // min-height, so the chip grows with the reader's text size.
73
+ export const BUTTON_COUNT = "inline-flex min-h-4 min-w-4 items-center justify-center rounded-full border border-current px-1 text-[0.625rem]/[1.4] font-semibold tabular-nums";
74
+ // Blocked replaces the variant's colour and hover rather than overriding them, so no `!` is needed.
75
+ export const BUTTON_BLOCKED = "cursor-not-allowed border-slate-200 bg-slate-100 text-slate-400";
76
+ export const BUTTON_BLOCKED_BY_VARIANT = {
77
+ link: "cursor-not-allowed border-transparent text-slate-400",
78
+ dashed: "cursor-not-allowed border-slate-200 text-slate-400",
79
+ };
80
+ export const BUTTON_BUSY = "cursor-progress opacity-85";
81
+ /** The look of an idle Button: the dashed look, a toggle's, or the tone's for the variant. */
82
+ export function buttonLook(variant, tone, pressed) {
83
+ if (variant === "dashed")
84
+ return BUTTON_DASHED;
85
+ if (pressed !== undefined && (variant === "outline" || variant === "ghost")) {
86
+ return pressed ? BUTTON_TONE[tone].primary : BUTTON_TOGGLE_OFF;
87
+ }
88
+ return BUTTON_TONE[tone][variant];
89
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A control's text: its type size by `size` at each type step, and its line height by `size`. A
3
+ * Button, a field and a pill take their text from here on every renderer, so a control's height
4
+ * (line height, padding and hairline) is the same on the web and on a phone.
5
+ */
6
+ import type { ButtonSize } from "./button.js";
7
+ /** The type step an app may set once: `compact` is one step down, for an app's chrome. */
8
+ export type ControlTypeStep = "default" | "compact";
9
+ /** A control's type size at each step: `md` is 16px at the default step, and `compact` is one step down. */
10
+ export declare const CONTROL_TEXT: Record<ControlTypeStep, Record<ButtonSize, string>>;
11
+ /**
12
+ * A control's line height by `size`, whatever its type step: 16, 20 and 24px, so with its padding
13
+ * every control is 26, 38 and 46px tall at both steps.
14
+ */
15
+ export declare const CONTROL_LEADING: Record<ButtonSize, string>;
@@ -0,0 +1,14 @@
1
+ /** A control's type size at each step: `md` is 16px at the default step, and `compact` is one step down. */
2
+ export const CONTROL_TEXT = {
3
+ default: { sm: "text-sm", md: "text-base", lg: "text-lg" },
4
+ compact: { sm: "text-xs", md: "text-sm", lg: "text-base" },
5
+ };
6
+ /**
7
+ * A control's line height by `size`, whatever its type step: 16, 20 and 24px, so with its padding
8
+ * every control is 26, 38 and 46px tall at both steps.
9
+ */
10
+ export const CONTROL_LEADING = {
11
+ sm: "leading-4",
12
+ md: "leading-5",
13
+ lg: "leading-6",
14
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Button's story fixtures: the stories both renderers draw from the same data, so a web story and
3
+ * its native shot share one story id (`actions-button--variants`). Each is a row of Buttons; the
4
+ * renderer lays the row out by `layout` and draws each item with its own Button.
5
+ */
6
+ import type { ButtonSize, ButtonTone, ButtonVariant } from "../button.js";
7
+ import type { StoryFixture } from "./types.js";
8
+ /** One Button in a fixture: its label and the props that change its look or state. */
9
+ export type ButtonFixtureItem = {
10
+ label: string;
11
+ variant?: ButtonVariant;
12
+ size?: ButtonSize;
13
+ tone?: ButtonTone;
14
+ pressed?: boolean;
15
+ disabledReason?: string;
16
+ busy?: boolean | string;
17
+ };
18
+ export declare const buttonFixtures: {
19
+ Variants: StoryFixture<ButtonFixtureItem>;
20
+ Small: StoryFixture<ButtonFixtureItem>;
21
+ Danger: StoryFixture<ButtonFixtureItem>;
22
+ Positive: StoryFixture<ButtonFixtureItem>;
23
+ Pressed: StoryFixture<ButtonFixtureItem>;
24
+ Blocked: StoryFixture<ButtonFixtureItem>;
25
+ Busy: StoryFixture<ButtonFixtureItem>;
26
+ };
@@ -0,0 +1,52 @@
1
+ const TITLE = "Actions/Button";
2
+ const fixture = (story, layout, items) => ({ title: TITLE, story, layout, items });
3
+ export const buttonFixtures = {
4
+ Variants: fixture("Variants", "wrap", [
5
+ { label: "Save" },
6
+ { label: "Cancel", variant: "outline" },
7
+ { label: "Skip", variant: "ghost" },
8
+ { label: "Edit", variant: "link" },
9
+ ]),
10
+ Small: fixture("Small", "wrap-center", [
11
+ { label: "Save", size: "sm" },
12
+ { label: "Cancel", size: "sm", variant: "outline" },
13
+ { label: "Skip", size: "sm", variant: "ghost" },
14
+ { label: "Edit", size: "sm", variant: "link" },
15
+ { label: "Remove", size: "sm", tone: "danger", variant: "outline" },
16
+ ]),
17
+ Danger: fixture("Danger", "wrap-center", [
18
+ { label: "Delete", tone: "danger" },
19
+ { label: "Clear", tone: "danger", variant: "outline" },
20
+ { label: "Remove", tone: "danger", variant: "ghost" },
21
+ { label: "Remove", tone: "danger", variant: "link" },
22
+ { label: "Delete", tone: "danger", size: "sm" },
23
+ { label: "Blocked", tone: "danger", disabledReason: "Nothing to delete" },
24
+ { label: "Delete", tone: "danger", busy: "Deleting…" },
25
+ ]),
26
+ Positive: fixture("Positive", "wrap-center", [
27
+ { label: "Accept", tone: "positive" },
28
+ { label: "Accept", tone: "positive", variant: "outline" },
29
+ { label: "Accept", tone: "positive", variant: "ghost" },
30
+ { label: "Accept", tone: "positive", variant: "link" },
31
+ { label: "Accept", tone: "positive", size: "sm" },
32
+ { label: "Blocked", tone: "positive", disabledReason: "Nothing to accept" },
33
+ { label: "Accept", tone: "positive", busy: "Accepting…" },
34
+ ]),
35
+ Pressed: fixture("Pressed", "wrap-center", [
36
+ { label: "Flag", variant: "outline", pressed: false },
37
+ { label: "Flag", variant: "outline", pressed: true },
38
+ { label: "Flag", variant: "ghost", pressed: true },
39
+ { label: "Accepted", variant: "outline", tone: "positive", pressed: true },
40
+ { label: "Rejected", variant: "outline", tone: "danger", pressed: true },
41
+ ]),
42
+ Blocked: fixture("Blocked", "wrap", [
43
+ { label: "Save", disabledReason: "Pick a shop first" },
44
+ { label: "Cancel", variant: "outline", disabledReason: "Pick a shop first" },
45
+ { label: "Skip", variant: "ghost", disabledReason: "Pick a shop first" },
46
+ ]),
47
+ Busy: fixture("Busy", "wrap", [
48
+ { label: "Save", busy: "Saving…" },
49
+ { label: "Cancel", variant: "outline", busy: "Cancelling…" },
50
+ { label: "Skip", variant: "ghost", busy: true },
51
+ ]),
52
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A story fixture: a story as data, which every renderer draws. `title` and `story` give the story
3
+ * id both renderers use (`storyId`), and `layout` how the items sit: `wrap` a wrapping row with the
4
+ * standard gap, `wrap-center` the same row with its items centred on the cross axis.
5
+ */
6
+ export type StoryFixture<Item> = {
7
+ title: string;
8
+ story: string;
9
+ layout: "wrap" | "wrap-center";
10
+ items: Item[];
11
+ };
12
+ /** Storybook's id for a story: `Actions/Button` and `Variants` give `actions-button--variants`. */
13
+ export declare function storyId(title: string, story: string): string;
@@ -0,0 +1,10 @@
1
+ /** Storybook's slug of a title or a story name: camelCase split, lower-cased, hyphenated. */
2
+ const slug = (text) => text
3
+ .replace(/([a-z\d])([A-Z])/g, "$1-$2")
4
+ .toLowerCase()
5
+ .replace(/[^a-z\d]+/g, "-")
6
+ .replace(/^-|-$/g, "");
7
+ /** Storybook's id for a story: `Actions/Button` and `Variants` give `actions-button--variants`. */
8
+ export function storyId(title, story) {
9
+ return `${slug(title)}--${slug(story)}`;
10
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The keyboard focus ring every interactive control shares, on every renderer: a 2px accent
3
+ * outline 2px out. `FOCUS_RING_INSET` draws it inside, for a control that fills a box which clips
4
+ * anything outside it (a table's sortable title, a scroller).
5
+ */
6
+ export declare const FOCUS_RING = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600";
7
+ export declare const FOCUS_RING_INSET = "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-violet-600";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The keyboard focus ring every interactive control shares, on every renderer: a 2px accent
3
+ * outline 2px out. `FOCUS_RING_INSET` draws it inside, for a control that fills a box which clips
4
+ * anything outside it (a table's sortable title, a scroller).
5
+ */
6
+ export const FOCUS_RING = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600";
7
+ export const FOCUS_RING_INSET = "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-violet-600";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@slashsuite/core`: what every UISlash renderer shares. The token tables and prop types of the
3
+ * components that have moved here, their story fixtures, the parity manifest built from the
4
+ * tables, and the native theme generator. Pure TypeScript, no runtime dependencies.
5
+ */
6
+ export * from "./button.js";
7
+ export { buttonFixtures, type ButtonFixtureItem } from "./fixtures/button.js";
8
+ export { storyId, type StoryFixture } from "./fixtures/types.js";
9
+ export { parityJson, parityManifest, radiusPx, spacingPx, type BoxMetrics, type ParityManifest, } from "./parity.js";
10
+ export { missingFromNative, nativeTheme, nativeThemeJson, STATE_OF_VARIANT, type NativeCompound, type NativeState, type NativeStyle, type NativeTheme, } from "./themeNative.js";
11
+ export { CONTROL_LEADING, CONTROL_TEXT, type ControlTypeStep } from "./control.js";
12
+ export { FOCUS_RING, FOCUS_RING_INSET } from "./focus.js";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@slashsuite/core`: what every UISlash renderer shares. The token tables and prop types of the
3
+ * components that have moved here, their story fixtures, the parity manifest built from the
4
+ * tables, and the native theme generator. Pure TypeScript, no runtime dependencies.
5
+ */
6
+ export * from "./button.js";
7
+ export { buttonFixtures } from "./fixtures/button.js";
8
+ export { storyId } from "./fixtures/types.js";
9
+ export { parityJson, parityManifest, radiusPx, spacingPx, } from "./parity.js";
10
+ export { missingFromNative, nativeTheme, nativeThemeJson, STATE_OF_VARIANT, } from "./themeNative.js";
11
+ export { CONTROL_LEADING, CONTROL_TEXT } from "./control.js";
12
+ export { FOCUS_RING, FOCUS_RING_INSET } from "./focus.js";
@@ -0,0 +1,22 @@
1
+ /** The px of the first `<prefix>-<n>` spacing class in `classes`, or 0 when there is none. */
2
+ export declare function spacingPx(classes: string, prefix: string): number;
3
+ /** The px of the radius class in `classes`, or 0 when there is none. */
4
+ export declare function radiusPx(classes: string): number;
5
+ /** One size of a component's box, in logical px. */
6
+ export type BoxMetrics = {
7
+ height: number;
8
+ paddingX: number;
9
+ paddingY: number;
10
+ gap: number;
11
+ radius: number;
12
+ borderWidth: number;
13
+ };
14
+ /** The manifest: component, then size, then its box. */
15
+ export type ParityManifest = {
16
+ version: 1;
17
+ components: Record<string, Record<string, BoxMetrics>>;
18
+ };
19
+ /** The manifest from the tables as they are now. */
20
+ export declare function parityManifest(): ParityManifest;
21
+ /** The manifest as the file holds it: two-space JSON with a trailing newline. */
22
+ export declare const parityJson: () => string;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The parity manifest: the box every renderer must draw for each component and size, in logical px,
3
+ * read from the token tables (never written by hand). `scripts/parity.ts` writes it to
4
+ * `parity.json`; its test fails when the file is stale, so a token change shows up as a diff of
5
+ * the manifest that both renderers are measured against.
6
+ */
7
+ import { BUTTON_BOX, BUTTON_SHAPE } from "./button.js";
8
+ import { CONTROL_LEADING } from "./control.js";
9
+ /** Tailwind's spacing step: `p-1` is 0.25rem, 4px at the default root size. */
10
+ const SPACING_PX = 4;
11
+ /** Tailwind v4's radius scale, in px. */
12
+ const RADIUS_PX = {
13
+ "rounded-sm": 4,
14
+ "rounded-md": 6,
15
+ "rounded-lg": 8,
16
+ "rounded-xl": 12,
17
+ "rounded-full": 9999,
18
+ };
19
+ /** The px of the first `<prefix>-<n>` spacing class in `classes`, or 0 when there is none. */
20
+ export function spacingPx(classes, prefix) {
21
+ const step = new RegExp(`(?:^|\\s)${prefix}-(\\d+(?:\\.\\d+)?)(?=\\s|$)`).exec(classes)?.[1];
22
+ return step === undefined ? 0 : Number(step) * SPACING_PX;
23
+ }
24
+ /** The px of the radius class in `classes`, or 0 when there is none. */
25
+ export function radiusPx(classes) {
26
+ const radius = classes.split(/\s+/).find((name) => name in RADIUS_PX);
27
+ return radius === undefined ? 0 : (RADIUS_PX[radius] ?? 0);
28
+ }
29
+ function buttonBox(size) {
30
+ const box = BUTTON_BOX[size];
31
+ const borderWidth = /(?:^|\s)border(?=\s|$)/.test(BUTTON_SHAPE) ? 1 : 0;
32
+ const paddingY = spacingPx(box, "py");
33
+ return {
34
+ height: spacingPx(CONTROL_LEADING[size], "leading") + 2 * paddingY + 2 * borderWidth,
35
+ paddingX: spacingPx(box, "px"),
36
+ paddingY,
37
+ gap: spacingPx(box, "gap"),
38
+ radius: radiusPx(BUTTON_SHAPE),
39
+ borderWidth,
40
+ };
41
+ }
42
+ const SIZES = ["sm", "md", "lg"];
43
+ /** The manifest from the tables as they are now. */
44
+ export function parityManifest() {
45
+ return {
46
+ version: 1,
47
+ components: {
48
+ Button: Object.fromEntries(SIZES.map((size) => [size, buttonBox(size)])),
49
+ },
50
+ };
51
+ }
52
+ /** The manifest as the file holds it: two-space JSON with a trailing newline. */
53
+ export const parityJson = () => `${JSON.stringify(parityManifest(), null, 2)}\n`;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The native theme generator: a theme's CSS (`themes/<id>.css`) as the style map a React Native
3
+ * renderer reads (`themes/<id>.native.json`). Pure: it takes the CSS text and the palette and
4
+ * returns the map, so the theme test can assert the committed file is current.
5
+ *
6
+ * Every palette utility lands in one place: a plain one (`bg-white`) in `utilities`, one behind a
7
+ * state variant in that state's slot (`hover:bg-violet-700` in `pressed`, `placeholder:text-slate-400`
8
+ * in `placeholderTextColor`, `backdrop:bg-slate-900/35` in `scrim`). A rule the map cannot hold as
9
+ * one utility (`.disabled\:opacity-50:disabled:is(…)`) is a compound. Anything else is listed in
10
+ * `unmapped`, so nothing is dropped silently, and the theme test requires that list to be empty.
11
+ */
12
+ /** A React Native style, as the theme sets it: colours as lower-case hex or `rgba(…)`, and opacity. */
13
+ export type NativeStyle = Record<string, string | number>;
14
+ /** The slot a state variant lands in. */
15
+ export type NativeState = "pressed" | "focused" | "placeholderTextColor" | "scrim" | "disabled" | "invalid" | "target";
16
+ /** A rule that holds only alongside other classes: `disabled:opacity-50` on a solid fill. */
17
+ export type NativeCompound = {
18
+ utility: string;
19
+ requiresAny: string[];
20
+ style: NativeStyle;
21
+ };
22
+ export type NativeTheme = {
23
+ /** The theme's id, its file name without `.css`. */
24
+ id: string;
25
+ /** The scope class the web theme sits under. */
26
+ scope: string;
27
+ scheme: "light" | "dark";
28
+ /** The status bar's content style: light content on a dark theme. */
29
+ statusBar: "light-content" | "dark-content";
30
+ /** The page: its canvas, its ink, its sans family and the family its headings take. */
31
+ base: {
32
+ backgroundColor: string;
33
+ color: string;
34
+ fontFamily: string | null;
35
+ headingFontFamily: string | null;
36
+ };
37
+ /** The text selection's colours. */
38
+ selection: NativeStyle;
39
+ /** Every plain palette utility, keyed as a component writes it. */
40
+ utilities: Record<string, NativeStyle>;
41
+ /** Each state's utilities, keyed by the plain utility they restyle: `hover:bg-violet-700` sits under `pressed`. */
42
+ states: Record<NativeState, Record<string, NativeStyle>>;
43
+ /** A utility drawn on a tint: `within["bg-violet-50"]["text-slate-500"]`. */
44
+ within: Record<string, Record<string, NativeStyle>>;
45
+ /** A utility as a heading draws it: `headings["text-slate-900"]`. */
46
+ headings: Record<string, NativeStyle>;
47
+ compounds: NativeCompound[];
48
+ };
49
+ /** Which slot each Tailwind variant the palette uses lands in. */
50
+ export declare const STATE_OF_VARIANT: Record<string, NativeState>;
51
+ /**
52
+ * The native map of one theme's CSS. `id` is the file name without `.css`. Returns the map and
53
+ * every rule or declaration it could not carry.
54
+ */
55
+ export declare function nativeTheme(css: string, id: string): {
56
+ theme: NativeTheme;
57
+ unmapped: string[];
58
+ };
59
+ /** The palette utilities a native map does not hold: each in `utilities`, or in its variant's slot. */
60
+ export declare function missingFromNative(theme: NativeTheme, palette: readonly string[]): string[];
61
+ /** The map as the file holds it: two-space JSON with a trailing newline. */
62
+ export declare const nativeThemeJson: (theme: NativeTheme) => string;