@eylulg/ui 0.0.0-stage → 1.0.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 (367) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -2
  3. package/dist/chrome/Anchor.d.ts +3 -0
  4. package/dist/chrome/Anchor.js +14 -0
  5. package/dist/chrome/Anchor.js.map +1 -0
  6. package/dist/chrome/AppShell.d.ts +28 -0
  7. package/dist/chrome/AppShell.js +57 -0
  8. package/dist/chrome/AppShell.js.map +1 -0
  9. package/dist/chrome/BrandLogo.d.ts +13 -0
  10. package/dist/chrome/BrandLogo.js +33 -0
  11. package/dist/chrome/BrandLogo.js.map +1 -0
  12. package/dist/chrome/BrandMark.d.ts +12 -0
  13. package/dist/chrome/BrandMark.js +40 -0
  14. package/dist/chrome/BrandMark.js.map +1 -0
  15. package/dist/chrome/LinkRouter.d.ts +19 -0
  16. package/dist/chrome/LinkRouter.js +28 -0
  17. package/dist/chrome/LinkRouter.js.map +1 -0
  18. package/dist/chrome/MobileMenu.d.ts +19 -0
  19. package/dist/chrome/MobileMenu.js +52 -0
  20. package/dist/chrome/MobileMenu.js.map +1 -0
  21. package/dist/chrome/ProjectSwitcher.d.ts +30 -0
  22. package/dist/chrome/ProjectSwitcher.js +64 -0
  23. package/dist/chrome/ProjectSwitcher.js.map +1 -0
  24. package/dist/chrome/ProjectSwitcherMenu.d.ts +13 -0
  25. package/dist/chrome/ProjectSwitcherMenu.js +50 -0
  26. package/dist/chrome/ProjectSwitcherMenu.js.map +1 -0
  27. package/dist/chrome/SidebarNav.d.ts +34 -0
  28. package/dist/chrome/SidebarNav.js +106 -0
  29. package/dist/chrome/SidebarNav.js.map +1 -0
  30. package/dist/chrome/SiteFooter.d.ts +31 -0
  31. package/dist/chrome/SiteFooter.js +85 -0
  32. package/dist/chrome/SiteFooter.js.map +1 -0
  33. package/dist/chrome/TextSizeToggle.d.ts +11 -0
  34. package/dist/chrome/TextSizeToggle.js +38 -0
  35. package/dist/chrome/TextSizeToggle.js.map +1 -0
  36. package/dist/chrome/ThemeToggle.d.ts +26 -0
  37. package/dist/chrome/ThemeToggle.js +100 -0
  38. package/dist/chrome/ThemeToggle.js.map +1 -0
  39. package/dist/chrome/ThemeToggleMenu.d.ts +16 -0
  40. package/dist/chrome/ThemeToggleMenu.js +42 -0
  41. package/dist/chrome/ThemeToggleMenu.js.map +1 -0
  42. package/dist/chrome/TopNav.d.ts +42 -0
  43. package/dist/chrome/TopNav.js +117 -0
  44. package/dist/chrome/TopNav.js.map +1 -0
  45. package/dist/chrome/brandLogoPath.d.ts +2 -0
  46. package/dist/chrome/brandLogoPath.js +7 -0
  47. package/dist/chrome/brandLogoPath.js.map +1 -0
  48. package/dist/chrome/index.d.ts +28 -0
  49. package/dist/chrome/index.js +15 -0
  50. package/dist/chrome/projects.d.ts +28 -0
  51. package/dist/chrome/projects.js +107 -0
  52. package/dist/chrome/projects.js.map +1 -0
  53. package/dist/chrome/themeChoices.d.ts +6 -0
  54. package/dist/chrome/themeChoices.js +18 -0
  55. package/dist/chrome/themeChoices.js.map +1 -0
  56. package/dist/chrome/themeScript.d.ts +16 -0
  57. package/dist/chrome/themeScript.js +20 -0
  58. package/dist/chrome/themeScript.js.map +1 -0
  59. package/dist/chrome/types.d.ts +17 -0
  60. package/dist/chrome/useTextSize.d.ts +16 -0
  61. package/dist/chrome/useTextSize.js +64 -0
  62. package/dist/chrome/useTextSize.js.map +1 -0
  63. package/dist/chrome/useTheme.d.ts +19 -0
  64. package/dist/chrome/useTheme.js +86 -0
  65. package/dist/chrome/useTheme.js.map +1 -0
  66. package/dist/components/Avatar/Avatar.d.ts +39 -0
  67. package/dist/components/Avatar/Avatar.js +122 -0
  68. package/dist/components/Avatar/Avatar.js.map +1 -0
  69. package/dist/components/Avatar/index.d.ts +2 -0
  70. package/dist/components/Avatar/index.js +2 -0
  71. package/dist/components/Badge/Badge.d.ts +19 -0
  72. package/dist/components/Badge/Badge.js +77 -0
  73. package/dist/components/Badge/Badge.js.map +1 -0
  74. package/dist/components/Badge/index.d.ts +2 -0
  75. package/dist/components/Badge/index.js +2 -0
  76. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +18 -0
  77. package/dist/components/Breadcrumbs/Breadcrumbs.js +40 -0
  78. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
  79. package/dist/components/Breadcrumbs/index.d.ts +2 -0
  80. package/dist/components/Breadcrumbs/index.js +2 -0
  81. package/dist/components/Button/Button.d.ts +39 -0
  82. package/dist/components/Button/Button.js +73 -0
  83. package/dist/components/Button/Button.js.map +1 -0
  84. package/dist/components/Button/buttonStyles.d.ts +21 -0
  85. package/dist/components/Button/buttonStyles.js +32 -0
  86. package/dist/components/Button/buttonStyles.js.map +1 -0
  87. package/dist/components/Button/index.d.ts +2 -0
  88. package/dist/components/Button/index.js +4 -0
  89. package/dist/components/Card/Card.d.ts +47 -0
  90. package/dist/components/Card/Card.js +119 -0
  91. package/dist/components/Card/Card.js.map +1 -0
  92. package/dist/components/Card/index.d.ts +2 -0
  93. package/dist/components/Card/index.js +2 -0
  94. package/dist/components/Chart/BarChart.d.ts +24 -0
  95. package/dist/components/Chart/BarChart.js +327 -0
  96. package/dist/components/Chart/BarChart.js.map +1 -0
  97. package/dist/components/Chart/ChartFrame.d.ts +27 -0
  98. package/dist/components/Chart/ChartFrame.js +80 -0
  99. package/dist/components/Chart/ChartFrame.js.map +1 -0
  100. package/dist/components/Chart/ChartLegend.d.ts +28 -0
  101. package/dist/components/Chart/ChartLegend.js +53 -0
  102. package/dist/components/Chart/ChartLegend.js.map +1 -0
  103. package/dist/components/Chart/ChartTable.d.ts +11 -0
  104. package/dist/components/Chart/ChartTable.js +48 -0
  105. package/dist/components/Chart/ChartTable.js.map +1 -0
  106. package/dist/components/Chart/ChartTooltip.d.ts +33 -0
  107. package/dist/components/Chart/ChartTooltip.js +56 -0
  108. package/dist/components/Chart/ChartTooltip.js.map +1 -0
  109. package/dist/components/Chart/HeatGrid.d.ts +50 -0
  110. package/dist/components/Chart/HeatGrid.js +256 -0
  111. package/dist/components/Chart/HeatGrid.js.map +1 -0
  112. package/dist/components/Chart/LineChart.d.ts +23 -0
  113. package/dist/components/Chart/LineChart.js +248 -0
  114. package/dist/components/Chart/LineChart.js.map +1 -0
  115. package/dist/components/Chart/format.d.ts +24 -0
  116. package/dist/components/Chart/format.js +134 -0
  117. package/dist/components/Chart/format.js.map +1 -0
  118. package/dist/components/Chart/geometry.d.ts +11 -0
  119. package/dist/components/Chart/geometry.js +69 -0
  120. package/dist/components/Chart/geometry.js.map +1 -0
  121. package/dist/components/Chart/index.d.ts +9 -0
  122. package/dist/components/Chart/index.js +6 -0
  123. package/dist/components/Chart/interaction.d.ts +43 -0
  124. package/dist/components/Chart/interaction.js +106 -0
  125. package/dist/components/Chart/interaction.js.map +1 -0
  126. package/dist/components/Chart/labels.d.ts +3 -0
  127. package/dist/components/Chart/labels.js +23 -0
  128. package/dist/components/Chart/labels.js.map +1 -0
  129. package/dist/components/Chart/scale.d.ts +15 -0
  130. package/dist/components/Chart/scale.js +54 -0
  131. package/dist/components/Chart/scale.js.map +1 -0
  132. package/dist/components/Chart/series.d.ts +14 -0
  133. package/dist/components/Chart/series.js +72 -0
  134. package/dist/components/Chart/series.js.map +1 -0
  135. package/dist/components/Chart/summary.d.ts +8 -0
  136. package/dist/components/Chart/summary.js +56 -0
  137. package/dist/components/Chart/summary.js.map +1 -0
  138. package/dist/components/Chart/types.d.ts +50 -0
  139. package/dist/components/Chart/useElementWidth.d.ts +6 -0
  140. package/dist/components/Chart/useElementWidth.js +25 -0
  141. package/dist/components/Chart/useElementWidth.js.map +1 -0
  142. package/dist/components/Checkbox/Checkbox.d.ts +9 -0
  143. package/dist/components/Checkbox/Checkbox.js +36 -0
  144. package/dist/components/Checkbox/Checkbox.js.map +1 -0
  145. package/dist/components/Checkbox/index.d.ts +2 -0
  146. package/dist/components/Checkbox/index.js +2 -0
  147. package/dist/components/CodeBlock/CodeBlock.d.ts +22 -0
  148. package/dist/components/CodeBlock/CodeBlock.js +56 -0
  149. package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
  150. package/dist/components/CodeBlock/index.d.ts +2 -0
  151. package/dist/components/CodeBlock/index.js +2 -0
  152. package/dist/components/Combobox/Combobox.d.ts +34 -0
  153. package/dist/components/Combobox/Combobox.js +106 -0
  154. package/dist/components/Combobox/Combobox.js.map +1 -0
  155. package/dist/components/Combobox/index.d.ts +2 -0
  156. package/dist/components/Combobox/index.js +2 -0
  157. package/dist/components/CommandPalette/CommandPalette.d.ts +74 -0
  158. package/dist/components/CommandPalette/CommandPalette.js +51 -0
  159. package/dist/components/CommandPalette/CommandPalette.js.map +1 -0
  160. package/dist/components/CommandPalette/CommandPaletteOverlay.d.ts +11 -0
  161. package/dist/components/CommandPalette/CommandPaletteOverlay.js +180 -0
  162. package/dist/components/CommandPalette/CommandPaletteOverlay.js.map +1 -0
  163. package/dist/components/CommandPalette/index.d.ts +2 -0
  164. package/dist/components/CommandPalette/index.js +2 -0
  165. package/dist/components/DatePicker/DatePicker.d.ts +25 -0
  166. package/dist/components/DatePicker/DatePicker.js +142 -0
  167. package/dist/components/DatePicker/DatePicker.js.map +1 -0
  168. package/dist/components/DatePicker/index.d.ts +2 -0
  169. package/dist/components/DatePicker/index.js +2 -0
  170. package/dist/components/Dialog/Dialog.d.ts +37 -0
  171. package/dist/components/Dialog/Dialog.js +33 -0
  172. package/dist/components/Dialog/Dialog.js.map +1 -0
  173. package/dist/components/Dialog/DialogOverlay.d.ts +3 -0
  174. package/dist/components/Dialog/DialogOverlay.js +72 -0
  175. package/dist/components/Dialog/DialogOverlay.js.map +1 -0
  176. package/dist/components/Dialog/index.d.ts +2 -0
  177. package/dist/components/Dialog/index.js +2 -0
  178. package/dist/components/Drawer/Drawer.d.ts +36 -0
  179. package/dist/components/Drawer/Drawer.js +33 -0
  180. package/dist/components/Drawer/Drawer.js.map +1 -0
  181. package/dist/components/Drawer/DrawerOverlay.d.ts +3 -0
  182. package/dist/components/Drawer/DrawerOverlay.js +71 -0
  183. package/dist/components/Drawer/DrawerOverlay.js.map +1 -0
  184. package/dist/components/Drawer/index.d.ts +2 -0
  185. package/dist/components/Drawer/index.js +2 -0
  186. package/dist/components/DropdownMenu/DropdownMenu.d.ts +49 -0
  187. package/dist/components/DropdownMenu/DropdownMenu.js +52 -0
  188. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
  189. package/dist/components/DropdownMenu/DropdownMenuParts.d.ts +6 -0
  190. package/dist/components/DropdownMenu/DropdownMenuParts.js +76 -0
  191. package/dist/components/DropdownMenu/DropdownMenuParts.js.map +1 -0
  192. package/dist/components/DropdownMenu/index.d.ts +2 -0
  193. package/dist/components/DropdownMenu/index.js +2 -0
  194. package/dist/components/EmptyState/EmptyState.d.ts +19 -0
  195. package/dist/components/EmptyState/EmptyState.js +51 -0
  196. package/dist/components/EmptyState/EmptyState.js.map +1 -0
  197. package/dist/components/EmptyState/index.d.ts +2 -0
  198. package/dist/components/EmptyState/index.js +2 -0
  199. package/dist/components/FileDropZone/FileDropZone.d.ts +41 -0
  200. package/dist/components/FileDropZone/FileDropZone.js +94 -0
  201. package/dist/components/FileDropZone/FileDropZone.js.map +1 -0
  202. package/dist/components/FileDropZone/index.d.ts +2 -0
  203. package/dist/components/FileDropZone/index.js +2 -0
  204. package/dist/components/IconButton/IconButton.d.ts +17 -0
  205. package/dist/components/IconButton/IconButton.js +37 -0
  206. package/dist/components/IconButton/IconButton.js.map +1 -0
  207. package/dist/components/IconButton/index.d.ts +2 -0
  208. package/dist/components/IconButton/index.js +2 -0
  209. package/dist/components/Input/Input.d.ts +21 -0
  210. package/dist/components/Input/Input.js +43 -0
  211. package/dist/components/Input/Input.js.map +1 -0
  212. package/dist/components/Input/index.d.ts +2 -0
  213. package/dist/components/Input/index.js +2 -0
  214. package/dist/components/Kbd/Kbd.d.ts +16 -0
  215. package/dist/components/Kbd/Kbd.js +35 -0
  216. package/dist/components/Kbd/Kbd.js.map +1 -0
  217. package/dist/components/Kbd/index.d.ts +2 -0
  218. package/dist/components/Kbd/index.js +2 -0
  219. package/dist/components/PageHeader/PageHeader.d.ts +18 -0
  220. package/dist/components/PageHeader/PageHeader.js +45 -0
  221. package/dist/components/PageHeader/PageHeader.js.map +1 -0
  222. package/dist/components/PageHeader/index.d.ts +2 -0
  223. package/dist/components/PageHeader/index.js +2 -0
  224. package/dist/components/Pagination/Pagination.d.ts +32 -0
  225. package/dist/components/Pagination/Pagination.js +124 -0
  226. package/dist/components/Pagination/Pagination.js.map +1 -0
  227. package/dist/components/Pagination/index.d.ts +2 -0
  228. package/dist/components/Pagination/index.js +2 -0
  229. package/dist/components/Popover/Popover.d.ts +27 -0
  230. package/dist/components/Popover/Popover.js +33 -0
  231. package/dist/components/Popover/Popover.js.map +1 -0
  232. package/dist/components/Popover/PopoverOverlay.d.ts +3 -0
  233. package/dist/components/Popover/PopoverOverlay.js +39 -0
  234. package/dist/components/Popover/PopoverOverlay.js.map +1 -0
  235. package/dist/components/Popover/index.d.ts +2 -0
  236. package/dist/components/Popover/index.js +2 -0
  237. package/dist/components/ProgressBar/ProgressBar.d.ts +19 -0
  238. package/dist/components/ProgressBar/ProgressBar.js +52 -0
  239. package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
  240. package/dist/components/ProgressBar/index.d.ts +2 -0
  241. package/dist/components/ProgressBar/index.js +2 -0
  242. package/dist/components/RadioGroup/RadioGroup.d.ts +14 -0
  243. package/dist/components/RadioGroup/RadioGroup.js +46 -0
  244. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  245. package/dist/components/RadioGroup/index.d.ts +2 -0
  246. package/dist/components/RadioGroup/index.js +2 -0
  247. package/dist/components/SegmentedControl/SegmentedControl.d.ts +32 -0
  248. package/dist/components/SegmentedControl/SegmentedControl.js +55 -0
  249. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -0
  250. package/dist/components/SegmentedControl/index.d.ts +2 -0
  251. package/dist/components/SegmentedControl/index.js +2 -0
  252. package/dist/components/Select/Select.d.ts +28 -0
  253. package/dist/components/Select/Select.js +64 -0
  254. package/dist/components/Select/Select.js.map +1 -0
  255. package/dist/components/Select/index.d.ts +2 -0
  256. package/dist/components/Select/index.js +2 -0
  257. package/dist/components/Skeleton/Skeleton.d.ts +13 -0
  258. package/dist/components/Skeleton/Skeleton.js +33 -0
  259. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  260. package/dist/components/Skeleton/index.d.ts +2 -0
  261. package/dist/components/Skeleton/index.js +2 -0
  262. package/dist/components/Spinner/Spinner.d.ts +12 -0
  263. package/dist/components/Spinner/Spinner.js +29 -0
  264. package/dist/components/Spinner/Spinner.js.map +1 -0
  265. package/dist/components/Spinner/index.d.ts +2 -0
  266. package/dist/components/Spinner/index.js +2 -0
  267. package/dist/components/Stat/Stat.d.ts +49 -0
  268. package/dist/components/Stat/Stat.js +125 -0
  269. package/dist/components/Stat/Stat.js.map +1 -0
  270. package/dist/components/Stat/index.d.ts +2 -0
  271. package/dist/components/Stat/index.js +2 -0
  272. package/dist/components/Switch/Switch.d.ts +11 -0
  273. package/dist/components/Switch/Switch.js +39 -0
  274. package/dist/components/Switch/Switch.js.map +1 -0
  275. package/dist/components/Switch/index.d.ts +2 -0
  276. package/dist/components/Switch/index.js +2 -0
  277. package/dist/components/Table/Table.d.ts +41 -0
  278. package/dist/components/Table/Table.js +121 -0
  279. package/dist/components/Table/Table.js.map +1 -0
  280. package/dist/components/Table/index.d.ts +2 -0
  281. package/dist/components/Table/index.js +2 -0
  282. package/dist/components/Tabs/Tabs.d.ts +10 -0
  283. package/dist/components/Tabs/Tabs.js +34 -0
  284. package/dist/components/Tabs/Tabs.js.map +1 -0
  285. package/dist/components/Tabs/index.d.ts +2 -0
  286. package/dist/components/Tabs/index.js +2 -0
  287. package/dist/components/Tag/Tag.d.ts +16 -0
  288. package/dist/components/Tag/Tag.js +48 -0
  289. package/dist/components/Tag/Tag.js.map +1 -0
  290. package/dist/components/Tag/index.d.ts +2 -0
  291. package/dist/components/Tag/index.js +2 -0
  292. package/dist/components/Textarea/Textarea.d.ts +28 -0
  293. package/dist/components/Textarea/Textarea.js +30 -0
  294. package/dist/components/Textarea/Textarea.js.map +1 -0
  295. package/dist/components/Textarea/index.d.ts +2 -0
  296. package/dist/components/Textarea/index.js +2 -0
  297. package/dist/components/Toast/Toast.d.ts +52 -0
  298. package/dist/components/Toast/Toast.js +77 -0
  299. package/dist/components/Toast/Toast.js.map +1 -0
  300. package/dist/components/Toast/ToastItem.d.ts +6 -0
  301. package/dist/components/Toast/ToastItem.js +127 -0
  302. package/dist/components/Toast/ToastItem.js.map +1 -0
  303. package/dist/components/Toast/index.d.ts +2 -0
  304. package/dist/components/Toast/index.js +2 -0
  305. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  306. package/dist/components/Tooltip/Tooltip.js +38 -0
  307. package/dist/components/Tooltip/Tooltip.js.map +1 -0
  308. package/dist/components/Tooltip/TooltipOverlay.d.ts +5 -0
  309. package/dist/components/Tooltip/TooltipOverlay.js +27 -0
  310. package/dist/components/Tooltip/TooltipOverlay.js.map +1 -0
  311. package/dist/components/Tooltip/index.d.ts +2 -0
  312. package/dist/components/Tooltip/index.js +2 -0
  313. package/dist/fonts.css +21 -0
  314. package/dist/index.d.ts +38 -0
  315. package/dist/index.js +43 -0
  316. package/dist/internal/Field.d.ts +13 -0
  317. package/dist/internal/Field.js +29 -0
  318. package/dist/internal/Field.js.map +1 -0
  319. package/dist/internal/LazyDialogTrigger.d.ts +8 -0
  320. package/dist/internal/LazyDialogTrigger.js +15 -0
  321. package/dist/internal/LazyDialogTrigger.js.map +1 -0
  322. package/dist/internal/PreloadOnIntent.d.ts +15 -0
  323. package/dist/internal/PreloadOnIntent.js +26 -0
  324. package/dist/internal/PreloadOnIntent.js.map +1 -0
  325. package/dist/internal/Spinner.d.ts +3 -0
  326. package/dist/internal/Spinner.js +14 -0
  327. package/dist/internal/Spinner.js.map +1 -0
  328. package/dist/internal/focusRing.d.ts +2 -0
  329. package/dist/internal/focusRing.js +7 -0
  330. package/dist/internal/focusRing.js.map +1 -0
  331. package/dist/internal/lazyModule.d.ts +15 -0
  332. package/dist/internal/lazyModule.js +54 -0
  333. package/dist/internal/lazyModule.js.map +1 -0
  334. package/dist/internal/surfaces.d.ts +8 -0
  335. package/dist/internal/surfaces.js +13 -0
  336. package/dist/internal/surfaces.js.map +1 -0
  337. package/dist/internal/types.d.ts +5 -0
  338. package/dist/internal/useLazyMenuTrigger.d.ts +23 -0
  339. package/dist/internal/useLazyMenuTrigger.js +47 -0
  340. package/dist/internal/useLazyMenuTrigger.js.map +1 -0
  341. package/dist/reset.css +52 -0
  342. package/dist/styles/themes/scales.d.ts +2 -0
  343. package/dist/styles/themes/scales.js +132 -0
  344. package/dist/styles/themes/scales.js.map +1 -0
  345. package/dist/styles/themes/variants.d.ts +41 -0
  346. package/dist/styles/themes/variants.js +180 -0
  347. package/dist/styles/themes/variants.js.map +1 -0
  348. package/dist/styles.css +2 -0
  349. package/dist/theme.css +528 -0
  350. package/dist/themes/all.css +158 -0
  351. package/dist/themes/assistant.css +25 -0
  352. package/dist/themes/control-room.css +25 -0
  353. package/dist/themes/plain-language.css +25 -0
  354. package/dist/themes/portfolio.css +25 -0
  355. package/dist/themes/review.css +25 -0
  356. package/dist/themes/sudoku.css +25 -0
  357. package/dist/themes/tokens.css +25 -0
  358. package/dist/themes/watchlist.css +25 -0
  359. package/dist/themes/workspace.css +25 -0
  360. package/dist/tokens.css +351 -0
  361. package/dist/utils/cx.d.ts +23 -0
  362. package/dist/utils/cx.js +25 -0
  363. package/dist/utils/cx.js.map +1 -0
  364. package/dist/utils/cxLite.d.ts +12 -0
  365. package/dist/utils/cxLite.js +23 -0
  366. package/dist/utils/cxLite.js.map +1 -0
  367. package/package.json +304 -4
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { focusRing } from "../../internal/focusRing.js";
3
+ import { cx } from "../../utils/cxLite.js";
4
+ import { useRef, useState } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { useFocusRing } from "react-aria/useFocusRing";
7
+ import { mergeProps } from "react-aria/mergeProps";
8
+ // src/components/Chart/interaction.tsx
9
+ /**
10
+ * Where the arrow keys lead from `index`, or -1 to stay put. With `columns` the marks form a grid
11
+ * (left and right along a row, up and down across rows, Ctrl with Home or End for the corners);
12
+ * without it they form one line that every arrow key walks.
13
+ */
14
+ function nextIndex(key, ctrl, index, count, columns = 0) {
15
+ const last = count - 1;
16
+ const rowStart = columns ? index - index % columns : 0;
17
+ let target = -1;
18
+ if (key === "Home") target = ctrl ? 0 : rowStart;
19
+ else if (key === "End") target = ctrl ? last : columns ? rowStart + columns - 1 : last;
20
+ else if (columns === 0) {
21
+ if (key === "ArrowRight" || key === "ArrowDown") target = index + 1;
22
+ if (key === "ArrowLeft" || key === "ArrowUp") target = index - 1;
23
+ } else {
24
+ const column = index % columns;
25
+ if (key === "ArrowRight" && column < columns - 1) target = index + 1;
26
+ if (key === "ArrowLeft" && column > 0) target = index - 1;
27
+ if (key === "ArrowDown") target = index + columns;
28
+ if (key === "ArrowUp") target = index - columns;
29
+ }
30
+ return target < 0 || target > last || target === index ? -1 : target;
31
+ }
32
+ /**
33
+ * Pointer and keyboard state shared by the charts: one tab stop that moves with the arrow keys
34
+ * (roving tabindex), hover and focus both open the tooltip, and Escape closes it until the next
35
+ * move. Escape is only consumed while a tooltip is open, so a second press reaches a dialog around
36
+ * the chart. `onActivate` receives the element of the mark that was just hovered or focused.
37
+ */
38
+ function useChartInteraction(count, columns = 0, onActivate) {
39
+ const [roving, setRoving] = useState(0);
40
+ const [focused, setFocused] = useState(null);
41
+ const [hovered, setHovered] = useState(null);
42
+ const [dismissed, setDismissed] = useState(false);
43
+ const marks = useRef(/* @__PURE__ */ new Map());
44
+ const current = Math.min(roving, Math.max(0, count - 1));
45
+ const isOpen = !dismissed && (hovered ?? focused) !== null;
46
+ function activate(index) {
47
+ setDismissed(false);
48
+ onActivate?.(marks.current.get(index) ?? null);
49
+ }
50
+ function markProps(index) {
51
+ return {
52
+ ref: (element) => {
53
+ if (element) marks.current.set(index, element);
54
+ else marks.current.delete(index);
55
+ },
56
+ tabIndex: index === current ? 0 : -1,
57
+ onFocus: () => {
58
+ setRoving(index);
59
+ setFocused(index);
60
+ activate(index);
61
+ },
62
+ onBlur: () => setFocused(null),
63
+ onKeyDown: (event) => {
64
+ if (event.key === "Escape") {
65
+ if (!isOpen) return;
66
+ event.stopPropagation();
67
+ setDismissed(true);
68
+ return;
69
+ }
70
+ const target = nextIndex(event.key, event.ctrlKey || event.metaKey, index, count, columns);
71
+ if (target === -1) return;
72
+ event.preventDefault();
73
+ marks.current.get(target)?.focus();
74
+ },
75
+ onPointerEnter: () => {
76
+ setHovered(index);
77
+ activate(index);
78
+ },
79
+ onPointerLeave: () => setHovered(null)
80
+ };
81
+ }
82
+ return {
83
+ active: isOpen ? hovered ?? focused : null,
84
+ markProps
85
+ };
86
+ }
87
+ /**
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
+ */
91
+ function ChartMark({ index, interaction, label, style, className, children }) {
92
+ const { focusProps, isFocusVisible } = useFocusRing();
93
+ const props = mergeProps(interaction.markProps(index), focusProps);
94
+ return /* @__PURE__ */ jsx("div", {
95
+ role: "img",
96
+ "aria-label": label,
97
+ "data-focus-visible": isFocusVisible || void 0,
98
+ className: cx("absolute rounded-xs", focusRing, className),
99
+ style,
100
+ ...props,
101
+ children
102
+ });
103
+ }
104
+ export { ChartMark, nextIndex, useChartInteraction };
105
+
106
+ //# sourceMappingURL=interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.js","names":[],"sources":["../../../src/components/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/cxLite';\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\ninterface ChartMarkProps {\n index: number;\n interaction: Interaction;\n /** The full description, read by a screen reader when the mark takes focus. */\n label: string;\n style: CSSProperties;\n className?: string;\n children?: ReactNode;\n}\n\n/**\n * An invisible, focusable hit area laid over the plot. It is bigger than the mark it stands for,\n * shows the library focus ring for keyboard focus and opens the tooltip.\n */\nexport function ChartMark({\n index,\n interaction,\n label,\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='img'\n aria-label={label}\n data-focus-visible={isFocusVisible || undefined}\n className={cx('absolute rounded-xs', 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;CACA,OAAO,SAAS,KAAK,SAAS,QAAQ,WAAW,QAAQ,KAAK;AAChE;;;;;;;AAwBA,SAAgB,oBACd,OACA,UAAU,GACV,YACa;CACb,MAAM,CAAC,QAAQ,aAAa,SAAS,CAAC;CACtC,MAAM,CAAC,SAAS,cAAc,SAAwB,IAAI;CAC1D,MAAM,CAAC,SAAS,cAAc,SAAwB,IAAI;CAC1D,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,QAAQ,uBAAO,IAAI,IAAyB,CAAC;CACnD,MAAM,UAAU,KAAK,IAAI,QAAQ,KAAK,IAAI,GAAG,QAAQ,CAAC,CAAC;CACvD,MAAM,SAAS,CAAC,cAAc,WAAW,aAAa;CAEtD,SAAS,SAAS,OAAe;EAC/B,aAAa,KAAK;EAClB,aAAa,MAAM,QAAQ,IAAI,KAAK,KAAK,IAAI;CAC/C;CAEA,SAAS,UAAU,OAA6B;EAC9C,OAAO;GACL,MAAM,YAAY;IAChB,IAAI,SAAS,MAAM,QAAQ,IAAI,OAAO,OAAO;SACxC,MAAM,QAAQ,OAAO,KAAK;GACjC;GACA,UAAU,UAAU,UAAU,IAAI;GAClC,eAAe;IACb,UAAU,KAAK;IACf,WAAW,KAAK;IAChB,SAAS,KAAK;GAChB;GACA,cAAc,WAAW,IAAI;GAC7B,YAAY,UAAU;IACpB,IAAI,MAAM,QAAQ,UAAU;KAC1B,IAAI,CAAC,QAAQ;KACb,MAAM,gBAAgB;KACtB,aAAa,IAAI;KACjB;IACF;IACA,MAAM,SAAS,UAAU,MAAM,KAAK,MAAM,WAAW,MAAM,SAAS,OAAO,OAAO,OAAO;IACzF,IAAI,WAAW,IAAI;IACnB,MAAM,eAAe;IACrB,MAAM,QAAQ,IAAI,MAAM,CAAC,EAAE,MAAM;GACnC;GACA,sBAAsB;IACpB,WAAW,KAAK;IAChB,SAAS,KAAK;GAChB;GACA,sBAAsB,WAAW,IAAI;EACvC;CACF;CAEA,OAAO;EAAE,QAAQ,SAAU,WAAW,UAAW;EAAM;CAAU;AACnE;;;;;AAgBA,SAAgB,UAAU,EACxB,OACA,aACA,OACA,OACA,WACA,YACiB;CACjB,MAAM,EAAE,YAAY,mBAAmB,aAAa;CACpD,MAAM,QAAQ,WAAW,YAAY,UAAU,KAAK,GAAG,UAAU;CAEjE,OACE,oBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,sBAAoB,kBAAkB,KAAA;EACtC,WAAW,GAAG,uBAAuB,WAAW,SAAS;EAClD;EACP,GAAI;EAEH;CACE,CAAA;AAET"}
@@ -0,0 +1,3 @@
1
+ import type { ChartLabels } from './types';
2
+ /** The labels a consumer passed, over the English defaults. */
3
+ export declare function chartLabels(labels?: Partial<ChartLabels>): ChartLabels;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ // src/components/Chart/labels.ts
3
+ var defaultLabels = {
4
+ showTable: "Show table",
5
+ hideTable: "Hide table",
6
+ empty: "No data to show.",
7
+ noData: "No data",
8
+ total: "Total",
9
+ category: "Category",
10
+ date: "Date",
11
+ value: "Value",
12
+ row: "Row"
13
+ };
14
+ /** The labels a consumer passed, over the English defaults. */
15
+ function chartLabels(labels) {
16
+ return {
17
+ ...defaultLabels,
18
+ ...labels
19
+ };
20
+ }
21
+ export { chartLabels };
22
+
23
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","names":[],"sources":["../../../src/components/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"}
@@ -0,0 +1,15 @@
1
+ export interface NiceScale {
2
+ ticks: number[];
3
+ min: number;
4
+ max: number;
5
+ }
6
+ /**
7
+ * Round tick values that cover `min` to `max`, about `count` of them. The domain is widened to the
8
+ * first and last tick, so a bar chart can start at a clean zero and end at a clean top. With
9
+ * `isInteger` the step is a whole number, so counts never get ticks such as 0.5.
10
+ */
11
+ export declare function niceTicks(min: number, max: number, count: number, isInteger?: boolean): NiceScale;
12
+ /** A linear map from a domain to a range. A zero width domain maps to the middle of the range. */
13
+ export declare function linearScale([d0, d1]: [number, number], [r0, r1]: [number, number]): (value: number) => number;
14
+ /** Evenly spaced indexes, starting at 0, so that at most `limit` labels are drawn. */
15
+ export declare function sampleIndexes(length: number, limit: number): number[];
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ // src/components/Chart/scale.ts
3
+ var steps = [
4
+ 1,
5
+ 2,
6
+ 2.5,
7
+ 5,
8
+ 10
9
+ ];
10
+ function decimals(step) {
11
+ const text = String(step);
12
+ const dot = text.indexOf(".");
13
+ return dot === -1 ? 0 : text.length - dot - 1;
14
+ }
15
+ /**
16
+ * Round tick values that cover `min` to `max`, about `count` of them. The domain is widened to the
17
+ * first and last tick, so a bar chart can start at a clean zero and end at a clean top. With
18
+ * `isInteger` the step is a whole number, so counts never get ticks such as 0.5.
19
+ */
20
+ function niceTicks(min, max, count, isInteger = false) {
21
+ if (min === max) {
22
+ if (min === 0) return niceTicks(0, 1, count, isInteger);
23
+ const pad = Math.abs(min) * .1;
24
+ return niceTicks(min - pad, max + pad, count, isInteger);
25
+ }
26
+ const raw = (max - min) / Math.max(1, count - 1);
27
+ const magnitude = 10 ** Math.floor(Math.log10(raw));
28
+ const candidates = steps.map((s) => Number((s * magnitude).toPrecision(12))).filter((step) => !isInteger || Number.isInteger(step));
29
+ const step = isInteger && raw <= 1 ? 1 : candidates.find((s) => s >= raw) ?? 10 * magnitude;
30
+ const first = Math.floor(min / step) * step;
31
+ const last = Math.ceil(max / step) * step;
32
+ const places = decimals(step);
33
+ const ticks = [];
34
+ for (let value = first; value <= last + step / 2; value += step) ticks.push(Number(value.toFixed(places)));
35
+ return {
36
+ ticks,
37
+ min: first,
38
+ max: last
39
+ };
40
+ }
41
+ /** A linear map from a domain to a range. A zero width domain maps to the middle of the range. */
42
+ function linearScale([d0, d1], [r0, r1]) {
43
+ if (d0 === d1) return () => (r0 + r1) / 2;
44
+ const ratio = (r1 - r0) / (d1 - d0);
45
+ return (value) => r0 + (value - d0) * ratio;
46
+ }
47
+ /** Evenly spaced indexes, starting at 0, so that at most `limit` labels are drawn. */
48
+ function sampleIndexes(length, limit) {
49
+ const step = Math.max(1, Math.ceil(length / Math.max(1, limit)));
50
+ return Array.from({ length: Math.ceil(length / step) }, (_, index) => index * step);
51
+ }
52
+ export { linearScale, niceTicks, sampleIndexes };
53
+
54
+ //# sourceMappingURL=scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scale.js","names":[],"sources":["../../../src/components/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;AAAE;AAE/B,SAAS,SAAS,MAAsB;CACtC,MAAM,OAAO,OAAO,IAAI;CACxB,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,IAAI,KAAK,SAAS,MAAM;AAC9C;;;;;;AAOA,SAAgB,UAAU,KAAa,KAAa,OAAe,YAAY,OAAkB;CAC/F,IAAI,QAAQ,KAAK;EACf,IAAI,QAAQ,GAAG,OAAO,UAAU,GAAG,GAAG,OAAO,SAAS;EACtD,MAAM,MAAM,KAAK,IAAI,GAAG,IAAI;EAC5B,OAAO,UAAU,MAAM,KAAK,MAAM,KAAK,OAAO,SAAS;CACzD;CACA,MAAM,OAAO,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,CAAC;CAC/C,MAAM,YAAY,MAAM,KAAK,MAAM,KAAK,MAAM,GAAG,CAAC;CAClD,MAAM,aAAa,MAChB,KAAK,MAAM,QAAQ,IAAI,UAAA,CAAW,YAAY,EAAE,CAAC,CAAC,CAAC,CACnD,QAAQ,SAAS,CAAC,aAAa,OAAO,UAAU,IAAI,CAAC;CACxD,MAAM,OAAO,aAAa,OAAO,IAAI,IAAK,WAAW,MAAM,MAAM,KAAK,GAAG,KAAK,KAAK;CACnF,MAAM,QAAQ,KAAK,MAAM,MAAM,IAAI,IAAI;CACvC,MAAM,OAAO,KAAK,KAAK,MAAM,IAAI,IAAI;CACrC,MAAM,SAAS,SAAS,IAAI;CAC5B,MAAM,QAAkB,CAAC;CACzB,KAAK,IAAI,QAAQ,OAAO,SAAS,OAAO,OAAO,GAAG,SAAS,MACzD,MAAM,KAAK,OAAO,MAAM,QAAQ,MAAM,CAAC,CAAC;CAE1C,OAAO;EAAE;EAAO,KAAK;EAAO,KAAK;CAAK;AACxC;;AAGA,SAAgB,YACd,CAAC,IAAI,KACL,CAAC,IAAI,KACsB;CAC3B,IAAI,OAAO,IAAI,cAAc,KAAK,MAAM;CACxC,MAAM,SAAS,KAAK,OAAO,KAAK;CAChC,QAAQ,UAAU,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,14 @@
1
+ import type { MarkerShape } from './geometry';
2
+ export interface SeriesStyle {
3
+ stroke: string;
4
+ fill: string;
5
+ swatch: string;
6
+ shape: MarkerShape;
7
+ /** SVG dash pattern. Only the colourless overflow series are dashed. */
8
+ dash?: string;
9
+ }
10
+ /**
11
+ * Colour, marker shape and dash of the series at `index`. The first six get a hue each, in a fixed
12
+ * order, never cycled. Further series share the muted colour and are told apart by shape and dash.
13
+ */
14
+ export declare function seriesStyle(index: number): SeriesStyle;
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ // src/components/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 overflow = {
44
+ stroke: "stroke-chart-muted",
45
+ fill: "fill-chart-muted",
46
+ swatch: "bg-chart-muted"
47
+ };
48
+ var dashes = [
49
+ "6 4",
50
+ "2 4",
51
+ "8 3 2 3"
52
+ ];
53
+ /**
54
+ * Colour, marker shape and dash of the series at `index`. The first six get a hue each, in a fixed
55
+ * order, never cycled. Further series share the muted colour and are told apart by shape and dash.
56
+ */
57
+ function seriesStyle(index) {
58
+ const shape = shapes[index % shapes.length] ?? "circle";
59
+ const colour = palette[index];
60
+ if (colour) return {
61
+ ...colour,
62
+ shape
63
+ };
64
+ return {
65
+ ...overflow,
66
+ shape,
67
+ dash: dashes[(index - palette.length) % dashes.length]
68
+ };
69
+ }
70
+ export { seriesStyle };
71
+
72
+ //# sourceMappingURL=series.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"series.js","names":[],"sources":["../../../src/components/Chart/series.ts"],"sourcesContent":["import type { MarkerShape } from './geometry';\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 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: number): SeriesStyle {\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"],"mappings":";;AAWA,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;CACvE;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;CACvE;EAAE,QAAQ;EAAkB,MAAM;EAAgB,QAAQ;CAAa;AACzE;AAEA,IAAM,WAAW;CACf,QAAQ;CACR,MAAM;CACN,QAAQ;AACV;AACA,IAAM,SAAS;CAAC;CAAO;CAAO;AAAS;;;;;AAMvC,SAAgB,YAAY,OAA4B;CACtD,MAAM,QAAQ,OAAO,QAAQ,OAAO,WAAW;CAC/C,MAAM,SAAS,QAAQ;CACvB,IAAI,QAAQ,OAAO;EAAE,GAAG;EAAQ;CAAM;CACtC,OAAO;EAAE,GAAG;EAAU;EAAO,MAAM,QAAQ,QAAQ,QAAQ,UAAU,OAAO;CAAQ;AACtF"}
@@ -0,0 +1,8 @@
1
+ import type { ChartSeries } from './types';
2
+ /** One sentence about a series: where it starts and ends, and its lowest and highest points. */
3
+ export declare function describeSeries(series: ChartSeries, positions: string[], format: (value: number) => string): string;
4
+ /** Describes the first few series in full and counts the rest. */
5
+ export declare function describeAll(headline: string, series: ChartSeries[], positions: string[], format: (value: number) => string): string;
6
+ export declare function plural(count: number, one: string, many: string): string;
7
+ /** One sentence per series about its highest and lowest category, for the first few series. */
8
+ export declare function describeBars(headline: string, categories: string[], series: ChartSeries[], format: (value: number) => string): string;
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ // src/components/Chart/summary.ts
3
+ var maxDescribed = 3;
4
+ function indexOfValue(values, target) {
5
+ return values.findIndex((value) => value === target);
6
+ }
7
+ /** One sentence about a series: where it starts and ends, and its lowest and highest points. */
8
+ function describeSeries(series, positions, format) {
9
+ const known = series.values.flatMap((value, index) => value === null ? [] : [{
10
+ value,
11
+ index
12
+ }]);
13
+ const first = known[0];
14
+ const last = known[known.length - 1];
15
+ if (!first || !last) return `${series.label}: no values.`;
16
+ if (known.length === 1) return `${series.label}: ${format(first.value)} at ${positions[first.index]}.`;
17
+ const numbers = known.map((point) => point.value);
18
+ const low = Math.min(...numbers);
19
+ const high = Math.max(...numbers);
20
+ if (low === high) return `${series.label}: ${format(low)} throughout.`;
21
+ const at = (value) => positions[indexOfValue(series.values, value)] ?? "";
22
+ return `${series.label}: from ${format(first.value)} to ${format(last.value)}, lowest ${format(low)} at ${at(low)}, highest ${format(high)} at ${at(high)}.`;
23
+ }
24
+ /** Describes the first few series in full and counts the rest. */
25
+ function describeAll(headline, series, positions, format) {
26
+ const described = series.slice(0, maxDescribed).map((s) => describeSeries(s, positions, format));
27
+ const rest = series.length - described.length;
28
+ if (rest > 0) described.push(`${rest} more ${rest === 1 ? "series is" : "series are"} in the table.`);
29
+ return [headline, ...described].join(" ");
30
+ }
31
+ function plural(count, one, many) {
32
+ return `${count} ${count === 1 ? one : many}`;
33
+ }
34
+ /** One sentence per series about its highest and lowest category, for the first few series. */
35
+ function describeBars(headline, categories, series, format) {
36
+ const described = series.slice(0, maxDescribed).map((s) => {
37
+ const known = s.values.flatMap((value, index) => value === null ? [] : [{
38
+ value,
39
+ index
40
+ }]);
41
+ const sorted = known.toSorted((a, b) => b.value - a.value);
42
+ const top = sorted[0];
43
+ const bottom = sorted[sorted.length - 1];
44
+ if (!top || !bottom) return `${s.label}: no values.`;
45
+ const name = (point) => categories[point.index] ?? "";
46
+ if (known.length === 1) return `${s.label}: ${format(top.value)} for ${name(top)}.`;
47
+ if (top.value === bottom.value) return `${s.label}: ${format(top.value)} for every category.`;
48
+ return `${s.label}: highest ${name(top)} at ${format(top.value)}, lowest ${name(bottom)} at ${format(bottom.value)}.`;
49
+ });
50
+ const rest = series.length - described.length;
51
+ if (rest > 0) described.push(`${rest} more ${rest === 1 ? "series is" : "series are"} in the table.`);
52
+ return [headline, ...described].join(" ");
53
+ }
54
+ export { describeAll, describeBars, describeSeries, plural };
55
+
56
+ //# sourceMappingURL=summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.js","names":[],"sources":["../../../src/components/Chart/summary.ts"],"sourcesContent":["import type { ChartSeries } from './types';\n\nconst maxDescribed = 3;\n\nfunction indexOfValue(values: Array<number | null>, target: number): number {\n return values.findIndex((value) => value === target);\n}\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[indexOfValue(series.values, 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;AAErB,SAAS,aAAa,QAA8B,QAAwB;CAC1E,OAAO,OAAO,WAAW,UAAU,UAAU,MAAM;AACrD;;AAGA,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,IAAI,GAAG,OAAO;CAC/B,MAAM,OAAO,KAAK,IAAI,GAAG,OAAO;CAChC,IAAI,QAAQ,MAAM,OAAO,GAAG,OAAO,MAAM,IAAI,OAAO,GAAG,EAAE;CACzD,MAAM,MAAM,UAAkB,UAAU,aAAa,OAAO,QAAQ,KAAK,MAAM;CAC/E,OAAO,GAAG,OAAO,MAAM,SAAS,OAAO,MAAM,KAAK,EAAE,MAAM,OAAO,KAAK,KAAK,EAAE,WAAW,OAAO,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,YAAY,OAAO,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE;AAC5J;;AAGA,SAAgB,YACd,UACA,QACA,WACA,QACQ;CACR,MAAM,YAAY,OAAO,MAAM,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM,eAAe,GAAG,WAAW,MAAM,CAAC;CAC/F,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;AAEA,SAAgB,OAAO,OAAe,KAAa,MAAsB;CACvE,OAAO,GAAG,MAAM,GAAG,UAAU,IAAI,MAAM;AACzC;;AAGA,SAAgB,aACd,UACA,YACA,QACA,QACQ;CACR,MAAM,YAAY,OAAO,MAAM,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;EACzD,MAAM,QAAQ,EAAE,OAAO,SAAS,OAAO,UAAW,UAAU,OAAO,CAAC,IAAI,CAAC;GAAE;GAAO;EAAM,CAAC,CAAE;EAC3F,MAAM,SAAS,MAAM,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;EACzD,MAAM,MAAM,OAAO;EACnB,MAAM,SAAS,OAAO,OAAO,SAAS;EACtC,IAAI,CAAC,OAAO,CAAC,QAAQ,OAAO,GAAG,EAAE,MAAM;EACvC,MAAM,QAAQ,UAA6B,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"}
@@ -0,0 +1,50 @@
1
+ export interface ChartSeries {
2
+ /** Stable key. Also the identity of the series: keep it the same when data is filtered. */
3
+ id: string;
4
+ /** Name shown in the legend, the tooltip and the table. */
5
+ label: string;
6
+ /** One value per x position or category. `null` leaves a gap. */
7
+ values: Array<number | null>;
8
+ /**
9
+ * Which of the six series colours to use, 0 to 5. Defaults to the position in the `series`
10
+ * array. Set it when a filter removes series, so the ones that remain keep their colour.
11
+ */
12
+ colorIndex?: number;
13
+ }
14
+ export type XValue = Date | number | string;
15
+ export interface ChartLabels {
16
+ showTable: string;
17
+ hideTable: string;
18
+ empty: string;
19
+ /** Stands for a missing value in a tooltip, an accessible name and a heat grid cell. */
20
+ noData: string;
21
+ /** The total row of a stacked bar tooltip and the last column of its table. */
22
+ total: string;
23
+ /** Default first table header of a bar chart and of a line chart with named x values. */
24
+ category: string;
25
+ /** Default first table header of a line chart with dates. */
26
+ date: string;
27
+ /** Default first table header of a line chart with numeric x values. */
28
+ value: string;
29
+ /** Default first table header and row header label of a heat grid. */
30
+ row: string;
31
+ }
32
+ export interface ChartBaseProps {
33
+ /** The accessible name of the chart. Shown above it unless `hideTitle` is set. */
34
+ title: string;
35
+ hideTitle?: boolean;
36
+ /**
37
+ * A one or two sentence description for assistive technology. Without it the chart writes one
38
+ * from the data, in English. Pass your own to localise it.
39
+ */
40
+ summary?: string;
41
+ /** BCP 47 tag for number and date formatting. Defaults to the runtime locale. */
42
+ locale?: string;
43
+ /** Text for the table toggle, the empty state and the words the chart adds to your data. */
44
+ labels?: Partial<ChartLabels>;
45
+ /** Height of the whole chart in pixels, including the axes. The plot is shorter by the margins. */
46
+ height?: number;
47
+ /** Draws the chart on a bordered card surface. */
48
+ isCard?: boolean;
49
+ className?: string;
50
+ }
@@ -0,0 +1,6 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * The width of an element, kept current with a ResizeObserver. Starts at `fallback`, which is
4
+ * also what the server renders, then settles on the real width after mount.
5
+ */
6
+ export declare function useElementWidth<T extends HTMLElement>(fallback: number): [RefObject<T | null>, number];
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ // src/components/Chart/useElementWidth.ts
4
+ /**
5
+ * The width of an element, kept current with a ResizeObserver. Starts at `fallback`, which is
6
+ * also what the server renders, then settles on the real width after mount.
7
+ */
8
+ function useElementWidth(fallback) {
9
+ const ref = useRef(null);
10
+ const [width, setWidth] = useState(fallback);
11
+ useEffect(() => {
12
+ const element = ref.current;
13
+ if (!element) return;
14
+ const observer = new ResizeObserver(([entry]) => {
15
+ const next = Math.round(entry?.contentRect.width ?? 0);
16
+ if (next > 0) setWidth(next);
17
+ });
18
+ observer.observe(element);
19
+ return () => observer.disconnect();
20
+ }, []);
21
+ return [ref, width];
22
+ }
23
+ export { useElementWidth };
24
+
25
+ //# sourceMappingURL=useElementWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useElementWidth.js","names":[],"sources":["../../../src/components/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"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type CheckboxProps as AriaCheckboxProps } from 'react-aria-components';
3
+ export interface CheckboxProps extends Omit<AriaCheckboxProps, 'children'> {
4
+ /** Visible label. If omitted, pass `aria-label`. */
5
+ children?: ReactNode;
6
+ /** Supporting text under the label. */
7
+ hint?: ReactNode;
8
+ }
9
+ export declare function Checkbox({ children, hint, className, ...props }: CheckboxProps): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { cx } from "../../utils/cx.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { Check, Minus } from "lucide-react";
5
+ import { Checkbox, composeRenderProps } from "react-aria-components";
6
+ // src/components/Checkbox/Checkbox.tsx
7
+ function Checkbox$1({ children, hint, className, ...props }) {
8
+ return /* @__PURE__ */ jsx(Checkbox, {
9
+ ...props,
10
+ className: composeRenderProps(className, (consumer) => cx("group flex cursor-pointer items-start gap-2.5 text-sm text-secondary", "data-disabled:cursor-not-allowed data-disabled:text-disabled", consumer)),
11
+ children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
12
+ className: cx("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-xs border border-control bg-primary text-fg-on-solid transition-colors", "group-data-selected:border-brand group-data-selected:bg-brand-solid", "group-data-indeterminate:border-brand group-data-indeterminate:bg-brand-solid", "group-data-invalid:border-error", "group-data-disabled:border-disabled group-data-disabled:bg-disabled group-data-disabled:text-fg-disabled", "group-data-focus-visible:outline-2 group-data-focus-visible:outline-offset-2 group-data-focus-visible:outline-focus"),
13
+ children: isIndeterminate ? /* @__PURE__ */ jsx(Minus, {
14
+ "aria-hidden": "true",
15
+ className: "size-3",
16
+ strokeWidth: 3
17
+ }) : isSelected ? /* @__PURE__ */ jsx(Check, {
18
+ "aria-hidden": "true",
19
+ className: "size-3",
20
+ strokeWidth: 3
21
+ }) : null
22
+ }), (children || hint) && /* @__PURE__ */ jsxs("span", {
23
+ className: "flex flex-col",
24
+ children: [children && /* @__PURE__ */ jsx("span", {
25
+ className: "font-medium",
26
+ children
27
+ }), hint && /* @__PURE__ */ jsx("span", {
28
+ className: "text-tertiary",
29
+ children: hint
30
+ })]
31
+ })] })
32
+ });
33
+ }
34
+ export { Checkbox$1 as Checkbox };
35
+
36
+ //# sourceMappingURL=Checkbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.js","names":["Checkbox","AriaCheckbox","_Fragment"],"sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import { Check, Minus } from 'lucide-react';\nimport type { ReactNode } from 'react';\nimport {\n Checkbox as AriaCheckbox,\n composeRenderProps,\n type CheckboxProps as AriaCheckboxProps,\n} from 'react-aria-components';\nimport { cx } from '../../utils/cx';\n\nexport interface CheckboxProps extends Omit<AriaCheckboxProps, 'children'> {\n /** Visible label. If omitted, pass `aria-label`. */\n children?: ReactNode;\n /** Supporting text under the label. */\n hint?: ReactNode;\n}\n\nexport function Checkbox({ children, hint, className, ...props }: CheckboxProps) {\n return (\n <AriaCheckbox\n {...props}\n className={composeRenderProps(className, (consumer) =>\n cx(\n 'group flex cursor-pointer items-start gap-2.5 text-sm text-secondary',\n 'data-disabled:cursor-not-allowed data-disabled:text-disabled',\n consumer,\n ),\n )}\n >\n {({ isSelected, isIndeterminate }) => (\n <>\n <span\n className={cx(\n 'mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-xs border border-control bg-primary text-fg-on-solid transition-colors',\n 'group-data-selected:border-brand group-data-selected:bg-brand-solid',\n 'group-data-indeterminate:border-brand group-data-indeterminate:bg-brand-solid',\n 'group-data-invalid:border-error',\n 'group-data-disabled:border-disabled group-data-disabled:bg-disabled group-data-disabled:text-fg-disabled',\n 'group-data-focus-visible:outline-2 group-data-focus-visible:outline-offset-2 group-data-focus-visible:outline-focus',\n )}\n >\n {isIndeterminate ? (\n <Minus aria-hidden='true' className='size-3' strokeWidth={3} />\n ) : isSelected ? (\n <Check aria-hidden='true' className='size-3' strokeWidth={3} />\n ) : null}\n </span>\n {(children || hint) && (\n <span className='flex flex-col'>\n {children && <span className='font-medium'>{children}</span>}\n {hint && <span className='text-tertiary'>{hint}</span>}\n </span>\n )}\n </>\n )}\n </AriaCheckbox>\n );\n}\n"],"mappings":";;;;;;AAgBA,SAAgBA,WAAS,EAAE,UAAU,MAAM,WAAW,GAAG,SAAwB;CAC/E,OACE,oBAACC,UAAD;EACE,GAAI;EACJ,WAAW,mBAAmB,YAAY,aACxC,GACE,wEACA,gEACA,QACF,CACF;EAEE,WAAA,EAAE,YAAY,sBACd,qBAAAC,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GACE,WAAW,GACT,0IACA,uEACA,iFACA,mCACA,4GACA,qHACF;GAEC,UAAA,kBACC,oBAAC,OAAD;IAAO,eAAY;IAAO,WAAU;IAAS,aAAa;GAAI,CAAA,IAC5D,aACF,oBAAC,OAAD;IAAO,eAAY;IAAO,WAAU;IAAS,aAAa;GAAI,CAAA,IAC5D;EACA,CAAA,IACJ,YAAY,SACZ,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,YAAY,oBAAC,QAAD;IAAM,WAAU;IAAe;GAAe,CAAA,GAC1D,QAAQ,oBAAC,QAAD;IAAM,WAAU;IAAiB,UAAA;GAAW,CAAA,CACjD;EAER,CAAA,CAAA,EAAA,CAAA;CAEQ,CAAA;AAElB"}
@@ -0,0 +1,2 @@
1
+ export { Checkbox } from './Checkbox';
2
+ export type { CheckboxProps } from './Checkbox';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Checkbox } from "./Checkbox.js";
@@ -0,0 +1,22 @@
1
+ export interface CodeBlockProps {
2
+ /** The text to show, exactly as it should be copied. */
3
+ children: string;
4
+ /** Accessible name of the block, such as "Generated Tailwind theme". */
5
+ label: string;
6
+ /** Adds a button that copies the text. */
7
+ copyable?: boolean;
8
+ /** Accessible name of the copy button. */
9
+ copyLabel?: string;
10
+ /** Announced after copying. */
11
+ copiedLabel?: string;
12
+ /** Wrap long lines instead of scrolling sideways. */
13
+ wrap?: boolean;
14
+ className?: string;
15
+ }
16
+ /**
17
+ * Preformatted text in the theme's data font, for generated output, commands
18
+ * and code samples. The block is focusable so a keyboard user can scroll it,
19
+ * and it is a labelled group so a screen reader names it. With `copyable` a
20
+ * button copies the text and a polite status confirms it.
21
+ */
22
+ export declare function CodeBlock({ children, label, copyable, copyLabel, copiedLabel, wrap, className, }: CodeBlockProps): import("react").JSX.Element;