@leonardaustin/ui 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/README.md +11 -0
  2. package/dist/components/app-shell/AppShell.d.ts +3 -3
  3. package/dist/components/app-shell/AppShell.js +82 -0
  4. package/dist/components/app-shell/AuthLayout.d.ts +3 -3
  5. package/dist/components/app-shell/AuthLayout.js +16 -0
  6. package/dist/components/app-shell/BackLink.d.ts +3 -3
  7. package/dist/components/app-shell/BackLink.js +19 -0
  8. package/dist/components/app-shell/BottomNav.d.ts +3 -2
  9. package/dist/components/app-shell/BottomNav.js +37 -0
  10. package/dist/components/app-shell/Breadcrumbs.d.ts +3 -2
  11. package/dist/components/app-shell/Breadcrumbs.js +46 -0
  12. package/dist/components/app-shell/CommandPalette.d.ts +3 -2
  13. package/dist/components/app-shell/CommandPalette.js +119 -0
  14. package/dist/components/app-shell/MobileDrawer.d.ts +3 -3
  15. package/dist/components/app-shell/MobileDrawer.js +128 -0
  16. package/dist/components/app-shell/Sidebar.d.ts +3 -3
  17. package/dist/components/app-shell/Sidebar.js +355 -0
  18. package/dist/components/app-shell/ThemeMenu.d.ts +3 -2
  19. package/dist/components/app-shell/ThemeMenu.js +273 -0
  20. package/dist/components/app-shell/TopBar.d.ts +3 -3
  21. package/dist/components/app-shell/TopBar.js +129 -0
  22. package/dist/components/app-shell/commandPaletteEvents.js +16 -0
  23. package/dist/components/app-shell/navigation.js +21 -0
  24. package/dist/components/app-shell/themeMenuEvents.js +7 -0
  25. package/dist/components/charts/AreaChart.d.ts +4 -3
  26. package/dist/components/charts/AreaChart.js +217 -0
  27. package/dist/components/charts/BarChart.d.ts +4 -3
  28. package/dist/components/charts/BarChart.js +91 -0
  29. package/dist/components/charts/DonutChart.d.ts +4 -3
  30. package/dist/components/charts/DonutChart.js +172 -0
  31. package/dist/components/charts/RadarChart.d.ts +4 -3
  32. package/dist/components/charts/RadarChart.js +142 -0
  33. package/dist/components/charts/RadialBarChart.d.ts +4 -3
  34. package/dist/components/charts/RadialBarChart.js +219 -0
  35. package/dist/components/charts/SparkLine.d.ts +4 -3
  36. package/dist/components/charts/SparkLine.js +39 -0
  37. package/dist/components/charts/StackedBarChart.d.ts +4 -3
  38. package/dist/components/charts/StackedBarChart.js +249 -0
  39. package/dist/components/charts/VerticalBarChart.d.ts +4 -3
  40. package/dist/components/charts/VerticalBarChart.js +143 -0
  41. package/dist/components/charts/chartUtils.js +68 -0
  42. package/dist/components/tables/ColumnPicker.d.ts +3 -3
  43. package/dist/components/tables/ColumnPicker.js +59 -0
  44. package/dist/components/tables/Pagination.d.ts +3 -3
  45. package/dist/components/tables/Pagination.js +56 -0
  46. package/dist/components/tables/ResourceTable.d.ts +3 -3
  47. package/dist/components/tables/ResourceTable.js +88 -0
  48. package/dist/components/tables/Table.js +95 -0
  49. package/dist/components/tables/sortRows.js +11 -0
  50. package/dist/components/ui/Accordion.d.ts +2 -1
  51. package/dist/components/ui/Accordion.js +35 -0
  52. package/dist/components/ui/Alert.d.ts +3 -2
  53. package/dist/components/ui/Alert.js +51 -0
  54. package/dist/components/ui/AttachmentList.d.ts +5 -5
  55. package/dist/components/ui/AttachmentList.js +90 -0
  56. package/dist/components/ui/AudioPlayer.d.ts +5 -2
  57. package/dist/components/ui/AudioPlayer.js +447 -0
  58. package/dist/components/ui/AuthCard.d.ts +3 -3
  59. package/dist/components/ui/AuthCard.js +39 -0
  60. package/dist/components/ui/AuthorByline.d.ts +3 -3
  61. package/dist/components/ui/AuthorByline.js +23 -0
  62. package/dist/components/ui/Avatar.d.ts +3 -2
  63. package/dist/components/ui/Avatar.js +36 -0
  64. package/dist/components/ui/Badge.d.ts +3 -2
  65. package/dist/components/ui/Badge.js +47 -0
  66. package/dist/components/ui/Button.d.ts +3 -3
  67. package/dist/components/ui/Button.js +83 -0
  68. package/dist/components/ui/Calendar.d.ts +3 -3
  69. package/dist/components/ui/Calendar.js +344 -0
  70. package/dist/components/ui/CalendarGrid.d.ts +3 -2
  71. package/dist/components/ui/CalendarGrid.js +136 -0
  72. package/dist/components/ui/Card.d.ts +6 -5
  73. package/dist/components/ui/Card.js +53 -0
  74. package/dist/components/ui/CharacterCount.d.ts +3 -3
  75. package/dist/components/ui/CharacterCount.js +27 -0
  76. package/dist/components/ui/Checkbox.d.ts +10 -8
  77. package/dist/components/ui/Checkbox.js +52 -0
  78. package/dist/components/ui/CodeInput.d.ts +7 -4
  79. package/dist/components/ui/CodeInput.js +97 -0
  80. package/dist/components/ui/Combobox.d.ts +8 -6
  81. package/dist/components/ui/Combobox.js +213 -0
  82. package/dist/components/ui/CopyButton.d.ts +1 -1
  83. package/dist/components/ui/CopyButton.js +57 -0
  84. package/dist/components/ui/DangerZone.d.ts +3 -3
  85. package/dist/components/ui/DangerZone.js +23 -0
  86. package/dist/components/ui/DatePartsInput.d.ts +6 -4
  87. package/dist/components/ui/DatePartsInput.js +138 -0
  88. package/dist/components/ui/DatePicker.d.ts +9 -4
  89. package/dist/components/ui/DatePicker.js +84 -0
  90. package/dist/components/ui/DateRangePicker.d.ts +7 -4
  91. package/dist/components/ui/DateRangePicker.js +143 -0
  92. package/dist/components/ui/DateTimePicker.d.ts +7 -4
  93. package/dist/components/ui/DateTimePicker.js +267 -0
  94. package/dist/components/ui/DetailPanel.d.ts +3 -3
  95. package/dist/components/ui/DetailPanel.js +183 -0
  96. package/dist/components/ui/Dialog.d.ts +3 -3
  97. package/dist/components/ui/Dialog.js +411 -0
  98. package/dist/components/ui/DialogActions.d.ts +3 -3
  99. package/dist/components/ui/DialogActions.js +35 -0
  100. package/dist/components/ui/Disclosure.d.ts +3 -3
  101. package/dist/components/ui/Disclosure.js +45 -0
  102. package/dist/components/ui/DividerLabel.d.ts +3 -3
  103. package/dist/components/ui/DividerLabel.js +20 -0
  104. package/dist/components/ui/DropdownMenu.d.ts +3 -3
  105. package/dist/components/ui/DropdownMenu.js +229 -0
  106. package/dist/components/ui/EmptyState.d.ts +3 -3
  107. package/dist/components/ui/EmptyState.js +31 -0
  108. package/dist/components/ui/ErrorBoundary.js +46 -0
  109. package/dist/components/ui/FieldContext.js +8 -0
  110. package/dist/components/ui/Fieldset.d.ts +2 -2
  111. package/dist/components/ui/Fieldset.js +39 -0
  112. package/dist/components/ui/FilterButton.d.ts +4 -7
  113. package/dist/components/ui/FilterButton.js +17 -0
  114. package/dist/components/ui/FilterDropdown.d.ts +4 -4
  115. package/dist/components/ui/FilterDropdown.js +18 -0
  116. package/dist/components/ui/FormField.d.ts +4 -4
  117. package/dist/components/ui/FormField.js +68 -0
  118. package/dist/components/ui/Grid.d.ts +1 -1
  119. package/dist/components/ui/Grid.js +19 -0
  120. package/dist/components/ui/GridItem.d.ts +1 -1
  121. package/dist/components/ui/GridItem.js +16 -0
  122. package/dist/components/ui/Inline.d.ts +1 -1
  123. package/dist/components/ui/Inline.js +24 -0
  124. package/dist/components/ui/Kbd.d.ts +3 -2
  125. package/dist/components/ui/Kbd.js +13 -0
  126. package/dist/components/ui/ListItemLink.d.ts +3 -3
  127. package/dist/components/ui/ListItemLink.js +44 -0
  128. package/dist/components/ui/LoadingSpinner.d.ts +3 -2
  129. package/dist/components/ui/LoadingSpinner.js +19 -0
  130. package/dist/components/ui/MessageBubble.d.ts +2 -2
  131. package/dist/components/ui/MessageBubble.js +41 -0
  132. package/dist/components/ui/MetadataGrid.d.ts +5 -3
  133. package/dist/components/ui/MetadataGrid.js +76 -0
  134. package/dist/components/ui/MetricCard.d.ts +3 -3
  135. package/dist/components/ui/MetricCard.js +51 -0
  136. package/dist/components/ui/NavTabs.d.ts +2 -2
  137. package/dist/components/ui/NavTabs.js +29 -0
  138. package/dist/components/ui/OAuthButton.d.ts +2 -2
  139. package/dist/components/ui/OAuthButton.js +55 -0
  140. package/dist/components/ui/OverlineLabel.d.ts +3 -3
  141. package/dist/components/ui/OverlineLabel.js +13 -0
  142. package/dist/components/ui/PageHeader.d.ts +3 -3
  143. package/dist/components/ui/PageHeader.js +33 -0
  144. package/dist/components/ui/PageSection.d.ts +3 -3
  145. package/dist/components/ui/PageSection.js +31 -0
  146. package/dist/components/ui/PaginationBar.d.ts +3 -3
  147. package/dist/components/ui/PaginationBar.js +62 -0
  148. package/dist/components/ui/PasswordInput.d.ts +3 -3
  149. package/dist/components/ui/PasswordInput.js +62 -0
  150. package/dist/components/ui/PasswordRequirements.d.ts +3 -2
  151. package/dist/components/ui/PasswordRequirements.js +34 -0
  152. package/dist/components/ui/Popover.d.ts +3 -3
  153. package/dist/components/ui/Popover.js +53 -0
  154. package/dist/components/ui/ProfileHeader.d.ts +3 -3
  155. package/dist/components/ui/ProfileHeader.js +54 -0
  156. package/dist/components/ui/ProgressBar.d.ts +3 -3
  157. package/dist/components/ui/ProgressBar.js +42 -0
  158. package/dist/components/ui/ProseContent.d.ts +3 -3
  159. package/dist/components/ui/ProseContent.js +13 -0
  160. package/dist/components/ui/QrCode.d.ts +3 -3
  161. package/dist/components/ui/QrCode.js +47 -0
  162. package/dist/components/ui/Radio.d.ts +9 -6
  163. package/dist/components/ui/Radio.js +58 -0
  164. package/dist/components/ui/RadioPill.d.ts +7 -4
  165. package/dist/components/ui/RadioPill.js +53 -0
  166. package/dist/components/ui/ReorderList.d.ts +3 -3
  167. package/dist/components/ui/ReorderList.js +123 -0
  168. package/dist/components/ui/SearchInput.d.ts +7 -5
  169. package/dist/components/ui/SearchInput.js +49 -0
  170. package/dist/components/ui/SectionHeader.d.ts +3 -3
  171. package/dist/components/ui/SectionHeader.js +13 -0
  172. package/dist/components/ui/Select.d.ts +4 -4
  173. package/dist/components/ui/Select.js +117 -0
  174. package/dist/components/ui/SelectDropdown.d.ts +8 -3
  175. package/dist/components/ui/SelectDropdown.js +206 -0
  176. package/dist/components/ui/SettingRow.d.ts +5 -5
  177. package/dist/components/ui/SettingRow.js +25 -0
  178. package/dist/components/ui/SideSheet.d.ts +3 -3
  179. package/dist/components/ui/SideSheet.js +164 -0
  180. package/dist/components/ui/Skeleton.d.ts +3 -3
  181. package/dist/components/ui/Skeleton.js +18 -0
  182. package/dist/components/ui/Slider.d.ts +11 -6
  183. package/dist/components/ui/Slider.js +58 -0
  184. package/dist/components/ui/SplitPaneLayout.d.ts +5 -5
  185. package/dist/components/ui/SplitPaneLayout.js +22 -0
  186. package/dist/components/ui/Stack.d.ts +1 -1
  187. package/dist/components/ui/Stack.js +18 -0
  188. package/dist/components/ui/StatusDot.d.ts +3 -2
  189. package/dist/components/ui/StatusDot.js +24 -0
  190. package/dist/components/ui/StepProgress.d.ts +3 -2
  191. package/dist/components/ui/StepProgress.js +33 -0
  192. package/dist/components/ui/Tabs.d.ts +5 -5
  193. package/dist/components/ui/Tabs.js +63 -0
  194. package/dist/components/ui/TextInput.d.ts +4 -4
  195. package/dist/components/ui/TextInput.js +57 -0
  196. package/dist/components/ui/Textarea.d.ts +3 -3
  197. package/dist/components/ui/Textarea.js +59 -0
  198. package/dist/components/ui/ThemePreview.d.ts +3 -3
  199. package/dist/components/ui/ThemePreview.js +28 -0
  200. package/dist/components/ui/TimeInput.d.ts +7 -6
  201. package/dist/components/ui/TimeInput.js +22 -0
  202. package/dist/components/ui/Timeline.d.ts +3 -2
  203. package/dist/components/ui/Timeline.js +29 -0
  204. package/dist/components/ui/Toast.js +121 -0
  205. package/dist/components/ui/Toggle.d.ts +5 -3
  206. package/dist/components/ui/Toggle.js +34 -0
  207. package/dist/components/ui/Toolbar.d.ts +3 -3
  208. package/dist/components/ui/Toolbar.js +70 -0
  209. package/dist/components/ui/Tooltip.js +91 -0
  210. package/dist/components/ui/TranscriptLine.d.ts +3 -3
  211. package/dist/components/ui/TranscriptLine.js +40 -0
  212. package/dist/components/ui/UploadDropzone.d.ts +3 -5
  213. package/dist/components/ui/UploadDropzone.js +55 -0
  214. package/dist/components/ui/badgeColors.js +5 -0
  215. package/dist/components/ui/calendar/AgendaView.js +140 -0
  216. package/dist/components/ui/calendar/MonthView.js +321 -0
  217. package/dist/components/ui/calendar/TimeGrid.js +501 -0
  218. package/dist/components/ui/calendar/TimelineView.js +311 -0
  219. package/dist/components/ui/calendar/context.js +10 -0
  220. package/dist/components/ui/calendar/items.js +152 -0
  221. package/dist/components/ui/calendar/types.js +38 -0
  222. package/dist/components/ui/calendar/useGridInteraction.js +393 -0
  223. package/dist/components/ui/useFieldControl.d.ts +1 -1
  224. package/dist/components/ui/useFieldControl.js +17 -0
  225. package/dist/config/theme.js +219 -0
  226. package/dist/core.css +2933 -0
  227. package/dist/hooks/useAnchoredPopup.js +162 -0
  228. package/dist/hooks/useApplyTheme.js +16 -0
  229. package/dist/hooks/useControllableState.d.ts +14 -0
  230. package/dist/hooks/useControllableState.js +10 -0
  231. package/dist/hooks/useDismiss.js +24 -0
  232. package/dist/hooks/useFocusTrap.js +42 -0
  233. package/dist/hooks/useOverlayStack.js +23 -0
  234. package/dist/hooks/usePopover.js +47 -0
  235. package/dist/hooks/usePortalContainer.js +14 -0
  236. package/dist/hooks/useSettings.js +8 -0
  237. package/dist/hooks/useTheme.js +8 -0
  238. package/dist/hooks/useTypeahead.js +19 -0
  239. package/dist/index.js +133 -12884
  240. package/dist/lib/anchorPlacement.js +75 -0
  241. package/dist/lib/calendar.js +666 -0
  242. package/dist/lib/cn.js +228 -0
  243. package/dist/lib/codeInput.js +51 -0
  244. package/dist/lib/dateParts.js +31 -0
  245. package/dist/lib/dialogDrag.js +45 -0
  246. package/dist/lib/dialogResize.js +47 -0
  247. package/dist/lib/formatDate.js +29 -0
  248. package/dist/lib/formatMediaTime.js +7 -0
  249. package/dist/lib/layout.js +29 -0
  250. package/dist/lib/math.js +6 -0
  251. package/dist/lib/mergeRefs.d.ts +6 -0
  252. package/dist/lib/mergeRefs.js +17 -0
  253. package/dist/lib/months.js +30 -0
  254. package/dist/lib/overlayStack.js +47 -0
  255. package/dist/lib/panelResize.js +8 -0
  256. package/dist/lib/passwordRequirements.js +23 -0
  257. package/dist/lib/qrCode.js +570 -0
  258. package/dist/lib/tones.js +104 -0
  259. package/dist/lib/typeahead.js +31 -0
  260. package/dist/providers/ControlSizeContext.js +9 -0
  261. package/dist/providers/ControlSizeProvider.js +11 -0
  262. package/dist/providers/SettingsContext.js +53 -0
  263. package/dist/providers/SettingsProvider.js +249 -0
  264. package/dist/providers/ThemeContext.js +5 -0
  265. package/dist/providers/ThemeProvider.js +17 -0
  266. package/dist/providers/accentColors.js +75 -0
  267. package/dist/providers/themeClasses.d.ts +1 -0
  268. package/dist/providers/themeClasses.js +20 -0
  269. package/dist/styles.css +228 -176
  270. package/dist/themes/cyber-brutal-dark.css +53 -0
  271. package/dist/themes/cyber-brutal-light.css +75 -0
  272. package/dist/themes/glass-dark.css +217 -0
  273. package/dist/themes/glass-light.css +215 -0
  274. package/dist/themes/hashi.css +66 -0
  275. package/dist/themes/light-inverted.css +32 -0
  276. package/dist/themes/light.css +1 -0
  277. package/dist/themes/monokai.css +51 -0
  278. package/dist/themes/solarized.css +55 -0
  279. package/package.json +3 -1
