@carto/ps-react-ui 4.17.3 → 4.18.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 (74) hide show
  1. package/dist/category-Ct2BzADB.js +753 -0
  2. package/dist/category-Ct2BzADB.js.map +1 -0
  3. package/dist/change-column-Bhcxmp-r.js +1148 -0
  4. package/dist/change-column-Bhcxmp-r.js.map +1 -0
  5. package/dist/echart-B10dhEaM.js +262 -0
  6. package/dist/echart-B10dhEaM.js.map +1 -0
  7. package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +15 -5
  8. package/dist/types/widgets-v2/category/components/category-legend.d.ts +18 -2
  9. package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +6 -1
  10. package/dist/types/widgets-v2/category/style.d.ts +8 -0
  11. package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +10 -4
  12. package/dist/types/widgets-v2/histogram/index.d.ts +1 -1
  13. package/dist/types/widgets-v2/histogram/transforms.d.ts +11 -0
  14. package/dist/types/widgets-v2/histogram/types.d.ts +9 -0
  15. package/dist/types/widgets-v2/scatterplot/index.d.ts +1 -1
  16. package/dist/types/widgets-v2/scatterplot/transforms.d.ts +9 -0
  17. package/dist/types/widgets-v2/table/index.d.ts +1 -0
  18. package/dist/types/widgets-v2/table/transforms.d.ts +13 -0
  19. package/dist/types/widgets-v2/table/transforms.test.d.ts +1 -0
  20. package/dist/types/widgets-v2/timeseries/index.d.ts +1 -0
  21. package/dist/types/widgets-v2/timeseries/transforms.d.ts +10 -0
  22. package/dist/types/widgets-v2/timeseries/transforms.test.d.ts +1 -0
  23. package/dist/widgets-v2/actions.js +1 -1
  24. package/dist/widgets-v2/category.js +1 -1
  25. package/dist/widgets-v2/echart.js +1 -1
  26. package/dist/widgets-v2/echart.js.map +1 -1
  27. package/dist/widgets-v2/histogram.js +181 -158
  28. package/dist/widgets-v2/histogram.js.map +1 -1
  29. package/dist/widgets-v2/pie.js +155 -116
  30. package/dist/widgets-v2/pie.js.map +1 -1
  31. package/dist/widgets-v2/scatterplot.js +91 -85
  32. package/dist/widgets-v2/scatterplot.js.map +1 -1
  33. package/dist/widgets-v2/table.js +55 -45
  34. package/dist/widgets-v2/table.js.map +1 -1
  35. package/dist/widgets-v2/timeseries.js +96 -85
  36. package/dist/widgets-v2/timeseries.js.map +1 -1
  37. package/dist/widgets-v2.js +4 -4
  38. package/package.json +1 -1
  39. package/src/widgets-v2/actions/lock-selection/lock-selection.test.tsx +62 -0
  40. package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +45 -13
  41. package/src/widgets-v2/category/category-ui.test.tsx +55 -0
  42. package/src/widgets-v2/category/category-ui.tsx +65 -6
  43. package/src/widgets-v2/category/components/category-legend.test.tsx +53 -2
  44. package/src/widgets-v2/category/components/category-legend.tsx +55 -12
  45. package/src/widgets-v2/category/components/category-row-stacked.test.tsx +7 -3
  46. package/src/widgets-v2/category/components/category-row-stacked.tsx +8 -3
  47. package/src/widgets-v2/category/style.ts +10 -2
  48. package/src/widgets-v2/echart/echart-ui.test.tsx +25 -0
  49. package/src/widgets-v2/echart/echart-ui.tsx +20 -0
  50. package/src/widgets-v2/echart/use-chart-selection.test.tsx +3 -1
  51. package/src/widgets-v2/echart/use-chart-selection.ts +10 -4
  52. package/src/widgets-v2/histogram/index.ts +4 -1
  53. package/src/widgets-v2/histogram/options.test.ts +86 -0
  54. package/src/widgets-v2/histogram/options.ts +50 -0
  55. package/src/widgets-v2/histogram/transforms.test.ts +36 -1
  56. package/src/widgets-v2/histogram/transforms.ts +23 -0
  57. package/src/widgets-v2/histogram/types.ts +9 -0
  58. package/src/widgets-v2/pie/options.test.ts +262 -0
  59. package/src/widgets-v2/pie/options.ts +80 -5
  60. package/src/widgets-v2/scatterplot/index.ts +4 -1
  61. package/src/widgets-v2/scatterplot/transforms.test.ts +38 -1
  62. package/src/widgets-v2/scatterplot/transforms.ts +23 -0
  63. package/src/widgets-v2/table/index.ts +1 -0
  64. package/src/widgets-v2/table/transforms.test.ts +40 -0
  65. package/src/widgets-v2/table/transforms.ts +26 -0
  66. package/src/widgets-v2/timeseries/index.ts +1 -0
  67. package/src/widgets-v2/timeseries/transforms.test.ts +49 -0
  68. package/src/widgets-v2/timeseries/transforms.ts +31 -0
  69. package/dist/category-CGS_eHr4.js +0 -719
  70. package/dist/category-CGS_eHr4.js.map +0 -1
  71. package/dist/change-column-CiVAjOUB.js +0 -1143
  72. package/dist/change-column-CiVAjOUB.js.map +0 -1
  73. package/dist/echart-Bdvbfx9s.js +0 -250
  74. package/dist/echart-Bdvbfx9s.js.map +0 -1
