@nocoo/basalt 2.2.0 → 3.1.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 (320) hide show
  1. package/README.md +2 -0
  2. package/ai/COMPATIBILITY.md +11 -1
  3. package/ai/DESIGN.md +398 -0
  4. package/ai/INTEGRATION.md +255 -129
  5. package/ai/RECIPES.md +51 -26
  6. package/ai/USAGE.md +4 -4
  7. package/ai/registry.json +3018 -271
  8. package/dist/charts/config.d.ts +11 -11
  9. package/dist/charts/config.js +4 -4
  10. package/dist/charts/config.js.map +1 -1
  11. package/dist/charts/date-navigation.js +10 -10
  12. package/dist/charts/date-navigation.js.map +1 -1
  13. package/dist/charts/donut.js +1 -1
  14. package/dist/charts/donut.js.map +1 -1
  15. package/dist/charts/frame.d.ts +1 -1
  16. package/dist/charts/frame.js +4 -4
  17. package/dist/charts/frame.js.map +1 -1
  18. package/dist/charts/gauge.js +5 -5
  19. package/dist/charts/gauge.js.map +1 -1
  20. package/dist/charts/heatmap-calendar.js +11 -11
  21. package/dist/charts/heatmap-calendar.js.map +1 -1
  22. package/dist/charts/heatmap-matrix.js +8 -8
  23. package/dist/charts/heatmap-matrix.js.map +1 -1
  24. package/dist/charts/item-list.js +1 -1
  25. package/dist/charts/item-list.js.map +1 -1
  26. package/dist/charts/legend.js +19 -19
  27. package/dist/charts/legend.js.map +1 -1
  28. package/dist/charts/palette.js +2 -2
  29. package/dist/charts/palette.js.map +1 -1
  30. package/dist/charts/slot-bar.js +2 -2
  31. package/dist/charts/slot-bar.js.map +1 -1
  32. package/dist/charts/sparkline.js +38 -23
  33. package/dist/charts/sparkline.js.map +1 -1
  34. package/dist/charts/stat-card.d.ts +2 -2
  35. package/dist/charts/stat-card.js +61 -58
  36. package/dist/charts/stat-card.js.map +1 -1
  37. package/dist/charts/timeline.js +18 -9
  38. package/dist/charts/timeline.js.map +1 -1
  39. package/dist/charts/tooltip.js +16 -16
  40. package/dist/charts/tooltip.js.map +1 -1
  41. package/dist/components/accordion.js +1 -1
  42. package/dist/components/accordion.js.map +1 -1
  43. package/dist/components/alert-dialog.js +4 -4
  44. package/dist/components/alert-dialog.js.map +1 -1
  45. package/dist/components/app-header.js +8 -8
  46. package/dist/components/app-header.js.map +1 -1
  47. package/dist/components/app-shell.js +1 -1
  48. package/dist/components/app-shell.js.map +1 -1
  49. package/dist/components/approval-card.d.ts +13 -0
  50. package/dist/components/approval-card.js +161 -0
  51. package/dist/components/approval-card.js.map +1 -0
  52. package/dist/components/avatar.d.ts +12 -0
  53. package/dist/components/avatar.js +39 -18
  54. package/dist/components/avatar.js.map +1 -1
  55. package/dist/components/badge.js +8 -8
  56. package/dist/components/badge.js.map +1 -1
  57. package/dist/components/banner.d.ts +2 -2
  58. package/dist/components/banner.js +9 -8
  59. package/dist/components/banner.js.map +1 -1
  60. package/dist/components/basalt-mark.js +1 -1
  61. package/dist/components/basalt-mark.js.map +1 -1
  62. package/dist/components/battery-meter.js +5 -5
  63. package/dist/components/battery-meter.js.map +1 -1
  64. package/dist/components/breadcrumbs.js +6 -6
  65. package/dist/components/breadcrumbs.js.map +1 -1
  66. package/dist/components/button.js +10 -10
  67. package/dist/components/button.js.map +1 -1
  68. package/dist/components/chat-bubble.js +4 -3
  69. package/dist/components/chat-bubble.js.map +1 -1
  70. package/dist/components/chat-composer.d.ts +21 -3
  71. package/dist/components/chat-composer.js +126 -60
  72. package/dist/components/chat-composer.js.map +1 -1
  73. package/dist/components/chat-header.js +6 -6
  74. package/dist/components/chat-header.js.map +1 -1
  75. package/dist/components/chat-inbox.js +34 -30
  76. package/dist/components/chat-inbox.js.map +1 -1
  77. package/dist/components/chat-markdown.d.ts +8 -0
  78. package/dist/components/chat-markdown.js +122 -0
  79. package/dist/components/chat-markdown.js.map +1 -0
  80. package/dist/components/chat-message.d.ts +26 -0
  81. package/dist/components/chat-message.js +145 -0
  82. package/dist/components/chat-message.js.map +1 -0
  83. package/dist/components/checkbox.js +11 -11
  84. package/dist/components/checkbox.js.map +1 -1
  85. package/dist/components/clipboard-text.js +3 -3
  86. package/dist/components/clipboard-text.js.map +1 -1
  87. package/dist/components/code.d.ts +22 -20
  88. package/dist/components/code.js +94 -32
  89. package/dist/components/code.js.map +1 -1
  90. package/dist/components/collapsible.js +8 -4
  91. package/dist/components/collapsible.js.map +1 -1
  92. package/dist/components/command-palette.js +73 -47
  93. package/dist/components/command-palette.js.map +1 -1
  94. package/dist/components/context-cards.d.ts +15 -0
  95. package/dist/components/context-cards.js +148 -0
  96. package/dist/components/context-cards.js.map +1 -0
  97. package/dist/components/context-menu.d.ts +1 -1
  98. package/dist/components/context-menu.js +18 -14
  99. package/dist/components/context-menu.js.map +1 -1
  100. package/dist/components/data-table.d.ts +14 -2
  101. package/dist/components/data-table.js +185 -135
  102. package/dist/components/data-table.js.map +1 -1
  103. package/dist/components/date-picker.js +13 -13
  104. package/dist/components/date-picker.js.map +1 -1
  105. package/dist/components/delete-resource.js +1 -1
  106. package/dist/components/delete-resource.js.map +1 -1
  107. package/dist/components/description-list.js +3 -3
  108. package/dist/components/description-list.js.map +1 -1
  109. package/dist/components/dialog.d.ts +2 -2
  110. package/dist/components/dialog.js +8 -8
  111. package/dist/components/dialog.js.map +1 -1
  112. package/dist/components/diff-table.d.ts +15 -0
  113. package/dist/components/diff-table.js +151 -0
  114. package/dist/components/diff-table.js.map +1 -0
  115. package/dist/components/dock.js +2 -2
  116. package/dist/components/dock.js.map +1 -1
  117. package/dist/components/dropdown-menu.js +23 -18
  118. package/dist/components/dropdown-menu.js.map +1 -1
  119. package/dist/components/editable-nav-item.js +63 -58
  120. package/dist/components/editable-nav-item.js.map +1 -1
  121. package/dist/components/empty.js +6 -6
  122. package/dist/components/empty.js.map +1 -1
  123. package/dist/components/fab.js +1 -1
  124. package/dist/components/fab.js.map +1 -1
  125. package/dist/components/field.js +3 -3
  126. package/dist/components/field.js.map +1 -1
  127. package/dist/components/file-dropzone.js +7 -7
  128. package/dist/components/file-dropzone.js.map +1 -1
  129. package/dist/components/filter-bar.js +6 -6
  130. package/dist/components/filter-bar.js.map +1 -1
  131. package/dist/components/flow.js +4 -3
  132. package/dist/components/flow.js.map +1 -1
  133. package/dist/components/grid.d.ts +3 -1
  134. package/dist/components/grid.js +15 -8
  135. package/dist/components/grid.js.map +1 -1
  136. package/dist/components/hover-card.js +1 -1
  137. package/dist/components/hover-card.js.map +1 -1
  138. package/dist/components/icon-picker.d.ts +8 -2
  139. package/dist/components/icon-picker.js +75 -47
  140. package/dist/components/icon-picker.js.map +1 -1
  141. package/dist/components/inline-editable.js +6 -6
  142. package/dist/components/inline-editable.js.map +1 -1
  143. package/dist/components/input-area.js +3 -3
  144. package/dist/components/input-area.js.map +1 -1
  145. package/dist/components/input-group.js +5 -5
  146. package/dist/components/input-group.js.map +1 -1
  147. package/dist/components/input.js +4 -4
  148. package/dist/components/input.js.map +1 -1
  149. package/dist/components/label.js +3 -3
  150. package/dist/components/label.js.map +1 -1
  151. package/dist/components/layer-card.d.ts +9 -4
  152. package/dist/components/layer-card.js +72 -67
  153. package/dist/components/layer-card.js.map +1 -1
  154. package/dist/components/loader.d.ts +16 -10
  155. package/dist/components/loader.js +46 -53
  156. package/dist/components/loader.js.map +1 -1
  157. package/dist/components/loading-screen.js +3 -3
  158. package/dist/components/loading-screen.js.map +1 -1
  159. package/dist/components/menu-bar.js +32 -27
  160. package/dist/components/menu-bar.js.map +1 -1
  161. package/dist/components/meter.d.ts +5 -5
  162. package/dist/components/meter.js +25 -12
  163. package/dist/components/meter.js.map +1 -1
  164. package/dist/components/multi-select.js +66 -62
  165. package/dist/components/multi-select.js.map +1 -1
  166. package/dist/components/navigation-menu.d.ts +2 -2
  167. package/dist/components/navigation-menu.js +22 -8
  168. package/dist/components/navigation-menu.js.map +1 -1
  169. package/dist/components/overlay.js +2 -2
  170. package/dist/components/overlay.js.map +1 -1
  171. package/dist/components/page-header.d.ts +3 -1
  172. package/dist/components/page-header.js +12 -12
  173. package/dist/components/page-header.js.map +1 -1
  174. package/dist/components/pagination.js +3 -3
  175. package/dist/components/pagination.js.map +1 -1
  176. package/dist/components/popover.js +18 -23
  177. package/dist/components/popover.js.map +1 -1
  178. package/dist/components/prompt-bar.d.ts +16 -0
  179. package/dist/components/prompt-bar.js +49 -0
  180. package/dist/components/prompt-bar.js.map +1 -0
  181. package/dist/components/radio.js +9 -9
  182. package/dist/components/radio.js.map +1 -1
  183. package/dist/components/recommendation-card.d.ts +13 -0
  184. package/dist/components/recommendation-card.js +123 -0
  185. package/dist/components/recommendation-card.js.map +1 -0
  186. package/dist/components/resource-list.js +1 -1
  187. package/dist/components/resource-list.js.map +1 -1
  188. package/dist/components/responsive-master-detail.js +4 -4
  189. package/dist/components/responsive-master-detail.js.map +1 -1
  190. package/dist/components/scroll-area.js +3 -3
  191. package/dist/components/scroll-area.js.map +1 -1
  192. package/dist/components/section-rule.d.ts +5 -3
  193. package/dist/components/section-rule.js +12 -12
  194. package/dist/components/section-rule.js.map +1 -1
  195. package/dist/components/segment-control.js +3 -3
  196. package/dist/components/segment-control.js.map +1 -1
  197. package/dist/components/select.js +47 -32
  198. package/dist/components/select.js.map +1 -1
  199. package/dist/components/sensitive-input.js +17 -19
  200. package/dist/components/sensitive-input.js.map +1 -1
  201. package/dist/components/sheet.d.ts +4 -4
  202. package/dist/components/sheet.js +11 -10
  203. package/dist/components/sheet.js.map +1 -1
  204. package/dist/components/sidebar.js +149 -137
  205. package/dist/components/sidebar.js.map +1 -1
  206. package/dist/components/skeleton-line.d.ts +1 -1
  207. package/dist/components/skeleton-line.js +2 -2
  208. package/dist/components/skeleton-line.js.map +1 -1
  209. package/dist/components/slider.js +2 -2
  210. package/dist/components/slider.js.map +1 -1
  211. package/dist/components/stat-strip.js +5 -4
  212. package/dist/components/stat-strip.js.map +1 -1
  213. package/dist/components/switch.js +6 -6
  214. package/dist/components/switch.js.map +1 -1
  215. package/dist/components/table-of-contents.js +5 -5
  216. package/dist/components/table-of-contents.js.map +1 -1
  217. package/dist/components/table-pager.js +2 -2
  218. package/dist/components/table-pager.js.map +1 -1
  219. package/dist/components/table.d.ts +39 -2
  220. package/dist/components/table.js +48 -17
  221. package/dist/components/table.js.map +1 -1
  222. package/dist/components/tabs.js +7 -6
  223. package/dist/components/tabs.js.map +1 -1
  224. package/dist/components/tag-badge.d.ts +10 -10
  225. package/dist/components/tag-badge.js +11 -11
  226. package/dist/components/tag-badge.js.map +1 -1
  227. package/dist/components/tag-color-picker.d.ts +8 -1
  228. package/dist/components/tag-color-picker.js +33 -25
  229. package/dist/components/tag-color-picker.js.map +1 -1
  230. package/dist/components/text.js +5 -5
  231. package/dist/components/text.js.map +1 -1
  232. package/dist/components/theme-toggle.js +1 -1
  233. package/dist/components/theme-toggle.js.map +1 -1
  234. package/dist/components/thinking.d.ts +16 -0
  235. package/dist/components/thinking.js +85 -0
  236. package/dist/components/thinking.js.map +1 -0
  237. package/dist/components/toast.js +25 -20
  238. package/dist/components/toast.js.map +1 -1
  239. package/dist/components/toggle-group.js +6 -5
  240. package/dist/components/toggle-group.js.map +1 -1
  241. package/dist/components/toggle.js +6 -6
  242. package/dist/components/toggle.js.map +1 -1
  243. package/dist/components/tool-chips.d.ts +12 -0
  244. package/dist/components/tool-chips.js +138 -0
  245. package/dist/components/tool-chips.js.map +1 -0
  246. package/dist/components/toolbar.js +3 -3
  247. package/dist/components/toolbar.js.map +1 -1
  248. package/dist/components/tooltip.js +1 -1
  249. package/dist/components/tooltip.js.map +1 -1
  250. package/dist/components/typeahead-field.js +59 -56
  251. package/dist/components/typeahead-field.js.map +1 -1
  252. package/dist/components/upload-queue.js +15 -14
  253. package/dist/components/upload-queue.js.map +1 -1
  254. package/dist/models/agent-feedback.d.ts +44 -0
  255. package/dist/models/agent-feedback.js +28 -0
  256. package/dist/models/agent-feedback.js.map +1 -0
  257. package/dist/models/avatar.d.ts +2 -0
  258. package/dist/models/avatar.js +15 -0
  259. package/dist/models/avatar.js.map +1 -0
  260. package/dist/models/code.d.ts +6 -0
  261. package/dist/models/code.js +24 -0
  262. package/dist/models/code.js.map +1 -0
  263. package/dist/models/context-cards.d.ts +13 -0
  264. package/dist/models/context-cards.js +17 -0
  265. package/dist/models/context-cards.js.map +1 -0
  266. package/dist/models/diff-table.d.ts +12 -0
  267. package/dist/models/diff-table.js +9 -0
  268. package/dist/models/diff-table.js.map +1 -0
  269. package/dist/models/recommendation.d.ts +26 -0
  270. package/dist/models/recommendation.js +23 -0
  271. package/dist/models/recommendation.js.map +1 -0
  272. package/dist/styles/base.css +14 -2
  273. package/dist/styles/standalone.css +1901 -943
  274. package/dist/styles/tailwind.css +180 -13
  275. package/dist/styles/tokens.css +681 -20
  276. package/dist/utils/cn.js +25 -4
  277. package/dist/utils/cn.js.map +1 -1
  278. package/dist/utils/control-surface.d.ts +1 -1
  279. package/dist/utils/control-surface.js +1 -1
  280. package/dist/utils/control-surface.js.map +1 -1
  281. package/dist/utils/navigation.d.ts +3 -0
  282. package/dist/utils/navigation.js +8 -0
  283. package/dist/utils/navigation.js.map +1 -0
  284. package/dist/utils/selection-indicator.d.ts +1 -1
  285. package/dist/utils/selection-indicator.js +49 -72
  286. package/dist/utils/selection-indicator.js.map +1 -1
  287. package/dist/utils/use-hover-highlight.d.ts +4 -0
  288. package/dist/utils/use-hover-highlight.js +82 -0
  289. package/dist/utils/use-hover-highlight.js.map +1 -0
  290. package/dist/viewmodels/use-approval-card.d.ts +20 -0
  291. package/dist/viewmodels/use-approval-card.js +83 -0
  292. package/dist/viewmodels/use-approval-card.js.map +1 -0
  293. package/dist/viewmodels/use-chat-composer.d.ts +16 -0
  294. package/dist/viewmodels/use-chat-composer.js +34 -0
  295. package/dist/viewmodels/use-chat-composer.js.map +1 -0
  296. package/dist/viewmodels/use-chat-message.d.ts +16 -0
  297. package/dist/viewmodels/use-chat-message.js +26 -0
  298. package/dist/viewmodels/use-chat-message.js.map +1 -0
  299. package/dist/viewmodels/use-code-block.d.ts +8 -0
  300. package/dist/viewmodels/use-code-block.js +38 -0
  301. package/dist/viewmodels/use-code-block.js.map +1 -0
  302. package/dist/viewmodels/use-context-cards.d.ts +17 -0
  303. package/dist/viewmodels/use-context-cards.js +18 -0
  304. package/dist/viewmodels/use-context-cards.js.map +1 -0
  305. package/dist/viewmodels/use-diff-table.d.ts +16 -0
  306. package/dist/viewmodels/use-diff-table.js +42 -0
  307. package/dist/viewmodels/use-diff-table.js.map +1 -0
  308. package/dist/viewmodels/use-loader.d.ts +4 -0
  309. package/dist/viewmodels/use-loader.js +22 -0
  310. package/dist/viewmodels/use-loader.js.map +1 -0
  311. package/dist/viewmodels/use-recommendation-card.d.ts +17 -0
  312. package/dist/viewmodels/use-recommendation-card.js +41 -0
  313. package/dist/viewmodels/use-recommendation-card.js.map +1 -0
  314. package/dist/viewmodels/use-thinking.d.ts +13 -0
  315. package/dist/viewmodels/use-thinking.js +18 -0
  316. package/dist/viewmodels/use-thinking.js.map +1 -0
  317. package/dist/viewmodels/use-tool-chips.d.ts +10 -0
  318. package/dist/viewmodels/use-tool-chips.js +20 -0
  319. package/dist/viewmodels/use-tool-chips.js.map +1 -0
  320. package/package.json +28 -26
