@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":"DateField.js","names":["useControllableState","IconButton","addDays","addMonths","isISODate","Calendar","Popover","TextField","calendar","useEffect","useId","useRef","useState","jsx","DEFAULT_LABELS","normalise","text","m","DateField","label","labelHidden","description","error","value","defaultValue","onChange","min","max","isDateDisabled","locale","weekStartsOn","today","name","form","required","disabled","readOnly","size","labels","className","style","id","current","setCurrent","draft","setDraft","problem","setProblem","open","setOpen","input","available","date","commit","typed","choose","onKeyDown","event","from","by","next","props"],"sources":["../../../src/components/DateField/DateField.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { calendar } from \"../../icons/calendar.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Calendar } from \"../Calendar/Calendar.js\";\nimport { addDays, addMonths, isISODate } from \"../Calendar/dates.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Popover } from \"../Popover/Popover.js\";\nimport { TextField } from \"../TextField/TextField.js\";\n\nexport interface DateFieldLabels {\n /** The button that opens the calendar. Default \"Choose a date\". */\n open: string;\n /** Shown when the text is not a date. Default \"Enter a date as YYYY-MM-DD\". */\n invalid: string;\n /** Shown when the date is outside `min` and `max`, or not available. Default \"This date is not available\". */\n unavailable: string;\n /** The calendar's month buttons. */\n previous: string;\n next: string;\n}\n\nexport interface DateFieldProps {\n label: ReactNode;\n labelHidden?: boolean;\n description?: ReactNode;\n /** Your own error; it replaces the field's own messages. */\n error?: ReactNode;\n /** `YYYY-MM-DD`, or null when empty. */\n value?: string | null;\n defaultValue?: string | null;\n /** A valid, available date (or null when cleared), when typing is finished or a day is picked. */\n onChange?: (date: string | null) => void;\n min?: string | undefined;\n max?: string | undefined;\n isDateDisabled?: ((date: string) => boolean) | undefined;\n /** The calendar's locale and first day of the week. */\n locale?: string | undefined;\n weekStartsOn?: number | undefined;\n today?: string | undefined;\n name?: string | undefined;\n form?: string | undefined;\n required?: boolean | undefined;\n disabled?: boolean | undefined;\n readOnly?: boolean | undefined;\n size?: Size;\n labels?: Partial<DateFieldLabels>;\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: DateFieldLabels = {\n open: \"Choose a date\",\n invalid: \"Enter a date as YYYY-MM-DD\",\n unavailable: \"This date is not available\",\n previous: \"Previous month\",\n next: \"Next month\",\n};\n\n/** `2026-1-5`, `2026/01/05` and `2026.1.5` all read as `2026-01-05`; anything else is left as it was typed. */\nconst normalise = (text: string) => {\n const m = /^\\s*(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})\\s*$/.exec(text);\n return m\n ? `${m[1]}-${(m[2] as string).padStart(2, \"0\")}-${(m[3] as string).padStart(2, \"0\")}`\n : text.trim();\n};\n\n/**\n * A date in a form: type it as `YYYY-MM-DD`, step it with the arrows, or pick it from a Calendar in a popover. The\n * value is a plain date string (no time, no time zone) and is only reported once it is a real, available date.\n */\nexport function DateField({\n label,\n labelHidden,\n description,\n error,\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n isDateDisabled,\n locale,\n weekStartsOn,\n today,\n name,\n form,\n required,\n disabled = false,\n readOnly = false,\n size = \"md\",\n labels,\n className,\n style,\n}: DateFieldProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const [current, setCurrent] = useControllableState<string | null>(value, defaultValue, onChange);\n const [draft, setDraft] = useState<string | null>(null);\n const [problem, setProblem] = useState<string | null>(null);\n const [open, setOpen] = useState(false);\n const input = useRef<HTMLInputElement>(null);\n\n const available = (date: string) =>\n !(min !== undefined && date < min) && !(max !== undefined && date > max) && !isDateDisabled?.(date);\n /** Takes what was typed: a real, available date is kept; anything else is explained and left for correcting. */\n const commit = () => {\n if (draft === null) return;\n const typed = normalise(draft);\n if (typed === \"\") {\n setDraft(null);\n setProblem(null);\n if (current !== null) setCurrent(null);\n return;\n }\n if (!isISODate(typed)) return setProblem(text.invalid);\n if (!available(typed)) return setProblem(text.unavailable);\n setDraft(null);\n setProblem(null);\n if (typed !== current) setCurrent(typed);\n };\n const choose = (date: string) => {\n setDraft(null);\n setProblem(null);\n if (date !== current) setCurrent(date);\n };\n\n // Up and Down step the date by a day (Shift: a month), skipping nothing: limits stop it.\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\") commit();\n if ((event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") || readOnly) return;\n const from = draft === null ? current : isISODate(normalise(draft)) ? normalise(draft) : null;\n if (!from) return;\n event.preventDefault();\n const by = event.key === \"ArrowUp\" ? 1 : -1;\n const next = event.shiftKey ? addMonths(from, by) : addDays(from, by);\n if ((min !== undefined && next < min) || (max !== undefined && next > max)) return;\n choose(next);\n };\n\n // The picker opens on the chosen day (the APG date picker), not on its first button.\n useEffect(() => {\n if (!open) return;\n document\n .getElementById(`${id}-calendar`)\n ?.querySelector<HTMLElement>('[data-date][tabindex=\"0\"]')\n ?.focus();\n }, [open, id]);\n\n return (\n <TextField\n ref={input}\n label={label}\n {...(labelHidden ? { labelHidden } : {})}\n {...(description !== undefined ? { description } : {})}\n {...((error ?? problem) != null ? { error: error ?? problem } : {})}\n value={draft ?? current ?? \"\"}\n onChange={setDraft}\n onBlur={commit}\n onKeyDown={onKeyDown}\n placeholder=\"YYYY-MM-DD\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n className={className ? `cy-date-field ${className}` : \"cy-date-field\"}\n {...(style ? { style } : {})}\n addonEnd={\n !readOnly && (\n <Popover\n label={text.open}\n open={open}\n onOpenChange={setOpen}\n placement=\"bottom\"\n size=\"sm\"\n trigger={(props) => (\n <IconButton\n {...props}\n icon={calendar}\n label={text.open}\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"cy-date-field-open\"\n />\n )}\n >\n <div id={`${id}-calendar`} className=\"cy-date-field-calendar\">\n <Calendar\n value={draft !== null && isISODate(normalise(draft)) ? normalise(draft) : current}\n onChange={(date) => {\n choose(date);\n setOpen(false);\n input.current?.focus();\n }}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n locale={locale}\n weekStartsOn={weekStartsOn}\n today={today}\n size=\"sm\"\n labels={{ previous: text.previous, next: text.next }}\n />\n </div>\n </Popover>\n )\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA4DA,IAAMc,KAAkC;AAAA,EACtC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAAA,EACV,MAAM;AACR,GAGMC,IAAA,CAAaC,MAAiB;AAClC,QAAMC,IAAI,8CAA8C,KAAKD,CAAI;AACjE,SAAOC,IACH,GAAGA,EAAE,CAAA,CAAA,IAAOA,EAAE,CAAA,EAAc,SAAS,GAAG,GAAG,CAAA,IAAMA,EAAE,CAAA,EAAc,SAAS,GAAG,GAAG,CAAA,KAChFD,EAAK,KAAK;AAChB;AAMA,SAAgBE,GAAU,EACxB,OAAAC,GACA,aAAAC,GACA,aAAAC,GACA,OAAAC,GACA,OAAAC,GACA,cAAAC,IAAe,MACf,UAAAC,GACA,KAAAC,GACA,KAAAC,GACA,gBAAAC,GACA,QAAAC,GACA,cAAAC,GACA,OAAAC,GACA,MAAAC,GACA,MAAAC,GACA,UAAAC,GACA,UAAAC,IAAW,IACX,UAAAC,IAAW,IACX,MAAAC,IAAO,MACP,QAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACiB;AACjB,QAAMxB,IAAO;AAAA,IAAE,GAAGF;AAAA,IAAgB,GAAGwB;AAAA,EAAO,GACtCG,IAAK/B,GAAM,GACX,CAACgC,GAASC,CAAA,IAAc3C,EAAoCuB,GAAOC,GAAcC,CAAQ,GACzF,CAACmB,GAAOC,CAAA,IAAYjC,EAAwB,IAAI,GAChD,CAACkC,GAASC,CAAA,IAAcnC,EAAwB,IAAI,GACpD,CAACoC,GAAMC,CAAA,IAAWrC,EAAS,EAAK,GAChCsC,IAAQvC,GAAyB,IAAI,GAErCwC,IAAA,CAAaC,MACjB,EAAE1B,MAAQ,UAAa0B,IAAO1B,MAAQ,EAAEC,MAAQ,UAAayB,IAAOz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H,CAAI,GACXH,EAAQ,EAAK,GACbC,EAAM,SAAS,MAAM;AAAA,UACvB;AAAA,UACK,KAAAxB;AAAA,UACA,KAAAC;AAAA,UACW,gBAAAC;AAAA,UACR,QAAAC;AAAA,UACM,cAAAC;AAAA,UACP,OAAAC;AAAA,UACP,MAAK;AAAA,UACL,QAAQ;AAAA,YAAE,UAAUf,EAAK;AAAA,YAAU,MAAMA,EAAK;AAAA,UAAK;AAAA,QACpD,CAAA;AAAA,MACE,CAAA;AAAA,IACE,CAAA;AAAA,EAGd,CAAA;AAEL"}
1
+ {"version":3,"file":"DateField.js","names":["useControllableState","IconButton","Popover","addDays","addMonths","isISODate","Calendar","TextField","calendar","useEffect","useId","useRef","useState","jsx","DEFAULT_LABELS","normalise","text","m","DateField","label","labelHidden","description","error","value","defaultValue","onChange","min","max","isDateDisabled","locale","weekStartsOn","today","name","form","required","disabled","readOnly","size","labels","className","style","id","current","setCurrent","draft","setDraft","problem","setProblem","open","setOpen","input","available","date","commit","typed","choose","onKeyDown","event","from","by","next","props"],"sources":["../../../src/components/DateField/DateField.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { calendar } from \"../../icons/calendar.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { Calendar } from \"../Calendar/Calendar.js\";\nimport { addDays, addMonths, isISODate } from \"../Calendar/dates.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { Popover } from \"../Popover/Popover.js\";\nimport { TextField } from \"../TextField/TextField.js\";\n\nexport interface DateFieldLabels {\n /** The button that opens the calendar. Default \"Choose a date\". */\n open: string;\n /** Shown when the text is not a date. Default \"Enter a date as YYYY-MM-DD\". */\n invalid: string;\n /** Shown when the date is outside `min` and `max`, or not available. Default \"This date is not available\". */\n unavailable: string;\n /** The calendar's month buttons. */\n previous: string;\n next: string;\n}\n\nexport interface DateFieldProps {\n /** Visible label; it names the field. */\n label: ReactNode;\n /** Visually hide the label (it still names the field). Prefer visible labels. */\n labelHidden?: boolean;\n /** Help text shown below the field. */\n description?: ReactNode;\n /** Your own error; it replaces the field's own messages. */\n error?: ReactNode;\n /** `YYYY-MM-DD`, or null when empty. */\n value?: string | null;\n /** Starting date when uncontrolled, as `YYYY-MM-DD`. */\n defaultValue?: string | null;\n /** A valid, available date (or null when cleared), when typing is finished or a day is picked. */\n onChange?: (date: string | null) => void;\n /** Earliest date that can be typed or picked, as `YYYY-MM-DD`. */\n min?: string | undefined;\n /** Latest date that can be typed or picked, as `YYYY-MM-DD`. */\n max?: string | undefined;\n /** Return true for dates that cannot be chosen (fully booked, weekends). */\n isDateDisabled?: ((date: string) => boolean) | undefined;\n /** The calendar's locale and first day of the week. */\n locale?: string | undefined;\n /** 0 Sunday to 6 Saturday. Default: the locale's first day, else Monday. */\n weekStartsOn?: number | undefined;\n /** What the calendar counts as today, as `YYYY-MM-DD`. Default: the device's date. */\n today?: string | undefined;\n /** Name the field's text is submitted under in a form. */\n name?: string | undefined;\n /** Id of the form it belongs to, when it is not inside that form. */\n form?: string | undefined;\n /** Marks the field as required for form validation. */\n required?: boolean | undefined;\n /** Turns off the field and the calendar button. */\n disabled?: boolean | undefined;\n /** The date can be read but not changed; the calendar button is hidden. */\n readOnly?: boolean | undefined;\n /** Size of the field. Default \"md\". */\n size?: Size;\n /** Replace the built-in English text: the calendar button, the two error messages and the month buttons. */\n labels?: Partial<DateFieldLabels>;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\nconst DEFAULT_LABELS: DateFieldLabels = {\n open: \"Choose a date\",\n invalid: \"Enter a date as YYYY-MM-DD\",\n unavailable: \"This date is not available\",\n previous: \"Previous month\",\n next: \"Next month\",\n};\n\n/** `2026-1-5`, `2026/01/05` and `2026.1.5` all read as `2026-01-05`; anything else is left as it was typed. */\nconst normalise = (text: string) => {\n const m = /^\\s*(\\d{4})[-/.](\\d{1,2})[-/.](\\d{1,2})\\s*$/.exec(text);\n return m\n ? `${m[1]}-${(m[2] as string).padStart(2, \"0\")}-${(m[3] as string).padStart(2, \"0\")}`\n : text.trim();\n};\n\n/**\n * A date in a form: type it as `YYYY-MM-DD`, step it with the arrows, or pick it from a Calendar in a popover. The\n * value is a plain date string (no time, no time zone) and is only reported once it is a real, available date.\n */\nexport function DateField({\n label,\n labelHidden,\n description,\n error,\n value,\n defaultValue = null,\n onChange,\n min,\n max,\n isDateDisabled,\n locale,\n weekStartsOn,\n today,\n name,\n form,\n required,\n disabled = false,\n readOnly = false,\n size = \"md\",\n labels,\n className,\n style,\n}: DateFieldProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const [current, setCurrent] = useControllableState<string | null>(value, defaultValue, onChange);\n const [draft, setDraft] = useState<string | null>(null);\n const [problem, setProblem] = useState<string | null>(null);\n const [open, setOpen] = useState(false);\n const input = useRef<HTMLInputElement>(null);\n\n const available = (date: string) =>\n !(min !== undefined && date < min) && !(max !== undefined && date > max) && !isDateDisabled?.(date);\n /** Takes what was typed: a real, available date is kept; anything else is explained and left for correcting. */\n const commit = () => {\n if (draft === null) return;\n const typed = normalise(draft);\n if (typed === \"\") {\n setDraft(null);\n setProblem(null);\n if (current !== null) setCurrent(null);\n return;\n }\n if (!isISODate(typed)) return setProblem(text.invalid);\n if (!available(typed)) return setProblem(text.unavailable);\n setDraft(null);\n setProblem(null);\n if (typed !== current) setCurrent(typed);\n };\n const choose = (date: string) => {\n setDraft(null);\n setProblem(null);\n if (date !== current) setCurrent(date);\n };\n\n // Up and Down step the date by a day (Shift: a month), skipping nothing: limits stop it.\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\") commit();\n if ((event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") || readOnly) return;\n const from = draft === null ? current : isISODate(normalise(draft)) ? normalise(draft) : null;\n if (!from) return;\n event.preventDefault();\n const by = event.key === \"ArrowUp\" ? 1 : -1;\n const next = event.shiftKey ? addMonths(from, by) : addDays(from, by);\n if ((min !== undefined && next < min) || (max !== undefined && next > max)) return;\n choose(next);\n };\n\n // The picker opens on the chosen day (the APG date picker), not on its first button.\n useEffect(() => {\n if (!open) return;\n document\n .getElementById(`${id}-calendar`)\n ?.querySelector<HTMLElement>('[data-date][tabindex=\"0\"]')\n ?.focus();\n }, [open, id]);\n\n return (\n <TextField\n ref={input}\n label={label}\n {...(labelHidden ? { labelHidden } : {})}\n {...(description !== undefined ? { description } : {})}\n {...((error ?? problem) != null ? { error: error ?? problem } : {})}\n value={draft ?? current ?? \"\"}\n onChange={setDraft}\n onBlur={commit}\n onKeyDown={onKeyDown}\n placeholder=\"YYYY-MM-DD\"\n inputMode=\"numeric\"\n autoComplete=\"off\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n className={className ? `cy-date-field ${className}` : \"cy-date-field\"}\n {...(style ? { style } : {})}\n addonEnd={\n !readOnly && (\n <Popover\n label={text.open}\n open={open}\n onOpenChange={setOpen}\n placement=\"bottom\"\n size=\"sm\"\n trigger={(props) => (\n <IconButton\n {...props}\n icon={calendar}\n label={text.open}\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"cy-date-field-open\"\n />\n )}\n >\n <div id={`${id}-calendar`} className=\"cy-date-field-calendar\">\n <Calendar\n value={draft !== null && isISODate(normalise(draft)) ? normalise(draft) : current}\n onChange={(date) => {\n choose(date);\n setOpen(false);\n input.current?.focus();\n }}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n locale={locale}\n weekStartsOn={weekStartsOn}\n today={today}\n size=\"sm\"\n labels={{ previous: text.previous, next: text.next }}\n />\n </div>\n </Popover>\n )\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA6EA,IAAMc,KAAkC;AAAA,EACtC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AAA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EAAK;AAAA,YAAU,MAAMA,EAAK;AAAA,UAAK;AAAA,QACpD,CAAA;AAAA,MACE,CAAA;AAAA,IACE,CAAA;AAAA,EAGd,CAAA;AAEL"}
@@ -21,6 +21,7 @@ export interface DescriptionItem {
21
21
  detail: ReactNode | ReactNode[];
22
22
  }
