@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 +1 @@
1
- {"version":3,"file":"SideNav.js","names":["_Fragment","ButtonBase","Icon","chevronDown","LinkBase","Tooltip","useEffect","useId","useState","Fragment$1","jsx","jsxs","isSection","entry","ancestors","items","id","trail","item","found","defaultLink","props","SideNav","label","current","onNavigate","renderLink","collapsed","onCollapsedChange","defaultExpanded","layout","size","className","style","bar","all","expanded","setExpanded","path","open","g","toggle","group","next","content","control","isCurrent","o","onClick","event","list","entries","depth","listId","hidden","labelledBy","blocks","last","block","i"],"sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useState,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Tooltip } from \"../Tooltip/Tooltip.js\";\n\nexport interface SideNavTokens {\n /** Width of the expanded navigation. */\n width: string;\n /** Width of the collapsed, icon-only rail. */\n railWidth: string;\n /** Corner radius of item highlights. */\n radius: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n sideNav: SideNavTokens;\n }\n}\n\nexport interface NavItem {\n id: string;\n label: string;\n /** A link. Without it the item is a button that calls `onNavigate` (or, with `items`, a group). */\n href?: string;\n icon?: IconData;\n /** A count or status after the label, e.g. a Badge. Read as part of the item's name. */\n badge?: ReactNode;\n /** Child items: the item becomes a group that expands and collapses. */\n items?: NavItem[];\n disabled?: boolean;\n}\n\nexport interface NavSection {\n /** Heading shown above the section's items. */\n label: string;\n items: NavItem[];\n}\n\nexport type NavEntry = NavItem | NavSection;\n\n/** What `renderLink` receives: spread it onto your router's link component. */\nexport interface NavLinkProps {\n href: string;\n className: string;\n \"aria-current\"?: \"page\";\n onClick: (event: MouseEvent<HTMLElement>) => void;\n children: ReactNode;\n}\n\nexport interface SideNavProps {\n /** Accessible name of the navigation landmark, e.g. \"Main\". */\n label: string;\n items: NavEntry[];\n /** `id` of the page being shown: marked `aria-current=\"page\"`; groups holding it start expanded. */\n current?: string | undefined;\n /** Called when an item is chosen (links too: call `event.preventDefault()` to route on the client). */\n onNavigate?: ((id: string, event: MouseEvent<HTMLElement>) => void) | undefined;\n /** Render links with your router: `(props) => <RouterLink to={props.href} {...props} />`. Default: a plain link. */\n renderLink?: (props: NavLinkProps) => ReactElement;\n /**\n * Icon-only rail; labels show in tooltips and stay the accessible names. Give top-level items icons. Groups do not\n * open inside the rail: choosing one calls `onCollapsedChange(false)` so you can widen the navigation.\n */\n collapsed?: boolean;\n onCollapsedChange?: (collapsed: boolean) => void;\n /** Group ids expanded at first (groups holding `current` always are). */\n defaultExpanded?: string[];\n /**\n * `column` (default): the vertical navigation. `bar`: one row of top-level items, icon over label, for a phone's\n * bottom tab bar (AppShell's `tabs`). Section headings are left out, and a group is one item that calls `onNavigate`\n * with its id (a bar has no room to open it). Give a bar three to five items, each with an icon.\n */\n layout?: \"column\" | \"bar\";\n size?: Size;\n className?: string;\n /** Layout only. Restyle through --cy-side-nav-* tokens. */\n style?: CSSProperties;\n}\n\nconst isSection = (entry: NavEntry): entry is NavSection => !(\"id\" in entry);\n\n/** Ids of the groups that lead to `id`. */\nfunction ancestors(items: NavItem[], id: string | undefined, trail: string[] = []): string[] | null {\n if (!id) return null;\n for (const item of items) {\n if (item.id === id) return trail;\n const found = item.items && ancestors(item.items, id, [...trail, item.id]);\n if (found) return found;\n }\n return null;\n}\n\nconst defaultLink = (props: NavLinkProps) => <LinkBase {...props} />;\n\n/** Vertical site or app navigation: links in sections, expandable groups, the current page marked, an icon rail. */\nexport function SideNav({\n label,\n items,\n current,\n onNavigate,\n renderLink = defaultLink,\n collapsed = false,\n onCollapsedChange,\n defaultExpanded = [],\n layout = \"column\",\n size = \"md\",\n className,\n style,\n}: SideNavProps) {\n const id = useId();\n const bar = layout === \"bar\";\n const all = items.flatMap((entry) => (isSection(entry) ? entry.items : [entry]));\n const [expanded, setExpanded] = useState(\n () => new Set([...defaultExpanded, ...(ancestors(all, current) ?? [])]),\n );\n const path = ancestors(all, current)?.join(\" \");\n // Navigating somewhere else opens the groups on the way to it (never closes any).\n useEffect(() => {\n if (!path) return;\n setExpanded((open) =>\n path.split(\" \").every((g) => open.has(g)) ? open : new Set([...open, ...path.split(\" \")]),\n );\n }, [path]);\n\n const toggle = (group: string) =>\n setExpanded((open) => {\n const next = new Set(open);\n if (!next.delete(group)) next.add(group);\n return next;\n });\n\n const content = (item: NavItem, group?: boolean) => (\n <>\n {item.icon && <Icon icon={item.icon} className=\"cy-side-nav-icon\" />}\n <span className=\"cy-side-nav-label cy-reset\">{item.label}</span>\n {item.badge != null && <span className=\"cy-side-nav-badge cy-reset\">{item.badge}</span>}\n {group && !bar && <Icon icon={chevronDown} className=\"cy-side-nav-chevron\" />}\n </>\n );\n\n const control = (item: NavItem): ReactElement<Record<string, unknown>> => {\n const isCurrent = item.id === current;\n if (item.items && !bar) {\n const open = expanded.has(item.id);\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-expanded={collapsed ? undefined : open}\n aria-controls={collapsed ? undefined : `${id}-${item.id}`}\n aria-disabled={item.disabled || undefined}\n onClick={() => {\n if (item.disabled) return;\n if (collapsed) {\n // The rail has no room for children: ask for the full navigation with this group open.\n setExpanded((o) => new Set([...o, item.id]));\n onCollapsedChange?.(false);\n } else toggle(item.id);\n }}\n >\n {content(item, true)}\n </ButtonBase>\n );\n }\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n onNavigate?.(item.id, event);\n };\n if (item.href && !item.disabled)\n return renderLink({\n href: item.href,\n className: \"cy-side-nav-link cy-reset\",\n ...(isCurrent ? { \"aria-current\": \"page\" as const } : {}),\n onClick,\n children: content(item),\n }) as ReactElement<Record<string, unknown>>;\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-current={isCurrent ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n onClick={onClick}\n >\n {content(item)}\n </ButtonBase>\n );\n };\n\n const list = (\n entries: NavItem[],\n depth: number,\n listId?: string,\n hidden?: boolean,\n labelledBy?: string,\n ) => (\n <ul\n className=\"cy-side-nav-list cy-reset\"\n id={listId}\n hidden={hidden}\n aria-labelledby={labelledBy}\n data-depth={depth}\n >\n {entries.map((item) => (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\">\n {collapsed && !bar ? (\n <Tooltip content={item.label} placement=\"end\">\n {control(item)}\n </Tooltip>\n ) : (\n control(item)\n )}\n {item.items &&\n !collapsed &&\n !bar &&\n list(item.items, depth + 1, `${id}-${item.id}`, !expanded.has(item.id))}\n </li>\n ))}\n </ul>\n );\n\n // Consecutive plain items share one list; each section gets its own heading and list.\n const blocks: ({ section: NavSection } | { items: NavItem[] })[] = [];\n if (bar) blocks.push({ items: all });\n else\n for (const entry of items) {\n const last = blocks[blocks.length - 1];\n if (isSection(entry)) blocks.push({ section: entry });\n else if (last && \"items\" in last) last.items.push(entry);\n else blocks.push({ items: [entry] });\n }\n\n return (\n <nav\n className={className ? `cy-side-nav ${className}` : \"cy-side-nav\"}\n aria-label={label}\n data-size={size}\n data-collapsed={collapsed && !bar ? \"\" : undefined}\n data-layout={layout}\n style={style}\n >\n {blocks.map((block, i) =>\n \"section\" in block ? (\n <div key={`section-${block.section.label}`} className=\"cy-side-nav-section cy-reset\">\n <span className=\"cy-side-nav-heading cy-reset\" id={`${id}-s${i}`}>\n {block.section.label}\n </span>\n {list(block.section.items, 0, undefined, false, `${id}-s${i}`)}\n </div>\n ) : (\n <div key={i} className=\"cy-side-nav-section cy-reset\">\n {list(block.items, 0)}\n </div>\n ),\n )}\n </nav>\n );\n}\n"],"mappings":";;;;;;;;AA4FA,IAAMY,IAAA,CAAaC,MAAyC,EAAE,QAAQA;AAGtE,SAASC,EAAUC,GAAkBC,GAAwBC,IAAkB,CAAC,GAAoB;AAClG,MAAI,CAACD,EAAI,QAAO;AAChB,aAAWE,KAAQH,GAAO;AACxB,QAAIG,EAAK,OA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,MAEjC,YAAWtB,KAASE,GAAO;AACzB,UAAM0C,IAAOD,EAAOA,EAAO,SAAS,CAAA;AACpC,IAAI5C,EAAUC,CAAK,IAAG2C,EAAO,KAAK,EAAE,SAAS3C,EAAM,CAAC,IAC3C4C,KAAQ,WAAWA,IAAMA,EAAK,MAAM,KAAK5C,CAAK,IAClD2C,EAAO,KAAK,EAAE,OAAO,CAAC3C,CAAK,EAAE,CAAC;AAAA,EACrC;AAEF,SACE,gBAAAH,EAAC,OAAD;AAAA,IACE,WAAWsB,IAAY,eAAeA,CAAA,KAAc;AAAA,IACpD,cAAYT;AAAA,IACZ,aAAWQ;AAAA,IACX,kBAAgBJ,KAAa,CAACO,IAAM,KAAK;AAAA,IACzC,eAAaJ;AAAA,IACN,OAAAG;AAAA,IAEN,UAAAuB,EAAO,IAAA,CAAKE,GAAOC,MAClB,aAAaD,IACX,gBAAA/C,EAAC,OAAD;AAAA,MAA4C,WAAU;AAAA,MAAtD,UAAA,CACE,gBAAAD,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAA+B,IAAI,GAAGM,CAAA,KAAO2C,CAAA;AAAA,QAC1D,UAAAD,EAAM,QAAQ;AAAA,MACX,CAAA,GACLR,EAAKQ,EAAM,QAAQ,OAAO,GAAG,QAAW,IAAO,GAAG1C,CAAA,KAAO2C,CAAA,EAAG,CAC1D;AAAA,IALK,GAAA,WAAWD,EAAM,QAAQ,KAAA,EAK9B,IAEL,gBAAAhD,EAAC,OAAD;AAAA,MAAa,WAAU;AAAA,MACpB,UAAAwC,EAAKQ,EAAM,OAAO,CAAC;AAAA,IACjB,GAFKC,CAEL,CAET;AAAA,EACG,CAAA;AAET"}
1
+ {"version":3,"file":"SideNav.js","names":["_Fragment","ButtonBase","Icon","chevronDown","LinkBase","Button","Tooltip","IconButton","useEffect","useId","useState","Fragment$1","jsx","jsxs","isSection","entry","isAction","ancestors","items","id","trail","item","found","defaultLink","props","SideNav","label","current","onNavigate","renderLink","collapsed","onCollapsedChange","defaultExpanded","layout","size","className","style","bar","rail","all","places","expanded","setExpanded","path","open","g","toggle","group","next","content","action","shared","control","isCurrent","o","onClick","event","list","entries","depth","listId","hidden","labelledBy","blocks","last","block","i"],"sources":["../../../src/components/SideNav/SideNav.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n useEffect,\n useId,\n useState,\n} from \"react\";\nimport { ButtonBase } from \"../../foundations/ButtonBase/ButtonBase.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { LinkBase } from \"../../foundations/LinkBase/LinkBase.js\";\nimport { chevronDown } from \"../../icons/chevron-down.js\";\nimport type { IconData } from \"../../icons/types.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Tooltip } from \"../Tooltip/Tooltip.js\";\n\nexport interface SideNavTokens {\n /** Width of the expanded navigation. */\n width: string;\n /** Width of the collapsed, icon-only rail. */\n railWidth: string;\n /** Corner radius of item highlights. */\n radius: string;\n /** Diameter of the round action button in the bar. */\n actionSize: string;\n /** How far the action button rises above the bar's row. */\n actionLift: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n sideNav: SideNavTokens;\n }\n}\n\nexport interface NavItem {\n id: string;\n label: string;\n /** A link. Without it the item is a button that calls `onNavigate` (or, with `items`, a group). */\n href?: string;\n icon?: IconData;\n /** A count or status after the label, e.g. a Badge. Read as part of the item's name. */\n badge?: ReactNode;\n /** Child items: the item becomes a group that expands and collapses. */\n items?: NavItem[];\n disabled?: boolean;\n}\n\nexport interface NavSection {\n /** Heading shown above the section's items. */\n label: string;\n items: NavItem[];\n}\n\n/**\n * A primary action among the items, such as \"Add\": a button, not a place. It is never the current page (even when\n * its `id` equals `current`), does not call `onNavigate`, and belongs at the top level, not in a section or group.\n * In a bar it is a raised round accent button showing only the icon; in the column, a filled accent button with the\n * icon and label; in the collapsed rail, a filled icon button. Give a navigation one at most.\n */\nexport interface NavAction {\n /** Marks the entry as an action instead of a destination. */\n kind: \"action\";\n /** Unique among the entries. */\n id: string;\n /** The button's accessible name; its visible text in the column, a tooltip in the bar and the rail. */\n label: string;\n /** The Facet icon shown in the button. */\n icon: IconData;\n /** Called when the action is pressed. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The button cannot be pressed. */\n disabled?: boolean;\n}\n\nexport type NavEntry = NavItem | NavSection | NavAction;\n\n/** What `renderLink` receives: spread it onto your router's link component. */\nexport interface NavLinkProps {\n /** The item's `href`. */\n href: string;\n /** The item's styling; keep it on the link. */\n className: string;\n /** Set to \"page\" on the current item. */\n \"aria-current\"?: \"page\";\n /** Calls `onNavigate` with the item's id; keep it on the link. */\n onClick: (event: MouseEvent<HTMLElement>) => void;\n /** The item's icon, label and badge. */\n children: ReactNode;\n}\n\nexport interface SideNavProps {\n /** Accessible name of the navigation landmark, e.g. \"Main\". */\n label: string;\n /**\n * Items and sections (`{ label, items }`), in order. One entry may be a primary action\n * (`{ kind: \"action\", id, label, icon, onClick }`): a button that sits where it is placed.\n */\n items: NavEntry[];\n /** `id` of the page being shown: marked `aria-current=\"page\"`; groups holding it start expanded. */\n current?: string | undefined;\n /** Called when an item is chosen (links too: call `event.preventDefault()` to route on the client). */\n onNavigate?: ((id: string, event: MouseEvent<HTMLElement>) => void) | undefined;\n /** Render links with your router: `(props) => <RouterLink to={props.href} {...props} />`. Default: a plain link. */\n renderLink?: (props: NavLinkProps) => ReactElement;\n /**\n * Icon-only rail; labels show in tooltips and stay the accessible names. Give top-level items icons. Groups do not\n * open inside the rail: choosing one calls `onCollapsedChange(false)` so you can widen the navigation.\n */\n collapsed?: boolean;\n /** Called with `false` when a group is chosen in the collapsed rail. */\n onCollapsedChange?: (collapsed: boolean) => void;\n /** Group ids expanded at first (groups holding `current` always are). */\n defaultExpanded?: string[];\n /**\n * `column` (default): the vertical navigation. `bar`: one row of top-level items, icon over label, for a phone's\n * bottom tab bar (AppShell's `tabs`). Section headings are left out, and a group is one item that calls `onNavigate`\n * with its id (a bar has no room to open it). Give a bar three to five items, each with an icon.\n */\n layout?: \"column\" | \"bar\";\n /** Height and text size of the items. Default \"md\". */\n size?: Size;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-side-nav-* tokens. */\n style?: CSSProperties;\n}\n\nconst isSection = (entry: NavEntry): entry is NavSection => !(\"id\" in entry);\nconst isAction = (entry: NavItem | NavAction): entry is NavAction => \"kind\" in entry;\n\n/** Ids of the groups that lead to `id`. */\nfunction ancestors(items: NavItem[], id: string | undefined, trail: string[] = []): string[] | null {\n if (!id) return null;\n for (const item of items) {\n if (item.id === id) return trail;\n const found = item.items && ancestors(item.items, id, [...trail, item.id]);\n if (found) return found;\n }\n return null;\n}\n\nconst defaultLink = (props: NavLinkProps) => <LinkBase {...props} />;\n\n/** Vertical site or app navigation: links in sections, expandable groups, the current page marked, an icon rail. */\nexport function SideNav({\n label,\n items,\n current,\n onNavigate,\n renderLink = defaultLink,\n collapsed = false,\n onCollapsedChange,\n defaultExpanded = [],\n layout = \"column\",\n size = \"md\",\n className,\n style,\n}: SideNavProps) {\n const id = useId();\n const bar = layout === \"bar\";\n // The collapsed rail: icons only, the labels and headings hidden from sight (still their names).\n const rail = collapsed && !bar;\n const all = items.flatMap((entry) => (isSection(entry) ? entry.items : [entry]));\n const places = all.filter((entry) => !isAction(entry)) as NavItem[];\n const [expanded, setExpanded] = useState(\n () => new Set([...defaultExpanded, ...(ancestors(places, current) ?? [])]),\n );\n const path = ancestors(places, current)?.join(\" \");\n // Navigating somewhere else opens the groups on the way to it (never closes any).\n useEffect(() => {\n if (!path) return;\n setExpanded((open) =>\n path.split(\" \").every((g) => open.has(g)) ? open : new Set([...open, ...path.split(\" \")]),\n );\n }, [path]);\n\n const toggle = (group: string) =>\n setExpanded((open) => {\n const next = new Set(open);\n if (!next.delete(group)) next.add(group);\n return next;\n });\n\n const content = (item: NavItem, group?: boolean) => (\n <>\n {item.icon && <Icon icon={item.icon} className=\"cy-side-nav-icon\" />}\n {/* In the rail the label is hidden from sight, still the row's name. */}\n <span className={`cy-side-nav-label cy-reset${rail ? \" cy-visually-hidden\" : \"\"}`}>{item.label}</span>\n {item.badge != null && <span className=\"cy-side-nav-badge cy-reset\">{item.badge}</span>}\n {group && !bar && <Icon icon={chevronDown} className=\"cy-side-nav-chevron\" />}\n </>\n );\n\n // The primary action: Cynosure's own buttons, so it presses, focuses and names itself like any other button.\n const action = (item: NavAction) => {\n const shared = {\n className: \"cy-side-nav-action\",\n variant: \"solid\",\n tone: \"accent\",\n disabled: item.disabled,\n onClick: item.onClick,\n } as const;\n return bar || collapsed ? (\n <IconButton\n {...shared}\n icon={item.icon}\n label={item.label}\n size={bar ? \"lg\" : size}\n tooltipPlacement={bar ? \"top\" : \"end\"}\n wrapperClassName=\"cy-side-nav-tip\"\n />\n ) : (\n <Button {...shared} icon={item.icon} size={size} fullWidth>\n {item.label}\n </Button>\n );\n };\n\n const control = (item: NavItem): ReactElement<Record<string, unknown>> => {\n const isCurrent = item.id === current;\n if (item.items && !bar) {\n const open = expanded.has(item.id);\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-expanded={collapsed ? undefined : open}\n aria-controls={collapsed ? undefined : `${id}-${item.id}`}\n aria-disabled={item.disabled || undefined}\n onClick={() => {\n if (item.disabled) return;\n if (collapsed) {\n // The rail has no room for children: ask for the full navigation with this group open.\n setExpanded((o) => new Set([...o, item.id]));\n onCollapsedChange?.(false);\n } else toggle(item.id);\n }}\n >\n {content(item, true)}\n </ButtonBase>\n );\n }\n const onClick = (event: MouseEvent<HTMLElement>) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n onNavigate?.(item.id, event);\n };\n if (item.href && !item.disabled)\n return renderLink({\n href: item.href,\n className: \"cy-side-nav-link cy-reset\",\n ...(isCurrent ? { \"aria-current\": \"page\" as const } : {}),\n onClick,\n children: content(item),\n }) as ReactElement<Record<string, unknown>>;\n return (\n <ButtonBase\n className=\"cy-side-nav-link cy-reset\"\n aria-current={isCurrent ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n onClick={onClick}\n >\n {content(item)}\n </ButtonBase>\n );\n };\n\n const list = (\n entries: (NavItem | NavAction)[],\n depth: number,\n listId?: string,\n hidden?: boolean,\n labelledBy?: string,\n ) => (\n <ul\n className=\"cy-side-nav-list cy-reset\"\n id={listId}\n hidden={hidden}\n aria-labelledby={labelledBy}\n data-depth={depth}\n >\n {entries.map((item) =>\n isAction(item) ? (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\" data-action=\"\">\n {action(item)}\n </li>\n ) : (\n <li key={item.id} className=\"cy-side-nav-item cy-reset\">\n {collapsed && !bar ? (\n <Tooltip content={item.label} placement=\"end\" className=\"cy-side-nav-tip\">\n {control(item)}\n </Tooltip>\n ) : (\n control(item)\n )}\n {item.items &&\n !collapsed &&\n !bar &&\n list(item.items, depth + 1, `${id}-${item.id}`, !expanded.has(item.id))}\n </li>\n ),\n )}\n </ul>\n );\n\n // Consecutive plain items share one list; each section gets its own heading and list.\n const blocks: ({ section: NavSection } | { items: (NavItem | NavAction)[] })[] = [];\n if (bar) blocks.push({ items: all });\n else\n for (const entry of items) {\n const last = blocks[blocks.length - 1];\n if (isSection(entry)) blocks.push({ section: entry });\n else if (last && \"items\" in last) last.items.push(entry);\n else blocks.push({ items: [entry] });\n }\n\n return (\n <nav\n className={className ? `cy-side-nav ${className}` : \"cy-side-nav\"}\n aria-label={label}\n data-size={size}\n data-collapsed={rail ? \"\" : undefined}\n data-layout={layout}\n style={style}\n >\n {blocks.map((block, i) =>\n \"section\" in block ? (\n <div key={`section-${block.section.label}`} className=\"cy-side-nav-section cy-reset\">\n <span\n className={`cy-side-nav-heading cy-reset${rail ? \" cy-visually-hidden\" : \"\"}`}\n id={`${id}-s${i}`}\n >\n {block.section.label}\n </span>\n {list(block.section.items, 0, undefined, false, `${id}-s${i}`)}\n </div>\n ) : (\n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AA;AACpC,IAAIjD,EAAUC,CAAK,IAAGgD,EAAO,KAAK,EAAE,SAAShD,EAAM,CAAC,IAC3CiD,KAAQ,WAAWA,IAAMA,EAAK,MAAM,KAAKjD,CAAK,IAClDgD,EAAO,KAAK,EAAE,OAAO,CAAChD,CAAK,EAAE,CAAC;AAAA,EACrC;AAEF,SACE,gBAAAH,EAAC,OAAD;AAAA,IACE,WAAWuB,IAAY,eAAeA,CAAA,KAAc;AAAA,IACpD,cAAYT;AAAA,IACZ,aAAWQ;AAAA,IACX,kBAAgBI,IAAO,KAAK;AAAA,IAC5B,eAAaL;AAAA,IACN,OAAAG;AAAA,IAEN,UAAA2B,EAAO,IAAA,CAAKE,GAAOC,MAClB,aAAaD,IACX,gBAAApD,EAAC,OAAD;AAAA,MAA4C,WAAU;AAAA,MAAtD,UAAA,CACE,gBAAAD,EAAC,QAAD;AAAA,QACE,WAAW,+BAA+B0B,IAAO,wBAAwB,EAAA;AAAA,QACzE,IAAI,GAAGnB,CAAA,KAAO+C,CAAA;AAAA,QAEb,UAAAD,EAAM,QAAQ;AAAA,MACX,CAAA,GACLR,EAAKQ,EAAM,QAAQ,OAAO,GAAG,QAAW,IAAO,GAAG9C,CAAA,KAAO+C,CAAA,EAAG,CAC1D;AAAA,IARK,GAAA,WAAWD,EAAM,QAAQ,KAAA,EAQ9B,IAEL,gBAAArD,EAAC,OAAD;AAAA,MAAa,WAAU;AAAA,MACpB,UAAA6C,EAAKQ,EAAM,OAAO,CAAC;AAAA,IACjB,GAFKC,CAEL,CAET;AAAA,EACG,CAAA;AAET"}
@@ -1 +1 @@
1
- export { type NavEntry, type NavItem, type NavLinkProps, type NavSection, SideNav, type SideNavProps, type SideNavTokens, } from "./SideNav.js";
1
+ export { type NavAction, type NavEntry, type NavItem, type NavLinkProps, type NavSection, SideNav, type SideNavProps, type SideNavTokens, } from "./SideNav.js";
@@ -36,10 +36,13 @@ export interface SignaturePadProps {
36
36
  } | undefined;
37
37
  /** Fixed size in CSS pixels. Default: the full width, and the height token. */
38
38
  width?: number | undefined;
39
+ /** Fixed height in CSS pixels. Default: the height token. */
39
40
  height?: number | undefined;
41
+ /** Stops drawing; the strokes so far stay shown. */
40
42
  disabled?: boolean;
41
43
  /** Ids of text that explains the pad (e.g. "Or type your name instead"). */
42
44
  "aria-describedby"?: string | undefined;
45
+ /** Added to the root element, for layout. */
43
46
  className?: string;
44
47
  /** Layout only. Restyle through --cy-signature-pad-* tokens. */
45
48
  style?: CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"SignaturePad.js","names":["inkPath","inkPoint","useCallback","useEffect","useRef","useState","jsx","MIN_STEP","PALM_MS","SignaturePad","label","value","onChange","ink","weight","space","width","height","disabled","describedBy","className","style","canvas","liveRef","pointer","penSeen","live","setLive","committed","size","setSize","el","measure","s","observer","paint","dpr","ctx","stroke","sample","event","rect","scale","native","samples","out","e","prev","p","ours","notePen","finish"],"sources":["../../../src/components/SignaturePad/SignaturePad.tsx"],"sourcesContent":["import { type CSSProperties, type PointerEvent, useCallback, useEffect, useRef, useState } from \"react\";\nimport { type InkPoint, type InkStroke, type InkWeight, inkPath, inkPoint } from \"./ink.js\";\n\nexport interface SignaturePadTokens {\n /** Ink colour when no `ink` is given (follows light and dark modes). */\n ink: string;\n /** Background of the pad. */\n background: string;\n /** Height when no `height` is given. */\n height: string;\n /** Colour of the guide line people sign on. */\n guide: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n signaturePad: SignaturePadTokens;\n }\n}\n\nexport interface SignaturePadProps {\n /** Accessible name, e.g. \"Draw your signature\". */\n label: string;\n /** The strokes so far, in the pad's coordinate space. */\n value: InkStroke[];\n /** Called once per finished stroke with the new list. Undo and clear are yours (slice or empty the list). */\n onChange: (strokes: InkStroke[]) => void;\n /** Ink colour (any CSS colour). Default: the ink token, so it follows dark mode on screen. */\n ink?: string | undefined;\n /** Nib size. Default `medium`. */\n weight?: InkWeight;\n /**\n * The coordinate space strokes are recorded in. Without it strokes are in shown CSS pixels; with it a signature keeps\n * its shape and weight however big the pad is shown (phone width, text size, a resize while drawing).\n */\n space?: { width: number; height: number } | undefined;\n /** Fixed size in CSS pixels. Default: the full width, and the height token. */\n width?: number | undefined;\n height?: number | undefined;\n disabled?: boolean;\n /** Ids of text that explains the pad (e.g. \"Or type your name instead\"). */\n \"aria-describedby\"?: string | undefined;\n className?: string;\n /** Layout only. Restyle through --cy-signature-pad-* tokens. */\n style?: CSSProperties;\n}\n\n/** Samples closer than this (pad units) to the last one add nothing. */\nconst MIN_STEP = 0.75;\n/** Touches are ignored for this long after a pen was last seen: a resting palm. */\nconst PALM_MS = 3000;\n\n/**\n * A pad to draw a signature with a mouse, finger or pen. A pen's pressure and tilt shape the line; mouse and touch draw\n * a steady line. One pointer draws at a time, and a palm resting while a pen is in use is ignored. It draws, nothing\n * more: offer typing or uploading a signature beside it for people who cannot draw.\n */\nexport function SignaturePad({\n label,\n value,\n onChange,\n ink,\n weight = \"medium\",\n space,\n width,\n height,\n disabled = false,\n \"aria-describedby\": describedBy,\n className,\n style,\n}: SignaturePadProps) {\n const canvas = useRef<HTMLCanvasElement>(null);\n // Several pointer events can arrive between renders: the stroke in progress lives in a ref; state mirrors it.\n const liveRef = useRef<InkStroke | null>(null);\n const pointer = useRef<number | null>(null);\n const penSeen = useRef(Number.NEGATIVE_INFINITY);\n const [live, setLive] = useState<InkStroke | null>(null);\n // The latest list, updated the moment a stroke ends: a second stroke can finish before React re-renders.\n const committed = useRef(value);\n committed.current = value;\n const [size, setSize] = useState({ width: 0, height: 0 });\n\n useEffect(() => {\n const el = canvas.current as HTMLCanvasElement;\n const measure = () =>\n setSize((s) =>\n s.width === el.clientWidth && s.height === el.clientHeight\n ? s\n : { width: el.clientWidth, height: el.clientHeight },\n );\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n const paint = useCallback(() => {\n const el = canvas.current as HTMLCanvasElement;\n const dpr = window.devicePixelRatio;\n el.width = Math.round(size.width * dpr);\n el.height = Math.round(size.height * dpr);\n const ctx = el.getContext(\"2d\") as CanvasRenderingContext2D;\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n if (space && size.width > 0) ctx.scale(size.width / space.width, size.height / space.height);\n ctx.fillStyle = ink ?? getComputedStyle(el).color;\n for (const stroke of live ? [...value, live] : value) {\n // Every stroke has at least its first sample, so it always has an outline.\n ctx.fill(new Path2D(inkPath(stroke, weight)));\n }\n }, [value, live, ink, weight, space, size]);\n useEffect(paint, [paint]);\n\n const sample = (event: PointerEvent<HTMLCanvasElement>, stroke: InkStroke): InkStroke => {\n const rect = event.currentTarget.getBoundingClientRect();\n const scale = space ? { x: space.width / rect.width, y: space.height / rect.height } : undefined;\n const native = event.nativeEvent;\n // Coalesced events keep a fast stroke smooth: the browser batches several samples into one event.\n const samples = native.getCoalescedEvents?.() ?? [];\n let out = stroke;\n for (const e of samples.length ? samples : [native]) {\n const prev: InkPoint | null = out[out.length - 1] ?? null;\n const p = inkPoint(e, rect, prev, scale);\n if (prev && Math.hypot(p.x - prev.x, p.y - prev.y) < MIN_STEP) continue;\n out = [...out, p];\n }\n return out;\n };\n\n const ours = (event: PointerEvent) => liveRef.current !== null && event.pointerId === pointer.current;\n const notePen = (event: PointerEvent) => {\n if (event.pointerType === \"pen\") penSeen.current = event.timeStamp;\n };\n const finish = (event: PointerEvent<HTMLCanvasElement>) => {\n notePen(event);\n if (!ours(event)) return;\n const stroke = liveRef.current as InkStroke;\n liveRef.current = null;\n pointer.current = null;\n setLive(null);\n committed.current = [...committed.current, stroke];\n onChange(committed.current);\n };\n\n return (\n <div\n className={className ? `cy-signature-pad ${className}` : \"cy-signature-pad\"}\n data-disabled={disabled ? \"\" : undefined}\n style={{ ...(width ? { inlineSize: width } : {}), ...(height ? { blockSize: height } : {}), ...style }}\n >\n <canvas\n ref={canvas}\n role=\"img\"\n aria-label={label}\n aria-describedby={describedBy}\n aria-disabled={disabled || undefined}\n className=\"cy-signature-pad-canvas cy-reset\"\n onPointerDown={(event) => {\n notePen(event);\n // One stroke at a time: a second finger or a resting palm does not take over.\n if (disabled || liveRef.current) return;\n // Only the tip (or the main mouse button) draws, not a pen's barrel button or eraser.\n if (event.pointerType !== \"touch\" && event.button !== 0) return;\n if (event.pointerType === \"touch\" && event.timeStamp - penSeen.current < PALM_MS) return;\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n // Synthetic events have no active pointer to capture.\n }\n pointer.current = event.pointerId;\n liveRef.current = sample(event, []);\n setLive(liveRef.current);\n }}\n onPointerMove={(event) => {\n notePen(event);\n if (!ours(event)) return;\n liveRef.current = sample(event, liveRef.current as InkStroke);\n setLive(liveRef.current);\n }}\n onPointerUp={finish}\n onPointerCancel={finish}\n // A long press opens the context menu on Windows and Android, which would cancel the stroke.\n onContextMenu={(event) => event.preventDefault()}\n />\n </div>\n );\n}\n"],"mappings":";;;;AAgDA,IAAMO,IAAW,MAEXC,IAAU;AAOhB,SAAgBC,EAAa,EAC3B,OAAAC,GACA,OAAAC,GACA,UAAAC,GACA,KAAAC,GACA,QAAAC,IAAS,UACT,OAAAC,GACA,OAAAC,GACA,QAAAC,GACA,UAAAC,IAAW,IACX,oBAAoBC,GACpB,WAAAC,GACA,OAAAC,EAAA,GACoB;AACpB,QAAMC,IAASlB,EAA0B,IAAI,GAEvCmB,IAAUnB,EAAyB,IAAI,GACvCoB,IAAUpB,EAAsB,IAAI,GACpCqB,IAAUrB,EAAO,OAAO,iBAAiB,GACzC,CAACsB,GAAMC,CAAA,IAAWtB,EAA2B,IAAI,GAEjDuB,IAAYxB,EAAOO,CAAK;AAC9B,EAAAiB,EAAU,UAAUjB;AACpB,QAAM,CAACkB,GAAMC,CAAA,IAAWzB,EAAS;AAAA,IAAE,OAAO;AAAA,IAAG,QAAQ;AAAA,EAAE,CAAC;AAExD,EAAAF,EAAA,MAAgB;AACd,UAAM4B,IAAKT,EAAO,SACZU,IAAA,MACJF,EAAA,CAASG,MACPA,EAAE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AAA,MAClB,iBAAeD,KAAY;AAAA,MAC3B,WAAU;AAAA,MACV,eAAA,CAAgBsB,MAAU;AAGxB,YAFAU,EAAQV,CAAK,GAET,EAAAtB,KAAYK,EAAQ,YAEpB,EAAAiB,EAAM,gBAAgB,WAAWA,EAAM,WAAW,MAClD,EAAAA,EAAM,gBAAgB,WAAWA,EAAM,YAAYf,EAAQ,UAAUjB,IACzE;AAAA,cAAI;AACF,YAAAgC,EAAM,cAAc,kBAAkBA,EAAM,SAAS;AAAA,UACvD,QAAQ;AAAA,UAER;AACA,UAAAhB,EAAQ,UAAUgB,EAAM,WACxBjB,EAAQ,UAAUgB,EAAOC,GAAO,CAAC,CAAC,GAClCb,EAAQJ,EAAQ,OAAO;AAAA;AAAA,MACzB;AAAA,MACA,eAAA,CAAgBiB,MAAU;AAExB,QADAU,EAAQV,CAAK,GACRS,EAAKT,CAAK,MACfjB,EAAQ,UAAUgB,EAAOC,GAAOjB,EAAQ,OAAoB,GAC5DI,EAAQJ,EAAQ,OAAO;AAAA,MACzB;AAAA,MACA,aAAa4B;AAAA,MACb,iBAAiBA;AAAA,MAEjB,eAAA,CAAgBX,MAAUA,EAAM,eAAe;AAAA,IAChD,CAAA;AAAA,EACE,CAAA;AAET"}
