@eylulg/ui 1.2.0 → 2.0.1

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 (524) hide show
  1. package/README.md +172 -223
  2. package/dist/components/{Avatar → atoms/Avatar}/Avatar.d.ts +3 -1
  3. package/dist/components/{Avatar → atoms/Avatar}/Avatar.js +4 -4
  4. package/dist/components/atoms/Avatar/Avatar.js.map +1 -0
  5. package/dist/components/{Avatar → atoms/Avatar}/index.d.ts +1 -1
  6. package/dist/components/atoms/Avatar/index.js +2 -0
  7. package/dist/components/{Badge → atoms/Badge}/Badge.d.ts +10 -6
  8. package/dist/components/{Badge → atoms/Badge}/Badge.js +12 -16
  9. package/dist/components/atoms/Badge/Badge.js.map +1 -0
  10. package/dist/components/atoms/Badge/index.d.ts +2 -0
  11. package/dist/components/atoms/BrandLoader/BrandLoader.d.ts +14 -0
  12. package/dist/components/atoms/BrandLoader/BrandLoader.js +57 -0
  13. package/dist/components/atoms/BrandLoader/BrandLoader.js.map +1 -0
  14. package/dist/components/atoms/BrandLoader/index.d.ts +2 -0
  15. package/dist/components/atoms/BrandLoader/index.js +2 -0
  16. package/dist/{chrome → components/atoms/BrandLogo}/BrandLogo.d.ts +1 -1
  17. package/dist/{chrome → components/atoms/BrandLogo}/BrandLogo.js +3 -4
  18. package/dist/components/atoms/BrandLogo/BrandLogo.js.map +1 -0
  19. package/dist/components/atoms/BrandLogo/index.d.ts +2 -0
  20. package/dist/components/atoms/BrandLogo/index.js +1 -0
  21. package/dist/components/{Button → atoms/Button}/Button.d.ts +13 -9
  22. package/dist/components/atoms/Button/Button.js +88 -0
  23. package/dist/components/atoms/Button/Button.js.map +1 -0
  24. package/dist/components/{Button → atoms/Button}/buttonStyles.d.ts +4 -6
  25. package/dist/components/atoms/Button/buttonStyles.js +25 -0
  26. package/dist/components/atoms/Button/buttonStyles.js.map +1 -0
  27. package/dist/components/atoms/Button/index.d.ts +2 -0
  28. package/dist/components/atoms/Button/index.js +4 -0
  29. package/dist/components/{Checkbox → atoms/Checkbox}/Checkbox.js +10 -14
  30. package/dist/components/atoms/Checkbox/Checkbox.js.map +1 -0
  31. package/dist/components/atoms/IconButton/IconButton.d.ts +21 -0
  32. package/dist/components/atoms/IconButton/IconButton.js +43 -0
  33. package/dist/components/atoms/IconButton/IconButton.js.map +1 -0
  34. package/dist/components/{Kbd → atoms/Kbd}/Kbd.d.ts +2 -2
  35. package/dist/components/{Kbd → atoms/Kbd}/Kbd.js +9 -8
  36. package/dist/components/atoms/Kbd/Kbd.js.map +1 -0
  37. package/dist/components/atoms/NavItem/NavItem.d.ts +24 -0
  38. package/dist/components/atoms/NavItem/NavItem.js +42 -0
  39. package/dist/components/atoms/NavItem/NavItem.js.map +1 -0
  40. package/dist/components/atoms/NavItem/index.d.ts +2 -0
  41. package/dist/components/atoms/NavItem/index.js +1 -0
  42. package/dist/components/{ProgressBar → atoms/ProgressBar}/ProgressBar.d.ts +2 -2
  43. package/dist/components/{ProgressBar → atoms/ProgressBar}/ProgressBar.js +6 -5
  44. package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -0
  45. package/dist/components/atoms/ProgressBar/index.d.ts +2 -0
  46. package/dist/components/{Skeleton → atoms/Skeleton}/Skeleton.js +3 -5
  47. package/dist/components/atoms/Skeleton/Skeleton.js.map +1 -0
  48. package/dist/components/{Spinner → atoms/Spinner}/Spinner.js +2 -2
  49. package/dist/components/atoms/Spinner/Spinner.js.map +1 -0
  50. package/dist/components/{Switch → atoms/Switch}/Switch.d.ts +3 -3
  51. package/dist/components/atoms/Switch/Switch.js +35 -0
  52. package/dist/components/atoms/Switch/Switch.js.map +1 -0
  53. package/dist/components/atoms/TextLink/TextLink.d.ts +18 -0
  54. package/dist/components/atoms/TextLink/TextLink.js +21 -0
  55. package/dist/components/atoms/TextLink/TextLink.js.map +1 -0
  56. package/dist/components/atoms/TextLink/index.d.ts +2 -0
  57. package/dist/components/atoms/TextLink/index.js +1 -0
  58. package/dist/components/{Tooltip → atoms/Tooltip}/Tooltip.js +4 -4
  59. package/dist/components/atoms/Tooltip/Tooltip.js.map +1 -0
  60. package/dist/components/{Tooltip → atoms/Tooltip}/TooltipOverlay.js +2 -2
  61. package/dist/components/atoms/Tooltip/TooltipOverlay.js.map +1 -0
  62. package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/Breadcrumbs.js +5 -4
  63. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js.map +1 -0
  64. package/dist/components/{Card → molecules/Card}/Card.d.ts +3 -1
  65. package/dist/components/{Card → molecules/Card}/Card.js +21 -13
  66. package/dist/components/molecules/Card/Card.js.map +1 -0
  67. package/dist/components/molecules/Card/index.d.ts +2 -0
  68. package/dist/components/{CodeBlock → molecules/CodeBlock}/CodeBlock.d.ts +7 -5
  69. package/dist/components/{CodeBlock → molecules/CodeBlock}/CodeBlock.js +20 -12
  70. package/dist/components/molecules/CodeBlock/CodeBlock.js.map +1 -0
  71. package/dist/components/{Combobox → molecules/Combobox}/Combobox.d.ts +4 -1
  72. package/dist/components/molecules/Combobox/Combobox.js +91 -0
  73. package/dist/components/molecules/Combobox/Combobox.js.map +1 -0
  74. package/dist/components/{DatePicker → molecules/DatePicker}/DatePicker.d.ts +7 -4
  75. package/dist/components/molecules/DatePicker/DatePicker.js +138 -0
  76. package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -0
  77. package/dist/components/molecules/Dialog/Dialog.d.ts +20 -0
  78. package/dist/components/{Dialog → molecules/Dialog}/Dialog.js +7 -7
  79. package/dist/components/molecules/Dialog/Dialog.js.map +1 -0
  80. package/dist/components/molecules/Dialog/DialogOverlay.d.ts +3 -0
  81. package/dist/components/molecules/Dialog/DialogOverlay.js +60 -0
  82. package/dist/components/molecules/Dialog/DialogOverlay.js.map +1 -0
  83. package/dist/components/molecules/Drawer/Drawer.d.ts +21 -0
  84. package/dist/components/{Drawer → molecules/Drawer}/Drawer.js +7 -7
  85. package/dist/components/molecules/Drawer/Drawer.js.map +1 -0
  86. package/dist/components/{Drawer → molecules/Drawer}/DrawerOverlay.d.ts +1 -1
  87. package/dist/components/molecules/Drawer/DrawerOverlay.js +66 -0
  88. package/dist/components/molecules/Drawer/DrawerOverlay.js.map +1 -0
  89. package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenu.d.ts +8 -9
  90. package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenu.js +8 -20
  91. package/dist/components/molecules/DropdownMenu/DropdownMenu.js.map +1 -0
  92. package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenuParts.d.ts +1 -1
  93. package/dist/components/{DropdownMenu → molecules/DropdownMenu}/DropdownMenuParts.js +17 -28
  94. package/dist/components/molecules/DropdownMenu/DropdownMenuParts.js.map +1 -0
  95. package/dist/components/{EmptyState → molecules/EmptyState}/EmptyState.d.ts +3 -4
  96. package/dist/components/{EmptyState → molecules/EmptyState}/EmptyState.js +6 -5
  97. package/dist/components/molecules/EmptyState/EmptyState.js.map +1 -0
  98. package/dist/components/{FileDropZone → molecules/FileDropZone}/FileDropZone.d.ts +1 -1
  99. package/dist/components/{FileDropZone → molecules/FileDropZone}/FileDropZone.js +6 -5
  100. package/dist/components/molecules/FileDropZone/FileDropZone.js.map +1 -0
  101. package/dist/components/{Input → molecules/Input}/Input.d.ts +8 -6
  102. package/dist/components/molecules/Input/Input.js +45 -0
  103. package/dist/components/molecules/Input/Input.js.map +1 -0
  104. package/dist/components/molecules/Input/index.d.ts +2 -0
  105. package/dist/components/{Pagination → molecules/Pagination}/Pagination.d.ts +6 -2
  106. package/dist/components/{Pagination → molecules/Pagination}/Pagination.js +44 -34
  107. package/dist/components/molecules/Pagination/Pagination.js.map +1 -0
  108. package/dist/components/molecules/Pagination/index.d.ts +2 -0
  109. package/dist/components/molecules/Pagination/index.js +2 -0
  110. package/dist/components/{Popover → molecules/Popover}/Popover.d.ts +1 -1
  111. package/dist/components/{Popover → molecules/Popover}/Popover.js +7 -7
  112. package/dist/components/molecules/Popover/Popover.js.map +1 -0
  113. package/dist/components/{Popover → molecules/Popover}/PopoverOverlay.js +5 -4
  114. package/dist/components/molecules/Popover/PopoverOverlay.js.map +1 -0
  115. package/dist/components/molecules/RadioGroup/RadioGroup.js +43 -0
  116. package/dist/components/molecules/RadioGroup/RadioGroup.js.map +1 -0
  117. package/dist/components/{SegmentedControl → molecules/SegmentedControl}/SegmentedControl.d.ts +6 -7
  118. package/dist/components/molecules/SegmentedControl/SegmentedControl.js +71 -0
  119. package/dist/components/molecules/SegmentedControl/SegmentedControl.js.map +1 -0
  120. package/dist/components/molecules/SegmentedControl/index.d.ts +2 -0
  121. package/dist/components/{Select → molecules/Select}/Select.d.ts +4 -1
  122. package/dist/components/molecules/Select/Select.js +58 -0
  123. package/dist/components/molecules/Select/Select.js.map +1 -0
  124. package/dist/components/molecules/Stat/Stat.d.ts +36 -0
  125. package/dist/components/molecules/Stat/Stat.js +85 -0
  126. package/dist/components/molecules/Stat/Stat.js.map +1 -0
  127. package/dist/components/molecules/Stat/index.d.ts +2 -0
  128. package/dist/components/molecules/Stat/index.js +2 -0
  129. package/dist/components/{Tabs → molecules/Tabs}/Tabs.js +5 -5
  130. package/dist/components/molecules/Tabs/Tabs.js.map +1 -0
  131. package/dist/components/molecules/Tag/Tag.js +49 -0
  132. package/dist/components/molecules/Tag/Tag.js.map +1 -0
  133. package/dist/components/{Textarea → molecules/Textarea}/Textarea.d.ts +3 -11
  134. package/dist/components/molecules/Textarea/Textarea.js +29 -0
  135. package/dist/components/molecules/Textarea/Textarea.js.map +1 -0
  136. package/dist/components/molecules/Textarea/index.d.ts +2 -0
  137. package/dist/components/{Toast → molecules/Toast}/Toast.d.ts +12 -8
  138. package/dist/components/{Toast → molecules/Toast}/Toast.js +13 -18
  139. package/dist/components/molecules/Toast/Toast.js.map +1 -0
  140. package/dist/components/molecules/Toast/ToastItem.d.ts +6 -0
  141. package/dist/components/{Toast → molecules/Toast}/ToastItem.js +25 -27
  142. package/dist/components/molecules/Toast/ToastItem.js.map +1 -0
  143. package/dist/components/{Toast → molecules/Toast}/index.d.ts +1 -1
  144. package/dist/components/{Chart → organisms/Chart}/BarChart.d.ts +1 -1
  145. package/dist/components/organisms/Chart/BarChart.js +304 -0
  146. package/dist/components/organisms/Chart/BarChart.js.map +1 -0
  147. package/dist/components/{Chart → organisms/Chart}/ChartFrame.d.ts +2 -2
  148. package/dist/components/{Chart → organisms/Chart}/ChartFrame.js +14 -18
  149. package/dist/components/organisms/Chart/ChartFrame.js.map +1 -0
  150. package/dist/components/{Chart → organisms/Chart}/ChartLegend.d.ts +3 -2
  151. package/dist/components/{Chart → organisms/Chart}/ChartLegend.js +2 -2
  152. package/dist/components/organisms/Chart/ChartLegend.js.map +1 -0
  153. package/dist/components/{Chart → organisms/Chart}/ChartTable.js +8 -12
  154. package/dist/components/organisms/Chart/ChartTable.js.map +1 -0
  155. package/dist/components/{Chart → organisms/Chart}/ChartTooltip.d.ts +3 -2
  156. package/dist/components/{Chart → organisms/Chart}/ChartTooltip.js +3 -3
  157. package/dist/components/organisms/Chart/ChartTooltip.js.map +1 -0
  158. package/dist/components/{Chart → organisms/Chart}/HeatGrid.d.ts +6 -3
  159. package/dist/components/organisms/Chart/HeatGrid.js +235 -0
  160. package/dist/components/organisms/Chart/HeatGrid.js.map +1 -0
  161. package/dist/components/{Chart → organisms/Chart}/LineChart.d.ts +1 -1
  162. package/dist/components/organisms/Chart/LineChart.js +227 -0
  163. package/dist/components/organisms/Chart/LineChart.js.map +1 -0
  164. package/dist/components/organisms/Chart/Sparkline.d.ts +14 -0
  165. package/dist/components/organisms/Chart/Sparkline.js +39 -0
  166. package/dist/components/organisms/Chart/Sparkline.js.map +1 -0
  167. package/dist/components/{Chart → organisms/Chart}/format.d.ts +2 -0
  168. package/dist/components/{Chart → organisms/Chart}/format.js +6 -4
  169. package/dist/components/organisms/Chart/format.js.map +1 -0
  170. package/dist/components/{Chart → organisms/Chart}/geometry.js +1 -1
  171. package/dist/components/organisms/Chart/geometry.js.map +1 -0
  172. package/dist/components/{Chart → organisms/Chart}/index.d.ts +2 -2
  173. package/dist/components/{Chart → organisms/Chart}/index.js +2 -2
  174. package/dist/components/{Chart → organisms/Chart}/interaction.d.ts +10 -6
  175. package/dist/components/{Chart → organisms/Chart}/interaction.js +13 -10
  176. package/dist/components/organisms/Chart/interaction.js.map +1 -0
  177. package/dist/components/{Chart → organisms/Chart}/labels.js +1 -1
  178. package/dist/components/organisms/Chart/labels.js.map +1 -0
  179. package/dist/components/{Chart → organisms/Chart}/scale.js +1 -1
  180. package/dist/components/organisms/Chart/scale.js.map +1 -0
  181. package/dist/components/organisms/Chart/series.d.ts +30 -0
  182. package/dist/components/organisms/Chart/series.js +108 -0
  183. package/dist/components/organisms/Chart/series.js.map +1 -0
  184. package/dist/components/{Chart → organisms/Chart}/summary.js +2 -5
  185. package/dist/components/organisms/Chart/summary.js.map +1 -0
  186. package/dist/components/{Chart → organisms/Chart}/types.d.ts +2 -2
  187. package/dist/components/{Chart → organisms/Chart}/useElementWidth.js +1 -1
  188. package/dist/components/organisms/Chart/useElementWidth.js.map +1 -0
  189. package/dist/components/{CommandPalette → organisms/CommandPalette}/CommandPalette.d.ts +7 -8
  190. package/dist/components/{CommandPalette → organisms/CommandPalette}/CommandPalette.js +4 -10
  191. package/dist/components/organisms/CommandPalette/CommandPalette.js.map +1 -0
  192. package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.d.ts +4 -0
  193. package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.js +150 -0
  194. package/dist/components/organisms/CommandPalette/CommandPaletteOverlay.js.map +1 -0
  195. package/dist/components/{CommandPalette → organisms/CommandPalette}/index.d.ts +1 -1
  196. package/dist/components/{PageHeader → organisms/PageHeader}/PageHeader.js +5 -5
  197. package/dist/components/organisms/PageHeader/PageHeader.js.map +1 -0
  198. package/dist/{chrome → components/organisms/SidebarNav}/SidebarNav.d.ts +1 -1
  199. package/dist/{chrome → components/organisms/SidebarNav}/SidebarNav.js +18 -26
  200. package/dist/components/organisms/SidebarNav/SidebarNav.js.map +1 -0
  201. package/dist/components/organisms/SidebarNav/index.d.ts +2 -0
  202. package/dist/components/organisms/SidebarNav/index.js +2 -0
  203. package/dist/components/organisms/SiteFooter/SiteFooter.d.ts +33 -0
  204. package/dist/components/organisms/SiteFooter/SiteFooter.js +87 -0
  205. package/dist/components/organisms/SiteFooter/SiteFooter.js.map +1 -0
  206. package/dist/components/organisms/SiteFooter/index.d.ts +2 -0
  207. package/dist/components/organisms/SiteFooter/index.js +1 -0
  208. package/dist/components/{Table → organisms/Table}/Table.d.ts +9 -6
  209. package/dist/components/{Table → organisms/Table}/Table.js +36 -23
  210. package/dist/components/organisms/Table/Table.js.map +1 -0
  211. package/dist/components/organisms/ThemeToggle/ThemeToggle.d.ts +36 -0
  212. package/dist/components/organisms/ThemeToggle/ThemeToggle.js +88 -0
  213. package/dist/components/organisms/ThemeToggle/ThemeToggle.js.map +1 -0
  214. package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.d.ts +14 -0
  215. package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.js +50 -0
  216. package/dist/components/organisms/ThemeToggle/ThemeToggleMenu.js.map +1 -0
  217. package/dist/components/organisms/ThemeToggle/index.d.ts +2 -0
  218. package/dist/components/organisms/ThemeToggle/index.js +2 -0
  219. package/dist/components/organisms/ThemeToggle/themeChoices.d.ts +7 -0
  220. package/dist/components/organisms/ThemeToggle/themeChoices.js +17 -0
  221. package/dist/components/organisms/ThemeToggle/themeChoices.js.map +1 -0
  222. package/dist/components/organisms/TopNav/TopNav.d.ts +51 -0
  223. package/dist/components/organisms/TopNav/TopNav.js +148 -0
  224. package/dist/components/organisms/TopNav/TopNav.js.map +1 -0
  225. package/dist/components/organisms/TopNav/index.d.ts +2 -0
  226. package/dist/components/organisms/TopNav/index.js +2 -0
  227. package/dist/{chrome → components/templates/AppShell}/AppShell.d.ts +10 -6
  228. package/dist/{chrome → components/templates/AppShell}/AppShell.js +12 -17
  229. package/dist/components/templates/AppShell/AppShell.js.map +1 -0
  230. package/dist/components/templates/AppShell/index.d.ts +2 -0
  231. package/dist/components/templates/AppShell/index.js +1 -0
  232. package/dist/{chrome → data}/projects.d.ts +13 -6
  233. package/dist/{chrome → data}/projects.js +43 -14
  234. package/dist/data/projects.js.map +1 -0
  235. package/dist/fonts.css +27 -2
  236. package/dist/index.d.ts +56 -38
  237. package/dist/index.js +55 -42
  238. package/dist/internal/Field.d.ts +16 -11
  239. package/dist/internal/Field.js +30 -23
  240. package/dist/internal/Field.js.map +1 -1
  241. package/dist/internal/OverlayParts.d.ts +43 -0
  242. package/dist/internal/OverlayParts.js +43 -0
  243. package/dist/internal/OverlayParts.js.map +1 -0
  244. package/dist/internal/PreloadOnIntent.d.ts +2 -3
  245. package/dist/internal/PreloadOnIntent.js +3 -3
  246. package/dist/internal/PreloadOnIntent.js.map +1 -1
  247. package/dist/{chrome → internal}/brandLogoPath.js +1 -2
  248. package/dist/internal/brandLogoPath.js.map +1 -0
  249. package/dist/internal/button.d.ts +7 -0
  250. package/dist/internal/button.js +19 -0
  251. package/dist/internal/button.js.map +1 -0
  252. package/dist/internal/control.d.ts +32 -0
  253. package/dist/internal/control.js +59 -0
  254. package/dist/internal/control.js.map +1 -0
  255. package/dist/internal/focusRing.d.ts +7 -1
  256. package/dist/internal/focusRing.js +8 -3
  257. package/dist/internal/focusRing.js.map +1 -1
  258. package/dist/internal/layout.d.ts +9 -0
  259. package/dist/internal/layout.js +13 -0
  260. package/dist/internal/layout.js.map +1 -0
  261. package/dist/internal/lazyModule.d.ts +8 -2
  262. package/dist/internal/lazyModule.js +20 -6
  263. package/dist/internal/lazyModule.js.map +1 -1
  264. package/dist/internal/link.d.ts +3 -0
  265. package/dist/internal/link.js +10 -0
  266. package/dist/internal/link.js.map +1 -0
  267. package/dist/internal/listParts.d.ts +12 -0
  268. package/dist/internal/listParts.js +32 -0
  269. package/dist/internal/listParts.js.map +1 -0
  270. package/dist/internal/surfaces.d.ts +11 -5
  271. package/dist/internal/surfaces.js +13 -7
  272. package/dist/internal/surfaces.js.map +1 -1
  273. package/dist/internal/toggle.d.ts +8 -0
  274. package/dist/internal/toggle.js +22 -0
  275. package/dist/internal/toggle.js.map +1 -0
  276. package/dist/internal/types.d.ts +2 -5
  277. package/dist/{chrome → router}/Anchor.js +1 -2
  278. package/dist/{chrome → router}/Anchor.js.map +1 -1
  279. package/dist/{chrome → router}/LinkRouter.js +1 -1
  280. package/dist/{chrome → router}/LinkRouter.js.map +1 -1
  281. package/dist/{chrome → router}/types.d.ts +3 -3
  282. package/dist/styles/themes/variants.d.ts +0 -12
  283. package/dist/styles/themes/variants.js +3 -43
  284. package/dist/styles/themes/variants.js.map +1 -1
  285. package/dist/styles.css +1 -1
  286. package/dist/{chrome → theme}/themeScript.d.ts +2 -5
  287. package/dist/{chrome → theme}/themeScript.js +4 -7
  288. package/dist/theme/themeScript.js.map +1 -0
  289. package/dist/{chrome → theme}/useTheme.js +1 -1
  290. package/dist/theme/useTheme.js.map +1 -0
  291. package/dist/theme.css +87 -56
  292. package/dist/tokens.css +42 -48
  293. package/dist/utils/cx.d.ts +0 -12
  294. package/dist/utils/cx.js +18 -10
  295. package/dist/utils/cx.js.map +1 -1
  296. package/package.json +147 -107
  297. package/dist/chrome/AppShell.js.map +0 -1
  298. package/dist/chrome/BrandLogo.js.map +0 -1
  299. package/dist/chrome/BrandMark.d.ts +0 -12
  300. package/dist/chrome/BrandMark.js +0 -40
  301. package/dist/chrome/BrandMark.js.map +0 -1
  302. package/dist/chrome/MobileMenu.d.ts +0 -19
  303. package/dist/chrome/MobileMenu.js +0 -52
  304. package/dist/chrome/MobileMenu.js.map +0 -1
  305. package/dist/chrome/ProjectSwitcher.d.ts +0 -30
  306. package/dist/chrome/ProjectSwitcher.js +0 -64
  307. package/dist/chrome/ProjectSwitcher.js.map +0 -1
  308. package/dist/chrome/ProjectSwitcherMenu.d.ts +0 -13
  309. package/dist/chrome/ProjectSwitcherMenu.js +0 -50
  310. package/dist/chrome/ProjectSwitcherMenu.js.map +0 -1
  311. package/dist/chrome/SidebarNav.js.map +0 -1
  312. package/dist/chrome/SiteFooter.d.ts +0 -37
  313. package/dist/chrome/SiteFooter.js +0 -105
  314. package/dist/chrome/SiteFooter.js.map +0 -1
  315. package/dist/chrome/TextSizeToggle.d.ts +0 -11
  316. package/dist/chrome/TextSizeToggle.js +0 -38
  317. package/dist/chrome/TextSizeToggle.js.map +0 -1
  318. package/dist/chrome/ThemeToggle.d.ts +0 -26
  319. package/dist/chrome/ThemeToggle.js +0 -100
  320. package/dist/chrome/ThemeToggle.js.map +0 -1
  321. package/dist/chrome/ThemeToggleMenu.d.ts +0 -16
  322. package/dist/chrome/ThemeToggleMenu.js +0 -42
  323. package/dist/chrome/ThemeToggleMenu.js.map +0 -1
  324. package/dist/chrome/TopNav.d.ts +0 -42
  325. package/dist/chrome/TopNav.js +0 -117
  326. package/dist/chrome/TopNav.js.map +0 -1
  327. package/dist/chrome/brandLogoPath.js.map +0 -1
  328. package/dist/chrome/index.d.ts +0 -28
  329. package/dist/chrome/index.js +0 -15
  330. package/dist/chrome/projects.js.map +0 -1
  331. package/dist/chrome/themeChoices.d.ts +0 -6
  332. package/dist/chrome/themeChoices.js +0 -18
  333. package/dist/chrome/themeChoices.js.map +0 -1
  334. package/dist/chrome/themeScript.js.map +0 -1
  335. package/dist/chrome/useTextSize.d.ts +0 -16
  336. package/dist/chrome/useTextSize.js +0 -64
  337. package/dist/chrome/useTextSize.js.map +0 -1
  338. package/dist/chrome/useTheme.js.map +0 -1
  339. package/dist/components/Avatar/Avatar.js.map +0 -1
  340. package/dist/components/Avatar/index.js +0 -2
  341. package/dist/components/Badge/Badge.js.map +0 -1
  342. package/dist/components/Badge/index.d.ts +0 -2
  343. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +0 -1
  344. package/dist/components/Button/Button.js +0 -73
  345. package/dist/components/Button/Button.js.map +0 -1
  346. package/dist/components/Button/buttonStyles.js +0 -32
  347. package/dist/components/Button/buttonStyles.js.map +0 -1
  348. package/dist/components/Button/index.d.ts +0 -2
  349. package/dist/components/Button/index.js +0 -4
  350. package/dist/components/Card/Card.js.map +0 -1
  351. package/dist/components/Card/index.d.ts +0 -2
  352. package/dist/components/Chart/BarChart.js +0 -327
  353. package/dist/components/Chart/BarChart.js.map +0 -1
  354. package/dist/components/Chart/ChartFrame.js.map +0 -1
  355. package/dist/components/Chart/ChartLegend.js.map +0 -1
  356. package/dist/components/Chart/ChartTable.js.map +0 -1
  357. package/dist/components/Chart/ChartTooltip.js.map +0 -1
  358. package/dist/components/Chart/HeatGrid.js +0 -256
  359. package/dist/components/Chart/HeatGrid.js.map +0 -1
  360. package/dist/components/Chart/LineChart.js +0 -248
  361. package/dist/components/Chart/LineChart.js.map +0 -1
  362. package/dist/components/Chart/format.js.map +0 -1
  363. package/dist/components/Chart/geometry.js.map +0 -1
  364. package/dist/components/Chart/interaction.js.map +0 -1
  365. package/dist/components/Chart/labels.js.map +0 -1
  366. package/dist/components/Chart/scale.js.map +0 -1
  367. package/dist/components/Chart/series.d.ts +0 -14
  368. package/dist/components/Chart/series.js +0 -72
  369. package/dist/components/Chart/series.js.map +0 -1
  370. package/dist/components/Chart/summary.js.map +0 -1
  371. package/dist/components/Chart/useElementWidth.js.map +0 -1
  372. package/dist/components/Checkbox/Checkbox.js.map +0 -1
  373. package/dist/components/CodeBlock/CodeBlock.js.map +0 -1
  374. package/dist/components/Combobox/Combobox.js +0 -106
  375. package/dist/components/Combobox/Combobox.js.map +0 -1
  376. package/dist/components/CommandPalette/CommandPalette.js.map +0 -1
  377. package/dist/components/CommandPalette/CommandPaletteOverlay.d.ts +0 -11
  378. package/dist/components/CommandPalette/CommandPaletteOverlay.js +0 -180
  379. package/dist/components/CommandPalette/CommandPaletteOverlay.js.map +0 -1
  380. package/dist/components/DatePicker/DatePicker.js +0 -142
  381. package/dist/components/DatePicker/DatePicker.js.map +0 -1
  382. package/dist/components/Dialog/Dialog.d.ts +0 -37
  383. package/dist/components/Dialog/Dialog.js.map +0 -1
  384. package/dist/components/Dialog/DialogOverlay.d.ts +0 -3
  385. package/dist/components/Dialog/DialogOverlay.js +0 -72
  386. package/dist/components/Dialog/DialogOverlay.js.map +0 -1
  387. package/dist/components/Drawer/Drawer.d.ts +0 -36
  388. package/dist/components/Drawer/Drawer.js.map +0 -1
  389. package/dist/components/Drawer/DrawerOverlay.js +0 -71
  390. package/dist/components/Drawer/DrawerOverlay.js.map +0 -1
  391. package/dist/components/DropdownMenu/DropdownMenu.js.map +0 -1
  392. package/dist/components/DropdownMenu/DropdownMenuParts.js.map +0 -1
  393. package/dist/components/EmptyState/EmptyState.js.map +0 -1
  394. package/dist/components/FileDropZone/FileDropZone.js.map +0 -1
  395. package/dist/components/IconButton/IconButton.d.ts +0 -17
  396. package/dist/components/IconButton/IconButton.js +0 -37
  397. package/dist/components/IconButton/IconButton.js.map +0 -1
  398. package/dist/components/Input/Input.js +0 -43
  399. package/dist/components/Input/Input.js.map +0 -1
  400. package/dist/components/Input/index.d.ts +0 -2
  401. package/dist/components/Kbd/Kbd.js.map +0 -1
  402. package/dist/components/PageHeader/PageHeader.js.map +0 -1
  403. package/dist/components/Pagination/Pagination.js.map +0 -1
  404. package/dist/components/Pagination/index.d.ts +0 -2
  405. package/dist/components/Pagination/index.js +0 -2
  406. package/dist/components/Popover/Popover.js.map +0 -1
  407. package/dist/components/Popover/PopoverOverlay.js.map +0 -1
  408. package/dist/components/ProgressBar/ProgressBar.js.map +0 -1
  409. package/dist/components/ProgressBar/index.d.ts +0 -2
  410. package/dist/components/RadioGroup/RadioGroup.js +0 -46
  411. package/dist/components/RadioGroup/RadioGroup.js.map +0 -1
  412. package/dist/components/SegmentedControl/SegmentedControl.js +0 -55
  413. package/dist/components/SegmentedControl/SegmentedControl.js.map +0 -1
  414. package/dist/components/SegmentedControl/index.d.ts +0 -2
  415. package/dist/components/Select/Select.js +0 -64
  416. package/dist/components/Select/Select.js.map +0 -1
  417. package/dist/components/Skeleton/Skeleton.js.map +0 -1
  418. package/dist/components/Spinner/Spinner.js.map +0 -1
  419. package/dist/components/Stat/Stat.d.ts +0 -49
  420. package/dist/components/Stat/Stat.js +0 -125
  421. package/dist/components/Stat/Stat.js.map +0 -1
  422. package/dist/components/Stat/index.d.ts +0 -2
  423. package/dist/components/Stat/index.js +0 -2
  424. package/dist/components/Switch/Switch.js +0 -39
  425. package/dist/components/Switch/Switch.js.map +0 -1
  426. package/dist/components/Table/Table.js.map +0 -1
  427. package/dist/components/Tabs/Tabs.js.map +0 -1
  428. package/dist/components/Tag/Tag.js +0 -48
  429. package/dist/components/Tag/Tag.js.map +0 -1
  430. package/dist/components/Textarea/Textarea.js +0 -30
  431. package/dist/components/Textarea/Textarea.js.map +0 -1
  432. package/dist/components/Textarea/index.d.ts +0 -2
  433. package/dist/components/Toast/Toast.js.map +0 -1
  434. package/dist/components/Toast/ToastItem.d.ts +0 -6
  435. package/dist/components/Toast/ToastItem.js.map +0 -1
  436. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  437. package/dist/components/Tooltip/TooltipOverlay.js.map +0 -1
  438. package/dist/internal/LazyDialogTrigger.d.ts +0 -8
  439. package/dist/internal/LazyDialogTrigger.js +0 -15
  440. package/dist/internal/LazyDialogTrigger.js.map +0 -1
  441. package/dist/internal/Spinner.d.ts +0 -3
  442. package/dist/internal/Spinner.js +0 -14
  443. package/dist/internal/Spinner.js.map +0 -1
  444. package/dist/internal/useLazyMenuTrigger.d.ts +0 -23
  445. package/dist/internal/useLazyMenuTrigger.js +0 -47
  446. package/dist/internal/useLazyMenuTrigger.js.map +0 -1
  447. package/dist/utils/cxLite.d.ts +0 -12
  448. package/dist/utils/cxLite.js +0 -23
  449. package/dist/utils/cxLite.js.map +0 -1
  450. /package/dist/components/{Badge → atoms/Badge}/index.js +0 -0
  451. /package/dist/components/{Checkbox → atoms/Checkbox}/Checkbox.d.ts +0 -0
  452. /package/dist/components/{Checkbox → atoms/Checkbox}/index.d.ts +0 -0
  453. /package/dist/components/{Checkbox → atoms/Checkbox}/index.js +0 -0
  454. /package/dist/components/{IconButton → atoms/IconButton}/index.d.ts +0 -0
  455. /package/dist/components/{IconButton → atoms/IconButton}/index.js +0 -0
  456. /package/dist/components/{Kbd → atoms/Kbd}/index.d.ts +0 -0
  457. /package/dist/components/{Kbd → atoms/Kbd}/index.js +0 -0
  458. /package/dist/components/{ProgressBar → atoms/ProgressBar}/index.js +0 -0
  459. /package/dist/components/{Skeleton → atoms/Skeleton}/Skeleton.d.ts +0 -0
  460. /package/dist/components/{Skeleton → atoms/Skeleton}/index.d.ts +0 -0
  461. /package/dist/components/{Skeleton → atoms/Skeleton}/index.js +0 -0
  462. /package/dist/components/{Spinner → atoms/Spinner}/Spinner.d.ts +0 -0
  463. /package/dist/components/{Spinner → atoms/Spinner}/index.d.ts +0 -0
  464. /package/dist/components/{Spinner → atoms/Spinner}/index.js +0 -0
  465. /package/dist/components/{Switch → atoms/Switch}/index.d.ts +0 -0
  466. /package/dist/components/{Switch → atoms/Switch}/index.js +0 -0
  467. /package/dist/components/{Tooltip → atoms/Tooltip}/Tooltip.d.ts +0 -0
  468. /package/dist/components/{Tooltip → atoms/Tooltip}/TooltipOverlay.d.ts +0 -0
  469. /package/dist/components/{Tooltip → atoms/Tooltip}/index.d.ts +0 -0
  470. /package/dist/components/{Tooltip → atoms/Tooltip}/index.js +0 -0
  471. /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/Breadcrumbs.d.ts +0 -0
  472. /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/index.d.ts +0 -0
  473. /package/dist/components/{Breadcrumbs → molecules/Breadcrumbs}/index.js +0 -0
  474. /package/dist/components/{Card → molecules/Card}/index.js +0 -0
  475. /package/dist/components/{CodeBlock → molecules/CodeBlock}/index.d.ts +0 -0
  476. /package/dist/components/{CodeBlock → molecules/CodeBlock}/index.js +0 -0
  477. /package/dist/components/{Combobox → molecules/Combobox}/index.d.ts +0 -0
  478. /package/dist/components/{Combobox → molecules/Combobox}/index.js +0 -0
  479. /package/dist/components/{DatePicker → molecules/DatePicker}/index.d.ts +0 -0
  480. /package/dist/components/{DatePicker → molecules/DatePicker}/index.js +0 -0
  481. /package/dist/components/{Dialog → molecules/Dialog}/index.d.ts +0 -0
  482. /package/dist/components/{Dialog → molecules/Dialog}/index.js +0 -0
  483. /package/dist/components/{Drawer → molecules/Drawer}/index.d.ts +0 -0
  484. /package/dist/components/{Drawer → molecules/Drawer}/index.js +0 -0
  485. /package/dist/components/{DropdownMenu → molecules/DropdownMenu}/index.d.ts +0 -0
  486. /package/dist/components/{DropdownMenu → molecules/DropdownMenu}/index.js +0 -0
  487. /package/dist/components/{EmptyState → molecules/EmptyState}/index.d.ts +0 -0
  488. /package/dist/components/{EmptyState → molecules/EmptyState}/index.js +0 -0
  489. /package/dist/components/{FileDropZone → molecules/FileDropZone}/index.d.ts +0 -0
  490. /package/dist/components/{FileDropZone → molecules/FileDropZone}/index.js +0 -0
  491. /package/dist/components/{Input → molecules/Input}/index.js +0 -0
  492. /package/dist/components/{Popover → molecules/Popover}/PopoverOverlay.d.ts +0 -0
  493. /package/dist/components/{Popover → molecules/Popover}/index.d.ts +0 -0
  494. /package/dist/components/{Popover → molecules/Popover}/index.js +0 -0
  495. /package/dist/components/{RadioGroup → molecules/RadioGroup}/RadioGroup.d.ts +0 -0
  496. /package/dist/components/{RadioGroup → molecules/RadioGroup}/index.d.ts +0 -0
  497. /package/dist/components/{RadioGroup → molecules/RadioGroup}/index.js +0 -0
  498. /package/dist/components/{SegmentedControl → molecules/SegmentedControl}/index.js +0 -0
  499. /package/dist/components/{Select → molecules/Select}/index.d.ts +0 -0
  500. /package/dist/components/{Select → molecules/Select}/index.js +0 -0
  501. /package/dist/components/{Tabs → molecules/Tabs}/Tabs.d.ts +0 -0
  502. /package/dist/components/{Tabs → molecules/Tabs}/index.d.ts +0 -0
  503. /package/dist/components/{Tabs → molecules/Tabs}/index.js +0 -0
  504. /package/dist/components/{Tag → molecules/Tag}/Tag.d.ts +0 -0
  505. /package/dist/components/{Tag → molecules/Tag}/index.d.ts +0 -0
  506. /package/dist/components/{Tag → molecules/Tag}/index.js +0 -0
  507. /package/dist/components/{Textarea → molecules/Textarea}/index.js +0 -0
  508. /package/dist/components/{Toast → molecules/Toast}/index.js +0 -0
  509. /package/dist/components/{Chart → organisms/Chart}/ChartTable.d.ts +0 -0
  510. /package/dist/components/{Chart → organisms/Chart}/geometry.d.ts +0 -0
  511. /package/dist/components/{Chart → organisms/Chart}/labels.d.ts +0 -0
  512. /package/dist/components/{Chart → organisms/Chart}/scale.d.ts +0 -0
  513. /package/dist/components/{Chart → organisms/Chart}/summary.d.ts +0 -0
  514. /package/dist/components/{Chart → organisms/Chart}/useElementWidth.d.ts +0 -0
  515. /package/dist/components/{CommandPalette → organisms/CommandPalette}/index.js +0 -0
  516. /package/dist/components/{PageHeader → organisms/PageHeader}/PageHeader.d.ts +0 -0
  517. /package/dist/components/{PageHeader → organisms/PageHeader}/index.d.ts +0 -0
  518. /package/dist/components/{PageHeader → organisms/PageHeader}/index.js +0 -0
  519. /package/dist/components/{Table → organisms/Table}/index.d.ts +0 -0
  520. /package/dist/components/{Table → organisms/Table}/index.js +0 -0
  521. /package/dist/{chrome → internal}/brandLogoPath.d.ts +0 -0
  522. /package/dist/{chrome → router}/Anchor.d.ts +0 -0
  523. /package/dist/{chrome → router}/LinkRouter.d.ts +0 -0
  524. /package/dist/{chrome → theme}/useTheme.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- // src/components/Chart/format.ts
