@brightlocal/ui-components 3.1.0 → 3.2.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 (176) hide show
  1. package/README.md +6 -1
  2. package/component-meta.json +663 -38
  3. package/deprecations.json +1 -1
  4. package/dist/alert-dialog.cjs +1 -1
  5. package/dist/alert-dialog.d.ts +32 -3
  6. package/dist/alert-dialog.d.ts.map +1 -1
  7. package/dist/alert-dialog.js +61 -58
  8. package/dist/alert.cjs +1 -1
  9. package/dist/alert.d.ts.map +1 -1
  10. package/dist/alert.js +58 -57
  11. package/dist/badge.cjs +1 -1
  12. package/dist/badge.d.ts +9 -0
  13. package/dist/badge.d.ts.map +1 -1
  14. package/dist/badge.js +50 -30
  15. package/dist/banner.cjs +1 -0
  16. package/dist/banner.d.ts +81 -0
  17. package/dist/banner.d.ts.map +1 -0
  18. package/dist/banner.js +176 -0
  19. package/dist/blocks/empty-state.cjs +1 -1
  20. package/dist/blocks/empty-state.d.ts +4 -3
  21. package/dist/blocks/empty-state.d.ts.map +1 -1
  22. package/dist/blocks/empty-state.js +21 -20
  23. package/dist/blocks/progress-state.d.ts +2 -2
  24. package/dist/blocks/sidebar.cjs +1 -1
  25. package/dist/blocks/sidebar.d.ts +17 -0
  26. package/dist/blocks/sidebar.d.ts.map +1 -1
  27. package/dist/blocks/sidebar.js +8 -2
  28. package/dist/brand-illustration-motif.d.ts +1 -1
  29. package/dist/card.cjs +1 -1
  30. package/dist/card.d.ts +86 -6
  31. package/dist/card.d.ts.map +1 -1
  32. package/dist/card.js +185 -96
  33. package/dist/chart.cjs +3 -3
  34. package/dist/chart.d.ts +231 -13
  35. package/dist/chart.d.ts.map +1 -1
  36. package/dist/chart.js +466 -306
  37. package/dist/checkbox.cjs +1 -1
  38. package/dist/checkbox.d.ts +1 -1
  39. package/dist/checkbox.d.ts.map +1 -1
  40. package/dist/checkbox.js +2 -1
  41. package/dist/combobox.cjs +1 -1
  42. package/dist/combobox.js +2 -2
  43. package/dist/command.cjs +1 -1
  44. package/dist/command.js +1 -1
  45. package/dist/data-table.cjs +1 -1
  46. package/dist/data-table.d.ts +169 -22
  47. package/dist/data-table.d.ts.map +1 -1
  48. package/dist/data-table.js +695 -561
  49. package/dist/grid.d.ts +24 -1
  50. package/dist/grid.d.ts.map +1 -1
  51. package/dist/hooks/use-breakpoint.cjs +1 -1
  52. package/dist/hooks/use-breakpoint.d.ts +1 -1
  53. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  54. package/dist/hooks/use-breakpoint.js +1 -0
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.ts +5 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +593 -561
  59. package/dist/info-tooltip.cjs +1 -0
  60. package/dist/info-tooltip.d.ts +39 -0
  61. package/dist/info-tooltip.d.ts.map +1 -0
  62. package/dist/info-tooltip.js +41 -0
  63. package/dist/input-chip.cjs +1 -1
  64. package/dist/input-chip.js +1 -1
  65. package/dist/input-group.cjs +1 -1
  66. package/dist/input-group.d.ts +33 -2
  67. package/dist/input-group.d.ts.map +1 -1
  68. package/dist/input-group.js +167 -54
  69. package/dist/input-otp.cjs +1 -1
  70. package/dist/input-otp.js +9 -9
  71. package/dist/input-password.cjs +1 -1
  72. package/dist/input-password.d.ts +28 -6
  73. package/dist/input-password.d.ts.map +1 -1
  74. package/dist/input-password.js +5 -5
  75. package/dist/input.cjs +1 -1
  76. package/dist/input.js +10 -10
  77. package/dist/lib/block-illustration.cjs +1 -1
  78. package/dist/lib/block-illustration.d.ts +4 -1
  79. package/dist/lib/block-illustration.d.ts.map +1 -1
  80. package/dist/lib/block-illustration.js +12 -11
  81. package/dist/lib/utils.cjs +1 -1
  82. package/dist/lib/utils.d.ts.map +1 -1
  83. package/dist/lib/utils.js +4 -3
  84. package/dist/list.cjs +1 -1
  85. package/dist/list.js +1 -1
  86. package/dist/multi-select-filter.cjs +1 -0
  87. package/dist/multi-select-filter.d.ts +178 -0
  88. package/dist/multi-select-filter.d.ts.map +1 -0
  89. package/dist/multi-select-filter.js +463 -0
  90. package/dist/progress.cjs +1 -1
  91. package/dist/progress.d.ts +123 -16
  92. package/dist/progress.d.ts.map +1 -1
  93. package/dist/progress.js +89 -75
  94. package/dist/rating.cjs +1 -1
  95. package/dist/rating.js +18 -18
  96. package/dist/relative-date.cjs +1 -0
  97. package/dist/relative-date.d.ts +65 -0
  98. package/dist/relative-date.d.ts.map +1 -0
  99. package/dist/relative-date.js +128 -0
  100. package/dist/select.cjs +2 -2
  101. package/dist/select.d.ts +11 -1
  102. package/dist/select.d.ts.map +1 -1
  103. package/dist/select.js +97 -81
  104. package/dist/sheet.cjs +1 -1
  105. package/dist/sheet.d.ts +78 -2
  106. package/dist/sheet.d.ts.map +1 -1
  107. package/dist/sheet.js +192 -85
  108. package/dist/single-select-filter.cjs +1 -0
  109. package/dist/single-select-filter.d.ts +81 -0
  110. package/dist/single-select-filter.d.ts.map +1 -0
  111. package/dist/single-select-filter.js +226 -0
  112. package/dist/sonner.cjs +1 -1
  113. package/dist/sonner.d.ts.map +1 -1
  114. package/dist/sonner.js +22 -22
  115. package/dist/split-layout.cjs +1 -1
  116. package/dist/split-layout.d.ts +1 -1
  117. package/dist/split-layout.js +13 -13
  118. package/dist/table.cjs +1 -1
  119. package/dist/table.d.ts +45 -4
  120. package/dist/table.d.ts.map +1 -1
  121. package/dist/table.js +90 -73
  122. package/dist/tabs.cjs +1 -1
  123. package/dist/tabs.d.ts +12 -1
  124. package/dist/tabs.d.ts.map +1 -1
  125. package/dist/tabs.js +148 -126
  126. package/dist/textarea.cjs +1 -1
  127. package/dist/textarea.js +1 -1
  128. package/dist/tooltip.cjs +1 -1
  129. package/dist/tooltip.d.ts +38 -36
  130. package/dist/tooltip.d.ts.map +1 -1
  131. package/dist/tooltip.js +262 -73
  132. package/dist/typography-text.d.ts +1 -2
  133. package/dist/typography-text.d.ts.map +1 -1
  134. package/dist/typography.d.ts +1 -1
  135. package/package.json +5 -6
  136. package/src/blocks/empty-state.tsx +8 -3
  137. package/src/blocks/progress-state.tsx +2 -2
  138. package/src/blocks/sidebar.tsx +26 -2
  139. package/src/components/alert-dialog.tsx +50 -5
  140. package/src/components/alert.tsx +16 -8
  141. package/src/components/badge.tsx +40 -3
  142. package/src/components/banner.tsx +288 -0
  143. package/src/components/brand-illustration-motif.tsx +1 -1
  144. package/src/components/card.tsx +211 -24
  145. package/src/components/chart.tsx +523 -35
  146. package/src/components/checkbox.tsx +1 -1
  147. package/src/components/combobox.tsx +2 -2
  148. package/src/components/command.tsx +1 -1
  149. package/src/components/data-table.tsx +778 -195
  150. package/src/components/grid.tsx +32 -1
  151. package/src/components/info-tooltip.tsx +94 -0
  152. package/src/components/input-chip.tsx +1 -1
  153. package/src/components/input-group.tsx +246 -11
  154. package/src/components/input-otp.tsx +1 -1
  155. package/src/components/input-password.tsx +33 -11
  156. package/src/components/input.tsx +1 -1
  157. package/src/components/list.tsx +1 -1
  158. package/src/components/multi-select-filter.tsx +912 -0
  159. package/src/components/progress.tsx +190 -31
  160. package/src/components/rating.tsx +1 -1
  161. package/src/components/relative-date.tsx +230 -0
  162. package/src/components/select.tsx +35 -5
  163. package/src/components/sheet.tsx +240 -4
  164. package/src/components/single-select-filter.tsx +443 -0
  165. package/src/components/sonner.tsx +16 -5
  166. package/src/components/split-layout.tsx +2 -2
  167. package/src/components/table.tsx +71 -11
  168. package/src/components/tabs.tsx +93 -46
  169. package/src/components/textarea.tsx +1 -1
  170. package/src/components/tooltip.tsx +440 -68
  171. package/src/components/typography-text.tsx +1 -2
  172. package/src/components/typography.tsx +1 -1
  173. package/src/hooks/use-breakpoint.ts +2 -1
  174. package/src/index.ts +5 -0
  175. package/src/lib/block-illustration.tsx +5 -1
  176. package/src/lib/utils.ts +1 -0
