@leonardaustin/ui 0.24.0 → 0.26.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 (500) hide show
  1. package/README.md +183 -2
  2. package/dist/components/app-shell/AppShell.d.ts +3 -4
  3. package/dist/components/app-shell/AppShell.js +82 -0
  4. package/dist/components/app-shell/AuthLayout.d.ts +3 -4
  5. package/dist/components/app-shell/AuthLayout.js +16 -0
  6. package/dist/components/app-shell/BackLink.d.ts +3 -4
  7. package/dist/components/app-shell/BackLink.js +19 -0
  8. package/dist/components/app-shell/BottomNav.d.ts +3 -3
  9. package/dist/components/app-shell/BottomNav.js +37 -0
  10. package/dist/components/app-shell/Breadcrumbs.d.ts +3 -3
  11. package/dist/components/app-shell/Breadcrumbs.js +46 -0
  12. package/dist/components/app-shell/CommandPalette.d.ts +3 -3
  13. package/dist/components/app-shell/CommandPalette.js +119 -0
  14. package/dist/components/app-shell/MobileDrawer.d.ts +3 -4
  15. package/dist/components/app-shell/MobileDrawer.js +128 -0
  16. package/dist/components/app-shell/Sidebar.d.ts +3 -4
  17. package/dist/components/app-shell/Sidebar.js +355 -0
  18. package/dist/components/app-shell/ThemeMenu.d.ts +3 -3
  19. package/dist/components/app-shell/ThemeMenu.js +273 -0
  20. package/dist/components/app-shell/TopBar.d.ts +3 -4
  21. package/dist/components/app-shell/TopBar.js +129 -0
  22. package/dist/components/app-shell/commandPaletteEvents.d.ts +0 -1
  23. package/dist/components/app-shell/commandPaletteEvents.js +16 -0
  24. package/dist/components/app-shell/navigation.d.ts +0 -1
  25. package/dist/components/app-shell/navigation.js +21 -0
  26. package/dist/components/app-shell/themeMenuEvents.d.ts +0 -1
  27. package/dist/components/app-shell/themeMenuEvents.js +7 -0
  28. package/dist/components/app-shell/types.d.ts +0 -1
  29. package/dist/components/charts/AreaChart.d.ts +4 -4
  30. package/dist/components/charts/AreaChart.js +217 -0
  31. package/dist/components/charts/BarChart.d.ts +4 -4
  32. package/dist/components/charts/BarChart.js +91 -0
  33. package/dist/components/charts/DonutChart.d.ts +4 -4
  34. package/dist/components/charts/DonutChart.js +172 -0
  35. package/dist/components/charts/RadarChart.d.ts +4 -4
  36. package/dist/components/charts/RadarChart.js +142 -0
  37. package/dist/components/charts/RadialBarChart.d.ts +4 -4
  38. package/dist/components/charts/RadialBarChart.js +219 -0
  39. package/dist/components/charts/SparkLine.d.ts +4 -4
  40. package/dist/components/charts/SparkLine.js +39 -0
  41. package/dist/components/charts/StackedBarChart.d.ts +4 -4
  42. package/dist/components/charts/StackedBarChart.js +249 -0
  43. package/dist/components/charts/VerticalBarChart.d.ts +4 -4
  44. package/dist/components/charts/VerticalBarChart.js +143 -0
  45. package/dist/components/charts/chartUtils.d.ts +0 -1
  46. package/dist/components/charts/chartUtils.js +68 -0
  47. package/dist/components/tables/ColumnPicker.d.ts +3 -4
  48. package/dist/components/tables/ColumnPicker.js +59 -0
  49. package/dist/components/tables/Pagination.d.ts +3 -5
  50. package/dist/components/tables/Pagination.js +56 -0
  51. package/dist/components/tables/ResourceTable.d.ts +3 -4
  52. package/dist/components/tables/ResourceTable.js +88 -0
  53. package/dist/components/tables/Table.d.ts +0 -1
  54. package/dist/components/tables/Table.js +95 -0
  55. package/dist/components/tables/sortRows.d.ts +0 -1
  56. package/dist/components/tables/sortRows.js +11 -0
  57. package/dist/components/ui/Accordion.d.ts +9 -2
  58. package/dist/components/ui/Accordion.js +35 -0
  59. package/dist/components/ui/Alert.d.ts +8 -6
  60. package/dist/components/ui/Alert.js +51 -0
  61. package/dist/components/ui/AttachmentList.d.ts +5 -6
  62. package/dist/components/ui/AttachmentList.js +90 -0
  63. package/dist/components/ui/AudioPlayer.d.ts +7 -4
  64. package/dist/components/ui/AudioPlayer.js +447 -0
  65. package/dist/components/ui/AuthCard.d.ts +3 -4
  66. package/dist/components/ui/AuthCard.js +39 -0
  67. package/dist/components/ui/AuthorByline.d.ts +5 -6
  68. package/dist/components/ui/AuthorByline.js +23 -0
  69. package/dist/components/ui/Avatar.d.ts +5 -4
  70. package/dist/components/ui/Avatar.js +36 -0
  71. package/dist/components/ui/Badge.d.ts +3 -3
  72. package/dist/components/ui/Badge.js +47 -0
  73. package/dist/components/ui/Button.d.ts +9 -9
  74. package/dist/components/ui/Button.js +83 -0
  75. package/dist/components/ui/Calendar.d.ts +3 -4
  76. package/dist/components/ui/Calendar.js +344 -0
  77. package/dist/components/ui/CalendarGrid.d.ts +3 -4
  78. package/dist/components/ui/CalendarGrid.js +136 -0
  79. package/dist/components/ui/Card.d.ts +6 -6
  80. package/dist/components/ui/Card.js +53 -0
  81. package/dist/components/ui/CharacterCount.d.ts +3 -4
  82. package/dist/components/ui/CharacterCount.js +27 -0
  83. package/dist/components/ui/Checkbox.d.ts +10 -9
  84. package/dist/components/ui/Checkbox.js +52 -0
  85. package/dist/components/ui/CodeInput.d.ts +7 -5
  86. package/dist/components/ui/CodeInput.js +96 -0
  87. package/dist/components/ui/Combobox.d.ts +8 -7
  88. package/dist/components/ui/Combobox.js +213 -0
  89. package/dist/components/ui/CopyButton.d.ts +6 -2
  90. package/dist/components/ui/CopyButton.js +57 -0
  91. package/dist/components/ui/DangerZone.d.ts +3 -5
  92. package/dist/components/ui/DangerZone.js +23 -0
  93. package/dist/components/ui/DatePartsInput.d.ts +6 -5
  94. package/dist/components/ui/DatePartsInput.js +138 -0
  95. package/dist/components/ui/DatePicker.d.ts +9 -5
  96. package/dist/components/ui/DatePicker.js +84 -0
  97. package/dist/components/ui/DateRangePicker.d.ts +7 -6
  98. package/dist/components/ui/DateRangePicker.js +143 -0
  99. package/dist/components/ui/DateTimePicker.d.ts +7 -5
  100. package/dist/components/ui/DateTimePicker.js +267 -0
  101. package/dist/components/ui/DetailPanel.d.ts +3 -4
  102. package/dist/components/ui/DetailPanel.js +183 -0
  103. package/dist/components/ui/Dialog.d.ts +3 -4
  104. package/dist/components/ui/Dialog.js +411 -0
  105. package/dist/components/ui/DialogActions.d.ts +3 -4
  106. package/dist/components/ui/DialogActions.js +35 -0
  107. package/dist/components/ui/Disclosure.d.ts +7 -4
  108. package/dist/components/ui/Disclosure.js +45 -0
  109. package/dist/components/ui/DividerLabel.d.ts +3 -4
  110. package/dist/components/ui/DividerLabel.js +20 -0
  111. package/dist/components/ui/DropdownMenu.d.ts +4 -5
  112. package/dist/components/ui/DropdownMenu.js +229 -0
  113. package/dist/components/ui/EmptyState.d.ts +3 -5
  114. package/dist/components/ui/EmptyState.js +31 -0
  115. package/dist/components/ui/ErrorBoundary.d.ts +3 -3
  116. package/dist/components/ui/ErrorBoundary.js +46 -0
  117. package/dist/components/ui/FieldContext.d.ts +0 -1
  118. package/dist/components/ui/FieldContext.js +8 -0
  119. package/dist/components/ui/Fieldset.d.ts +2 -3
  120. package/dist/components/ui/Fieldset.js +39 -0
  121. package/dist/components/ui/FilterButton.d.ts +4 -9
  122. package/dist/components/ui/FilterButton.js +17 -0
  123. package/dist/components/ui/FilterDropdown.d.ts +4 -6
  124. package/dist/components/ui/FilterDropdown.js +18 -0
  125. package/dist/components/ui/FormField.d.ts +4 -5
  126. package/dist/components/ui/FormField.js +68 -0
  127. package/dist/components/ui/Grid.d.ts +1 -2
  128. package/dist/components/ui/Grid.js +19 -0
  129. package/dist/components/ui/GridItem.d.ts +1 -2
  130. package/dist/components/ui/GridItem.js +16 -0
  131. package/dist/components/ui/Inline.d.ts +1 -2
  132. package/dist/components/ui/Inline.js +24 -0
  133. package/dist/components/ui/Kbd.d.ts +3 -4
  134. package/dist/components/ui/Kbd.js +13 -0
  135. package/dist/components/ui/ListItemLink.d.ts +3 -4
  136. package/dist/components/ui/ListItemLink.js +44 -0
  137. package/dist/components/ui/LoadingSpinner.d.ts +5 -5
  138. package/dist/components/ui/LoadingSpinner.js +19 -0
  139. package/dist/components/ui/MessageBubble.d.ts +5 -3
  140. package/dist/components/ui/MessageBubble.js +41 -0
  141. package/dist/components/ui/MetadataGrid.d.ts +5 -4
  142. package/dist/components/ui/MetadataGrid.js +76 -0
  143. package/dist/components/ui/MetricCard.d.ts +3 -4
  144. package/dist/components/ui/MetricCard.js +51 -0
  145. package/dist/components/ui/NavTabs.d.ts +2 -3
  146. package/dist/components/ui/NavTabs.js +29 -0
  147. package/dist/components/ui/OAuthButton.d.ts +2 -3
  148. package/dist/components/ui/OAuthButton.js +55 -0
  149. package/dist/components/ui/OverlineLabel.d.ts +3 -4
  150. package/dist/components/ui/OverlineLabel.js +13 -0
  151. package/dist/components/ui/PageHeader.d.ts +3 -4
  152. package/dist/components/ui/PageHeader.js +33 -0
  153. package/dist/components/ui/PageSection.d.ts +3 -4
  154. package/dist/components/ui/PageSection.js +31 -0
  155. package/dist/components/ui/PaginationBar.d.ts +3 -4
  156. package/dist/components/ui/PaginationBar.js +62 -0
  157. package/dist/components/ui/PasswordInput.d.ts +3 -5
  158. package/dist/components/ui/PasswordInput.js +62 -0
  159. package/dist/components/ui/PasswordRequirements.d.ts +3 -3
  160. package/dist/components/ui/PasswordRequirements.js +34 -0
  161. package/dist/components/ui/Popover.d.ts +5 -4
  162. package/dist/components/ui/Popover.js +53 -0
  163. package/dist/components/ui/ProfileHeader.d.ts +3 -4
  164. package/dist/components/ui/ProfileHeader.js +54 -0
  165. package/dist/components/ui/ProgressBar.d.ts +3 -4
  166. package/dist/components/ui/ProgressBar.js +42 -0
  167. package/dist/components/ui/ProseContent.d.ts +3 -4
  168. package/dist/components/ui/ProseContent.js +13 -0
  169. package/dist/components/ui/QrCode.d.ts +3 -4
  170. package/dist/components/ui/QrCode.js +47 -0
  171. package/dist/components/ui/Radio.d.ts +9 -7
  172. package/dist/components/ui/Radio.js +58 -0
  173. package/dist/components/ui/RadioPill.d.ts +10 -8
  174. package/dist/components/ui/RadioPill.js +53 -0
  175. package/dist/components/ui/ReorderList.d.ts +3 -4
  176. package/dist/components/ui/ReorderList.js +123 -0
  177. package/dist/components/ui/SearchInput.d.ts +7 -6
  178. package/dist/components/ui/SearchInput.js +49 -0
  179. package/dist/components/ui/SectionHeader.d.ts +3 -5
  180. package/dist/components/ui/SectionHeader.js +13 -0
  181. package/dist/components/ui/Select.d.ts +4 -6
  182. package/dist/components/ui/Select.js +117 -0
  183. package/dist/components/ui/SelectDropdown.d.ts +10 -6
  184. package/dist/components/ui/SelectDropdown.js +206 -0
  185. package/dist/components/ui/SettingRow.d.ts +5 -7
  186. package/dist/components/ui/SettingRow.js +25 -0
  187. package/dist/components/ui/SideSheet.d.ts +3 -4
  188. package/dist/components/ui/SideSheet.js +164 -0
  189. package/dist/components/ui/Skeleton.d.ts +3 -4
  190. package/dist/components/ui/Skeleton.js +18 -0
  191. package/dist/components/ui/Slider.d.ts +11 -7
  192. package/dist/components/ui/Slider.js +58 -0
  193. package/dist/components/ui/SplitPaneLayout.d.ts +6 -6
  194. package/dist/components/ui/SplitPaneLayout.js +22 -0
  195. package/dist/components/ui/Stack.d.ts +1 -2
  196. package/dist/components/ui/Stack.js +18 -0
  197. package/dist/components/ui/StatusDot.d.ts +3 -3
  198. package/dist/components/ui/StatusDot.js +24 -0
  199. package/dist/components/ui/StepProgress.d.ts +3 -3
  200. package/dist/components/ui/StepProgress.js +33 -0
  201. package/dist/components/ui/Tabs.d.ts +5 -6
  202. package/dist/components/ui/Tabs.js +63 -0
  203. package/dist/components/ui/TextInput.d.ts +3 -5
  204. package/dist/components/ui/TextInput.js +57 -0
  205. package/dist/components/ui/Textarea.d.ts +3 -5
  206. package/dist/components/ui/Textarea.js +59 -0
  207. package/dist/components/ui/ThemePreview.d.ts +3 -4
  208. package/dist/components/ui/ThemePreview.js +28 -0
  209. package/dist/components/ui/TimeInput.d.ts +7 -7
  210. package/dist/components/ui/TimeInput.js +22 -0
  211. package/dist/components/ui/Timeline.d.ts +3 -3
  212. package/dist/components/ui/Timeline.js +29 -0
  213. package/dist/components/ui/Toast.d.ts +0 -1
  214. package/dist/components/ui/Toast.js +121 -0
  215. package/dist/components/ui/Toggle.d.ts +10 -5
  216. package/dist/components/ui/Toggle.js +34 -0
  217. package/dist/components/ui/Toolbar.d.ts +3 -4
  218. package/dist/components/ui/Toolbar.js +70 -0
  219. package/dist/components/ui/Tooltip.d.ts +0 -1
  220. package/dist/components/ui/Tooltip.js +91 -0
  221. package/dist/components/ui/TranscriptLine.d.ts +5 -4
  222. package/dist/components/ui/TranscriptLine.js +40 -0
  223. package/dist/components/ui/UploadDropzone.d.ts +3 -6
  224. package/dist/components/ui/UploadDropzone.js +55 -0
  225. package/dist/components/ui/badgeColors.d.ts +0 -1
  226. package/dist/components/ui/badgeColors.js +5 -0
  227. package/dist/components/ui/calendar/AgendaView.d.ts +0 -1
  228. package/dist/components/ui/calendar/AgendaView.js +140 -0
  229. package/dist/components/ui/calendar/MonthView.d.ts +0 -1
  230. package/dist/components/ui/calendar/MonthView.js +321 -0
  231. package/dist/components/ui/calendar/TimeGrid.d.ts +0 -1
  232. package/dist/components/ui/calendar/TimeGrid.js +501 -0
  233. package/dist/components/ui/calendar/TimelineView.d.ts +0 -1
  234. package/dist/components/ui/calendar/TimelineView.js +311 -0
  235. package/dist/components/ui/calendar/context.d.ts +0 -1
  236. package/dist/components/ui/calendar/context.js +10 -0
  237. package/dist/components/ui/calendar/items.d.ts +0 -1
  238. package/dist/components/ui/calendar/items.js +152 -0
  239. package/dist/components/ui/calendar/types.d.ts +0 -1
  240. package/dist/components/ui/calendar/types.js +38 -0
  241. package/dist/components/ui/calendar/useGridInteraction.d.ts +0 -1
  242. package/dist/components/ui/calendar/useGridInteraction.js +393 -0
  243. package/dist/components/ui/useFieldControl.d.ts +1 -2
  244. package/dist/components/ui/useFieldControl.js +17 -0
  245. package/dist/config/theme.d.ts +0 -1
  246. package/dist/config/theme.js +219 -0
  247. package/dist/core.css +2933 -0
  248. package/dist/hooks/useAnchoredPopup.d.ts +0 -1
  249. package/dist/hooks/useAnchoredPopup.js +162 -0
  250. package/dist/hooks/useApplyTheme.d.ts +0 -1
  251. package/dist/hooks/useApplyTheme.js +16 -0
  252. package/dist/hooks/useControllableState.d.ts +14 -0
  253. package/dist/hooks/useControllableState.js +10 -0
  254. package/dist/hooks/useDismiss.d.ts +0 -1
  255. package/dist/hooks/useDismiss.js +24 -0
  256. package/dist/hooks/useFocusTrap.d.ts +0 -1
  257. package/dist/hooks/useFocusTrap.js +42 -0
  258. package/dist/hooks/useOverlayStack.d.ts +0 -1
  259. package/dist/hooks/useOverlayStack.js +23 -0
  260. package/dist/hooks/usePopover.d.ts +0 -1
  261. package/dist/hooks/usePopover.js +47 -0
  262. package/dist/hooks/usePortalContainer.d.ts +0 -1
  263. package/dist/hooks/usePortalContainer.js +14 -0
  264. package/dist/hooks/useSettings.d.ts +0 -1
  265. package/dist/hooks/useSettings.js +8 -0
  266. package/dist/hooks/useTheme.d.ts +0 -1
  267. package/dist/hooks/useTheme.js +8 -0
  268. package/dist/hooks/useTypeahead.d.ts +0 -1
  269. package/dist/hooks/useTypeahead.js +19 -0
  270. package/dist/index.d.ts +0 -1
  271. package/dist/index.js +133 -12866
  272. package/dist/lib/anchorPlacement.d.ts +0 -1
  273. package/dist/lib/anchorPlacement.js +75 -0
  274. package/dist/lib/calendar.d.ts +0 -1
  275. package/dist/lib/calendar.js +666 -0
  276. package/dist/lib/cn.d.ts +0 -1
  277. package/dist/lib/cn.js +228 -0
  278. package/dist/lib/codeInput.d.ts +0 -1
  279. package/dist/lib/codeInput.js +51 -0
  280. package/dist/lib/dateParts.d.ts +0 -1
  281. package/dist/lib/dateParts.js +31 -0
  282. package/dist/lib/dialogDrag.d.ts +0 -1
  283. package/dist/lib/dialogDrag.js +45 -0
  284. package/dist/lib/dialogResize.d.ts +0 -1
  285. package/dist/lib/dialogResize.js +47 -0
  286. package/dist/lib/formatDate.d.ts +0 -1
  287. package/dist/lib/formatDate.js +29 -0
  288. package/dist/lib/formatMediaTime.d.ts +0 -1
  289. package/dist/lib/formatMediaTime.js +7 -0
  290. package/dist/lib/keyboardStep.d.ts +0 -1
  291. package/dist/lib/layout.d.ts +0 -1
  292. package/dist/lib/layout.js +29 -0
  293. package/dist/lib/math.d.ts +0 -1
  294. package/dist/lib/math.js +6 -0
  295. package/dist/lib/mergeRefs.d.ts +6 -0
  296. package/dist/lib/mergeRefs.js +17 -0
  297. package/dist/lib/months.d.ts +0 -1
  298. package/dist/lib/months.js +30 -0
  299. package/dist/lib/overlayStack.d.ts +0 -1
  300. package/dist/lib/overlayStack.js +47 -0
  301. package/dist/lib/panelResize.d.ts +0 -1
  302. package/dist/lib/panelResize.js +8 -0
  303. package/dist/lib/passwordRequirements.d.ts +0 -1
  304. package/dist/lib/passwordRequirements.js +23 -0
  305. package/dist/lib/qrCode.d.ts +0 -1
  306. package/dist/lib/qrCode.js +570 -0
  307. package/dist/lib/rect.d.ts +0 -1
  308. package/dist/lib/tones.d.ts +0 -1
  309. package/dist/lib/tones.js +104 -0
  310. package/dist/lib/typeahead.d.ts +0 -1
  311. package/dist/lib/typeahead.js +31 -0
  312. package/dist/providers/ControlSizeContext.d.ts +0 -1
  313. package/dist/providers/ControlSizeContext.js +9 -0
  314. package/dist/providers/ControlSizeProvider.d.ts +0 -1
  315. package/dist/providers/ControlSizeProvider.js +11 -0
  316. package/dist/providers/SettingsContext.d.ts +0 -1
  317. package/dist/providers/SettingsContext.js +53 -0
  318. package/dist/providers/SettingsProvider.d.ts +0 -1
  319. package/dist/providers/SettingsProvider.js +249 -0
  320. package/dist/providers/ThemeContext.d.ts +0 -1
  321. package/dist/providers/ThemeContext.js +5 -0
  322. package/dist/providers/ThemeProvider.d.ts +0 -1
  323. package/dist/providers/ThemeProvider.js +17 -0
  324. package/dist/providers/accentColors.d.ts +0 -1
  325. package/dist/providers/accentColors.js +75 -0
  326. package/dist/providers/themeClasses.d.ts +1 -1
  327. package/dist/providers/themeClasses.js +20 -0
  328. package/dist/styles.css +263 -176
  329. package/dist/themes/cyber-brutal-dark.css +53 -0
  330. package/dist/themes/cyber-brutal-light.css +75 -0
  331. package/dist/themes/glass-dark.css +217 -0
  332. package/dist/themes/glass-light.css +215 -0
  333. package/dist/themes/hashi.css +66 -0
  334. package/dist/themes/light-inverted.css +32 -0
  335. package/dist/themes/light.css +1 -0
  336. package/dist/themes/monokai.css +51 -0
  337. package/dist/themes/solarized.css +55 -0
  338. package/package.json +3 -1
  339. package/dist/components/app-shell/AppShell.d.ts.map +0 -1
  340. package/dist/components/app-shell/AuthLayout.d.ts.map +0 -1
  341. package/dist/components/app-shell/BackLink.d.ts.map +0 -1
  342. package/dist/components/app-shell/BottomNav.d.ts.map +0 -1
  343. package/dist/components/app-shell/Breadcrumbs.d.ts.map +0 -1
  344. package/dist/components/app-shell/CommandPalette.d.ts.map +0 -1
  345. package/dist/components/app-shell/MobileDrawer.d.ts.map +0 -1
  346. package/dist/components/app-shell/Sidebar.d.ts.map +0 -1
  347. package/dist/components/app-shell/ThemeMenu.d.ts.map +0 -1
  348. package/dist/components/app-shell/TopBar.d.ts.map +0 -1
  349. package/dist/components/app-shell/commandPaletteEvents.d.ts.map +0 -1
  350. package/dist/components/app-shell/navigation.d.ts.map +0 -1
  351. package/dist/components/app-shell/themeMenuEvents.d.ts.map +0 -1
  352. package/dist/components/app-shell/types.d.ts.map +0 -1
  353. package/dist/components/charts/AreaChart.d.ts.map +0 -1
  354. package/dist/components/charts/BarChart.d.ts.map +0 -1
  355. package/dist/components/charts/DonutChart.d.ts.map +0 -1
  356. package/dist/components/charts/RadarChart.d.ts.map +0 -1
  357. package/dist/components/charts/RadialBarChart.d.ts.map +0 -1
  358. package/dist/components/charts/SparkLine.d.ts.map +0 -1
  359. package/dist/components/charts/StackedBarChart.d.ts.map +0 -1
  360. package/dist/components/charts/VerticalBarChart.d.ts.map +0 -1
  361. package/dist/components/charts/chartUtils.d.ts.map +0 -1
  362. package/dist/components/tables/ColumnPicker.d.ts.map +0 -1
  363. package/dist/components/tables/Pagination.d.ts.map +0 -1
  364. package/dist/components/tables/ResourceTable.d.ts.map +0 -1
  365. package/dist/components/tables/Table.d.ts.map +0 -1
  366. package/dist/components/tables/sortRows.d.ts.map +0 -1
  367. package/dist/components/ui/Accordion.d.ts.map +0 -1
  368. package/dist/components/ui/Alert.d.ts.map +0 -1
  369. package/dist/components/ui/AttachmentList.d.ts.map +0 -1
  370. package/dist/components/ui/AudioPlayer.d.ts.map +0 -1
  371. package/dist/components/ui/AuthCard.d.ts.map +0 -1
  372. package/dist/components/ui/AuthorByline.d.ts.map +0 -1
  373. package/dist/components/ui/Avatar.d.ts.map +0 -1
  374. package/dist/components/ui/Badge.d.ts.map +0 -1
  375. package/dist/components/ui/Button.d.ts.map +0 -1
  376. package/dist/components/ui/Calendar.d.ts.map +0 -1
  377. package/dist/components/ui/CalendarGrid.d.ts.map +0 -1
  378. package/dist/components/ui/Card.d.ts.map +0 -1
  379. package/dist/components/ui/CharacterCount.d.ts.map +0 -1
  380. package/dist/components/ui/Checkbox.d.ts.map +0 -1
  381. package/dist/components/ui/CodeInput.d.ts.map +0 -1
  382. package/dist/components/ui/Combobox.d.ts.map +0 -1
  383. package/dist/components/ui/CopyButton.d.ts.map +0 -1
  384. package/dist/components/ui/DangerZone.d.ts.map +0 -1
  385. package/dist/components/ui/DatePartsInput.d.ts.map +0 -1
  386. package/dist/components/ui/DatePicker.d.ts.map +0 -1
  387. package/dist/components/ui/DateRangePicker.d.ts.map +0 -1
  388. package/dist/components/ui/DateTimePicker.d.ts.map +0 -1
  389. package/dist/components/ui/DetailPanel.d.ts.map +0 -1
  390. package/dist/components/ui/Dialog.d.ts.map +0 -1
  391. package/dist/components/ui/DialogActions.d.ts.map +0 -1
  392. package/dist/components/ui/Disclosure.d.ts.map +0 -1
  393. package/dist/components/ui/DividerLabel.d.ts.map +0 -1
  394. package/dist/components/ui/DropdownMenu.d.ts.map +0 -1
  395. package/dist/components/ui/EmptyState.d.ts.map +0 -1
  396. package/dist/components/ui/ErrorBoundary.d.ts.map +0 -1
  397. package/dist/components/ui/FieldContext.d.ts.map +0 -1
  398. package/dist/components/ui/Fieldset.d.ts.map +0 -1
  399. package/dist/components/ui/FilterButton.d.ts.map +0 -1
  400. package/dist/components/ui/FilterDropdown.d.ts.map +0 -1
  401. package/dist/components/ui/FormField.d.ts.map +0 -1
  402. package/dist/components/ui/Grid.d.ts.map +0 -1
  403. package/dist/components/ui/GridItem.d.ts.map +0 -1
  404. package/dist/components/ui/Inline.d.ts.map +0 -1
  405. package/dist/components/ui/Kbd.d.ts.map +0 -1
  406. package/dist/components/ui/ListItemLink.d.ts.map +0 -1
  407. package/dist/components/ui/LoadingSpinner.d.ts.map +0 -1
  408. package/dist/components/ui/MessageBubble.d.ts.map +0 -1
  409. package/dist/components/ui/MetadataGrid.d.ts.map +0 -1
  410. package/dist/components/ui/MetricCard.d.ts.map +0 -1
  411. package/dist/components/ui/NavTabs.d.ts.map +0 -1
  412. package/dist/components/ui/OAuthButton.d.ts.map +0 -1
  413. package/dist/components/ui/OverlineLabel.d.ts.map +0 -1
  414. package/dist/components/ui/PageHeader.d.ts.map +0 -1
  415. package/dist/components/ui/PageSection.d.ts.map +0 -1
  416. package/dist/components/ui/PaginationBar.d.ts.map +0 -1
  417. package/dist/components/ui/PasswordInput.d.ts.map +0 -1
  418. package/dist/components/ui/PasswordRequirements.d.ts.map +0 -1
  419. package/dist/components/ui/Popover.d.ts.map +0 -1
  420. package/dist/components/ui/ProfileHeader.d.ts.map +0 -1
  421. package/dist/components/ui/ProgressBar.d.ts.map +0 -1
  422. package/dist/components/ui/ProseContent.d.ts.map +0 -1
  423. package/dist/components/ui/QrCode.d.ts.map +0 -1
  424. package/dist/components/ui/Radio.d.ts.map +0 -1
  425. package/dist/components/ui/RadioPill.d.ts.map +0 -1
  426. package/dist/components/ui/ReorderList.d.ts.map +0 -1
  427. package/dist/components/ui/SearchInput.d.ts.map +0 -1
  428. package/dist/components/ui/SectionHeader.d.ts.map +0 -1
  429. package/dist/components/ui/Select.d.ts.map +0 -1
  430. package/dist/components/ui/SelectDropdown.d.ts.map +0 -1
  431. package/dist/components/ui/SettingRow.d.ts.map +0 -1
  432. package/dist/components/ui/SideSheet.d.ts.map +0 -1
  433. package/dist/components/ui/Skeleton.d.ts.map +0 -1
  434. package/dist/components/ui/Slider.d.ts.map +0 -1
  435. package/dist/components/ui/SplitPaneLayout.d.ts.map +0 -1
  436. package/dist/components/ui/Stack.d.ts.map +0 -1
  437. package/dist/components/ui/StatusDot.d.ts.map +0 -1
  438. package/dist/components/ui/StepProgress.d.ts.map +0 -1
  439. package/dist/components/ui/Tabs.d.ts.map +0 -1
  440. package/dist/components/ui/TextInput.d.ts.map +0 -1
  441. package/dist/components/ui/Textarea.d.ts.map +0 -1
  442. package/dist/components/ui/ThemePreview.d.ts.map +0 -1
  443. package/dist/components/ui/TimeInput.d.ts.map +0 -1
  444. package/dist/components/ui/Timeline.d.ts.map +0 -1
  445. package/dist/components/ui/Toast.d.ts.map +0 -1
  446. package/dist/components/ui/Toggle.d.ts.map +0 -1
  447. package/dist/components/ui/Toolbar.d.ts.map +0 -1
  448. package/dist/components/ui/Tooltip.d.ts.map +0 -1
  449. package/dist/components/ui/TranscriptLine.d.ts.map +0 -1
  450. package/dist/components/ui/UploadDropzone.d.ts.map +0 -1
  451. package/dist/components/ui/badgeColors.d.ts.map +0 -1
  452. package/dist/components/ui/calendar/AgendaView.d.ts.map +0 -1
  453. package/dist/components/ui/calendar/MonthView.d.ts.map +0 -1
  454. package/dist/components/ui/calendar/TimeGrid.d.ts.map +0 -1
  455. package/dist/components/ui/calendar/TimelineView.d.ts.map +0 -1
  456. package/dist/components/ui/calendar/context.d.ts.map +0 -1
  457. package/dist/components/ui/calendar/items.d.ts.map +0 -1
  458. package/dist/components/ui/calendar/types.d.ts.map +0 -1
  459. package/dist/components/ui/calendar/useGridInteraction.d.ts.map +0 -1
  460. package/dist/components/ui/useFieldControl.d.ts.map +0 -1
  461. package/dist/config/theme.d.ts.map +0 -1
  462. package/dist/hooks/useAnchoredPopup.d.ts.map +0 -1
  463. package/dist/hooks/useApplyTheme.d.ts.map +0 -1
  464. package/dist/hooks/useDismiss.d.ts.map +0 -1
  465. package/dist/hooks/useFocusTrap.d.ts.map +0 -1
  466. package/dist/hooks/useOverlayStack.d.ts.map +0 -1
  467. package/dist/hooks/usePopover.d.ts.map +0 -1
  468. package/dist/hooks/usePortalContainer.d.ts.map +0 -1
  469. package/dist/hooks/useSettings.d.ts.map +0 -1
  470. package/dist/hooks/useTheme.d.ts.map +0 -1
  471. package/dist/hooks/useTypeahead.d.ts.map +0 -1
  472. package/dist/index.d.ts.map +0 -1
  473. package/dist/lib/anchorPlacement.d.ts.map +0 -1
  474. package/dist/lib/calendar.d.ts.map +0 -1
  475. package/dist/lib/cn.d.ts.map +0 -1
  476. package/dist/lib/codeInput.d.ts.map +0 -1
  477. package/dist/lib/dateParts.d.ts.map +0 -1
  478. package/dist/lib/dialogDrag.d.ts.map +0 -1
  479. package/dist/lib/dialogResize.d.ts.map +0 -1
  480. package/dist/lib/formatDate.d.ts.map +0 -1
  481. package/dist/lib/formatMediaTime.d.ts.map +0 -1
  482. package/dist/lib/keyboardStep.d.ts.map +0 -1
  483. package/dist/lib/layout.d.ts.map +0 -1
  484. package/dist/lib/math.d.ts.map +0 -1
  485. package/dist/lib/months.d.ts.map +0 -1
  486. package/dist/lib/overlayStack.d.ts.map +0 -1
  487. package/dist/lib/panelResize.d.ts.map +0 -1
  488. package/dist/lib/passwordRequirements.d.ts.map +0 -1
  489. package/dist/lib/qrCode.d.ts.map +0 -1
  490. package/dist/lib/rect.d.ts.map +0 -1
  491. package/dist/lib/tones.d.ts.map +0 -1
  492. package/dist/lib/typeahead.d.ts.map +0 -1
  493. package/dist/providers/ControlSizeContext.d.ts.map +0 -1
  494. package/dist/providers/ControlSizeProvider.d.ts.map +0 -1
  495. package/dist/providers/SettingsContext.d.ts.map +0 -1
  496. package/dist/providers/SettingsProvider.d.ts.map +0 -1
  497. package/dist/providers/ThemeContext.d.ts.map +0 -1
  498. package/dist/providers/ThemeProvider.d.ts.map +0 -1
  499. package/dist/providers/accentColors.d.ts.map +0 -1
  500. package/dist/providers/themeClasses.d.ts.map +0 -1
