@carto/ps-react-ui 4.17.2 → 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 (91) 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/legend/stores.js +1 -1
  8. package/dist/{legend-store-registry-Bo8U_qWM.js → legend-store-registry-p1tSwJXH.js} +151 -147
  9. package/dist/legend-store-registry-p1tSwJXH.js.map +1 -0
  10. package/dist/legend.js +473 -415
  11. package/dist/legend.js.map +1 -1
  12. package/dist/types/legend/components/legend-actions/legend-actions.d.ts +2 -2
  13. package/dist/types/legend/components/legend-group/styles.d.ts +31 -20
  14. package/dist/types/legend/components/legend-row/styles.d.ts +24 -4
  15. package/dist/types/legend/components/legend-sortable/styles.d.ts +4 -3
  16. package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +15 -5
  17. package/dist/types/widgets-v2/category/components/category-legend.d.ts +18 -2
  18. package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +6 -1
  19. package/dist/types/widgets-v2/category/style.d.ts +8 -0
  20. package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +10 -4
  21. package/dist/types/widgets-v2/histogram/index.d.ts +1 -1
  22. package/dist/types/widgets-v2/histogram/transforms.d.ts +11 -0
  23. package/dist/types/widgets-v2/histogram/types.d.ts +9 -0
  24. package/dist/types/widgets-v2/scatterplot/index.d.ts +1 -1
  25. package/dist/types/widgets-v2/scatterplot/transforms.d.ts +9 -0
  26. package/dist/types/widgets-v2/table/index.d.ts +1 -0
  27. package/dist/types/widgets-v2/table/transforms.d.ts +13 -0
  28. package/dist/types/widgets-v2/table/transforms.test.d.ts +1 -0
  29. package/dist/types/widgets-v2/timeseries/index.d.ts +1 -0
  30. package/dist/types/widgets-v2/timeseries/transforms.d.ts +10 -0
  31. package/dist/types/widgets-v2/timeseries/transforms.test.d.ts +1 -0
  32. package/dist/widgets-v2/actions.js +1 -1
  33. package/dist/widgets-v2/category.js +1 -1
  34. package/dist/widgets-v2/echart.js +1 -1
  35. package/dist/widgets-v2/echart.js.map +1 -1
  36. package/dist/widgets-v2/histogram.js +181 -158
  37. package/dist/widgets-v2/histogram.js.map +1 -1
  38. package/dist/widgets-v2/pie.js +155 -116
  39. package/dist/widgets-v2/pie.js.map +1 -1
  40. package/dist/widgets-v2/scatterplot.js +91 -85
  41. package/dist/widgets-v2/scatterplot.js.map +1 -1
  42. package/dist/widgets-v2/table.js +55 -45
  43. package/dist/widgets-v2/table.js.map +1 -1
  44. package/dist/widgets-v2/timeseries.js +96 -85
  45. package/dist/widgets-v2/timeseries.js.map +1 -1
  46. package/dist/widgets-v2.js +4 -4
  47. package/package.json +3 -3
  48. package/src/legend/components/legend-actions/legend-actions.tsx +2 -2
  49. package/src/legend/components/legend-group/styles.ts +59 -36
  50. package/src/legend/components/legend-row/legend-row.tsx +10 -7
  51. package/src/legend/components/legend-row/styles.ts +41 -10
  52. package/src/legend/components/legend-sortable/styles.ts +13 -4
  53. package/src/legend/stores/legend-store-registry.ts +28 -4
  54. package/src/legend/stores/legend-store.test.ts +23 -0
  55. package/src/widgets-v2/actions/lock-selection/lock-selection.test.tsx +62 -0
  56. package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +45 -13
  57. package/src/widgets-v2/category/category-ui.test.tsx +55 -0
  58. package/src/widgets-v2/category/category-ui.tsx +65 -6
  59. package/src/widgets-v2/category/components/category-legend.test.tsx +53 -2
  60. package/src/widgets-v2/category/components/category-legend.tsx +55 -12
  61. package/src/widgets-v2/category/components/category-row-stacked.test.tsx +7 -3
  62. package/src/widgets-v2/category/components/category-row-stacked.tsx +8 -3
  63. package/src/widgets-v2/category/style.ts +10 -2
  64. package/src/widgets-v2/echart/echart-ui.test.tsx +25 -0
  65. package/src/widgets-v2/echart/echart-ui.tsx +20 -0
  66. package/src/widgets-v2/echart/use-chart-selection.test.tsx +3 -1
  67. package/src/widgets-v2/echart/use-chart-selection.ts +10 -4
  68. package/src/widgets-v2/histogram/index.ts +4 -1
  69. package/src/widgets-v2/histogram/options.test.ts +86 -0
  70. package/src/widgets-v2/histogram/options.ts +50 -0
  71. package/src/widgets-v2/histogram/transforms.test.ts +36 -1
  72. package/src/widgets-v2/histogram/transforms.ts +23 -0
  73. package/src/widgets-v2/histogram/types.ts +9 -0
  74. package/src/widgets-v2/pie/options.test.ts +262 -0
  75. package/src/widgets-v2/pie/options.ts +80 -5
  76. package/src/widgets-v2/scatterplot/index.ts +4 -1
  77. package/src/widgets-v2/scatterplot/transforms.test.ts +38 -1
  78. package/src/widgets-v2/scatterplot/transforms.ts +23 -0
  79. package/src/widgets-v2/table/index.ts +1 -0
  80. package/src/widgets-v2/table/transforms.test.ts +40 -0
  81. package/src/widgets-v2/table/transforms.ts +26 -0
  82. package/src/widgets-v2/timeseries/index.ts +1 -0
  83. package/src/widgets-v2/timeseries/transforms.test.ts +49 -0
  84. package/src/widgets-v2/timeseries/transforms.ts +31 -0
  85. package/dist/category-CGS_eHr4.js +0 -719
  86. package/dist/category-CGS_eHr4.js.map +0 -1
  87. package/dist/change-column-CiVAjOUB.js +0 -1143
  88. package/dist/change-column-CiVAjOUB.js.map +0 -1
  89. package/dist/echart-Bdvbfx9s.js +0 -250
  90. package/dist/echart-Bdvbfx9s.js.map +0 -1
  91. package/dist/legend-store-registry-Bo8U_qWM.js.map +0 -1
