@acronis-platform/ui-react 4.1.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +191 -85
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  3. package/dist/components/ui/bar-chart/bar-chart.js +288 -225
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js +85 -0
  6. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js.map +1 -0
  7. package/dist/components/ui/card-widget-carousel/card-widget.js +82 -0
  8. package/dist/components/ui/card-widget-carousel/card-widget.js.map +1 -0
  9. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  10. package/dist/components/ui/chart/chart-format.js +25 -22
  11. package/dist/components/ui/chart/chart-format.js.map +1 -1
  12. package/dist/components/ui/chart/chart-palette.js +9 -8
  13. package/dist/components/ui/chart/chart-palette.js.map +1 -1
  14. package/dist/components/ui/chart/chart.js +127 -89
  15. package/dist/components/ui/chart/chart.js.map +1 -1
  16. package/dist/components/ui/funnel-chart/funnel-chart.js +189 -113
  17. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  18. package/dist/components/ui/input-select/input-select.js +18 -9
  19. package/dist/components/ui/input-select/input-select.js.map +1 -1
  20. package/dist/components/ui/line-chart/line-chart.js +194 -86
  21. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  22. package/dist/components/ui/radar-chart/radar-chart.js +76 -66
  23. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  24. package/dist/components/ui/scatter-chart/scatter-chart.js +5 -2
  25. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  26. package/dist/components/ui/separator/separator.js +52 -10
  27. package/dist/components/ui/separator/separator.js.map +1 -1
  28. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js +144 -121
  29. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  30. package/dist/components/ui/tree-item/tree-item.js +67 -0
  31. package/dist/components/ui/tree-item/tree-item.js.map +1 -0
  32. package/dist/components/ui/treemap/treemap.js +73 -66
  33. package/dist/components/ui/treemap/treemap.js.map +1 -1
  34. package/dist/index.js +109 -107
  35. package/dist/llms/area-chart.md +2 -1
  36. package/dist/llms/bar-chart.md +132 -33
  37. package/dist/llms/card-widget-carousel.md +252 -0
  38. package/dist/llms/category-bar.md +2 -2
  39. package/dist/llms/funnel-chart.md +269 -101
  40. package/dist/llms/input-select.md +175 -1
  41. package/dist/llms/line-chart.md +2 -1
  42. package/dist/llms/metric.md +10 -5
  43. package/dist/llms/radar-chart.md +15 -5
  44. package/dist/llms/scatter-chart.md +2 -1
  45. package/dist/llms/separator.md +27 -8
  46. package/dist/llms/sidebar-secondary.md +235 -4
  47. package/dist/llms/tree-item.md +359 -0
  48. package/dist/llms/treemap.md +47 -36
  49. package/dist/llms.txt +5 -4
  50. package/dist/react.js +109 -107
  51. package/dist/src/components/ui/area-chart/area-chart.d.ts +10 -0
  52. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +75 -10
  53. package/dist/src/components/ui/bar-chart/bar-chart.docs.d.ts +146 -0
  54. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  55. package/dist/src/components/ui/card-widget-carousel/card-widget-carousel.d.ts +9 -0
  56. package/dist/src/components/ui/card-widget-carousel/card-widget.d.ts +43 -0
  57. package/dist/src/components/ui/card-widget-carousel/index.d.ts +2 -0
  58. package/dist/src/components/ui/chart/chart-format.d.ts +9 -1
  59. package/dist/src/components/ui/chart/chart-palette.d.ts +38 -10
  60. package/dist/src/components/ui/chart/chart.d.ts +8 -1
  61. package/dist/src/components/ui/chart/index.d.ts +2 -2
  62. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +92 -26
  63. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
  64. package/dist/src/components/ui/input-select/input-select.d.ts +34 -2
  65. package/dist/src/components/ui/line-chart/line-chart.d.ts +11 -1
  66. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +42 -9
  67. package/dist/src/components/ui/separator/separator.d.ts +9 -1
  68. package/dist/src/components/ui/sidebar-secondary/sidebar-secondary.d.ts +23 -3
  69. package/dist/src/components/ui/tree-item/index.d.ts +1 -0
  70. package/dist/src/components/ui/tree-item/tree-item.d.ts +64 -0
  71. package/dist/src/components/ui/treemap/treemap.d.ts +16 -5
  72. package/dist/src/index.d.ts +2 -1
  73. package/dist/ui-react.css +1 -1
  74. package/package.json +1 -1
  75. package/dist/components/ui/meter/meter.js +0 -79
  76. package/dist/components/ui/meter/meter.js.map +0 -1
  77. package/dist/llms/meter.md +0 -177
  78. package/dist/src/components/ui/meter/index.d.ts +0 -1
  79. package/dist/src/components/ui/meter/meter.d.ts +0 -25
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../../lib/utils.js";
3
3
  import { cva as t } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