2
+ // src/components/organisms/Chart/format.ts
3
3
  var day = 864e5;
4
4
  function xKind(xs) {
5
5
  const first = xs[0];
@@ -117,18 +117,20 @@ function createValueFormat(max, locale, options) {
117
117
  axis: (value) => axis.format(value)
118
118
  };
119
119
  }
120
+ /** Average width of one character at the chart's 12px text, in pixels. */
121
+ var charWidth = 6.6;
120
122
  /** Rough width of `text` at 12px in the UI font, for margins and tick density. */
121
123
  function textWidth(text) {
122
- return text.length * 6.6;
124
+ return text.length * charWidth;
123
125
  }
124
126
  /** `text` as it is when it fits in `width` pixels, otherwise shortened with an ellipsis. */
125
127
  function fitText(text, width) {
126
- return textWidth(text) <= width + .5 ? text : truncate(text, Math.floor(width / 6.6));
128
+ return textWidth(text) <= width + .5 ? text : truncate(text, Math.floor(width / charWidth));
127
129
  }
128
130
  /** Shortens text to `limit` characters with an ellipsis. */
129
131
  function truncate(text, limit) {
130
132
  return text.length > limit ? `${text.slice(0, Math.max(1, limit - 1))}…` : text;
131
133
  }
132
- export { createValueFormat, createXFormat, fitText, textWidth, truncate, xKind, xNumbers };
134
+ export { charWidth, createValueFormat, createXFormat, fitText, textWidth, truncate, xKind, xNumbers };
133
135
 