23
23
  export interface DescriptionListProps {
24
+ /** The terms and their details, in order. */
24
25
  items: DescriptionItem[];
25
26
  /**
26
27
  * `inline`: terms beside their details. `stacked`: terms above. `auto` (default): inline when the list is at least
@@ -29,7 +30,9 @@ export interface DescriptionListProps {
29
30
  layout?: "auto" | "inline" | "stacked";
30
31
  /** Lines between rows. */
31
32
  divided?: boolean;
33
+ /** Text size. Default "md". */
32
34
  size?: Size;
35
+ /** Added to the root element, for layout. */
33
36
  className?: string;
34
37
  /** Layout only. Restyle through --cy-description-list-* tokens. */
35
38
  style?: CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionList.js","names":["jsx","jsxs","DescriptionList","items","layout","divided","size","className","style","item","i","detail","j"],"sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface DescriptionListTokens {\n /** Widest the term column gets when terms sit beside their details. */\n termWidth: string;\n /** Space between the term and detail columns. */\n columnGap: string;\n /** Space between rows. */\n rowGap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n descriptionList: DescriptionListTokens;\n }\n}\n\nexport interface DescriptionItem {\n /** Defaults to the term when it is a string. */\n id?: string;\n term: ReactNode;\n /** One detail, or several for a term with more than one value. */\n detail: ReactNode | ReactNode[];\n}\n\nexport interface DescriptionListProps {\n items: DescriptionItem[];\n /**\n * `inline`: terms beside their details. `stacked`: terms above. `auto` (default): inline when the list is at least\n * 28rem wide, stacked when narrower (it follows the list's own width, not the window's).\n */\n layout?: \"auto\" | \"inline\" | \"stacked\";\n /** Lines between rows. */\n divided?: boolean;\n size?: Size;\n className?: string;\n /** Layout only. Restyle through --cy-description-list-* tokens. */\n style?: CSSProperties;\n}\n\n/** Term and detail pairs: settings summaries, metadata, the facts about a record. */\nexport function DescriptionList({\n items,\n layout = \"auto\",\n divided = false,\n size = \"md\",\n className,\n style,\n}: DescriptionListProps) {\n return (\n <div\n className={className ? `cy-description-list ${className}` : \"cy-description-list\"}\n data-layout={layout}\n data-size={size}\n data-divided={divided ? \"\" : undefined}\n style={style}\n >\n <dl className=\"cy-description-list-list cy-reset\">\n {items.map((item, i) => (\n <div\n key={item.id ?? (typeof item.term === \"string\" ? item.term : i)}\n className=\"cy-description-list-row cy-reset\"\n >\n <dt className=\"cy-description-list-term cy-reset\">{item.term}</dt>\n {(Array.isArray(item.detail) ? item.detail : [item.detail]).map((detail, j) => (\n <dd key={j} className=\"cy-description-list-detail cy-reset\">\n {detail}\n </dd>\n ))}\n </div>\n ))}\n </dl>\n </div>\n );\n}\n"],"mappings":";;AA0CA,SAAgBE,EAAgB,EAC9B,OAAAC,GACA,QAAAC,IAAS,QACT,SAAAC,IAAU,IACV,MAAAC,IAAO,MACP,WAAAC,GACA,OAAAC,EAAA,GACuB;AACvB,SACE,gBAAAR,EAAC,OAAD;AAAA,IACE,WAAWO,IAAY,uBAAuBA,CAAA,KAAc;AAAA,IAC5D,eAAaH;AAAA,IACb,aAAWE;AAAA,IACX,gBAAcD,IAAU,KAAK;AAAA,IACtB,OAAAG;AAAA,IAEP,UAAA,gBAAAR,EAAC,MAAD;AAAA,MAAI,WAAU;AAAA,MACX,UAAAG,EAAM,IAAA,CAAKM,GAAMC,MAChB,gBAAAT,EAAC,OAAD;AAAA,QAEE,WAAU;AAAA,QAFZ,UAAA,CAIE,gBAAAD,EAAC,MAAD;AAAA,UAAI,WAAU;AAAA,UAAqC,UAAAS,EAAK;AAAA,QAAS,CAAA,IAC/D,MAAM,QAAQA,EAAK,MAAM,IAAIA,EAAK,SAAS,CAACA,EAAK,MAAM,GAAG,IAAA,CAAKE,GAAQC,MACvE,gBAAAZ,EAAC,MAAD;AAAA,UAAY,WAAU;AAAA,UACnB,UAAAW;AAAA,QACC,GAFKC,CAEL,CACL,CACE;AAAA,MATE,GAAAH,EAAK,OAAO,OAAOA,EAAK,QAAS,WAAWA,EAAK,OAAOC,EAS1D,CACN;AAAA,IACC,CAAA;AAAA,EACD,CAAA;AAET"}
