@carto/ps-react-ui 4.11.3 → 4.12.1

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 (103) hide show
  1. package/dist/chat.js +962 -733
  2. package/dist/chat.js.map +1 -1
  3. package/dist/csv-item-hH_Gt7ur.js +32 -0
  4. package/dist/csv-item-hH_Gt7ur.js.map +1 -0
  5. package/dist/{echart-BMPpj7n_.js → echart-Bdvbfx9s.js} +2 -2
  6. package/dist/echart-Bdvbfx9s.js.map +1 -0
  7. package/dist/{option-builders-F-c9ELi1.js → option-builders-DPeoyQaM.js} +41 -33
  8. package/dist/option-builders-DPeoyQaM.js.map +1 -0
  9. package/dist/png-item-9dNbB37T.js +57 -0
  10. package/dist/png-item-9dNbB37T.js.map +1 -0
  11. package/dist/table-B3ZWWhJt.js +383 -0
  12. package/dist/table-B3ZWWhJt.js.map +1 -0
  13. package/dist/types/chat/containers/chat-footer.d.ts +1 -1
  14. package/dist/types/chat/containers/styles.d.ts +79 -12
  15. package/dist/types/chat/index.d.ts +1 -1
  16. package/dist/types/chat/types.d.ts +21 -0
  17. package/dist/types/chat/use-typewriter.d.ts +5 -3
  18. package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
  19. package/dist/types/widgets-v2/actions/download/constants.d.ts +12 -0
  20. package/dist/types/widgets-v2/actions/download/csv-item.d.ts +38 -0
  21. package/dist/types/widgets-v2/actions/download/icons.d.ts +6 -0
  22. package/dist/types/widgets-v2/actions/download/index.d.ts +3 -1
  23. package/dist/types/widgets-v2/actions/index.d.ts +1 -1
  24. package/dist/types/widgets-v2/pie/skeleton.d.ts +9 -0
  25. package/dist/widgets/bar.js +1 -1
  26. package/dist/widgets/histogram.js +1 -1
  27. package/dist/widgets/pie.js +1 -1
  28. package/dist/widgets/scatterplot.js +5 -5
  29. package/dist/widgets/timeseries.js +1 -1
  30. package/dist/widgets/utils.js +1 -1
  31. package/dist/widgets-v2/actions.js +40 -36
  32. package/dist/widgets-v2/actions.js.map +1 -1
  33. package/dist/widgets-v2/bar.js +69 -76
  34. package/dist/widgets-v2/bar.js.map +1 -1
  35. package/dist/widgets-v2/category.js +50 -55
  36. package/dist/widgets-v2/category.js.map +1 -1
  37. package/dist/widgets-v2/echart.js +1 -1
  38. package/dist/widgets-v2/formula.js +37 -43
  39. package/dist/widgets-v2/formula.js.map +1 -1
  40. package/dist/widgets-v2/histogram.js +141 -147
  41. package/dist/widgets-v2/histogram.js.map +1 -1
  42. package/dist/widgets-v2/markdown.js +18 -17
  43. package/dist/widgets-v2/markdown.js.map +1 -1
  44. package/dist/widgets-v2/pie.js +174 -126
  45. package/dist/widgets-v2/pie.js.map +1 -1
  46. package/dist/widgets-v2/scatterplot.js +156 -166
  47. package/dist/widgets-v2/scatterplot.js.map +1 -1
  48. package/dist/widgets-v2/spread.js +36 -41
  49. package/dist/widgets-v2/spread.js.map +1 -1
  50. package/dist/widgets-v2/table.js +46 -55
  51. package/dist/widgets-v2/table.js.map +1 -1
  52. package/dist/widgets-v2/timeseries.js +83 -89
  53. package/dist/widgets-v2/timeseries.js.map +1 -1
  54. package/dist/widgets-v2.js +3 -3
  55. package/package.json +1 -1
  56. package/src/chat/bubbles/styles.ts +5 -1
  57. package/src/chat/containers/chat-content.tsx +4 -1
  58. package/src/chat/containers/chat-footer.test.tsx +59 -0
  59. package/src/chat/containers/chat-footer.tsx +124 -36
  60. package/src/chat/containers/styles.ts +107 -16
  61. package/src/chat/feedback/styles.ts +11 -4
  62. package/src/chat/index.ts +1 -0
  63. package/src/chat/types.ts +22 -0
  64. package/src/chat/use-typewriter.ts +32 -24
  65. package/src/widgets/utils/chart-config/index.ts +1 -0
  66. package/src/widgets/utils/chart-config/option-builders.test.ts +34 -0
  67. package/src/widgets/utils/chart-config/option-builders.ts +21 -0
  68. package/src/widgets-v2/actions/download/constants.ts +14 -0
  69. package/src/widgets-v2/actions/download/csv-item.test.tsx +77 -0
  70. package/src/widgets-v2/actions/download/csv-item.tsx +71 -0
  71. package/src/widgets-v2/actions/download/icons.tsx +10 -1
  72. package/src/widgets-v2/actions/download/index.ts +3 -1
  73. package/src/widgets-v2/actions/download/png-item.tsx +2 -1
  74. package/src/widgets-v2/actions/index.ts +5 -0
  75. package/src/widgets-v2/bar/download.tsx +16 -22
  76. package/src/widgets-v2/bar/options.ts +3 -2
  77. package/src/widgets-v2/category/download.test.ts +9 -0
  78. package/src/widgets-v2/category/download.ts +16 -20
  79. package/src/widgets-v2/echart/edge-label-clamp.ts +7 -4
  80. package/src/widgets-v2/formula/download.tsx +23 -29
  81. package/src/widgets-v2/histogram/download.ts +22 -26
  82. package/src/widgets-v2/histogram/options.ts +3 -2
  83. package/src/widgets-v2/markdown/{download.ts → download.tsx} +5 -2
  84. package/src/widgets-v2/pie/download.ts +16 -20
  85. package/src/widgets-v2/pie/skeleton.test.tsx +6 -3
  86. package/src/widgets-v2/pie/skeleton.tsx +69 -7
  87. package/src/widgets-v2/scatterplot/download.ts +16 -20
  88. package/src/widgets-v2/scatterplot/options.ts +3 -6
  89. package/src/widgets-v2/spread/download.ts +23 -27
  90. package/src/widgets-v2/table/download.test.ts +10 -0
  91. package/src/widgets-v2/table/download.ts +11 -15
  92. package/src/widgets-v2/table/helpers.test.ts +19 -0
  93. package/src/widgets-v2/table/helpers.ts +7 -12
  94. package/src/widgets-v2/timeseries/download.ts +36 -40
  95. package/src/widgets-v2/timeseries/options.ts +3 -2
  96. package/dist/echart-BMPpj7n_.js.map +0 -1
  97. package/dist/option-builders-F-c9ELi1.js.map +0 -1
  98. package/dist/png-item-BE9uEqlD.js +0 -45
  99. package/dist/png-item-BE9uEqlD.js.map +0 -1
  100. package/dist/table-C9IMbTr0.js +0 -385
  101. package/dist/table-C9IMbTr0.js.map +0 -1
  102. package/dist/types/chat/feedback/styles.d.ts +0 -211
  103. package/dist/types/widgets/utils/chart-config/option-builders.d.ts +0 -124
