panelui-native 0.61.1 → 0.63.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.
- package/lib/module/components/area-chart/index.js +14 -4
- package/lib/module/components/area-chart/index.js.map +1 -1
- package/lib/module/components/bar-chart/index.js +14 -4
- package/lib/module/components/bar-chart/index.js.map +1 -1
- package/lib/module/components/candlestick-chart/index.js +14 -4
- package/lib/module/components/candlestick-chart/index.js.map +1 -1
- package/lib/module/components/card/index.js +26 -1
- package/lib/module/components/card/index.js.map +1 -1
- package/lib/module/components/dialog/index.js +49 -3
- package/lib/module/components/dialog/index.js.map +1 -1
- package/lib/module/components/hex-chart/index.js +2 -2
- package/lib/module/components/hex-chart/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +14 -4
- package/lib/module/components/line-chart/index.js.map +1 -1
- package/lib/module/components/live-line-chart/index.js +1063 -0
- package/lib/module/components/live-line-chart/index.js.map +1 -0
- package/lib/module/components/pie-chart/index.js +2 -2
- package/lib/module/components/pie-chart/index.js.map +1 -1
- package/lib/module/components/plot/index.js +1329 -0
- package/lib/module/components/plot/index.js.map +1 -0
- package/lib/module/components/polar-area-chart/index.js +719 -0
- package/lib/module/components/polar-area-chart/index.js.map +1 -0
- package/lib/module/components/radar-chart/index.js +14 -4
- package/lib/module/components/radar-chart/index.js.map +1 -1
- package/lib/module/components/ring-chart/index.js +2 -2
- package/lib/module/components/ring-chart/index.js.map +1 -1
- package/lib/module/components/section-rail/index.js +120 -15
- package/lib/module/components/section-rail/index.js.map +1 -1
- package/lib/module/components/selection-mode/index.js +129 -18
- package/lib/module/components/selection-mode/index.js.map +1 -1
- package/lib/module/components/sortable/index.js +15 -5
- package/lib/module/components/sortable/index.js.map +1 -1
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/chart.js +40 -0
- package/lib/module/utils/chart.js.map +1 -1
- package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/candlestick-chart/index.d.ts +6 -3
- package/lib/typescript/src/components/candlestick-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/card/index.d.ts +48 -1
- package/lib/typescript/src/components/card/index.d.ts.map +1 -1
- package/lib/typescript/src/components/dialog/index.d.ts +47 -2
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/live-line-chart/index.d.ts +293 -0
- package/lib/typescript/src/components/live-line-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/plot/index.d.ts +471 -0
- package/lib/typescript/src/components/plot/index.d.ts.map +1 -0
- package/lib/typescript/src/components/polar-area-chart/index.d.ts +259 -0
- package/lib/typescript/src/components/polar-area-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/radar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/section-rail/index.d.ts +8 -1
- package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -1
- package/lib/typescript/src/components/selection-mode/index.d.ts +82 -6
- package/lib/typescript/src/components/selection-mode/index.d.ts.map +1 -1
- package/lib/typescript/src/components/sortable/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/chart.d.ts +15 -14
- package/lib/typescript/src/utils/chart.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/area-chart/index.tsx +14 -4
- package/src/components/bar-chart/index.tsx +14 -4
- package/src/components/candlestick-chart/index.tsx +20 -7
- package/src/components/card/index.tsx +32 -7
- package/src/components/dialog/index.tsx +55 -2
- package/src/components/hex-chart/index.tsx +2 -2
- package/src/components/line-chart/index.tsx +14 -4
- package/src/components/live-line-chart/index.tsx +1294 -0
- package/src/components/pie-chart/index.tsx +2 -2
- package/src/components/plot/index.tsx +1564 -0
- package/src/components/polar-area-chart/index.tsx +928 -0
- package/src/components/radar-chart/index.tsx +14 -4
- package/src/components/ring-chart/index.tsx +2 -2
- package/src/components/section-rail/index.tsx +133 -14
- package/src/components/selection-mode/index.tsx +163 -26
- package/src/components/sortable/index.tsx +15 -5
- package/src/index.ts +81 -0
- package/src/utils/chart.ts +44 -0
- package/theme.css +24 -0
|
@@ -28,24 +28,25 @@ export interface ChartInk {
|
|
|
28
28
|
muted: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
31
|
+
* The colour for the `index`th thing in a chart that draws an unbounded number
|
|
32
|
+
* of them.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* There are five series tokens, and a chart is routinely asked to draw six
|
|
35
|
+
* things. Taking the palette modulo its length hands two of them the identical
|
|
36
|
+
* colour, which in a chart whose whole job is telling parts apart is a bug the
|
|
37
|
+
* theme decides the severity of — on a theme whose first token is green, the
|
|
38
|
+
* sixth wedge is a second green one.
|
|
38
39
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* that a darker label would technically suit changes what the chart looks like
|
|
42
|
-
* to fix the two that were unreadable.
|
|
40
|
+
* So each further lap through the palette is drawn a step further along a tone
|
|
41
|
+
* run, keeping the theme's own hues rather than inventing new ones.
|
|
43
42
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
43
|
+
* The run goes *away* from whichever end the colour already sits near, and
|
|
44
|
+
* always in that one direction. Alternating lighter and darker would be the
|
|
45
|
+
* obvious thing and it reintroduces the bug on the themes that matter: a token
|
|
46
|
+
* of `#fafafa` lightened is `#fafafa` back again, so the second lap of a
|
|
47
|
+
* near-white palette entry is the same colour it was trying not to be.
|
|
48
48
|
*/
|
|
49
|
+
export declare function seriesColorAt(palette: string[], index: number): string;
|
|
49
50
|
export declare function inkOn(fill: string, behind?: string, opacity?: number): ChartInk;
|
|
50
51
|
/** `12k` rather than `12400` — a readout has one line to say it in. */
|
|
51
52
|
export declare function compactNumber(value: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../../src/utils/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,qDAAqD;AACrD,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,gBAAgB,GACtB,MAAM,CAGR;AA0DD,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../../src/utils/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,qDAAqD;AACrD,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,gBAAgB,GACtB,MAAM,CAGR;AA0DD,2EAA2E;AAC3E,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AA6CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYtE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,QAAQ,CAe1E;AAoBD,uEAAu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,MAAM,GACZ,MAAM,CAyBR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "High-performance React Native UI components for Expo. Semantic design tokens, powered by Uniwind (Tailwind v4) and Reanimated.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -227,7 +227,7 @@ const AreaChartRoot = forwardRef<AreaChartHandle, AreaChartProps>(function AreaC
|
|
|
227
227
|
xDataKey = 'date',
|
|
228
228
|
status = 'ready',
|
|
229
229
|
aspectRatio = 2,
|
|
230
|
-
animationDuration =
|
|
230
|
+
animationDuration = 700,
|
|
231
231
|
domainDuration = 500,
|
|
232
232
|
yDomain,
|
|
233
233
|
stacked = false,
|
|
@@ -356,17 +356,27 @@ const AreaChartRoot = forwardRef<AreaChartHandle, AreaChartProps>(function AreaC
|
|
|
356
356
|
reveal.value = 0;
|
|
357
357
|
reveal.value = withTiming(1, {
|
|
358
358
|
duration: animationDuration,
|
|
359
|
-
easing: Easing.
|
|
359
|
+
easing: Easing.out(Easing.cubic),
|
|
360
360
|
});
|
|
361
361
|
},
|
|
362
362
|
[reducedMotion, animationDuration, reveal]
|
|
363
363
|
);
|
|
364
364
|
|
|
365
365
|
useEffect(() => {
|
|
366
|
-
|
|
366
|
+
/*
|
|
367
|
+
* Going back to `loading` arms the reveal again. Without this a chart that
|
|
368
|
+
* is refetched comes back fully drawn on the frame the data lands, which
|
|
369
|
+
* reads as the loading state having been for nothing.
|
|
370
|
+
*/
|
|
371
|
+
if (loading) {
|
|
372
|
+
revealed.current = false;
|
|
373
|
+
reveal.value = 0;
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (revealed.current || plot.width <= 0 || !data.length) return;
|
|
367
377
|
revealed.current = true;
|
|
368
378
|
playReveal();
|
|
369
|
-
}, [loading, plot.width, data.length, playReveal]);
|
|
379
|
+
}, [loading, plot.width, data.length, playReveal, reveal]);
|
|
370
380
|
|
|
371
381
|
useImperativeHandle(ref, () => ({ replay: playReveal }), [playReveal]);
|
|
372
382
|
|
|
@@ -245,7 +245,7 @@ const BarChartRoot = forwardRef<BarChartHandle, BarChartProps>(function BarChart
|
|
|
245
245
|
xDataKey = 'name',
|
|
246
246
|
status = 'ready',
|
|
247
247
|
aspectRatio = 2,
|
|
248
|
-
animationDuration =
|
|
248
|
+
animationDuration = 700,
|
|
249
249
|
domainDuration = 500,
|
|
250
250
|
yDomain,
|
|
251
251
|
orientation = 'vertical',
|
|
@@ -374,17 +374,27 @@ const BarChartRoot = forwardRef<BarChartHandle, BarChartProps>(function BarChart
|
|
|
374
374
|
reveal.value = 0;
|
|
375
375
|
reveal.value = withTiming(1, {
|
|
376
376
|
duration: animationDuration,
|
|
377
|
-
easing: Easing.
|
|
377
|
+
easing: Easing.out(Easing.cubic),
|
|
378
378
|
});
|
|
379
379
|
},
|
|
380
380
|
[reducedMotion, animationDuration, reveal]
|
|
381
381
|
);
|
|
382
382
|
|
|
383
383
|
useEffect(() => {
|
|
384
|
-
|
|
384
|
+
/*
|
|
385
|
+
* Going back to `loading` arms the reveal again. Without this a chart that
|
|
386
|
+
* is refetched comes back fully drawn on the frame the data lands, which
|
|
387
|
+
* reads as the loading state having been for nothing.
|
|
388
|
+
*/
|
|
389
|
+
if (loading) {
|
|
390
|
+
revealed.current = false;
|
|
391
|
+
reveal.value = 0;
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (revealed.current || plot.width <= 0 || !data.length) return;
|
|
385
395
|
revealed.current = true;
|
|
386
396
|
playReveal();
|
|
387
|
-
}, [loading, plot.width, data.length, playReveal]);
|
|
397
|
+
}, [loading, plot.width, data.length, playReveal, reveal]);
|
|
388
398
|
|
|
389
399
|
useImperativeHandle(ref, () => ({ replay: playReveal }), [playReveal]);
|
|
390
400
|
|
|
@@ -249,9 +249,12 @@ export interface CandlestickChartProps extends ViewProps {
|
|
|
249
249
|
/** Key holding the closing price. */
|
|
250
250
|
closeDataKey?: string;
|
|
251
251
|
/**
|
|
252
|
-
* `loading`
|
|
253
|
-
*
|
|
254
|
-
*
|
|
252
|
+
* `loading` leaves the plot empty — the frame, the grid and the header stay,
|
|
253
|
+
* and no candles are drawn. Turning `ready` grows them in left to right.
|
|
254
|
+
*
|
|
255
|
+
* Nothing stands in for the candles while they are missing. A placeholder
|
|
256
|
+
* candle is four made-up prices, and a reader has no way to tell an invented
|
|
257
|
+
* one from a real one until it changes under them.
|
|
255
258
|
*/
|
|
256
259
|
status?: CandlestickChartStatus;
|
|
257
260
|
/** Width ÷ height. `1.6` suits a chart this dense better than `2`. */
|
|
@@ -323,7 +326,7 @@ const CandlestickChartRoot = forwardRef<CandlestickChartHandle, CandlestickChart
|
|
|
323
326
|
closeDataKey = 'close',
|
|
324
327
|
status = 'ready',
|
|
325
328
|
aspectRatio = 1.6,
|
|
326
|
-
animationDuration =
|
|
329
|
+
animationDuration = 700,
|
|
327
330
|
domainDuration = 500,
|
|
328
331
|
yDomain,
|
|
329
332
|
candleGap = 0.3,
|
|
@@ -427,17 +430,27 @@ const CandlestickChartRoot = forwardRef<CandlestickChartHandle, CandlestickChart
|
|
|
427
430
|
reveal.value = 0;
|
|
428
431
|
reveal.value = withTiming(1, {
|
|
429
432
|
duration: animationDuration,
|
|
430
|
-
easing: Easing.
|
|
433
|
+
easing: Easing.out(Easing.cubic),
|
|
431
434
|
});
|
|
432
435
|
},
|
|
433
436
|
[reducedMotion, animationDuration, reveal]
|
|
434
437
|
);
|
|
435
438
|
|
|
436
439
|
useEffect(() => {
|
|
437
|
-
|
|
440
|
+
/*
|
|
441
|
+
* Going back to `loading` arms the reveal again. Without this a chart
|
|
442
|
+
* that is refetched comes back fully drawn on the frame the data lands,
|
|
443
|
+
* which reads as the loading state having been for nothing.
|
|
444
|
+
*/
|
|
445
|
+
if (loading) {
|
|
446
|
+
revealed.current = false;
|
|
447
|
+
reveal.value = 0;
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (revealed.current || plot.width <= 0 || !data.length) return;
|
|
438
451
|
revealed.current = true;
|
|
439
452
|
playReveal();
|
|
440
|
-
}, [loading, plot.width, data.length, playReveal]);
|
|
453
|
+
}, [loading, plot.width, data.length, playReveal, reveal]);
|
|
441
454
|
|
|
442
455
|
useImperativeHandle(ref, () => ({ replay: playReveal }), [playReveal]);
|
|
443
456
|
|
|
@@ -23,13 +23,40 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { forwardRef } from 'react';
|
|
25
25
|
import { View, type ViewProps } from 'react-native';
|
|
26
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
26
27
|
import { cn } from '../../utils/cn';
|
|
27
28
|
import { Text, type TextProps } from '../../primitives/text';
|
|
28
29
|
|
|
30
|
+
const footerVariants = tv({
|
|
31
|
+
base: 'flex-row items-center gap-2',
|
|
32
|
+
variants: {
|
|
33
|
+
/**
|
|
34
|
+
* Whether the footer draws a surface of its own.
|
|
35
|
+
*
|
|
36
|
+
* `plain` is part of the card: same background, padding continuing from the
|
|
37
|
+
* content above it. `panel` is a band set into it — a rule across the top,
|
|
38
|
+
* a step darker, and the card's own bottom corners — so the buttons read as
|
|
39
|
+
* the card's actions rather than as the last thing in its body. Use it when
|
|
40
|
+
* the footer is what somebody does with the card, not more of what it says.
|
|
41
|
+
*/
|
|
42
|
+
variant: {
|
|
43
|
+
plain: 'p-6 pt-0',
|
|
44
|
+
panel: 'rounded-b-2xl border-t border-border bg-inset p-6',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: 'plain',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
29
52
|
export interface CardProps extends ViewProps {
|
|
30
53
|
className?: string;
|
|
31
54
|
}
|
|
32
55
|
|
|
56
|
+
export interface CardFooterProps
|
|
57
|
+
extends CardProps,
|
|
58
|
+
VariantProps<typeof footerVariants> {}
|
|
59
|
+
|
|
33
60
|
const CardRoot = forwardRef<View, CardProps>(({ className, ...props }, ref) => (
|
|
34
61
|
<View
|
|
35
62
|
ref={ref}
|
|
@@ -69,13 +96,11 @@ const CardContent = forwardRef<View, CardProps>(({ className, ...props }, ref) =
|
|
|
69
96
|
));
|
|
70
97
|
CardContent.displayName = 'Card.Content';
|
|
71
98
|
|
|
72
|
-
const CardFooter = forwardRef<View,
|
|
73
|
-
|
|
74
|
-
ref={ref}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/>
|
|
78
|
-
));
|
|
99
|
+
const CardFooter = forwardRef<View, CardFooterProps>(
|
|
100
|
+
({ className, variant, ...props }, ref) => (
|
|
101
|
+
<View ref={ref} className={cn(footerVariants({ variant }), className)} {...props} />
|
|
102
|
+
)
|
|
103
|
+
);
|
|
79
104
|
CardFooter.displayName = 'Card.Footer';
|
|
80
105
|
|
|
81
106
|
export const Card = Object.assign(CardRoot, {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from 'react';
|
|
13
13
|
import { Pressable, View, type ViewProps } from 'react-native';
|
|
14
14
|
import Animated, { FadeIn, FadeOut, ZoomIn } from 'react-native-reanimated';
|
|
15
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
15
16
|
import { Portal } from '../../primitives/portal';
|
|
16
17
|
import { Scrim } from '../../primitives/scrim';
|
|
17
18
|
import { Text, type TextProps, textChildren } from '../../primitives/text';
|
|
@@ -129,6 +130,8 @@ function DialogContent({
|
|
|
129
130
|
entering={ZoomIn.springify().damping(18).stiffness(250).mass(0.6)}
|
|
130
131
|
exiting={FadeOut.duration(120)}
|
|
131
132
|
accessibilityViewIsModal
|
|
133
|
+
// `p-5` is `DIALOG_PADDING` above — a panel footer bleeds back out
|
|
134
|
+
// through exactly this much, so the two move together.
|
|
132
135
|
className={cn(
|
|
133
136
|
'w-full max-w-sm gap-1.5 rounded-2xl border border-border bg-popover p-5 shadow-lg',
|
|
134
137
|
className
|
|
@@ -163,10 +166,60 @@ const DialogDescription = forwardRef<React.ElementRef<typeof Text>, TextProps>(
|
|
|
163
166
|
);
|
|
164
167
|
DialogDescription.displayName = 'Dialog.Description';
|
|
165
168
|
|
|
166
|
-
|
|
169
|
+
/**
|
|
170
|
+
* The dialog's padding, in points. The panel footer bleeds back out through it,
|
|
171
|
+
* so the two have to agree — a mismatch is a band inset from one edge.
|
|
172
|
+
*/
|
|
173
|
+
const DIALOG_PADDING = 20;
|
|
174
|
+
|
|
175
|
+
const dialogFooterVariants = tv({
|
|
176
|
+
base: 'flex-row items-center justify-end gap-2',
|
|
177
|
+
variants: {
|
|
178
|
+
/**
|
|
179
|
+
* Whether the footer draws a surface of its own.
|
|
180
|
+
*
|
|
181
|
+
* `plain` is part of the dialog: same background, sitting under the content
|
|
182
|
+
* with a gap above it. `panel` is a band set into it — a rule across the
|
|
183
|
+
* top, a step darker, and the dialog's own bottom corners — which separates
|
|
184
|
+
* what the dialog says from what you can do about it. Worth it on a dialog
|
|
185
|
+
* with a form in it, where the buttons are otherwise one more row of it.
|
|
186
|
+
*/
|
|
187
|
+
variant: {
|
|
188
|
+
plain: 'mt-4',
|
|
189
|
+
panel: 'mt-5 rounded-b-2xl border-t border-border bg-inset',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
defaultVariants: {
|
|
193
|
+
variant: 'plain',
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export interface DialogFooterProps extends ViewProps, VariantProps<typeof dialogFooterVariants> {
|
|
198
|
+
className?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function DialogFooter({ className, variant, style, ...props }: DialogFooterProps) {
|
|
167
202
|
return (
|
|
168
203
|
<View
|
|
169
|
-
|
|
204
|
+
/*
|
|
205
|
+
* The bleed is a style rather than a class because it is arithmetic on the
|
|
206
|
+
* dialog's own padding, and a class would be a second copy of that number
|
|
207
|
+
* waiting to disagree with the first.
|
|
208
|
+
*/
|
|
209
|
+
style={
|
|
210
|
+
variant === 'panel'
|
|
211
|
+
? [
|
|
212
|
+
{
|
|
213
|
+
marginHorizontal: -DIALOG_PADDING,
|
|
214
|
+
marginBottom: -DIALOG_PADDING,
|
|
215
|
+
paddingHorizontal: DIALOG_PADDING,
|
|
216
|
+
paddingVertical: 16,
|
|
217
|
+
},
|
|
218
|
+
style,
|
|
219
|
+
]
|
|
220
|
+
: style
|
|
221
|
+
}
|
|
222
|
+
className={cn(dialogFooterVariants({ variant }), className)}
|
|
170
223
|
{...props}
|
|
171
224
|
/>
|
|
172
225
|
);
|
|
@@ -269,7 +269,7 @@ const HexChartRoot = forwardRef<HexChartHandle, HexChartProps>(function HexChart
|
|
|
269
269
|
density = 0.55,
|
|
270
270
|
shape = 'blob',
|
|
271
271
|
cellGap = 0.14,
|
|
272
|
-
animationDuration =
|
|
272
|
+
animationDuration = 620,
|
|
273
273
|
status = 'ready',
|
|
274
274
|
activeIndex: activeIndexProp,
|
|
275
275
|
onActiveIndexChange,
|
|
@@ -413,7 +413,7 @@ const HexChartRoot = forwardRef<HexChartHandle, HexChartProps>(function HexChart
|
|
|
413
413
|
reveal.value = 0;
|
|
414
414
|
reveal.value = withTiming(1, {
|
|
415
415
|
duration: animationDuration,
|
|
416
|
-
easing: Easing.
|
|
416
|
+
easing: Easing.out(Easing.cubic),
|
|
417
417
|
});
|
|
418
418
|
},
|
|
419
419
|
[reducedMotion, animationDuration, reveal]
|
|
@@ -221,7 +221,7 @@ const LineChartRoot = forwardRef<LineChartHandle, LineChartProps>(function LineC
|
|
|
221
221
|
xDataKey = 'date',
|
|
222
222
|
status = 'ready',
|
|
223
223
|
aspectRatio = 2,
|
|
224
|
-
animationDuration =
|
|
224
|
+
animationDuration = 700,
|
|
225
225
|
domainDuration = 500,
|
|
226
226
|
yDomain,
|
|
227
227
|
curve = 'monotone',
|
|
@@ -341,17 +341,27 @@ const LineChartRoot = forwardRef<LineChartHandle, LineChartProps>(function LineC
|
|
|
341
341
|
reveal.value = 0;
|
|
342
342
|
reveal.value = withTiming(1, {
|
|
343
343
|
duration: animationDuration,
|
|
344
|
-
easing: Easing.
|
|
344
|
+
easing: Easing.out(Easing.cubic),
|
|
345
345
|
});
|
|
346
346
|
},
|
|
347
347
|
[reducedMotion, animationDuration, reveal]
|
|
348
348
|
);
|
|
349
349
|
|
|
350
350
|
useEffect(() => {
|
|
351
|
-
|
|
351
|
+
/*
|
|
352
|
+
* Going back to `loading` arms the reveal again. Without this a chart that
|
|
353
|
+
* is refetched comes back fully drawn on the frame the data lands, which
|
|
354
|
+
* reads as the loading state having been for nothing.
|
|
355
|
+
*/
|
|
356
|
+
if (loading) {
|
|
357
|
+
revealed.current = false;
|
|
358
|
+
reveal.value = 0;
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (revealed.current || plot.width <= 0 || !data.length) return;
|
|
352
362
|
revealed.current = true;
|
|
353
363
|
playReveal();
|
|
354
|
-
}, [loading, plot.width, data.length, playReveal]);
|
|
364
|
+
}, [loading, plot.width, data.length, playReveal, reveal]);
|
|
355
365
|
|
|
356
366
|
// `replay()` re-runs the reveal — for a control the caller wires up.
|
|
357
367
|
useImperativeHandle(ref, () => ({ replay: playReveal }), [playReveal]);
|