4
- import { ChartContainer as n, ChartLegend as r, ChartLegendContent as i, ChartTooltip as a, ChartTooltipContent as o } from "../chart/chart.js";
5
- import { resolveAnimation as s, resolveAxisDomain as c, resolveBrushProps as l, resolveCartesianLabelPosition as ee, resolveCategoryRange as u, resolveChartReferenceValue as te, resolveLabelFillClass as d, resolveReferenceLineProps as f, resolveRotatedTickAnchor as p, resolveXAxisHeight as m, resolveXAxisTitle as ne, resolveYAxisTitle as re, toLabelFormatter as ie, toReferenceLineList as ae } from "../chart/chart-format.js";
6
- import * as h from "react";
7
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
8
- import { Bar as y, BarChart as oe, Brush as se, CartesianGrid as ce, Cell as b, LabelList as le, Rectangle as x, ReferenceArea as ue, ReferenceLine as de, Text as fe, XAxis as S, YAxis as C } from "recharts";
4
+ import { Tooltip as n, TooltipContent as r, TooltipTrigger as i } from "../tooltip/tooltip.js";
5
+ import { ChartContainer as a, ChartLegend as o, ChartLegendContent as s, ChartTooltip as c, ChartTooltipContent as l, resolveChartColors as u } from "../chart/chart.js";
6
+ import { resolveAnimation as d, resolveAxisDomain as f, resolveBrushProps as p, resolveCartesianLabelPosition as m, resolveCategoryRange as h, resolveChartReferenceValue as g, resolveLabelFillClass as _, resolveReferenceLineProps as ee, resolveRotatedTickAnchor as te, resolveXAxisHeight as ne, resolveXAxisTitle as re, resolveYAxisTitle as ie, toLabelFormatter as ae, toReferenceLineList as oe } from "../chart/chart-format.js";
7
+ import * as v from "react";
8
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
9
+ import { Bar as S, BarChart as se, Brush as ce, CartesianGrid as le, Cell as C, LabelList as ue, Rectangle as w, ReferenceArea as de, ReferenceLine as fe, Text as pe, XAxis as me, YAxis as he } from "recharts";
10
+ import { Meter as T } from "@base-ui/react/meter";
9
11
  //#region src/components/ui/bar-chart/bar-chart.tsx
