@arshad-shah/cynosure 0.3.0 → 0.5.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 (687) hide show
  1. package/README.md +6 -6
  2. package/dist/_virtual/_rolldown/runtime.js +12 -0
  3. package/dist/adapters/astro/index.d.ts +53 -0
  4. package/dist/adapters/astro/index.js +27 -0
  5. package/dist/adapters/astro/index.js.map +1 -0
  6. package/dist/adapters/vite/index.d.ts +11 -0
  7. package/dist/adapters/vite/index.js +33 -12
  8. package/dist/adapters/vite/index.js.map +1 -1
  9. package/dist/brands/googleplay.d.ts +2 -0
  10. package/dist/brands/googleplay.js +17 -0
  11. package/dist/brands/googleplay.js.map +1 -0
  12. package/dist/brands/index.d.ts +1 -0
  13. package/dist/brands/index.js +132 -130
  14. package/dist/components/Accordion/Accordion.d.ts +1 -1
  15. package/dist/components/Accordion/Accordion.js +26 -26
  16. package/dist/components/Accordion/Accordion.js.map +1 -1
  17. package/dist/components/Announcer/Announcer.d.ts +2 -1
  18. package/dist/components/Announcer/Announcer.js +32 -34
  19. package/dist/components/Announcer/Announcer.js.map +1 -1
  20. package/dist/components/AppShell/AppShell.js +41 -41
  21. package/dist/components/AppShell/AppShell.js.map +1 -1
  22. package/dist/components/Avatar/Avatar.js +20 -20
  23. package/dist/components/Avatar/Avatar.js.map +1 -1
  24. package/dist/components/Badge/Badge.d.ts +19 -5
  25. package/dist/components/Badge/Badge.js +19 -13
  26. package/dist/components/Badge/Badge.js.map +1 -1
  27. package/dist/components/Button/Button.d.ts +30 -6
  28. package/dist/components/Button/Button.js +50 -42
  29. package/dist/components/Button/Button.js.map +1 -1
  30. package/dist/components/Calendar/Calendar.js +158 -161
  31. package/dist/components/Calendar/Calendar.js.map +1 -1
  32. package/dist/components/Calendar/dates.js +42 -38
  33. package/dist/components/Calendar/dates.js.map +1 -1
  34. package/dist/components/Card/Card.d.ts +22 -2
  35. package/dist/components/Card/Card.js +60 -52
  36. package/dist/components/Card/Card.js.map +1 -1
  37. package/dist/components/ChatMessage/ChatMessage.d.ts +55 -0
  38. package/dist/components/ChatMessage/ChatMessage.js +50 -0
  39. package/dist/components/ChatMessage/ChatMessage.js.map +1 -0
  40. package/dist/components/ChatMessage/index.d.ts +1 -0
  41. package/dist/components/Checkbox/Checkbox.d.ts +4 -4
  42. package/dist/components/Checkbox/Checkbox.js +33 -8
  43. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  44. package/dist/components/Checklist/Checklist.js +21 -21
  45. package/dist/components/Checklist/Checklist.js.map +1 -1
  46. package/dist/components/Choice/Choice.d.ts +73 -0
  47. package/dist/components/Choice/Choice.js +41 -0
  48. package/dist/components/Choice/Choice.js.map +1 -0
  49. package/dist/components/Choice/index.d.ts +1 -0
  50. package/dist/components/CodeBlock/CodeBlock.d.ts +6 -1
  51. package/dist/components/CodeBlock/CodeBlock.js +40 -37
  52. package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
  53. package/dist/components/ColorField/ColorField.d.ts +3 -2
  54. package/dist/components/ColorField/ColorField.js +202 -212
  55. package/dist/components/ColorField/ColorField.js.map +1 -1
  56. package/dist/components/ColorField/read-color.js +5 -6
  57. package/dist/components/ColorField/read-color.js.map +1 -1
  58. package/dist/components/ColorSwatches/ColorSwatches.js +42 -33
  59. package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
  60. package/dist/components/Combobox/Combobox.d.ts +13 -2
  61. package/dist/components/Combobox/Combobox.js +118 -129
  62. package/dist/components/Combobox/Combobox.js.map +1 -1
  63. package/dist/components/CommandPalette/CommandPalette.d.ts +14 -1
  64. package/dist/components/CommandPalette/CommandPalette.js +153 -109
  65. package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
  66. package/dist/components/CommandPalette/index.d.ts +1 -1
  67. package/dist/components/CompareSlider/CompareSlider.js +14 -14
  68. package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
  69. package/dist/components/Container/Container.d.ts +2 -2
  70. package/dist/components/Container/Container.js +17 -13
  71. package/dist/components/Container/Container.js.map +1 -1
  72. package/dist/components/ContextMenu/ContextMenu.d.ts +27 -13
  73. package/dist/components/ContextMenu/ContextMenu.js +64 -46
  74. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  75. package/dist/components/CopyButton/CopyButton.js +41 -41
  76. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  77. package/dist/components/DataGrid/DataGrid.d.ts +135 -0
  78. package/dist/components/DataGrid/DataGrid.js +385 -0
  79. package/dist/components/DataGrid/DataGrid.js.map +1 -0
  80. package/dist/components/DataGrid/index.d.ts +1 -0
  81. package/dist/components/DateField/DateField.d.ts +4 -3
  82. package/dist/components/DateField/DateField.js +70 -59
  83. package/dist/components/DateField/DateField.js.map +1 -1
  84. package/dist/components/DeviceFrame/DeviceFrame.d.ts +63 -0
  85. package/dist/components/DeviceFrame/DeviceFrame.js +54 -0
  86. package/dist/components/DeviceFrame/DeviceFrame.js.map +1 -0
  87. package/dist/components/DeviceFrame/index.d.ts +1 -0
  88. package/dist/components/Dialog/Dialog.d.ts +10 -1
  89. package/dist/components/Dialog/Dialog.js +82 -81
  90. package/dist/components/Dialog/Dialog.js.map +1 -1
  91. package/dist/components/Disclosure/Disclosure.d.ts +15 -1
  92. package/dist/components/Disclosure/Disclosure.js +37 -30
  93. package/dist/components/Disclosure/Disclosure.js.map +1 -1
  94. package/dist/components/DocumentViewport/DocumentViewport.js +54 -57
  95. package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
  96. package/dist/components/EmptyState/EmptyState.d.ts +5 -2
  97. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  98. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +59 -0
  99. package/dist/components/ErrorBoundary/ErrorBoundary.js +53 -0
  100. package/dist/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
  101. package/dist/components/ErrorBoundary/index.d.ts +1 -0
  102. package/dist/components/Field/Field.d.ts +38 -5
  103. package/dist/components/Field/Field.js +48 -42
  104. package/dist/components/Field/Field.js.map +1 -1
  105. package/dist/components/Field/index.d.ts +1 -1
  106. package/dist/components/FileDrop/FileDrop.d.ts +26 -1
  107. package/dist/components/FileDrop/FileDrop.js +150 -99
  108. package/dist/components/FileDrop/FileDrop.js.map +1 -1
  109. package/dist/components/FloatingToolbar/FloatingToolbar.js +80 -77
  110. package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
  111. package/dist/components/Grid/Grid.d.ts +32 -11
  112. package/dist/components/Grid/Grid.js +78 -48
  113. package/dist/components/Grid/Grid.js.map +1 -1
  114. package/dist/components/Grid/index.d.ts +1 -1
  115. package/dist/components/Heading/Heading.d.ts +4 -2
  116. package/dist/components/Heading/Heading.js.map +1 -1
  117. package/dist/components/HighlightedText/HighlightedText.d.ts +40 -0
  118. package/dist/components/HighlightedText/HighlightedText.js +36 -0
  119. package/dist/components/HighlightedText/HighlightedText.js.map +1 -0
  120. package/dist/components/HighlightedText/index.d.ts +2 -0
  121. package/dist/components/HotkeyField/HotkeyField.d.ts +84 -0
  122. package/dist/components/HotkeyField/HotkeyField.js +161 -0
  123. package/dist/components/HotkeyField/HotkeyField.js.map +1 -0
  124. package/dist/components/HotkeyField/index.d.ts +1 -0
  125. package/dist/components/HoverCard/HoverCard.js +6 -6
  126. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  127. package/dist/components/IconButton/IconButton.d.ts +16 -1
  128. package/dist/components/IconButton/IconButton.js +20 -15
  129. package/dist/components/IconButton/IconButton.js.map +1 -1
  130. package/dist/components/IconTile/IconTile.d.ts +45 -0
  131. package/dist/components/IconTile/IconTile.js +25 -0
  132. package/dist/components/IconTile/IconTile.js.map +1 -0
  133. package/dist/components/IconTile/index.d.ts +1 -0
  134. package/dist/components/Image/Image.js.map +1 -1
  135. package/dist/components/Inline/Inline.d.ts +3 -3
  136. package/dist/components/Inline/Inline.js +12 -22
  137. package/dist/components/Inline/Inline.js.map +1 -1
  138. package/dist/components/Kbd/Kbd.d.ts +0 -2
  139. package/dist/components/Kbd/Kbd.js +16 -22
  140. package/dist/components/Kbd/Kbd.js.map +1 -1
  141. package/dist/components/KeyValueEditor/KeyValueEditor.js +37 -36
  142. package/dist/components/KeyValueEditor/KeyValueEditor.js.map +1 -1
  143. package/dist/components/KeyValueEditor/bulk.js +3 -4
  144. package/dist/components/KeyValueEditor/bulk.js.map +1 -1
  145. package/dist/components/Link/Link.d.ts +9 -1
  146. package/dist/components/Link/Link.js +20 -18
  147. package/dist/components/Link/Link.js.map +1 -1
  148. package/dist/components/List/List.d.ts +73 -0
  149. package/dist/components/List/List.js +64 -0
  150. package/dist/components/List/List.js.map +1 -0
  151. package/dist/components/List/index.d.ts +1 -0
  152. package/dist/components/ListRow/ListRow.d.ts +105 -0
  153. package/dist/components/ListRow/ListRow.js +164 -0
  154. package/dist/components/ListRow/ListRow.js.map +1 -0
  155. package/dist/components/ListRow/index.d.ts +1 -0
  156. package/dist/components/LoadingDots/LoadingDots.d.ts +7 -2
  157. package/dist/components/LoadingDots/LoadingDots.js +28 -18
  158. package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
  159. package/dist/components/Menu/Menu.d.ts +29 -11
  160. package/dist/components/Menu/Menu.js +204 -111
  161. package/dist/components/Menu/Menu.js.map +1 -1
  162. package/dist/components/Menubar/Menubar.d.ts +40 -0
  163. package/dist/components/Menubar/Menubar.js +82 -0
  164. package/dist/components/Menubar/Menubar.js.map +1 -0
  165. package/dist/components/Menubar/index.d.ts +1 -0
  166. package/dist/components/Notice/Notice.d.ts +11 -2
  167. package/dist/components/Notice/Notice.js +31 -27
  168. package/dist/components/Notice/Notice.js.map +1 -1
  169. package/dist/components/NumberField/NumberField.d.ts +8 -3
  170. package/dist/components/NumberField/NumberField.js +151 -100
  171. package/dist/components/NumberField/NumberField.js.map +1 -1
  172. package/dist/components/OptionList/OptionList.d.ts +102 -0
  173. package/dist/components/OptionList/OptionList.js +98 -0
  174. package/dist/components/OptionList/OptionList.js.map +1 -0
  175. package/dist/components/OptionList/index.d.ts +1 -0
  176. package/dist/components/OverlayFrame/OverlayFrame.d.ts +33 -0
  177. package/dist/components/OverlayFrame/OverlayFrame.js +20 -0
  178. package/dist/components/OverlayFrame/OverlayFrame.js.map +1 -0
  179. package/dist/components/OverlayFrame/index.d.ts +1 -0
  180. package/dist/components/PageHeader/PageHeader.d.ts +6 -0
  181. package/dist/components/PageHeader/PageHeader.js +27 -27
  182. package/dist/components/PageHeader/PageHeader.js.map +1 -1
  183. package/dist/components/Pagination/Pagination.js +31 -30
  184. package/dist/components/Pagination/Pagination.js.map +1 -1
  185. package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +71 -4
  186. package/dist/components/PanZoomCanvas/PanZoomCanvas.js +197 -141
  187. package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
  188. package/dist/components/PanZoomCanvas/index.d.ts +1 -1
  189. package/dist/components/PathField/PathField.d.ts +68 -0
  190. package/dist/components/PathField/PathField.js +67 -0
  191. package/dist/components/PathField/PathField.js.map +1 -0
  192. package/dist/components/PathField/index.d.ts +1 -0
  193. package/dist/components/Popover/Popover.d.ts +16 -3
  194. package/dist/components/Popover/Popover.js +51 -42
  195. package/dist/components/Popover/Popover.js.map +1 -1
  196. package/dist/components/ProgressBar/ProgressBar.d.ts +4 -3
  197. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  198. package/dist/components/QRCode/QRCode.d.ts +56 -0
  199. package/dist/components/QRCode/QRCode.js +48 -0
  200. package/dist/components/QRCode/QRCode.js.map +1 -0
  201. package/dist/components/QRCode/index.d.ts +1 -0
  202. package/dist/components/RadioGroup/RadioGroup.js +32 -24
  203. package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
  204. package/dist/components/RowActions/RowActions.d.ts +35 -0
  205. package/dist/components/RowActions/RowActions.js +38 -0
  206. package/dist/components/RowActions/RowActions.js.map +1 -0
  207. package/dist/components/RowActions/index.d.ts +1 -0
  208. package/dist/components/ScrollArea/ScrollArea.d.ts +55 -0
  209. package/dist/components/ScrollArea/ScrollArea.js +55 -0
  210. package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
  211. package/dist/components/ScrollArea/index.d.ts +1 -0
  212. package/dist/components/SearchField/SearchField.d.ts +17 -0
  213. package/dist/components/SearchField/SearchField.js +31 -17
  214. package/dist/components/SearchField/SearchField.js.map +1 -1
  215. package/dist/components/SearchField/index.d.ts +1 -1
  216. package/dist/components/Section/Section.d.ts +57 -0
  217. package/dist/components/Section/Section.js +27 -0
  218. package/dist/components/Section/Section.js.map +1 -0
  219. package/dist/components/Section/index.d.ts +1 -0
  220. package/dist/components/SegmentedControl/SegmentedControl.d.ts +6 -3
  221. package/dist/components/SegmentedControl/SegmentedControl.js +24 -20
  222. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  223. package/dist/components/Select/Select.d.ts +22 -6
  224. package/dist/components/Select/Select.js +155 -156
  225. package/dist/components/Select/Select.js.map +1 -1
  226. package/dist/components/SelectionFrame/frame-math.js +19 -20
  227. package/dist/components/SelectionFrame/frame-math.js.map +1 -1
  228. package/dist/components/Sheet/Sheet.js +12 -7
  229. package/dist/components/Sheet/Sheet.js.map +1 -1
  230. package/dist/components/SideNav/SideNav.d.ts +13 -1
  231. package/dist/components/SideNav/SideNav.js +100 -91
  232. package/dist/components/SideNav/SideNav.js.map +1 -1
  233. package/dist/components/SignaturePad/SignaturePad.js +63 -62
  234. package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
  235. package/dist/components/SignaturePad/ink.js +0 -1
  236. package/dist/components/SignaturePad/ink.js.map +1 -1
  237. package/dist/components/SiteFooter/SiteFooter.d.ts +66 -0
  238. package/dist/components/SiteFooter/SiteFooter.js +80 -0
  239. package/dist/components/SiteFooter/SiteFooter.js.map +1 -0
  240. package/dist/components/SiteFooter/index.d.ts +1 -0
  241. package/dist/components/SiteHeader/SiteHeader.d.ts +78 -0
  242. package/dist/components/SiteHeader/SiteHeader.js +114 -0
  243. package/dist/components/SiteHeader/SiteHeader.js.map +1 -0
  244. package/dist/components/SiteHeader/index.d.ts +1 -0
  245. package/dist/components/SkipLink/SkipLink.d.ts +42 -0
  246. package/dist/components/SkipLink/SkipLink.js +43 -0
  247. package/dist/components/SkipLink/SkipLink.js.map +1 -0
  248. package/dist/components/SkipLink/index.d.ts +1 -0
  249. package/dist/components/Slider/Slider.js +88 -91
  250. package/dist/components/Slider/Slider.js.map +1 -1
  251. package/dist/components/SortButton/SortButton.d.ts +36 -0
  252. package/dist/components/SortButton/SortButton.js +35 -0
  253. package/dist/components/SortButton/SortButton.js.map +1 -0
  254. package/dist/components/SortButton/index.d.ts +1 -0
  255. package/dist/components/SortableList/SortableList.js +146 -120
  256. package/dist/components/SortableList/SortableList.js.map +1 -1
  257. package/dist/components/SplitPane/SplitPane.d.ts +32 -12
  258. package/dist/components/SplitPane/SplitPane.js +105 -59
  259. package/dist/components/SplitPane/SplitPane.js.map +1 -1
  260. package/dist/components/Stack/Stack.d.ts +16 -7
  261. package/dist/components/Stack/Stack.js +32 -18
  262. package/dist/components/Stack/Stack.js.map +1 -1
  263. package/dist/components/Stack/index.d.ts +1 -1
  264. package/dist/components/Stat/Stat.d.ts +88 -0
  265. package/dist/components/Stat/Stat.js +105 -0
  266. package/dist/components/Stat/Stat.js.map +1 -0
  267. package/dist/components/Stat/index.d.ts +1 -0
  268. package/dist/components/StatusBar/StatusBar.d.ts +95 -0
  269. package/dist/components/StatusBar/StatusBar.js +110 -0
  270. package/dist/components/StatusBar/StatusBar.js.map +1 -0
  271. package/dist/components/StatusBar/index.d.ts +1 -0
  272. package/dist/components/Steps/Steps.d.ts +10 -4
  273. package/dist/components/Steps/Steps.js +31 -30
  274. package/dist/components/Steps/Steps.js.map +1 -1
  275. package/dist/components/Switch/Switch.d.ts +4 -4
  276. package/dist/components/Switch/Switch.js +18 -7
  277. package/dist/components/Switch/Switch.js.map +1 -1
  278. package/dist/components/Table/Table.d.ts +6 -6
  279. package/dist/components/Table/Table.js +73 -102
  280. package/dist/components/Table/Table.js.map +1 -1
  281. package/dist/components/Tabs/Tabs.d.ts +55 -6
  282. package/dist/components/Tabs/Tabs.js +288 -169
  283. package/dist/components/Tabs/Tabs.js.map +1 -1
  284. package/dist/components/TagInput/TagInput.d.ts +10 -2
  285. package/dist/components/TagInput/TagInput.js +137 -148
  286. package/dist/components/TagInput/TagInput.js.map +1 -1
  287. package/dist/components/Text/Text.d.ts +6 -0
  288. package/dist/components/Text/Text.js +18 -17
  289. package/dist/components/Text/Text.js.map +1 -1
  290. package/dist/components/TextArea/TextArea.d.ts +37 -6
  291. package/dist/components/TextArea/TextArea.js +200 -72
  292. package/dist/components/TextArea/TextArea.js.map +1 -1
  293. package/dist/components/TextArea/index.d.ts +1 -1
  294. package/dist/components/TextField/TextField.d.ts +22 -6
  295. package/dist/components/TextField/TextField.js +59 -53
  296. package/dist/components/TextField/TextField.js.map +1 -1
  297. package/dist/components/ThemeToggle/ThemeToggle.d.ts +7 -1
  298. package/dist/components/ThemeToggle/ThemeToggle.js +33 -30
  299. package/dist/components/ThemeToggle/ThemeToggle.js.map +1 -1
  300. package/dist/components/TimeField/TimeField.d.ts +4 -3
  301. package/dist/components/TimeField/TimeField.js +197 -183
  302. package/dist/components/TimeField/TimeField.js.map +1 -1
  303. package/dist/components/TitleBar/TitleBar.d.ts +91 -0
  304. package/dist/components/TitleBar/TitleBar.js +80 -0
  305. package/dist/components/TitleBar/TitleBar.js.map +1 -0
  306. package/dist/components/TitleBar/index.d.ts +1 -0
  307. package/dist/components/Toast/Toast.d.ts +17 -2
  308. package/dist/components/Toast/Toast.js +166 -147
  309. package/dist/components/Toast/Toast.js.map +1 -1
  310. package/dist/components/Toast/index.d.ts +1 -1
  311. package/dist/components/Toolbar/Toolbar.js +11 -12
  312. package/dist/components/Toolbar/Toolbar.js.map +1 -1
  313. package/dist/components/Tooltip/Tooltip.d.ts +23 -1
  314. package/dist/components/Tooltip/Tooltip.js +50 -31
  315. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  316. package/dist/components/Tree/Tree.d.ts +92 -11
  317. package/dist/components/Tree/Tree.js +332 -164
  318. package/dist/components/Tree/Tree.js.map +1 -1
  319. package/dist/components/VirtualList/VirtualList.d.ts +27 -4
  320. package/dist/components/VirtualList/VirtualList.js +179 -145
  321. package/dist/components/VirtualList/VirtualList.js.map +1 -1
  322. package/dist/components/VirtualList/index.d.ts +1 -1
  323. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +24 -0
  324. package/dist/components/VisuallyHidden/VisuallyHidden.js +17 -0
  325. package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
  326. package/dist/components/VisuallyHidden/index.d.ts +1 -0
  327. package/dist/components/ZoomControls/ZoomControls.d.ts +6 -2
  328. package/dist/components/ZoomControls/ZoomControls.js +37 -37
  329. package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
  330. package/dist/entries/tokens.js +22 -16
  331. package/dist/foundations/ChoiceBase/ChoiceBase.js +15 -13
  332. package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
  333. package/dist/foundations/HiddenValue/HiddenValue.js +5 -5
  334. package/dist/foundations/HiddenValue/HiddenValue.js.map +1 -1
  335. package/dist/foundations/Icon/Icon.d.ts +6 -1
  336. package/dist/foundations/Icon/Icon.js +15 -14
  337. package/dist/foundations/Icon/Icon.js.map +1 -1
  338. package/dist/foundations/LiveRegion/LiveRegion.d.ts +33 -0
  339. package/dist/foundations/LiveRegion/LiveRegion.js +29 -0
  340. package/dist/foundations/LiveRegion/LiveRegion.js.map +1 -0
  341. package/dist/foundations/LiveRegion/index.d.ts +1 -0
  342. package/dist/foundations/canvas-size.d.ts +14 -0
  343. package/dist/foundations/canvas-size.js +32 -0
  344. package/dist/foundations/canvas-size.js.map +1 -0
  345. package/dist/foundations/dir.js +0 -1
  346. package/dist/foundations/dir.js.map +1 -1
  347. package/dist/foundations/draft.d.ts +14 -0
  348. package/dist/foundations/draft.js +22 -0
  349. package/dist/foundations/draft.js.map +1 -0
  350. package/dist/foundations/edge.d.ts +20 -0
  351. package/dist/foundations/edge.js +26 -0
  352. package/dist/foundations/edge.js.map +1 -0
  353. package/dist/foundations/focus.d.ts +5 -0
  354. package/dist/foundations/focus.js +10 -0
  355. package/dist/foundations/focus.js.map +1 -0
  356. package/dist/foundations/hotkey.d.ts +23 -1
  357. package/dist/foundations/hotkey.js +48 -26
  358. package/dist/foundations/hotkey.js.map +1 -1
  359. package/dist/foundations/icon-size.d.ts +7 -0
  360. package/dist/foundations/icon-size.js +6 -0
  361. package/dist/foundations/icon-size.js.map +1 -0
  362. package/dist/foundations/image-outcome.d.ts +8 -3
  363. package/dist/foundations/image-outcome.js +12 -8
  364. package/dist/foundations/image-outcome.js.map +1 -1
  365. package/dist/foundations/keys.js +12 -13
  366. package/dist/foundations/keys.js.map +1 -1
  367. package/dist/foundations/layout.d.ts +81 -0
  368. package/dist/foundations/layout.js +29 -0
  369. package/dist/foundations/layout.js.map +1 -0
  370. package/dist/foundations/listbox.d.ts +47 -2
  371. package/dist/foundations/listbox.js +56 -25
  372. package/dist/foundations/listbox.js.map +1 -1
  373. package/dist/foundations/math.d.ts +25 -0
  374. package/dist/foundations/math.js +14 -3
  375. package/dist/foundations/math.js.map +1 -1
  376. package/dist/foundations/media-query.d.ts +5 -0
  377. package/dist/foundations/media-query.js +14 -0
  378. package/dist/foundations/media-query.js.map +1 -0
  379. package/dist/foundations/motion.d.ts +12 -0
  380. package/dist/foundations/motion.js +21 -0
  381. package/dist/foundations/motion.js.map +1 -0
  382. package/dist/foundations/option-icon.d.ts +3 -1
  383. package/dist/foundations/option-icon.js +6 -6
  384. package/dist/foundations/option-icon.js.map +1 -1
  385. package/dist/foundations/printing.d.ts +6 -0
  386. package/dist/foundations/printing.js +17 -0
  387. package/dist/foundations/printing.js.map +1 -0
  388. package/dist/foundations/qr.d.ts +42 -0
  389. package/dist/foundations/qr.js +245 -0
  390. package/dist/foundations/qr.js.map +1 -0
  391. package/dist/foundations/refs.d.ts +8 -0
  392. package/dist/foundations/refs.js +14 -0
  393. package/dist/foundations/refs.js.map +1 -0
  394. package/dist/foundations/reorder.js +5 -6
  395. package/dist/foundations/reorder.js.map +1 -1
  396. package/dist/foundations/roving-focus.d.ts +10 -0
  397. package/dist/foundations/roving-focus.js +34 -31
  398. package/dist/foundations/roving-focus.js.map +1 -1
  399. package/dist/foundations/scroll-align.d.ts +11 -0
  400. package/dist/foundations/scroll-align.js +8 -0
  401. package/dist/foundations/scroll-align.js.map +1 -0
  402. package/dist/foundations/sort.d.ts +13 -0
  403. package/dist/foundations/sort.js +26 -0
  404. package/dist/foundations/sort.js.map +1 -0
  405. package/dist/foundations/text-match.d.ts +11 -0
  406. package/dist/foundations/text-match.js +20 -0
  407. package/dist/foundations/text-match.js.map +1 -0
  408. package/dist/foundations/tone-icons.js +4 -5
  409. package/dist/foundations/tone-icons.js.map +1 -1
  410. package/dist/foundations/use-follow.d.ts +29 -0
  411. package/dist/foundations/use-follow.js +51 -0
  412. package/dist/foundations/use-follow.js.map +1 -0
  413. package/dist/foundations/virtual-window.d.ts +22 -5
  414. package/dist/foundations/virtual-window.js +58 -54
  415. package/dist/foundations/virtual-window.js.map +1 -1
  416. package/dist/foundations/zoom-gestures.d.ts +23 -1
  417. package/dist/foundations/zoom-gestures.js +123 -84
  418. package/dist/foundations/zoom-gestures.js.map +1 -1
  419. package/dist/foundations/zoom.d.ts +10 -4
  420. package/dist/foundations/zoom.js +16 -17
  421. package/dist/foundations/zoom.js.map +1 -1
  422. package/dist/icons/book-marked.d.ts +2 -0
  423. package/dist/icons/book-marked.js +14 -0
  424. package/dist/icons/book-marked.js.map +1 -0
  425. package/dist/icons/boxes.d.ts +2 -0
  426. package/dist/icons/boxes.js +34 -0
  427. package/dist/icons/boxes.js.map +1 -0
  428. package/dist/icons/by-name.d.ts +11 -0
  429. package/dist/icons/by-name.js +11 -0
  430. package/dist/icons/by-name.js.map +1 -0
  431. package/dist/icons/cable.d.ts +2 -0
  432. package/dist/icons/cable.js +14 -0
  433. package/dist/icons/cable.js.map +1 -0
  434. package/dist/icons/calendar-days.d.ts +2 -0
  435. package/dist/icons/calendar-days.js +24 -0
  436. package/dist/icons/calendar-days.js.map +1 -0
  437. package/dist/icons/check-check.d.ts +2 -0
  438. package/dist/icons/check-check.js +17 -0
  439. package/dist/icons/check-check.js.map +1 -0
  440. package/dist/icons/check-square.d.ts +2 -0
  441. package/dist/icons/check-square.js +14 -0
  442. package/dist/icons/check-square.js.map +1 -0
  443. package/dist/icons/clipboard-paste.d.ts +2 -0
  444. package/dist/icons/clipboard-paste.js +30 -0
  445. package/dist/icons/clipboard-paste.js.map +1 -0
  446. package/dist/icons/crescent.d.ts +2 -0
  447. package/dist/icons/crescent.js +14 -0
  448. package/dist/icons/crescent.js.map +1 -0
  449. package/dist/icons/facet.d.ts +274 -0
  450. package/dist/icons/facet.js +830 -0
  451. package/dist/icons/facet.js.map +1 -0
  452. package/dist/icons/file-plus.d.ts +2 -0
  453. package/dist/icons/file-plus.js +14 -0
  454. package/dist/icons/file-plus.js.map +1 -0
  455. package/dist/icons/file-question.d.ts +2 -0
  456. package/dist/icons/file-question.js +14 -0
  457. package/dist/icons/file-question.js.map +1 -0
  458. package/dist/icons/file-search.d.ts +2 -0
  459. package/dist/icons/file-search.js +24 -0
  460. package/dist/icons/file-search.js.map +1 -0
  461. package/dist/icons/function.d.ts +2 -0
  462. package/dist/icons/function.js +20 -0
  463. package/dist/icons/function.js.map +1 -0
  464. package/dist/icons/gauge.d.ts +2 -0
  465. package/dist/icons/gauge.js +14 -0
  466. package/dist/icons/gauge.js.map +1 -0
  467. package/dist/icons/hourglass.d.ts +2 -0
  468. package/dist/icons/hourglass.js +14 -0
  469. package/dist/icons/hourglass.js.map +1 -0
  470. package/dist/icons/index.d.ts +1 -240
  471. package/dist/icons/index.js +546 -478
  472. package/dist/icons/kaaba.d.ts +2 -0
  473. package/dist/icons/kaaba.js +14 -0
  474. package/dist/icons/kaaba.js.map +1 -0
  475. package/dist/icons/keywords.d.ts +35 -1
  476. package/dist/icons/keywords.js +274 -1
  477. package/dist/icons/keywords.js.map +1 -1
  478. package/dist/icons/languages.d.ts +2 -0
  479. package/dist/icons/languages.js +14 -0
  480. package/dist/icons/languages.js.map +1 -0
  481. package/dist/icons/list-tree.d.ts +2 -0
  482. package/dist/icons/list-tree.js +14 -0
  483. package/dist/icons/list-tree.js.map +1 -0
  484. package/dist/icons/loader.d.ts +2 -0
  485. package/dist/icons/loader.js +14 -0
  486. package/dist/icons/loader.js.map +1 -0
  487. package/dist/icons/monitor-down.d.ts +2 -0
  488. package/dist/icons/monitor-down.js +24 -0
  489. package/dist/icons/monitor-down.js.map +1 -0
  490. package/dist/icons/mosque.d.ts +2 -0
  491. package/dist/icons/mosque.js +14 -0
  492. package/dist/icons/mosque.js.map +1 -0
  493. package/dist/icons/panel-right.d.ts +2 -0
  494. package/dist/icons/panel-right.js +20 -0
  495. package/dist/icons/panel-right.js.map +1 -0
  496. package/dist/icons/party-popper.d.ts +2 -0
  497. package/dist/icons/party-popper.js +14 -0
  498. package/dist/icons/party-popper.js.map +1 -0
  499. package/dist/icons/power-off.d.ts +2 -0
  500. package/dist/icons/power-off.js +14 -0
  501. package/dist/icons/power-off.js.map +1 -0
  502. package/dist/icons/prayer-beads.d.ts +2 -0
  503. package/dist/icons/prayer-beads.js +67 -0
  504. package/dist/icons/prayer-beads.js.map +1 -0
  505. package/dist/icons/qr-code.d.ts +2 -0
  506. package/dist/icons/qr-code.js +38 -0
  507. package/dist/icons/qr-code.js.map +1 -0
  508. package/dist/icons/refresh-cw.d.ts +2 -0
  509. package/dist/icons/refresh-cw.js +14 -0
  510. package/dist/icons/refresh-cw.js.map +1 -0
  511. package/dist/icons/rocket.d.ts +2 -0
  512. package/dist/icons/rocket.js +21 -0
  513. package/dist/icons/rocket.js.map +1 -0
  514. package/dist/icons/rows.d.ts +2 -0
  515. package/dist/icons/rows.js +20 -0
  516. package/dist/icons/rows.js.map +1 -0
  517. package/dist/icons/scissors.d.ts +2 -0
  518. package/dist/icons/scissors.js +26 -0
  519. package/dist/icons/scissors.js.map +1 -0
  520. package/dist/icons/shield-question.d.ts +2 -0
  521. package/dist/icons/shield-question.js +14 -0
  522. package/dist/icons/shield-question.js.map +1 -0
  523. package/dist/icons/square-plus.d.ts +2 -0
  524. package/dist/icons/square-plus.js +20 -0
  525. package/dist/icons/square-plus.js.map +1 -0
  526. package/dist/icons/text-select.d.ts +2 -0
  527. package/dist/icons/text-select.js +14 -0
  528. package/dist/icons/text-select.js.map +1 -0
  529. package/dist/icons/types.d.ts +1 -1
  530. package/dist/icons/types.js +2 -1
  531. package/dist/icons/types.js.map +1 -1
  532. package/dist/icons/window-maximize.d.ts +2 -0
  533. package/dist/icons/window-maximize.js +14 -0
  534. package/dist/icons/window-maximize.js.map +1 -0
  535. package/dist/icons/window-restore.d.ts +2 -0
  536. package/dist/icons/window-restore.js +20 -0
  537. package/dist/icons/window-restore.js.map +1 -0
  538. package/dist/index.d.ts +38 -9
  539. package/dist/index.js +326 -249
  540. package/dist/overlay/dismiss.js +15 -13
  541. package/dist/overlay/dismiss.js.map +1 -1
  542. package/dist/overlay/floating.d.ts +7 -2
  543. package/dist/overlay/floating.js +29 -21
  544. package/dist/overlay/floating.js.map +1 -1
  545. package/dist/overlay/listbox-layer.d.ts +3 -2
  546. package/dist/overlay/listbox-layer.js.map +1 -1
  547. package/dist/overlay/position.d.ts +5 -2
  548. package/dist/overlay/position.js +19 -19
  549. package/dist/overlay/position.js.map +1 -1
  550. package/dist/overlay/toast-host.js +3 -2
  551. package/dist/overlay/toast-host.js.map +1 -1
  552. package/dist/overlay/use-anchored-position.d.ts +2 -2
  553. package/dist/overlay/use-anchored-position.js +25 -25
  554. package/dist/overlay/use-anchored-position.js.map +1 -1
  555. package/dist/styles/announcer.css +1 -1
  556. package/dist/styles/app-shell.css +1 -1
  557. package/dist/styles/avatar.css +1 -1
  558. package/dist/styles/badge.css +1 -1
  559. package/dist/styles/base.css +1 -1
  560. package/dist/styles/button.css +1 -1
  561. package/dist/styles/calendar.css +1 -1
  562. package/dist/styles/card.css +1 -1
  563. package/dist/styles/chat-message.css +1 -0
  564. package/dist/styles/checkbox.css +1 -1
  565. package/dist/styles/choice-base.css +1 -0
  566. package/dist/styles/choice.css +1 -1
  567. package/dist/styles/code-block.css +1 -1
  568. package/dist/styles/color-field.css +1 -1
  569. package/dist/styles/combobox.css +1 -1
  570. package/dist/styles/command-palette.css +1 -1
  571. package/dist/styles/copy-button.css +1 -1
  572. package/dist/styles/data-grid.css +1 -0
  573. package/dist/styles/date-field.css +1 -1
  574. package/dist/styles/device-frame.css +1 -0
  575. package/dist/styles/dialog.css +1 -1
  576. package/dist/styles/disclosure.css +1 -1
  577. package/dist/styles/error-boundary.css +1 -0
  578. package/dist/styles/field.css +1 -1
  579. package/dist/styles/file-drop.css +1 -1
  580. package/dist/styles/floating-toolbar.css +1 -1
  581. package/dist/styles/generated-css.d.ts +1 -1
  582. package/dist/styles/generated-css.js +3 -3
  583. package/dist/styles/generated-css.js.map +1 -1
  584. package/dist/styles/grid.css +1 -1
  585. package/dist/styles/heading.css +1 -1
  586. package/dist/styles/highlighted-text.css +1 -0
  587. package/dist/styles/hotkey-field.css +1 -0
  588. package/dist/styles/icon-tile.css +1 -0
  589. package/dist/styles/icon.css +1 -1
  590. package/dist/styles/inline.css +1 -0
  591. package/dist/styles/key-value-editor.css +1 -1
  592. package/dist/styles/link.css +1 -1
  593. package/dist/styles/list-row.css +1 -0
  594. package/dist/styles/list.css +1 -0
  595. package/dist/styles/loading-dots.css +1 -1
  596. package/dist/styles/manifest.json +852 -0
  597. package/dist/styles/menu.css +1 -1
  598. package/dist/styles/menubar.css +1 -0
  599. package/dist/styles/notice.css +1 -1
  600. package/dist/styles/number-field.css +1 -1
  601. package/dist/styles/option-list.css +1 -0
  602. package/dist/styles/overlay-frame.css +1 -0
  603. package/dist/styles/pagination.css +1 -1
  604. package/dist/styles/pan-zoom-canvas.css +1 -1
  605. package/dist/styles/path-field.css +1 -0
  606. package/dist/styles/popover.css +1 -1
  607. package/dist/styles/progress-bar.css +1 -1
  608. package/dist/styles/qr-code.css +1 -0
  609. package/dist/styles/radio-group.css +1 -1
  610. package/dist/styles/row-actions.css +1 -0
  611. package/dist/styles/scroll-area.css +1 -0
  612. package/dist/styles/search-field.css +1 -1
  613. package/dist/styles/section.css +1 -0
  614. package/dist/styles/segmented-control.css +1 -1
  615. package/dist/styles/select.css +1 -1
  616. package/dist/styles/sheet.css +1 -1
  617. package/dist/styles/side-nav.css +1 -1
  618. package/dist/styles/site-footer.css +1 -0
  619. package/dist/styles/site-header.css +1 -0
  620. package/dist/styles/skip-link.css +1 -0
  621. package/dist/styles/sort-button.css +1 -0
  622. package/dist/styles/sortable-list.css +1 -1
  623. package/dist/styles/split-pane.css +1 -1
  624. package/dist/styles/stack.css +1 -1
  625. package/dist/styles/stat.css +1 -0
  626. package/dist/styles/status-bar.css +1 -0
  627. package/dist/styles/steps.css +1 -1
  628. package/dist/styles/switch.css +1 -0
  629. package/dist/styles/table.css +1 -1
  630. package/dist/styles/tabs.css +1 -1
  631. package/dist/styles/tag-input.css +1 -1
  632. package/dist/styles/text-area.css +1 -1
  633. package/dist/styles/text-field.css +1 -1
  634. package/dist/styles/text.css +1 -1
  635. package/dist/styles/time-field.css +1 -1
  636. package/dist/styles/title-bar.css +1 -0
  637. package/dist/styles/toast.css +1 -1
  638. package/dist/styles/tokens.css +3 -3
  639. package/dist/styles/tree.css +1 -1
  640. package/dist/styles/virtual-list.css +1 -1
  641. package/dist/styles/visually-hidden.css +1 -0
  642. package/dist/styles.css +3 -3
  643. package/dist/theme/CynosureTheme.d.ts +7 -3
  644. package/dist/theme/CynosureTheme.js +47 -31
  645. package/dist/theme/CynosureTheme.js.map +1 -1
  646. package/dist/theme/index.d.ts +1 -0
  647. package/dist/theme/theme-context.d.ts +9 -0
  648. package/dist/theme/theme-context.js +8 -0
  649. package/dist/theme/theme-context.js.map +1 -0
  650. package/dist/theme/theme-init-script.js +0 -1
  651. package/dist/theme/theme-init-script.js.map +1 -1
  652. package/dist/theme/use-color-mode.d.ts +3 -2
  653. package/dist/theme/use-color-mode.js +35 -38
  654. package/dist/theme/use-color-mode.js.map +1 -1
  655. package/dist/theme/use-cynosure-theme.d.ts +18 -0
  656. package/dist/theme/use-cynosure-theme.js +23 -0
  657. package/dist/theme/use-cynosure-theme.js.map +1 -0
  658. package/dist/tokens/chart-themes.d.ts +38 -0
  659. package/dist/tokens/chart-themes.js +35 -0
  660. package/dist/tokens/chart-themes.js.map +1 -0
  661. package/dist/tokens/create-theme.d.ts +11 -1
  662. package/dist/tokens/create-theme.js +194 -125
  663. package/dist/tokens/create-theme.js.map +1 -1
  664. package/dist/tokens/defaults.d.ts +3 -3
  665. package/dist/tokens/defaults.js +1 -0
  666. package/dist/tokens/defaults.js.map +1 -1
  667. package/dist/tokens/editor-themes.d.ts +9 -2
  668. package/dist/tokens/editor-themes.js +43 -42
  669. package/dist/tokens/editor-themes.js.map +1 -1
  670. package/dist/tokens/index.d.ts +3 -1
  671. package/dist/tokens/named-themes.d.ts +41 -0
  672. package/dist/tokens/named-themes.js +118 -0
  673. package/dist/tokens/named-themes.js.map +1 -0
  674. package/dist/tokens/schema.d.ts +24 -1
  675. package/dist/tokens/schema.js +13 -0
  676. package/dist/tokens/schema.js.map +1 -0
  677. package/dist/tokens/to-css.js +34 -31
  678. package/dist/tokens/to-css.js.map +1 -1
  679. package/package.json +15 -6
  680. package/dist/components/Checkbox/ChoiceRow.d.ts +0 -39
  681. package/dist/components/Checkbox/ChoiceRow.js +0 -58
  682. package/dist/components/Checkbox/ChoiceRow.js.map +0 -1
  683. package/dist/components/Stack/space.d.ts +0 -18
  684. package/dist/components/Stack/space.js +0 -12
  685. package/dist/components/Stack/space.js.map +0 -1
  686. package/dist/styles/hidden-value.css +0 -1
  687. package/dist/styles/iconbutton.css +0 -1
