@arshad-shah/cynosure 0.2.0 → 0.4.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 (441) hide show
  1. package/README.md +5 -5
  2. package/dist/adapters/astro/index.d.ts +52 -0
  3. package/dist/adapters/astro/index.js +27 -0
  4. package/dist/adapters/astro/index.js.map +1 -0
  5. package/dist/adapters/vite/index.d.ts +11 -0
  6. package/dist/adapters/vite/index.js +33 -12
  7. package/dist/adapters/vite/index.js.map +1 -1
  8. package/dist/brands/googleplay.d.ts +2 -0
  9. package/dist/brands/googleplay.js +17 -0
  10. package/dist/brands/googleplay.js.map +1 -0
  11. package/dist/brands/index.d.ts +1 -0
  12. package/dist/brands/index.js +132 -130
  13. package/dist/components/Accordion/Accordion.d.ts +14 -0
  14. package/dist/components/Accordion/Accordion.js.map +1 -1
  15. package/dist/components/Announcer/Announcer.d.ts +1 -0
  16. package/dist/components/Announcer/Announcer.js +5 -5
  17. package/dist/components/Announcer/Announcer.js.map +1 -1
  18. package/dist/components/AppShell/AppShell.d.ts +22 -1
  19. package/dist/components/AppShell/AppShell.js +92 -83
  20. package/dist/components/AppShell/AppShell.js.map +1 -1
  21. package/dist/components/AppShell/index.d.ts +1 -1
  22. package/dist/components/AspectRatio/AspectRatio.d.ts +29 -0
  23. package/dist/components/AspectRatio/AspectRatio.js +21 -0
  24. package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
  25. package/dist/components/AspectRatio/index.d.ts +1 -0
  26. package/dist/components/Avatar/Avatar.d.ts +96 -0
  27. package/dist/components/Avatar/Avatar.js +90 -0
  28. package/dist/components/Avatar/Avatar.js.map +1 -0
  29. package/dist/components/Avatar/index.d.ts +1 -0
  30. package/dist/components/Badge/Badge.d.ts +6 -0
  31. package/dist/components/Badge/Badge.js.map +1 -1
  32. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +55 -0
  33. package/dist/components/Breadcrumbs/Breadcrumbs.js +85 -0
  34. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
  35. package/dist/components/Breadcrumbs/index.d.ts +1 -0
  36. package/dist/components/Button/Button.d.ts +27 -2
  37. package/dist/components/Button/Button.js +62 -53
  38. package/dist/components/Button/Button.js.map +1 -1
  39. package/dist/components/Calendar/Calendar.d.ts +65 -7
  40. package/dist/components/Calendar/Calendar.js +209 -97
  41. package/dist/components/Calendar/Calendar.js.map +1 -1
  42. package/dist/components/Calendar/dates.d.ts +4 -0
  43. package/dist/components/Calendar/dates.js +41 -27
  44. package/dist/components/Calendar/dates.js.map +1 -1
  45. package/dist/components/Calendar/index.d.ts +1 -1
  46. package/dist/components/Card/Card.d.ts +35 -1
  47. package/dist/components/Card/Card.js +48 -36
  48. package/dist/components/Card/Card.js.map +1 -1
  49. package/dist/components/Card/index.d.ts +1 -1
  50. package/dist/components/Checkbox/Checkbox.d.ts +11 -4
  51. package/dist/components/Checkbox/Checkbox.js +33 -7
  52. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  53. package/dist/components/Checklist/Checklist.d.ts +65 -0
  54. package/dist/components/Checklist/Checklist.js +163 -0
  55. package/dist/components/Checklist/Checklist.js.map +1 -0
  56. package/dist/components/Checklist/index.d.ts +1 -0
  57. package/dist/components/Choice/Choice.d.ts +73 -0
  58. package/dist/components/Choice/Choice.js +41 -0
  59. package/dist/components/Choice/Choice.js.map +1 -0
  60. package/dist/components/Choice/index.d.ts +1 -0
  61. package/dist/components/CodeBlock/CodeBlock.d.ts +5 -0
  62. package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
  63. package/dist/components/ColorField/ColorField.d.ts +12 -0
  64. package/dist/components/ColorField/ColorField.js +199 -208
  65. package/dist/components/ColorField/ColorField.js.map +1 -1
  66. package/dist/components/ColorSwatches/ColorSwatches.d.ts +5 -0
  67. package/dist/components/ColorSwatches/ColorSwatches.js +6 -6
  68. package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
  69. package/dist/components/Combobox/Combobox.d.ts +20 -1
  70. package/dist/components/Combobox/Combobox.js +86 -111
  71. package/dist/components/Combobox/Combobox.js.map +1 -1
  72. package/dist/components/CommandPalette/CommandPalette.d.ts +9 -0
  73. package/dist/components/CommandPalette/CommandPalette.js +10 -10
  74. package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
  75. package/dist/components/CompareSlider/CompareSlider.d.ts +4 -0
  76. package/dist/components/CompareSlider/CompareSlider.js +4 -4
  77. package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
  78. package/dist/components/Container/Container.d.ts +44 -0
  79. package/dist/components/Container/Container.js +28 -0
  80. package/dist/components/Container/Container.js.map +1 -0
  81. package/dist/components/Container/index.d.ts +1 -0
  82. package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
  83. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  84. package/dist/components/CopyButton/CopyButton.d.ts +8 -0
  85. package/dist/components/CopyButton/CopyButton.js +29 -28
  86. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  87. package/dist/components/DateField/DateField.d.ts +17 -0
  88. package/dist/components/DateField/DateField.js +6 -6
  89. package/dist/components/DateField/DateField.js.map +1 -1
  90. package/dist/components/DescriptionList/DescriptionList.d.ts +3 -0
  91. package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
  92. package/dist/components/DeviceFrame/DeviceFrame.d.ts +63 -0
  93. package/dist/components/DeviceFrame/DeviceFrame.js +54 -0
  94. package/dist/components/DeviceFrame/DeviceFrame.js.map +1 -0
  95. package/dist/components/DeviceFrame/index.d.ts +1 -0
  96. package/dist/components/Dialog/Dialog.d.ts +25 -2
  97. package/dist/components/Dialog/Dialog.js +89 -72
  98. package/dist/components/Dialog/Dialog.js.map +1 -1
  99. package/dist/components/Disclosure/Disclosure.d.ts +7 -0
  100. package/dist/components/Disclosure/Disclosure.js.map +1 -1
  101. package/dist/components/Divider/Divider.d.ts +59 -0
  102. package/dist/components/Divider/Divider.js +32 -0
  103. package/dist/components/Divider/Divider.js.map +1 -0
  104. package/dist/components/Divider/index.d.ts +1 -0
  105. package/dist/components/DocumentViewport/DocumentViewport.d.ts +8 -0
  106. package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
  107. package/dist/components/EmptyState/EmptyState.d.ts +8 -2
  108. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  109. package/dist/components/Field/Field.d.ts +6 -0
  110. package/dist/components/Field/Field.js +31 -33
  111. package/dist/components/Field/Field.js.map +1 -1
  112. package/dist/components/FileDrop/FileDrop.d.ts +8 -0
  113. package/dist/components/FileDrop/FileDrop.js +14 -14
  114. package/dist/components/FileDrop/FileDrop.js.map +1 -1
  115. package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +4 -0
  116. package/dist/components/FloatingToolbar/FloatingToolbar.js +11 -10
  117. package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
  118. package/dist/components/Grid/Grid.d.ts +57 -10
  119. package/dist/components/Grid/Grid.js +71 -28
  120. package/dist/components/Grid/Grid.js.map +1 -1
  121. package/dist/components/Grid/index.d.ts +1 -1
  122. package/dist/components/Heading/Heading.d.ts +59 -0
  123. package/dist/components/Heading/Heading.js +33 -0
  124. package/dist/components/Heading/Heading.js.map +1 -0
  125. package/dist/components/Heading/index.d.ts +1 -0
  126. package/dist/components/HoverCard/HoverCard.d.ts +1 -0
  127. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  128. package/dist/components/IconButton/IconButton.d.ts +17 -1
  129. package/dist/components/IconButton/IconButton.js +14 -10
  130. package/dist/components/IconButton/IconButton.js.map +1 -1
  131. package/dist/components/IconTile/IconTile.d.ts +45 -0
  132. package/dist/components/IconTile/IconTile.js +25 -0
  133. package/dist/components/IconTile/IconTile.js.map +1 -0
  134. package/dist/components/IconTile/index.d.ts +1 -0
  135. package/dist/components/Image/Image.d.ts +62 -0
  136. package/dist/components/Image/Image.js +75 -0
  137. package/dist/components/Image/Image.js.map +1 -0
  138. package/dist/components/Image/index.d.ts +1 -0
  139. package/dist/components/Inline/Inline.d.ts +8 -4
  140. package/dist/components/Inline/Inline.js +12 -16
  141. package/dist/components/Inline/Inline.js.map +1 -1
  142. package/dist/components/Kbd/Kbd.d.ts +2 -0
  143. package/dist/components/Kbd/Kbd.js.map +1 -1
  144. package/dist/components/KeyValueEditor/KeyValueEditor.d.ts +7 -0
  145. package/dist/components/KeyValueEditor/KeyValueEditor.js +43 -42
  146. package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
  147. package/dist/components/Link/Link.d.ts +16 -1
  148. package/dist/components/Link/Link.js +20 -18
  149. package/dist/components/Link/Link.js.map +1 -1
  150. package/dist/components/List/List.d.ts +73 -0
  151. package/dist/components/List/List.js +64 -0
  152. package/dist/components/List/List.js.map +1 -0
  153. package/dist/components/List/index.d.ts +1 -0
  154. package/dist/components/LoadingDots/LoadingDots.d.ts +2 -0
  155. package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
  156. package/dist/components/Menu/Menu.d.ts +13 -1
  157. package/dist/components/Menu/Menu.js +37 -35
  158. package/dist/components/Menu/Menu.js.map +1 -1
  159. package/dist/components/Notice/Notice.d.ts +5 -0
  160. package/dist/components/Notice/Notice.js +12 -11
  161. package/dist/components/Notice/Notice.js.map +1 -1
  162. package/dist/components/NumberField/NumberField.d.ts +17 -0
  163. package/dist/components/NumberField/NumberField.js +8 -8
  164. package/dist/components/NumberField/NumberField.js.map +1 -1
  165. package/dist/components/OptionList/OptionList.d.ts +69 -0
  166. package/dist/components/OptionList/OptionList.js +75 -0
  167. package/dist/components/OptionList/OptionList.js.map +1 -0
  168. package/dist/components/OptionList/index.d.ts +1 -0
  169. package/dist/components/PageHeader/PageHeader.d.ts +67 -0
  170. package/dist/components/PageHeader/PageHeader.js +63 -0
  171. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  172. package/dist/components/PageHeader/index.d.ts +1 -0
  173. package/dist/components/Pagination/Pagination.d.ts +77 -0
  174. package/dist/components/Pagination/Pagination.js +121 -0
  175. package/dist/components/Pagination/Pagination.js.map +1 -0
  176. package/dist/components/Pagination/index.d.ts +1 -0
  177. package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +4 -0
  178. package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
  179. package/dist/components/Popover/Popover.d.ts +10 -0
  180. package/dist/components/Popover/Popover.js.map +1 -1
  181. package/dist/components/ProgressBar/ProgressBar.d.ts +5 -0
  182. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  183. package/dist/components/ProgressOverlay/ProgressOverlay.d.ts +3 -0
  184. package/dist/components/ProgressOverlay/ProgressOverlay.js.map +1 -1
  185. package/dist/components/Prose/Prose.d.ts +1 -0
  186. package/dist/components/Prose/Prose.js.map +1 -1
  187. package/dist/components/QRCode/QRCode.d.ts +56 -0
  188. package/dist/components/QRCode/QRCode.js +48 -0
  189. package/dist/components/QRCode/QRCode.js.map +1 -0
  190. package/dist/components/QRCode/index.d.ts +1 -0
  191. package/dist/components/RadioGroup/RadioGroup.d.ts +13 -0
  192. package/dist/components/RadioGroup/RadioGroup.js +32 -24
  193. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  194. package/dist/components/Section/Section.d.ts +57 -0
  195. package/dist/components/Section/Section.js +27 -0
  196. package/dist/components/Section/Section.js.map +1 -0
  197. package/dist/components/Section/index.d.ts +1 -0
  198. package/dist/components/SegmentedControl/SegmentedControl.d.ts +9 -0
  199. package/dist/components/SegmentedControl/SegmentedControl.js +12 -12
  200. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  201. package/dist/components/Select/Select.d.ts +18 -1
  202. package/dist/components/Select/Select.js +107 -125
  203. package/dist/components/Select/Select.js.map +1 -1
  204. package/dist/components/Select/index.d.ts +1 -0
  205. package/dist/components/SelectionFrame/SelectionFrame.d.ts +6 -0
  206. package/dist/components/SelectionFrame/SelectionFrame.js.map +1 -1
  207. package/dist/components/Sheet/Sheet.js +12 -7
  208. package/dist/components/Sheet/Sheet.js.map +1 -1
  209. package/dist/components/SideNav/SideNav.d.ts +37 -1
  210. package/dist/components/SideNav/SideNav.js +103 -74
  211. package/dist/components/SideNav/SideNav.js.map +1 -1
  212. package/dist/components/SideNav/index.d.ts +1 -1
  213. package/dist/components/SignaturePad/SignaturePad.d.ts +3 -0
  214. package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
  215. package/dist/components/SiteFooter/SiteFooter.d.ts +66 -0
  216. package/dist/components/SiteFooter/SiteFooter.js +80 -0
  217. package/dist/components/SiteFooter/SiteFooter.js.map +1 -0
  218. package/dist/components/SiteFooter/index.d.ts +1 -0
  219. package/dist/components/SiteHeader/SiteHeader.d.ts +78 -0
  220. package/dist/components/SiteHeader/SiteHeader.js +114 -0
  221. package/dist/components/SiteHeader/SiteHeader.js.map +1 -0
  222. package/dist/components/SiteHeader/index.d.ts +1 -0
  223. package/dist/components/Skeleton/Skeleton.d.ts +1 -0
  224. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  225. package/dist/components/SkipLink/SkipLink.d.ts +42 -0
  226. package/dist/components/SkipLink/SkipLink.js +43 -0
  227. package/dist/components/SkipLink/SkipLink.js.map +1 -0
  228. package/dist/components/SkipLink/index.d.ts +1 -0
  229. package/dist/components/Slider/Slider.d.ts +11 -0
  230. package/dist/components/Slider/Slider.js +6 -6
  231. package/dist/components/Slider/Slider.js.map +1 -1
  232. package/dist/components/SortableList/SortableList.d.ts +6 -0
  233. package/dist/components/SortableList/SortableList.js +13 -13
  234. package/dist/components/SortableList/SortableList.js.map +1 -1
  235. package/dist/components/SplitPane/SplitPane.d.ts +5 -0
  236. package/dist/components/SplitPane/SplitPane.js +4 -4
  237. package/dist/components/SplitPane/SplitPane.js.map +1 -1
  238. package/dist/components/Stack/Stack.d.ts +19 -6
  239. package/dist/components/Stack/Stack.js +26 -13
  240. package/dist/components/Stack/Stack.js.map +1 -1
  241. package/dist/components/Stack/index.d.ts +1 -0
  242. package/dist/components/Stack/space.d.ts +47 -0
  243. package/dist/components/Stack/space.js +23 -0
  244. package/dist/components/Stack/space.js.map +1 -0
  245. package/dist/components/Stat/Stat.d.ts +88 -0
  246. package/dist/components/Stat/Stat.js +105 -0
  247. package/dist/components/Stat/Stat.js.map +1 -0
  248. package/dist/components/Stat/index.d.ts +1 -0
  249. package/dist/components/Steps/Steps.d.ts +14 -4
  250. package/dist/components/Steps/Steps.js +31 -30
  251. package/dist/components/Steps/Steps.js.map +1 -1
  252. package/dist/components/Switch/Switch.d.ts +4 -4
  253. package/dist/components/Switch/Switch.js +18 -7
  254. package/dist/components/Switch/Switch.js.map +1 -1
  255. package/dist/components/Table/Table.d.ts +12 -0
  256. package/dist/components/Table/Table.js +11 -12
  257. package/dist/components/Table/Table.js.map +1 -1
  258. package/dist/components/Tabs/Tabs.d.ts +18 -1
  259. package/dist/components/Tabs/Tabs.js +74 -73
  260. package/dist/components/Tabs/Tabs.js.map +1 -1
  261. package/dist/components/TagInput/TagInput.d.ts +18 -0
  262. package/dist/components/TagInput/TagInput.js +79 -100
  263. package/dist/components/TagInput/TagInput.js.map +1 -1
  264. package/dist/components/Text/Text.d.ts +72 -0
  265. package/dist/components/Text/Text.js +30 -0
  266. package/dist/components/Text/Text.js.map +1 -0
  267. package/dist/components/Text/index.d.ts +1 -0
  268. package/dist/components/TextArea/TextArea.d.ts +10 -0
  269. package/dist/components/TextArea/TextArea.js +4 -4
  270. package/dist/components/TextArea/TextArea.js.map +1 -1
  271. package/dist/components/TextField/TextField.d.ts +17 -0
  272. package/dist/components/TextField/TextField.js +28 -27
  273. package/dist/components/TextField/TextField.js.map +1 -1
  274. package/dist/components/ThemeToggle/ThemeToggle.d.ts +11 -1
  275. package/dist/components/ThemeToggle/ThemeToggle.js +33 -30
  276. package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
  277. package/dist/components/TimeField/TimeField.d.ts +62 -8
  278. package/dist/components/TimeField/TimeField.js +308 -72
  279. package/dist/components/TimeField/TimeField.js.map +1 -1
  280. package/dist/components/Toast/Toast.d.ts +25 -1
  281. package/dist/components/Toast/Toast.js +137 -126
  282. package/dist/components/Toast/Toast.js.map +1 -1
  283. package/dist/components/Toast/index.d.ts +1 -1
  284. package/dist/components/Toolbar/Toolbar.d.ts +3 -0
  285. package/dist/components/Toolbar/Toolbar.js.map +1 -1
  286. package/dist/components/Tooltip/Tooltip.d.ts +7 -1
  287. package/dist/components/Tooltip/Tooltip.js +19 -19
  288. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  289. package/dist/components/Tree/Tree.d.ts +8 -0
  290. package/dist/components/Tree/Tree.js.map +1 -1
  291. package/dist/components/VirtualList/VirtualList.d.ts +8 -0
  292. package/dist/components/VirtualList/VirtualList.js +4 -4
  293. package/dist/components/VirtualList/VirtualList.js.map +1 -1
  294. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
  295. package/dist/components/VisuallyHidden/VisuallyHidden.js +17 -0
  296. package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
  297. package/dist/components/VisuallyHidden/index.d.ts +1 -0
  298. package/dist/components/ZoomControls/ZoomControls.d.ts +4 -0
  299. package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
  300. package/dist/foundations/ChoiceBase/ChoiceBase.d.ts +1 -0
  301. package/dist/foundations/ChoiceBase/ChoiceBase.js +8 -8
  302. package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
  303. package/dist/foundations/HiddenValue/HiddenValue.d.ts +3 -0
  304. package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
  305. package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
  306. package/dist/foundations/Icon/Icon.d.ts +9 -1
  307. package/dist/foundations/Icon/Icon.js +15 -14
  308. package/dist/foundations/Icon/Icon.js.map +1 -1
  309. package/dist/foundations/image-outcome.d.ts +20 -0
  310. package/dist/foundations/image-outcome.js +43 -0
  311. package/dist/foundations/image-outcome.js.map +1 -0
  312. package/dist/foundations/option-icon.d.ts +26 -0
  313. package/dist/foundations/option-icon.js +16 -0
  314. package/dist/foundations/option-icon.js.map +1 -0
  315. package/dist/foundations/printing.d.ts +6 -0
  316. package/dist/foundations/printing.js +17 -0
  317. package/dist/foundations/printing.js.map +1 -0
  318. package/dist/foundations/qr.d.ts +42 -0
  319. package/dist/foundations/qr.js +246 -0
  320. package/dist/foundations/qr.js.map +1 -0
  321. package/dist/icons/book-marked.d.ts +2 -0
  322. package/dist/icons/book-marked.js +14 -0
  323. package/dist/icons/book-marked.js.map +1 -0
  324. package/dist/icons/calendar-days.d.ts +2 -0
  325. package/dist/icons/calendar-days.js +24 -0
  326. package/dist/icons/calendar-days.js.map +1 -0
  327. package/dist/icons/check-square.d.ts +2 -0
  328. package/dist/icons/check-square.js +14 -0
  329. package/dist/icons/check-square.js.map +1 -0
  330. package/dist/icons/crescent.d.ts +2 -0
  331. package/dist/icons/crescent.js +14 -0
  332. package/dist/icons/crescent.js.map +1 -0
  333. package/dist/icons/index.d.ts +11 -0
  334. package/dist/icons/index.js +502 -480
  335. package/dist/icons/kaaba.d.ts +2 -0
  336. package/dist/icons/kaaba.js +14 -0
  337. package/dist/icons/kaaba.js.map +1 -0
  338. package/dist/icons/keywords.d.ts +259 -0
  339. package/dist/icons/keywords.js +1816 -0
  340. package/dist/icons/keywords.js.map +1 -0
  341. package/dist/icons/list-tree.d.ts +2 -0
  342. package/dist/icons/list-tree.js +14 -0
  343. package/dist/icons/list-tree.js.map +1 -0
  344. package/dist/icons/mosque.d.ts +2 -0
  345. package/dist/icons/mosque.js +14 -0
  346. package/dist/icons/mosque.js.map +1 -0
  347. package/dist/icons/prayer-beads.d.ts +2 -0
  348. package/dist/icons/prayer-beads.js +67 -0
  349. package/dist/icons/prayer-beads.js.map +1 -0
  350. package/dist/icons/qr-code.d.ts +2 -0
  351. package/dist/icons/qr-code.js +38 -0
  352. package/dist/icons/qr-code.js.map +1 -0
  353. package/dist/icons/refresh-cw.d.ts +2 -0
  354. package/dist/icons/refresh-cw.js +14 -0
  355. package/dist/icons/refresh-cw.js.map +1 -0
  356. package/dist/icons/types.d.ts +1 -1
  357. package/dist/icons/types.js +2 -1
  358. package/dist/icons/types.js.map +1 -1
  359. package/dist/index.d.ts +35 -10
  360. package/dist/index.js +280 -220
  361. package/dist/styles/announcer.css +1 -1
  362. package/dist/styles/app-shell.css +1 -1
  363. package/dist/styles/aspect-ratio.css +1 -0
  364. package/dist/styles/avatar.css +1 -0
  365. package/dist/styles/base.css +1 -1
  366. package/dist/styles/breadcrumbs.css +1 -0
  367. package/dist/styles/button.css +1 -1
  368. package/dist/styles/calendar.css +1 -1
  369. package/dist/styles/card.css +1 -1
  370. package/dist/styles/checkbox.css +1 -1
  371. package/dist/styles/checklist.css +1 -0
  372. package/dist/styles/choice-base.css +1 -0
  373. package/dist/styles/choice.css +1 -1
  374. package/dist/styles/color-field.css +1 -1
  375. package/dist/styles/combobox.css +1 -1
  376. package/dist/styles/container.css +1 -0
  377. package/dist/styles/copy-button.css +1 -1
  378. package/dist/styles/date-field.css +1 -1
  379. package/dist/styles/device-frame.css +1 -0
  380. package/dist/styles/dialog.css +1 -1
  381. package/dist/styles/disclosure.css +1 -1
  382. package/dist/styles/divider.css +1 -0
  383. package/dist/styles/field.css +1 -1
  384. package/dist/styles/file-drop.css +1 -1
  385. package/dist/styles/floating-toolbar.css +1 -1
  386. package/dist/styles/generated-css.d.ts +1 -1
  387. package/dist/styles/generated-css.js +1 -1
  388. package/dist/styles/generated-css.js.map +1 -1
  389. package/dist/styles/grid.css +1 -1
  390. package/dist/styles/heading.css +1 -0
  391. package/dist/styles/icon-tile.css +1 -0
  392. package/dist/styles/icon.css +1 -1
  393. package/dist/styles/image.css +1 -0
  394. package/dist/styles/inline.css +1 -0
  395. package/dist/styles/key-value-editor.css +1 -1
  396. package/dist/styles/link.css +1 -1
  397. package/dist/styles/list.css +1 -0
  398. package/dist/styles/manifest.json +715 -0
  399. package/dist/styles/menu.css +1 -1
  400. package/dist/styles/notice.css +1 -1
  401. package/dist/styles/number-field.css +1 -1
  402. package/dist/styles/option-list.css +1 -0
  403. package/dist/styles/page-header.css +1 -0
  404. package/dist/styles/pagination.css +1 -0
  405. package/dist/styles/qr-code.css +1 -0
  406. package/dist/styles/radio-group.css +1 -1
  407. package/dist/styles/section.css +1 -0
  408. package/dist/styles/segmented-control.css +1 -1
  409. package/dist/styles/select.css +1 -1
  410. package/dist/styles/sheet.css +1 -1
  411. package/dist/styles/side-nav.css +1 -1
  412. package/dist/styles/site-footer.css +1 -0
  413. package/dist/styles/site-header.css +1 -0
  414. package/dist/styles/skip-link.css +1 -0
  415. package/dist/styles/sortable-list.css +1 -1
  416. package/dist/styles/stack.css +1 -1
  417. package/dist/styles/stat.css +1 -0
  418. package/dist/styles/steps.css +1 -1
  419. package/dist/styles/switch.css +1 -0
  420. package/dist/styles/table.css +1 -1
  421. package/dist/styles/tabs.css +1 -1
  422. package/dist/styles/tag-input.css +1 -1
  423. package/dist/styles/text-field.css +1 -1
  424. package/dist/styles/text.css +1 -0
  425. package/dist/styles/time-field.css +1 -1
  426. package/dist/styles/toast.css +1 -1
  427. package/dist/styles/visually-hidden.css +1 -0
  428. package/dist/styles.css +1 -1
  429. package/dist/theme/CynosureTheme.d.ts +4 -0
  430. package/dist/theme/CynosureTheme.js.map +1 -1
  431. package/dist/tokens/create-theme.js +137 -108
  432. package/dist/tokens/create-theme.js.map +1 -1
  433. package/dist/tokens/to-css.js +12 -12
  434. package/dist/tokens/to-css.js.map +1 -1
  435. package/package.json +8 -3
  436. package/dist/components/Checkbox/ChoiceRow.d.ts +0 -23
  437. package/dist/components/Checkbox/ChoiceRow.js +0 -57
  438. package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
  439. package/dist/styles/hidden-value.css +0 -1
  440. package/dist/styles/iconbutton.css +0 -1
  441. package/dist/styles/search-field.css +0 -1
