p1-charts 0.2.0 → 0.3.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 (150) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +100 -2
  3. package/dist/CategoryBarChart-1Kn3Vozc.js +580 -0
  4. package/dist/CategoryBarChart-1Kn3Vozc.js.map +1 -0
  5. package/dist/ChartFrame-B1bVFM2E.js +403 -0
  6. package/dist/ChartFrame-B1bVFM2E.js.map +1 -0
  7. package/dist/{Heatmap-C1XcTUg1.js → Heatmap-CFC753mV.js} +278 -272
  8. package/dist/Heatmap-CFC753mV.js.map +1 -0
  9. package/dist/{PieLegend-BZsv9IbF.js → PieLegend-CbpjaOJH.js} +94 -111
  10. package/dist/PieLegend-CbpjaOJH.js.map +1 -0
  11. package/dist/PolarChart-hcNTWKfJ.js +450 -0
  12. package/dist/PolarChart-hcNTWKfJ.js.map +1 -0
  13. package/dist/Sparkline-BApLVWfg.js +110 -0
  14. package/dist/Sparkline-BApLVWfg.js.map +1 -0
  15. package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BzeHEtQl.js} +120 -119
  16. package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BzeHEtQl.js.map} +1 -1
  17. package/dist/category.d.ts +1 -1
  18. package/dist/category.d.ts.map +1 -1
  19. package/dist/category.js +1 -1
  20. package/dist/charts/CategoryBarChart/index.d.ts +1 -1
  21. package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
  22. package/dist/charts/Heatmap/index.d.ts.map +1 -1
  23. package/dist/charts/PolarChart/index.d.ts.map +1 -1
  24. package/dist/charts/ScatterChart/index.d.ts +1 -1
  25. package/dist/charts/ScatterChart/index.d.ts.map +1 -1
  26. package/dist/charts/Sparkline/index.d.ts +5 -2
  27. package/dist/charts/Sparkline/index.d.ts.map +1 -1
  28. package/dist/components/ChartFrame/index.d.ts +7 -0
  29. package/dist/components/ChartFrame/index.d.ts.map +1 -0
  30. package/dist/components/ChartStory/index.d.ts +7 -0
  31. package/dist/components/ChartStory/index.d.ts.map +1 -0
  32. package/dist/components/HeatmapCells/index.d.ts +1 -1
  33. package/dist/components/HeatmapCells/index.d.ts.map +1 -1
  34. package/dist/{css-C-rsk7-l.js → css-BtFQ2bM4.js} +2 -2
  35. package/dist/{css-C-rsk7-l.js.map → css-BtFQ2bM4.js.map} +1 -1
  36. package/dist/heatmap.js +1 -1
  37. package/dist/hooks/useMarkMemory.d.ts +9 -0
  38. package/dist/hooks/useMarkMemory.d.ts.map +1 -0
  39. package/dist/hooks/usePieTween.d.ts.map +1 -1
  40. package/dist/hooks/useSteps.d.ts +4 -0
  41. package/dist/hooks/useSteps.d.ts.map +1 -0
  42. package/dist/hooks/useTween.d.ts +12 -0
  43. package/dist/hooks/useTween.d.ts.map +1 -0
  44. package/dist/index.d.ts +11 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +122 -118
  47. package/dist/index.js.map +1 -1
  48. package/dist/motion.utils-DFoqptDi.js +55 -0
  49. package/dist/motion.utils-DFoqptDi.js.map +1 -0
  50. package/dist/pie.js +1 -1
  51. package/dist/scatter.js +1 -1
  52. package/dist/series.js +1 -1
  53. package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
  54. package/dist/shared-C1pGJV4T.js.map +1 -0
  55. package/dist/sparkline.d.ts +1 -1
  56. package/dist/sparkline.d.ts.map +1 -1
  57. package/dist/sparkline.js +2 -2
  58. package/dist/story.d.ts +11 -0
  59. package/dist/story.d.ts.map +1 -0
  60. package/dist/story.js +7 -0
  61. package/dist/theme.js +3 -3
  62. package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DgmWROoe.js} +40 -20
  63. package/dist/theme.utils-DgmWROoe.js.map +1 -0
  64. package/dist/tooltip.utils-CXD_NapA.js +9 -0
  65. package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
  66. package/dist/types/category.d.ts +10 -0
  67. package/dist/types/category.d.ts.map +1 -1
  68. package/dist/types/heatmap.d.ts +3 -0
  69. package/dist/types/heatmap.d.ts.map +1 -1
  70. package/dist/types/heatmapParts.d.ts +2 -0
  71. package/dist/types/heatmapParts.d.ts.map +1 -1
  72. package/dist/types/motion.d.ts +31 -0
  73. package/dist/types/motion.d.ts.map +1 -0
  74. package/dist/types/pie.d.ts +3 -4
  75. package/dist/types/pie.d.ts.map +1 -1
  76. package/dist/types/polar.d.ts +3 -0
  77. package/dist/types/polar.d.ts.map +1 -1
  78. package/dist/types/scatter.d.ts +3 -0
  79. package/dist/types/scatter.d.ts.map +1 -1
  80. package/dist/types/sparkline.d.ts +3 -0
  81. package/dist/types/sparkline.d.ts.map +1 -1
  82. package/dist/types/story.d.ts +73 -0
  83. package/dist/types/story.d.ts.map +1 -0
  84. package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-KKtc1C4K.js} +2 -2
  85. package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-KKtc1C4K.js.map} +1 -1
  86. package/dist/useControllable-Crsr0byh.js +11 -0
  87. package/dist/useControllable-Crsr0byh.js.map +1 -0
  88. package/dist/useMarkMemory-CLNY6TtT.js +15 -0
  89. package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
  90. package/dist/useTween-B0G0CcvM.js +46 -0
  91. package/dist/useTween-B0G0CcvM.js.map +1 -0
  92. package/dist/utils/category.utils.d.ts +2 -0
  93. package/dist/utils/category.utils.d.ts.map +1 -1
  94. package/dist/utils/color.utils.d.ts +9 -0
  95. package/dist/utils/color.utils.d.ts.map +1 -1
  96. package/dist/utils/csv.utils.d.ts +6 -0
  97. package/dist/utils/csv.utils.d.ts.map +1 -0
  98. package/dist/utils/motion.utils.d.ts +25 -0
  99. package/dist/utils/motion.utils.d.ts.map +1 -1
  100. package/dist/utils/pieTween.utils.d.ts +1 -1
  101. package/dist/utils/pieTween.utils.d.ts.map +1 -1
  102. package/dist/utils/sparkline.utils.d.ts +15 -0
  103. package/dist/utils/sparkline.utils.d.ts.map +1 -1
  104. package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
  105. package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
  106. package/package.json +10 -3
  107. package/src/category.ts +1 -0
  108. package/src/charts/CategoryBarChart/index.tsx +203 -44
  109. package/src/charts/Heatmap/index.tsx +4 -0
  110. package/src/charts/PolarChart/index.tsx +98 -5
  111. package/src/charts/ScatterChart/index.tsx +96 -13
  112. package/src/charts/Sparkline/index.tsx +54 -7
  113. package/src/components/ChartFrame/index.tsx +180 -0
  114. package/src/components/ChartStory/index.tsx +184 -0
  115. package/src/components/HeatmapCells/index.tsx +5 -2
  116. package/src/hooks/useMarkMemory.ts +29 -0
  117. package/src/hooks/usePieTween.ts +9 -44
  118. package/src/hooks/useSteps.ts +77 -0
  119. package/src/hooks/useTween.ts +112 -0
  120. package/src/index.ts +19 -0
  121. package/src/sparkline.ts +1 -1
  122. package/src/story.ts +19 -0
  123. package/src/types/category.ts +11 -0
  124. package/src/types/heatmap.ts +3 -0
  125. package/src/types/heatmapParts.ts +2 -0
  126. package/src/types/motion.ts +35 -0
  127. package/src/types/pie.ts +3 -3
  128. package/src/types/polar.ts +3 -0
  129. package/src/types/scatter.ts +3 -0
  130. package/src/types/sparkline.ts +3 -0
  131. package/src/types/story.ts +103 -0
  132. package/src/utils/category.utils.ts +22 -0
  133. package/src/utils/color.utils.ts +48 -0
  134. package/src/utils/csv.utils.ts +28 -0
  135. package/src/utils/motion.utils.ts +124 -0
  136. package/src/utils/pieTween.utils.ts +1 -2
  137. package/src/utils/sparkline.utils.ts +69 -0
  138. package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
  139. package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
  140. package/dist/Heatmap-C1XcTUg1.js.map +0 -1
  141. package/dist/PieLegend-BZsv9IbF.js.map +0 -1
  142. package/dist/PolarChart-BUEhn3CI.js +0 -334
  143. package/dist/PolarChart-BUEhn3CI.js.map +0 -1
  144. package/dist/Sparkline-DtNhxGVo.js +0 -67
  145. package/dist/Sparkline-DtNhxGVo.js.map +0 -1
  146. package/dist/motion.utils-C1eaZJdQ.js +0 -9
  147. package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
  148. package/dist/theme.utils-CP1XtGIe.js.map +0 -1
  149. package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
  150. package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
