@arshad-shah/cynosure 0.4.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 (511) 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 +2 -1
  4. package/dist/adapters/astro/index.js.map +1 -1
  5. package/dist/components/Accordion/Accordion.d.ts +1 -1
  6. package/dist/components/Accordion/Accordion.js +26 -26
  7. package/dist/components/Accordion/Accordion.js.map +1 -1
  8. package/dist/components/Announcer/Announcer.d.ts +2 -1
  9. package/dist/components/Announcer/Announcer.js +31 -33
  10. package/dist/components/Announcer/Announcer.js.map +1 -1
  11. package/dist/components/AppShell/AppShell.js +44 -41
  12. package/dist/components/AppShell/AppShell.js.map +1 -1
  13. package/dist/components/Badge/Badge.d.ts +19 -5
  14. package/dist/components/Badge/Badge.js +19 -13
  15. package/dist/components/Badge/Badge.js.map +1 -1
  16. package/dist/components/Button/Button.d.ts +13 -3
  17. package/dist/components/Button/Button.js +34 -33
  18. package/dist/components/Button/Button.js.map +1 -1
  19. package/dist/components/Calendar/Calendar.js +155 -158
  20. package/dist/components/Calendar/Calendar.js.map +1 -1
  21. package/dist/components/Calendar/dates.js +42 -38
  22. package/dist/components/Calendar/dates.js.map +1 -1
  23. package/dist/components/Card/Card.d.ts +14 -1
  24. package/dist/components/Card/Card.js +60 -52
  25. package/dist/components/Card/Card.js.map +1 -1
  26. package/dist/components/ChatMessage/ChatMessage.d.ts +55 -0
  27. package/dist/components/ChatMessage/ChatMessage.js +50 -0
  28. package/dist/components/ChatMessage/ChatMessage.js.map +1 -0
  29. package/dist/components/ChatMessage/index.d.ts +1 -0
  30. package/dist/components/CodeBlock/CodeBlock.d.ts +6 -1
  31. package/dist/components/CodeBlock/CodeBlock.js +40 -37
  32. package/dist/components/CodeBlock/CodeBlock.js.map +1 -1
  33. package/dist/components/ColorField/ColorField.d.ts +3 -2
  34. package/dist/components/ColorField/ColorField.js +138 -139
  35. package/dist/components/ColorField/ColorField.js.map +1 -1
  36. package/dist/components/ColorField/read-color.js +5 -6
  37. package/dist/components/ColorField/read-color.js.map +1 -1
  38. package/dist/components/ColorSwatches/ColorSwatches.js +42 -33
  39. package/dist/components/ColorSwatches/ColorSwatches.js.map +1 -1
  40. package/dist/components/Combobox/Combobox.d.ts +13 -2
  41. package/dist/components/Combobox/Combobox.js +113 -95
  42. package/dist/components/Combobox/Combobox.js.map +1 -1
  43. package/dist/components/CommandPalette/CommandPalette.d.ts +14 -1
  44. package/dist/components/CommandPalette/CommandPalette.js +153 -109
  45. package/dist/components/CommandPalette/CommandPalette.js.map +1 -1
  46. package/dist/components/CommandPalette/index.d.ts +1 -1
  47. package/dist/components/CompareSlider/CompareSlider.js +14 -14
  48. package/dist/components/CompareSlider/CompareSlider.js.map +1 -1
  49. package/dist/components/Container/Container.d.ts +1 -1
  50. package/dist/components/Container/Container.js +1 -1
  51. package/dist/components/Container/Container.js.map +1 -1
  52. package/dist/components/ContextMenu/ContextMenu.d.ts +27 -13
  53. package/dist/components/ContextMenu/ContextMenu.js +64 -46
  54. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  55. package/dist/components/CopyButton/CopyButton.js +38 -39
  56. package/dist/components/CopyButton/CopyButton.js.map +1 -1
  57. package/dist/components/DataGrid/DataGrid.d.ts +135 -0
  58. package/dist/components/DataGrid/DataGrid.js +385 -0
  59. package/dist/components/DataGrid/DataGrid.js.map +1 -0
  60. package/dist/components/DataGrid/index.d.ts +1 -0
  61. package/dist/components/DateField/DateField.d.ts +4 -3
  62. package/dist/components/DateField/DateField.js +70 -59
  63. package/dist/components/DateField/DateField.js.map +1 -1
  64. package/dist/components/Dialog/Dialog.js +76 -80
  65. package/dist/components/Dialog/Dialog.js.map +1 -1
  66. package/dist/components/Disclosure/Disclosure.d.ts +15 -1
  67. package/dist/components/Disclosure/Disclosure.js +37 -30
  68. package/dist/components/Disclosure/Disclosure.js.map +1 -1
  69. package/dist/components/DocumentViewport/DocumentViewport.js +54 -57
  70. package/dist/components/DocumentViewport/DocumentViewport.js.map +1 -1
  71. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +59 -0
  72. package/dist/components/ErrorBoundary/ErrorBoundary.js +53 -0
  73. package/dist/components/ErrorBoundary/ErrorBoundary.js.map +1 -0
  74. package/dist/components/ErrorBoundary/index.d.ts +1 -0
  75. package/dist/components/Field/Field.d.ts +38 -5
  76. package/dist/components/Field/Field.js +47 -39
  77. package/dist/components/Field/Field.js.map +1 -1
  78. package/dist/components/Field/index.d.ts +1 -1
  79. package/dist/components/FileDrop/FileDrop.d.ts +26 -1
  80. package/dist/components/FileDrop/FileDrop.js +149 -98
  81. package/dist/components/FileDrop/FileDrop.js.map +1 -1
  82. package/dist/components/FloatingToolbar/FloatingToolbar.js +83 -81
  83. package/dist/components/FloatingToolbar/FloatingToolbar.js.map +1 -1
  84. package/dist/components/Grid/Grid.d.ts +3 -3
  85. package/dist/components/Grid/Grid.js +55 -47
  86. package/dist/components/Grid/Grid.js.map +1 -1
  87. package/dist/components/HighlightedText/HighlightedText.d.ts +40 -0
  88. package/dist/components/HighlightedText/HighlightedText.js +36 -0
  89. package/dist/components/HighlightedText/HighlightedText.js.map +1 -0
  90. package/dist/components/HighlightedText/index.d.ts +2 -0
  91. package/dist/components/HotkeyField/HotkeyField.d.ts +84 -0
  92. package/dist/components/HotkeyField/HotkeyField.js +161 -0
  93. package/dist/components/HotkeyField/HotkeyField.js.map +1 -0
  94. package/dist/components/HotkeyField/index.d.ts +1 -0
  95. package/dist/components/HoverCard/HoverCard.js +6 -6
  96. package/dist/components/HoverCard/HoverCard.js.map +1 -1
  97. package/dist/components/IconButton/IconButton.js +16 -15
  98. package/dist/components/IconButton/IconButton.js.map +1 -1
  99. package/dist/components/Inline/Inline.d.ts +2 -2
  100. package/dist/components/Inline/Inline.js.map +1 -1
  101. package/dist/components/Kbd/Kbd.d.ts +0 -2
  102. package/dist/components/Kbd/Kbd.js +16 -22
  103. package/dist/components/Kbd/Kbd.js.map +1 -1
  104. package/dist/components/KeyValueEditor/bulk.js +3 -4
  105. package/dist/components/KeyValueEditor/bulk.js.map +1 -1
  106. package/dist/components/ListRow/ListRow.d.ts +105 -0
  107. package/dist/components/ListRow/ListRow.js +164 -0
  108. package/dist/components/ListRow/ListRow.js.map +1 -0
  109. package/dist/components/ListRow/index.d.ts +1 -0
  110. package/dist/components/LoadingDots/LoadingDots.d.ts +7 -2
  111. package/dist/components/LoadingDots/LoadingDots.js +28 -18
  112. package/dist/components/LoadingDots/LoadingDots.js.map +1 -1
  113. package/dist/components/Menu/Menu.d.ts +29 -11
  114. package/dist/components/Menu/Menu.js +204 -111
  115. package/dist/components/Menu/Menu.js.map +1 -1
  116. package/dist/components/Menubar/Menubar.d.ts +40 -0
  117. package/dist/components/Menubar/Menubar.js +82 -0
  118. package/dist/components/Menubar/Menubar.js.map +1 -0
  119. package/dist/components/Menubar/index.d.ts +1 -0
  120. package/dist/components/Notice/Notice.d.ts +11 -2
  121. package/dist/components/Notice/Notice.js +31 -28
  122. package/dist/components/Notice/Notice.js.map +1 -1
  123. package/dist/components/NumberField/NumberField.d.ts +8 -3
  124. package/dist/components/NumberField/NumberField.js +151 -100
  125. package/dist/components/NumberField/NumberField.js.map +1 -1
  126. package/dist/components/OptionList/OptionList.d.ts +36 -3
  127. package/dist/components/OptionList/OptionList.js +65 -42
  128. package/dist/components/OptionList/OptionList.js.map +1 -1
  129. package/dist/components/OptionList/index.d.ts +1 -1
  130. package/dist/components/OverlayFrame/OverlayFrame.d.ts +33 -0
  131. package/dist/components/OverlayFrame/OverlayFrame.js +20 -0
  132. package/dist/components/OverlayFrame/OverlayFrame.js.map +1 -0
  133. package/dist/components/OverlayFrame/index.d.ts +1 -0
  134. package/dist/components/PanZoomCanvas/PanZoomCanvas.d.ts +71 -4
  135. package/dist/components/PanZoomCanvas/PanZoomCanvas.js +197 -141
  136. package/dist/components/PanZoomCanvas/PanZoomCanvas.js.map +1 -1
  137. package/dist/components/PanZoomCanvas/index.d.ts +1 -1
  138. package/dist/components/PathField/PathField.d.ts +68 -0
  139. package/dist/components/PathField/PathField.js +67 -0
  140. package/dist/components/PathField/PathField.js.map +1 -0
  141. package/dist/components/PathField/index.d.ts +1 -0
  142. package/dist/components/Popover/Popover.d.ts +16 -3
  143. package/dist/components/Popover/Popover.js +51 -42
  144. package/dist/components/Popover/Popover.js.map +1 -1
  145. package/dist/components/ProgressBar/ProgressBar.d.ts +4 -3
  146. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  147. package/dist/components/RowActions/RowActions.d.ts +35 -0
  148. package/dist/components/RowActions/RowActions.js +38 -0
  149. package/dist/components/RowActions/RowActions.js.map +1 -0
  150. package/dist/components/RowActions/index.d.ts +1 -0
  151. package/dist/components/ScrollArea/ScrollArea.d.ts +55 -0
  152. package/dist/components/ScrollArea/ScrollArea.js +55 -0
  153. package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
  154. package/dist/components/ScrollArea/index.d.ts +1 -0
  155. package/dist/components/SearchField/SearchField.d.ts +17 -0
  156. package/dist/components/SearchField/SearchField.js +31 -17
  157. package/dist/components/SearchField/SearchField.js.map +1 -1
  158. package/dist/components/SearchField/index.d.ts +1 -1
  159. package/dist/components/Section/Section.d.ts +1 -1
  160. package/dist/components/Section/Section.js +1 -1
  161. package/dist/components/Section/Section.js.map +1 -1
  162. package/dist/components/SegmentedControl/SegmentedControl.d.ts +6 -3
  163. package/dist/components/SegmentedControl/SegmentedControl.js +23 -19
  164. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  165. package/dist/components/Select/Select.d.ts +22 -6
  166. package/dist/components/Select/Select.js +155 -129
  167. package/dist/components/Select/Select.js.map +1 -1
  168. package/dist/components/SelectionFrame/frame-math.js +19 -20
  169. package/dist/components/SelectionFrame/frame-math.js.map +1 -1
  170. package/dist/components/SideNav/SideNav.d.ts +13 -1
  171. package/dist/components/SideNav/SideNav.js +98 -91
  172. package/dist/components/SideNav/SideNav.js.map +1 -1
  173. package/dist/components/SignaturePad/SignaturePad.js +63 -62
  174. package/dist/components/SignaturePad/SignaturePad.js.map +1 -1
  175. package/dist/components/SignaturePad/ink.js +0 -1
  176. package/dist/components/SignaturePad/ink.js.map +1 -1
  177. package/dist/components/Slider/Slider.js +88 -91
  178. package/dist/components/Slider/Slider.js.map +1 -1
  179. package/dist/components/SortButton/SortButton.d.ts +36 -0
  180. package/dist/components/SortButton/SortButton.js +35 -0
  181. package/dist/components/SortButton/SortButton.js.map +1 -0
  182. package/dist/components/SortButton/index.d.ts +1 -0
  183. package/dist/components/SortableList/SortableList.js +145 -119
  184. package/dist/components/SortableList/SortableList.js.map +1 -1
  185. package/dist/components/SplitPane/SplitPane.d.ts +32 -12
  186. package/dist/components/SplitPane/SplitPane.js +105 -59
  187. package/dist/components/SplitPane/SplitPane.js.map +1 -1
  188. package/dist/components/Stack/Stack.d.ts +2 -2
  189. package/dist/components/Stack/Stack.js +24 -17
  190. package/dist/components/Stack/Stack.js.map +1 -1
  191. package/dist/components/Stack/index.d.ts +1 -1
  192. package/dist/components/Stat/Stat.js +6 -6
  193. package/dist/components/Stat/Stat.js.map +1 -1
  194. package/dist/components/StatusBar/StatusBar.d.ts +95 -0
  195. package/dist/components/StatusBar/StatusBar.js +110 -0
  196. package/dist/components/StatusBar/StatusBar.js.map +1 -0
  197. package/dist/components/StatusBar/index.d.ts +1 -0
  198. package/dist/components/Table/Table.d.ts +6 -6
  199. package/dist/components/Table/Table.js +71 -99
  200. package/dist/components/Table/Table.js.map +1 -1
  201. package/dist/components/Tabs/Tabs.d.ts +51 -5
  202. package/dist/components/Tabs/Tabs.js +289 -171
  203. package/dist/components/Tabs/Tabs.js.map +1 -1
  204. package/dist/components/TagInput/TagInput.d.ts +10 -2
  205. package/dist/components/TagInput/TagInput.js +121 -111
  206. package/dist/components/TagInput/TagInput.js.map +1 -1
  207. package/dist/components/Text/Text.d.ts +6 -0
  208. package/dist/components/Text/Text.js +18 -17
  209. package/dist/components/Text/Text.js.map +1 -1
  210. package/dist/components/TextArea/TextArea.d.ts +37 -6
  211. package/dist/components/TextArea/TextArea.js +200 -72
  212. package/dist/components/TextArea/TextArea.js.map +1 -1
  213. package/dist/components/TextArea/index.d.ts +1 -1
  214. package/dist/components/TextField/TextField.d.ts +18 -6
  215. package/dist/components/TextField/TextField.js +59 -54
  216. package/dist/components/TextField/TextField.js.map +1 -1
  217. package/dist/components/TimeField/TimeField.d.ts +4 -3
  218. package/dist/components/TimeField/TimeField.js +197 -183
  219. package/dist/components/TimeField/TimeField.js.map +1 -1
  220. package/dist/components/TitleBar/TitleBar.d.ts +91 -0
  221. package/dist/components/TitleBar/TitleBar.js +80 -0
  222. package/dist/components/TitleBar/TitleBar.js.map +1 -0
  223. package/dist/components/TitleBar/index.d.ts +1 -0
  224. package/dist/components/Toast/Toast.d.ts +17 -2
  225. package/dist/components/Toast/Toast.js +162 -145
  226. package/dist/components/Toast/Toast.js.map +1 -1
  227. package/dist/components/Toast/index.d.ts +1 -1
  228. package/dist/components/Toolbar/Toolbar.js +11 -12
  229. package/dist/components/Toolbar/Toolbar.js.map +1 -1
  230. package/dist/components/Tooltip/Tooltip.d.ts +18 -1
  231. package/dist/components/Tooltip/Tooltip.js +50 -31
  232. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  233. package/dist/components/Tree/Tree.d.ts +92 -11
  234. package/dist/components/Tree/Tree.js +332 -164
  235. package/dist/components/Tree/Tree.js.map +1 -1
  236. package/dist/components/VirtualList/VirtualList.d.ts +27 -4
  237. package/dist/components/VirtualList/VirtualList.js +179 -145
  238. package/dist/components/VirtualList/VirtualList.js.map +1 -1
  239. package/dist/components/VirtualList/index.d.ts +1 -1
  240. package/dist/components/ZoomControls/ZoomControls.d.ts +6 -2
  241. package/dist/components/ZoomControls/ZoomControls.js +37 -37
  242. package/dist/components/ZoomControls/ZoomControls.js.map +1 -1
  243. package/dist/entries/tokens.js +22 -16
  244. package/dist/foundations/ChoiceBase/ChoiceBase.js +15 -13
  245. package/dist/foundations/ChoiceBase/ChoiceBase.js.map +1 -1
  246. package/dist/foundations/LiveRegion/LiveRegion.d.ts +33 -0
  247. package/dist/foundations/LiveRegion/LiveRegion.js +29 -0
  248. package/dist/foundations/LiveRegion/LiveRegion.js.map +1 -0
  249. package/dist/foundations/LiveRegion/index.d.ts +1 -0
  250. package/dist/foundations/canvas-size.d.ts +14 -0
  251. package/dist/foundations/canvas-size.js +32 -0
  252. package/dist/foundations/canvas-size.js.map +1 -0
  253. package/dist/foundations/dir.js +0 -1
  254. package/dist/foundations/dir.js.map +1 -1
  255. package/dist/foundations/draft.d.ts +14 -0
  256. package/dist/foundations/draft.js +22 -0
  257. package/dist/foundations/draft.js.map +1 -0
  258. package/dist/foundations/edge.d.ts +20 -0
  259. package/dist/foundations/edge.js +26 -0
  260. package/dist/foundations/edge.js.map +1 -0
  261. package/dist/foundations/focus.d.ts +5 -0
  262. package/dist/foundations/focus.js +10 -0
  263. package/dist/foundations/focus.js.map +1 -0
  264. package/dist/foundations/hotkey.d.ts +23 -1
  265. package/dist/foundations/hotkey.js +48 -26
  266. package/dist/foundations/hotkey.js.map +1 -1
  267. package/dist/foundations/icon-size.d.ts +7 -0
  268. package/dist/foundations/icon-size.js +6 -0
  269. package/dist/foundations/icon-size.js.map +1 -0
  270. package/dist/foundations/keys.js +12 -13
  271. package/dist/foundations/keys.js.map +1 -1
  272. package/dist/{components/Stack/space.d.ts → foundations/layout.d.ts} +34 -0
  273. package/dist/foundations/layout.js +29 -0
  274. package/dist/foundations/layout.js.map +1 -0
  275. package/dist/foundations/listbox.d.ts +47 -2
  276. package/dist/foundations/listbox.js +56 -25
  277. package/dist/foundations/listbox.js.map +1 -1
  278. package/dist/foundations/math.d.ts +25 -0
  279. package/dist/foundations/math.js +14 -3
  280. package/dist/foundations/math.js.map +1 -1
  281. package/dist/foundations/media-query.d.ts +5 -0
  282. package/dist/foundations/media-query.js +14 -0
  283. package/dist/foundations/media-query.js.map +1 -0
  284. package/dist/foundations/motion.d.ts +12 -0
  285. package/dist/foundations/motion.js +21 -0
  286. package/dist/foundations/motion.js.map +1 -0
  287. package/dist/foundations/option-icon.d.ts +3 -1
  288. package/dist/foundations/option-icon.js +6 -6
  289. package/dist/foundations/option-icon.js.map +1 -1
  290. package/dist/foundations/qr.js +0 -1
  291. package/dist/foundations/qr.js.map +1 -1
  292. package/dist/foundations/refs.d.ts +8 -0
  293. package/dist/foundations/refs.js +14 -0
  294. package/dist/foundations/refs.js.map +1 -0
  295. package/dist/foundations/reorder.js +5 -6
  296. package/dist/foundations/reorder.js.map +1 -1
  297. package/dist/foundations/roving-focus.d.ts +10 -0
  298. package/dist/foundations/roving-focus.js +34 -31
  299. package/dist/foundations/roving-focus.js.map +1 -1
  300. package/dist/foundations/scroll-align.d.ts +11 -0
  301. package/dist/foundations/scroll-align.js +8 -0
  302. package/dist/foundations/scroll-align.js.map +1 -0
  303. package/dist/foundations/sort.d.ts +13 -0
  304. package/dist/foundations/sort.js +26 -0
  305. package/dist/foundations/sort.js.map +1 -0
  306. package/dist/foundations/text-match.d.ts +11 -0
  307. package/dist/foundations/text-match.js +20 -0
  308. package/dist/foundations/text-match.js.map +1 -0
  309. package/dist/foundations/tone-icons.js +4 -5
  310. package/dist/foundations/tone-icons.js.map +1 -1
  311. package/dist/foundations/use-follow.d.ts +29 -0
  312. package/dist/foundations/use-follow.js +51 -0
  313. package/dist/foundations/use-follow.js.map +1 -0
  314. package/dist/foundations/virtual-window.d.ts +22 -5
  315. package/dist/foundations/virtual-window.js +58 -54
  316. package/dist/foundations/virtual-window.js.map +1 -1
  317. package/dist/foundations/zoom-gestures.d.ts +23 -1
  318. package/dist/foundations/zoom-gestures.js +123 -84
  319. package/dist/foundations/zoom-gestures.js.map +1 -1
  320. package/dist/foundations/zoom.d.ts +10 -4
  321. package/dist/foundations/zoom.js +16 -17
  322. package/dist/foundations/zoom.js.map +1 -1
  323. package/dist/icons/boxes.d.ts +2 -0
  324. package/dist/icons/boxes.js +34 -0
  325. package/dist/icons/boxes.js.map +1 -0
  326. package/dist/icons/by-name.d.ts +11 -0
  327. package/dist/icons/by-name.js +11 -0
  328. package/dist/icons/by-name.js.map +1 -0
  329. package/dist/icons/cable.d.ts +2 -0
  330. package/dist/icons/cable.js +14 -0
  331. package/dist/icons/cable.js.map +1 -0
  332. package/dist/icons/check-check.d.ts +2 -0
  333. package/dist/icons/check-check.js +17 -0
  334. package/dist/icons/check-check.js.map +1 -0
  335. package/dist/icons/clipboard-paste.d.ts +2 -0
  336. package/dist/icons/clipboard-paste.js +30 -0
  337. package/dist/icons/clipboard-paste.js.map +1 -0
  338. package/dist/icons/facet.d.ts +274 -0
  339. package/dist/icons/facet.js +830 -0
  340. package/dist/icons/facet.js.map +1 -0
  341. package/dist/icons/file-plus.d.ts +2 -0
  342. package/dist/icons/file-plus.js +14 -0
  343. package/dist/icons/file-plus.js.map +1 -0
  344. package/dist/icons/file-question.d.ts +2 -0
  345. package/dist/icons/file-question.js +14 -0
  346. package/dist/icons/file-question.js.map +1 -0
  347. package/dist/icons/file-search.d.ts +2 -0
  348. package/dist/icons/file-search.js +24 -0
  349. package/dist/icons/file-search.js.map +1 -0
  350. package/dist/icons/function.d.ts +2 -0
  351. package/dist/icons/function.js +20 -0
  352. package/dist/icons/function.js.map +1 -0
  353. package/dist/icons/gauge.d.ts +2 -0
  354. package/dist/icons/gauge.js +14 -0
  355. package/dist/icons/gauge.js.map +1 -0
  356. package/dist/icons/hourglass.d.ts +2 -0
  357. package/dist/icons/hourglass.js +14 -0
  358. package/dist/icons/hourglass.js.map +1 -0
  359. package/dist/icons/index.d.ts +1 -250
  360. package/dist/icons/index.js +548 -500
  361. package/dist/icons/keywords.d.ts +24 -0
  362. package/dist/icons/keywords.js +185 -0
  363. package/dist/icons/keywords.js.map +1 -1
  364. package/dist/icons/languages.d.ts +2 -0
  365. package/dist/icons/languages.js +14 -0
  366. package/dist/icons/languages.js.map +1 -0
  367. package/dist/icons/loader.d.ts +2 -0
  368. package/dist/icons/loader.js +14 -0
  369. package/dist/icons/loader.js.map +1 -0
  370. package/dist/icons/monitor-down.d.ts +2 -0
  371. package/dist/icons/monitor-down.js +24 -0
  372. package/dist/icons/monitor-down.js.map +1 -0
  373. package/dist/icons/panel-right.d.ts +2 -0
  374. package/dist/icons/panel-right.js +20 -0
  375. package/dist/icons/panel-right.js.map +1 -0
  376. package/dist/icons/party-popper.d.ts +2 -0
  377. package/dist/icons/party-popper.js +14 -0
  378. package/dist/icons/party-popper.js.map +1 -0
  379. package/dist/icons/power-off.d.ts +2 -0
  380. package/dist/icons/power-off.js +14 -0
  381. package/dist/icons/power-off.js.map +1 -0
  382. package/dist/icons/rocket.d.ts +2 -0
  383. package/dist/icons/rocket.js +21 -0
  384. package/dist/icons/rocket.js.map +1 -0
  385. package/dist/icons/rows.d.ts +2 -0
  386. package/dist/icons/rows.js +20 -0
  387. package/dist/icons/rows.js.map +1 -0
  388. package/dist/icons/scissors.d.ts +2 -0
  389. package/dist/icons/scissors.js +26 -0
  390. package/dist/icons/scissors.js.map +1 -0
  391. package/dist/icons/shield-question.d.ts +2 -0
  392. package/dist/icons/shield-question.js +14 -0
  393. package/dist/icons/shield-question.js.map +1 -0
  394. package/dist/icons/square-plus.d.ts +2 -0
  395. package/dist/icons/square-plus.js +20 -0
  396. package/dist/icons/square-plus.js.map +1 -0
  397. package/dist/icons/text-select.d.ts +2 -0
  398. package/dist/icons/text-select.js +14 -0
  399. package/dist/icons/text-select.js.map +1 -0
  400. package/dist/icons/window-maximize.d.ts +2 -0
  401. package/dist/icons/window-maximize.js +14 -0
  402. package/dist/icons/window-maximize.js.map +1 -0
  403. package/dist/icons/window-restore.d.ts +2 -0
  404. package/dist/icons/window-restore.js +20 -0
  405. package/dist/icons/window-restore.js.map +1 -0
  406. package/dist/index.d.ts +24 -9
  407. package/dist/index.js +326 -282
  408. package/dist/overlay/dismiss.js +15 -13
  409. package/dist/overlay/dismiss.js.map +1 -1
  410. package/dist/overlay/floating.d.ts +7 -2
  411. package/dist/overlay/floating.js +29 -21
  412. package/dist/overlay/floating.js.map +1 -1
  413. package/dist/overlay/listbox-layer.d.ts +3 -2
  414. package/dist/overlay/listbox-layer.js.map +1 -1
  415. package/dist/overlay/position.d.ts +5 -2
  416. package/dist/overlay/position.js +19 -19
  417. package/dist/overlay/position.js.map +1 -1
  418. package/dist/overlay/toast-host.js +3 -2
  419. package/dist/overlay/toast-host.js.map +1 -1
  420. package/dist/overlay/use-anchored-position.d.ts +2 -2
  421. package/dist/overlay/use-anchored-position.js +25 -25
  422. package/dist/overlay/use-anchored-position.js.map +1 -1
  423. package/dist/styles/badge.css +1 -1
  424. package/dist/styles/base.css +1 -1
  425. package/dist/styles/button.css +1 -1
  426. package/dist/styles/calendar.css +1 -1
  427. package/dist/styles/card.css +1 -1
  428. package/dist/styles/chat-message.css +1 -0
  429. package/dist/styles/code-block.css +1 -1
  430. package/dist/styles/command-palette.css +1 -1
  431. package/dist/styles/data-grid.css +1 -0
  432. package/dist/styles/disclosure.css +1 -1
  433. package/dist/styles/error-boundary.css +1 -0
  434. package/dist/styles/field.css +1 -1
  435. package/dist/styles/file-drop.css +1 -1
  436. package/dist/styles/generated-css.d.ts +1 -1
  437. package/dist/styles/generated-css.js +3 -3
  438. package/dist/styles/generated-css.js.map +1 -1
  439. package/dist/styles/highlighted-text.css +1 -0
  440. package/dist/styles/hotkey-field.css +1 -0
  441. package/dist/styles/list-row.css +1 -0
  442. package/dist/styles/loading-dots.css +1 -1
  443. package/dist/styles/manifest.json +149 -12
  444. package/dist/styles/menu.css +1 -1
  445. package/dist/styles/menubar.css +1 -0
  446. package/dist/styles/notice.css +1 -1
  447. package/dist/styles/option-list.css +1 -1
  448. package/dist/styles/overlay-frame.css +1 -0
  449. package/dist/styles/pan-zoom-canvas.css +1 -1
  450. package/dist/styles/path-field.css +1 -0
  451. package/dist/styles/popover.css +1 -1
  452. package/dist/styles/progress-bar.css +1 -1
  453. package/dist/styles/row-actions.css +1 -0
  454. package/dist/styles/scroll-area.css +1 -0
  455. package/dist/styles/search-field.css +1 -0
  456. package/dist/styles/segmented-control.css +1 -1
  457. package/dist/styles/select.css +1 -1
  458. package/dist/styles/side-nav.css +1 -1
  459. package/dist/styles/sort-button.css +1 -0
  460. package/dist/styles/split-pane.css +1 -1
  461. package/dist/styles/status-bar.css +1 -0
  462. package/dist/styles/table.css +1 -1
  463. package/dist/styles/tabs.css +1 -1
  464. package/dist/styles/text-area.css +1 -1
  465. package/dist/styles/text-field.css +1 -1
  466. package/dist/styles/text.css +1 -1
  467. package/dist/styles/title-bar.css +1 -0
  468. package/dist/styles/toast.css +1 -1
  469. package/dist/styles/tokens.css +3 -3
  470. package/dist/styles/tree.css +1 -1
  471. package/dist/styles/virtual-list.css +1 -1
  472. package/dist/styles.css +3 -3
  473. package/dist/theme/CynosureTheme.d.ts +7 -3
  474. package/dist/theme/CynosureTheme.js +47 -31
  475. package/dist/theme/CynosureTheme.js.map +1 -1
  476. package/dist/theme/index.d.ts +1 -0
  477. package/dist/theme/theme-context.d.ts +9 -0
  478. package/dist/theme/theme-context.js +8 -0
  479. package/dist/theme/theme-context.js.map +1 -0
  480. package/dist/theme/theme-init-script.js +0 -1
  481. package/dist/theme/theme-init-script.js.map +1 -1
  482. package/dist/theme/use-color-mode.d.ts +3 -2
  483. package/dist/theme/use-color-mode.js +35 -38
  484. package/dist/theme/use-color-mode.js.map +1 -1
  485. package/dist/theme/use-cynosure-theme.d.ts +18 -0
  486. package/dist/theme/use-cynosure-theme.js +23 -0
  487. package/dist/theme/use-cynosure-theme.js.map +1 -0
  488. package/dist/tokens/chart-themes.d.ts +38 -0
  489. package/dist/tokens/chart-themes.js +35 -0
  490. package/dist/tokens/chart-themes.js.map +1 -0
  491. package/dist/tokens/create-theme.d.ts +11 -1
  492. package/dist/tokens/create-theme.js +161 -121
  493. package/dist/tokens/create-theme.js.map +1 -1
  494. package/dist/tokens/defaults.d.ts +3 -3
  495. package/dist/tokens/defaults.js +1 -0
  496. package/dist/tokens/defaults.js.map +1 -1
  497. package/dist/tokens/editor-themes.d.ts +9 -2
  498. package/dist/tokens/editor-themes.js +43 -42
  499. package/dist/tokens/editor-themes.js.map +1 -1
  500. package/dist/tokens/index.d.ts +3 -1
  501. package/dist/tokens/named-themes.d.ts +41 -0
  502. package/dist/tokens/named-themes.js +118 -0
  503. package/dist/tokens/named-themes.js.map +1 -0
  504. package/dist/tokens/schema.d.ts +24 -1
  505. package/dist/tokens/schema.js +13 -0
  506. package/dist/tokens/schema.js.map +1 -0
  507. package/dist/tokens/to-css.js +34 -31
  508. package/dist/tokens/to-css.js.map +1 -1
  509. package/package.json +10 -6
  510. package/dist/components/Stack/space.js +0 -23
  511. package/dist/components/Stack/space.js.map +0 -1
