@cdx-ui/components 0.3.5 → 0.3.7
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 +10 -1
- package/docs/components/country-flag/content.md +232 -0
- package/docs/components/data-grid/content.md +3 -1
- package/docs/components/icon/content.md +1 -1
- package/docs/components/input/content.md +1 -0
- package/docs/components/line-chart/content.md +567 -0
- package/docs/components/pie-chart/content.md +493 -0
- package/docs/components/progress-bar/content.md +164 -3
- package/docs/components/progress-segmented/content.md +1 -1
- package/docs/components/select/content.md +1 -0
- package/docs/components/stepper/content.md +599 -0
- package/docs/components/system-alert/content.md +533 -0
- package/docs/foundations/expressions/icons/content.md +2 -1
- package/docs/foundations/styles/tokens/all-tokens/content.md +2 -1
- package/docs/getting-started/developers/content.md +1 -1
- package/docs/llms.txt +12 -0
- package/docs/patterns/content.md +1 -0
- package/docs/patterns/dashboard/content.md +423 -19
- package/docs/patterns/insights/content.md +659 -0
- package/docs/resources/content.md +1 -0
- package/docs/resources/release-notes/0.3.5/content.md +7 -0
- package/docs/resources/release-notes/0.3.6/content.md +29 -0
- package/docs/resources/release-notes/content.md +2 -0
- package/docs/resources/skills/content.md +66 -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 +935 -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/CountryFlag/index.js +56 -0
- package/lib/commonjs/components/CountryFlag/index.js.map +1 -0
- package/lib/commonjs/components/Input/index.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 +744 -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/ProgressBar/index.js +44 -12
- package/lib/commonjs/components/ProgressBar/index.js.map +1 -1
- package/lib/commonjs/components/ProgressBar/styles.js +31 -2
- package/lib/commonjs/components/ProgressBar/styles.js.map +1 -1
- 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/Select/index.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/hiddenSvgProps.js +23 -0
- package/lib/commonjs/components/chart/hiddenSvgProps.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 +72 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/figma/Accordion.figma.js +2 -2
- package/lib/commonjs/figma/Accordion.figma.js.map +1 -1
- package/lib/commonjs/figma/Alert.figma.js +7 -7
- package/lib/commonjs/figma/Alert.figma.js.map +1 -1
- package/lib/commonjs/figma/Badge.Indicator.figma.js +6 -5
- package/lib/commonjs/figma/Badge.Indicator.figma.js.map +1 -1
- package/lib/commonjs/figma/Badge.figma.js +22 -22
- package/lib/commonjs/figma/Badge.figma.js.map +1 -1
- package/lib/commonjs/figma/Button.figma.js +5 -2
- package/lib/commonjs/figma/Button.figma.js.map +1 -1
- package/lib/commonjs/figma/CLAUDE.md +1 -0
- package/lib/commonjs/figma/Card.Header.figma.js +8 -4
- package/lib/commonjs/figma/Card.Header.figma.js.map +1 -1
- package/lib/commonjs/figma/Card.figma.js +2 -1
- package/lib/commonjs/figma/Card.figma.js.map +1 -1
- package/lib/commonjs/figma/Chip.figma.js +2 -2
- package/lib/commonjs/figma/Chip.figma.js.map +1 -1
- package/lib/commonjs/figma/CurrencyInput.figma.js +1 -1
- package/lib/commonjs/figma/CurrencyInput.figma.js.map +1 -1
- package/lib/commonjs/figma/Dialog.figma.js +5 -2
- package/lib/commonjs/figma/Dialog.figma.js.map +1 -1
- package/lib/commonjs/figma/Divider.figma.js +1 -1
- package/lib/commonjs/figma/Divider.figma.js.map +1 -1
- package/lib/commonjs/figma/Drawer.figma.js +3 -3
- package/lib/commonjs/figma/Drawer.figma.js.map +1 -1
- package/lib/commonjs/figma/IconButton.figma.js +10 -4
- package/lib/commonjs/figma/IconButton.figma.js.map +1 -1
- package/lib/commonjs/figma/Input.figma.js +2 -1
- package/lib/commonjs/figma/Input.figma.js.map +1 -1
- package/lib/commonjs/figma/Insight.figma.js +3 -3
- package/lib/commonjs/figma/Insight.figma.js.map +1 -1
- package/lib/commonjs/figma/ProgressBar.figma.js +11 -2
- package/lib/commonjs/figma/ProgressBar.figma.js.map +1 -1
- package/lib/commonjs/figma/ProgressSegmented.figma.js +9 -1
- package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -1
- package/lib/commonjs/figma/Select.figma.js +2 -1
- package/lib/commonjs/figma/Select.figma.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 +47 -0
- package/lib/commonjs/figma/SystemAlert.figma.js.map +1 -0
- package/lib/commonjs/styles.css +0 -1
- 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 +929 -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/CountryFlag/index.js +52 -0
- package/lib/module/components/CountryFlag/index.js.map +1 -0
- package/lib/module/components/Input/index.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 +738 -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/ProgressBar/index.js +47 -15
- package/lib/module/components/ProgressBar/index.js.map +1 -1
- package/lib/module/components/ProgressBar/styles.js +31 -2
- package/lib/module/components/ProgressBar/styles.js.map +1 -1
- 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/Select/index.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/hiddenSvgProps.js +20 -0
- package/lib/module/components/chart/hiddenSvgProps.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 +6 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/figma/Accordion.figma.js +2 -2
- package/lib/module/figma/Accordion.figma.js.map +1 -1
- package/lib/module/figma/Alert.figma.js +7 -7
- package/lib/module/figma/Alert.figma.js.map +1 -1
- package/lib/module/figma/Badge.Indicator.figma.js +6 -5
- package/lib/module/figma/Badge.Indicator.figma.js.map +1 -1
- package/lib/module/figma/Badge.figma.js +22 -22
- package/lib/module/figma/Badge.figma.js.map +1 -1
- package/lib/module/figma/Button.figma.js +5 -2
- package/lib/module/figma/Button.figma.js.map +1 -1
- package/lib/module/figma/CLAUDE.md +1 -0
- package/lib/module/figma/Card.Header.figma.js +8 -4
- package/lib/module/figma/Card.Header.figma.js.map +1 -1
- package/lib/module/figma/Card.figma.js +2 -1
- package/lib/module/figma/Card.figma.js.map +1 -1
- package/lib/module/figma/Chip.figma.js +2 -2
- package/lib/module/figma/Chip.figma.js.map +1 -1
- package/lib/module/figma/CurrencyInput.figma.js +1 -1
- package/lib/module/figma/CurrencyInput.figma.js.map +1 -1
- package/lib/module/figma/Dialog.figma.js +5 -2
- package/lib/module/figma/Dialog.figma.js.map +1 -1
- package/lib/module/figma/Divider.figma.js +1 -1
- package/lib/module/figma/Divider.figma.js.map +1 -1
- package/lib/module/figma/Drawer.figma.js +3 -3
- package/lib/module/figma/Drawer.figma.js.map +1 -1
- package/lib/module/figma/IconButton.figma.js +10 -4
- package/lib/module/figma/IconButton.figma.js.map +1 -1
- package/lib/module/figma/Input.figma.js +2 -1
- package/lib/module/figma/Input.figma.js.map +1 -1
- package/lib/module/figma/Insight.figma.js +3 -3
- package/lib/module/figma/Insight.figma.js.map +1 -1
- package/lib/module/figma/ProgressBar.figma.js +12 -2
- package/lib/module/figma/ProgressBar.figma.js.map +1 -1
- package/lib/module/figma/ProgressSegmented.figma.js +9 -1
- package/lib/module/figma/ProgressSegmented.figma.js.map +1 -1
- package/lib/module/figma/Select.figma.js +2 -1
- package/lib/module/figma/Select.figma.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 +41 -0
- package/lib/module/figma/SystemAlert.figma.js.map +1 -0
- package/lib/module/styles.css +0 -1
- 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/CountryFlag/index.d.ts +35 -0
- package/lib/typescript/components/CountryFlag/index.d.ts.map +1 -0
- package/lib/typescript/components/Input/index.d.ts +2 -0
- package/lib/typescript/components/Input/index.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/ProgressBar/index.d.ts +16 -1
- package/lib/typescript/components/ProgressBar/index.d.ts.map +1 -1
- package/lib/typescript/components/ProgressBar/styles.d.ts +7 -2
- package/lib/typescript/components/ProgressBar/styles.d.ts.map +1 -1
- 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/Select/index.d.ts +2 -0
- package/lib/typescript/components/Select/index.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/hiddenSvgProps.d.ts +17 -0
- package/lib/typescript/components/chart/hiddenSvgProps.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 +6 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/Alert.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Badge.Indicator.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Badge.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Button.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Card.Header.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Card.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Dialog.figma.d.ts.map +1 -1
- package/lib/typescript/figma/IconButton.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Input.figma.d.ts.map +1 -1
- package/lib/typescript/figma/ProgressBar.figma.d.ts.map +1 -1
- package/lib/typescript/figma/ProgressSegmented.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Select.figma.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 +1417 -0
- package/src/components/BarChart/styles.ts +31 -0
- package/src/components/Button/index.tsx +1 -1
- package/src/components/CountryFlag/index.tsx +53 -0
- package/src/components/Input/index.tsx +2 -0
- package/src/components/LineChart/geometry.ts +957 -0
- package/src/components/LineChart/index.tsx +1106 -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/ProgressBar/index.tsx +66 -14
- package/src/components/ProgressBar/styles.ts +35 -4
- 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/Select/index.tsx +2 -0
- 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/hiddenSvgProps.ts +15 -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 +6 -0
- package/src/styles.css +0 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
createContext,
|
|
4
|
+
forwardRef,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
type ReactElement,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
} from 'react';
|
|
11
|
+
import { Text, View, type TextProps, type ViewProps } from 'react-native';
|
|
12
|
+
import {
|
|
13
|
+
Slot,
|
|
14
|
+
StepperRoot,
|
|
15
|
+
StepperStep,
|
|
16
|
+
StepperStepTrigger,
|
|
17
|
+
dataAttributes,
|
|
18
|
+
mergeDataAttributes,
|
|
19
|
+
useStepperContext,
|
|
20
|
+
useStepperIndex,
|
|
21
|
+
useStepperStep,
|
|
22
|
+
type IStepperProps,
|
|
23
|
+
type IStepperStepProps,
|
|
24
|
+
} from '@cdx-ui/primitives';
|
|
25
|
+
import { CheckCircle } from '@cdx-ui/icons';
|
|
26
|
+
import { cn, flattenChildren, mergeRefs } from '@cdx-ui/utils';
|
|
27
|
+
import { Icon } from '../Icon';
|
|
28
|
+
import { ProgressRing } from '../ProgressCircle/ProgressRing';
|
|
29
|
+
import {
|
|
30
|
+
getStepperLayout,
|
|
31
|
+
STEPPER_INDICATOR_SIZE,
|
|
32
|
+
STEPPER_RING_STROKE_WIDTH,
|
|
33
|
+
stepperContentVariants,
|
|
34
|
+
stepperDescriptionVariants,
|
|
35
|
+
stepperIndicatorCheckVariants,
|
|
36
|
+
stepperIndicatorDiscVariants,
|
|
37
|
+
stepperIndicatorNumeralVariants,
|
|
38
|
+
stepperIndicatorRingVariants,
|
|
39
|
+
stepperIndicatorVariants,
|
|
40
|
+
stepperSeparatorVariants,
|
|
41
|
+
stepperStepBodyVariants,
|
|
42
|
+
stepperStepLabelVariants,
|
|
43
|
+
stepperStepMainVariants,
|
|
44
|
+
stepperStepTriggerVariants,
|
|
45
|
+
stepperStepVariants,
|
|
46
|
+
stepperTitleVariants,
|
|
47
|
+
stepperVariants,
|
|
48
|
+
} from './styles';
|
|
49
|
+
import { useStepperLabelFit, type StepperLabelFit } from './useStepperLabelFit';
|
|
50
|
+
import { useStepperRingColors } from './useStepperRingColors';
|
|
51
|
+
|
|
52
|
+
export { useStepperStep } from '@cdx-ui/primitives';
|
|
53
|
+
export type {
|
|
54
|
+
StepperLabelPlacement,
|
|
55
|
+
StepperOrientation,
|
|
56
|
+
StepperStepState,
|
|
57
|
+
} from '@cdx-ui/primitives';
|
|
58
|
+
|
|
59
|
+
const StepperLabelFitContext = createContext<StepperLabelFit>('shrink');
|
|
60
|
+
|
|
61
|
+
/** Counts steps the way `StepperRoot` numbers them, so the label-fit decision resets with them. */
|
|
62
|
+
function countSteps(children: ReactNode, asChild: boolean | undefined): number {
|
|
63
|
+
const source =
|
|
64
|
+
asChild && isValidElement<{ children?: ReactNode }>(children)
|
|
65
|
+
? children.props.children
|
|
66
|
+
: children;
|
|
67
|
+
return flattenChildren(source).filter((child) => isValidElement(child)).length;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const HIDDEN_FROM_AT = {
|
|
71
|
+
'aria-hidden': true,
|
|
72
|
+
accessibilityElementsHidden: true,
|
|
73
|
+
importantForAccessibility: 'no-hide-descendants',
|
|
74
|
+
} as const;
|
|
75
|
+
|
|
76
|
+
// =============================================================================
|
|
77
|
+
// ROOT
|
|
78
|
+
// =============================================================================
|
|
79
|
+
|
|
80
|
+
export interface StepperProps extends IStepperProps {
|
|
81
|
+
readonly className?: string;
|
|
82
|
+
/**
|
|
83
|
+
* `Stepper.Step` elements. Every direct element child is a step and is numbered by position;
|
|
84
|
+
* arrays and fragments are unwrapped, and `false`/`null` children are skipped.
|
|
85
|
+
*/
|
|
86
|
+
readonly children?: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const StepperRootComponent = forwardRef<View, StepperProps>(
|
|
90
|
+
(
|
|
91
|
+
{ className, style, orientation = 'vertical', labelPlacement = 'end', children, ...props },
|
|
92
|
+
ref,
|
|
93
|
+
) => {
|
|
94
|
+
const layout = getStepperLayout(orientation, labelPlacement);
|
|
95
|
+
const { fit, measureRef } = useStepperLabelFit(
|
|
96
|
+
layout === 'horizontal-end',
|
|
97
|
+
countSteps(children, props.asChild),
|
|
98
|
+
);
|
|
99
|
+
const rootRef = useMemo(
|
|
100
|
+
() => (measureRef === undefined ? ref : mergeRefs(ref, measureRef)),
|
|
101
|
+
[ref, measureRef],
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<StepperLabelFitContext.Provider value={fit}>
|
|
106
|
+
<StepperRoot
|
|
107
|
+
ref={rootRef}
|
|
108
|
+
className={cn(stepperVariants({ layout }), className)}
|
|
109
|
+
style={style}
|
|
110
|
+
orientation={orientation}
|
|
111
|
+
labelPlacement={labelPlacement}
|
|
112
|
+
{...props}
|
|
113
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'stepper' }))}
|
|
114
|
+
>
|
|
115
|
+
{children}
|
|
116
|
+
</StepperRoot>
|
|
117
|
+
</StepperLabelFitContext.Provider>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
StepperRootComponent.displayName = 'Stepper';
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// STEP
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
export interface StepperStepProps extends IStepperStepProps {
|
|
129
|
+
readonly className?: string;
|
|
130
|
+
/**
|
|
131
|
+
* `Stepper.Indicator`, `Stepper.Title`, `Stepper.Description`, `Stepper.Content` and
|
|
132
|
+
* `Stepper.Separator`. They must be **direct** children: the step sorts them into regions by
|
|
133
|
+
* component identity, so a `memo()`/HOC wrapper is not recognized and renders as content.
|
|
134
|
+
* Only the first of each slot is used. `asChild` skips the sorting.
|
|
135
|
+
*/
|
|
136
|
+
readonly children?: ReactNode;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function isSlot(child: ReactNode, type: unknown): child is ReactElement {
|
|
140
|
+
return isValidElement(child) && child.type === type;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const StepperStepComponent = forwardRef<View, StepperStepProps>(
|
|
144
|
+
({ asChild, className, style, children, ...props }, ref) => {
|
|
145
|
+
const { orientation, labelPlacement, count } = useStepperContext();
|
|
146
|
+
const layout = getStepperLayout(orientation, labelPlacement);
|
|
147
|
+
const labelFit = useContext(StepperLabelFitContext);
|
|
148
|
+
const isLast = useStepperIndex() === count - 1;
|
|
149
|
+
const stepClass = cn(stepperStepVariants({ layout, isLast, labelFit }), className);
|
|
150
|
+
const slotAttributes = mergeDataAttributes(props, dataAttributes({ slot: 'stepper-step' }));
|
|
151
|
+
|
|
152
|
+
if (asChild) {
|
|
153
|
+
return (
|
|
154
|
+
<StepperStep
|
|
155
|
+
ref={ref}
|
|
156
|
+
asChild
|
|
157
|
+
className={stepClass}
|
|
158
|
+
style={style}
|
|
159
|
+
{...props}
|
|
160
|
+
{...slotAttributes}
|
|
161
|
+
>
|
|
162
|
+
{children}
|
|
163
|
+
</StepperStep>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Indicator, Title and Description form the step trigger, which carries the accessible
|
|
168
|
+
// name; everything else is the body below the title. The Separator sits in the indicator
|
|
169
|
+
// track: before the main column when vertical, after it when horizontal.
|
|
170
|
+
const childArray = Children.toArray(children);
|
|
171
|
+
const indicator = childArray.find((child) => isSlot(child, StepperIndicatorComponent));
|
|
172
|
+
const title = childArray.find((child) => isSlot(child, StepperTitleComponent));
|
|
173
|
+
const description = childArray.find((child) => isSlot(child, StepperDescriptionComponent));
|
|
174
|
+
const separator = childArray.find((child) => isSlot(child, StepperSeparatorComponent));
|
|
175
|
+
const body = childArray.filter(
|
|
176
|
+
(child) =>
|
|
177
|
+
!isSlot(child, StepperIndicatorComponent) &&
|
|
178
|
+
!isSlot(child, StepperTitleComponent) &&
|
|
179
|
+
!isSlot(child, StepperDescriptionComponent) &&
|
|
180
|
+
!isSlot(child, StepperSeparatorComponent),
|
|
181
|
+
);
|
|
182
|
+
const hasLabel = title !== undefined || description !== undefined;
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<StepperStep ref={ref} className={stepClass} style={style} {...props} {...slotAttributes}>
|
|
186
|
+
{layout === 'vertical' ? separator : null}
|
|
187
|
+
<View className={cn(stepperStepMainVariants({ layout, labelFit }))}>
|
|
188
|
+
<StepperStepTrigger
|
|
189
|
+
className={stepperStepTriggerVariants({ layout })}
|
|
190
|
+
{...dataAttributes({ slot: 'stepper-step-trigger' })}
|
|
191
|
+
>
|
|
192
|
+
{indicator}
|
|
193
|
+
{hasLabel ? (
|
|
194
|
+
<View className={cn(stepperStepLabelVariants({ layout, labelFit }))}>
|
|
195
|
+
{title}
|
|
196
|
+
{description}
|
|
197
|
+
</View>
|
|
198
|
+
) : null}
|
|
199
|
+
</StepperStepTrigger>
|
|
200
|
+
{body.length > 0 ? (
|
|
201
|
+
<View className={stepperStepBodyVariants({ layout })}>{body}</View>
|
|
202
|
+
) : null}
|
|
203
|
+
</View>
|
|
204
|
+
{layout === 'vertical' ? null : separator}
|
|
205
|
+
</StepperStep>
|
|
206
|
+
);
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
StepperStepComponent.displayName = 'Stepper.Step';
|
|
211
|
+
|
|
212
|
+
// =============================================================================
|
|
213
|
+
// INDICATOR
|
|
214
|
+
// =============================================================================
|
|
215
|
+
|
|
216
|
+
export interface StepperIndicatorProps extends ViewProps {
|
|
217
|
+
/** Replaces the whole indicator with the child element via `Slot`. */
|
|
218
|
+
readonly asChild?: boolean;
|
|
219
|
+
readonly className?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Replaces the glyph inside the disc. The disc, tone and progress ring still render.
|
|
222
|
+
* Defaults to a check when the step is complete, otherwise the 1-based step number.
|
|
223
|
+
*/
|
|
224
|
+
readonly children?: ReactNode;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const StepperIndicatorComponent = forwardRef<View, StepperIndicatorProps>(
|
|
228
|
+
({ asChild, className, style, children, ...props }, ref) => {
|
|
229
|
+
const { index, isCurrent, isComplete, hasProgress, progress } = useStepperStep();
|
|
230
|
+
const ringColors = useStepperRingColors(isCurrent);
|
|
231
|
+
const currentAttribute = dataAttributes({ current: isCurrent });
|
|
232
|
+
const indicatorClass = cn(stepperIndicatorVariants(), className);
|
|
233
|
+
const indicatorAttributes = mergeDataAttributes(
|
|
234
|
+
props,
|
|
235
|
+
dataAttributes({
|
|
236
|
+
slot: 'stepper-indicator',
|
|
237
|
+
current: isCurrent,
|
|
238
|
+
complete: isComplete,
|
|
239
|
+
progress: hasProgress,
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
if (asChild) {
|
|
244
|
+
return (
|
|
245
|
+
<Slot
|
|
246
|
+
ref={ref}
|
|
247
|
+
className={indicatorClass}
|
|
248
|
+
style={style}
|
|
249
|
+
{...props}
|
|
250
|
+
{...HIDDEN_FROM_AT}
|
|
251
|
+
{...indicatorAttributes}
|
|
252
|
+
>
|
|
253
|
+
{children}
|
|
254
|
+
</Slot>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const hasCustomGlyph = children !== undefined && children !== null;
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<View
|
|
262
|
+
ref={ref}
|
|
263
|
+
className={indicatorClass}
|
|
264
|
+
style={style}
|
|
265
|
+
{...props}
|
|
266
|
+
{...HIDDEN_FROM_AT}
|
|
267
|
+
{...indicatorAttributes}
|
|
268
|
+
>
|
|
269
|
+
{hasProgress ? (
|
|
270
|
+
<View className={stepperIndicatorRingVariants()}>
|
|
271
|
+
<ProgressRing
|
|
272
|
+
size={STEPPER_INDICATOR_SIZE}
|
|
273
|
+
strokeWidth={STEPPER_RING_STROKE_WIDTH}
|
|
274
|
+
value={progress}
|
|
275
|
+
trackColor={ringColors.track}
|
|
276
|
+
indicatorColor={ringColors.indicator}
|
|
277
|
+
/>
|
|
278
|
+
</View>
|
|
279
|
+
) : null}
|
|
280
|
+
{isComplete && !hasCustomGlyph ? (
|
|
281
|
+
<Icon
|
|
282
|
+
as={CheckCircle}
|
|
283
|
+
filled
|
|
284
|
+
className={stepperIndicatorCheckVariants()}
|
|
285
|
+
{...currentAttribute}
|
|
286
|
+
/>
|
|
287
|
+
) : (
|
|
288
|
+
<View className={stepperIndicatorDiscVariants()} {...currentAttribute}>
|
|
289
|
+
{hasCustomGlyph ? (
|
|
290
|
+
children
|
|
291
|
+
) : (
|
|
292
|
+
<Text className={stepperIndicatorNumeralVariants()} {...currentAttribute}>
|
|
293
|
+
{String(index + 1)}
|
|
294
|
+
</Text>
|
|
295
|
+
)}
|
|
296
|
+
</View>
|
|
297
|
+
)}
|
|
298
|
+
</View>
|
|
299
|
+
);
|
|
300
|
+
},
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
StepperIndicatorComponent.displayName = 'Stepper.Indicator';
|
|
304
|
+
|
|
305
|
+
// =============================================================================
|
|
306
|
+
// TITLE
|
|
307
|
+
// =============================================================================
|
|
308
|
+
|
|
309
|
+
export interface StepperTitleProps extends TextProps {
|
|
310
|
+
readonly asChild?: boolean;
|
|
311
|
+
readonly className?: string;
|
|
312
|
+
readonly children?: ReactNode;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const StepperTitleComponent = forwardRef<Text, StepperTitleProps>(
|
|
316
|
+
({ asChild, className, style, ...props }, ref) => {
|
|
317
|
+
const { isCurrent, orientation, labelPlacement } = useStepperStep();
|
|
318
|
+
const isCentered = getStepperLayout(orientation, labelPlacement) === 'horizontal-bottom';
|
|
319
|
+
const Comp = asChild ? Slot : Text;
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<Comp
|
|
323
|
+
ref={ref}
|
|
324
|
+
className={cn(stepperTitleVariants({ isCentered }), className)}
|
|
325
|
+
style={style}
|
|
326
|
+
{...props}
|
|
327
|
+
{...mergeDataAttributes(
|
|
328
|
+
props,
|
|
329
|
+
dataAttributes({ slot: 'stepper-title', current: isCurrent }),
|
|
330
|
+
)}
|
|
331
|
+
/>
|
|
332
|
+
);
|
|
333
|
+
},
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
StepperTitleComponent.displayName = 'Stepper.Title';
|
|
337
|
+
|
|
338
|
+
// =============================================================================
|
|
339
|
+
// DESCRIPTION
|
|
340
|
+
// =============================================================================
|
|
341
|
+
|
|
342
|
+
export interface StepperDescriptionProps extends TextProps {
|
|
343
|
+
readonly asChild?: boolean;
|
|
344
|
+
readonly className?: string;
|
|
345
|
+
readonly children?: ReactNode;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
const StepperDescriptionComponent = forwardRef<Text, StepperDescriptionProps>(
|
|
349
|
+
({ asChild, className, style, ...props }, ref) => {
|
|
350
|
+
const { orientation, labelPlacement } = useStepperStep();
|
|
351
|
+
const isCentered = getStepperLayout(orientation, labelPlacement) === 'horizontal-bottom';
|
|
352
|
+
const Comp = asChild ? Slot : Text;
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<Comp
|
|
356
|
+
ref={ref}
|
|
357
|
+
className={cn(stepperDescriptionVariants({ isCentered }), className)}
|
|
358
|
+
style={style}
|
|
359
|
+
{...props}
|
|
360
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'stepper-description' }))}
|
|
361
|
+
/>
|
|
362
|
+
);
|
|
363
|
+
},
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
StepperDescriptionComponent.displayName = 'Stepper.Description';
|
|
367
|
+
|
|
368
|
+
// =============================================================================
|
|
369
|
+
// CONTENT
|
|
370
|
+
// =============================================================================
|
|
371
|
+
|
|
372
|
+
export interface StepperContentProps extends ViewProps {
|
|
373
|
+
readonly asChild?: boolean;
|
|
374
|
+
readonly className?: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const StepperContentComponent = forwardRef<View, StepperContentProps>(
|
|
378
|
+
({ asChild, className, style, ...props }, ref) => {
|
|
379
|
+
const Comp = asChild ? Slot : View;
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<Comp
|
|
383
|
+
ref={ref}
|
|
384
|
+
className={cn(stepperContentVariants(), className)}
|
|
385
|
+
style={style}
|
|
386
|
+
{...props}
|
|
387
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'stepper-content' }))}
|
|
388
|
+
/>
|
|
389
|
+
);
|
|
390
|
+
},
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
StepperContentComponent.displayName = 'Stepper.Content';
|
|
394
|
+
|
|
395
|
+
// =============================================================================
|
|
396
|
+
// SEPARATOR
|
|
397
|
+
// =============================================================================
|
|
398
|
+
|
|
399
|
+
export interface StepperSeparatorProps extends ViewProps {
|
|
400
|
+
readonly asChild?: boolean;
|
|
401
|
+
readonly className?: string;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const StepperSeparatorComponent = forwardRef<View, StepperSeparatorProps>(
|
|
405
|
+
({ asChild, className, style, ...props }, ref) => {
|
|
406
|
+
const { isLast, orientation, labelPlacement } = useStepperStep();
|
|
407
|
+
|
|
408
|
+
if (isLast) {
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const Comp = asChild ? Slot : View;
|
|
413
|
+
|
|
414
|
+
return (
|
|
415
|
+
<Comp
|
|
416
|
+
ref={ref}
|
|
417
|
+
className={cn(
|
|
418
|
+
stepperSeparatorVariants({ layout: getStepperLayout(orientation, labelPlacement) }),
|
|
419
|
+
className,
|
|
420
|
+
)}
|
|
421
|
+
style={style}
|
|
422
|
+
{...props}
|
|
423
|
+
{...HIDDEN_FROM_AT}
|
|
424
|
+
{...mergeDataAttributes(props, dataAttributes({ slot: 'stepper-separator' }))}
|
|
425
|
+
/>
|
|
426
|
+
);
|
|
427
|
+
},
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
StepperSeparatorComponent.displayName = 'Stepper.Separator';
|
|
431
|
+
|
|
432
|
+
// =============================================================================
|
|
433
|
+
// COMPOUND EXPORT
|
|
434
|
+
// =============================================================================
|
|
435
|
+
|
|
436
|
+
type StepperCompoundComponent = typeof StepperRootComponent & {
|
|
437
|
+
Step: typeof StepperStepComponent;
|
|
438
|
+
Indicator: typeof StepperIndicatorComponent;
|
|
439
|
+
Title: typeof StepperTitleComponent;
|
|
440
|
+
Description: typeof StepperDescriptionComponent;
|
|
441
|
+
Content: typeof StepperContentComponent;
|
|
442
|
+
Separator: typeof StepperSeparatorComponent;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
export const Stepper = Object.assign(StepperRootComponent, {
|
|
446
|
+
Step: StepperStepComponent,
|
|
447
|
+
Indicator: StepperIndicatorComponent,
|
|
448
|
+
Title: StepperTitleComponent,
|
|
449
|
+
Description: StepperDescriptionComponent,
|
|
450
|
+
Content: StepperContentComponent,
|
|
451
|
+
Separator: StepperSeparatorComponent,
|
|
452
|
+
}) as StepperCompoundComponent;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import type { StepperLabelPlacement, StepperOrientation } from '@cdx-ui/primitives';
|
|
3
|
+
import { cva, type VariantProps } from '@cdx-ui/utils';
|
|
4
|
+
import { TRANSITION_COLORS } from '../../styles/constants';
|
|
5
|
+
|
|
6
|
+
/** Indicator frame in px. The ring is drawn at this size around the 24px disc. */
|
|
7
|
+
export const STEPPER_INDICATOR_SIZE = 34;
|
|
8
|
+
export const STEPPER_RING_STROKE_WIDTH = 3;
|
|
9
|
+
|
|
10
|
+
export type StepperLayout = 'vertical' | 'horizontal-end' | 'horizontal-bottom';
|
|
11
|
+
|
|
12
|
+
export function getStepperLayout(
|
|
13
|
+
orientation: StepperOrientation,
|
|
14
|
+
labelPlacement: StepperLabelPlacement,
|
|
15
|
+
): StepperLayout {
|
|
16
|
+
if (orientation === 'vertical') {
|
|
17
|
+
return 'vertical';
|
|
18
|
+
}
|
|
19
|
+
return labelPlacement === 'bottom' ? 'horizontal-bottom' : 'horizontal-end';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Horizontal layouts:
|
|
23
|
+
// - `horizontal-end` (label after the indicator): steps start at their content width and every
|
|
24
|
+
// step but the last grows; that growth goes to its in-flow separator. With `labelFit: 'words'`
|
|
25
|
+
// (web, while the row fits) steps keep their min-content width so labels wrap between words;
|
|
26
|
+
// with `'shrink'` RN Web's `min-width: 0` lets them shrink further so the row never overflows.
|
|
27
|
+
// - `horizontal-bottom` (label centered below): equal columns; the separator is absolute, so it
|
|
28
|
+
// never affects column layout.
|
|
29
|
+
export const stepperVariants = cva([], {
|
|
30
|
+
variants: {
|
|
31
|
+
layout: {
|
|
32
|
+
vertical: 'flex-col',
|
|
33
|
+
'horizontal-end': 'w-full flex-row items-start',
|
|
34
|
+
'horizontal-bottom': 'w-full flex-row items-start',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
layout: 'vertical',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const stepperStepVariants = cva([], {
|
|
43
|
+
variants: {
|
|
44
|
+
layout: {
|
|
45
|
+
vertical: 'flex-row',
|
|
46
|
+
'horizontal-end': 'min-w-0 flex-row items-start',
|
|
47
|
+
'horizontal-bottom': 'relative min-w-0 flex-1 basis-0 items-center',
|
|
48
|
+
},
|
|
49
|
+
isLast: {
|
|
50
|
+
true: '',
|
|
51
|
+
false: '',
|
|
52
|
+
},
|
|
53
|
+
labelFit: {
|
|
54
|
+
words: '',
|
|
55
|
+
shrink: '',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
compoundVariants: [
|
|
59
|
+
{ layout: 'horizontal-end', isLast: false, className: 'grow shrink basis-auto pe-2' },
|
|
60
|
+
{ layout: 'horizontal-end', isLast: true, className: 'shrink' },
|
|
61
|
+
{ layout: 'horizontal-end', labelFit: 'words', className: 'min-w-auto' },
|
|
62
|
+
],
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
layout: 'vertical',
|
|
65
|
+
isLast: false,
|
|
66
|
+
labelFit: 'shrink',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Unexported layout wrappers inside `Stepper.Step` (no `data-slot`).
|
|
71
|
+
export const stepperStepMainVariants = cva(['min-w-0'], {
|
|
72
|
+
variants: {
|
|
73
|
+
layout: {
|
|
74
|
+
vertical: 'flex-1',
|
|
75
|
+
'horizontal-end': 'shrink',
|
|
76
|
+
'horizontal-bottom': 'items-center self-stretch px-2',
|
|
77
|
+
},
|
|
78
|
+
labelFit: {
|
|
79
|
+
words: '',
|
|
80
|
+
shrink: '',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
compoundVariants: [{ layout: 'horizontal-end', labelFit: 'words', className: 'min-w-auto' }],
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
layout: 'vertical',
|
|
86
|
+
labelFit: 'shrink',
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Each layout pads the hover and press fill and cancels it with an equal negative margin, so a
|
|
91
|
+
// step keeps its geometry when it becomes clickable. The 24px disc sits 5px inside its 34px
|
|
92
|
+
// frame, so sides bounded by the disc get 4px and sides bounded by text get 9px; the fill then
|
|
93
|
+
// looks evenly padded. Each layout aligns the trigger to its content (`self-start`, or
|
|
94
|
+
// `self-center` under a centered label) so the fill hugs the indicator and label instead of
|
|
95
|
+
// spanning the step. Hover, press and focus-visible use the `Tabs` hover tokens and the Forge
|
|
96
|
+
// focus ring until the designer specifies clickable-step states.
|
|
97
|
+
export const stepperStepTriggerVariants = cva(
|
|
98
|
+
[
|
|
99
|
+
'rounded-md',
|
|
100
|
+
TRANSITION_COLORS,
|
|
101
|
+
Platform.select({
|
|
102
|
+
default: 'data-[active=true]:bg-surface-secondary-active',
|
|
103
|
+
web: [
|
|
104
|
+
'outline-none data-[clickable=true]:cursor-pointer',
|
|
105
|
+
'data-[hover=true]:bg-surface-secondary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
|
|
106
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
107
|
+
].join(' '),
|
|
108
|
+
}),
|
|
109
|
+
],
|
|
110
|
+
{
|
|
111
|
+
variants: {
|
|
112
|
+
layout: {
|
|
113
|
+
vertical: 'flex-row items-start self-start gap-2 -my-1 -ms-1 -me-[9px] py-1 ps-1 pe-[9px]',
|
|
114
|
+
'horizontal-end':
|
|
115
|
+
'flex-row items-start self-start gap-2 -my-1 -ms-1 -me-[9px] py-1 ps-1 pe-[9px]',
|
|
116
|
+
'horizontal-bottom':
|
|
117
|
+
'min-w-0 items-center self-center gap-1 -mx-[9px] -mt-1 -mb-[9px] px-[9px] pt-1 pb-[9px]',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
defaultVariants: {
|
|
121
|
+
layout: 'vertical',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
export const stepperStepLabelVariants = cva(['min-w-0'], {
|
|
127
|
+
variants: {
|
|
128
|
+
layout: {
|
|
129
|
+
vertical: 'shrink py-[7px]',
|
|
130
|
+
'horizontal-end': 'shrink py-[7px]',
|
|
131
|
+
'horizontal-bottom': 'self-stretch',
|
|
132
|
+
},
|
|
133
|
+
labelFit: {
|
|
134
|
+
words: '',
|
|
135
|
+
shrink: '',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
compoundVariants: [{ layout: 'horizontal-end', labelFit: 'words', className: 'min-w-auto' }],
|
|
139
|
+
defaultVariants: {
|
|
140
|
+
layout: 'vertical',
|
|
141
|
+
labelFit: 'shrink',
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export const stepperStepBodyVariants = cva([], {
|
|
146
|
+
variants: {
|
|
147
|
+
layout: {
|
|
148
|
+
vertical: 'ps-[42px]',
|
|
149
|
+
'horizontal-end': 'ps-[42px]',
|
|
150
|
+
'horizontal-bottom': 'self-stretch',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
defaultVariants: {
|
|
154
|
+
layout: 'vertical',
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Indicator, disc, numeral and check each emit their own `data-current` because native
|
|
159
|
+
// Uniwind cannot style a child from its parent's data attributes.
|
|
160
|
+
export const stepperIndicatorVariants = cva([
|
|
161
|
+
'relative size-[34px] shrink-0 items-center justify-center',
|
|
162
|
+
]);
|
|
163
|
+
|
|
164
|
+
export const stepperIndicatorRingVariants = cva(['pointer-events-none absolute inset-0']);
|
|
165
|
+
|
|
166
|
+
export const stepperIndicatorDiscVariants = cva([
|
|
167
|
+
'size-6 items-center justify-center rounded-full',
|
|
168
|
+
'bg-surface-neutral-strong data-[current=true]:bg-surface-brand-strong',
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
export const stepperIndicatorNumeralVariants = cva([
|
|
172
|
+
'body-sm font-medium',
|
|
173
|
+
'text-content-neutral-on-strong data-[current=true]:text-content-brand-on-strong',
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
export const stepperIndicatorCheckVariants = cva([
|
|
177
|
+
'size-7 text-content-neutral data-[current=true]:text-content-brand',
|
|
178
|
+
]);
|
|
179
|
+
|
|
180
|
+
// Native text alignment does not inherit from a parent `View`, so centered labels set it on
|
|
181
|
+
// each text part.
|
|
182
|
+
export const stepperTitleVariants = cva(
|
|
183
|
+
[
|
|
184
|
+
'body-md text-content-secondary',
|
|
185
|
+
'data-[current=true]:font-medium data-[current=true]:text-content-primary',
|
|
186
|
+
],
|
|
187
|
+
{
|
|
188
|
+
variants: {
|
|
189
|
+
isCentered: {
|
|
190
|
+
true: 'text-center',
|
|
191
|
+
false: '',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
defaultVariants: {
|
|
195
|
+
isCentered: false,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
export const stepperDescriptionVariants = cva(['body-sm text-content-secondary'], {
|
|
201
|
+
variants: {
|
|
202
|
+
isCentered: {
|
|
203
|
+
true: 'text-center',
|
|
204
|
+
false: '',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
defaultVariants: {
|
|
208
|
+
isCentered: false,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export const stepperContentVariants = cva(['gap-2 py-2']);
|
|
213
|
+
|
|
214
|
+
// Vertical: rendered before the step's main column with zero net width, centered under the
|
|
215
|
+
// 34px frame; `self-stretch` follows the title and content.
|
|
216
|
+
// `horizontal-end`: in flow after the label, centered on the frame's height; it takes the
|
|
217
|
+
// step's growth, and the step's `pe-2` leaves 8px before the next indicator.
|
|
218
|
+
// `horizontal-bottom`: absolute from this column's center to the next one's (columns are equal
|
|
219
|
+
// and have no gap), inset 25px at each end: half the 34px frame plus 8px.
|
|
220
|
+
// `z-10` keeps the line above a clickable trigger's hover and press fill.
|
|
221
|
+
export const stepperSeparatorVariants = cva(['z-10 bg-stroke-secondary'], {
|
|
222
|
+
variants: {
|
|
223
|
+
layout: {
|
|
224
|
+
vertical: 'relative mt-[34px] min-h-6 w-px self-stretch ms-[16.5px] -me-[17.5px]',
|
|
225
|
+
'horizontal-end': 'relative mt-[16.5px] h-px min-w-6 flex-1 ms-2',
|
|
226
|
+
'horizontal-bottom': 'absolute top-[16.5px] start-[50%] end-[-50%] h-px ms-[25px] me-[25px]',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
defaultVariants: {
|
|
230
|
+
layout: 'vertical',
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
export type StepperVariantProps = VariantProps<typeof stepperVariants>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RefCallback } from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How `horizontal-end` labels give way when the row runs out of room. `'words'` keeps each
|
|
6
|
+
* step at least as wide as its longest word, so labels wrap only between words; `'shrink'` lets
|
|
7
|
+
* steps shrink below that so the row never overflows.
|
|
8
|
+
*/
|
|
9
|
+
export type StepperLabelFit = 'words' | 'shrink';
|
|
10
|
+
|
|
11
|
+
export interface StepperLabelFitResult {
|
|
12
|
+
readonly fit: StepperLabelFit;
|
|
13
|
+
readonly measureRef: RefCallback<View> | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const NATIVE_RESULT: StepperLabelFitResult = { fit: 'shrink', measureRef: undefined };
|
|
17
|
+
|
|
18
|
+
/** Native layout has no min-content sizing, so steps always shrink to fit. */
|
|
19
|
+
export function useStepperLabelFit(_enabled: boolean, _count: number): StepperLabelFitResult {
|
|
20
|
+
return NATIVE_RESULT;
|
|
21
|
+
}
|