@@ -1,10 +1,12 @@
1
1
  "use client";
2
- import { c as e } from "./theme.utils-CP1XtGIe.js";
3
- import { a as t, n, t as r } from "./visibility.utils-nMI5a_Et.js";
4
- import { n as i, r as a, t as o } from "./tooltip.utils-D7xaBSUK.js";
5
- import { n as s, t as c } from "./dom.utils-CKMWLto-.js";
6
- import { t as l } from "./useChartTheme-B06p_jvu.js";
7
- import { t as u } from "./motion.utils-C1eaZJdQ.js";
2
+ import { c as e } from "./theme.utils-DgmWROoe.js";
3
+ import { i as t, t as n } from "./visibility.utils-wuc3ZS8D.js";
4
+ import { n as r, t as i } from "./shared-C1pGJV4T.js";
5
+ import { n as a, t as o } from "./dom.utils-CKMWLto-.js";
6
+ import { t as s } from "./useChartTheme-KKtc1C4K.js";
7
+ import { t as c } from "./useControllable-Crsr0byh.js";
8
+ import { t as l } from "./tooltip.utils-CXD_NapA.js";
9
+ import { t as u } from "./useTween-B0G0CcvM.js";
8
10
  import { forwardRef as d, useEffect as f, useImperativeHandle as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
9
11
  import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
10
12
  //#region src/utils/pie.utils.ts
@@ -138,9 +140,9 @@ var te = {
138
140
  ArrowLeft: -1,
139
141
  ArrowUp: -1
140
142
  }, R = [], z = (e, t) => e === "none" ? R : e === "single" ? t.slice(-1) : t;
141
- function B({ slices: e, activeKey: t, onActiveChange: i, selectionMode: a = "none", selectedKeys: o, defaultSelectedKeys: c = R, onSelectionChange: l, hiddenKeys: u, defaultHiddenKeys: d = R, onHiddenChange: f, drillOther: p = !1, onDrill: m, onSliceClick: v, onSliceHover: y, onSliceLeave: b }) {
142
- let x = g(null), [S, C] = n(t, null), [w, T] = n(o, c), [E, D] = n(u, d), [O, k] = _(null), [A, j] = _(null), [M, N] = _(a), P = L(e, p, x), F = h(() => z(a, w), [a, w]);
143
- M !== a && (N(a), o === void 0 && T(z(M, w)));
143
+ function B({ slices: e, activeKey: t, onActiveChange: r, selectionMode: i = "none", selectedKeys: o, defaultSelectedKeys: s = R, onSelectionChange: l, hiddenKeys: u, defaultHiddenKeys: d = R, onHiddenChange: f, drillOther: p = !1, onDrill: m, onSliceClick: v, onSliceHover: y, onSliceLeave: b }) {
144
+ let x = g(null), [S, C] = c(t, null), [w, T] = c(o, s), [E, D] = c(u, d), [O, k] = _(null), [A, j] = _(null), [M, N] = _(i), P = L(e, p, x), F = h(() => z(i, w), [i, w]);
145
+ M !== i && (N(i), o === void 0 && T(z(M, w)));
144
146
  let I = h(() => ee(P.slices, E).map((e) => ({
145
147
  ...e,
146
148
  selected: !e.hidden && F.includes(e.key)
@@ -149,7 +151,7 @@ function B({ slices: e, activeKey: t, onActiveChange: i, selectionMode: a = "non
149
151
  E,
150
152
  F
151
153
  ]), B = I.filter((e) => !e.hidden), V = B.find((e) => e.key === S) ?? null, H = B.find((e) => e.key === O) ?? null, U = B.filter((e) => e.selected), W = (V ?? B[0])?.index ?? 0, G = (e, t) => {
152
- j(t), (e?.key ?? null) !== S && (C(e?.key ?? null), i?.(e, t));
154
+ j(t), (e?.key ?? null) !== S && (C(e?.key ?? null), r?.(e, t));
153
155
  }, K = (e) => {
154
156
  let t = e.flatMap((e) => I.filter((t) => t.key === e).map((e) => ({
155
157
  ...e,
@@ -159,13 +161,13 @@ function B({ slices: e, activeKey: t, onActiveChange: i, selectionMode: a = "non
159
161
  }, q = (e) => {
160
162
  P.setDrilled(e), m?.(e ? P.top : null), G(null, "api"), F.length > 0 && K([]), E.length > 0 && (D(R), f?.(R));
161
163
  }, J = (e) => {
162
- p && e.other ? q(!0) : a !== "none" && K(e.selected ? F.filter((t) => t !== e.key) : a === "single" ? [e.key] : [...F, e.key]), v?.(e);
163
- }, ne = (e, t = !1) => {
164
- let n = I.map((e) => e.key), i = r(n, E, e, t), a = F.filter((e) => !i.includes(e));
164
+ p && e.other ? q(!0) : i !== "none" && K(e.selected ? F.filter((t) => t !== e.key) : i === "single" ? [e.key] : [...F, e.key]), v?.(e);
165
+ }, Y = (e, t = !1) => {
166
+ let r = I.map((e) => e.key), i = n(r, E, e, t), a = F.filter((e) => !i.includes(e));
165
167
  i !== E && (D(i), f?.(i), a.length < F.length && K(a), V && i.includes(V.key) && G(null, "legend"));
166
- }, Y = (e, t) => {
167
- e.hidden || (G(e, t), y?.(e));
168
168
  }, X = (e, t) => {
169
+ e.hidden || (G(e, t), y?.(e));
170
+ }, Z = (e, t) => {
169
171
  e.key === S && G(null, t), b?.(e);
170
172
  };
171
173
  return {
@@ -180,13 +182,13 @@ function B({ slices: e, activeKey: t, onActiveChange: i, selectionMode: a = "non
180
182
  stop: W,
181
183
  handlers: {
182
184
  click: J,
183
- enter: Y,
184
- leave: X,
185
+ enter: X,
186
+ leave: Z,
185
187
  focus: (e, t) => {
186
- k(s(t) ? e.key : null), Y(e, "keyboard");
188
+ k(a(t) ? e.key : null), X(e, "keyboard");
187
189
  },
188
190
  blur: (e) => {
189
- k(null), X(e, "keyboard");
191
+ k(null), Z(e, "keyboard");
190
192
  },
191
193
  keyDown: (e, t) => {
192
194
  let n = Math.max(0, B.findIndex((e) => e.index === t)), r = e.key === "Home" ? -n : e.key === "End" ? B.length - 1 - n : te[e.key];
@@ -199,20 +201,14 @@ function B({ slices: e, activeKey: t, onActiveChange: i, selectionMode: a = "non
199
201
  x.current?.querySelectorAll("[data-part=\"slice\"]")[i?.index ?? t]?.focus();
200
202
  }
201
203
  },
202
- hide: ne
204
+ hide: Y
203
205
  }
204
206
  };
205
207
  }
206
208
  //#endregion
207
209
  //#region src/utils/pieTween.utils.ts
208
- var V = (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2, H = (e) => Object.fromEntries(e.map((e) => [e.key, [e.startAngle, e.endAngle]])), U = (e, t) => Object.keys(e).length === Object.keys(t).length && Object.entries(t).every(([t, [n, r]]) => e[t]?.[0] === n && e[t]?.[1] === r);
209
- function W(e, t, n) {
210
- return Object.fromEntries(Object.entries(t).map(([t, [r, i]]) => {
211
- let [a, o] = e[t] ?? [r, r];
212
- return [t, [a + (r - a) * n, o + (i - o) * n]];
213
- }));
214
- }
215
- function G(e, t) {
210
+ var V = (e) => Object.fromEntries(e.map((e) => [e.key, [e.startAngle, e.endAngle]]));
211
+ function H(e, t) {
216
212
  return e.map((e) => {
217
213
  let [n, r] = t[e.key] ?? [e.startAngle, e.endAngle];
218
214
  return {
@@ -225,44 +221,31 @@ function G(e, t) {
225
221
  }
226
222
  //#endregion
227
223
  //#region src/hooks/usePieTween.ts
228
- var K = 240;
229
- function q(e, t = !0) {
230
- let { duration: n = K, easing: r = V } = typeof t == "object" ? t : {}, i = h(() => H(e), [e]), a = g(i), [o, s] = _(null);
231
- return m(() => {
232
- let e = a.current;
233
- if (U(e, i)) return;
234
- if (t === !1 || n <= 0 || u()) {
235
- a.current = i, s(null);
236
- return;
237
- }
238
- let o = performance.now(), c = 0, l = () => {
239
- let t = Math.min(1, (performance.now() - o) / n), u = W(e, i, r(t));
240
- a.current = u, s(t < 1 ? u : null), t < 1 && (c = requestAnimationFrame(l));
241
- };
242
- return s(W(e, i, 0)), c = requestAnimationFrame(l), () => cancelAnimationFrame(c);
243
- }, [
244
- i,
245
- t,
224
+ var U = (e, [t]) => [t, t];
225
+ function W(e, t = !0) {
226
+ let n = h(() => V(e), [e]), r = u(n, t, { enter: U });
227
+ return h(() => r === n ? e : H(e, r), [
228
+ r,
246
229
  n,
247
- r
248
- ]), h(() => o ? G(e, o) : e, [o, e]);
230
+ e
231
+ ]);
249
232
  }
250
233
  //#endregion
251
234
  //#region src/utils/pieRails.utils.ts
252
- var J = 6, ne = 20, Y = 2, X = 4, re = 3;
253
- function ie(e) {
254
- let t = e?.pie.selection, n = Math.min(Math.max(t?.offset ?? J, 0), ne), r = n + (t?.width ?? Y) / 2 + X;
235
+ var G = 6, K = 20, q = 2, J = 4, Y = 3;
236
+ function X(e) {
237
+ let t = e?.pie.selection, n = Math.min(Math.max(t?.offset ?? G, 0), K), r = n + (t?.width ?? q) / 2 + J;
255
238
  return {
256
239
  selection: n,
257
240
  focus: r,
258
- room: r + re
241
+ room: r + Y
259
242
  };
260
243
  }
261
244
  //#endregion
262
245
  //#region src/hooks/usePieChart.ts
263
- var Z = 100, ae = 16, oe = 130, se = new Intl.NumberFormat(), ce = (e) => Math.min(Math.max(e, 0), .95);
264
- function le(e, t) {
265
- let { data: n, innerRadius: r, gap: i, maxSlices: a, otherLabel: o, labelSpacing: s, renderLabel: c, emphasis: u = "dim", selectionMode: d = "none", formatValue: f = se.format, describeSlice: m, animate: _ } = e, v = g(null), y = l(e), b = y?.pie, x = Z * ce(r ?? b?.innerRadius ?? 0), S = y ? i ?? b?.gap ?? 0 : 0, C = h(() => A(n, {
246
+ var Z = 100, ne = 16, re = 130, ie = new Intl.NumberFormat(), ae = (e) => Math.min(Math.max(e, 0), .95);
247
+ function oe(e, t) {
248
+ let { data: n, innerRadius: r, gap: i, maxSlices: a, otherLabel: o, labelSpacing: c, renderLabel: l, emphasis: u = "dim", selectionMode: d = "none", formatValue: f = ie.format, describeSlice: m, animate: _ } = e, v = g(null), y = s(e), b = y?.pie, x = Z * ae(r ?? b?.innerRadius ?? 0), S = y ? i ?? b?.gap ?? 0 : 0, C = h(() => A(n, {
266
249
  maxSlices: a ?? b?.maxSlices,
267
250
  otherLabel: o ?? b?.otherLabel
268
251
  }), [
@@ -275,13 +258,13 @@ function le(e, t) {
275
258
  ...e,
276
259
  slices: C,
277
260
  selectionMode: d
278
- }), { svgRef: E, slices: D, active: k, selected: j, handlers: M } = w, N = q(D, _), P = h(() => I(N.filter((e) => !e.hidden), {
261
+ }), { svgRef: E, slices: D, active: k, selected: j, handlers: M } = w, N = W(D, _), P = h(() => I(N.filter((e) => !e.hidden), {
279
262
  radius: Z,
280
- offset: ae,
281
- spacing: s ?? b?.labelSpacing ?? 32
263
+ offset: ne,
264
+ spacing: c ?? b?.labelSpacing ?? 32
282
265
  }), [
283
266
  N,
284
- s,
267
+ c,
285
268
  b?.labelSpacing
286
269
  ]);
287
270
  p(t, () => ({
@@ -304,7 +287,7 @@ function le(e, t) {
304
287
  isolate: () => M.hide(e.key, !0),
305
288
  enter: () => M.enter(e, "legend"),
306
289
  leave: () => M.leave(e, "legend")
307
- })), R = c === null || !F, z = R ? ie(y).room : oe, [V, H] = [Z + z, Z + (R ? z : 28)];
290
+ })), R = l === null || !F, z = R ? X(y).room : re, [V, H] = [Z + z, Z + (R ? z : 28)];
308
291
  return {
309
292
  ...w,
310
293
  theme: y,
@@ -334,24 +317,24 @@ function le(e, t) {
334
317
  }
335
318
  //#endregion
336
319
  //#region src/styles/pieChart.ts
337
- var ue = { position: "relative" }, de = {
320
+ var se = { position: "relative" }, ce = {
338
321
  display: "block",
339
322
  width: "100%",
340
323
  height: "auto",
341
324
  overflow: "visible"
342
- }, fe = {
325
+ }, le = {
343
326
  cursor: "pointer",
344
327
  strokeLinejoin: "round",
345
328
  touchAction: "manipulation"
346
- }, pe = {
329
+ }, ue = {
347
330
  fill: "none",
348
331
  pointerEvents: "none"
349
- }, me = { cursor: "pointer" }, Q = {
332
+ }, de = { cursor: "pointer" }, Q = {
350
333
  x: -4,
351
334
  y: -18,
352
335
  width: 120,
353
336
  height: 36
354
- }, he = {
337
+ }, fe = {
355
338
  fill: "none",
356
339
  stroke: "currentColor",
357
340
  strokeWidth: 1,
@@ -363,8 +346,8 @@ var ue = { position: "relative" }, de = {
363
346
  };
364
347
  //#endregion
365
348
  //#region src/components/PieRails/index.tsx
366
- function ge({ selected: e, focused: t, radius: n, theme: r, classNames: i, styles: a }) {
367
- let o = r?.pie.selection, s = ie(r), c = r && {
349
+ function pe({ selected: e, focused: t, radius: n, theme: r, classNames: i, styles: a }) {
350
+ let o = r?.pie.selection, s = X(r), c = r && {
368
351
  stroke: o?.color ?? r.palette.text,
369
352
  strokeWidth: o?.width ?? 2
370
353
  }, l = r && {
@@ -379,7 +362,7 @@ function ge({ selected: e, focused: t, radius: n, theme: r, classNames: i, style
379
362
  d: N(e.startAngle, e.endAngle, n + s.selection),
380
363
  className: i?.selection,
381
364
  style: {
382
- ...pe,
365
+ ...ue,
383
366
  ...c,
384
367
  ...a?.selection
385
368
  }
@@ -388,7 +371,7 @@ function ge({ selected: e, focused: t, radius: n, theme: r, classNames: i, style
388
371
  d: N(t.startAngle, t.endAngle, n + s.focus),
389
372
  className: i?.focus,
390
373
  style: {
391
- ...pe,
374
+ ...ue,
392
375
  ...l,
393
376
  ...a?.focus
394
377
  }
@@ -397,8 +380,8 @@ function ge({ selected: e, focused: t, radius: n, theme: r, classNames: i, style
397
380
  }
398
381
  //#endregion
399
382
  //#region src/components/PieCenter/index.tsx
400
- var _e = 1.6, ve = .6, ye = 16;
401
- function be({ summary: e, inner: t, unit: n, theme: r, formatValue: i, render: a, className: o, style: s }) {
383
+ var me = 1.6, he = .6, ge = 16;
384
+ function _e({ summary: e, inner: t, unit: n, theme: r, formatValue: i, render: a, className: o, style: s }) {
402
385
  if (a === null) return null;
403
386
  let c = e.slices.length === 0;
404
387
  if (!a && t <= 0 && !c) return null;
@@ -408,7 +391,7 @@ function be({ summary: e, inner: t, unit: n, theme: r, formatValue: i, render: a
408
391
  }, u = {
409
392
  ...$,
410
393
  ...D(r?.pie.centerUnit ?? r?.typography.label)
411
- }, d = e.active ? [e.active] : e.selected, f = (e) => d.reduce((t, n) => t + n[e], 0), p = Number(u.fontSize ?? ye), m = (e) => E(e, Math.max(1, Math.floor(t * _e / (p * ve)))), h = d.length ? [T(f("share")), d.length === 1 ? d[0].label : `${d.length} selected`] : n ? [n] : [];
394
+ }, d = e.active ? [e.active] : e.selected, f = (e) => d.reduce((t, n) => t + n[e], 0), p = Number(u.fontSize ?? ge), m = (e) => E(e, Math.max(1, Math.floor(t * me / (p * he)))), h = d.length ? [T(f("share")), d.length === 1 ? d[0].label : `${d.length} selected`] : n ? [n] : [];
412
395
  return /* @__PURE__ */ y("g", {
413
396
  "data-part": "center",
414
397
  textAnchor: "middle",
@@ -432,7 +415,7 @@ function be({ summary: e, inner: t, unit: n, theme: r, formatValue: i, render: a
432
415
  }
433
416
  //#endregion
434
417
  //#region src/components/PieLabels/index.tsx
435
- function xe({ labels: e, theme: t, formatValue: n, dimmed: r, handlers: i, render: a, classNames: o, styles: s }) {
418
+ function ve({ labels: e, theme: t, formatValue: n, dimmed: r, handlers: i, render: a, classNames: o, styles: s }) {
436
419
  if (a === null) return null;
437
420
  let c = t && {
438
421
  stroke: t.pie.leader?.color ?? t.palette.grid,
@@ -454,7 +437,7 @@ function xe({ labels: e, theme: t, formatValue: n, dimmed: r, handlers: i, rende
454
437
  points: h.map((e) => e.join(",")).join(" "),
455
438
  className: o?.leader,
456
439
  style: {
457
- ...he,
440
+ ...fe,
458
441
  ...c,
459
442
  ..._,
460
443
  ...s?.leader
@@ -466,7 +449,7 @@ function xe({ labels: e, theme: t, formatValue: n, dimmed: r, handlers: i, rende
466
449
  textAnchor: f > 0 ? "start" : "end",
467
450
  className: o?.label,
468
451
  style: {
469
- ...me,
452
+ ...de,
470
453
  ..._,
471
454
  ...s?.label
472
455
  },
@@ -496,7 +479,7 @@ function xe({ labels: e, theme: t, formatValue: n, dimmed: r, handlers: i, rende
496
479
  }
497
480
  //#endregion
498
481
  //#region src/components/PieSlices/index.tsx
499
- function Se({ slices: e, radius: t, inner: n, theme: r, gap: i, active: a, focused: o, pressable: s, dimmed: l, stop: u, describe: d, handlers: f, classNames: p, styles: m }) {
482
+ function ye({ slices: e, radius: t, inner: n, theme: r, gap: i, active: a, focused: s, pressable: c, dimmed: l, stop: u, describe: d, handlers: f, classNames: p, styles: m }) {
500
483
  let h = r?.pie.dimOpacity;
501
484
  return e.map((e, g) => {
502
485
  let _ = l(e);
@@ -508,19 +491,19 @@ function Se({ slices: e, radius: t, inner: n, theme: r, gap: i, active: a, focus
508
491
  "data-other": e.other || void 0,
509
492
  "data-selected": e.selected || void 0,
510
493
  "data-hidden": e.hidden || void 0,
511
- "data-focus-visible": o?.key === e.key || void 0,
494
+ "data-focus-visible": s?.key === e.key || void 0,
512
495
  role: "button",
513
496
  tabIndex: g === u ? 0 : -1,
514
497
  "aria-hidden": e.hidden || void 0,
515
- "aria-pressed": s(e) ? e.selected : void 0,
498
+ "aria-pressed": c(e) ? e.selected : void 0,
516
499
  "aria-label": d(e),
517
500
  d: P(e.startAngle, e.endAngle, t, n),
518
501
  fill: O(e, r),
519
502
  stroke: i > 0 ? r?.palette.background : void 0,
520
503
  strokeWidth: i > 0 ? i : void 0,
521
- className: c(p?.slice, e.className),
504
+ className: o(p?.slice, e.className),
522
505
  style: {
523
- ...fe,
506
+ ...le,
524
507
  ...r && { outline: "none" },
525
508
  ..._ && h !== void 0 && { opacity: h },
526
509
  ...m?.slice
@@ -536,18 +519,18 @@ function Se({ slices: e, radius: t, inner: n, theme: r, gap: i, active: a, focus
536
519
  }
537
520
  //#endregion
538
521
  //#region src/utils/pieTooltip.utils.ts
539
- function Ce(e, t, n, r, [i, a, o]) {
522
+ function be(e, t, n, r, [i, a, o]) {
540
523
  let [s, c] = k(e.midAngle, t), l = o ? n.width / o : 0;
541
524
  return [n.left - r.left + (s - i) * l, n.top - r.top + (c - a) * l];
542
525
  }
543
526
  //#endregion
544
527
  //#region src/components/PieTooltip/index.tsx
545
- var we = {
528
+ var xe = {
546
529
  pointer: 16,
547
530
  keyboard: 12
548
531
  };
549
- function Te({ active: e, source: t, root: n, svg: r, box: i, radius: s, render: c, className: l, style: u }) {
550
- let d = g(null), [p, h] = _(null), v = t === "pointer" || t === "keyboard" ? t : null, b = n.current?.getBoundingClientRect(), x = r.current?.getBoundingClientRect(), S = !e || !v ? null : v === "pointer" ? p : b && x ? Ce(e, s, x, b, i) : null;
532
+ function Se({ active: e, source: t, root: n, svg: i, box: a, radius: o, render: s, className: c, style: u }) {
533
+ let d = g(null), [p, h] = _(null), v = t === "pointer" || t === "keyboard" ? t : null, b = n.current?.getBoundingClientRect(), x = i.current?.getBoundingClientRect(), S = !e || !v ? null : v === "pointer" ? p : b && x ? be(e, o, x, b, a) : null;
551
534
  return f(() => {
552
535
  let e = n.current, t = (t) => {
553
536
  let n = e.getBoundingClientRect();
@@ -559,19 +542,19 @@ function Te({ active: e, source: t, root: n, svg: r, box: i, radius: s, render:
559
542
  }, [n]), m(() => {
560
543
  let e = d.current, t = e?.parentElement;
561
544
  if (!e || !t || !S || !v) return;
562
- let [n, r] = o(S, we[v], [e.offsetWidth, e.offsetHeight], [t.clientWidth, t.clientHeight]);
545
+ let [n, r] = l(S, xe[v], [e.offsetWidth, e.offsetHeight], [t.clientWidth, t.clientHeight]);
563
546
  e.style.transform = `translate(${n}px, ${r}px)`;
564
547
  }), !e || !v || !S ? null : /* @__PURE__ */ y("div", {
565
548
  ref: d,
566
549
  "data-part": "tooltip",
567
550
  "data-source": v,
568
551
  "aria-hidden": "true",
569
- className: l,
552
+ className: c,
570
553
  style: {
571
- ...a,
554
+ ...r,
572
555
  ...u
573
556
  },
574
- children: c(e, {
557
+ children: s(e, {
575
558
  source: v,
576
559
  x: S[0],
577
560
  y: S[1]
@@ -580,21 +563,21 @@ function Te({ active: e, source: t, root: n, svg: r, box: i, radius: s, render:
580
563
  }
581
564
  //#endregion
582
565
  //#region src/charts/PieChart/index.tsx
583
- function Ee(e, t) {
584
- let { unit: n, ariaLabel: r = "Pie chart", className: a, style: o, classNames: s, styles: l, renderLabel: u, renderCenter: d, renderLegend: f, renderTooltip: p, renderBreadcrumb: m, drillOther: h, selectionMode: g = "none" } = e, _ = le(e, t), { theme: v, radius: x, total: S, active: C, describe: w, dimmed: T } = _;
566
+ function Ce(e, t) {
567
+ let { unit: n, ariaLabel: r = "Pie chart", className: a, style: s, classNames: c, styles: l, renderLabel: u, renderCenter: d, renderLegend: f, renderTooltip: p, renderBreadcrumb: m, drillOther: h, selectionMode: g = "none" } = e, _ = oe(e, t), { theme: v, radius: x, total: S, active: C, describe: w, dimmed: T } = _;
585
568
  return /* @__PURE__ */ b("div", {
586
569
  ref: _.rootRef,
587
570
  "data-part": "root",
588
- className: c(a, s?.root),
571
+ className: o(a, c?.root),
589
572
  style: {
590
- ...ue,
591
- ...o,
573
+ ...se,
574
+ ...s,
592
575
  ...l?.root
593
576
  },
594
577
  children: [
595
578
  _.other && m && /* @__PURE__ */ y("div", {
596
579
  "data-part": "breadcrumb",
597
- className: s?.breadcrumb,
580
+ className: c?.breadcrumb,
598
581
  style: l?.breadcrumb,
599
582
  children: m({
600
583
  other: _.other,
@@ -606,9 +589,9 @@ function Ee(e, t) {
606
589
  role: "group",
607
590
  "aria-label": S ? r : `${r}, no data`,
608
591
  viewBox: _.box.join(" "),
609
- style: de,
592
+ style: ce,
610
593
  children: [
611
- /* @__PURE__ */ y(Se, {
594
+ /* @__PURE__ */ y(ye, {
612
595
  slices: _.drawn,
613
596
  radius: x,
614
597
  inner: _.inner,
@@ -621,28 +604,28 @@ function Ee(e, t) {
621
604
  stop: _.stop,
622
605
  describe: w,
623
606
  handlers: _.handlers,
624
- classNames: s,
607
+ classNames: c,
625
608
  styles: l
626
609
  }),
627
- /* @__PURE__ */ y(ge, {
610
+ /* @__PURE__ */ y(pe, {
628
611
  selected: _.rails.selected,
629
612
  focused: _.rails.focused,
630
613
  radius: x,
631
614
  theme: v,
632
- classNames: s,
615
+ classNames: c,
633
616
  styles: l
634
617
  }),
635
- /* @__PURE__ */ y(xe, {
618
+ /* @__PURE__ */ y(ve, {
636
619
  labels: _.labels,
637
620
  theme: v,
638
621
  formatValue: _.formatValue,
639
622
  dimmed: T,
640
623
  handlers: _.handlers,
641
624
  render: u,
642
- classNames: s,
625
+ classNames: c,
643
626
  styles: l
644
627
  }),
645
- /* @__PURE__ */ y(be, {
628
+ /* @__PURE__ */ y(_e, {
646
629
  summary: {
647
630
  total: S,
648
631
  slices: _.slices,
@@ -654,13 +637,13 @@ function Ee(e, t) {
654
637
  theme: v,
655
638
  formatValue: _.formatValue,
656
639
  render: d,
657
- className: s?.center,
640
+ className: c?.center,
658
641
  style: l?.center
659
642
  })
660
643
  ]
661
644
  }),
662
645
  f?.(_.legend),
663
- p && /* @__PURE__ */ y(Te, {
646
+ p && /* @__PURE__ */ y(Se, {
664
647
  active: C,
665
648
  source: _.source,
666
649
  root: _.rootRef,
@@ -668,14 +651,14 @@ function Ee(e, t) {
668
651
  box: _.box,
669
652
  radius: _.centroid,
670
653
  render: p,
671
- className: s?.tooltip,
654
+ className: c?.tooltip,
672
655
  style: l?.tooltip
673
656
  }),
674
657
  /* @__PURE__ */ y("div", {
675
658
  "data-part": "readout",
676
659
  "aria-live": "polite",
677
660
  "aria-atomic": "true",
678
- className: s?.readout,
661
+ className: c?.readout,
679
662
  style: {
680
663
  ...i,
681
664
  ...l?.readout
@@ -685,11 +668,11 @@ function Ee(e, t) {
685
668
  ]
686
669
  });
687
670
  }
688
- var De = d(Ee), Oe = new Intl.NumberFormat();
689
- function ke({ entries: e, formatValue: t = Oe.format, className: n, style: r, classNames: i }) {
671
+ var we = d(Ce), Te = new Intl.NumberFormat();
672
+ function Ee({ entries: e, formatValue: t = Te.format, className: n, style: r, classNames: i }) {
690
673
  return /* @__PURE__ */ y("ul", {
691
674
  "data-part": "legend",
692
- className: c(n, i?.legend),
675
+ className: o(n, i?.legend),
693
676
  style: r,
694
677
  children: e.map(({ slice: e, color: n, active: r, hidden: a, ...o }) => /* @__PURE__ */ y("li", { children: /* @__PURE__ */ b("button", {
695
678
  type: "button",
@@ -724,6 +707,6 @@ function ke({ entries: e, formatValue: t = Oe.format, className: n, style: r, cl
724
707
  });
725
708
  }
726
709
  //#endregion
727
- export { A as a, P as i, De as n, I as o, B as r, ke as t };
710
+ export { A as a, P as i, we as n, I as o, B as r, Ee as t };
728
711
 
729
- //# sourceMappingURL=PieLegend-BZsv9IbF.js.map
712
+ //# sourceMappingURL=PieLegend-CbpjaOJH.js.map