1
+ {"version":3,"file":"DescriptionList.js","names":["jsx","jsxs","DescriptionList","items","layout","divided","size","className","style","item","i","detail","j"],"sources":["../../../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport type { Size } from \"../../tokens/schema.js\";\n\nexport interface DescriptionListTokens {\n /** Widest the term column gets when terms sit beside their details. */\n termWidth: string;\n /** Space between the term and detail columns. */\n columnGap: string;\n /** Space between rows. */\n rowGap: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n descriptionList: DescriptionListTokens;\n }\n}\n\nexport interface DescriptionItem {\n /** Defaults to the term when it is a string. */\n id?: string;\n term: ReactNode;\n /** One detail, or several for a term with more than one value. */\n detail: ReactNode | ReactNode[];\n}\n\nexport interface DescriptionListProps {\n /** The terms and their details, in order. */\n items: DescriptionItem[];\n /**\n * `inline`: terms beside their details. `stacked`: terms above. `auto` (default): inline when the list is at least\n * 28rem wide, stacked when narrower (it follows the list's own width, not the window's).\n */\n layout?: \"auto\" | \"inline\" | \"stacked\";\n /** Lines between rows. */\n divided?: boolean;\n /** Text size. Default \"md\". */\n size?: Size;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. Restyle through --cy-description-list-* tokens. */\n style?: CSSProperties;\n}\n\n/** Term and detail pairs: settings summaries, metadata, the facts about a record. */\nexport function DescriptionList({\n items,\n layout = \"auto\",\n divided = false,\n size = \"md\",\n className,\n style,\n}: DescriptionListProps) {\n return (\n <div\n className={className ? `cy-description-list ${className}` : \"cy-description-list\"}\n data-layout={layout}\n data-size={size}\n data-divided={divided ? \"\" : undefined}\n style={style}\n >\n <dl className=\"cy-description-list-list cy-reset\">\n {items.map((item, i) => (\n <div\n key={item.id ?? (typeof item.term === \"string\" ? item.term : i)}\n className=\"cy-description-list-row cy-reset\"\n >\n <dt className=\"cy-description-list-term cy-reset\">{item.term}</dt>\n {(Array.isArray(item.detail) ? item.detail : [item.detail]).map((detail, j) => (\n <dd key={j} className=\"cy-description-list-detail cy-reset\">\n {detail}\n </dd>\n ))}\n </div>\n ))}\n </dl>\n </div>\n );\n}\n"],"mappings":";;AA6CA,SAAgBE,EAAgB,EAC9B,OAAAC,GACA,QAAAC,IAAS,QACT,SAAAC,IAAU,IACV,MAAAC,IAAO,MACP,WAAAC,GACA,OAAAC,EAAA,GACuB;AACvB,SACE,gBAAAR,EAAC,OAAD;AAAA,IACE,WAAWO,IAAY,uBAAuBA,CAAA,KAAc;AAAA,IAC5D,eAAaH;AAAA,IACb,aAAWE;AAAA,IACX,gBAAcD,IAAU,KAAK;AAAA,IACtB,OAAAG;AAAA,IAEP,UAAA,gBAAAR,EAAC,MAAD;AAAA,MAAI,WAAU;AAAA,MACX,UAAAG,EAAM,IAAA,CAAKM,GAAMC,MAChB,gBAAAT,EAAC,OAAD;AAAA,QAEE,WAAU;AAAA,QAFZ,UAAA,CAIE,gBAAAD,EAAC,MAAD;AAAA,UAAI,WAAU;AAAA,UAAqC,UAAAS,EAAK;AAAA,QAAS,CAAA,IAC/D,MAAM,QAAQA,EAAK,MAAM,IAAIA,EAAK,SAAS,CAACA,EAAK,MAAM,GAAG,IAAA,CAAKE,GAAQC,MACvE,gBAAAZ,EAAC,MAAD;AAAA,UAAY,WAAU;AAAA,UACnB,UAAAW;AAAA,QACC,GAFKC,CAEL,CACL,CACE;AAAA,MATE,GAAAH,EAAK,OAAO,OAAOA,EAAK,QAAS,WAAWA,EAAK,OAAOC,EAS1D,CACN;AAAA,IACC,CAAA;AAAA,EACD,CAAA;AAET"}
@@ -0,0 +1,63 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ export interface DeviceFrameTokens {
3
+ /**
4
+ * Colour of a phone's or tablet's bezel. Default: the ink on a light page; on a dark page a dark grey lifted off the
5
+ * page, so the device stays dark but does not disappear.
6
+ */
7
+ bezel: string;
8
+ /** Rim around the frame: the line colour on a light page, a lighter rim (3:1 against the page) on a dark one. */
9
+ edge: string;
10
+ /** Shadow under the frame. */
11
+ shadow: string;
12
+ /** Fill of the screen behind the content. */
13
+ screen: string;
14
+ /** Width of a portrait phone; a landscape phone is as tall as this. */
15
+ phoneWidth: string;
16
+ /** Width of a portrait tablet; a landscape tablet is as tall as this. */
17
+ tabletWidth: string;
18
+ /** Corner radius of the browser window. */
19
+ browserRadius: string;
20
+ /** Fill of the browser's top bar. */
21
+ browserBar: string;
22
+ /** Colour of the three window dots in the browser bar. */
23
+ dot: string;
24
+ }
25
+ declare module "../../tokens/schema.js" {
26
+ interface ComponentTokens {
27
+ deviceFrame: DeviceFrameTokens;
28
+ }
29
+ }
30
+ /** The device drawn around the content. */
31
+ export type DeviceFrameDevice = "phone" | "tablet" | "browser";
32
+ export interface DeviceFrameProps {
33
+ /** The device drawn around the content. Default "phone". */
34
+ device?: DeviceFrameDevice;
35
+ /** Which way a phone or tablet is held. The browser ignores it. Default "portrait". */
36
+ orientation?: "portrait" | "landscape";
37
+ /**
38
+ * Width divided by height of the screen, as drawn in portrait (phone and tablet) or as is (browser). Landscape uses
39
+ * its inverse. Default: 9 / 19.5 for a phone, 3 / 4 for a tablet, 16 / 10 for a browser.
40
+ */
41
+ ratio?: number;
42
+ /** Address shown in the browser bar (decoration: it is not a link and is not announced). Browser only. */
43
+ url?: string;
44
+ /**
45
+ * Accessible name. With it the frame is a `figure` with this name; without it the frame is decoration and adds
46
+ * nothing to the accessibility tree, so the content keeps its own semantics.
47
+ */
48
+ label?: string;
49
+ /**
50
+ * Phone only: keep the content clear of the camera island (below it upright, beside it turned), as an app keeps
51
+ * clear of a real phone's. By default live content is kept clear and a screenshot, video or canvas fills the whole
52
+ * screen (it has its own status bar); `true` or `false` decides for any content.
53
+ */
54
+ safeArea?: boolean | undefined;
55
+ /** What the screen shows: a screenshot, a video or a live demo. Each child is stretched to the screen and clipped. */
56
+ children?: ReactNode;
57
+ /** Added to the root element, for layout. */
58
+ className?: string;
59
+ /** Layout only (width, margin, placement). The height follows from the width. Restyle through tokens. */
60
+ style?: CSSProperties;
61
+ }
62
+ /** A phone, tablet or browser window drawn around a screenshot or a live demo, at any width. */
63
+ export declare const DeviceFrame: import("react").ForwardRefExoticComponent<DeviceFrameProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { AspectRatio as f } from "../AspectRatio/AspectRatio.js";
3
+ import { forwardRef as h } from "react";
4
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
5
+ var y = {
6
+ phone: 9 / 19.5,
7
+ tablet: 3 / 4,
8
+ browser: 16 / 10
9
+ }, x = h(function({ device: r = "phone", orientation: i = "portrait", ratio: a, url: s, label: d, safeArea: n, children: l, className: o, style: v }, p) {
10
+ const t = a !== void 0 && a > 0 && Number.isFinite(a) ? a : y[r], m = r !== "browser" && i === "landscape" ? 1 / t : t;
11
+ return /* @__PURE__ */ e(d ? "figure" : "div", {
12
+ ref: p,
13
+ "aria-label": d || void 0,
14
+ className: `cy-device-frame${o ? ` ${o}` : ""}`,
15
+ "data-device": r,
16
+ "data-orientation": r === "browser" ? void 0 : i,
17
+ "data-safe": n === void 0 ? "auto" : n ? "on" : void 0,
18
+ style: {
19
+ "--_screen-ratio": m,
20
+ ...v
21
+ },
22
+ children: /* @__PURE__ */ c("div", {
23
+ className: "cy-device-frame-body",
24
+ children: [r === "browser" && /* @__PURE__ */ c("div", {
25
+ className: "cy-device-frame-bar",
26
+ "aria-hidden": "true",
27
+ children: [/* @__PURE__ */ c("span", {
28
+ className: "cy-device-frame-dots",
29
+ children: [
30
+ /* @__PURE__ */ e("span", {}),
31
+ /* @__PURE__ */ e("span", {}),
32
+ /* @__PURE__ */ e("span", {})
33
+ ]
34
+ }), s && /* @__PURE__ */ e("span", {
35
+ className: "cy-device-frame-url",
36
+ dir: "ltr",
37
+ children: s
38
+ })]
39
+ }), /* @__PURE__ */ e(f, {
40
+ ratio: m,
41
+ className: "cy-device-frame-screen",
42
+ children: /* @__PURE__ */ e("div", {
43
+ className: "cy-device-frame-content cy-reset",
44
+ children: l
45
+ })
46
+ })]
47
+ })
48
+ });
49
+ });
50
+ export {
51
+ x as DeviceFrame
52
+ };
53
+
54
+ //# sourceMappingURL=DeviceFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceFrame.js","names":["AspectRatio","forwardRef","jsx","jsxs","RATIOS","DeviceFrame","device","orientation","ratio","url","label","safeArea","children","className","style","ref","upright","screen"],"sources":["../../../src/components/DeviceFrame/DeviceFrame.tsx"],"sourcesContent":["import { type CSSProperties, forwardRef, type ReactNode } from \"react\";\nimport { AspectRatio } from \"../AspectRatio/AspectRatio.js\";\n\nexport interface DeviceFrameTokens {\n /**\n * Colour of a phone's or tablet's bezel. Default: the ink on a light page; on a dark page a dark grey lifted off the\n * page, so the device stays dark but does not disappear.\n */\n bezel: string;\n /** Rim around the frame: the line colour on a light page, a lighter rim (3:1 against the page) on a dark one. */\n edge: string;\n /** Shadow under the frame. */\n shadow: string;\n /** Fill of the screen behind the content. */\n screen: string;\n /** Width of a portrait phone; a landscape phone is as tall as this. */\n phoneWidth: string;\n /** Width of a portrait tablet; a landscape tablet is as tall as this. */\n tabletWidth: string;\n /** Corner radius of the browser window. */\n browserRadius: string;\n /** Fill of the browser's top bar. */\n browserBar: string;\n /** Colour of the three window dots in the browser bar. */\n dot: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n deviceFrame: DeviceFrameTokens;\n }\n}\n\n/** The device drawn around the content. */\nexport type DeviceFrameDevice = \"phone\" | \"tablet\" | \"browser\";\n\nexport interface DeviceFrameProps {\n /** The device drawn around the content. Default \"phone\". */\n device?: DeviceFrameDevice;\n /** Which way a phone or tablet is held. The browser ignores it. Default \"portrait\". */\n orientation?: \"portrait\" | \"landscape\";\n /**\n * Width divided by height of the screen, as drawn in portrait (phone and tablet) or as is (browser). Landscape uses\n * its inverse. Default: 9 / 19.5 for a phone, 3 / 4 for a tablet, 16 / 10 for a browser.\n */\n ratio?: number;\n /** Address shown in the browser bar (decoration: it is not a link and is not announced). Browser only. */\n url?: string;\n /**\n * Accessible name. With it the frame is a `figure` with this name; without it the frame is decoration and adds\n * nothing to the accessibility tree, so the content keeps its own semantics.\n */\n label?: string;\n /**\n * Phone only: keep the content clear of the camera island (below it upright, beside it turned), as an app keeps\n * clear of a real phone's. By default live content is kept clear and a screenshot, video or canvas fills the whole\n * screen (it has its own status bar); `true` or `false` decides for any content.\n */\n safeArea?: boolean | undefined;\n /** What the screen shows: a screenshot, a video or a live demo. Each child is stretched to the screen and clipped. */\n children?: ReactNode;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only (width, margin, placement). The height follows from the width. Restyle through tokens. */\n style?: CSSProperties;\n}\n\nconst RATIOS: Record<DeviceFrameDevice, number> = { phone: 9 / 19.5, tablet: 3 / 4, browser: 16 / 10 };\n\n/** A phone, tablet or browser window drawn around a screenshot or a live demo, at any width. */\nexport const DeviceFrame = forwardRef<HTMLElement, DeviceFrameProps>(function DeviceFrame(\n { device = \"phone\", orientation = \"portrait\", ratio, url, label, safeArea, children, className, style },\n ref,\n) {\n const upright = ratio !== undefined && ratio > 0 && Number.isFinite(ratio) ? ratio : RATIOS[device];\n const turned = device !== \"browser\" && orientation === \"landscape\";\n const screen = turned ? 1 / upright : upright;\n const Root = label ? \"figure\" : \"div\";\n return (\n <Root\n ref={ref as never}\n aria-label={label || undefined}\n className={`cy-device-frame${className ? ` ${className}` : \"\"}`}\n data-device={device}\n data-orientation={device === \"browser\" ? undefined : orientation}\n data-safe={safeArea === undefined ? \"auto\" : safeArea ? \"on\" : undefined}\n style={{ \"--_screen-ratio\": screen, ...style } as CSSProperties}\n >\n <div className=\"cy-device-frame-body\">\n {device === \"browser\" && (\n <div className=\"cy-device-frame-bar\" aria-hidden=\"true\">\n <span className=\"cy-device-frame-dots\">\n <span />\n <span />\n <span />\n </span>\n {url && (\n <span className=\"cy-device-frame-url\" dir=\"ltr\">\n {url}\n </span>\n )}\n </div>\n )}\n <AspectRatio ratio={screen} className=\"cy-device-frame-screen\">\n <div className=\"cy-device-frame-content cy-reset\">{children}</div>\n </AspectRatio>\n </div>\n </Root>\n );\n});\n"],"mappings":";;;;AAmEA,IAAMI,IAA4C;AAAA,EAAE,OAAO,IAAI;AAAA,EAAM,QAAQ,IAAI;AAAA,EAAG,SAAS,KAAK;AAAG,GAGxFC,IAAcJ,EAA0C,SACnE,EAAE,QAAAK,IAAS,SAAS,aAAAC,IAAc,YAAY,OAAAC,GAAO,KAAAC,GAAK,OAAAC,GAAO,UAAAC,GAAU,UAAAC,GAAU,WAAAC,GAAW,OAAAC,EAAA,GAChGC,GACA;AACA,QAAMC,IAAUR,MAAU,UAAaA,IAAQ,KAAK,OAAO,SAASA,CAAK,IAAIA,IAAQJ,EAAOE,CAAA,GAEtFW,IADSX,MAAW,aAAaC,MAAgB,cAC/B,IAAIS,IAAUA;AAEtC,SACE,gBAAAd,EAFWQ,IAAQ,WAAW,OAE9B;AAAA,IACO,KAAAK;AAAA,IACL,cAAYL,KAAS;AAAA,IACrB,WAAW,kBAAkBG,IAAY,IAAIA,CAAA,KAAc,EAAA;AAAA,IAC3D,eAAaP;AAAA,IACb,oBAAkBA,MAAW,YAAY,SAAYC;AAAA,IACrD,aAAWI,MAAa,SAAY,SAASA,IAAW,OAAO;AAAA,IAC/D,OAAO;AAAA,MAAE,mBAAmBM;AAAA,MAAQ,GAAGH;AAAA,IAAM;AAAA,IAE7C,UAAA,gBAAAX,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAf,UAAA,CACGG,MAAW,aACV,gBAAAH,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QAAsB,eAAY;AAAA,QAAjD,UAAA,CACE,gBAAAA,EAAC,QAAD;AAAA,UAAM,WAAU;AAAA,UAAhB,UAAA;AAAA,YACE,gBAAAD,EAAC,QAAD,CAAO,CAAA;AAAA,YACP,gBAAAA,EAAC,QAAD,CAAO,CAAA;AAAA,YACP,gBAAAA,EAAC,QAAD,CAAO,CAAA;AAAA,UACH;AAAA,QACL,CAAA,GAAAO,KACC,gBAAAP,EAAC,QAAD;AAAA,UAAM,WAAU;AAAA,UAAsB,KAAI;AAAA,UACvC,UAAAO;AAAA,QACG,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAAP,EAACF,GAAD;AAAA,QAAa,OAAOiB;AAAA,QAAQ,WAAU;AAAA,QACpC,UAAA,gBAAAf,EAAC,OAAD;AAAA,UAAK,WAAU;AAAA,UAAoC,UAAAU;AAAA,QAAc,CAAA;AAAA,MACtD,CAAA,CACV;AAAA,I;A,EACD,CAAA;AAEV,CAAC"}
@@ -0,0 +1 @@
1
+ export { DeviceFrame, type DeviceFrameDevice, type DeviceFrameProps, type DeviceFrameTokens, } from "./DeviceFrame.js";
@@ -18,8 +18,11 @@ export interface DialogLabels {
18
18
  close: string;
19
19
  }