@@ -1,719 +0,0 @@
1
- import { jsx as w, jsxs as E } from "react/jsx-runtime";
2
- import { c as j } from "react/compiler-runtime";
3
- import { useRef as xe, useState as ye } from "react";
4
- import { u as ve } from "./widget-context-DTGO0Yta.js";
5
- import { u as we } from "./widget-store-registry-_W4Z4xp-.js";
6
- import "zustand";
7
- import { Box as $, Typography as K, useTheme as ke } from "@mui/material";
8
- import "./lasso-tool-YLFRgb-S.js";
9
- import "./cjs-D4KH3azB.js";
10
- import { T as Ce } from "./tooltip-BDnrRKrp.js";
11
- import "@mui/icons-material";
12
- import "@carto/ps-utils";
13
- const Se = {
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
- }, Le = {
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
- }, $e = {
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
- }, x = {
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: Se,
170
- barFill: Le,
171
- stackedSegment: $e,
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: (f) => `1px solid ${f.palette.divider}`
243
- },
244
- legendItem: {
245
- display: "flex",
246
- alignItems: "center",
247
- gap: 1
248
- },
249
- legendDot: {
250
- width: 8,
251
- height: 8,
252
- borderRadius: "50%"
253
- },
254
- legendLabel: {
255
- color: "text.secondary",
256
- textTransform: "uppercase",
257
- fontWeight: "medium"
258
- },
259
- // ── "Other" overflow row ──────────────────────────────────────────
260
- // Left-aligned `Others <count>` — the label sits next to a muted count
261
- // (no parentheses). Only the label is the click target when interactive;
262
- // the count is always static text beside it.
263
- otherRow: {
264
- display: "flex",
265
- alignItems: "center",
266
- gap: 1,
267
- py: 0.5,
268
- px: 0.5
269
- },
270
- // Interactive affordances layered onto the "Others" label only (cursor,
271
- // hover tint, focus ring). A negative LEFT margin + matching padding keep
272
- // the hover pill breathing without shifting the label's text edge (it
273
- // stays aligned with the category rows above). No right margin, so the
274
- // row `gap` is preserved between the pill and the count.
275
- otherLabelButton: {
276
- cursor: "pointer",
277
- userSelect: "none",
278
- borderRadius: 1,
279
- px: 0.5,
280
- ml: -0.5,
281
- transition: "background-color 80ms ease",
282
- "&:hover": {
283
- bgcolor: "action.hover"
284
- },
285
- "&:focus-visible": {
286
- outline: "2px solid",
287
- outlineColor: "primary.main",
288
- outlineOffset: 2
289
- }
290
- },
291
- otherLabel: {
292
- color: "text.primary",
293
- fontWeight: "medium"
294
- },
295
- otherCount: {
296
- color: "text.secondary",
297
- fontVariantNumeric: "tabular-nums"
298
- }
299
- // `bar` / `barFill` are size-keyed (`Record<CategorySize, SxProps>`);
300
- // every other entry is a single `SxProps<Theme>`. The mixed shape means
301
- // we can't apply the file-wide `satisfies Record<string, SxProps<Theme>>`
302
- // constraint that the other widget style files use — consumers of
303
- // individual tokens still get full type-checking at the call site via
304
- // the typed `Box`/`Typography` `sx` prop.
305
- };
306
- function he(f) {
307
- const e = j(10), {
308
- value: o,
309
- maxValue: s,
310
- color: l,
311
- size: c
312
- } = f, r = c === void 0 ? "small" : c, t = s > 0 ? o / s * 100 : 0, v = x.bar[r], n = x.barFill[r], h = `${t}%`;
313
- let u;
314
- e[0] !== l || e[1] !== h ? (u = {
315
- width: h,
316
- backgroundColor: l
317
- }, e[0] = l, e[1] = h, e[2] = u) : u = e[2];
318
- let i;
319
- e[3] !== n || e[4] !== u ? (i = /* @__PURE__ */ w($, { sx: n, style: u, "data-bar-fill": "true" }), e[3] = n, e[4] = u, e[5] = i) : i = e[5];
320
- let a;
321
- return e[6] !== r || e[7] !== v || e[8] !== i ? (a = /* @__PURE__ */ w($, { sx: v, "data-size": r, children: i }), e[6] = r, e[7] = v, e[8] = i, e[9] = a) : a = e[9], a;
322
- }
323
- function Re(f) {
324
- const e = j(27), {
325
- name: o,
326
- displayName: s,
327
- value: l,
328
- maxValue: c,
329
- color: r,
330
- formatter: t,
331
- selected: v,
332
- onToggle: n,
333
- size: h
334
- } = f;
335
- let u;
336
- e[0] !== o || e[1] !== n ? (u = (S) => {
337
- (S.key === "Enter" || S.key === " ") && (S.preventDefault(), n(o));
338
- }, e[0] = o, e[1] = n, e[2] = u) : u = e[2];
339
- const i = u;
340
- let a;
341
- e[3] !== o || e[4] !== n ? (a = () => n(o), e[3] = o, e[4] = n, e[5] = a) : a = e[5];
342
- const g = s ?? o;
343
- let d;
344
- e[6] !== g ? (d = /* @__PURE__ */ w(K, { variant: "body2", sx: x.name, children: g }), e[6] = g, e[7] = d) : d = e[7];
345
- let b;
346
- e[8] !== t || e[9] !== l ? (b = t(l), e[8] = t, e[9] = l, e[10] = b) : b = e[10];
347
- let p;
348
- e[11] !== b ? (p = /* @__PURE__ */ w(K, { variant: "body2", sx: x.value, children: b }), e[11] = b, e[12] = p) : p = e[12];
349
- let m;
350
- e[13] !== d || e[14] !== p ? (m = /* @__PURE__ */ E($, { sx: x.rowHeader, children: [
351
- d,
352
- p
353
- ] }), e[13] = d, e[14] = p, e[15] = m) : m = e[15];
354
- let k;
355
- e[16] !== r || e[17] !== c || e[18] !== h || e[19] !== l ? (k = /* @__PURE__ */ w(he, { value: l, maxValue: c, color: r, size: h }), e[16] = r, e[17] = c, e[18] = h, e[19] = l, e[20] = k) : k = e[20];
356
- let y;
357
- return e[21] !== i || e[22] !== v || e[23] !== a || e[24] !== m || e[25] !== k ? (y = /* @__PURE__ */ E($, { role: "button", "aria-pressed": v, tabIndex: 0, onClick: a, onKeyDown: i, sx: x.rowSingle, children: [
358
- m,
359
- k
360
- ] }), e[21] = i, e[22] = v, e[23] = a, e[24] = m, e[25] = k, e[26] = y) : y = e[26], y;
361
- }
362
- function Te(f) {
363
- const e = j(27), {
364
- name: o,
365
- displayName: s,
366
- values: l,
367
- colors: c,
368
- maxValue: r,
369
- formatter: t,
370
- selected: v,
371
- onToggle: n,
372
- size: h
373
- } = f;
374
- let u;
375
- e[0] !== o || e[1] !== n ? (u = (m) => {
376
- (m.key === "Enter" || m.key === " ") && (m.preventDefault(), n(o));
377
- }, e[0] = o, e[1] = n, e[2] = u) : u = e[2];
378
- const i = u;
379
- let a;
380
- e[3] !== o || e[4] !== n ? (a = () => n(o), e[3] = o, e[4] = n, e[5] = a) : a = e[5];
381
- const g = s ?? o;
382
- let d;
383
- e[6] !== g ? (d = /* @__PURE__ */ w(K, { variant: "body2", sx: x.multiName, children: g }), e[6] = g, e[7] = d) : d = e[7];
384
- let b;
385
- if (e[8] !== c || e[9] !== t || e[10] !== r || e[11] !== o || e[12] !== h || e[13] !== l) {
386
- let m;
387
- e[15] !== c || e[16] !== t || e[17] !== r || e[18] !== o || e[19] !== h ? (m = (k, y) => /* @__PURE__ */ E($, { sx: x.multiBarRow, children: [
388
- /* @__PURE__ */ w($, { sx: x.multiBarContainer, children: /* @__PURE__ */ w(he, { value: k, maxValue: r, color: c[y] ?? "", size: h }) }),
389
- /* @__PURE__ */ w(K, { variant: "body2", sx: x.value, children: t(k) })
390
- ] }, `${o}-series-${y}`), e[15] = c, e[16] = t, e[17] = r, e[18] = o, e[19] = h, e[20] = m) : m = e[20], b = l.map(m), e[8] = c, e[9] = t, e[10] = r, e[11] = o, e[12] = h, e[13] = l, e[14] = b;
391
- } else
392
- b = e[14];
393
- let p;
394
- return e[21] !== i || e[22] !== v || e[23] !== a || e[24] !== d || e[25] !== b ? (p = /* @__PURE__ */ E($, { role: "button", "aria-pressed": v, tabIndex: 0, onClick: a, onKeyDown: i, sx: x.rowMulti, children: [
395
- d,
396
- b
397
- ] }), e[21] = i, e[22] = v, e[23] = a, e[24] = d, e[25] = b, e[26] = p) : p = e[26], p;
398
- }
399
- function De(f) {
400
- const e = j(17), {
401
- values: o,
402
- colors: s,
403
- maxValue: l,
404
- size: c
405
- } = f, r = c === void 0 ? "small" : c;
406
- let t;
407
- if (e[0] !== o) {
408
- t = [];
409
- let u = 0;
410
- for (const i of o)
411
- t.push(u), u = u + i;
412
- e[0] = o, e[1] = t;
413
- } else
414
- t = e[1];
415
- const v = x.bar[r];
416
- let n;
417
- if (e[2] !== s || e[3] !== l || e[4] !== t || e[5] !== r || e[6] !== o) {
418
- let u;
419
- e[8] !== s || e[9] !== l || e[10] !== t || e[11] !== r ? (u = (i, a) => {
420
- if (i <= 0)
421
- return null;
422
- const g = l > 0 ? t[a] / l * 100 : 0, d = l > 0 ? i / l * 100 : 0;
423
- return /* @__PURE__ */ w($, { sx: x.stackedSegment[r], style: {
424
- left: `${g}%`,
425
- width: `${d}%`,
426
- backgroundColor: s[a] ?? ""
427
- }, "data-bar-fill": "true" }, `seg-${s[a] ?? "none"}-${a}`);
428
- }, e[8] = s, e[9] = l, e[10] = t, e[11] = r, e[12] = u) : u = e[12], n = o.map(u), e[2] = s, e[3] = l, e[4] = t, e[5] = r, e[6] = o, e[7] = n;
429
- } else
430
- n = e[7];
431
- let h;
432
- return e[13] !== r || e[14] !== v || e[15] !== n ? (h = /* @__PURE__ */ w($, { sx: v, "data-size": r, children: n }), e[13] = r, e[14] = v, e[15] = n, e[16] = h) : h = e[16], h;
433
- }
434
- function Ie(f) {
435
- const e = j(65), {
436
- name: o,
437
- displayName: s,
438
- values: l,
439
- colors: c,
440
- seriesNames: r,
441
- formatter: t,
442
- selected: v,
443
- onToggle: n,
444
- size: h
445
- } = f;
446
- let u;
447
- e[0] !== o || e[1] !== n ? (u = (R) => {
448
- (R.key === "Enter" || R.key === " ") && (R.preventDefault(), n(o));
449
- }, e[0] = o, e[1] = n, e[2] = u) : u = e[2];
450
- const i = u;
451
- let a, g, d, b, p, m, k, y, S, O, I, D, G, A, N;
452
- if (e[3] !== s || e[4] !== t || e[5] !== i || e[6] !== o || e[7] !== n || e[8] !== v || e[9] !== l) {
453
- N = l.reduce(Ae, 0), d = $, D = "button", G = v, A = 0, e[25] !== o || e[26] !== n ? (b = () => n(o), e[25] = o, e[26] = n, e[27] = b) : b = e[27], p = i, m = x.rowStacked, g = $, O = x.stackedHeader;
454
- const R = s ?? o;
455
- e[28] !== R ? (I = /* @__PURE__ */ w(K, { variant: "body2", sx: x.multiName, children: R }), e[28] = R, e[29] = I) : I = e[29], a = K, k = "body2", y = x.stackedTotal, S = t(N), e[3] = s, e[4] = t, e[5] = i, e[6] = o, e[7] = n, e[8] = v, e[9] = l, e[10] = a, e[11] = g, e[12] = d, e[13] = b, e[14] = p, e[15] = m, e[16] = k, e[17] = y, e[18] = S, e[19] = O, e[20] = I, e[21] = D, e[22] = G, e[23] = A, e[24] = N;
456
- } else
457
- a = e[10], g = e[11], d = e[12], b = e[13], p = e[14], m = e[15], k = e[16], y = e[17], S = e[18], O = e[19], I = e[20], D = e[21], G = e[22], A = e[23], N = e[24];
458
- let M;
459
- e[30] !== a || e[31] !== k || e[32] !== y || e[33] !== S ? (M = /* @__PURE__ */ w(a, { variant: k, sx: y, children: S }), e[30] = a, e[31] = k, e[32] = y, e[33] = S, e[34] = M) : M = e[34];
460
- let H;
461
- e[35] !== g || e[36] !== M || e[37] !== O || e[38] !== I ? (H = /* @__PURE__ */ E(g, { sx: O, children: [
462
- I,
463
- M
464
- ] }), e[35] = g, e[36] = M, e[37] = O, e[38] = I, e[39] = H) : H = e[39];
465
- let T;
466
- e[40] !== c || e[41] !== h || e[42] !== N || e[43] !== l ? (T = /* @__PURE__ */ w(De, { values: l, colors: c, maxValue: N, size: h }), e[40] = c, e[41] = h, e[42] = N, e[43] = l, e[44] = T) : T = e[44];
467
- let B;
468
- if (e[45] !== t || e[46] !== r || e[47] !== l) {
469
- let R;
470
- e[49] !== t || e[50] !== r ? (R = (P, F) => /* @__PURE__ */ w(K, { variant: "body2", sx: x.stackedBreakdownItem, children: `${r[F] ?? `Series ${F + 1}`}: ${t(P)}` }, `breakdown-${r[F] ?? `series-${F}`}`), e[49] = t, e[50] = r, e[51] = R) : R = e[51], B = l.map(R), e[45] = t, e[46] = r, e[47] = l, e[48] = B;
471
- } else
472
- B = e[48];
473
- let V;
474
- e[52] !== B ? (V = /* @__PURE__ */ w($, { sx: x.stackedBreakdown, children: B }), e[52] = B, e[53] = V) : V = e[53];
475
- let W;
476
- return e[54] !== d || e[55] !== b || e[56] !== p || e[57] !== m || e[58] !== H || e[59] !== T || e[60] !== V || e[61] !== D || e[62] !== G || e[63] !== A ? (W = /* @__PURE__ */ E(d, { role: D, "aria-pressed": G, tabIndex: A, onClick: b, onKeyDown: p, sx: m, children: [
477
- H,
478
- T,
479
- V
480
- ] }), e[54] = d, e[55] = b, e[56] = p, e[57] = m, e[58] = H, e[59] = T, e[60] = V, e[61] = D, e[62] = G, e[63] = A, e[64] = W) : W = e[64], W;
481
- }
482
- function Ae(f, e) {
483
- return f + e;
484
- }
485
- function Oe(f) {
486
- const e = j(23), {
487
- hiddenCount: o,
488
- otherLabel: s,
489
- otherCountLabel: l,
490
- onShowAll: c,
491
- showAllLabel: r
492
- } = f, t = s === void 0 ? "Others" : s, v = l === void 0 ? "{count}" : l, n = r === void 0 ? "Show all" : r;
493
- let h;
494
- e[0] !== o || e[1] !== v ? (h = v.replace("{count}", String(o)), e[0] = o, e[1] = v, e[2] = h) : h = e[2];
495
- const u = h;
496
- let i;
497
- e[3] !== u ? (i = /* @__PURE__ */ w(K, { variant: "body2", sx: x.otherCount, children: u }), e[3] = u, e[4] = i) : i = e[4];
498
- const a = i;
499
- if (!c) {
500
- let y;
501
- e[5] !== t ? (y = /* @__PURE__ */ w(K, { variant: "body2", sx: x.otherLabel, children: t }), e[5] = t, e[6] = y) : y = e[6];
502
- let S;
503
- return e[7] !== a || e[8] !== y ? (S = /* @__PURE__ */ E($, { sx: x.otherRow, children: [
504
- y,
505
- a
506
- ] }), e[7] = a, e[8] = y, e[9] = S) : S = e[9], S;
507
- }
508
- let g;
509
- e[10] !== c ? (g = (y) => {
510
- (y.key === "Enter" || y.key === " ") && (y.preventDefault(), c());
511
- }, e[10] = c, e[11] = g) : g = e[11];
512
- const d = g;
513
- let b;
514
- e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = {
515
- ...x.otherLabel,
516
- ...x.otherLabelButton
517
- }, e[12] = b) : b = e[12];
518
- let p;
519
- e[13] !== d || e[14] !== c || e[15] !== t ? (p = /* @__PURE__ */ w(K, { variant: "body2", component: "span", role: "button", tabIndex: 0, onClick: c, onKeyDown: d, sx: b, children: t }), e[13] = d, e[14] = c, e[15] = t, e[16] = p) : p = e[16];
520
- let m;
521
- e[17] !== n || e[18] !== p ? (m = /* @__PURE__ */ w(Ce, { title: n, children: p }), e[17] = n, e[18] = p, e[19] = m) : m = e[19];
522
- let k;
523
- return e[20] !== a || e[21] !== m ? (k = /* @__PURE__ */ E($, { sx: x.otherRow, children: [
524
- m,
525
- a
526
- ] }), e[20] = a, e[21] = m, e[22] = k) : k = e[22], k;
527
- }
528
- function Ne(f) {
529
- const e = j(7), {
530
- series: o,
531
- colorAt: s
532
- } = f;
533
- if (o.length === 0)
534
- return null;
535
- let l;
536
- if (e[0] !== s || e[1] !== o) {
537
- let r;
538
- e[3] !== s ? (r = (t, v) => /* @__PURE__ */ E($, { sx: x.legendItem, children: [
539
- /* @__PURE__ */ w($, { sx: x.legendDot, style: {
540
- backgroundColor: t.color ?? s(v)
541
- } }),
542
- /* @__PURE__ */ w(K, { variant: "caption", sx: x.legendLabel, children: t.name })
543
- ] }, t.name), e[3] = s, e[4] = r) : r = e[4], l = o.map(r), e[0] = s, e[1] = o, e[2] = l;
544
- } else
545
- l = e[2];
546
- let c;
547
- return e[5] !== l ? (c = /* @__PURE__ */ w($, { sx: x.legend, children: l }), e[5] = l, e[6] = c) : c = e[6], c;
548
- }
549
- const Be = 20, We = {
550
- small: 36,
551
- medium: 44
552
- }, Fe = 8;
553
- function ze(f) {
554
- if (!f || f.length === 0) return [];
555
- const e = Math.max(f.length, 1), o = /* @__PURE__ */ new Map(), s = [];
556
- for (let l = 0; l < f.length; l++) {
557
- const c = f[l] ?? [];
558
- for (const r of c) {
559
- let t = o.get(r.name);
560
- t || (t = {
561
- name: r.name,
562
- values: new Array(e).fill(0),
563
- rowColors: new Array(e).fill(void 0)
564
- }, o.set(r.name, t), s.push(r.name)), t.values[l] = r.value, t.rowColors[l] = r.color;
565
- }
566
- }
567
- return s.map((l) => o.get(l));
568
- }
569
- function Me(f) {
570
- const e = j(76), {
571
- data: o,
572
- selection: s,
573
- onSelectionChange: l,
574
- formatter: c,
575
- labelFormatter: r,
576
- series: t,
577
- maxItems: v,
578
- labels: n,
579
- onShowAll: h,
580
- maxOverride: u,
581
- size: i,
582
- stacked: a
583
- } = f, g = v === void 0 ? Be : v, d = i === void 0 ? "small" : i, b = a === void 0 ? !1 : a, p = ke(), m = c ?? Ve, k = !!s && s.length > 0;
584
- let y;
585
- e[0] !== s ? (y = s ?? [], e[0] = s, e[1] = y) : y = e[1];
586
- let S;
587
- e[2] !== y ? (S = new Set(y), e[2] = y, e[3] = S) : S = e[3];
588
- const O = S;
589
- let I;
590
- e[4] !== l || e[5] !== s ? (I = (L) => {
591
- if (!l)
592
- return;
593
- const C = s ?? [], z = C.includes(L) ? C.filter((ue) => ue !== L) : [...C, L];
594
- l(z);
595
- }, e[4] = l, e[5] = s, e[6] = I) : I = e[6];
596
- const D = I, G = p.palette.secondary.main;
597
- let A;
598
- e[7] !== p.palette ? (A = Object.values(p.palette.qualitative?.bold ?? {}), e[7] = p.palette, e[8] = A) : A = e[8];
599
- let N;
600
- e[9] !== A || e[10] !== p.palette.secondary.main ? (N = [G, ...A], e[9] = A, e[10] = p.palette.secondary.main, e[11] = N) : N = e[11];
601
- const M = N;
602
- let H;
603
- e[12] !== M || e[13] !== t || e[14] !== p.palette.secondary.main ? (H = (L, C) => {
604
- if (C)
605
- return C;
606
- const z = t?.[L]?.color;
607
- return z || (M[L % M.length] ?? p.palette.secondary.main);
608
- }, e[12] = M, e[13] = t, e[14] = p.palette.secondary.main, e[15] = H) : H = e[15];
609
- const T = H, B = p.palette.action.disabled;
610
- let V;
611
- e[16] !== o ? (V = ze(o), e[16] = o, e[17] = V) : V = e[17];
612
- const W = V;
613
- let R;
614
- e: {
615
- if (typeof u == "number" && u > 0) {
616
- R = u;
617
- break e;
618
- }
619
- let L = 0;
620
- for (const C of W)
621
- for (const z of C.values)
622
- z > L && (L = z);
623
- R = L;
624
- }
625
- const P = R, F = g === 0, pe = xe(!1), [ge, be] = ye(null);
626
- let Z;
627
- e[18] !== F ? (Z = (L) => {
628
- if (!L || pe.current || F)
629
- return;
630
- const C = L.clientHeight;
631
- C > 0 && (pe.current = !0, be(C));
632
- }, e[18] = F, e[19] = Z) : Z = e[19];
633
- const ie = Z;
634
- if (W.length === 0)
635
- return null;
636
- let ee;
637
- e[20] !== g ? (ee = typeof g == "number" && Number.isFinite(g) && g > 0, e[20] = g, e[21] = ee) : ee = e[21];
638
- const te = ee;
639
- let oe;
640
- e[22] !== W || e[23] !== te || e[24] !== g ? (oe = te ? W.slice(0, g) : W, e[22] = W, e[23] = te, e[24] = g, e[25] = oe) : oe = e[25];
641
- const le = oe, re = te ? W.length - le.length : 0, U = o.length > 1, ce = U && !!t && t.length > 0, ne = F ? ge ?? We[d] * Fe : void 0;
642
- let X;
643
- e[26] !== F ? (X = F ? {
644
- ...x.list,
645
- ...x.listScroll
646
- } : x.list, e[26] = F, e[27] = X) : X = e[27];
647
- let q;
648
- e[28] !== ne ? (q = ne !== void 0 ? {
649
- maxHeight: ne,
650
- overflowY: "auto"
651
- } : void 0, e[28] = ne, e[29] = q) : q = e[29];
652
- let Y;
653
- if (e[30] !== T || e[31] !== B || e[32] !== m || e[33] !== k || e[34] !== U || e[35] !== r || e[36] !== P || e[37] !== O || e[38] !== t || e[39] !== d || e[40] !== b || e[41] !== D || e[42] !== le) {
654
- let L;
655
- e[44] !== T || e[45] !== B || e[46] !== m || e[47] !== k || e[48] !== U || e[49] !== r || e[50] !== P || e[51] !== O || e[52] !== t || e[53] !== d || e[54] !== b || e[55] !== D ? (L = (C) => {
656
- const z = O.has(C.name), ue = k && !z, de = r ? r(C.name) : void 0, fe = (ae) => ue ? B : T(ae, C.rowColors[ae]);
657
- return U ? b ? /* @__PURE__ */ w(Ie, { name: C.name, displayName: de, values: C.values, colors: C.values.map((ae, me) => fe(me)), seriesNames: t?.map(He) ?? [], formatter: m, selected: z, onToggle: D, size: d }, String(C.name)) : /* @__PURE__ */ w(Te, { name: C.name, displayName: de, values: C.values, colors: C.values.map((ae, me) => fe(me)), maxValue: P, formatter: m, selected: z, onToggle: D, size: d }, String(C.name)) : /* @__PURE__ */ w(Re, { name: C.name, displayName: de, value: C.values[0] ?? 0, maxValue: P, color: fe(0), formatter: m, selected: z, onToggle: D, size: d }, String(C.name));
658
- }, e[44] = T, e[45] = B, e[46] = m, e[47] = k, e[48] = U, e[49] = r, e[50] = P, e[51] = O, e[52] = t, e[53] = d, e[54] = b, e[55] = D, e[56] = L) : L = e[56], Y = le.map(L), e[30] = T, e[31] = B, e[32] = m, e[33] = k, e[34] = U, e[35] = r, e[36] = P, e[37] = O, e[38] = t, e[39] = d, e[40] = b, e[41] = D, e[42] = le, e[43] = Y;
659
- } else
660
- Y = e[43];
661
- let _;
662
- e[57] !== re || e[58] !== n?.other || e[59] !== n?.otherCount || e[60] !== n?.showAll || e[61] !== h ? (_ = re > 0 && /* @__PURE__ */ w(Oe, { hiddenCount: re, otherLabel: n?.other, otherCountLabel: n?.otherCount, showAllLabel: n?.showAll, onShowAll: h }), e[57] = re, e[58] = n?.other, e[59] = n?.otherCount, e[60] = n?.showAll, e[61] = h, e[62] = _) : _ = e[62];
663
- let J;
664
- e[63] !== ie || e[64] !== X || e[65] !== q || e[66] !== Y || e[67] !== _ ? (J = /* @__PURE__ */ E($, { ref: ie, sx: X, style: q, children: [
665
- Y,
666
- _
667
- ] }), e[63] = ie, e[64] = X, e[65] = q, e[66] = Y, e[67] = _, e[68] = J) : J = e[68];
668
- let Q;
669
- e[69] !== T || e[70] !== ce || e[71] !== t ? (Q = ce && t && /* @__PURE__ */ w(Ne, { series: t, colorAt: (L) => T(L) }), e[69] = T, e[70] = ce, e[71] = t, e[72] = Q) : Q = e[72];
670
- let se;
671
- return e[73] !== J || e[74] !== Q ? (se = /* @__PURE__ */ E($, { sx: x.root, children: [
672
- J,
673
- Q
674
- ] }), e[73] = J, e[74] = Q, e[75] = se) : se = e[75], se;
675
- }
676
- function He(f) {
677
- return f.name;
678
- }
679
- function Ve(f) {
680
- return String(f);
681
- }
682
- const Ke = (f) => ({
683
- data: f.data ?? [],
684
- rawData: f.rawData ?? void 0,
685
- formatter: f.formatter,
686
- labelFormatter: f.labelFormatter
687
- });
688
- function Ee(f) {
689
- if (!f) return 0;
690
- let e = 0;
691
- for (const o of f)
692
- for (const s of o) s.value > e && (e = s.value);
693
- return e;
694
- }
695
- function tt(f) {
696
- const e = j(13), {
697
- selection: o,
698
- onSelectionChange: s,
699
- series: l,
700
- maxItems: c,
701
- labels: r,
702
- onShowAll: t,
703
- maxOverride: v,
704
- size: n,
705
- stacked: h
706
- } = f, u = ve(), i = we(u, Ke), a = Ee(i.rawData), g = v ?? (a > 0 ? a : void 0);
707
- let d;
708
- return e[0] !== g || e[1] !== r || e[2] !== c || e[3] !== s || e[4] !== t || e[5] !== o || e[6] !== l || e[7] !== n || e[8] !== i.data || e[9] !== i.formatter || e[10] !== i.labelFormatter || e[11] !== h ? (d = /* @__PURE__ */ w(Me, { data: i.data, formatter: i.formatter, labelFormatter: i.labelFormatter, selection: o, onSelectionChange: s, series: l, maxItems: c, labels: r, onShowAll: t, maxOverride: g, size: n, stacked: h }), e[0] = g, e[1] = r, e[2] = c, e[3] = s, e[4] = t, e[5] = o, e[6] = l, e[7] = n, e[8] = i.data, e[9] = i.formatter, e[10] = i.labelFormatter, e[11] = h, e[12] = d) : d = e[12], d;
709
- }
710
- export {
711
- tt as C,
712
- he as a,
713
- Ne as b,
714
- Te as c,
715
- Oe as d,
716
- Re as e,
717
- Me as f
718
- };
719
- //# sourceMappingURL=category-CGS_eHr4.js.map