@@ -1,22 +1,35 @@
1
1
  "use client";
2
- import { forwardRef as n } from "react";
3
- import { jsx as p } from "react/jsx-runtime";
4
- var y = n(function({ gap: t = "4", align: r, justify: c, as: e = "div", className: a, style: i, children: o, ...f }, s) {
5
- return /* @__PURE__ */ p(e, {
6
- ref: s,
7
- ...f,
8
- className: `cy-stack${a ? ` ${a}` : ""}`,
9
- "data-align": r,
10
- "data-justify": c,
2
+ import { paddingVars as g, space as k, visibilityAttrs as w } from "./space.js";
3
+ import { forwardRef as j } from "react";
4
+ import { jsx as x } from "react/jsx-runtime";
5
+ var A = j(function({ gap: r = "4", direction: o = "column", padding: d, paddingInline: c, paddingBlock: n, align: p, justify: s, sticky: t, stickyOffset: a, hideBelow: e, hideAbove: m, as: f = "div", className: i, style: l, children: u, ...v }, y) {
6
+ return /* @__PURE__ */ x(f, {
7
+ ref: y,
8
+ ...v,
9
+ className: `cy-stack${i ? ` ${i}` : ""}`,
10
+ "data-direction": o === "row" ? "row" : void 0,
11
+ "data-align": p,
12
+ "data-justify": s,
13
+ "data-sticky": t ? "" : void 0,
14
+ ...w({
15
+ hideBelow: e,
16
+ hideAbove: m
17
+ }),
11
18
  style: {
12
- "--_gap": `var(--cy-space-${t})`,
13
- ...i
19
+ "--_gap": k(r),
20
+ ...t && a ? { "--_sticky-top": a } : {},
21
+ ...g({
22
+ padding: d,
23
+ paddingInline: c,
24
+ paddingBlock: n
25
+ }),
26
+ ...l
14
27
  },
15
- children: o
28
+ children: u
16
29
  });
17
30
  });
18
31
  export {
19
- y as Stack
32
+ A as Stack
20
33
  };
21
34
 
22
35
  //# sourceMappingURL=Stack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stack.js","names":["Tag","forwardRef","jsx","Stack","gap","align","justify","as","className","style","children","rest","ref"],"sources":["../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import { type CSSProperties, type ElementType, forwardRef, type ReactNode } from \"react\";\n\ntype Space = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\" | \"10\";\n\nexport interface StackProps {\n /** Space token between children. */\n gap?: Space;\n align?: \"start\" | \"center\" | \"end\" | \"stretch\";\n justify?: \"start\" | \"center\" | \"end\" | \"between\";\n\n /** Neutral layout element to render (never an interactive one). */\n as?: \"div\" | \"section\" | \"ul\" | \"ol\" | \"nav\" | \"aside\" | \"header\" | \"footer\" | \"span\";\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n children?: ReactNode;\n \"data-testid\"?: string;\n}\n\n/** Vertical layout with token gaps. */\nexport const Stack = forwardRef<HTMLElement, StackProps>(function Stack(\n { gap = \"4\", align, justify, as = \"div\", className, style, children, ...rest },\n ref,\n) {\n const Tag = as as ElementType;\n return (\n <Tag\n ref={ref}\n {...rest}\n className={`cy-stack${className ? ` ${className}` : \"\"}`}\n data-align={align}\n data-justify={justify}\n style={{ \"--_gap\": `var(--cy-space-${gap})`, ...style } as CSSProperties}\n >\n {children}\n </Tag>\n );\n});\n"],"mappings":";;;AAoBA,IAAaG,IAAQF,EAAoC,SACvD,EAAE,KAAAG,IAAM,KAAK,OAAAC,GAAO,SAAAC,GAAS,IAAAC,IAAK,OAAO,WAAAC,GAAW,OAAAC,GAAO,UAAAC,GAAU,GAAGC,EAAA,GACxEC,GACA;AAEA,SACE,gBAAAV,EAACF,GAAD;AAAA,IACO,KAAAY;AAAA,IACL,GAAID;AAAA,IACJ,WAAW,WAAWH,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACpD,cAAYH;AAAA,IACZ,gBAAcC;AAAA,IACd,OAAO;AAAA,MAAE,UAAU,kBAAkBF,CAAA;AAAA,MAAQ,GAAGK;AAAA,IAAM;AAAA,IAErD,UAAAC;AAAA,EACE,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"Stack.js","names":["Tag","paddingVars","space","visibilityAttrs","forwardRef","jsx","Stack","gap","direction","padding","paddingInline","paddingBlock","align","justify","sticky","stickyOffset","hideBelow","hideAbove","as","className","style","children","rest","ref"],"sources":["../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import { type CSSProperties, type ElementType, forwardRef, type ReactNode } from \"react\";\nimport {\n type LayoutAttributes,\n type PaddingProps,\n paddingVars,\n type Space,\n space,\n type VisibilityProps,\n visibilityAttrs,\n} from \"./space.js\";\n\nexport interface StackProps extends PaddingProps, VisibilityProps, LayoutAttributes {\n /** Space token between children. */\n gap?: Space;\n /** Lay the children out in a column (the default) or in a row. For a row, Inline adds wrapping and centring. */\n direction?: \"column\" | \"row\" | undefined;\n /** How children line up across the stack (horizontally in a column); `baseline` lines up text in a row. */\n align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\" | undefined;\n /** How children are spread along the stack (vertically in a column); `between` pushes them apart. */\n justify?: \"start\" | \"center\" | \"end\" | \"between\" | undefined;\n\n /**\n * Stay in view while the page scrolls past (`position: sticky`), inside its parent. In a Grid, make the GridItem\n * sticky instead, or give the Grid `align=\"start\"`: a box stretched to its row has nowhere to move.\n */\n sticky?: boolean | undefined;\n /** With `sticky`: any CSS length between the top of the scrolling area and the box, e.g. a header's height. Default 0. */\n stickyOffset?: string | undefined;\n /** Neutral layout element to render (never an interactive one). */\n as?: \"div\" | \"section\" | \"ul\" | \"ol\" | \"nav\" | \"aside\" | \"header\" | \"footer\" | \"span\";\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n /** The items to stack. */\n children?: ReactNode;\n /** Passed to the root element, for tests. */\n \"data-testid\"?: string;\n}\n\n/** Vertical layout with token gaps (or a row, with `direction=\"row\"`). */\nexport const Stack = forwardRef<HTMLElement, StackProps>(function Stack(\n {\n gap = \"4\",\n direction = \"column\",\n padding,\n paddingInline,\n paddingBlock,\n align,\n justify,\n sticky,\n stickyOffset,\n hideBelow,\n hideAbove,\n as = \"div\",\n className,\n style,\n children,\n ...rest\n },\n ref,\n) {\n const Tag = as as ElementType;\n return (\n <Tag\n ref={ref}\n {...rest}\n className={`cy-stack${className ? ` ${className}` : \"\"}`}\n data-direction={direction === \"row\" ? \"row\" : undefined}\n data-align={align}\n data-justify={justify}\n data-sticky={sticky ? \"\" : undefined}\n {...visibilityAttrs({ hideBelow, hideAbove })}\n style={\n {\n \"--_gap\": space(gap),\n ...(sticky && stickyOffset ? { \"--_sticky-top\": stickyOffset } : {}),\n ...paddingVars({ padding, paddingInline, paddingBlock }),\n ...style,\n } as CSSProperties\n }\n >\n {children}\n </Tag>\n );\n});\n"],"mappings":";;;;AAyCA,IAAaM,IAAQF,EAAoC,SACvD,EACE,KAAAG,IAAM,KACN,WAAAC,IAAY,UACZ,SAAAC,GACA,eAAAC,GACA,cAAAC,GACA,OAAAC,GACA,SAAAC,GACA,QAAAC,GACA,cAAAC,GACA,WAAAC,GACA,WAAAC,GACA,IAAAC,IAAK,OACL,WAAAC,GACA,OAAAC,GACA,UAAAC,GACA,GAAGC,EAAA,GAELC,GACA;AAEA,SACE,gBAAAlB,EAACL,GAAD;AAAA,IACO,KAAAuB;AAAA,IACL,GAAID;AAAA,IACJ,WAAW,WAAWH,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IACpD,kBAAgBX,MAAc,QAAQ,QAAQ;AAAA,IAC9C,cAAYI;AAAA,IACZ,gBAAcC;AAAA,IACd,eAAaC,IAAS,KAAK;AAAA,IAC3B,GAAIX,EAAgB;AAAA,MAAE,WAAAa;AAAA,MAAW,WAAAC;AAAA,IAAU,CAAC;AAAA,IAC5C,OACE;AAAA,MACE,UAAUf,EAAMK,CAAG;AAAA,MACnB,GAAIO,KAAUC,IAAe,EAAE,iBAAiBA,EAAa,IAAI,CAAC;AAAA,MAClE,GAAGd,EAAY;AAAA,QAAE,SAAAQ;AAAA,QAAS,eAAAC;AAAA,QAAe,cAAAC;AAAA,MAAa,CAAC;AAAA,MACvD,GAAGS;AAAA,IACL;AAAA,IAGD,UAAAC;AAAA,EACE,CAAA;AAET,CAAC"}
@@ -1 +1,2 @@
1
1
  export { Stack, type StackProps } from "./Stack.js";
2
+ export { BREAKPOINTS, type Breakpoint, type LayoutAttributes, type PaddingProps, type Space, type VisibilityProps, } from "./space.js";
@@ -0,0 +1,47 @@
1
+ import type { AriaAttributes, HTMLAttributes } from "react";
2
+ /** A step of the theme's space scale (`--cy-space-0` … `--cy-space-10`). */
3
+ export type Space = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10";
4
+ /** The padding props shared by the layout primitives (Stack, Inline, Grid). */
5
+ export interface PaddingProps {
6
+ /** Space token of padding on all four sides of the box. Default: none. */
7
+ padding?: Space | undefined;
8
+ /** Space token of padding at the inline start and end (left and right in English). Wins over `padding`. */
9
+ paddingInline?: Space | undefined;
10
+ /** Space token of padding at the block start and end (top and bottom in English). Wins over `padding`. */
11
+ paddingBlock?: Space | undefined;
12
+ }
13
+ /** The space token a key stands for, as a CSS value. */
14
+ export declare const space: (key: Space) => string;
15
+ /**
16
+ * The private custom properties the layout CSS reads its padding from, for the sides that are set. Sides that are
17
+ * not set are left out: the stylesheet resets them to zero on every root, so a nested layout never inherits them.
18
+ */
19
+ export declare function paddingVars({ padding, paddingInline, paddingBlock }: PaddingProps): Record<string, string>;
20
+ /**
21
+ * The named widths of the layout scale. Grid's per-breakpoint `columns` measure the grid's own width; `hideBelow` and
22
+ * `hideAbove` measure the window. A breakpoint applies from its width upwards. `base.css` and `grid.css` repeat these
23
+ * values (a media or container query cannot read a custom property): change them together.
24
+ */
25
+ export declare const BREAKPOINTS: {
26
+ readonly sm: "30rem";
27
+ readonly md: "45rem";
28
+ readonly lg: "60rem";
29
+ readonly xl: "75rem";
30
+ };
31
+ /** A named width of the layout scale (`BREAKPOINTS`). */
32
+ export type Breakpoint = keyof typeof BREAKPOINTS;
33
+ /** Attributes every layout primitive passes to its element: an id to link to, a role and ARIA attributes. */
34
+ export interface LayoutAttributes extends Pick<HTMLAttributes<HTMLElement>, "id" | "role">, AriaAttributes {
35
+ }
36
+ /** Showing or hiding a layout box by the width of the window, with no script. */
37
+ export interface VisibilityProps {
38
+ /** Hidden while the window is narrower than this breakpoint (`md`: below 45rem). */
39
+ hideBelow?: Breakpoint | undefined;
40
+ /** Hidden from this breakpoint upwards (`md`: 45rem and wider). */
41
+ hideAbove?: Breakpoint | undefined;
42
+ }
43
+ /** The data attributes `base.css` hides a box by. */
44
+ export declare const visibilityAttrs: ({ hideBelow, hideAbove }: VisibilityProps) => {
45
+ "data-cy-hide-below": "sm" | "md" | "lg" | "xl" | undefined;
46
+ "data-cy-hide-above": "sm" | "md" | "lg" | "xl" | undefined;
47
+ };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ var i = (e) => `var(--cy-space-${e})`;
3
+ function s({ padding: e, paddingInline: r = e, paddingBlock: t = e }) {
4
+ const a = {};
5
+ return r && (a["--_pad-inline"] = i(r)), t && (a["--_pad-block"] = i(t)), a;
6
+ }
7
+ var c = {
8
+ sm: "30rem",
9
+ md: "45rem",
10
+ lg: "60rem",
11
+ xl: "75rem"
12
+ }, v = ({ hideBelow: e, hideAbove: r }) => ({
13
+ "data-cy-hide-below": e,
14
+ "data-cy-hide-above": r
15
+ });
16
+ export {
17
+ c as BREAKPOINTS,
18
+ s as paddingVars,
19
+ i as space,
20
+ v as visibilityAttrs
21
+ };
22
+
23
+ //# sourceMappingURL=space.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.js","names":["space","key","paddingVars","padding","paddingInline","paddingBlock","vars","BREAKPOINTS","visibilityAttrs","hideBelow","hideAbove"],"sources":["../../../src/components/Stack/space.ts"],"sourcesContent":["import type { AriaAttributes, HTMLAttributes } from \"react\";\n\n/** A step of the theme's space scale (`--cy-space-0` … `--cy-space-10`). */\nexport type Space = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" | \"8\" | \"9\" | \"10\";\n\n/** The padding props shared by the layout primitives (Stack, Inline, Grid). */\nexport interface PaddingProps {\n /** Space token of padding on all four sides of the box. Default: none. */\n padding?: Space | undefined;\n /** Space token of padding at the inline start and end (left and right in English). Wins over `padding`. */\n paddingInline?: Space | undefined;\n /** Space token of padding at the block start and end (top and bottom in English). Wins over `padding`. */\n paddingBlock?: Space | undefined;\n}\n\n/** The space token a key stands for, as a CSS value. */\nexport const space = (key: Space) => `var(--cy-space-${key})`;\n\n/**\n * The private custom properties the layout CSS reads its padding from, for the sides that are set. Sides that are\n * not set are left out: the stylesheet resets them to zero on every root, so a nested layout never inherits them.\n */\nexport function paddingVars({ padding, paddingInline = padding, paddingBlock = padding }: PaddingProps) {\n const vars: Record<string, string> = {};\n if (paddingInline) vars[\"--_pad-inline\"] = space(paddingInline);\n if (paddingBlock) vars[\"--_pad-block\"] = space(paddingBlock);\n return vars;\n}\n\n/**\n * The named widths of the layout scale. Grid's per-breakpoint `columns` measure the grid's own width; `hideBelow` and\n * `hideAbove` measure the window. A breakpoint applies from its width upwards. `base.css` and `grid.css` repeat these\n * values (a media or container query cannot read a custom property): change them together.\n */\nexport const BREAKPOINTS = { sm: \"30rem\", md: \"45rem\", lg: \"60rem\", xl: \"75rem\" } as const;\n\n/** A named width of the layout scale (`BREAKPOINTS`). */\nexport type Breakpoint = keyof typeof BREAKPOINTS;\n\n/** Attributes every layout primitive passes to its element: an id to link to, a role and ARIA attributes. */\nexport interface LayoutAttributes extends Pick<HTMLAttributes<HTMLElement>, \"id\" | \"role\">, AriaAttributes {}\n\n/** Showing or hiding a layout box by the width of the window, with no script. */\nexport interface VisibilityProps {\n /** Hidden while the window is narrower than this breakpoint (`md`: below 45rem). */\n hideBelow?: Breakpoint | undefined;\n /** Hidden from this breakpoint upwards (`md`: 45rem and wider). */\n hideAbove?: Breakpoint | undefined;\n}\n\n/** The data attributes `base.css` hides a box by. */\nexport const visibilityAttrs = ({ hideBelow, hideAbove }: VisibilityProps) => ({\n \"data-cy-hide-below\": hideBelow,\n \"data-cy-hide-above\": hideAbove,\n});\n"],"mappings":";AAgBA,IAAaA,IAAA,CAASC,MAAe,kBAAkBA,CAAA;AAMvD,SAAgBC,EAAY,EAAE,SAAAC,GAAS,eAAAC,IAAgBD,GAAS,cAAAE,IAAeF,EAAA,GAAyB;AACtG,QAAMG,IAA+B,CAAC;AACtC,SAAIF,MAAeE,EAAK,eAAA,IAAmBN,EAAMI,CAAa,IAC1DC,MAAcC,EAAK,cAAA,IAAkBN,EAAMK,CAAY,IACpDC;AACT;AAOA,IAAaC,IAAc;AAAA,EAAE,IAAI;AAAA,EAAS,IAAI;AAAA,EAAS,IAAI;AAAA,EAAS,IAAI;AAAQ,GAiBnEC,IAAA,CAAmB,EAAE,WAAAC,GAAW,WAAAC,EAAA,OAAkC;AAAA,EAC7E,sBAAsBD;AAAA,EACtB,sBAAsBC;AACxB"}
@@ -0,0 +1,88 @@
1
+ import { type CSSProperties, type MouseEventHandler, type ReactNode } from "react";
2
+ import type { IconData } from "../../icons/types.js";
3
+ import type { Size, Tone } from "../../tokens/schema.js";
4
+ export interface StatTokens {
5
+ /** Space between the icon tile and the text. */
6
+ gap: string;
7
+ /** Colour of the label and the description. */
8
+ labelColor: string;
9
+ /** Font family of the value. Falls back to the display font. */
10
+ valueFont: string;
11
+ /** Font weight of the value. */
12
+ valueWeight: string;
13
+ /** Font size of the value at `size="sm"`. */
14
+ valueSizeSm: string;
15
+ /** Font size of the value at `size="md"`. */
16
+ valueSizeMd: string;
17
+ /** Font size of the value at `size="lg"`. */
18
+ valueSizeLg: string;
19
+ }
20
+ declare module "../../tokens/schema.js" {
21
+ interface ComponentTokens {
22
+ stat: StatTokens;
23
+ }
24
+ }
25
+ export type StatDirection = "up" | "down" | "flat";
26
+ export interface StatDelta {
27
+ /** The change as shown, e.g. "12%" or "+£1,200". */
28
+ value: string;
29
+ /**
30
+ * Which way it moved: picks the arrow and the spoken word. Default: "up" when `value` starts with "+", "down" when
31
+ * it starts with "-" or "−", otherwise "flat".
32
+ */
33
+ direction?: StatDirection | undefined;
34
+ /**
35
+ * Colour of the change. Default: "success" for up, "danger" for down, "neutral" for flat. Set it when down is good
36
+ * news (costs, errors, load time).
37
+ */
38
+ tone?: Tone | undefined;
39
+ }
40
+ export interface StatLabels {
41
+ /** Spoken for a rise, from the delta's value without its sign. Default "up 12%". */
42
+ up: (value: string) => string;
43
+ /** Spoken for a fall. Default "down 12%". */
44
+ down: (value: string) => string;
45
+ /** Spoken when nothing moved. Default "unchanged at 0%". */
46
+ flat: (value: string) => string;
47
+ }
48
+ export interface StatProps {
49
+ /** What is measured ("Revenue"). Read before the value. */
50
+ label: ReactNode;
51
+ /** The figure ("£12,400"). Digits are tabular, so stats in a row line up. */
52
+ value: ReactNode;
53
+ /** A unit written after the value, smaller ("ms", "users"). */
54
+ unit?: ReactNode;
55
+ /** A line under the value: what the figure covers ("Last 30 days") or how it compares ("vs last month"). */
56
+ description?: ReactNode;
57
+ /** The change since last time: an arrow, the value in a tone, and a spoken direction ("up 12%"). */
58
+ delta?: StatDelta | undefined;
59
+ /** An icon on an IconTile at the start of the stat. Decorative: the label names the stat. */
60
+ icon?: IconData | undefined;
61
+ /** Colour of the icon tile. Default "accent". */
62
+ iconTone?: Tone;
63
+ /** Size of the value, the text, the icon tile and the padding. Default "md". */
64
+ size?: Size;
65
+ /** `start`: icon beside the text, text at the start. `center`: icon above, everything centred. Default "start". */
66
+ align?: "start" | "center";
67
+ /** The card's look, as Card's: `surface` raised, `outline` border only, `soft` tinted. Default "surface". */
68
+ variant?: "surface" | "outline" | "soft";
69
+ /** Element of a static stat: `li` inside a list of stats, `article` for a stat that stands alone. Default "div". */
70
+ as?: "div" | "li" | "article";
71
+ /** Makes the whole stat a link to the figure's detail (through Card, so unsafe schemes are not linked). */
72
+ href?: string | undefined;
73
+ /** With `href`: where it opens, e.g. `_blank`. */
74
+ target?: string | undefined;
75
+ /** With `href`: called when the link is followed, before the browser navigates. */
76
+ onClick?: MouseEventHandler<HTMLElement> | undefined;
77
+ /** Replace the built-in English words spoken with the delta. */
78
+ labels?: Partial<StatLabels>;
79
+ /** Added to the root element, for layout. */
80
+ className?: string;
81
+ /** Layout only. Restyle through --cy-stat-* tokens. */
82
+ style?: CSSProperties;
83
+ }
84
+ /**
85
+ * A figure with its label (a KPI tile): the value, an optional unit, change and description, on a Card. The label and
86
+ * the figures are a description list, so they are read as "Revenue, £12,400, up 12%".
87
+ */
88
+ export declare const Stat: import("react").ForwardRefExoticComponent<StatProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { Icon as E } from "../../foundations/Icon/Icon.js";
3
+ import { Card as I } from "../Card/Card.js";
4
+ import { minus as L } from "../../icons/minus.js";
5
+ import { IconTile as T } from "../IconTile/IconTile.js";
6
+ import { arrowDown as $ } from "../../icons/arrow-down.js";
7
+ import { arrowUp as O } from "../../icons/arrow-up.js";
8
+ import { forwardRef as R } from "react";
9
+ import { jsx as a, jsxs as c } from "react/jsx-runtime";
10
+ var b = {
11
+ up: (t) => `up ${t}`,
12
+ down: (t) => `down ${t}`,
13
+ flat: (t) => `unchanged at ${t}`
14
+ }, j = {
15
+ up: O,
16
+ down: $,
17
+ flat: L
18
+ }, G = {
19
+ up: "success",
20
+ down: "danger",
21
+ flat: "neutral"
22
+ }, U = /^[+\-\u2212]\s*/, _ = {
23
+ sm: "sm",
24
+ md: "md",
25
+ lg: "lg"
26
+ };
27
+ function B(t) {
28
+ const s = t.trim()[0];
29
+ return s === "+" ? "up" : s === "-" || s === "−" ? "down" : "flat";
30
+ }
31
+ var K = R(function({ label: s, value: N, unit: o, description: l, delta: r, icon: m, iconTone: h = "accent", size: n = "md", align: w = "start", variant: g = "surface", as: e = "div", href: d, target: u, onClick: p, labels: A, className: v, style: f }, S) {
32
+ const D = {
33
+ ...b,
34
+ ...A
35
+ }, i = r ? r.direction ?? B(r.value) : "flat", x = e, y = /* @__PURE__ */ a(I, {
36
+ ref: S,
37
+ as: e,
38
+ variant: g,
39
+ padding: _[n],
40
+ ...d !== void 0 && {
41
+ href: d,
42
+ ...u !== void 0 && { target: u },
43
+ ...p !== void 0 && { onClick: p }
44
+ },
45
+ className: v ? `cy-stat ${v}` : "cy-stat",
46
+ ...f !== void 0 && { style: f },
47
+ children: /* @__PURE__ */ c("div", {
48
+ className: "cy-stat-body cy-reset",
49
+ "data-size": n,
50
+ "data-align": w,
51
+ children: [m && /* @__PURE__ */ a(T, {
52
+ icon: m,
53
+ tone: h,
54
+ size: n
55
+ }), /* @__PURE__ */ c("dl", {
56
+ className: "cy-stat-list cy-reset",
57
+ children: [
58
+ /* @__PURE__ */ a("dt", {
59
+ className: "cy-stat-label",
60
+ children: s
61
+ }),
62
+ /* @__PURE__ */ c("dd", {
63
+ className: "cy-stat-value",
64
+ children: [N, o != null && /* @__PURE__ */ a("span", {
65
+ className: "cy-stat-unit",
66
+ children: o
67
+ })]
68
+ }),
69
+ r && /* @__PURE__ */ c("dd", {
70
+ className: "cy-stat-delta",
71
+ "data-tone": r.tone ?? G[i],
72
+ children: [
73
+ /* @__PURE__ */ a(E, {
74
+ icon: j[i],
75
+ size: "sm"
76
+ }),
77
+ /* @__PURE__ */ a("span", {
78
+ className: "cy-reset",
79
+ "aria-hidden": "true",
80
+ children: r.value
81
+ }),
82
+ /* @__PURE__ */ a("span", {
83
+ className: "cy-visually-hidden",
84
+ children: D[i](r.value.trim().replace(U, ""))
85
+ })
86
+ ]
87
+ }),
88
+ l != null && /* @__PURE__ */ a("dd", {
89
+ className: "cy-stat-description",
90
+ children: l
91
+ })
92
+ ]
93
+ })]
94
+ })
95
+ });
96
+ return d !== void 0 && e !== "div" ? /* @__PURE__ */ a(x, {
97
+ className: "cy-stat-item cy-reset",
98
+ children: y
99
+ }) : y;
100
+ });
101
+ export {
102
+ K as Stat
103
+ };
104
+
105
+ //# sourceMappingURL=Stat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stat.js","names":["Icon","Card","minus","IconTile","arrowDown","arrowUp","forwardRef","jsx","jsxs","DEFAULT_LABELS","value","ARROWS","DELTA_TONES","SIGN","PADDING","directionOf","sign","Stat","label","unit","description","delta","icon","iconTone","size","align","variant","as","href","target","onClick","labels","className","style","ref","text","direction","As","card"],"sources":["../../../src/components/Stat/Stat.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type MouseEventHandler, type ReactNode } from \"react\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { arrowDown } from \"../../icons/arrow-down.js\";\nimport { arrowUp } from \"../../icons/arrow-up.js\";\nimport { minus } from \"../../icons/minus.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size, Tone } from \"../../tokens/schema.js\";\nimport { Card } from \"../Card/Card.js\";\nimport { IconTile } from \"../IconTile/IconTile.js\";\n\nexport interface StatTokens {\n /** Space between the icon tile and the text. */\n gap: string;\n /** Colour of the label and the description. */\n labelColor: string;\n /** Font family of the value. Falls back to the display font. */\n valueFont: string;\n /** Font weight of the value. */\n valueWeight: string;\n /** Font size of the value at `size=\"sm\"`. */\n valueSizeSm: string;\n /** Font size of the value at `size=\"md\"`. */\n valueSizeMd: string;\n /** Font size of the value at `size=\"lg\"`. */\n valueSizeLg: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n stat: StatTokens;\n }\n}\n\nexport type StatDirection = \"up\" | \"down\" | \"flat\";\n\nexport interface StatDelta {\n /** The change as shown, e.g. \"12%\" or \"+£1,200\". */\n value: string;\n /**\n * Which way it moved: picks the arrow and the spoken word. Default: \"up\" when `value` starts with \"+\", \"down\" when\n * it starts with \"-\" or \"−\", otherwise \"flat\".\n */\n direction?: StatDirection | undefined;\n /**\n * Colour of the change. Default: \"success\" for up, \"danger\" for down, \"neutral\" for flat. Set it when down is good\n * news (costs, errors, load time).\n */\n tone?: Tone | undefined;\n}\n\nexport interface StatLabels {\n /** Spoken for a rise, from the delta's value without its sign. Default \"up 12%\". */\n up: (value: string) => string;\n /** Spoken for a fall. Default \"down 12%\". */\n down: (value: string) => string;\n /** Spoken when nothing moved. Default \"unchanged at 0%\". */\n flat: (value: string) => string;\n}\n\nexport interface StatProps {\n /** What is measured (\"Revenue\"). Read before the value. */\n label: ReactNode;\n /** The figure (\"£12,400\"). Digits are tabular, so stats in a row line up. */\n value: ReactNode;\n /** A unit written after the value, smaller (\"ms\", \"users\"). */\n unit?: ReactNode;\n /** A line under the value: what the figure covers (\"Last 30 days\") or how it compares (\"vs last month\"). */\n description?: ReactNode;\n /** The change since last time: an arrow, the value in a tone, and a spoken direction (\"up 12%\"). */\n delta?: StatDelta | undefined;\n /** An icon on an IconTile at the start of the stat. Decorative: the label names the stat. */\n icon?: IconData | undefined;\n /** Colour of the icon tile. Default \"accent\". */\n iconTone?: Tone;\n /** Size of the value, the text, the icon tile and the padding. Default \"md\". */\n size?: Size;\n /** `start`: icon beside the text, text at the start. `center`: icon above, everything centred. Default \"start\". */\n align?: \"start\" | \"center\";\n /** The card's look, as Card's: `surface` raised, `outline` border only, `soft` tinted. Default \"surface\". */\n variant?: \"surface\" | \"outline\" | \"soft\";\n /** Element of a static stat: `li` inside a list of stats, `article` for a stat that stands alone. Default \"div\". */\n as?: \"div\" | \"li\" | \"article\";\n /** Makes the whole stat a link to the figure's detail (through Card, so unsafe schemes are not linked). */\n href?: string | undefined;\n /** With `href`: where it opens, e.g. `_blank`. */\n target?: string | undefined;\n /** With `href`: called when the link is followed, before the browser navigates. */\n onClick?: MouseEventHandler<HTMLElement> | undefined;\n /** Replace the built-in English words spoken with the delta. */\n labels?: Partial<StatLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-stat-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: StatLabels = {\n up: (value) => `up ${value}`,\n down: (value) => `down ${value}`,\n flat: (value) => `unchanged at ${value}`,\n};\nconst ARROWS = { up: arrowUp, down: arrowDown, flat: minus };\nconst DELTA_TONES = { up: \"success\", down: \"danger\", flat: \"neutral\" } as const;\n/** A leading plus or minus: the spoken word already says which way. */\nconst SIGN = /^[+\\-\\u2212]\\s*/;\nconst PADDING = { sm: \"sm\", md: \"md\", lg: \"lg\" } as const;\n\n/** The direction a delta's value implies when none is given. */\nfunction directionOf(value: string): StatDirection {\n const sign = value.trim()[0];\n return sign === \"+\" ? \"up\" : sign === \"-\" || sign === \"−\" ? \"down\" : \"flat\";\n}\n\n/**\n * A figure with its label (a KPI tile): the value, an optional unit, change and description, on a Card. The label and\n * the figures are a description list, so they are read as \"Revenue, £12,400, up 12%\".\n */\nexport const Stat = forwardRef<HTMLElement, StatProps>(function Stat(\n {\n label,\n value,\n unit,\n description,\n delta,\n icon,\n iconTone = \"accent\",\n size = \"md\",\n align = \"start\",\n variant = \"surface\",\n as = \"div\",\n href,\n target,\n onClick,\n labels,\n className,\n style,\n },\n ref,\n) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const direction = delta ? (delta.direction ?? directionOf(delta.value)) : \"flat\";\n const As = as;\n const card = (\n <Card\n ref={ref}\n as={as}\n variant={variant}\n padding={PADDING[size]}\n {...(href !== undefined && {\n href,\n ...(target !== undefined && { target }),\n ...(onClick !== undefined && { onClick }),\n })}\n className={className ? `cy-stat ${className}` : \"cy-stat\"}\n {...(style !== undefined && { style })}\n >\n <div className=\"cy-stat-body cy-reset\" data-size={size} data-align={align}>\n {icon && <IconTile icon={icon} tone={iconTone} size={size} />}\n <dl className=\"cy-stat-list cy-reset\">\n <dt className=\"cy-stat-label\">{label}</dt>\n <dd className=\"cy-stat-value\">\n {value}\n {unit != null && <span className=\"cy-stat-unit\">{unit}</span>}\n </dd>\n {delta && (\n <dd className=\"cy-stat-delta\" data-tone={delta.tone ?? DELTA_TONES[direction]}>\n <Icon icon={ARROWS[direction]} size=\"sm\" />\n <span className=\"cy-reset\" aria-hidden=\"true\">\n {delta.value}\n </span>\n <span className=\"cy-visually-hidden\">\n {text[direction](delta.value.trim().replace(SIGN, \"\"))}\n </span>\n </dd>\n )}\n {description != null && <dd className=\"cy-stat-description\">{description}</dd>}\n </dl>\n </div>\n </Card>\n );\n // A linked stat in a list keeps its list item: the link goes inside it.\n return href !== undefined && as !== \"div\" ? <As className=\"cy-stat-item cy-reset\">{card}</As> : card;\n});\n"],"mappings":";;;;;;;;;AAgGA,IAAMS,IAA6B;AAAA,EACjC,IAAA,CAAKC,MAAU,MAAMA,CAAA;AAAA,EACrB,MAAA,CAAOA,MAAU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;AAAA,MACD,CAAA,CAAA;AAAA,I;A,EACD,CAAA;AAGR,SAAOQ,MAAS,UAAaD,MAAO,QAAQ,gBAAApB,EAAC8B,GAAD;AAAA,IAAI,WAAU;AAAA,IAAyB,UAAAC;AAAA,EAAS,CAAA,IAAIA;AAClG,CAAC"}
@@ -0,0 +1 @@
1
+ export { Stat, type StatDelta, type StatDirection, type StatLabels, type StatProps, type StatTokens, } from "./Stat.js";
@@ -25,7 +25,7 @@ export interface StepItem {
25
25
  disabled?: boolean;
26
26
  }
27
27
  export interface StepsLabels {
28
- /** Accessible name of the list. Default: "Progress". */
28
+ /** Accessible name of the list. Default: "Progress", or "Steps" for a how-to (no `current`). */
29
29
  list: string;
30
30
  /** Read after each step's label. Defaults: "completed", "current step", "not started", "has a problem". */
31
31
  complete: string;
@@ -34,18 +34,28 @@ export interface StepsLabels {
34
34
  error: string;
35
35
  }
36
36
  export interface StepsProps {
37
+ /** The steps, in order. */
37
38
  steps: StepItem[];
38
- /** `id` of the step the person is on. Steps before it are complete, steps after it upcoming. */
39
- current: string;
39
+ /**
40
+ * `id` of the step the person is on. Steps before it are complete, steps after it upcoming. Leave it out for a
41
+ * numbered how-to (steps to follow, not progress): every step is numbered alike and no status is read.
42
+ */
43
+ current?: string | undefined;
44
+ /** Lays the steps out in a row or in a column. Default "horizontal". */
40
45
  orientation?: "horizontal" | "vertical";
41
46
  /** Makes steps buttons that go to that step. Leave it out for a read-only progress display. */
42
47
  onStepSelect?: (id: string) => void;
43
48
  /** Text size of labels and markers. */
44
49
  size?: Size;
50
+ /** Replace the built-in English text: the list's name and the status read after each step. */
45
51
  labels?: Partial<StepsLabels>;
52
+ /** Added to the root element, for layout. */
46
53
  className?: string;
47
54
  /** Layout only. Restyle through --cy-steps-* tokens. */
48
55
  style?: CSSProperties;
49
56
  }
50
- /** Progress through an ordered flow (a setup wizard, a checkout): numbered steps with the current one marked. */
57
+ /**
58
+ * Progress through an ordered flow (a setup wizard, a checkout): numbered steps with the current one marked. Without
59
+ * `current`, a numbered how-to.
60
+ */
51
61
  export declare function Steps({ steps, current, orientation, onStepSelect, size, labels, className, style, }: StepsProps): import("react").JSX.Element;
@@ -1,39 +1,40 @@
1
1
  "use client";
2
- import { ButtonBase as b } from "../../foundations/ButtonBase/ButtonBase.js";
3
- import { Icon as p } from "../../foundations/Icon/Icon.js";
2
+ import { ButtonBase as v } from "../../foundations/ButtonBase/ButtonBase.js";
3
+ import { Icon as u } from "../../foundations/Icon/Icon.js";
4
4
  import { check as x } from "../../icons/check.js";
5
5
  import { alert as g } from "../../icons/alert.js";
6
- import { Fragment as v, jsx as s, jsxs as i } from "react/jsx-runtime";
7
- var z = {
6
+ import { Fragment as z, jsx as s, jsxs as o } from "react/jsx-runtime";
7
+ var k = {
8
8
  list: "Progress",
9
9
  complete: "completed",
10
10
  current: "current step",
11
11
  upcoming: "not started",
12
12
  error: "has a problem"
13
13
  };
14
- function C({ steps: a, current: u, orientation: y = "horizontal", onStepSelect: l, size: h = "md", labels: N, className: o, style: f }) {
15
- const d = {
16
- ...z,
17
- ...N
18
- }, r = a.findIndex((e) => e.id === u);
14
+ function E({ steps: c, current: l, orientation: h = "horizontal", onStepSelect: d, size: N = "md", labels: f, className: m, style: b }) {
15
+ const i = l === void 0, p = {
16
+ ...k,
17
+ ...i ? { list: "Steps" } : {},
18
+ ...f
19
+ }, a = i ? -1 : c.findIndex((e) => e.id === l);
19
20
  return /* @__PURE__ */ s("ol", {
20
- className: o ? `cy-steps ${o}` : "cy-steps",
21
- "aria-label": d.list,
22
- "data-orientation": y,
23
- "data-size": h,
24
- style: f,
25
- children: a.map((e, t) => {
26
- const c = e.status ?? (t === r ? "current" : r >= 0 && t < r ? "complete" : "upcoming"), n = t === r, m = /* @__PURE__ */ i(v, { children: [/* @__PURE__ */ s("span", {
21
+ className: m ? `cy-steps ${m}` : "cy-steps",
22
+ "aria-label": p.list,
23
+ "data-orientation": h,
24
+ "data-size": N,
25
+ style: b,
26
+ children: c.map((e, t) => {
27
+ const r = e.status ?? (i ? void 0 : t === a ? "current" : a >= 0 && t < a ? "complete" : "upcoming"), n = t === a, y = /* @__PURE__ */ o(z, { children: [/* @__PURE__ */ s("span", {
27
28
  className: "cy-steps-marker cy-reset",
28
29
  "aria-hidden": "true",
29
- children: c === "complete" ? /* @__PURE__ */ s(p, {
30
+ children: r === "complete" ? /* @__PURE__ */ s(u, {
30
31
  icon: x,
31
32
  size: "sm"
32
- }) : c === "error" ? /* @__PURE__ */ s(p, {
33
+ }) : r === "error" ? /* @__PURE__ */ s(u, {
33
34
  icon: g,
34
35
  size: "sm"
35
36
  }) : t + 1
36
- }), /* @__PURE__ */ i("span", {
37
+ }), /* @__PURE__ */ o("span", {
37
38
  className: "cy-steps-text cy-reset",
38
39
  children: [
39
40
  /* @__PURE__ */ s("span", {
@@ -44,28 +45,28 @@ function C({ steps: a, current: u, orientation: y = "horizontal", onStepSelect:
44
45
  className: "cy-steps-description cy-reset",
45
46
  children: e.description
46
47
  }),
47
- /* @__PURE__ */ s("span", {
48
- className: "cy-steps-hidden",
49
- children: `, ${d[c]}`
48
+ r && /* @__PURE__ */ s("span", {
49
+ className: "cy-visually-hidden",
50
+ children: `, ${p[r]}`
50
51
  })
51
52
  ]
52
53
  })] });
53
- return /* @__PURE__ */ i("li", {
54
+ return /* @__PURE__ */ o("li", {
54
55
  className: "cy-steps-item cy-reset",
55
- "data-status": c,
56
- children: [l ? /* @__PURE__ */ s(b, {
56
+ "data-status": r ?? "step",
57
+ children: [d ? /* @__PURE__ */ s(v, {
57
58
  className: "cy-steps-step cy-reset",
58
59
  "aria-current": n ? "step" : void 0,
59
60
  "aria-disabled": e.disabled || void 0,
60
61
  onClick: () => {
61
- !e.disabled && !n && l(e.id);
62
+ !e.disabled && !n && d(e.id);
62
63
  },
63
- children: m
64
+ children: y
64
65
  }) : /* @__PURE__ */ s("span", {
65
66
  className: "cy-steps-step cy-reset",
66
67
  "aria-current": n ? "step" : void 0,
67
- children: m
68
- }), t < a.length - 1 && /* @__PURE__ */ s("span", {
68
+ children: y
69
+ }), t < c.length - 1 && /* @__PURE__ */ s("span", {
69
70
  className: "cy-steps-line cy-reset",
70
71
  "aria-hidden": "true"
71
72
  })]
@@ -74,7 +75,7 @@ function C({ steps: a, current: u, orientation: y = "horizontal", onStepSelect:
74
75
  });
75
76
  }
76
77
  export {
77
- C as Steps
78
+ E as Steps
78
79
  };
79
80
 
80
81
  //# sourceMappingURL=Steps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Steps.js","names":["_Fragment","ButtonBase","Icon","check","alert","Fragment","jsx","jsxs","DEFAULT_LABELS","Steps","steps","current","orientation","onStepSelect","size","labels","className","style","text","at","s","step","i","status","isCurrent","content"],"sources":["../../../src/components/Steps/Steps.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { alert } from \"../../icons/alert.js\";\nimport { check } from \"../../icons/check.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface StepsTokens {\n /** Diameter of the numbered marker. */\n markerSize: string;\n /** Thickness of the line between steps. */\n lineWidth: string;\n /** Space between steps. */\n gap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n steps: StepsTokens;\n }\n}\n\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\" | \"error\";\n\nexport interface StepItem {\n id: string;\n label: ReactNode;\n /** A second line under the label. */\n description?: ReactNode;\n /** Overrides the status worked out from `current`: mark a step `error`, or `complete` out of order. */\n status?: \"complete\" | \"error\" | undefined;\n /** With `onStepSelect`: this step cannot be chosen. */\n disabled?: boolean;\n}\n\nexport interface StepsLabels {\n /** Accessible name of the list. Default: \"Progress\". */\n list: string;\n /** Read after each step's label. Defaults: \"completed\", \"current step\", \"not started\", \"has a problem\". */\n complete: string;\n current: string;\n upcoming: string;\n error: string;\n}\n\nexport interface StepsProps {\n steps: StepItem[];\n /** `id` of the step the person is on. Steps before it are complete, steps after it upcoming. */\n current: string;\n orientation?: \"horizontal\" | \"vertical\";\n /** Makes steps buttons that go to that step. Leave it out for a read-only progress display. */\n onStepSelect?: (id: string) => void;\n /** Text size of labels and markers. */\n size?: Size;\n labels?: Partial<StepsLabels>;\n className?: string;\n /** Layout only. Restyle through --cy-steps-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: StepsLabels = {\n list: \"Progress\",\n complete: \"completed\",\n current: \"current step\",\n upcoming: \"not started\",\n error: \"has a problem\",\n};\n\n/** Progress through an ordered flow (a setup wizard, a checkout): numbered steps with the current one marked. */\nexport function Steps({\n steps,\n current,\n orientation = \"horizontal\",\n onStepSelect,\n size = \"md\",\n labels,\n className,\n style,\n}: StepsProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const at = steps.findIndex((s) => s.id === current);\n return (\n <ol\n className={className ? `cy-steps ${className}` : \"cy-steps\"}\n aria-label={text.list}\n data-orientation={orientation}\n data-size={size}\n style={style}\n >\n {steps.map((step, i) => {\n const status: StepStatus =\n step.status ?? (i === at ? \"current\" : at >= 0 && i < at ? \"complete\" : \"upcoming\");\n const isCurrent = i === at;\n const content = (\n <>\n <span className=\"cy-steps-marker cy-reset\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <Icon icon={check} size=\"sm\" />\n ) : status === \"error\" ? (\n <Icon icon={alert} size=\"sm\" />\n ) : (\n i + 1\n )}\n </span>\n <span className=\"cy-steps-text cy-reset\">\n <span className=\"cy-steps-label cy-reset\">{step.label}</span>\n {step.description != null && (\n <span className=\"cy-steps-description cy-reset\">{step.description}</span>\n )}\n <span className=\"cy-steps-hidden\">{`, ${text[status]}`}</span>\n </span>\n </>\n );\n return (\n <li key={step.id} className=\"cy-steps-item cy-reset\" data-status={status}>\n {onStepSelect ? (\n <ButtonBase\n className=\"cy-steps-step cy-reset\"\n aria-current={isCurrent ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n onClick={() => {\n if (!step.disabled && !isCurrent) onStepSelect(step.id);\n }}\n >\n {content}\n </ButtonBase>\n ) : (\n <span className=\"cy-steps-step cy-reset\" aria-current={isCurrent ? \"step\" : undefined}>\n {content}\n </span>\n )}\n {i < steps.length - 1 && <span className=\"cy-steps-line cy-reset\" aria-hidden=\"true\" />}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"mappings":";;;;;;AA4DA,IAAMQ,IAA8B;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AACT;AAGA,SAAgBC,EAAM,EACpB,OAAAC,GACA,SAAAC,GACA,aAAAC,IAAc,cACd,cAAAC,GACA,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACa;AACb,QAAMC,IAAO;AAAA,IAAE,GAAGV;AAAA,IAAgB,GAAGO;AAAA,EAAO,GACtCI,IAAKT,EAAM,UAAA,CAAWU,MAAMA,EAAE,OAAOT,CAAO;AAClD,SACE,gBAAAL,EAAC,MAAD;AAAA,IACE,WAAWU,IAAY,YAAYA,CAAA,KAAc;AAAA,IACjD,cAAYE,EAAK;AAAA,IACjB,oBAAkBN;AAAA,IAClB,aAAWE;AAAA,IACJ,OAAAG;AAAA,IAEN,UAAAP,EAAM,IAAA,CAAKW,GAAMC,MAAM;AACtB,YAAMC,IACJF,EAAK,WAAWC,MAAMH,IAAK,YAAYA,KAAM,KAAKG,IAAIH,IAAK,aAAa,aACpEK,IAAYF,MAAMH,GAClBM,IACJ,gBAAAlB,EAAAP,GAAA,EAAA,UAAA,CACE,gBAAAM,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAA2B,eAAY;AAAA,QACpD,UAAAiB,MAAW,aACV,gBAAAjB,EAACJ,GAAD;AAAA,UAAM,MAAMC;AAAA,UAAO,MAAK;AAAA,QAAM,CAAA,IAC5BoB,MAAW,UACb,gBAAAjB,EAACJ,GAAD;AAAA,UAAM,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","DEFAULT_LABELS","Steps","steps","current","orientation","onStepSelect","size","labels","className","style","howTo","text","at","s","step","i","status","isCurrent","content"],"sources":["../../../src/components/Steps/Steps.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { alert } from \"../../icons/alert.js\";\nimport { check } from \"../../icons/check.js\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface StepsTokens {\n /** Diameter of the numbered marker. */\n markerSize: string;\n /** Thickness of the line between steps. */\n lineWidth: string;\n /** Space between steps. */\n gap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n steps: StepsTokens;\n }\n}\n\nexport type StepStatus = \"complete\" | \"current\" | \"upcoming\" | \"error\";\n\nexport interface StepItem {\n id: string;\n label: ReactNode;\n /** A second line under the label. */\n description?: ReactNode;\n /** Overrides the status worked out from `current`: mark a step `error`, or `complete` out of order. */\n status?: \"complete\" | \"error\" | undefined;\n /** With `onStepSelect`: this step cannot be chosen. */\n disabled?: boolean;\n}\n\nexport interface StepsLabels {\n /** Accessible name of the list. Default: \"Progress\", or \"Steps\" for a how-to (no `current`). */\n list: string;\n /** Read after each step's label. Defaults: \"completed\", \"current step\", \"not started\", \"has a problem\". */\n complete: string;\n current: string;\n upcoming: string;\n error: string;\n}\n\nexport interface StepsProps {\n /** The steps, in order. */\n steps: StepItem[];\n /**\n * `id` of the step the person is on. Steps before it are complete, steps after it upcoming. Leave it out for a\n * numbered how-to (steps to follow, not progress): every step is numbered alike and no status is read.\n */\n current?: string | undefined;\n /** Lays the steps out in a row or in a column. Default \"horizontal\". */\n orientation?: \"horizontal\" | \"vertical\";\n /** Makes steps buttons that go to that step. Leave it out for a read-only progress display. */\n onStepSelect?: (id: string) => void;\n /** Text size of labels and markers. */\n size?: Size;\n /** Replace the built-in English text: the list's name and the status read after each step. */\n labels?: Partial<StepsLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-steps-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: StepsLabels = {\n list: \"Progress\",\n complete: \"completed\",\n current: \"current step\",\n upcoming: \"not started\",\n error: \"has a problem\",\n};\n\n/**\n * Progress through an ordered flow (a setup wizard, a checkout): numbered steps with the current one marked. Without\n * `current`, a numbered how-to.\n */\nexport function Steps({\n steps,\n current,\n orientation = \"horizontal\",\n onStepSelect,\n size = \"md\",\n labels,\n className,\n style,\n}: StepsProps) {\n const howTo = current === undefined;\n const text = { ...DEFAULT_LABELS, ...(howTo ? { list: \"Steps\" } : {}), ...labels };\n const at = howTo ? -1 : steps.findIndex((s) => s.id === current);\n return (\n <ol\n className={className ? `cy-steps ${className}` : \"cy-steps\"}\n aria-label={text.list}\n data-orientation={orientation}\n data-size={size}\n style={style}\n >\n {steps.map((step, i) => {\n // A how-to has no progress: steps are plain unless one is marked (`status`), and nothing is read for them.\n const status: StepStatus | undefined =\n step.status ??\n (howTo ? undefined : i === at ? \"current\" : at >= 0 && i < at ? \"complete\" : \"upcoming\");\n const isCurrent = i === at;\n const content = (\n <>\n <span className=\"cy-steps-marker cy-reset\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <Icon icon={check} size=\"sm\" />\n ) : status === \"error\" ? (\n <Icon icon={alert} size=\"sm\" />\n ) : (\n i + 1\n )}\n </span>\n <span className=\"cy-steps-text cy-reset\">\n <span className=\"cy-steps-label cy-reset\">{step.label}</span>\n {step.description != null && (\n <span className=\"cy-steps-description cy-reset\">{step.description}</span>\n )}\n {status && <span className=\"cy-visually-hidden\">{`, ${text[status]}`}</span>}\n </span>\n </>\n );\n return (\n <li key={step.id} className=\"cy-steps-item cy-reset\" data-status={status ?? \"step\"}>\n {onStepSelect ? (\n <ButtonBase\n className=\"cy-steps-step cy-reset\"\n aria-current={isCurrent ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n onClick={() => {\n if (!step.disabled && !isCurrent) onStepSelect(step.id);\n }}\n >\n {content}\n </ButtonBase>\n ) : (\n <span className=\"cy-steps-step cy-reset\" aria-current={isCurrent ? \"step\" : undefined}>\n {content}\n </span>\n )}\n {i < steps.length - 1 && <span className=\"cy-steps-line cy-reset\" aria-hidden=\"true\" />}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"mappings":";;;;;;AAmEA,IAAMQ,IAA8B;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAO;AACT;AAMA,SAAgBC,EAAM,EACpB,OAAAC,GACA,SAAAC,GACA,aAAAC,IAAc,cACd,cAAAC,GACA,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACa;AACb,QAAMC,IAAQP,MAAY,QACpBQ,IAAO;AAAA,IAAE,GAAGX;AAAA,IAAgB,GAAIU,IAAQ,EAAE,MAAM,QAAQ,IAAI,CAAC;AAAA,IAAI,GAAGH;AAAA,EAAO,GAC3EK,IAAKF,IAAQ,KAAKR,EAAM,UAAA,CAAWW,MAAMA,EAAE,OAAOV,CAAO;AAC/D,SACE,gBAAAL,EAAC,MAAD;AAAA,IACE,WAAWU,IAAY,YAAYA,CAAA,KAAc;AAAA,IACjD,cAAYG,EAAK;AAAA,IACjB,oBAAkBP;AAAA,IAClB,aAAWE;AAAA,IACJ,OAAAG;AAAA,IAEN,UAAAP,EAAM,IAAA,CAAKY,GAAMC,MAAM;AAEtB,YAAMC,IACJF,EAAK,WACJJ,IAAQ,SAAYK,MAAMH,IAAK,YAAYA,KAAM,KAAKG,IAAIH,IAAK,aAAa,aACzEK,IAAYF,MAAMH,GAClBM,IACJ,gBAAAnB,EAAAP,GAAA,EAAA,UAAA,CACE,gBAAAM,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAA2B,eAAY;AAAA,QACpD,UAAAkB,MAAW,aACV,gBAAAlB,EAACJ,GAAD;AAAA,UAAM,MA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AkBV;AAAA,IAER,CAAC;AAAA,EACC,CAAA;AAER"}
@@ -1,4 +1,4 @@
1
- import { type ChoiceRowProps } from "../Checkbox/ChoiceRow.js";
1
+ import { type ChoiceControlProps } from "../Choice/Choice.js";
2
2
  export interface SwitchTokens {
3
3
  width: string;
4
4
  height: string;
@@ -10,6 +10,6 @@ declare module "../../tokens/schema.js" {
10
10
  switch: SwitchTokens;
11
11
  }
12
12
  }
13
- export type SwitchProps = ChoiceRowProps;
14
- /** On/off switch (`role="switch"`) on a native checkbox. */
15
- export declare function Switch(props: SwitchProps): import("react").JSX.Element;
13
+ export type SwitchProps = ChoiceControlProps;
14
+ /** On/off switch (`role="switch"`) on a native checkbox, in a Choice row. */
15
+ export declare function Switch({ size, tone, ...props }: SwitchProps): import("react").JSX.Element;
@@ -1,14 +1,25 @@
1
1
  "use client";
2
- import { ChoiceRow as o } from "../Checkbox/ChoiceRow.js";
3
- import { jsx as t } from "react/jsx-runtime";
4
- function e(i) {
5
- return /* @__PURE__ */ t(o, {
6
- kind: "switch",
7
- ...i
2
+ import { ChoiceBase as r } from "../../foundations/ChoiceBase/ChoiceBase.js";
3
+ import { Choice as a } from "../Choice/Choice.js";
4
+ import { jsx as c, jsxs as i } from "react/jsx-runtime";
5
+ function p({ size: t = "md", tone: e = "accent", ...o }) {
6
+ return /* @__PURE__ */ c(a, {
7
+ ...o,
8
+ size: t,
9
+ control: (s) => /* @__PURE__ */ i("span", {
10
+ className: "cy-switch",
11
+ "data-size": t,
12
+ "data-tone": e,
13
+ children: [/* @__PURE__ */ c(r, {
14
+ ...s,
15
+ type: "checkbox",
16
+ role: "switch"
17
+ }), /* @__PURE__ */ c("span", { className: "cy-reset cy-switch-thumb" })]
18
+ })
8
19
  });
9
20
  }
10
21
  export {
11
- e as Switch
22
+ p as Switch
12
23
  };
13
24
 
14
25
  //# sourceMappingURL=Switch.js.map