@cdx-ui/components 0.0.1-beta.5 → 0.0.1-beta.50
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 +28 -18
- package/lib/commonjs/components/AlertDialog/index.js +1 -1
- package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
- package/lib/commonjs/components/Avatar/index.js +1 -1
- package/lib/commonjs/components/Avatar/styles.js +36 -29
- package/lib/commonjs/components/Avatar/styles.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +12 -1
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +26 -26
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/CLAUDE.md +90 -0
- package/lib/commonjs/components/Card/index.js +22 -4
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/Card/styles.js +27 -4
- package/lib/commonjs/components/Card/styles.js.map +1 -1
- package/lib/commonjs/components/Checkbox/index.js +5 -29
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/Checkbox/styles.js +39 -47
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js +78 -9
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/Chip/styles.js +207 -21
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/Field/index.js +8 -2
- package/lib/commonjs/components/Field/index.js.map +1 -1
- package/lib/commonjs/components/Field/styles.js +4 -4
- package/lib/commonjs/components/Field/styles.js.map +1 -1
- package/lib/commonjs/components/Heading/styles.js +1 -1
- package/lib/commonjs/components/Heading/styles.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js +3 -4
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/IconButton/index.js +6 -1
- package/lib/commonjs/components/IconButton/index.js.map +1 -1
- package/lib/commonjs/components/IconButton/styles.js +135 -10
- package/lib/commonjs/components/IconButton/styles.js.map +1 -1
- package/lib/commonjs/components/Input/styles.js +7 -6
- package/lib/commonjs/components/Input/styles.js.map +1 -1
- package/lib/commonjs/components/Link/index.js +22 -3
- package/lib/commonjs/components/Link/index.js.map +1 -1
- package/lib/commonjs/components/Link/styles.js +56 -6
- package/lib/commonjs/components/Link/styles.js.map +1 -1
- package/lib/commonjs/components/ListItem/styles.js +9 -9
- package/lib/commonjs/components/ListItem/styles.js.map +1 -1
- package/lib/commonjs/components/ProgressSegmented/index.js +24 -10
- package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
- package/lib/commonjs/components/Radio/index.js +167 -0
- package/lib/commonjs/components/Radio/index.js.map +1 -0
- package/lib/commonjs/components/Radio/styles.js +31 -0
- package/lib/commonjs/components/Radio/styles.js.map +1 -0
- package/lib/commonjs/components/ScopedTheme/index.js +24 -0
- package/lib/commonjs/components/ScopedTheme/index.js.map +1 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js +4 -0
- package/lib/commonjs/components/Select/SelectTriggerHost.web.js.map +1 -1
- package/lib/commonjs/components/Select/index.js +9 -3
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/Select/styles.js +17 -20
- package/lib/commonjs/components/Select/styles.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +2 -2
- package/lib/commonjs/components/Text/styles.js.map +1 -1
- package/lib/commonjs/components/Tile/index.js +251 -0
- package/lib/commonjs/components/Tile/index.js.map +1 -0
- package/lib/commonjs/components/Tile/styles.js +52 -0
- package/lib/commonjs/components/Tile/styles.js.map +1 -0
- package/lib/commonjs/components/index.js +36 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/figma/Avatar.figma.js +54 -0
- package/lib/commonjs/figma/Avatar.figma.js.map +1 -0
- package/lib/commonjs/figma/Button.figma.js +28 -15
- package/lib/commonjs/figma/Button.figma.js.map +1 -1
- package/lib/commonjs/figma/CLAUDE.md +30 -0
- package/lib/commonjs/figma/Card.Header.figma.js +28 -0
- package/lib/commonjs/figma/Card.Header.figma.js.map +1 -0
- package/lib/commonjs/figma/Card.figma.js +42 -0
- package/lib/commonjs/figma/Card.figma.js.map +1 -0
- package/lib/commonjs/figma/Checkbox.figma.js +55 -0
- package/lib/commonjs/figma/Checkbox.figma.js.map +1 -0
- package/lib/commonjs/figma/Chip.figma.js +68 -0
- package/lib/commonjs/figma/Chip.figma.js.map +1 -0
- package/lib/commonjs/figma/Field.Input.figma.js +57 -0
- package/lib/commonjs/figma/Field.Input.figma.js.map +1 -0
- package/lib/commonjs/figma/Field.Select.figma.js +57 -0
- package/lib/commonjs/figma/Field.Select.figma.js.map +1 -0
- package/lib/commonjs/figma/Heading.figma.js +30 -0
- package/lib/commonjs/figma/Heading.figma.js.map +1 -0
- package/lib/commonjs/figma/Icon.figma.js +20 -0
- package/lib/commonjs/figma/Icon.figma.js.map +1 -0
- package/lib/commonjs/figma/IconButton.figma.js +47 -0
- package/lib/commonjs/figma/IconButton.figma.js.map +1 -0
- package/lib/commonjs/figma/Input.figma.js +52 -0
- package/lib/commonjs/figma/Input.figma.js.map +1 -0
- package/lib/commonjs/figma/Link.figma.js +30 -0
- package/lib/commonjs/figma/Link.figma.js.map +1 -0
- package/lib/commonjs/figma/ProgressSegmented.figma.js +39 -0
- package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -0
- package/lib/commonjs/figma/Radio.figma.js +40 -0
- package/lib/commonjs/figma/Radio.figma.js.map +1 -0
- package/lib/commonjs/figma/Select.figma.js +53 -0
- package/lib/commonjs/figma/Select.figma.js.map +1 -0
- package/lib/commonjs/figma/Text.figma.js +29 -0
- package/lib/commonjs/figma/Text.figma.js.map +1 -0
- package/lib/commonjs/figma/icons.figma.batch.js +27 -0
- package/lib/commonjs/figma/icons.figma.batch.js.map +1 -0
- package/lib/commonjs/figma/icons.figma.batch.json +17705 -0
- package/lib/commonjs/metro/withCdxMetroConfig.js +7 -18
- package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -1
- package/lib/commonjs/metro/withForgeMetroConfig.js +24 -0
- package/lib/commonjs/metro/withForgeMetroConfig.js.map +1 -0
- package/lib/commonjs/styles/primitives.js +43 -6
- package/lib/commonjs/styles/primitives.js.map +1 -1
- package/lib/module/components/AlertDialog/index.js +1 -1
- package/lib/module/components/AlertDialog/index.js.map +1 -1
- package/lib/module/components/Avatar/index.js +1 -1
- package/lib/module/components/Avatar/styles.js +36 -29
- package/lib/module/components/Avatar/styles.js.map +1 -1
- package/lib/module/components/Button/index.js +13 -2
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +26 -26
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/CLAUDE.md +90 -0
- package/lib/module/components/Card/index.js +23 -4
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Card/styles.js +27 -4
- package/lib/module/components/Card/styles.js.map +1 -1
- package/lib/module/components/Checkbox/index.js +6 -30
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/Checkbox/styles.js +40 -48
- package/lib/module/components/Checkbox/styles.js.map +1 -1
- package/lib/module/components/Chip/index.js +82 -13
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/Chip/styles.js +206 -20
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/Field/index.js +9 -3
- package/lib/module/components/Field/index.js.map +1 -1
- package/lib/module/components/Field/styles.js +4 -4
- package/lib/module/components/Field/styles.js.map +1 -1
- package/lib/module/components/Heading/styles.js +1 -1
- package/lib/module/components/Heading/styles.js.map +1 -1
- package/lib/module/components/Icon/index.js +3 -4
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/IconButton/index.js +6 -1
- package/lib/module/components/IconButton/index.js.map +1 -1
- package/lib/module/components/IconButton/styles.js +135 -10
- package/lib/module/components/IconButton/styles.js.map +1 -1
- package/lib/module/components/Input/styles.js +7 -6
- package/lib/module/components/Input/styles.js.map +1 -1
- package/lib/module/components/Link/index.js +25 -6
- package/lib/module/components/Link/index.js.map +1 -1
- package/lib/module/components/Link/styles.js +55 -6
- package/lib/module/components/Link/styles.js.map +1 -1
- package/lib/module/components/ListItem/styles.js +10 -10
- package/lib/module/components/ListItem/styles.js.map +1 -1
- package/lib/module/components/ProgressSegmented/index.js +25 -11
- package/lib/module/components/ProgressSegmented/index.js.map +1 -1
- package/lib/module/components/Radio/index.js +164 -0
- package/lib/module/components/Radio/index.js.map +1 -0
- package/lib/module/components/Radio/styles.js +27 -0
- package/lib/module/components/Radio/styles.js.map +1 -0
- package/lib/module/components/ScopedTheme/index.js +19 -0
- package/lib/module/components/ScopedTheme/index.js.map +1 -0
- package/lib/module/components/Select/SelectTriggerHost.web.js +4 -0
- package/lib/module/components/Select/SelectTriggerHost.web.js.map +1 -1
- package/lib/module/components/Select/index.js +10 -4
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/Select/styles.js +18 -21
- package/lib/module/components/Select/styles.js.map +1 -1
- package/lib/module/components/Text/styles.js +2 -2
- package/lib/module/components/Text/styles.js.map +1 -1
- package/lib/module/components/Tile/index.js +243 -0
- package/lib/module/components/Tile/index.js.map +1 -0
- package/lib/module/components/Tile/styles.js +48 -0
- package/lib/module/components/Tile/styles.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/figma/Avatar.figma.js +48 -0
- package/lib/module/figma/Avatar.figma.js.map +1 -0
- package/lib/module/figma/Button.figma.js +28 -15
- package/lib/module/figma/Button.figma.js.map +1 -1
- package/lib/module/figma/CLAUDE.md +30 -0
- package/lib/module/figma/Card.Header.figma.js +22 -0
- package/lib/module/figma/Card.Header.figma.js.map +1 -0
- package/lib/module/figma/Card.figma.js +36 -0
- package/lib/module/figma/Card.figma.js.map +1 -0
- package/lib/module/figma/Checkbox.figma.js +49 -0
- package/lib/module/figma/Checkbox.figma.js.map +1 -0
- package/lib/module/figma/Chip.figma.js +62 -0
- package/lib/module/figma/Chip.figma.js.map +1 -0
- package/lib/module/figma/Field.Input.figma.js +51 -0
- package/lib/module/figma/Field.Input.figma.js.map +1 -0
- package/lib/module/figma/Field.Select.figma.js +51 -0
- package/lib/module/figma/Field.Select.figma.js.map +1 -0
- package/lib/module/figma/Heading.figma.js +24 -0
- package/lib/module/figma/Heading.figma.js.map +1 -0
- package/lib/module/figma/Icon.figma.js +14 -0
- package/lib/module/figma/Icon.figma.js.map +1 -0
- package/lib/module/figma/IconButton.figma.js +41 -0
- package/lib/module/figma/IconButton.figma.js.map +1 -0
- package/lib/module/figma/Input.figma.js +46 -0
- package/lib/module/figma/Input.figma.js.map +1 -0
- package/lib/module/figma/Link.figma.js +24 -0
- package/lib/module/figma/Link.figma.js.map +1 -0
- package/lib/module/figma/ProgressSegmented.figma.js +33 -0
- package/lib/module/figma/ProgressSegmented.figma.js.map +1 -0
- package/lib/module/figma/Radio.figma.js +34 -0
- package/lib/module/figma/Radio.figma.js.map +1 -0
- package/lib/module/figma/Select.figma.js +47 -0
- package/lib/module/figma/Select.figma.js.map +1 -0
- package/lib/module/figma/Text.figma.js +23 -0
- package/lib/module/figma/Text.figma.js.map +1 -0
- package/lib/module/figma/icons.figma.batch.js +22 -0
- package/lib/module/figma/icons.figma.batch.js.map +1 -0
- package/lib/module/figma/icons.figma.batch.json +17705 -0
- package/lib/module/metro/withCdxMetroConfig.js +3 -17
- package/lib/module/metro/withCdxMetroConfig.js.map +1 -1
- package/lib/module/metro/withForgeMetroConfig.js +20 -0
- package/lib/module/metro/withForgeMetroConfig.js.map +1 -0
- package/lib/module/styles/primitives.js +43 -6
- package/lib/module/styles/primitives.js.map +1 -1
- package/lib/typescript/components/Avatar/styles.d.ts +4 -4
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -1
- package/lib/typescript/components/Button/index.d.ts +13 -1
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +3 -3
- package/lib/typescript/components/Card/index.d.ts +4 -3
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Card/styles.d.ts +13 -3
- package/lib/typescript/components/Card/styles.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/index.d.ts +1 -2
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/styles.d.ts +4 -14
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +19 -6
- package/lib/typescript/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/styles.d.ts +13 -4
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
- package/lib/typescript/components/Field/FieldLabel.web.d.ts +2 -2
- package/lib/typescript/components/Field/FieldLabel.web.d.ts.map +1 -1
- package/lib/typescript/components/Field/index.d.ts.map +1 -1
- package/lib/typescript/components/Field/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/styles.d.ts +1 -1
- package/lib/typescript/components/Icon/index.d.ts +5 -5
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/IconButton/index.d.ts +3 -3
- package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
- package/lib/typescript/components/IconButton/styles.d.ts +6 -2
- package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
- package/lib/typescript/components/Input/styles.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +2 -2
- package/lib/typescript/components/Link/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/styles.d.ts +9 -2
- package/lib/typescript/components/Link/styles.d.ts.map +1 -1
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -1
- package/lib/typescript/components/ProgressSegmented/index.d.ts +14 -3
- package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
- package/lib/typescript/components/Radio/index.d.ts +40 -0
- package/lib/typescript/components/Radio/index.d.ts.map +1 -0
- package/lib/typescript/components/Radio/styles.d.ts +8 -0
- package/lib/typescript/components/Radio/styles.d.ts.map +1 -0
- package/lib/typescript/components/ScopedTheme/index.d.ts +16 -0
- package/lib/typescript/components/ScopedTheme/index.d.ts.map +1 -0
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts +3 -0
- package/lib/typescript/components/Select/SelectTriggerHost.web.d.ts.map +1 -1
- package/lib/typescript/components/Select/index.d.ts +1 -1
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/styles.d.ts.map +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +2 -2
- package/lib/typescript/components/Text/styles.d.ts +1 -1
- package/lib/typescript/components/Tile/index.d.ts +70 -0
- package/lib/typescript/components/Tile/index.d.ts.map +1 -0
- package/lib/typescript/components/Tile/styles.d.ts +18 -0
- package/lib/typescript/components/Tile/styles.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/figma/Avatar.figma.d.ts +8 -0
- package/lib/typescript/figma/Avatar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Button.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Card.Header.figma.d.ts +8 -0
- package/lib/typescript/figma/Card.Header.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Card.figma.d.ts +8 -0
- package/lib/typescript/figma/Card.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Checkbox.figma.d.ts +8 -0
- package/lib/typescript/figma/Checkbox.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Chip.figma.d.ts +8 -0
- package/lib/typescript/figma/Chip.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Field.Input.figma.d.ts +8 -0
- package/lib/typescript/figma/Field.Input.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Field.Select.figma.d.ts +8 -0
- package/lib/typescript/figma/Field.Select.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Heading.figma.d.ts +8 -0
- package/lib/typescript/figma/Heading.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Icon.figma.d.ts +8 -0
- package/lib/typescript/figma/Icon.figma.d.ts.map +1 -0
- package/lib/typescript/figma/IconButton.figma.d.ts +8 -0
- package/lib/typescript/figma/IconButton.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Input.figma.d.ts +8 -0
- package/lib/typescript/figma/Input.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Link.figma.d.ts +8 -0
- package/lib/typescript/figma/Link.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ProgressSegmented.figma.d.ts +8 -0
- package/lib/typescript/figma/ProgressSegmented.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Radio.figma.d.ts +8 -0
- package/lib/typescript/figma/Radio.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Select.figma.d.ts +8 -0
- package/lib/typescript/figma/Select.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Text.figma.d.ts +8 -0
- package/lib/typescript/figma/Text.figma.d.ts.map +1 -0
- package/lib/typescript/figma/icons.figma.batch.d.ts +14 -0
- package/lib/typescript/figma/icons.figma.batch.d.ts.map +1 -0
- package/lib/typescript/metro/withCdxMetroConfig.d.ts +4 -18
- package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -1
- package/lib/typescript/metro/withForgeMetroConfig.d.ts +19 -0
- package/lib/typescript/metro/withForgeMetroConfig.d.ts.map +1 -0
- package/lib/typescript/styles/primitives.d.ts +38 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/AlertDialog/index.tsx +1 -1
- package/src/components/Avatar/index.tsx +1 -1
- package/src/components/Avatar/styles.ts +49 -34
- package/src/components/Button/index.tsx +37 -3
- package/src/components/Button/styles.ts +27 -27
- package/src/components/CLAUDE.md +90 -0
- package/src/components/Card/index.tsx +41 -16
- package/src/components/Card/styles.ts +42 -15
- package/src/components/Checkbox/index.tsx +8 -19
- package/src/components/Checkbox/styles.ts +82 -86
- package/src/components/Chip/index.tsx +104 -27
- package/src/components/Chip/styles.ts +232 -18
- package/src/components/Field/FieldLabel.web.tsx +1 -1
- package/src/components/Field/index.tsx +10 -3
- package/src/components/Field/styles.ts +5 -4
- package/src/components/Heading/styles.ts +1 -1
- package/src/components/Icon/index.tsx +6 -7
- package/src/components/IconButton/index.tsx +7 -6
- package/src/components/IconButton/styles.ts +136 -10
- package/src/components/Input/styles.ts +15 -9
- package/src/components/Link/index.tsx +22 -9
- package/src/components/Link/styles.ts +49 -9
- package/src/components/ListItem/styles.ts +12 -19
- package/src/components/ProgressSegmented/index.tsx +50 -14
- package/src/components/Radio/index.tsx +192 -0
- package/src/components/Radio/styles.ts +59 -0
- package/src/components/ScopedTheme/index.tsx +17 -0
- package/src/components/Select/SelectTriggerHost.web.tsx +8 -1
- package/src/components/Select/index.tsx +9 -4
- package/src/components/Select/styles.ts +49 -51
- package/src/components/Text/styles.ts +2 -2
- package/src/components/Tile/index.tsx +296 -0
- package/src/components/Tile/styles.ts +82 -0
- package/src/components/index.ts +3 -0
- package/src/metro/withCdxMetroConfig.ts +4 -29
- package/src/metro/withForgeMetroConfig.ts +29 -0
- package/src/styles/primitives.ts +43 -6
|
@@ -8,35 +8,133 @@ export const iconButtonRootVariants = cva(
|
|
|
8
8
|
'rounded-[var(--border-radius-round)]',
|
|
9
9
|
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
10
10
|
TRANSITION_COLORS,
|
|
11
|
-
'data-[disabled=true]:opacity-[--opacity-disabled]',
|
|
11
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
12
12
|
DISABLED_CURSOR,
|
|
13
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[--color-stroke-ring] web:data-[focus-visible=true]:ring-offset-2',
|
|
13
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[var(--color-stroke-ring)] web:data-[focus-visible=true]:ring-offset-2',
|
|
14
14
|
],
|
|
15
15
|
{
|
|
16
16
|
variants: {
|
|
17
17
|
variant: {
|
|
18
|
-
solid: [
|
|
18
|
+
solid: [],
|
|
19
|
+
tint: [],
|
|
20
|
+
ghost: ['bg-transparent'],
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
neutral: [],
|
|
24
|
+
action: [],
|
|
25
|
+
danger: [],
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
default: 'h-11 w-11 min-w-11 shrink-0 p-2.5',
|
|
29
|
+
small: 'h-8 w-8 min-w-8 shrink-0 p-1.5',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
compoundVariants: [
|
|
33
|
+
// ── solid × color ───────────────────────────────────────────────────
|
|
34
|
+
{
|
|
35
|
+
variant: 'solid',
|
|
36
|
+
color: 'neutral',
|
|
37
|
+
className: [
|
|
19
38
|
'bg-surface-primary border border-stroke-secondary',
|
|
20
39
|
Platform.select({
|
|
21
40
|
default: 'data-[active=true]:bg-surface-primary-active',
|
|
22
41
|
web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
|
|
23
42
|
}),
|
|
24
43
|
],
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
variant: 'solid',
|
|
47
|
+
color: 'action',
|
|
48
|
+
className: [
|
|
49
|
+
'bg-surface-action-strong',
|
|
50
|
+
Platform.select({
|
|
51
|
+
default: 'data-[active=true]:bg-surface-action-strong-active',
|
|
52
|
+
web: 'data-[hover=true]:bg-surface-action-strong-hover data-[active=true]:data-[hover=true]:bg-surface-action-strong-active',
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
variant: 'solid',
|
|
58
|
+
color: 'danger',
|
|
59
|
+
className: [
|
|
60
|
+
'bg-surface-danger-strong',
|
|
61
|
+
Platform.select({
|
|
62
|
+
default: 'data-[active=true]:bg-surface-danger-strong-active',
|
|
63
|
+
web: 'data-[hover=true]:bg-surface-danger-strong-hover data-[active=true]:data-[hover=true]:bg-surface-danger-strong-active',
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// ── tint × color ─────────────────────────────────────────────────
|
|
69
|
+
{
|
|
70
|
+
variant: 'tint',
|
|
71
|
+
color: 'neutral',
|
|
72
|
+
className: [
|
|
73
|
+
'bg-surface-neutral-tint',
|
|
74
|
+
Platform.select({
|
|
75
|
+
default: 'data-[active=true]:bg-surface-neutral-tint-active',
|
|
76
|
+
web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
variant: 'tint',
|
|
82
|
+
color: 'action',
|
|
83
|
+
className: [
|
|
84
|
+
'bg-surface-action-tint',
|
|
85
|
+
Platform.select({
|
|
86
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
87
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
variant: 'tint',
|
|
93
|
+
color: 'danger',
|
|
94
|
+
className: [
|
|
95
|
+
'bg-surface-danger-tint',
|
|
96
|
+
Platform.select({
|
|
97
|
+
default: 'data-[active=true]:bg-surface-danger-tint-active',
|
|
98
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
|
|
99
|
+
}),
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// ── ghost × color ──────────────────────────────────────────────────
|
|
104
|
+
{
|
|
105
|
+
variant: 'ghost',
|
|
106
|
+
color: 'neutral',
|
|
107
|
+
className: [
|
|
27
108
|
Platform.select({
|
|
28
109
|
default: 'data-[active=true]:bg-surface-primary-active',
|
|
29
110
|
web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
|
|
30
111
|
}),
|
|
31
112
|
],
|
|
32
113
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
114
|
+
{
|
|
115
|
+
variant: 'ghost',
|
|
116
|
+
color: 'action',
|
|
117
|
+
className: [
|
|
118
|
+
Platform.select({
|
|
119
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
120
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
|
|
121
|
+
}),
|
|
122
|
+
],
|
|
36
123
|
},
|
|
37
|
-
|
|
124
|
+
{
|
|
125
|
+
variant: 'ghost',
|
|
126
|
+
color: 'danger',
|
|
127
|
+
className: [
|
|
128
|
+
Platform.select({
|
|
129
|
+
default: 'data-[active=true]:bg-surface-danger-tint-active',
|
|
130
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
|
|
131
|
+
}),
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
],
|
|
38
135
|
defaultVariants: {
|
|
39
136
|
variant: 'solid',
|
|
137
|
+
color: 'neutral',
|
|
40
138
|
size: 'default',
|
|
41
139
|
},
|
|
42
140
|
},
|
|
@@ -54,6 +152,34 @@ export const iconButtonGlyphVariants = cva([], {
|
|
|
54
152
|
},
|
|
55
153
|
});
|
|
56
154
|
|
|
57
|
-
export const iconButtonIconColorVariants = cva([
|
|
155
|
+
export const iconButtonIconColorVariants = cva([], {
|
|
156
|
+
variants: {
|
|
157
|
+
variant: {
|
|
158
|
+
solid: [],
|
|
159
|
+
tint: [],
|
|
160
|
+
ghost: [],
|
|
161
|
+
},
|
|
162
|
+
color: {
|
|
163
|
+
neutral: [],
|
|
164
|
+
action: [],
|
|
165
|
+
danger: [],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
compoundVariants: [
|
|
169
|
+
{ variant: 'solid', color: 'neutral', className: 'text-content-primary' },
|
|
170
|
+
{ variant: 'solid', color: 'action', className: 'text-content-action-on-strong' },
|
|
171
|
+
{ variant: 'solid', color: 'danger', className: 'text-content-danger-on-strong' },
|
|
172
|
+
{ variant: 'tint', color: 'neutral', className: 'text-content-primary' },
|
|
173
|
+
{ variant: 'tint', color: 'action', className: 'text-content-action-on-subtle' },
|
|
174
|
+
{ variant: 'tint', color: 'danger', className: 'text-content-danger-on-subtle' },
|
|
175
|
+
{ variant: 'ghost', color: 'neutral', className: 'text-content-primary' },
|
|
176
|
+
{ variant: 'ghost', color: 'action', className: 'text-content-action' },
|
|
177
|
+
{ variant: 'ghost', color: 'danger', className: 'text-content-danger' },
|
|
178
|
+
],
|
|
179
|
+
defaultVariants: {
|
|
180
|
+
variant: 'solid',
|
|
181
|
+
color: 'neutral',
|
|
182
|
+
},
|
|
183
|
+
});
|
|
58
184
|
|
|
59
185
|
export type IconButtonVariantProps = VariantProps<typeof iconButtonRootVariants>;
|
|
@@ -3,13 +3,14 @@ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
|
3
3
|
|
|
4
4
|
export const inputRootVariants = cva(
|
|
5
5
|
[
|
|
6
|
-
'w-full flex-row items-
|
|
6
|
+
'w-full flex-row items-center overflow-hidden',
|
|
7
7
|
'bg-surface-primary',
|
|
8
|
-
'border-solid border-
|
|
8
|
+
'border-solid border-stroke-primary',
|
|
9
|
+
'web:border-default native:border-[length:var(--border-width-default)]',
|
|
9
10
|
'rounded-[var(--border-radius-default)]',
|
|
10
11
|
TRANSITION_COLORS,
|
|
11
12
|
'data-[disabled=true]:bg-surface-secondary',
|
|
12
|
-
'data-[disabled=true]:opacity-[--opacity-disabled]',
|
|
13
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
13
14
|
DISABLED_CURSOR,
|
|
14
15
|
'data-[readonly=true]:cursor-default',
|
|
15
16
|
'data-[readonly=true]:bg-surface-secondary',
|
|
@@ -24,11 +25,16 @@ export const inputRootVariants = cva(
|
|
|
24
25
|
outline: [],
|
|
25
26
|
},
|
|
26
27
|
size: {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
default: [
|
|
29
|
+
'h-11 min-h-11 px-4 py-3 gap-4',
|
|
30
|
+
// Subtract one hairline from padding when focused so the wider focus border doesn’t shift layout.
|
|
31
|
+
'data-[focus=true]:px-[calc(var(--spacing-4)-var(--spacing-px))]',
|
|
32
|
+
'data-[focus=true]:py-[calc(var(--spacing-3)-var(--spacing-px))]',
|
|
33
|
+
],
|
|
29
34
|
small: [
|
|
30
|
-
'h-8 px-3 py-
|
|
31
|
-
'data-[focus=true]:px-[
|
|
35
|
+
'h-8 min-h-8 px-3 py-2 gap-1.5',
|
|
36
|
+
'data-[focus=true]:px-[calc(var(--spacing-3)-var(--spacing-px))]',
|
|
37
|
+
'data-[focus=true]:py-[calc(var(--spacing-2)-var(--spacing-px))]',
|
|
32
38
|
],
|
|
33
39
|
},
|
|
34
40
|
},
|
|
@@ -42,7 +48,7 @@ export const inputRootVariants = cva(
|
|
|
42
48
|
export const inputFieldVariants = cva(
|
|
43
49
|
[
|
|
44
50
|
'flex-1 justify-center bg-transparent p-0',
|
|
45
|
-
'
|
|
51
|
+
'text-content-primary',
|
|
46
52
|
'placeholder:text-content-tertiary',
|
|
47
53
|
'web:outline-none',
|
|
48
54
|
'tracking-normal',
|
|
@@ -60,7 +66,7 @@ export const inputFieldVariants = cva(
|
|
|
60
66
|
},
|
|
61
67
|
);
|
|
62
68
|
|
|
63
|
-
export const inputSlotVariants = cva(['items-center justify-center self-center']);
|
|
69
|
+
export const inputSlotVariants = cva(['items-center justify-center self-center shrink-0']);
|
|
64
70
|
|
|
65
71
|
export const inputIconVariants = cva(['text-content-tertiary'], {
|
|
66
72
|
variants: {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
-
import { Pressable, Text
|
|
3
|
-
import { createLink, type ILinkProps } from '@cdx-ui/primitives';
|
|
2
|
+
import { Platform, Pressable, Text, View, type TextProps } from 'react-native';
|
|
3
|
+
import { createLink, useLinkInteractionContext, type ILinkProps } from '@cdx-ui/primitives';
|
|
4
4
|
import { cn } from '@cdx-ui/utils';
|
|
5
5
|
import { Icon, type IconProps } from '../Icon';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
linkIconVariants,
|
|
8
|
+
linkLabelVariants,
|
|
9
|
+
linkNativeUnderlineVariants,
|
|
10
|
+
linkRootVariants,
|
|
11
|
+
} from './styles';
|
|
7
12
|
|
|
8
13
|
export { LinkProvider, type LinkConfig, type LinkAction } from '@cdx-ui/primitives';
|
|
9
14
|
|
|
@@ -40,15 +45,22 @@ export interface LinkLabelProps extends TextProps {
|
|
|
40
45
|
children?: ReactNode;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
const LinkLabel = forwardRef<
|
|
48
|
+
const LinkLabel = forwardRef<Text, LinkLabelProps>(
|
|
44
49
|
({ className, children, style, ...props }, ref) => {
|
|
45
|
-
const
|
|
50
|
+
const { visited } = useLinkInteractionContext();
|
|
51
|
+
const computedClassName = cn(linkLabelVariants({ visited }), className);
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
<
|
|
53
|
+
const textElement = (
|
|
54
|
+
<Text ref={ref} className={computedClassName} style={style} {...props}>
|
|
49
55
|
{children}
|
|
50
|
-
</
|
|
56
|
+
</Text>
|
|
51
57
|
);
|
|
58
|
+
|
|
59
|
+
if (Platform.OS === 'web') {
|
|
60
|
+
return textElement;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return <View className={cn(linkNativeUnderlineVariants({ visited }))}>{textElement}</View>;
|
|
52
64
|
},
|
|
53
65
|
);
|
|
54
66
|
|
|
@@ -61,7 +73,8 @@ LinkLabel.displayName = 'Link.Label';
|
|
|
61
73
|
export interface LinkIconProps extends Omit<IconProps, 'children'> {}
|
|
62
74
|
|
|
63
75
|
const LinkIcon = ({ className, style, as, ...props }: LinkIconProps) => {
|
|
64
|
-
const
|
|
76
|
+
const { visited } = useLinkInteractionContext();
|
|
77
|
+
const computedClassName = cn(linkIconVariants({ visited }), className);
|
|
65
78
|
|
|
66
79
|
return <Icon as={as} className={computedClassName} style={style} {...props} />;
|
|
67
80
|
};
|
|
@@ -1,21 +1,61 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
1
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
3
|
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
3
4
|
|
|
4
|
-
// TODO: Handle visited state
|
|
5
|
-
|
|
6
5
|
export const linkRootVariants = cva([
|
|
7
6
|
'flex-row items-center gap-1',
|
|
8
|
-
|
|
7
|
+
Platform.select({ web: 'web:inline-flex web:self-start', default: '' }),
|
|
9
8
|
TRANSITION_COLORS,
|
|
9
|
+
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
10
|
+
'web:data-[focus-visible=true]:rounded-[2px]',
|
|
10
11
|
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
12
|
+
// Web: set color on the anchor so Label/Icon can text-inherit (incl. browser :visited).
|
|
13
|
+
'web:text-content-link',
|
|
14
|
+
'web:visited:text-content-link-visited',
|
|
15
|
+
'web:hover:text-content-primary',
|
|
16
|
+
'web:visited:hover:text-content-primary',
|
|
17
|
+
'data-[visited=true]:text-content-link-visited',
|
|
18
|
+
'web:data-[hover=true]:text-content-primary',
|
|
11
19
|
]);
|
|
12
20
|
|
|
13
|
-
export const linkLabelVariants = cva(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
export const linkLabelVariants = cva(
|
|
22
|
+
[
|
|
23
|
+
'body-md',
|
|
24
|
+
Platform.select({ web: 'underline underline-offset-4', default: '' }),
|
|
25
|
+
Platform.select({ web: 'text-inherit', default: 'text-content-link' }),
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
visited: {
|
|
30
|
+
true: Platform.select({ web: '', default: 'text-content-link-visited' }),
|
|
31
|
+
false: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { visited: false },
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const linkNativeUnderlineVariants = cva(['border-b border-content-link pb-0.5'], {
|
|
39
|
+
variants: {
|
|
40
|
+
visited: {
|
|
41
|
+
true: 'border-content-link-visited',
|
|
42
|
+
false: '',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: { visited: false },
|
|
46
|
+
});
|
|
18
47
|
|
|
19
|
-
export const linkIconVariants = cva(
|
|
48
|
+
export const linkIconVariants = cva(
|
|
49
|
+
['size-4', Platform.select({ web: 'text-inherit', default: 'text-content-link' })],
|
|
50
|
+
{
|
|
51
|
+
variants: {
|
|
52
|
+
visited: {
|
|
53
|
+
true: Platform.select({ web: '', default: 'text-content-link-visited' }),
|
|
54
|
+
false: '',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: { visited: false },
|
|
58
|
+
},
|
|
59
|
+
);
|
|
20
60
|
|
|
21
61
|
export type LinkVariantProps = VariantProps<typeof linkLabelVariants>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
4
|
-
COLOR_BORDER_DEFAULT,
|
|
5
|
-
COLOR_TEXT_MUTED,
|
|
6
|
-
COLOR_TEXT_PRIMARY,
|
|
7
|
-
COLOR_TEXT_SECONDARY,
|
|
8
|
-
TRANSITION_COLORS,
|
|
9
|
-
} from '../../styles/primitives';
|
|
3
|
+
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
10
4
|
|
|
11
5
|
// ── Root (row): density, surface, separator, interactive feedback ──────────
|
|
12
6
|
|
|
@@ -19,7 +13,7 @@ export const listItemRootVariants = cva(
|
|
|
19
13
|
Platform.select({
|
|
20
14
|
web: [
|
|
21
15
|
'outline-none',
|
|
22
|
-
'web:data-[
|
|
16
|
+
'web:data-[hover=true]:bg-slate-50',
|
|
23
17
|
'web:focus-visible:data-[disabled=false]:bg-slate-50',
|
|
24
18
|
'web:focus-visible:data-[disabled=false]:ring-2 web:focus-visible:data-[disabled=false]:ring-slate-400/40 web:focus-visible:data-[disabled=false]:ring-offset-2',
|
|
25
19
|
].join(' '),
|
|
@@ -37,7 +31,7 @@ export const listItemRootVariants = cva(
|
|
|
37
31
|
negative: 'bg-red-50',
|
|
38
32
|
},
|
|
39
33
|
showSeparator: {
|
|
40
|
-
true:
|
|
34
|
+
true: 'border-b border-solid border-stroke-secondary',
|
|
41
35
|
false: 'border-b-0',
|
|
42
36
|
},
|
|
43
37
|
crossAlign: {
|
|
@@ -49,7 +43,7 @@ export const listItemRootVariants = cva(
|
|
|
49
43
|
{
|
|
50
44
|
surface: 'negative',
|
|
51
45
|
className: Platform.select({
|
|
52
|
-
web: 'web:data-[
|
|
46
|
+
web: 'web:data-[hover=true]:bg-red-100/90',
|
|
53
47
|
default: '',
|
|
54
48
|
}),
|
|
55
49
|
},
|
|
@@ -81,7 +75,7 @@ export const listItemTrailingSlotVariants = cva(['flex shrink-0 flex-row justify
|
|
|
81
75
|
|
|
82
76
|
// ── Content stack (title / description / meta) ───────────────────────────────
|
|
83
77
|
|
|
84
|
-
export const listItemContentVariants = cva(
|
|
78
|
+
export const listItemContentVariants = cva('flex min-w-0 flex-1 flex-col gap-1', {
|
|
85
79
|
variants: {
|
|
86
80
|
crossAlign: {
|
|
87
81
|
center: 'justify-center',
|
|
@@ -95,7 +89,7 @@ export const listItemContentVariants = cva(['flex min-w-0 flex-1 flex-col gap-1'
|
|
|
95
89
|
|
|
96
90
|
// ── Typography ───────────────────────────────────────────────────────────────
|
|
97
91
|
|
|
98
|
-
export const listItemTitleVariants = cva(
|
|
92
|
+
export const listItemTitleVariants = cva('text-content-primary font-medium', {
|
|
99
93
|
variants: {
|
|
100
94
|
size: {
|
|
101
95
|
default: 'text-base leading-snug',
|
|
@@ -107,7 +101,7 @@ export const listItemTitleVariants = cva([COLOR_TEXT_PRIMARY, 'font-medium'], {
|
|
|
107
101
|
},
|
|
108
102
|
});
|
|
109
103
|
|
|
110
|
-
export const listItemDescriptionVariants = cva(
|
|
104
|
+
export const listItemDescriptionVariants = cva('text-content-secondary', {
|
|
111
105
|
variants: {
|
|
112
106
|
size: {
|
|
113
107
|
default: 'text-sm leading-normal',
|
|
@@ -119,7 +113,7 @@ export const listItemDescriptionVariants = cva([COLOR_TEXT_SECONDARY], {
|
|
|
119
113
|
},
|
|
120
114
|
});
|
|
121
115
|
|
|
122
|
-
export const listItemMetaVariants = cva(
|
|
116
|
+
export const listItemMetaVariants = cva('text-content-tertiary', {
|
|
123
117
|
variants: {
|
|
124
118
|
size: {
|
|
125
119
|
default: 'text-xs leading-normal',
|
|
@@ -136,7 +130,7 @@ export const listItemMetaVariants = cva([COLOR_TEXT_MUTED], {
|
|
|
136
130
|
export const listItemSectionHeaderVariants = cva(
|
|
137
131
|
[
|
|
138
132
|
'flex-row items-center justify-between gap-2 border-b border-solid px-4 py-3',
|
|
139
|
-
|
|
133
|
+
'border-stroke-secondary',
|
|
140
134
|
],
|
|
141
135
|
{
|
|
142
136
|
variants: {
|
|
@@ -152,9 +146,8 @@ export const listItemSectionHeaderVariants = cva(
|
|
|
152
146
|
);
|
|
153
147
|
|
|
154
148
|
/** Default section-title typography; applied by `ListItem.SectionHeader` for string/number children. Exported for rare custom composition. */
|
|
155
|
-
export const listItemSectionHeaderLabelVariants = cva(
|
|
156
|
-
'text-xs font-semibold uppercase tracking-wide',
|
|
157
|
-
|
|
158
|
-
]);
|
|
149
|
+
export const listItemSectionHeaderLabelVariants = cva(
|
|
150
|
+
'text-xs font-semibold uppercase tracking-wide text-content-secondary',
|
|
151
|
+
);
|
|
159
152
|
|
|
160
153
|
export type ListItemVariantProps = VariantProps<typeof listItemRootVariants>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, useMemo } from 'react';
|
|
1
|
+
import { forwardRef, useEffect, useMemo } from 'react';
|
|
2
2
|
import { View, type ViewProps } from 'react-native';
|
|
3
3
|
import { cn } from '@cdx-ui/utils';
|
|
4
4
|
import {
|
|
@@ -7,15 +7,32 @@ import {
|
|
|
7
7
|
type ProgressSegmentedVariants,
|
|
8
8
|
} from './styles';
|
|
9
9
|
|
|
10
|
+
/* `ProgressSegmentedProps.total` remains in the public API until the next major release. */
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
10
12
|
export interface ProgressSegmentedProps extends ViewProps, ProgressSegmentedVariants {
|
|
11
13
|
/** Current step (1-based index into the segment count) */
|
|
12
14
|
readonly step: number;
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Number of segments in the bar. Matches the Figma `segments` variant (2–6 in the design
|
|
17
|
+
* system file); the prop accepts any positive integer for backward compatibility.
|
|
18
|
+
*/
|
|
19
|
+
readonly segments?: number;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use {@link ProgressSegmentedProps.segments} instead. This alias will be removed
|
|
22
|
+
* in a future major release.
|
|
23
|
+
*/
|
|
14
24
|
readonly total?: number;
|
|
15
25
|
/** When true, the current step segment is marked as complete rather than in-progress */
|
|
16
26
|
readonly isStepComplete?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Returns the accessibility value text announced by screen readers. Receives the clamped
|
|
29
|
+
* step, segment count, and whether the step is complete.
|
|
30
|
+
*/
|
|
31
|
+
readonly getAccessibilityText?: (
|
|
32
|
+
step: number,
|
|
33
|
+
segmentCount: number,
|
|
34
|
+
isStepComplete: boolean,
|
|
35
|
+
) => string;
|
|
19
36
|
readonly className?: string;
|
|
20
37
|
}
|
|
21
38
|
|
|
@@ -23,7 +40,8 @@ export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
|
23
40
|
(
|
|
24
41
|
{
|
|
25
42
|
step,
|
|
26
|
-
|
|
43
|
+
segments,
|
|
44
|
+
total,
|
|
27
45
|
isStepComplete = false,
|
|
28
46
|
getAccessibilityText,
|
|
29
47
|
className,
|
|
@@ -32,10 +50,26 @@ export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
|
32
50
|
},
|
|
33
51
|
ref,
|
|
34
52
|
) => {
|
|
35
|
-
const
|
|
53
|
+
const segmentCount = segments ?? total ?? 5;
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
|
|
55
|
+
// TODO: Remove this once the `total` prop is removed.
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (
|
|
58
|
+
typeof process !== 'undefined' &&
|
|
59
|
+
process.env.NODE_ENV !== 'production' &&
|
|
60
|
+
total !== undefined &&
|
|
61
|
+
segments === undefined
|
|
62
|
+
) {
|
|
63
|
+
console.warn(
|
|
64
|
+
'[ProgressSegmented] The `total` prop is deprecated and will be removed in a future major release. Use `segments` instead.',
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}, [total, segments]);
|
|
68
|
+
|
|
69
|
+
const clampedStep = Math.max(0, Math.min(step, segmentCount));
|
|
70
|
+
|
|
71
|
+
const segmentStates = useMemo(() => {
|
|
72
|
+
return Array.from({ length: segmentCount }, (_, index) => {
|
|
39
73
|
const segmentIndex = index + 1;
|
|
40
74
|
let state: 'complete' | 'incomplete' | 'inprogress' = 'incomplete';
|
|
41
75
|
|
|
@@ -47,13 +81,13 @@ export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
|
47
81
|
|
|
48
82
|
return state;
|
|
49
83
|
});
|
|
50
|
-
}, [
|
|
84
|
+
}, [segmentCount, clampedStep, isStepComplete]);
|
|
51
85
|
|
|
52
|
-
let accessibilityText = `Step ${String(clampedStep)} of ${String(
|
|
86
|
+
let accessibilityText = `Step ${String(clampedStep)} of ${String(segmentCount)}`;
|
|
53
87
|
if (getAccessibilityText) {
|
|
54
|
-
accessibilityText = getAccessibilityText(clampedStep,
|
|
88
|
+
accessibilityText = getAccessibilityText(clampedStep, segmentCount, isStepComplete);
|
|
55
89
|
} else if (isStepComplete) {
|
|
56
|
-
accessibilityText = `Step ${String(clampedStep)} of ${String(
|
|
90
|
+
accessibilityText = `Step ${String(clampedStep)} of ${String(segmentCount)}, completed`;
|
|
57
91
|
}
|
|
58
92
|
|
|
59
93
|
return (
|
|
@@ -63,14 +97,14 @@ export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
|
63
97
|
accessibilityLabel={accessibilityLabel}
|
|
64
98
|
accessibilityValue={{
|
|
65
99
|
min: 0,
|
|
66
|
-
max:
|
|
100
|
+
max: segmentCount,
|
|
67
101
|
now: clampedStep,
|
|
68
102
|
text: accessibilityText,
|
|
69
103
|
}}
|
|
70
104
|
className={cn(progressSegmentedVariants(), className)}
|
|
71
105
|
{...props}
|
|
72
106
|
>
|
|
73
|
-
{
|
|
107
|
+
{segmentStates.map((state, index) => (
|
|
74
108
|
<View key={index} className={cn(segmentVariants({ state }))} />
|
|
75
109
|
))}
|
|
76
110
|
</View>
|
|
@@ -79,3 +113,5 @@ export const ProgressSegmented = forwardRef<View, ProgressSegmentedProps>(
|
|
|
79
113
|
);
|
|
80
114
|
|
|
81
115
|
ProgressSegmented.displayName = 'ProgressSegmented';
|
|
116
|
+
|
|
117
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|