@@ -4,28 +4,28 @@ import { type ChartTooltipItem } from "./tooltip.js";
4
4
  export type { ChartSeriesDescriptor } from "./series.js";
5
5
  export type ChartTypeFace = "axis" | "legend" | "tooltipTitle" | "tooltipBody";
6
6
  export declare const CHART_TYPE: {
7
- readonly axisFontSize: 11;
8
- readonly legendFontSize: 12;
9
- readonly tooltipTitleSize: 12;
10
- readonly tooltipBodySize: 12;
7
+ readonly axisFontSize: "var(--basalt-text-xs)";
8
+ readonly legendFontSize: "var(--basalt-text-sm)";
9
+ readonly tooltipTitleSize: "var(--basalt-text-sm)";
10
+ readonly tooltipBodySize: "var(--basalt-text-sm)";
11
11
  readonly tooltipDot: 8;
12
12
  readonly strokeWidth: 2;
13
13
  readonly gridDash: "3 3";
14
14
  readonly gridOpacity: 0.15;
15
15
  readonly areaFillAlpha: 0.2;
16
16
  };
17
- export declare function chartFontSize(face: ChartTypeFace): number;
17
+ export declare function chartFontSize(face: ChartTypeFace): string;
18
18
  export declare function chartTextStyle(face: ChartTypeFace): {
19
- fontSize: number;
19
+ fontSize: string;
20
20
  };
21
21
  export declare function chartTickStyle(face?: ChartTypeFace): {
22
- fontSize: number;
22
+ fontSize: string;
23
23
  fill: string;
24
24
  };
25
25
  export declare function getChartColor(index: number): string;