134
136
  //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","names":[],"sources":["../../../../src/components/organisms/Chart/format.ts"],"sourcesContent":["import type { XValue } from './types';\n\nexport type XKind = 'time' | 'number' | 'category';\n\nconst day = 24 * 60 * 60 * 1000;\n\nexport function xKind(xs: XValue[]): XKind {\n const first = xs[0];\n if (first instanceof Date) return 'time';\n return typeof first === 'number' ? 'number' : 'category';\n}\n\n/** Where each x sits along the axis: its time or value, or its index for categories. */\nexport function xNumbers(xs: XValue[]): number[] {\n return xs.map((x, index) => {\n if (x instanceof Date) return x.getTime();\n return typeof x === 'number' ? x : index;\n });\n}\n\nexport interface XFormat {\n /** Short text for an axis tick. */\n tick: (index: number) => string;\n /** Full text for a tooltip, the table and accessible names. */\n full: (index: number) => string;\n}\n\nconst componentKeys = [\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'dayPeriod',\n 'hour',\n 'minute',\n 'second',\n 'fractionalSecondDigits',\n 'timeZoneName',\n 'dateStyle',\n 'timeStyle',\n] as const;\n\n/** Whether `time` is exactly midnight in `timeZone`, or in the runtime zone when it is unset. */\nfunction isMidnight(time: number, timeZone?: string): boolean {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n hourCycle: 'h23',\n }).formatToParts(time);\n return parts.every(\n (part) =>\n !['hour', 'minute', 'second'].includes(part.type) ||\n part.value === '0' ||\n part.value === '00',\n );\n}\n\n/** Whether the points carry a time of day: not all at midnight and closer together than a day. */\nfunction hasTimeOfDay(times: number[], timeZone?: string): boolean {\n if (times.every((time) => isMidnight(time, timeZone))) return false;\n const sorted = [...new Set(times)].toSorted((a, b) => a - b);\n const steps = sorted.slice(1).map((time, index) => time - (sorted[index] ?? time));\n return steps.length > 0 && Math.min(...steps) < day;\n}\n\nexport function createXFormat(\n xs: XValue[],\n locale?: string,\n options?: Intl.DateTimeFormatOptions,\n): XFormat {\n const kind = xKind(xs);\n if (kind === 'time') {\n const times = xNumbers(xs);\n const span = Math.max(...times) - Math.min(...times);\n const timeZone = options?.timeZone;\n const isTimed = hasTimeOfDay(times, timeZone);\n const automatic: Intl.DateTimeFormatOptions =\n isTimed && span < 2 * day\n ? { hour: 'numeric', minute: '2-digit' }\n : span > 400 * day\n ? { month: 'short', year: 'numeric' }\n : { month: 'short', day: 'numeric' };\n const isComplete = options && componentKeys.some((key) => options[key] !== undefined);\n const tick = new Intl.DateTimeFormat(\n locale,\n isComplete ? options : { ...automatic, ...options },\n );\n const full = new Intl.DateTimeFormat(\n locale,\n isTimed\n ? { dateStyle: 'medium', timeStyle: 'short', timeZone }\n : { dateStyle: 'medium', timeZone },\n );\n const pick = (format: Intl.DateTimeFormat) => (index: number) => {\n const x = xs[index];\n return x instanceof Date ? format.format(x) : '';\n };\n return { tick: pick(tick), full: pick(full) };\n }\n if (kind === 'number') {\n const format = new Intl.NumberFormat(locale);\n const text = (index: number) => {\n const x = xs[index];\n return typeof x === 'number' ? format.format(x) : '';\n };\n return { tick: text, full: text };\n }\n const text = (index: number) => String(xs[index] ?? '');\n return { tick: text, full: text };\n}\n\nexport interface ValueFormat {\n full: (value: number) => string;\n /** Compact above 10,000, so axis labels stay short. */\n axis: (value: number) => string;\n}\n\nexport function createValueFormat(\n max: number,\n locale?: string,\n options?: Intl.NumberFormatOptions,\n): ValueFormat {\n const full = new Intl.NumberFormat(locale, options);\n const compact = max >= 10000 && options?.style !== 'percent';\n const axis = compact\n ? new Intl.NumberFormat(locale, { ...options, notation: 'compact', maximumFractionDigits: 1 })\n : full;\n return { full: (value) => full.format(value), axis: (value) => axis.format(value) };\n}\n\n/** Average width of one character at the chart's 12px text, in pixels. */\nexport const charWidth = 6.6;\n\n/** Rough width of `text` at 12px in the UI font, for margins and tick density. */\nexport function textWidth(text: string): number {\n return text.length * charWidth;\n}\n\n/** `text` as it is when it fits in `width` pixels, otherwise shortened with an ellipsis. */\nexport function fitText(text: string, width: number): string {\n return textWidth(text) <= width + 0.5 ? text : truncate(text, Math.floor(width / charWidth));\n}\n\n/** Shortens text to `limit` characters with an ellipsis. */\nexport function truncate(text: string, limit: number): string {\n return text.length > limit ? `${text.slice(0, Math.max(1, limit - 1))}…` : text;\n}\n"],"mappings":";;AAIA,IAAM,MAAM;AAEZ,SAAgB,MAAM,IAAqB;CACzC,MAAM,QAAQ,GAAG;CACjB,IAAI,iBAAiB,MAAM,OAAO;CAClC,OAAO,OAAO,UAAU,WAAW,WAAW;AAChD;;AAGA,SAAgB,SAAS,IAAwB;CAC/C,OAAO,GAAG,KAAK,GAAG,UAAU;EAC1B,IAAI,aAAa,MAAM,OAAO,EAAE,QAAQ;EACxC,OAAO,OAAO,MAAM,WAAW,IAAI;CACrC,CAAC;AACH;AASA,IAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,SAAS,WAAW,MAAc,UAA4B;CAQ5D,OAPc,IAAI,KAAK,eAAe,SAAS;EAC7C;EACA,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,WAAW;CACb,CAAC,CAAC,CAAC,cAAc,IACV,CAAA,CAAM,OACV,SACC,CAAC;EAAC;EA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AAO,CAAC,IAAI;EAChD;EACA,OAAO;GAAE,MAAM,KAAK,IAAI;GAAG,MAAM,KAAK,IAAI;EAAE;CAC9C;CACA,IAAI,SAAS,UAAU;EACrB,MAAM,SAAS,IAAI,KAAK,aAAa,MAAM;EAC3C,MAAM,QAAQ,UAAkB;GAC9B,MAAM,IAAI,GAAG;GACb,OAAO,OAAO,MAAM,WAAW,OAAO,OAAO,CAAC,IAAI;EACpD;EACA,OAAO;GAAE,MAAM;GAAM,MAAM;EAAK;CAClC;CACA,MAAM,QAAQ,UAAkB,OAAO,GAAG,UAAU,EAAE;CACtD,OAAO;EAAE,MAAM;EAAM,MAAM;CAAK;AAClC;AAQA,SAAgB,kBACd,KACA,QACA,SACa;CACb,MAAM,OAAO,IAAI,KAAK,aAAa,QAAQ,OAAO;CAElD,MAAM,OADU,OAAO,OAAS,SAAS,UAAU,YAE/C,IAAI,KAAK,aAAa,QAAQ;EAAE,GAAG;EAAS,UAAU;EAAW,uBAAuB;CAAE,CAAC,IAC3F;CACJ,OAAO;EAAE,OAAO,UAAU,KAAK,OAAO,KAAK;EAAG,OAAO,UAAU,KAAK,OAAO,KAAK;CAAE;AACpF;;AAGA,IAAa,YAAY;;AAGzB,SAAgB,UAAU,MAAsB;CAC9C,OAAO,KAAK,SAAS;AACvB;;AAGA,SAAgB,QAAQ,MAAc,OAAuB;CAC3D,OAAO,UAAU,IAAI,KAAK,QAAQ,KAAM,OAAO,SAAS,MAAM,KAAK,MAAM,QAAQ,SAAS,CAAC;AAC7F;;AAGA,SAAgB,SAAS,MAAc,OAAuB;CAC5D,OAAO,KAAK,SAAS,QAAQ,GAAG,KAAK,MAAM,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC,CAAC,EAAE,KAAK;AAC7E"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- // src/components/Chart/geometry.ts