@@ -19,17 +19,30 @@ export interface ContextMenuTargetProps {
19
19
  /** Spread onto the target: tells assistive tech that Shift+F10 opens the menu. */
20
20
  "aria-keyshortcuts": "Shift+F10";
21
21
  }
22
- export interface ContextMenuProps {
23
- /** Render the target: `(props) => <div {...props} tabIndex={0}>…</div>`. Make it focusable for keyboard users. */
24
- children: (props: ContextMenuTargetProps) => ReactNode;
25
- /** Accessible name of the menu. */
26
- label: string;
27
- /** The commands, as in `Menu`: items, or sections of items with a group name. */
28
- items: MenuEntry[];
29
- /** Called when an item is chosen, with its `value`. */
30
- onSelect: (value: string) => void;
31
- /** Called when the menu opens or closes, e.g. to highlight the row it belongs to. */
32
- onOpenChange?: ((open: boolean) => void) | undefined;
22
+ /**
23
+ * The props for one of many targets (`targetFor(key)`): the same handlers without the ref. The menu returns focus to
24
+ * the element that opened it.
25
+ */
26
+ export type ContextMenuKeyTargetProps = Omit<ContextMenuTargetProps, "ref">;
27
+ export interface ContextMenuProps<K = undefined> {
28
+ /**
29
+ * Render the target: `(props) => <div {...props} tabIndex={0}>…</div>`. Make it focusable for keyboard users. For
30
+ * many targets (the rows of a list, the tabs of a tab list), spread `targetFor(key)` onto each instead, with a key
31
+ * (any value, such as the row's item) that `label`, `items`, `onSelect` and `onOpenChange` receive back. One menu
32
+ * then serves them all, beside the list rather than inside it.
33
+ */
34
+ children: (props: ContextMenuTargetProps, targetFor: (key: K) => ContextMenuKeyTargetProps) => ReactNode;
35
+ /** Accessible name of the menu; with many targets, a function of the key of the target it opened for. */
36
+ label: string | ((key: K) => string);
37
+ /**
38
+ * The commands, as in `Menu`: items, or sections of items with a group name. With many targets, a function of the
39
+ * key of the target it opened for.
40
+ */
41
+ items: MenuEntry[] | ((key: K) => MenuEntry[]);
42
+ /** Called when an item is chosen, with its `value` (and, with many targets, the key of the target). */
43
+ onSelect: (value: string, key: K) => void;
44
+ /** Called when the menu opens or closes, e.g. to highlight the row it belongs to (with many targets, its key). */
45
+ onOpenChange?: ((open: boolean, key: K) => void) | undefined;
33
46
  /** The browser's own menu shows instead. */
34
47
  disabled?: boolean;
35
48
  /** Added to the menu panel, for layout. */
@@ -39,6 +52,7 @@ export interface ContextMenuProps {
39
52
  }
40
53
  /**
41
54
  * A menu of commands for one thing, opened where the person points: right-click, a long press on touch screens,
42
- * or Shift+F10 / the context menu key on the focused target. The menu itself behaves like `Menu`.
55
+ * or Shift+F10 / the context menu key on the focused target. The menu itself behaves like `Menu`. One ContextMenu
56
+ * can serve many targets (rows, tabs) through `targetFor`.
43
57
  */
44
- export declare function ContextMenu({ children, label, items, onSelect, onOpenChange, disabled, className, style, }: ContextMenuProps): import("react").JSX.Element;
58
+ export declare function ContextMenu<K = undefined>({ children, label, items, onSelect, onOpenChange, disabled, className, style, }: ContextMenuProps<K>): import("react").JSX.Element;
@@ -1,70 +1,88 @@
1
1
  "use client";
2
- import { MenuPanel as w } from "../Menu/Menu.js";
3
- import { useCallback as x, useEffect as P, useId as O, useRef as o, useState as R } from "react";
4
- import { Fragment as X, jsx as Y, jsxs as d } from "react/jsx-runtime";
5
- var K = 500, j = 10, M = (c, u) => ({ getBoundingClientRect: () => new DOMRect(c, u, 0, 0) });
6
- function B({ children: c, label: u, items: C, onSelect: T, onOpenChange: f, disabled: s = !1, className: D, style: F }) {
7
- const S = O(), [i, a] = R(!1), m = o(null), p = o(null), n = o(null), y = o(f);
8
- y.current = f;
9
- const l = x((t) => {
10
- p.current = t, a(!0);
11
- }, []), k = x(() => a(!1), []), g = o(!0);
12
- P(() => {
13
- if (g.current) {
14
- g.current = !1;
2
+ import { MenuPanel as L } from "../Menu/Menu.js";
3
+ import { useCallback as a, useEffect as D, useId as B, useRef as f, useState as O } from "react";
4
+ import { Fragment as G, jsx as I, jsxs as N } from "react/jsx-runtime";
5
+ var U = 500, _ = 10, S = (y, s) => ({ getBoundingClientRect: () => new DOMRect(y, s, 0, 0) });
6
+ function A({ children: y, label: s, items: d, onSelect: C, onOpenChange: P, disabled: T = !1, className: b, style: w }) {
7
+ const R = B(), [p, M] = O(!1), [c, X] = O(null), g = f(null), F = f(null), u = f(null), i = f({
8
+ disabled: T,
9
+ onOpenChange: P,
10
+ current: c
11
+ });
12
+ i.current = {
13
+ disabled: T,
14
+ onOpenChange: P,
15
+ current: c
16
+ };
17
+ const m = a((e, o, t, r) => {
18
+ g.current = t, F.current = r, X({
19
+ key: e,
20
+ keyed: o
21
+ }), M(!0);
22
+ }, []), Y = a(() => M(!1), []), k = f(!0);
23
+ D(() => {
24
+ if (k.current) {
25
+ k.current = !1;
15
26
  return;
16
27
  }
17
- y.current?.(i);
18
- }, [i]);
19
- const e = () => {
20
- n.current && clearTimeout(n.current.timer), n.current = null;
21
- };
22
- return P(() => e, []), /* @__PURE__ */ d(X, { children: [c({
23
- ref: m,
28
+ const { onOpenChange: e, current: o } = i.current;
29
+ o?.keyed ? e?.(p, o.key) : e?.(p);
30
+ }, [p]);
31
+ const n = a(() => {
32
+ u.current && clearTimeout(u.current.timer), u.current = null;
33
+ }, []);
34
+ D(() => n, [n]);
35
+ const h = a((e, o) => ({
24
36
  "aria-keyshortcuts": "Shift+F10",
25
37
  onContextMenu: (t) => {
26
- if (s) return;
27
- t.preventDefault(), e();
28
- const r = t.clientX === 0 && t.clientY === 0;
29
- l(r ? t.currentTarget : M(t.clientX, t.clientY));
38
+ if (i.current.disabled) return;
39
+ t.preventDefault(), n();
40
+ const r = t.clientX === 0 && t.clientY === 0, l = t.currentTarget;
41
+ m(e, o, l, r ? l : S(t.clientX, t.clientY));
30
42
  },
31
43
  onKeyDown: (t) => {
32
- s || t.target !== t.currentTarget || (t.key === "ContextMenu" || t.key === "F10" && t.shiftKey) && (t.preventDefault(), l(t.currentTarget));
44
+ i.current.disabled || t.target !== t.currentTarget || (t.key === "ContextMenu" || t.key === "F10" && t.shiftKey) && (t.preventDefault(), m(e, o, t.currentTarget, t.currentTarget));
33
45
  },
34
46
  onPointerDown: (t) => {
35
- if (s || t.pointerType !== "touch") return;
36
- const { clientX: r, clientY: h } = t;
37
- e(), n.current = {
47
+ if (i.current.disabled || t.pointerType !== "touch") return;
48
+ const { clientX: r, clientY: l, currentTarget: E } = t;
49
+ n(), u.current = {
38
50
  x: r,
39
- y: h,
40
- timer: setTimeout(() => l(M(r, h)), K)
51
+ y: l,
52
+ timer: setTimeout(() => m(e, o, E, S(r, l)), U)
41
53
  };
42
54
  },
43
55
  onPointerMove: (t) => {
44
- const r = n.current;
45
- r && Math.hypot(t.clientX - r.x, t.clientY - r.y) > j && e();
56
+ const r = u.current;
57
+ r && Math.hypot(t.clientX - r.x, t.clientY - r.y) > _ && n();
46
58
  },
47
- onPointerUp: e,
48
- onPointerCancel: e
49
- }), /* @__PURE__ */ Y(w, {
50
- id: S,
51
- label: u,
52
- items: C,
53
- onSelect: T,
54
- open: i,
55
- onClose: k,
59
+ onPointerUp: n,
60
+ onPointerCancel: n
61
+ }), [m, n]), K = a((e) => h(e, !0), [h]), x = c?.key, j = (e) => {
62
+ c?.keyed ? C(e, x) : C(e);
63
+ };
64
+ return /* @__PURE__ */ N(G, { children: [y({
65
+ ref: g,
66
+ ...h(void 0, !1)
67
+ }, K), /* @__PURE__ */ I(L, {
68
+ id: R,
69
+ label: typeof s == "function" ? c ? s(x) : "" : s,
70
+ items: typeof d == "function" ? c ? d(x) : [] : d,
71
+ onSelect: j,
72
+ open: p,
73
+ onClose: Y,
56
74
  focusOn: "first",
57
- anchor: p,
75
+ anchor: F,
58
76
  placement: "bottom",
59
77
  offset: 2,
60
78
  inside: [],
61
- returnFocus: m,
62
- className: D,
63
- style: F
79
+ returnFocus: g,
80
+ className: b,
81
+ style: w
64
82
  })] });
65
83
  }
66
84
  export {
67
- B as ContextMenu
85
+ A as ContextMenu
68
86
  };
69
87
 
70
88
  //# sourceMappingURL=ContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","names":["_Fragment","MenuPanel","useCallback","useEffect","useId","useRef","useState","Fragment$1","jsx","jsxs","LONG_PRESS","SLOP","point","x","y","ContextMenu","children","label","items","onSelect","onOpenChange","disabled","className","style","id","open","setOpen","target","anchor","press","changed","show","at","close","first","cancelPress","event","fromKeyboard","p"],"sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport type { VirtualAnchor } from \"../../overlay/use-anchored-position.js\";\nimport { type MenuEntry, MenuPanel } from \"../Menu/Menu.js\";\n\n/** Spread onto the one element that opens the menu (a row, a card, a canvas). */\nexport interface ContextMenuTargetProps {\n /** Spread onto the target: focus returns to it when the menu closes. */\n ref: Ref<HTMLElement>;\n /** Spread onto the target: opens the menu on right-click, in place of the browser's own menu. */\n onContextMenu: (event: MouseEvent<HTMLElement>) => void;\n /** Spread onto the target: opens the menu on Shift+F10 or the context menu key while the target has focus. */\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n /** Spread onto the target: starts the long press that opens the menu on touch screens. */\n onPointerDown: (event: PointerEvent<HTMLElement>) => void;\n /** Spread onto the target: cancels the long press when the finger moves (a scroll). */\n onPointerMove: (event: PointerEvent<HTMLElement>) => void;\n /** Spread onto the target: cancels the long press when the finger lifts early. */\n onPointerUp: () => void;\n /** Spread onto the target: cancels the long press when the browser takes over the touch. */\n onPointerCancel: () => void;\n /** Spread onto the target: tells assistive tech that Shift+F10 opens the menu. */\n \"aria-keyshortcuts\": \"Shift+F10\";\n}\n\nexport interface ContextMenuProps {\n /** Render the target: `(props) => <div {...props} tabIndex={0}>…</div>`. Make it focusable for keyboard users. */\n children: (props: ContextMenuTargetProps) => ReactNode;\n /** Accessible name of the menu. */\n label: string;\n /** The commands, as in `Menu`: items, or sections of items with a group name. */\n items: MenuEntry[];\n /** Called when an item is chosen, with its `value`. */\n onSelect: (value: string) => void;\n /** Called when the menu opens or closes, e.g. to highlight the row it belongs to. */\n onOpenChange?: ((open: boolean) => void) | undefined;\n /** The browser's own menu shows instead. */\n disabled?: boolean;\n /** Added to the menu panel, for layout. */\n className?: string;\n /** Layout only, applied to the panel. */\n style?: CSSProperties;\n}\n\n/** How long a touch must stay down to open the menu (iOS fires no contextmenu event). */\nconst LONG_PRESS = 500;\n/** How far a touch may drift before it counts as a scroll instead of a long press. */\nconst SLOP = 10;\n\nconst point = (x: number, y: number): VirtualAnchor => ({\n getBoundingClientRect: () => new DOMRect(x, y, 0, 0),\n});\n\n/**\n * A menu of commands for one thing, opened where the person points: right-click, a long press on touch screens,\n * or Shift+F10 / the context menu key on the focused target. The menu itself behaves like `Menu`.\n */\nexport function ContextMenu({\n children,\n label,\n items,\n onSelect,\n onOpenChange,\n disabled = false,\n className,\n style,\n}: ContextMenuProps) {\n const id = useId();\n const [open, setOpen] = useState(false);\n const target = useRef<HTMLElement>(null);\n const anchor = useRef<HTMLElement | VirtualAnchor | null>(null);\n const press = useRef<{ x: number; y: number; timer: ReturnType<typeof setTimeout> } | null>(null);\n const changed = useRef(onOpenChange);\n changed.current = onOpenChange;\n\n const show = useCallback((at: HTMLElement | VirtualAnchor) => {\n anchor.current = at;\n setOpen(true);\n }, []);\n const close = useCallback(() => setOpen(false), []);\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n changed.current?.(open);\n }, [open]);\n\n const cancelPress = () => {\n if (press.current) clearTimeout(press.current.timer);\n press.current = null;\n };\n useEffect(() => cancelPress, []);\n\n return (\n <>\n {children({\n ref: target,\n \"aria-keyshortcuts\": \"Shift+F10\",\n onContextMenu: (event) => {\n if (disabled) return;\n event.preventDefault();\n cancelPress();\n // A keyboard-made contextmenu event has no pointer position: place the menu at the target instead.\n const fromKeyboard = event.clientX === 0 && event.clientY === 0;\n show(fromKeyboard ? event.currentTarget : point(event.clientX, event.clientY));\n },\n onKeyDown: (event) => {\n if (disabled || event.target !== event.currentTarget) return;\n if (event.key === \"ContextMenu\" || (event.key === \"F10\" && event.shiftKey)) {\n event.preventDefault();\n show(event.currentTarget);\n }\n },\n onPointerDown: (event) => {\n if (disabled || event.pointerType !== \"touch\") return;\n const { clientX: x, clientY: y } = event;\n cancelPress();\n press.current = { x, y, timer: setTimeout(() => show(point(x, y)), LONG_PRESS) };\n },\n onPointerMove: (event) => {\n const p = press.current;\n if (p && Math.hypot(event.clientX - p.x, event.clientY - p.y) > SLOP) cancelPress();\n },\n onPointerUp: cancelPress,\n onPointerCancel: cancelPress,\n })}\n <MenuPanel\n id={id}\n label={label}\n items={items}\n onSelect={onSelect}\n open={open}\n onClose={close}\n focusOn=\"first\"\n anchor={anchor}\n placement=\"bottom\"\n offset={2}\n inside={[]}\n returnFocus={target}\n className={className}\n style={style}\n />\n </>\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"ContextMenu.js","names":["_Fragment","MenuPanel","useCallback","useEffect","useId","useRef","useState","Fragment$1","jsx","jsxs","LONG_PRESS","SLOP","point","x","y","ContextMenu","children","label","items","onSelect","onOpenChange","disabled","className","style","id","open","setOpen","current","setCurrent","target","anchor","press","latest","show","key","keyed","el","at","close","first","cancelPress","handlers","event","fromKeyboard","p","targetFor","choose","value"],"sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n type Ref,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\";\nimport type { VirtualAnchor } from \"../../overlay/use-anchored-position.js\";\nimport { type MenuEntry, MenuPanel } from \"../Menu/Menu.js\";\n\n/** Spread onto the one element that opens the menu (a row, a card, a canvas). */\nexport interface ContextMenuTargetProps {\n /** Spread onto the target: focus returns to it when the menu closes. */\n ref: Ref<HTMLElement>;\n /** Spread onto the target: opens the menu on right-click, in place of the browser's own menu. */\n onContextMenu: (event: MouseEvent<HTMLElement>) => void;\n /** Spread onto the target: opens the menu on Shift+F10 or the context menu key while the target has focus. */\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n /** Spread onto the target: starts the long press that opens the menu on touch screens. */\n onPointerDown: (event: PointerEvent<HTMLElement>) => void;\n /** Spread onto the target: cancels the long press when the finger moves (a scroll). */\n onPointerMove: (event: PointerEvent<HTMLElement>) => void;\n /** Spread onto the target: cancels the long press when the finger lifts early. */\n onPointerUp: () => void;\n /** Spread onto the target: cancels the long press when the browser takes over the touch. */\n onPointerCancel: () => void;\n /** Spread onto the target: tells assistive tech that Shift+F10 opens the menu. */\n \"aria-keyshortcuts\": \"Shift+F10\";\n}\n\n/**\n * The props for one of many targets (`targetFor(key)`): the same handlers without the ref. The menu returns focus to\n * the element that opened it.\n */\nexport type ContextMenuKeyTargetProps = Omit<ContextMenuTargetProps, \"ref\">;\n\nexport interface ContextMenuProps<K = undefined> {\n /**\n * Render the target: `(props) => <div {...props} tabIndex={0}>…</div>`. Make it focusable for keyboard users. For\n * many targets (the rows of a list, the tabs of a tab list), spread `targetFor(key)` onto each instead, with a key\n * (any value, such as the row's item) that `label`, `items`, `onSelect` and `onOpenChange` receive back. One menu\n * then serves them all, beside the list rather than inside it.\n */\n children: (props: ContextMenuTargetProps, targetFor: (key: K) => ContextMenuKeyTargetProps) => ReactNode;\n /** Accessible name of the menu; with many targets, a function of the key of the target it opened for. */\n label: string | ((key: K) => string);\n /**\n * The commands, as in `Menu`: items, or sections of items with a group name. With many targets, a function of the\n * key of the target it opened for.\n */\n items: MenuEntry[] | ((key: K) => MenuEntry[]);\n /** Called when an item is chosen, with its `value` (and, with many targets, the key of the target). */\n onSelect: (value: string, key: K) => void;\n /** Called when the menu opens or closes, e.g. to highlight the row it belongs to (with many targets, its key). */\n onOpenChange?: ((open: boolean, key: K) => void) | undefined;\n /** The browser's own menu shows instead. */\n disabled?: boolean;\n /** Added to the menu panel, for layout. */\n className?: string;\n /** Layout only, applied to the panel. */\n style?: CSSProperties;\n}\n\n/** How long a touch must stay down to open the menu (iOS fires no contextmenu event). */\nconst LONG_PRESS = 500;\n/** How far a touch may drift before it counts as a scroll instead of a long press. */\nconst SLOP = 10;\n\nconst point = (x: number, y: number): VirtualAnchor => ({\n getBoundingClientRect: () => new DOMRect(x, y, 0, 0),\n});\n\n/**\n * A menu of commands for one thing, opened where the person points: right-click, a long press on touch screens,\n * or Shift+F10 / the context menu key on the focused target. The menu itself behaves like `Menu`. One ContextMenu\n * can serve many targets (rows, tabs) through `targetFor`.\n */\nexport function ContextMenu<K = undefined>({\n children,\n label,\n items,\n onSelect,\n onOpenChange,\n disabled = false,\n className,\n style,\n}: ContextMenuProps<K>) {\n const id = useId();\n const [open, setOpen] = useState(false);\n // The target the menu is open for (or was last open for), by its key; focus returns to its element.\n const [current, setCurrent] = useState<{ key: K; keyed: boolean } | null>(null);\n const target = useRef<HTMLElement>(null);\n const anchor = useRef<HTMLElement | VirtualAnchor | null>(null);\n const press = useRef<{ x: number; y: number; timer: ReturnType<typeof setTimeout> } | null>(null);\n const latest = useRef({ disabled, onOpenChange, current });\n latest.current = { disabled, onOpenChange, current };\n\n const show = useCallback((key: K, keyed: boolean, el: HTMLElement, at: HTMLElement | VirtualAnchor) => {\n target.current = el;\n anchor.current = at;\n setCurrent({ key, keyed });\n setOpen(true);\n }, []);\n const close = useCallback(() => setOpen(false), []);\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n const { onOpenChange, current } = latest.current;\n if (current?.keyed) onOpenChange?.(open, current.key);\n else (onOpenChange as ((open: boolean) => void) | undefined)?.(open);\n }, [open]);\n\n const cancelPress = useCallback(() => {\n if (press.current) clearTimeout(press.current.timer);\n press.current = null;\n }, []);\n useEffect(() => cancelPress, [cancelPress]);\n\n // Stable, so rows that are memoised do not re-render; the handlers read `disabled` when they run.\n const handlers = useCallback(\n (key: K, keyed: boolean): ContextMenuKeyTargetProps => ({\n \"aria-keyshortcuts\": \"Shift+F10\",\n onContextMenu: (event) => {\n if (latest.current.disabled) return;\n event.preventDefault();\n cancelPress();\n // A keyboard-made contextmenu event has no pointer position: place the menu at the target instead.\n const fromKeyboard = event.clientX === 0 && event.clientY === 0;\n const el = event.currentTarget;\n show(key, keyed, el, fromKeyboard ? el : point(event.clientX, event.clientY));\n },\n onKeyDown: (event) => {\n if (latest.current.disabled || event.target !== event.currentTarget) return;\n if (event.key === \"ContextMenu\" || (event.key === \"F10\" && event.shiftKey)) {\n event.preventDefault();\n show(key, keyed, event.currentTarget, event.currentTarget);\n }\n },\n onPointerDown: (event) => {\n if (latest.current.disabled || event.pointerType !== \"touch\") return;\n const { clientX: x, clientY: y, currentTarget: el } = event;\n cancelPress();\n press.current = { x, y, timer: setTimeout(() => show(key, keyed, el, point(x, y)), LONG_PRESS) };\n },\n onPointerMove: (event) => {\n const p = press.current;\n if (p && Math.hypot(event.clientX - p.x, event.clientY - p.y) > SLOP) cancelPress();\n },\n onPointerUp: cancelPress,\n onPointerCancel: cancelPress,\n }),\n [show, cancelPress],\n );\n const targetFor = useCallback((key: K) => handlers(key, true), [handlers]);\n\n const key = current?.key as K;\n const choose = (value: string) => {\n if (current?.keyed) onSelect(value, key);\n else (onSelect as (value: string) => void)(value);\n };\n return (\n <>\n {children({ ref: target, ...handlers(undefined as K, false) }, targetFor)}\n <MenuPanel\n id={id}\n label={typeof label === \"function\" ? (current ? label(key) : \"\") : label}\n items={typeof items === \"function\" ? (current ? items(key) : []) : items}\n onSelect={choose}\n open={open}\n onClose={close}\n focusOn=\"first\"\n anchor={anchor}\n placement=\"bottom\"\n offset={2}\n inside={[]}\n returnFocus={target}\n className={className}\n style={style}\n />\n </>\n );\n}\n"],"mappings":"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"}
@@ -1,61 +1,60 @@
1
1
  "use client";
2
- import { IconButton as B } from "../IconButton/IconButton.js";
3
- import { check as L } from "../../icons/check.js";
2
+ import { LiveRegion as h, useLiveMessage as L } from "../../foundations/LiveRegion/LiveRegion.js";
3
+ import { IconButton as E } from "../IconButton/IconButton.js";
4
+ import { check as B } from "../../icons/check.js";
4
5
  import { copy as S } from "../../icons/copy.js";
5
6
  import { xCircle as j } from "../../icons/x-circle.js";
6
- import { useEffect as k, useRef as A, useState as l } from "react";
7
- import { jsx as u, jsxs as D } from "react/jsx-runtime";
8
- var F = {
7
+ import { useEffect as k, useRef as A, useState as M } from "react";
8
+ import { jsx as d, jsxs as R } from "react/jsx-runtime";
9
+ var D = {
9
10
  copy: "Copy",
10
11
  copied: "Copied",
11
12
  failed: "Could not copy"
12
- }, I = (e) => {
13
+ }, F = (t) => {
13
14
  if (!navigator.clipboard?.writeText) throw new Error("Clipboard unavailable");
14
- return navigator.clipboard.writeText(e);
15
+ return navigator.clipboard.writeText(t);
15
16
  };
16
- function $({ value: e, labels: m, timeout: y = 2e3, copy: f = I, onCopy: w, onError: b, size: v = "md", variant: C = "ghost", tooltipPlacement: s, disabled: x, className: n, style: T }) {
17
+ function G({ value: t, labels: l, timeout: u = 2e3, copy: f = F, onCopy: m, onError: y, size: v = "md", variant: b = "ghost", tooltipPlacement: i, disabled: C, className: a, style: g }) {
17
18
  const c = {
18
- ...F,
19
- ...m
20
- }, [t, d] = l("idle"), [h, i] = l(""), r = A(void 0);
19
+ ...D,
20
+ ...l
21
+ }, [o, s] = M("idle"), [x, n] = L(), r = A(void 0);
21
22
  k(() => () => clearTimeout(r.current), []);
22
- const p = (o) => {
23
- d(o), i(o === "copied" ? c.copied : c.failed), clearTimeout(r.current), r.current = setTimeout(() => {
24
- d("idle"), i("");
25
- }, y);
26
- }, g = async () => {
27
- i("");
23
+ const p = (e) => {
24
+ s(e), n(e === "copied" ? c.copied : c.failed), clearTimeout(r.current), r.current = setTimeout(() => {
25
+ s("idle"), n("");
26
+ }, u);
27
+ }, w = async () => {
28
28
  try {
29
- const o = typeof e == "function" ? e() : e;
30
- await f(o), await new Promise((a) => setTimeout(a)), p("copied"), w?.(o);
31
- } catch (o) {
32
- await new Promise((a) => setTimeout(a)), p("failed"), b?.(o);
29
+ const e = typeof t == "function" ? t() : t;
30
+ await f(e), p("copied"), m?.(e);
31
+ } catch (e) {
32
+ p("failed"), y?.(e);
33
33
  }
34
- }, E = t === "copied" ? c.copied : t === "failed" ? c.failed : c.copy;
35
- return /* @__PURE__ */ D("span", {
36
- className: n ? `cy-copy-button ${n}` : "cy-copy-button",
37
- "data-state": t,
38
- style: T,
39
- children: [/* @__PURE__ */ u(B, {
40
- icon: t === "copied" ? L : t === "failed" ? j : S,
41
- label: E,
34
+ }, T = o === "copied" ? c.copied : o === "failed" ? c.failed : c.copy;
35
+ return /* @__PURE__ */ R("span", {
36
+ className: a ? `cy-copy-button ${a}` : "cy-copy-button",
37
+ "data-state": o,
38
+ style: g,
39
+ children: [/* @__PURE__ */ d(E, {
40
+ icon: o === "copied" ? B : o === "failed" ? j : S,
41
+ label: T,
42
42
  size: v,
43
- variant: C,
44
- iconColor: t === "copied" ? "var(--cy-color-success-text)" : t === "failed" ? "var(--cy-color-danger-text)" : void 0,
45
- disabled: x,
43
+ variant: b,
44
+ iconColor: o === "copied" ? "var(--cy-color-success-text)" : o === "failed" ? "var(--cy-color-danger-text)" : void 0,
45
+ disabled: C,
46
46
  onClick: () => {
47
- g();
47
+ w();
48
48
  },
49
- ...s ? { tooltipPlacement: s } : {}
50
- }), /* @__PURE__ */ u("span", {
51
- className: "cy-copy-button-status cy-reset cy-visually-hidden",
52
- role: "status",
53
- children: h
49
+ ...i ? { tooltipPlacement: i } : {}
50
+ }), /* @__PURE__ */ d(h, {
51
+ ...x,
52
+ className: "cy-copy-button-status cy-reset"
54
53
  })]
55
54
  });
56
55
  }
57
56
  export {
58
- $ as CopyButton
57
+ G as CopyButton
59
58
  };
60
59
 
61
60
  //# sourceMappingURL=CopyButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyButton.js","names":["copy","copyIcon","IconButton","check","copy","xCircle","useEffect","useRef","useState","jsx","jsxs","DEFAULT_LABELS","writeClipboard","text","CopyButton","value","labels","timeout","copy$1","onCopy","onError","size","variant","tooltipPlacement","disabled","className","style","state","setState","message","setMessage","timer","settle","next","run","content","resolve","error","label"],"sources":["../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import { type CSSProperties, useEffect, useRef, useState } from \"react\";\nimport { check } from \"../../icons/check.js\";\nimport { copy as copyIcon } from \"../../icons/copy.js\";\nimport { xCircle } from \"../../icons/x-circle.js\";\nimport type { Placement } from \"../../overlay/position.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport type { ButtonVariant } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface CopyButtonLabels {\n /** Name and tooltip before copying. */\n copy: string;\n /** Name, tooltip and announcement after a successful copy. */\n copied: string;\n /** Name, tooltip and announcement when the clipboard refused. */\n failed: string;\n}\n\nexport interface CopyButtonProps {\n /** The text to copy (or a function that returns it when clicked). */\n value: string | (() => string);\n /** Replace the built-in English text: the button's name before copying, after a copy and after a failure. */\n labels?: Partial<CopyButtonLabels>;\n /** Milliseconds before the button goes back to its copy state (default 2000). */\n timeout?: number;\n /**\n * Writes to the clipboard. Defaults to `navigator.clipboard.writeText`; pass your own for extensions (an offscreen\n * document, `chrome.runtime` messaging) or tests. A rejection or throw shows the failed state.\n */\n copy?: (text: string) => Promise<void> | void;\n /** Called after a successful copy, with the text that was copied. */\n onCopy?: (text: string) => void;\n /** Called when copying fails, with the error. */\n onError?: (error: unknown) => void;\n /** Size of the button. Default \"md\". */\n size?: Size;\n /** Fill style of the button. Default \"ghost\". */\n variant?: ButtonVariant;\n /** Where the label tooltip appears. Default \"top\". */\n tooltipPlacement?: Placement;\n /** The button cannot be pressed. */\n disabled?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\ntype State = \"idle\" | \"copied\" | \"failed\";\nconst DEFAULT_LABELS: CopyButtonLabels = { copy: \"Copy\", copied: \"Copied\", failed: \"Could not copy\" };\n\nconst writeClipboard = (text: string) => {\n if (!navigator.clipboard?.writeText) throw new Error(\"Clipboard unavailable\");\n return navigator.clipboard.writeText(text);\n};\n\n/** An IconButton that copies a value, swaps to a check (or an error) and announces the result. Never throws. */\nexport function CopyButton({\n value,\n labels,\n timeout = 2000,\n copy = writeClipboard,\n onCopy,\n onError,\n size = \"md\",\n variant = \"ghost\",\n tooltipPlacement,\n disabled,\n className,\n style,\n}: CopyButtonProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [state, setState] = useState<State>(\"idle\");\n const [message, setMessage] = useState(\"\");\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => () => clearTimeout(timer.current), []);\n\n const settle = (next: State) => {\n setState(next);\n setMessage(next === \"copied\" ? text.copied : text.failed);\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setState(\"idle\");\n setMessage(\"\");\n }, timeout);\n };\n\n const run = async () => {\n // Clear the live region first, so copying again while it still says \"Copied\" is announced again.\n setMessage(\"\");\n try {\n const content = typeof value === \"function\" ? value() : value;\n await copy(content);\n await new Promise((resolve) => setTimeout(resolve));\n settle(\"copied\");\n onCopy?.(content);\n } catch (error) {\n await new Promise((resolve) => setTimeout(resolve));\n settle(\"failed\");\n onError?.(error);\n }\n };\n\n const label = state === \"copied\" ? text.copied : state === \"failed\" ? text.failed : text.copy;\n return (\n <span\n className={className ? `cy-copy-button ${className}` : \"cy-copy-button\"}\n data-state={state}\n style={style}\n >\n <IconButton\n icon={state === \"copied\" ? check : state === \"failed\" ? xCircle : copyIcon}\n label={label}\n size={size}\n variant={variant}\n iconColor={\n state === \"copied\"\n ? \"var(--cy-color-success-text)\"\n : state === \"failed\"\n ? \"var(--cy-color-danger-text)\"\n : undefined\n }\n disabled={disabled}\n onClick={() => void run()}\n {...(tooltipPlacement ? { tooltipPlacement } : {})}\n />\n <span className=\"cy-copy-button-status cy-reset cy-visually-hidden\" role=\"status\">\n {message}\n </span>\n </span>\n );\n}\n"],"mappings":";;;;;;;AAiDA,IAAMW,IAAmC;AAAA,EAAE,MAAM;AAAA,EAAQ,QAAQ;AAAA,EAAU,QAAQ;AAAiB,GAE9FC,IAAA,CAAkBC,MAAiB;AACvC,MAAI,CAAC,UAAU,WAAW,UAAW,OAAM,IAAI,MAAM,uBAAuB;AAC5E,SAAO,UAAU,UAAU,UAAUA,CAAI;AAC3C;AAGA,SAAgBC,EAAW,EACzB,OAAAC,GACA,QAAAC,GACA,SAAAC,IAAU,KACV,MAAAC,IAAON,GACP,QAAAO,GACA,SAAAC,GACA,MAAAC,IAAO,MACP,SAAAC,IAAU,SACV,kBAAAC,GACA,UAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACkB;AAClB,QAAMb,IAAO;AAAA,IAAE,GAAGF;AAAA,IAAgB,GAAGK;AAAA,EAAO,GACtC,CAACW,GAAOC,CAAA,IAAYpB,EAAgB,MAAM,GAC1C,CAACqB,GAASC,CAAA,IAActB,EAAS,EAAE,GACnCuB,IAAQxB,EAAsC,MAAS;AAC7D,EAAAD,EAAA,MAAA,MAAsB,aAAayB,EAAM,OAAO,GAAG,CAAC,CAAC;AAErD,QAAMC,IAAA,CAAUC,MAAgB;AAC9B,IAAAL,EAASK,CAAI,GACbH,EAAWG,MAAS,WAAWpB,EAAK,SAASA,EAAK,MAAM,GACxD,aAAakB,EAAM,OAAO,GAC1BA,EAAM,UAAU,WAAA,MAAiB;AAC/B,MAAAH,EAAS,MAAM,GACfE,EAAW,EAAE;AAAA,IACf,GAAGb,CAAO;AAAA,EACZ,GAEMiB,IAAM,YAAY;AAEtB,IAAAJ,EAAW,EAAE;AACb,QAAI;AACF,YAAMK,IAAU,OAAOpB,KAAU,aAAaA,EAAM,IAAIA;AACxD,YAAMf,EAAKmC,CAAO,GAClB,MAAM,IAAI,QAAA,CAASC,MAAY,WAAWA,CAAO,CAAC,GAClDJ,EAAO,QAAQ,GACfb,IAASgB,CAAO;AAAA,IAClB,SAASE,GAAO;AACd,YAAM,IAAI,QAAA,CAASD,MAAY,WAAWA,CAAO,CAAC,GAClDJ,EAAO,QAAQ,GACfZ,IAAUiB,CAAK;AAAA,IACjB;AAAA,EACF,GAEMC,IAAQX,MAAU,WAAWd,EAAK,SAASc,MAAU,WAAWd,EAAK,SAASA,EAAK;AACzF,SACE,gBAAAH,EAAC,QAAD;AAAA,IACE,WAAWe,IAAY,kBAAkBA,CAAA,KAAc;AAAA,IACvD,cAAYE;AAAA,IACL,OAAAD;AAAA,IAHT,UAAA,CAKE,gBAAAjB,EAACP,GAAD;AAAA,MACE,MAAMyB,MAAU,WAAWxB,IAAQwB,MAAU,WAAWtB,IAAUJ;AAAAA,MAC3D,OAAAqC;AAAA,MACD,MAAAjB;AAAA,MACG,SAAAC;AAAA,MACT,WACEK,MAAU,WACN,iCACAA,MAAU,WACR,gCACA;AAAA,MAEE,UAAAH;AAAA,MACV,SAAA,MAAA;AAAe,QAAKU,EAAI;AAAA;AAAA,MACxB,GAAKX,IAAmB,EAAE,kBAAAA,EAAiB,IAAI,CAAC;AAAA,IACjD,CAAA,GACD,gBAAAd,EAAC,QAAD;AAAA,MAAM,WAAU;AAAA,MAAoD,MAAK;AAAA,MACtE,UAAAoB;AAAA,IACG,CAAA,CACF;AAAA,E;AAEV"}
1
+ {"version":3,"file":"CopyButton.js","names":["copy","copyIcon","LiveRegion","useLiveMessage","IconButton","check","copy","xCircle","useEffect","useRef","useState","jsx","jsxs","DEFAULT_LABELS","writeClipboard","text","CopyButton","value","labels","timeout","copy$1","onCopy","onError","size","variant","tooltipPlacement","disabled","className","style","state","setState","message","setMessage","timer","settle","next","run","content","error","label"],"sources":["../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import { type CSSProperties, useEffect, useRef, useState } from \"react\";\nimport { LiveRegion, useLiveMessage } from \"../../foundations/LiveRegion/LiveRegion.js\";\nimport { check } from \"../../icons/check.js\";\nimport { copy as copyIcon } from \"../../icons/copy.js\";\nimport { xCircle } from \"../../icons/x-circle.js\";\nimport type { Placement } from \"../../overlay/position.js\";\nimport type { Size } from \"../../tokens/schema.js\";\nimport type { ButtonVariant } from \"../Button/Button.js\";\nimport { IconButton } from \"../IconButton/IconButton.js\";\n\nexport interface CopyButtonLabels {\n /** Name and tooltip before copying. */\n copy: string;\n /** Name, tooltip and announcement after a successful copy. */\n copied: string;\n /** Name, tooltip and announcement when the clipboard refused. */\n failed: string;\n}\n\nexport interface CopyButtonProps {\n /** The text to copy (or a function that returns it when clicked). */\n value: string | (() => string);\n /** Replace the built-in English text: the button's name before copying, after a copy and after a failure. */\n labels?: Partial<CopyButtonLabels>;\n /** Milliseconds before the button goes back to its copy state (default 2000). */\n timeout?: number;\n /**\n * Writes to the clipboard. Defaults to `navigator.clipboard.writeText`; pass your own for extensions (an offscreen\n * document, `chrome.runtime` messaging) or tests. A rejection or throw shows the failed state.\n */\n copy?: (text: string) => Promise<void> | void;\n /** Called after a successful copy, with the text that was copied. */\n onCopy?: (text: string) => void;\n /** Called when copying fails, with the error. */\n onError?: (error: unknown) => void;\n /** Size of the button. Default \"md\". */\n size?: Size;\n /** Fill style of the button. Default \"ghost\". */\n variant?: ButtonVariant;\n /** Where the label tooltip appears. Default \"top\". */\n tooltipPlacement?: Placement;\n /** The button cannot be pressed. */\n disabled?: boolean;\n /** Added to the root element, for layout. */\n className?: string;\n /** Layout only. */\n style?: CSSProperties;\n}\n\ntype State = \"idle\" | \"copied\" | \"failed\";\nconst DEFAULT_LABELS: CopyButtonLabels = { copy: \"Copy\", copied: \"Copied\", failed: \"Could not copy\" };\n\nconst writeClipboard = (text: string) => {\n if (!navigator.clipboard?.writeText) throw new Error(\"Clipboard unavailable\");\n return navigator.clipboard.writeText(text);\n};\n\n/** An IconButton that copies a value, swaps to a check (or an error) and announces the result. Never throws. */\nexport function CopyButton({\n value,\n labels,\n timeout = 2000,\n copy = writeClipboard,\n onCopy,\n onError,\n size = \"md\",\n variant = \"ghost\",\n tooltipPlacement,\n disabled,\n className,\n style,\n}: CopyButtonProps) {\n const text = { ...DEFAULT_LABELS, ...labels };\n const [state, setState] = useState<State>(\"idle\");\n const [message, setMessage] = useLiveMessage();\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n useEffect(() => () => clearTimeout(timer.current), []);\n\n const settle = (next: State) => {\n setState(next);\n setMessage(next === \"copied\" ? text.copied : text.failed);\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setState(\"idle\");\n setMessage(\"\");\n }, timeout);\n };\n\n const run = async () => {\n try {\n const content = typeof value === \"function\" ? value() : value;\n await copy(content);\n settle(\"copied\");\n onCopy?.(content);\n } catch (error) {\n settle(\"failed\");\n onError?.(error);\n }\n };\n\n const label = state === \"copied\" ? text.copied : state === \"failed\" ? text.failed : text.copy;\n return (\n <span\n className={className ? `cy-copy-button ${className}` : \"cy-copy-button\"}\n data-state={state}\n style={style}\n >\n <IconButton\n icon={state === \"copied\" ? check : state === \"failed\" ? xCircle : copyIcon}\n label={label}\n size={size}\n variant={variant}\n iconColor={\n state === \"copied\"\n ? \"var(--cy-color-success-text)\"\n : state === \"failed\"\n ? \"var(--cy-color-danger-text)\"\n : undefined\n }\n disabled={disabled}\n onClick={() => void run()}\n {...(tooltipPlacement ? { tooltipPlacement } : {})}\n />\n <LiveRegion {...message} className=\"cy-copy-button-status cy-reset\" />\n </span>\n );\n}\n"],"mappings":";;;;;;;;AAkDA,IAAMa,IAAmC;AAAA,EAAE,MAAM;AAAA,EAAQ,QAAQ;AAAA,EAAU,QAAQ;AAAiB,GAE9FC,IAAA,CAAkBC,MAAiB;AACvC,MAAI,CAAC,UAAU,WAAW,UAAW,OAAM,IAAI,MAAM,uBAAuB;AAC5E,SAAO,UAAU,UAAU,UAAUA,CAAI;AAC3C;AAGA,SAAgBC,EAAW,EACzB,OAAAC,GACA,QAAAC,GACA,SAAAC,IAAU,KACV,MAAAC,IAAON,GACP,QAAAO,GACA,SAAAC,GACA,MAAAC,IAAO,MACP,SAAAC,IAAU,SACV,kBAAAC,GACA,UAAAC,GACA,WAAAC,GACA,OAAAC,EAAA,GACkB;AAClB,QAAMb,IAAO;AAAA,IAAE,GAAGF;AAAA,IAAgB,GAAGK;AAAA,EAAO,GACtC,CAACW,GAAOC,CAAA,IAAYpB,EAAgB,MAAM,GAC1C,CAACqB,GAASC,CAAA,IAAc7B,EAAe,GACvC8B,IAAQxB,EAAsC,MAAS;AAC7D,EAAAD,EAAA,MAAA,MAAsB,aAAayB,EAAM,OAAO,GAAG,CAAC,CAAC;AAErD,QAAMC,IAAA,CAAUC,MAAgB;AAC9B,IAAAL,EAASK,CAAI,GACbH,EAAWG,MAAS,WAAWpB,EAAK,SAASA,EAAK,MAAM,GACxD,aAAakB,EAAM,OAAO,GAC1BA,EAAM,UAAU,WAAA,MAAiB;AAC/B,MAAAH,EAAS,MAAM,GACfE,EAAW,EAAE;AAAA,IACf,GAAGb,CAAO;AAAA,EACZ,GAEMiB,IAAM,YAAY;AACtB,QAAI;AACF,YAAMC,IAAU,OAAOpB,KAAU,aAAaA,EAAM,IAAIA;AACxD,YAAMjB,EAAKqC,CAAO,GAClBH,EAAO,QAAQ,GACfb,IAASgB,CAAO;AAAA,IAClB,SAASC,GAAO;AACd,MAAAJ,EAAO,QAAQ,GACfZ,IAAUgB,CAAK;AAAA,IACjB;AAAA,EACF,GAEMC,IAAQV,MAAU,WAAWd,EAAK,SAASc,MAAU,WAAWd,EAAK,SAASA,EAAK;AACzF,SACE,gBAAAH,EAAC,QAAD;AAAA,IACE,WAAWe,IAAY,kBAAkBA,CAAA,KAAc;AAAA,IACvD,cAAYE;AAAA,IACL,OAAAD;AAAA,IAHT,UAAA,CAKE,gBAAAjB,EAACP,GAAD;AAAA,MACE,MAAMyB,MAAU,WAAWxB,IAAQwB,MAAU,WAAWtB,IAAUN;AAAAA,MAC3D,OAAAsC;AAAA,MACD,MAAAhB;AAAA,MACG,SAAAC;AAAA,MACT,WACEK,MAAU,WACN,iCACAA,MAAU,WACR,gCACA;AAAA,MAEE,UAAAH;AAAA,MACV,SAAA,MAAA;AAAe,QAAKU,EAAI;AAAA;AAAA,MACxB,GAAKX,IAAmB,EAAE,kBAAAA,EAAiB,IAAI,CAAC;AAAA,IACjD,CAAA,GACD,gBAAAd,EAACT,GAAD;AAAA,MAAY,GAAI6B;AAAA,MAAS,WAAU;AAAA,IAAkC,CAAA,CACjE;AAAA,E;AAEV"}
@@ -0,0 +1,135 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import { type TableSort } from "../../foundations/sort.js";
3
+ import type { Tone } from "../../tokens/schema.js";
4
+ export interface DataGridTokens {
5
+ /** Height of the grid (it scrolls inside, in both directions). */
6
+ height: string;
7
+ /** Height of a row (never less than the hit area: 44px on a touch screen). */
8
+ rowHeight: string;
9
+ /** Height of the header row. */
10
+ headerHeight: string;
11
+ /** Background of the header row. */
12
+ headerBackground: string;
13
+ /** Background of selected rows and cells. */
14
+ selectedBackground: string;
15
+ /** Inline padding of a cell. */
16
+ cellPadding: string;
17
+ /** Text colour of cells whose `cellKind` is "null" (an empty value). */
18
+ nullColor: string;
19
+ /** Text colour of cells whose `cellKind` is "number". */
20
+ numberColor: string;
21
+ }
22
+ declare module "../../tokens/schema.js" {
23
+ interface ComponentTokens {
24
+ dataGrid: DataGridTokens;
25
+ }
26
+ }
27
+ export type { SortDirection, TableSort } from "../../foundations/sort.js";
28
+ /** What kind of value a cell holds, for its styling: an empty value (muted, italic) or a number. */
29
+ export type DataGridCellKind = "null" | "number";
30
+ export interface DataGridColumn<Row> {
31
+ /** Unique key of the column; also the default field read from each row. */
32
+ key: string;
33
+ /** The header's content. */
34
+ header: ReactNode;
35
+ /** Starting width in CSS pixels. Default 160. A new value replaces a width the user dragged. */
36
+ width?: number | undefined;
37
+ /** Narrowest the column can be resized to. Default 48. */
38
+ minWidth?: number;
39
+ /** Widest the column can be resized to. Default: no limit. */
40
+ maxWidth?: number;
41
+ /** `end` for numbers. */
42
+ align?: "start" | "end";
43
+ /** The header becomes a sort button. */
44
+ sortable?: boolean;
45
+ /** The header's edge can be dragged (and Alt+Left/Right pressed on the header) to change the width. */
46
+ resizable?: boolean;
47
+ /** What the cell shows (format values here). Default: `value(row)` as text. */
48
+ cell?: (row: Row) => ReactNode;
49
+ /** The cell's raw value: what sorting compares and copying writes. Default: `row[key]`. */
50
+ value?: (row: Row) => unknown;
51
+ /**
52
+ * The full value of a cell, shown in a Tooltip on hover and keyboard focus only while the cell's text is cut short
53
+ * with an ellipsis. It repeats what the cell holds, so it is not read again. Nothing: no tooltip.
54
+ */
55
+ tooltip?: (row: Row) => ReactNode;
56
+ /** The kind of value the cell holds: "null" (an empty value, muted and italic) or "number". Nothing: plain text. */
57
+ cellKind?: (row: Row) => DataGridCellKind | undefined;
58
+ /** Colours the cell's text with a tone (a status, a match); it wins over the kind's colour. Nothing: no tone. */
59
+ cellTone?: (row: Row) => Tone | undefined;
60
+ }
61
+ /** One cell, by its row's id and its column's key (so it survives sorting and loading more rows). */
62
+ export interface DataGridCell {
63
+ rowId: string;
64
+ key: string;
65
+ }
66
+ /** A rectangle of cells between two corners: where the selection started and where it ends now. */
67
+ export interface DataGridRange {
68
+ anchor: DataGridCell;
69
+ focus: DataGridCell;
70
+ }
71
+ export interface DataGridLabels {
72
+ /** Shown when there are no rows. */
73
+ empty: ReactNode;
74
+ }
75
+ export interface DataGridProps<Row> {
76
+ /** Accessible name of the grid. */
77
+ label: string;
78
+ /** The columns, in display order. */
79
+ columns: DataGridColumn<Row>[];
80
+ /** The data, one entry per row. */
81
+ rows: readonly Row[];
82
+ /** A stable, unique id per row (selection and React keys). */
83
+ getRowId: (row: Row) => string;
84
+ /** The current sort (controlled); `null` is unsorted. */
85
+ sort?: TableSort | null | undefined;
86
+ /** Starting sort when uncontrolled; unsorted when left out. */
87
+ defaultSort?: TableSort | null;
88
+ /** Called when a sortable header is pressed, with the new sort, or `null` when it goes back to unsorted. */
89
+ onSortChange?: ((sort: TableSort | null) => void) | undefined;
90
+ /** You sort the rows (e.g. on a server); the grid only shows and reports the sort. */
91
+ manualSort?: boolean;
92
+ /** Called when a column's width has been changed by dragging its edge or by Alt+Left/Right, with the new width. */
93
+ onColumnResize?: ((key: string, width: number) => void) | undefined;
94
+ /**
95
+ * What clicking, Space and the arrow keys select: "none" (default), "row" (rows: Ctrl/Cmd+click toggles,
96
+ * Shift+click and Shift+arrows extend), "cell" (one cell, following focus) or "range" (a rectangle of cells:
97
+ * Shift+click and Shift+arrows extend it). Ctrl/Cmd+C copies the selection as tab-separated text.
98
+ */
99
+ selectionMode?: "none" | "row" | "cell" | "range";
100
+ /** Ids of the selected rows, with `selectionMode="row"` (controlled), as Table's `selected`. */
101
+ selected?: string[] | undefined;
102
+ /** Ids of the rows selected at the start when uncontrolled. */
103
+ defaultSelected?: string[];
104
+ /** Called with the selected row ids when they change. */
105
+ onSelectionChange?: ((ids: string[]) => void) | undefined;
106
+ /** The selected cells, with `selectionMode` "cell" or "range" (controlled); `null` is none. */
107
+ selectedRange?: DataGridRange | null | undefined;
108
+ /** The cells selected at the start when uncontrolled. */
109
+ defaultSelectedRange?: DataGridRange | null;
110
+ /** Called with the selected cells when they change. */
111
+ onSelectedRangeChange?: ((range: DataGridRange | null) => void) | undefined;
112
+ /** A row's cell was clicked or tapped. */
113
+ onRowClick?: ((row: Row, index: number) => void) | undefined;
114
+ /** Enter on a row's cell, or a double-click on it (open the row), as VirtualList's and Tree's `onAction`. */
115
+ onAction?: ((row: Row, index: number) => void) | undefined;
116
+ /**
117
+ * Called once the last rows come into view, once per row count: load the next rows and append them ("load more").
118
+ * For pages, put a `Pagination` under the grid and pass it one page of rows.
119
+ */
120
+ onEndReached?: (() => void) | undefined;
121
+ /** Row height and text size: "sm" is dense. Default "md". */
122
+ size?: "sm" | "md";
123
+ /** Replace the built-in English text: the message when there are no rows. */
124
+ labels?: Partial<DataGridLabels>;
125
+ /** Added to the root element, for layout. */
126
+ className?: string;
127
+ /** Layout only (e.g. `blockSize`). Restyle through --cy-data-grid-* tokens. */
128
+ style?: CSSProperties;
129
+ }
130
+ /**
131
+ * A data grid for large results: rows and columns rendered only where they are in view (a hundred thousand rows by
132
+ * fifty columns stay quick), a sticky header, sorting, resizable columns, row, cell or range selection copied as
133
+ * tab-separated text, and the APG grid keyboard. Read-only: cells show what `cell` renders.
134
+ */
135
+ export declare function DataGrid<Row>({ label, columns, rows, getRowId, sort, defaultSort, onSortChange, manualSort, onColumnResize, selectionMode, selected, defaultSelected, onSelectionChange, selectedRange, defaultSelectedRange, onSelectedRangeChange, onRowClick, onAction, onEndReached, size, labels, className, style, }: DataGridProps<Row>): import("react").JSX.Element;