20
20
  export interface DialogProps {
21
+ /** Whether the dialog is open, when you control it. */
21
22
  open?: boolean;
23
+ /** Open on first render when uncontrolled. */
22
24
  defaultOpen?: boolean;
25
+ /** Called with `false` when the dialog closes itself: Escape, the backdrop or the close button. */
23
26
  onOpenChange?: (open: boolean) => void;
24
27
  /** Heading of the dialog; also its accessible name. */
25
28
  title: ReactNode;
@@ -31,19 +34,39 @@ export interface DialogProps {
31
34
  size?: Size;
32
35
  /** Escape, the backdrop and the close button close it (default). `false` leaves only your actions. */
33
36
  dismissible?: boolean;
37
+ /**
38
+ * Keep the content in the DOM while the dialog is closed. By default a closed dialog renders nothing inside it: the
39
+ * content mounts when it opens and unmounts once the closing transition has ended, so every opening starts fresh.
40
+ * Set it for content whose state must survive closing (a half-filled form) or that is expensive to rebuild.
41
+ * Default false.
42
+ */
43
+ keepMounted?: boolean;
44
+ /** Replace the built-in English text: the close button's name. */
34
45
  labels?: Partial<DialogLabels>;
46
+ /** Added to the panel, for layout. */
35
47
  className?: string;
36
48
  /** Layout only, applied to the panel. Restyle through --cy-dialog-* tokens. */
37
49
  style?: CSSProperties;
50
+ /** The content; it scrolls when it is taller than the dialog. */
38
51
  children?: ReactNode;
39
52
  }
40
53
  /** Internal: a Sheet is the same dialog docked to an edge. */
41
54
  export interface DialogFrameProps extends DialogProps {
42
55
  side?: "bottom" | "end" | "start";
56
+ /**
57
+ * Classes of the component built on the frame (Sheet), added to the dialog, the panel and the actions, so that
58
+ * component draws its own look in its own stylesheet.
59
+ */
60
+ parts?: {
61
+ root: string;
62
+ panel: string;
63
+ actions: string;
64
+ };
43
65
  }
44
- export declare function DialogFrame({ open, defaultOpen, onOpenChange, title, description, actions, size, dismissible, labels, side, className, style, children, }: DialogFrameProps): import("react").JSX.Element;
66
+ export declare function DialogFrame({ open, defaultOpen, onOpenChange, title, description, actions, size, dismissible, keepMounted, labels, side, parts, className, style, children, }: DialogFrameProps): import("react").JSX.Element;
45
67
  /**
46
68
  * Modal dialog in the top layer: focus moves in, stays in and comes back; Escape, the backdrop and the close button
47
- * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet.
69
+ * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet. Its content is mounted only while
70
+ * it is open (and while it closes), unless `keepMounted`.
48
71
  */
49
72
  export declare function Dialog(props: DialogProps): import("react").JSX.Element;
@@ -1,111 +1,128 @@
1
1
  "use client";
2
- import { useControllableState as B } from "../../foundations/controllable.js";
3
- import { useClientLayoutEffect as p } from "../../foundations/client-layout-effect.js";
4
- import { useDismiss as I } from "../../overlay/dismiss.js";
5
- import { IconButton as O } from "../IconButton/IconButton.js";
6
- import { DialogBase as R } from "../../foundations/DialogBase/DialogBase.js";
7
- import { close as k } from "../../icons/close.js";
8
- import { ToastHostContext as q } from "../../overlay/toast-host.js";
9
- import { useContext as T, useId as j, useRef as n } from "react";
10
- import { jsx as o, jsxs as y } from "react/jsx-runtime";
11
- var z = { close: "Close" }, N = 'button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]):not([aria-hidden="true"]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12
- function H() {
2
+ import { useControllableState as M } from "../../foundations/controllable.js";
3
+ import { useClientLayoutEffect as h } from "../../foundations/client-layout-effect.js";
4
+ import { useDismiss as _ } from "../../overlay/dismiss.js";
5
+ import { IconButton as G } from "../IconButton/IconButton.js";
6
+ import { DialogBase as J } from "../../foundations/DialogBase/DialogBase.js";
7
+ import { close as K } from "../../icons/close.js";
8
+ import { ToastHostContext as Q } from "../../overlay/toast-host.js";
9
+ import { useContext as W, useEffect as X, useId as Y, useRef as s, useState as Z } from "react";
10
+ import { jsx as n, jsxs as b } from "react/jsx-runtime";
11
+ var ee = { close: "Close" }, A = 'button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]):not([aria-hidden="true"]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12
+ function te() {
13
13
  if (typeof document > "u") return null;
14
14
  let e = document.activeElement;
15
15
  for (; e?.shadowRoot?.activeElement; ) e = e.shadowRoot.activeElement;
16
16
  return e;
17
17
  }
18
- function P(e) {
18
+ function oe(e) {
19
19
  if (!e) return null;
20
20
  const r = e.closest("[popover][id]");
21
21
  if (!(r ? !r.matches(":popover-open") : e.checkVisibility?.() === !1)) return e;
22
- const l = e.getRootNode();
23
- return (r && l.querySelector(`[aria-controls="${CSS.escape(r.id)}"]`)) ?? e;
22
+ const f = e.getRootNode();
23
+ return (r && f.querySelector(`[aria-controls="${CSS.escape(r.id)}"]`)) ?? e;
24
24
  }
25
- function U({ open: e, defaultOpen: r = !1, onOpenChange: l, title: E, description: d, actions: h, size: $ = "md", dismissible: b = !0, labels: w, side: D, className: v, style: F, children: L }) {
26
- const s = j(), A = {
27
- ...z,
28
- ...w
29
- }, [t, u] = B(e, r, l), i = n(null), c = T(q), f = n(null), g = n(null), C = n(null), a = n(null), x = n(!1);
30
- t && !x.current && (a.current = H()), x.current = t;
31
- const S = () => {
32
- b && u(!1);
33
- };
34
- return p(() => {
35
- if (!(!t || !c || !f.current))
36
- return c.register(f.current);
37
- }, [t, c]), p(() => {
25
+ function ne({ open: e, defaultOpen: r = !1, onOpenChange: f, title: I, description: p, actions: C, size: O = "md", dismissible: x = !0, keepMounted: R = !1, labels: j, side: k, parts: i, className: q, style: P, children: z }) {
26
+ const c = Y(), H = {
27
+ ...ee,
28
+ ...j
29
+ }, [t, y] = M(e, r, f), a = s(null), l = W(Q), g = s(null), N = s(null), S = s(null), d = s(null), E = s(!1);
30
+ t && !E.current && (d.current = te()), E.current = t;
31
+ const w = () => {
32
+ x && y(!1);
33
+ }, [u, D] = Z(t);
34
+ t && !u && D(!0), X(() => {
35
+ if (t || !u) return;
36
+ const o = a.current, L = () => D(!1), $ = getComputedStyle(o), F = (v) => Math.max(...v.split(",").map((V) => Number.parseFloat(V))), B = (F($.transitionDuration) + F($.transitionDelay)) * 1e3, T = (v) => {
37
+ v.target === o && L();
38
+ };
39
+ o.addEventListener("transitionend", T);
40
+ const U = setTimeout(L, B && B + 100);
41
+ return () => {
42
+ o.removeEventListener("transitionend", T), clearTimeout(U);
43
+ };
44
+ }, [t, u]);
45
+ const m = t || u || R;
46
+ return h(() => {
47
+ if (!(!t || !l || !g.current))
48
+ return l.register(g.current);
49
+ }, [t, l]), h(() => {
38
50
  if (t)
39
51
  return () => {
40
- a.current = P(a.current);
52
+ d.current = oe(d.current);
41
53
  };
42
- }, [t]), p(() => {
43
- t && (g.current?.querySelector(N) ?? C.current?.querySelector(N) ?? i.current)?.focus({ preventScroll: !0 });
44
- }, [t]), I({
54
+ }, [t]), h(() => {
55
+ t && (N.current?.querySelector(A) ?? S.current?.querySelector(A) ?? a.current)?.focus({ preventScroll: !0 });
56
+ }, [t]), _({
45
57
  open: t,
46
- onClose: S,
47
- inside: [i],
48
- returnFocus: a,
49
- outside: (m) => m.composedPath()[0] === i.current
50
- }), /* @__PURE__ */ y(R, {
51
- ref: i,
58
+ onClose: w,
59
+ inside: [a],
60
+ returnFocus: d,
61
+ outside: (o) => o.composedPath()[0] === a.current
62
+ }), /* @__PURE__ */ b(J, {
63
+ ref: a,
52
64
  open: t,
53
- onCancel: S,
54
- onClose: () => u(!1),
55
- className: "cy-dialog",
65
+ onCancel: w,
66
+ onClose: () => y(!1),
67
+ className: i ? `cy-dialog ${i.root}` : "cy-dialog",
56
68
  tabIndex: -1,
57
- "data-size": $,
58
- "data-side": D,
59
- "aria-labelledby": `${s}-title`,
60
- "aria-describedby": d ? `${s}-description` : void 0,
61
- children: [/* @__PURE__ */ y("div", {
62
- className: v ? `cy-dialog-panel cy-reset ${v}` : "cy-dialog-panel cy-reset",
63
- style: F,
69
+ "data-size": O,
70
+ "data-side": k,
71
+ "aria-labelledby": m ? `${c}-title` : void 0,
72
+ "aria-describedby": m && p ? `${c}-description` : void 0,
73
+ children: [m && /* @__PURE__ */ b("div", {
74
+ className: [
75
+ "cy-dialog-panel cy-reset",
76
+ i?.panel,
77
+ q
78
+ ].filter(Boolean).join(" "),
79
+ style: P,
64
80
  children: [
65
- /* @__PURE__ */ y("div", {
81
+ /* @__PURE__ */ b("div", {
66
82
  className: "cy-dialog-header cy-reset",
67
- children: [/* @__PURE__ */ o("h2", {
68
- id: `${s}-title`,
83
+ children: [/* @__PURE__ */ n("h2", {
84
+ id: `${c}-title`,
69
85
  className: "cy-dialog-title cy-reset",
70
- children: E
71
- }), b && /* @__PURE__ */ o(O, {
72
- icon: k,
73
- label: A.close,
86
+ children: I
87
+ }), x && /* @__PURE__ */ n(G, {
88
+ icon: K,
89
+ label: H.close,
74
90
  variant: "ghost",
75
91
  size: "sm",
76
92
  tooltipPlacement: "bottom",
77
- onClick: () => u(!1)
93
+ wrapperClassName: "cy-dialog-close",
94
+ onClick: () => y(!1)
78
95
  })]
79
96
  }),
80
- d && /* @__PURE__ */ o("p", {
81
- id: `${s}-description`,
97
+ p && /* @__PURE__ */ n("p", {
98
+ id: `${c}-description`,
82
99
  className: "cy-dialog-description cy-reset",
83
- children: d
100
+ children: p
84
101
  }),
85
- /* @__PURE__ */ o("div", {
86
- ref: g,
102
+ /* @__PURE__ */ n("div", {
103
+ ref: N,
87
104
  className: "cy-dialog-body cy-reset",
88
- onFocus: (m) => m.target.scrollIntoView({ block: "nearest" }),
89
- children: L
105
+ onFocus: (o) => o.target.scrollIntoView({ block: "nearest" }),
106
+ children: z
90
107
  }),
91
- h && /* @__PURE__ */ o("div", {
92
- ref: C,
93
- className: "cy-dialog-actions cy-reset",
94
- children: h
108
+ C && /* @__PURE__ */ n("div", {
109
+ ref: S,
110
+ className: i ? `cy-dialog-actions cy-reset ${i.actions}` : "cy-dialog-actions cy-reset",
111
+ children: C
95
112
  })
96
113
  ]
97
- }), c && /* @__PURE__ */ o("div", {
98
- ref: f,
114
+ }), l && m && /* @__PURE__ */ n("div", {
115
+ ref: g,
99
116
  className: "cy-dialog-toasts"
100
117
  })]
101
118
  });
102
119
  }
103
- function Y(e) {
104
- return /* @__PURE__ */ o(U, { ...e });
120
+ function fe(e) {
121
+ return /* @__PURE__ */ n(ne, { ...e });
105
122
  }
106
123
  export {
107
- Y as Dialog,
108
- U as DialogFrame
124
+ fe as Dialog,
125
+ ne as DialogFrame
109
126
  };
110
127
 
111
128
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["closeIcon","useControllableState","useClientLayoutEffect","useDismiss","IconButton","DialogBase","close","ToastHostContext","useContext","useId","useRef","jsx","jsxs","DEFAULT_LABELS","FOCUSABLE","deepActive","active","reachable","el","popover","root","DialogFrame","open","defaultOpen","onOpenChange","title","description","actions","size","dismissible","labels","side","className","style","children","id","text","isOpen","setOpen","dialog","toastHost","toasts","body","footer","returnTo","wasOpen","dismiss","event","Dialog","props"],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useContext, useId, useRef } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { DialogBase } from \"../../foundations/DialogBase/DialogBase.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { useDismiss } from \"../../overlay/dismiss.js\";\nimport { ToastHostContext } from \"../../overlay/toast-host.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface DialogTokens {\n radius: string;\n padding: string;\n widthSm: string;\n widthMd: string;\n widthLg: string;\n scrim: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n dialog: DialogTokens;\n }\n}\n\nexport interface DialogLabels {\n /** Accessible name of the close button. */\n close: string;\n}\n\nexport interface DialogProps {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Heading of the dialog; also its accessible name. */\n title: ReactNode;\n /** One or two sentences under the title; also its accessible description. */\n description?: ReactNode;\n /** Buttons along the bottom, outside the scrolling content (Cancel first, then the main action). */\n actions?: ReactNode;\n /** Width preset (the panel never grows wider than its container). */\n size?: Size;\n /** Escape, the backdrop and the close button close it (default). `false` leaves only your actions. */\n dismissible?: boolean;\n labels?: Partial<DialogLabels>;\n className?: string;\n /** Layout only, applied to the panel. Restyle through --cy-dialog-* tokens. */\n style?: CSSProperties;\n children?: ReactNode;\n}\n\n/** Internal: a Sheet is the same dialog docked to an edge. */\nexport interface DialogFrameProps extends DialogProps {\n side?: \"bottom\" | \"end\" | \"start\";\n}\n\nconst DEFAULT_LABELS: DialogLabels = { close: \"Close\" };\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden=\"true\"]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** The focused element, looking inside shadow roots (document.activeElement stops at the host). */\nfunction deepActive(): HTMLElement | null {\n if (typeof document === \"undefined\") return null; // server render\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n return active as HTMLElement | null;\n}\n\n/**\n * Where focus can actually go back to. A Dialog opened from a Menu item remembers that item, but the menu has closed\n * (hidden, still in the DOM): fall back to the button that controls the hidden popover.\n */\nfunction reachable(el: HTMLElement | null): HTMLElement | null {\n if (!el) return null;\n // A closed popover can still be fading out (displayed), so ask the popover, not only the layout.\n const popover = el.closest<HTMLElement>(\"[popover][id]\");\n const closed = popover ? !popover.matches(\":popover-open\") : el.checkVisibility?.() === false;\n if (!closed) return el;\n const root = el.getRootNode() as Document | ShadowRoot;\n return (popover && root.querySelector<HTMLElement>(`[aria-controls=\"${CSS.escape(popover.id)}\"]`)) ?? el;\n}\n\nexport function DialogFrame({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n actions,\n size = \"md\",\n dismissible = true,\n labels,\n side,\n className,\n style,\n children,\n}: DialogFrameProps) {\n const id = useId();\n const text = { ...DEFAULT_LABELS, ...labels };\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const dialog = useRef<HTMLDialogElement>(null);\n const toastHost = useContext(ToastHostContext);\n const toasts = useRef<HTMLDivElement>(null);\n const body = useRef<HTMLDivElement>(null);\n const footer = useRef<HTMLDivElement>(null);\n const returnTo = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n // Where focus was before opening: read while rendering, because DialogBase's showModal moves it first.\n if (isOpen && !wasOpen.current) returnTo.current = deepActive();\n wasOpen.current = isOpen;\n const dismiss = () => {\n if (dismissible) setOpen(false);\n };\n\n // On close, before useDismiss returns focus: make sure the remembered element can still take it.\n // Inside a Toaster, lend it a container while open: toasts raised now show above this dialog instead of under its\n // scrim, where the modal would make them inert. Runs after DialogBase has called showModal.\n useClientLayoutEffect(() => {\n if (!isOpen || !toastHost || !toasts.current) return;\n return toastHost.register(toasts.current);\n }, [isOpen, toastHost]);\n\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n return () => {\n returnTo.current = reachable(returnTo.current);\n };\n }, [isOpen]);\n\n // DialogBase has opened it; move focus to the first control in the content, else the first action, else the\n // dialog itself (so the close button's tooltip does not pop up on open).\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n const first =\n body.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n footer.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n dialog.current;\n first?.focus({ preventScroll: true });\n }, [isOpen]);\n\n useDismiss({\n open: isOpen,\n onClose: dismiss,\n inside: [dialog],\n returnFocus: returnTo,\n // The dialog fills its container; a pointer down on the dialog itself (not the panel) is on the backdrop.\n outside: (event) => event.composedPath()[0] === dialog.current,\n });\n\n return (\n <DialogBase\n ref={dialog}\n open={isOpen}\n onCancel={dismiss}\n onClose={() => setOpen(false)}\n className=\"cy-dialog\"\n tabIndex={-1}\n data-size={size}\n data-side={side}\n aria-labelledby={`${id}-title`}\n aria-describedby={description ? `${id}-description` : undefined}\n >\n <div\n className={className ? `cy-dialog-panel cy-reset ${className}` : \"cy-dialog-panel cy-reset\"}\n style={style}\n >\n <div className=\"cy-dialog-header cy-reset\">\n <h2 id={`${id}-title`} className=\"cy-dialog-title cy-reset\">\n {title}\n </h2>\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={text.close}\n variant=\"ghost\"\n size=\"sm\"\n tooltipPlacement=\"bottom\"\n onClick={() => setOpen(false)}\n />\n )}\n </div>\n {description && (\n <p id={`${id}-description`} className=\"cy-dialog-description cy-reset\">\n {description}\n </p>\n )}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated focus listener for the controls inside */}\n <div\n ref={body}\n className=\"cy-dialog-body cy-reset\"\n // A focused field low in the content (Tab, or the on-screen keyboard opening) is brought fully into view.\n onFocus={(event) => event.target.scrollIntoView({ block: \"nearest\" })}\n >\n {children}\n </div>\n {actions && (\n <div ref={footer} className=\"cy-dialog-actions cy-reset\">\n {actions}\n </div>\n )}\n </div>\n {toastHost && <div ref={toasts} className=\"cy-dialog-toasts\" />}\n </DialogBase>\n );\n}\n\n/**\n * Modal dialog in the top layer: focus moves in, stays in and comes back; Escape, the backdrop and the close button\n * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet.\n */\nexport function Dialog(props: DialogProps) {\n return <DialogFrame {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAwDA,IAAMa,IAA+B,EAAE,OAAO,QAAQ,GAChDC,IACJ;AAGF,SAASC,IAAiC;AACxC,MAAI,OAAO,WAAa,IAAa,QAAO;AAC5C,MAAIC,IAAS,SAAS;AACtB,SAAOA,GAAQ,YAAY,gBAAe,CAAAA,IAASA,EAAO,WAAW;AACrE,SAAOA;AACT;AAMA,SAASC,EAAUC,GAA4C;AAC7D,MAAI,CAACA,EAAI,QAAO;AAEhB,QAAMC,IAAUD,EAAG,QAAqB,eAAe;AAEvD,MAAI,EADWC,IAAU,CAACA,EAAQ,QAAQ,eAAe,IAAID,EAAG,kBAAkB,MAAM,IAC3E,QAAOA;AACpB,QAAME,IAAOF,EAAG,YAAY;AAC5B,UAAQC,KAAWC,EAAK,cAA2B,mBAAmB,IAAI,OAAOD,EAAQ,EAAE,CAAA,IAAK,MAAMD;AACxG;AAEA,SAAgBG,EAAY,EAC1B,MAAAC,GACA,aAAAC,IAAc,IACd,cAAAC,GACA,OAAAC,GACA,aAAAC,GACA,SAAAC,GACA,MAAAC,IAAO,MACP,aAAAC,IAAc,IACd,QAAAC,GACA,MAAAC,GACA,WAAAC,GACA,OAAAC,GACA,UAAAC,EAAA,GACmB;AACnB,QAAMC,IAAK1B,EAAM,GACX2B,IAAO;AAAA,IAAE,GAAGvB;AAAA,IAAgB,GAAGiB;AAAA,EAAO,GACtC,CAACO,GAAQC,CAAA,IAAWrC,EAAqBqB,GAAMC,GAAaC,CAAY,GACxEe,IAAS7B,EAA0B,IAAI,GACvC8B,IAAYhC,EAAWD,CAAgB,GACvCkC,IAAS/B,EAAuB,IAAI,GACpCgC,IAAOhC,EAAuB,IAAI,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conButton","DialogBase","close","ToastHostContext","useContext","useEffect","useId","useRef","useState","jsx","jsxs","DEFAULT_LABELS","FOCUSABLE","deepActive","active","reachable","el","popover","root","DialogFrame","open","defaultOpen","onOpenChange","title","description","actions","size","dismissible","keepMounted","labels","side","parts","className","style","children","id","text","isOpen","setOpen","dialog","toastHost","toasts","body","footer","returnTo","wasOpen","dismiss","present","setPresent","unmount","longest","times","time","wait","ended","event","timer","mounted","Dialog","props"],"sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useContext, useEffect, useId, useRef, useState } from \"react\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useControllableState } from \"../../foundations/controllable.js\";\nimport { DialogBase } from \"../../foundations/DialogBase/DialogBase.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { useDismiss } from \"../../overlay/dismiss.js\";\nimport { ToastHostContext } from \"../../overlay/toast-host.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface DialogTokens {\n radius: string;\n padding: string;\n widthSm: string;\n widthMd: string;\n widthLg: string;\n scrim: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n dialog: DialogTokens;\n }\n}\n\nexport interface DialogLabels {\n /** Accessible name of the close button. */\n close: string;\n}\n\nexport interface DialogProps {\n /** Whether the dialog is open, when you control it. */\n open?: boolean;\n /** Open on first render when uncontrolled. */\n defaultOpen?: boolean;\n /** Called with `false` when the dialog closes itself: Escape, the backdrop or the close button. */\n onOpenChange?: (open: boolean) => void;\n /** Heading of the dialog; also its accessible name. */\n title: ReactNode;\n /** One or two sentences under the title; also its accessible description. */\n description?: ReactNode;\n /** Buttons along the bottom, outside the scrolling content (Cancel first, then the main action). */\n actions?: ReactNode;\n /** Width preset (the panel never grows wider than its container). */\n size?: Size;\n /** Escape, the backdrop and the close button close it (default). `false` leaves only your actions. */\n dismissible?: boolean;\n /**\n * Keep the content in the DOM while the dialog is closed. By default a closed dialog renders nothing inside it: the\n * content mounts when it opens and unmounts once the closing transition has ended, so every opening starts fresh.\n * Set it for content whose state must survive closing (a half-filled form) or that is expensive to rebuild.\n * Default false.\n */\n keepMounted?: boolean;\n /** Replace the built-in English text: the close button's name. */\n labels?: Partial<DialogLabels>;\n /** Added to the panel, for layout. */\n className?: string;\n /** Layout only, applied to the panel. Restyle through --cy-dialog-* tokens. */\n style?: CSSProperties;\n /** The content; it scrolls when it is taller than the dialog. */\n children?: ReactNode;\n}\n\n/** Internal: a Sheet is the same dialog docked to an edge. */\nexport interface DialogFrameProps extends DialogProps {\n side?: \"bottom\" | \"end\" | \"start\";\n /**\n * Classes of the component built on the frame (Sheet), added to the dialog, the panel and the actions, so that\n * component draws its own look in its own stylesheet.\n */\n parts?: { root: string; panel: string; actions: string };\n}\n\nconst DEFAULT_LABELS: DialogLabels = { close: \"Close\" };\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden=\"true\"]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/** The focused element, looking inside shadow roots (document.activeElement stops at the host). */\nfunction deepActive(): HTMLElement | null {\n if (typeof document === \"undefined\") return null; // server render\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n return active as HTMLElement | null;\n}\n\n/**\n * Where focus can actually go back to. A Dialog opened from a Menu item remembers that item, but the menu has closed\n * (hidden, still in the DOM): fall back to the button that controls the hidden popover.\n */\nfunction reachable(el: HTMLElement | null): HTMLElement | null {\n if (!el) return null;\n // A closed popover can still be fading out (displayed), so ask the popover, not only the layout.\n const popover = el.closest<HTMLElement>(\"[popover][id]\");\n const closed = popover ? !popover.matches(\":popover-open\") : el.checkVisibility?.() === false;\n if (!closed) return el;\n const root = el.getRootNode() as Document | ShadowRoot;\n return (popover && root.querySelector<HTMLElement>(`[aria-controls=\"${CSS.escape(popover.id)}\"]`)) ?? el;\n}\n\nexport function DialogFrame({\n open,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n actions,\n size = \"md\",\n dismissible = true,\n keepMounted = false,\n labels,\n side,\n parts,\n className,\n style,\n children,\n}: DialogFrameProps) {\n const id = useId();\n const text = { ...DEFAULT_LABELS, ...labels };\n const [isOpen, setOpen] = useControllableState(open, defaultOpen, onOpenChange);\n const dialog = useRef<HTMLDialogElement>(null);\n const toastHost = useContext(ToastHostContext);\n const toasts = useRef<HTMLDivElement>(null);\n const body = useRef<HTMLDivElement>(null);\n const footer = useRef<HTMLDivElement>(null);\n const returnTo = useRef<HTMLElement | null>(null);\n const wasOpen = useRef(false);\n // Where focus was before opening: read while rendering, because DialogBase's showModal moves it first.\n if (isOpen && !wasOpen.current) returnTo.current = deepActive();\n wasOpen.current = isOpen;\n const dismiss = () => {\n if (dismissible) setOpen(false);\n };\n\n // The content is rendered while open, and after closing until the closing transition has ended. `present` goes true\n // in the render that opens the dialog, so the content is there before DialogBase shows it (no empty first frame).\n const [present, setPresent] = useState(isOpen);\n if (isOpen && !present) setPresent(true);\n useEffect(() => {\n if (isOpen || !present) return;\n const el = dialog.current as HTMLDialogElement;\n const unmount = () => setPresent(false);\n // Unmount when the dialog's own closing transition ends. The timer covers a transition that never reports back\n // (interrupted, or the dialog is not rendered) and is the whole wait when there is none: reduced motion, or no\n // stylesheet.\n const style = getComputedStyle(el);\n const longest = (times: string) => Math.max(...times.split(\",\").map((time) => Number.parseFloat(time)));\n const wait = (longest(style.transitionDuration) + longest(style.transitionDelay)) * 1000;\n const ended = (event: Event) => {\n if (event.target === el) unmount();\n };\n el.addEventListener(\"transitionend\", ended);\n const timer = setTimeout(unmount, wait && wait + 100);\n return () => {\n el.removeEventListener(\"transitionend\", ended);\n clearTimeout(timer);\n };\n }, [isOpen, present]);\n const mounted = isOpen || present || keepMounted;\n\n // On close, before useDismiss returns focus: make sure the remembered element can still take it.\n // Inside a Toaster, lend it a container while open: toasts raised now show above this dialog instead of under its\n // scrim, where the modal would make them inert. Runs after DialogBase has called showModal.\n useClientLayoutEffect(() => {\n if (!isOpen || !toastHost || !toasts.current) return;\n return toastHost.register(toasts.current);\n }, [isOpen, toastHost]);\n\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n return () => {\n returnTo.current = reachable(returnTo.current);\n };\n }, [isOpen]);\n\n // DialogBase has opened it; move focus to the first control in the content, else the first action, else the\n // dialog itself (so the close button's tooltip does not pop up on open).\n useClientLayoutEffect(() => {\n if (!isOpen) return;\n const first =\n body.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n footer.current?.querySelector<HTMLElement>(FOCUSABLE) ??\n dialog.current;\n first?.focus({ preventScroll: true });\n }, [isOpen]);\n\n useDismiss({\n open: isOpen,\n onClose: dismiss,\n inside: [dialog],\n returnFocus: returnTo,\n // The dialog fills its container; a pointer down on the dialog itself (not the panel) is on the backdrop.\n outside: (event) => event.composedPath()[0] === dialog.current,\n });\n\n return (\n <DialogBase\n ref={dialog}\n open={isOpen}\n onCancel={dismiss}\n onClose={() => setOpen(false)}\n className={parts ? `cy-dialog ${parts.root}` : \"cy-dialog\"}\n tabIndex={-1}\n data-size={size}\n data-side={side}\n aria-labelledby={mounted ? `${id}-title` : undefined}\n aria-describedby={mounted && description ? `${id}-description` : undefined}\n >\n {mounted && (\n <div\n className={[\"cy-dialog-panel cy-reset\", parts?.panel, className].filter(Boolean).join(\" \")}\n style={style}\n >\n <div className=\"cy-dialog-header cy-reset\">\n <h2 id={`${id}-title`} className=\"cy-dialog-title cy-reset\">\n {title}\n </h2>\n {dismissible && (\n <IconButton\n icon={closeIcon}\n label={text.close}\n variant=\"ghost\"\n size=\"sm\"\n tooltipPlacement=\"bottom\"\n wrapperClassName=\"cy-dialog-close\"\n onClick={() => setOpen(false)}\n />\n )}\n </div>\n {description && (\n <p id={`${id}-description`} className=\"cy-dialog-description cy-reset\">\n {description}\n </p>\n )}\n {/* biome-ignore lint/a11y/noStaticElementInteractions: delegated focus listener for the controls inside */}\n <div\n ref={body}\n className=\"cy-dialog-body cy-reset\"\n // A focused field low in the content (Tab, or the on-screen keyboard opening) is brought fully into view.\n onFocus={(event) => event.target.scrollIntoView({ block: \"nearest\" })}\n >\n {children}\n </div>\n {actions && (\n <div\n ref={footer}\n className={parts ? `cy-dialog-actions cy-reset ${parts.actions}` : \"cy-dialog-actions cy-reset\"}\n >\n {actions}\n </div>\n )}\n </div>\n )}\n {toastHost && mounted && <div ref={toasts} className=\"cy-dialog-toasts\" />}\n </DialogBase>\n );\n}\n\n/**\n * Modal dialog in the top layer: focus moves in, stays in and comes back; Escape, the backdrop and the close button\n * dismiss it. In a container narrower than about 36rem it becomes a bottom sheet. Its content is mounted only while\n * it is open (and while it closes), unless `keepMounted`.\n */\nexport function Dialog(props: DialogProps) {\n return <DialogFrame {...props} />;\n}\n"],"mappings":";;;;;;;;;;AA0EA,IAAMe,KAA+B,EAAE,OAAO,QAAQ,GAChDC,IACJ;AAGF,SAASC,KAAiC;AACxC,MAAI,OAAO,WAAa,IAAa,QAAO;AAC5C,MAAIC,IAAS,SAAS;AACtB,SAAOA,GAAQ,YAAY,gBAAe,CAAAA,IAASA,EAAO,WAAW;AACrE,SAAOA;AACT;AAMA,SAASC,GAAUC,GAA4C;AAC7D,MAAI,CAACA,EAAI,QAAO;AAEhB,QAAMC,IAAUD,EAAG,QAAqB,eAAe;AAEvD,MAAI,EADWC,IAAU,CAACA,EAAQ,QAAQ,eAAe,IAAID,EAAG,kBAAkB,MAAM,IAC3E,QAAOA;AACpB,QAAME,IAAOF,EAAG,YAAY;AAC5B,UAAQC,KAAWC,EAAK,cAA2B,mBAAmB,IAAI,OAAOD,EAAQ,EAAE,CAAA,IAAK,MAAMD;AACxG;AAEA,SAAgBG,GAAY,EAC1B,MAAAC,GACA,aAAAC,IAAc,IACd,cAAAC,GACA,OAAAC,GACA,aAAAC,GACA,SAAAC,GACA,MAAAC,IAAO,MACP,aAAAC,IAAc,IACd,aAAAC,IAAc,IACd,Q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AlD,EAACU,IAAD,EAAa,GAAIwC,EAAQ,CAAA;AAClC"}
@@ -13,11 +13,15 @@ declare module "../../tokens/schema.js" {
13
13
  export interface DisclosureProps {
14
14
  /** The always-visible trigger text. */
15
15
  summary: ReactNode;
16
+ /** Whether the content is shown, when you control it. */
16
17
  open?: boolean;
18
+ /** Shown on first render when uncontrolled. */
17
19
  defaultOpen?: boolean;
20
+ /** Called with the new state when the trigger is pressed. */
18
21
  onOpenChange?: (open: boolean) => void;
19
22
  /** `plain` no chrome, `line` bottom divider, `card` bordered surface. */
20
23
  variant?: "plain" | "line" | "card";
24
+ /** Height of the trigger and size of the text. Default "md". */
21
25
  size?: Size;
22
26
  /** Wrap the trigger in a heading of this level (accordion sections in a document outline). */
23
27
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
@@ -27,10 +31,13 @@ export interface DisclosureProps {
27
31
  locked?: boolean;
28
32
  /** Keyboard handler on the trigger (Accordion uses it for arrow navigation). */
29
33
  onTriggerKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
34
+ /** Added to the root element, for layout. */
30
35
  className?: string;
31
36
  /** Layout only. */
32
37
  style?: CSSProperties;
38
+ /** The content that is shown and hidden. */
33
39
  children?: ReactNode;
40
+ /** Set on the root element, for tests. */
34
41
  "data-testid"?: string;
35
42
  }
36
43
  /** Show and hide a section behind a button. Replaces native <details> with an animated, themeable version. */