@acronis-platform/ui-react 2.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist/components/ui/accordion-container/accordion-container.js +144 -0
  2. package/dist/components/ui/accordion-container/accordion-container.js.map +1 -0
  3. package/dist/components/ui/app-shell-chat/app-shell-chat.js.map +1 -1
  4. package/dist/components/ui/area-chart/area-chart.js +141 -139
  5. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  6. package/dist/components/ui/avatar/avatar.js +33 -22
  7. package/dist/components/ui/avatar/avatar.js.map +1 -1
  8. package/dist/components/ui/bar-chart/bar-chart.js +295 -293
  9. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  10. package/dist/components/ui/card/card.js +150 -74
  11. package/dist/components/ui/card/card.js.map +1 -1
  12. package/dist/components/ui/card-section/card-section.js +111 -0
  13. package/dist/components/ui/card-section/card-section.js.map +1 -0
  14. package/dist/components/ui/category-bar/category-bar.js +109 -93
  15. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  16. package/dist/components/ui/chart/chart-palette.js +113 -0
  17. package/dist/components/ui/chart/chart-palette.js.map +1 -0
  18. package/dist/components/ui/chart/chart.js +176 -129
  19. package/dist/components/ui/chart/chart.js.map +1 -1
  20. package/dist/components/ui/chart-state/chart-state-illustrations.js +310 -0
  21. package/dist/components/ui/chart-state/chart-state-illustrations.js.map +1 -0
  22. package/dist/components/ui/chart-state/chart-state.js +48 -34
  23. package/dist/components/ui/chart-state/chart-state.js.map +1 -1
  24. package/dist/components/ui/chart-widget/chart-widget.js +87 -0
  25. package/dist/components/ui/chart-widget/chart-widget.js.map +1 -0
  26. package/dist/components/ui/composed-chart/composed-chart.js +117 -115
  27. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  28. package/dist/components/ui/confidence-cone/confidence-cone.js +166 -158
  29. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  30. package/dist/components/ui/data-table/data-table.js +4 -2
  31. package/dist/components/ui/data-table/data-table.js.map +1 -1
  32. package/dist/components/ui/empty-overlay/empty-overlay.js +49 -0
  33. package/dist/components/ui/empty-overlay/empty-overlay.js.map +1 -0
  34. package/dist/components/ui/funnel-chart/funnel-chart.js +162 -161
  35. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  36. package/dist/components/ui/histogram/histogram.js +94 -92
  37. package/dist/components/ui/histogram/histogram.js.map +1 -1
  38. package/dist/components/ui/input/input.js.map +1 -1
  39. package/dist/components/ui/label/label.js +2 -9
  40. package/dist/components/ui/label/label.js.map +1 -1
  41. package/dist/components/ui/line-chart/line-chart.js +143 -141
  42. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  43. package/dist/components/ui/metric/metric.js +74 -185
  44. package/dist/components/ui/metric/metric.js.map +1 -1
  45. package/dist/components/ui/page-content/page-content.js.map +1 -1
  46. package/dist/components/ui/pie-chart/pie-chart.js +201 -195
  47. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
  48. package/dist/components/ui/radar-chart/radar-chart.js +133 -131
  49. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  50. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +297 -265
  51. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
  52. package/dist/components/ui/sankey-chart/sankey-chart.js +123 -101
  53. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
  54. package/dist/components/ui/scatter-chart/scatter-chart.js +76 -74
  55. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  56. package/dist/components/ui/section/section.js +157 -31
  57. package/dist/components/ui/section/section.js.map +1 -1
  58. package/dist/components/ui/stepper/stepper.js +24 -24
  59. package/dist/components/ui/stepper/stepper.js.map +1 -1
  60. package/dist/components/ui/stepper-item/stepper-item.js +43 -24
  61. package/dist/components/ui/stepper-item/stepper-item.js.map +1 -1
  62. package/dist/components/ui/table/table.js +27 -27
  63. package/dist/components/ui/table/table.js.map +1 -1
  64. package/dist/components/ui/treemap/treemap.js +133 -124
  65. package/dist/components/ui/treemap/treemap.js.map +1 -1
  66. package/dist/components/ui/trend-indicator/trend-indicator.js +34 -69
  67. package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -1
  68. package/dist/components/ui/wizard/wizard.js +59 -0
  69. package/dist/components/ui/wizard/wizard.js.map +1 -0
  70. package/dist/hooks/use-wizard.js +75 -0
  71. package/dist/hooks/use-wizard.js.map +1 -0
  72. package/dist/index.js +540 -525
  73. package/dist/index.js.map +1 -1
  74. package/dist/llms/accordion-container.md +181 -0
  75. package/dist/llms/accordion.md +124 -0
  76. package/dist/llms/alert.md +225 -0
  77. package/dist/llms/app-shell-chat.md +415 -0
  78. package/dist/llms/area-chart.md +355 -0
  79. package/dist/llms/avatar.md +208 -0
  80. package/dist/llms/bar-chart.md +406 -0
  81. package/dist/llms/breadcrumb.md +326 -0
  82. package/dist/llms/button-group.md +298 -0
  83. package/dist/llms/button-icon-input.md +142 -0
  84. package/dist/llms/button-icon-menu.md +209 -0
  85. package/dist/llms/button-icon.md +128 -0
  86. package/dist/llms/button-menu.md +172 -0
  87. package/dist/llms/button.md +185 -0
  88. package/dist/llms/calendar-panel.md +733 -0
  89. package/dist/llms/calendar.md +188 -0
  90. package/dist/llms/card-filter.md +214 -0
  91. package/dist/llms/card-section.md +293 -0
  92. package/dist/llms/card.md +447 -0
  93. package/dist/llms/carousel-dialog.md +156 -0
  94. package/dist/llms/category-bar.md +193 -0
  95. package/dist/llms/chart-state.md +190 -0
  96. package/dist/llms/chart-widget.md +209 -0
  97. package/dist/llms/chart.md +182 -0
  98. package/dist/llms/checkbox.md +257 -0
  99. package/dist/llms/chip.md +195 -0
  100. package/dist/llms/combobox.md +164 -0
  101. package/dist/llms/composed-chart.md +508 -0
  102. package/dist/llms/confidence-cone.md +277 -0
  103. package/dist/llms/data-table.md +474 -0
  104. package/dist/llms/date-range-picker.md +272 -0
  105. package/dist/llms/description-list.md +131 -0
  106. package/dist/llms/dialog-footer-carousel.md +147 -0
  107. package/dist/llms/dialog-footer-default.md +142 -0
  108. package/dist/llms/dialog-root.md +246 -0
  109. package/dist/llms/dialog-welcome.md +223 -0
  110. package/dist/llms/dialog.md +403 -0
  111. package/dist/llms/dropdown-menu.md +193 -0
  112. package/dist/llms/empty-overlay.md +146 -0
  113. package/dist/llms/empty.md +156 -0
  114. package/dist/llms/field.md +185 -0
  115. package/dist/llms/filter-cards.md +157 -0
  116. package/dist/llms/filter-chips.md +323 -0
  117. package/dist/llms/filter-search.md +512 -0
  118. package/dist/llms/form.md +154 -0
  119. package/dist/llms/funnel-chart.md +333 -0
  120. package/dist/llms/grid.md +80 -0
  121. package/dist/llms/histogram.md +190 -0
  122. package/dist/llms/input-date-picker.md +203 -0
  123. package/dist/llms/input-otp.md +173 -0
  124. package/dist/llms/input-password.md +197 -0
  125. package/dist/llms/input-search.md +170 -0
  126. package/dist/llms/input-select.md +278 -0
  127. package/dist/llms/input-text-area.md +271 -0
  128. package/dist/llms/input-text.md +192 -0
  129. package/dist/llms/line-chart.md +369 -0
  130. package/dist/llms/link.md +209 -0
  131. package/dist/llms/loading.md +130 -0
  132. package/dist/llms/meter.md +177 -0
  133. package/dist/llms/metric.md +204 -0
  134. package/dist/llms/number-field.md +122 -0
  135. package/dist/llms/page-content.md +69 -0
  136. package/dist/llms/page-header.md +182 -0
  137. package/dist/llms/pagination.md +133 -0
  138. package/dist/llms/pie-chart.md +307 -0
  139. package/dist/llms/popover.md +252 -0
  140. package/dist/llms/progress-circle.md +126 -0
  141. package/dist/llms/progress.md +111 -0
  142. package/dist/llms/radar-chart.md +316 -0
  143. package/dist/llms/radial-bar-chart.md +319 -0
  144. package/dist/llms/radio.md +255 -0
  145. package/dist/llms/resizable.md +195 -0
  146. package/dist/llms/sankey-chart.md +208 -0
  147. package/dist/llms/scatter-chart.md +239 -0
  148. package/dist/llms/scroll-area.md +183 -0
  149. package/dist/llms/section.md +401 -0
  150. package/dist/llms/select.md +210 -0
  151. package/dist/llms/separator.md +87 -0
  152. package/dist/llms/sheet.md +202 -0
  153. package/dist/llms/sidebar-primary.md +360 -0
  154. package/dist/llms/sidebar-secondary.md +417 -0
  155. package/dist/llms/skeleton.md +81 -0
  156. package/dist/llms/slider.md +97 -0
  157. package/dist/llms/spinner.md +100 -0
  158. package/dist/llms/stack.md +80 -0
  159. package/dist/llms/stepper-item.md +309 -0
  160. package/dist/llms/stepper.md +251 -0
  161. package/dist/llms/switch.md +140 -0
  162. package/dist/llms/table.md +436 -0
  163. package/dist/llms/tabs.md +197 -0
  164. package/dist/llms/tag.md +139 -0
  165. package/dist/llms/timeline.md +361 -0
  166. package/dist/llms/timer.md +259 -0
  167. package/dist/llms/toast.md +241 -0
  168. package/dist/llms/toggle-group.md +121 -0
  169. package/dist/llms/toolbar.md +453 -0
  170. package/dist/llms/tooltip.md +164 -0
  171. package/dist/llms/treemap.md +254 -0
  172. package/dist/llms/trend-indicator.md +132 -0
  173. package/dist/llms/widget-placeholder.md +169 -0
  174. package/dist/llms/wizard.md +412 -0
  175. package/dist/llms.txt +142 -0
  176. package/dist/react.js +540 -525
  177. package/dist/react.js.map +1 -1
  178. package/dist/src/components/ui/accordion-container/accordion-container.d.ts +44 -0
  179. package/dist/src/components/ui/accordion-container/index.d.ts +1 -0
  180. package/dist/src/components/ui/area-chart/area-chart.d.ts +9 -4
  181. package/dist/src/components/ui/avatar/avatar.d.ts +27 -8
  182. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +9 -4
  183. package/dist/src/components/ui/button/button.d.ts +1 -1
  184. package/dist/src/components/ui/card/card.d.ts +69 -8
  185. package/dist/src/components/ui/card/index.d.ts +1 -1
  186. package/dist/src/components/ui/card-section/card-section.d.ts +50 -0
  187. package/dist/src/components/ui/card-section/index.d.ts +1 -0
  188. package/dist/src/components/ui/category-bar/category-bar.d.ts +10 -4
  189. package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +48 -0
  190. package/dist/src/components/ui/chart/__tests__/chart-palette.test.d.ts +1 -0
  191. package/dist/src/components/ui/chart/chart-palette.d.ts +128 -0
  192. package/dist/src/components/ui/chart/chart.d.ts +66 -15
  193. package/dist/src/components/ui/chart/index.d.ts +4 -2
  194. package/dist/src/components/ui/chart-state/chart-state-illustrations.d.ts +6 -0
  195. package/dist/src/components/ui/chart-state/chart-state.d.ts +13 -2
  196. package/dist/src/components/ui/chart-state/index.d.ts +1 -0
  197. package/dist/src/components/ui/chart-widget/chart-widget.d.ts +64 -0
  198. package/dist/src/components/ui/chart-widget/index.d.ts +1 -0
  199. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +12 -7
  200. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +10 -5
  201. package/dist/src/components/ui/dialog/dialog.d.ts +1 -1
  202. package/dist/src/components/ui/empty-overlay/empty-overlay.d.ts +20 -0
  203. package/dist/src/components/ui/empty-overlay/index.d.ts +2 -0
  204. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +11 -5
  205. package/dist/src/components/ui/grid/grid.d.ts +1 -1
  206. package/dist/src/components/ui/histogram/histogram.d.ts +10 -4
  207. package/dist/src/components/ui/label/index.d.ts +1 -1
  208. package/dist/src/components/ui/label/label.d.ts +1 -5
  209. package/dist/src/components/ui/line-chart/line-chart.d.ts +9 -4
  210. package/dist/src/components/ui/metric/metric.d.ts +13 -14
  211. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +17 -8
  212. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +10 -5
  213. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +17 -6
  214. package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +10 -5
  215. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +10 -5
  216. package/dist/src/components/ui/section/index.d.ts +1 -1
  217. package/dist/src/components/ui/section/section.d.ts +75 -6
  218. package/dist/src/components/ui/sheet/sheet.d.ts +1 -1
  219. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  220. package/dist/src/components/ui/stepper-item/stepper-item.d.ts +6 -5
  221. package/dist/src/components/ui/tag/tag.d.ts +1 -1
  222. package/dist/src/components/ui/treemap/treemap.d.ts +11 -5
  223. package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +3 -7
  224. package/dist/src/components/ui/wizard/index.d.ts +1 -0
  225. package/dist/src/components/ui/wizard/wizard.d.ts +6 -0
  226. package/dist/src/hooks/index.d.ts +1 -0
  227. package/dist/src/hooks/use-wizard.d.ts +80 -0
  228. package/dist/src/index.d.ts +5 -3
  229. package/dist/ui-react.css +1 -1
  230. package/package.json +12 -6
  231. package/dist/components/ui/app-shell/app-shell.js +0 -75
  232. package/dist/components/ui/app-shell/app-shell.js.map +0 -1
  233. package/dist/components/ui/auth-layout/auth-layout.js +0 -56
  234. package/dist/components/ui/auth-layout/auth-layout.js.map +0 -1
  235. package/dist/components/ui/collapsible/collapsible.js +0 -22
  236. package/dist/components/ui/collapsible/collapsible.js.map +0 -1
  237. package/dist/src/components/ui/app-shell/app-shell.d.ts +0 -8
  238. package/dist/src/components/ui/app-shell/index.d.ts +0 -1
  239. package/dist/src/components/ui/auth-layout/auth-layout.d.ts +0 -6
  240. package/dist/src/components/ui/auth-layout/index.d.ts +0 -1
  241. package/dist/src/components/ui/collapsible/collapsible.d.ts +0 -5
  242. package/dist/src/components/ui/collapsible/index.d.ts +0 -1
  243. package/dist/src/components/ui/label/label.docs.d.ts +0 -10