26
26
  export declare const AXIS_CONFIG: {
27
27
  readonly tick: {
28
- fontSize: number;
28
+ fontSize: string;
29
29
  fill: string;
30
30
  };
31
31
  axisLine: false;
@@ -33,7 +33,7 @@ export declare const AXIS_CONFIG: {
33
33
  };
34
34
  export declare function cartesianAxisProps(hidden?: boolean): {
35
35
  tick: {
36
- fontSize: number;
36
+ fontSize: string;
37
37
  fill: string;
38
38
  };
39
39
  axisLine: false;
@@ -67,7 +67,7 @@ export declare function chartTooltipContentStyle(): {
67
67
  border: string;
68
68
  borderRadius: string;
69
69
  boxShadow: string;
70
- fontSize: number;
70
+ fontSize: string;
71
71
  color: string;
72
72
  padding: string;
73
73
  };
@@ -107,7 +107,7 @@ export declare function chartTooltipProps(options?: {
107
107
  border: string;
108
108
  borderRadius: string;
109
109
  boxShadow: string;
110
- fontSize: number;
110
+ fontSize: string;
111
111
  color: string;
112
112
  padding: string;
113
113
  };
@@ -4,10 +4,10 @@ import { ChartTooltipContent as r } from "./tooltip.js";
4
4
  import { createElement as i } from "react";
5
5
  //#region src/charts/config.ts
6
6
  var a = {
7
- axisFontSize: 11,
8
- legendFontSize: 12,
9
- tooltipTitleSize: 12,
10
- tooltipBodySize: 12,
7
+ axisFontSize: "var(--basalt-text-xs)",
8
+ legendFontSize: "var(--basalt-text-sm)",
9
+ tooltipTitleSize: "var(--basalt-text-sm)",
10
+ tooltipBodySize: "var(--basalt-text-sm)",
11
11
  tooltipDot: 8,
12
12
  strokeWidth: 2,
13
13
  gridDash: "3 3",
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["CHART_TYPE","chartFontSize","face","chartTextStyle","chartTickStyle","chartAxis","getChartColor","CHART_COLORS","index","AXIS_CONFIG","cartesianAxisProps","hidden","GRID_PROPS","BAR_RADIUS","ANIMATION_PROPS","CHART_TOOLTIP_CURSOR_LINE","CHART_TOOLTIP_CURSOR_BAR","withAlpha","chartTooltipContentStyle","chartTooltipProps","options","props","createElement","ChartTooltipContent","seriesColor","series","RESPONSIVE_CONTAINER_PROPS","CHART_PLOT_MARGIN","CHART_PLOT_MARGIN_BARE"],"sources":["../../src/charts/config.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport { CHART_COLORS, chartAxis, withAlpha } from \"./palette\";\nimport type { ChartSeriesDescriptor } from \"./series\";\nimport { ChartTooltipContent, type ChartTooltipItem } from \"./tooltip\";\n\nexport type { ChartSeriesDescriptor } from \"./series\";\n\nexport type ChartTypeFace = \"axis\" | \"legend\" | \"tooltipTitle\" | \"tooltipBody\";\n\nexport const CHART_TYPE = {\n\taxisFontSize: 11,\n\tlegendFontSize: 12,\n\ttooltipTitleSize: 12,\n\ttooltipBodySize: 12,\n\ttooltipDot: 8,\n\tstrokeWidth: 2,\n\tgridDash: \"3 3\",\n\tgridOpacity: 0.15,\n\tareaFillAlpha: 0.2,\n} as const;\n\nexport function chartFontSize(face: ChartTypeFace): number {\n\tif (face === \"legend\") {\n\t\treturn CHART_TYPE.legendFontSize;\n\t}\n\tif (face === \"tooltipTitle\") {\n\t\treturn CHART_TYPE.tooltipTitleSize;\n\t}\n\tif (face === \"tooltipBody\") {\n\t\treturn CHART_TYPE.tooltipBodySize;\n\t}\n\treturn CHART_TYPE.axisFontSize;\n}\n\nexport function chartTextStyle(face: ChartTypeFace): { fontSize: number } {\n\treturn { fontSize: chartFontSize(face) };\n}\n\nexport function chartTickStyle(face: ChartTypeFace = \"axis\"): {\n\tfontSize: number;\n\tfill: string;\n} {\n\treturn { fontSize: chartFontSize(face), fill: chartAxis };\n}\n\nexport function getChartColor(index: number): string {\n\treturn CHART_COLORS[index % CHART_COLORS.length] ?? CHART_COLORS[0];\n}\n\nexport const AXIS_CONFIG = {\n\tget tick() {\n\t\treturn chartTickStyle(\"axis\");\n\t},\n\taxisLine: false as const,\n\ttickLine: false as const,\n};\n\nexport function cartesianAxisProps(hidden = false) {\n\treturn { hide: hidden, ...AXIS_CONFIG };\n}\n\nexport const GRID_PROPS = {\n\tvertical: false as const,\n\tstroke: chartAxis,\n\tstrokeOpacity: CHART_TYPE.gridOpacity,\n\tstrokeDasharray: CHART_TYPE.gridDash,\n};\n\nexport const BAR_RADIUS = {\n\thorizontal: [0, 4, 4, 0] as [number, number, number, number],\n\tvertical: [4, 4, 0, 0] as [number, number, number, number],\n};\n\nexport const ANIMATION_PROPS = {\n\tisAnimationActive: false,\n};\n\nexport const CHART_TOOLTIP_CURSOR_LINE = {\n\tstroke: chartAxis,\n\tstrokeOpacity: 0.35,\n\tstrokeWidth: 1,\n} as const;\n\nexport const CHART_TOOLTIP_CURSOR_BAR = {\n\tfill: withAlpha(\"foreground\", 0.06),\n\tstroke: \"none\",\n} as const;\n\nexport function chartTooltipContentStyle(): {\n\tbackground: string;\n\tborder: string;\n\tborderRadius: string;\n\tboxShadow: string;\n\tfontSize: number;\n\tcolor: string;\n\tpadding: string;\n} {\n\treturn {\n\t\tbackground: \"transparent\",\n\t\tborder: \"none\",\n\t\tborderRadius: \"0\",\n\t\tboxShadow: \"none\",\n\t\tfontSize: chartFontSize(\"tooltipBody\"),\n\t\tcolor: \"hsl(var(--basalt-foreground))\",\n\t\tpadding: \"0\",\n\t};\n}\n\nexport function chartTooltipProps(options?: {\n\tformatter?: (value: number) => string;\n\tcursor?: \"bar\" | \"line\" | false;\n\tcustomTooltip?: (props: {\n\t\tactive?: boolean;\n\t\tpayload?: readonly ChartTooltipItem[];\n\t\tlabel?: string | number;\n\t}) => ReactNode;\n}) {\n\tconst cursor =\n\t\toptions?.cursor === false\n\t\t\t? false\n\t\t\t: options?.cursor === \"line\"\n\t\t\t\t? CHART_TOOLTIP_CURSOR_LINE\n\t\t\t\t: CHART_TOOLTIP_CURSOR_BAR;\n\treturn {\n\t\tisAnimationActive: false,\n\t\tanimationDuration: 0,\n\t\toffset: 12,\n\t\tallowEscapeViewBox: { x: false, y: false },\n\t\tcursor,\n\t\twrapperStyle: {\n\t\t\toutline: \"none\",\n\t\t\tzIndex: 40,\n\t\t\tpointerEvents: \"none\" as const,\n\t\t\ttransition: \"none\",\n\t\t\tanimation: \"none\",\n\t\t},\n\t\tcontentStyle: chartTooltipContentStyle(),\n\t\tcontent: ((props: {\n\t\t\tactive?: boolean;\n\t\t\tpayload?: readonly ChartTooltipItem[];\n\t\t\tlabel?: unknown;\n\t\t}) => {\n\t\t\tif (options?.customTooltip) {\n\t\t\t\treturn options.customTooltip({\n\t\t\t\t\tactive: props.active,\n\t\t\t\t\tpayload: props.payload,\n\t\t\t\t\tlabel: props.label as string | number | undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createElement(ChartTooltipContent, {\n\t\t\t\tactive: props.active,\n\t\t\t\tpayload: props.payload,\n\t\t\t\tlabel: props.label as string | number | undefined,\n\t\t\t\tformatter: options?.formatter,\n\t\t\t});\n\t\t}) as never,\n\t};\n}\n\nexport function seriesColor(\n\tseries: ChartSeriesDescriptor | undefined,\n\tindex: number,\n): string | undefined {\n\treturn series?.color ?? CHART_COLORS[index % CHART_COLORS.length];\n}\n\nexport const RESPONSIVE_CONTAINER_PROPS = {\n\twidth: \"100%\" as const,\n\theight: \"100%\" as const,\n\tminWidth: 0,\n\tminHeight: 0,\n\tdebounce: 150,\n};\n\nexport const CHART_PLOT_MARGIN = {\n\ttop: 4,\n\tright: 4,\n\tbottom: 0,\n\tleft: 0,\n} as const;\n\nexport const CHART_PLOT_MARGIN_BARE = {\n\ttop: 2,\n\tright: 2,\n\tbottom: 2,\n\tleft: 2,\n} as const;\n"],"mappings":";;;;;AASA,IAAaA,IAAa;CACzB,cAAc;CACd,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,YAAY;C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;EACzC,QAVAC,GAAS,WAAW,KACjB,KACAA,GAAS,WAAW,SACnBL,IACAC;EAOJ,cAAc;GACb,SAAS;GACT,QAAQ;GACR,eAAe;GACf,YAAY;GACZ,WAAW;EACZ;EACA,cAAcE,EAAyB;EACvC,WAAW,MAKNE,GAAS,gBACLA,EAAQ,cAAc;GAC5B,QAAQC,EAAM;GACd,SAASA,EAAM;GACf,OAAOA,EAAM;EACd,CAAC,IAEKC,EAAcC,GAAqB;GACzC,QAAQF,EAAM;GACd,SAASA,EAAM;GACf,OAAOA,EAAM;GACb,WAAWD,GAAS;EACrB,CAAC;CAEH;AACD;AAEA,SAAgBI,EACf,GACA,GACqB;CACrB,OAAOC,GAAQ,SAASlB,EAAaC,IAAQD,EAAa;AAC3D;AAEA,IAAamB,IAA6B;CACzC,OAAO;CACP,QAAQ;CACR,UAAU;CACV,WAAW;CACX,UAAU;AACX,GAEaC,IAAoB;CAChC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACP,GAEaC,IAAyB;CACrC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACP"}
1
+ {"version":3,"file":"config.js","names":["CHART_TYPE","chartFontSize","face","chartTextStyle","chartTickStyle","chartAxis","getChartColor","CHART_COLORS","index","AXIS_CONFIG","cartesianAxisProps","hidden","GRID_PROPS","BAR_RADIUS","ANIMATION_PROPS","CHART_TOOLTIP_CURSOR_LINE","CHART_TOOLTIP_CURSOR_BAR","withAlpha","chartTooltipContentStyle","chartTooltipProps","options","props","createElement","ChartTooltipContent","seriesColor","series","RESPONSIVE_CONTAINER_PROPS","CHART_PLOT_MARGIN","CHART_PLOT_MARGIN_BARE"],"sources":["../../src/charts/config.ts"],"sourcesContent":["import { createElement, type ReactNode } from \"react\";\nimport { CHART_COLORS, chartAxis, withAlpha } from \"./palette\";\nimport type { ChartSeriesDescriptor } from \"./series\";\nimport { ChartTooltipContent, type ChartTooltipItem } from \"./tooltip\";\n\nexport type { ChartSeriesDescriptor } from \"./series\";\n\nexport type ChartTypeFace = \"axis\" | \"legend\" | \"tooltipTitle\" | \"tooltipBody\";\n\nexport const CHART_TYPE = {\n\taxisFontSize: \"var(--basalt-text-xs)\",\n\tlegendFontSize: \"var(--basalt-text-sm)\",\n\ttooltipTitleSize: \"var(--basalt-text-sm)\",\n\ttooltipBodySize: \"var(--basalt-text-sm)\",\n\ttooltipDot: 8,\n\tstrokeWidth: 2,\n\tgridDash: \"3 3\",\n\tgridOpacity: 0.15,\n\tareaFillAlpha: 0.2,\n} as const;\n\nexport function chartFontSize(face: ChartTypeFace): string {\n\tif (face === \"legend\") {\n\t\treturn CHART_TYPE.legendFontSize;\n\t}\n\tif (face === \"tooltipTitle\") {\n\t\treturn CHART_TYPE.tooltipTitleSize;\n\t}\n\tif (face === \"tooltipBody\") {\n\t\treturn CHART_TYPE.tooltipBodySize;\n\t}\n\treturn CHART_TYPE.axisFontSize;\n}\n\nexport function chartTextStyle(face: ChartTypeFace): { fontSize: string } {\n\treturn { fontSize: chartFontSize(face) };\n}\n\nexport function chartTickStyle(face: ChartTypeFace = \"axis\"): {\n\tfontSize: string;\n\tfill: string;\n} {\n\treturn { fontSize: chartFontSize(face), fill: chartAxis };\n}\n\nexport function getChartColor(index: number): string {\n\treturn CHART_COLORS[index % CHART_COLORS.length] ?? CHART_COLORS[0];\n}\n\nexport const AXIS_CONFIG = {\n\tget tick() {\n\t\treturn chartTickStyle(\"axis\");\n\t},\n\taxisLine: false as const,\n\ttickLine: false as const,\n};\n\nexport function cartesianAxisProps(hidden = false) {\n\treturn { hide: hidden, ...AXIS_CONFIG };\n}\n\nexport const GRID_PROPS = {\n\tvertical: false as const,\n\tstroke: chartAxis,\n\tstrokeOpacity: CHART_TYPE.gridOpacity,\n\tstrokeDasharray: CHART_TYPE.gridDash,\n};\n\nexport const BAR_RADIUS = {\n\thorizontal: [0, 4, 4, 0] as [number, number, number, number],\n\tvertical: [4, 4, 0, 0] as [number, number, number, number],\n};\n\nexport const ANIMATION_PROPS = {\n\tisAnimationActive: false,\n};\n\nexport const CHART_TOOLTIP_CURSOR_LINE = {\n\tstroke: chartAxis,\n\tstrokeOpacity: 0.35,\n\tstrokeWidth: 1,\n} as const;\n\nexport const CHART_TOOLTIP_CURSOR_BAR = {\n\tfill: withAlpha(\"foreground\", 0.06),\n\tstroke: \"none\",\n} as const;\n\nexport function chartTooltipContentStyle(): {\n\tbackground: string;\n\tborder: string;\n\tborderRadius: string;\n\tboxShadow: string;\n\tfontSize: string;\n\tcolor: string;\n\tpadding: string;\n} {\n\treturn {\n\t\tbackground: \"transparent\",\n\t\tborder: \"none\",\n\t\tborderRadius: \"0\",\n\t\tboxShadow: \"none\",\n\t\tfontSize: chartFontSize(\"tooltipBody\"),\n\t\tcolor: \"hsl(var(--basalt-foreground))\",\n\t\tpadding: \"0\",\n\t};\n}\n\nexport function chartTooltipProps(options?: {\n\tformatter?: (value: number) => string;\n\tcursor?: \"bar\" | \"line\" | false;\n\tcustomTooltip?: (props: {\n\t\tactive?: boolean;\n\t\tpayload?: readonly ChartTooltipItem[];\n\t\tlabel?: string | number;\n\t}) => ReactNode;\n}) {\n\tconst cursor =\n\t\toptions?.cursor === false\n\t\t\t? false\n\t\t\t: options?.cursor === \"line\"\n\t\t\t\t? CHART_TOOLTIP_CURSOR_LINE\n\t\t\t\t: CHART_TOOLTIP_CURSOR_BAR;\n\treturn {\n\t\tisAnimationActive: false,\n\t\tanimationDuration: 0,\n\t\toffset: 12,\n\t\tallowEscapeViewBox: { x: false, y: false },\n\t\tcursor,\n\t\twrapperStyle: {\n\t\t\toutline: \"none\",\n\t\t\tzIndex: 40,\n\t\t\tpointerEvents: \"none\" as const,\n\t\t\ttransition: \"none\",\n\t\t\tanimation: \"none\",\n\t\t},\n\t\tcontentStyle: chartTooltipContentStyle(),\n\t\tcontent: ((props: {\n\t\t\tactive?: boolean;\n\t\t\tpayload?: readonly ChartTooltipItem[];\n\t\t\tlabel?: unknown;\n\t\t}) => {\n\t\t\tif (options?.customTooltip) {\n\t\t\t\treturn options.customTooltip({\n\t\t\t\t\tactive: props.active,\n\t\t\t\t\tpayload: props.payload,\n\t\t\t\t\tlabel: props.label as string | number | undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createElement(ChartTooltipContent, {\n\t\t\t\tactive: props.active,\n\t\t\t\tpayload: props.payload,\n\t\t\t\tlabel: props.label as string | number | undefined,\n\t\t\t\tformatter: options?.formatter,\n\t\t\t});\n\t\t}) as never,\n\t};\n}\n\nexport function seriesColor(\n\tseries: ChartSeriesDescriptor | undefined,\n\tindex: number,\n): string | undefined {\n\treturn series?.color ?? CHART_COLORS[index % CHART_COLORS.length];\n}\n\nexport const RESPONSIVE_CONTAINER_PROPS = {\n\twidth: \"100%\" as const,\n\theight: \"100%\" as const,\n\tminWidth: 0,\n\tminHeight: 0,\n\tdebounce: 150,\n};\n\nexport const CHART_PLOT_MARGIN = {\n\ttop: 4,\n\tright: 4,\n\tbottom: 0,\n\tleft: 0,\n} as const;\n\nexport const CHART_PLOT_MARGIN_BARE = {\n\ttop: 2,\n\tright: 2,\n\tbottom: 2,\n\tleft: 2,\n} as const;\n"],"mappings":";;;;;AASA,IAAaA,IAAa;CACzB,cAAc;CACd,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,YAAY;CACZ,aAAa;CACb,UAAU;CACV,aAAa;CACb,eAAe;AAChB;AAEA,SAAgBC,EAAc,GAA6B;CAU1D,OATIC,MAAS,WACLF,EAAW,iBAEfE,MAAS,iBACLF,EAAW,mBAEfE,MAAS,gBACLF,EAAW,kBAEZA,EAAW;AACnB;AAEA,SAAgBG,EAAe,GAA2C;CACzE,OAAO,EAAE,UAAUF,EAAcC,CAAI,EAAE;AACxC;AAEA,SAAgBE,EAAe,IAAsB,QAGnD;CACD,OAAO;EAAE,UAAUH,EAAcC,CAAI;EAAG,MAAMG;CAAU;AACzD;AAEA,SAAgBC,EAAc,GAAuB;CACpD,OAAOC,EAAaC,IAAQD,EAAa,WAAWA,E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,GAAQ,SAASlB,EAAaC,IAAQD,EAAa;AAC3D;AAEA,IAAamB,IAA6B;CACzC,OAAO;CACP,QAAQ;CACR,UAAU;CACV,WAAW;CACX,UAAU;AACX,GAEaC,IAAoB;CAChC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACP,GAEaC,IAAyB;CACrC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;AACP"}
@@ -35,7 +35,7 @@ function p({ value: e, defaultValue: i = "", onChange: u, disabled: d, ariaLabel
35
35
  e === void 0 && g(t), u?.(t);
36
36
  }
37
37
  return /* @__PURE__ */ c("div", {
38
- className: "inline-flex items-center gap-1",
38
+ className: "inline-flex items-center gap-basalt-space-sm",
39
39
  children: [
40
40
  /* @__PURE__ */ s(t, {
41
41
  variant: "outline",
@@ -72,44 +72,44 @@ function m({ selectedDate: t, onPrevDay: n, onNextDay: r, onToday: l, onToggleCa
72
72
  timeZone: v
73
73
  })), x = d(u(t, v), u(/* @__PURE__ */ new Date(), v)), S = b(t);
74
74
  return /* @__PURE__ */ c("div", {
75
- className: e("flex items-center justify-center gap-2", y),
75
+ className: e("flex items-center justify-center gap-basalt-space-lg", y),
76
76
  children: [
77
77
  /* @__PURE__ */ s("button", {
78
78
  type: "button",
79
79
  onClick: l,
80
80
  disabled: x,
81
- className: e("mr-2 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors", x ? "cursor-not-allowed text-basalt-muted-foreground opacity-50" : "bg-basalt-secondary text-basalt-foreground hover:bg-basalt-accent"),
81
+ className: e("mr-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-base font-medium transition-colors basalt-motion", x ? "cursor-not-allowed text-basalt-muted-foreground opacity-50" : "bg-basalt-secondary text-basalt-foreground hover:bg-basalt-hover"),
82
82
  children: p
83
83
  }),
84
84
  /* @__PURE__ */ s("button", {
85
85
  type: "button",
86
86
  onClick: n,
87
87
  "aria-label": m,
88
- className: "flex h-8 w-8 items-center justify-center rounded-lg text-basalt-muted-foreground transition-colors hover:bg-basalt-accent hover:text-basalt-foreground",
88
+ className: "flex h-basalt-8 w-basalt-8 items-center justify-center rounded-basalt-md text-basalt-muted-foreground transition-colors basalt-motion hover:bg-basalt-hover hover:text-basalt-foreground",
89
89
  children: /* @__PURE__ */ s(a, {
90
- className: "h-4 w-4",
90
+ className: "h-basalt-4 w-basalt-4",
91
91
  strokeWidth: 1.5
92
92
  })
93
93
  }),
94
94
  f ? /* @__PURE__ */ c("button", {
95
95
  type: "button",
96
96
  onClick: f,
97
- className: "flex cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 text-lg font-medium transition-colors hover:bg-basalt-accent",
97
+ className: "flex cursor-pointer items-center gap-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-xl font-medium transition-colors basalt-motion hover:bg-basalt-hover",
98
98
  children: [/* @__PURE__ */ s("span", { children: S }), /* @__PURE__ */ s(i, {
99
- className: "h-4 w-4 text-basalt-muted-foreground",
99
+ className: "h-basalt-4 w-basalt-4 text-basalt-muted-foreground",
100
100
  strokeWidth: 1.5
101
101
  })]
102
102
  }) : /* @__PURE__ */ s("span", {
103
- className: "flex items-center gap-2 rounded-lg px-3 py-1.5 text-lg font-medium",
103
+ className: "flex items-center gap-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-xl font-medium",
104
104
  children: S
105
105
  }),
106
106
  /* @__PURE__ */ s("button", {
107
107
  type: "button",
108
108
  onClick: r,
109
109
  "aria-label": h,
110
- className: "flex h-8 w-8 items-center justify-center rounded-lg text-basalt-muted-foreground transition-colors hover:bg-basalt-accent hover:text-basalt-foreground",
110
+ className: "flex h-basalt-8 w-basalt-8 items-center justify-center rounded-basalt-md text-basalt-muted-foreground transition-colors basalt-motion hover:bg-basalt-hover hover:text-basalt-foreground",
111
111
  children: /* @__PURE__ */ s(o, {
112
- className: "h-4 w-4",
112
+ className: "h-basalt-4 w-basalt-4",
113
113
  strokeWidth: 1.5
114
114
  })
115
115
  })
@@ -1 +1 @@
1
- {"version":3,"file":"date-navigation.js","names":["CalendarIcon","shiftIso","match","value","date","delta","civilInZone","parts","read","part","type","isSameCivil","left","right","DateNavigation","props","DateNavigationDisplay","DateNavigationPicker","ariaLabelAttr","uncontrolled","setUncontrolled","useState","defaultValue","selected","commit","next","onChange","Button","ChevronLeft","DatePicker","ariaLabel","ChevronRight","resolvedFormatDate","formatDate","locale","isToday","selectedDate","timeZone","formatted","cn","className","onToday","todayLabel","onPrevDay","previousDayLabel","onToggleCalendar","Calendar","onNextDay","nextDayLabel"],"sources":["../../src/charts/date-navigation.tsx"],"sourcesContent":["import { Calendar as CalendarIcon, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { type ComponentProps, useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { DatePicker } from \"../components/date-picker\";\nimport { cn } from \"../utils/cn\";\n\nfunction shiftIso(value: string, delta: number) {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tconst date = match\n\t\t? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]))\n\t\t: new Date();\n\tdate.setDate(date.getDate() + delta);\n\tconst year = date.getFullYear();\n\tconst month = String(date.getMonth() + 1).padStart(2, \"0\");\n\tconst day = String(date.getDate()).padStart(2, \"0\");\n\treturn `${year}-${month}-${day}`;\n}\n\nfunction civilInZone(date: Date, timeZone?: string) {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(date);\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction isSameCivil(\n\tleft: { y: number; m: number; d: number },\n\tright: { y: number; m: number; d: number },\n) {\n\treturn left.y === right.y && left.m === right.m && left.d === right.d;\n}\n\ntype PickerProps = ComponentProps<typeof DatePicker> & {\n\tariaLabel?: string;\n\tselectedDate?: undefined;\n};\n\ntype DisplayProps = {\n\tselectedDate: Date;\n\tonPrevDay: () => void;\n\tonNextDay: () => void;\n\tonToday: () => void;\n\tonToggleCalendar?: () => void;\n\ttodayLabel?: string;\n\tpreviousDayLabel?: string;\n\tnextDayLabel?: string;\n\tformatDate?: (date: Date) => string;\n\tlocale?: string;\n\ttimeZone?: string;\n\tclassName?: string;\n};\n\nexport type DateNavigationPickerProps = {\n\tariaLabel?: string;\n\tclassName?: string;\n};\n\nexport type DateNavigationDisplayProps = DisplayProps;\n\nexport function DateNavigation(props: PickerProps | DisplayProps) {\n\tif (\"onPrevDay\" in props) {\n\t\treturn <DateNavigationDisplay {...props} />;\n\t}\n\treturn <DateNavigationPicker {...props} />;\n}\n\nfunction DateNavigationPicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tdisabled,\n\tariaLabel,\n\t\"aria-label\": ariaLabelAttr,\n\t...props\n}: PickerProps) {\n\tconst [uncontrolled, setUncontrolled] = useState(value ?? defaultValue);\n\tconst selected = value ?? uncontrolled;\n\tfunction commit(next: string) {\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tonChange?.(next);\n\t}\n\treturn (\n\t\t<div className=\"inline-flex items-center gap-1\">\n\t\t\t<Button\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-label=\"Previous day\"\n\t\t\t\tonClick={() => commit(shiftIso(selected, -1))}\n\t\t\t>\n\t\t\t\t<ChevronLeft />\n\t\t\t</Button>\n\t\t\t<DatePicker\n\t\t\t\t{...props}\n\t\t\t\tvalue={selected}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={commit}\n\t\t\t\taria-label={ariaLabel ?? ariaLabelAttr ?? \"Date navigation\"}\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-label=\"Next day\"\n\t\t\t\tonClick={() => commit(shiftIso(selected, 1))}\n\t\t\t>\n\t\t\t\t<ChevronRight />\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nfunction DateNavigationDisplay({\n\tselectedDate,\n\tonPrevDay,\n\tonNextDay,\n\tonToday,\n\tonToggleCalendar,\n\ttodayLabel = \"Today\",\n\tpreviousDayLabel = \"Previous day\",\n\tnextDayLabel = \"Next day\",\n\tformatDate,\n\tlocale = \"en-US\",\n\ttimeZone,\n\tclassName,\n}: DisplayProps) {\n\tconst resolvedFormatDate =\n\t\tformatDate ??\n\t\t((date: Date) =>\n\t\t\tdate.toLocaleDateString(locale, {\n\t\t\t\tweekday: \"short\",\n\t\t\t\tyear: \"numeric\",\n\t\t\t\tmonth: \"short\",\n\t\t\t\tday: \"numeric\",\n\t\t\t\ttimeZone,\n\t\t\t}));\n\tconst isToday = isSameCivil(\n\t\tcivilInZone(selectedDate, timeZone),\n\t\tcivilInZone(new Date(), timeZone),\n\t);\n\tconst formatted = resolvedFormatDate(selectedDate);\n\treturn (\n\t\t<div className={cn(\"flex items-center justify-center gap-2\", className)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onToday}\n\t\t\t\tdisabled={isToday}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"mr-2 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors\",\n\t\t\t\t\tisToday\n\t\t\t\t\t\t? \"cursor-not-allowed text-basalt-muted-foreground opacity-50\"\n\t\t\t\t\t\t: \"bg-basalt-secondary text-basalt-foreground hover:bg-basalt-accent\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{todayLabel}\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onPrevDay}\n\t\t\t\taria-label={previousDayLabel}\n\t\t\t\tclassName=\"flex h-8 w-8 items-center justify-center rounded-lg text-basalt-muted-foreground transition-colors hover:bg-basalt-accent hover:text-basalt-foreground\"\n\t\t\t>\n\t\t\t\t<ChevronLeft className=\"h-4 w-4\" strokeWidth={1.5} />\n\t\t\t</button>\n\t\t\t{onToggleCalendar ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={onToggleCalendar}\n\t\t\t\t\tclassName=\"flex cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 text-lg font-medium transition-colors hover:bg-basalt-accent\"\n\t\t\t\t>\n\t\t\t\t\t<span>{formatted}</span>\n\t\t\t\t\t<CalendarIcon className=\"h-4 w-4 text-basalt-muted-foreground\" strokeWidth={1.5} />\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\t<span className=\"flex items-center gap-2 rounded-lg px-3 py-1.5 text-lg font-medium\">\n\t\t\t\t\t{formatted}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onNextDay}\n\t\t\t\taria-label={nextDayLabel}\n\t\t\t\tclassName=\"flex h-8 w-8 items-center justify-center rounded-lg text-basalt-muted-foreground transition-colors hover:bg-basalt-accent hover:text-basalt-foreground\"\n\t\t\t>\n\t\t\t\t<ChevronRight className=\"h-4 w-4\" strokeWidth={1.5} />\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAMA,SAASC,EAAS,GAAe,GAAe;CAC/C,IAAMC,IAAQ,6BAA6B,KAAKC,CAAK,GAC/CC,IAAOF,IACV,IAAI,KAAK,OAAOA,EAAM,EAAE,GAAG,OAAOA,EAAM,EAAE,IAAI,GAAG,OAAOA,EAAM,EAAE,CAAC,oBACjE,IAAI,KAAK;CAKZ,OAJAE,EAAK,QAAQA,EAAK,QAAQ,IAAIC,CAAK,GAI5B,GAHMD,EAAK,YAGR,EAAK,GAFD,OAAOA,EAAK,SAAS,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG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CAAA;GAC9C,CAAA;EACJ;;AAEP"}
1
+ {"version":3,"file":"date-navigation.js","names":["CalendarIcon","shiftIso","match","value","date","delta","civilInZone","parts","read","part","type","isSameCivil","left","right","DateNavigation","props","DateNavigationDisplay","DateNavigationPicker","ariaLabelAttr","uncontrolled","setUncontrolled","useState","defaultValue","selected","commit","next","onChange","Button","ChevronLeft","DatePicker","ariaLabel","ChevronRight","resolvedFormatDate","formatDate","locale","isToday","selectedDate","timeZone","formatted","cn","className","onToday","todayLabel","onPrevDay","previousDayLabel","onToggleCalendar","Calendar","onNextDay","nextDayLabel"],"sources":["../../src/charts/date-navigation.tsx"],"sourcesContent":["import { Calendar as CalendarIcon, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { type ComponentProps, useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { DatePicker } from \"../components/date-picker\";\nimport { cn } from \"../utils/cn\";\n\nfunction shiftIso(value: string, delta: number) {\n\tconst match = /^(\\d{4,})-(\\d{2})-(\\d{2})$/.exec(value);\n\tconst date = match\n\t\t? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]))\n\t\t: new Date();\n\tdate.setDate(date.getDate() + delta);\n\tconst year = date.getFullYear();\n\tconst month = String(date.getMonth() + 1).padStart(2, \"0\");\n\tconst day = String(date.getDate()).padStart(2, \"0\");\n\treturn `${year}-${month}-${day}`;\n}\n\nfunction civilInZone(date: Date, timeZone?: string) {\n\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\ttimeZone,\n\t\tyear: \"numeric\",\n\t\tmonth: \"2-digit\",\n\t\tday: \"2-digit\",\n\t}).formatToParts(date);\n\tconst read = (type: Intl.DateTimeFormatPartTypes) =>\n\t\tNumber(parts.find((part) => part.type === type)?.value);\n\treturn { y: read(\"year\"), m: read(\"month\"), d: read(\"day\") };\n}\n\nfunction isSameCivil(\n\tleft: { y: number; m: number; d: number },\n\tright: { y: number; m: number; d: number },\n) {\n\treturn left.y === right.y && left.m === right.m && left.d === right.d;\n}\n\ntype PickerProps = ComponentProps<typeof DatePicker> & {\n\tariaLabel?: string;\n\tselectedDate?: undefined;\n};\n\ntype DisplayProps = {\n\tselectedDate: Date;\n\tonPrevDay: () => void;\n\tonNextDay: () => void;\n\tonToday: () => void;\n\tonToggleCalendar?: () => void;\n\ttodayLabel?: string;\n\tpreviousDayLabel?: string;\n\tnextDayLabel?: string;\n\tformatDate?: (date: Date) => string;\n\tlocale?: string;\n\ttimeZone?: string;\n\tclassName?: string;\n};\n\nexport type DateNavigationPickerProps = {\n\tariaLabel?: string;\n\tclassName?: string;\n};\n\nexport type DateNavigationDisplayProps = DisplayProps;\n\nexport function DateNavigation(props: PickerProps | DisplayProps) {\n\tif (\"onPrevDay\" in props) {\n\t\treturn <DateNavigationDisplay {...props} />;\n\t}\n\treturn <DateNavigationPicker {...props} />;\n}\n\nfunction DateNavigationPicker({\n\tvalue,\n\tdefaultValue = \"\",\n\tonChange,\n\tdisabled,\n\tariaLabel,\n\t\"aria-label\": ariaLabelAttr,\n\t...props\n}: PickerProps) {\n\tconst [uncontrolled, setUncontrolled] = useState(value ?? defaultValue);\n\tconst selected = value ?? uncontrolled;\n\tfunction commit(next: string) {\n\t\tif (value === undefined) {\n\t\t\tsetUncontrolled(next);\n\t\t}\n\t\tonChange?.(next);\n\t}\n\treturn (\n\t\t<div className=\"inline-flex items-center gap-basalt-space-sm\">\n\t\t\t<Button\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-label=\"Previous day\"\n\t\t\t\tonClick={() => commit(shiftIso(selected, -1))}\n\t\t\t>\n\t\t\t\t<ChevronLeft />\n\t\t\t</Button>\n\t\t\t<DatePicker\n\t\t\t\t{...props}\n\t\t\t\tvalue={selected}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={commit}\n\t\t\t\taria-label={ariaLabel ?? ariaLabelAttr ?? \"Date navigation\"}\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tdisabled={disabled}\n\t\t\t\taria-label=\"Next day\"\n\t\t\t\tonClick={() => commit(shiftIso(selected, 1))}\n\t\t\t>\n\t\t\t\t<ChevronRight />\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nfunction DateNavigationDisplay({\n\tselectedDate,\n\tonPrevDay,\n\tonNextDay,\n\tonToday,\n\tonToggleCalendar,\n\ttodayLabel = \"Today\",\n\tpreviousDayLabel = \"Previous day\",\n\tnextDayLabel = \"Next day\",\n\tformatDate,\n\tlocale = \"en-US\",\n\ttimeZone,\n\tclassName,\n}: DisplayProps) {\n\tconst resolvedFormatDate =\n\t\tformatDate ??\n\t\t((date: Date) =>\n\t\t\tdate.toLocaleDateString(locale, {\n\t\t\t\tweekday: \"short\",\n\t\t\t\tyear: \"numeric\",\n\t\t\t\tmonth: \"short\",\n\t\t\t\tday: \"numeric\",\n\t\t\t\ttimeZone,\n\t\t\t}));\n\tconst isToday = isSameCivil(\n\t\tcivilInZone(selectedDate, timeZone),\n\t\tcivilInZone(new Date(), timeZone),\n\t);\n\tconst formatted = resolvedFormatDate(selectedDate);\n\treturn (\n\t\t<div className={cn(\"flex items-center justify-center gap-basalt-space-lg\", className)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onToday}\n\t\t\t\tdisabled={isToday}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"mr-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-base font-medium transition-colors basalt-motion\",\n\t\t\t\t\tisToday\n\t\t\t\t\t\t? \"cursor-not-allowed text-basalt-muted-foreground opacity-50\"\n\t\t\t\t\t\t: \"bg-basalt-secondary text-basalt-foreground hover:bg-basalt-hover\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{todayLabel}\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onPrevDay}\n\t\t\t\taria-label={previousDayLabel}\n\t\t\t\tclassName=\"flex h-basalt-8 w-basalt-8 items-center justify-center rounded-basalt-md text-basalt-muted-foreground transition-colors basalt-motion hover:bg-basalt-hover hover:text-basalt-foreground\"\n\t\t\t>\n\t\t\t\t<ChevronLeft className=\"h-basalt-4 w-basalt-4\" strokeWidth={1.5} />\n\t\t\t</button>\n\t\t\t{onToggleCalendar ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={onToggleCalendar}\n\t\t\t\t\tclassName=\"flex cursor-pointer items-center gap-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-xl font-medium transition-colors basalt-motion hover:bg-basalt-hover\"\n\t\t\t\t>\n\t\t\t\t\t<span>{formatted}</span>\n\t\t\t\t\t<CalendarIcon\n\t\t\t\t\t\tclassName=\"h-basalt-4 w-basalt-4 text-basalt-muted-foreground\"\n\t\t\t\t\t\tstrokeWidth={1.5}\n\t\t\t\t\t/>\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\t<span className=\"flex items-center gap-basalt-space-lg rounded-basalt-md px-basalt-space-lg py-basalt-space-md text-basalt-xl font-medium\">\n\t\t\t\t\t{formatted}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onNextDay}\n\t\t\t\taria-label={nextDayLabel}\n\t\t\t\tclassName=\"flex h-basalt-8 w-basalt-8 items-center justify-center rounded-basalt-md text-basalt-muted-foreground transition-colors basalt-motion hover:bg-basalt-hover hover:text-basalt-foreground\"\n\t\t\t>\n\t\t\t\t<ChevronRight className=\"h-basalt-4 w-basalt-4\" strokeWidth={1.5} />\n\t\t\t</button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAMA,SAASC,EAAS,GAAe,GAAe;CAC/C,IAAMC,IAAQ,6BAA6B,KAAKC,CAAK,GAC/CC,IAAOF,IACV,IAAI,KAAK,OAAOA,E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,GAAD;KACC,WAAU;KACV,aAAa;IACb,CAAA,CACM;GAER,CAAA,IAAA,kBAAC,QAAD;IAAM,WAAU;IACd,UAAAsC;GACI,CAAA;GAEP,kBAAC,UAAD;IACC,MAAK;IACL,SAASS;IACT,cAAYC;IACZ,WAAU;IAEV,UAAA,kBAACjB,GAAD;KAAc,WAAU;KAAwB,aAAa;IAAM,CAAA;GAC5D,CAAA;EACJ;;AAEP"}
@@ -17,7 +17,7 @@ function d({ data: d, series: f, ariaLabel: p = "Donut chart", className: m, sho
17
17
  return /* @__PURE__ */ a(r, {
18
18
  ariaLabel: p,
19
19
  className: m,
20
- size: "h-36 w-36",
20
+ size: "h-basalt-36 w-basalt-36",
21
21
  legend: h ? /* @__PURE__ */ a(i, {
22
22
  items: b,
23
23
  shape: "bar"
@@ -1 +1 @@
1
- {"version":3,"file":"donut.js","names":["DonutChart","legendItems","data","item","series","candidate","entry","index","seriesColor","ChartShell","showLegend","ChartLegend","PieChart","Pie","ANIMATION_PROPS","Cell","Tooltip","chartTooltipProps","valueFormatter"],"sources":["../../src/charts/donut.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Cell, Pie, PieChart, Tooltip } from \"recharts\";\nimport { ANIMATION_PROPS, chartTooltipProps, seriesColor } from \"./config\";\nimport { ChartShell } from \"./frame\";\nimport { ChartLegend } from \"./legend\";\nimport type { ChartSeriesDescriptor, NamedValue } from \"./series\";\n\nexport type DonutChartProps = {\n\tdata: NamedValue[];\n\tseries?: ChartSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowLegend?: boolean;\n\tvalueFormatter?: (value: number) => string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport function DonutChart({\n\tdata,\n\tseries,\n\tariaLabel = \"Donut chart\",\n\tclassName,\n\tshowLegend = false,\n\tvalueFormatter,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer,\n}: DonutChartProps) {\n\tconst legendItems = data.map((entry, index) => {\n\t\tconst item = series?.find((candidate) => candidate.key === entry.name);\n\t\treturn {\n\t\t\tkey: `${entry.name}-${index}`,\n\t\t\tlabel: item?.label ?? entry.name,\n\t\t\tcolor: seriesColor(item, index),\n\t\t};\n\t});\n\treturn (\n\t\t<ChartShell\n\t\t\tariaLabel={ariaLabel}\n\t\t\tclassName={className}\n\t\t\tsize=\"h-36 w-36\"\n\t\t\tlegend={showLegend ? <ChartLegend items={legendItems} shape=\"bar\" /> : undefined}\n\t\t\tsummary={summary}\n\t\t\tdataAlternative={dataAlternative}\n\t\t\taccessibilityLayer={accessibilityLayer}\n\t\t>\n\t\t\t<PieChart>\n\t\t\t\t<Pie\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tnameKey=\"name\"\n\t\t\t\t\tinnerRadius={24}\n\t\t\t\t\touterRadius={48}\n\t\t\t\t\tstroke=\"none\"\n\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t>\n\t\t\t\t\t{data.map((entry, index) => {\n\t\t\t\t\t\tconst item = series?.find((candidate) => candidate.key === entry.name);\n\t\t\t\t\t\treturn <Cell key={`${entry.name}-${index}`} fill={seriesColor(item, index)} />;\n\t\t\t\t\t})}\n\t\t\t\t</Pie>\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: false })} />\n\t\t\t</PieChart>\n\t\t</ChartShell>\n\t);\n}\n"],"mappings":";;;;;;;AAgCA,SAAgBA,EAAW,EAC1B,SACA,WACA,eAAY,eACZ,cACA,gBAAa,IACb,mBACA,YACA,oBACA,yBACmB;CACnB,IAAMC,IAAcC,EAAK,KAAK,GAAO,MAAU;EAC9C,IAAMC,IAAOC,GAAQ,MAAM,MAAcC,EAAU,QAAQC,EAAM,IAAI;EACrE,OAAO;GACN,KAAK,GAAGA,EAAM,KAAK,GAAGC;GACtB,OAAOJ,GAAM,SAASG,EAAM;GAC5B,OAAOE,EAAYL,GAAMI,CAAK;EAC/B;CACD,CAAC;CACD,OACC,kBAACE,GAAD;EACY;EACA;EACX,MAAK;EACL,QAAQC,IAAa,kBAACC,GAAD;GAAa,OAAOV;GAAa,OAAM;EAAO,CAAA,IAAI,KAAA;EAC9D;EACQ;EACG;EAEpB,UAAA,kBAACW,GAAD,EAAA,UAAA,CACC,kBAACC,GAAD;GACO;GACN,SAAQ;GACR,SAAQ;GACR,aAAa;GACb,aAAa;GACb,QAAO;GACP,GAAIC;GAEH,UAAAZ,EAAK,KAAK,GAAO,MAAU;IAC3B,IAAMC,IAAOC,GAAQ,MAAM,MAAcC,EAAU,QAAQC,EAAM,IAAI;IACrE,OAAO,kBAACS,GAAD,EAAqC,MAAMP,EAAYL,GAAMI,CAAK,EAAI,GAA3D,GAAGD,EAAM,KAAK,GAAGC,GAA0C;GAC9E,CAAC;EACG,CAAA,GACL,kBAACS,GAAD,EAAS,GAAIC,EAAkB;GAAE,WAAWC;GAAgB,QAAQ;EAAM,CAAC,EAAI,CAAA,CACtE,EAAA,CAAA;CACC,CAAA;AAEd"}
1
+ {"version":3,"file":"donut.js","names":["DonutChart","legendItems","data","item","series","candidate","entry","index","seriesColor","ChartShell","showLegend","ChartLegend","PieChart","Pie","ANIMATION_PROPS","Cell","Tooltip","chartTooltipProps","valueFormatter"],"sources":["../../src/charts/donut.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Cell, Pie, PieChart, Tooltip } from \"recharts\";\nimport { ANIMATION_PROPS, chartTooltipProps, seriesColor } from \"./config\";\nimport { ChartShell } from \"./frame\";\nimport { ChartLegend } from \"./legend\";\nimport type { ChartSeriesDescriptor, NamedValue } from \"./series\";\n\nexport type DonutChartProps = {\n\tdata: NamedValue[];\n\tseries?: ChartSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\tshowLegend?: boolean;\n\tvalueFormatter?: (value: number) => string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport function DonutChart({\n\tdata,\n\tseries,\n\tariaLabel = \"Donut chart\",\n\tclassName,\n\tshowLegend = false,\n\tvalueFormatter,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer,\n}: DonutChartProps) {\n\tconst legendItems = data.map((entry, index) => {\n\t\tconst item = series?.find((candidate) => candidate.key === entry.name);\n\t\treturn {\n\t\t\tkey: `${entry.name}-${index}`,\n\t\t\tlabel: item?.label ?? entry.name,\n\t\t\tcolor: seriesColor(item, index),\n\t\t};\n\t});\n\treturn (\n\t\t<ChartShell\n\t\t\tariaLabel={ariaLabel}\n\t\t\tclassName={className}\n\t\t\tsize=\"h-basalt-36 w-basalt-36\"\n\t\t\tlegend={showLegend ? <ChartLegend items={legendItems} shape=\"bar\" /> : undefined}\n\t\t\tsummary={summary}\n\t\t\tdataAlternative={dataAlternative}\n\t\t\taccessibilityLayer={accessibilityLayer}\n\t\t>\n\t\t\t<PieChart>\n\t\t\t\t<Pie\n\t\t\t\t\tdata={data}\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tnameKey=\"name\"\n\t\t\t\t\tinnerRadius={24}\n\t\t\t\t\touterRadius={48}\n\t\t\t\t\tstroke=\"none\"\n\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t>\n\t\t\t\t\t{data.map((entry, index) => {\n\t\t\t\t\t\tconst item = series?.find((candidate) => candidate.key === entry.name);\n\t\t\t\t\t\treturn <Cell key={`${entry.name}-${index}`} fill={seriesColor(item, index)} />;\n\t\t\t\t\t})}\n\t\t\t\t</Pie>\n\t\t\t\t<Tooltip {...chartTooltipProps({ formatter: valueFormatter, cursor: false })} />\n\t\t\t</PieChart>\n\t\t</ChartShell>\n\t);\n}\n"],"mappings":";;;;;;;AAgCA,SAAgBA,EAAW,EAC1B,SACA,WACA,eAAY,eACZ,cACA,gBAAa,IACb,mBACA,YACA,oBACA,yBACmB;CACnB,IAAMC,IAAcC,EAAK,KAAK,GAAO,MAAU;EAC9C,IAAMC,IAAOC,GAAQ,MAAM,MAAcC,EAAU,QAAQC,EAAM,IAAI;EACrE,OAAO;GACN,KAAK,GAAGA,EAAM,KAAK,GAAGC;GACtB,OAAOJ,GAAM,SAASG,EAAM;GAC5B,OAAOE,EAAYL,GAAMI,CAAK;EAC/B;CACD,CAAC;CACD,OACC,kBAACE,GAAD;EACY;EACA;EACX,MAAK;EACL,QAAQC,IAAa,kBAACC,GAAD;GAAa,OAAOV;GAAa,OAAM;EAAO,CAAA,IAAI,KAAA;EAC9D;EACQ;EACG;EAEpB,UAAA,kBAACW,GAAD,EAAA,UAAA,CACC,kBAACC,GAAD;GACO;GACN,SAAQ;GACR,SAAQ;GACR,aAAa;GACb,aAAa;GACb,QAAO;GACP,GAAIC;GAEH,UAAAZ,EAAK,KAAK,GAAO,MAAU;IAC3B,IAAMC,IAAOC,GAAQ,MAAM,MAAcC,EAAU,QAAQC,EAAM,IAAI;IACrE,OAAO,kBAACS,GAAD,EAAqC,MAAMP,EAAYL,GAAMI,CAAK,EAAI,GAA3D,GAAGD,EAAM,KAAK,GAAGC,GAA0C;GAC9E,CAAC;EACG,CAAA,GACL,kBAACS,GAAD,EAAS,GAAIC,EAAkB;GAAE,WAAWC;GAAgB,QAAQ;EAAM,CAAC,EAAI,CAAA,CACtE,EAAA,CAAA;CACC,CAAA;AAEd"}
@@ -19,7 +19,7 @@ export type ChartFrameProps = {
19
19
  }>;
20
20
  /**
21
21
  * Tailwind size classes for the chart container.
22
- * @default "h-36 w-56"
22
+ * @default "h-basalt-36 w-basalt-56"
23
23
  */
24
24
  size?: string;
25
25
  /**
@@ -8,7 +8,7 @@ import { ResponsiveContainer as o } from "recharts";
8
8
  function s(e) {
9
9
  return e != null && e !== !1;
10
10
  }
11
- function c({ ariaLabel: c, className: l, children: u, size: d = "h-36 w-56", legend: f, summary: p, dataAlternative: m, accessibilityLayer: h = !0 }) {
11
+ function c({ ariaLabel: c, className: l, children: u, size: d = "h-basalt-36 w-basalt-56", legend: f, summary: p, dataAlternative: m, accessibilityLayer: h = !0 }) {
12
12
  let g = r(), _ = s(p), v = s(m), y = u?.props ?? {}, b = y.accessibilityLayer, x = n(u, {
13
13
  accessibilityLayer: b === void 0 ? h : b,
14
14
  "aria-label": y["aria-label"] ?? c,
@@ -45,16 +45,16 @@ function c({ ariaLabel: c, className: l, children: u, size: d = "h-36 w-56", leg
45
45
  role: "group",
46
46
  "aria-label": c,
47
47
  "aria-describedby": _ ? g : void 0,
48
- className: "m-0 flex flex-col gap-2 p-0 min-h-0 min-w-0",
48
+ className: "relative m-0 flex flex-col gap-basalt-space-lg p-0 min-h-0 min-w-0",
49
49
  children: [
50
50
  _ ? /* @__PURE__ */ i("div", {
51
51
  id: g,
52
- className: "text-xs text-basalt-muted-foreground",
52
+ className: "text-basalt-sm text-basalt-muted-foreground",
53
53
  children: p
54
54
  }) : null,
55
55
  S,
56
56
  v ? /* @__PURE__ */ i("div", {
57
- className: "text-xs text-basalt-muted-foreground",
57
+ className: "text-basalt-sm text-basalt-muted-foreground",
58
58
  children: m
59
59
  }) : null
60
60
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"frame.js","names":["hasSlotContent","slot","ChartContainer","summaryId","useId","hasSummary","summary","hasAlternative","dataAlternative","childProps","children","childLayer","clonedChild","cloneElement","accessibilityLayer","ariaLabel","plotContainer","legend","cn","size","className","ResponsiveContainer","RESPONSIVE_CONTAINER_PROPS","ChartFrame","props","ChartShell"],"sources":["../../src/charts/frame.tsx"],"sourcesContent":["import { cloneElement, type ReactElement, type ReactNode, useId } from \"react\";\nimport { ResponsiveContainer } from \"recharts\";\nimport { cn } from \"../utils/cn\";\nimport { RESPONSIVE_CONTAINER_PROPS } from \"./config\";\n\nexport type ChartFrameProps = {\n\t/**\n\t * Accessible label describing the purpose or dataset of the chart.\n\t */\n\tariaLabel: string;\n\t/**\n\t * Additional CSS class names for styling the chart container.\n\t */\n\tclassName?: string;\n\t/**\n\t * Single child Recharts element to render inside the responsive container.\n\t * Explicit child accessibilityLayer prop takes precedence over wrapper prop, which defaults to true.\n\t */\n\tchildren: ReactElement<{\n\t\taccessibilityLayer?: boolean;\n\t\t\"aria-label\"?: string;\n\t\t\"aria-describedby\"?: string;\n\t}>;\n\t/**\n\t * Tailwind size classes for the chart container.\n\t * @default \"h-36 w-56\"\n\t */\n\tsize?: string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport type ChartShellProps = ChartFrameProps & {\n\t/**\n\t * Optional legend node rendered alongside the chart plot.\n\t */\n\tlegend?: ReactNode;\n};\n\nexport type ChartAccessibilityProps = Pick<\n\tChartFrameProps,\n\t\"summary\" | \"dataAlternative\" | \"accessibilityLayer\"\n>;\n\nfunction hasSlotContent(slot: ReactNode | undefined): boolean {\n\treturn slot !== undefined && slot !== null && slot !== false;\n}\n\nfunction ChartContainer({\n\tariaLabel,\n\tclassName,\n\tchildren,\n\tsize = \"h-36 w-56\",\n\tlegend,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer = true,\n}: ChartShellProps) {\n\tconst summaryId = useId();\n\tconst hasSummary = hasSlotContent(summary);\n\tconst hasAlternative = hasSlotContent(dataAlternative);\n\n\tconst childProps = (children?.props ?? {}) as {\n\t\taccessibilityLayer?: boolean;\n\t\t\"aria-label\"?: string;\n\t\t\"aria-describedby\"?: string;\n\t};\n\tconst childLayer = childProps.accessibilityLayer;\n\tconst resolvedLayer = childLayer !== undefined ? childLayer : accessibilityLayer;\n\n\tconst clonedChild = cloneElement(children, {\n\t\taccessibilityLayer: resolvedLayer,\n\t\t\"aria-label\": childProps[\"aria-label\"] ?? ariaLabel,\n\t\t\"aria-describedby\": childProps[\"aria-describedby\"] ?? (hasSummary ? summaryId : undefined),\n\t});\n\n\tlet plotContainer: ReactNode;\n\tif (hasSlotContent(legend)) {\n\t\tplotContainer = (\n\t\t\t<div\n\t\t\t\tdata-testid=\"chart-shell\"\n\t\t\t\tclassName={cn(size, className)}\n\t\t\t\tstyle={{ display: \"flex\", flexDirection: \"column\", minHeight: 0, minWidth: 0 }}\n\t\t\t>\n\t\t\t\t<div className=\"min-h-0 w-full flex-1 basalt-chart [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-basalt-ring\">\n\t\t\t\t\t<ResponsiveContainer {...RESPONSIVE_CONTAINER_PROPS}>{clonedChild}</ResponsiveContainer>\n\t\t\t\t</div>\n\t\t\t\t{legend}\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tplotContainer = (\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\tsize,\n\t\t\t\t\t\"min-h-0 min-w-0 basalt-chart [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-basalt-ring\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<ResponsiveContainer {...RESPONSIVE_CONTAINER_PROPS}>{clonedChild}</ResponsiveContainer>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (!hasSummary && !hasAlternative) {\n\t\treturn (\n\t\t\t<figure role=\"group\" aria-label={ariaLabel} className=\"contents m-0 p-0\">\n\t\t\t\t{plotContainer}\n\t\t\t</figure>\n\t\t);\n\t}\n\n\treturn (\n\t\t<figure\n\t\t\trole=\"group\"\n\t\t\taria-label={ariaLabel}\n\t\t\taria-describedby={hasSummary ? summaryId : undefined}\n\t\t\tclassName=\"m-0 flex flex-col gap-2 p-0 min-h-0 min-w-0\"\n\t\t>\n\t\t\t{hasSummary ? (\n\t\t\t\t<div id={summaryId} className=\"text-xs text-basalt-muted-foreground\">\n\t\t\t\t\t{summary}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{plotContainer}\n\t\t\t{hasAlternative ? (\n\t\t\t\t<div className=\"text-xs text-basalt-muted-foreground\">{dataAlternative}</div>\n\t\t\t) : null}\n\t\t</figure>\n\t);\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n\treturn <ChartContainer {...props} />;\n}\n\nexport function ChartShell(props: ChartShellProps) {\n\treturn <ChartContainer {...props} />;\n}\n"],"mappings":";;;;;;;AA0DA,SAASA,EAAe,GAAsC;CAC7D,OAAOC,KAA+B,QAAQA,MAAS;AACxD;AAEA,SAASC,EAAe,EACvB,cACA,cACA,aACA,UAAO,aACP,WACA,YACA,oBACA,wBAAqB,MACF;CACnB,IAAMC,IAAYC,EAAM,GAClBC,IAAaL,EAAeM,CAAO,GACnCC,IAAiBP,EAAeQ,CAAe,GAE/CC,IAAcC,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3,"file":"frame.js","names":["hasSlotContent","slot","ChartContainer","summaryId","useId","hasSummary","summary","hasAlternative","dataAlternative","childProps","children","childLayer","clonedChild","cloneElement","accessibilityLayer","ariaLabel","plotContainer","legend","cn","size","className","ResponsiveContainer","RESPONSIVE_CONTAINER_PROPS","ChartFrame","props","ChartShell"],"sources":["../../src/charts/frame.tsx"],"sourcesContent":["import { cloneElement, type ReactElement, type ReactNode, useId } from \"react\";\nimport { ResponsiveContainer } from \"recharts\";\nimport { cn } from \"../utils/cn\";\nimport { RESPONSIVE_CONTAINER_PROPS } from \"./config\";\n\nexport type ChartFrameProps = {\n\t/**\n\t * Accessible label describing the purpose or dataset of the chart.\n\t */\n\tariaLabel: string;\n\t/**\n\t * Additional CSS class names for styling the chart container.\n\t */\n\tclassName?: string;\n\t/**\n\t * Single child Recharts element to render inside the responsive container.\n\t * Explicit child accessibilityLayer prop takes precedence over wrapper prop, which defaults to true.\n\t */\n\tchildren: ReactElement<{\n\t\taccessibilityLayer?: boolean;\n\t\t\"aria-label\"?: string;\n\t\t\"aria-describedby\"?: string;\n\t}>;\n\t/**\n\t * Tailwind size classes for the chart container.\n\t * @default \"h-basalt-36 w-basalt-56\"\n\t */\n\tsize?: string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport type ChartShellProps = ChartFrameProps & {\n\t/**\n\t * Optional legend node rendered alongside the chart plot.\n\t */\n\tlegend?: ReactNode;\n};\n\nexport type ChartAccessibilityProps = Pick<\n\tChartFrameProps,\n\t\"summary\" | \"dataAlternative\" | \"accessibilityLayer\"\n>;\n\nfunction hasSlotContent(slot: ReactNode | undefined): boolean {\n\treturn slot !== undefined && slot !== null && slot !== false;\n}\n\nfunction ChartContainer({\n\tariaLabel,\n\tclassName,\n\tchildren,\n\tsize = \"h-basalt-36 w-basalt-56\",\n\tlegend,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer = true,\n}: ChartShellProps) {\n\tconst summaryId = useId();\n\tconst hasSummary = hasSlotContent(summary);\n\tconst hasAlternative = hasSlotContent(dataAlternative);\n\n\tconst childProps = (children?.props ?? {}) as {\n\t\taccessibilityLayer?: boolean;\n\t\t\"aria-label\"?: string;\n\t\t\"aria-describedby\"?: string;\n\t};\n\tconst childLayer = childProps.accessibilityLayer;\n\tconst resolvedLayer = childLayer !== undefined ? childLayer : accessibilityLayer;\n\n\tconst clonedChild = cloneElement(children, {\n\t\taccessibilityLayer: resolvedLayer,\n\t\t\"aria-label\": childProps[\"aria-label\"] ?? ariaLabel,\n\t\t\"aria-describedby\": childProps[\"aria-describedby\"] ?? (hasSummary ? summaryId : undefined),\n\t});\n\n\tlet plotContainer: ReactNode;\n\tif (hasSlotContent(legend)) {\n\t\tplotContainer = (\n\t\t\t<div\n\t\t\t\tdata-testid=\"chart-shell\"\n\t\t\t\tclassName={cn(size, className)}\n\t\t\t\tstyle={{ display: \"flex\", flexDirection: \"column\", minHeight: 0, minWidth: 0 }}\n\t\t\t>\n\t\t\t\t<div className=\"min-h-0 w-full flex-1 basalt-chart [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-basalt-ring\">\n\t\t\t\t\t<ResponsiveContainer {...RESPONSIVE_CONTAINER_PROPS}>{clonedChild}</ResponsiveContainer>\n\t\t\t\t</div>\n\t\t\t\t{legend}\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tplotContainer = (\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\tsize,\n\t\t\t\t\t\"min-h-0 min-w-0 basalt-chart [&_.recharts-surface:focus-visible]:outline-2 [&_.recharts-surface:focus-visible]:outline-offset-2 [&_.recharts-surface:focus-visible]:outline-basalt-ring\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<ResponsiveContainer {...RESPONSIVE_CONTAINER_PROPS}>{clonedChild}</ResponsiveContainer>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (!hasSummary && !hasAlternative) {\n\t\treturn (\n\t\t\t<figure role=\"group\" aria-label={ariaLabel} className=\"contents m-0 p-0\">\n\t\t\t\t{plotContainer}\n\t\t\t</figure>\n\t\t);\n\t}\n\n\treturn (\n\t\t<figure\n\t\t\trole=\"group\"\n\t\t\taria-label={ariaLabel}\n\t\t\taria-describedby={hasSummary ? summaryId : undefined}\n\t\t\tclassName=\"relative m-0 flex flex-col gap-basalt-space-lg p-0 min-h-0 min-w-0\"\n\t\t>\n\t\t\t{hasSummary ? (\n\t\t\t\t<div id={summaryId} className=\"text-basalt-sm text-basalt-muted-foreground\">\n\t\t\t\t\t{summary}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{plotContainer}\n\t\t\t{hasAlternative ? (\n\t\t\t\t<div className=\"text-basalt-sm text-basalt-muted-foreground\">{dataAlternative}</div>\n\t\t\t) : null}\n\t\t</figure>\n\t);\n}\n\nexport function ChartFrame(props: ChartFrameProps) {\n\treturn <ChartContainer {...props} />;\n}\n\nexport function ChartShell(props: ChartShellProps) {\n\treturn <ChartContainer {...props} />;\n}\n"],"mappings":";;;;;;;AA0DA,SAASA,EAAe,GAAsC;CAC7D,OAAOC,KAA+B,QAAQA,MAAS;AACxD;AAEA,SAASC,EAAe,EACvB,cACA,cACA,aACA,UAAO,2BACP,WACA,YACA,oBACA,wBAAqB,MACF;CACnB,IAAMC,IAAYC,EAAM,GAClBC,IAAaL,EAAeM,CAAO,GACnCC,IAAiBP,EAAeQ,CA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;AACpC"}
@@ -9,7 +9,7 @@ import { PolarAngleAxis as c, RadialBar as l, RadialBarChart as u } from "rechar
9
9
  //#region src/charts/gauge.tsx
10
10
  function d({ value: d, max: f = 100, series: p, ariaLabel: m = "Gauge", className: h, hideValue: g = !1, valueFormatter: _, summary: v, dataAlternative: y, accessibilityLayer: b }) {
11
11
  let x = a(), S = f === 0 ? 0 : Math.min(100, Math.max(0, d / f * 100)), C = _ ? _(d) : String(d), w = v != null && v !== !1, T = y != null && y !== !1, E = /* @__PURE__ */ s("div", {
12
- className: e("relative h-36 w-36", h),
12
+ className: e("relative h-basalt-36 w-basalt-36", h),
13
13
  children: [/* @__PURE__ */ o(i, {
14
14
  ariaLabel: m,
15
15
  className: "h-full w-full",
@@ -39,21 +39,21 @@ function d({ value: d, max: f = 100, series: p, ariaLabel: m = "Gauge", classNam
39
39
  })]
40
40
  })
41
41
  }), g ? null : /* @__PURE__ */ o("span", {
42
- className: "pointer-events-none absolute inset-0 flex items-center justify-center text-sm font-semibold text-basalt-foreground",
42
+ className: "pointer-events-none absolute inset-0 flex items-center justify-center text-basalt-base font-semibold text-basalt-foreground",
43
43
  children: C
44
44
  })]
45
45
  });
46
46
  return !w && !T ? E : /* @__PURE__ */ s("div", {
47
- className: "flex flex-col gap-2 min-h-0 min-w-0",
47
+ className: "flex flex-col gap-basalt-space-lg min-h-0 min-w-0",
48
48
  children: [
49
49
  w ? /* @__PURE__ */ o("div", {
50
50
  id: x,
51
- className: "text-xs text-basalt-muted-foreground",
51
+ className: "text-basalt-sm text-basalt-muted-foreground",
52
52
  children: v
53
53
  }) : null,
54
54
  E,
55
55
  T ? /* @__PURE__ */ o("div", {
56
- className: "text-xs text-basalt-muted-foreground",
56
+ className: "text-basalt-sm text-basalt-muted-foreground",
57
57
  children: y
58
58
  }) : null
59
59
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"gauge.js","names":["Gauge","summaryId","useId","percent","max","value","display","valueFormatter","hasSummary","summary","hasAlternative","dataAlternative","plot","cn","className","ChartFrame","RadialBarChart","PolarAngleAxis","RadialBar","seriesColor","series","chartMuted","ANIMATION_PROPS","hideValue"],"sources":["../../src/charts/gauge.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useId } from \"react\";\nimport { PolarAngleAxis, RadialBar, RadialBarChart } from \"recharts\";\nimport { cn } from \"../utils/cn\";\nimport { ANIMATION_PROPS, seriesColor } from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { chartMuted } from \"./palette\";\nimport type { ChartSeriesDescriptor } from \"./series\";\n\nexport type GaugeProps = {\n\tvalue: number;\n\tmax?: number;\n\tseries?: ChartSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\thideValue?: boolean;\n\tvalueFormatter?: (value: number) => string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport function Gauge({\n\tvalue,\n\tmax = 100,\n\tseries,\n\tariaLabel = \"Gauge\",\n\tclassName,\n\thideValue = false,\n\tvalueFormatter,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer,\n}: GaugeProps) {\n\tconst summaryId = useId();\n\tconst percent = max === 0 ? 0 : Math.min(100, Math.max(0, (value / max) * 100));\n\tconst display = valueFormatter ? valueFormatter(value) : String(value);\n\tconst hasSummary = summary !== undefined && summary !== null && summary !== false;\n\tconst hasAlternative =\n\t\tdataAlternative !== undefined && dataAlternative !== null && dataAlternative !== false;\n\n\tconst plot = (\n\t\t<div className={cn(\"relative h-36 w-36\", className)}>\n\t\t\t<ChartFrame\n\t\t\t\tariaLabel={ariaLabel}\n\t\t\t\tclassName=\"h-full w-full\"\n\t\t\t\tsize=\"h-full w-full\"\n\t\t\t\taccessibilityLayer={accessibilityLayer}\n\t\t\t>\n\t\t\t\t<RadialBarChart\n\t\t\t\t\tcx=\"50%\"\n\t\t\t\t\tcy=\"50%\"\n\t\t\t\t\tinnerRadius=\"75%\"\n\t\t\t\t\touterRadius=\"95%\"\n\t\t\t\t\tstartAngle={90}\n\t\t\t\t\tendAngle={-270}\n\t\t\t\t\tdata={[{ value: percent }]}\n\t\t\t\t\tbarSize={12}\n\t\t\t\t\t{...(hasSummary ? { \"aria-describedby\": summaryId } : {})}\n\t\t\t\t>\n\t\t\t\t\t<PolarAngleAxis type=\"number\" domain={[0, 100]} angleAxisId={0} tick={false} />\n\t\t\t\t\t<RadialBar\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tcornerRadius={6}\n\t\t\t\t\t\tfill={seriesColor(series?.[0], 2)}\n\t\t\t\t\t\tbackground={{ fill: chartMuted }}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t</RadialBarChart>\n\t\t\t</ChartFrame>\n\t\t\t{hideValue ? null : (\n\t\t\t\t<span className=\"pointer-events-none absolute inset-0 flex items-center justify-center text-sm font-semibold text-basalt-foreground\">\n\t\t\t\t\t{display}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t);\n\n\tif (!hasSummary && !hasAlternative) {\n\t\treturn plot;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-2 min-h-0 min-w-0\">\n\t\t\t{hasSummary ? (\n\t\t\t\t<div id={summaryId} className=\"text-xs text-basalt-muted-foreground\">\n\t\t\t\t\t{summary}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{plot}\n\t\t\t{hasAlternative ? (\n\t\t\t\t<div className=\"text-xs text-basalt-muted-foreground\">{dataAlternative}</div>\n\t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HG;GACAF,IACA,kBAAC,OAAD;IAAK,WAAU;IAAwC,UAAAC;GAAqB,CAAA,IACzE;EACA;;AAEP"}
1
+ {"version":3,"file":"gauge.js","names":["Gauge","summaryId","useId","percent","max","value","display","valueFormatter","hasSummary","summary","hasAlternative","dataAlternative","plot","cn","className","ChartFrame","RadialBarChart","PolarAngleAxis","RadialBar","seriesColor","series","chartMuted","ANIMATION_PROPS","hideValue"],"sources":["../../src/charts/gauge.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { useId } from \"react\";\nimport { PolarAngleAxis, RadialBar, RadialBarChart } from \"recharts\";\nimport { cn } from \"../utils/cn\";\nimport { ANIMATION_PROPS, seriesColor } from \"./config\";\nimport { ChartFrame } from \"./frame\";\nimport { chartMuted } from \"./palette\";\nimport type { ChartSeriesDescriptor } from \"./series\";\n\nexport type GaugeProps = {\n\tvalue: number;\n\tmax?: number;\n\tseries?: ChartSeriesDescriptor[];\n\tariaLabel?: string;\n\tclassName?: string;\n\thideValue?: boolean;\n\tvalueFormatter?: (value: number) => string;\n\t/**\n\t * Textual summary describing key insights, highs, lows, and keyboard exploration instructions.\n\t * Associated with the chart via useId and aria-describedby.\n\t */\n\tsummary?: ReactNode;\n\t/**\n\t * Accessible tabular or structured data alternative rendered outside the plot area.\n\t */\n\tdataAlternative?: ReactNode;\n\t/**\n\t * Whether the interactive accessibility layer is enabled on the underlying Recharts graphic.\n\t * Enables keyboard exploration with Tab and arrow keys where supported by the underlying chart type.\n\t * Non-interactive compact or decorative charts without tooltip navigation should provide summary or dataAlternative.\n\t * @default true\n\t */\n\taccessibilityLayer?: boolean;\n};\n\nexport function Gauge({\n\tvalue,\n\tmax = 100,\n\tseries,\n\tariaLabel = \"Gauge\",\n\tclassName,\n\thideValue = false,\n\tvalueFormatter,\n\tsummary,\n\tdataAlternative,\n\taccessibilityLayer,\n}: GaugeProps) {\n\tconst summaryId = useId();\n\tconst percent = max === 0 ? 0 : Math.min(100, Math.max(0, (value / max) * 100));\n\tconst display = valueFormatter ? valueFormatter(value) : String(value);\n\tconst hasSummary = summary !== undefined && summary !== null && summary !== false;\n\tconst hasAlternative =\n\t\tdataAlternative !== undefined && dataAlternative !== null && dataAlternative !== false;\n\n\tconst plot = (\n\t\t<div className={cn(\"relative h-basalt-36 w-basalt-36\", className)}>\n\t\t\t<ChartFrame\n\t\t\t\tariaLabel={ariaLabel}\n\t\t\t\tclassName=\"h-full w-full\"\n\t\t\t\tsize=\"h-full w-full\"\n\t\t\t\taccessibilityLayer={accessibilityLayer}\n\t\t\t>\n\t\t\t\t<RadialBarChart\n\t\t\t\t\tcx=\"50%\"\n\t\t\t\t\tcy=\"50%\"\n\t\t\t\t\tinnerRadius=\"75%\"\n\t\t\t\t\touterRadius=\"95%\"\n\t\t\t\t\tstartAngle={90}\n\t\t\t\t\tendAngle={-270}\n\t\t\t\t\tdata={[{ value: percent }]}\n\t\t\t\t\tbarSize={12}\n\t\t\t\t\t{...(hasSummary ? { \"aria-describedby\": summaryId } : {})}\n\t\t\t\t>\n\t\t\t\t\t<PolarAngleAxis type=\"number\" domain={[0, 100]} angleAxisId={0} tick={false} />\n\t\t\t\t\t<RadialBar\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tcornerRadius={6}\n\t\t\t\t\t\tfill={seriesColor(series?.[0], 2)}\n\t\t\t\t\t\tbackground={{ fill: chartMuted }}\n\t\t\t\t\t\t{...ANIMATION_PROPS}\n\t\t\t\t\t/>\n\t\t\t\t</RadialBarChart>\n\t\t\t</ChartFrame>\n\t\t\t{hideValue ? null : (\n\t\t\t\t<span className=\"pointer-events-none absolute inset-0 flex items-center justify-center text-basalt-base font-semibold text-basalt-foreground\">\n\t\t\t\t\t{display}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t);\n\n\tif (!hasSummary && !hasAlternative) {\n\t\treturn plot;\n\t}\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-basalt-space-lg min-h-0 min-w-0\">\n\t\t\t{hasSummary ? (\n\t\t\t\t<div id={summaryId} className=\"text-basalt-sm text-basalt-muted-foreground\">\n\t\t\t\t\t{summary}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{plot}\n\t\t\t{hasAlternative ? (\n\t\t\t\t<div className=\"text-basalt-sm text-basalt-muted-foreground\">{dataAlternative}</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;AAmCA,SAAgBA,EAAM,EACrB,UACA,SAAM,KACN,WACA,eAAY,SACZ,cACA,eAAY,IACZ,mBACA,YACA,oBACA,yBACc;CACd,IAAMC,IAAYC,EAAM,GAClBC,IAAUC,MAAQ,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAIC,IAAQD,IAAO,GAAG,CAAC,GACxEE,IAAUC,IAAiBA,EAAeF,CAAK,IAAI,OAAOA,CAAK,GAC/DG,IAAaC,KAAqC,QAAQA,MAAY,IACtEC,IACLC,KAAqD,QAAQA,MAAoB,IAE5EC,IACL,kBAAC,OAAD;EAAK,WAAWC,EAAG,oCAAoCC,CAAS;EAAhE,UAAA,CACC,kBAACC,GAAD;GACY;GACX,WAAU;GACV,MAAK;GACe;GAEpB,UAAA,kBAACC,GAAD;IACC,IAAG;IACH,IAAG;IACH,aAAY;IACZ,aAAY;IACZ,YAAY;IACZ,UAAU;IACV,MAAM,CAAC,EAAE,OAAOb,EAAQ,CAAC;IACzB,SAAS;IACT,GAAKK,IAAa,EAAE,oBAAoBP,EAAU,IAAI,CAAC;IATxD,UAAA,CAWC,kBAACgB,GAAD;KAAgB,MAAK;KAAS,QAAQ,CAAC,GAAG,GAAG;KAAG,aAAa;KAAG,MAAM;IAAQ,CAAA,GAC9E,kBAACC,GAAD;KACC,SAAQ;KACR,cAAc;KACd,MAAMC,EAAYC,IAAS,IAAI,CAAC;KAChC,YAAY,EAAE,MAAMC,EAAW;KAC/B,GAAIC;IACJ,CAAA,CACc;;EACL,CAAA,GACXC,IAAY,OACZ,kBAAC,QAAD;GAAM,WAAU;GACd,UAAAjB;EACI,CAAA,CAEH;;CAON,OAJI,CAACE,KAAc,CAACE,IACZE,IAIP,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACEJ,IACA,kBAAC,OAAD;IAAK,IAAIP;IAAW,WAAU;IAC5B,UAAAQ;GACG,CAAA,IACF;GACHG;GACAF,IACA,kBAAC,OAAD;IAAK,WAAU;IAA+C,UAAAC;GAAqB,CAAA,IAChF;EACA;;AAEP"}
@@ -94,7 +94,7 @@ function y({ values: o, ariaLabel: s = "Heatmap calendar", className: f }) {
94
94
  onBlur: (e) => {
95
95
  e.currentTarget.contains(e.relatedTarget) || (y.current = !1);
96
96
  },
97
- className: e("grid grid-cols-7 gap-1 p-0.5 outline-none", f),
97
+ className: e("grid grid-cols-7 gap-basalt-space-sm p-basalt-space-xs outline-none", f),
98
98
  children: o.map((e, r) => /* @__PURE__ */ d(t, {
99
99
  open: h === r,
100
100
  onOpenChange: (e) => {
@@ -116,11 +116,11 @@ function y({ values: o, ariaLabel: s = "Heatmap calendar", className: f }) {
116
116
  },
117
117
  onKeyDown: (e) => b(e, r),
118
118
  "aria-label": `Position ${r + 1}: ${e}`,
119
- className: "box-border m-0 h-3 w-3 cursor-pointer rounded-sm border-0 p-0 transition-colors focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-basalt-ring",
119
+ className: "box-border m-0 h-basalt-3 w-basalt-3 cursor-pointer rounded-basalt-sm border-0 p-0 transition-colors basalt-motion focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-basalt-ring",
120
120
  style: { backgroundColor: `hsl(var(--basalt-chart-5) / ${.2 + Math.min(4, Math.max(0, e)) * .15})` }
121
121
  })
122
122
  }), /* @__PURE__ */ u(n, { children: /* @__PURE__ */ d("div", {
123
- className: "text-xs",
123
+ className: "text-basalt-sm",
124
124
  children: [
125
125
  "Position ",
126
126
  r + 1,
@@ -218,14 +218,14 @@ function b({ data: v, year: y, colorScale: b = f.green, valueFormatter: x = (e)
218
218
  onBlur: (e) => {
219
219
  e.currentTarget.contains(e.relatedTarget) || (q.current = !1);
220
220
  },
221
- className: e("overflow-x-auto rounded-md outline-none focus-visible:ring-1 focus-visible:ring-basalt-ring", j),
221
+ className: e("overflow-x-auto rounded-basalt-md outline-none focus-visible:ring-1 focus-visible:ring-basalt-ring", j),
222
222
  children: /* @__PURE__ */ u(r, { children: /* @__PURE__ */ d("div", {
223
- className: "inline-block p-1",
223
+ className: "inline-block p-basalt-space-sm",
224
224
  role: "group",
225
225
  "aria-label": A,
226
226
  children: [
227
227
  /* @__PURE__ */ u("div", {
228
- className: "relative mb-1 h-4 text-xs text-basalt-muted-foreground",
228
+ className: "relative mb-basalt-space-sm h-basalt-4 text-basalt-sm text-basalt-muted-foreground",
229
229
  style: { marginLeft: 30 },
230
230
  children: z.map((e) => /* @__PURE__ */ u("div", {
231
231
  className: "absolute",
@@ -236,7 +236,7 @@ function b({ data: v, year: y, colorScale: b = f.green, valueFormatter: x = (e)
236
236
  /* @__PURE__ */ d("div", {
237
237
  className: "flex",
238
238
  children: [/* @__PURE__ */ u("div", {
239
- className: "mr-1 flex flex-col text-xs text-basalt-muted-foreground select-none",
239
+ className: "mr-basalt-space-sm flex flex-col text-basalt-sm text-basalt-muted-foreground select-none",
240
240
  style: { width: 30 },
241
241
  "aria-hidden": "true",
242
242
  children: M.map((e, t) => /* @__PURE__ */ u("div", {
@@ -285,7 +285,7 @@ function b({ data: v, year: y, colorScale: b = f.green, valueFormatter: x = (e)
285
285
  G((e) => e === a ? null : e);
286
286
  },
287
287
  onKeyDown: (e) => X(e, a),
288
- className: "box-border m-0 cursor-pointer rounded-sm border-0 p-0 transition-colors hover:ring-1 hover:ring-basalt-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-basalt-ring",
288
+ className: "box-border m-0 cursor-pointer rounded-basalt-sm border-0 p-0 transition-colors basalt-motion hover:ring-1 hover:ring-basalt-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-basalt-ring",
289
289
  style: {
290
290
  width: C,
291
291
  height: C,
@@ -295,7 +295,7 @@ function b({ data: v, year: y, colorScale: b = f.green, valueFormatter: x = (e)
295
295
  }), /* @__PURE__ */ u(n, {
296
296
  id: `${P}-${a}`,
297
297
  children: /* @__PURE__ */ d("div", {
298
- className: "text-sm",
298
+ className: "text-basalt-base",
299
299
  children: [/* @__PURE__ */ u("div", {
300
300
  className: "font-medium",
301
301
  children: a
@@ -315,12 +315,12 @@ function b({ data: v, year: y, colorScale: b = f.green, valueFormatter: x = (e)
315
315
  })]
316
316
  }),
317
317
  /* @__PURE__ */ d("div", {
318
- className: "mt-2 flex items-center justify-end gap-1 text-xs text-basalt-muted-foreground select-none",
318
+ className: "mt-basalt-space-lg flex items-center justify-end gap-basalt-space-sm text-basalt-sm text-basalt-muted-foreground select-none",
319
319
  "aria-hidden": "true",
320
320
  children: [
321
321
  /* @__PURE__ */ u("span", { children: O }),
322
322
  b.map((e) => /* @__PURE__ */ u("div", {
323
- className: "rounded-sm",
323
+ className: "rounded-basalt-sm",
324
324
  style: {
325
325
  width: C,
326
326
  height: C,