1
+ {"version":3,"file":"SignaturePad.js","names":["inkPath","inkPoint","useCallback","useEffect","useRef","useState","jsx","MIN_STEP","PALM_MS","SignaturePad","label","value","onChange","ink","weight","space","width","height","disabled","describedBy","className","style","canvas","liveRef","pointer","penSeen","live","setLive","committed","size","setSize","el","measure","s","observer","paint","dpr","ctx","stroke","sample","event","rect","scale","native","samples","out","e","prev","p","ours","notePen","finish"],"sources":["../../../src/components/SignaturePad/SignaturePad.tsx"],"sourcesContent":["import { type CSSProperties, type PointerEvent, useCallback, useEffect, useRef, useState } from \"react\";\nimport { type InkPoint, type InkStroke, type InkWeight, inkPath, inkPoint } from \"./ink.js\";\n\nexport interface SignaturePadTokens {\n /** Ink colour when no `ink` is given (follows light and dark modes). */\n ink: string;\n /** Background of the pad. */\n background: string;\n /** Height when no `height` is given. */\n height: string;\n /** Colour of the guide line people sign on. */\n guide: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n signaturePad: SignaturePadTokens;\n }\n}\n\nexport interface SignaturePadProps {\n /** Accessible name, e.g. \"Draw your signature\". */\n label: string;\n /** The strokes so far, in the pad's coordinate space. */\n value: InkStroke[];\n /** Called once per finished stroke with the new list. Undo and clear are yours (slice or empty the list). */\n onChange: (strokes: InkStroke[]) => void;\n /** Ink colour (any CSS colour). Default: the ink token, so it follows dark mode on screen. */\n ink?: string | undefined;\n /** Nib size. Default `medium`. */\n weight?: InkWeight;\n /**\n * The coordinate space strokes are recorded in. Without it strokes are in shown CSS pixels; with it a signature keeps\n * its shape and weight however big the pad is shown (phone width, text size, a resize while drawing).\n */\n space?: { width: number; height: number } | undefined;\n /** Fixed size in CSS pixels. Default: the full width, and the height token. */\n width?: number | undefined;\n /** Fixed height in CSS pixels. Default: the height token. */\n height?: number | undefined;\n /** Stops drawing; the strokes so far stay shown. */\n disabled?: boolean;\n /** Ids of text that explains the pad (e.g. \"Or type your name instead\"). */\n \"aria-describedby\"?: string | undefined;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-signature-pad-* tokens. */\n style?: CSSProperties;\n}\n\n/** Samples closer than this (pad units) to the last one add nothing. */\nconst MIN_STEP = 0.75;\n/** Touches are ignored for this long after a pen was last seen: a resting palm. */\nconst PALM_MS = 3000;\n\n/**\n * A pad to draw a signature with a mouse, finger or pen. A pen's pressure and tilt shape the line; mouse and touch draw\n * a steady line. One pointer draws at a time, and a palm resting while a pen is in use is ignored. It draws, nothing\n * more: offer typing or uploading a signature beside it for people who cannot draw.\n */\nexport function SignaturePad({\n label,\n value,\n onChange,\n ink,\n weight = \"medium\",\n space,\n width,\n height,\n disabled = false,\n \"aria-describedby\": describedBy,\n className,\n style,\n}: SignaturePadProps) {\n const canvas = useRef<HTMLCanvasElement>(null);\n // Several pointer events can arrive between renders: the stroke in progress lives in a ref; state mirrors it.\n const liveRef = useRef<InkStroke | null>(null);\n const pointer = useRef<number | null>(null);\n const penSeen = useRef(Number.NEGATIVE_INFINITY);\n const [live, setLive] = useState<InkStroke | null>(null);\n // The latest list, updated the moment a stroke ends: a second stroke can finish before React re-renders.\n const committed = useRef(value);\n committed.current = value;\n const [size, setSize] = useState({ width: 0, height: 0 });\n\n useEffect(() => {\n const el = canvas.current as HTMLCanvasElement;\n const measure = () =>\n setSize((s) =>\n s.width === el.clientWidth && s.height === el.clientHeight\n ? s\n : { width: el.clientWidth, height: el.clientHeight },\n );\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n\n const paint = useCallback(() => {\n const el = canvas.current as HTMLCanvasElement;\n const dpr = window.devicePixelRatio;\n el.width = Math.round(size.width * dpr);\n el.height = Math.round(size.height * dpr);\n const ctx = el.getContext(\"2d\") as CanvasRenderingContext2D;\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n if (space && size.width > 0) ctx.scale(size.width / space.width, size.height / space.height);\n ctx.fillStyle = ink ?? getComputedStyle(el).color;\n for (const stroke of live ? [...value, live] : value) {\n // Every stroke has at least its first sample, so it always has an outline.\n ctx.fill(new Path2D(inkPath(stroke, weight)));\n }\n }, [value, live, ink, weight, space, size]);\n useEffect(paint, [paint]);\n\n const sample = (event: PointerEvent<HTMLCanvasElement>, stroke: InkStroke): InkStroke => {\n const rect = event.currentTarget.getBoundingClientRect();\n const scale = space ? { x: space.width / rect.width, y: space.height / rect.height } : undefined;\n const native = event.nativeEvent;\n // Coalesced events keep a fast stroke smooth: the browser batches several samples into one event.\n const samples = native.getCoalescedEvents?.() ?? [];\n let out = stroke;\n for (const e of samples.length ? samples : [native]) {\n const prev: InkPoint | null = out[out.length - 1] ?? null;\n const p = inkPoint(e, rect, prev, scale);\n if (prev && Math.hypot(p.x - prev.x, p.y - prev.y) < MIN_STEP) continue;\n out = [...out, p];\n }\n return out;\n };\n\n const ours = (event: PointerEvent) => liveRef.current !== null && event.pointerId === pointer.current;\n const notePen = (event: PointerEvent) => {\n if (event.pointerType === \"pen\") penSeen.current = event.timeStamp;\n };\n const finish = (event: PointerEvent<HTMLCanvasElement>) => {\n notePen(event);\n if (!ours(event)) return;\n const stroke = liveRef.current as InkStroke;\n liveRef.current = null;\n pointer.current = null;\n setLive(null);\n committed.current = [...committed.current, stroke];\n onChange(committed.current);\n };\n\n return (\n <div\n className={className ? `cy-signature-pad ${className}` : \"cy-signature-pad\"}\n data-disabled={disabled ? \"\" : undefined}\n style={{ ...(width ? { inlineSize: width } : {}), ...(height ? { blockSize: height } : {}), ...style }}\n >\n <canvas\n ref={canvas}\n role=\"img\"\n aria-label={label}\n aria-describedby={describedBy}\n aria-disabled={disabled || undefined}\n className=\"cy-signature-pad-canvas cy-reset\"\n onPointerDown={(event) => {\n notePen(event);\n // One stroke at a time: a second finger or a resting palm does not take over.\n if (disabled || liveRef.current) return;\n // Only the tip (or the main mouse button) draws, not a pen's barrel button or eraser.\n if (event.pointerType !== \"touch\" && event.button !== 0) return;\n if (event.pointerType === \"touch\" && event.timeStamp - penSeen.current < PALM_MS) return;\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n // Synthetic events have no active pointer to capture.\n }\n pointer.current = event.pointerId;\n liveRef.current = sample(event, []);\n setLive(liveRef.current);\n }}\n onPointerMove={(event) => {\n notePen(event);\n if (!ours(event)) return;\n liveRef.current = sample(event, liveRef.current as InkStroke);\n setLive(liveRef.current);\n }}\n onPointerUp={finish}\n onPointerCancel={finish}\n // A long press opens the context menu on Windows and Android, which would cancel the stroke.\n onContextMenu={(event) => event.preventDefault()}\n />\n </div>\n );\n}\n"],"mappings":";;;;AAmDA,IAAMO,IAAW,MAEXC,IAAU;AAOhB,SAAgBC,EAAa,EAC3B,OAAAC,GACA,OAAAC,GACA,UAAAC,GACA,KAAAC,GACA,QAAAC,IAAS,UACT,OAAA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AAA,CAAgBX,MAAUA,EAAM,eAAe;AAAA,IAChD,CAAA;AAAA,EACE,CAAA;AAET"}
@@ -0,0 +1,66 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import { type ContainerProps } from "../Container/Container.js";
3
+ export interface SiteFooterTokens {
4
+ /** Background of the footer. */
5
+ background: string;
6
+ /** Colour of the hairline above the footer and above its bottom row. */
7
+ border: string;
8
+ /** Space above and below the footer's content, and between its rows. */
9
+ paddingBlock: string;
10
+ /** Least width of a link column before the columns wrap onto another row. */
11
+ columnMinWidth: string;
12
+ }
13
+ declare module "../../tokens/schema.js" {
14
+ interface ComponentTokens {
15
+ siteFooter: SiteFooterTokens;
16
+ }
17
+ }
18
+ /** A column of footer links under a heading. */
19
+ export interface SiteFooterColumn {
20
+ /** The column's heading, e.g. "Product". */
21
+ title: string;
22
+ /** The column's links, in order. */
23
+ links: {
24
+ /** The link text. */
25
+ label: string;
26
+ /** Where it goes. */
27
+ href: string;
28
+ /** Opens in a new tab, with an icon and announced text. */
29
+ external?: boolean;
30
+ }[];
31
+ }
32
+ export interface SiteFooterLabels {
33
+ /** Name of the navigation landmark that holds the link columns. Default: "Footer". */
34
+ nav: string;
35
+ }
36
+ export interface SiteFooterProps {
37
+ /** The logo or the site's name, at the top of the inline start. */
38
+ brand?: ReactNode;
39
+ /** A sentence under the brand about the site or the company. */
40
+ tagline?: ReactNode;
41
+ /** Link columns, as data: a heading and its links. They sit side by side and wrap onto more rows when narrow. */
42
+ columns?: SiteFooterColumn[];
43
+ /** Heading level of the column titles, to fit the page outline. Default 2. */
44
+ headingLevel?: 2 | 3 | 4;
45
+ /** The bottom row's start: copyright and legal links. */
46
+ legal?: ReactNode;
47
+ /** The bottom row's end: links to the site's social accounts, usually IconButtons with `href`. */
48
+ social?: ReactNode;
49
+ /** Widest the content gets: the `size` of its Container, to line up with the page. Default "lg". */
50
+ size?: ContainerProps["size"];
51
+ /** Replace the built-in English text: `nav`, the name of the links' navigation landmark. */
52
+ labels?: Partial<SiteFooterLabels>;
53
+ /** Set on the `footer` element. */
54
+ id?: string | undefined;
55
+ /** Names the footer, when a page has more than one. */
56
+ "aria-label"?: string | undefined;
57
+ /** Added to the `footer` element, for layout. */
58
+ className?: string | undefined;
59
+ /** Layout only. Restyle through --cy-site-footer-* tokens. */
60
+ style?: CSSProperties;
61
+ }
62
+ /**
63
+ * The bottom of a website: the brand and a tagline, columns of links, and a bottom row for the copyright, legal links
64
+ * and social links. Columns and rows stack on narrow screens.
65
+ */
66
+ export declare const SiteFooter: import("react").ForwardRefExoticComponent<SiteFooterProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { Link as u } from "../Link/Link.js";
3
+ import { Container as F } from "../Container/Container.js";
4
+ import { Heading as L } from "../Heading/Heading.js";
5
+ import { Text as b } from "../Text/Text.js";
6
+ import { forwardRef as S, useId as g } from "react";
7
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
8
+ var j = { nav: "Footer" }, C = S(function({ brand: r, tagline: s, columns: i = [], headingLevel: y = 2, legal: c, social: a, size: h = "lg", labels: v, className: d, style: N, ...p }, x) {
9
+ const $ = {
10
+ ...j,
11
+ ...v
12
+ }, n = g(), f = r || s || i.length > 0;
13
+ return /* @__PURE__ */ e("footer", {
14
+ ref: x,
15
+ ...p,
16
+ className: `cy-site-footer${d ? ` ${d}` : ""}`,
17
+ style: N,
18
+ children: /* @__PURE__ */ t(F, {
19
+ size: h,
20
+ className: "cy-site-footer-inner",
21
+ children: [f && /* @__PURE__ */ t("div", {
22
+ className: "cy-site-footer-top cy-reset",
23
+ children: [(r || s) && /* @__PURE__ */ t("div", {
24
+ className: "cy-site-footer-brand cy-reset",
25
+ children: [r && /* @__PURE__ */ e("div", {
26
+ className: "cy-site-footer-logo",
27
+ children: r
28
+ }), s && /* @__PURE__ */ e(b, {
29
+ as: "p",
30
+ tone: "muted",
31
+ className: "cy-site-footer-tagline",
32
+ children: s
33
+ })]
34
+ }), i.length > 0 && /* @__PURE__ */ e("nav", {
35
+ "aria-label": $.nav,
36
+ className: "cy-site-footer-nav cy-reset",
37
+ children: i.map((l, m) => /* @__PURE__ */ t("div", {
38
+ className: "cy-site-footer-column cy-reset",
39
+ children: [/* @__PURE__ */ e(L, {
40
+ level: y,
41
+ size: "xs",
42
+ id: `${n}-${m}`,
43
+ className: "cy-site-footer-title",
44
+ children: l.title
45
+ }), /* @__PURE__ */ e("ul", {
46
+ "aria-labelledby": `${n}-${m}`,
47
+ className: "cy-site-footer-links cy-reset",
48
+ children: l.links.map((o) => /* @__PURE__ */ e("li", {
49
+ className: "cy-site-footer-item cy-reset",
50
+ children: /* @__PURE__ */ e(u, {
51
+ href: o.href,
52
+ tone: "neutral",
53
+ size: "md",
54
+ external: o.external ?? !1,
55
+ className: "cy-site-footer-link",
56
+ children: o.label
57
+ })
58
+ }, o.href))
59
+ })]
60
+ }, l.title))
61
+ })]
62
+ }), (c || a) && /* @__PURE__ */ t("div", {
63
+ className: "cy-site-footer-bottom cy-reset",
64
+ "data-divided": f ? "" : void 0,
65
+ children: [c && /* @__PURE__ */ e("div", {
66
+ className: "cy-site-footer-legal",
67
+ children: c
68
+ }), a && /* @__PURE__ */ e("div", {
69
+ className: "cy-site-footer-social cy-reset",
70
+ children: a
71
+ })]
72
+ })]
73
+ })
74
+ });
75
+ });
76
+ export {
77
+ C as SiteFooter
78
+ };
79
+
80
+ //# sourceMappingURL=SiteFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SiteFooter.js","names":["Link","Container","Heading","Text","forwardRef","useId","jsx","jsxs","DEFAULT_LABELS","SiteFooter","brand","tagline","columns","headingLevel","legal","social","size","labels","className","style","rest","ref","text","id","top","column","i","link"],"sources":["../../../src/components/SiteFooter/SiteFooter.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode, useId } from \"react\";\nimport { Container, type ContainerProps } from \"../Container/Container.js\";\nimport { Heading } from \"../Heading/Heading.js\";\nimport { Link } from \"../Link/Link.js\";\nimport { Text } from \"../Text/Text.js\";\n\nexport interface SiteFooterTokens {\n /** Background of the footer. */\n background: string;\n /** Colour of the hairline above the footer and above its bottom row. */\n border: string;\n /** Space above and below the footer's content, and between its rows. */\n paddingBlock: string;\n /** Least width of a link column before the columns wrap onto another row. */\n columnMinWidth: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n siteFooter: SiteFooterTokens;\n }\n}\n\n/** A column of footer links under a heading. */\nexport interface SiteFooterColumn {\n /** The column's heading, e.g. \"Product\". */\n title: string;\n /** The column's links, in order. */\n links: {\n /** The link text. */\n label: string;\n /** Where it goes. */\n href: string;\n /** Opens in a new tab, with an icon and announced text. */\n external?: boolean;\n }[];\n}\n\nexport interface SiteFooterLabels {\n /** Name of the navigation landmark that holds the link columns. Default: \"Footer\". */\n nav: string;\n}\n\nexport interface SiteFooterProps {\n /** The logo or the site's name, at the top of the inline start. */\n brand?: ReactNode;\n /** A sentence under the brand about the site or the company. */\n tagline?: ReactNode;\n /** Link columns, as data: a heading and its links. They sit side by side and wrap onto more rows when narrow. */\n columns?: SiteFooterColumn[];\n /** Heading level of the column titles, to fit the page outline. Default 2. */\n headingLevel?: 2 | 3 | 4;\n /** The bottom row's start: copyright and legal links. */\n legal?: ReactNode;\n /** The bottom row's end: links to the site's social accounts, usually IconButtons with `href`. */\n social?: ReactNode;\n /** Widest the content gets: the `size` of its Container, to line up with the page. Default \"lg\". */\n size?: ContainerProps[\"size\"];\n /** Replace the built-in English text: `nav`, the name of the links' navigation landmark. */\n labels?: Partial<SiteFooterLabels>;\n /** Set on the `footer` element. */\n id?: string | undefined;\n /** Names the footer, when a page has more than one. */\n \"aria-label\"?: string | undefined;\n /** Added to the `footer` element, for layout. */\n className?: string | undefined;\n /** Layout only. Restyle through --cy-site-footer-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: SiteFooterLabels = { nav: \"Footer\" };\n\n/**\n * The bottom of a website: the brand and a tagline, columns of links, and a bottom row for the copyright, legal links\n * and social links. Columns and rows stack on narrow screens.\n */\nexport const SiteFooter = forwardRef<HTMLElement, SiteFooterProps>(function SiteFooter(\n {\n brand,\n tagline,\n columns = [],\n headingLevel = 2,\n legal,\n social,\n size = \"lg\",\n labels,\n className,\n style,\n ...rest\n },\n ref,\n) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const top = brand || tagline || columns.length > 0;\n return (\n <footer ref={ref} {...rest} className={`cy-site-footer${className ? ` ${className}` : \"\"}`} style={style}>\n <Container size={size} className=\"cy-site-footer-inner\">\n {top && (\n <div className=\"cy-site-footer-top cy-reset\">\n {(brand || tagline) && (\n <div className=\"cy-site-footer-brand cy-reset\">\n {brand && <div className=\"cy-site-footer-logo\">{brand}</div>}\n {tagline && (\n <Text as=\"p\" tone=\"muted\" className=\"cy-site-footer-tagline\">\n {tagline}\n </Text>\n )}\n </div>\n )}\n {columns.length > 0 && (\n <nav aria-label={text.nav} className=\"cy-site-footer-nav cy-reset\">\n {columns.map((column, i) => (\n <div key={column.title} className=\"cy-site-footer-column cy-reset\">\n <Heading\n level={headingLevel}\n size=\"xs\"\n id={`${id}-${i}`}\n className=\"cy-site-footer-title\"\n >\n {column.title}\n </Heading>\n <ul aria-labelledby={`${id}-${i}`} className=\"cy-site-footer-links cy-reset\">\n {column.links.map((link) => (\n <li key={link.href} className=\"cy-site-footer-item cy-reset\">\n <Link\n href={link.href}\n tone=\"neutral\"\n size=\"md\"\n external={link.external ?? false}\n className=\"cy-site-footer-link\"\n >\n {link.label}\n </Link>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </nav>\n )}\n </div>\n )}\n {(legal || social) && (\n <div className=\"cy-site-footer-bottom cy-reset\" data-divided={top ? \"\" : undefined}>\n {legal && <div className=\"cy-site-footer-legal\">{legal}</div>}\n {social && <div className=\"cy-site-footer-social cy-reset\">{social}</div>}\n </div>\n )}\n </Container>\n </footer>\n );\n});\n"],"mappings":";;;;;;;AAsEA,IAAM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E,OAAOW;AAAA,cACP,MAAK;AAAA,cACL,IAAI,GAAGU,CAAA,IAAMG,CAAA;AAAA,cACb,WAAU;AAAA,cAET,UAAAD,EAAO;AAAA,YACD,CAAA,GACT,gBAAAnB,EAAC,MAAD;AAAA,cAAI,mBAAiB,GAAGiB,CAAA,IAAMG,CAAA;AAAA,cAAK,WAAU;AAAA,cAC1C,UAAAD,EAAO,MAAM,IAAA,CAAKE,MACjB,gBAAArB,EAAC,MAAD;AAAA,gBAAoB,WAAU;AAAA,gBAC5B,UAAA,gBAAAA,EAACN,GAAD;AAAA,kBACE,MAAM2B,EAAK;AAAA,kBACX,MAAK;AAAA,kBACL,MAAK;AAAA,kBACL,UAAUA,EAAK,YAAY;AAAA,kBAC3B,WAAU;AAAA,kBAET,UAAAA,EAAK;AAAA,gBACF,CAAA;AAAA,cACJ,GAVKA,EAAK,IAUV,CACL;AAAA,YACC,CAAA,CACD;AAAA,UAxBK,GAAAF,EAAO,KAwBZ,CACN;AAAA,QACE,CAAA,CAEJ;AAAA,MAEL,CAAA,IAAAX,KAASC,MACT,gBAAAR,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAAiC,gBAAciB,IAAM,KAAK;AAAA,QAAzE,UAAA,CACGV,KAAS,gBAAAR,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAwB,UAAAQ;AAAA,QAAW,CAAA,GAC3DC,KAAU,gBAAAT,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAkC,UAAAS;AAAA,QAAY,CAAA,CACrE;AAAA,MAEE,CAAA,CAAA;AAAA,I;A,EACL,CAAA;AAEZ,CAAC"}
@@ -0,0 +1 @@
1
+ export { SiteFooter, type SiteFooterColumn, type SiteFooterLabels, type SiteFooterProps, type SiteFooterTokens, } from "./SiteFooter.js";
@@ -0,0 +1,78 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import { type ContainerProps } from "../Container/Container.js";
3
+ export interface SiteHeaderTokens {
4
+ /** Least height of the bar. */
5
+ height: string;
6
+ /** Background of the bar. A sticky bar mixes it with some transparency and blurs the page behind. */
7
+ background: string;
8
+ /** Colour of the hairline under the bar. */
9
+ border: string;
10
+ /** Blur of the page seen through a sticky bar. */
11
+ blur: string;
12
+ /** Text colour of the navigation links. */
13
+ linkColor: string;
14
+ /** Text colour of the link to the current page. */
15
+ linkCurrentColor: string;
16
+ /** Background of a hovered link and of the link to the current page. */
17
+ linkHighlight: string;
18
+ }
19
+ declare module "../../tokens/schema.js" {
20
+ interface ComponentTokens {
21
+ siteHeader: SiteHeaderTokens;
22
+ }
23
+ }
24
+ /** One link of the site navigation. */
25
+ export interface SiteHeaderLink {
26
+ /** The link text. */
27
+ label: string;
28
+ /** Where it goes. */
29
+ href: string;
30
+ /** This link is the page being shown: it is marked `aria-current="page"`. */
31
+ current?: boolean;
32
+ }
33
+ export interface SiteHeaderLabels {
34
+ /** Name of the navigation landmark, in the bar and in the menu. Default: "Main". */
35
+ nav: string;
36
+ /** The menu button shown on narrow screens. Default: "Open menu". */
37
+ openMenu: string;
38
+ /** Title of the menu sheet. Default: "Menu". */
39
+ menu: string;
40
+ /** The skip link. Default: "Skip to content". */
41
+ skip: string;
42
+ }
43
+ export interface SiteHeaderProps {
44
+ /** The logo or the site's name, at the inline start. Give a logo image its text alternative. */
45
+ brand?: ReactNode;
46
+ /** Where the brand links to. `false` shows the brand without a link. Default "/". */
47
+ brandHref?: string | false;
48
+ /** The site navigation, as data. Each link is a real link; the `current` one is marked for assistive technology. */
49
+ nav?: SiteHeaderLink[];
50
+ /** Controls at the inline end, such as a ThemeToggle, a search button or a sign-in Button. They stay in the bar. */
51
+ actions?: ReactNode;
52
+ /** Keep the bar at the top of the window while the page scrolls, over a blurred view of the page. Default true. */
53
+ sticky?: boolean;
54
+ /** Render a SkipLink before the bar, the first stop of the Tab order. Default true. */
55
+ skipLink?: boolean;
56
+ /** Where the skip link goes: `#` and the id of the page's main content. Default "#main". */
57
+ skipTo?: string;
58
+ /**
59
+ * Width of the header below which the navigation moves into a menu opened from a button: `sm` 40rem, `md` 48rem,
60
+ * `lg` 64rem. CSS only, so the right layout shows before any script runs. Default "md".
61
+ */
62
+ collapseBelow?: "sm" | "md" | "lg";
63
+ /** Widest the bar's content gets: the `size` of its Container, to line up with the page. Default "lg". */
64
+ size?: ContainerProps["size"];
65
+ /** Replace the built-in English text: the landmark name, the menu button, the menu title and the skip link. */
66
+ labels?: Partial<SiteHeaderLabels>;
67
+ /** Set on the `header` element. */
68
+ id?: string | undefined;
69
+ /** Added to the `header` element, for layout. */
70
+ className?: string | undefined;
71
+ /** Layout only. Restyle through --cy-site-header-* tokens. */
72
+ style?: CSSProperties;
73
+ }
74
+ /**
75
+ * The top bar of a website that scrolls as a document: a skip link, the brand, the site navigation and actions. On
76
+ * narrow screens the navigation moves into a menu sheet. For an app frame with a side navigation, use AppShell.
77
+ */
78
+ export declare const SiteHeader: import("react").ForwardRefExoticComponent<SiteHeaderProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,114 @@
1
+ "use client";
2
+ import { menu as x } from "../../icons/menu.js";
3
+ import { IconButton as L } from "../IconButton/IconButton.js";
4
+ import { Sheet as M } from "../Sheet/Sheet.js";
5
+ import { SkipLink as C } from "../SkipLink/SkipLink.js";
6
+ import { Link as h } from "../Link/Link.js";
7
+ import { Container as F } from "../Container/Container.js";
8
+ import { SideNav as O } from "../SideNav/SideNav.js";
9
+ import { forwardRef as $, useState as j } from "react";
10
+ import { Fragment as A, jsx as e, jsxs as m } from "react/jsx-runtime";
11
+ var B = {
12
+ nav: "Main",
13
+ openMenu: "Open menu",
14
+ menu: "Menu",
15
+ skip: "Skip to content"
16
+ }, _ = $(function({ brand: t, brandHref: s = "/", nav: a = [], actions: l, sticky: p = !0, skipLink: u = !0, skipTo: f = "#main", collapseBelow: y = "md", size: N = "lg", labels: g, id: k, className: c, style: v }, S) {
17
+ const n = {
18
+ ...B,
19
+ ...g
20
+ }, [o, i] = j(!1), d = a.findIndex((r) => r.current);
21
+ return /* @__PURE__ */ m(A, { children: [
22
+ u && /* @__PURE__ */ e(C, {
23
+ href: f,
24
+ labels: { skip: n.skip }
25
+ }),
26
+ /* @__PURE__ */ e("header", {
27
+ ref: S,
28
+ id: k,
29
+ className: `cy-site-header${c ? ` ${c}` : ""}`,
30
+ "data-sticky": p ? "" : void 0,
31
+ "data-collapse": y,
32
+ style: v,
33
+ children: /* @__PURE__ */ m(F, {
34
+ size: N,
35
+ className: "cy-site-header-bar",
36
+ children: [
37
+ t && (s === !1 ? /* @__PURE__ */ e("div", {
38
+ className: "cy-site-header-brand",
39
+ children: t
40
+ }) : /* @__PURE__ */ e(h, {
41
+ href: s,
42
+ tone: "neutral",
43
+ underline: "none",
44
+ className: "cy-site-header-brand-link",
45
+ children: /* @__PURE__ */ e("span", {
46
+ className: "cy-site-header-brand",
47
+ children: t
48
+ })
49
+ })),
50
+ a.length > 0 && /* @__PURE__ */ e("nav", {
51
+ "aria-label": n.nav,
52
+ className: "cy-site-header-nav cy-reset",
53
+ children: /* @__PURE__ */ e("ul", {
54
+ className: "cy-site-header-list cy-reset",
55
+ children: a.map((r) => /* @__PURE__ */ e("li", {
56
+ className: "cy-site-header-item cy-reset",
57
+ children: /* @__PURE__ */ e(h, {
58
+ href: r.href,
59
+ tone: "neutral",
60
+ underline: "none",
61
+ "aria-current": r.current ? "page" : void 0,
62
+ className: "cy-site-header-link-anchor",
63
+ children: /* @__PURE__ */ e("span", {
64
+ className: "cy-site-header-link",
65
+ children: r.label
66
+ })
67
+ })
68
+ }, r.href))
69
+ })
70
+ }),
71
+ l && /* @__PURE__ */ e("div", {
72
+ className: "cy-site-header-actions cy-reset",
73
+ children: l
74
+ }),
75
+ a.length > 0 && /* @__PURE__ */ e("div", {
76
+ className: "cy-site-header-menu cy-reset",
77
+ children: /* @__PURE__ */ e(L, {
78
+ icon: x,
79
+ label: n.openMenu,
80
+ variant: "ghost",
81
+ tone: "neutral",
82
+ tooltipPlacement: "bottom",
83
+ "aria-expanded": o,
84
+ onClick: () => i(!0)
85
+ })
86
+ })
87
+ ]
88
+ })
89
+ }),
90
+ a.length > 0 && /* @__PURE__ */ e(M, {
91
+ open: o,
92
+ onOpenChange: i,
93
+ side: "end",
94
+ size: "sm",
95
+ title: n.menu,
96
+ children: /* @__PURE__ */ e(O, {
97
+ label: n.nav,
98
+ items: a.map((r, b) => ({
99
+ id: String(b),
100
+ label: r.label,
101
+ href: r.href
102
+ })),
103
+ current: d < 0 ? void 0 : String(d),
104
+ onNavigate: () => i(!1),
105
+ className: "cy-site-header-sheet-nav"
106
+ })
107
+ })
108
+ ] });
109
+ });
110
+ export {
111
+ _ as SiteHeader
112
+ };
113
+
114
+ //# sourceMappingURL=SiteHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SiteHeader.js","names":["_Fragment","menu","IconButton","Sheet","SkipLink","Link","Container","SideNav","forwardRef","useState","Fragment$1","jsx","jsxs","DEFAULT_LABELS","SiteHeader","brand","brandHref","nav","actions","sticky","skipLink","skipTo","collapseBelow","size","labels","id","className","style","ref","text","open","setOpen","current","item","i"],"sources":["../../../src/components/SiteHeader/SiteHeader.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode, useState } from \"react\";\nimport { menu } from \"../../icons/menu.js\";\nimport { Container, type ContainerProps } from \"../Container/Container.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Link } from \"../Link/Link.js\";\nimport { Sheet } from \"../Sheet/Sheet.js\";\nimport { SideNav } from \"../SideNav/SideNav.js\";\nimport { SkipLink } from \"../SkipLink/SkipLink.js\";\n\nexport interface SiteHeaderTokens {\n /** Least height of the bar. */\n height: string;\n /** Background of the bar. A sticky bar mixes it with some transparency and blurs the page behind. */\n background: string;\n /** Colour of the hairline under the bar. */\n border: string;\n /** Blur of the page seen through a sticky bar. */\n blur: string;\n /** Text colour of the navigation links. */\n linkColor: string;\n /** Text colour of the link to the current page. */\n linkCurrentColor: string;\n /** Background of a hovered link and of the link to the current page. */\n linkHighlight: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n siteHeader: SiteHeaderTokens;\n }\n}\n\n/** One link of the site navigation. */\nexport interface SiteHeaderLink {\n /** The link text. */\n label: string;\n /** Where it goes. */\n href: string;\n /** This link is the page being shown: it is marked `aria-current=\"page\"`. */\n current?: boolean;\n}\n\nexport interface SiteHeaderLabels {\n /** Name of the navigation landmark, in the bar and in the menu. Default: \"Main\". */\n nav: string;\n /** The menu button shown on narrow screens. Default: \"Open menu\". */\n openMenu: string;\n /** Title of the menu sheet. Default: \"Menu\". */\n menu: string;\n /** The skip link. Default: \"Skip to content\". */\n skip: string;\n}\n\nexport interface SiteHeaderProps {\n /** The logo or the site's name, at the inline start. Give a logo image its text alternative. */\n brand?: ReactNode;\n /** Where the brand links to. `false` shows the brand without a link. Default \"/\". */\n brandHref?: string | false;\n /** The site navigation, as data. Each link is a real link; the `current` one is marked for assistive technology. */\n nav?: SiteHeaderLink[];\n /** Controls at the inline end, such as a ThemeToggle, a search button or a sign-in Button. They stay in the bar. */\n actions?: ReactNode;\n /** Keep the bar at the top of the window while the page scrolls, over a blurred view of the page. Default true. */\n sticky?: boolean;\n /** Render a SkipLink before the bar, the first stop of the Tab order. Default true. */\n skipLink?: boolean;\n /** Where the skip link goes: `#` and the id of the page's main content. Default \"#main\". */\n skipTo?: string;\n /**\n * Width of the header below which the navigation moves into a menu opened from a button: `sm` 40rem, `md` 48rem,\n * `lg` 64rem. CSS only, so the right layout shows before any script runs. Default \"md\".\n */\n collapseBelow?: \"sm\" | \"md\" | \"lg\";\n /** Widest the bar's content gets: the `size` of its Container, to line up with the page. Default \"lg\". */\n size?: ContainerProps[\"size\"];\n /** Replace the built-in English text: the landmark name, the menu button, the menu title and the skip link. */\n labels?: Partial<SiteHeaderLabels>;\n /** Set on the `header` element. */\n id?: string | undefined;\n /** Added to the `header` element, for layout. */\n className?: string | undefined;\n /** Layout only. Restyle through --cy-site-header-* tokens. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: SiteHeaderLabels = {\n nav: \"Main\",\n openMenu: \"Open menu\",\n menu: \"Menu\",\n skip: \"Skip to content\",\n};\n\n/**\n * The top bar of a website that scrolls as a document: a skip link, the brand, the site navigation and actions. On\n * narrow screens the navigation moves into a menu sheet. For an app frame with a side navigation, use AppShell.\n */\nexport const SiteHeader = forwardRef<HTMLElement, SiteHeaderProps>(function SiteHeader(\n {\n brand,\n brandHref = \"/\",\n nav = [],\n actions,\n sticky = true,\n skipLink = true,\n skipTo = \"#main\",\n collapseBelow = \"md\",\n size = \"lg\",\n labels,\n id,\n className,\n style,\n },\n ref,\n) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [open, setOpen] = useState(false);\n const current = nav.findIndex((item) => item.current);\n\n return (\n <>\n {/* Before the header, not in it: a sticky header's blur would make the link's fixed position relative to it. */}\n {skipLink && <SkipLink href={skipTo} labels={{ skip: text.skip }} />}\n <header\n ref={ref}\n id={id}\n className={`cy-site-header${className ? ` ${className}` : \"\"}`}\n data-sticky={sticky ? \"\" : undefined}\n data-collapse={collapseBelow}\n style={style}\n >\n <Container size={size} className=\"cy-site-header-bar\">\n {brand &&\n (brandHref === false ? (\n <div className=\"cy-site-header-brand\">{brand}</div>\n ) : (\n // A Link (its focus ring and colour), drawn as the brand by the span inside it.\n <Link href={brandHref} tone=\"neutral\" underline=\"none\" className=\"cy-site-header-brand-link\">\n <span className=\"cy-site-header-brand\">{brand}</span>\n </Link>\n ))}\n {nav.length > 0 && (\n <nav aria-label={text.nav} className=\"cy-site-header-nav cy-reset\">\n <ul className=\"cy-site-header-list cy-reset\">\n {nav.map((item) => (\n <li key={item.href} className=\"cy-site-header-item cy-reset\">\n {/* A Link, drawn as a pill by the span inside it. */}\n <Link\n href={item.href}\n tone=\"neutral\"\n underline=\"none\"\n aria-current={item.current ? \"page\" : undefined}\n className=\"cy-site-header-link-anchor\"\n >\n <span className=\"cy-site-header-link\">{item.label}</span>\n </Link>\n </li>\n ))}\n </ul>\n </nav>\n )}\n {actions && <div className=\"cy-site-header-actions cy-reset\">{actions}</div>}\n {nav.length > 0 && (\n <div className=\"cy-site-header-menu cy-reset\">\n <IconButton\n icon={menu}\n label={text.openMenu}\n variant=\"ghost\"\n tone=\"neutral\"\n tooltipPlacement=\"bottom\"\n aria-expanded={open}\n onClick={() => setOpen(true)}\n />\n </div>\n )}\n </Container>\n </header>\n {nav.length > 0 && (\n <Sheet open={open} onOpenChange={setOpen} side=\"end\" size=\"sm\" title={text.menu}>\n <SideNav\n label={text.nav}\n items={nav.map((item, i) => ({ id: String(i), label: item.label, href: item.href }))}\n current={current < 0 ? undefined : String(current)}\n // Choosing a link closes the menu; the browser then follows it.\n onNavigate={() => setOpen(false)}\n className=\"cy-site-header-sheet-nav\"\n />\n </Sheet>\n )}\n </>\n );\n});\n"],"mappings":";;;;;;;;;;AAqFA,IAAMa,IAAmC;AAAA,EACvC,KAAK;AAAA,EACL,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AACR,GAMaC,IAAaN,EAAyC,SACjE,EACE,OAAAO,GACA,WAAAC,IAAY,KACZ,KAAAC,IAAM,CAAC,GACP,SAAAC,GACA,QAAAC,IAAS,IACT,UAAAC,IAAW,IACX,QAAAC,IAAS,SACT,eAAAC,IAAgB,MAChB,MAAAC,IAAO,MACP,QAAAC,GACA,IAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GAEFC,GACA;AACA,QAAMC,IAAO;AAAA,IAAE,GAAGhB;AAAA,IAAgB,GAAGW;AAAA,EAAO,GACtC,CAACM,GAAMC,CAAA,IAAWtB,EAAS,EAAK,GAChCuB,IAAUf,EAAI,UAAA,CAAWgB,MAASA,EAAK,OAAO;AAEpD,SACE,gBAAArB,EAAAZ,GAAA,EAAA,UAAA;AAAA,IAEGoB,KAAY,gBAAAT,EAACP,GAAD;AAAA,MAAU,MAAMiB;AAAA,MAAQ,QAAQ,EAAE,MAAMQ,EAAK,KAAK;AAAA,IAAI,CAAA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KAAW,gBAAAP,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YAAmC,UAAAO;AAAA,UAAa,CAAA;AAAA,UAC1ED,EAAI,SAAS,KACZ,gBAAAN,EAAC,OAAD;AAAA,YAAK,WAAU;AAAA,YACb,UAAA,gBAAAA,EAACT,GAAD;AAAA,cACE,MAAMD;AAAA,cACN,OAAO4B,EAAK;AAAA,cACZ,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,kBAAiB;AAAA,cACjB,iBAAeC;AAAA,cACf,SAAA,MAAeC,EAAQ,EAAI;AAAA,YAC5B,CAAA;AAAA,UACE,CAAA;AAAA,QAEE;AAAA,M;A,IACL,CAAA;AAAA,IACPd,EAAI,SAAS,KACZ,gBAAAN,EAACR,GAAD;AAAA,MAAa,MAAA2B;AAAA,MAAM,cAAcC;AAAA,MAAS,MAAK;AAAA,MAAM,MAAK;AAAA,MAAK,OAAOF,EAAK;AAAA,MACzE,UAAA,gBAAAlB,EAACJ,GAAD;AAAA,QACE,OAAOsB,EAAK;AAAA,QACZ,OAAOZ,EAAI,IAAA,CAAKgB,GAAMC,OAAO;AAAA,UAAE,IAAI,OAAOA,CAAC;AAAA,UAAG,OAAOD,EAAK;AAAA,UAAO,MAAMA,EAAK;AAAA,QAAK,EAAE;AAAA,QACnF,SAASD,IAAU,IAAI,SAAY,OAAOA,CAAO;AAAA,QAEjD,YAAA,MAAkBD,EAAQ,EAAK;AAAA,QAC/B,WAAU;AAAA,MACX,CAAA;AAAA,IACI,CAAA;AAAA,EAET,EAAA,CAAA;AAEN,CAAC"}
@@ -0,0 +1 @@
1
+ export { SiteHeader, type SiteHeaderLabels, type SiteHeaderLink, type SiteHeaderProps, type SiteHeaderTokens, } from "./SiteHeader.js";
@@ -24,6 +24,7 @@ export interface SkeletonProps {
24
24
  width?: string | undefined;
25
25
  /** Any CSS length. Default: one line of text (block) or the circle's diameter (circle). */
26
26
  height?: string | undefined;
27
+ /** Added to the root element, for layout. */
27
28
  className?: string;
28
29
  /** Layout only. Restyle through --cy-skeleton-* tokens. */
29
30
  style?: CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.js","names":["jsx","Skeleton","shape","lines","size","width","height","className","style","count","_"],"sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface SkeletonTokens {\n /** Placeholder fill. */\n color: string;\n /** The band that sweeps across while loading. */\n highlight: string;\n /** Corner radius of text and block shapes. */\n radius: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n skeleton: SkeletonTokens;\n }\n}\n\nexport interface SkeletonProps {\n /** `text`: lines the height of text at `size`. `block`: a box. `circle`: an avatar or icon. */\n shape?: \"text\" | \"block\" | \"circle\";\n /** Text shape only: how many lines. The last of several is shorter, like a paragraph. */\n lines?: number;\n /** Text size the lines stand in for (shared vocabulary: docs/conventions.md). */\n size?: Size;\n /** Any CSS length. Default: the full width (text, block) or the height (circle). */\n width?: string | undefined;\n /** Any CSS length. Default: one line of text (block) or the circle's diameter (circle). */\n height?: string | undefined;\n className?: string;\n /** Layout only. Restyle through --cy-skeleton-* tokens. */\n style?: CSSProperties;\n}\n\n/**\n * A placeholder in the shape of content that is still loading. It is hidden from assistive technology: mark the region\n * that owns it `aria-busy=\"true\"` while it loads.\n */\nexport function Skeleton({\n shape = \"text\",\n lines = 1,\n size = \"md\",\n width,\n height,\n className,\n style,\n}: SkeletonProps) {\n const count = shape === \"text\" ? Math.max(1, Math.floor(lines) || 1) : 1;\n return (\n <span\n className={className ? `cy-skeleton ${className}` : \"cy-skeleton\"}\n data-shape={shape}\n data-size={size}\n aria-hidden=\"true\"\n style={{ \"--_w\": width, \"--_h\": height, ...style } as CSSProperties}\n >\n {Array.from({ length: count }, (_, i) => (\n <span key={i} className=\"cy-skeleton-bone cy-reset\" />\n ))}\n </span>\n );\n}\n"],"mappings":";;AAsCA,SAAgBC,EAAS,EACvB,OAAAC,IAAQ,QACR,OAAAC,IAAQ,GACR,MAAAC,IAAO,MACP,OAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACgB;AAChB,QAAMC,IAAQP,MAAU,SAAS,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAK,KAAK,CAAC,IAAI;AACvE,SACE,gBAAAH,EAAC,QAAD;AAAA,IACE,WAAWO,IAAY,eAAeA,CAAA,KAAc;AAAA,IACpD,cAAYL;AAAA,IACZ,aAAWE;AAAA,IACX,eAAY;AAAA,IACZ,OAAO;AAAA,MAAE,QAAQC;AAAA,MAAO,QAAQC;AAAA,MAAQ,GAAGE;AAAA,IAAM;AAAA,IAEhD,UAAA,MAAM,KAAK,EAAE,QAAQC,EAAM,GAAA,CAAIC,GAAG,MACjC,gBAAAV,EAAC,QAAD,EAAc,WAAU,4BAA6B,GAA1C,CAA0C,CACtD;AAAA,EACG,CAAA;AAEV"}