@@ -1,29 +1,64 @@
1
- import { jsx as o, jsxs as v, Fragment as L } from "react/jsx-runtime";
2
- import * as p from "react";
1
+ import { jsx as s, jsxs as p, Fragment as L } from "react/jsx-runtime";
2
+ import * as b from "react";
3
3
  import * as j from "recharts";
4
- import { cn as d } from "../../../lib/utils.js";
5
- const E = { light: "", dark: "[data-theme='dark']" }, N = p.createContext(null);
6
- function P() {
7
- const e = p.useContext(N);
4
+ import { cn as x } from "../../../lib/utils.js";
5
+ import { CHART_DEFAULT_PALETTE as $, resolveSeriesColor as C, CHART_STATUS_TOKENS as A } from "./chart-palette.js";
6
+ function S(e, r) {
7
+ var h;
8
+ const t = Object.entries(e), n = (c) => {
9
+ var l;
10
+ return !!((l = c.tone) != null && l.sameAs);
11
+ };
12
+ let o = 0;
13
+ const i = {};
14
+ for (const [c, l] of t)
15
+ n(l) || (i[c] = {
16
+ ...l,
17
+ color: C(r, { index: o++, tone: l.tone })
18
+ });
19
+ const a = /* @__PURE__ */ new Map();
20
+ for (const [c, l] of t)
21
+ n(l) && a.set(c, l.tone.sameAs);
22
+ let f = !0;
23
+ for (; f && a.size > 0; ) {
24
+ f = !1;
25
+ for (const [c, l] of a) {
26
+ const v = (h = i[l]) == null ? void 0 : h.color;
27
+ v !== void 0 && (i[c] = { ...e[c], color: v }, a.delete(c), f = !0);
28
+ }
29
+ }
30
+ for (const [c, l] of a)
31
+ process.env.NODE_ENV !== "production" && console.warn(
32
+ `[ui-react] Chart series "${c}" aliases "${l}", which is not a palette-assigned series in this config. Falling back to neutral.`
33
+ ), i[c] = { ...e[c], color: A.neutral };
34
+ return Object.fromEntries(t.map(([c]) => [c, i[c]]));
35
+ }
36
+ const T = b.createContext(null);
37
+ function y() {
38
+ const e = b.useContext(T);
8
39
  if (!e)
9
40
  throw new Error("useChart must be used within a <ChartContainer />");
10
41
  return e;
11
42
  }
12
- function O({
43
+ function H({
13
44
  id: e,
14
45
  className: r,
15
46
  children: t,
16
47
  config: n,
17
- ...s
48
+ palette: o = $,
49
+ ...i
18
50
  }) {
19
- const l = p.useId(), c = `chart-${e || l.replace(/:/g, "")}`;
20
- return /* @__PURE__ */ o(N.Provider, { value: { config: n }, children: /* @__PURE__ */ v(
51
+ const a = b.useId(), f = `chart-${e || a.replace(/:/g, "")}`, h = b.useMemo(
52
+ () => S(n, o),
53
+ [n, o]
54
+ );
55
+ return /* @__PURE__ */ s(T.Provider, { value: { config: h }, children: /* @__PURE__ */ p(
21
56
  "div",
22
57
  {
23
58
  id: e,
24
59
  "data-slot": "chart",
25
- "data-chart": c,
26
- className: d(
60
+ "data-chart": f,
61
+ className: x(
27
62
  "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden [&_.recharts-trapezoid[stroke='#fff']]:stroke-transparent",
28
63
  // A `<Brush>` traveller is the one `.recharts-layer` that is a real
29
64
  // control (`role="slider"`, tabbable, arrow-key driven), so the blanket
@@ -52,216 +87,228 @@ function O({
52
87
  "[&_.recharts-surface]:[direction:ltr] rtl:[&_.recharts-surface_foreignObject]:[direction:rtl]",
53
88
  r
54
89
  ),
55
- ...s,
90
+ ...i,
56
91
  children: [
57
- /* @__PURE__ */ o(T, { id: c, config: n }),
58
- /* @__PURE__ */ o(j.ResponsiveContainer, { children: t })
92
+ /* @__PURE__ */ s(O, { id: f, config: h }),
93
+ /* @__PURE__ */ s(j.ResponsiveContainer, { children: t })
59
94
  ]
60
95
  }
61
96
  ) });
62
97
  }
63
- const T = ({ id: e, config: r }) => {
64
- const t = Object.entries(r).filter(
65
- ([, n]) => n.theme || n.color
66
- );
67
- return t.length ? /* @__PURE__ */ o("style", { children: Object.entries(E).map(
68
- ([n, s]) => `
69
- ${s} [data-chart=${e}] {
70
- ${t.map(([l, c]) => {
71
- var u;
72
- const i = ((u = c.theme) == null ? void 0 : u[n]) || c.color;
73
- return i ? ` --color-${l}: ${i};` : null;
74
- }).join(`
98
+ const O = ({
99
+ id: e,
100
+ config: r
101
+ }) => {
102
+ const t = Object.entries(r);
103
+ return t.length ? /* @__PURE__ */ s("style", { children: `[data-chart=${e}] {
104
+ ${t.map(([n, o]) => ` --color-${n}: ${o.color};`).join(`
75
105
  `)}
76
- }
77
- `
78
- ).join(`
79
- `) }) : null;
80
- };
81
- function y({
82
- marker: e,
83
- color: r,
84
- className: t
85
- }) {
86
- return /* @__PURE__ */ o(
87
- "div",
88
- {
89
- className: d(
90
- "shrink-0",
91
- e === "swatch" ? "h-2.5 w-2.5 rounded-sm" : "h-[3px] w-4 rounded-full",
92
- t
93
- ),
94
- style: e === "dashed" ? {
95
- // A dashed stroke can't be drawn with a background color, so the
96
- // dash pattern is painted as a gradient.
97
- backgroundImage: `repeating-linear-gradient(90deg, ${r} 0 4px, transparent 4px 7px)`
98
- } : { backgroundColor: r }
99
- }
100
- );
101
- }
102
- const K = j.Tooltip;
103
- function I({
106
+ }` }) : null;
107
+ }, K = j.Tooltip;
108
+ function P({
104
109
  item: e,
105
110
  index: r,
106
111
  payload: t,
107
112
  itemConfig: n,
108
- indicatorColor: s,
109
- hideIndicator: l,
110
- formatter: c
113
+ indicatorColor: o,
114
+ hideIndicator: i,
115
+ formatter: a
111
116
  }) {
112
- return /* @__PURE__ */ o("div", { className: "flex w-full flex-wrap items-center gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", children: c && (e == null ? void 0 : e.value) !== void 0 && e.name ? c(e.value, e.name, e, r, t) : /* @__PURE__ */ v(L, { children: [
113
- n != null && n.icon ? /* @__PURE__ */ o(n.icon, {}) : !l && // A row is always dotted, whatever marker the legend
117
+ return /* @__PURE__ */ s("div", { className: "flex w-full flex-wrap items-center gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", children: a && (e == null ? void 0 : e.value) !== void 0 && e.name ? a(e.value, e.name, e, r, t) : /* @__PURE__ */ p(L, { children: [
118
+ n != null && n.icon ? /* @__PURE__ */ s(n.icon, {}) : !i && // A row is always dotted, whatever marker the legend
114
119
  // gives that series.
115
- /* @__PURE__ */ o(
120
+ /* @__PURE__ */ s(
116
121
  "div",
117
122
  {
118
123
  className: "h-2.5 w-2.5 shrink-0 rounded-full",
119
- style: { backgroundColor: s }
124
+ style: { backgroundColor: o }
120
125
  }
121
126
  ),
122
- /* @__PURE__ */ v("div", { className: "flex flex-1 items-center justify-between gap-4 leading-none", children: [
123
- /* @__PURE__ */ o("span", { className: "text-muted-foreground", children: (n == null ? void 0 : n.label) || e.name }),
124
- e.value != null && /* @__PURE__ */ o("span", { className: "font-medium tabular-nums text-foreground", children: e.value.toLocaleString() })
127
+ /* @__PURE__ */ p("div", { className: "flex flex-1 items-center justify-between gap-4 leading-none", children: [
128
+ /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: (n == null ? void 0 : n.label) || e.name }),
129
+ e.value != null && /* @__PURE__ */ s("span", { className: "font-medium tabular-nums text-foreground", children: e.value.toLocaleString() })
125
130
  ] })
126
131
  ] }) });
127
132
  }
128
- function q({
133
+ function U({
129
134
  active: e,
130
135
  payload: r,
131
136
  label: t,
132
137
  className: n,
133
- hideLabel: s = !1,
134
- hideIndicator: l = !1,
135
- labelFormatter: c,
136
- formatter: i,
137
- labelClassName: u,
138
- color: h,
139
- nameKey: x,
140
- labelKey: b
138
+ hideLabel: o = !1,
139
+ hideIndicator: i = !1,
140
+ labelFormatter: a,
141
+ formatter: f,
142
+ labelClassName: h,
143
+ color: c,
144
+ nameKey: l,
145
+ labelKey: v
141
146
  }) {
142
- const { config: g } = P(), C = p.useMemo(() => {
143
- if (s || !(r != null && r.length))
147
+ const { config: u } = y(), _ = b.useMemo(() => {
148
+ if (o || !(r != null && r.length))
144
149
  return null;
145
- const [a] = r, _ = `${b || (a == null ? void 0 : a.dataKey) || (a == null ? void 0 : a.name) || "value"}`, f = m(g, a, _), k = (() => {
146
- var $;
147
- const w = !b && typeof t == "string" ? (($ = g[t]) == null ? void 0 : $.label) ?? t : f == null ? void 0 : f.label;
148
- return typeof w == "string" || typeof w == "number" ? w : void 0;
150
+ const [d] = r, k = `${v || (d == null ? void 0 : d.dataKey) || (d == null ? void 0 : d.name) || "value"}`, g = w(u, d, k), N = (() => {
151
+ var E;
152
+ const m = !v && typeof t == "string" ? ((E = u[t]) == null ? void 0 : E.label) ?? t : g == null ? void 0 : g.label;
153
+ return typeof m == "string" || typeof m == "number" ? m : void 0;
149
154
  })();
150
- return c ? /* @__PURE__ */ o("div", { className: d("font-medium", u), children: c(k, r) }) : k ? /* @__PURE__ */ o("div", { className: d("font-medium", u), children: k }) : null;
155
+ return a ? /* @__PURE__ */ s("div", { className: x("font-medium", h), children: a(N, r) }) : N ? /* @__PURE__ */ s("div", { className: x("font-medium", h), children: N }) : null;
151
156
  }, [
152
157
  t,
153
- c,
158
+ a,
154
159
  r,
155
- s,
160
+ o,
161
+ h,
156
162
  u,
157
- g,
158
- b
163
+ v
159
164
  ]);
160
- return !e || !(r != null && r.length) ? null : /* @__PURE__ */ v(
165
+ return !e || !(r != null && r.length) ? null : /* @__PURE__ */ p(
161
166
  "div",
162
167
  {
163
- className: d(
168
+ className: x(
164
169
  "grid min-w-[8rem] items-start gap-1.5 rounded-[var(--ui-tooltip-container-border-radius)] border border-border bg-background px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs text-foreground shadow-md",
165
170
  n
166
171
  ),
167
172
  children: [
168
- C,
169
- /* @__PURE__ */ o("div", { className: "grid gap-1.5", children: r.map((a, _) => {
170
- const f = `${x || a.name || a.dataKey || "value"}`;
171
- return /* @__PURE__ */ o(
172
- I,
173
+ _,
174
+ /* @__PURE__ */ s("div", { className: "grid gap-1.5", children: r.map((d, k) => {
175
+ const g = `${l || d.name || d.dataKey || "value"}`;
176
+ return /* @__PURE__ */ s(
177
+ P,
173
178
  {
174
- item: a,
175
- index: _,
179
+ item: d,
180
+ index: k,
176
181
  payload: r,
177
- itemConfig: m(g, a, f),
178
- indicatorColor: h || a.payload.fill || a.color,
179
- hideIndicator: l,
180
- formatter: i
182
+ itemConfig: w(u, d, g),
183
+ indicatorColor: c || d.payload.fill || d.color,
184
+ hideIndicator: i,
185
+ formatter: f
181
186
  },
182
- f
187
+ g
183
188
  );
184
189
  }) })
185
190
  ]
186
191
  }
187
192
  );
188
193
  }
189
- const z = j.Legend;
194
+ const V = j.Legend;
190
195
  function R({
196
+ item: e,
197
+ itemConfig: r,
198
+ valueKey: t,
199
+ valueFormatter: n
200
+ }) {
201
+ var a;
202
+ const o = t ? (a = e.payload) == null ? void 0 : a[t] : void 0, i = o != null ? n ? n(o) : String(o) : void 0;
203
+ return /* @__PURE__ */ p("div", { className: "flex w-full items-start gap-2 overflow-hidden", children: [
204
+ /* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
205
+ r != null && r.icon ? /* @__PURE__ */ s(r.icon, {}) : /* @__PURE__ */ s(
206
+ "div",
207
+ {
208
+ className: "h-2.5 w-2.5 shrink-0 rounded-full",
209
+ style: { backgroundColor: e.color }
210
+ }
211
+ ),
212
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate text-xs text-foreground", children: (r == null ? void 0 : r.label) ?? e.value })
213
+ ] }),
214
+ i != null && /* @__PURE__ */ s("span", { className: "shrink-0 text-xs font-semibold text-[var(--ui-text-on-surface-link-idle)]", children: i })
215
+ ] });
216
+ }
217
+ function I({
191
218
  item: e,
192
219
  itemConfig: r,
193
220
  hideIcon: t
194
221
  }) {
195
- var l;
196
- const n = (l = e.payload) == null ? void 0 : l.strokeDasharray, s = e.type !== "line" ? "swatch" : n ? "dashed" : "line";
197
- return /* @__PURE__ */ v(
222
+ return /* @__PURE__ */ p(
198
223
  "div",
199
224
  {
200
- className: d(
225
+ className: x(
201
226
  "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
202
227
  ),
203
228
  children: [
204
- r != null && r.icon && !t ? /* @__PURE__ */ o(r.icon, {}) : /* @__PURE__ */ o(y, { marker: s, color: e.color }),
229
+ r != null && r.icon && !t ? /* @__PURE__ */ s(r.icon, {}) : /* @__PURE__ */ s(
230
+ "div",
231
+ {
232
+ className: "h-2.5 w-2.5 shrink-0 rounded-full",
233
+ style: { backgroundColor: e.color }
234
+ }
235
+ ),
205
236
  (r == null ? void 0 : r.label) ?? e.value
206
237
  ]
207
238
  }
208
239
  );
209
240
  }
210
- function A({
241
+ function q({
211
242
  className: e,
212
243
  hideIcon: r = !1,
213
244
  payload: t,
214
245
  verticalAlign: n = "bottom",
215
- nameKey: s,
216
- config: l
246
+ nameKey: o,
247
+ config: i,
248
+ variant: a = "default",
249
+ valueKey: f,
250
+ valueFormatter: h
217
251
  }) {
218
- var u;
219
- const c = (u = p.useContext(N)) == null ? void 0 : u.config, i = l ?? c;
220
- if (!i)
252
+ var v;
253
+ const c = (v = b.useContext(T)) == null ? void 0 : v.config, l = i ?? c;
254
+ if (!l)
221
255
  throw new Error(
222
256
  "ChartLegendContent must be used within a <ChartContainer /> or given a `config` prop"
223
257
  );
224
- return t != null && t.length ? /* @__PURE__ */ o(
258
+ return t != null && t.length ? a === "list" ? /* @__PURE__ */ s("div", { className: x("flex flex-col", e), children: t.map((u) => {
259
+ const _ = `${o || u.dataKey || "value"}`;
260
+ return /* @__PURE__ */ s(
261
+ R,
262
+ {
263
+ item: u,
264
+ itemConfig: w(l, u, _),
265
+ valueKey: f,
266
+ valueFormatter: h
267
+ },
268
+ u.value
269
+ );
270
+ }) }) : /* @__PURE__ */ s(
225
271
  "div",
226
272
  {
227
- className: d(
273
+ className: x(
228
274
  // Wraps rather than overflowing: a legend with many entries (a treemap's
229
275
  // one-per-tile, a pie's one-per-slice) is wider than the chart on a narrow
230
276
  // surface, and a row that can't wrap paints past the chart's edge. The
231
277
  // column gap is unchanged, so a legend that already fits on one row keeps
232
278
  // its exact layout.
233
- "flex flex-wrap items-center justify-start gap-x-4 gap-y-2",
279
+ "flex flex-wrap items-center justify-center gap-x-6 gap-y-2",
234
280
  n === "top" ? "pb-3" : "pt-3",
235
281
  e
236
282
  ),
237
- children: t.map((h) => {
238
- const x = `${s || h.dataKey || "value"}`;
239
- return /* @__PURE__ */ o(
240
- R,
283
+ children: t.map((u) => {
284
+ const _ = `${o || u.dataKey || "value"}`;
285
+ return /* @__PURE__ */ s(
286
+ I,
241
287
  {
242
- item: h,
243
- itemConfig: m(i, h, x),
288
+ item: u,
289
+ itemConfig: w(l, u, _),
244
290
  hideIcon: r
245
291
  },
246
- h.value
292
+ u.value
247
293
  );
248
294
  })
249
295
  }
250
296
  ) : null;
251
297
  }
252
- function m(e, r, t) {
298
+ function w(e, r, t) {
253
299
  if (typeof r != "object" || r === null)
254
300
  return;
255
301
  const n = "payload" in r && typeof r.payload == "object" && r.payload !== null ? r.payload : void 0;
256
- let s = t;
257
- return t in r && typeof r[t] == "string" ? s = r[t] : n && t in n && typeof n[t] == "string" && (s = n[t]), s in e ? e[s] : e[t];
302
+ let o = t;
303
+ return t in r && typeof r[t] == "string" ? o = r[t] : n && t in n && typeof n[t] == "string" && (o = n[t]), o in e ? e[o] : e[t];
258
304
  }
259
305
  export {
260
- O as ChartContainer,
261
- z as ChartLegend,
262
- A as ChartLegendContent,
263
- T as ChartStyle,
306
+ H as ChartContainer,
307
+ V as ChartLegend,
308
+ q as ChartLegendContent,
309
+ O as ChartStyle,
264
310
  K as ChartTooltip,
265
- q as ChartTooltipContent
311
+ U as ChartTooltipContent,
312
+ S as resolveChartColors
266
313
  };
267
314
  //# sourceMappingURL=chart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart.js","sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\nimport type { LegendPayload } from 'recharts/types/component/DefaultLegendContent';\nimport {\n NameType,\n Payload,\n ValueType,\n} from 'recharts/types/component/DefaultTooltipContent';\nimport type { Props as LegendProps } from 'recharts/types/component/Legend';\nimport { TooltipContentProps } from 'recharts/types/component/Tooltip';\n\nimport { cn } from '@/lib/utils';\n\n// Format: { THEME_NAME: CSS_SELECTOR }. ui-react flips light/dark via the\n// `[data-theme]` attribute (the tokens resolve `light-dark()` through\n// `color-scheme`), not the legacy `.dark` class — so per-series `theme` colors\n// scope their dark value under `[data-theme='dark']`.\nconst THEMES = { light: '', dark: \"[data-theme='dark']\" } as const;\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n );\n};\n\ntype ChartContextProps = {\n config: ChartConfig;\n};\n\n/**\n * How a series is marked in the legend. A filled series reads as a square\n * swatch; a stroke-drawn one (line, area) as the line it paints — dashed when\n * the stroke is. The tooltip always dots its rows instead.\n */\ntype ChartSeriesMarker = 'swatch' | 'line' | 'dashed';\n\nexport type ChartTooltipContentProps = Partial<\n TooltipContentProps<ValueType, NameType>\n> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n nameKey?: string;\n labelKey?: string;\n labelFormatter?: (\n label: TooltipContentProps<number, string>['label'],\n payload: TooltipContentProps<number, string>['payload']\n ) => React.ReactNode;\n formatter?: (\n value: number | string,\n name: string,\n item: Payload<number | string, string>,\n index: number,\n payload: ReadonlyArray<Payload<number | string, string>>\n ) => React.ReactNode;\n labelClassName?: string;\n color?: string;\n};\n\nexport type ChartLegendContentProps = {\n className?: string;\n hideIcon?: boolean;\n verticalAlign?: LegendProps['verticalAlign'];\n payload?: LegendPayload[];\n nameKey?: string;\n /**\n * The series config the entries take their labels and icons from. Defaults to\n * the enclosing `ChartContainer`'s — pass it only to render the legend *outside*\n * the container, which a chart type has to do when the renderer can't lay a\n * legend out inside its plot (see `Treemap`).\n */\n config?: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport interface ChartContainerProps extends React.ComponentProps<'div'> {\n config: ChartConfig;\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >['children'];\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n ...props\n}: ChartContainerProps) {\n const uniqueId = React.useId();\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n id={id}\n data-slot=\"chart\"\n data-chart={chartId}\n // The `[stroke='#fff']` rules undo recharts' hardcoded white outlines —\n // on pie/radial sectors, line dots and funnel trapezoids. They don't\n // follow the theme, so in dark mode they read as a light hairline around\n // every segment.\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden [&_.recharts-trapezoid[stroke='#fff']]:stroke-transparent\",\n // A `<Brush>` traveller is the one `.recharts-layer` that is a real\n // control (`role=\"slider\"`, tabbable, arrow-key driven), so the blanket\n // `outline-hidden` above would leave it with no focus indicator. Restore\n // one — the `:focus-visible` pseudo-class outranks that rule, so this\n // wins regardless of the order Tailwind emits them in. An `outline`\n // rather than the usual `ring`: box-shadow doesn't paint on SVG children.\n '[&_.recharts-brush-traveller:focus-visible]:[outline:3px_solid_var(--ui-focus-primary)] [&_.recharts-brush-traveller:focus-visible]:[outline-offset:1px]',\n // recharts anchors its axis tick text with the *direction-relative*\n // SVG keywords (`text-anchor: start|end`, see `getTickTextAnchor` in\n // `CartesianAxis`), while placing every mark at a computed physical\n // coordinate. Inheriting `direction: rtl` therefore flips only the\n // text: an `end`-anchored Y tick mirrors about its anchor and lands\n // inside the plot (measured: +24px to +39px), rotated ticks shift\n // ~+15px, and a `ReferenceLine` label at the right edge overflows the\n // surface. Pinning the surface keeps the plot's own coordinate system\n // consistent with the geometry recharts computed for it. The chrome\n // that *should* mirror — tooltip and legend — is HTML outside\n // `.recharts-surface`, so it is unaffected.\n //\n // `Treemap` is the exception: its cell labels are HTML in a\n // `<foreignObject>` *inside* the surface, put there precisely so they\n // mirror with the page (see `treemap.tsx`). That is ordinary flow\n // layout, not a computed SVG coordinate, so the pin has to stop at the\n // `<foreignObject>` boundary and hand the page's direction back.\n '[&_.recharts-surface]:[direction:ltr] rtl:[&_.recharts-surface_foreignObject]:[direction:rtl]',\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme || config.color\n );\n\n if (!colorConfig.length) {\n return null;\n }\n\n // Rendered as a text child (not dangerouslySetInnerHTML): React sets it via\n // textContent, which the browser does not HTML-parse, so a `</style>` in a\n // config color can't break out of the tag.\n return (\n <style>\n {Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n ${prefix} [data-chart=${id}] {\n ${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||\n itemConfig.color;\n return color ? ` --color-${key}: ${color};` : null;\n })\n .join('\\n')}\n }\n `\n )\n .join('\\n')}\n </style>\n );\n};\n\n/** The marker drawn next to a series' name in the legend. */\nfunction SeriesMarker({\n marker,\n color,\n className,\n}: {\n marker: ChartSeriesMarker;\n color?: string;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n 'shrink-0',\n marker === 'swatch'\n ? 'h-2.5 w-2.5 rounded-sm'\n : 'h-[3px] w-4 rounded-full',\n className\n )}\n style={\n marker === 'dashed'\n ? {\n // A dashed stroke can't be drawn with a background color, so the\n // dash pattern is painted as a gradient.\n backgroundImage: `repeating-linear-gradient(90deg, ${color} 0 4px, transparent 4px 7px)`,\n }\n : { backgroundColor: color }\n }\n />\n );\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/** The `content` a caller passes to override the default tooltip (recharts' `Tooltip['content']`). */\nexport type ChartTooltipContentType = React.ComponentProps<\n typeof ChartTooltip\n>['content'];\n\n/**\n * What `getPayloadConfigFromPayload` resolves a payload item to — the lookup can\n * miss, so every consumer has to cope with `undefined`. Derived from the helper\n * rather than restated, so the two can't drift.\n */\ntype ChartItemConfig = ReturnType<typeof getPayloadConfigFromPayload>;\n\n/** One row of the tooltip's payload, after the `active`/empty guard. */\ntype ChartTooltipItem = NonNullable<\n ChartTooltipContentProps['payload']\n>[number];\n\n/**\n * One tooltip row. Its own three-way branching (caller formatter, config icon,\n * default dot) is what drove the nesting in `ChartTooltipContent`; as a\n * component the map body reads as a single element.\n */\nfunction ChartTooltipRow({\n item,\n index,\n payload,\n itemConfig,\n indicatorColor,\n hideIndicator,\n formatter,\n}: {\n item: ChartTooltipItem;\n index: number;\n payload: NonNullable<ChartTooltipContentProps['payload']>;\n itemConfig: ChartItemConfig;\n indicatorColor?: string;\n hideIndicator: boolean;\n formatter: ChartTooltipContentProps['formatter'];\n}) {\n return (\n <div className=\"flex w-full flex-wrap items-center gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\">\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n // A row is always dotted, whatever marker the legend\n // gives that series.\n <div\n className=\"h-2.5 w-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: indicatorColor }}\n />\n )\n )}\n {/*\n * `gap-4` puts a floor under the name/value separation.\n * `justify-between` alone only separates them while the\n * container has free space to distribute — which the tooltip's\n * `min-w-[8rem]` guarantees for a short value and not for a\n * long one (a currency `tickFormatter`, a `labelFormatter`\n * with units, a value plus its share), where the two would\n * otherwise butt up against each other. A minimum, so a row\n * with slack renders as before.\n */}\n <div className=\"flex flex-1 items-center justify-between gap-4 leading-none\">\n <span className=\"text-muted-foreground\">\n {itemConfig?.label || item.name}\n </span>\n {item.value != null && (\n <span className=\"font-medium tabular-nums text-foreground\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n}\n\nfunction ChartTooltipContent({\n active,\n payload,\n label,\n className,\n hideLabel = false,\n hideIndicator = false,\n labelFormatter,\n formatter,\n labelClassName,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = (() => {\n const v =\n !labelKey && typeof label === 'string'\n ? (config[label as keyof typeof config]?.label ?? label)\n : itemConfig?.label;\n\n return typeof v === 'string' || typeof v === 'number' ? v : undefined;\n })();\n\n if (labelFormatter) {\n return (\n <div className={cn('font-medium', labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n );\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cn(\n 'grid min-w-[8rem] items-start gap-1.5 rounded-[var(--ui-tooltip-container-border-radius)] border border-border bg-background px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs text-foreground shadow-md',\n className\n )}\n >\n {tooltipLabel}\n <div className=\"grid gap-1.5\">\n {payload.map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n\n return (\n <ChartTooltipRow\n key={key}\n item={item}\n index={index}\n payload={payload}\n itemConfig={getPayloadConfigFromPayload(config, item, key)}\n indicatorColor={color || item.payload.fill || item.color}\n hideIndicator={hideIndicator}\n formatter={formatter}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/**\n * One legend entry. Split out so the marker it has to derive from the payload\n * sits next to the markup that uses it, instead of above a nested map body.\n */\nfunction ChartLegendEntry({\n item,\n itemConfig,\n hideIcon,\n}: {\n item: LegendPayload;\n itemConfig: ChartItemConfig;\n hideIcon: boolean;\n}) {\n // recharts types stroke-drawn series (<Line>, <Area>) as `line`; a chart\n // that wants a swatch instead sets the series' `legendType=\"rect\"`.\n const dashArray = (\n item.payload as { strokeDasharray?: string | number } | undefined\n )?.strokeDasharray;\n const marker: ChartSeriesMarker =\n item.type !== 'line' ? 'swatch' : dashArray ? 'dashed' : 'line';\n\n return (\n <div\n className={cn(\n 'flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground'\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <SeriesMarker marker={marker} color={item.color} />\n )}\n {/*\n * Falls back to the series key, the way the tooltip row and the\n * treemap's on-cell label both do. `label` is optional on a\n * `ChartConfig` entry, and `getPayloadConfigFromPayload` can miss\n * entirely, so without this an entry renders as a marker with no\n * text — worst on the charts whose legend is the only place a series\n * is named.\n */}\n {itemConfig?.label ?? item.value}\n </div>\n );\n}\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n config: configFromProps,\n}: ChartLegendContentProps) {\n // The context read directly rather than through `useChart()`: a caller that\n // passes its own `config` is rendering the legend outside the container, where\n // the context is absent by design rather than by mistake. Every other caller\n // still gets `useChart()`'s error — the legend has no way to label itself\n // without a config, and failing loudly beats rendering an empty row.\n const contextConfig = React.useContext(ChartContext)?.config;\n const config = configFromProps ?? contextConfig;\n\n if (!config) {\n throw new Error(\n 'ChartLegendContent must be used within a <ChartContainer /> or given a `config` prop'\n );\n }\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cn(\n // Wraps rather than overflowing: a legend with many entries (a treemap's\n // one-per-tile, a pie's one-per-slice) is wider than the chart on a narrow\n // surface, and a row that can't wrap paints past the chart's edge. The\n // column gap is unchanged, so a legend that already fits on one row keeps\n // its exact layout.\n 'flex flex-wrap items-center justify-start gap-x-4 gap-y-2',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n className\n )}\n >\n {payload.map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n\n return (\n <ChartLegendEntry\n key={item.value}\n item={item}\n itemConfig={getPayloadConfigFromPayload(config, item, key)}\n hideIcon={hideIcon}\n />\n );\n })}\n </div>\n );\n}\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload &&\n typeof payload.payload === 'object' &&\n payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === 'string'\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string;\n }\n\n return configLabelKey in config\n ? config[configLabelKey]\n : config[key as keyof typeof config];\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n};\n"],"names":["THEMES","ChartContext","React","useChart","context","ChartContainer","id","className","children","config","props","uniqueId","chartId","jsxs","cn","jsx","ChartStyle","RechartsPrimitive","colorConfig","theme","prefix","key","itemConfig","color","_a","SeriesMarker","marker","ChartTooltip","ChartTooltipRow","item","index","payload","indicatorColor","hideIndicator","formatter","Fragment","ChartTooltipContent","active","label","hideLabel","labelFormatter","labelClassName","nameKey","labelKey","tooltipLabel","getPayloadConfigFromPayload","value","v","ChartLegend","ChartLegendEntry","hideIcon","dashArray","ChartLegendContent","verticalAlign","configFromProps","contextConfig","payloadPayload","configLabelKey"],"mappings":";;;;AAmBA,MAAMA,IAAS,EAAE,OAAO,IAAI,MAAM,sBAAA,GA6D5BC,IAAeC,EAAM,cAAwC,IAAI;AAEvE,SAASC,IAAW;AAClB,QAAMC,IAAUF,EAAM,WAAWD,CAAY;AAE7C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,mDAAmD;AAGrE,SAAOA;AACT;AASA,SAASC,EAAe;AAAA,EACtB,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GAAwB;AACtB,QAAMC,IAAWT,EAAM,MAAA,GACjBU,IAAU,SAASN,KAAMK,EAAS,QAAQ,MAAM,EAAE,CAAC;AAEzD,2BACGV,EAAa,UAAb,EAAsB,OAAO,EAAE,QAAAQ,KAC9B,UAAA,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAP;AAAA,MACA,aAAU;AAAA,MACV,cAAYM;AAAA,MAKZ,WAAWE;AAAA,QACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAkBA;AAAA,QACAP;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAK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AAAA;AAAA;AAAA;AAAA,QAMT;AAAA,QACAuC,MAAkB,QAAQ,SAAS;AAAA,QACnC9C;AAAA,MAAA;AAAA,MAGD,UAAAwB,EAAQ,IAAI,CAACF,MAAS;AACrB,cAAMR,IAAM,GAAGqB,KAAWb,EAAK,WAAW,OAAO;AAEjD,eACE,gBAAAd;AAAA,UAACkC;AAAA,UAAA;AAAA,YAEC,MAAApB;AAAA,YACA,YAAYgB,EAA4BpC,GAAQoB,GAAMR,CAAG;AAAA,YACzD,UAAA6B;AAAA,UAAA;AAAA,UAHKrB,EAAK;AAAA,QAAA;AAAA,MAMhB,CAAC;AAAA,IAAA;AAAA,EAAA,IA3BI;AA8BX;AAGA,SAASgB,EACPpC,GACAsB,GACAV,GACA;AACA,MAAI,OAAOU,KAAY,YAAYA,MAAY;AAC7C;AAGF,QAAMyB,IACJ,aAAazB,KACb,OAAOA,EAAQ,WAAY,YAC3BA,EAAQ,YAAY,OAChBA,EAAQ,UACR;AAEN,MAAI0B,IAAyBpC;AAE7B,SACEA,KAAOU,KACP,OAAOA,EAAQV,CAA2B,KAAM,WAEhDoC,IAAiB1B,EAAQV,CAA2B,IAEpDmC,KACAnC,KAAOmC,KACP,OAAOA,EAAenC,CAAkC,KAAM,aAE9DoC,IAAiBD,EACfnC,CACF,IAGKoC,KAAkBhD,IACrBA,EAAOgD,CAAc,IACrBhD,EAAOY,CAA0B;AACvC;"}
1
+ {"version":3,"file":"chart.js","sources":["../../../../src/components/ui/chart/chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as RechartsPrimitive from 'recharts';\nimport type { LegendPayload } from 'recharts/types/component/DefaultLegendContent';\nimport {\n NameType,\n Payload,\n ValueType,\n} from 'recharts/types/component/DefaultTooltipContent';\nimport type { Props as LegendProps } from 'recharts/types/component/Legend';\nimport { TooltipContentProps } from 'recharts/types/component/Tooltip';\n\nimport { cn } from '@/lib/utils';\nimport {\n CHART_DEFAULT_PALETTE,\n CHART_STATUS_TOKENS,\n resolveSeriesColor,\n type ChartPalette,\n type ChartSeriesTone,\n} from './chart-palette';\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode;\n icon?: React.ComponentType;\n /**\n * Which stop of the container's `palette` this series paints with. Left\n * unset, it is assigned from the series' position. See `ChartSeriesTone`.\n *\n * There is deliberately no free-form `color` here: every series colour\n * comes from the chart's palette, so a chart cannot paint a hue the design\n * system does not define. Pick a different palette on `ChartContainer`, or\n * a different stop of it with this.\n */\n tone?: ChartSeriesTone;\n };\n};\n\n/**\n * A `ChartConfig` with every series' palette colour filled in. This is what the\n * container puts on the context, so the plot, the tooltip rows and the legend\n * markers all read the same resolved colour.\n */\nexport type ResolvedChartConfig = {\n [k in string]: ChartConfig[string] & { color: string };\n};\n\n/**\n * Resolve each series' colour out of `palette` — in the palette's defined\n * order, honouring any `tone` a series named.\n *\n * Exported for tests and for the widget editor, which needs the same resolved\n * map to detect duplicate colours (`findDuplicateTones`) without re-deriving it.\n */\nexport function resolveChartColors(\n config: ChartConfig,\n palette: ChartPalette\n): ResolvedChartConfig {\n const entries = Object.entries(config);\n\n // An aliased series (`tone: { sameAs }`) doesn't take a stop of its own — it\n // is the same metric drawn a second way, so it must not consume a colour or\n // shift the series after it along the palette.\n const isAlias = (item: ChartConfig[string]) => Boolean(item.tone?.sameAs);\n let index = 0;\n const resolved: Record<string, ChartConfig[string] & { color: string }> = {};\n\n for (const [key, item] of entries) {\n if (isAlias(item)) {\n continue;\n }\n resolved[key] = {\n ...item,\n color: resolveSeriesColor(palette, { index: index++, tone: item.tone }),\n };\n }\n\n // An alias may point at another alias, in any order, so a single pass over\n // the aliases can miss a chain that is fully resolvable. Keep sweeping the\n // pending set until nothing more resolves; what is left is a cycle or a\n // target that isn't in this config at all.\n const pending = new Map<string, string>();\n for (const [key, item] of entries) {\n if (isAlias(item)) {\n pending.set(key, item.tone!.sameAs as string);\n }\n }\n\n let changed = true;\n while (changed && pending.size > 0) {\n changed = false;\n for (const [key, target] of pending) {\n const targetColor = resolved[target]?.color;\n if (targetColor !== undefined) {\n resolved[key] = { ...config[key], color: targetColor };\n pending.delete(key);\n changed = true;\n }\n }\n }\n\n for (const [key, target] of pending) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `[ui-react] Chart series \"${key}\" aliases \"${target}\", which is not a palette-assigned series in this config. Falling back to neutral.`\n );\n }\n resolved[key] = { ...config[key], color: CHART_STATUS_TOKENS.neutral };\n }\n\n // Rebuilt in the config's own order: the passes above visit non-aliases\n // first, and callers (legend order, `Object.entries` consumers) rely on the\n // order they wrote.\n return Object.fromEntries(entries.map(([key]) => [key, resolved[key]]));\n}\n\ntype ChartContextProps = {\n config: ResolvedChartConfig;\n};\n\nexport type ChartTooltipContentProps = Partial<\n TooltipContentProps<ValueType, NameType>\n> & {\n className?: string;\n hideLabel?: boolean;\n hideIndicator?: boolean;\n nameKey?: string;\n labelKey?: string;\n labelFormatter?: (\n label: TooltipContentProps<number, string>['label'],\n payload: TooltipContentProps<number, string>['payload']\n ) => React.ReactNode;\n formatter?: (\n value: number | string,\n name: string,\n item: Payload<number | string, string>,\n index: number,\n payload: ReadonlyArray<Payload<number | string, string>>\n ) => React.ReactNode;\n labelClassName?: string;\n color?: string;\n};\n\nexport type ChartLegendContentProps = {\n className?: string;\n hideIcon?: boolean;\n verticalAlign?: LegendProps['verticalAlign'];\n payload?: LegendPayload[];\n nameKey?: string;\n /**\n * The series config the entries take their labels and icons from. Defaults to\n * the enclosing `ChartContainer`'s — pass it only to render the legend *outside*\n * the container, which a chart type has to do when the renderer can't lay a\n * legend out inside its plot (see `Treemap`).\n */\n config?: ChartConfig;\n /**\n * `default` — the current horizontal wrap layout (one row of chips).\n * `list` — a vertical list where each entry is `[dot] [label flex-1] [value]`,\n * matching the Figma donut/radial widget legend. Use alongside a manually-built\n * `payload` passed from outside the chart's recharts composition.\n */\n variant?: 'default' | 'list';\n /**\n * When `variant=\"list\"`, the field on `payload[i].payload` to display as the\n * right-hand value. Typically the chart's `dataKey` (the numeric series field).\n */\n valueKey?: string;\n /**\n * Format the value shown in each list entry. When omitted the raw value is\n * stringified with `String()`.\n */\n valueFormatter?: (value: string | number) => string;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n const context = React.useContext(ChartContext);\n\n if (!context) {\n throw new Error('useChart must be used within a <ChartContainer />');\n }\n\n return context;\n}\n\nexport interface ChartContainerProps extends React.ComponentProps<'div'> {\n /**\n * The series this chart draws, keyed by data field.\n *\n * Declare exactly what the chart plots. A stop is assigned by an entry's\n * position here, not by which series end up rendered, so an entry for a\n * series the chart doesn't draw still consumes a colour and shifts the ones\n * that follow it. (That is deliberate: a series then keeps its colour when a\n * sibling is toggled off, instead of the whole chart recolouring.)\n */\n config: ChartConfig;\n /**\n * The dataviz palette this chart's series are painted from. Series take a\n * stop of it in the palette's defined order, or the one their `tone` names.\n * Defaults to `categorical` — there is no \"no palette\" state.\n */\n palette?: ChartPalette;\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >['children'];\n}\n\nfunction ChartContainer({\n id,\n className,\n children,\n config,\n palette = CHART_DEFAULT_PALETTE,\n ...props\n}: ChartContainerProps) {\n const uniqueId = React.useId();\n const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;\n // Resolved once and shared with the context, so the tooltip rows and legend\n // markers read the same colors the plot paints with.\n const resolvedConfig = React.useMemo(\n () => resolveChartColors(config, palette),\n [config, palette]\n );\n\n return (\n <ChartContext.Provider value={{ config: resolvedConfig }}>\n <div\n id={id}\n data-slot=\"chart\"\n data-chart={chartId}\n // The `[stroke='#fff']` rules undo recharts' hardcoded white outlines —\n // on pie/radial sectors, line dots and funnel trapezoids. They don't\n // follow the theme, so in dark mode they read as a light hairline around\n // every segment.\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden [&_.recharts-trapezoid[stroke='#fff']]:stroke-transparent\",\n // A `<Brush>` traveller is the one `.recharts-layer` that is a real\n // control (`role=\"slider\"`, tabbable, arrow-key driven), so the blanket\n // `outline-hidden` above would leave it with no focus indicator. Restore\n // one — the `:focus-visible` pseudo-class outranks that rule, so this\n // wins regardless of the order Tailwind emits them in. An `outline`\n // rather than the usual `ring`: box-shadow doesn't paint on SVG children.\n '[&_.recharts-brush-traveller:focus-visible]:[outline:3px_solid_var(--ui-focus-primary)] [&_.recharts-brush-traveller:focus-visible]:[outline-offset:1px]',\n // recharts anchors its axis tick text with the *direction-relative*\n // SVG keywords (`text-anchor: start|end`, see `getTickTextAnchor` in\n // `CartesianAxis`), while placing every mark at a computed physical\n // coordinate. Inheriting `direction: rtl` therefore flips only the\n // text: an `end`-anchored Y tick mirrors about its anchor and lands\n // inside the plot (measured: +24px to +39px), rotated ticks shift\n // ~+15px, and a `ReferenceLine` label at the right edge overflows the\n // surface. Pinning the surface keeps the plot's own coordinate system\n // consistent with the geometry recharts computed for it. The chrome\n // that *should* mirror — tooltip and legend — is HTML outside\n // `.recharts-surface`, so it is unaffected.\n //\n // `Treemap` is the exception: its cell labels are HTML in a\n // `<foreignObject>` *inside* the surface, put there precisely so they\n // mirror with the page (see `treemap.tsx`). That is ordinary flow\n // layout, not a computed SVG coordinate, so the pin has to stop at the\n // `<foreignObject>` boundary and hand the page's direction back.\n '[&_.recharts-surface]:[direction:ltr] rtl:[&_.recharts-surface_foreignObject]:[direction:rtl]',\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={resolvedConfig} />\n <RechartsPrimitive.ResponsiveContainer>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n}\n\nconst ChartStyle = ({\n id,\n config,\n}: {\n id: string;\n config: ResolvedChartConfig;\n}) => {\n const entries = Object.entries(config);\n\n if (!entries.length) {\n return null;\n }\n\n // One block, no light/dark split: every colour is now a `--ui-dataviz-*`\n // token, and those are `light-dark()` pairs that follow `color-scheme`\n // themselves. The old per-theme `[data-theme='dark']` duplication existed\n // only for hand-written `theme: { light, dark }` config entries, which the\n // palette replaced.\n //\n // Rendered as a text child (not dangerouslySetInnerHTML): React sets it via\n // textContent, which the browser does not HTML-parse, so a `</style>` in a\n // colour can't break out of the tag.\n return (\n <style>\n {`[data-chart=${id}] {\\n${entries\n .map(([key, itemConfig]) => ` --color-${key}: ${itemConfig.color};`)\n .join('\\n')}\\n}`}\n </style>\n );\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/** The `content` a caller passes to override the default tooltip (recharts' `Tooltip['content']`). */\nexport type ChartTooltipContentType = React.ComponentProps<\n typeof ChartTooltip\n>['content'];\n\n/**\n * What `getPayloadConfigFromPayload` resolves a payload item to — the lookup can\n * miss, so every consumer has to cope with `undefined`. Derived from the helper\n * rather than restated, so the two can't drift.\n */\ntype ChartItemConfig = ReturnType<typeof getPayloadConfigFromPayload>;\n\n/** One row of the tooltip's payload, after the `active`/empty guard. */\ntype ChartTooltipItem = NonNullable<\n ChartTooltipContentProps['payload']\n>[number];\n\n/**\n * One tooltip row. Its own three-way branching (caller formatter, config icon,\n * default dot) is what drove the nesting in `ChartTooltipContent`; as a\n * component the map body reads as a single element.\n */\nfunction ChartTooltipRow({\n item,\n index,\n payload,\n itemConfig,\n indicatorColor,\n hideIndicator,\n formatter,\n}: {\n item: ChartTooltipItem;\n index: number;\n payload: NonNullable<ChartTooltipContentProps['payload']>;\n itemConfig: ChartItemConfig;\n indicatorColor?: string;\n hideIndicator: boolean;\n formatter: ChartTooltipContentProps['formatter'];\n}) {\n return (\n <div className=\"flex w-full flex-wrap items-center gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\">\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n // A row is always dotted, whatever marker the legend\n // gives that series.\n <div\n className=\"h-2.5 w-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: indicatorColor }}\n />\n )\n )}\n {/*\n * `gap-4` puts a floor under the name/value separation.\n * `justify-between` alone only separates them while the\n * container has free space to distribute — which the tooltip's\n * `min-w-[8rem]` guarantees for a short value and not for a\n * long one (a currency `tickFormatter`, a `labelFormatter`\n * with units, a value plus its share), where the two would\n * otherwise butt up against each other. A minimum, so a row\n * with slack renders as before.\n */}\n <div className=\"flex flex-1 items-center justify-between gap-4 leading-none\">\n <span className=\"text-muted-foreground\">\n {itemConfig?.label || item.name}\n </span>\n {item.value != null && (\n <span className=\"font-medium tabular-nums text-foreground\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n );\n}\n\nfunction ChartTooltipContent({\n active,\n payload,\n label,\n className,\n hideLabel = false,\n hideIndicator = false,\n labelFormatter,\n formatter,\n labelClassName,\n color,\n nameKey,\n labelKey,\n}: ChartTooltipContentProps) {\n const { config } = useChart();\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = (() => {\n const v =\n !labelKey && typeof label === 'string'\n ? (config[label as keyof typeof config]?.label ?? label)\n : itemConfig?.label;\n\n return typeof v === 'string' || typeof v === 'number' ? v : undefined;\n })();\n\n if (labelFormatter) {\n return (\n <div className={cn('font-medium', labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n );\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn('font-medium', labelClassName)}>{value}</div>;\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n return (\n <div\n className={cn(\n 'grid min-w-[8rem] items-start gap-1.5 rounded-[var(--ui-tooltip-container-border-radius)] border border-border bg-background px-[var(--ui-tooltip-container-padding-x)] py-[var(--ui-tooltip-container-padding-y)] text-xs text-foreground shadow-md',\n className\n )}\n >\n {tooltipLabel}\n <div className=\"grid gap-1.5\">\n {payload.map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || 'value'}`;\n\n return (\n <ChartTooltipRow\n key={key}\n item={item}\n index={index}\n payload={payload}\n itemConfig={getPayloadConfigFromPayload(config, item, key)}\n indicatorColor={color || item.payload.fill || item.color}\n hideIndicator={hideIndicator}\n formatter={formatter}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/**\n * One entry in the `variant=\"list\"` legend: `[dot] [label flex-1] [value]`.\n *\n * The dot is always a circle, regardless of the series' recharts type — the\n * list layout is only used for polar charts (donut, radial) where the fill\n * marker matches the slice/arc color.\n */\nfunction ChartLegendListEntry({\n item,\n itemConfig,\n valueKey,\n valueFormatter,\n}: {\n item: LegendPayload;\n itemConfig: ChartItemConfig;\n valueKey?: string;\n valueFormatter?: (value: string | number) => string;\n}) {\n const raw = valueKey\n ? (item.payload as Record<string, unknown> | undefined)?.[valueKey]\n : undefined;\n const displayValue =\n raw != null\n ? valueFormatter\n ? valueFormatter(raw as string | number)\n : String(raw)\n : undefined;\n\n return (\n <div className=\"flex w-full items-start gap-2 overflow-hidden\">\n <div className=\"flex min-w-0 flex-1 items-center gap-2\">\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2.5 w-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: item.color }}\n />\n )}\n <span className=\"min-w-0 flex-1 truncate text-xs text-foreground\">\n {itemConfig?.label ?? item.value}\n </span>\n </div>\n {displayValue != null && (\n <span className=\"shrink-0 text-xs font-semibold text-[var(--ui-text-on-surface-link-idle)]\">\n {displayValue}\n </span>\n )}\n </div>\n );\n}\n\n/**\n * One legend entry. Split out so the marker it has to derive from the payload\n * sits next to the markup that uses it, instead of above a nested map body.\n */\nfunction ChartLegendEntry({\n item,\n itemConfig,\n hideIcon,\n}: {\n item: LegendPayload;\n itemConfig: ChartItemConfig;\n hideIcon: boolean;\n}) {\n return (\n <div\n className={cn(\n 'flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground'\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2.5 w-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: item.color }}\n />\n )}\n {/*\n * Falls back to the series key, the way the tooltip row and the\n * treemap's on-cell label both do. `label` is optional on a\n * `ChartConfig` entry, and `getPayloadConfigFromPayload` can miss\n * entirely, so without this an entry renders as a marker with no\n * text — worst on the charts whose legend is the only place a series\n * is named.\n */}\n {itemConfig?.label ?? item.value}\n </div>\n );\n}\n\nfunction ChartLegendContent({\n className,\n hideIcon = false,\n payload,\n verticalAlign = 'bottom',\n nameKey,\n config: configFromProps,\n variant = 'default',\n valueKey,\n valueFormatter,\n}: ChartLegendContentProps) {\n // The context read directly rather than through `useChart()`: a caller that\n // passes its own `config` is rendering the legend outside the container, where\n // the context is absent by design rather than by mistake. Every other caller\n // still gets `useChart()`'s error — the legend has no way to label itself\n // without a config, and failing loudly beats rendering an empty row.\n const contextConfig = React.useContext(ChartContext)?.config;\n const config = configFromProps ?? contextConfig;\n\n if (!config) {\n throw new Error(\n 'ChartLegendContent must be used within a <ChartContainer /> or given a `config` prop'\n );\n }\n\n if (!payload?.length) {\n return null;\n }\n\n if (variant === 'list') {\n return (\n <div className={cn('flex flex-col', className)}>\n {payload.map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n return (\n <ChartLegendListEntry\n key={item.value}\n item={item}\n itemConfig={getPayloadConfigFromPayload(config, item, key)}\n valueKey={valueKey}\n valueFormatter={valueFormatter}\n />\n );\n })}\n </div>\n );\n }\n\n return (\n <div\n className={cn(\n // Wraps rather than overflowing: a legend with many entries (a treemap's\n // one-per-tile, a pie's one-per-slice) is wider than the chart on a narrow\n // surface, and a row that can't wrap paints past the chart's edge. The\n // column gap is unchanged, so a legend that already fits on one row keeps\n // its exact layout.\n 'flex flex-wrap items-center justify-center gap-x-6 gap-y-2',\n verticalAlign === 'top' ? 'pb-3' : 'pt-3',\n className\n )}\n >\n {payload.map((item) => {\n const key = `${nameKey || item.dataKey || 'value'}`;\n\n return (\n <ChartLegendEntry\n key={item.value}\n item={item}\n itemConfig={getPayloadConfigFromPayload(config, item, key)}\n hideIcon={hideIcon}\n />\n );\n })}\n </div>\n );\n}\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== 'object' || payload === null) {\n return undefined;\n }\n\n const payloadPayload =\n 'payload' in payload &&\n typeof payload.payload === 'object' &&\n payload.payload !== null\n ? payload.payload\n : undefined;\n\n let configLabelKey: string = key;\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === 'string'\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string;\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string;\n }\n\n return configLabelKey in config\n ? config[configLabelKey]\n : config[key as keyof typeof config];\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n};\n"],"names":["resolveChartColors","config","palette","entries","isAlias","item","_a","index","resolved","key","resolveSeriesColor","pending","changed","target","targetColor","CHART_STATUS_TOKENS","ChartContext","React","useChart","context","ChartContainer","id","className","children","CHART_DEFAULT_PALETTE","props","uniqueId","chartId","resolvedConfig","jsx","jsxs","cn","ChartStyle","RechartsPrimitive","itemConfig","ChartTooltip","ChartTooltipRow","payload","indicatorColor","hideIndicator","formatter","Fragment","ChartTooltipContent","active","label","hideLabel","labelFormatter","labelClassName","color","nameKey","labelKey","tooltipLabel","getPayloadConfigFromPayload","value","v","ChartLegend","ChartLegendListEntry","valueKey","valueFormatter","raw","displayValue","ChartLegendEntry","hideIcon","ChartLegendContent","verticalAlign","configFromProps","variant","contextConfig","payloadPayload","configLabelKey"],"mappings":";;;;;AAuDO,SAASA,EACdC,GACAC,GACqB;;AACrB,QAAMC,IAAU,OAAO,QAAQF,CAAM,GAK/BG,IAAU,CAACC,MAAA;;AAA8B,eAAQC,IAAAD,EAAK,SAAL,QAAAC,EAAW;AAAA;AAClE,MAAIC,IAAQ;AACZ,QAAMC,IAAoE,CAAA;AAE1E,aAAW,CAACC,GAAKJ,CAAI,KAAKF;AACxB,IAAIC,EAAQC,CAAI,MAGhBG,EAASC,CAAG,IAAI;AAAA,MACd,GAAGJ;AAAA,MACH,OAAOK,EAAmBR,GAAS,EAAE,OAAOK,KAAS,MAAMF,EAAK,KAAA,CAAM;AAAA,IAAA;AAQ1E,QAAMM,wBAAc,IAAA;AACpB,aAAW,CAACF,GAAKJ,CAAI,KAAKF;AACxB,IAAIC,EAAQC,CAAI,KACdM,EAAQ,IAAIF,GAAKJ,EAAK,KAAM,MAAgB;AAIhD,MAAIO,IAAU;AACd,SAAOA,KAAWD,EAAQ,OAAO,KAAG;AAClC,IAAAC,IAAU;AACV,eAAW,CAACH,GAAKI,CAAM,KAAKF,GAAS;AACnC,YAAMG,KAAcR,IAAAE,EAASK,CAAM,MAAf,gBAAAP,EAAkB;AACtC,MAAIQ,MAAgB,WAClBN,EAASC,CAAG,IAAI,EAAE,GAAGR,EAAOQ,C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