@@ -0,0 +1,129 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { handleAppShellNavigate as t, isAppShellPathActive as n } from "./navigation.js";
3
+ import { DEFAULT_COMMAND_PALETTE_SHORTCUT as r, openCommandPalette as i } from "./commandPaletteEvents.js";
4
+ import { useSettings as a } from "../../hooks/useSettings.js";
5
+ import { Breadcrumbs as o } from "./Breadcrumbs.js";
6
+ import { ThemeMenu as s } from "./ThemeMenu.js";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ import { Menu as d, Monitor as f, Moon as p, PanelLeft as m, PanelLeftDashed as h, Search as g, Sun as _ } from "lucide-react";
9
+ //#region src/components/app-shell/TopBar.tsx
10
+ var v = [
11
+ "dark",
12
+ "light",
13
+ "system"
14
+ ], y = {
15
+ dark: p,
16
+ light: _,
17
+ system: f
18
+ }, b = {
19
+ dark: "Dark",
20
+ light: "Light",
21
+ system: "System"
22
+ };
23
+ function x({ onMobileMenuToggle: t, breadcrumbs: n, navItems: f = [], navLabel: p = "Primary", showCommandTrigger: _ = !0, commandTriggerLabel: x = "Search", commandShortcut: C = r, currentPath: w, onNavigate: T, onCommandTrigger: E, actions: D, className: O, style: k, ref: A, ...j }) {
24
+ let { sidebarCollapsed: M, setSidebarCollapsed: N, colorMode: P, setColorMode: F } = a();
25
+ function I() {
26
+ F(v[(v.indexOf(P) + 1) % v.length]);
27
+ }
28
+ let L = y[P], R = f.length > 0, z = R || n !== !1;
29
+ return /* @__PURE__ */ u("header", {
30
+ ref: A,
31
+ ...j,
32
+ className: e("ui-glass ui-glass-chrome border-border bg-bg-secondary font-navigation flex h-9 shrink-0 items-center justify-between border-b px-3", O),
33
+ style: {
34
+ height: "var(--topbar-height)",
35
+ ...k
36
+ },
37
+ children: [/* @__PURE__ */ u("div", {
38
+ className: "flex min-w-0 items-center gap-2",
39
+ children: [
40
+ /* @__PURE__ */ l("button", {
41
+ type: "button",
42
+ onClick: t,
43
+ className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded md:hidden",
44
+ "aria-label": "Toggle menu",
45
+ children: /* @__PURE__ */ l(d, { className: "h-4 w-4" })
46
+ }),
47
+ /* @__PURE__ */ l("button", {
48
+ type: "button",
49
+ onClick: () => N(!M),
50
+ className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover hidden h-7 w-7 cursor-pointer items-center justify-center rounded md:flex",
51
+ "aria-label": M ? "Expand sidebar" : "Collapse sidebar",
52
+ children: l(M ? h : m, { className: "h-4 w-4" })
53
+ }),
54
+ z && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", { className: "bg-border hidden h-4 w-px md:block" }), R ? /* @__PURE__ */ l(S, {
55
+ items: f,
56
+ label: p,
57
+ currentPath: w,
58
+ onNavigate: T
59
+ }) : n === !1 ? null : /* @__PURE__ */ l(o, {
60
+ ...n,
61
+ currentPath: w,
62
+ onNavigate: T
63
+ })] })
64
+ ]
65
+ }), /* @__PURE__ */ u("div", {
66
+ className: "flex shrink-0 items-center gap-1",
67
+ children: [
68
+ D,
69
+ _ && /* @__PURE__ */ u("button", {
70
+ type: "button",
71
+ onClick: E ?? (() => i()),
72
+ className: "text-text-tertiary bg-bg-primary border-border hover:border-border-strong hover:text-text-secondary font-navigation hidden h-6 cursor-pointer items-center gap-2 rounded-md border px-2 transition-colors duration-[100ms] sm:flex",
73
+ children: [
74
+ /* @__PURE__ */ l(g, { className: "h-3 w-3" }),
75
+ /* @__PURE__ */ l("span", {
76
+ className: "text-2xs",
77
+ children: x
78
+ }),
79
+ /* @__PURE__ */ l("kbd", {
80
+ className: "text-2xs font-mono opacity-60",
81
+ children: C.label
82
+ })
83
+ ]
84
+ }),
85
+ /* @__PURE__ */ l("button", {
86
+ type: "button",
87
+ onClick: I,
88
+ className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-7 w-7 cursor-pointer items-center justify-center rounded",
89
+ "aria-label": `Color mode: ${b[P]}. Click to cycle.`,
90
+ title: b[P],
91
+ children: /* @__PURE__ */ l(L, { className: "h-4 w-4" })
92
+ }),
93
+ /* @__PURE__ */ l(s, {})
94
+ ]
95
+ })]
96
+ });
97
+ }
98
+ function S({ items: r, label: i, currentPath: a, onNavigate: o }) {
99
+ return /* @__PURE__ */ l("nav", {
100
+ className: "hidden min-w-0 items-center gap-1 md:flex",
101
+ "aria-label": i,
102
+ children: r.map((r) => {
103
+ let i = r.icon, s = n(r, a), c = r.rel ?? (r.target === "_blank" ? "noreferrer" : void 0);
104
+ return /* @__PURE__ */ u("a", {
105
+ href: r.href ?? r.path,
106
+ target: r.target,
107
+ rel: c,
108
+ "aria-current": s ? "page" : void 0,
109
+ onClick: (e) => {
110
+ r.reloadDocument || t(e, r.path, o);
111
+ },
112
+ className: e("font-navigation flex h-6 max-w-40 items-center gap-1 rounded px-2 text-xs transition-colors duration-[100ms]", s ? "bg-accent-muted text-accent-fg" : "text-text-tertiary hover:bg-bg-hover hover:text-text-primary"),
113
+ children: [
114
+ i && /* @__PURE__ */ l(i, { className: "h-3 w-3 shrink-0" }),
115
+ /* @__PURE__ */ l("span", {
116
+ className: "truncate",
117
+ children: r.label
118
+ }),
119
+ r.badge && /* @__PURE__ */ l("span", {
120
+ className: "shrink-0",
121
+ children: r.badge
122
+ })
123
+ ]
124
+ }, `${r.label}-${r.path}`);
125
+ })
126
+ });
127
+ }
128
+ //#endregion
129
+ export { x as TopBar };
@@ -0,0 +1,16 @@
1
+ //#region src/components/app-shell/commandPaletteEvents.ts
2
+ var e = "open-command-palette", t = {
3
+ key: "k",
4
+ label: "⌘K",
5
+ modifier: "primary"
6
+ };
7
+ function n(t = e) {
8
+ typeof document > "u" || document.dispatchEvent(new CustomEvent(t));
9
+ }
10
+ function r(e, t) {
11
+ if (e.key.toLowerCase() !== t.key.toLowerCase()) return !1;
12
+ let n = t.modifier ?? "primary";
13
+ return (n === "primary" ? e.metaKey || e.ctrlKey : n === "meta" ? e.metaKey && !e.ctrlKey : n === "ctrl" ? e.ctrlKey && !e.metaKey : !e.metaKey && !e.ctrlKey) && !!e.altKey == !!t.altKey && !!e.shiftKey == !!t.shiftKey;
14
+ }
15
+ //#endregion
16
+ export { e as COMMAND_PALETTE_EVENT, t as DEFAULT_COMMAND_PALETTE_SHORTCUT, r as matchesCommandPaletteShortcut, n as openCommandPalette };
@@ -0,0 +1,21 @@
1
+ //#region src/components/app-shell/navigation.ts
2
+ function e(e, t) {
3
+ if (e.active !== void 0) return e.active;
4
+ if (!t) return !1;
5
+ if (e.end ?? e.path === "/") return t === e.path;
6
+ let n = e.path.endsWith("/") ? e.path : `${e.path}/`;
7
+ return t === e.path || t.startsWith(n);
8
+ }
9
+ function t(e, t, n, r) {
10
+ let i = e.currentTarget.getAttribute("target");
11
+ e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || i && i !== "_self" || (n && (e.preventDefault(), n(t)), r?.());
12
+ }
13
+ function n(e, t) {
14
+ if (t) {
15
+ t(e);
16
+ return;
17
+ }
18
+ typeof window < "u" && window.location.assign(e);
19
+ }
20
+ //#endregion
21
+ export { t as handleAppShellNavigate, e as isAppShellPathActive, n as navigateToPath };
@@ -0,0 +1,7 @@
1
+ //#region src/components/app-shell/themeMenuEvents.ts
2
+ var e = "open-theme-menu";
3
+ function t(t = e) {
4
+ typeof document > "u" || document.dispatchEvent(new CustomEvent(t));
5
+ }
6
+ //#endregion
7
+ export { e as THEME_MENU_EVENT, t as openThemeMenu };
@@ -1,8 +1,9 @@
1
+ import { type ComponentPropsWithRef } from "react";
1
2
  export interface AreaChartDatum {
2
3
  date: string;
3
4
  value: number;
4
5
  }