10
- var pe = t("", {
12
+ var ge = t("", {
11
13
  variants: {
12
14
  orientation: {
13
15
  vertical: "",
@@ -22,39 +24,39 @@ var pe = t("", {
22
24
  orientation: "vertical",
23
25
  layout: "grouped"
24
26
  }
25
- }), w = "__headroom_";
26
- function T(e, t) {
27
- let n = e?.filter((e) => !String(e.dataKey).startsWith(w));
27
+ }), E = "__headroom_";
28
+ function D(e, t) {
29
+ let n = e?.filter((e) => !String(e.dataKey).startsWith(E));
28
30
  return t ? n?.slice().sort((e, n) => t.indexOf(String(e.dataKey)) - t.indexOf(String(n.dataKey))) : n;
29
31
  }
30
- function E(e) {
32
+ function O(e) {
31
33
  return e?.map((e) => e.color?.startsWith("url(") ? {
32
34
  ...e,
33
35
  color: `var(--color-${String(e.dataKey)})`
34
36
  } : e);
35
37
  }
36
- function me({ content: e, dataKeys: t, ...n }) {
38
+ function k({ content: e, dataKeys: t, ...n }) {
37
39
  let r = {
38
40
  ...n,
39
- payload: E(T(n.payload, t))
41
+ payload: O(D(n.payload, t))
40
42
  };
41
- return e ? typeof e == "function" ? h.createElement(e, r) : h.cloneElement(e, r) : /* @__PURE__ */ _(o, { ...r });
43
+ return e ? typeof e == "function" ? v.createElement(e, r) : v.cloneElement(e, r) : /* @__PURE__ */ b(l, { ...r });
42
44
  }
43
- function he({ dataKeys: e, ...t }) {
44
- return /* @__PURE__ */ _(i, {
45
+ function A({ dataKeys: e, ...t }) {
46
+ return /* @__PURE__ */ b(s, {
45
47
  verticalAlign: t.verticalAlign,
46
- payload: E(T(t.payload, e))
48
+ payload: O(D(t.payload, e))
47
49
  });
48
50
  }
49
- function D({ bar: e, track: t, trackFill: n, paint: r }) {
50
- return /* @__PURE__ */ v(g, { children: [t && /* @__PURE__ */ _(x, {
51
+ function j({ bar: e, track: t, trackFill: n, paint: r }) {
52
+ return /* @__PURE__ */ x(y, { children: [t && /* @__PURE__ */ b(w, {
51
53
  className: "recharts-bar-background-rectangle",
52
54
  x: t.x ?? void 0,
53
55
  y: t.y ?? void 0,
54
56
  width: t.width ?? void 0,
55
57
  height: t.height ?? void 0,
56
58
  fill: n
57
- }), /* @__PURE__ */ _(x, {
59
+ }), /* @__PURE__ */ b(w, {
58
60
  x: e.x ?? void 0,
59
61
  y: e.y ?? void 0,
60
62
  width: e.width ?? void 0,
@@ -67,21 +69,21 @@ function D({ bar: e, track: t, trackFill: n, paint: r }) {
67
69
  strokeDasharray: e.strokeDasharray
68
70
  })] });
69
71
  }
70
- function O({ inRange: e, trackFill: t, paint: n }) {
71
- return ({ background: r, index: i, ...a }) => D({
72
+ function M({ inRange: e, trackFill: t, paint: n }) {
73
+ return ({ background: r, index: i, ...a }) => j({
72
74
  bar: a,
73
75
  track: e(i) ? r : void 0,
74
76
  trackFill: t,
75
77
  paint: n
76
78
  });
77
79
  }
78
- function ge({ rangeBackground: e, inRange: t, trackFill: n, activeBarOption: r }) {
80
+ function _e({ rangeBackground: e, inRange: t, trackFill: n, activeBarOption: r }) {
79
81
  return e ? {
80
- shape: O({
82
+ shape: M({
81
83
  inRange: t,
82
84
  trackFill: n
83
85
  }),
84
- activeBar: r && O({
86
+ activeBar: r && M({
85
87
  inRange: t,
86
88
  trackFill: n,
87
89
  paint: r
@@ -91,32 +93,29 @@ function ge({ rangeBackground: e, inRange: t, trackFill: n, activeBarOption: r }
91
93
  activeBar: r
92
94
  };
93
95
  }
94
- function k({ band: e, vertical: t }) {
95
- let { x: n = 0, y: r = 0, width: i = 0, height: a = 0, fill: o, fillOpacity: s } = e;
96
- return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(x, {
96
+ function N(e) {
97
+ let { x: t = 0, y: n = 0, width: r = 0, height: i = 0, fill: a, fillOpacity: o } = e;
98
+ return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(w, {
97
99
  className: "recharts-reference-area-rect",
98
- x: n,
99
- y: r,
100
- width: i,
101
- height: a,
102
- fill: o,
103
- fillOpacity: s
104
- }), /* @__PURE__ */ _("line", {
105
- x1: n,
106
- y1: r,
107
- x2: t ? n : n + i,
108
- y2: t ? r + a : r,
100
+ x: t,
101
+ y: n,
102
+ width: r,
103
+ height: i,
104
+ fill: a,
105
+ fillOpacity: o
106
+ }), /* @__PURE__ */ b("line", {
107
+ x1: t,
108
+ y1: n,
109
+ x2: t,
110
+ y2: n + i,
109
111
  stroke: "var(--ui-border-on-surface-border)",
110
112
  strokeDasharray: "4 4"
111
113
  })] });
112
114
  }
113
- function _e({ divider: e, vertical: t }) {
114
- if (e) return (e) => k({
115
- band: e,
116
- vertical: t
117
- });
118
- }
119
115
  function ve(e) {
116
+ if (e) return N;
117
+ }
118
+ function ye(e) {
120
119
  return e ? {
121
120
  value: e,
122
121
  position: "insideTop",
@@ -124,35 +123,35 @@ function ve(e) {
124
123
  fontSize: 12
125
124
  } : void 0;
126
125
  }
127
- function ye({ id: e, dataKeys: t, shapes: n, horizontal: r }) {
128
- let i = n.has("gradient"), a = n.has("pattern");
129
- return !i && !a ? null : /* @__PURE__ */ _("defs", { children: t.map((t) => /* @__PURE__ */ v(h.Fragment, { children: [i && /* @__PURE__ */ v("linearGradient", {
126
+ function be({ id: e, dataKeys: t, shapes: n }) {
127
+ let r = n.has("gradient"), i = n.has("pattern");
128
+ return !r && !i ? null : /* @__PURE__ */ b("defs", { children: t.map((t) => /* @__PURE__ */ x(v.Fragment, { children: [r && /* @__PURE__ */ x("linearGradient", {
130
129
  id: `${e}-gradient-${t}`,
131
130
  x1: "0",
132
131
  y1: "0",
133
- x2: r ? "1" : "0",
134
- y2: r ? "0" : "1",
135
- children: [/* @__PURE__ */ _("stop", {
132
+ x2: "0",
133
+ y2: "1",
134
+ children: [/* @__PURE__ */ b("stop", {
136
135
  offset: "0%",
137
136
  stopColor: `var(--color-${t})`,
138
137
  stopOpacity: 1
139
- }), /* @__PURE__ */ _("stop", {
138
+ }), /* @__PURE__ */ b("stop", {
140
139
  offset: "100%",
141
140
  stopColor: `var(--color-${t})`,
142
141
  stopOpacity: .35
143
142
  })]
144
- }), a && /* @__PURE__ */ v("pattern", {
143
+ }), i && /* @__PURE__ */ x("pattern", {
145
144
  id: `${e}-pattern-${t}`,
146
145
  patternUnits: "userSpaceOnUse",
147
146
  width: 6,
148
147
  height: 6,
149
148
  patternTransform: "rotate(45)",
150
- children: [/* @__PURE__ */ _("rect", {
149
+ children: [/* @__PURE__ */ b("rect", {
151
150
  width: 6,
152
151
  height: 6,
153
152
  fill: `var(--color-${t})`,
154
153
  fillOpacity: .25
155
- }), /* @__PURE__ */ _("line", {
154
+ }), /* @__PURE__ */ b("line", {
156
155
  x1: 0,
157
156
  y1: 0,
158
157
  x2: 0,
@@ -162,40 +161,142 @@ function ye({ id: e, dataKeys: t, shapes: n, horizontal: r }) {
162
161
  })]
163
162
  })] }, t)) });
164
163
  }
165
- function be({ data: e, chartData: t, xKey: n, seriesKey: r, settings: i, range: a, headroomKey: o, barShape: s, rounded: c, fillOf: l, radiusFor: ee }) {
166
- let { fill: u, opacity: te, dashed: d } = i;
167
- return e.map((e, f) => {
168
- let p = f >= a[0] && f <= a[1], m = p && i.shape || s, ne = o !== void 0 && Number(t[f]?.[`${w}${r}`]) > 0;
169
- return /* @__PURE__ */ _(b, {
170
- fill: p ? u ?? l(r, m) : l(r, s),
171
- fillOpacity: p ? te : void 0,
172
- stroke: p && d ? `var(--color-${r})` : void 0,
173
- strokeWidth: p && d ? 1 : void 0,
174
- strokeDasharray: p && d ? "4 3" : void 0,
175
- radius: ne ? void 0 : ee(m, c)
176
- }, `${r}-${String(e[n])}-${f}`);
164
+ function xe({ data: e, chartData: t, xKey: n, seriesKey: r, settings: i, range: a, headroomKey: o, barShape: s, rounded: c, fillOf: l, radiusFor: u }) {
165
+ let { fill: d, opacity: f, dashed: p } = i;
166
+ return e.map((e, m) => {
167
+ let h = m >= a[0] && m <= a[1], g = h && i.shape || s, _ = o !== void 0 && Number(t[m]?.[`${E}${r}`]) > 0;
168
+ return /* @__PURE__ */ b(C, {
169
+ fill: h ? d ?? l(r, g) : l(r, s),
170
+ fillOpacity: h ? f : void 0,
171
+ stroke: h && p ? `var(--color-${r})` : void 0,
172
+ strokeWidth: h && p ? 1 : void 0,
173
+ strokeDasharray: h && p ? "4 3" : void 0,
174
+ radius: _ ? void 0 : u(g, c)
175
+ }, `${r}-${String(e[n])}-${m}`);
177
176
  });
178
177
  }
179
- var A = h.forwardRef(({ className: t, config: i, palette: o, data: b, dataKeys: x, xKey: T, referenceLine: E, referenceArea: D, barSettings: O, xAxisLabel: k, yAxisLabel: A, xUnit: xe, yUnit: Se, orientation: j = "vertical", layout: M = "grouped", barRadius: N = 4, barShape: P = "rounded", barSize: Ce, maxBarSize: we, barGap: Te, barCategoryGap: Ee, minPointSize: F, showBackground: De = !1, backgroundFill: I = "var(--ui-background-surface-secondary)", showActiveBar: Oe = !1, activeBar: L, showGrid: ke = !0, showTooltip: Ae = !0, showLegend: je = !0, showXAxis: R = !0, showYAxis: z = !0, xTickFormatter: B, yTickFormatter: V, xAxisAngle: H, xAxisInterval: U, yAxisTickCount: W, yAxisDomain: Me, gridDashed: Ne, gridHorizontal: Pe, gridVertical: Fe, tooltipContent: Ie, animate: Le, animationDuration: Re, animationBegin: ze, animationEasing: Be, showLabels: Ve = !1, labelPosition: He, labelFormatter: Ue, showBrush: We = !1, brushHeight: Ge, brushAriaLabel: Ke, ...qe }, Je) => {
180
- let G = s({
181
- animate: Le,
182
- animationDuration: Re,
183
- animationBegin: ze,
184
- animationEasing: Be
185
- }), Ye = j === "horizontal" ? "vertical" : "horizontal", K = M === "stacked", q = ee({
186
- labelPosition: He,
187
- isStacked: K,
188
- growingEnd: j === "horizontal" ? "right" : "top"
189
- }), Xe = ae(E), Ze = (D ? Array.isArray(D) ? D : [D] : []).map((e) => ({
178
+ var P = (e) => e.toLocaleString();
179
+ function F({ item: t, resolvedColor: a, max: o, valueFormatter: s, showTooltip: c, tooltip: l }) {
180
+ let { label: u, value: d, forecast: f } = t, p = a, m = o > 0 ? Math.round(d / o * 100) : 0, h = f != null && f > d, g = /* @__PURE__ */ x(T.Root, {
181
+ value: d,
182
+ max: o,
183
+ "aria-valuemax": o,
184
+ "aria-valuetext": h ? `${s(d)} of ${s(o)} (${m}%), forecast ${s(f)}` : `${s(d)} of ${s(o)} (${m}%)`,
185
+ tabIndex: c ? 0 : void 0,
186
+ className: "flex w-full flex-col gap-1.5",
187
+ children: [/* @__PURE__ */ x("div", {
188
+ className: "flex items-baseline justify-between gap-2 text-sm leading-none",
189
+ children: [/* @__PURE__ */ b(T.Label, {
190
+ className: "truncate font-semibold",
191
+ children: u
192
+ }), /* @__PURE__ */ x("span", {
193
+ className: "shrink-0 tabular-nums",
194
+ children: [/* @__PURE__ */ b("span", {
195
+ className: "font-semibold text-[var(--ui-text-on-surface-link-idle)]",
196
+ children: s(d)
197
+ }), /* @__PURE__ */ x("span", {
198
+ className: "text-muted-foreground",
199
+ children: [
200
+ " ",
201
+ m,
202
+ "%"
203
+ ]
204
+ })]
205
+ })]
206
+ }), /* @__PURE__ */ x(T.Track, {
207
+ className: "relative h-2 w-full overflow-hidden rounded-full bg-[var(--ui-background-status-neutral-pressed)]",
208
+ children: [h && /* @__PURE__ */ b("div", {
209
+ "data-forecast": !0,
210
+ className: "absolute inset-y-0 start-0 rounded-full",
211
+ style: {
212
+ backgroundColor: p,
213
+ opacity: .3,
214
+ width: `${f / o * 100}%`
215
+ }
216
+ }), /* @__PURE__ */ b(T.Indicator, {
217
+ className: "relative rounded-full",
218
+ style: { backgroundColor: p }
219
+ })]
220
+ })]
221
+ });
222
+ return c ? /* @__PURE__ */ x(n, { children: [/* @__PURE__ */ b(i, { render: g }), /* @__PURE__ */ b(r, {
223
+ className: e("border border-border bg-background text-foreground shadow-md", !l && "flex items-center gap-2"),
224
+ children: l ?? /* @__PURE__ */ x(y, { children: [
225
+ /* @__PURE__ */ b("span", {
226
+ className: "size-2.5 shrink-0 rounded-full",
227
+ style: { backgroundColor: p }
228
+ }),
229
+ /* @__PURE__ */ b("span", {
230
+ className: "font-semibold",
231
+ children: u
232
+ }),
233
+ /* @__PURE__ */ x("span", {
234
+ className: "text-muted-foreground",
235
+ children: [
236
+ s(d),
237
+ " of ",
238
+ s(o),
239
+ " · ",
240
+ m,
241
+ "%"
242
+ ]
243
+ })
244
+ ] })
245
+ })] }) : g;
246
+ }
247
+ var I = v.forwardRef(({ items: t, max: n, palette: r, valueFormatter: i = P, showTooltip: a = !0, tooltip: o, className: s, ...c }, l) => {
248
+ let d = n !== void 0 && n > 0 ? n : t.reduce((e, t) => e + t.value, 0) || 1, f = v.useMemo(() => {
249
+ if (!r) return null;
250
+ let e = Object.fromEntries(t.map((e, t) => [`item${t}`, {
251
+ label: e.label,
252
+ ...e.tone ? { tone: e.tone } : {}
253
+ }])), n = u(e, r);
254
+ return t.map((e, t) => e.color ?? n[`item${t}`]?.color ?? "");
255
+ }, [t, r]);
256
+ return /* @__PURE__ */ b("div", {
257
+ ref: l,
258
+ "data-orientation": "horizontal",
259
+ className: e("flex flex-col gap-4", s),
260
+ ...c,
261
+ children: t.map((e, t) => /* @__PURE__ */ b(F, {
262
+ item: e,
263
+ resolvedColor: f ? f[t] ?? "" : e.color ?? "",
264
+ max: d,
265
+ valueFormatter: i,
266
+ showTooltip: a,
267
+ tooltip: o
268
+ }, `${t}-${e.label}`))
269
+ });
270
+ });
271
+ I.displayName = "HorizontalBarLayout";
272
+ var L = v.forwardRef((t, n) => {
273
+ let r = v.useId().replace(/:/g, "");
274
+ if (t.orientation === "horizontal") {
275
+ let { orientation: e, ...r } = t;
276
+ return /* @__PURE__ */ b(I, {
277
+ ...r,
278
+ ref: n
279
+ });
280
+ }
281
+ let { className: i, config: s, palette: l, data: u, dataKeys: C, xKey: w, referenceLine: T, referenceArea: D, barSettings: O, xAxisLabel: j, yAxisLabel: M, yUnit: N, orientation: P = "vertical", layout: F = "grouped", barRadius: L = 8, barShape: R = "rounded", barSize: Se = 8, maxBarSize: Ce, barGap: we = 4, barCategoryGap: Te, minPointSize: z, showBackground: Ee = !1, backgroundFill: B = "var(--ui-background-surface-secondary)", showActiveBar: De = !1, activeBar: V, showGrid: Oe = !0, showTooltip: ke = !0, showLegend: Ae = !0, showXAxis: je = !0, showYAxis: Me = !0, xTickFormatter: H, yTickFormatter: Ne, xAxisAngle: U, xAxisInterval: Pe, yAxisTickCount: Fe, yAxisDomain: Ie, gridDashed: Le = !0, gridHorizontal: Re, gridVertical: ze, tooltipContent: Be, animate: Ve, animationDuration: He, animationBegin: Ue, animationEasing: We, showLabels: Ge = !1, labelPosition: Ke, labelFormatter: qe, showBrush: Je = !1, brushHeight: Ye, brushAriaLabel: Xe, ...Ze } = t, W = d({
282
+ animate: Ve,
283
+ animationDuration: He,
284
+ animationBegin: Ue,
285
+ animationEasing: We
286
+ }), G = F === "stacked", K = m({
287
+ labelPosition: Ke,
288
+ isStacked: G,
289
+ growingEnd: "top"
290
+ }), Qe = oe(T), q = (D ? Array.isArray(D) ? D : [D] : []).map((e) => ({
190
291
  area: e,
191
- range: u(e, b, T)
192
- })).filter((e) => e.range !== void 0), J = new Map(x.flatMap((e) => {
193
- let t = O?.[e], n = t ? u(t, b, T) : void 0;
292
+ range: h(e, u, w)
293
+ })).filter((e) => e.range !== void 0), J = new Map(C.flatMap((e) => {
294
+ let t = O?.[e], n = t ? h(t, u, w) : void 0;
194
295
  return t && n ? [[e, {
195
296
  settings: t,
196
297
  range: n
197
298
  }]] : [];
198
- })), Y = new Map(K ? [] : Array.from(J, ([e, t]) => typeof t.settings.background == "string" ? [e, t.settings.background] : void 0).filter((e) => e !== void 0)), X = Y.size ? b.map((e, t) => {
299
+ })), Y = new Map(G ? [] : Array.from(J, ([e, t]) => typeof t.settings.background == "string" ? [e, t.settings.background] : void 0).filter((e) => e !== void 0)), X = Y.size ? u.map((e, t) => {
199
300
  let n = {};
200
301
  return Y.forEach((r, i) => {
201
302
  let a = J.get(i);
@@ -203,206 +304,168 @@ var A = h.forwardRef(({ className: t, config: i, palette: o, data: b, dataKeys:
203
304
  let [o, s] = a.range;
204
305
  if (t < o || t > s) return;
205
306
  let c = e[i], l = e[r];
206
- typeof c == "number" && typeof l == "number" && (n[`${w}${i}`] = Math.max(0, l - c));
307
+ typeof c == "number" && typeof l == "number" && (n[`${E}${i}`] = Math.max(0, l - c));
207
308
  }), {
208
309
  ...e,
209
310
  ...n
210
311
  };
211
- }) : b, Qe = new Set(Ze.filter(({ area: e }) => e.highlightTicks !== !1).flatMap(({ range: e }) => b.slice(e[0], e[1] + 1).map((e) => e[T]))), $e = Qe.size ? ({ payload: t, index: n, ...r }) => {
212
- let i = j === "horizontal" ? V : B, a = i ? i(t.value, n) : t.value;
213
- return /* @__PURE__ */ _(fe, {
312
+ }) : u, Z = new Set(q.filter(({ area: e }) => e.highlightTicks !== !1).flatMap(({ range: e }) => u.slice(e[0], e[1] + 1).map((e) => e[w]))), $e = Z.size ? ({ payload: t, index: n, ...r }) => {
313
+ let i = H ? H(t.value, n) : t.value;
314
+ return /* @__PURE__ */ b(pe, {
214
315
  ...r,
215
- className: e("fill-muted-foreground", Qe.has(t.value) && "fill-primary italic"),
316
+ className: e("fill-muted-foreground", Z.has(t.value) && "fill-primary italic"),
216
317
  fontSize: 12,
217
- children: a
318
+ children: i
218
319
  });
219
- } : void 0, et = Oe ? {
220
- ...L?.fill === void 0 ? {} : { fill: L.fill },
221
- fillOpacity: L?.opacity ?? .85
222
- } : !1, Z = `bar-${h.useId().replace(/:/g, "")}`, tt = /* @__PURE__ */ new Set([P]);
320
+ } : void 0, et = De ? {
321
+ ...V?.fill === void 0 ? {} : { fill: V.fill },
322
+ fillOpacity: V?.opacity ?? .85
323
+ } : !1, Q = `bar-${r}`, tt = /* @__PURE__ */ new Set([R]);
223
324
  J.forEach(({ settings: e }) => {
224
325
  e.shape && tt.add(e.shape);
225
326
  });
226
- let nt = (e) => F === void 0 ? void 0 : (t, n) => {
227
- let r = K ? X[n]?.[e] : t;
228
- return typeof r == "number" && r !== 0 ? F : 0;
229
- }, Q = (e, t) => t === "gradient" ? `url(#${Z}-gradient-${e})` : t === "pattern" ? `url(#${Z}-pattern-${e})` : `var(--color-${e})`, rt = ne(k), it = re(A), at = c(Me), ot = m(k, H), st = j === "horizontal" ? [
230
- 0,
231
- N,
232
- N,
233
- 0
234
- ] : [
235
- N,
236
- N,
327
+ let nt = (e) => z === void 0 ? void 0 : (t, n) => {
328
+ let r = G ? X[n]?.[e] : t;
329
+ return typeof r == "number" && r !== 0 ? z : 0;
330
+ }, rt = (e, t) => t === "gradient" ? `url(#${Q}-gradient-${e})` : t === "pattern" ? `url(#${Q}-pattern-${e})` : `var(--color-${e})`, it = re(j), at = ie(M), ot = f(Ie), st = ne(j, U), ct = [
331
+ L,
332
+ L,
237
333
  0,
238
334
  0
239
- ], $ = (e, t) => e === "pill" ? 9999 : N > 0 && t ? st : void 0, ct = /* @__PURE__ */ _(me, {
240
- content: Ie,
241
- dataKeys: x
242
- }), lt = /* @__PURE__ */ _(he, { dataKeys: x }), ut = () => j === "horizontal" ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(S, {
243
- type: "number",
244
- hide: !R,
245
- tickLine: !1,
246
- axisLine: !1,
247
- unit: xe,
248
- tickFormatter: B,
249
- angle: H,
250
- interval: U,
251
- textAnchor: p(H),
252
- tickCount: W,
253
- domain: at,
254
- height: ot,
255
- label: rt
256
- }), /* @__PURE__ */ _(C, {
257
- dataKey: T,
335
+ ], $ = (e, t) => e === "pill" ? 9999 : L > 0 && t ? ct : void 0, lt = /* @__PURE__ */ b(k, {
336
+ content: Be,
337
+ dataKeys: C
338
+ }), ut = /* @__PURE__ */ b(A, { dataKeys: C }), dt = () => /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(me, {
339
+ dataKey: w,
258
340
  type: "category",
259
- hide: !z,
341
+ hide: !je,
260
342
  tickLine: !1,
261
343
  axisLine: !1,
262
344
  tick: $e,
263
- tickFormatter: V,
264
- width: A ? 96 : 80,
345
+ tickFormatter: H,
346
+ angle: U,
347
+ interval: Pe,
348
+ textAnchor: te(U),
349
+ height: st,
265
350
  label: it
266
- })] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(S, {
267
- dataKey: T,
268
- type: "category",
269
- hide: !R,
270
- tickLine: !1,
271
- axisLine: !1,
272
- tick: $e,
273
- tickFormatter: B,
274
- angle: H,
275
- interval: U,
276
- textAnchor: p(H),
277
- height: ot,
278
- label: rt
279
- }), /* @__PURE__ */ _(C, {
351
+ }), /* @__PURE__ */ b(he, {
280
352
  type: "number",
281
- hide: !z,
353
+ hide: !Me,
282
354
  tickLine: !1,
283
355
  axisLine: !1,
284
- unit: Se,
285
- tickFormatter: V,
286
- tickCount: W,
287
- domain: at,
288
- width: A ? 72 : void 0,
289
- label: it
290
- })] }), dt = () => x.map((e, t) => {
291
- let n = !K || t === x.length - 1, r = J.get(e), i = (e) => r !== void 0 && e >= r.range[0] && e <= r.range[1], a = Y.get(e), { shape: o, activeBar: s } = ge({
356
+ unit: N,
357
+ tickFormatter: Ne,
358
+ tickCount: Fe,
359
+ domain: ot,
360
+ width: M ? 72 : void 0,
361
+ label: at
362
+ })] }), ft = () => C.map((e, t) => {
363
+ let n = !G || t === C.length - 1, r = J.get(e), i = (e) => r !== void 0 && e >= r.range[0] && e <= r.range[1], a = Y.get(e), { shape: o, activeBar: s } = _e({
292
364
  rangeBackground: r?.settings.background === !0,
293
365
  inRange: i,
294
- trackFill: I,
366
+ trackFill: B,
295
367
  activeBarOption: et
296
- }), c = r && be({
297
- data: b,
368
+ }), c = r && xe({
369
+ data: u,
298
370
  chartData: X,
299
- xKey: T,
371
+ xKey: w,
300
372
  seriesKey: e,
301
373
  settings: r.settings,
302
374
  range: r.range,
303
375
  headroomKey: a,
304
- barShape: P,
376
+ barShape: R,
305
377
  rounded: n,
306
- fillOf: Q,
378
+ fillOf: rt,
307
379
  radiusFor: $
308
- }), l = Ve && /* @__PURE__ */ _(le, {
380
+ }), l = Ge && /* @__PURE__ */ b(ue, {
309
381
  dataKey: e,
310
- position: q,
311
- formatter: ie(Ue),
312
- className: d(q),
382
+ position: K,
383
+ formatter: ae(qe),
384
+ className: _(K),
313
385
  fontSize: 12
314
386
  });
315
- return /* @__PURE__ */ v(h.Fragment, { children: [/* @__PURE__ */ v(y, {
387
+ return /* @__PURE__ */ x(v.Fragment, { children: [/* @__PURE__ */ x(S, {
316
388
  dataKey: e,
317
- fill: Q(e, P),
318
- stackId: K ? "a" : a ? e : void 0,
319
- radius: $(P, n),
389
+ fill: rt(e, R),
390
+ stackId: G ? "a" : a ? e : void 0,
391
+ radius: $(R, n),
320
392
  minPointSize: nt(e),
321
- background: De ? { fill: I } : void 0,
393
+ background: Ee ? { fill: B } : void 0,
322
394
  shape: o,
323
395
  activeBar: s,
324
- ...G,
396
+ ...W,
325
397
  children: [c, l]
326
- }), a && /* @__PURE__ */ _(y, {
327
- dataKey: `${w}${e}`,
398
+ }), a && /* @__PURE__ */ b(S, {
399
+ dataKey: `${E}${e}`,
328
400
  stackId: e,
329
401
  fill: `var(--color-${e})`,
330
402
  fillOpacity: .25,
331
- radius: $(P, !0),
403
+ radius: $(R, !0),
332
404
  legendType: "none",
333
405
  tooltipType: "none",
334
- ...G
406
+ ...W
335
407
  })] }, e);
336
- }), ft = () => Ze.map(({ area: e, range: t }, n) => {
337
- let [r, i] = t, a = j === "horizontal" ? {
338
- y1: b[r]?.[T],
339
- y2: b[i]?.[T]
340
- } : {
341
- x1: b[r]?.[T],
342
- x2: b[i]?.[T]
343
- };
344
- return /* @__PURE__ */ _(ue, {
345
- ...a,
408
+ }), pt = () => q.map(({ area: e, range: t }, n) => {
409
+ let [r, i] = t;
410
+ return /* @__PURE__ */ b(de, {
411
+ x1: u[r]?.[w],
412
+ x2: u[i]?.[w],
346
413
  fill: "var(--ui-background-surface-secondary)",
347
414
  fillOpacity: .6,
348
415
  ifOverflow: "extendDomain",
349
- shape: _e({
350
- divider: e.divider,
351
- vertical: j !== "horizontal"
352
- }),
353
- label: ve(e.label)
416
+ shape: ve(e.divider),
417
+ label: ye(e.label)
354
418
  }, `${e.label ?? "area"}-${n}`);
355
- }), pt = () => Xe.map((e, t) => {
356
- let n = te(e, b, x);
357
- return n === void 0 ? null : /* @__PURE__ */ _(de, {
358
- ...j === "horizontal" ? { x: n } : { y: n },
359
- ...f(e.label, e.labelPosition ?? (j === "horizontal" ? "top" : "insideTopRight"))
419
+ }), mt = () => Qe.map((e, t) => {
420
+ let n = g(e, u, C);
421
+ return n === void 0 ? null : /* @__PURE__ */ b(fe, {
422
+ y: n,
423
+ ...ee(e.label, e.labelPosition ?? "insideTopRight")
360
424
  }, `${e.label ?? "ref"}-${t}`);
361
425
  });
362
- return /* @__PURE__ */ _("div", {
363
- ref: Je,
364
- "data-orientation": j,
365
- "data-layout": M,
366
- className: e(pe({
367
- orientation: j,
368
- layout: M
369
- }), t),
370
- ...qe,
371
- children: /* @__PURE__ */ _(n, {
372
- config: i,
373
- palette: o,
426
+ return /* @__PURE__ */ b("div", {
427
+ ref: n,
428
+ "data-orientation": P,
429
+ "data-layout": F,
430
+ className: e(ge({
431
+ orientation: P,
432
+ layout: F
433
+ }), i),
434
+ ...Ze,
435
+ children: /* @__PURE__ */ b(a, {
436
+ config: s,
437
+ palette: l,
374
438
  className: "size-full [&_.recharts-label]:fill-foreground",
375
- children: /* @__PURE__ */ v(oe, {
439
+ children: /* @__PURE__ */ x(se, {
376
440
  data: X,
377
- layout: Ye,
378
- barSize: Ce,
379
- maxBarSize: we,
380
- barGap: Te,
381
- barCategoryGap: Ee,
441
+ layout: "horizontal",
442
+ barSize: Se,
443
+ maxBarSize: Ce,
444
+ barGap: we,
445
+ barCategoryGap: Te,
382
446
  children: [
383
- /* @__PURE__ */ _(ye, {
384
- id: Z,
385
- dataKeys: x,
386
- shapes: tt,
387
- horizontal: j === "horizontal"
447
+ /* @__PURE__ */ b(be, {
448
+ id: Q,
449
+ dataKeys: C,
450
+ shapes: tt
388
451
  }),
389
- ke && /* @__PURE__ */ _(ce, {
390
- horizontal: Pe ?? j === "vertical",
391
- vertical: Fe ?? j === "horizontal",
392
- strokeDasharray: Ne ? "3 3" : void 0
452
+ Oe && /* @__PURE__ */ b(le, {
453
+ horizontal: Re ?? !0,
454
+ vertical: ze ?? !1,
455
+ strokeDasharray: Le ? "3 3" : void 0
393
456
  }),
394
- ut(),
395
- Ae && /* @__PURE__ */ _(a, { content: ct }),
396
- je && /* @__PURE__ */ _(r, { content: lt }),
397
457
  dt(),
458
+ ke && /* @__PURE__ */ b(c, { content: lt }),
459
+ Ae && /* @__PURE__ */ b(o, { content: ut }),
398
460
  ft(),
399
461
  pt(),
400
- We && /* @__PURE__ */ _(se, {
401
- dataKey: T,
402
- tickFormatter: j === "horizontal" ? V : B,
403
- ...l({
404
- brushHeight: Ge,
405
- brushAriaLabel: Ke
462
+ mt(),
463
+ Je && /* @__PURE__ */ b(ce, {
464
+ dataKey: w,
465
+ tickFormatter: H,
466
+ ...p({
467
+ brushHeight: Ye,
468
+ brushAriaLabel: Xe
406
469
  })
407
470
  })
408
471
  ]
@@ -410,8 +473,8 @@ var A = h.forwardRef(({ className: t, config: i, palette: o, data: b, dataKeys:
410
473
  })
411
474
  });
412
475
  });
413
- A.displayName = "BarChart";
476
+ L.displayName = "BarChart";
414
477
  //#endregion
415
- export { A as BarChart, he as NormalizedLegendContent, me as NormalizedTooltipContent, pe as barChartVariants, O as createTrackShape, T as dropHeadroomSeries, E as withSeriesColor };
478
+ export { L as BarChart, A as NormalizedLegendContent, k as NormalizedTooltipContent, ge as barChartVariants, M as createTrackShape, D as dropHeadroomSeries, O as withSeriesColor };
416
479
 
417
480
  //# sourceMappingURL=bar-chart.js.map