@cdx-ui/components 0.0.1-beta.4 → 0.0.1-beta.40
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 +18 -11
- 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/styles.js +2 -2
- 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 -5
- 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 +1 -2
- 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/ListItem/index.js +283 -0
- package/lib/commonjs/components/ListItem/index.js.map +1 -0
- package/lib/commonjs/components/ListItem/styles.js +130 -0
- package/lib/commonjs/components/ListItem/styles.js.map +1 -0
- package/lib/commonjs/components/ProgressSegmented/index.js +22 -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/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 -11
- 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/ProgressSegmented.figma.js +39 -0
- package/lib/commonjs/figma/ProgressSegmented.figma.js.map +1 -0
- package/lib/commonjs/figma/Radio.figma.js +38 -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/styles/primitives.js +42 -5
- package/lib/commonjs/styles/primitives.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/styles.js +2 -2
- 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 -5
- 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 +1 -2
- 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/ListItem/index.js +226 -0
- package/lib/module/components/ListItem/index.js.map +1 -0
- package/lib/module/components/ListItem/styles.js +127 -0
- package/lib/module/components/ListItem/styles.js.map +1 -0
- package/lib/module/components/ProgressSegmented/index.js +23 -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/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 -11
- 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/ProgressSegmented.figma.js +33 -0
- package/lib/module/figma/ProgressSegmented.figma.js.map +1 -0
- package/lib/module/figma/Radio.figma.js +32 -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/styles/primitives.js +42 -5
- 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/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.map +1 -1
- 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/ListItem/index.d.ts +49 -0
- package/lib/typescript/components/ListItem/index.d.ts.map +1 -0
- package/lib/typescript/components/ListItem/styles.d.ts +30 -0
- package/lib/typescript/components/ListItem/styles.d.ts.map +1 -0
- 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/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/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/styles/primitives.d.ts +38 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/Avatar/index.tsx +1 -1
- package/src/components/Avatar/styles.ts +49 -34
- package/src/components/Button/styles.ts +2 -2
- package/src/components/CLAUDE.md +90 -0
- package/src/components/Card/index.tsx +41 -16
- package/src/components/Card/styles.ts +43 -23
- 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 +1 -2
- package/src/components/IconButton/index.tsx +3 -2
- package/src/components/IconButton/styles.ts +136 -10
- package/src/components/Input/styles.ts +14 -9
- package/src/components/ListItem/index.tsx +285 -0
- package/src/components/ListItem/styles.ts +153 -0
- package/src/components/ProgressSegmented/index.tsx +49 -14
- package/src/components/Radio/index.tsx +192 -0
- package/src/components/Radio/styles.ts +59 -0
- 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/styles/primitives.ts +42 -5
|
@@ -4,15 +4,12 @@ import { forwardRef } from 'react';
|
|
|
4
4
|
import { Pressable, Text, View } from 'react-native';
|
|
5
5
|
import { Check, CheckIndeterminateSmall } from '@cdx-ui/icons';
|
|
6
6
|
import { createCheckbox } from '@cdx-ui/primitives';
|
|
7
|
-
import { cn
|
|
7
|
+
import { cn } from '@cdx-ui/utils';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
9
|
import { checkboxGroupVariants, checkboxIconVariants, checkboxIndicatorVariants, checkboxLabelVariants, checkboxRootVariants } from './styles';
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const SCOPE = 'CHECKBOX';
|
|
12
|
-
const Root = withStyleContext(Pressable, SCOPE);
|
|
13
|
-
const useCheckboxStyleContext = () => useStyleContext(SCOPE);
|
|
14
11
|
const CheckboxPrimitive = createCheckbox({
|
|
15
|
-
Root,
|
|
12
|
+
Root: Pressable,
|
|
16
13
|
Indicator: View,
|
|
17
14
|
Icon: View,
|
|
18
15
|
Label: Text,
|
|
@@ -24,24 +21,18 @@ const CheckboxPrimitive = createCheckbox({
|
|
|
24
21
|
// =============================================================================
|
|
25
22
|
|
|
26
23
|
const CheckboxRoot = /*#__PURE__*/forwardRef(({
|
|
27
|
-
size = 'default',
|
|
28
24
|
className,
|
|
29
25
|
isIndeterminate,
|
|
30
26
|
children,
|
|
31
27
|
style,
|
|
32
28
|
...props
|
|
33
29
|
}, ref) => {
|
|
34
|
-
const computedClassName = cn(checkboxRootVariants(
|
|
35
|
-
size
|
|
36
|
-
}), className);
|
|
30
|
+
const computedClassName = cn(checkboxRootVariants(), className);
|
|
37
31
|
return /*#__PURE__*/_jsxs(CheckboxPrimitive, {
|
|
38
32
|
ref: ref,
|
|
39
33
|
className: computedClassName,
|
|
40
34
|
isIndeterminate: isIndeterminate,
|
|
41
35
|
style: style,
|
|
42
|
-
context: {
|
|
43
|
-
size
|
|
44
|
-
},
|
|
45
36
|
...props,
|
|
46
37
|
children: [/*#__PURE__*/_jsx(CheckboxIndicator, {
|
|
47
38
|
children: /*#__PURE__*/_jsx(CheckboxPrimitive.Icon, {
|
|
@@ -64,12 +55,7 @@ const CheckboxIndicator = /*#__PURE__*/forwardRef(({
|
|
|
64
55
|
style,
|
|
65
56
|
...props
|
|
66
57
|
}, ref) => {
|
|
67
|
-
const
|
|
68
|
-
size
|
|
69
|
-
} = useCheckboxStyleContext();
|
|
70
|
-
const computedClassName = cn(checkboxIndicatorVariants({
|
|
71
|
-
size
|
|
72
|
-
}), className);
|
|
58
|
+
const computedClassName = cn(checkboxIndicatorVariants(), className);
|
|
73
59
|
return /*#__PURE__*/_jsx(CheckboxPrimitive.Indicator, {
|
|
74
60
|
ref: ref,
|
|
75
61
|
className: computedClassName,
|
|
@@ -89,12 +75,7 @@ const CheckboxIcon = ({
|
|
|
89
75
|
style,
|
|
90
76
|
...props
|
|
91
77
|
}) => {
|
|
92
|
-
const
|
|
93
|
-
size
|
|
94
|
-
} = useCheckboxStyleContext();
|
|
95
|
-
const computedClassName = cn(checkboxIconVariants({
|
|
96
|
-
size
|
|
97
|
-
}), className);
|
|
78
|
+
const computedClassName = cn(checkboxIconVariants(), className);
|
|
98
79
|
return /*#__PURE__*/_jsx(Icon, {
|
|
99
80
|
className: computedClassName,
|
|
100
81
|
style: style,
|
|
@@ -113,12 +94,7 @@ const CheckboxLabel = /*#__PURE__*/forwardRef(({
|
|
|
113
94
|
style,
|
|
114
95
|
...props
|
|
115
96
|
}, ref) => {
|
|
116
|
-
const
|
|
117
|
-
size
|
|
118
|
-
} = useCheckboxStyleContext();
|
|
119
|
-
const computedClassName = cn(checkboxLabelVariants({
|
|
120
|
-
size
|
|
121
|
-
}), className);
|
|
97
|
+
const computedClassName = cn(checkboxLabelVariants(), className);
|
|
122
98
|
return /*#__PURE__*/_jsx(CheckboxPrimitive.Label, {
|
|
123
99
|
ref: ref,
|
|
124
100
|
className: computedClassName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Pressable","Text","View","Check","CheckIndeterminateSmall","createCheckbox","cn","
|
|
1
|
+
{"version":3,"names":["forwardRef","Pressable","Text","View","Check","CheckIndeterminateSmall","createCheckbox","cn","Icon","checkboxGroupVariants","checkboxIconVariants","checkboxIndicatorVariants","checkboxLabelVariants","checkboxRootVariants","jsx","_jsx","jsxs","_jsxs","CheckboxPrimitive","Root","Indicator","Label","Group","CheckboxRoot","className","isIndeterminate","children","style","props","ref","computedClassName","CheckboxIndicator","CheckboxIcon","as","displayName","CheckboxLabel","CheckboxGroup","direction","value","onChange","isDisabled","isInvalid","isReadOnly","viewProps","Chec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
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
import {
|
|
6
|
-
export const checkboxRootVariants = cva(['flex-row items-center', DISABLED_OPACITY, DISABLED_CURSOR
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
web: [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
small: 'text-sm',
|
|
46
|
-
default: 'text-base'
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
size: 'default'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
5
|
+
import { DISABLED_CURSOR, DISABLED_OPACITY, TRANSITION_COLORS } from '../../styles/primitives';
|
|
6
|
+
export const checkboxRootVariants = cva(['flex-row items-center gap-2.5', DISABLED_OPACITY, DISABLED_CURSOR,
|
|
7
|
+
// Suppress stray outline on the Pressable/label wrapper; focus ring is drawn on Checkbox.Indicator (Radio pattern).
|
|
8
|
+
'web:outline-none web:focus:outline-none web:focus-visible:outline-none']);
|
|
9
|
+
export const checkboxIndicatorVariants = cva(['items-center justify-center', 'h-5 w-5', 'rounded', 'border-2 border-solid', 'data-[disabled=true]:opacity-50',
|
|
10
|
+
// Background — layered by specificity. checked=false acts as an explicit reset so the base bg
|
|
11
|
+
// reasserts when transitioning from checked/indeterminate on native (where absent attributes
|
|
12
|
+
// break data-[attr=false] selectors).
|
|
13
|
+
// IMPORTANT: On native (Uniwind), only the LAST data-[] condition in a compound chain is
|
|
14
|
+
// effectively evaluated. Place the most discriminating condition last to avoid false matches.
|
|
15
|
+
'data-[checked=false]:bg-surface-primary', 'data-[checked=true]:bg-surface-action-strong', 'data-[indeterminate=true]:bg-surface-action-strong',
|
|
16
|
+
// Border — invalid (later) beats checked/indeterminate.
|
|
17
|
+
'data-[checked=false]:border-content-secondary', 'data-[checked=true]:border-stroke-action', 'data-[indeterminate=true]:border-stroke-action', 'data-[invalid=true]:border-stroke-danger', Platform.select({
|
|
18
|
+
web: [
|
|
19
|
+
// Invalid bg — compound selectors evaluate correctly on web.
|
|
20
|
+
'data-[invalid=true]:data-[checked=true]:bg-surface-danger-strong', 'data-[invalid=true]:data-[indeterminate=true]:bg-surface-danger-strong', TRANSITION_COLORS,
|
|
21
|
+
// Hover — unchecked (Figma: border unchanged, bg overlay at opacity/hover)
|
|
22
|
+
'data-[hover=true]:data-[checked=false]:data-[indeterminate=false]:bg-content-secondary/[0.08]',
|
|
23
|
+
// Hover — unchecked + invalid (overlay uses danger token)
|
|
24
|
+
'data-[hover=true]:data-[invalid=true]:data-[checked=false]:data-[indeterminate=false]:bg-surface-danger-strong/[0.08]',
|
|
25
|
+
// Hover — checked / indeterminate (bg + border darken together)
|
|
26
|
+
'data-[hover=true]:data-[checked=true]:bg-surface-action-strong-hover', 'data-[hover=true]:data-[checked=true]:border-[--color-surface-action-strong-hover]', 'data-[hover=true]:data-[indeterminate=true]:bg-surface-action-strong-hover', 'data-[hover=true]:data-[indeterminate=true]:border-[--color-surface-action-strong-hover]', 'data-[hover=true]:data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong-hover', 'data-[hover=true]:data-[checked=true]:data-[invalid=true]:border-[--color-surface-danger-strong-hover]', 'data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:bg-surface-danger-strong-hover', 'data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:border-[--color-surface-danger-strong-hover]',
|
|
27
|
+
// Active — CSS :active pseudo-class (web root does not track press via data-active).
|
|
28
|
+
// data-[hover=true] guard ensures active beats hover by specificity (0,3,0 > 0,2,0).
|
|
29
|
+
'web:active:data-[hover=true]:data-[checked=true]:bg-surface-action-strong-active', 'web:active:data-[hover=true]:data-[checked=true]:border-[--color-surface-action-strong-active]', 'web:active:data-[hover=true]:data-[indeterminate=true]:bg-surface-action-strong-active', 'web:active:data-[hover=true]:data-[indeterminate=true]:border-[--color-surface-action-strong-active]', 'web:active:data-[hover=true]:data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong-active', 'web:active:data-[hover=true]:data-[checked=true]:data-[invalid=true]:border-[--color-surface-danger-strong-active]', 'web:active:data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:bg-surface-danger-strong-active', 'web:active:data-[hover=true]:data-[indeterminate=true]:data-[invalid=true]:border-[--color-surface-danger-strong-active]',
|
|
30
|
+
// Focus ring
|
|
31
|
+
'web:data-[focus-visible=true]:outline-none', 'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[--color-stroke-ring] web:data-[focus-visible=true]:ring-offset-2'].join(' '),
|
|
32
|
+
default: [
|
|
33
|
+
// Invalid bg is NOT styled on native. Compound data-[] selectors cannot express
|
|
34
|
+
// "invalid AND checked" without false-matching other states (Uniwind only evaluates
|
|
35
|
+
// the last condition). Invalid state is communicated via border-stroke-danger (single
|
|
36
|
+
// condition, always correct). The fill stays action-strong for checked/indeterminate.
|
|
37
|
+
//
|
|
38
|
+
// Active — native tracks press via data-[active] from usePress.
|
|
39
|
+
// Place data-[active=true] last so the rule only fires during press.
|
|
40
|
+
// 'data-[checked=false]:data-[invalid=true]:bg-transparent',
|
|
41
|
+
'data-[checked=true]:data-[invalid=true]:bg-surface-danger-strong', 'data-[checked=true]:data-[active=true]:bg-surface-action-strong-active', 'data-[checked=true]:data-[active=true]:data-[invalid=true]:bg-surface-danger-strong-active', 'data-[indeterminate=true]:data-[active=true]:bg-surface-action-strong-active'].join(' ')
|
|
42
|
+
})]);
|
|
43
|
+
export const checkboxIconVariants = cva(['text-white', 'h-5 w-5']);
|
|
44
|
+
export const checkboxLabelVariants = cva(['text-content-primary text-base', 'data-[disabled=true]:text-content-tertiary']);
|
|
53
45
|
export const checkboxGroupVariants = cva([], {
|
|
54
46
|
variants: {
|
|
55
47
|
direction: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","cva","
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","DISABLED_OPACITY","TRANSITION_COLORS","checkboxRootVariants","checkboxIndicatorVariants","select","web","join","default","checkboxIconVariants","checkboxLabelVariants","checkboxGroupVariants","variants","direction","column","row","defaultVariants"],"sourceRoot":"../../../../src","sources":["components/Checkbox/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ,yBAAyB;AAE9F,OAAO,MAAMC,oBAAoB,GAAGJ,GAAG,CAAC,CACtC,+BAA+B,EAC/BE,gBAAgB,EAChBD,eAAe;AACf;AACA,wEAAwE,CACzE,CAAC;AAEF,OAAO,MAAMI,yBAAyB,GAAGL,GAAG,CAAC,CAC3C,6BAA6B,EAC7B,SAAS,EACT,SAAS,EACT,uBAAuB,EACvB,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA,yCAAyC,EACzC,8CAA8C,EAC9C,oDAAoD;AACpD;AACA,+CAA+C,EAC/C,0CAA0C,EAC1C,gDAAgD,EAChD,0CAA0C,EAC1CD,QAAQ,CAACO,MAAM,CAAC;EACdC,GAAG,EAAE;EACH;EACA,kEAAkE,EAClE,wEAAwE,EACxEJ,iBAAiB;EACjB;EACA,+FAA+F;EAC/F;EACA,uHAAuH;EACvH;EACA,sEAAsE,EACtE,oFAAoF,EACpF,4EAA4E,EAC5E,0FAA0F,EAC1F,0FAA0F,EAC1F,wGAAwG,EACxG,gGAAgG,EAChG,8GAA8G;EAC9G;EACA;EACA,kFAAkF,EAClF,gGAAgG,EAChG,wFAAwF,EACxF,sGAAsG,EACtG,sGAAsG,EACtG,oHAAoH,EACpH,4GAA4G,EAC5G,0HAA0H;EAC1H;EACA,4CAA4C,EAC5C,2IAA2I,CAC5I,CAACK,IAAI,CAAC,GAAG,CAAC;EACXC,OAAO,EAAE;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kEAAkE,EAClE,wEAAwE,EACxE,4FAA4F,EAC5F,8EAA8E,CAC/E,CAACD,IAAI,CAAC,GAAG;AACZ,CAAC,CAAC,CACH,CAAC;AAEF,OAAO,MAAME,oBAAoB,GAAGV,GAAG,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAElE,OAAO,MAAMW,qBAAqB,GAAGX,GAAG,CAAC,CACvC,gCAAgC,EAChC,4CAA4C,CAC7C,CAAC;AAEF,OAAO,MAAMY,qBAAqB,GAAGZ,GAAG,CAAC,EAAE,EAAE;EAC3Ca,QAAQ,EAAE;IACRC,SAAS,EAAE;MACTC,MAAM,EAAE,OAAO;MACfC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,44 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Pressable, Text as RNText, View } from 'react-native';
|
|
5
|
+
import { createChip } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, ParentContext, useParentContext, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
7
|
+
import { Avatar } from '../Avatar';
|
|
6
8
|
import { Icon } from '../Icon';
|
|
7
|
-
import {
|
|
9
|
+
import { chipAvatarVariants, chipIconVariants, chipLabelVariants, chipRootVariants } from './styles';
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
11
|
const SCOPE = 'CHIP';
|
|
10
|
-
const
|
|
12
|
+
const RootView = withStyleContext(View, SCOPE);
|
|
13
|
+
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
14
|
+
const ChipPrimitive = createChip({
|
|
15
|
+
View: RootView,
|
|
16
|
+
Pressable: RootPressable
|
|
17
|
+
});
|
|
11
18
|
const useChipStyleContext = () => useStyleContext(SCOPE);
|
|
12
19
|
|
|
13
20
|
// =============================================================================
|
|
14
|
-
//
|
|
21
|
+
// ROOT
|
|
15
22
|
// =============================================================================
|
|
16
23
|
|
|
17
24
|
const ChipRoot = /*#__PURE__*/forwardRef(({
|
|
18
25
|
children,
|
|
26
|
+
variant = 'tint',
|
|
27
|
+
size = 'default',
|
|
19
28
|
color = 'default',
|
|
20
29
|
className,
|
|
21
30
|
style,
|
|
31
|
+
asChild,
|
|
22
32
|
...props
|
|
23
33
|
}, ref) => {
|
|
34
|
+
const parentContextValues = useParentContext();
|
|
35
|
+
const styleContextValues = useMemo(() => ({
|
|
36
|
+
...parentContextValues,
|
|
37
|
+
[SCOPE]: {
|
|
38
|
+
variant,
|
|
39
|
+
size,
|
|
40
|
+
color
|
|
41
|
+
}
|
|
42
|
+
}), [parentContextValues, variant, size, color]);
|
|
24
43
|
const computedClassName = cn(chipRootVariants({
|
|
44
|
+
variant,
|
|
45
|
+
size,
|
|
25
46
|
color
|
|
26
47
|
}), className);
|
|
27
|
-
|
|
48
|
+
const root = /*#__PURE__*/_jsx(ChipPrimitive, {
|
|
28
49
|
ref: ref,
|
|
50
|
+
asChild: asChild,
|
|
29
51
|
className: computedClassName,
|
|
30
|
-
style: style,
|
|
31
52
|
context: {
|
|
53
|
+
variant,
|
|
54
|
+
size,
|
|
32
55
|
color
|
|
33
56
|
},
|
|
57
|
+
style: style,
|
|
34
58
|
...props,
|
|
35
59
|
children: children
|
|
36
60
|
});
|
|
61
|
+
if (asChild) {
|
|
62
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
63
|
+
value: styleContextValues,
|
|
64
|
+
children: root
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return root;
|
|
37
68
|
});
|
|
38
69
|
ChipRoot.displayName = 'Chip';
|
|
39
70
|
|
|
40
71
|
// =============================================================================
|
|
41
|
-
//
|
|
72
|
+
// LABEL
|
|
42
73
|
// =============================================================================
|
|
43
74
|
|
|
44
75
|
const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
@@ -48,9 +79,13 @@ const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
|
48
79
|
...props
|
|
49
80
|
}, ref) => {
|
|
50
81
|
const {
|
|
82
|
+
size,
|
|
83
|
+
variant,
|
|
51
84
|
color
|
|
52
85
|
} = useChipStyleContext();
|
|
53
86
|
const computedClassName = cn(chipLabelVariants({
|
|
87
|
+
size,
|
|
88
|
+
variant,
|
|
54
89
|
color
|
|
55
90
|
}), className);
|
|
56
91
|
return /*#__PURE__*/_jsx(RNText, {
|
|
@@ -64,20 +99,24 @@ const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
|
64
99
|
ChipLabel.displayName = 'Chip.Label';
|
|
65
100
|
|
|
66
101
|
// =============================================================================
|
|
67
|
-
//
|
|
102
|
+
// ICON
|
|
68
103
|
// =============================================================================
|
|
69
104
|
|
|
70
105
|
const ChipIcon = ({
|
|
71
106
|
className,
|
|
72
107
|
style,
|
|
73
108
|
as,
|
|
109
|
+
slot,
|
|
74
110
|
...props
|
|
75
111
|
}) => {
|
|
76
112
|
const {
|
|
113
|
+
size,
|
|
77
114
|
color
|
|
78
115
|
} = useChipStyleContext();
|
|
79
116
|
const computedClassName = cn(chipIconVariants({
|
|
80
|
-
|
|
117
|
+
size,
|
|
118
|
+
color,
|
|
119
|
+
slot
|
|
81
120
|
}), className);
|
|
82
121
|
return /*#__PURE__*/_jsx(Icon, {
|
|
83
122
|
as: as,
|
|
@@ -89,11 +128,41 @@ const ChipIcon = ({
|
|
|
89
128
|
ChipIcon.displayName = 'Chip.Icon';
|
|
90
129
|
|
|
91
130
|
// =============================================================================
|
|
92
|
-
//
|
|
131
|
+
// AVATAR
|
|
132
|
+
// =============================================================================
|
|
133
|
+
|
|
134
|
+
const ChipAvatar = ({
|
|
135
|
+
className,
|
|
136
|
+
style,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}) => {
|
|
140
|
+
const {
|
|
141
|
+
size
|
|
142
|
+
} = useChipStyleContext();
|
|
143
|
+
// chipAvatarVariants sets w/h and the leading slot negative margin.
|
|
144
|
+
// Avatar renders with size="sm" (its smallest named size) but chipAvatarVariants
|
|
145
|
+
// overrides the w/h via tailwind-merge so the chip size wins.
|
|
146
|
+
const computedClassName = cn(chipAvatarVariants({
|
|
147
|
+
size
|
|
148
|
+
}), className);
|
|
149
|
+
return /*#__PURE__*/_jsx(Avatar, {
|
|
150
|
+
size: "sm",
|
|
151
|
+
className: computedClassName,
|
|
152
|
+
style: style,
|
|
153
|
+
...props,
|
|
154
|
+
children: children
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
ChipAvatar.displayName = 'Chip.Avatar';
|
|
158
|
+
|
|
159
|
+
// =============================================================================
|
|
160
|
+
// COMPOUND EXPORT
|
|
93
161
|
// =============================================================================
|
|
94
162
|
|
|
95
163
|
export const Chip = Object.assign(ChipRoot, {
|
|
96
164
|
Label: ChipLabel,
|
|
97
|
-
Icon: ChipIcon
|
|
165
|
+
Icon: ChipIcon,
|
|
166
|
+
Avatar: ChipAvatar
|
|
98
167
|
});
|
|
99
168
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Pressable","Text","RNText","View","createChip","cn","ParentContext","useParentContext","useStyleContext","withStyleContext","Avatar","Icon","chipAvatarVariants","chipIconVariants","chipLabelVariants","chipRootVariants","jsx","_jsx","SCOPE","RootView","RootPressable","ChipPrimitive","useChipStyleContext","ChipRoot","children","variant","size","color","className","style","asChild","props","ref","parentContextValues","styleContextValues","computedClassName","root","context","Provider","value","displayName","ChipLabel","ChipIcon","as","slot","ChipAvatar","Chip","Object","assign","Label"],"sourceRoot":"../../../../src","sources":["components/Chip/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC3D,SAASC,SAAS,EAAEC,IAAI,IAAIC,MAAM,EAAEC,IAAI,QAAwB,cAAc;AAC9E,SAASC,UAAU,QAAyB,oBAAoB;AAChE,SACEC,EAAE,EACFC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,gBAAgB,QAEX,eAAe;AACtB,SAASC,MAAM,QAA0B,WAAW;AACpD,SAASC,IAAI,QAAwB,SAAS;AAC9C,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QAEX,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,KAAK,GAAG,MAAM;AAEpB,MAAMC,QAAQ,GAAGV,gBAAgB,CAACN,IAAI,EAAEe,KAAK,CAAC;AAC9C,MAAME,aAAa,GAAGX,gBAAgB,CAACT,SAAS,EAAEkB,KAAK,CAAC;AAExD,MAAMG,aAAa,GAAGjB,UAAU,CAAC;EAC/BD,IAAI,EAAEgB,QAAQ;EACdnB,SAAS,EAAEoB;AACb,CAAC,CAAC;AAEF,MAAME,mBAAmB,GAAGA,CAAA,KAAMd,eAAe,CAACU,KAAK,CAAqB;;AAE5E;AACA;AACA;;AAOA,MAAMK,QAAQ,gBAAGzB,UAAU,CACzB,CACE;EACE0B,QAAQ;EACRC,OAAO,GAAG,MAAM;EAChBC,IAAI,GAAG,SAAS;EAChBC,KAAK,GAAG,SAAS;EACjBC,SAAS;EACTC,KAAK;EACLC,OAAO;EACP,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,mBAAmB,GAAG1B,gBAAgB,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