@@ -0,0 +1,217 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { mergeRefs as t } from "../../lib/mergeRefs.js";
3
+ import { estimateTooltipWidth as n, formatCompactValue as r, getLabelIndices as i, getSvgTooltipPosition as a } from "./chartUtils.js";
4
+ import { useId as o, useMemo as s, useRef as c, useState as l } from "react";
5
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
6
+ //#region src/components/charts/AreaChart.tsx
7
+ var p = {
8
+ top: 16,
9
+ right: 12,
10
+ bottom: 28,
11
+ left: 48
12
+ }, m = 600;
13
+ function h(e) {
14
+ return e === 0 ? 1 : Math.max(Math.abs(e) * .02, 1);
15
+ }
16
+ function g({ data: g, height: _ = 240, minValue: v, maxValue: y, startAtZero: b = !1, valueFormatter: x, tooltipValueFormatter: S, xLabelCount: C = 5, "aria-label": w = "Area chart", className: T, onPointerMove: E, onPointerLeave: D, ref: O, ...k }) {
17
+ let A = o(), j = c(null), M = s(() => t(j, O), [O]), [N, P] = l(null), F = Math.max(p.top + p.bottom + 1, _), I = m - p.left - p.right, L = Math.max(1, F - p.top - p.bottom), R = g.length > 0, z = g[0]?.value ?? 0, B = g[0]?.value ?? 0;
18
+ for (let e of g) e.value < z && (z = e.value), e.value > B && (B = e.value);
19
+ let V = v ?? z, H = y ?? B;
20
+ if (b && v === void 0 && z >= 0 && (V = 0), V === H) {
21
+ if (b || v !== void 0 || y !== void 0) {
22
+ let e = h(B);
23
+ v === void 0 && (V = b && z >= 0 ? 0 : z >= 0 ? Math.max(0, z - e) : z - e), y === void 0 && (H = B + e);
24
+ }
25
+ V === H && (H = V + 1);
26
+ }
27
+ let U = H - V, W = x ?? r, G = S ?? x ?? ((e) => e.toLocaleString());
28
+ function K(e) {
29
+ return p.left + e / Math.max(g.length - 1, 1) * I;
30
+ }
31
+ function q(e) {
32
+ return p.top + L - (e - V) / U * L;
33
+ }
34
+ let J = g.map((e, t) => `${K(t)},${q(e.value)}`).join(" "), Y = R ? [
35
+ `${K(0)},${p.top + L}`,
36
+ ...g.map((e, t) => `${K(t)},${q(e.value)}`),
37
+ `${K(g.length - 1)},${p.top + L}`
38
+ ].join(" ") : "", X = i(g.length, C);
39
+ function Z(e) {
40
+ let t = j.current;
41
+ if (!t || g.length === 0) return;
42
+ let n = t.getBoundingClientRect();
43
+ if (n.width <= 0) return;
44
+ let r = ((e.clientX - n.left) / n.width * m - p.left) / I, i = Math.round(r * (g.length - 1)), a = Math.max(0, Math.min(g.length - 1, i));
45
+ P({
46
+ x: K(a),
47
+ y: q(g[a].value),
48
+ index: a
49
+ });
50
+ }
51
+ function Q(e) {
52
+ P({
53
+ x: K(e),
54
+ y: q(g[e].value),
55
+ index: e
56
+ });
57
+ }
58
+ function $() {
59
+ P(null);
60
+ }
61
+ return /* @__PURE__ */ f("svg", {
62
+ ...k,
63
+ ref: M,
64
+ width: "100%",
65
+ viewBox: `0 0 ${m} ${F}`,
66
+ onPointerMove: (e) => {
67
+ E?.(e), !e.defaultPrevented && Z(e);
68
+ },
69
+ onPointerLeave: (e) => {
70
+ D?.(e), !e.defaultPrevented && $();
71
+ },
72
+ className: e("select-none", T),
73
+ role: "img",
74
+ "aria-label": w,
75
+ children: [
76
+ /* @__PURE__ */ d("defs", { children: /* @__PURE__ */ f("linearGradient", {
77
+ id: A,
78
+ x1: "0",
79
+ y1: "0",
80
+ x2: "0",
81
+ y2: "1",
82
+ children: [/* @__PURE__ */ d("stop", {
83
+ offset: "0%",
84
+ stopColor: "var(--accent)",
85
+ stopOpacity: .3
86
+ }), /* @__PURE__ */ d("stop", {
87
+ offset: "100%",
88
+ stopColor: "var(--accent)",
89
+ stopOpacity: 0
90
+ })]
91
+ }) }),
92
+ /* @__PURE__ */ d("text", {
93
+ x: p.left - 8,
94
+ y: p.top,
95
+ textAnchor: "end",
96
+ dominantBaseline: "central",
97
+ fill: "var(--text-tertiary)",
98
+ fontSize: 10,
99
+ children: W(H)
100
+ }),
101
+ /* @__PURE__ */ d("text", {
102
+ x: p.left - 8,
103
+ y: p.top + L,
104
+ textAnchor: "end",
105
+ dominantBaseline: "central",
106
+ fill: "var(--text-tertiary)",
107
+ fontSize: 10,
108
+ children: W(V)
109
+ }),
110
+ /* @__PURE__ */ d("line", {
111
+ x1: p.left,
112
+ y1: p.top + L,
113
+ x2: p.left + I,
114
+ y2: p.top + L,
115
+ stroke: "var(--border)",
116
+ strokeWidth: 1
117
+ }),
118
+ R && /* @__PURE__ */ d("polygon", {
119
+ points: Y,
120
+ fill: `url(#${A})`
121
+ }),
122
+ R && /* @__PURE__ */ d("polyline", {
123
+ points: J,
124
+ fill: "none",
125
+ stroke: "var(--accent)",
126
+ strokeWidth: 2,
127
+ strokeLinecap: "round",
128
+ strokeLinejoin: "round"
129
+ }),
130
+ g.map((e, t) => /* @__PURE__ */ d("circle", {
131
+ cx: K(t),
132
+ cy: q(e.value),
133
+ r: 8,
134
+ fill: "transparent",
135
+ tabIndex: 0,
136
+ role: "button",
137
+ "aria-label": `${e.date}: ${G(e.value)}`,
138
+ onFocus: () => Q(t),
139
+ onBlur: $
140
+ }, `${e.date}-${t}-hit`)),
141
+ X.map((e) => /* @__PURE__ */ d("text", {
142
+ x: K(e),
143
+ y: F - 4,
144
+ textAnchor: "middle",
145
+ fill: "var(--text-tertiary)",
146
+ fontSize: 10,
147
+ children: g[e].date
148
+ }, `${g[e].date}-${e}`)),
149
+ N && /* @__PURE__ */ f(u, { children: [
150
+ /* @__PURE__ */ d("line", {
151
+ x1: N.x,
152
+ y1: p.top,
153
+ x2: N.x,
154
+ y2: p.top + L,
155
+ stroke: "var(--border-strong)",
156
+ strokeWidth: 1,
157
+ strokeDasharray: "3 3"
158
+ }),
159
+ /* @__PURE__ */ d("circle", {
160
+ cx: N.x,
161
+ cy: N.y,
162
+ r: 4,
163
+ fill: "var(--accent)",
164
+ stroke: "var(--bg-secondary)",
165
+ strokeWidth: 2
166
+ }),
167
+ (() => {
168
+ let e = g[N.index];
169
+ if (!e) return null;
170
+ let t = e.date, r = G(e.value), i = a(N.x, N.y, {
171
+ boundsHeight: F,
172
+ boundsWidth: m,
173
+ height: 28,
174
+ offset: 10,
175
+ width: n([t, r], {
176
+ maxWidth: 180,
177
+ minWidth: 90
178
+ })
179
+ }), o = i.x + i.width / 2;
180
+ return /* @__PURE__ */ f(u, { children: [
181
+ /* @__PURE__ */ d("rect", {
182
+ x: i.x,
183
+ y: i.y,
184
+ width: i.width,
185
+ height: i.height,
186
+ rx: 4,
187
+ fill: "var(--bg-tooltip, var(--bg-tertiary))",
188
+ stroke: "var(--border)",
189
+ strokeWidth: 1
190
+ }),
191
+ /* @__PURE__ */ d("text", {
192
+ x: o,
193
+ y: i.y + 10,
194
+ textAnchor: "middle",
195
+ dominantBaseline: "central",
196
+ fill: "var(--text-secondary)",
197
+ fontSize: 9,
198
+ children: t
199
+ }),
200
+ /* @__PURE__ */ d("text", {
201
+ x: o,
202
+ y: i.y + 22,
203
+ textAnchor: "middle",
204
+ dominantBaseline: "central",
205
+ fill: "var(--text-primary)",
206
+ fontSize: 11,
207
+ fontWeight: 600,
208
+ children: r
209
+ })
210
+ ] });
211
+ })()
212
+ ] })
213
+ ]
214
+ });
215
+ }
216
+ //#endregion
217
+ export { g as AreaChart };
@@ -1,8 +1,9 @@
1
+ import { type ComponentPropsWithRef } from "react";
1
2
  export interface BarChartDatum {
2
3
  label: string;
3
4
  value: number;
4
5
  }
