@misoto22/design 0.3.1 → 0.6.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 (266) hide show
  1. package/README.md +124 -0
  2. package/bin/misoto22-design.mjs +205 -0
  3. package/dist/agent/Accordion.md +41 -0
  4. package/dist/agent/Alert.md +42 -0
  5. package/dist/agent/AppShell.md +40 -0
  6. package/dist/agent/AreaChart.md +68 -0
  7. package/dist/agent/Article.md +41 -0
  8. package/dist/agent/Avatar.md +32 -0
  9. package/dist/agent/Badge.md +40 -0
  10. package/dist/agent/BarChart.md +65 -0
  11. package/dist/agent/BarList.md +40 -0
  12. package/dist/agent/BigNumber.md +45 -0
  13. package/dist/agent/BoxPlot.md +58 -0
  14. package/dist/agent/Breadcrumb.md +32 -0
  15. package/dist/agent/BulletChart.md +48 -0
  16. package/dist/agent/Button.md +56 -0
  17. package/dist/agent/Calendar.md +42 -0
  18. package/dist/agent/Card.md +49 -0
  19. package/dist/agent/Checkbox.md +35 -0
  20. package/dist/agent/Collapsible.md +46 -0
  21. package/dist/agent/Combobox.md +50 -0
  22. package/dist/agent/Command.md +93 -0
  23. package/dist/agent/ComposedChart.md +57 -0
  24. package/dist/agent/ContextMenu.md +59 -0
  25. package/dist/agent/DatePicker.md +75 -0
  26. package/dist/agent/Diagram.md +46 -0
  27. package/dist/agent/Dialog.md +52 -0
  28. package/dist/agent/DropdownMenu.md +70 -0
  29. package/dist/agent/EmptyState.md +37 -0
  30. package/dist/agent/ErrorState.md +41 -0
  31. package/dist/agent/Facet.md +82 -0
  32. package/dist/agent/Field.md +37 -0
  33. package/dist/agent/FigureBand.md +37 -0
  34. package/dist/agent/FloatingIconButton.md +38 -0
  35. package/dist/agent/FunnelChart.md +52 -0
  36. package/dist/agent/Heatmap.md +53 -0
  37. package/dist/agent/Histogram.md +63 -0
  38. package/dist/agent/Input.md +30 -0
  39. package/dist/agent/Kbd.md +29 -0
  40. package/dist/agent/LineChart.md +60 -0
  41. package/dist/agent/LinkArrow.md +29 -0
  42. package/dist/agent/NativeSelect.md +40 -0
  43. package/dist/agent/NavItem.md +35 -0
  44. package/dist/agent/Pagination.md +43 -0
  45. package/dist/agent/PieChart.md +55 -0
  46. package/dist/agent/Popover.md +57 -0
  47. package/dist/agent/Progress.md +33 -0
  48. package/dist/agent/RadarChart.md +54 -0
  49. package/dist/agent/RadialChart.md +57 -0
  50. package/dist/agent/RadioGroup.md +44 -0
  51. package/dist/agent/SankeyChart.md +61 -0
  52. package/dist/agent/ScatterChart.md +54 -0
  53. package/dist/agent/ScrollArea.md +40 -0
  54. package/dist/agent/SearchableMenu.md +46 -0
  55. package/dist/agent/Select.md +75 -0
  56. package/dist/agent/Separator.md +35 -0
  57. package/dist/agent/Sheet.md +57 -0
  58. package/dist/agent/Skeleton.md +73 -0
  59. package/dist/agent/Slider.md +39 -0
  60. package/dist/agent/Sparkline.md +45 -0
  61. package/dist/agent/Spinner.md +39 -0
  62. package/dist/agent/StatusDot.md +36 -0
  63. package/dist/agent/StatusPill.md +28 -0
  64. package/dist/agent/Steps.md +44 -0
  65. package/dist/agent/Switch.md +29 -0
  66. package/dist/agent/Table.md +85 -0
  67. package/dist/agent/Tabs.md +48 -0
  68. package/dist/agent/Tag.md +35 -0
  69. package/dist/agent/Textarea.md +26 -0
  70. package/dist/agent/Toast.md +26 -0
  71. package/dist/agent/ToggleGroup.md +44 -0
  72. package/dist/agent/Tooltip.md +51 -0
  73. package/dist/agent/TreemapChart.md +52 -0
  74. package/dist/agent/WaterfallChart.md +62 -0
  75. package/dist/agent/catalog.json +1791 -0
  76. package/dist/agent/index.md +131 -0
  77. package/dist/article.css +393 -0
  78. package/dist/charts/AreaChart/AreaChart.d.ts +191 -0
  79. package/dist/charts/AreaChart/AreaChart.js +480 -0
  80. package/dist/charts/AreaChart/AreaChart.js.map +1 -0
  81. package/dist/charts/BarChart/BarChart.d.ts +179 -0
  82. package/dist/charts/BarChart/BarChart.js +591 -0
  83. package/dist/charts/BarChart/BarChart.js.map +1 -0
  84. package/dist/charts/BarList/BarList.d.ts +57 -0
  85. package/dist/charts/BarList/BarList.js +71 -0
  86. package/dist/charts/BarList/BarList.js.map +1 -0
  87. package/dist/charts/BigNumber/BigNumber.d.ts +56 -0
  88. package/dist/charts/BigNumber/BigNumber.js +31 -0
  89. package/dist/charts/BigNumber/BigNumber.js.map +1 -0
  90. package/dist/charts/BoxPlot/BoxPlot.d.ts +177 -0
  91. package/dist/charts/BoxPlot/BoxPlot.js +495 -0
  92. package/dist/charts/BoxPlot/BoxPlot.js.map +1 -0
  93. package/dist/charts/BulletChart/BulletChart.d.ts +100 -0
  94. package/dist/charts/BulletChart/BulletChart.js +162 -0
  95. package/dist/charts/BulletChart/BulletChart.js.map +1 -0
  96. package/dist/charts/ComposedChart/ComposedChart.d.ts +171 -0
  97. package/dist/charts/ComposedChart/ComposedChart.js +667 -0
  98. package/dist/charts/ComposedChart/ComposedChart.js.map +1 -0
  99. package/dist/charts/Facet/Facet.d.ts +240 -0
  100. package/dist/charts/Facet/Facet.js +133 -0
  101. package/dist/charts/Facet/Facet.js.map +1 -0
  102. package/dist/charts/Facet/panels.d.ts +187 -0
  103. package/dist/charts/Facet/panels.js +203 -0
  104. package/dist/charts/Facet/panels.js.map +1 -0
  105. package/dist/charts/FunnelChart/FunnelChart.d.ts +101 -0
  106. package/dist/charts/FunnelChart/FunnelChart.js +147 -0
  107. package/dist/charts/FunnelChart/FunnelChart.js.map +1 -0
  108. package/dist/charts/Heatmap/Heatmap.d.ts +78 -0
  109. package/dist/charts/Heatmap/Heatmap.js +108 -0
  110. package/dist/charts/Heatmap/Heatmap.js.map +1 -0
  111. package/dist/charts/Histogram/Histogram.d.ts +165 -0
  112. package/dist/charts/Histogram/Histogram.js +350 -0
  113. package/dist/charts/Histogram/Histogram.js.map +1 -0
  114. package/dist/charts/LineChart/LineChart.d.ts +167 -0
  115. package/dist/charts/LineChart/LineChart.js +486 -0
  116. package/dist/charts/LineChart/LineChart.js.map +1 -0
  117. package/dist/charts/PieChart/PieChart.d.ts +128 -0
  118. package/dist/charts/PieChart/PieChart.js +309 -0
  119. package/dist/charts/PieChart/PieChart.js.map +1 -0
  120. package/dist/charts/RadarChart/RadarChart.d.ts +123 -0
  121. package/dist/charts/RadarChart/RadarChart.js +299 -0
  122. package/dist/charts/RadarChart/RadarChart.js.map +1 -0
  123. package/dist/charts/RadialChart/RadialChart.d.ts +124 -0
  124. package/dist/charts/RadialChart/RadialChart.js +257 -0
  125. package/dist/charts/RadialChart/RadialChart.js.map +1 -0
  126. package/dist/charts/SankeyChart/SankeyChart.d.ts +137 -0
  127. package/dist/charts/SankeyChart/SankeyChart.js +501 -0
  128. package/dist/charts/SankeyChart/SankeyChart.js.map +1 -0
  129. package/dist/charts/ScatterChart/ScatterChart.d.ts +128 -0
  130. package/dist/charts/ScatterChart/ScatterChart.js +269 -0
  131. package/dist/charts/ScatterChart/ScatterChart.js.map +1 -0
  132. package/dist/charts/Sparkline/Sparkline.d.ts +53 -0
  133. package/dist/charts/Sparkline/Sparkline.js +93 -0
  134. package/dist/charts/Sparkline/Sparkline.js.map +1 -0
  135. package/dist/charts/TreemapChart/TreemapChart.d.ts +93 -0
  136. package/dist/charts/TreemapChart/TreemapChart.js +118 -0
  137. package/dist/charts/TreemapChart/TreemapChart.js.map +1 -0
  138. package/dist/charts/WaterfallChart/WaterfallChart.d.ts +164 -0
  139. package/dist/charts/WaterfallChart/WaterfallChart.js +319 -0
  140. package/dist/charts/WaterfallChart/WaterfallChart.js.map +1 -0
  141. package/dist/charts/index.d.ts +41 -0
  142. package/dist/charts/index.js +128 -0
  143. package/dist/charts/index.js.map +1 -0
  144. package/dist/charts/lib/annotations.d.ts +103 -0
  145. package/dist/charts/lib/annotations.js +99 -0
  146. package/dist/charts/lib/annotations.js.map +1 -0
  147. package/dist/charts/lib/axis.d.ts +18 -0
  148. package/dist/charts/lib/axis.js +21 -0
  149. package/dist/charts/lib/axis.js.map +1 -0
  150. package/dist/charts/lib/background.d.ts +33 -0
  151. package/dist/charts/lib/background.js +173 -0
  152. package/dist/charts/lib/background.js.map +1 -0
  153. package/dist/charts/lib/brush.d.ts +94 -0
  154. package/dist/charts/lib/brush.js +535 -0
  155. package/dist/charts/lib/brush.js.map +1 -0
  156. package/dist/charts/lib/chart.d.ts +94 -0
  157. package/dist/charts/lib/chart.js +134 -0
  158. package/dist/charts/lib/chart.js.map +1 -0
  159. package/dist/charts/lib/dot.d.ts +29 -0
  160. package/dist/charts/lib/dot.js +78 -0
  161. package/dist/charts/lib/dot.js.map +1 -0
  162. package/dist/charts/lib/empty.d.ts +31 -0
  163. package/dist/charts/lib/empty.js +13 -0
  164. package/dist/charts/lib/empty.js.map +1 -0
  165. package/dist/charts/lib/export.d.ts +103 -0
  166. package/dist/charts/lib/export.js +204 -0
  167. package/dist/charts/lib/export.js.map +1 -0
  168. package/dist/charts/lib/figure.d.ts +61 -0
  169. package/dist/charts/lib/figure.js +59 -0
  170. package/dist/charts/lib/figure.js.map +1 -0
  171. package/dist/charts/lib/format.d.ts +46 -0
  172. package/dist/charts/lib/format.js +56 -0
  173. package/dist/charts/lib/format.js.map +1 -0
  174. package/dist/charts/lib/legend.d.ts +45 -0
  175. package/dist/charts/lib/legend.js +117 -0
  176. package/dist/charts/lib/legend.js.map +1 -0
  177. package/dist/charts/lib/loading.d.ts +48 -0
  178. package/dist/charts/lib/loading.js +105 -0
  179. package/dist/charts/lib/loading.js.map +1 -0
  180. package/dist/charts/lib/paint.d.ts +154 -0
  181. package/dist/charts/lib/paint.js +551 -0
  182. package/dist/charts/lib/paint.js.map +1 -0
  183. package/dist/charts/lib/sonify-control.d.ts +163 -0
  184. package/dist/charts/lib/sonify-control.js +172 -0
  185. package/dist/charts/lib/sonify-control.js.map +1 -0
  186. package/dist/charts/lib/sonify.d.ts +248 -0
  187. package/dist/charts/lib/sonify.js +262 -0
  188. package/dist/charts/lib/sonify.js.map +1 -0
  189. package/dist/charts/lib/toolbar.d.ts +143 -0
  190. package/dist/charts/lib/toolbar.js +156 -0
  191. package/dist/charts/lib/toolbar.js.map +1 -0
  192. package/dist/charts/lib/tooltip.d.ts +59 -0
  193. package/dist/charts/lib/tooltip.js +135 -0
  194. package/dist/charts/lib/tooltip.js.map +1 -0
  195. package/dist/charts/lib/values.d.ts +56 -0
  196. package/dist/charts/lib/values.js +71 -0
  197. package/dist/charts/lib/values.js.map +1 -0
  198. package/dist/charts/lib/zoom.d.ts +139 -0
  199. package/dist/charts/lib/zoom.js +314 -0
  200. package/dist/charts/lib/zoom.js.map +1 -0
  201. package/dist/components/AppShell/AppShell.d.ts +15 -1
  202. package/dist/components/AppShell/AppShell.js +8 -4
  203. package/dist/components/AppShell/AppShell.js.map +1 -1
  204. package/dist/components/Article/Article.d.ts +51 -0
  205. package/dist/components/Article/Article.js +21 -0
  206. package/dist/components/Article/Article.js.map +1 -0
  207. package/dist/components/Button/Button.js +2 -2
  208. package/dist/components/Button/Button.js.map +1 -1
  209. package/dist/components/Calendar/Calendar.d.ts +1 -1
  210. package/dist/components/Calendar/Calendar.js +259 -24
  211. package/dist/components/Calendar/Calendar.js.map +1 -1
  212. package/dist/components/Checkbox/Checkbox.js +1 -1
  213. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  214. package/dist/components/Collapsible/Collapsible.d.ts +15 -1
  215. package/dist/components/Collapsible/Collapsible.js +18 -0
  216. package/dist/components/Collapsible/Collapsible.js.map +1 -1
  217. package/dist/components/Combobox/Combobox.js +1 -1
  218. package/dist/components/Combobox/Combobox.js.map +1 -1
  219. package/dist/components/Command/Command.js +7 -7
  220. package/dist/components/Command/Command.js.map +1 -1
  221. package/dist/components/ContextMenu/ContextMenu.js +2 -2
  222. package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
  223. package/dist/components/Diagram/Diagram.d.ts +81 -0
  224. package/dist/components/Diagram/Diagram.js +139 -0
  225. package/dist/components/Diagram/Diagram.js.map +1 -0
  226. package/dist/components/Dialog/Dialog.js +1 -1
  227. package/dist/components/Dialog/Dialog.js.map +1 -1
  228. package/dist/components/DropdownMenu/DropdownMenu.js +2 -2
  229. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  230. package/dist/components/FigureBand/FigureBand.js +41 -30
  231. package/dist/components/FigureBand/FigureBand.js.map +1 -1
  232. package/dist/components/Popover/Popover.js +1 -1
  233. package/dist/components/Popover/Popover.js.map +1 -1
  234. package/dist/components/Select/Select.js +2 -2
  235. package/dist/components/Select/Select.js.map +1 -1
  236. package/dist/components/Sheet/Sheet.js +1 -1
  237. package/dist/components/Sheet/Sheet.js.map +1 -1
  238. package/dist/components/Slider/Slider.js +1 -1
  239. package/dist/components/Slider/Slider.js.map +1 -1
  240. package/dist/components/Steps/Steps.d.ts +65 -0
  241. package/dist/components/Steps/Steps.js +55 -0
  242. package/dist/components/Steps/Steps.js.map +1 -0
  243. package/dist/components/Switch/Switch.js +1 -1
  244. package/dist/components/Switch/Switch.js.map +1 -1
  245. package/dist/components/Tooltip/Tooltip.js +1 -1
  246. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  247. package/dist/index.d.ts +4 -1
  248. package/dist/index.js +3 -0
  249. package/dist/index.js.map +1 -1
  250. package/dist/lib/useSelectionIndicator.js +14 -10
  251. package/dist/lib/useSelectionIndicator.js.map +1 -1
  252. package/dist/semantic.css +19 -0
  253. package/dist/styles.css +1 -1
  254. package/dist/themes.css +103 -7
  255. package/dist/tokens.css +193 -10
  256. package/dist/tokens.d.ts +25 -0
  257. package/dist/tokens.js +154 -8
  258. package/dist/tokens.json +154 -8
  259. package/package.json +45 -20
  260. package/skills/misoto22-design/SKILL.md +171 -0
  261. package/skills/misoto22-design/evals/claims.json +95 -0
  262. package/skills/misoto22-design/rules/a11y.md +115 -0
  263. package/skills/misoto22-design/rules/composition.md +108 -0
  264. package/skills/misoto22-design/rules/forms.md +128 -0
  265. package/skills/misoto22-design/rules/naming.md +155 -0
  266. package/skills/misoto22-design/rules/tokens.md +131 -0
