@cdx-ui/components 0.3.4 → 0.3.6
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/README.md +1 -1
- package/coverage.svg +1 -1
- package/docs/components/bar-chart/content.md +703 -0
- package/docs/components/content.md +9 -1
- package/docs/components/line-chart/content.md +567 -0
- package/docs/components/pie-chart/content.md +493 -0
- package/docs/components/progress-segmented/content.md +1 -1
- package/docs/components/select/content.md +144 -2
- package/docs/components/stepper/content.md +599 -0
- package/docs/components/system-alert/content.md +533 -0
- package/docs/foundations/expressions/icons/content.md +1 -1
- package/docs/foundations/styles/tokens/all-tokens/content.md +2 -1
- package/docs/llms.txt +10 -0
- package/docs/patterns/content.md +1 -0
- package/docs/patterns/dashboard/content.md +423 -19
- package/docs/patterns/insights/content.md +590 -0
- package/docs/resources/release-notes/0.3.4/content.md +27 -0
- package/docs/resources/release-notes/0.3.5/content.md +7 -0
- package/docs/resources/release-notes/content.md +2 -0
- package/lib/commonjs/components/BarChart/geometry.js +1130 -0
- package/lib/commonjs/components/BarChart/geometry.js.map +1 -0
- package/lib/commonjs/components/BarChart/index.js +942 -0
- package/lib/commonjs/components/BarChart/index.js.map +1 -0
- package/lib/commonjs/components/BarChart/styles.js +26 -0
- package/lib/commonjs/components/BarChart/styles.js.map +1 -0
- package/lib/commonjs/components/Button/index.js +2 -2
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Chip/styles.js +3 -1
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/LineChart/geometry.js +698 -0
- package/lib/commonjs/components/LineChart/geometry.js.map +1 -0
- package/lib/commonjs/components/LineChart/index.js +747 -0
- package/lib/commonjs/components/LineChart/index.js.map +1 -0
- package/lib/commonjs/components/LineChart/styles.js +25 -0
- package/lib/commonjs/components/LineChart/styles.js.map +1 -0
- package/lib/commonjs/components/PieChart/geometry.js +216 -0
- package/lib/commonjs/components/PieChart/geometry.js.map +1 -0
- package/lib/commonjs/components/PieChart/index.js +476 -0
- package/lib/commonjs/components/PieChart/index.js.map +1 -0
- package/lib/commonjs/components/PieChart/styles.js +88 -0
- package/lib/commonjs/components/PieChart/styles.js.map +1 -0
- package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js +9 -31
- package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
- package/lib/commonjs/components/ProgressCircle/ProgressRing.js +52 -0
- package/lib/commonjs/components/ProgressCircle/ProgressRing.js.map +1 -0
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +8 -7
- package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/commonjs/components/Stepper/index.js +369 -0
- package/lib/commonjs/components/Stepper/index.js.map +1 -0
- package/lib/commonjs/components/Stepper/styles.js +211 -0
- package/lib/commonjs/components/Stepper/styles.js.map +1 -0
- package/lib/commonjs/components/Stepper/useStepperLabelFit.js +22 -0
- package/lib/commonjs/components/Stepper/useStepperLabelFit.js.map +1 -0
- package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js +52 -0
- package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js.map +1 -0
- package/lib/commonjs/components/Stepper/useStepperRingColors.js +31 -0
- package/lib/commonjs/components/Stepper/useStepperRingColors.js.map +1 -0
- package/lib/commonjs/components/SystemAlert/animation.js +218 -0
- package/lib/commonjs/components/SystemAlert/animation.js.map +1 -0
- package/lib/commonjs/components/SystemAlert/index.js +525 -0
- package/lib/commonjs/components/SystemAlert/index.js.map +1 -0
- package/lib/commonjs/components/SystemAlert/styles.js +178 -0
- package/lib/commonjs/components/SystemAlert/styles.js.map +1 -0
- package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js +53 -0
- package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
- package/lib/commonjs/components/Tabs/index.js +4 -0
- package/lib/commonjs/components/Tabs/index.js.map +1 -1
- package/lib/commonjs/components/Tabs/styles.js +1 -1
- package/lib/commonjs/components/Tabs/styles.js.map +1 -1
- package/lib/commonjs/components/chart/ChartInspector.js +610 -0
- package/lib/commonjs/components/chart/ChartInspector.js.map +1 -0
- package/lib/commonjs/components/chart/format.js +93 -0
- package/lib/commonjs/components/chart/format.js.map +1 -0
- package/lib/commonjs/components/chart/index.js +2 -0
- package/lib/commonjs/components/chart/index.js.map +1 -0
- package/lib/commonjs/components/chart/motion.js +97 -0
- package/lib/commonjs/components/chart/motion.js.map +1 -0
- package/lib/commonjs/components/chart/palette.js +178 -0
- package/lib/commonjs/components/chart/palette.js.map +1 -0
- package/lib/commonjs/components/chart/size.js +34 -0
- package/lib/commonjs/components/chart/size.js.map +1 -0
- package/lib/commonjs/components/chart/ticks.js +59 -0
- package/lib/commonjs/components/chart/ticks.js.map +1 -0
- package/lib/commonjs/components/chart/types.js +6 -0
- package/lib/commonjs/components/chart/types.js.map +1 -0
- package/lib/commonjs/components/chart/useChartHostWidth.js +27 -0
- package/lib/commonjs/components/chart/useChartHostWidth.js.map +1 -0
- package/lib/commonjs/components/index.js +60 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/figma/SystemAlert.Button.figma.js +28 -0
- package/lib/commonjs/figma/SystemAlert.Button.figma.js.map +1 -0
- package/lib/commonjs/figma/SystemAlert.Close.figma.js +22 -0
- package/lib/commonjs/figma/SystemAlert.Close.figma.js.map +1 -0
- package/lib/commonjs/figma/SystemAlert.Description.figma.js +20 -0
- package/lib/commonjs/figma/SystemAlert.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/SystemAlert.IconButton.figma.js +31 -0
- package/lib/commonjs/figma/SystemAlert.IconButton.figma.js.map +1 -0
- package/lib/commonjs/figma/SystemAlert.figma.js +48 -0
- package/lib/commonjs/figma/SystemAlert.figma.js.map +1 -0
- package/lib/module/components/BarChart/geometry.js +1110 -0
- package/lib/module/components/BarChart/geometry.js.map +1 -0
- package/lib/module/components/BarChart/index.js +936 -0
- package/lib/module/components/BarChart/index.js.map +1 -0
- package/lib/module/components/BarChart/styles.js +22 -0
- package/lib/module/components/BarChart/styles.js.map +1 -0
- package/lib/module/components/Button/index.js +2 -2
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Chip/styles.js +3 -1
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/LineChart/geometry.js +685 -0
- package/lib/module/components/LineChart/geometry.js.map +1 -0
- package/lib/module/components/LineChart/index.js +741 -0
- package/lib/module/components/LineChart/index.js.map +1 -0
- package/lib/module/components/LineChart/styles.js +21 -0
- package/lib/module/components/LineChart/styles.js.map +1 -0
- package/lib/module/components/PieChart/geometry.js +209 -0
- package/lib/module/components/PieChart/geometry.js.map +1 -0
- package/lib/module/components/PieChart/index.js +471 -0
- package/lib/module/components/PieChart/index.js.map +1 -0
- package/lib/module/components/PieChart/styles.js +84 -0
- package/lib/module/components/PieChart/styles.js.map +1 -0
- package/lib/module/components/ProgressCircle/ProgressCircleRing.js +10 -32
- package/lib/module/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
- package/lib/module/components/ProgressCircle/ProgressRing.js +48 -0
- package/lib/module/components/ProgressCircle/ProgressRing.js.map +1 -0
- package/lib/module/components/ScrollShadow/useScrollShadow.js +8 -7
- package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
- package/lib/module/components/Stepper/index.js +360 -0
- package/lib/module/components/Stepper/index.js.map +1 -0
- package/lib/module/components/Stepper/styles.js +206 -0
- package/lib/module/components/Stepper/styles.js.map +1 -0
- package/lib/module/components/Stepper/useStepperLabelFit.js +18 -0
- package/lib/module/components/Stepper/useStepperLabelFit.js.map +1 -0
- package/lib/module/components/Stepper/useStepperLabelFit.web.js +48 -0
- package/lib/module/components/Stepper/useStepperLabelFit.web.js.map +1 -0
- package/lib/module/components/Stepper/useStepperRingColors.js +28 -0
- package/lib/module/components/Stepper/useStepperRingColors.js.map +1 -0
- package/lib/module/components/SystemAlert/animation.js +213 -0
- package/lib/module/components/SystemAlert/animation.js.map +1 -0
- package/lib/module/components/SystemAlert/index.js +515 -0
- package/lib/module/components/SystemAlert/index.js.map +1 -0
- package/lib/module/components/SystemAlert/styles.js +174 -0
- package/lib/module/components/SystemAlert/styles.js.map +1 -0
- package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js +49 -0
- package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
- package/lib/module/components/Tabs/index.js +4 -0
- package/lib/module/components/Tabs/index.js.map +1 -1
- package/lib/module/components/Tabs/styles.js +1 -1
- package/lib/module/components/Tabs/styles.js.map +1 -1
- package/lib/module/components/chart/ChartInspector.js +600 -0
- package/lib/module/components/chart/ChartInspector.js.map +1 -0
- package/lib/module/components/chart/format.js +84 -0
- package/lib/module/components/chart/format.js.map +1 -0
- package/lib/module/components/chart/index.js +2 -0
- package/lib/module/components/chart/index.js.map +1 -0
- package/lib/module/components/chart/motion.js +89 -0
- package/lib/module/components/chart/motion.js.map +1 -0
- package/lib/module/components/chart/palette.js +168 -0
- package/lib/module/components/chart/palette.js.map +1 -0
- package/lib/module/components/chart/size.js +29 -0
- package/lib/module/components/chart/size.js.map +1 -0
- package/lib/module/components/chart/ticks.js +55 -0
- package/lib/module/components/chart/ticks.js.map +1 -0
- package/lib/module/components/chart/types.js +4 -0
- package/lib/module/components/chart/types.js.map +1 -0
- package/lib/module/components/chart/useChartHostWidth.js +23 -0
- package/lib/module/components/chart/useChartHostWidth.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/figma/SystemAlert.Button.figma.js +22 -0
- package/lib/module/figma/SystemAlert.Button.figma.js.map +1 -0
- package/lib/module/figma/SystemAlert.Close.figma.js +18 -0
- package/lib/module/figma/SystemAlert.Close.figma.js.map +1 -0
- package/lib/module/figma/SystemAlert.Description.figma.js +14 -0
- package/lib/module/figma/SystemAlert.Description.figma.js.map +1 -0
- package/lib/module/figma/SystemAlert.IconButton.figma.js +25 -0
- package/lib/module/figma/SystemAlert.IconButton.figma.js.map +1 -0
- package/lib/module/figma/SystemAlert.figma.js +42 -0
- package/lib/module/figma/SystemAlert.figma.js.map +1 -0
- package/lib/typescript/components/BarChart/geometry.d.ts +236 -0
- package/lib/typescript/components/BarChart/geometry.d.ts.map +1 -0
- package/lib/typescript/components/BarChart/index.d.ts +193 -0
- package/lib/typescript/components/BarChart/index.d.ts.map +1 -0
- package/lib/typescript/components/BarChart/styles.d.ts +32 -0
- package/lib/typescript/components/BarChart/styles.d.ts.map +1 -0
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
- package/lib/typescript/components/LineChart/geometry.d.ts +248 -0
- package/lib/typescript/components/LineChart/geometry.d.ts.map +1 -0
- package/lib/typescript/components/LineChart/index.d.ts +105 -0
- package/lib/typescript/components/LineChart/index.d.ts.map +1 -0
- package/lib/typescript/components/LineChart/styles.d.ts +12 -0
- package/lib/typescript/components/LineChart/styles.d.ts.map +1 -0
- package/lib/typescript/components/PieChart/geometry.d.ts +43 -0
- package/lib/typescript/components/PieChart/geometry.d.ts.map +1 -0
- package/lib/typescript/components/PieChart/index.d.ts +147 -0
- package/lib/typescript/components/PieChart/index.d.ts.map +1 -0
- package/lib/typescript/components/PieChart/styles.d.ts +27 -0
- package/lib/typescript/components/PieChart/styles.d.ts.map +1 -0
- package/lib/typescript/components/ProgressCircle/ProgressCircleRing.d.ts.map +1 -1
- package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts +17 -0
- package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts.map +1 -0
- package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
- package/lib/typescript/components/Stepper/index.d.ts +68 -0
- package/lib/typescript/components/Stepper/index.d.ts.map +1 -0
- package/lib/typescript/components/Stepper/styles.d.ts +46 -0
- package/lib/typescript/components/Stepper/styles.d.ts.map +1 -0
- package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts +15 -0
- package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts.map +1 -0
- package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts +10 -0
- package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts.map +1 -0
- package/lib/typescript/components/Stepper/useStepperRingColors.d.ts +6 -0
- package/lib/typescript/components/Stepper/useStepperRingColors.d.ts.map +1 -0
- package/lib/typescript/components/SystemAlert/animation.d.ts +56 -0
- package/lib/typescript/components/SystemAlert/animation.d.ts.map +1 -0
- package/lib/typescript/components/SystemAlert/index.d.ts +110 -0
- package/lib/typescript/components/SystemAlert/index.d.ts.map +1 -0
- package/lib/typescript/components/SystemAlert/styles.d.ts +38 -0
- package/lib/typescript/components/SystemAlert/styles.d.ts.map +1 -0
- package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts +14 -0
- package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts.map +1 -0
- package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
- package/lib/typescript/components/chart/ChartInspector.d.ts +101 -0
- package/lib/typescript/components/chart/ChartInspector.d.ts.map +1 -0
- package/lib/typescript/components/chart/format.d.ts +16 -0
- package/lib/typescript/components/chart/format.d.ts.map +1 -0
- package/lib/typescript/components/chart/index.d.ts +3 -0
- package/lib/typescript/components/chart/index.d.ts.map +1 -0
- package/lib/typescript/components/chart/motion.d.ts +27 -0
- package/lib/typescript/components/chart/motion.d.ts.map +1 -0
- package/lib/typescript/components/chart/palette.d.ts +44 -0
- package/lib/typescript/components/chart/palette.d.ts.map +1 -0
- package/lib/typescript/components/chart/size.d.ts +25 -0
- package/lib/typescript/components/chart/size.d.ts.map +1 -0
- package/lib/typescript/components/chart/ticks.d.ts +3 -0
- package/lib/typescript/components/chart/ticks.d.ts.map +1 -0
- package/lib/typescript/components/chart/types.d.ts +163 -0
- package/lib/typescript/components/chart/types.d.ts.map +1 -0
- package/lib/typescript/components/chart/useChartHostWidth.d.ts +9 -0
- package/lib/typescript/components/chart/useChartHostWidth.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +5 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/SystemAlert.Button.figma.d.ts +11 -0
- package/lib/typescript/figma/SystemAlert.Button.figma.d.ts.map +1 -0
- package/lib/typescript/figma/SystemAlert.Close.figma.d.ts +11 -0
- package/lib/typescript/figma/SystemAlert.Close.figma.d.ts.map +1 -0
- package/lib/typescript/figma/SystemAlert.Description.figma.d.ts +8 -0
- package/lib/typescript/figma/SystemAlert.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts +11 -0
- package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts.map +1 -0
- package/lib/typescript/figma/SystemAlert.figma.d.ts +8 -0
- package/lib/typescript/figma/SystemAlert.figma.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/components/BarChart/geometry.ts +1469 -0
- package/src/components/BarChart/index.tsx +1424 -0
- package/src/components/BarChart/styles.ts +31 -0
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Chip/styles.ts +3 -1
- package/src/components/LineChart/geometry.ts +957 -0
- package/src/components/LineChart/index.tsx +1109 -0
- package/src/components/LineChart/styles.ts +26 -0
- package/src/components/PieChart/geometry.ts +295 -0
- package/src/components/PieChart/index.tsx +715 -0
- package/src/components/PieChart/styles.ts +101 -0
- package/src/components/ProgressCircle/ProgressCircleRing.tsx +10 -39
- package/src/components/ProgressCircle/ProgressRing.tsx +60 -0
- package/src/components/ScrollShadow/useScrollShadow.ts +12 -11
- package/src/components/Stepper/index.tsx +452 -0
- package/src/components/Stepper/styles.ts +234 -0
- package/src/components/Stepper/useStepperLabelFit.ts +21 -0
- package/src/components/Stepper/useStepperLabelFit.web.ts +53 -0
- package/src/components/Stepper/useStepperRingColors.ts +29 -0
- package/src/components/SystemAlert/animation.ts +252 -0
- package/src/components/SystemAlert/index.tsx +684 -0
- package/src/components/SystemAlert/styles.ts +212 -0
- package/src/components/SystemAlert/useSystemAlertStatusBarStyle.ts +57 -0
- package/src/components/Tabs/index.tsx +4 -0
- package/src/components/Tabs/styles.ts +1 -1
- package/src/components/chart/ChartInspector.tsx +726 -0
- package/src/components/chart/format.ts +95 -0
- package/src/components/chart/index.ts +24 -0
- package/src/components/chart/motion.ts +98 -0
- package/src/components/chart/palette.tsx +247 -0
- package/src/components/chart/size.ts +21 -0
- package/src/components/chart/ticks.ts +53 -0
- package/src/components/chart/types.ts +183 -0
- package/src/components/chart/useChartHostWidth.ts +26 -0
- package/src/components/index.ts +5 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { cva, type VariantProps } from '@cdx-ui/utils';
|
|
2
|
+
|
|
3
|
+
export type PieChartLegendPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
+
|
|
5
|
+
export const pieChartRootVariants = cva('w-full max-w-full gap-4', {
|
|
6
|
+
variants: {
|
|
7
|
+
placement: {
|
|
8
|
+
top: 'items-center',
|
|
9
|
+
bottom: 'items-center',
|
|
10
|
+
left: 'flex-row items-center justify-center',
|
|
11
|
+
right: 'flex-row items-center justify-center',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
placement: 'bottom',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const pieChartCanvasVariants = cva(
|
|
20
|
+
'relative shrink-0 items-center justify-center overflow-hidden web:outline-none',
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
sm: 'size-40',
|
|
25
|
+
md: 'size-48',
|
|
26
|
+
lg: 'size-56',
|
|
27
|
+
xl: 'size-64',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
size: 'lg',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export type PieChartLegendLayout = 'wrap' | 'list';
|
|
37
|
+
|
|
38
|
+
export const pieChartLegendVariants = cva('max-w-full', {
|
|
39
|
+
variants: {
|
|
40
|
+
layout: {
|
|
41
|
+
wrap: 'flex-row flex-wrap items-center justify-center gap-x-4 gap-y-2',
|
|
42
|
+
list: 'w-full self-stretch',
|
|
43
|
+
names: 'min-w-0 shrink gap-2',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
layout: 'wrap',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const pieChartLegendItemVariants = cva('flex-row items-center', {
|
|
52
|
+
variants: {
|
|
53
|
+
layout: {
|
|
54
|
+
wrap: 'gap-1.5',
|
|
55
|
+
list: 'w-full gap-2 py-2.5',
|
|
56
|
+
names: 'gap-1.5 py-0.5',
|
|
57
|
+
},
|
|
58
|
+
divided: {
|
|
59
|
+
true: 'border-b border-stroke-secondary',
|
|
60
|
+
false: '',
|
|
61
|
+
},
|
|
62
|
+
interactive: {
|
|
63
|
+
true: 'rounded-sm web:cursor-pointer web:outline-none web:focus-visible:ring-2 web:focus-visible:ring-[var(--color-stroke-ring)]',
|
|
64
|
+
false: '',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
layout: 'wrap',
|
|
69
|
+
divided: false,
|
|
70
|
+
interactive: false,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const pieChartLegendLabelVariants = cva('body-sm text-content-primary', {
|
|
75
|
+
variants: {
|
|
76
|
+
selected: {
|
|
77
|
+
true: 'font-medium text-content-primary',
|
|
78
|
+
false: '',
|
|
79
|
+
},
|
|
80
|
+
layout: {
|
|
81
|
+
wrap: '',
|
|
82
|
+
list: 'min-w-0 flex-1 font-normal text-content-primary',
|
|
83
|
+
names: 'font-normal text-content-primary',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
defaultVariants: {
|
|
87
|
+
selected: false,
|
|
88
|
+
layout: 'wrap',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const pieChartLegendMetaVariants = cva('body-sm font-normal text-content-primary');
|
|
93
|
+
|
|
94
|
+
export const pieChartLegendShareVariants = cva('body-sm w-12 text-right text-content-primary');
|
|
95
|
+
|
|
96
|
+
export const pieChartCenterLabelVariants = cva(
|
|
97
|
+
'body-md text-center font-medium text-content-primary',
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
export type PieChartRootVariantProps = VariantProps<typeof pieChartCanvasVariants>;
|
|
101
|
+
export type PieChartLegendLabelVariantProps = VariantProps<typeof pieChartLegendLabelVariants>;
|
|
@@ -7,12 +7,12 @@ import Animated, {
|
|
|
7
7
|
withRepeat,
|
|
8
8
|
withTiming,
|
|
9
9
|
} from 'react-native-reanimated';
|
|
10
|
-
import { Circle, Svg } from 'react-native-svg';
|
|
11
10
|
import { useProgressContext } from '@cdx-ui/primitives';
|
|
11
|
+
import { ProgressRing } from './ProgressRing';
|
|
12
12
|
import { PROGRESS_CIRCLE_DIMENSIONS, type ProgressCircleSize } from './styles';
|
|
13
13
|
import { useProgressCircleColors } from './useProgressCircleColors';
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const INDETERMINATE_ARC_PERCENT = 25;
|
|
16
16
|
const ROTATION_DURATION_MS = 1000;
|
|
17
17
|
|
|
18
18
|
export interface ProgressCircleRingProps {
|
|
@@ -25,9 +25,6 @@ export function ProgressCircleRing({ size = 'large', color = 'default' }: Progre
|
|
|
25
25
|
const ringColors = useProgressCircleColors(color);
|
|
26
26
|
const rotation = useSharedValue(0);
|
|
27
27
|
const { size: dimension, strokeWidth } = PROGRESS_CIRCLE_DIMENSIONS[size];
|
|
28
|
-
const radius = (dimension - strokeWidth) / 2;
|
|
29
|
-
const center = dimension / 2;
|
|
30
|
-
const circumference = 2 * Math.PI * radius;
|
|
31
28
|
const isIndeterminate = state === 'indeterminate';
|
|
32
29
|
|
|
33
30
|
useEffect(() => {
|
|
@@ -55,41 +52,15 @@ export function ProgressCircleRing({ size = 'large', color = 'default' }: Progre
|
|
|
55
52
|
[rotation],
|
|
56
53
|
);
|
|
57
54
|
|
|
58
|
-
const progressLength = isIndeterminate
|
|
59
|
-
? circumference * INDETERMINATE_ARC_RATIO
|
|
60
|
-
: (circumference * percent) / 100;
|
|
61
|
-
const gapLength = circumference - progressLength;
|
|
62
|
-
|
|
63
55
|
const ring = (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
r={radius}
|
|
73
|
-
stroke={ringColors.track}
|
|
74
|
-
strokeWidth={strokeWidth}
|
|
75
|
-
fill="none"
|
|
76
|
-
opacity={ringColors.trackOpacity}
|
|
77
|
-
/>
|
|
78
|
-
{progressLength > 0 ? (
|
|
79
|
-
<Circle
|
|
80
|
-
cx={center}
|
|
81
|
-
cy={center}
|
|
82
|
-
r={radius}
|
|
83
|
-
stroke={ringColors.indicator}
|
|
84
|
-
strokeWidth={strokeWidth}
|
|
85
|
-
fill="none"
|
|
86
|
-
strokeDasharray={`${String(progressLength)} ${String(gapLength)}`}
|
|
87
|
-
strokeLinecap="round"
|
|
88
|
-
rotation={-90}
|
|
89
|
-
origin={`${String(center)}, ${String(center)}`}
|
|
90
|
-
/>
|
|
91
|
-
) : null}
|
|
92
|
-
</Svg>
|
|
56
|
+
<ProgressRing
|
|
57
|
+
size={dimension}
|
|
58
|
+
strokeWidth={strokeWidth}
|
|
59
|
+
value={isIndeterminate ? INDETERMINATE_ARC_PERCENT : percent}
|
|
60
|
+
trackColor={ringColors.track}
|
|
61
|
+
indicatorColor={ringColors.indicator}
|
|
62
|
+
trackOpacity={ringColors.trackOpacity}
|
|
63
|
+
/>
|
|
93
64
|
);
|
|
94
65
|
|
|
95
66
|
if (isIndeterminate) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Circle, Svg } from 'react-native-svg';
|
|
2
|
+
|
|
3
|
+
export interface ProgressRingProps {
|
|
4
|
+
/** Outer diameter in px. */
|
|
5
|
+
readonly size: number;
|
|
6
|
+
readonly strokeWidth: number;
|
|
7
|
+
/** Arc length as a percentage of the circumference, 0–100. */
|
|
8
|
+
readonly value: number;
|
|
9
|
+
readonly trackColor: string;
|
|
10
|
+
readonly indicatorColor: string;
|
|
11
|
+
/** @default 1 */
|
|
12
|
+
readonly trackOpacity?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Size-agnostic determinate ring: a full track plus a round-capped arc starting at 12 o'clock.
|
|
17
|
+
* Internal to `@cdx-ui/components`; shared by `ProgressCircle` and `Stepper.Indicator`.
|
|
18
|
+
*/
|
|
19
|
+
export function ProgressRing({
|
|
20
|
+
size,
|
|
21
|
+
strokeWidth,
|
|
22
|
+
value,
|
|
23
|
+
trackColor,
|
|
24
|
+
indicatorColor,
|
|
25
|
+
trackOpacity = 1,
|
|
26
|
+
}: ProgressRingProps) {
|
|
27
|
+
const radius = (size - strokeWidth) / 2;
|
|
28
|
+
const center = size / 2;
|
|
29
|
+
const circumference = 2 * Math.PI * radius;
|
|
30
|
+
const progressLength = (circumference * value) / 100;
|
|
31
|
+
const gapLength = circumference - progressLength;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Svg width={size} height={size} viewBox={`0 0 ${String(size)} ${String(size)}`}>
|
|
35
|
+
<Circle
|
|
36
|
+
cx={center}
|
|
37
|
+
cy={center}
|
|
38
|
+
r={radius}
|
|
39
|
+
stroke={trackColor}
|
|
40
|
+
strokeWidth={strokeWidth}
|
|
41
|
+
fill="none"
|
|
42
|
+
opacity={trackOpacity}
|
|
43
|
+
/>
|
|
44
|
+
{progressLength > 0 ? (
|
|
45
|
+
<Circle
|
|
46
|
+
cx={center}
|
|
47
|
+
cy={center}
|
|
48
|
+
r={radius}
|
|
49
|
+
stroke={indicatorColor}
|
|
50
|
+
strokeWidth={strokeWidth}
|
|
51
|
+
fill="none"
|
|
52
|
+
strokeDasharray={`${String(progressLength)} ${String(gapLength)}`}
|
|
53
|
+
strokeLinecap="round"
|
|
54
|
+
rotation={-90}
|
|
55
|
+
origin={`${String(center)}, ${String(center)}`}
|
|
56
|
+
/>
|
|
57
|
+
) : null}
|
|
58
|
+
</Svg>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -98,6 +98,7 @@ export function useScrollShadowTracker({
|
|
|
98
98
|
canScrollBefore: false,
|
|
99
99
|
canScrollAfter: false,
|
|
100
100
|
});
|
|
101
|
+
const capabilityRef = useRef(capability);
|
|
101
102
|
|
|
102
103
|
const updateCapability = useCallback(() => {
|
|
103
104
|
if (!enabled) {
|
|
@@ -106,18 +107,18 @@ export function useScrollShadowTracker({
|
|
|
106
107
|
|
|
107
108
|
onDistanceChange?.(getScrollDistance(metricsRef.current, offset));
|
|
108
109
|
const nextCapability = getScrollCapability(metricsRef.current, offset);
|
|
110
|
+
const previousCapability = capabilityRef.current;
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
112
|
+
if (
|
|
113
|
+
previousCapability.canScrollBefore === nextCapability.canScrollBefore &&
|
|
114
|
+
previousCapability.canScrollAfter === nextCapability.canScrollAfter
|
|
115
|
+
) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
capabilityRef.current = nextCapability;
|
|
120
|
+
setCapability(nextCapability);
|
|
121
|
+
onCapabilityChange?.(nextCapability);
|
|
121
122
|
}, [enabled, offset, onCapabilityChange, onDistanceChange]);
|
|
122
123
|
|
|
123
124
|
useEffect(() => {
|