5
- export interface BarChartProps {
6
+ export interface BarChartProps extends Omit<ComponentPropsWithRef<"svg">, "children" | "viewBox" | "width"> {
6
7
  /** Bars to draw top to bottom, each with a `label` and numeric `value`. */
7
8
  data: BarChartDatum[];
8
9
  /** Total chart height in SVG units; rows scale to fit. Defaults to the natural height from `barHeight` and `gap`. */
@@ -24,9 +25,8 @@ export interface BarChartProps {
24
25
  /** Natural gap between rows before the optional height prop scales the chart. */
25
26
  gap?: number;
26
27
  /** Accessible label for the chart. Defaults to "Horizontal bar chart". */
27
- ariaLabel?: string;
28
+ "aria-label"?: string;
28
29
  /** Extra classes for the `<svg>`. */
29
30
  className?: string;
30
31
  }
31
- export declare function BarChart({ data, height, maxValue, valueFormatter, labelFormatter, maxLabelLength, labelWidth, valueWidth, barHeight, gap, ariaLabel, className, }: BarChartProps): import("react/jsx-runtime").JSX.Element;
32
- //# sourceMappingURL=BarChart.d.ts.map
32
+ export declare function BarChart({ data, height, maxValue, valueFormatter, labelFormatter, maxLabelLength, labelWidth, valueWidth, barHeight, gap, "aria-label": ariaLabel, className, ref, ...rest }: BarChartProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { clamp as t } from "../../lib/math.js";
3
+ import { getPositiveValue as n, truncateChartLabel as r } from "./chartUtils.js";
4
+ import { useState as i } from "react";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ //#region src/components/charts/BarChart.tsx
7
+ var s = [
8
+ 1,
9
+ .85,
10
+ .7,
11
+ .55,
12
+ .45
13
+ ], c = 600;
14
+ function l({ data: l, height: u, maxValue: d, valueFormatter: f, labelFormatter: p, maxLabelLength: m, labelWidth: h = 160, valueWidth: g = 60, barHeight: _ = 28, gap: v = 10, "aria-label": y = "Horizontal bar chart", className: b, ref: x, ...S }) {
15
+ let [C, w] = i(null), T = l.length, E = Math.max(1, _), D = Math.max(0, v), O = T > 0 ? T * E + Math.max(0, T - 1) * D : E, k = Math.max(1, u ?? O), A = u === void 0 ? 1 : k / O, j = E * A, M = D * A, N = Math.min(3, j / 3), P = Math.max(0, j - N * 2), F = d === void 0 ? Math.max(...l.map((e) => n(e.value)), 1) : Math.max(n(d), 1), I = Math.max(0, h), L = Math.max(0, g), R = Math.max(0, c - I - L), z = f ?? ((e) => e.toLocaleString());
16
+ return /* @__PURE__ */ a("svg", {
17
+ ref: x,
18
+ ...S,
19
+ width: "100%",
20
+ viewBox: `0 0 ${c} ${k}`,
21
+ className: e("select-none", b),
22
+ role: "img",
23
+ "aria-label": y,
24
+ children: l.map((e, i) => {
25
+ let l = i * (j + M), u = F > 0 ? t(n(e.value), 0, F) / F * R : 0, d = C === i, f = p?.(e.label, e, i) ?? e.label, h = r(f, m), g = h !== f, _ = z(e.value);
26
+ return /* @__PURE__ */ o("g", {
27
+ onMouseEnter: () => w(i),
28
+ onMouseLeave: () => w(null),
29
+ onPointerEnter: () => w(i),
30
+ onPointerDown: () => w(i),
31
+ onPointerLeave: () => w(null),
32
+ onFocus: () => w(i),
33
+ onBlur: () => w(null),
34
+ className: "cursor-pointer",
35
+ tabIndex: 0,
36
+ role: "button",
37
+ "aria-label": `${f}: ${_}`,
38
+ children: [
39
+ /* @__PURE__ */ a("rect", {
40
+ x: 0,
41
+ y: l,
42
+ width: c,
43
+ height: j,
44
+ fill: "transparent"
45
+ }),
46
+ /* @__PURE__ */ o("text", {
47
+ x: 0,
48
+ y: l + j / 2,
49
+ dominantBaseline: "central",
50
+ fill: d ? "var(--text-primary)" : "var(--text-secondary)",
51
+ fontSize: 11,
52
+ fontWeight: d ? 600 : 400,
53
+ style: { transition: "all 150ms" },
54
+ children: [g && /* @__PURE__ */ a("title", { children: f }), h]
55
+ }),
56
+ /* @__PURE__ */ a("rect", {
57
+ x: I,
58
+ y: l + N,
59
+ width: R,
60
+ height: P,
61
+ fill: "var(--border)",
62
+ rx: 6,
63
+ opacity: .5
64
+ }),
65
+ /* @__PURE__ */ a("rect", {
66
+ x: I,
67
+ y: l + N,
68
+ width: u,
69
+ height: P,
70
+ fill: "var(--accent)",
71
+ rx: 6,
72
+ opacity: d ? 1 : s[i % s.length],
73
+ style: { transition: "all 150ms" }
74
+ }),
75
+ /* @__PURE__ */ a("text", {
76
+ x: c,
77
+ y: l + j / 2,
78
+ dominantBaseline: "central",
79
+ textAnchor: "end",
80
+ fill: "var(--text-primary)",
81
+ fontSize: 11,
82
+ fontWeight: 600,
83
+ children: _
84
+ })
85
+ ]
86
+ }, e.label);
87
+ })
88
+ });
89
+ }
90
+ //#endregion
91
+ export { l as BarChart };
@@ -1,9 +1,10 @@
1
+ import { type ComponentPropsWithRef } from "react";
1
2
  export interface DonutSegment {
2
3
  name: string;
3
4
  value: number;
4
5
  color: string;
5
6
  }
6
- export interface DonutChartProps {
7
+ export interface DonutChartProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
7
8
  /** Slices to draw; each has a `name`, `value`, and `color` (chart color token or any CSS color). Non-positive values draw nothing. */
8
9
  segments: DonutSegment[];
9
10
  /** Diameter of the donut in px. Defaults to 180. */
@@ -17,9 +18,8 @@ export interface DonutChartProps {
17
18
  /** Show the legend with each segment's value below the chart. Defaults to `true`. */
18
19
  showLegend?: boolean;
19
20
  /** Accessible label for the chart. Defaults to "Donut chart". */
20
- ariaLabel?: string;
21
+ "aria-label"?: string;
21
22
  /** Extra classes for the wrapper element. */
22
23
  className?: string;
23
24
  }
24
- export declare function DonutChart({ segments, size, strokeWidth, valueFormatter, percentageFormatter, showLegend, ariaLabel, className, }: DonutChartProps): import("react/jsx-runtime").JSX.Element;
25
- //# sourceMappingURL=DonutChart.d.ts.map
25
+ export declare function DonutChart({ segments, size, strokeWidth, valueFormatter, percentageFormatter, showLegend, "aria-label": ariaLabel, className, ref, ...rest }: DonutChartProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,172 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { estimateTooltipWidth as t, getFloatingTooltipStyle as n, getPositiveValue as r, resolveChartColor as i } from "./chartUtils.js";
3
+ import { useState as a } from "react";
4
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
+ //#region src/components/charts/DonutChart.tsx
6
+ function c(e, t) {
7
+ let n = e.reduce((e, t) => e + r(t.value), 0), i = 0;
8
+ return e.map((e) => {
9
+ let a = r(e.value), o = n > 0 ? a / n * t : 0, s = t - o, c = i / t * 360 - 90, l = c + o / t * 180, u = n > 0 ? a / n * 100 : 0;
10
+ return i += o, {
11
+ segment: e,
12
+ segmentLength: o,
13
+ dashOffset: s,
14
+ rotation: c,
15
+ midAngle: l,
16
+ percentage: u
17
+ };
18
+ });
19
+ }
20
+ function l({ segments: l, size: u = 180, strokeWidth: d = 28, valueFormatter: f, percentageFormatter: p, showLegend: m = !0, "aria-label": h = "Donut chart", className: g, ref: _, ...v }) {
21
+ let [y, b] = a(null), x = l.reduce((e, t) => e + r(t.value), 0), S = Math.max(1, u), C = Math.max(1, Math.min(d, S - 1)), w = Math.max(.5, (S - C) / 2), T = c(l, 2 * Math.PI * w), E = f ?? ((e) => e.toLocaleString()), D = p ?? ((e) => `${e.toFixed(1)}%`), O = S + 12, k = O / 2;
22
+ return /* @__PURE__ */ s("div", {
23
+ ref: _,
24
+ ...v,
25
+ className: e("flex flex-col items-center gap-4", g),
26
+ children: [/* @__PURE__ */ s("div", {
27
+ className: "relative",
28
+ children: [/* @__PURE__ */ s("svg", {
29
+ width: O,
30
+ height: O,
31
+ viewBox: `0 0 ${O} ${O}`,
32
+ className: "select-none",
33
+ onMouseLeave: () => b(null),
34
+ onPointerLeave: () => b(null),
35
+ role: "img",
36
+ "aria-label": h,
37
+ children: [
38
+ T.map((e, t) => /* @__PURE__ */ o("circle", {
39
+ cx: k,
40
+ cy: k,
41
+ r: w,
42
+ fill: "none",
43
+ stroke: "transparent",
44
+ strokeWidth: C + 12 + 8,
45
+ strokeDasharray: `${e.segmentLength} ${e.dashOffset}`,
46
+ strokeLinecap: "butt",
47
+ transform: `rotate(${e.rotation} ${k} ${k})`,
48
+ onMouseEnter: () => b(t),
49
+ onPointerEnter: () => b(t),
50
+ onPointerDown: () => b(t),
51
+ onFocus: () => b(t),
52
+ onBlur: () => b(null),
53
+ tabIndex: 0,
54
+ role: "button",
55
+ "aria-label": `${e.segment.name}: ${E(r(e.segment.value))} (${D(e.percentage)})`,
56
+ className: "cursor-pointer"
57
+ }, `hit-${e.segment.name}`)),
58
+ T.map((e, t) => {
59
+ let n = y === t, r = e.midAngle * Math.PI / 180, a = n ? Math.cos(r) * 6 : 0, s = n ? Math.sin(r) * 6 : 0;
60
+ return /* @__PURE__ */ o("circle", {
61
+ cx: k,
62
+ cy: k,
63
+ r: w,
64
+ fill: "none",
65
+ stroke: i(e.segment.color),
66
+ strokeWidth: n ? C + 4 : C,
67
+ strokeDasharray: `${e.segmentLength} ${e.dashOffset}`,
68
+ strokeLinecap: "butt",
69
+ transform: `translate(${a} ${s}) rotate(${e.rotation} ${k} ${k})`,
70
+ opacity: y !== null && !n ? .5 : 1,
71
+ style: { transition: "all 150ms ease-out" },
72
+ className: "pointer-events-none"
73
+ }, e.segment.name);
74
+ }),
75
+ /* @__PURE__ */ o("text", {
76
+ x: k,
77
+ y: k - 6,
78
+ textAnchor: "middle",
79
+ dominantBaseline: "central",
80
+ fill: "var(--text-primary)",
81
+ fontSize: 18,
82
+ fontWeight: 700,
83
+ className: "pointer-events-none",
84
+ children: E(y === null ? x : r(T[y].segment.value))
85
+ }),
86
+ /* @__PURE__ */ o("text", {
87
+ x: k,
88
+ y: k + 12,
89
+ textAnchor: "middle",
90
+ dominantBaseline: "central",
91
+ fill: "var(--text-tertiary)",
92
+ fontSize: 10,
93
+ className: "pointer-events-none",
94
+ children: y === null ? "Total" : T[y].segment.name
95
+ })
96
+ ]
97
+ }), y !== null && (() => {
98
+ let e = T[y], a = e.midAngle * Math.PI / 180, c = w + C / 2 + 20, l = k + Math.cos(a) * c, u = k + Math.sin(a) * c, d = i(e.segment.color), f = E(r(e.segment.value)), p = D(e.percentage);
99
+ return /* @__PURE__ */ o("div", {
100
+ className: "ui-glass ui-glass-popover bg-bg-tertiary border-border pointer-events-none absolute z-10 rounded-md border px-2.5 py-1.5 shadow-lg",
101
+ style: n({
102
+ anchorX: l,
103
+ anchorY: u,
104
+ boundsHeight: O,
105
+ boundsWidth: O,
106
+ height: 30,
107
+ margin: 4,
108
+ offset: 8,
109
+ width: t([`${e.segment.name} ${f} ${p}`], {
110
+ maxWidth: 220,
111
+ minWidth: 112
112
+ })
113
+ }),
114
+ children: /* @__PURE__ */ s("div", {
115
+ className: "flex items-center gap-2",
116
+ children: [
117
+ /* @__PURE__ */ o("span", {
118
+ className: "h-2 w-2 shrink-0 rounded-full",
119
+ style: { backgroundColor: d }
120
+ }),
121
+ /* @__PURE__ */ o("span", {
122
+ className: "text-text-secondary text-xs whitespace-nowrap",
123
+ children: e.segment.name
124
+ }),
125
+ /* @__PURE__ */ o("span", {
126
+ className: "text-text-primary text-xs font-semibold",
127
+ children: f
128
+ }),
129
+ /* @__PURE__ */ s("span", {
130
+ className: "text-text-tertiary text-2xs",
131
+ children: [
132
+ "(",
133
+ p,
134
+ ")"
135
+ ]
136
+ })
137
+ ]
138
+ })
139
+ });
140
+ })()]
141
+ }), m && /* @__PURE__ */ o("div", {
142
+ className: "relative z-0 flex flex-wrap justify-center gap-x-4 gap-y-1.5",
143
+ children: l.map((t, n) => /* @__PURE__ */ s("button", {
144
+ type: "button",
145
+ onMouseEnter: () => b(n),
146
+ onMouseLeave: () => b(null),
147
+ onPointerEnter: () => b(n),
148
+ onPointerDown: () => b(n),
149
+ onPointerLeave: () => b(null),
150
+ onFocus: () => b(n),
151
+ onBlur: () => b(null),
152
+ className: e("flex cursor-pointer items-center gap-1.5 transition-opacity duration-[100ms]", y !== null && y !== n && "opacity-50"),
153
+ children: [
154
+ /* @__PURE__ */ o("span", {
155
+ className: "h-2 w-2 rounded-full",
156
+ style: { backgroundColor: i(t.color) }
157
+ }),
158
+ /* @__PURE__ */ o("span", {
159
+ className: "text-text-secondary text-xs",
160
+ children: t.name
161
+ }),
162
+ /* @__PURE__ */ o("span", {
163
+ className: "text-text-primary text-xs font-semibold",
164
+ children: E(r(t.value))
165
+ })
166
+ ]
167
+ }, t.name))
168
+ })]
169
+ });
170
+ }
171
+ //#endregion
172
+ export { l as DonutChart };
@@ -1,8 +1,9 @@
1
+ import { type ComponentPropsWithRef } from "react";
1
2
  export interface RadarDataPoint {
2
3
  label: string;
3
4
  value: number;
4
5
  }
5
- export interface RadarChartProps {
6
+ export interface RadarChartProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
6
7
  /** Axes of the radar, each with a `label` and numeric `value`, drawn clockwise from the top. */
7
8
  data: RadarDataPoint[];
8
9
  /** Max value for the scale. Defaults to auto from data. */
@@ -20,9 +21,8 @@ export interface RadarChartProps {
20
21
  /** Format values shown on hover. Defaults to `String`. */
21
22
  valueFormatter?: (value: number) => string;
22
23
  /** Accessible label for the chart. Defaults to "Radar chart". */
23
- ariaLabel?: string;
24
+ "aria-label"?: string;
24
25
  /** Extra classes for the wrapper element. */
25
26
  className?: string;
26
27
  }
27
- export declare function RadarChart({ data, maxValue, size, rings, labelOffset, labelFormatter, maxLabelLength, valueFormatter, ariaLabel, className, }: RadarChartProps): import("react/jsx-runtime").JSX.Element;
28
- //# sourceMappingURL=RadarChart.d.ts.map
28
+ export declare function RadarChart({ data, maxValue, size, rings, labelOffset, labelFormatter, maxLabelLength, valueFormatter, "aria-label": ariaLabel, className, ref, ...rest }: RadarChartProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,142 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { clamp as t } from "../../lib/math.js";
3
+ import { getPositiveValue as n, truncateChartLabel as r } from "./chartUtils.js";
4
+ import { useState as i } from "react";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ //#region src/components/charts/RadarChart.tsx
7
+ function s({ data: s, maxValue: c, size: l = 240, rings: u = 4, labelOffset: d = 18, labelFormatter: f, maxLabelLength: p, valueFormatter: m, "aria-label": h = "Radar chart", className: g, ref: _, ...v }) {
8
+ let [y, b] = i(null), x = Math.max(80, l), S = Math.max(n(c ?? 0), ...s.map((e) => n(e.value)), 1), C = x / 2, w = Math.max(1, C - Math.max(0, d) - 12), T = s.length > 0 ? 2 * Math.PI / s.length : 0, E = Math.max(1, Math.floor(u)), D = m ?? String, O = s.map((e, t) => {
9
+ let n = f?.(e.label, e, t) ?? e.label, i = r(n, p);
10
+ return {
11
+ displayLabel: i,
12
+ isTruncated: i !== n,
13
+ label: n
14
+ };
15
+ });
16
+ function k(e, t) {
17
+ return [C + t * Math.cos(e - Math.PI / 2), C + t * Math.sin(e - Math.PI / 2)];
18
+ }
19
+ let A = s.map((e, r) => {
20
+ let i = t(n(e.value), 0, S) / S * w;
21
+ return k(r * T, i);
22
+ }), j = A.map((e) => `${e[0]},${e[1]}`).join(" ");
23
+ return /* @__PURE__ */ o("div", {
24
+ ref: _,
25
+ ...v,
26
+ className: e("relative flex flex-col items-center", g),
27
+ children: [/* @__PURE__ */ o("svg", {
28
+ width: x,
29
+ height: x,
30
+ viewBox: `0 0 ${x} ${x}`,
31
+ className: "select-none",
32
+ role: "img",
33
+ "aria-label": h,
34
+ children: [
35
+ s.length > 0 && Array.from({ length: E }, (e, t) => {
36
+ let n = (t + 1) / E * w;
37
+ return /* @__PURE__ */ a("polygon", {
38
+ points: s.map((e, t) => k(t * T, n)).map((e) => `${e[0]},${e[1]}`).join(" "),
39
+ fill: "none",
40
+ stroke: "var(--border)",
41
+ strokeWidth: 1,
42
+ opacity: .5
43
+ }, t);
44
+ }),
45
+ s.map((e, t) => {
46
+ let [n, r] = k(t * T, w);
47
+ return /* @__PURE__ */ a("line", {
48
+ x1: C,
49
+ y1: C,
50
+ x2: n,
51
+ y2: r,
52
+ stroke: "var(--border)",
53
+ strokeWidth: 1,
54
+ opacity: .3
55
+ }, t);
56
+ }),
57
+ s.length > 0 && /* @__PURE__ */ a("polygon", {
58
+ points: j,
59
+ fill: "var(--accent)",
60
+ fillOpacity: .15,
61
+ stroke: "var(--accent)",
62
+ strokeWidth: 2,
63
+ strokeLinejoin: "round"
64
+ }),
65
+ A.map((e, t) => {
66
+ let n = y === t, r = D(s[t].value);
67
+ return /* @__PURE__ */ a("circle", {
68
+ cx: e[0],
69
+ cy: e[1],
70
+ r: n ? 5 : 3,
71
+ fill: "var(--accent)",
72
+ stroke: "var(--bg-secondary)",
73
+ strokeWidth: 2,
74
+ onMouseEnter: () => b(t),
75
+ onMouseLeave: () => b(null),
76
+ onPointerEnter: () => b(t),
77
+ onPointerDown: () => b(t),
78
+ onPointerLeave: () => b(null),
79
+ onFocus: () => b(t),
80
+ onBlur: () => b(null),
81
+ tabIndex: 0,
82
+ role: "button",
83
+ "aria-label": `${O[t].label}: ${r}`,
84
+ className: "cursor-pointer",
85
+ style: { transition: "r 150ms" }
86
+ }, t);
87
+ }),
88
+ s.map((e, t) => {
89
+ let n = w + Math.max(0, d), [r, i] = k(t * T, n), s = O[t], c = Math.max(48, s.displayLabel.length * 6 + 12), l = D(e.value);
90
+ return /* @__PURE__ */ o("g", {
91
+ onMouseEnter: () => b(t),
92
+ onMouseLeave: () => b(null),
93
+ onPointerEnter: () => b(t),
94
+ onPointerDown: () => b(t),
95
+ onPointerLeave: () => b(null),
96
+ onFocus: () => b(t),
97
+ onBlur: () => b(null),
98
+ className: "cursor-pointer",
99
+ tabIndex: 0,
100
+ role: "button",
101
+ "aria-label": `${s.label}: ${l}`,
102
+ children: [/* @__PURE__ */ a("rect", {
103
+ x: r - c / 2,
104
+ y: i - 10,
105
+ width: c,
106
+ height: 20,
107
+ fill: "transparent"
108
+ }), /* @__PURE__ */ o("text", {
109
+ x: r,
110
+ y: i,
111
+ textAnchor: "middle",
112
+ dominantBaseline: "central",
113
+ fill: y === t ? "var(--text-primary)" : "var(--text-tertiary)",
114
+ fontSize: 10,
115
+ fontWeight: y === t ? 600 : 400,
116
+ style: { transition: "all 150ms" },
117
+ children: [s.isTruncated && /* @__PURE__ */ a("title", { children: s.label }), s.displayLabel]
118
+ })]
119
+ }, e.label);
120
+ })
121
+ ]
122
+ }), y !== null && /* @__PURE__ */ a("div", {
123
+ className: "ui-glass ui-glass-popover bg-bg-tertiary border-border pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-md border px-2.5 py-1.5 shadow-lg",
124
+ children: /* @__PURE__ */ o("div", {
125
+ className: "flex items-center gap-2",
126
+ children: [
127
+ /* @__PURE__ */ a("span", { className: "bg-accent h-2 w-2 shrink-0 rounded-full" }),
128
+ /* @__PURE__ */ a("span", {
129
+ className: e("text-text-secondary text-xs whitespace-nowrap"),
130
+ children: O[y].label
131
+ }),
132
+ /* @__PURE__ */ a("span", {
133
+ className: "text-text-primary text-xs font-semibold",
134
+ children: D(s[y].value)
135
+ })
136
+ ]
137
+ })
138
+ })]
139
+ });
140
+ }
141
+ //#endregion
142
+ export { s as RadarChart };