5
- export interface AreaChartProps {
6
+ export interface AreaChartProps extends Omit<ComponentPropsWithRef<"svg">, "children" | "viewBox" | "width"> {
6
7
  /** Points to plot in order, each with an X-axis `date` label and a numeric `value`. */
7
8
  data: AreaChartDatum[];
8
9
  /** Chart height in SVG units; the width scales to the container. Defaults to 240. */
@@ -29,8 +30,8 @@ export interface AreaChartProps {
29
30
  /** Maximum number of X-axis labels to show. */
30
31
  xLabelCount?: number;
31
32
  /** Accessible label for the chart. Defaults to "Area chart". */
32
- ariaLabel?: string;
33
+ "aria-label"?: string;
33
34
  /** Extra classes for the `<svg>`. */
34
35
  className?: string;
35
36
  }
36
- export declare function AreaChart({ data, height, minValue, maxValue, startAtZero, valueFormatter, tooltipValueFormatter, xLabelCount, ariaLabel, className, }: AreaChartProps): import("react/jsx-runtime").JSX.Element;
37
+ export declare function AreaChart({ data, height, minValue, maxValue, startAtZero, valueFormatter, tooltipValueFormatter, xLabelCount, "aria-label": ariaLabel, className, onPointerMove, onPointerLeave, ref, ...rest }: AreaChartProps): import("react/jsx-runtime").JSX.Element;
@@ -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,8 +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
+ 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,8 +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
+ export declare function DonutChart({ segments, size, strokeWidth, valueFormatter, percentageFormatter, showLegend, "aria-label": ariaLabel, className, ref, ...rest }: DonutChartProps): import("react/jsx-runtime").JSX.Element;