package/dist/chart.js CHANGED
@@ -1,58 +1,63 @@
1
- import { jsxs as b, jsx as s, Fragment as S } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as o, Fragment as T } from "react/jsx-runtime";
2
2
  import * as k from "react";
3
- import * as N from "recharts";
4
- import { Area as J, AreaChart as Q, Bar as U, BarChart as Z, CartesianGrid as K, Cell as ee, Label as te, Legend as re, Tooltip as ne, Customized as ae, LabelList as le, Line as oe, LineChart as se, Pie as ie, PieChart as ce, PolarAngleAxis as de, PolarGrid as ue, PolarRadiusAxis as he, Radar as fe, RadarChart as pe, RadialBar as me, RadialBarChart as ge, Rectangle as Ce, ReferenceLine as be, ResponsiveContainer as xe, Sector as ve, XAxis as ke, YAxis as Ne } from "recharts";
5
- import { cn as p } from "@brightlocal/ui-components/lib/utils";
6
- const R = k.createContext(null);
3
+ import * as _ from "recharts";
4
+ import { Area as se, AreaChart as ie, Bar as ce, BarChart as de, CartesianGrid as ue, Cell as he, Label as fe, Legend as ge, Tooltip as pe, Customized as me, LabelList as Ce, Line as be, LineChart as ve, Pie as xe, PieChart as ke, PolarAngleAxis as Ne, PolarGrid as ye, PolarRadiusAxis as Le, Radar as _e, RadarChart as $e, RadialBar as we, RadialBarChart as ze, Rectangle as Re, ReferenceLine as Pe, ResponsiveContainer as Se, Sector as Ae, XAxis as Ie, YAxis as Te } from "recharts";
5
+ import { Slot as j, Slottable as O } from "@radix-ui/react-slot";
6
+ import { cva as V } from "class-variance-authority";
7
+ import { cn as b } from "@brightlocal/ui-components/lib/utils";
8
+ const w = k.createContext(null);
7
9
  function P() {
8
- const t = k.useContext(R);
10
+ const t = k.useContext(w);
9
11
  if (!t)
10
12
  throw new Error("useChart must be used within a <ChartContainer />");
11
13
  return t;
12
14
  }