2
+ // src/components/organisms/Chart/geometry.ts
3
3
  /** The SVG path of a marker centred on x, y whose circumscribed circle has radius r. */
4
4
  function markerPath(shape, x, y, r) {
5
5
  const points = (angles, radius) => angles.map((angle, index) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.js","names":[],"sources":["../../../../src/components/organisms/Chart/geometry.ts"],"sourcesContent":["export type MarkerShape =\n 'circle' | 'square' | 'diamond' | 'triangle' | 'triangle-down' | 'hexagon';\n\n/** The SVG path of a marker centred on x, y whose circumscribed circle has radius r. */\nexport function markerPath(shape: MarkerShape, x: number, y: number, r: number): string {\n const points = (angles: number[], radius: number) =>\n angles\n .map((angle, index) => {\n const rad = ((angle - 90) * Math.PI) / 180;\n return `${index === 0 ? 'M' : 'L'}${(x + radius * Math.cos(rad)).toFixed(2)} ${(y + radius * Math.sin(rad)).toFixed(2)}`;\n })\n .join('') + 'Z';\n switch (shape) {\n case 'circle':\n return `M${x - r} ${y}a${r} ${r} 0 1 0 ${2 * r} 0a${r} ${r} 0 1 0 ${-2 * r} 0Z`;\n case 'square':\n return points([45, 135, 225, 315], r * Math.SQRT2 * 0.82);\n case 'diamond':\n return points([0, 90, 180, 270], r * 1.2);\n case 'triangle':\n return points([0, 120, 240], r * 1.25);\n case 'triangle-down':\n return points([180, 300, 60], r * 1.25);\n case 'hexagon':\n return points([0, 60, 120, 180, 240, 300], r * 1.1);\n }\n}\n\nexport type BarEnd = 'top' | 'right' | 'bottom' | 'left' | 'none';\n\n/**\n * A bar with a rounded data end and a square base. `top` rounds the upper corners of a column,\n * `right` the right corners of a horizontal bar, `bottom` and `left` the same for a bar that\n * grows below or to the left of zero, and `none` draws a plain rectangle (the inner segments of a\n * stack).\n */\nexport function barPath(\n x: number,\n y: number,\n width: number,\n height: number,\n end: BarEnd,\n radius = 4,\n): string {\n if (width <= 0 || height <= 0) return '';\n if (end === 'none') return `M${x} ${y}h${width}v${height}h${-width}Z`;\n if (end === 'top') {\n const r = Math.min(radius, width / 2, height);\n return `M${x} ${y + height}V${y + r}a${r} ${r} 0 0 1 ${r} ${-r}h${width - 2 * r}a${r} ${r} 0 0 1 ${r} ${r}V${y + height}Z`;\n }\n if (end === 'bottom') {\n const r = Math.min(radius, width / 2, height);\n return `M${x} ${y}h${width}V${y + height - r}a${r} ${r} 0 0 1 ${-r} ${r}H${x + r}a${r} ${r} 0 0 1 ${-r} ${-r}Z`;\n }\n if (end === 'left') {\n const r = Math.min(radius, height / 2, width);\n return `M${x + width} ${y}H${x + r}a${r} ${r} 0 0 0 ${-r} ${r}V${y + height - r}a${r} ${r} 0 0 0 ${r} ${r}H${x + width}Z`;\n }\n const r = Math.min(radius, height / 2, width);\n return `M${x} ${y}H${x + width - r}a${r} ${r} 0 0 1 ${r} ${r}V${y + height - r}a${r} ${r} 0 0 1 ${-r} ${r}H${x}Z`;\n}\n"],"mappings":";;;AAIA,SAAgB,WAAW,OAAoB,GAAW,GAAW,GAAmB;CACtF,MAAM,UAAU,QAAkB,WAChC,OACG,KAAK,OAAO,UAAU;EACrB,MAAM,OAAQ,QAAQ,MAAM,KAAK,KAAM;EACvC,OAAO,GAAG,UAAU,IAAI,MAAM,OAAO,IAAI,SAAS,KAAK,IAAI,GAAG,EAAA,CAAG,QAAQ,CAAC,EAAE,IAAI,IAAI,SAAS,KAAK,IAAI,GAAG,EAAA,CAAG,QAAQ,CAAC;CACvH,CAAC,CAAC,CACD,KAAK,EAAE,IAAI;CAChB,QAAQ,OAAR;EACE,KAAK,UACH,OAAO,IAAI,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,KAAK,EAAE;EAC7E,KAAK,UACH,OAAO,OAAO;GAAC;GAAI;GAAK;GAAK;EAAG,GAAG,IAAI,KAAK,QAAQ,GAAI;EAC1D,KAAK,WACH,OAAO,OAAO;GAAC;GAAG;GAAI;GAAK;EAAG,GAAG,IAAI,GAAG;EAC1C,KAAK,YACH,OAAO,OAAO;GAAC;GAAG;GAAK;EAAG,GAAG,IAAI,IAAI;EACvC,KAAK,iBACH,OAAO,OAAO;GAAC;G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,KAAK,IAAI,QAAQ,SAAS,GAAG,KAAK;CAC5C,OAAO,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,IAAI,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE;AACjH"}
@@ -1,7 +1,7 @@
1
1
  export { BarChart } from './BarChart';
2
2
  export type { BarChartProps } from './BarChart';
3
- export { ChartLegend } from './ChartLegend';
4
- export type { ChartLegendItem, ChartLegendProps } from './ChartLegend';
3
+ export { Sparkline } from './Sparkline';
4
+ export type { SparklineProps } from './Sparkline';
5
5
  export { HeatGrid } from './HeatGrid';
6
6
  export type { HeatGridCell, HeatGridLine, HeatGridProps, HeatGridState, HeatGridTone, } from './HeatGrid';
7
7
  export { LineChart } from './LineChart';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { BarChart } from "./BarChart.js";
3
- import { ChartLegend } from "./ChartLegend.js";
3
+ import { Sparkline } from "./Sparkline.js";
4
4
  import { HeatGrid } from "./HeatGrid.js";
5
5
  import { LineChart } from "./LineChart.js";
6
- export { BarChart, ChartLegend, HeatGrid, LineChart };
6
+ export { BarChart, HeatGrid, LineChart, Sparkline };
@@ -26,18 +26,22 @@ export interface Interaction {
26
26
  * the chart. `onActivate` receives the element of the mark that was just hovered or focused.
27
27
  */
28
28
  export declare function useChartInteraction(count: number, columns?: number, onActivate?: (element: HTMLElement | null) => void): Interaction;
29
+ /** Classes for a mark that is an invisible hit area laid over the plot. */
30
+ export declare const markHitArea = "absolute rounded-xs";
29
31
  interface ChartMarkProps {
30
32
  index: number;
31
33
  interaction: Interaction;
32
- /** The full description, read by a screen reader when the mark takes focus. */
33
- label: string;
34
- style: CSSProperties;
34
+ /** The full description, read by a screen reader when the mark takes focus. Without it the mark's own content names it. */
35
+ label?: string;
36
+ role?: 'img' | 'gridcell';
37
+ style?: CSSProperties;
35
38
  className?: string;
36
39
  children?: ReactNode;
37
40
  }
38
41
  /**
39
- * An invisible, focusable hit area laid over the plot. It is bigger than the mark it stands for,
40
- * shows the library focus ring for keyboard focus and opens the tooltip.
42
+ * A focusable mark of a chart. Over a plot it is an invisible hit area bigger than the mark it
43
+ * stands for (see `markHitArea`); in a grid it is the cell itself. It shows the library focus
44
+ * ring for keyboard focus and opens the tooltip.
41
45
  */
42
- export declare function ChartMark({ index, interaction, label, style, className, children, }: ChartMarkProps): import("react").JSX.Element;
46
+ export declare function ChartMark({ index, interaction, label, role, style, className, children, }: ChartMarkProps): import("react").JSX.Element;
43
47
  export {};
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { focusRing } from "../../internal/focusRing.js";
3
- import { cx } from "../../utils/cxLite.js";
2
+ import { focusRing } from "../../../internal/focusRing.js";
3
+ import { cx } from "../../../utils/cx.js";
4
4
  import { useRef, useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { useFocusRing } from "react-aria/useFocusRing";
7
6
  import { mergeProps } from "react-aria/mergeProps";
8
- // src/components/Chart/interaction.tsx
7
+ import { useFocusRing } from "react-aria/useFocusRing";
8
+ // src/components/organisms/Chart/interaction.tsx
9
9
  /**
10
10
  * Where the arrow keys lead from `index`, or -1 to stay put. With `columns` the marks form a grid
11
11
  * (left and right along a row, up and down across rows, Ctrl with Home or End for the corners);
@@ -84,23 +84,26 @@ function useChartInteraction(count, columns = 0, onActivate) {
84
84
  markProps
85
85
  };
86
86
  }
87
+ /** Classes for a mark that is an invisible hit area laid over the plot. */
88
+ var markHitArea = "absolute rounded-xs";
87
89
  /**
88
- * An invisible, focusable hit area laid over the plot. It is bigger than the mark it stands for,
89
- * shows the library focus ring for keyboard focus and opens the tooltip.
90
+ * A focusable mark of a chart. Over a plot it is an invisible hit area bigger than the mark it
91
+ * stands for (see `markHitArea`); in a grid it is the cell itself. It shows the library focus
92
+ * ring for keyboard focus and opens the tooltip.
90
93
  */
91
- function ChartMark({ index, interaction, label, style, className, children }) {
94
+ function ChartMark({ index, interaction, label, role = "img", style, className, children }) {
92
95
  const { focusProps, isFocusVisible } = useFocusRing();
93
96
  const props = mergeProps(interaction.markProps(index), focusProps);
94
97
  return /* @__PURE__ */ jsx("div", {
95
- role: "img",
98
+ role,
96
99
  "aria-label": label,
97
100
  "data-focus-visible": isFocusVisible || void 0,
98
- className: cx("absolute rounded-xs", focusRing, className),
101
+ className: cx(focusRing, className),
99
102
  style,
100
103
  ...props,
101
104
  children
102
105
  });
103
106
  }
104
- export { ChartMark, nextIndex, useChartInteraction };
107
+ export { ChartMark, markHitArea, nextIndex, useChartInteraction };
105
108
 
106
109
  //# sourceMappingURL=interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.js","names":[],"sources":["../../../../src/components/organisms/Chart/interaction.tsx"],"sourcesContent":["import { useRef, useState, type CSSProperties, type KeyboardEvent, type ReactNode } from 'react';\nimport { mergeProps } from 'react-aria/mergeProps';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { focusRing } from '../../../internal/focusRing';\nimport { cx } from '../../../utils/cx';\n\n/**\n * Where the arrow keys lead from `index`, or -1 to stay put. With `columns` the marks form a grid\n * (left and right along a row, up and down across rows, Ctrl with Home or End for the corners);\n * without it they form one line that every arrow key walks.\n */\nexport function nextIndex(\n key: string,\n ctrl: boolean,\n index: number,\n count: number,\n columns = 0,\n): number {\n const last = count - 1;\n const rowStart = columns ? index - (index % columns) : 0;\n let target = -1;\n if (key === 'Home') target = ctrl ? 0 : rowStart;\n else if (key === 'End') target = ctrl ? last : columns ? rowStart + columns - 1 : last;\n else if (columns === 0) {\n if (key === 'ArrowRight' || key === 'ArrowDown') target = index + 1;\n if (key === 'ArrowLeft' || key === 'ArrowUp') target = index - 1;\n } else {\n const column = index % columns;\n if (key === 'ArrowRight' && column < columns - 1) target = index + 1;\n if (key === 'ArrowLeft' && column > 0) target = index - 1;\n if (key === 'ArrowDown') target = index + columns;\n if (key === 'ArrowUp') target = index - columns;\n }\n return target < 0 || target > last || target === index ? -1 : target;\n}\n\ninterface MarkHandlers {\n ref: (element: HTMLElement | null) => void;\n tabIndex: number;\n onFocus: () => void;\n onBlur: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;\n onPointerEnter: () => void;\n onPointerLeave: () => void;\n}\n\nexport interface Interaction {\n /** The mark whose tooltip is showing, from the pointer or the keyboard. */\n active: number | null;\n markProps: (index: number) => MarkHandlers;\n}\n\n/**\n * Pointer and keyboard state shared by the charts: one tab stop that moves with the arrow keys\n * (roving tabindex), hover and focus both open the tooltip, and Escape closes it until the next\n * move. Escape is only consumed while a tooltip is open, so a second press reaches a dialog around\n * the chart. `onActivate` receives the element of the mark that was just hovered or focused.\n */\nexport function useChartInteraction(\n count: number,\n columns = 0,\n onActivate?: (element: HTMLElement | null) => void,\n): Interaction {\n const [roving, setRoving] = useState(0);\n const [focused, setFocused] = useState<number | null>(null);\n const [hovered, setHovered] = useState<number | null>(null);\n const [dismissed, setDismissed] = useState(false);\n const marks = useRef(new Map<number, HTMLElement>());\n const current = Math.min(roving, Math.max(0, count - 1));\n const isOpen = !dismissed && (hovered ?? focused) !== null;\n\n function activate(index: number) {\n setDismissed(false);\n onActivate?.(marks.current.get(index) ?? null);\n }\n\n function markProps(index: number): MarkHandlers {\n return {\n ref: (element) => {\n if (element) marks.current.set(index, element);\n else marks.current.delete(index);\n },\n tabIndex: index === current ? 0 : -1,\n onFocus: () => {\n setRoving(index);\n setFocused(index);\n activate(index);\n },\n onBlur: () => setFocused(null),\n onKeyDown: (event) => {\n if (event.key === 'Escape') {\n if (!isOpen) return;\n event.stopPropagation();\n setDismissed(true);\n return;\n }\n const target = nextIndex(event.key, event.ctrlKey || event.metaKey, index, count, columns);\n if (target === -1) return;\n event.preventDefault();\n marks.current.get(target)?.focus();\n },\n onPointerEnter: () => {\n setHovered(index);\n activate(index);\n },\n onPointerLeave: () => setHovered(null),\n };\n }\n\n return { active: isOpen ? (hovered ?? focused) : null, markProps };\n}\n\n/** Classes for a mark that is an invisible hit area laid over the plot. */\nexport const markHitArea = 'absolute rounded-xs';\n\ninterface ChartMarkProps {\n index: number;\n interaction: Interaction;\n /** The full description, read by a screen reader when the mark takes focus. Without it the mark's own content names it. */\n label?: string;\n role?: 'img' | 'gridcell';\n style?: CSSProperties;\n className?: string;\n children?: ReactNode;\n}\n\n/**\n * A focusable mark of a chart. Over a plot it is an invisible hit area bigger than the mark it\n * stands for (see `markHitArea`); in a grid it is the cell itself. It shows the library focus\n * ring for keyboard focus and opens the tooltip.\n */\nexport function ChartMark({\n index,\n interaction,\n label,\n role = 'img',\n style,\n className,\n children,\n}: ChartMarkProps) {\n const { focusProps, isFocusVisible } = useFocusRing();\n const props = mergeProps(interaction.markProps(index), focusProps);\n\n return (\n <div\n role={role}\n aria-label={label}\n data-focus-visible={isFocusVisible || undefined}\n className={cx(focusRing, className)}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,UACd,KACA,MACA,OACA,OACA,UAAU,GACF;CACR,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,UAAU,QAAS,QAAQ,UAAW;CACvD,IAAI,SAAS;CACb,IAAI,QAAQ,QAAQ,SAAS,OAAO,IAAI;MACnC,IAAI,QAAQ,OAAO,SAAS,OAAO,OAAO,UAAU,WAAW,UAAU,IAAI;MAC7E,IAAI,YAAY,GAAG;EACtB,IAAI,QAAQ,gBAAgB,QAAQ,aAAa,SAAS,QAAQ;EAClE,IAAI,QAAQ,eAAe,QAAQ,WAAW,SAAS,QAAQ;CACjE,OAAO;EACL,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,gBAAgB,SAAS,UAAU,GAAG,SAAS,QAAQ;EACnE,IAAI,QAAQ,eAAe,SAAS,GAAG,SAAS,QAAQ;EACxD,IAAI,QAAQ,aAAa,SAAS,QAAQ;EAC1C,IAAI,QAAQ,WAAW,SAAS,QAAQ;CAC1C;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U,WAAW,UAAW;EAAM;CAAU;AACnE;;AAGA,IAAa,cAAc;;;;;;AAkB3B,SAAgB,UAAU,EACxB,OACA,aACA,OACA,OAAO,OACP,OACA,WACA,YACiB;CACjB,MAAM,EAAE,YAAY,mBAAmB,aAAa;CACpD,MAAM,QAAQ,WAAW,YAAY,UAAU,KAAK,GAAG,UAAU;CAEjE,OACE,oBAAC,OAAD;EACQ;EACN,cAAY;EACZ,sBAAoB,kBAAkB,KAAA;EACtC,WAAW,GAAG,WAAW,SAAS;EAC3B;EACP,GAAI;EAEH;CACE,CAAA;AAET"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- // src/components/Chart/labels.ts
2
+ // src/components/organisms/Chart/labels.ts
3
3
  var defaultLabels = {
4
4
  showTable: "Show table",
5
5
  hideTable: "Hide table",
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","names":[],"sources":["../../../../src/components/organisms/Chart/labels.ts"],"sourcesContent":["import type { ChartLabels } from './types';\n\nconst defaultLabels: ChartLabels = {\n showTable: 'Show table',\n hideTable: 'Hide table',\n empty: 'No data to show.',\n noData: 'No data',\n total: 'Total',\n category: 'Category',\n date: 'Date',\n value: 'Value',\n row: 'Row',\n};\n\n/** The labels a consumer passed, over the English defaults. */\nexport function chartLabels(labels?: Partial<ChartLabels>): ChartLabels {\n return { ...defaultLabels, ...labels };\n}\n"],"mappings":";;AAEA,IAAM,gBAA6B;CACjC,WAAW;CACX,WAAW;CACX,OAAO;CACP,QAAQ;CACR,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,KAAK;AACP;;AAGA,SAAgB,YAAY,QAA4C;CACtE,OAAO;EAAE,GAAG;EAAe,GAAG;CAAO;AACvC"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- // src/components/Chart/scale.ts
2
+ // src/components/organisms/Chart/scale.ts
3
3
  var steps = [
4
4
  1,
5
5
  2,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scale.js","names":[],"sources":["../../../../src/components/organisms/Chart/scale.ts"],"sourcesContent":["export interface NiceScale {\n ticks: number[];\n min: number;\n max: number;\n}\n\nconst steps = [1, 2, 2.5, 5, 10];\n\nfunction decimals(step: number): number {\n const text = String(step);\n const dot = text.indexOf('.');\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/**\n * Round tick values that cover `min` to `max`, about `count` of them. The domain is widened to the\n * first and last tick, so a bar chart can start at a clean zero and end at a clean top. With\n * `isInteger` the step is a whole number, so counts never get ticks such as 0.5.\n */\nexport function niceTicks(min: number, max: number, count: number, isInteger = false): NiceScale {\n if (min === max) {\n if (min === 0) return niceTicks(0, 1, count, isInteger);\n const pad = Math.abs(min) * 0.1;\n return niceTicks(min - pad, max + pad, count, isInteger);\n }\n const raw = (max - min) / Math.max(1, count - 1);\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const candidates = steps\n .map((s) => Number((s * magnitude).toPrecision(12)))\n .filter((step) => !isInteger || Number.isInteger(step));\n const step = isInteger && raw <= 1 ? 1 : (candidates.find((s) => s >= raw) ?? 10 * magnitude);\n const first = Math.floor(min / step) * step;\n const last = Math.ceil(max / step) * step;\n const places = decimals(step);\n const ticks: number[] = [];\n for (let value = first; value <= last + step / 2; value += step) {\n ticks.push(Number(value.toFixed(places)));\n }\n return { ticks, min: first, max: last };\n}\n\n/** A linear map from a domain to a range. A zero width domain maps to the middle of the range. */\nexport function linearScale(\n [d0, d1]: [number, number],\n [r0, r1]: [number, number],\n): (value: number) => number {\n if (d0 === d1) return () => (r0 + r1) / 2;\n const ratio = (r1 - r0) / (d1 - d0);\n return (value) => r0 + (value - d0) * ratio;\n}\n\n/** Evenly spaced indexes, starting at 0, so that at most `limit` labels are drawn. */\nexport function sampleIndexes(length: number, limit: number): number[] {\n const step = Math.max(1, Math.ceil(length / Math.max(1, limit)));\n return Array.from({ length: Math.ceil(length / step) }, (_, index) => index * step);\n}\n"],"mappings":";;AAMA,IAAM,QAAQ;CAAC;CAAG;CAAG;CAAK;CAAG;AAA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MAAM,QAAQ,MAAM;AACxC;;AAGA,SAAgB,cAAc,QAAgB,OAAyB;CACrE,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,KAAK,SAAS,KAAK,IAAI,GAAG,KAAK,CAAC,CAAC;CAC/D,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,KAAK,SAAS,IAAI,EAAE,IAAI,GAAG,UAAU,QAAQ,IAAI;AACpF"}
@@ -0,0 +1,30 @@
1
+ import type { MarkerShape } from './geometry';
2
+ import type { ChartSeries } from './types';
3
+ /** A palette position, or the project colour. */
4
+ export type SeriesColor = number | 'brand';
5
+ export interface SeriesStyle {
6
+ stroke: string;
7
+ fill: string;
8
+ swatch: string;
9
+ shape: MarkerShape;
10
+ /** SVG dash pattern. Only the colourless overflow series are dashed. */
11
+ dash?: string;
12
+ }
13
+ /**
14
+ * Colour, marker shape and dash of the series at `index`. The first six get a hue each, in a fixed
15
+ * order, never cycled. Further series share the muted colour and are told apart by shape and dash.
16
+ */
17
+ export declare function seriesStyle(index: SeriesColor): SeriesStyle;
18
+ export declare function isNumber(value: number | null | undefined): value is number;
19
+ /** Every value that is present, across all series. */
20
+ export declare function knownValues(series: ChartSeries[]): number[];
21
+ /** The colour of each series: the brand colour, its own `colorIndex`, or its position. */
22
+ export declare function seriesColors(series: ChartSeries[]): SeriesColor[];
23
+ /** Legend entries for the series, in the colours the plot uses. */
24
+ export declare function legendItems(series: ChartSeries[]): {
25
+ id: string;
26
+ label: string;
27
+ index: SeriesColor | undefined;
28
+ }[];
29
+ /** Table cells for one x position or category: the formatted value of each series, or empty. */
30
+ export declare function seriesCells(series: ChartSeries[], position: number, format: (value: number) => string): string[];
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ // src/components/organisms/Chart/series.ts
3
+ var shapes = [
4
+ "circle",
5
+ "square",
6
+ "diamond",
7
+ "triangle",
8
+ "triangle-down",
9
+ "hexagon"
10
+ ];
11
+ var palette = [
12
+ {
13
+ stroke: "stroke-chart-1",
14
+ fill: "fill-chart-1",
15
+ swatch: "bg-chart-1"
16
+ },
17
+ {
18
+ stroke: "stroke-chart-2",
19
+ fill: "fill-chart-2",
20
+ swatch: "bg-chart-2"
21
+ },
22
+ {
23
+ stroke: "stroke-chart-3",
24
+ fill: "fill-chart-3",
25
+ swatch: "bg-chart-3"
26
+ },
27
+ {
28
+ stroke: "stroke-chart-4",
29
+ fill: "fill-chart-4",
30
+ swatch: "bg-chart-4"
31
+ },
32
+ {
33
+ stroke: "stroke-chart-5",
34
+ fill: "fill-chart-5",
35
+ swatch: "bg-chart-5"
36
+ },
37
+ {
38
+ stroke: "stroke-chart-6",
39
+ fill: "fill-chart-6",
40
+ swatch: "bg-chart-6"
41
+ }
42
+ ];
43
+ var brand = {
44
+ stroke: "stroke-(--ui-bg-brand-solid)",
45
+ fill: "fill-(--ui-bg-brand-solid)",
46
+ swatch: "bg-brand-solid"
47
+ };
48
+ var overflow = {
49
+ stroke: "stroke-chart-muted",
50
+ fill: "fill-chart-muted",
51
+ swatch: "bg-chart-muted"
52
+ };
53
+ var dashes = [
54
+ "6 4",
55
+ "2 4",
56
+ "8 3 2 3"
57
+ ];
58
+ /**
59
+ * Colour, marker shape and dash of the series at `index`. The first six get a hue each, in a fixed
60
+ * order, never cycled. Further series share the muted colour and are told apart by shape and dash.
61
+ */
62
+ function seriesStyle(index) {
63
+ if (index === "brand") return {
64
+ ...brand,
65
+ shape: "circle"
66
+ };
67
+ const shape = shapes[index % shapes.length] ?? "circle";
68
+ const colour = palette[index];
69
+ if (colour) return {
70
+ ...colour,
71
+ shape
72
+ };
73
+ return {
74
+ ...overflow,
75
+ shape,
76
+ dash: dashes[(index - palette.length) % dashes.length]
77
+ };
78
+ }
79
+ function isNumber(value) {
80
+ return typeof value === "number";
81
+ }
82
+ /** Every value that is present, across all series. */
83
+ function knownValues(series) {
84
+ return series.flatMap((s) => s.values.filter(isNumber));
85
+ }
86
+ /** The colour of each series: the brand colour, its own `colorIndex`, or its position. */
87
+ function seriesColors(series) {
88
+ return series.map((s, index) => s.tone === "brand" ? "brand" : s.colorIndex ?? index);
89
+ }
90
+ /** Legend entries for the series, in the colours the plot uses. */
91
+ function legendItems(series) {
92
+ const colors = seriesColors(series);
93
+ return series.map((s, index) => ({
94
+ id: s.id,
95
+ label: s.label,
96
+ index: colors[index]
97
+ }));
98
+ }
99
+ /** Table cells for one x position or category: the formatted value of each series, or empty. */
100
+ function seriesCells(series, position, format) {
101
+ return series.map((s) => {
102
+ const value = s.values[position];
103
+ return isNumber(value) ? format(value) : "";
104
+ });
105
+ }
106
+ export { isNumber, knownValues, legendItems, seriesCells, seriesColors, seriesStyle };
107
+
108
+ //# sourceMappingURL=series.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"series.js","names":[],"sources":["../../../../src/components/organisms/Chart/series.ts"],"sourcesContent":["import type { MarkerShape } from './geometry';\nimport type { ChartSeries } from './types';\n\n/** A palette position, or the project colour. */\nexport type SeriesColor = number | 'brand';\n\nexport interface SeriesStyle {\n stroke: string;\n fill: string;\n swatch: string;\n shape: MarkerShape;\n /** SVG dash pattern. Only the colourless overflow series are dashed. */\n dash?: string;\n}\n\nconst shapes: MarkerShape[] = [\n 'circle',\n 'square',\n 'diamond',\n 'triangle',\n 'triangle-down',\n 'hexagon',\n];\n\nconst palette = [\n { stroke: 'stroke-chart-1', fill: 'fill-chart-1', swatch: 'bg-chart-1' },\n { stroke: 'stroke-chart-2', fill: 'fill-chart-2', swatch: 'bg-chart-2' },\n { stroke: 'stroke-chart-3', fill: 'fill-chart-3', swatch: 'bg-chart-3' },\n { stroke: 'stroke-chart-4', fill: 'fill-chart-4', swatch: 'bg-chart-4' },\n { stroke: 'stroke-chart-5', fill: 'fill-chart-5', swatch: 'bg-chart-5' },\n { stroke: 'stroke-chart-6', fill: 'fill-chart-6', swatch: 'bg-chart-6' },\n];\n\nconst brand = {\n stroke: 'stroke-(--ui-bg-brand-solid)',\n fill: 'fill-(--ui-bg-brand-solid)',\n swatch: 'bg-brand-solid',\n};\n\nconst overflow = {\n stroke: 'stroke-chart-muted',\n fill: 'fill-chart-muted',\n swatch: 'bg-chart-muted',\n};\nconst dashes = ['6 4', '2 4', '8 3 2 3'];\n\n/**\n * Colour, marker shape and dash of the series at `index`. The first six get a hue each, in a fixed\n * order, never cycled. Further series share the muted colour and are told apart by shape and dash.\n */\nexport function seriesStyle(index: SeriesColor): SeriesStyle {\n if (index === 'brand') return { ...brand, shape: 'circle' };\n const shape = shapes[index % shapes.length] ?? 'circle';\n const colour = palette[index];\n if (colour) return { ...colour, shape };\n return { ...overflow, shape, dash: dashes[(index - palette.length) % dashes.length] };\n}\n\nexport function isNumber(value: number | null | undefined): value is number {\n return typeof value === 'number';\n}\n\n/** Every value that is present, across all series. */\nexport function knownValues(series: ChartSeries[]): number[] {\n return series.flatMap((s) => s.values.filter(isNumber));\n}\n\n/** The colour of each series: the brand colour, its own `colorIndex`, or its position. */\nexport function seriesColors(series: ChartSeries[]): SeriesColor[] {\n return series.map((s, index) => (s.tone === 'brand' ? 'brand' : (s.colorIndex ?? index)));\n}\n\n/** Legend entries for the series, in the colours the plot uses. */\nexport function legendItems(series: ChartSeries[]) {\n const colors = seriesColors(series);\n return series.map((s, index) => ({ id: s.id, label: s.label, index: colors[index] }));\n}\n\n/** Table cells for one x position or category: the formatted value of each series, or empty. */\nexport function seriesCells(\n series: ChartSeries[],\n position: number,\n format: (value: number) => string,\n): string[] {\n return series.map((s) => {\n const value = s.values[position];\n return isNumber(value) ? format(value) : '';\n });\n}\n"],"mappings":";;AAeA,IAAM,SAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,UAAU;CACd;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;CACvE;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;CACvE;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;CACvE;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;CACv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/organisms/Chart/summary.ts
3
3
  var maxDescribed = 3;
4
- function indexOfValue(values, target) {
5
- return values.findIndex((value) => value === target);
6
- }
7
4
  /** One sentence about a series: where it starts and ends, and its lowest and highest points. */
8
5
  function describeSeries(series, positions, format) {
9
6
  const known = series.values.flatMap((value, index) => value === null ? [] : [{
@@ -18,7 +15,7 @@ function describeSeries(series, positions, format) {
18
15
  const low = Math.min(...numbers);
19
16
  const high = Math.max(...numbers);
20
17
  if (low === high) return `${series.label}: ${format(low)} throughout.`;
21
- const at = (value) => positions[indexOfValue(series.values, value)] ?? "";
18
+ const at = (value) => positions[series.values.indexOf(value)] ?? "";
22
19
  return `${series.label}: from ${format(first.value)} to ${format(last.value)}, lowest ${format(low)} at ${at(low)}, highest ${format(high)} at ${at(high)}.`;
23
20
  }
24
21
  /** Describes the first few series in full and counts the rest. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.js","names":[],"sources":["../../../../src/components/organisms/Chart/summary.ts"],"sourcesContent":["import type { ChartSeries } from './types';\n\nconst maxDescribed = 3;\n\n/** One sentence about a series: where it starts and ends, and its lowest and highest points. */\nexport function describeSeries(\n series: ChartSeries,\n positions: string[],\n format: (value: number) => string,\n): string {\n const known = series.values.flatMap((value, index) => (value === null ? [] : [{ value, index }]));\n const first = known[0];\n const last = known[known.length - 1];\n if (!first || !last) return `${series.label}: no values.`;\n if (known.length === 1)\n return `${series.label}: ${format(first.value)} at ${positions[first.index]}.`;\n const numbers = known.map((point) => point.value);\n const low = Math.min(...numbers);\n const high = Math.max(...numbers);\n if (low === high) return `${series.label}: ${format(low)} throughout.`;\n const at = (value: number) => positions[series.values.indexOf(value)] ?? '';\n return `${series.label}: from ${format(first.value)} to ${format(last.value)}, lowest ${format(low)} at ${at(low)}, highest ${format(high)} at ${at(high)}.`;\n}\n\n/** Describes the first few series in full and counts the rest. */\nexport function describeAll(\n headline: string,\n series: ChartSeries[],\n positions: string[],\n format: (value: number) => string,\n): string {\n const described = series.slice(0, maxDescribed).map((s) => describeSeries(s, positions, format));\n const rest = series.length - described.length;\n if (rest > 0)\n described.push(`${rest} more ${rest === 1 ? 'series is' : 'series are'} in the table.`);\n return [headline, ...described].join(' ');\n}\n\nexport function plural(count: number, one: string, many: string): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** One sentence per series about its highest and lowest category, for the first few series. */\nexport function describeBars(\n headline: string,\n categories: string[],\n series: ChartSeries[],\n format: (value: number) => string,\n): string {\n const described = series.slice(0, maxDescribed).map((s) => {\n const known = s.values.flatMap((value, index) => (value === null ? [] : [{ value, index }]));\n const sorted = known.toSorted((a, b) => b.value - a.value);\n const top = sorted[0];\n const bottom = sorted[sorted.length - 1];\n if (!top || !bottom) return `${s.label}: no values.`;\n const name = (point: { index: number }) => categories[point.index] ?? '';\n if (known.length === 1) return `${s.label}: ${format(top.value)} for ${name(top)}.`;\n if (top.value === bottom.value) return `${s.label}: ${format(top.value)} for every category.`;\n return `${s.label}: highest ${name(top)} at ${format(top.value)}, lowest ${name(bottom)} at ${format(bottom.value)}.`;\n });\n const rest = series.length - described.length;\n if (rest > 0)\n described.push(`${rest} more ${rest === 1 ? 'series is' : 'series are'} in the table.`);\n return [headline, ...described].join(' ');\n}\n"],"mappings":";;AAEA,IAAM,eAAe;;AAGrB,SAAgB,eACd,QACA,WACA,QACQ;CACR,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,UAAW,UAAU,OAAO,CAAC,IAAI,CAAC;EAAE;EAAO;CAAM,CAAC,CAAE;CAChG,MAAM,QAAQ,MAAM;CACpB,MAAM,OAAO,MAAM,MAAM,SAAS;CAClC,IAAI,CAAC,SAAS,CAAC,MAAM,OAAO,GAAG,OAAO,MAAM;CAC5C,IAAI,MAAM,WAAW,GACnB,OAAO,GAAG,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,EAAE,MAAM,UAAU,MAAM,OAAO;CAC9E,MAAM,UAAU,MAAM,KAAK,UAAU,MAAM,KAAK;CAChD,MAAM,MAAM,KAAK,I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A6B,WAAW,MAAM,UAAU;EACtE,IAAI,MAAM,WAAW,GAAG,OAAO,GAAG,EAAE,MAAM,IAAI,OAAO,IAAI,KAAK,EAAE,OAAO,KAAK,GAAG,EAAE;EACjF,IAAI,IAAI,UAAU,OAAO,OAAO,OAAO,GAAG,EAAE,MAAM,IAAI,OAAO,IAAI,KAAK,EAAE;EACxE,OAAO,GAAG,EAAE,MAAM,YAAY,KAAK,GAAG,EAAE,MAAM,OAAO,IAAI,KAAK,EAAE,WAAW,KAAK,MAAM,EAAE,MAAM,OAAO,OAAO,KAAK,EAAE;CACrH,CAAC;CACD,MAAM,OAAO,OAAO,SAAS,UAAU;CACvC,IAAI,OAAO,GACT,UAAU,KAAK,GAAG,KAAK,QAAQ,SAAS,IAAI,cAAc,aAAa,eAAe;CACxF,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,KAAK,GAAG;AAC1C"}
@@ -10,6 +10,8 @@ export interface ChartSeries {
10
10
  * array. Set it when a filter removes series, so the ones that remain keep their colour.
11
11
  */
12
12
  colorIndex?: number;
13
+ /** `brand` draws the series in the project colour instead of a categorical one. */
14
+ tone?: 'brand';
13
15
  }
14
16
  export type XValue = Date | number | string;
15
17
  export interface ChartLabels {
@@ -44,7 +46,5 @@ export interface ChartBaseProps {
44
46
  labels?: Partial<ChartLabels>;
45
47
  /** Height of the whole chart in pixels, including the axes. The plot is shorter by the margins. */
46
48
  height?: number;
47
- /** Draws the chart on a bordered card surface. */
48
- isCard?: boolean;
49
49
  className?: string;
50
50
  }
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useEffect, useRef, useState } from "react";
3
- // src/components/Chart/useElementWidth.ts
3
+ // src/components/organisms/Chart/useElementWidth.ts
4
4
  /**
5
5
  * The width of an element, kept current with a ResizeObserver. Starts at `fallback`, which is
6
6
  * also what the server renders, then settles on the real width after mount.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementWidth.js","names":[],"sources":["../../../../src/components/organisms/Chart/useElementWidth.ts"],"sourcesContent":["import { useEffect, useRef, useState, type RefObject } from 'react';\n\n/**\n * The width of an element, kept current with a ResizeObserver. Starts at `fallback`, which is\n * also what the server renders, then settles on the real width after mount.\n */\nexport function useElementWidth<T extends HTMLElement>(\n fallback: number,\n): [RefObject<T | null>, number] {\n const ref = useRef<T | null>(null);\n const [width, setWidth] = useState(fallback);\n\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const observer = new ResizeObserver(([entry]) => {\n const next = Math.round(entry?.contentRect.width ?? 0);\n if (next > 0) setWidth(next);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n return [ref, width];\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,gBACd,UAC+B;CAC/B,MAAM,MAAM,OAAiB,IAAI;CACjC,MAAM,CAAC,OAAO,YAAY,SAAS,QAAQ;CAE3C,gBAAgB;EACd,MAAM,UAAU,IAAI;EACpB,IAAI,CAAC,SAAS;EACd,MAAM,WAAW,IAAI,gBAAgB,CAAC,WAAW;GAC/C,MAAM,OAAO,KAAK,MAAM,OAAO,YAAY,SAAS,CAAC;GACrD,IAAI,OAAO,GAAG,SAAS,IAAI;EAC7B,CAAC;EACD,SAAS,QAAQ,OAAO;EACxB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CAEL,OAAO,CAAC,KAAK,KAAK;AACpB"}
@@ -1,6 +1,5 @@
1
1
  import { type Dispatch, type ReactNode, type SetStateAction } from 'react';
2
2
  import type { Key, MenuItemProps, MenuSectionProps } from 'react-aria-components';
3
- import type { IconComponent } from '../../internal/types';
4
3
  export interface CommandPalettePage {
5
4
  /** Identifies the page. The search text resets when it changes. */
6
5
  id: string;
@@ -10,14 +9,14 @@ export interface CommandPalettePage {
10
9
  export interface CommandPaletteProps {
11
10
  isOpen: boolean;
12
11
  onOpenChange: (isOpen: boolean) => void;
13
- /** Called with the id of the chosen command. The palette closes afterwards unless `closeOnAction` is false. */
12
+ /** Called with the id of the chosen command. The palette closes afterwards unless `shouldCloseOnAction` is false. */
14
13
  onAction?: (key: Key) => void;
15
14
  /**
16
15
  * Whether choosing a command closes the palette. Set it to false when some
17
16
  * commands open a sub page: keep the page in your state, render its commands
18
17
  * as `children`, and call `onOpenChange(false)` yourself after a final command.
19
18
  */
20
- closeOnAction?: boolean;
19
+ shouldCloseOnAction?: boolean;
21
20
  /** Called with the search text as the user types. */
22
21
  onSearchChange?: (value: string) => void;
23
22
  /**
@@ -31,7 +30,7 @@ export interface CommandPaletteProps {
31
30
  /** Accessible name of the back button. */
32
31
  backLabel?: string;
33
32
  /** Accessible name of the dialog. */
34
- label?: string;
33
+ 'aria-label'?: string;
35
34
  /** Accessible name and placeholder of the search field. */
36
35
  searchLabel?: string;
37
36
  placeholder?: string;
@@ -47,8 +46,8 @@ export interface CommandGroupProps extends Omit<MenuSectionProps<object>, 'child
47
46
  }
48
47
  export interface CommandItemProps extends Omit<MenuItemProps, 'children'> {
49
48
  children: ReactNode;
50
- /** A lucide-react style component, or an element such as `<Inbox />`. */
51
- icon?: IconComponent | ReactNode;
49
+ /** An icon element such as `<Inbox />`. */
50
+ icon?: ReactNode;
52
51
  /** Secondary line. It joins the accessible name after the label, so the name contains the visible text. */
53
52
  description?: ReactNode;
54
53
  /** Keys of the shortcut that runs this command outside the palette, such as ['⌘', 'N']. */
@@ -65,8 +64,8 @@ export interface CommandItemProps extends Omit<MenuItemProps, 'children'> {
65
64
  * or Ctrl with useCommandPaletteShortcut starts the download ahead of the K.
66
65
  */
67
66
  export declare function CommandPalette(props: CommandPaletteProps): import("react").JSX.Element | null;
68
- export declare function CommandGroup(props: CommandGroupProps): import("react").JSX.Element | null;
69
- export declare function CommandItem(props: CommandItemProps): import("react").JSX.Element | null;
67
+ export declare const CommandGroup: typeof import("./CommandPaletteOverlay").CommandGroup;
68
+ export declare const CommandItem: typeof import("./CommandPaletteOverlay").CommandItem;
70
69
  /**
71
70
  * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state
72
71
  * setter of `isOpen`. `key` changes the letter.
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { createLazyModule } from "../../internal/lazyModule.js";
2
+ import { createLazyModule, lazyPart } from "../../../internal/lazyModule.js";
3
3
  import { useEffect } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- // src/components/CommandPalette/CommandPalette.tsx
5
+ // src/components/organisms/CommandPalette/CommandPalette.tsx
6
6
  var palette = /*#__PURE__*/ createLazyModule(() => import("./CommandPaletteOverlay.js"));
7
7
  /**
8
8
  * A searchable list of commands in a modal, opened with Cmd or Ctrl and K
@@ -18,14 +18,8 @@ function CommandPalette(props) {
18
18
  const loaded = palette.useModule(props.isOpen);
19
19
  return loaded ? /* @__PURE__ */ jsx(loaded.CommandPalette, { ...props }) : null;
20
20
  }
21
- function CommandGroup(props) {
22
- const loaded = palette.get();
23
- return loaded ? /* @__PURE__ */ jsx(loaded.CommandGroup, { ...props }) : null;
24
- }
25
- function CommandItem(props) {
26
- const loaded = palette.get();
27
- return loaded ? /* @__PURE__ */ jsx(loaded.CommandItem, { ...props }) : null;
28
- }
21
+ var CommandGroup = lazyPart(palette, "CommandGroup");
22
+ var CommandItem = lazyPart(palette, "CommandItem");
29
23
  /**
30
24
  * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state
31
25
  * setter of `isOpen`. `key` changes the letter.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandPalette.js","names":[],"sources":["../../../../src/components/organisms/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import { useEffect, type Dispatch, type ReactNode, type SetStateAction } from 'react';\nimport type { Key, MenuItemProps, MenuSectionProps } from 'react-aria-components';\nimport { createLazyModule, lazyPart } from '../../../internal/lazyModule';\n\nexport interface CommandPalettePage {\n /** Identifies the page. The search text resets when it changes. */\n id: string;\n /** Shown before the search field and announced when the page opens, such as \"Change status\". */\n title: string;\n}\n\nexport interface CommandPaletteProps {\n isOpen: boolean;\n onOpenChange: (isOpen: boolean) => void;\n /** Called with the id of the chosen command. The palette closes afterwards unless `shouldCloseOnAction` is false. */\n onAction?: (key: Key) => void;\n /**\n * Whether choosing a command closes the palette. Set it to false when some\n * commands open a sub page: keep the page in your state, render its commands\n * as `children`, and call `onOpenChange(false)` yourself after a final command.\n */\n shouldCloseOnAction?: boolean;\n /** Called with the search text as the user types. */\n onSearchChange?: (value: string) => void;\n /**\n * The sub page being shown, or nothing for the top level. While it is set the\n * palette shows its title and a back button, and Backspace in an empty\n * search field calls `onBack`.\n */\n page?: CommandPalettePage;\n /** Go up one level: Backspace in an empty search field, or the back button. */\n onBack?: () => void;\n /** Accessible name of the back button. */\n backLabel?: string;\n /** Accessible name of the dialog. */\n 'aria-label'?: string;\n /** Accessible name and placeholder of the search field. */\n searchLabel?: string;\n placeholder?: string;\n /** Shown when nothing matches the search. */\n emptyState?: ReactNode;\n /** CommandGroup and CommandItem elements. */\n children: ReactNode;\n}\n\nexport interface CommandGroupProps extends Omit<MenuSectionProps<object>, 'children'> {\n /** Visible heading, also the group's accessible name. */\n heading: ReactNode;\n children: ReactNode;\n}\n\nexport interface CommandItemProps extends Omit<MenuItemProps, 'children'> {\n children: ReactNode;\n /** An icon element such as `<Inbox />`. */\n icon?: ReactNode;\n /** Secondary line. It joins the accessible name after the label, so the name contains the visible text. */\n description?: ReactNode;\n /** Keys of the shortcut that runs this command outside the palette, such as ['⌘', 'N']. */\n shortcut?: string[];\n}\n\nconst palette = /*#__PURE__*/ createLazyModule(() => import('./CommandPaletteOverlay'));\n\n/**\n * A searchable list of commands in a modal, opened with Cmd or Ctrl and K\n * through useCommandPaletteShortcut. Focus starts in the search field, typing\n * filters every group, arrow keys move through matches, Enter runs a command\n * and closes the palette, and Escape closes it. Focus then returns to where it\n * was before opening.\n *\n * The palette's code loads the first time `isOpen` becomes true. Pressing Cmd\n * or Ctrl with useCommandPaletteShortcut starts the download ahead of the K.\n */\nexport function CommandPalette(props: CommandPaletteProps) {\n const loaded = palette.useModule(props.isOpen);\n return loaded ? <loaded.CommandPalette {...props} /> : null;\n}\n\nexport const CommandGroup = lazyPart(palette, 'CommandGroup');\n\nexport const CommandItem = lazyPart(palette, 'CommandItem');\n\n/**\n * Toggles the palette with Cmd+K on macOS or Ctrl+K elsewhere. Pass the state\n * setter of `isOpen`. `key` changes the letter.\n */\nexport function useCommandPaletteShortcut(setOpen: Dispatch<SetStateAction<boolean>>, key = 'k') {\n useEffect(() => {\n function toggle(open: boolean) {\n return !open;\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (!(event.metaKey || event.ctrlKey)) return;\n palette.preload();\n if (event.key.toLowerCase() !== key.toLowerCase()) return;\n event.preventDefault();\n setOpen(toggle);\n }\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [setOpen, key]);\n}\n"],"mappings":";;;;;AA6DA,IAAM,UAAwB,qCAAuB,OAAO,6BAA0B;;;;;;;;;;;AAYtF,SAAgB,eAAe,OAA4B;CACzD,MAAM,SAAS,QAAQ,UAAU,MAAM,MAAM;CAC7C,OAAO,SAAS,oBAAC,OAAO,gBAAR,EAAuB,GAAI,MAAQ,CAAA,IAAI;AACzD;AAEA,IAAa,eAAe,SAAS,SAAS,cAAc;AAE5D,IAAa,cAAc,SAAS,SAAS,aAAa;;;;;AAM1D,SAAgB,0BAA0B,SAA4C,MAAM,KAAK;CAC/F,gBAAgB;EACd,SAAS,OAAO,MAAe;GAC7B,OAAO,CAAC;EACV;EAEA,SAAS,cAAc,OAAsB;GAC3C,IAAI,EAAE,MAAM,WAAW,MAAM,UAAU;GACvC,QAAQ,QAAQ;GAChB,IAAI,MAAM,IAAI,YAAY,MAAM,IAAI,YAAY,GAAG;GACnD,MAAM,eAAe;GACrB,QAAQ,MAAM;EAChB;EAEA,OAAO,iBAAiB,WAAW,aAAa;EAChD,aAAa,OAAO,oBAAoB,WAAW,aAAa;CAClE,GAAG,CAAC,SAAS,GAAG,CAAC;AACnB"}
@@ -0,0 +1,4 @@
1
+ import type { CommandGroupProps, CommandItemProps, CommandPaletteProps } from './CommandPalette';
2
+ export declare function CommandPalette({ isOpen, onOpenChange, onAction, shouldCloseOnAction, onSearchChange, page, onBack, backLabel, 'aria-label': ariaLabel, searchLabel, placeholder, emptyState, children, }: CommandPaletteProps): import("react").JSX.Element;
3
+ export declare function CommandGroup({ heading, children, className, ...props }: CommandGroupProps): import("react").JSX.Element;
4
+ export declare function CommandItem({ children, icon, description, shortcut, className, ...props }: CommandItemProps): import("react").JSX.Element;