@@ -0,0 +1,753 @@
1
+ import { jsx as w, jsxs as V } from "react/jsx-runtime";
2
+ import { c as P } from "react/compiler-runtime";
3
+ import { useRef as $e, useState as ke } from "react";
4
+ import { u as Ae } from "./widget-context-DTGO0Yta.js";
5
+ import { u as Oe } from "./widget-store-registry-_W4Z4xp-.js";
6
+ import "zustand";
7
+ import { Box as T, Typography as E, useTheme as Ne } from "@mui/material";
8
+ import "./lasso-tool-YLFRgb-S.js";
9
+ import "./cjs-D4KH3azB.js";
10
+ import { T as He } from "./tooltip-BDnrRKrp.js";
11
+ import "@mui/icons-material";
12
+ import "@carto/ps-utils";
13
+ const Be = {
14
+ small: {
15
+ position: "relative",
16
+ height: 4,
17
+ bgcolor: "action.hover",
18
+ borderRadius: 1,
19
+ overflow: "hidden",
20
+ transition: "background-color 150ms ease"
21
+ },
22
+ medium: {
23
+ position: "relative",
24
+ height: 12,
25
+ bgcolor: "action.hover",
26
+ borderRadius: 0.25,
27
+ overflow: "hidden",
28
+ transition: "background-color 150ms ease"
29
+ }
30
+ }, We = {
31
+ small: {
32
+ position: "absolute",
33
+ inset: "0 auto 0 0",
34
+ borderRadius: 1,
35
+ transition: "width 300ms ease-in-out, background-color 150ms ease, filter 150ms ease"
36
+ },
37
+ medium: {
38
+ position: "absolute",
39
+ inset: "0 auto 0 0",
40
+ borderRadius: 0.25,
41
+ transition: "width 300ms ease-in-out, background-color 150ms ease, filter 150ms ease"
42
+ }
43
+ }, ze = {
44
+ small: {
45
+ position: "absolute",
46
+ top: 0,
47
+ bottom: 0,
48
+ transition: "left 300ms ease-in-out, width 300ms ease-in-out, background-color 150ms ease, filter 150ms ease"
49
+ },
50
+ medium: {
51
+ position: "absolute",
52
+ top: 0,
53
+ bottom: 0,
54
+ transition: "left 300ms ease-in-out, width 300ms ease-in-out, background-color 150ms ease, filter 150ms ease"
55
+ }
56
+ }, b = {
57
+ // ── Top-level container ────────────────────────────────────────────
58
+ root: {
59
+ display: "flex",
60
+ flexDirection: "column",
61
+ position: "relative",
62
+ width: "100%"
63
+ },
64
+ // Flat list of category rows. Holds both single + multi rows.
65
+ list: {
66
+ display: "flex",
67
+ flexDirection: "column",
68
+ gap: 1,
69
+ py: 0.5
70
+ },
71
+ // Layered on `list` only in scroll mode (`maxItems === 0`): right padding
72
+ // so the bars + right-aligned values clear the scrollbar. Right side only
73
+ // — the left edge stays at 0 so content stays aligned with the capped
74
+ // view. `overflowY` + the dynamic `maxHeight` remain on the inline style.
75
+ listScroll: {
76
+ pr: 1
77
+ },
78
+ // ── Single-series row ─────────────────────────────────────────────
79
+ // v1 layout: label + value share a top flex row (justify-between); the
80
+ // bar fills the row width below. Mirrors `rowMulti` for visual
81
+ // consistency.
82
+ rowSingle: {
83
+ display: "flex",
84
+ flexDirection: "column",
85
+ gap: 0.5,
86
+ // py: 0.5,
87
+ // px: 0.5,
88
+ cursor: "pointer",
89
+ userSelect: "none",
90
+ transition: "background-color 80ms ease",
91
+ // Hovering anywhere in the row also brightens the bar fill, matching
92
+ // what the bar got from `bar:hover` before. `data-bar-fill` is set
93
+ // on `barFill` by <CategoryBar>; descendant selector reaches it
94
+ // through `bar` in single rows and through `multiBarRow > bar` in
95
+ // multi rows.
96
+ '&:hover [data-bar-fill="true"]': {
97
+ filter: "brightness(1.2)"
98
+ },
99
+ "&:focus-visible": {
100
+ outline: "2px solid",
101
+ outlineColor: "primary.main",
102
+ outlineOffset: -2
103
+ }
104
+ },
105
+ // Top row of `rowSingle`: label on the left, value on the right.
106
+ rowHeader: {
107
+ display: "flex",
108
+ justifyContent: "space-between",
109
+ alignItems: "center",
110
+ gap: 1
111
+ },
112
+ // ── Multi-series row ──────────────────────────────────────────────
113
+ // Flex column: label fills the top row; bar+value pairs stack below.
114
+ // Bars get full track width — better legibility for N>=2 series than a
115
+ // shared grid would give.
116
+ rowMulti: {
117
+ display: "flex",
118
+ flexDirection: "column",
119
+ gap: 0.5,
120
+ // py: 0.5,
121
+ // px: 0.5,
122
+ cursor: "pointer",
123
+ userSelect: "none",
124
+ transition: "background-color 80ms ease",
125
+ // Row-hover brightens every bar fill inside the multi-row.
126
+ '&:hover [data-bar-fill="true"]': {
127
+ filter: "brightness(1.2)"
128
+ },
129
+ "&:focus-visible": {
130
+ outline: "2px solid",
131
+ outlineColor: "primary.main",
132
+ outlineOffset: -2
133
+ }
134
+ },
135
+ // ── Row labels / values ───────────────────────────────────────────
136
+ // Matches v1: name uses medium-weight body2 in primary text color,
137
+ // value uses regular body2 in secondary text color. Same font size,
138
+ // visual hierarchy via weight + color.
139
+ name: {
140
+ overflow: "hidden",
141
+ whiteSpace: "nowrap",
142
+ textOverflow: "ellipsis",
143
+ color: "text.primary",
144
+ fontWeight: "medium"
145
+ },
146
+ multiName: {
147
+ overflow: "hidden",
148
+ whiteSpace: "nowrap",
149
+ textOverflow: "ellipsis",
150
+ color: "text.primary",
151
+ fontWeight: "medium"
152
+ },
153
+ value: {
154
+ color: "text.secondary",
155
+ fontVariantNumeric: "tabular-nums",
156
+ // Right-align + minWidth keeps `rowMulti`'s per-bar value column
157
+ // tidy (where the bar grows on the left and the number sits at a
158
+ // fixed right edge). `rowSingle` uses `rowHeader`'s flex
159
+ // justify-between to push the value to the trailing edge, so the
160
+ // minWidth here is also harmless in that context.
161
+ minWidth: 48,
162
+ textAlign: "right"
163
+ },
164
+ // ── Bar (track + fill) ────────────────────────────────────────────
165
+ // Size-keyed maps live above the `styles` object; `<CategoryBar>` picks
166
+ // the variant via its `size` prop. Hover brightening still fires from
167
+ // the parent row (`&:hover [data-bar-fill]`), so it works regardless
168
+ // of which size variant the bar uses.
169
+ bar: Be,
170
+ barFill: We,
171
+ stackedSegment: ze,
172
+ // ── Multi-series internals ────────────────────────────────────────
173
+ // One [bar | value] flex row per series, inside `rowMulti`'s column.
174
+ multiBarRow: {
175
+ display: "flex",
176
+ alignItems: "center",
177
+ gap: 1
178
+ },
179
+ multiBarContainer: {
180
+ flex: 1
181
+ },
182
+ // ── Stacked-mode row ──────────────────────────────────────────────
183
+ // Mirror `rowMulti`'s outer shape (click target + hover brightening +
184
+ // focus ring) but stack three children vertically: header line, bar,
185
+ // breakdown line.
186
+ rowStacked: {
187
+ display: "flex",
188
+ flexDirection: "column",
189
+ gap: 0.5,
190
+ cursor: "pointer",
191
+ userSelect: "none",
192
+ transition: "background-color 80ms ease",
193
+ '&:hover [data-bar-fill="true"]': {
194
+ filter: "brightness(1.2)"
195
+ },
196
+ "&:focus-visible": {
197
+ outline: "2px solid",
198
+ outlineColor: "primary.main",
199
+ outlineOffset: -2
200
+ }
201
+ },
202
+ stackedHeader: {
203
+ display: "flex",
204
+ justifyContent: "space-between",
205
+ alignItems: "center",
206
+ gap: 1
207
+ },
208
+ // Right-aligned total in the header. Tabular-nums keeps totals lined
209
+ // up vertically across rows; minWidth reuses the per-series-value
210
+ // column width so the right edge sits at the same spot as `rowMulti`'s
211
+ // value column when both modes co-exist in the same widget card.
212
+ stackedTotal: {
213
+ color: "text.primary",
214
+ fontWeight: "medium",
215
+ fontVariantNumeric: "tabular-nums",
216
+ minWidth: 48,
217
+ textAlign: "right"
218
+ },
219
+ // Flex row of "{seriesName}: {value}" pairs. Wraps gracefully when
220
+ // series names are long or there are many series.
221
+ stackedBreakdown: {
222
+ display: "flex",
223
+ flexWrap: "wrap",
224
+ columnGap: 2,
225
+ rowGap: 0.25
226
+ },
227
+ stackedBreakdownItem: {
228
+ color: "text.secondary",
229
+ fontVariantNumeric: "tabular-nums"
230
+ },
231
+ // ── Legend (sticky bottom) ────────────────────────────────────────
232
+ legend: {
233
+ display: "flex",
234
+ alignItems: "center",
235
+ gap: 2,
236
+ flexWrap: "wrap",
237
+ pt: 2,
238
+ mt: 2,
239
+ position: "sticky",
240
+ bottom: 0,
241
+ bgcolor: "background.paper",
242
+ borderTop: (u) => `1px solid ${u.palette.divider}`
243
+ },
244
+ legendItem: {
245
+ display: "flex",
246
+ alignItems: "center",
247
+ gap: 1,
248
+ cursor: "pointer"
249
+ },
250
+ legendItemHidden: {
251
+ display: "flex",
252
+ alignItems: "center",
253
+ gap: 1,
254
+ cursor: "pointer",
255
+ opacity: 0.5
256
+ },
257
+ legendDot: {
258
+ width: 14,
259
+ height: 14,
260
+ borderRadius: "50%"
261
+ },
262
+ legendLabel: {
263
+ color: "text.secondary",
264
+ textTransform: "uppercase",
265
+ fontWeight: "medium"
266
+ },
267
+ // ── "Other" overflow row ──────────────────────────────────────────
268
+ // Left-aligned `Others <count>` — the label sits next to a muted count
269
+ // (no parentheses). Only the label is the click target when interactive;
270
+ // the count is always static text beside it.
271
+ otherRow: {
272
+ display: "flex",
273
+ alignItems: "center",
274
+ gap: 1,
275
+ py: 0.5,
276
+ px: 0.5
277
+ },
278
+ // Interactive affordances layered onto the "Others" label only (cursor,
279
+ // hover tint, focus ring). A negative LEFT margin + matching padding keep
280
+ // the hover pill breathing without shifting the label's text edge (it
281
+ // stays aligned with the category rows above). No right margin, so the
282
+ // row `gap` is preserved between the pill and the count.
283
+ otherLabelButton: {
284
+ cursor: "pointer",
285
+ userSelect: "none",
286
+ borderRadius: 1,
287
+ px: 0.5,
288
+ ml: -0.5,
289
+ transition: "background-color 80ms ease",
290
+ "&:hover": {
291
+ bgcolor: "action.hover"
292
+ },
293
+ "&:focus-visible": {
294
+ outline: "2px solid",
295
+ outlineColor: "primary.main",
296
+ outlineOffset: 2
297
+ }
298
+ },
299
+ otherLabel: {
300
+ color: "text.primary",
301
+ fontWeight: "medium"
302
+ },
303
+ otherCount: {
304
+ color: "text.secondary",
305
+ fontVariantNumeric: "tabular-nums"
306
+ }
307
+ // `bar` / `barFill` are size-keyed (`Record<CategorySize, SxProps>`);
308
+ // every other entry is a single `SxProps<Theme>`. The mixed shape means
309
+ // we can't apply the file-wide `satisfies Record<string, SxProps<Theme>>`
310
+ // constraint that the other widget style files use — consumers of
311
+ // individual tokens still get full type-checking at the call site via
312
+ // the typed `Box`/`Typography` `sx` prop.
313
+ };
314
+ function Ie(u) {
315
+ const e = P(10), {
316
+ value: o,
317
+ maxValue: a,
318
+ color: n,
319
+ size: d
320
+ } = u, l = d === void 0 ? "small" : d, t = a > 0 ? o / a * 100 : 0, x = b.bar[l], r = b.barFill[l], m = `${t}%`;
321
+ let i;
322
+ e[0] !== n || e[1] !== m ? (i = {
323
+ width: m,
324
+ backgroundColor: n
325
+ }, e[0] = n, e[1] = m, e[2] = i) : i = e[2];
326
+ let c;
327
+ e[3] !== r || e[4] !== i ? (c = /* @__PURE__ */ w(T, { sx: r, style: i, "data-bar-fill": "true" }), e[3] = r, e[4] = i, e[5] = c) : c = e[5];
328
+ let s;
329
+ return e[6] !== l || e[7] !== x || e[8] !== c ? (s = /* @__PURE__ */ w(T, { sx: x, "data-size": l, children: c }), e[6] = l, e[7] = x, e[8] = c, e[9] = s) : s = e[9], s;
330
+ }
331
+ function Fe(u) {
332
+ const e = P(27), {
333
+ name: o,
334
+ displayName: a,
335
+ value: n,
336
+ maxValue: d,
337
+ color: l,
338
+ formatter: t,
339
+ selected: x,
340
+ onToggle: r,
341
+ size: m
342
+ } = u;
343
+ let i;
344
+ e[0] !== o || e[1] !== r ? (i = (C) => {
345
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), r(o));
346
+ }, e[0] = o, e[1] = r, e[2] = i) : i = e[2];
347
+ const c = i;
348
+ let s;
349
+ e[3] !== o || e[4] !== r ? (s = () => r(o), e[3] = o, e[4] = r, e[5] = s) : s = e[5];
350
+ const p = a ?? o;
351
+ let f;
352
+ e[6] !== p ? (f = /* @__PURE__ */ w(E, { variant: "body2", sx: b.name, children: p }), e[6] = p, e[7] = f) : f = e[7];
353
+ let v;
354
+ e[8] !== t || e[9] !== n ? (v = t(n), e[8] = t, e[9] = n, e[10] = v) : v = e[10];
355
+ let h;
356
+ e[11] !== v ? (h = /* @__PURE__ */ w(E, { variant: "body2", sx: b.value, children: v }), e[11] = v, e[12] = h) : h = e[12];
357
+ let g;
358
+ e[13] !== f || e[14] !== h ? (g = /* @__PURE__ */ V(T, { sx: b.rowHeader, children: [
359
+ f,
360
+ h
361
+ ] }), e[13] = f, e[14] = h, e[15] = g) : g = e[15];
362
+ let k;
363
+ e[16] !== l || e[17] !== d || e[18] !== m || e[19] !== n ? (k = /* @__PURE__ */ w(Ie, { value: n, maxValue: d, color: l, size: m }), e[16] = l, e[17] = d, e[18] = m, e[19] = n, e[20] = k) : k = e[20];
364
+ let y;
365
+ return e[21] !== c || e[22] !== x || e[23] !== s || e[24] !== g || e[25] !== k ? (y = /* @__PURE__ */ V(T, { role: "button", "aria-pressed": x, tabIndex: 0, onClick: s, onKeyDown: c, sx: b.rowSingle, children: [
366
+ g,
367
+ k
368
+ ] }), e[21] = c, e[22] = x, e[23] = s, e[24] = g, e[25] = k, e[26] = y) : y = e[26], y;
369
+ }
370
+ function Ke(u) {
371
+ const e = P(27), {
372
+ name: o,
373
+ displayName: a,
374
+ values: n,
375
+ colors: d,
376
+ maxValue: l,
377
+ formatter: t,
378
+ selected: x,
379
+ onToggle: r,
380
+ size: m
381
+ } = u;
382
+ let i;
383
+ e[0] !== o || e[1] !== r ? (i = (g) => {
384
+ (g.key === "Enter" || g.key === " ") && (g.preventDefault(), r(o));
385
+ }, e[0] = o, e[1] = r, e[2] = i) : i = e[2];
386
+ const c = i;
387
+ let s;
388
+ e[3] !== o || e[4] !== r ? (s = () => r(o), e[3] = o, e[4] = r, e[5] = s) : s = e[5];
389
+ const p = a ?? o;
390
+ let f;
391
+ e[6] !== p ? (f = /* @__PURE__ */ w(E, { variant: "body2", sx: b.multiName, children: p }), e[6] = p, e[7] = f) : f = e[7];
392
+ let v;
393
+ if (e[8] !== d || e[9] !== t || e[10] !== l || e[11] !== o || e[12] !== m || e[13] !== n) {
394
+ let g;
395
+ e[15] !== d || e[16] !== t || e[17] !== l || e[18] !== o || e[19] !== m ? (g = (k, y) => /* @__PURE__ */ V(T, { sx: b.multiBarRow, children: [
396
+ /* @__PURE__ */ w(T, { sx: b.multiBarContainer, children: /* @__PURE__ */ w(Ie, { value: k, maxValue: l, color: d[y] ?? "", size: m }) }),
397
+ /* @__PURE__ */ w(E, { variant: "body2", sx: b.value, children: t(k) })
398
+ ] }, `${o}-series-${y}`), e[15] = d, e[16] = t, e[17] = l, e[18] = o, e[19] = m, e[20] = g) : g = e[20], v = n.map(g), e[8] = d, e[9] = t, e[10] = l, e[11] = o, e[12] = m, e[13] = n, e[14] = v;
399
+ } else
400
+ v = e[14];
401
+ let h;
402
+ return e[21] !== c || e[22] !== x || e[23] !== s || e[24] !== f || e[25] !== v ? (h = /* @__PURE__ */ V(T, { role: "button", "aria-pressed": x, tabIndex: 0, onClick: s, onKeyDown: c, sx: b.rowMulti, children: [
403
+ f,
404
+ v
405
+ ] }), e[21] = c, e[22] = x, e[23] = s, e[24] = f, e[25] = v, e[26] = h) : h = e[26], h;
406
+ }
407
+ function Me(u) {
408
+ const e = P(17), {
409
+ values: o,
410
+ colors: a,
411
+ maxValue: n,
412
+ size: d
413
+ } = u, l = d === void 0 ? "small" : d;
414
+ let t;
415
+ if (e[0] !== o) {
416
+ t = [];
417
+ let i = 0;
418
+ for (const c of o)
419
+ t.push(i), i = i + c;
420
+ e[0] = o, e[1] = t;
421
+ } else
422
+ t = e[1];
423
+ const x = b.bar[l];
424
+ let r;
425
+ if (e[2] !== a || e[3] !== n || e[4] !== t || e[5] !== l || e[6] !== o) {
426
+ let i;
427
+ e[8] !== a || e[9] !== n || e[10] !== t || e[11] !== l ? (i = (c, s) => {
428
+ if (c <= 0)
429
+ return null;
430
+ const p = n > 0 ? t[s] / n * 100 : 0, f = n > 0 ? c / n * 100 : 0;
431
+ return /* @__PURE__ */ w(T, { sx: b.stackedSegment[l], style: {
432
+ left: `${p}%`,
433
+ width: `${f}%`,
434
+ backgroundColor: a[s] ?? ""
435
+ }, "data-bar-fill": "true" }, `seg-${a[s] ?? "none"}-${s}`);
436
+ }, e[8] = a, e[9] = n, e[10] = t, e[11] = l, e[12] = i) : i = e[12], r = o.map(i), e[2] = a, e[3] = n, e[4] = t, e[5] = l, e[6] = o, e[7] = r;
437
+ } else
438
+ r = e[7];
439
+ let m;
440
+ return e[13] !== l || e[14] !== x || e[15] !== r ? (m = /* @__PURE__ */ w(T, { sx: x, "data-size": l, children: r }), e[13] = l, e[14] = x, e[15] = r, e[16] = m) : m = e[16], m;
441
+ }
442
+ function Ee(u) {
443
+ const e = P(65), {
444
+ name: o,
445
+ displayName: a,
446
+ values: n,
447
+ colors: d,
448
+ seriesNames: l,
449
+ formatter: t,
450
+ selected: x,
451
+ onToggle: r,
452
+ size: m
453
+ } = u;
454
+ let i;
455
+ e[0] !== o || e[1] !== r ? (i = (D) => {
456
+ (D.key === "Enter" || D.key === " ") && (D.preventDefault(), r(o));
457
+ }, e[0] = o, e[1] = r, e[2] = i) : i = e[2];
458
+ const c = i;
459
+ let s, p, f, v, h, g, k, y, C, j, $, H, _, A, B;
460
+ if (e[3] !== a || e[4] !== t || e[5] !== c || e[6] !== o || e[7] !== r || e[8] !== x || e[9] !== n) {
461
+ B = n.reduce(Ve, 0), f = T, H = "button", _ = x, A = 0, e[25] !== o || e[26] !== r ? (v = () => r(o), e[25] = o, e[26] = r, e[27] = v) : v = e[27], h = c, g = b.rowStacked, p = T, j = b.stackedHeader;
462
+ const D = a ?? o;
463
+ e[28] !== D ? ($ = /* @__PURE__ */ w(E, { variant: "body2", sx: b.multiName, children: D }), e[28] = D, e[29] = $) : $ = e[29], s = E, k = "body2", y = b.stackedTotal, C = t(B), e[3] = a, e[4] = t, e[5] = c, e[6] = o, e[7] = r, e[8] = x, e[9] = n, e[10] = s, e[11] = p, e[12] = f, e[13] = v, e[14] = h, e[15] = g, e[16] = k, e[17] = y, e[18] = C, e[19] = j, e[20] = $, e[21] = H, e[22] = _, e[23] = A, e[24] = B;
464
+ } else
465
+ s = e[10], p = e[11], f = e[12], v = e[13], h = e[14], g = e[15], k = e[16], y = e[17], C = e[18], j = e[19], $ = e[20], H = e[21], _ = e[22], A = e[23], B = e[24];
466
+ let F;
467
+ e[30] !== s || e[31] !== k || e[32] !== y || e[33] !== C ? (F = /* @__PURE__ */ w(s, { variant: k, sx: y, children: C }), e[30] = s, e[31] = k, e[32] = y, e[33] = C, e[34] = F) : F = e[34];
468
+ let K;
469
+ e[35] !== p || e[36] !== F || e[37] !== j || e[38] !== $ ? (K = /* @__PURE__ */ V(p, { sx: j, children: [
470
+ $,
471
+ F
472
+ ] }), e[35] = p, e[36] = F, e[37] = j, e[38] = $, e[39] = K) : K = e[39];
473
+ let O;
474
+ e[40] !== d || e[41] !== m || e[42] !== B || e[43] !== n ? (O = /* @__PURE__ */ w(Me, { values: n, colors: d, maxValue: B, size: m }), e[40] = d, e[41] = m, e[42] = B, e[43] = n, e[44] = O) : O = e[44];
475
+ let G;
476
+ if (e[45] !== t || e[46] !== l || e[47] !== n) {
477
+ let D;
478
+ e[49] !== t || e[50] !== l ? (D = (J, z) => /* @__PURE__ */ w(E, { variant: "body2", sx: b.stackedBreakdownItem, children: `${l[z]}: ${t(J)}` }, `breakdown-${l[z]}`), e[49] = t, e[50] = l, e[51] = D) : D = e[51], G = n.map(D), e[45] = t, e[46] = l, e[47] = n, e[48] = G;
479
+ } else
480
+ G = e[48];
481
+ let M;
482
+ e[52] !== G ? (M = /* @__PURE__ */ w(T, { sx: b.stackedBreakdown, children: G }), e[52] = G, e[53] = M) : M = e[53];
483
+ let W;
484
+ return e[54] !== f || e[55] !== v || e[56] !== h || e[57] !== g || e[58] !== K || e[59] !== O || e[60] !== M || e[61] !== H || e[62] !== _ || e[63] !== A ? (W = /* @__PURE__ */ V(f, { role: H, "aria-pressed": _, tabIndex: A, onClick: v, onKeyDown: h, sx: g, children: [
485
+ K,
486
+ O,
487
+ M
488
+ ] }), e[54] = f, e[55] = v, e[56] = h, e[57] = g, e[58] = K, e[59] = O, e[60] = M, e[61] = H, e[62] = _, e[63] = A, e[64] = W) : W = e[64], W;
489
+ }
490
+ function Ve(u, e) {
491
+ return u + e;
492
+ }
493
+ function je(u) {
494
+ const e = P(23), {
495
+ hiddenCount: o,
496
+ otherLabel: a,
497
+ otherCountLabel: n,
498
+ onShowAll: d,
499
+ showAllLabel: l
500
+ } = u, t = a === void 0 ? "Others" : a, x = n === void 0 ? "{count}" : n, r = l === void 0 ? "Show all" : l;
501
+ let m;
502
+ e[0] !== o || e[1] !== x ? (m = x.replace("{count}", String(o)), e[0] = o, e[1] = x, e[2] = m) : m = e[2];
503
+ const i = m;
504
+ let c;
505
+ e[3] !== i ? (c = /* @__PURE__ */ w(E, { variant: "body2", sx: b.otherCount, children: i }), e[3] = i, e[4] = c) : c = e[4];
506
+ const s = c;
507
+ if (!d) {
508
+ let y;
509
+ e[5] !== t ? (y = /* @__PURE__ */ w(E, { variant: "body2", sx: b.otherLabel, children: t }), e[5] = t, e[6] = y) : y = e[6];
510
+ let C;
511
+ return e[7] !== s || e[8] !== y ? (C = /* @__PURE__ */ V(T, { sx: b.otherRow, children: [
512
+ y,
513
+ s
514
+ ] }), e[7] = s, e[8] = y, e[9] = C) : C = e[9], C;
515
+ }
516
+ let p;
517
+ e[10] !== d ? (p = (y) => {
518
+ (y.key === "Enter" || y.key === " ") && (y.preventDefault(), d());
519
+ }, e[10] = d, e[11] = p) : p = e[11];
520
+ const f = p;
521
+ let v;
522
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = {
523
+ ...b.otherLabel,
524
+ ...b.otherLabelButton
525
+ }, e[12] = v) : v = e[12];
526
+ let h;
527
+ e[13] !== f || e[14] !== d || e[15] !== t ? (h = /* @__PURE__ */ w(E, { variant: "body2", component: "span", role: "button", tabIndex: 0, onClick: d, onKeyDown: f, sx: v, children: t }), e[13] = f, e[14] = d, e[15] = t, e[16] = h) : h = e[16];
528
+ let g;
529
+ e[17] !== r || e[18] !== h ? (g = /* @__PURE__ */ w(He, { title: r, children: h }), e[17] = r, e[18] = h, e[19] = g) : g = e[19];
530
+ let k;
531
+ return e[20] !== s || e[21] !== g ? (k = /* @__PURE__ */ V(T, { sx: b.otherRow, children: [
532
+ g,
533
+ s
534
+ ] }), e[20] = s, e[21] = g, e[22] = k) : k = e[22], k;
535
+ }
536
+ const Ge = /* @__PURE__ */ new Set();
537
+ function Pe(u) {
538
+ const e = P(11), {
539
+ series: o,
540
+ colorAt: a,
541
+ hiddenSeries: n,
542
+ onToggle: d
543
+ } = u, l = n === void 0 ? Ge : n;
544
+ if (o.length === 0)
545
+ return null;
546
+ let t;
547
+ if (e[0] !== a || e[1] !== l || e[2] !== d || e[3] !== o) {
548
+ let r;
549
+ e[5] !== a || e[6] !== l || e[7] !== d ? (r = (m, i) => {
550
+ const c = l.has(i);
551
+ return /* @__PURE__ */ V(T, { role: "checkbox", "aria-checked": !c, tabIndex: 0, onClick: () => d?.(i), onKeyDown: (s) => {
552
+ (s.key === "Enter" || s.key === " ") && (s.preventDefault(), d?.(i));
553
+ }, sx: c ? b.legendItemHidden : b.legendItem, children: [
554
+ /* @__PURE__ */ w(T, { sx: b.legendDot, style: {
555
+ backgroundColor: m.color ?? a(i)
556
+ } }),
557
+ /* @__PURE__ */ w(E, { variant: "caption", sx: b.legendLabel, children: m.name })
558
+ ] }, m.name);
559
+ }, e[5] = a, e[6] = l, e[7] = d, e[8] = r) : r = e[8], t = o.map(r), e[0] = a, e[1] = l, e[2] = d, e[3] = o, e[4] = t;
560
+ } else
561
+ t = e[4];
562
+ let x;
563
+ return e[9] !== t ? (x = /* @__PURE__ */ w(T, { sx: b.legend, children: t }), e[9] = t, e[10] = x) : x = e[10], x;
564
+ }
565
+ const _e = 20, Ue = {
566
+ small: 36,
567
+ medium: 44
568
+ }, Xe = 8;
569
+ function qe(u) {
570
+ if (!u || u.length === 0) return [];
571
+ const e = Math.max(u.length, 1), o = /* @__PURE__ */ new Map(), a = [];
572
+ for (let n = 0; n < u.length; n++) {
573
+ const d = u[n] ?? [];
574
+ for (const l of d) {
575
+ let t = o.get(l.name);
576
+ t || (t = {
577
+ name: l.name,
578
+ values: new Array(e).fill(0),
579
+ rowColors: new Array(e).fill(void 0)
580
+ }, o.set(l.name, t), a.push(l.name)), t.values[n] = l.value, t.rowColors[n] = l.color;
581
+ }
582
+ }
583
+ return a.map((n) => o.get(n));
584
+ }
585
+ function Je(u) {
586
+ const e = P(83), {
587
+ data: o,
588
+ selection: a,
589
+ onSelectionChange: n,
590
+ formatter: d,
591
+ labelFormatter: l,
592
+ series: t,
593
+ maxItems: x,
594
+ labels: r,
595
+ onShowAll: m,
596
+ maxOverride: i,
597
+ size: c,
598
+ stacked: s
599
+ } = u, p = x === void 0 ? _e : x, f = c === void 0 ? "small" : c, v = s === void 0 ? !1 : s, h = Ne(), g = d ?? et, k = !!a && a.length > 0;
600
+ let y;
601
+ e[0] !== a ? (y = a ?? [], e[0] = a, e[1] = y) : y = e[1];
602
+ let C;
603
+ e[2] !== y ? (C = new Set(y), e[2] = y, e[3] = C) : C = e[3];
604
+ const j = C;
605
+ let $;
606
+ e[4] !== n || e[5] !== a ? ($ = (S) => {
607
+ if (!n)
608
+ return;
609
+ const L = a ?? [], I = L.includes(S) ? L.filter((ie) => ie !== S) : [...L, S];
610
+ n(I);
611
+ }, e[4] = n, e[5] = a, e[6] = $) : $ = e[6];
612
+ const H = $, _ = h.palette.secondary.main;
613
+ let A;
614
+ e[7] !== h.palette ? (A = Object.values(h.palette.qualitative?.bold ?? {}), e[7] = h.palette, e[8] = A) : A = e[8];
615
+ let B;
616
+ e[9] !== A || e[10] !== h.palette.secondary.main ? (B = [_, ...A], e[9] = A, e[10] = h.palette.secondary.main, e[11] = B) : B = e[11];
617
+ const F = B;
618
+ let K;
619
+ e[12] !== F || e[13] !== t || e[14] !== h.palette.secondary.main ? (K = (S, L) => {
620
+ if (L)
621
+ return L;
622
+ const I = t?.[S]?.color;
623
+ return I || (F[S % F.length] ?? h.palette.secondary.main);
624
+ }, e[12] = F, e[13] = t, e[14] = h.palette.secondary.main, e[15] = K) : K = e[15];
625
+ const O = K, G = h.palette.action.disabled;
626
+ let M;
627
+ e[16] !== o ? (M = qe(o), e[16] = o, e[17] = M) : M = e[17];
628
+ const W = M;
629
+ let D;
630
+ e: {
631
+ if (typeof i == "number" && i > 0) {
632
+ D = i;
633
+ break e;
634
+ }
635
+ let S = 0;
636
+ for (const L of W)
637
+ for (const I of L.values)
638
+ I > S && (S = I);
639
+ D = S;
640
+ }
641
+ const J = D, z = p === 0, Se = $e(!1), [ge, Te] = ke(null);
642
+ let ce;
643
+ e[18] !== z ? (ce = (S) => {
644
+ if (!S || Se.current || z)
645
+ return;
646
+ const L = S.clientHeight;
647
+ L > 0 && (Se.current = !0, Te(L));
648
+ }, e[18] = z, e[19] = ce) : ce = e[19];
649
+ const be = ce, [Y, Ce] = ke(Ze);
650
+ let de;
651
+ e[20] !== t ? (de = JSON.stringify(t?.map(Qe) ?? []), e[20] = t, e[21] = de) : de = e[21];
652
+ const xe = de, [De, Le] = ke(xe);
653
+ xe !== De && (Le(xe), Ce(/* @__PURE__ */ new Set()));
654
+ const Q = Math.max(o.length, 1);
655
+ let ue;
656
+ e[22] !== Q ? (ue = (S) => {
657
+ Ce((L) => {
658
+ const I = new Set(L);
659
+ return I.has(S) ? I.delete(S) : I.add(S), I.size >= Q ? /* @__PURE__ */ new Set() : I;
660
+ });
661
+ }, e[22] = Q, e[23] = ue) : ue = e[23];
662
+ const ye = ue;
663
+ if (W.length === 0)
664
+ return null;
665
+ let me;
666
+ e[24] !== p ? (me = typeof p == "number" && Number.isFinite(p) && p > 0, e[24] = p, e[25] = me) : me = e[25];
667
+ const fe = me;
668
+ let Z, ee, te, q, oe, U, X, le, ne;
669
+ if (e[26] !== O || e[27] !== o.length || e[28] !== G || e[29] !== g || e[30] !== W || e[31] !== fe || e[32] !== k || e[33] !== Y || e[34] !== l || e[35] !== be || e[36] !== p || e[37] !== J || e[38] !== ge || e[39] !== z || e[40] !== j || e[41] !== t || e[42] !== Q || e[43] !== f || e[44] !== v || e[45] !== H) {
670
+ const S = fe ? W.slice(0, p) : W;
671
+ q = fe ? W.length - S.length : 0;
672
+ const L = o.length > 1;
673
+ te = L && !!t && t.length > 0;
674
+ const I = Array.from({
675
+ length: Q
676
+ }, Ye).filter((R) => !Y.has(R)), ie = z ? ge ?? Ue[f] * Xe : void 0;
677
+ ee = T, ne = b.root, Z = T, oe = be, e[55] !== z ? (U = z ? {
678
+ ...b.list,
679
+ ...b.listScroll
680
+ } : b.list, e[55] = z, e[56] = U) : U = e[56], e[57] !== ie ? (X = ie !== void 0 ? {
681
+ maxHeight: ie,
682
+ overflowY: "auto"
683
+ } : void 0, e[57] = ie, e[58] = X) : X = e[58], le = S.map((R) => {
684
+ const pe = j.has(R.name), Re = k && !pe, ve = l ? l(R.name) : void 0, we = (N) => Re ? G : O(N, R.rowColors[N]);
685
+ return L ? v ? /* @__PURE__ */ w(Ee, { name: R.name, displayName: ve, values: I.map((N) => R.values[N]), colors: I.map((N) => we(N)), seriesNames: I.map((N) => t?.[N]?.name ?? `Series ${N + 1}`), formatter: g, selected: pe, onToggle: H, size: f }, String(R.name)) : /* @__PURE__ */ w(Ke, { name: R.name, displayName: ve, values: I.map((N) => R.values[N]), colors: I.map((N) => we(N)), maxValue: J, formatter: g, selected: pe, onToggle: H, size: f }, String(R.name)) : /* @__PURE__ */ w(Fe, { name: R.name, displayName: ve, value: R.values[0] ?? 0, maxValue: J, color: we(0), formatter: g, selected: pe, onToggle: H, size: f }, String(R.name));
686
+ }), e[26] = O, e[27] = o.length, e[28] = G, e[29] = g, e[30] = W, e[31] = fe, e[32] = k, e[33] = Y, e[34] = l, e[35] = be, e[36] = p, e[37] = J, e[38] = ge, e[39] = z, e[40] = j, e[41] = t, e[42] = Q, e[43] = f, e[44] = v, e[45] = H, e[46] = Z, e[47] = ee, e[48] = te, e[49] = q, e[50] = oe, e[51] = U, e[52] = X, e[53] = le, e[54] = ne;
687
+ } else
688
+ Z = e[46], ee = e[47], te = e[48], q = e[49], oe = e[50], U = e[51], X = e[52], le = e[53], ne = e[54];
689
+ let re;
690
+ e[59] !== q || e[60] !== r?.other || e[61] !== r?.otherCount || e[62] !== r?.showAll || e[63] !== m ? (re = q > 0 && /* @__PURE__ */ w(je, { hiddenCount: q, otherLabel: r?.other, otherCountLabel: r?.otherCount, showAllLabel: r?.showAll, onShowAll: m }), e[59] = q, e[60] = r?.other, e[61] = r?.otherCount, e[62] = r?.showAll, e[63] = m, e[64] = re) : re = e[64];
691
+ let se;
692
+ e[65] !== Z || e[66] !== oe || e[67] !== U || e[68] !== X || e[69] !== le || e[70] !== re ? (se = /* @__PURE__ */ V(Z, { ref: oe, sx: U, style: X, children: [
693
+ le,
694
+ re
695
+ ] }), e[65] = Z, e[66] = oe, e[67] = U, e[68] = X, e[69] = le, e[70] = re, e[71] = se) : se = e[71];
696
+ let ae;
697
+ e[72] !== O || e[73] !== te || e[74] !== Y || e[75] !== t || e[76] !== ye ? (ae = te && t && /* @__PURE__ */ w(Pe, { series: t, colorAt: (S) => O(S), hiddenSeries: Y, onToggle: ye }), e[72] = O, e[73] = te, e[74] = Y, e[75] = t, e[76] = ye, e[77] = ae) : ae = e[77];
698
+ let he;
699
+ return e[78] !== ee || e[79] !== ne || e[80] !== se || e[81] !== ae ? (he = /* @__PURE__ */ V(ee, { sx: ne, children: [
700
+ se,
701
+ ae
702
+ ] }), e[78] = ee, e[79] = ne, e[80] = se, e[81] = ae, e[82] = he) : he = e[82], he;
703
+ }
704
+ function Ye(u, e) {
705
+ return e;
706
+ }
707
+ function Qe(u) {
708
+ return u.name;
709
+ }
710
+ function Ze() {
711
+ return /* @__PURE__ */ new Set();
712
+ }
713
+ function et(u) {
714
+ return String(u);
715
+ }
716
+ const tt = (u) => ({
717
+ data: u.data ?? [],
718
+ rawData: u.rawData ?? void 0,
719
+ formatter: u.formatter,
720
+ labelFormatter: u.labelFormatter
721
+ });
722
+ function ot(u) {
723
+ if (!u) return 0;
724
+ let e = 0;
725
+ for (const o of u)
726
+ for (const a of o) a.value > e && (e = a.value);
727
+ return e;
728
+ }
729
+ function pt(u) {
730
+ const e = P(13), {
731
+ selection: o,
732
+ onSelectionChange: a,
733
+ series: n,
734
+ maxItems: d,
735
+ labels: l,
736
+ onShowAll: t,
737
+ maxOverride: x,
738
+ size: r,
739
+ stacked: m
740
+ } = u, i = Ae(), c = Oe(i, tt), s = ot(c.rawData), p = x ?? (s > 0 ? s : void 0);
741
+ let f;
742
+ return e[0] !== p || e[1] !== l || e[2] !== d || e[3] !== a || e[4] !== t || e[5] !== o || e[6] !== n || e[7] !== r || e[8] !== c.data || e[9] !== c.formatter || e[10] !== c.labelFormatter || e[11] !== m ? (f = /* @__PURE__ */ w(Je, { data: c.data, formatter: c.formatter, labelFormatter: c.labelFormatter, selection: o, onSelectionChange: a, series: n, maxItems: d, labels: l, onShowAll: t, maxOverride: p, size: r, stacked: m }), e[0] = p, e[1] = l, e[2] = d, e[3] = a, e[4] = t, e[5] = o, e[6] = n, e[7] = r, e[8] = c.data, e[9] = c.formatter, e[10] = c.labelFormatter, e[11] = m, e[12] = f) : f = e[12], f;
743
+ }
744
+ export {
745
+ pt as C,
746
+ Ie as a,
747
+ Pe as b,
748
+ Ke as c,
749
+ je as d,
750
+ Fe as e,
751
+ Je as f
752
+ };
753
+ //# sourceMappingURL=category-Ct2BzADB.js.map