@@ -0,0 +1,591 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ Children,
5
+ createContext,
6
+ isValidElement,
7
+ useCallback,
8
+ useContext,
9
+ useId,
10
+ useMemo,
11
+ useState
12
+ } from "react";
13
+ import {
14
+ Bar as RechartsBar,
15
+ BarChart as RechartsBarChart,
16
+ CartesianGrid,
17
+ Rectangle,
18
+ XAxis as RechartsXAxis,
19
+ YAxis as RechartsYAxis
20
+ } from "recharts";
21
+ import { motion, useReducedMotion } from "motion/react";
22
+ import { ChartContainer } from "../lib/chart.js";
23
+ import { ChartFigure } from "../lib/figure.js";
24
+ import { ChartEmpty } from "../lib/empty.js";
25
+ import { axisLabel } from "../lib/axis.js";
26
+ import { defaultTick } from "../lib/format.js";
27
+ import { Annotation, ReferenceBand, ReferenceLine } from "../lib/annotations.js";
28
+ import { Values, findSlot, resolveValues } from "../lib/values.js";
29
+ import {
30
+ ChartSonifyButton,
31
+ Sonify,
32
+ useChartSonifySeries
33
+ } from "../lib/sonify-control.js";
34
+ import { ChartBackground } from "../lib/background.js";
35
+ import { ChartLegend, ChartLegendContent } from "../lib/legend.js";
36
+ import { ChartTooltip, ChartTooltipContent } from "../lib/tooltip.js";
37
+ import { Brush, ChartBrush } from "../lib/brush.js";
38
+ import { ChartControls, Toolbar } from "../lib/toolbar.js";
39
+ import { useChartZoom } from "../lib/zoom.js";
40
+ import { LoadingIndicator, LoadingShimmer, LOADING_KEY, useLoadingRows } from "../lib/loading.js";
41
+ import {
42
+ BarBufferFill,
43
+ BarDuotoneFill,
44
+ BarGradientFill,
45
+ BarHatchedFill,
46
+ BarStrippedFill,
47
+ GlowFilter,
48
+ REVEAL_EASE,
49
+ SeriesGradient
50
+ } from "../lib/paint.js";
51
+ const BAR_RADIUS = 2;
52
+ const GROW_DURATION = 0.5;
53
+ const GROW_STAGGER = 0.05;
54
+ const STACK_ID = "m22-bar-stack";
55
+ const CHART_MARGIN = { top: 8, right: 12, bottom: 0, left: 12 };
56
+ const BarChartContext = createContext(null);
57
+ function useBarChart() {
58
+ const context = useContext(BarChartContext);
59
+ if (!context) throw new Error("A bar chart part must be rendered inside <BarChart>");
60
+ return context;
61
+ }
62
+ function BarChart({
63
+ config,
64
+ data,
65
+ title,
66
+ showTitle,
67
+ description,
68
+ children,
69
+ className,
70
+ chartProps,
71
+ stackType = "default",
72
+ orientation = "vertical",
73
+ barRadius = BAR_RADIUS,
74
+ animationType = "forward",
75
+ barGap,
76
+ barCategoryGap,
77
+ defaultSelectedDataKey = null,
78
+ onSelectionChange,
79
+ isLoading = false,
80
+ loadingBars,
81
+ xDataKey,
82
+ hideDataTable = false,
83
+ empty
84
+ }) {
85
+ const chartId = useId().replace(/:/g, "");
86
+ const [introStartedAt] = useState(() => Date.now());
87
+ const [selectedDataKey, setSelectedDataKey] = useState(defaultSelectedDataKey);
88
+ const [isPointerInChart, setIsPointerInChart] = useState(false);
89
+ const { rows: loadingData, onShimmerExit } = useLoadingRows(isLoading, loadingBars ?? 12);
90
+ const zoom = useChartZoom({ data, xDataKey });
91
+ const { brushSlot, toolbarSlot, sonifySlot, chartChildren } = useMemo(() => {
92
+ const parts = Children.toArray(children);
93
+ const element = parts.find((child) => isValidElement(child) && child.type === Brush);
94
+ const props = isValidElement(element) ? element.props : {};
95
+ return {
96
+ brushSlot: { present: isValidElement(element), ...props },
97
+ toolbarSlot: findSlot(parts, Toolbar),
98
+ sonifySlot: findSlot(parts, Sonify),
99
+ chartChildren: parts.filter(
100
+ (child) => !(isValidElement(child) && (child.type === Brush || child.type === Toolbar || child.type === Sonify))
101
+ )
102
+ };
103
+ }, [children]);
104
+ const isStacked = stackType === "stacked" || stackType === "percent";
105
+ const isHorizontal = orientation === "horizontal";
106
+ const columns = useMemo(
107
+ () => Object.entries(config).map(([key, series]) => ({ key, label: series.label })),
108
+ [config]
109
+ );
110
+ const showBrush = brushSlot.present && !isLoading;
111
+ const showToolbar = toolbarSlot !== null && !isLoading;
112
+ const isEmpty = !isLoading && empty !== false && data.length === 0;
113
+ const displayData = showBrush || showToolbar ? zoom.visibleData : data;
114
+ const sonifySeries = useChartSonifySeries(
115
+ sonifySlot,
116
+ isLoading ? loadingData : displayData,
117
+ config,
118
+ xDataKey
119
+ );
120
+ const selectDataKey = useCallback(
121
+ (next) => {
122
+ setSelectedDataKey(next);
123
+ onSelectionChange?.(next);
124
+ },
125
+ [onSelectionChange]
126
+ );
127
+ const context = useMemo(
128
+ () => ({
129
+ config,
130
+ rows: displayData,
131
+ isStacked,
132
+ isHorizontal,
133
+ isLoading,
134
+ barRadius,
135
+ animationType,
136
+ introStartedAt,
137
+ dataLength: displayData.length,
138
+ selectedDataKey,
139
+ selectDataKey,
140
+ isPointerInChart
141
+ }),
142
+ [
143
+ animationType,
144
+ barRadius,
145
+ config,
146
+ displayData,
147
+ introStartedAt,
148
+ isHorizontal,
149
+ isLoading,
150
+ isPointerInChart,
151
+ isStacked,
152
+ selectDataKey,
153
+ selectedDataKey
154
+ ]
155
+ );
156
+ return /* @__PURE__ */ jsx(BarChartContext.Provider, { value: context, children: /* @__PURE__ */ jsxs(
157
+ ChartFigure,
158
+ {
159
+ title,
160
+ showTitle,
161
+ description,
162
+ className,
163
+ table: hideDataTable ? false : { rows: data, rowKey: xDataKey, columns },
164
+ children: [
165
+ sonifySlot && /* @__PURE__ */ jsx(ChartSonifyButton, { ...sonifySlot, title, series: sonifySeries }),
166
+ isEmpty ? /* @__PURE__ */ jsx(ChartEmpty, { ...empty || {} }) : /* @__PURE__ */ jsx(
167
+ ChartControls,
168
+ {
169
+ toolbar: showToolbar ? toolbarSlot : null,
170
+ zoom,
171
+ title,
172
+ rows: data,
173
+ columns,
174
+ rowKey: xDataKey,
175
+ children: /* @__PURE__ */ jsx(
176
+ ChartContainer,
177
+ {
178
+ config,
179
+ footer: showBrush && /* @__PURE__ */ jsx(
180
+ ChartBrush,
181
+ {
182
+ data,
183
+ config,
184
+ xDataKey,
185
+ variant: "bar",
186
+ barRadius,
187
+ height: brushSlot.height,
188
+ formatLabel: brushSlot.formatLabel,
189
+ stacked: isStacked,
190
+ className: "mt-1",
191
+ ...zoom.brushProps,
192
+ onChange: (range) => {
193
+ zoom.brushProps.onChange(range);
194
+ brushSlot.onChange?.(range);
195
+ }
196
+ }
197
+ ),
198
+ children: /* @__PURE__ */ jsxs(
199
+ RechartsBarChart,
200
+ {
201
+ id: chartId,
202
+ accessibilityLayer: true,
203
+ margin: CHART_MARGIN,
204
+ layout: isHorizontal ? "vertical" : "horizontal",
205
+ data: isLoading ? loadingData : displayData,
206
+ barGap,
207
+ barCategoryGap,
208
+ stackOffset: stackType === "percent" ? "expand" : void 0,
209
+ onMouseEnter: () => setIsPointerInChart(true),
210
+ onMouseLeave: () => setIsPointerInChart(false),
211
+ ...chartProps,
212
+ children: [
213
+ chartChildren,
214
+ isLoading && /* @__PURE__ */ jsx(LoadingBar, { chartId, onShimmerExit })
215
+ ]
216
+ }
217
+ )
218
+ }
219
+ )
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx(LoadingIndicator, { isLoading })
223
+ ]
224
+ }
225
+ ) });
226
+ }
227
+ function Bar({
228
+ dataKey,
229
+ variant = "default",
230
+ radius,
231
+ animationType,
232
+ isClickable = false,
233
+ enableHoverHighlight = false,
234
+ glowing = false,
235
+ buffer = false,
236
+ children,
237
+ barProps
238
+ }) {
239
+ const {
240
+ config,
241
+ isStacked,
242
+ isHorizontal,
243
+ isLoading,
244
+ rows,
245
+ barRadius: defaultRadius,
246
+ animationType: defaultAnimation,
247
+ introStartedAt,
248
+ dataLength,
249
+ selectedDataKey,
250
+ selectDataKey,
251
+ isPointerInChart
252
+ } = useBarChart();
253
+ const id = useId().replace(/:/g, "");
254
+ const reduceMotion = useReducedMotion();
255
+ if (isLoading) return null;
256
+ const resolvedRadius = radius ?? defaultRadius;
257
+ const isSelected = selectedDataKey === dataKey;
258
+ const reveal = reduceMotion ? "none" : animationType ?? defaultAnimation;
259
+ const shared = {
260
+ id,
261
+ dataKey,
262
+ variant,
263
+ barRadius: resolvedRadius,
264
+ glowing,
265
+ buffer,
266
+ isClickable,
267
+ enableHoverHighlight,
268
+ isPointerInChart,
269
+ isHorizontal,
270
+ introStartedAt,
271
+ selectedDataKey,
272
+ dataLength,
273
+ onSelect: () => {
274
+ if (!isClickable) return;
275
+ selectDataKey(isSelected ? null : dataKey);
276
+ }
277
+ };
278
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
279
+ /* @__PURE__ */ jsx(
280
+ RechartsBar,
281
+ {
282
+ dataKey,
283
+ stackId: isStacked ? STACK_ID : void 0,
284
+ fill: `url(#${id}-colors-${dataKey})`,
285
+ radius: resolvedRadius,
286
+ isAnimationActive: false,
287
+ style: isClickable || enableHoverHighlight ? { cursor: "pointer" } : void 0,
288
+ shape: (props) => /* @__PURE__ */ jsx(BarShape, { ...props, ...shared, animationType: reveal }),
289
+ activeBar: (props) => /* @__PURE__ */ jsx(BarShape, { ...props, ...shared, animationType: "none" }),
290
+ ...barProps,
291
+ children: resolveValues(
292
+ findSlot(children, Values),
293
+ rows.map((row) => Number(row[dataKey])).filter(Number.isFinite)
294
+ )
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsxs("defs", { children: [
298
+ /* @__PURE__ */ jsx(SeriesGradient, { id, dataKey, config, direction: "vertical" }),
299
+ variant === "hatched" && /* @__PURE__ */ jsx(BarHatchedFill, { id, dataKey }),
300
+ variant === "duotone" && /* @__PURE__ */ jsx(BarDuotoneFill, { id, dataKey, config }),
301
+ variant === "duotone-reverse" && /* @__PURE__ */ jsx(BarDuotoneFill, { id, dataKey, config, reverse: true }),
302
+ variant === "gradient" && /* @__PURE__ */ jsx(BarGradientFill, { id, dataKey }),
303
+ variant === "stripped" && /* @__PURE__ */ jsx(BarStrippedFill, { id, dataKey }),
304
+ buffer && /* @__PURE__ */ jsx(BarBufferFill, { id, dataKey }),
305
+ glowing && /* @__PURE__ */ jsx(GlowFilter, { id, dataKey })
306
+ ] })
307
+ ] });
308
+ }
309
+ function BarShape(props) {
310
+ const {
311
+ x = 0,
312
+ y = 0,
313
+ width = 0,
314
+ height = 0,
315
+ id,
316
+ dataKey,
317
+ variant,
318
+ barRadius,
319
+ glowing,
320
+ buffer,
321
+ isClickable,
322
+ enableHoverHighlight,
323
+ isPointerInChart,
324
+ isHorizontal,
325
+ animationType,
326
+ introStartedAt,
327
+ selectedDataKey,
328
+ isActive,
329
+ dataLength,
330
+ onSelect
331
+ } = props;
332
+ const index = typeof props.index === "number" ? props.index : -1;
333
+ const isBufferBar = buffer && dataLength > 0 && index === dataLength - 1;
334
+ const isStripped = variant === "stripped";
335
+ const grow = growAnimation(animationType, index, dataLength, isHorizontal, introStartedAt);
336
+ const fill = isBufferBar ? `url(#${id}-buffer-${dataKey})` : variantFill(variant, id, dataKey);
337
+ const opacity = barOpacity({
338
+ isClickable,
339
+ selectedDataKey,
340
+ dataKey,
341
+ enableHoverHighlight,
342
+ isPointerInChart,
343
+ isActive
344
+ });
345
+ const radius = isStripped ? [barRadius, barRadius, 0, 0] : barRadius;
346
+ const painted = /* @__PURE__ */ jsxs(Fragment, { children: [
347
+ /* @__PURE__ */ jsx(
348
+ Rectangle,
349
+ {
350
+ x,
351
+ y,
352
+ width,
353
+ height: Math.max(0, height - 3),
354
+ opacity,
355
+ radius,
356
+ fill,
357
+ filter: glowing ? `url(#${id}-glow-${dataKey})` : void 0,
358
+ stroke: isBufferBar ? `url(#${id}-colors-${dataKey})` : void 0,
359
+ strokeWidth: isBufferBar ? 1 : void 0
360
+ }
361
+ ),
362
+ isStripped && /* @__PURE__ */ jsx(
363
+ Rectangle,
364
+ {
365
+ x,
366
+ y: y - 4,
367
+ width,
368
+ height: 2,
369
+ radius: 1,
370
+ fill: `url(#${id}-colors-${dataKey})`
371
+ }
372
+ )
373
+ ] });
374
+ return /* @__PURE__ */ jsxs(
375
+ "g",
376
+ {
377
+ style: isClickable || enableHoverHighlight ? { cursor: "pointer" } : void 0,
378
+ onClick: onSelect,
379
+ children: [
380
+ /* @__PURE__ */ jsx(Rectangle, { ...props, fill: "transparent" }),
381
+ grow ? /* @__PURE__ */ jsx(
382
+ motion.g,
383
+ {
384
+ initial: grow.initial,
385
+ animate: grow.animate,
386
+ transition: grow.transition,
387
+ style: grow.style,
388
+ children: painted
389
+ }
390
+ ) : painted
391
+ ]
392
+ }
393
+ );
394
+ }
395
+ function growAnimation(animationType, index, dataLength, isHorizontal, introStartedAt) {
396
+ if (animationType === "none" || index < 0 || dataLength <= 0) return null;
397
+ const lastIndex = dataLength - 1;
398
+ const centre = lastIndex / 2;
399
+ let step;
400
+ switch (animationType) {
401
+ case "reverse":
402
+ step = lastIndex - index;
403
+ break;
404
+ case "center-out":
405
+ step = Math.abs(index - centre);
406
+ break;
407
+ case "edges-in":
408
+ step = centre - Math.abs(index - centre);
409
+ break;
410
+ default:
411
+ step = index;
412
+ }
413
+ const startMs = step * GROW_STAGGER * 1e3;
414
+ const endMs = startMs + GROW_DURATION * 1e3;
415
+ const elapsed = Date.now() - introStartedAt;
416
+ if (elapsed >= endMs) return null;
417
+ const from = elapsed <= startMs ? 0 : (elapsed - startMs) / (GROW_DURATION * 1e3);
418
+ const transition = {
419
+ duration: (endMs - Math.max(elapsed, startMs)) / 1e3,
420
+ ease: REVEAL_EASE,
421
+ delay: Math.max(0, startMs - elapsed) / 1e3
422
+ };
423
+ return isHorizontal ? { initial: { scaleX: from }, animate: { scaleX: 1 }, transition, style: { originX: 0 } } : { initial: { scaleY: from }, animate: { scaleY: 1 }, transition, style: { originY: 1 } };
424
+ }
425
+ function variantFill(variant, id, dataKey) {
426
+ if (variant === "default") return `url(#${id}-colors-${dataKey})`;
427
+ return `url(#${id}-${variant}-${dataKey})`;
428
+ }
429
+ function barOpacity({
430
+ isClickable,
431
+ selectedDataKey,
432
+ dataKey,
433
+ enableHoverHighlight,
434
+ isPointerInChart,
435
+ isActive
436
+ }) {
437
+ const inSelection = selectedDataKey === null || selectedDataKey === dataKey;
438
+ const selectionOpacity = isClickable && selectedDataKey !== null ? inSelection ? 1 : 0.15 : 1;
439
+ if (enableHoverHighlight && isPointerInChart) {
440
+ return isActive ? selectionOpacity : selectionOpacity * 0.3;
441
+ }
442
+ return selectionOpacity;
443
+ }
444
+ function XAxis({
445
+ tickLine = false,
446
+ axisLine = false,
447
+ tickMargin = 8,
448
+ minTickGap = 8,
449
+ type,
450
+ label,
451
+ ...rest
452
+ }) {
453
+ const { isLoading, isHorizontal } = useBarChart();
454
+ if (isLoading) return null;
455
+ return /* @__PURE__ */ jsx(
456
+ RechartsXAxis,
457
+ {
458
+ tickLine,
459
+ axisLine,
460
+ tickMargin,
461
+ minTickGap,
462
+ type: type ?? (isHorizontal ? "number" : "category"),
463
+ ...rest,
464
+ children: axisLabel(label, "x")
465
+ }
466
+ );
467
+ }
468
+ function YAxis({
469
+ tickLine = false,
470
+ axisLine = false,
471
+ tickMargin = 8,
472
+ minTickGap = 8,
473
+ width = "auto",
474
+ type,
475
+ label,
476
+ tickFormatter,
477
+ ...rest
478
+ }) {
479
+ const { isLoading, isHorizontal } = useBarChart();
480
+ if (isLoading) return null;
481
+ return /* @__PURE__ */ jsx(
482
+ RechartsYAxis,
483
+ {
484
+ tickLine,
485
+ axisLine,
486
+ tickMargin,
487
+ minTickGap,
488
+ width,
489
+ type: type ?? (isHorizontal ? "category" : "number"),
490
+ tickFormatter: tickFormatter ?? defaultTick,
491
+ ...rest,
492
+ children: axisLabel(label, "y")
493
+ }
494
+ );
495
+ }
496
+ function Grid({
497
+ strokeDasharray = "3 3",
498
+ vertical,
499
+ horizontal,
500
+ ...rest
501
+ }) {
502
+ const { isHorizontal } = useBarChart();
503
+ return /* @__PURE__ */ jsx(
504
+ CartesianGrid,
505
+ {
506
+ strokeDasharray,
507
+ vertical: vertical ?? isHorizontal,
508
+ horizontal: horizontal ?? !isHorizontal,
509
+ ...rest
510
+ }
511
+ );
512
+ }
513
+ function Tooltip({ variant, roundness, defaultIndex, cursor = false }) {
514
+ const { isLoading, selectedDataKey } = useBarChart();
515
+ if (isLoading) return null;
516
+ return /* @__PURE__ */ jsx(
517
+ ChartTooltip,
518
+ {
519
+ cursor,
520
+ defaultIndex,
521
+ content: /* @__PURE__ */ jsx(ChartTooltipContent, { selected: selectedDataKey, roundness, variant })
522
+ }
523
+ );
524
+ }
525
+ function Legend({
526
+ variant,
527
+ align = "right",
528
+ verticalAlign = "top",
529
+ isClickable = false
530
+ }) {
531
+ const { selectedDataKey, selectDataKey } = useBarChart();
532
+ return /* @__PURE__ */ jsx(
533
+ ChartLegend,
534
+ {
535
+ verticalAlign,
536
+ align,
537
+ content: /* @__PURE__ */ jsx(
538
+ ChartLegendContent,
539
+ {
540
+ selected: selectedDataKey,
541
+ onSelectChange: selectDataKey,
542
+ isClickable,
543
+ variant
544
+ }
545
+ )
546
+ }
547
+ );
548
+ }
549
+ function Background({ variant }) {
550
+ const { isLoading } = useBarChart();
551
+ if (isLoading) return null;
552
+ return /* @__PURE__ */ jsx(ChartBackground, { variant });
553
+ }
554
+ function LoadingBar({ chartId, onShimmerExit }) {
555
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
556
+ /* @__PURE__ */ jsx(
557
+ RechartsBar,
558
+ {
559
+ dataKey: LOADING_KEY,
560
+ fill: "currentColor",
561
+ fillOpacity: 0.15,
562
+ radius: BAR_RADIUS,
563
+ isAnimationActive: false,
564
+ legendType: "none",
565
+ className: "text-(--ink)",
566
+ style: { mask: `url(#${chartId}-loading-mask)` }
567
+ }
568
+ ),
569
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx(LoadingShimmer, { id: chartId, onShimmerExit }) })
570
+ ] });
571
+ }
572
+ BarChart.Bar = Bar;
573
+ BarChart.XAxis = XAxis;
574
+ BarChart.YAxis = YAxis;
575
+ BarChart.Grid = Grid;
576
+ BarChart.Tooltip = Tooltip;
577
+ BarChart.Legend = Legend;
578
+ BarChart.Background = Background;
579
+ BarChart.ReferenceLine = ReferenceLine;
580
+ BarChart.ReferenceBand = ReferenceBand;
581
+ BarChart.Annotation = Annotation;
582
+ BarChart.Values = Values;
583
+ BarChart.Brush = Brush;
584
+ BarChart.Toolbar = Toolbar;
585
+ BarChart.Sonify = Sonify;
586
+ var BarChart_default = BarChart;
587
+ export {
588
+ BarChart,
589
+ BarChart_default as default
590
+ };
591
+ //# sourceMappingURL=BarChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/charts/BarChart/BarChart.tsx"],"sourcesContent":["'use client'\n\nimport {\n Children,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n type ComponentProps,\n type ReactNode,\n} from 'react'\nimport {\n Bar as RechartsBar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n Rectangle,\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n} from 'recharts'\nimport type { RectRadius } from 'recharts/types/shape/Rectangle'\nimport { motion, useReducedMotion } from 'motion/react'\nimport { ChartContainer, type ChartConfig } from '../lib/chart'\nimport { ChartFigure } from '../lib/figure'\nimport { ChartEmpty, type ChartEmptyProps } from '../lib/empty'\nimport { axisLabel } from '../lib/axis'\nimport { defaultTick } from '../lib/format'\nimport { Annotation, ReferenceBand, ReferenceLine } from '../lib/annotations'\nimport { Values, findSlot, resolveValues, type ValuesProps } from '../lib/values'\nimport {\n ChartSonifyButton,\n Sonify,\n useChartSonifySeries,\n type SonifyProps,\n} from '../lib/sonify-control'\n\n/**\n * The axis props, with `label` narrowed to a string.\n *\n * Recharts' own `label` accepts a render function and a config object, neither\n * of which a call site should be reaching for to name an axis — and both of\n * which would let a consumer opt out of the system's own axis type styling\n * without noticing.\n */\nexport type ChartXAxisProps = Omit<ComponentProps<typeof RechartsXAxis>, 'label'> & {\n /** What this axis measures. Say the unit here or in the series label, once. */\n label?: string\n}\n\nexport type ChartYAxisProps = Omit<ComponentProps<typeof RechartsYAxis>, 'label'> & {\n /** What this axis measures. Say the unit here or in the series label, once. */\n label?: string\n}\n\nimport { ChartBackground, type ChartBackgroundVariant } from '../lib/background'\nimport { ChartLegend, ChartLegendContent } from '../lib/legend'\nimport { ChartTooltip, ChartTooltipContent } from '../lib/tooltip'\nimport { Brush, ChartBrush, type BrushProps, type ChartBrushRange } from '../lib/brush'\nimport { ChartControls, Toolbar, type ToolbarProps } from '../lib/toolbar'\nimport { useChartZoom } from '../lib/zoom'\nimport { LoadingIndicator, LoadingShimmer, LOADING_KEY, useLoadingRows } from '../lib/loading'\nimport {\n BarBufferFill,\n BarDuotoneFill,\n BarGradientFill,\n BarHatchedFill,\n BarStrippedFill,\n GlowFilter,\n REVEAL_EASE,\n SeriesGradient,\n type ChartRevealType,\n} from '../lib/paint'\nimport type { ChartLegendSlotProps, ChartTooltipSlotProps } from '../AreaChart/AreaChart'\n\n/** The corner every bar rounds to unless it says otherwise. */\nconst BAR_RADIUS = 2\n\n/** One bar's grow-in, in seconds. */\nconst GROW_DURATION = 0.5\n\n/** How long each bar waits behind the one before it. */\nconst GROW_STAGGER = 0.05\n\nconst STACK_ID = 'm22-bar-stack'\n\n/**\n * Room around the plot, so the first and last tick labels are not sliced by the\n * container's edge. Recharts' own default is 5px on every side, which is not\n * enough for a label centred on the axis's first point.\n */\nconst CHART_MARGIN = { top: 8, right: 12, bottom: 0, left: 12 }\n\n/** How a bar meets the plot. The primary carrier of identity in monochrome. */\nexport type BarVariant = 'default' | 'hatched' | 'duotone' | 'duotone-reverse' | 'gradient' | 'stripped'\n\n/** How several bars combine: side by side, stacked, or normalised to 100%. */\nexport type BarStackType = 'default' | 'stacked' | 'percent'\n\n/**\n * Which way the bars run.\n *\n * `vertical` stands them up from a category axis along the bottom — the default,\n * and what a time series wants. `horizontal` lays them out from a category axis\n * down the side, which is what long category NAMES want: a label that would be\n * rotated 45° to fit under a column reads straight beside a row.\n */\nexport type BarOrientation = 'vertical' | 'horizontal'\n\ninterface BarChartContextValue {\n config: ChartConfig\n /** The rows on screen, so a mark can label its own extremes. */\n rows: Record<string, unknown>[]\n isStacked: boolean\n isHorizontal: boolean\n isLoading: boolean\n barRadius: number\n animationType: ChartRevealType\n introStartedAt: number\n dataLength: number\n selectedDataKey: string | null\n selectDataKey: (dataKey: string | null) => void\n isPointerInChart: boolean\n}\n\nconst BarChartContext = createContext<BarChartContextValue | null>(null)\n\nfunction useBarChart(): BarChartContextValue {\n const context = useContext(BarChartContext)\n if (!context) throw new Error('A bar chart part must be rendered inside <BarChart>')\n return context\n}\n\ntype ValidateKeys<TData, TConfig> = {\n [K in keyof TConfig]: K extends keyof TData ? ChartConfig[string] : never\n}\n\nexport interface BarChartProps<\n TData extends Record<string, unknown>,\n TConfig extends Record<string, ChartConfig[string]>,\n> {\n config: TConfig & ValidateKeys<TData, TConfig>\n /** The rows the chart draws. One entry per point, bar or category. */\n data: TData[]\n /**\n * What the chart shows, in a sentence a reader could act on. Required, and\n * announced to a screen reader even when it is not printed.\n */\n title: string\n /** Prints the title above the plot instead of hiding it from sight. */\n showTitle?: boolean\n /** A line under the title — the unit, the window, the caveat. */\n description?: ReactNode\n /**\n * The composed parts — axes, grid, tooltip, legend, and the marks\n * themselves.\n */\n children: ReactNode\n /** Merged onto the figure, last, so a call site can size or space it. */\n className?: string\n /** Escape hatch onto the raw Recharts chart element. */\n chartProps?: ComponentProps<typeof RechartsBarChart>\n /** How several marks combine: side by side, stacked, or normalised to 100%. */\n stackType?: BarStackType\n /**\n * Which way the bars run. Reach for `horizontal` when the category names are\n * long enough to need rotating under a column.\n */\n orientation?: BarOrientation\n /** The corner every `<BarChart.Bar>` inherits. */\n barRadius?: number\n /** The grow-in order every `<BarChart.Bar>` inherits. */\n animationType?: ChartRevealType\n /** Gap between bars inside one category. */\n barGap?: number\n /** Gap between categories. */\n barCategoryGap?: number\n /** The series lit on first render. Selection dims every other series. */\n defaultSelectedDataKey?: string | null\n /** Fires when the selection changes, and with null when it is cleared. */\n onSelectionChange?: (selectedDataKey: string | null) => void\n /**\n * Swaps the marks for an animated skeleton, keeping the measured height so\n * the page does not jump when the data lands.\n */\n isLoading?: boolean\n /** How many bars the skeleton draws. */\n loadingBars?: number\n /**\n * The row field on the category axis. Needed by the brush and by the table\n * view.\n */\n xDataKey?: keyof TData & string\n /**\n * Drops the hidden table view. Only correct when the page prints the data\n * itself.\n */\n hideDataTable?: boolean\n /**\n * What the chart shows when it has nothing to draw.\n *\n * Rendered instead of the plot whenever `data` is empty and the chart is not\n * loading — the state a real dashboard reaches within a week, and the one an\n * empty pair of axes is indistinguishable from a failed load. `false` keeps\n * the axes, for a chart whose emptiness is itself the reading.\n */\n empty?: ChartEmptyProps | false\n}\n\n/**\n * Discrete categories compared by length — the shape for \"how much, per thing\".\n *\n * Reach for `<AreaChart>` or `<LineChart>` when the axis is continuous and the\n * reader is following a trend rather than comparing buckets.\n *\n * @example\n * <BarChart title=\"Visitors by month\" config={config} data={data} xDataKey=\"month\">\n * <BarChart.Grid />\n * <BarChart.XAxis dataKey=\"month\" />\n * <BarChart.Tooltip />\n * <BarChart.Bar dataKey=\"desktop\" variant=\"duotone\" />\n * </BarChart>\n */\nexport function BarChart<\n TData extends Record<string, unknown>,\n TConfig extends Record<string, ChartConfig[string]>,\n>({\n config,\n data,\n title,\n showTitle,\n description,\n children,\n className,\n chartProps,\n stackType = 'default',\n orientation = 'vertical',\n barRadius = BAR_RADIUS,\n animationType = 'forward',\n barGap,\n barCategoryGap,\n defaultSelectedDataKey = null,\n onSelectionChange,\n isLoading = false,\n loadingBars,\n xDataKey,\n hideDataTable = false,\n empty,\n}: BarChartProps<TData, TConfig>) {\n const chartId = useId().replace(/:/g, '')\n // Stamped once, on the first render. The grow-in reads elapsed time from\n // here rather than from mount, because Recharts remounts every bar on any\n // re-render — a mount-anchored animation would replay on every hover.\n const [introStartedAt] = useState(() => Date.now())\n const [selectedDataKey, setSelectedDataKey] = useState<string | null>(defaultSelectedDataKey)\n const [isPointerInChart, setIsPointerInChart] = useState(false)\n const { rows: loadingData, onShimmerExit } = useLoadingRows(isLoading, loadingBars ?? 12)\n // One window, two views of it: the brush strip below the plot and the\n // toolbar above it both read and write this. See `useChartZoom` for why they\n // are not two separate windows.\n const zoom = useChartZoom({ data, xDataKey })\n\n // The brush, the toolbar and the sonify control are declared as children but\n // never rendered into the Recharts tree — they live in the figure, outside\n // the SVG.\n const { brushSlot, toolbarSlot, sonifySlot, chartChildren } = useMemo(() => {\n const parts = Children.toArray(children)\n const element = parts.find((child) => isValidElement(child) && child.type === Brush)\n const props = (isValidElement(element) ? element.props : {}) as BrushProps\n return {\n brushSlot: { present: isValidElement(element), ...props },\n toolbarSlot: findSlot<ToolbarProps>(parts, Toolbar),\n sonifySlot: findSlot<SonifyProps>(parts, Sonify),\n chartChildren: parts.filter(\n (child) =>\n !(\n isValidElement(child) &&\n (child.type === Brush || child.type === Toolbar || child.type === Sonify)\n ),\n ),\n }\n }, [children])\n\n const isStacked = stackType === 'stacked' || stackType === 'percent'\n const isHorizontal = orientation === 'horizontal'\n const columns = useMemo(\n () => Object.entries(config).map(([key, series]) => ({ key, label: series.label })),\n [config],\n )\n\n const showBrush = brushSlot.present && !isLoading\n const showToolbar = toolbarSlot !== null && !isLoading\n // `empty === false` keeps the axes, for a chart whose emptiness is the\n // reading — a monitoring panel that should show a flat, silent range rather\n // than a message.\n const isEmpty = !isLoading && empty !== false && data.length === 0\n const displayData = showBrush || showToolbar ? zoom.visibleData : data\n\n // The rows on screen, so a brushed range sounds like what it looks like. The\n // skeleton's rows carry no real series, which is what leaves the control\n // disabled while data is in flight rather than playing yesterday's numbers.\n const sonifySeries = useChartSonifySeries(\n sonifySlot,\n (isLoading ? loadingData : displayData) as Record<string, unknown>[],\n config,\n xDataKey,\n )\n\n const selectDataKey = useCallback(\n (next: string | null) => {\n setSelectedDataKey(next)\n onSelectionChange?.(next)\n },\n [onSelectionChange],\n )\n\n const context = useMemo<BarChartContextValue>(\n () => ({\n config,\n rows: displayData as Record<string, unknown>[],\n isStacked,\n isHorizontal,\n isLoading,\n barRadius,\n animationType,\n introStartedAt,\n dataLength: displayData.length,\n selectedDataKey,\n selectDataKey,\n isPointerInChart,\n }),\n [\n animationType,\n barRadius,\n config,\n displayData,\n introStartedAt,\n isHorizontal,\n isLoading,\n isPointerInChart,\n isStacked,\n selectDataKey,\n selectedDataKey,\n ],\n )\n\n return (\n <BarChartContext.Provider value={context}>\n <ChartFigure\n title={title}\n showTitle={showTitle}\n description={description}\n className={className}\n table={\n hideDataTable\n ? false\n : { rows: data, rowKey: xDataKey, columns }\n }\n >\n {sonifySlot && (\n <ChartSonifyButton {...sonifySlot} title={title} series={sonifySeries} />\n )}\n {isEmpty ? (\n <ChartEmpty {...(empty || {})} />\n ) : (\n <ChartControls\n toolbar={showToolbar ? toolbarSlot : null}\n zoom={zoom}\n title={title}\n rows={data}\n columns={columns}\n rowKey={xDataKey}\n >\n <ChartContainer\n config={config}\n footer={\n showBrush && (\n <ChartBrush\n data={data}\n config={config}\n xDataKey={xDataKey}\n variant=\"bar\"\n barRadius={barRadius}\n height={brushSlot.height}\n formatLabel={brushSlot.formatLabel}\n stacked={isStacked}\n className=\"mt-1\"\n {...zoom.brushProps}\n onChange={(range: ChartBrushRange) => {\n zoom.brushProps.onChange(range)\n brushSlot.onChange?.(range)\n }}\n />\n )\n }\n >\n <RechartsBarChart\n id={chartId}\n accessibilityLayer\n margin={CHART_MARGIN}\n // Recharts' `layout` names the axis the CATEGORIES run along, which\n // is the opposite of what a reader means by a horizontal bar chart.\n // The flip is done once, here.\n layout={isHorizontal ? 'vertical' : 'horizontal'}\n data={isLoading ? loadingData : displayData}\n barGap={barGap}\n barCategoryGap={barCategoryGap}\n stackOffset={stackType === 'percent' ? 'expand' : undefined}\n onMouseEnter={() => setIsPointerInChart(true)}\n onMouseLeave={() => setIsPointerInChart(false)}\n {...chartProps}\n >\n {chartChildren}\n {isLoading && <LoadingBar chartId={chartId} onShimmerExit={onShimmerExit} />}\n </RechartsBarChart>\n </ChartContainer>\n </ChartControls>\n )}\n <LoadingIndicator isLoading={isLoading} />\n </ChartFigure>\n </BarChartContext.Provider>\n )\n}\n\nexport interface BarProps {\n dataKey: string\n variant?: BarVariant\n radius?: number\n animationType?: ChartRevealType\n /** Lets a click on this series select it, dimming the rest. */\n isClickable?: boolean\n /** Dims this series while another bar in the same column is hovered. */\n enableHoverHighlight?: boolean\n /** A halo behind the bars — for the one series that is the point of the figure. */\n glowing?: boolean\n /**\n * Draws the LAST category as an open hatch rather than a solid bar.\n *\n * The idiom for a period still in progress: the bar is the same height as any\n * other but is visibly not the same kind of fact.\n */\n buffer?: boolean\n /** `<BarChart.Values>`. */\n children?: ReactNode\n barProps?: ComponentProps<typeof RechartsBar>\n}\n\n/**\n * One bar series. Scopes its own patterns under a unique id, so any number of\n * series with different variants can share a chart.\n */\nfunction Bar({\n dataKey,\n variant = 'default',\n radius,\n animationType,\n isClickable = false,\n enableHoverHighlight = false,\n glowing = false,\n buffer = false,\n children,\n barProps,\n}: BarProps) {\n const {\n config,\n isStacked,\n isHorizontal,\n isLoading,\n rows,\n barRadius: defaultRadius,\n animationType: defaultAnimation,\n introStartedAt,\n dataLength,\n selectedDataKey,\n selectDataKey,\n isPointerInChart,\n } = useBarChart()\n const id = useId().replace(/:/g, '')\n const reduceMotion = useReducedMotion()\n\n if (isLoading) return null\n\n const resolvedRadius = radius ?? defaultRadius\n const isSelected = selectedDataKey === dataKey\n const reveal: ChartRevealType = reduceMotion ? 'none' : (animationType ?? defaultAnimation)\n\n const shared = {\n id,\n dataKey,\n variant,\n barRadius: resolvedRadius,\n glowing,\n buffer,\n isClickable,\n enableHoverHighlight,\n isPointerInChart,\n isHorizontal,\n introStartedAt,\n selectedDataKey,\n dataLength,\n onSelect: () => {\n if (!isClickable) return\n selectDataKey(isSelected ? null : dataKey)\n },\n }\n\n return (\n <>\n <RechartsBar\n dataKey={dataKey}\n stackId={isStacked ? STACK_ID : undefined}\n fill={`url(#${id}-colors-${dataKey})`}\n radius={resolvedRadius}\n isAnimationActive={false}\n style={isClickable || enableHoverHighlight ? { cursor: 'pointer' } : undefined}\n shape={(props: unknown) => (\n <BarShape {...(props as BarGeometry)} {...shared} animationType={reveal} />\n )}\n // The hovered bar re-renders through `activeBar`; without forcing the\n // animation off here it would replay its grow-in under the pointer.\n activeBar={(props: unknown) => (\n <BarShape {...(props as BarGeometry)} {...shared} animationType=\"none\" />\n )}\n {...barProps}\n >\n {resolveValues(\n findSlot<ValuesProps>(children, Values),\n rows.map((row) => Number(row[dataKey])).filter(Number.isFinite),\n )}\n </RechartsBar>\n <defs>\n <SeriesGradient id={id} dataKey={dataKey} config={config} direction=\"vertical\" />\n {variant === 'hatched' && <BarHatchedFill id={id} dataKey={dataKey} />}\n {variant === 'duotone' && <BarDuotoneFill id={id} dataKey={dataKey} config={config} />}\n {variant === 'duotone-reverse' && (\n <BarDuotoneFill id={id} dataKey={dataKey} config={config} reverse />\n )}\n {variant === 'gradient' && <BarGradientFill id={id} dataKey={dataKey} />}\n {variant === 'stripped' && <BarStrippedFill id={id} dataKey={dataKey} />}\n {buffer && <BarBufferFill id={id} dataKey={dataKey} />}\n {glowing && <GlowFilter id={id} dataKey={dataKey} />}\n </defs>\n </>\n )\n}\n\n/** The geometry Recharts hands a custom bar shape. */\ninterface BarGeometry {\n x?: number\n y?: number\n width?: number\n height?: number\n index?: number\n isActive?: boolean\n [key: string]: unknown\n}\n\ninterface BarShapeProps extends BarGeometry {\n id: string\n dataKey: string\n variant: BarVariant\n barRadius: number\n glowing: boolean\n buffer: boolean\n isClickable: boolean\n enableHoverHighlight: boolean\n isPointerInChart: boolean\n isHorizontal: boolean\n animationType: ChartRevealType\n introStartedAt: number\n selectedDataKey: string | null\n dataLength: number\n onSelect: () => void\n}\n\n/**\n * One drawn bar.\n *\n * Two rectangles, and the second one is the reason this is a custom shape: an\n * invisible full-height rect keeps the whole COLUMN hoverable and clickable, so\n * a 3px bar at the bottom of the scale is as easy to hit as a full-height one.\n * The painted bar sits inside it and is the only part that animates.\n */\nfunction BarShape(props: BarShapeProps) {\n const {\n x = 0,\n y = 0,\n width = 0,\n height = 0,\n id,\n dataKey,\n variant,\n barRadius,\n glowing,\n buffer,\n isClickable,\n enableHoverHighlight,\n isPointerInChart,\n isHorizontal,\n animationType,\n introStartedAt,\n selectedDataKey,\n isActive,\n dataLength,\n onSelect,\n } = props\n\n const index = typeof props.index === 'number' ? props.index : -1\n const isBufferBar = buffer && dataLength > 0 && index === dataLength - 1\n const isStripped = variant === 'stripped'\n const grow = growAnimation(animationType, index, dataLength, isHorizontal, introStartedAt)\n\n const fill = isBufferBar ? `url(#${id}-buffer-${dataKey})` : variantFill(variant, id, dataKey)\n const opacity = barOpacity({\n isClickable,\n selectedDataKey,\n dataKey,\n enableHoverHighlight,\n isPointerInChart,\n isActive,\n })\n\n // Stripped rounds only the cap; every other variant rounds all four corners.\n const radius: RectRadius = isStripped ? [barRadius, barRadius, 0, 0] : barRadius\n\n const painted = (\n <>\n <Rectangle\n x={x}\n y={y}\n width={width}\n // Three pixels off the foot, which is the 2px surface gap between a bar\n // and its neighbour above in a stack, plus the hairline.\n height={Math.max(0, height - 3)}\n opacity={opacity}\n radius={radius}\n fill={fill}\n filter={glowing ? `url(#${id}-glow-${dataKey})` : undefined}\n stroke={isBufferBar ? `url(#${id}-colors-${dataKey})` : undefined}\n strokeWidth={isBufferBar ? 1 : undefined}\n />\n {isStripped && (\n <Rectangle\n x={x}\n y={y - 4}\n width={width}\n height={2}\n radius={1}\n fill={`url(#${id}-colors-${dataKey})`}\n />\n )}\n </>\n )\n\n return (\n <g\n style={isClickable || enableHoverHighlight ? { cursor: 'pointer' } : undefined}\n onClick={onSelect}\n >\n <Rectangle {...props} fill=\"transparent\" />\n {grow ? (\n <motion.g\n initial={grow.initial}\n animate={grow.animate}\n transition={grow.transition}\n style={grow.style}\n >\n {painted}\n </motion.g>\n ) : (\n painted\n )}\n </g>\n )\n}\n\n/**\n * The grow-in for a single bar, or `null` when it should render static.\n *\n * The animation is anchored to when the CHART started rather than to when this\n * bar mounted, because Recharts remounts every bar on every re-render — a hover\n * anywhere in the plot would otherwise replay the whole intro. Reading elapsed\n * time makes it a true one-shot: a bar past its window renders flat, and a bar\n * caught mid-grow resumes from where it should already be.\n */\nfunction growAnimation(\n animationType: ChartRevealType,\n index: number,\n dataLength: number,\n isHorizontal: boolean,\n introStartedAt: number,\n) {\n if (animationType === 'none' || index < 0 || dataLength <= 0) return null\n\n const lastIndex = dataLength - 1\n const centre = lastIndex / 2\n\n let step: number\n switch (animationType) {\n case 'reverse':\n step = lastIndex - index\n break\n case 'center-out':\n step = Math.abs(index - centre)\n break\n case 'edges-in':\n step = centre - Math.abs(index - centre)\n break\n default:\n step = index\n }\n\n const startMs = step * GROW_STAGGER * 1000\n const endMs = startMs + GROW_DURATION * 1000\n const elapsed = Date.now() - introStartedAt\n\n if (elapsed >= endMs) return null\n\n const from = elapsed <= startMs ? 0 : (elapsed - startMs) / (GROW_DURATION * 1000)\n const transition = {\n duration: (endMs - Math.max(elapsed, startMs)) / 1000,\n ease: REVEAL_EASE,\n delay: Math.max(0, startMs - elapsed) / 1000,\n }\n\n return isHorizontal\n ? { initial: { scaleX: from }, animate: { scaleX: 1 }, transition, style: { originX: 0 } }\n : { initial: { scaleY: from }, animate: { scaleY: 1 }, transition, style: { originY: 1 } }\n}\n\n/** The paint reference for a variant. */\nfunction variantFill(variant: BarVariant, id: string, dataKey: string): string {\n if (variant === 'default') return `url(#${id}-colors-${dataKey})`\n return `url(#${id}-${variant}-${dataKey})`\n}\n\n/** How lit a bar is, given the click selection and the hover highlight. */\nfunction barOpacity({\n isClickable,\n selectedDataKey,\n dataKey,\n enableHoverHighlight,\n isPointerInChart,\n isActive,\n}: {\n isClickable: boolean\n selectedDataKey: string | null\n dataKey: string\n enableHoverHighlight: boolean\n isPointerInChart: boolean\n isActive?: boolean\n}) {\n const inSelection = selectedDataKey === null || selectedDataKey === dataKey\n const selectionOpacity = isClickable && selectedDataKey !== null ? (inSelection ? 1 : 0.15) : 1\n\n if (enableHoverHighlight && isPointerInChart) {\n return isActive ? selectionOpacity : selectionOpacity * 0.3\n }\n return selectionOpacity\n}\n\n/**\n * The category axis when the bars stand up, the value axis when they lie down.\n * The type is resolved from the orientation so a consumer never has to know\n * which way round Recharts wants it.\n */\nfunction XAxis({\n tickLine = false,\n axisLine = false,\n tickMargin = 8,\n minTickGap = 8,\n type,\n label,\n ...rest\n}: ChartXAxisProps) {\n const { isLoading, isHorizontal } = useBarChart()\n if (isLoading) return null\n return (\n <RechartsXAxis\n tickLine={tickLine}\n axisLine={axisLine}\n tickMargin={tickMargin}\n minTickGap={minTickGap}\n type={type ?? (isHorizontal ? 'number' : 'category')}\n {...rest}\n >\n {axisLabel(label, 'x')}\n </RechartsXAxis>\n )\n}\n\n/** The other axis, resolved the same way. */\nfunction YAxis({\n tickLine = false,\n axisLine = false,\n tickMargin = 8,\n minTickGap = 8,\n width = 'auto',\n type,\n label,\n tickFormatter,\n ...rest\n}: ChartYAxisProps) {\n const { isLoading, isHorizontal } = useBarChart()\n if (isLoading) return null\n return (\n <RechartsYAxis\n tickLine={tickLine}\n axisLine={axisLine}\n tickMargin={tickMargin}\n minTickGap={minTickGap}\n width={width}\n type={type ?? (isHorizontal ? 'category' : 'number')}\n tickFormatter={tickFormatter ?? defaultTick}\n {...rest}\n >\n {axisLabel(label, 'y')}\n </RechartsYAxis>\n )\n}\n\n/** Rules across the value axis — whichever axis that is for this orientation. */\nfunction Grid({\n strokeDasharray = '3 3',\n vertical,\n horizontal,\n ...rest\n}: ComponentProps<typeof CartesianGrid>) {\n const { isHorizontal } = useBarChart()\n return (\n <CartesianGrid\n strokeDasharray={strokeDasharray}\n vertical={vertical ?? isHorizontal}\n horizontal={horizontal ?? !isHorizontal}\n {...rest}\n />\n )\n}\n\n/**\n * The hover panel.\n *\n * No crosshair by default, unlike the line and area charts: a bar already marks\n * its own category, and a cursor over it draws a second edge on a shape that\n * has four already.\n */\nfunction Tooltip({ variant, roundness, defaultIndex, cursor = false }: ChartTooltipSlotProps) {\n const { isLoading, selectedDataKey } = useBarChart()\n if (isLoading) return null\n\n return (\n <ChartTooltip\n cursor={cursor}\n defaultIndex={defaultIndex}\n content={\n <ChartTooltipContent selected={selectedDataKey} roundness={roundness} variant={variant} />\n }\n />\n )\n}\n\n/** The key. Required above one series. */\nfunction Legend({\n variant,\n align = 'right',\n verticalAlign = 'top',\n isClickable = false,\n}: ChartLegendSlotProps) {\n const { selectedDataKey, selectDataKey } = useBarChart()\n\n return (\n <ChartLegend\n verticalAlign={verticalAlign}\n align={align}\n content={\n <ChartLegendContent\n selected={selectedDataKey}\n onSelectChange={selectDataKey}\n isClickable={isClickable}\n variant={variant}\n />\n }\n />\n )\n}\n\n/** The decorative plate behind the plot. */\nfunction Background({ variant }: { variant: ChartBackgroundVariant }) {\n const { isLoading } = useBarChart()\n if (isLoading) return null\n return <ChartBackground variant={variant} />\n}\n\n/** The skeleton drawn in place of the real bars while data is in flight. */\nfunction LoadingBar({ chartId, onShimmerExit }: { chartId: string; onShimmerExit: () => void }) {\n return (\n <>\n <RechartsBar\n dataKey={LOADING_KEY}\n fill=\"currentColor\"\n fillOpacity={0.15}\n radius={BAR_RADIUS}\n isAnimationActive={false}\n legendType=\"none\"\n className=\"text-(--ink)\"\n style={{ mask: `url(#${chartId}-loading-mask)` }}\n />\n <defs>\n <LoadingShimmer id={chartId} onShimmerExit={onShimmerExit} />\n </defs>\n </>\n )\n}\n\nBarChart.Bar = Bar\nBarChart.XAxis = XAxis\nBarChart.YAxis = YAxis\nBarChart.Grid = Grid\nBarChart.Tooltip = Tooltip\nBarChart.Legend = Legend\nBarChart.Background = Background\nBarChart.ReferenceLine = ReferenceLine\nBarChart.ReferenceBand = ReferenceBand\nBarChart.Annotation = Annotation\nBarChart.Values = Values\nBarChart.Brush = Brush\nBarChart.Toolbar = Toolbar\nBarChart.Sonify = Sonify\n\nexport default BarChart\n"],"mappings":";AAyWU,SAmJN,UAnJM,KAoCA,YApCA;AAvWV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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