13
- const j = k.forwardRef(
15
+ function D() {
16
+ return k.useContext(w);
17
+ }
18
+ const W = k.forwardRef(
14
19
  ({
15
20
  id: t,
16
- className: r,
17
- children: l,
21
+ className: a,
22
+ children: s,
18
23
  config: e,
19
- dataHook: n,
20
- width: a,
21
- height: o,
22
- minWidth: d,
23
- minHeight: i,
24
- maxHeight: u,
24
+ dataHook: r,
25
+ width: n,
26
+ height: i,
27
+ minWidth: c,
28
+ minHeight: l,
29
+ maxHeight: f,
25
30
  trackingEl: h,
26
- trackingLabel: g,
31
+ trackingLabel: p,
27
32
  ...m
28
- }, C) => {
29
- const x = k.useId(), f = `chart-${t || x.replace(/:/g, "")}`;
30
- return /* @__PURE__ */ s(R.Provider, { value: { config: e }, children: /* @__PURE__ */ b(
33
+ }, v) => {
34
+ const x = k.useId(), g = `chart-${t || x.replace(/:/g, "")}`;
35
+ return /* @__PURE__ */ o(w.Provider, { value: { config: e }, children: /* @__PURE__ */ y(
31
36
  "div",
32
37
  {
33
- ref: C,
34
- className: p(
38
+ ref: v,
39
+ className: b(
35
40
  "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-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 [&_.recharts-pie-sector]:stroke-background text-body-xs flex aspect-video justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
36
- r
41
+ a
37
42
  ),
38
- "data-chart": f,
39
- "data-hook": n,
43
+ "data-chart": g,
44
+ "data-hook": r,
40
45
  "data-slot": "chart-container",
41
46
  "data-tracking-el": h,
42
- "data-tracking-label": g,
47
+ "data-tracking-label": p,
43
48
  ...m,
44
49
  children: [
45
- /* @__PURE__ */ s(T, { config: e, id: f }),
46
- /* @__PURE__ */ s(
47
- N.ResponsiveContainer,
50
+ /* @__PURE__ */ o(G, { config: e, id: g }),
51
+ /* @__PURE__ */ o(
52
+ _.ResponsiveContainer,
48
53
  {
49
- height: o ?? "100%",
54
+ height: i ?? "100%",
50
55
  initialDimension: { width: 1, height: 1 },
51
- maxHeight: u,
52
- minHeight: i,
53
- minWidth: d ?? 0,
54
- width: a ?? "100%",
55
- children: l
56
+ maxHeight: f,
57
+ minHeight: l,
58
+ minWidth: c ?? 0,
59
+ width: n ?? "100%",
60
+ children: s
56
61
  }
57
62
  )
58
63
  ]
@@ -60,25 +65,25 @@ const j = k.forwardRef(
60
65
  ) });
61
66
  }
62
67
  );
63
- j.displayName = "ChartContainer";
64
- function T({ id: t, config: r }) {
65
- const l = Object.entries(r).filter(
68
+ W.displayName = "ChartContainer";
69
+ function G({ id: t, config: a }) {
70
+ const s = Object.entries(a).filter(
66
71
  ([, e]) => e.theme || e.color
67
72
  );
68
- return l.length ? /* @__PURE__ */ s(
73
+ return s.length ? /* @__PURE__ */ o(
69
74
  "style",
70
75
  {
71
76
  dangerouslySetInnerHTML: {
72
- __html: l.map(([e, n]) => {
73
- const a = typeof n.color == "string" ? n.color.replace(/^hsl\((.*)\)$/, "$1") : null;
74
- return a ? `
77
+ __html: s.map(([e, r]) => {
78
+ const n = typeof r.color == "string" ? r.color.replace(/^hsl\((.*)\)$/, "$1") : null;
79
+ return n ? `
75
80
  [data-chart=${t}] {
76
- --color-${e}: ${a};
81
+ --color-${e}: ${n};
77
82
  }
78
- ` : n.theme ? Object.entries(n.theme).map(
79
- ([o, d]) => `
80
- .${o} [data-chart=${t}] {
81
- --color-${e}: ${d.replace(/^hsl\((.*)\)$/, "$1")};
83
+ ` : r.theme ? Object.entries(r.theme).map(
84
+ ([i, c]) => `
85
+ .${i} [data-chart=${t}] {
86
+ --color-${e}: ${c.replace(/^hsl\((.*)\)$/, "$1")};
82
87
  }
83
88
  `
84
89
  ).join("") : "";
@@ -88,109 +93,109 @@ function T({ id: t, config: r }) {
88
93
  }
89
94
  ) : null;
90
95
  }
91
- function $(t) {
96
+ function R(t) {
92
97
  return t == null || t === "" ? !1 : typeof t == "number" ? Number.isFinite(t) : !0;
93
98
  }
94
- function A({ ...t }) {
95
- return /* @__PURE__ */ s(N.Tooltip, { ...t });
99
+ function M({ ...t }) {
100
+ return /* @__PURE__ */ o(_.Tooltip, { ...t });
96
101
  }
97
- A.displayName = "ChartTooltip";
98
- function W({
102
+ M.displayName = "ChartTooltip";
103
+ function E({
99
104
  active: t,
100
- payload: r,
101
- className: l,
105
+ payload: a,
106
+ className: s,
102
107
  indicator: e = "dot",
103
- hideLabel: n = !1,
104
- hideIndicator: a = !1,
105
- label: o,
106
- labelFormatter: d,
107
- labelClassName: i,
108
- formatter: u,
108
+ hideLabel: r = !1,
109
+ hideIndicator: n = !1,
110
+ label: i,
111
+ labelFormatter: c,
112
+ labelClassName: l,
113
+ formatter: f,
109
114
  color: h,
110
- nameKey: g,
115
+ nameKey: p,
111
116
  labelKey: m
112
117
  }) {
113
- const { config: C } = P(), x = k.useMemo(() => {
114
- if (n || !r?.length)
118
+ const { config: v } = P(), x = k.useMemo(() => {
119
+ if (r || !a?.length)
115
120
  return null;
116
- const [c] = r;
117
- if (!c)
121
+ const [d] = a;
122
+ if (!d)
118
123
  return null;
119
- const L = `${m || c.dataKey || c.name || "value"}`, y = C[L], v = !m && typeof o == "string" ? C[o]?.label || o : y?.label;
120
- return d ? /* @__PURE__ */ s("div", { className: p("font-medium", i), children: d(v, r) }) : v ? /* @__PURE__ */ s("div", { className: p("font-medium", i), children: v }) : null;
124
+ const N = `${m || d.dataKey || d.name || "value"}`, u = v[N], C = !m && typeof i == "string" ? v[i]?.label || i : u?.label;
125
+ return c ? /* @__PURE__ */ o("div", { className: b("font-medium", l), children: c(C, a) }) : C ? /* @__PURE__ */ o("div", { className: b("font-medium", l), children: C }) : null;
121
126
  }, [
122
- o,
123
- d,
124
- r,
125
- n,
126
127
  i,
127
- C,
128
+ c,
129
+ a,
130
+ r,
131
+ l,
132
+ v,
128
133
  m
129
134
  ]);
130
- if (!t || !r?.length)
135
+ if (!t || !a?.length)
131
136
  return null;
132
- const f = r.length === 1 && e !== "dot";
133
- return /* @__PURE__ */ b(
137
+ const g = a.length === 1 && e !== "dot";
138
+ return /* @__PURE__ */ y(
134
139
  "div",
135
140
  {
136
- className: p(
141
+ className: b(
137
142
  "border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",
138
- l
143
+ s
139
144
  ),
140
145
  "data-slot": "chart-tooltip-content",
141
146
  children: [
142
- f ? null : x,
143
- /* @__PURE__ */ s("div", { className: "grid gap-1.5", children: r.map((c, L) => {
144
- const y = `${g || c.name || c.dataKey || "value"}`, v = C[y], _ = h || c.color || c.payload.fill || `var(--color-${y})`;
145
- return /* @__PURE__ */ s(
147
+ g ? null : x,
148
+ /* @__PURE__ */ o("div", { className: "grid gap-1.5", children: a.map((d, N) => {
149
+ const u = `${p || d.name || d.dataKey || "value"}`, C = v[u], L = h || d.color || d.payload.fill || `var(--color-${u})`;
150
+ return /* @__PURE__ */ o(
146
151
  "div",
147
152
  {
148
- className: p(
153
+ className: b(
149
154
  "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",
150
155
  e === "dot" && "items-center"
151
156
  ),
152
157
  "data-slot": "chart-tooltip-item",
153
- children: u && $(c.value) && c.name ? u(c.value, c.name, c, L, r) : /* @__PURE__ */ b(S, { children: [
154
- v?.icon && !a ? /* @__PURE__ */ s(v.icon, { size: 10 }) : !a && /* @__PURE__ */ s(
158
+ children: f && R(d.value) && d.name ? f(d.value, d.name, d, N, a) : /* @__PURE__ */ y(T, { children: [
159
+ C?.icon && !n ? /* @__PURE__ */ o(C.icon, { size: 10 }) : !n && /* @__PURE__ */ o(
155
160
  "div",
156
161
  {
157
- className: p("shrink-0 rounded-[2px]", {
162
+ className: b("shrink-0 rounded-[2px]", {
158
163
  "h-2.5 w-2.5": e === "dot",
159
164
  "w-1": e === "line",
160
165
  "w-0 border-[1.5px] border-dashed bg-transparent": e === "dashed",
161
- "my-0.5": f && e === "dashed"
166
+ "my-0.5": g && e === "dashed"
162
167
  }),
163
168
  style: {
164
- backgroundColor: e === "dashed" ? "transparent" : _,
165
- borderColor: _
169
+ backgroundColor: e === "dashed" ? "transparent" : L,
170
+ borderColor: L
166
171
  }
167
172
  }
168
173
  ),
169
- /* @__PURE__ */ b(
174
+ /* @__PURE__ */ y(
170
175
  "div",
171
176
  {
172
- className: p(
177
+ className: b(
173
178
  "flex flex-1 justify-between gap-2 leading-none",
174
- f ? "items-end" : "items-center"
179
+ g ? "items-end" : "items-center"
175
180
  ),
176
181
  children: [
177
- /* @__PURE__ */ b("div", { className: "grid gap-1.5", children: [
178
- f ? x : null,
179
- /* @__PURE__ */ s(
182
+ /* @__PURE__ */ y("div", { className: "grid gap-1.5", children: [
183
+ g ? x : null,
184
+ /* @__PURE__ */ o(
180
185
  "span",
181
186
  {
182
187
  className: "text-muted-foreground",
183
188
  "data-slot": "chart-tooltip-item-name",
184
- children: v?.label || c.name
189
+ children: C?.label || d.name
185
190
  }
186
191
  )
187
192
  ] }),
188
- $(c.value) && /* @__PURE__ */ s(
193
+ R(d.value) && /* @__PURE__ */ o(
189
194
  "span",
190
195
  {
191
196
  className: "text-foreground tabular-nums",
192
197
  "data-slot": "chart-tooltip-item-value",
193
- children: typeof c.value == "number" ? c.value.toLocaleString() : c.value
198
+ children: typeof d.value == "number" ? d.value.toLocaleString() : d.value
194
199
  }
195
200
  )
196
201
  ]
@@ -198,225 +203,378 @@ function W({
198
203
  )
199
204
  ] })
200
205
  },
201
- c.dataKey
206
+ d.dataKey
202
207
  );
203
208
  }) })
204
209
  ]
205
210
  }
206
211
  );
207
212
  }
208
- W.displayName = "ChartTooltipContent";
209
- function D({ ...t }) {
210
- return /* @__PURE__ */ s(N.Legend, { ...t });
213
+ E.displayName = "ChartTooltipContent";
214
+ function Y({ ...t }) {
215
+ return /* @__PURE__ */ o(_.Legend, { ...t });
211
216
  }
212
- D.displayName = "ChartLegend";
213
- function G({
214
- className: t,
215
- hideIcon: r = !1,
216
- payload: l,
217
- verticalAlign: e = "bottom",
218
- nameKey: n
217
+ Y.displayName = "ChartLegend";
218
+ const S = k.forwardRef(
219
+ ({
220
+ asChild: t = !1,
221
+ children: a,
222
+ className: s,
223
+ color: e,
224
+ dataHook: r,
225
+ hidden: n = !1,
226
+ hideIcon: i = !1,
227
+ muted: c = !1,
228
+ seriesKey: l,
229
+ trackingEl: f,
230
+ trackingLabel: h,
231
+ value: p,
232
+ ...m
233
+ }, v) => {
234
+ const x = D(), g = l ? x?.config[l] : void 0, d = e ?? g?.color ?? (l ? `var(--color-${l})` : void 0), N = !!l && !e && (!x || !!x.standalone && !g?.color);
235
+ k.useEffect(() => {
236
+ process.env.NODE_ENV !== "production" && N && console.warn(
237
+ `ChartLegendItem: seriesKey="${l}" has no colour to resolve — render it inside a ChartContainer, give the ChartLegendList config a \`color\` for this key (a \`theme\` only resolves inside a container), or set \`color\`.`
238
+ );
239
+ }, [l, N]);
240
+ const u = t ? j : "div", C = a ?? g?.label ?? l;
241
+ return /* @__PURE__ */ y(
242
+ u,
243
+ {
244
+ ref: v,
245
+ className: b(
246
+ /* The focus ring is here rather than at each call site, so an
247
+ `asChild` button gets it without remembering to. */
248
+ "[&>svg]:text-muted-foreground focus-visible:shadow-default flex items-center gap-1.5 rounded-sm outline-none group-data-[size=md]/legend:gap-2 [&>svg]:size-3 group-data-[size=md]/legend:[&>svg]:size-3.5",
249
+ (c || n) && "text-muted-foreground",
250
+ /* text-decoration does not propagate into a nested <button>/<a>
251
+ (atomic inline-level boxes), so a trigger used as the label gets
252
+ the strike explicitly. */
253
+ n && "line-through [&_:is(button,a)]:line-through",
254
+ s
255
+ ),
256
+ "data-hidden": n || void 0,
257
+ "data-hook": r,
258
+ "data-muted": c || n || void 0,
259
+ "data-slot": "chart-legend-item",
260
+ "data-tracking-el": f,
261
+ "data-tracking-label": h,
262
+ ...m,
263
+ children: [
264
+ g?.icon && !i ? /* @__PURE__ */ o(g.icon, { size: 12 }) : (
265
+ /* A span, not a div: with `asChild` the item is often a button,
266
+ which only allows phrasing content. */
267
+ /* @__PURE__ */ o(
268
+ "span",
269
+ {
270
+ "aria-hidden": "true",
271
+ className: b(
272
+ "duration-fast block size-2 shrink-0 rounded-[2px] transition-opacity ease-out group-data-[size=md]/legend:size-2.5",
273
+ (c || n) && "opacity-40"
274
+ ),
275
+ "data-slot": "chart-legend-item-swatch",
276
+ style: { backgroundColor: d }
277
+ }
278
+ )
279
+ ),
280
+ /* @__PURE__ */ o(O, { children: C }),
281
+ p != null && /* @__PURE__ */ o(
282
+ "span",
283
+ {
284
+ className: "ml-auto pl-0.5 tabular-nums",
285
+ "data-slot": "chart-legend-item-value",
286
+ children: /* @__PURE__ */ o("span", { className: "inline-block", children: p })
287
+ }
288
+ )
289
+ ]
290
+ }
291
+ );
292
+ }
293
+ );
294
+ S.displayName = "ChartLegendItem";
295
+ const q = V("group/legend flex", {
296
+ variants: {
297
+ size: {
298
+ sm: "text-body-xs",
299
+ md: "text-body-sm"
300
+ },
301
+ orientation: {
302
+ /* Wraps: six or seven series do not fit one line on a phone, and
303
+ without wrapping the tail is simply clipped. */
304
+ horizontal: "flex-wrap items-center justify-center gap-x-4 gap-y-1",
305
+ /* Items stretch to the list's width so a value can sit at the far edge. */
306
+ vertical: "flex-col items-stretch gap-3"
307
+ }
308
+ },
309
+ defaultVariants: {
310
+ orientation: "horizontal",
311
+ size: "sm"
312
+ }
313
+ }), A = k.forwardRef(
314
+ ({
315
+ ariaLabel: t,
316
+ children: a,
317
+ className: s,
318
+ config: e,
319
+ dataHook: r,
320
+ orientation: n = "horizontal",
321
+ size: i = "sm",
322
+ trackingEl: c,
323
+ trackingLabel: l,
324
+ ...f
325
+ }, h) => {
326
+ const p = k.useMemo(
327
+ () => e ? { config: e, standalone: !0 } : null,
328
+ [e]
329
+ ), m = /* @__PURE__ */ o(
330
+ "div",
331
+ {
332
+ ref: h,
333
+ "aria-label": t ?? "Chart legend",
334
+ className: b(
335
+ q({ orientation: n, size: i }),
336
+ s
337
+ ),
338
+ "data-hook": r,
339
+ "data-orientation": n,
340
+ "data-size": i,
341
+ "data-slot": "chart-legend-list",
342
+ "data-tracking-el": c,
343
+ "data-tracking-label": l,
344
+ role: "group",
345
+ ...f,
346
+ children: a
347
+ }
348
+ );
349
+ return p ? /* @__PURE__ */ o(w.Provider, { value: p, children: m }) : m;
350
+ }
351
+ );
352
+ A.displayName = "ChartLegendList";
353
+ const F = (t) => t.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
354
+ function H({
355
+ ariaLabel: t,
356
+ className: a,
357
+ dataHook: s = "chart-legend",
358
+ hideIcon: e = !1,
359
+ nameKey: r,
360
+ orientation: n = "horizontal",
361
+ payload: i,
362
+ renderItem: c,
363
+ showValue: l = !1,
364
+ size: f = "sm",
365
+ sortBy: h,
366
+ valueFormatter: p,
367
+ valueKey: m,
368
+ verticalAlign: v = "bottom"
219
369
  }) {
220
- const { config: a } = P();
221
- return l?.length ? /* @__PURE__ */ s(
222
- "div",
370
+ const { config: x } = P();
371
+ if (!i?.length)
372
+ return null;
373
+ const g = (u) => String(
374
+ u.dataKey ?? (r ? u.payload?.[r] : void 0) ?? u.value
375
+ ), d = (u) => {
376
+ const C = Array.isArray(h) ? h.indexOf(g(u)) : -1;
377
+ return C === -1 ? Number.POSITIVE_INFINITY : C;
378
+ }, N = h ? [...i].sort(
379
+ Array.isArray(h) ? (u, C) => {
380
+ const L = d(u), $ = d(C);
381
+ return L === $ ? 0 : L - $;
382
+ } : h
383
+ ) : i;
384
+ return /* @__PURE__ */ o(
385
+ A,
223
386
  {
224
- className: p(
225
- "flex items-center justify-center gap-4",
226
- e === "top" ? "pb-4" : "pt-4",
227
- t
387
+ ariaLabel: t,
388
+ className: b(
389
+ v === "top" && "pb-4",
390
+ v === "bottom" && "pt-4",
391
+ a
228
392
  ),
229
393
  "data-slot": "chart-legend-content",
230
- children: l.map((o) => {
231
- const d = `${n || o.dataKey || "value"}`, i = a[d];
232
- return /* @__PURE__ */ b(
233
- "div",
394
+ dataHook: s,
395
+ orientation: n,
396
+ size: f,
397
+ children: N.map((u) => {
398
+ const C = g(u), L = x[C], $ = l ? p ? p(u) : u.payload?.[m ?? u.dataKey ?? "value"] : void 0, z = /* @__PURE__ */ o(
399
+ S,
234
400
  {
235
- className: p(
236
- "[&>svg]:text-muted-foreground flex items-center gap-1.5"
237
- ),
238
- children: [
239
- i?.icon && !r ? /* @__PURE__ */ s(i.icon, { size: 12 }) : /* @__PURE__ */ s(
240
- "div",
241
- {
242
- className: "h-2 w-2 shrink-0 rounded-[2px]",
243
- style: {
244
- backgroundColor: o.color
245
- }
246
- }
247
- ),
248
- i?.label || o.value
249
- ]
401
+ color: u.color,
402
+ dataHook: `${s}-${F(C)}`,
403
+ hideIcon: e,
404
+ seriesKey: C,
405
+ value: $,
406
+ children: L?.label || u.value
250
407
  },
251
- o.value
408
+ u.value
252
409
  );
410
+ return c ? /* @__PURE__ */ o(k.Fragment, { children: c(u, z) }, u.value) : z;
253
411
  })
254
412
  }
255
- ) : null;
413
+ );
256
414
  }
257
- G.displayName = "ChartLegendContent";
258
- function w({
415
+ H.displayName = "ChartLegendContent";
416
+ function I({
259
417
  colorKey: t,
260
- color: r,
261
- fill: l,
418
+ color: a,
419
+ fill: s,
262
420
  stroke: e,
263
- payload: n
421
+ payload: r
264
422
  }) {
265
- return (t && typeof n?.[t] == "string" ? n[t] : void 0) ?? r ?? l ?? e ?? "currentColor";
423
+ return (t && typeof r?.[t] == "string" ? r[t] : void 0) ?? a ?? s ?? e ?? "currentColor";
266
424
  }
267
- function M({
425
+ function X({
268
426
  size: t = 8,
269
- custom: r = !1,
270
- color: l,
427
+ custom: a = !1,
428
+ color: s,
271
429
  colorKey: e,
272
- cx: n,
273
- cy: a,
274
- stroke: o,
275
- fill: d,
276
- payload: i
430
+ cx: r,
431
+ cy: n,
432
+ stroke: i,
433
+ fill: c,
434
+ payload: l
277
435
  }) {
278
- if (n == null || a == null)
436
+ if (r == null || n == null)
279
437
  return null;
280
- const u = w({
438
+ const f = I({
281
439
  colorKey: e,
282
- color: l,
283
- fill: d,
284
- stroke: o,
285
- payload: i
440
+ color: s,
441
+ fill: c,
442
+ stroke: i,
443
+ payload: l
286
444
  });
287
- return /* @__PURE__ */ s(
445
+ return /* @__PURE__ */ o(
288
446
  "circle",
289
447
  {
290
- className: r ? "fill-background" : void 0,
291
- cx: n,
292
- cy: a,
448
+ className: a ? "fill-background" : void 0,
449
+ cx: r,
450
+ cy: n,
293
451
  "data-slot": "chart-dot",
294
- fill: r ? void 0 : u,
452
+ fill: a ? void 0 : f,
295
453
  r: t / 2,
296
- stroke: r ? u : "none",
297
- strokeWidth: r ? 2 : void 0
454
+ stroke: a ? f : "none",
455
+ strokeWidth: a ? 2 : void 0
298
456
  }
299
457
  );
300
458
  }
301
- M.displayName = "ChartDot";
302
- function z({
459
+ X.displayName = "ChartDot";
460
+ function J({
303
461
  size: t = 6,
304
- color: r,
305
- colorKey: l,
462
+ color: a,
463
+ colorKey: s,
306
464
  cx: e,
307
- cy: n,
308
- stroke: a,
309
- fill: o,
310
- payload: d
465
+ cy: r,
466
+ stroke: n,
467
+ fill: i,
468
+ payload: c
311
469
  }) {
312
- if (e == null || n == null)
470
+ if (e == null || r == null)
313
471
  return null;
314
- const i = w({
315
- colorKey: l,
316
- color: r,
317
- fill: o,
318
- stroke: a,
319
- payload: d
472
+ const l = I({
473
+ colorKey: s,
474
+ color: a,
475
+ fill: i,
476
+ stroke: n,
477
+ payload: c
320
478
  });
321
- return /* @__PURE__ */ s(
479
+ return /* @__PURE__ */ o(
322
480
  "circle",
323
481
  {
324
482
  className: "stroke-background",
325
483
  cx: e,
326
- cy: n,
484
+ cy: r,
327
485
  "data-slot": "chart-dot-on-stroke",
328
- fill: i,
486
+ fill: l,
329
487
  r: t / 2,
330
488
  strokeWidth: 2
331
489
  }
332
490
  );
333
491
  }
334
- z.displayName = "ChartDotOnStroke";
335
- function I({
492
+ J.displayName = "ChartDotOnStroke";
493
+ function Q({
336
494
  type: t = "default",
337
- filled: r = !1,
338
- fillColor: l = "var(--chart-teal)",
495
+ filled: a = !1,
496
+ fillColor: s = "var(--chart-teal)",
339
497
  fillOpacity: e = 0.2,
340
- boundaryOnly: n = !1,
341
- radialLines: a,
342
- className: o,
343
- ...d
498
+ boundaryOnly: r = !1,
499
+ radialLines: n,
500
+ className: i,
501
+ ...c
344
502
  }) {
345
- const i = t === "circle" ? "circle" : "polygon", h = n ? `[&_.${i === "circle" ? "recharts-polar-grid-concentric-circle" : "recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent` : void 0;
346
- return r ? /* @__PURE__ */ s(
347
- N.PolarGrid,
503
+ const l = t === "circle" ? "circle" : "polygon", h = r ? `[&_.${l === "circle" ? "recharts-polar-grid-concentric-circle" : "recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent` : void 0;
504
+ return a ? /* @__PURE__ */ o(
505
+ _.PolarGrid,
348
506
  {
349
- className: p(h, o),
350
- fill: l,
507
+ className: b(h, i),
508
+ fill: s,
351
509
  fillOpacity: e,
352
- gridType: i,
353
- radialLines: a ?? !1,
510
+ gridType: l,
511
+ radialLines: n ?? !1,
354
512
  stroke: "none",
355
- ...d
513
+ ...c
356
514
  }
357
- ) : /* @__PURE__ */ s(
358
- N.PolarGrid,
515
+ ) : /* @__PURE__ */ o(
516
+ _.PolarGrid,
359
517
  {
360
- className: p(h, o),
361
- gridType: i,
362
- radialLines: a,
363
- ...d
518
+ className: b(h, i),
519
+ gridType: l,
520
+ radialLines: n,
521
+ ...c
364
522
  }
365
523
  );
366
524
  }
367
- I.displayName = "ChartRadarGrid";
368
- function O({
525
+ Q.displayName = "ChartRadarGrid";
526
+ function U({
369
527
  type: t = "default",
370
- data: r,
371
- primaryKey: l,
528
+ data: a,
529
+ primaryKey: s,
372
530
  secondaryKey: e,
373
- x: n,
374
- y: a,
375
- textAnchor: o,
376
- payload: d,
377
- index: i
531
+ x: r,
532
+ y: n,
533
+ textAnchor: i,
534
+ payload: c,
535
+ index: l
378
536
  }) {
379
- const u = r != null && i != null ? r[i] : void 0, h = u && l != null ? u[l] : void 0, g = u && e != null ? u[e] : void 0, m = t === "default" && h != null ? g != null ? `${String(h)}/${String(g)}` : String(h) : null;
380
- return /* @__PURE__ */ b(
537
+ const f = a != null && l != null ? a[l] : void 0, h = f && s != null ? f[s] : void 0, p = f && e != null ? f[e] : void 0, m = t === "default" && h != null ? p != null ? `${String(h)}/${String(p)}` : String(h) : null;
538
+ return /* @__PURE__ */ y(
381
539
  "text",
382
540
  {
383
541
  className: "text-body-xs",
384
542
  "data-slot": "chart-radar-label-wrapper",
385
- textAnchor: o,
386
- x: n,
387
- y: a,
543
+ textAnchor: i,
544
+ x: r,
545
+ y: n,
388
546
  children: [
389
- m != null && /* @__PURE__ */ s("tspan", { className: "fill-card-foreground", dy: "-0.5em", x: n, children: m }),
390
- /* @__PURE__ */ s(
547
+ m != null && /* @__PURE__ */ o("tspan", { className: "fill-card-foreground", dy: "-0.5em", x: r, children: m }),
548
+ /* @__PURE__ */ o(
391
549
  "tspan",
392
550
  {
393
551
  className: "fill-muted-foreground",
394
552
  dy: m != null ? "1.2em" : void 0,
395
- x: n,
396
- children: d?.value
553
+ x: r,
554
+ children: c?.value
397
555
  }
398
556
  )
399
557
  ]
400
558
  }
401
559
  );
402
560
  }
403
- O.displayName = "ChartRadarLabelWrapper";
404
- function B({
561
+ U.displayName = "ChartRadarLabelWrapper";
562
+ function Z({
405
563
  nameKey: t,
406
- config: r,
407
- radiusRatio: l = 0.5,
564
+ config: a,
565
+ radiusRatio: s = 0.5,
408
566
  cx: e,
409
- cy: n,
410
- midAngle: a = 0,
411
- innerRadius: o = 0,
412
- outerRadius: d = 0,
413
- payload: i,
414
- name: u
567
+ cy: r,
568
+ midAngle: n = 0,
569
+ innerRadius: i = 0,
570
+ outerRadius: c = 0,
571
+ payload: l,
572
+ name: f
415
573
  }) {
416
- if (e == null || n == null)
574
+ if (e == null || r == null)
417
575
  return null;
418
- const h = Math.PI / 180, g = o + (d - o) * l, m = e + g * Math.cos(-a * h), C = n + g * Math.sin(-a * h), x = t != null && i != null ? i[t] : void 0, f = x != null ? String(x) : u, c = f != null ? r?.[f]?.label ?? f : f;
419
- return /* @__PURE__ */ s(
576
+ const h = Math.PI / 180, p = i + (c - i) * s, m = e + p * Math.cos(-n * h), v = r + p * Math.sin(-n * h), x = t != null && l != null ? l[t] : void 0, g = x != null ? String(x) : f, d = g != null ? a?.[g]?.label ?? g : g;
577
+ return /* @__PURE__ */ o(
420
578
  "text",
421
579
  {
422
580
  className: "fill-foreground text-body-xs",
@@ -424,123 +582,125 @@ function B({
424
582
  dominantBaseline: "middle",
425
583
  textAnchor: "middle",
426
584
  x: m,
427
- y: C,
428
- children: c
585
+ y: v,
586
+ children: d
429
587
  }
430
588
  );
431
589
  }
432
- B.displayName = "ChartPieLabelList";
433
- function V({
590
+ Z.displayName = "ChartPieLabelList";
591
+ function B({
434
592
  valueKey: t,
435
- x: r,
436
- y: l,
593
+ x: a,
594
+ y: s,
437
595
  textAnchor: e,
438
- payload: n,
439
- value: a
596
+ payload: r,
597
+ value: n
440
598
  }) {
441
- if (r == null || l == null)
599
+ if (a == null || s == null)
442
600
  return null;
443
- const o = t != null && n != null ? n[t] : a;
444
- return /* @__PURE__ */ s(
601
+ const i = t != null && r != null ? r[t] : n;
602
+ return /* @__PURE__ */ o(
445
603
  "text",
446
604
  {
447
605
  className: "fill-foreground text-body-xs",
448
606
  "data-slot": "chart-pie-label-wrapper",
449
607
  dominantBaseline: "middle",
450
608
  textAnchor: e,
451
- x: r,
452
- y: l,
453
- children: o
609
+ x: a,
610
+ y: s,
611
+ children: i
454
612
  }
455
613
  );
456
614
  }
457
- V.displayName = "ChartPieLabelWrapper";
458
- const q = {
615
+ B.displayName = "ChartPieLabelWrapper";
616
+ const K = {
459
617
  "2xl": "text-metric",
460
618
  "3xl": "font-sans text-3xl font-semibold",
461
619
  "4xl": "font-sans text-4xl font-semibold"
462
620
  };
463
- function E({
621
+ function ee({
464
622
  primary: t,
465
- secondary: r,
466
- size: l = "3xl",
623
+ secondary: a,
624
+ size: s = "3xl",
467
625
  viewBox: e
468
626
  }) {
469
627
  if (e == null || typeof e != "object" || !("cx" in e) || !("cy" in e))
470
628
  return null;
471
- const { cx: n, cy: a } = e;
472
- return /* @__PURE__ */ b(
629
+ const { cx: r, cy: n } = e;
630
+ return /* @__PURE__ */ y(
473
631
  "text",
474
632
  {
475
633
  "data-slot": "chart-center-label",
476
634
  dominantBaseline: "middle",
477
635
  textAnchor: "middle",
478
- x: n,
479
- y: a,
636
+ x: r,
637
+ y: n,
480
638
  children: [
481
- /* @__PURE__ */ s(
639
+ /* @__PURE__ */ o(
482
640
  "tspan",
483
641
  {
484
- className: p("fill-foreground", q[l]),
485
- x: n,
486
- y: a,
642
+ className: b("fill-foreground", K[s]),
643
+ x: r,
644
+ y: n,
487
645
  children: t
488
646
  }
489
647
  ),
490
- r != null && /* @__PURE__ */ s(
648
+ a != null && /* @__PURE__ */ o(
491
649
  "tspan",
492
650
  {
493
651
  className: "fill-muted-foreground text-body-xs",
494
- x: n,
495
- y: a + 24,
496
- children: r
652
+ x: r,
653
+ y: n + 24,
654
+ children: a
497
655
  }
498
656
  )
499
657
  ]
500
658
  }
501
659
  );
502
660
  }
503
- E.displayName = "ChartCenterLabel";
661
+ ee.displayName = "ChartCenterLabel";
504
662
  export {
505
- J as Area,
506
- Q as AreaChart,
507
- U as Bar,
508
- Z as BarChart,
509
- K as CartesianGrid,
510
- ee as Cell,
511
- E as ChartCenterLabel,
512
- j as ChartContainer,
513
- M as ChartDot,
514
- z as ChartDotOnStroke,
515
- te as ChartLabel,
516
- D as ChartLegend,
517
- G as ChartLegendContent,
518
- B as ChartPieLabelList,
519
- V as ChartPieLabelWrapper,
520
- I as ChartRadarGrid,
521
- O as ChartRadarLabelWrapper,
522
- T as ChartStyle,
523
- A as ChartTooltip,
524
- W as ChartTooltipContent,
525
- re as ChartsLegend,
526
- ne as ChartsTooltip,
527
- ae as Customized,
528
- le as LabelList,
529
- oe as Line,
530
- se as LineChart,
531
- ie as Pie,
532
- ce as PieChart,
533
- de as PolarAngleAxis,
534
- ue as PolarGrid,
535
- he as PolarRadiusAxis,
536
- fe as Radar,
537
- pe as RadarChart,
538
- me as RadialBar,
539
- ge as RadialBarChart,
540
- Ce as Rectangle,
541
- be as ReferenceLine,
542
- xe as ResponsiveContainer,
543
- ve as Sector,
544
- ke as XAxis,
545
- Ne as YAxis
663
+ se as Area,
664
+ ie as AreaChart,
665
+ ce as Bar,
666
+ de as BarChart,
667
+ ue as CartesianGrid,
668
+ he as Cell,
669
+ ee as ChartCenterLabel,
670
+ W as ChartContainer,
671
+ X as ChartDot,
672
+ J as ChartDotOnStroke,
673
+ fe as ChartLabel,
674
+ Y as ChartLegend,
675
+ H as ChartLegendContent,
676
+ S as ChartLegendItem,
677
+ A as ChartLegendList,
678
+ Z as ChartPieLabelList,
679
+ B as ChartPieLabelWrapper,
680
+ Q as ChartRadarGrid,
681
+ U as ChartRadarLabelWrapper,
682
+ G as ChartStyle,
683
+ M as ChartTooltip,
684
+ E as ChartTooltipContent,
685
+ ge as ChartsLegend,
686
+ pe as ChartsTooltip,
687
+ me as Customized,
688
+ Ce as LabelList,
689
+ be as Line,
690
+ ve as LineChart,
691
+ xe as Pie,
692
+ ke as PieChart,
693
+ Ne as PolarAngleAxis,
694
+ ye as PolarGrid,
695
+ Le as PolarRadiusAxis,
696
+ _e as Radar,
697
+ $e as RadarChart,
698
+ we as RadialBar,
699
+ ze as RadialBarChart,
700
+ Re as Rectangle,
701
+ Pe as ReferenceLine,
702
+ Se as ResponsiveContainer,
703
+ Ae as Sector,
704
+ Ie as XAxis,
705
+ Te as YAxis
546
706
  };