@@ -1,202 +1,221 @@
1
1
  "use client";
2
- import { Icon as J } from "../../foundations/Icon/Icon.js";
3
- import { useClientLayoutEffect as z } from "../../foundations/client-layout-effect.js";
4
- import { Button as K } from "../Button/Button.js";
5
- import { IconButton as Q } from "../IconButton/IconButton.js";
6
- import { close as Y } from "../../icons/close.js";
7
- import { ToastHostContext as Z } from "../../overlay/toast-host.js";
8
- import { space as tt } from "../Stack/space.js";
9
- import { TONE_ICONS as et } from "../../foundations/tone-icons.js";
10
- import { createContext as nt, useCallback as D, useContext as ot, useEffect as E, useId as rt, useMemo as X, useRef as I, useState as v } from "react";
11
- import { Fragment as st, jsx as m, jsxs as M } from "react/jsx-runtime";
12
- import { createPortal as it } from "react-dom";
13
- var at = {
2
+ import { Icon as tt } from "../../foundations/Icon/Icon.js";
3
+ import { useClientLayoutEffect as W } from "../../foundations/client-layout-effect.js";
4
+ import { LoadingDots as et } from "../LoadingDots/LoadingDots.js";
5
+ import { Button as nt } from "../Button/Button.js";
6
+ import { deepActiveElement as ot } from "../../foundations/focus.js";
7
+ import { IconButton as rt } from "../IconButton/IconButton.js";
8
+ import { transitionTime as st } from "../../foundations/motion.js";
9
+ import { close as it } from "../../icons/close.js";
10
+ import { ToastHostContext as ct } from "../../overlay/toast-host.js";
11
+ import { useDrag as at } from "../../foundations/drag.js";
12
+ import { space as ut } from "../../foundations/layout.js";
13
+ import { TONE_ICONS as lt } from "../../foundations/tone-icons.js";
14
+ import { createContext as dt, useCallback as L, useContext as mt, useEffect as k, useId as ft, useMemo as V, useRef as A, useState as g } from "react";
15
+ import { Fragment as vt, jsx as v, jsxs as H } from "react/jsx-runtime";
16
+ import { createPortal as pt } from "react-dom";
17
+ var gt = {
14
18
  region: "Notifications",
15
19
  dismiss: "Dismiss"
16
- }, ct = 64, q = (o) => /^(\d|10)$/.test(o) ? tt(o) : o;
17
- function lt(o) {
18
- const { block: a, inline: g } = typeof o == "object" ? o : { block: o }, y = {};
19
- return a && (y["--_offset-block"] = q(a)), g && (y["--_offset-inline"] = q(g)), y;
20
+ }, yt = 64, U = (n) => /^(\d|10)$/.test(n) ? ut(n) : n;
21
+ function ht(n) {
22
+ const { block: d, inline: y } = typeof n == "object" ? n : { block: n }, h = {};
23
+ return d && (h["--_offset-block"] = U(d)), y && (h["--_offset-inline"] = U(y)), h;
20
24
  }
21
- var O = nt(null);
22
- function Pt() {
23
- const o = ot(O);
24
- if (!o) throw new Error("useToast() needs a <Toaster> around it.");
25
- return o;
25
+ var G = dt(null);
26
+ function $t() {
27
+ const n = mt(G);
28
+ if (!n) throw new Error("useToast() needs a <Toaster> around it.");
29
+ return n;
26
30
  }
27
- function wt({ position: o = "bottom-end", max: a = 3, offset: g, labels: y, className: h, style: N, children: S }) {
28
- const r = {
29
- ...at,
30
- ...y
31
- }, L = rt(), w = I(0), [c, T] = v([]), [x, l] = v(!1), [f, s] = v(!1), [F, b] = v(!1), d = I(null), k = I(/* @__PURE__ */ new Map()), [_, C] = v([]), e = X(() => ({ register: (t) => (C((i) => [...i, t]), () => C((i) => i.filter((u) => u !== t))) }), []), n = _.at(-1) ?? null, p = D((t) => {
32
- k.current.delete(t), T((i) => i.filter((u) => u.id !== t));
33
- }, []), $ = D((t) => {
34
- const i = d.current?.ownerDocument.activeElement, u = i?.closest(".cy-toast");
35
- if (u && d.current?.contains(u) && (t === void 0 || u.dataset.id === t)) {
36
- const B = [...d.current.querySelectorAll(".cy-toast:not([data-collapsed]):not([data-leaving])")], P = t === void 0 ? void 0 : B.find((G) => G !== u), j = P ? [...P.querySelectorAll("button")].at(-1) : void 0;
37
- j ? j.focus() : (i.blur(), s(!1));
31
+ function Bt({ position: n = "bottom-end", max: d = 3, offset: y, labels: h, className: b, style: I, children: D }) {
32
+ const c = {
33
+ ...gt,
34
+ ...h
35
+ }, C = ft(), F = A(0), [T, x] = g([]), u = A([]), a = L((t) => {
36
+ u.current = t, x(t);
37
+ }, []), [N, m] = g(!1), [o, s] = g(!1), [_, w] = g(!1), E = A(null), P = A(/* @__PURE__ */ new Map()), [e, i] = g([]), $ = V(() => ({ register: (t) => (i((f) => [...f, t]), () => i((f) => f.filter((l) => l !== t))) }), []), B = e.at(-1) ?? null, J = L((t) => {
38
+ P.current.delete(t), a(u.current.filter((f) => f.id !== t));
39
+ }, [a]), M = L((t, f) => {
40
+ const l = u.current.filter((r) => !r.leaving && (t === void 0 || r.id === t));
41
+ if (l.length === 0) return;
42
+ const S = ot(E.current?.ownerDocument), p = S?.closest(".cy-toast");
43
+ if (p && E.current?.contains(p) && (t === void 0 || p.dataset.id === t)) {
44
+ const r = [...E.current.querySelectorAll(".cy-toast:not([data-collapsed]):not([data-leaving])")], O = t === void 0 ? void 0 : r.find((Z) => Z !== p), R = O ? [...O.querySelectorAll("button")].at(-1) : void 0;
45
+ R ? R.focus() : (S.blur(), s(!1));
38
46
  }
39
- T((B) => B.map((P) => t === void 0 || P.id === t ? {
40
- ...P,
47
+ a(u.current.map((r) => l.includes(r) ? {
48
+ ...r,
41
49
  leaving: !0
42
- } : P));
43
- }, []), A = D((t) => {
44
- w.current += 1;
45
- const i = `${L}-${w.current}`;
46
- return T((u) => [...u, {
47
- ...t,
48
- id: i
49
- }]), i;
50
- }, [L]), R = X(() => ({
51
- toast: A,
52
- dismiss: $
53
- }), [A, $]);
54
- z(() => {
55
- const t = d.current;
50
+ } : r));
51
+ for (const r of l) r.onDismiss?.(r.id, f);
52
+ }, [a]), j = L((t) => M(t, "programmatic"), [M]), z = L(({ id: t, ...f }) => {
53
+ const l = t === void 0 ? void 0 : u.current.find((p) => p.id === t);
54
+ if (l) {
55
+ const p = {
56
+ ...f,
57
+ id: l.id,
58
+ version: l.version + 1
59
+ };
60
+ return a(u.current.map((r) => r === l ? p : r)), l.id;
61
+ }
62
+ F.current += 1;
63
+ const S = t ?? `${C}-${F.current}`;
64
+ return a([...u.current, {
65
+ ...f,
66
+ id: S,
67
+ version: 0
68
+ }]), S;
69
+ }, [C, a]), K = V(() => ({
70
+ toast: z,
71
+ dismiss: j
72
+ }), [z, j]);
73
+ W(() => {
74
+ const t = E.current;
56
75
  return t?.showPopover?.(), () => {
57
76
  t?.matches(":popover-open") && t.hidePopover?.();
58
77
  };
59
- }, [n]), E(() => {
60
- const t = () => b(document.visibilityState === "hidden");
78
+ }, [B]), k(() => {
79
+ const t = () => w(document.visibilityState === "hidden");
61
80
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
62
- }, []), E(() => {
63
- f && !c.some((t) => !t.leaving) && s(!1);
64
- }, [f, c]);
65
- const U = c.filter((t) => !t.leaving), V = new Set(U.slice(-a).map((t) => t.id)), W = x || f || F, H = /* @__PURE__ */ m("section", {
66
- ref: d,
67
- "aria-label": r.region,
81
+ }, []), k(() => {
82
+ o && !T.some((t) => !t.leaving) && s(!1);
83
+ }, [o, T]);
84
+ const Q = T.filter((t) => !t.leaving), X = new Set(Q.slice(-d).map((t) => t.id)), Y = N || o || _, q = /* @__PURE__ */ v("section", {
85
+ ref: E,
86
+ "aria-label": c.region,
68
87
  popover: "manual",
69
- className: h ? `cy-toaster ${h}` : "cy-toaster",
70
- "data-position": o,
88
+ className: b ? `cy-toaster ${b}` : "cy-toaster",
89
+ "data-position": n,
71
90
  style: {
72
- ...lt(g),
73
- ...N
91
+ ...ht(y),
92
+ ...I
74
93
  },
75
- onPointerEnter: () => l(!0),
76
- onPointerLeave: () => l(!1),
94
+ onPointerEnter: () => m(!0),
95
+ onPointerLeave: () => m(!1),
77
96
  onFocus: () => s(!0),
78
97
  onBlur: (t) => {
79
98
  t.currentTarget.contains(t.relatedTarget) || s(!1);
80
99
  },
81
- children: c.map((t) => /* @__PURE__ */ m(ut, {
100
+ children: T.map((t) => /* @__PURE__ */ v(bt, {
82
101
  item: t,
83
- collapsed: !t.leaving && !V.has(t.id),
84
- paused: W,
85
- dismissLabel: r.dismiss,
86
- onDismiss: $,
87
- onRemoved: p,
88
- memory: k.current
102
+ collapsed: !t.leaving && !X.has(t.id),
103
+ paused: Y,
104
+ dismissLabel: c.dismiss,
105
+ onDismiss: M,
106
+ onRemoved: J,
107
+ memory: P.current
89
108
  }, t.id))
90
109
  });
91
- return /* @__PURE__ */ M(O.Provider, {
92
- value: R,
93
- children: [/* @__PURE__ */ m(Z.Provider, {
94
- value: e,
95
- children: S
96
- }), n ? it(H, n) : H]
110
+ return /* @__PURE__ */ H(G.Provider, {
111
+ value: K,
112
+ children: [/* @__PURE__ */ v(ct.Provider, {
113
+ value: $,
114
+ children: D
115
+ }), B ? pt(q, B) : q]
97
116
  });
98
117
  }
99
- function ut({ item: o, collapsed: a, paused: g, dismissLabel: y, onDismiss: h, onRemoved: N, memory: S }) {
100
- const { id: r, title: L, description: w, tone: c = "neutral", action: T, duration: x = 5e3, leaving: l = !1 } = o, f = I(null), [s] = v(() => {
101
- const e = S.get(r) ?? { announced: !1 };
102
- return S.set(r, e), e;
103
- }), [F] = v(s.announced), b = I(null), [d, k] = v(s.announced);
104
- E(() => {
105
- if (d) return;
118
+ function bt({ item: n, collapsed: d, paused: y, dismissLabel: h, onDismiss: b, onRemoved: I, memory: D }) {
119
+ const { id: c, version: C, title: F, description: T, tone: x = "neutral", action: u, duration: a = 5e3, loading: N = !1, leaving: m = !1 } = n, o = A(null), [s] = g(() => {
120
+ const e = D.get(c) ?? { announced: !1 };
121
+ return D.set(c, e), e;
122
+ }), [_] = g(s.announced), [w, E] = g(s.announced);
123
+ k(() => {
124
+ if (w) return;
106
125
  const e = setTimeout(() => {
107
- s.announced = !0, k(!0);
126
+ s.announced = !0, E(!0);
108
127
  }, 50);
109
128
  return () => clearTimeout(e);
110
- }, [d, s]), z(() => {
111
- f.current && (f.current.inert = a || l);
112
- }, [a, l]), E(() => {
113
- if (g || a || l || !Number.isFinite(x) || x <= 0) return;
114
- const e = Date.now(), n = s.remaining ?? x, p = setTimeout(() => h(r), Math.max(n, 0));
129
+ }, [w, s]), W(() => {
130
+ o.current && (o.current.inert = d || m);
131
+ }, [d, m]), k(() => {
132
+ if (y || d || m || N || !Number.isFinite(a) || a <= 0) return;
133
+ const e = Date.now(), i = s.remaining?.version === C ? s.remaining.ms : a, $ = setTimeout(() => b(c, "timeout"), Math.max(i, 0));
115
134
  return () => {
116
- clearTimeout(p), s.remaining = n - (Date.now() - e);
135
+ clearTimeout($), s.remaining = {
136
+ version: C,
137
+ ms: i - (Date.now() - e)
138
+ };
117
139
  };
118
140
  }, [
119
- g,
141
+ y,
142
+ d,
143
+ m,
144
+ N,
120
145
  a,
121
- l,
122
- x,
123
- r,
124
- h,
146
+ C,
147
+ c,
148
+ b,
125
149
  s
126
- ]), E(() => {
127
- if (!l) return;
128
- const e = f.current, n = e && Number.parseFloat(getComputedStyle(e).transitionDuration) * 1e3 || 0, p = setTimeout(() => N(r), n);
129
- return () => clearTimeout(p);
150
+ ]), k(() => {
151
+ if (!m) return;
152
+ const e = o.current, i = setTimeout(() => I(c), e ? st(getComputedStyle(e)) : 0);
153
+ return () => clearTimeout(i);
130
154
  }, [
131
- l,
132
- r,
133
- N
134
- ]);
135
- const _ = (e) => {
136
- const n = b.current;
137
- if (!n || n.pointer !== e.pointerId) return;
138
- b.current = null;
139
- const p = e.currentTarget;
140
- delete p.dataset.swiping, Math.abs(e.clientX - n.x) >= ct ? h(r) : p.style.removeProperty("--_dx");
141
- }, C = et[c];
142
- return /* @__PURE__ */ M("div", {
143
- ref: f,
144
- role: c === "danger" && !F ? "alert" : "status",
155
+ m,
156
+ c,
157
+ I
158
+ ]), at(o, {
159
+ touchAction: "css",
160
+ onStart: (e) => e.pointerType === "touch" && !e.path.some((i) => i instanceof Element && i.matches("button, a") && o.current?.contains(i)),
161
+ onMove: (e) => {
162
+ o.current?.setAttribute("data-swiping", ""), o.current?.style.setProperty("--_dx", `${e.delta.x}px`);
163
+ },
164
+ onEnd: (e, i) => {
165
+ o.current?.removeAttribute("data-swiping"), !i && Math.abs(e.delta.x) >= yt ? b(c, "user") : o.current?.style.removeProperty("--_dx");
166
+ }
167
+ });
168
+ const P = lt[x];
169
+ return /* @__PURE__ */ H("div", {
170
+ ref: o,
171
+ role: x === "danger" && !_ ? "alert" : "status",
145
172
  "aria-atomic": "true",
146
173
  className: "cy-toast",
147
- "data-id": r,
148
- "data-tone": c,
149
- "data-collapsed": a || void 0,
150
- "data-leaving": l || void 0,
151
- onPointerDown: (e) => {
152
- e.pointerType === "touch" && (b.current = {
153
- x: e.clientX,
154
- pointer: e.pointerId
155
- });
156
- },
157
- onPointerMove: (e) => {
158
- const n = b.current;
159
- !n || n.pointer !== e.pointerId || (e.currentTarget.dataset.swiping = "", e.currentTarget.style.setProperty("--_dx", `${e.clientX - n.x}px`));
160
- },
161
- onPointerUp: _,
162
- onPointerCancel: (e) => {
163
- b.current = null, delete e.currentTarget.dataset.swiping, e.currentTarget.style.removeProperty("--_dx");
164
- },
174
+ "data-id": c,
175
+ "data-tone": x,
176
+ "data-collapsed": d || void 0,
177
+ "data-leaving": m || void 0,
165
178
  children: [
166
- C && /* @__PURE__ */ m(J, {
167
- icon: C,
179
+ N ? /* @__PURE__ */ v(et, {
180
+ variant: "spinner",
181
+ size: "md",
182
+ className: "cy-toast-icon"
183
+ }) : P && /* @__PURE__ */ v(tt, {
184
+ icon: P,
168
185
  className: "cy-toast-icon"
169
186
  }),
170
- /* @__PURE__ */ m("div", {
187
+ /* @__PURE__ */ v("div", {
171
188
  className: "cy-toast-text cy-reset",
172
- children: d && /* @__PURE__ */ M(st, { children: [/* @__PURE__ */ m("span", {
189
+ children: w && /* @__PURE__ */ H(vt, { children: [/* @__PURE__ */ v("span", {
173
190
  className: "cy-toast-title cy-reset",
174
- children: L
175
- }), w && /* @__PURE__ */ m("span", {
191
+ children: F
192
+ }), T && /* @__PURE__ */ v("span", {
176
193
  className: "cy-toast-description cy-reset",
177
- children: w
194
+ children: T
178
195
  })] })
179
196
  }),
180
- T && /* @__PURE__ */ m(K, {
197
+ u && /* @__PURE__ */ v(nt, {
181
198
  size: "sm",
182
199
  variant: "soft",
183
- tone: c === "neutral" ? "accent" : c,
184
- onClick: T.onClick,
185
- children: T.label
200
+ tone: x === "neutral" ? "accent" : x,
201
+ className: "cy-toast-action",
202
+ onClick: u.onClick,
203
+ children: u.label
186
204
  }),
187
- /* @__PURE__ */ m(Q, {
188
- icon: Y,
189
- label: y,
205
+ /* @__PURE__ */ v(rt, {
206
+ icon: it,
207
+ label: h,
190
208
  variant: "ghost",
191
209
  size: "sm",
192
- onClick: () => h(r)
210
+ wrapperClassName: "cy-toast-dismiss",
211
+ onClick: () => b(c, "user")
193
212
  })
194
213
  ]
195
214
  });
196
215
  }
197
216
  export {
198
- wt as Toaster,
199
- Pt as useToast
217
+ Bt as Toaster,
218
+ $t as useToast
200
219
  };
201
220
 
202
221
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","names":["_Fragment","closeIcon","Icon","useClientLayoutEffect","Button","IconButton","close","ToastHostContext","space","TONE_ICONS","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","Fragment$1","jsx","jsxs","createPortal","DEFAULT_LABELS","SWIPE","length","value","offsetVars","offset","block","inline","vars","ToastContext","useToast","api","Toaster","position","max","labels","className","style","children","text","prefix","count","items","setItems","hovered","setHovered","focused","setFocused","hidden","setHidden","region","memory","hosts","setHosts","registry","el","list","h","host","remove","id","t","dismiss","active","holder","others","next","button","toast","options","onVisibility","live","shown","paused","regionEl","e","item","ToastItem","collapsed","dismissLabel","onDismiss","onRemoved","title","description","tone","action","duration","leaving","mem","found","announcedBefore","drag","ready","setReady","started","left","node","ms","endSwipe","event","start","icon"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import {\n type CSSProperties,\n createContext,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { ToastHostContext, type ToastHostRegistry } from \"../../overlay/toast-host.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { type Space, space } from \"../Stack/space.js\";\n\nexport interface ToastTokens {\n width: string;\n radius: string;\n padding: string;\n gap: string;\n /** Extra distance between the toasts and the top or bottom edge they sit on (a fixed tab bar or header). */\n offsetBlock: string;\n /** Extra distance between the toasts and the side they sit on (a fixed side rail). */\n offsetInline: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n toast: ToastTokens;\n }\n}\n\nexport type ToastTone = Extract<Tone, \"neutral\" | \"success\" | \"danger\" | \"warning\" | \"info\">;\n\nexport interface ToastOptions {\n title: string;\n description?: string;\n /** Colour and icon. `danger` is announced assertively (`role=\"alert\"`); the others politely. */\n tone?: ToastTone;\n /** One button in the toast. It does not close the toast unless `onClick` dismisses it. */\n action?: { label: string; onClick: () => void };\n /** Milliseconds before it closes itself (default 5000). `Infinity` keeps it until dismissed. */\n duration?: number;\n}\n\nexport interface ToastApi {\n /** Shows a toast and returns its id. */\n toast: (options: ToastOptions) => string;\n /** Closes one toast, or all of them without an id. */\n dismiss: (id?: string) => void;\n}\n\nexport type ToastPosition =\n | \"top-start\"\n | \"top-center\"\n | \"top-end\"\n | \"bottom-start\"\n | \"bottom-center\"\n | \"bottom-end\";\n\n/** A distance: a step of the space scale (`\"6\"` is `--cy-space-6`) or any CSS length (`\"72px\"`, `\"calc(56px + 1rem)\"`). */\nexport type ToastOffsetLength = Space | (string & {});\n\n/** How far in from their edges the toasts sit, for each axis. */\nexport interface ToastOffset {\n /** From the top or bottom edge, whichever `position` names. */\n block?: ToastOffsetLength | undefined;\n /** From the side `position` names (both sides for `center`). Follows the reading direction. */\n inline?: ToastOffsetLength | undefined;\n}\n\nexport interface ToastLabels {\n /** Name of the notifications region. */\n region: string;\n /** Accessible name of each toast's close button. */\n dismiss: string;\n}\n\nexport interface ToasterProps {\n /** Where toasts stack. `start`/`end` follow the reading direction. */\n position?: ToastPosition;\n /** How many show at once; older ones collapse until newer ones close. */\n max?: number;\n /**\n * Keeps the toasts clear of fixed parts of the app, such as a bottom tab bar: extra distance from the edge they sit\n * on, added to the usual margin and the device's safe area. A step of the space scale (`\"8\"`) or a CSS length\n * (`\"72px\"`) moves them in from the top or bottom edge; `{ block, inline }` sets that and the distance from the\n * side. To set it from CSS instead (only below a breakpoint, say) use the `--cy-toast-offset-block` and\n * `--cy-toast-offset-inline` tokens; this prop wins over them. Default: none.\n */\n offset?: ToastOffsetLength | ToastOffset | undefined;\n /** Replace the built-in English text: the region's name and the close button's name. */\n labels?: Partial<ToastLabels>;\n /** Added to the notifications region, for layout. */\n className?: string;\n /** Layout only, applied to the region. Restyle through --cy-toast-* tokens. */\n style?: CSSProperties;\n /** The part of the app that can call `useToast()`. */\n children?: ReactNode;\n}\n\ninterface Item extends ToastOptions {\n id: string;\n leaving?: boolean;\n}\n\nconst DEFAULT_LABELS: ToastLabels = { region: \"Notifications\", dismiss: \"Dismiss\" };\n/** Horizontal distance a touch has to travel to swipe a toast away. */\nconst SWIPE = 64;\n\nconst length = (value: ToastOffsetLength) => (/^(\\d|10)$/.test(value) ? space(value as Space) : value);\n/** The private custom properties toast.css reads the `offset` prop from; an axis that is not set is left to the token. */\nfunction offsetVars(offset: ToasterProps[\"offset\"]) {\n const { block, inline }: ToastOffset = typeof offset === \"object\" ? offset : { block: offset };\n const vars: Record<string, string> = {};\n if (block) vars[\"--_offset-block\"] = length(block);\n if (inline) vars[\"--_offset-inline\"] = length(inline);\n return vars;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\n/** `toast()` and `dismiss()` for the nearest `<Toaster>`. */\nexport function useToast(): ToastApi {\n const api = useContext(ToastContext);\n if (!api) throw new Error(\"useToast() needs a <Toaster> around it.\");\n return api;\n}\n\ntype RegionEl = HTMLElement & { showPopover?: () => void; hidePopover?: () => void };\n\n/** What a toast keeps when its element is re-created (the region moved into or out of a Dialog). */\ninterface Memory {\n announced: boolean;\n remaining?: number;\n}\ntype MemoryMap = Map<string, Memory>;\n\n/**\n * Hosts toasts for everything inside it: a region in the top layer, a store per Toaster (no globals), timers that pause\n * while the pointer or focus is on a toast, and polite or assertive announcements.\n */\nexport function Toaster({\n position = \"bottom-end\",\n max = 3,\n offset,\n labels,\n className,\n style,\n children,\n}: ToasterProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const prefix = useId();\n const count = useRef(0);\n const [items, setItems] = useState<Item[]>([]);\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const region = useRef<RegionEl>(null);\n const memory = useRef<MemoryMap>(new Map());\n // Containers lent by open modal Dialogs; the latest one hosts the region.\n const [hosts, setHosts] = useState<HTMLElement[]>([]);\n const registry = useMemo<ToastHostRegistry>(\n () => ({\n register: (el) => {\n setHosts((list) => [...list, el]);\n return () => setHosts((list) => list.filter((h) => h !== el));\n },\n }),\n [],\n );\n const host = hosts.at(-1) ?? null;\n\n const remove = useCallback((id: string) => {\n memory.current.delete(id);\n setItems((list) => list.filter((t) => t.id !== id));\n }, []);\n const dismiss = useCallback((id?: string) => {\n // Closing the toast that holds focus (its close button, from the keyboard): hand focus to the next toast's close\n // button, or let the region stop pausing if there is none.\n const active = region.current?.ownerDocument.activeElement;\n const holder = active?.closest<HTMLElement>(\".cy-toast\");\n if (holder && region.current?.contains(holder) && (id === undefined || holder.dataset.id === id)) {\n const others = [\n ...region.current.querySelectorAll<HTMLElement>(\n \".cy-toast:not([data-collapsed]):not([data-leaving])\",\n ),\n ];\n const next = id === undefined ? undefined : others.find((t) => t !== holder);\n const button = next ? [...next.querySelectorAll<HTMLElement>(\"button\")].at(-1) : undefined;\n if (button) button.focus();\n else {\n (active as HTMLElement).blur();\n setFocused(false);\n }\n }\n setItems((list) => list.map((t) => (id === undefined || t.id === id ? { ...t, leaving: true } : t)));\n }, []);\n const toast = useCallback(\n (options: ToastOptions) => {\n count.current += 1;\n const id = `${prefix}-${count.current}`;\n setItems((list) => [...list, { ...options, id }]);\n return id;\n },\n [prefix],\n );\n const api = useMemo<ToastApi>(() => ({ toast, dismiss }), [toast, dismiss]);\n\n // The region lives in the top layer for as long as the Toaster is mounted, so live regions exist before content.\n // It is re-created when it moves into or out of a Dialog; showing it again puts it on top of that dialog.\n useClientLayoutEffect(() => {\n const el = region.current;\n el?.showPopover?.();\n return () => {\n if (el?.matches(\":popover-open\")) el.hidePopover?.();\n };\n }, [host]);\n useEffect(() => {\n const onVisibility = () => setHidden(document.visibilityState === \"hidden\");\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n // Focus left the region entirely (a toast closing with focus inside also counts).\n useEffect(() => {\n if (focused && !items.some((t) => !t.leaving)) setFocused(false);\n }, [focused, items]);\n\n const live = items.filter((t) => !t.leaving);\n const shown = new Set(live.slice(-max).map((t) => t.id));\n const paused = hovered || focused || hidden;\n\n const regionEl = (\n <section\n ref={region}\n aria-label={text.region}\n {...{ popover: \"manual\" }}\n className={className ? `cy-toaster ${className}` : \"cy-toaster\"}\n data-position={position}\n style={{ ...offsetVars(offset), ...style }}\n onPointerEnter={() => setHovered(true)}\n onPointerLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocused(false);\n }}\n >\n {items.map((item) => (\n <ToastItem\n key={item.id}\n item={item}\n collapsed={!item.leaving && !shown.has(item.id)}\n paused={paused}\n dismissLabel={text.dismiss}\n onDismiss={dismiss}\n onRemoved={remove}\n memory={memory.current}\n />\n ))}\n </section>\n );\n\n return (\n <ToastContext.Provider value={api}>\n <ToastHostContext.Provider value={registry}>{children}</ToastHostContext.Provider>\n {host ? createPortal(regionEl, host) : regionEl}\n </ToastContext.Provider>\n );\n}\n\ninterface ToastItemProps {\n item: Item;\n collapsed: boolean;\n paused: boolean;\n dismissLabel: string;\n onDismiss: (id: string) => void;\n onRemoved: (id: string) => void;\n memory: MemoryMap;\n}\n\nfunction ToastItem({ item, collapsed, paused, dismissLabel, onDismiss, onRemoved, memory }: ToastItemProps) {\n const { id, title, description, tone = \"neutral\", action, duration = 5000, leaving = false } = item;\n const el = useRef<HTMLDivElement>(null);\n // Survives the element being re-created (region moved into or out of a Dialog).\n const [mem] = useState<Memory>(() => {\n const found = memory.get(id) ?? { announced: false };\n memory.set(id, found);\n return found;\n });\n const [announcedBefore] = useState(mem.announced);\n const drag = useRef<{ x: number; pointer: number } | null>(null);\n // The live element exists (empty) first and its text arrives a moment later: screen readers announce text added to\n // a live region, and the text is added once, so the toast is announced once.\n // Already announced (re-created after a move): show the text at once, so nothing is inserted to announce again.\n const [ready, setReady] = useState(mem.announced);\n useEffect(() => {\n if (ready) return;\n const t = setTimeout(() => {\n mem.announced = true;\n setReady(true);\n }, 50);\n return () => clearTimeout(t);\n }, [ready, mem]);\n\n // Collapsed and leaving toasts cannot be focused or clicked. Set as a property: React 18 drops `inert={true}`.\n useClientLayoutEffect(() => {\n if (el.current) el.current.inert = collapsed || leaving;\n }, [collapsed, leaving]);\n\n // Auto-dismiss, keeping the time already spent across pauses and moves. The time left lives in `mem`, read when the\n // timer starts: a re-created toast's effects run after the old one has saved it.\n useEffect(() => {\n if (paused || collapsed || leaving || !Number.isFinite(duration) || duration <= 0) return;\n const started = Date.now();\n const left = mem.remaining ?? duration;\n const t = setTimeout(() => onDismiss(id), Math.max(left, 0));\n return () => {\n clearTimeout(t);\n mem.remaining = left - (Date.now() - started);\n };\n }, [paused, collapsed, leaving, duration, id, onDismiss, mem]);\n\n // Leaving: play the exit transition (none under reduced motion), then drop it from the store.\n useEffect(() => {\n if (!leaving) return;\n const node = el.current;\n const ms = node ? Number.parseFloat(getComputedStyle(node).transitionDuration) * 1000 || 0 : 0;\n const t = setTimeout(() => onRemoved(id), ms);\n return () => clearTimeout(t);\n }, [leaving, id, onRemoved]);\n\n const endSwipe = (event: PointerEvent<HTMLDivElement>) => {\n const start = drag.current;\n if (!start || start.pointer !== event.pointerId) return;\n drag.current = null;\n const node = event.currentTarget;\n delete node.dataset.swiping;\n if (Math.abs(event.clientX - start.x) >= SWIPE) onDismiss(id);\n else node.style.removeProperty(\"--_dx\");\n };\n\n const icon = TONE_ICONS[tone];\n return (\n <div\n ref={el}\n // An alert announces whenever it appears; one already announced comes back as a status.\n role={tone === \"danger\" && !announcedBefore ? \"alert\" : \"status\"}\n aria-atomic=\"true\"\n className=\"cy-toast\"\n data-id={id}\n data-tone={tone}\n data-collapsed={collapsed || undefined}\n data-leaving={leaving || undefined}\n onPointerDown={(event) => {\n if (event.pointerType !== \"touch\") return;\n drag.current = { x: event.clientX, pointer: event.pointerId };\n }}\n onPointerMove={(event) => {\n const start = drag.current;\n if (!start || start.pointer !== event.pointerId) return;\n event.currentTarget.dataset.swiping = \"\";\n event.currentTarget.style.setProperty(\"--_dx\", `${event.clientX - start.x}px`);\n }}\n onPointerUp={endSwipe}\n onPointerCancel={(event) => {\n // The browser took the gesture (a scroll): spring back, never dismiss.\n drag.current = null;\n delete event.currentTarget.dataset.swiping;\n event.currentTarget.style.removeProperty(\"--_dx\");\n }}\n >\n {icon && <Icon icon={icon} className=\"cy-toast-icon\" />}\n <div className=\"cy-toast-text cy-reset\">\n {ready && (\n <>\n <span className=\"cy-toast-title cy-reset\">{title}</span>\n {description && <span className=\"cy-toast-description cy-reset\">{description}</span>}\n </>\n )}\n </div>\n {action && (\n <Button size=\"sm\" variant=\"soft\" tone={tone === \"neutral\" ? \"accent\" : tone} onClick={action.onClick}>\n {action.label}\n </Button>\n )}\n <IconButton\n icon={closeIcon}\n label={dismissLabel}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => onDismiss(id)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAmHA,IAAMsB,KAA8B;AAAA,EAAE,QAAQ;AAAA,EAAiB,SAAS;AAAU,GAE5EC,KAAQ,IAERC,IAAA,CAAUC,MAA8B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,UAAA,CACE,gBAAAmB,EAAC,QAAD;AAAA,UAAM,WAAU;AAAA,UAA2B,UAAAiE;AAAA,QAAY,CAAA,GACtDC,KAAe,gBAAAlE,EAAC,QAAD;AAAA,UAAM,WAAU;AAAA,UAAiC,UAAAkE;AAAA,QAAkB,CAAA,CACnF,EAAA,CAAA;AAAA,MAED,CAAA;AAAA,MACJE,KACC,gBAAApE,EAACf,GAAD;AAAA,QAAQ,MAAK;AAAA,QAAK,SAAQ;AAAA,QAAO,MAAMkF,MAAS,YAAY,WAAWA;AAAA,QAAM,SAASC,EAAO;AAAA,QAC1F,UAAAA,EAAO;AAAA,MACF,CAAA;AAAA,MAEV,gBAAApE,EAACd,GAAD;AAAA,QACE,MAAMJ;AAAAA,QACN,OAAOgF;AAAA,QACP,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,SAAA,MAAeC,EAAUpB,CAAE;AAAA,MAC5B,CAAA;AAAA,IACE;AAAA,E;AAET"}
1
+ {"version":3,"file":"Toast.js","names":["_Fragment","closeIcon","Icon","useClientLayoutEffect","LoadingDots","Button","deepActiveElement","IconButton","transitionTime","close","ToastHostContext","useDrag","space","TONE_ICONS","createContext","useCallback","useContext","useEffect","useId","useMemo","useRef","useState","Fragment$1","jsx","jsxs","createPortal","DEFAULT_LABELS","SWIPE","length","value","offsetVars","offset","block","inline","vars","ToastContext","useToast","api","Toaster","position","max","labels","className","style","children","text","prefix","count","items","setItems","store","commit","next","hovered","setHovered","focused","setFocused","hidden","setHidden","region","memory","hosts","setHosts","registry","el","list","h","host","remove","id","t","reason","ending","active","holder","others","button","dismiss","toast","wanted","options","current","onVisibility","live","shown","paused","regionEl","e","item","ToastItem","collapsed","dismissLabel","onDismiss","onRemoved","version","title","description","tone","action","duration","loading","leaving","mem","found","announcedBefore","ready","setReady","started","left","node","session","n","cancelled","icon"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import {\n type CSSProperties,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useClientLayoutEffect } from \"../../foundations/client-layout-effect.js\";\nimport { useDrag } from \"../../foundations/drag.js\";\nimport { deepActiveElement } from \"../../foundations/focus.js\";\nimport { Icon } from \"../../foundations/Icon/Icon.js\";\nimport { type Space, space } from \"../../foundations/layout.js\";\nimport { transitionTime } from \"../../foundations/motion.js\";\nimport { TONE_ICONS } from \"../../foundations/tone-icons.js\";\nimport { close as closeIcon } from \"../../icons/close.js\";\nimport { ToastHostContext, type ToastHostRegistry } from \"../../overlay/toast-host.js\";\nimport type { Tone } from \"../../tokens/schema.js\";\nimport { Button } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\nimport { LoadingDots } from \"../LoadingDots/LoadingDots.js\";\n\nexport interface ToastTokens {\n width: string;\n radius: string;\n padding: string;\n gap: string;\n /** Extra distance between the toasts and the top or bottom edge they sit on (a fixed tab bar or header). */\n offsetBlock: string;\n /** Extra distance between the toasts and the side they sit on (a fixed side rail). */\n offsetInline: string;\n}\n\ndeclare module \"../../tokens/schema.js\" {\n interface ComponentTokens {\n toast: ToastTokens;\n }\n}\n\nexport type ToastTone = Extract<Tone, \"neutral\" | \"success\" | \"danger\" | \"warning\" | \"info\">;\n\n/** Why a toast closed: its timer ran out, the user closed it (close button or swipe), or `dismiss()` was called. */\nexport type ToastDismissReason = \"timeout\" | \"user\" | \"programmatic\";\n\nexport interface ToastOptions {\n /**\n * Names the toast. Calling `toast()` again with the id of a toast that is still showing updates that toast in place\n * (a loading toast becoming done) instead of adding another; its timer starts again with the new `duration`.\n * Default: a new id for every call.\n */\n id?: string;\n title: string;\n description?: string;\n /** Colour and icon. `danger` is announced assertively (`role=\"alert\"`); the others politely. */\n tone?: ToastTone;\n /** One button in the toast. It does not close the toast unless `onClick` dismisses it. */\n action?: { label: string; onClick: () => void };\n /** Milliseconds before it closes itself (default 5000). `Infinity` keeps it until dismissed. */\n duration?: number;\n /**\n * Work in progress: a spinner in place of the tone's icon, and no timer until the toast is updated (`toast()` with\n * the same `id`) or dismissed.\n */\n loading?: boolean;\n /** Called once when the toast starts to close, with its id and why it closed. */\n onDismiss?: (id: string, reason: ToastDismissReason) => void;\n}\n\nexport interface ToastApi {\n /** Shows a toast and returns its id; with the `id` of a toast that is showing, updates that toast instead. */\n toast: (options: ToastOptions) => string;\n /** Closes one toast, or all of them without an id. */\n dismiss: (id?: string) => void;\n}\n\nexport type ToastPosition =\n | \"top-start\"\n | \"top-center\"\n | \"top-end\"\n | \"bottom-start\"\n | \"bottom-center\"\n | \"bottom-end\";\n\n/** A distance: a step of the space scale (`\"6\"` is `--cy-space-6`) or any CSS length (`\"72px\"`, `\"calc(56px + 1rem)\"`). */\nexport type ToastOffsetLength = Space | (string & {});\n\n/** How far in from their edges the toasts sit, for each axis. */\nexport interface ToastOffset {\n /** From the top or bottom edge, whichever `position` names. */\n block?: ToastOffsetLength | undefined;\n /** From the side `position` names (both sides for `center`). Follows the reading direction. */\n inline?: ToastOffsetLength | undefined;\n}\n\nexport interface ToastLabels {\n /** Name of the notifications region. */\n region: string;\n /** Accessible name of each toast's close button. */\n dismiss: string;\n}\n\nexport interface ToasterProps {\n /** Where toasts stack. `start`/`end` follow the reading direction. */\n position?: ToastPosition;\n /** How many show at once; older ones collapse until newer ones close. */\n max?: number;\n /**\n * Keeps the toasts clear of fixed parts of the app, such as a bottom tab bar: extra distance from the edge they sit\n * on, added to the usual margin and the device's safe area. A step of the space scale (`\"8\"`) or a CSS length\n * (`\"72px\"`) moves them in from the top or bottom edge; `{ block, inline }` sets that and the distance from the\n * side. To set it from CSS instead (only below a breakpoint, say) use the `--cy-toast-offset-block` and\n * `--cy-toast-offset-inline` tokens; this prop wins over them. Default: none.\n */\n offset?: ToastOffsetLength | ToastOffset | undefined;\n /** Replace the built-in English text: the region's name and the close button's name. */\n labels?: Partial<ToastLabels>;\n /** Added to the notifications region, for layout. */\n className?: string;\n /** Layout only, applied to the region. Restyle through --cy-toast-* tokens. */\n style?: CSSProperties;\n /** The part of the app that can call `useToast()`. */\n children?: ReactNode;\n}\n\ninterface Item extends ToastOptions {\n id: string;\n /** Counts updates, so an update restarts the timer even when its duration is unchanged. */\n version: number;\n leaving?: boolean;\n}\n\nconst DEFAULT_LABELS: ToastLabels = { region: \"Notifications\", dismiss: \"Dismiss\" };\n/** Horizontal distance a touch has to travel to swipe a toast away. */\nconst SWIPE = 64;\n\nconst length = (value: ToastOffsetLength) => (/^(\\d|10)$/.test(value) ? space(value as Space) : value);\n/** The private custom properties toast.css reads the `offset` prop from; an axis that is not set is left to the token. */\nfunction offsetVars(offset: ToasterProps[\"offset\"]) {\n const { block, inline }: ToastOffset = typeof offset === \"object\" ? offset : { block: offset };\n const vars: Record<string, string> = {};\n if (block) vars[\"--_offset-block\"] = length(block);\n if (inline) vars[\"--_offset-inline\"] = length(inline);\n return vars;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\n/** `toast()` and `dismiss()` for the nearest `<Toaster>`. */\nexport function useToast(): ToastApi {\n const api = useContext(ToastContext);\n if (!api) throw new Error(\"useToast() needs a <Toaster> around it.\");\n return api;\n}\n\ntype RegionEl = HTMLElement & { showPopover?: () => void; hidePopover?: () => void };\n\n/** What a toast keeps when its element is re-created (the region moved into or out of a Dialog). */\ninterface Memory {\n announced: boolean;\n /** Time left on the timer of one version of the toast; an update starts a timer of its own. */\n remaining?: { version: number; ms: number };\n}\ntype MemoryMap = Map<string, Memory>;\n\n/**\n * Hosts toasts for everything inside it: a region in the top layer, a store per Toaster (no globals), timers that pause\n * while the pointer or focus is on a toast, and polite or assertive announcements.\n */\nexport function Toaster({\n position = \"bottom-end\",\n max = 3,\n offset,\n labels,\n className,\n style,\n children,\n}: ToasterProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const prefix = useId();\n const count = useRef(0);\n const [items, setItems] = useState<Item[]>([]);\n // The store as of the last change, read synchronously by toast() and dismiss() (two calls in one handler see each\n // other), so updates find their toast and onDismiss is called outside a state updater, exactly once.\n const store = useRef<Item[]>([]);\n const commit = useCallback((next: Item[]) => {\n store.current = next;\n setItems(next);\n }, []);\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const [hidden, setHidden] = useState(false);\n const region = useRef<RegionEl>(null);\n const memory = useRef<MemoryMap>(new Map());\n // Containers lent by open modal Dialogs; the latest one hosts the region.\n const [hosts, setHosts] = useState<HTMLElement[]>([]);\n const registry = useMemo<ToastHostRegistry>(\n () => ({\n register: (el) => {\n setHosts((list) => [...list, el]);\n return () => setHosts((list) => list.filter((h) => h !== el));\n },\n }),\n [],\n );\n const host = hosts.at(-1) ?? null;\n\n const remove = useCallback(\n (id: string) => {\n memory.current.delete(id);\n commit(store.current.filter((t) => t.id !== id));\n },\n [commit],\n );\n const close = useCallback(\n (id: string | undefined, reason: ToastDismissReason) => {\n const ending = store.current.filter((t) => !t.leaving && (id === undefined || t.id === id));\n if (ending.length === 0) return;\n // Closing the toast that holds focus (its close button, from the keyboard): hand focus to the next toast's close\n // button, or let the region stop pausing if there is none.\n const active = deepActiveElement(region.current?.ownerDocument);\n const holder = active?.closest<HTMLElement>(\".cy-toast\");\n if (holder && region.current?.contains(holder) && (id === undefined || holder.dataset.id === id)) {\n const others = [\n ...region.current.querySelectorAll<HTMLElement>(\n \".cy-toast:not([data-collapsed]):not([data-leaving])\",\n ),\n ];\n const next = id === undefined ? undefined : others.find((t) => t !== holder);\n const button = next ? [...next.querySelectorAll<HTMLElement>(\"button\")].at(-1) : undefined;\n if (button) button.focus();\n else {\n (active as HTMLElement).blur();\n setFocused(false);\n }\n }\n commit(store.current.map((t) => (ending.includes(t) ? { ...t, leaving: true } : t)));\n for (const t of ending) t.onDismiss?.(t.id, reason);\n },\n [commit],\n );\n const dismiss = useCallback((id?: string) => close(id, \"programmatic\"), [close]);\n const toast = useCallback(\n ({ id: wanted, ...options }: ToastOptions) => {\n // The id of a toast still in the store: update it in place (one that was closing comes back).\n const current = wanted === undefined ? undefined : store.current.find((t) => t.id === wanted);\n if (current) {\n const next: Item = { ...options, id: current.id, version: current.version + 1 };\n commit(store.current.map((t) => (t === current ? next : t)));\n return current.id;\n }\n count.current += 1;\n const id = wanted ?? `${prefix}-${count.current}`;\n commit([...store.current, { ...options, id, version: 0 }]);\n return id;\n },\n [prefix, commit],\n );\n const api = useMemo<ToastApi>(() => ({ toast, dismiss }), [toast, dismiss]);\n\n // The region lives in the top layer for as long as the Toaster is mounted, so live regions exist before content.\n // It is re-created when it moves into or out of a Dialog; showing it again puts it on top of that dialog.\n useClientLayoutEffect(() => {\n const el = region.current;\n el?.showPopover?.();\n return () => {\n if (el?.matches(\":popover-open\")) el.hidePopover?.();\n };\n }, [host]);\n useEffect(() => {\n const onVisibility = () => setHidden(document.visibilityState === \"hidden\");\n document.addEventListener(\"visibilitychange\", onVisibility);\n return () => document.removeEventListener(\"visibilitychange\", onVisibility);\n }, []);\n // Focus left the region entirely (a toast closing with focus inside also counts).\n useEffect(() => {\n if (focused && !items.some((t) => !t.leaving)) setFocused(false);\n }, [focused, items]);\n\n const live = items.filter((t) => !t.leaving);\n const shown = new Set(live.slice(-max).map((t) => t.id));\n const paused = hovered || focused || hidden;\n\n const regionEl = (\n <section\n ref={region}\n aria-label={text.region}\n {...{ popover: \"manual\" }}\n className={className ? `cy-toaster ${className}` : \"cy-toaster\"}\n data-position={position}\n style={{ ...offsetVars(offset), ...style }}\n onPointerEnter={() => setHovered(true)}\n onPointerLeave={() => setHovered(false)}\n onFocus={() => setFocused(true)}\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocused(false);\n }}\n >\n {items.map((item) => (\n <ToastItem\n key={item.id}\n item={item}\n collapsed={!item.leaving && !shown.has(item.id)}\n paused={paused}\n dismissLabel={text.dismiss}\n onDismiss={close}\n onRemoved={remove}\n memory={memory.current}\n />\n ))}\n </section>\n );\n\n return (\n <ToastContext.Provider value={api}>\n <ToastHostContext.Provider value={registry}>{children}</ToastHostContext.Provider>\n {host ? createPortal(regionEl, host) : regionEl}\n </ToastContext.Provider>\n );\n}\n\ninterface ToastItemProps {\n item: Item;\n collapsed: boolean;\n paused: boolean;\n dismissLabel: string;\n onDismiss: (id: string, reason: ToastDismissReason) => void;\n onRemoved: (id: string) => void;\n memory: MemoryMap;\n}\n\nfunction ToastItem({ item, collapsed, paused, dismissLabel, onDismiss, onRemoved, memory }: ToastItemProps) {\n const {\n id,\n version,\n title,\n description,\n tone = \"neutral\",\n action,\n duration = 5000,\n loading = false,\n leaving = false,\n } = item;\n const el = useRef<HTMLDivElement>(null);\n // Survives the element being re-created (region moved into or out of a Dialog).\n const [mem] = useState<Memory>(() => {\n const found = memory.get(id) ?? { announced: false };\n memory.set(id, found);\n return found;\n });\n const [announcedBefore] = useState(mem.announced);\n // The live element exists (empty) first and its text arrives a moment later: screen readers announce text added to\n // a live region, and the text is added once, so the toast is announced once.\n // Already announced (re-created after a move): show the text at once, so nothing is inserted to announce again.\n const [ready, setReady] = useState(mem.announced);\n useEffect(() => {\n if (ready) return;\n const t = setTimeout(() => {\n mem.announced = true;\n setReady(true);\n }, 50);\n return () => clearTimeout(t);\n }, [ready, mem]);\n\n // Collapsed and leaving toasts cannot be focused or clicked. Set as a property: React 18 drops `inert={true}`.\n useClientLayoutEffect(() => {\n if (el.current) el.current.inert = collapsed || leaving;\n }, [collapsed, leaving]);\n\n // Auto-dismiss, keeping the time already spent across pauses and moves. The time left lives in `mem`, read when the\n // timer starts: a re-created toast's effects run after the old one has saved it. An update (a new version) starts a\n // fresh timer; a loading toast has none until it is updated.\n useEffect(() => {\n if (paused || collapsed || leaving || loading || !Number.isFinite(duration) || duration <= 0) return;\n const started = Date.now();\n const left = mem.remaining?.version === version ? mem.remaining.ms : duration;\n const t = setTimeout(() => onDismiss(id, \"timeout\"), Math.max(left, 0));\n return () => {\n clearTimeout(t);\n mem.remaining = { version, ms: left - (Date.now() - started) };\n };\n }, [paused, collapsed, leaving, loading, duration, version, id, onDismiss, mem]);\n\n // Leaving: play the exit transition (none under reduced motion), then drop it from the store.\n useEffect(() => {\n if (!leaving) return;\n const node = el.current;\n const t = setTimeout(() => onRemoved(id), node ? transitionTime(getComputedStyle(node)) : 0);\n return () => clearTimeout(t);\n }, [leaving, id, onRemoved]);\n\n // A finger swipes the toast away sideways. A press on its buttons stays a tap; a vertical swipe scrolls (the\n // stylesheet's pan-y) and, like Escape, puts it back.\n useDrag(el, {\n touchAction: \"css\",\n onStart: (session) =>\n session.pointerType === \"touch\" &&\n !session.path.some((n) => n instanceof Element && n.matches(\"button, a\") && el.current?.contains(n)),\n onMove: (session) => {\n el.current?.setAttribute(\"data-swiping\", \"\");\n el.current?.style.setProperty(\"--_dx\", `${session.delta.x}px`);\n },\n onEnd: (session, cancelled) => {\n el.current?.removeAttribute(\"data-swiping\");\n if (!cancelled && Math.abs(session.delta.x) >= SWIPE) onDismiss(id, \"user\");\n else el.current?.style.removeProperty(\"--_dx\");\n },\n });\n\n const icon = TONE_ICONS[tone];\n return (\n <div\n ref={el}\n // An alert announces whenever it appears; one already announced comes back as a status.\n role={tone === \"danger\" && !announcedBefore ? \"alert\" : \"status\"}\n aria-atomic=\"true\"\n className=\"cy-toast\"\n data-id={id}\n data-tone={tone}\n data-collapsed={collapsed || undefined}\n data-leaving={leaving || undefined}\n >\n {loading ? (\n <LoadingDots variant=\"spinner\" size=\"md\" className=\"cy-toast-icon\" />\n ) : (\n icon && <Icon icon={icon} className=\"cy-toast-icon\" />\n )}\n <div className=\"cy-toast-text cy-reset\">\n {ready && (\n <>\n <span className=\"cy-toast-title cy-reset\">{title}</span>\n {description && <span className=\"cy-toast-description cy-reset\">{description}</span>}\n </>\n )}\n </div>\n {action && (\n <Button\n size=\"sm\"\n variant=\"soft\"\n tone={tone === \"neutral\" ? \"accent\" : tone}\n className=\"cy-toast-action\"\n onClick={action.onClick}\n >\n {action.label}\n </Button>\n )}\n <IconButton\n icon={closeIcon}\n label={dismissLabel}\n variant=\"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AAA,MAED,CAAA;AAAA,MACJE,KACC,gBAAA3E,EAAClB,IAAD;AAAA,QACE,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,MAAM4F,MAAS,YAAY,WAAWA;AAAA,QACtC,WAAU;AAAA,QACV,SAASC,EAAO;AAAA,QAEf,UAAAA,EAAO;AAAA,MACF,CAAA;AAAA,MAEV,gBAAA3E,EAAChB,IAAD;AAAA,QACE,MAAMN;AAAAA,QACN,OAAO0F;AAAA,QACP,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,kBAAiB;AAAA,QACjB,SAAA,MAAeC,EAAUvB,GAAI,MAAM;AAAA,MACpC,CAAA;AAAA,IACE;AAAA,E;AAET"}
@@ -1 +1 @@
1
- export { type ToastApi, Toaster, type ToasterProps, type ToastLabels, type ToastOffset, type ToastOffsetLength, type ToastOptions, type ToastPosition, type ToastTokens, type ToastTone, useToast, } from "./Toast.js";
1
+ export { type ToastApi, type ToastDismissReason, Toaster, type ToasterProps, type ToastLabels, type ToastOffset, type ToastOffsetLength, type ToastOptions, type ToastPosition, type ToastTokens, type ToastTone, useToast, } from "./Toast.js";
@@ -1,27 +1,26 @@
1
1
  "use client";
2
- import { useRovingFocus as u } from "../../foundations/roving-focus.js";
3
- import { useRef as c } from "react";
2
+ import { TOOLBAR_ITEMS as u, useRovingFocus as c } from "../../foundations/roving-focus.js";
3
+ import { useRef as s } from "react";
4
4
  import { jsx as f } from "react/jsx-runtime";
5
- var s = 'button, a[href], textarea, input:not([type="hidden"]):not([aria-hidden="true"]), [data-roving]';
6
- function p({ label: e, orientation: o = "horizontal", loop: a = !0, className: r, style: i, children: n, ...l }) {
7
- const t = c(null);
8
- return u(t, {
5
+ function R({ label: e, orientation: o = "horizontal", loop: l = !0, className: r, style: a, children: i, ...n }) {
6
+ const t = s(null);
7
+ return c(t, {
9
8
  orientation: o,
10
- loop: a,
11
- selector: s
9
+ loop: l,
10
+ selector: u
12
11
  }), /* @__PURE__ */ f("div", {
13
12
  ref: t,
14
- ...l,
13
+ ...n,
15
14
  role: "toolbar",
16
15
  "aria-label": e,
17
16
  "aria-orientation": o,
18
17
  className: r ? `cy-toolbar ${r}` : "cy-toolbar",
19
- style: i,
20
- children: n
18
+ style: a,
19
+ children: i
21
20
  });
22
21
  }
23
22
  export {
24
- p as Toolbar
23
+ R as Toolbar
25
24
  };
26
25
 
27
26
  //# sourceMappingURL=Toolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","names":["useRovingFocus","useRef","jsx","ITEMS","Toolbar","label","orientation","loop","className","style","children","rest","ref"],"sources":["../../../src/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from \"react\";\nimport { useRovingFocus } from \"../../foundations/roving-focus.js\";\n\nexport interface ToolbarProps {\n /** Accessible name (required: a toolbar must be named). */\n label: string;\n /** Direction of the toolbar: Left/Right move between controls, or Up/Down when vertical. Default \"horizontal\". */\n orientation?: \"horizontal\" | \"vertical\";\n /** Arrow keys wrap from the last item to the first. */\n loop?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n /** Buttons, IconButtons, SegmentedControls, fields. */\n children?: ReactNode;\n /** Test id, set on the toolbar element. */\n \"data-testid\"?: string;\n}\n\n/** Every focusable control inside joins the roving group (hidden form proxies excluded). */\nconst ITEMS =\n 'button, a[href], textarea, input:not([type=\"hidden\"]):not([aria-hidden=\"true\"]), [data-roving]';\n\n/** APG toolbar: one Tab stop; arrow keys move between controls (RTL aware), Home and End jump. */\nexport function Toolbar({\n label,\n orientation = \"horizontal\",\n loop = true,\n className,\n style,\n children,\n ...rest\n}: ToolbarProps) {\n const ref = useRef<HTMLDivElement>(null);\n useRovingFocus(ref, { orientation, loop, selector: ITEMS });\n return (\n <div\n ref={ref}\n {...rest}\n role=\"toolbar\"\n aria-label={label}\n aria-orientation={orientation}\n className={className ? `cy-toolbar ${className}` : \"cy-toolbar\"}\n style={style}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,IAAMG,IACJ;AAGF,SAAgBC,EAAQ,EACtB,OAAAC,GACA,aAAAC,IAAc,cACd,MAAAC,IAAO,IACP,WAAAC,GACA,OAAAC,GACA,UAAAC,GACA,GAAGC,EAAA,GACY;AACf,QAAMC,IAAMX,EAAuB,IAAI;AACvC,SAAAD,EAAeY,GAAK;AAAA,IAAE,aAAAN;AAAA,IAAa,MAAAC;AAAA,IAAM,UAAUJ;AAAA,EAAM,CAAC,GAExD,gBAAAD,EAAC,OAAD;AAAA,IACO,KAAAU;AAAA,IACL,GAAID;AAAA,IACJ,MAAK;AAAA,IACL,cAAYN;AAAA,IACZ,oBAAkBC;AAAA,IAClB,WAAWE,IAAY,cAAcA,CAAA,KAAc;AAAA,IAC5C,OAAAC;AAAA,IAEN,UAAAC;AAAA,EACE,CAAA;AAET"}
1
+ {"version":3,"file":"Toolbar.js","names":["TOOLBAR_ITEMS","useRovingFocus","useRef","jsx","Toolbar","label","orientation","loop","className","style","children","rest","ref"],"sources":["../../../src/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import { type CSSProperties, type ReactNode, useRef } from \"react\";\nimport { TOOLBAR_ITEMS, useRovingFocus } from \"../../foundations/roving-focus.js\";\n\nexport interface ToolbarProps {\n /** Accessible name (required: a toolbar must be named). */\n label: string;\n /** Direction of the toolbar: Left/Right move between controls, or Up/Down when vertical. Default \"horizontal\". */\n orientation?: \"horizontal\" | \"vertical\";\n /** Arrow keys wrap from the last item to the first. */\n loop?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n /** Buttons, IconButtons, SegmentedControls, fields. */\n children?: ReactNode;\n /** Test id, set on the toolbar element. */\n \"data-testid\"?: string;\n}\n\n/** APG toolbar: one Tab stop; arrow keys move between controls (RTL aware), Home and End jump. */\nexport function Toolbar({\n label,\n orientation = \"horizontal\",\n loop = true,\n className,\n style,\n children,\n ...rest\n}: ToolbarProps) {\n const ref = useRef<HTMLDivElement>(null);\n useRovingFocus(ref, { orientation, loop, selector: TOOLBAR_ITEMS });\n return (\n <div\n ref={ref}\n {...rest}\n role=\"toolbar\"\n aria-label={label}\n aria-orientation={orientation}\n className={className ? `cy-toolbar ${className}` : \"cy-toolbar\"}\n style={style}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAqBA,SAAgBI,EAAQ,EACtB,OAAAC,GACA,aAAAC,IAAc,cACd,MAAAC,IAAO,IACP,WAAAC,GACA,OAAAC,GACA,UAAAC,GACA,GAAGC,EAAA,GACY;AACf,QAAMC,IAAMV,EAAuB,IAAI;AACvC,SAAAD,EAAeW,GAAK;AAAA,IAAE,aAAAN;AAAA,IAAa,MAAAC;AAAA,IAAM,UAAUP;AAAA,EAAc,CAAC,GAEhE,gBAAAG,EAAC,OAAD;AAAA,IACO,KAAAS;AAAA,IACL,GAAID;AAAA,IACJ,MAAK;AAAA,IACL,cAAYN;AAAA,IACZ,oBAAkBC;AAAA,IAClB,WAAWE,IAAY,cAAcA,CAAA,KAAc;AAAA,IAC5C,OAAAC;AAAA,IAEN,UAAAC;AAAA,EACE,CAAA;AAET"}
@@ -20,9 +20,31 @@ export interface TooltipProps {
20
20
  placement?: Placement;
21
21
  /** Hover delay in ms (focus opens immediately). */
22
22
  delay?: number;
23
+ /**
24
+ * Added to the element around the trigger (the anchor, the box the parent lays out), for layout: a grid area,
25
+ * `flex`, margins.
26
+ */
27
+ className?: string | undefined;
28
+ /**
29
+ * Turn the tooltip off without remounting the trigger: no tip, no description, hover and focus do nothing. For a
30
+ * tooltip that only matters sometimes, such as the full text of a label while it is cut short.
31
+ */
32
+ disabled?: boolean | undefined;
33
+ /**
34
+ * `false` when the tip only repeats text the trigger's name already holds, such as a label cut short with an
35
+ * ellipsis: it is shown but hidden from assistive technology, and does not describe the trigger. Default true.
36
+ */
37
+ describe?: boolean | undefined;
38
+ /**
39
+ * Show the tip only while text is cut short (it overflows its box, as with an ellipsis), for the full text of a
40
+ * label: `true` measures the trigger, a function picks the element inside it that holds the text. It is measured
41
+ * after every render and whenever the element is resized, and the tip repeats the trigger's name, so it implies
42
+ * `describe={false}`.
43
+ */
44
+ whenTruncated?: boolean | ((trigger: HTMLElement) => HTMLElement | null) | undefined;
23
45
  }
24
46
  /**
25
47
  * Tooltip in the top layer (Popover API), positioned against its trigger. Opens on hover after `delay` and on
26
48
  * keyboard focus; dismissible with Escape; hoverable; never opens on touch (WCAG 1.4.13).
27
49
  */
28
- export declare function Tooltip({ content, children, placement, delay }: TooltipProps): import("react").JSX.Element;
50
+ export declare function Tooltip({ content, children, placement, delay, className, disabled: off, describe: describes, whenTruncated, }: TooltipProps): import("react").JSX.Element;