panelui-native 0.43.0 → 0.46.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 (58) hide show
  1. package/README.md +2 -1
  2. package/lib/module/components/card/index.js +8 -154
  3. package/lib/module/components/card/index.js.map +1 -1
  4. package/lib/module/components/combobox/index.js +7 -1
  5. package/lib/module/components/combobox/index.js.map +1 -1
  6. package/lib/module/components/date-time-picker/index.js +254 -0
  7. package/lib/module/components/date-time-picker/index.js.map +1 -0
  8. package/lib/module/components/grid-item/index.js +486 -0
  9. package/lib/module/components/grid-item/index.js.map +1 -0
  10. package/lib/module/components/{kpi-chart → kpi}/index.js +62 -62
  11. package/lib/module/components/kpi/index.js.map +1 -0
  12. package/lib/module/components/line-chart/index.js +92 -10
  13. package/lib/module/components/line-chart/index.js.map +1 -1
  14. package/lib/module/components/pie-chart/index.js +625 -0
  15. package/lib/module/components/pie-chart/index.js.map +1 -0
  16. package/lib/module/components/scatter-chart/index.js +1173 -0
  17. package/lib/module/components/scatter-chart/index.js.map +1 -0
  18. package/lib/module/components/tabs/index.js +275 -33
  19. package/lib/module/components/tabs/index.js.map +1 -1
  20. package/lib/module/index.js +5 -1
  21. package/lib/module/index.js.map +1 -1
  22. package/lib/module/utils/chart.js +81 -0
  23. package/lib/module/utils/chart.js.map +1 -1
  24. package/lib/typescript/src/components/card/index.d.ts +0 -20
  25. package/lib/typescript/src/components/card/index.d.ts.map +1 -1
  26. package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
  27. package/lib/typescript/src/components/date-time-picker/index.d.ts +121 -0
  28. package/lib/typescript/src/components/date-time-picker/index.d.ts.map +1 -0
  29. package/lib/typescript/src/components/grid-item/index.d.ts +292 -0
  30. package/lib/typescript/src/components/grid-item/index.d.ts.map +1 -0
  31. package/lib/typescript/src/components/{kpi-chart → kpi}/index.d.ts +65 -65
  32. package/lib/typescript/src/components/kpi/index.d.ts.map +1 -0
  33. package/lib/typescript/src/components/line-chart/index.d.ts +25 -1
  34. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  35. package/lib/typescript/src/components/pie-chart/index.d.ts +245 -0
  36. package/lib/typescript/src/components/pie-chart/index.d.ts.map +1 -0
  37. package/lib/typescript/src/components/scatter-chart/index.d.ts +309 -0
  38. package/lib/typescript/src/components/scatter-chart/index.d.ts.map +1 -0
  39. package/lib/typescript/src/components/tabs/index.d.ts +20 -2
  40. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  41. package/lib/typescript/src/index.d.ts +7 -3
  42. package/lib/typescript/src/index.d.ts.map +1 -1
  43. package/lib/typescript/src/utils/chart.d.ts +34 -0
  44. package/lib/typescript/src/utils/chart.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/src/components/card/index.tsx +7 -209
  47. package/src/components/combobox/index.tsx +7 -1
  48. package/src/components/date-time-picker/index.tsx +375 -0
  49. package/src/components/grid-item/index.tsx +515 -0
  50. package/src/components/{kpi-chart → kpi}/index.tsx +85 -85
  51. package/src/components/line-chart/index.tsx +98 -8
  52. package/src/components/pie-chart/index.tsx +863 -0
  53. package/src/components/scatter-chart/index.tsx +1401 -0
  54. package/src/components/tabs/index.tsx +305 -35
  55. package/src/index.ts +66 -18
  56. package/src/utils/chart.ts +110 -0
  57. package/lib/module/components/kpi-chart/index.js.map +0 -1
  58. package/lib/typescript/src/components/kpi-chart/index.d.ts.map +0 -1