1
+ {"version":3,"file":"Skeleton.js","names":["jsx","Skeleton","shape","lines","size","width","height","className","style","count","_"],"sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface SkeletonTokens {\n /** Placeholder fill. */\n color: string;\n /** The band that sweeps across while loading. */\n highlight: string;\n /** Corner radius of text and block shapes. */\n radius: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n skeleton: SkeletonTokens;\n }\n}\n\nexport interface SkeletonProps {\n /** `text`: lines the height of text at `size`. `block`: a box. `circle`: an avatar or icon. */\n shape?: \"text\" | \"block\" | \"circle\";\n /** Text shape only: how many lines. The last of several is shorter, like a paragraph. */\n lines?: number;\n /** Text size the lines stand in for (shared vocabulary: docs/conventions.md). */\n size?: Size;\n /** Any CSS length. Default: the full width (text, block) or the height (circle). */\n width?: string | undefined;\n /** Any CSS length. Default: one line of text (block) or the circle's diameter (circle). */\n height?: string | undefined;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-skeleton-* tokens. */\n style?: CSSProperties;\n}\n\n/**\n * A placeholder in the shape of content that is still loading. It is hidden from assistive technology: mark the region\n * that owns it `aria-busy=\"true\"` while it loads.\n */\nexport function Skeleton({\n shape = \"text\",\n lines = 1,\n size = \"md\",\n width,\n height,\n className,\n style,\n}: SkeletonProps) {\n const count = shape === \"text\" ? Math.max(1, Math.floor(lines) || 1) : 1;\n return (\n <span\n className={className ? `cy-skeleton ${className}` : \"cy-skeleton\"}\n data-shape={shape}\n data-size={size}\n aria-hidden=\"true\"\n style={{ \"--_w\": width, \"--_h\": height, ...style } as CSSProperties}\n >\n {Array.from({ length: count }, (_, i) => (\n <span key={i} className=\"cy-skeleton-bone cy-reset\" />\n ))}\n </span>\n );\n}\n"],"mappings":";;AAuCA,SAAgBC,EAAS,EACvB,OAAAC,IAAQ,QACR,OAAAC,IAAQ,GACR,MAAAC,IAAO,MACP,OAAAC,GACA,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACgB;AAChB,QAAMC,IAAQP,MAAU,SAAS,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAK,KAAK,CAAC,IAAI;AACvE,SACE,gBAAAH,EAAC,QAAD;AAAA,IACE,WAAWO,IAAY,eAAeA,CAAA,KAAc;AAAA,IACpD,cAAYL;AAAA,IACZ,aAAWE;AAAA,IACX,eAAY;AAAA,IACZ,OAAO;AAAA,MAAE,QAAQC;AAAA,MAAO,QAAQC;AAAA,MAAQ,GAAGE;AAAA,IAAM;AAAA,IAEhD,UAAA,MAAM,KAAK,EAAE,QAAQC,EAAM,GAAA,CAAIC,GAAG,MACjC,gBAAAV,EAAC,QAAD,EAAc,WAAU,4BAA6B,GAA1C,CAA0C,CACtD;AAAA,EACG,CAAA;AAEV"}