@@ -1,8 +1,8 @@
1
- import * as E from "echarts";
2
- import { d as H, g as V, c as W, n as S, f as F } from "../option-builders-F-c9ELi1.js";
3
- import { jsx as x, jsxs as M } from "react/jsx-runtime";
4
- import { c as q } from "react/compiler-runtime";
5
- import { Skeleton as I, Box as A } from "@mui/material";
1
+ import * as H from "echarts";
2
+ import { h as M, d as W, g as q, c as U, n as A, f as Y } from "../option-builders-DPeoyQaM.js";
3
+ import { jsx as x, jsxs as X } from "react/jsx-runtime";
4
+ import { c as J } from "react/compiler-runtime";
5
+ import { Skeleton as L, Box as S } from "@mui/material";
6
6
  import "../widget-store-Bw5zRUGg.js";
7
7
  import "zustand/shallow";
8
8
  import "@mui/icons-material";
@@ -21,52 +21,52 @@ import "zustand/vanilla";
21
21
  import "zustand/middleware";
22
22
  import "zustand/react/shallow";
23
23
  import { Z as b } from "../transforms-Cdx4fkU5.js";
24
- import { m as U, r as J } from "../resolve-theme-color-BdojIw0K.js";
25
- import { a as K } from "../exports-Cx-f6m6U.js";
26
- import { b as Q } from "../png-item-BE9uEqlD.js";
27
- function ee({
28
- theme: e,
29
- xFormatter: t,
24
+ import { m as K, r as Q } from "../resolve-theme-color-BdojIw0K.js";
25
+ import { b as V } from "../png-item-9dNbB37T.js";
26
+ import { b as ee } from "../csv-item-hH_Gt7ur.js";
27
+ function te({
28
+ theme: t,
29
+ xFormatter: e,
30
30
  yFormatter: r
31
31
  }) {
32
32
  return {
33
33
  grid: {
34
- left: parseInt(e.spacing(1)),
35
- top: parseInt(e.spacing(3)),
36
- right: parseInt(e.spacing(1)),
34
+ left: parseInt(t.spacing(1)),
35
+ top: parseInt(t.spacing(3)),
36
+ right: parseInt(t.spacing(1)),
37
37
  // Default: no legend. Merger bumps `bottom` when there are >1 series.
38
- ...W(!1, e),
38
+ ...U(!1, t),
39
39
  containLabel: !0
40
40
  },
41
41
  tooltip: {
42
42
  // Per-point trigger — different from Bar's 'axis' trigger because
43
43
  // points don't share an x-coordinate.
44
44
  trigger: "item",
45
- backgroundColor: e.palette.grey[900],
45
+ backgroundColor: t.palette.grey[900],
46
46
  borderWidth: 0,
47
- padding: [parseInt(e.spacing(1)), parseInt(e.spacing(1))],
47
+ padding: [parseInt(t.spacing(1)), parseInt(t.spacing(1))],
48
48
  textStyle: {
49
- color: e.palette.common.white,
49
+ color: t.palette.common.white,
50
50
  fontSize: 11,
51
- fontFamily: e.typography.caption.fontFamily
51
+ fontFamily: t.typography.caption.fontFamily
52
52
  },
53
- position: V(e),
54
- formatter: oe(t, r)
53
+ position: q(t),
54
+ formatter: oe(e, r)
55
55
  },
56
56
  // Legend styling baked here; `show` is toggled by the merger based on
57
57
  // series count.
58
58
  legend: {
59
- ...H({
59
+ ...W({
60
60
  hasLegend: !1,
61
61
  labelFormatter: void 0
62
62
  })
63
63
  },
64
64
  axisPointer: {
65
65
  lineStyle: {
66
- color: e.palette.grey[400]
66
+ color: t.palette.grey[400]
67
67
  }
68
68
  },
69
- color: [e.palette.secondary.main, ...Object.values(e.palette.qualitative?.bold ?? {})],
69
+ color: [t.palette.secondary.main, ...Object.values(t.palette.qualitative?.bold ?? {})],
70
70
  xAxis: {
71
71
  type: "value",
72
72
  axisLine: {
@@ -76,21 +76,19 @@ function ee({
76
76
  show: !1
77
77
  },
78
78
  axisLabel: {
79
- fontSize: e.typography.overlineDelicate?.fontSize,
80
- fontFamily: e.typography.overlineDelicate?.fontFamily,
81
- color: e.palette.black?.[60],
82
- margin: parseInt(e.spacing(1)),
79
+ ...M(t),
80
+ margin: parseInt(t.spacing(1)),
83
81
  hideOverlap: !0,
84
82
  showMinLabel: !0,
85
83
  showMaxLabel: !0,
86
- ...t && {
87
- formatter: t
84
+ ...e && {
85
+ formatter: e
88
86
  }
89
87
  },
90
88
  splitLine: {
91
89
  show: !0,
92
90
  lineStyle: {
93
- color: e.palette.black?.[4] ?? e.palette.divider
91
+ color: t.palette.black?.[4] ?? t.palette.divider
94
92
  }
95
93
  }
96
94
  },
@@ -103,10 +101,8 @@ function ee({
103
101
  show: !1
104
102
  },
105
103
  axisLabel: {
106
- fontSize: e.typography.overlineDelicate?.fontSize,
107
- fontFamily: e.typography.overlineDelicate?.fontFamily,
108
- color: e.palette.black?.[60],
109
- margin: parseInt(e.spacing(1)),
104
+ ...M(t),
105
+ margin: parseInt(t.spacing(1)),
110
106
  hideOverlap: !0,
111
107
  showMinLabel: !0,
112
108
  showMaxLabel: !0,
@@ -117,55 +113,55 @@ function ee({
117
113
  splitLine: {
118
114
  show: !0,
119
115
  lineStyle: {
120
- color: e.palette.black?.[4] ?? e.palette.divider
116
+ color: t.palette.black?.[4] ?? t.palette.divider
121
117
  }
122
118
  }
123
119
  }
124
120
  };
125
121
  }
126
- function De(e) {
122
+ function Oe(t) {
127
123
  const {
128
- theme: t,
124
+ theme: e,
129
125
  xFormatter: r,
130
126
  yFormatter: i,
131
- optionsOverride: n
132
- } = e, s = e.series, a = e.symbolSize ?? 8, l = e.selection, c = l && l.length > 0 ? new Set(l) : null;
133
- return (o, u, p) => {
134
- if (o == null) {
135
- const d = ee({
136
- theme: t,
127
+ optionsOverride: o
128
+ } = t, s = t.series, a = t.symbolSize ?? 8, l = t.selection, c = l && l.length > 0 ? new Set(l) : null;
129
+ return (n, p, u) => {
130
+ if (n == null) {
131
+ const d = te({
132
+ theme: e,
137
133
  xFormatter: r,
138
134
  yFormatter: i
139
135
  });
140
- return n ? U(d, n) : d;
136
+ return o ? K(d, o) : d;
141
137
  }
142
- const f = Array.isArray(u) ? u : [];
138
+ const f = Array.isArray(p) ? p : [];
143
139
  if (f.length === 0)
144
140
  return {
145
- ...o,
141
+ ...n,
146
142
  dataset: [],
147
143
  series: []
148
144
  };
149
- const k = f.length > 1, Y = typeof o.legend == "object" && !Array.isArray(o.legend) ? o.legend : {}, g = typeof o.grid == "object" && !Array.isArray(o.grid) ? o.grid : {}, L = typeof o.tooltip == "object" && !Array.isArray(o.tooltip) ? o.tooltip : {}, T = typeof o.xAxis == "object" && !Array.isArray(o.xAxis) ? o.xAxis : {}, N = typeof o.yAxis == "object" && !Array.isArray(o.yAxis) ? o.yAxis : {}, w = p?.formatter, {
150
- niceMinX: X,
151
- niceMaxX: D,
152
- niceMinY: j,
153
- niceMaxY: O
154
- } = ie(f), z = (d) => (m) => {
145
+ const w = f.length > 1, T = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, g = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, k = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, F = typeof n.xAxis == "object" && !Array.isArray(n.xAxis) ? n.xAxis : {}, N = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, I = u?.formatter, {
146
+ niceMinX: j,
147
+ niceMaxX: O,
148
+ niceMinY: _,
149
+ niceMaxY: D
150
+ } = ne(f), R = (d) => (m) => {
155
151
  const y = m.color;
156
152
  if (!c) return y;
157
- const Z = `${d}:${m.dataIndex}`;
158
- return c.has(Z) ? y : E.color.modifyAlpha(y, 0.15);
159
- }, h = te(o.dataZoom, k), _ = h?.hasXSlider ?? !1, B = h?.hasYSlider ?? !1, R = typeof g.bottom == "number" ? g.bottom : 24, $ = k ? 56 : R, P = _ ? $ + b.sliderHeight + b.sliderGap : $, C = typeof g.right == "number" ? g.right : 8, G = B ? C + b.sliderHeight + b.sliderGap : C;
153
+ const E = `${d}:${m.dataIndex}`;
154
+ return c.has(E) ? y : H.color.modifyAlpha(y, 0.15);
155
+ }, h = re(n.dataZoom, w), B = h?.hasXSlider ?? !1, z = h?.hasYSlider ?? !1, G = typeof g.bottom == "number" ? g.bottom : 24, $ = w ? 56 : G, P = B ? $ + b.sliderHeight + b.sliderGap : $, C = typeof g.right == "number" ? g.right : 8, Z = z ? C + b.sliderHeight + b.sliderGap : C;
160
156
  return {
161
- ...o,
157
+ ...n,
162
158
  // ECharts dataset.source wants a mutable [number, number][] shape; we
163
159
  // hold readonly tuples internally, so cast at the boundary.
164
160
  dataset: f.map((d) => ({
165
161
  source: d
166
162
  })),
167
163
  series: f.map((d, m) => {
168
- const y = J(t, s?.[m]?.color);
164
+ const y = Q(e, s?.[m]?.color);
169
165
  return {
170
166
  type: "scatter",
171
167
  datasetIndex: m,
@@ -179,7 +175,7 @@ function De(e) {
179
175
  focus: "series"
180
176
  },
181
177
  itemStyle: {
182
- color: z(m)
178
+ color: R(m)
183
179
  },
184
180
  ...y ? {
185
181
  color: y
@@ -187,26 +183,26 @@ function De(e) {
187
183
  };
188
184
  }),
189
185
  legend: {
190
- ...Y,
191
- show: k
186
+ ...T,
187
+ show: w
192
188
  },
193
189
  grid: {
194
190
  ...g,
195
191
  bottom: P,
196
- right: G
192
+ right: Z
197
193
  },
198
194
  ...h ? {
199
195
  dataZoom: h.entries
200
196
  } : {},
201
197
  xAxis: {
202
- ...T,
203
- min: X,
204
- max: D
198
+ ...F,
199
+ min: j,
200
+ max: O
205
201
  },
206
202
  yAxis: {
207
203
  ...N,
208
- min: j,
209
- max: O,
204
+ min: _,
205
+ max: D,
210
206
  axisLabel: {
211
207
  ...N.axisLabel ?? {},
212
208
  // Re-derive the y-axis formatter at fusion time so RelativeData's
@@ -214,30 +210,30 @@ function De(e) {
214
210
  // without rebuilding the structural option. Falls back to the
215
211
  // structural `yFormatter` already baked in `baseYAxis.axisLabel`
216
212
  // (which `String(value)` if neither is set).
217
- ...w ? {
218
- formatter: w
213
+ ...I ? {
214
+ formatter: I
219
215
  } : {}
220
216
  }
221
217
  },
222
218
  tooltip: {
223
- ...L,
219
+ ...k,
224
220
  // Rebuild the tooltip formatter so the live y-axis formatter is
225
221
  // applied to the y-coordinate in the (x, y) label. xFormatter is
226
222
  // structural — relative is a values-axis concept, so xFormatter
227
223
  // doesn't change under RelativeData.
228
- formatter: re(L.formatter, w, r)
224
+ formatter: ie(k.formatter, I, r)
229
225
  }
230
226
  };
231
227
  };
232
228
  }
233
- function te(e, t) {
234
- if (!Array.isArray(e) || e.length === 0) return null;
229
+ function re(t, e) {
230
+ if (!Array.isArray(t) || t.length === 0) return null;
235
231
  let r = !1, i = !1;
236
232
  return {
237
- entries: e.map((s) => {
233
+ entries: t.map((s) => {
238
234
  if (s == null || typeof s != "object") return s;
239
235
  const a = s;
240
- return a.type !== "slider" ? a : a.yAxisIndex !== void 0 ? (i = !0, a) : (r = !0, t ? {
236
+ return a.type !== "slider" ? a : a.yAxisIndex !== void 0 ? (i = !0, a) : (r = !0, e ? {
241
237
  ...a,
242
238
  bottom: b.sliderBottomWithLegend
243
239
  } : a);
@@ -246,36 +242,36 @@ function te(e, t) {
246
242
  hasYSlider: i
247
243
  };
248
244
  }
249
- function re(e, t, r) {
250
- return t ? F((i) => {
251
- const n = i.value, s = n?.[0], a = n?.[1], l = typeof s == "number" ? r ? r(s) : String(s) : "", c = typeof a == "number" ? t(a) : String(a ?? ""), o = typeof i.marker == "string" ? i.marker : "", u = i.seriesName ? `${i.seriesName}: ` : "";
245
+ function ie(t, e, r) {
246
+ return e ? Y((i) => {
247
+ const o = i.value, s = o?.[0], a = o?.[1], l = typeof s == "number" ? r ? r(s) : String(s) : "", c = typeof a == "number" ? e(a) : String(a ?? ""), n = typeof i.marker == "string" ? i.marker : "", p = i.seriesName ? `${i.seriesName}: ` : "";
252
248
  return {
253
249
  name: `(${l}, ${c})`,
254
- seriesName: u,
255
- marker: o,
250
+ seriesName: p,
251
+ marker: n,
256
252
  value: ""
257
253
  };
258
- }) : e;
254
+ }) : t;
259
255
  }
260
- function oe(e, t) {
261
- return F((r) => {
262
- const i = r.value, n = i?.[0], s = i?.[1], a = typeof n == "number" ? e ? e(n) : String(n) : "", l = typeof s == "number" ? t ? t(s) : String(s) : "", c = typeof r.marker == "string" ? r.marker : "", o = r.seriesName ? `${r.seriesName}: ` : "";
256
+ function oe(t, e) {
257
+ return Y((r) => {
258
+ const i = r.value, o = i?.[0], s = i?.[1], a = typeof o == "number" ? t ? t(o) : String(o) : "", l = typeof s == "number" ? e ? e(s) : String(s) : "", c = typeof r.marker == "string" ? r.marker : "", n = r.seriesName ? `${r.seriesName}: ` : "";
263
259
  return {
264
260
  name: `(${a}, ${l})`,
265
- seriesName: o,
261
+ seriesName: n,
266
262
  marker: c,
267
263
  value: ""
268
264
  };
269
265
  });
270
266
  }
271
- function ie(e) {
272
- let t = 1 / 0, r = -1 / 0, i = 1 / 0, n = -1 / 0;
273
- for (const o of e)
274
- for (const u of o) {
275
- const p = u?.[0], f = u?.[1];
276
- typeof p == "number" && Number.isFinite(p) && (p < t && (t = p), p > r && (r = p)), typeof f == "number" && Number.isFinite(f) && (f < i && (i = f), f > n && (n = f));
267
+ function ne(t) {
268
+ let e = 1 / 0, r = -1 / 0, i = 1 / 0, o = -1 / 0;
269
+ for (const n of t)
270
+ for (const p of n) {
271
+ const u = p?.[0], f = p?.[1];
272
+ typeof u == "number" && Number.isFinite(u) && (u < e && (e = u), u > r && (r = u)), typeof f == "number" && Number.isFinite(f) && (f < i && (i = f), f > o && (o = f));
277
273
  }
278
- const s = Number.isFinite(r) ? r <= 0 ? 1 : S(r) : 1, a = Number.isFinite(n) ? n <= 0 ? 1 : S(n) : 1, l = Number.isFinite(t) && t < 0 ? S(t) : 0, c = Number.isFinite(i) && i < 0 ? S(i) : 0;
274
+ const s = Number.isFinite(r) ? r <= 0 ? 1 : A(r) : 1, a = Number.isFinite(o) ? o <= 0 ? 1 : A(o) : 1, l = Number.isFinite(e) && e < 0 ? A(e) : 0, c = Number.isFinite(i) && i < 0 ? A(i) : 0;
279
275
  return {
280
276
  niceMinX: l,
281
277
  niceMaxX: s,
@@ -290,11 +286,11 @@ const v = {
290
286
  justifyContent: "space-between",
291
287
  flexDirection: "column",
292
288
  gap: ({
293
- spacing: e
294
- }) => e(1),
289
+ spacing: t
290
+ }) => t(1),
295
291
  height: ({
296
- spacing: e
297
- }) => e(38)
292
+ spacing: t
293
+ }) => t(38)
298
294
  },
299
295
  grid: {
300
296
  position: "relative",
@@ -305,105 +301,99 @@ const v = {
305
301
  display: "flex",
306
302
  alignItems: "center",
307
303
  gap: ({
308
- spacing: e
309
- }) => e(2),
304
+ spacing: t
305
+ }) => t(2),
310
306
  height: ({
311
- spacing: e
312
- }) => e(5)
307
+ spacing: t
308
+ }) => t(5)
313
309
  },
314
310
  legendItem: {
315
311
  display: "flex",
316
312
  alignItems: "center",
317
313
  gap: ({
318
- spacing: e
319
- }) => e(1.5)
314
+ spacing: t
315
+ }) => t(1.5)
320
316
  }
321
- }, ne = (e, t, r) => ({
317
+ }, se = (t, e, r) => ({
322
318
  position: "absolute",
323
- top: e,
324
- left: t,
319
+ top: t,
320
+ left: e,
325
321
  width: r,
326
322
  height: r,
327
323
  borderRadius: "50%"
328
324
  });
329
- function je(e) {
330
- const t = q(15), {
325
+ function _e(t) {
326
+ const e = J(15), {
331
327
  count: r
332
- } = e, i = r === void 0 ? 24 : r;
333
- let n, s, a, l, c;
334
- if (t[0] !== i) {
328
+ } = t, i = r === void 0 ? 24 : r;
329
+ let o, s, a, l, c;
330
+ if (e[0] !== i) {
335
331
  const f = Array.from({
336
332
  length: i
337
- }, le);
338
- s = A, c = v.container, n = A, a = v.grid, l = f.map(ae), t[0] = i, t[1] = n, t[2] = s, t[3] = a, t[4] = l, t[5] = c;
333
+ }, ce);
334
+ s = S, c = v.container, o = S, a = v.grid, l = f.map(le), e[0] = i, e[1] = o, e[2] = s, e[3] = a, e[4] = l, e[5] = c;
339
335
  } else
340
- n = t[1], s = t[2], a = t[3], l = t[4], c = t[5];
341
- let o;
342
- t[6] !== n || t[7] !== a || t[8] !== l ? (o = /* @__PURE__ */ x(n, { sx: a, children: l }), t[6] = n, t[7] = a, t[8] = l, t[9] = o) : o = t[9];
343
- let u;
344
- t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ x(A, { sx: v.legend, children: [0, 1].map(se) }), t[10] = u) : u = t[10];
336
+ o = e[1], s = e[2], a = e[3], l = e[4], c = e[5];
337
+ let n;
338
+ e[6] !== o || e[7] !== a || e[8] !== l ? (n = /* @__PURE__ */ x(o, { sx: a, children: l }), e[6] = o, e[7] = a, e[8] = l, e[9] = n) : n = e[9];
345
339
  let p;
346
- return t[11] !== s || t[12] !== c || t[13] !== o ? (p = /* @__PURE__ */ M(s, { sx: c, children: [
347
- o,
348
- u
349
- ] }), t[11] = s, t[12] = c, t[13] = o, t[14] = p) : p = t[14], p;
340
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ x(S, { sx: v.legend, children: [0, 1].map(ae) }), e[10] = p) : p = e[10];
341
+ let u;
342
+ return e[11] !== s || e[12] !== c || e[13] !== n ? (u = /* @__PURE__ */ X(s, { sx: c, children: [
343
+ n,
344
+ p
345
+ ] }), e[11] = s, e[12] = c, e[13] = n, e[14] = u) : u = e[14], u;
350
346
  }
351
- function se(e) {
352
- return /* @__PURE__ */ M(A, { sx: v.legendItem, children: [
353
- /* @__PURE__ */ x(I, { variant: "circular", width: 8, height: 8 }),
354
- /* @__PURE__ */ x(I, { width: 48, height: 8 })
355
- ] }, `legend-${e}`);
347
+ function ae(t) {
348
+ return /* @__PURE__ */ X(S, { sx: v.legendItem, children: [
349
+ /* @__PURE__ */ x(L, { variant: "circular", width: 8, height: 8 }),
350
+ /* @__PURE__ */ x(L, { width: 48, height: 8 })
351
+ ] }, `legend-${t}`);
356
352
  }
357
- function ae(e, t) {
358
- return /* @__PURE__ */ x(I, { variant: "circular", sx: ne(e.top, e.left, e.size) }, `dot-${t}`);
353
+ function le(t, e) {
354
+ return /* @__PURE__ */ x(L, { variant: "circular", sx: se(t.top, t.left, t.size) }, `dot-${e}`);
359
355
  }
360
- function le(e, t) {
361
- const r = 10 + t * 37 % 80, i = 5 + t * 53 % 90, n = 8 + t * 7 % 6;
356
+ function ce(t, e) {
357
+ const r = 10 + e * 37 % 80, i = 5 + e * 53 % 90, o = 8 + e * 7 % 6;
362
358
  return {
363
359
  top: `${r}%`,
364
360
  left: `${i}%`,
365
- size: n
361
+ size: o
366
362
  };
367
363
  }
368
- function Oe(e) {
369
- const t = [];
370
- return e.getCaptureEl && t.push(Q({
371
- filename: e.filename,
372
- getCaptureEl: e.getCaptureEl,
373
- pixelRatio: e.pngPixelRatio,
374
- backgroundColor: e.pngBackgroundColor
375
- })), t.push({
376
- id: "csv",
377
- label: "Download as CSV",
378
- resolve: () => {
379
- const r = e.getData(), i = [["series", "x", "y"]];
380
- for (const [s, a] of r.entries()) {
381
- const l = e.seriesNames?.[s] ?? `series_${s + 1}`;
382
- for (const [c, o] of a)
383
- i.push([l, c, o]);
364
+ function De(t) {
365
+ const e = [];
366
+ return t.getCaptureEl && e.push(V({
367
+ filename: t.filename,
368
+ getCaptureEl: t.getCaptureEl,
369
+ pixelRatio: t.pngPixelRatio,
370
+ backgroundColor: t.pngBackgroundColor
371
+ })), e.push(ee({
372
+ filename: t.filename,
373
+ getRows: () => {
374
+ const r = t.getData(), i = [["series", "x", "y"]];
375
+ for (const [o, s] of r.entries()) {
376
+ const a = t.seriesNames?.[o] ?? `series_${o + 1}`;
377
+ for (const [l, c] of s)
378
+ i.push([a, l, c]);
384
379
  }
385
- const n = K(i);
386
- return Promise.resolve({
387
- url: n.url,
388
- filename: `${e.filename}.csv`,
389
- revoke: n.revoke
390
- });
380
+ return i;
391
381
  }
392
- }), t;
382
+ })), e;
393
383
  }
394
- const ze = (e) => Array.isArray(e) ? e.map((t) => {
395
- if (!ce(t)) return t;
396
- const r = t.reduce((i, [, n]) => i + Math.abs(n), 0);
397
- return r <= 0 ? t : t.map(([i, n]) => [i, n / r * 100]);
398
- }) : e;
399
- function ce(e) {
400
- return Array.isArray(e) ? e.every((t) => Array.isArray(t) && t.length === 2 && typeof t[0] == "number" && Number.isFinite(t[0]) && typeof t[1] == "number" && Number.isFinite(t[1])) : !1;
384
+ const Re = (t) => Array.isArray(t) ? t.map((e) => {
385
+ if (!fe(e)) return e;
386
+ const r = e.reduce((i, [, o]) => i + Math.abs(o), 0);
387
+ return r <= 0 ? e : e.map(([i, o]) => [i, o / r * 100]);
388
+ }) : t;
389
+ function fe(t) {
390
+ return Array.isArray(t) ? t.every((e) => Array.isArray(e) && e.length === 2 && typeof e[0] == "number" && Number.isFinite(e[0]) && typeof e[1] == "number" && Number.isFinite(e[1])) : !1;
401
391
  }
402
392
  export {
403
- je as ScatterplotSkeleton,
404
- Oe as createScatterplotDownloadConfig,
405
- De as createScatterplotOptionFactory,
406
- ee as scatterplotOptions,
407
- ze as toRelativeScatterplotData
393
+ _e as ScatterplotSkeleton,
394
+ De as createScatterplotDownloadConfig,
395
+ Oe as createScatterplotOptionFactory,
396
+ te as scatterplotOptions,
397
+ Re as toRelativeScatterplotData
408
398
  };
409
399
  //# sourceMappingURL=scatterplot.js.map