@@ -0,0 +1,625 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * PieChart — one whole, divided between its parts.
5
+ *
6
+ * ```tsx
7
+ * <PieChart data={spend} innerRadius={0.58}>
8
+ * <PieChart.Header title="This month" value="$18,420" legend />
9
+ * <PieChart.Slices />
10
+ * <PieChart.Center />
11
+ * </PieChart>
12
+ * ```
13
+ *
14
+ * ## What it is, against the ring beside it
15
+ *
16
+ * A ring chart draws a value against *its own* target, so three rings can all
17
+ * sit at ninety percent of three unrelated numbers and nothing has to add up.
18
+ * A pie is the opposite claim: every slice is a share of one total, the angles
19
+ * must come to a full turn, and a slice only means anything next to the others.
20
+ * That is why nothing here takes a `maxValue` and why every value is normalised
21
+ * against the sum — the sum *is* the subject.
22
+ *
23
+ * It follows that a pie is the wrong shape for a great many things. Two numbers
24
+ * that do not belong to one whole, a series over time, anything a reader has to
25
+ * compare precisely: all of those are a bar chart, because an angle is the
26
+ * hardest quantity to read off a page and the fifth-largest slice of eleven is
27
+ * not a fact anybody is going to extract. Use it for a handful of parts of one
28
+ * obvious total, and put the number in the middle.
29
+ *
30
+ * ## Drawing
31
+ *
32
+ * Each slice is a filled path rather than a stroked arc, because a slice is a
33
+ * *region* — two arcs and two radial edges — and a stroke is a band of even
34
+ * thickness with no ends of its own. `wedgePath` builds it, and rebuilds it on
35
+ * the UI thread on every frame of the reveal.
36
+ *
37
+ * That is what makes the reveal an unroll rather than a fade: one angle sweeps
38
+ * clockwise from the start and each slice is drawn only as far as it has got
39
+ * to. The pie fills the way it would be drawn by hand, and the slices arrive in
40
+ * the order they are listed rather than all at once.
41
+ *
42
+ * Touch, not hover: a slice is selected by pressing it, and pressing the same
43
+ * one again clears the selection. There is no equivalent of a pointer resting
44
+ * somewhere without committing, so a chart that only revealed its numbers on
45
+ * hover would never reveal them at all.
46
+ */
47
+ import { Children, createContext, forwardRef, isValidElement, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
48
+ import { Pressable, View } from 'react-native';
49
+ import Animated, { Easing, useAnimatedProps, useDerivedValue, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
50
+ import Svg, { G, Path } from 'react-native-svg';
51
+ import { useCSSVariable } from 'uniwind';
52
+ import { Text } from "../../primitives/text.js";
53
+ import { compactNumber, useSeriesColor, wedgePath } from "../../utils/chart.js";
54
+ import { cn } from "../../utils/cn.js";
55
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
56
+ const AnimatedPath = Animated.createAnimatedComponent(Path);
57
+
58
+ /** Milliseconds for a slice to lift out and settle back as it is selected. */
59
+ const SELECT_DURATION = 180;
60
+
61
+ /** Where a child is drawn: inside the SVG, over it, above it, or under it. */
62
+
63
+ /** Whether the chart is showing data or waiting for it. */
64
+
65
+ /** One slice. Its share is worked out from the others, so there is no maximum. */
66
+
67
+ /** A slice's place on the dial, in turns clockwise from twelve o'clock. */
68
+
69
+ const PieChartContext = /*#__PURE__*/createContext(null);
70
+ function useChart(component) {
71
+ const context = useContext(PieChartContext);
72
+ if (!context) {
73
+ throw new Error(`${component} must be used within a <PieChart>`);
74
+ }
75
+ return context;
76
+ }
77
+
78
+ /** The selected slice and its share, for something rendered inside the chart. */
79
+ export function usePieChart() {
80
+ const {
81
+ data,
82
+ slices,
83
+ activeIndex
84
+ } = useChart('usePieChart');
85
+ return {
86
+ activeIndex,
87
+ activeSlice: activeIndex >= 0 ? data[activeIndex] ?? null : null,
88
+ /** The selected slice's share of the whole, 0 to 1. */
89
+ activeFraction: activeIndex >= 0 ? slices[activeIndex]?.fraction ?? 0 : 0
90
+ };
91
+ }
92
+
93
+ /** Imperative handle: re-run the unroll, for a "replay" control. */
94
+
95
+ /** Room kept outside the pie so a selected slice has somewhere to lift into. */
96
+ const LIFT = 8;
97
+ const PieChartRoot = /*#__PURE__*/forwardRef(function PieChartRoot({
98
+ className,
99
+ data,
100
+ size,
101
+ innerRadius = 0,
102
+ startAngle = 0,
103
+ endAngle = 360,
104
+ padAngle = 0,
105
+ minAngle = 0,
106
+ animationDuration = 900,
107
+ status = 'ready',
108
+ activeIndex: activeIndexProp,
109
+ onActiveIndexChange,
110
+ children,
111
+ ...props
112
+ }, ref) {
113
+ const [measured, setMeasured] = useState(0);
114
+ const [internalActive, setInternalActive] = useState(-1);
115
+ const reveal = useSharedValue(0);
116
+ const reducedMotion = useReducedMotion();
117
+ const controlled = activeIndexProp !== undefined;
118
+ const activeIndex = controlled ? activeIndexProp : internalActive;
119
+ const setActiveIndex = useMemo(() => index => {
120
+ if (!controlled) setInternalActive(index);
121
+ onActiveIndexChange?.(index);
122
+ }, [controlled, onActiveIndexChange]);
123
+ const box = size ?? measured;
124
+ const radius = Math.max(box / 2 - LIFT, 0);
125
+ const hole = radius * Math.max(0, Math.min(innerRadius, 0.95));
126
+ const origin = startAngle / 360;
127
+ // Clamped to one turn, because a pie drawn past 360° laps itself and the
128
+ // slice underneath is simply gone.
129
+ const span = Math.min(Math.max(endAngle - startAngle, 0), 360) / 360;
130
+ const total = useMemo(() => data.reduce((sum, slice) => sum + Math.max(0, slice.value), 0), [data]);
131
+ const slices = useMemo(() => {
132
+ const count = data.length;
133
+ if (!count || total <= 0 || span <= 0) return [];
134
+
135
+ /*
136
+ * The gaps and the floors are taken out of the turn *first*, and what is
137
+ * left is shared by value. Adding them instead would push the last slice
138
+ * past the end of the dial, which on a closed pie means over the first one.
139
+ */
140
+ const pad = Math.min(padAngle / 360, span / (count * 2));
141
+ const gaps = count > 1 || span < 1 ? pad * count : 0;
142
+ const floor = Math.min(minAngle / 360, (span - gaps) / (count * 2));
143
+ const drawn = data.filter(slice => Math.max(0, slice.value) > 0).length;
144
+ const floors = floor * drawn;
145
+ const free = Math.max(span - gaps - floors, 0);
146
+ const result = [];
147
+ let cursor = origin + pad / 2;
148
+ for (const slice of data) {
149
+ const value = Math.max(0, slice.value);
150
+ const fraction = value / total;
151
+ const sweep = value > 0 ? floor + free * fraction : 0;
152
+ result.push({
153
+ from: cursor,
154
+ to: cursor + sweep,
155
+ mid: cursor + sweep / 2,
156
+ fraction
157
+ });
158
+ cursor += sweep + pad;
159
+ }
160
+ return result;
161
+ }, [data, total, origin, span, padAngle, minAngle]);
162
+ const playReveal = useMemo(() => () => {
163
+ if (reducedMotion) {
164
+ reveal.value = 1;
165
+ return;
166
+ }
167
+ reveal.value = 0;
168
+ reveal.value = withTiming(1, {
169
+ duration: animationDuration,
170
+ easing: Easing.bezier(0.85, 0, 0.15, 1)
171
+ });
172
+ }, [reducedMotion, animationDuration, reveal]);
173
+ const loading = status === 'loading';
174
+ const revealed = useRef(false);
175
+ useEffect(() => {
176
+ if (loading) {
177
+ revealed.current = false;
178
+ reveal.value = 0;
179
+ return;
180
+ }
181
+ if (revealed.current || box <= 0 || !slices.length) return;
182
+ revealed.current = true;
183
+ playReveal();
184
+ }, [loading, box, slices.length, playReveal, reveal]);
185
+ useImperativeHandle(ref, () => ({
186
+ replay: playReveal
187
+ }), [playReveal]);
188
+
189
+ // Resolved here rather than inside the slices, so the legend, the header and
190
+ // the centre readout can name a slice's colour without drawing one.
191
+ const c1 = useSeriesColor(undefined, 1);
192
+ const c2 = useSeriesColor(undefined, 2);
193
+ const c3 = useSeriesColor(undefined, 3);
194
+ const c4 = useSeriesColor(undefined, 4);
195
+ const c5 = useSeriesColor(undefined, 5);
196
+ const palette = useMemo(() => [c1, c2, c3, c4, c5], [c1, c2, c3, c4, c5]);
197
+ const colors = useMemo(() => data.map((slice, index) => slice.color ?? palette[index % palette.length]), [data, palette]);
198
+ const onLayout = event => {
199
+ const {
200
+ width,
201
+ height
202
+ } = event.nativeEvent.layout;
203
+ const next = Math.round(Math.min(width, height));
204
+ if (next !== measured) setMeasured(next);
205
+ props.onLayout?.(event);
206
+ };
207
+ const context = useMemo(() => ({
208
+ data,
209
+ total,
210
+ size: box,
211
+ radius,
212
+ hole,
213
+ colors,
214
+ slices,
215
+ origin,
216
+ span,
217
+ reveal,
218
+ status,
219
+ activeIndex,
220
+ setActiveIndex
221
+ }), [data, total, box, radius, hole, colors, slices, origin, span, reveal, status, activeIndex, setActiveIndex]);
222
+ const slots = {
223
+ svg: [],
224
+ overlay: [],
225
+ header: [],
226
+ footer: []
227
+ };
228
+ Children.forEach(children, (child, index) => {
229
+ if (! /*#__PURE__*/isValidElement(child)) return;
230
+ const slot = child.type.slot ?? 'overlay';
231
+ slots[slot in slots ? slot : 'overlay'].push(/*#__PURE__*/_jsx(ChildSlot, {
232
+ children: child
233
+ }, index));
234
+ });
235
+ return /*#__PURE__*/_jsx(PieChartContext.Provider, {
236
+ value: context,
237
+ children: /*#__PURE__*/_jsxs(View, {
238
+ ...props,
239
+ style: props.style,
240
+ className: cn('w-full', className),
241
+ children: [slots.header, /*#__PURE__*/_jsx(View, {
242
+ onLayout: onLayout,
243
+ style: size ? {
244
+ width: size,
245
+ height: size
246
+ } : {
247
+ aspectRatio: 1
248
+ },
249
+ className: cn('items-center justify-center', size ? 'self-center' : 'w-full'),
250
+ children: box > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
251
+ children: [/*#__PURE__*/_jsx(Svg, {
252
+ width: box,
253
+ height: box,
254
+ children: slots.svg
255
+ }), /*#__PURE__*/_jsx(View, {
256
+ pointerEvents: "box-none",
257
+ style: {
258
+ position: 'absolute',
259
+ width: box,
260
+ height: box
261
+ },
262
+ className: "items-center justify-center",
263
+ children: slots.overlay
264
+ })]
265
+ }) : null
266
+ }), slots.footer]
267
+ })
268
+ });
269
+ });
270
+ PieChartRoot.displayName = 'PieChart';
271
+ function ChildSlot({
272
+ children
273
+ }) {
274
+ return /*#__PURE__*/_jsx(_Fragment, {
275
+ children: children
276
+ });
277
+ }
278
+ /**
279
+ * Every slice, drawn in the order the data lists them.
280
+ *
281
+ * One part rather than one per datum, unlike the rings next door. A ring is
282
+ * configured on its own — its own thickness, its own cap, its own segment count
283
+ * — because it is its own measurement. Slices of a pie are not: they share a
284
+ * radius, a hole and a dial by definition, and a chart where one of them could
285
+ * be given a different radius would be a chart drawing a lie.
286
+ */
287
+ function PieChartSlices({
288
+ cornerRadius = 0,
289
+ popOut = 6,
290
+ dimOpacity = 0.35
291
+ }) {
292
+ const {
293
+ data,
294
+ slices,
295
+ colors,
296
+ radius,
297
+ hole,
298
+ size,
299
+ reveal,
300
+ origin,
301
+ span,
302
+ status,
303
+ activeIndex,
304
+ setActiveIndex
305
+ } = useChart('PieChart.Slices');
306
+ if (status === 'loading' || radius <= 0) return null;
307
+ return /*#__PURE__*/_jsx(G, {
308
+ children: slices.map((angles, index) => {
309
+ const datum = data[index];
310
+ if (!datum || angles.to <= angles.from) return null;
311
+ return /*#__PURE__*/_jsx(Slice, {
312
+ angles: angles,
313
+ fill: colors[index] ?? colors[0],
314
+ centre: size / 2,
315
+ radius: radius,
316
+ hole: hole,
317
+ cornerRadius: cornerRadius,
318
+ popOut: popOut,
319
+ reveal: reveal,
320
+ origin: origin,
321
+ span: span,
322
+ selected: activeIndex === index,
323
+ dimmed: activeIndex >= 0 && activeIndex !== index,
324
+ dimOpacity: dimOpacity,
325
+ label: datum.label,
326
+ percent: Math.round(angles.fraction * 100),
327
+ onPress: () => setActiveIndex(activeIndex === index ? -1 : index)
328
+ }, datum.label);
329
+ })
330
+ });
331
+ }
332
+ PieChartSlices.displayName = 'PieChart.Slices';
333
+ PieChartSlices.slot = 'svg';
334
+
335
+ /**
336
+ * One slice, rebuilt on the UI thread every frame it is moving.
337
+ *
338
+ * Both the unroll and the lift are folded into the path rather than laid on top
339
+ * of it as a transform. The unroll has to be: a slice half drawn is a shorter
340
+ * slice, not a smaller one, and no scale expresses that. The lift could be a
341
+ * translation, but the path is already being rebuilt, so moving the centre it
342
+ * is drawn around costs nothing and keeps the geometry in one place.
343
+ */
344
+ function Slice({
345
+ angles,
346
+ fill,
347
+ centre,
348
+ radius,
349
+ hole,
350
+ cornerRadius,
351
+ popOut,
352
+ reveal,
353
+ origin,
354
+ span,
355
+ selected,
356
+ dimmed,
357
+ dimOpacity,
358
+ label,
359
+ percent,
360
+ onPress
361
+ }) {
362
+ const lift = useDerivedValue(() => withTiming(selected ? 1 : 0, {
363
+ duration: SELECT_DURATION
364
+ }));
365
+ const {
366
+ from,
367
+ to,
368
+ mid
369
+ } = angles;
370
+ // The direction the slice lifts in, resolved once: the middle of it, as a
371
+ // unit vector from the centre of the dial.
372
+ const angle = (mid - 0.25) * Math.PI * 2;
373
+ const dx = Math.cos(angle);
374
+ const dy = Math.sin(angle);
375
+ const animatedProps = useAnimatedProps(() => {
376
+ // One hand sweeping clockwise from the start of the dial. A slice is drawn
377
+ // as far as the hand has reached and no further, so the pie fills the way
378
+ // it would be drawn by hand rather than every slice growing at once.
379
+ const hand = origin + span * reveal.value;
380
+ const out = popOut * lift.value;
381
+ return {
382
+ d: wedgePath(centre + dx * out, centre + dy * out, radius, hole, from, Math.min(to, hand), cornerRadius)
383
+ };
384
+ });
385
+ return /*#__PURE__*/_jsx(AnimatedPath, {
386
+ animatedProps: animatedProps,
387
+ fill: fill,
388
+ fillOpacity: dimmed ? dimOpacity : 1,
389
+ onPress: onPress
390
+ // An SVG node takes a label but not a role, so the slices are reachable
391
+ // and named without being announced as buttons. `PieChart.Legend` is the
392
+ // properly wired way through the same selection, and the easier target.
393
+ ,
394
+ accessibilityLabel: `${label}, ${percent} percent`
395
+ });
396
+ }
397
+ /**
398
+ * The loading state: the dial as one plain band, with nothing divided up yet.
399
+ *
400
+ * Deliberately undivided. Placeholder slices would be a made-up split, and a
401
+ * reader has no way to tell an invented one from a real one until it changes
402
+ * under them — which is worse than showing nothing, because it is showing
403
+ * something wrong.
404
+ */
405
+ function PieChartSkeleton({
406
+ color
407
+ }) {
408
+ const {
409
+ size,
410
+ radius,
411
+ hole,
412
+ origin,
413
+ span,
414
+ status
415
+ } = useChart('PieChart.Skeleton');
416
+ const token = useCSSVariable('--color-skeleton');
417
+ const fill = color ?? (typeof token === 'string' ? token : 'rgba(128,128,128,0.2)');
418
+ if (status !== 'loading' || radius <= 0) return null;
419
+ return /*#__PURE__*/_jsx(Path, {
420
+ d: wedgePath(size / 2, size / 2, radius, hole, origin, origin + span, 0),
421
+ fill: fill
422
+ });
423
+ }
424
+ PieChartSkeleton.displayName = 'PieChart.Skeleton';
425
+ PieChartSkeleton.slot = 'svg';
426
+ /**
427
+ * The hole's readout: the total, and the selected slice's own figures once one
428
+ * is picked.
429
+ *
430
+ * Unlike the ring chart's centre, the default here *is* an aggregate, and it is
431
+ * the honest one — the whole point of a pie is that its parts belong to a total,
432
+ * so the total is the number the chart is about. Selecting a slice swaps it for
433
+ * that slice's value and its share.
434
+ */
435
+ function PieChartCenter({
436
+ defaultLabel = 'Total',
437
+ formatValue,
438
+ children,
439
+ className
440
+ }) {
441
+ const {
442
+ data,
443
+ slices,
444
+ total,
445
+ hole,
446
+ activeIndex
447
+ } = useChart('PieChart.Center');
448
+ const slice = activeIndex >= 0 ? data[activeIndex] ?? null : null;
449
+ const share = activeIndex >= 0 ? slices[activeIndex]?.fraction ?? 0 : 0;
450
+ const format = formatValue ?? (amount => compactNumber(amount));
451
+
452
+ // A square inside a circle, not across it: the corners of a box as wide as
453
+ // the diameter fall outside the hole.
454
+ const room = hole * Math.SQRT2;
455
+ if (room <= 0) return null;
456
+ return /*#__PURE__*/_jsx(View, {
457
+ pointerEvents: "none",
458
+ style: {
459
+ maxWidth: room
460
+ },
461
+ className: cn('items-center', className),
462
+ children: children ? children(slice) : /*#__PURE__*/_jsxs(_Fragment, {
463
+ children: [/*#__PURE__*/_jsx(Text, {
464
+ size: "xs",
465
+ muted: true,
466
+ numberOfLines: 1,
467
+ children: slice ? slice.label : defaultLabel
468
+ }), /*#__PURE__*/_jsx(Text, {
469
+ size: room < 90 ? 'lg' : 'xl',
470
+ weight: "semibold",
471
+ numberOfLines: 1,
472
+ children: format(slice ? slice.value : total, slice)
473
+ }), room >= 90 && slice ? /*#__PURE__*/_jsx(Text, {
474
+ size: "xs",
475
+ muted: true,
476
+ numberOfLines: 1,
477
+ children: `${Math.round(share * 100)}% of ${format(total, null)}`
478
+ }) : null]
479
+ })
480
+ });
481
+ }
482
+ PieChartCenter.displayName = 'PieChart.Center';
483
+ PieChartCenter.slot = 'overlay';
484
+ /**
485
+ * A swatch, a name and a share per slice, under the chart and across the width
486
+ * of it. Pressable in the same way the slices are — the legend is usually the
487
+ * easier target of the two, and a slice worth a couple of percent is not a
488
+ * target at all.
489
+ *
490
+ * It wraps rather than stacking, so five or six entries take two lines instead
491
+ * of six. A key is a lookup table, and a lookup table read down a column of one
492
+ * word each is a column the eye has to walk.
493
+ */
494
+ function PieChartLegend({
495
+ className,
496
+ showValue = true,
497
+ ...props
498
+ }) {
499
+ const {
500
+ data,
501
+ slices,
502
+ colors,
503
+ activeIndex,
504
+ setActiveIndex
505
+ } = useChart('PieChart.Legend');
506
+ if (!data.length) return null;
507
+ return /*#__PURE__*/_jsx(View, {
508
+ ...props,
509
+ className: cn('w-full flex-row flex-wrap items-center justify-center gap-x-3 gap-y-1.5 pt-3', className),
510
+ children: data.map((slice, index) => {
511
+ const percent = Math.round((slices[index]?.fraction ?? 0) * 100);
512
+ const dimmed = activeIndex >= 0 && activeIndex !== index;
513
+ return /*#__PURE__*/_jsxs(Pressable, {
514
+ accessibilityRole: "button",
515
+ accessibilityLabel: `${slice.label}, ${percent} percent`,
516
+ onPress: () => setActiveIndex(activeIndex === index ? -1 : index),
517
+ style: {
518
+ opacity: dimmed ? 0.4 : 1
519
+ },
520
+ className: "max-w-full flex-row items-center gap-1.5",
521
+ children: [/*#__PURE__*/_jsx(View, {
522
+ style: {
523
+ width: 8,
524
+ height: 8,
525
+ borderRadius: 4,
526
+ backgroundColor: colors[index]
527
+ }
528
+ }), /*#__PURE__*/_jsx(Text, {
529
+ size: "xs",
530
+ muted: true,
531
+ numberOfLines: 1,
532
+ className: "shrink",
533
+ children: slice.label
534
+ }), showValue ? /*#__PURE__*/_jsxs(Text, {
535
+ size: "xs",
536
+ weight: "medium",
537
+ children: [percent, "%"]
538
+ }) : null]
539
+ }, slice.label);
540
+ })
541
+ });
542
+ }
543
+ PieChartLegend.displayName = 'PieChart.Legend';
544
+ PieChartLegend.slot = 'footer';
545
+ /**
546
+ * The strip above the pie: what the chart is of, what it reads, and what the
547
+ * colours mean.
548
+ *
549
+ * It belongs to the chart rather than to the card around it because it is about
550
+ * the *slices* — the number changes as one is selected, and the legend is the
551
+ * list the chart itself is holding. The card's header is a caption on the tray
552
+ * the chart sits in; this is the chart introducing itself.
553
+ *
554
+ * The value is not derived here even though there is a total to derive it from,
555
+ * because the formatting is not the chart's to guess: a total of 18420 is a
556
+ * count, a currency or a percentage depending on what was counted, and only the
557
+ * caller knows which.
558
+ */
559
+ function PieChartHeader({
560
+ className,
561
+ title,
562
+ value,
563
+ caption,
564
+ labels,
565
+ legend = false,
566
+ children,
567
+ ...props
568
+ }) {
569
+ const {
570
+ data,
571
+ colors
572
+ } = useChart('PieChart.Header');
573
+ const trailing = children ?? (legend && data.length ? /*#__PURE__*/_jsx(View, {
574
+ className: "flex-row flex-wrap items-center justify-end gap-x-3 gap-y-1",
575
+ children: data.map((slice, index) => /*#__PURE__*/_jsxs(View, {
576
+ className: "flex-row items-center gap-1.5",
577
+ children: [/*#__PURE__*/_jsx(View, {
578
+ style: {
579
+ width: 8,
580
+ height: 8,
581
+ borderRadius: 4,
582
+ backgroundColor: colors[index]
583
+ }
584
+ }), /*#__PURE__*/_jsx(Text, {
585
+ size: "xs",
586
+ muted: true,
587
+ numberOfLines: 1,
588
+ children: labels?.[slice.label] ?? slice.label
589
+ })]
590
+ }, slice.label))
591
+ }) : null);
592
+ return /*#__PURE__*/_jsxs(View, {
593
+ ...props,
594
+ className: cn('flex-row items-start justify-between gap-3 pb-3', className),
595
+ children: [/*#__PURE__*/_jsxs(View, {
596
+ className: "flex-1 gap-0.5",
597
+ children: [title ? /*#__PURE__*/_jsx(Text, {
598
+ size: "xs",
599
+ muted: true,
600
+ children: title
601
+ }) : null, value ? /*#__PURE__*/_jsx(Text, {
602
+ size: "xl",
603
+ weight: "bold",
604
+ children: value
605
+ }) : null, caption ? /*#__PURE__*/_jsx(Text, {
606
+ size: "xs",
607
+ muted: true,
608
+ children: caption
609
+ }) : null]
610
+ }), trailing ? /*#__PURE__*/_jsx(View, {
611
+ className: "max-w-[55%] shrink pt-1",
612
+ children: trailing
613
+ }) : null]
614
+ });
615
+ }
616
+ PieChartHeader.displayName = 'PieChart.Header';
617
+ PieChartHeader.slot = 'header';
618
+ export const PieChart = Object.assign(PieChartRoot, {
619
+ Header: PieChartHeader,
620
+ Slices: PieChartSlices,
621
+ Center: PieChartCenter,
622
+ Legend: PieChartLegend,
623
+ Skeleton: PieChartSkeleton
624
+ });
625
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Children","createContext","forwardRef","isValidElement","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","Pressable","View","Animated","Easing","useAnimatedProps","useDerivedValue","useReducedMotion","useSharedValue","withTiming","Svg","G","Path","useCSSVariable","Text","compactNumber","useSeriesColor","wedgePath","cn","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AnimatedPath","createAnimatedComponent","SELECT_DURATION","PieChartContext","useChart","component","context","Error","usePieChart","data","slices","activeIndex","activeSlice","activeFraction","fraction","LIFT","PieChartRoot","className","size","innerRadius","startAngle","endAngle","padAngle","minAngle","animationDuration","status","activeIndexProp","onActiveIndexChange","children","props","ref","measured","setMeasured","internalActive","setInternalActive","reveal","reducedMotion","controlled","undefined","setActiveIndex","index","box","radius","Math","max","hole","min","origin","span","total","reduce","sum","slice","value","count","length","pad","gaps","floor","drawn","filter","floors","free","result","cursor","sweep","push","from","to","mid","playReveal","duration","easing","bezier","loading","revealed","current","replay","c1","c2","c3","c4","c5","palette","colors","map","color","onLayout","event","width","height","nativeEvent","layout","next","round","slots","svg","overlay","header","footer","forEach","child","slot","type","ChildSlot","Provider","style","aspectRatio","pointerEvents","position","displayName","PieChartSlices","cornerRadius","popOut","dimOpacity","angles","datum","Slice","fill","centre","selected","dimmed","label","percent","onPress","lift","angle","PI","dx","cos","dy","sin","animatedProps","hand","out","d","fillOpacity","accessibilityLabel","PieChartSkeleton","token","PieChartCenter","defaultLabel","formatValue","share","format","amount","room","SQRT2","maxWidth","muted","numberOfLines","weight","PieChartLegend","showValue","accessibilityRole","opacity","borderRadius","backgroundColor","PieChartHeader","title","caption","labels","legend","trailing","PieChart","Object","assign","Header","Slices","Center","Legend","Skeleton"],"sourceRoot":"../../../../src","sources":["components/pie-chart/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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