@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
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Pressable, Text, View } from 'react-native';
|
|
5
|
+
import { createRadio, dataAttributes } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn } from '@cdx-ui/utils';
|
|
7
|
+
import { radioGroupVariants, radioIndicatorVariants, radioInnerDotVariants, radioLabelVariants, radioRootVariants } from './styles';
|
|
8
|
+
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// STYLED INDICATOR BASE
|
|
11
|
+
// =============================================================================
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const RadioIndicatorBase = /*#__PURE__*/forwardRef(({
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
style,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
// On web, data attributes arrive as `dataSet: { checked: true }`.
|
|
20
|
+
// On native, they arrive as individual `data-checked: "true"` props.
|
|
21
|
+
const ds = props.dataSet;
|
|
22
|
+
const isChecked = ds ? ds.checked === true : props['data-checked'] === 'true';
|
|
23
|
+
const isInvalid = ds ? ds.invalid === true : props['data-invalid'] === 'true';
|
|
24
|
+
const isHovered = ds ? ds.hover === true : props['data-hover'] === 'true';
|
|
25
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
26
|
+
ref: ref,
|
|
27
|
+
className: cn(radioIndicatorVariants(), className),
|
|
28
|
+
style: style,
|
|
29
|
+
...props,
|
|
30
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
31
|
+
className: cn(radioInnerDotVariants()),
|
|
32
|
+
...dataAttributes({
|
|
33
|
+
checked: isChecked,
|
|
34
|
+
invalid: isInvalid,
|
|
35
|
+
hover: isHovered
|
|
36
|
+
})
|
|
37
|
+
}), children]
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
RadioIndicatorBase.displayName = 'Radio.IndicatorBase';
|
|
41
|
+
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// PRIMITIVE ASSEMBLY
|
|
44
|
+
// =============================================================================
|
|
45
|
+
|
|
46
|
+
const RadioPrimitive = createRadio({
|
|
47
|
+
Root: Pressable,
|
|
48
|
+
Indicator: RadioIndicatorBase,
|
|
49
|
+
Label: Text,
|
|
50
|
+
Group: View
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// =============================================================================
|
|
54
|
+
// RADIO ROOT
|
|
55
|
+
// =============================================================================
|
|
56
|
+
|
|
57
|
+
const RadioRoot = /*#__PURE__*/forwardRef(({
|
|
58
|
+
className,
|
|
59
|
+
children,
|
|
60
|
+
style,
|
|
61
|
+
...props
|
|
62
|
+
}, ref) => {
|
|
63
|
+
const computedClassName = cn(radioRootVariants(), className);
|
|
64
|
+
return /*#__PURE__*/_jsx(RadioPrimitive, {
|
|
65
|
+
ref: ref,
|
|
66
|
+
className: computedClassName,
|
|
67
|
+
style: style,
|
|
68
|
+
...props,
|
|
69
|
+
children: children
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
RadioRoot.displayName = 'Radio';
|
|
73
|
+
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// RADIO INDICATOR
|
|
76
|
+
// =============================================================================
|
|
77
|
+
|
|
78
|
+
const RadioIndicator = /*#__PURE__*/forwardRef(({
|
|
79
|
+
className,
|
|
80
|
+
children,
|
|
81
|
+
style,
|
|
82
|
+
...props
|
|
83
|
+
}, ref) => {
|
|
84
|
+
return /*#__PURE__*/_jsx(RadioPrimitive.Indicator, {
|
|
85
|
+
ref: ref,
|
|
86
|
+
className: className,
|
|
87
|
+
style: style,
|
|
88
|
+
...props,
|
|
89
|
+
children: children
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
RadioIndicator.displayName = 'Radio.Indicator';
|
|
93
|
+
|
|
94
|
+
// =============================================================================
|
|
95
|
+
// RADIO LABEL
|
|
96
|
+
// =============================================================================
|
|
97
|
+
|
|
98
|
+
const RadioLabel = /*#__PURE__*/forwardRef(({
|
|
99
|
+
className,
|
|
100
|
+
children,
|
|
101
|
+
style,
|
|
102
|
+
...props
|
|
103
|
+
}, ref) => {
|
|
104
|
+
const computedClassName = cn(radioLabelVariants(), className);
|
|
105
|
+
return /*#__PURE__*/_jsx(RadioPrimitive.Label, {
|
|
106
|
+
ref: ref,
|
|
107
|
+
className: computedClassName,
|
|
108
|
+
style: style,
|
|
109
|
+
...props,
|
|
110
|
+
children: children
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
RadioLabel.displayName = 'Radio.Label';
|
|
114
|
+
|
|
115
|
+
// =============================================================================
|
|
116
|
+
// RADIO GROUP
|
|
117
|
+
// =============================================================================
|
|
118
|
+
|
|
119
|
+
const RadioGroup = /*#__PURE__*/forwardRef(({
|
|
120
|
+
className,
|
|
121
|
+
children,
|
|
122
|
+
style,
|
|
123
|
+
direction = 'column',
|
|
124
|
+
value,
|
|
125
|
+
defaultValue,
|
|
126
|
+
onChange,
|
|
127
|
+
isDisabled,
|
|
128
|
+
isInvalid,
|
|
129
|
+
isRequired,
|
|
130
|
+
isReadOnly,
|
|
131
|
+
name,
|
|
132
|
+
...viewProps
|
|
133
|
+
}, ref) => {
|
|
134
|
+
const computedClassName = cn(radioGroupVariants({
|
|
135
|
+
direction
|
|
136
|
+
}), className);
|
|
137
|
+
return /*#__PURE__*/_jsx(RadioPrimitive.Group, {
|
|
138
|
+
ref: ref,
|
|
139
|
+
className: computedClassName,
|
|
140
|
+
style: style,
|
|
141
|
+
value: value,
|
|
142
|
+
defaultValue: defaultValue,
|
|
143
|
+
onChange: onChange,
|
|
144
|
+
isDisabled: isDisabled,
|
|
145
|
+
isInvalid: isInvalid,
|
|
146
|
+
isRequired: isRequired,
|
|
147
|
+
isReadOnly: isReadOnly,
|
|
148
|
+
name: name,
|
|
149
|
+
...viewProps,
|
|
150
|
+
children: children
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
RadioGroup.displayName = 'Radio.Group';
|
|
154
|
+
|
|
155
|
+
// =============================================================================
|
|
156
|
+
// COMPOUND COMPONENT
|
|
157
|
+
// =============================================================================
|
|
158
|
+
|
|
159
|
+
export const Radio = Object.assign(RadioRoot, {
|
|
160
|
+
Indicator: RadioIndicator,
|
|
161
|
+
Label: RadioLabel,
|
|
162
|
+
Group: RadioGroup
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","Pressable","Text","View","createRadio","dataAttributes","cn","radioGroupVariants","radioIndicatorVariants","radioInnerDotVariants","radioLabelVariants","radioRootVariants","jsx","_jsx","jsxs","_jsxs","RadioIndicatorBase","className","children","style","props","ref","ds","dataSet","isChecked","checked","isInvalid","invalid","isHovered","hover","displayName","RadioPrimitive","Root","Indicator","Label","Group","RadioRoot","computedClassName","RadioIndicator","RadioLabel","RadioGroup","direction","value","defaultValue","onChange","isDisabled","isRequired","isReadOnly","name","viewProps","Radio","Object","assign"],"sourceRoot":"../../../../src","sources":["components/Radio/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,SAAS,EAAEC,IAAI,EAAkBC,IAAI,QAAwB,cAAc;AACpF,SAASC,WAAW,EAAEC,cAAc,QAA0B,oBAAoB;AAClF,SAASC,EAAE,QAAQ,eAAe;AAClC,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,qBAAqB,EACrBC,kBAAkB,EAClBC,iBAAiB,QACZ,UAAU;;AAEjB;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEA,MAAMC,kBAAkB,gBAAGhB,UAAU,CACnC,CAAC;EAAEiB,SAAS;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACjD;EACA;EACA,MAAMC,EAAE,GAAIF,KAAK,CAASG,OAAO;EACjC,MAAMC,SAAS,GAAGF,EAAE,GAAGA,EAAE,CAACG,OAAO,KAAK,IAAI,GAAIL,KAAK,CAAS,cAAc,CAAC,KAAK,MAAM;EACtF,MAAMM,SAAS,GAAGJ,EAAE,GAAGA,EAAE,CAACK,OAAO,KAAK,IAAI,GAAIP,KAAK,CAAS,cAAc,CAAC,KAAK,MAAM;EACtF,MAAMQ,SAAS,GAAGN,EAAE,GAAGA,EAAE,CAACO,KAAK,KAAK,IAAI,GAAIT,KAAK,CAAS,YAAY,CAAC,KAAK,MAAM;EAElF,oBACEL,KAAA,CAACZ,IAAI;IAACkB,GAAG,EAAEA,GAAI;IAACJ,SAAS,EAAEX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AEA,KAAM;IACbC,YAAY,EAAEA,YAAa;IAC3BC,QAAQ,EAAEA,QAAS;IACnBC,UAAU,EAAEA,UAAW;IACvBnB,SAAS,EAAEA,SAAU;IACrBoB,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBC,IAAI,EAAEA,IAAK;IAAA,GACPC,SAAS;IAAA/B,QAAA,EAEZA;EAAQ,CACW,CAAC;AAE3B,CACF,CAAC;AAEDsB,UAAU,CAACV,WAAW,GAAG,aAAa;;AAEtC;AACA;AACA;;AAQA,OAAO,MAAMoB,KAAK,GAAGC,MAAM,CAACC,MAAM,CAAChB,SAAS,EAAE;EAC5CH,SAAS,EAAEK,cAAc;EACzBJ,KAAK,EAAEK,UAAU;EACjBJ,KAAK,EAAEK;AACT,CAAC,CAA2B","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
6
|
+
export const radioRootVariants = cva(['flex-row items-center gap-2', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR]);
|
|
7
|
+
export const radioIndicatorVariants = cva(['items-center justify-center', 'rounded-[var(--border-radius-round)]', 'border-2', 'h-5 w-5', 'bg-surface-primary', 'data-[checked=false]:border-content-secondary', 'data-[checked=true]:border-stroke-action', 'data-[invalid=true]:border-stroke-danger', 'data-[checked=true]:data-[invalid=true]:border-stroke-danger', Platform.select({
|
|
8
|
+
web: [TRANSITION_COLORS, 'data-[hover=true]:data-[checked=true]:border-surface-action-strong-hover', 'data-[hover=true]:data-[invalid=true]:border-surface-danger-strong-hover', 'web:data-[focus-visible=true]:outline-none', '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'].join(' '),
|
|
9
|
+
default: ''
|
|
10
|
+
})]);
|
|
11
|
+
export const radioInnerDotVariants = cva(['rounded-[var(--border-radius-round)]', 'h-2.5 w-2.5', 'scale-0', 'data-[checked=true]:scale-100', 'bg-surface-action-strong', 'data-[invalid=true]:bg-surface-danger-strong', Platform.select({
|
|
12
|
+
web: ['data-[hover=true]:bg-surface-action-strong-hover', 'data-[hover=true]:data-[invalid=true]:bg-surface-danger-strong-hover'].join(' '),
|
|
13
|
+
default: ''
|
|
14
|
+
})]);
|
|
15
|
+
export const radioLabelVariants = cva(['body-md', 'text-content-primary']);
|
|
16
|
+
export const radioGroupVariants = cva([], {
|
|
17
|
+
variants: {
|
|
18
|
+
direction: {
|
|
19
|
+
column: 'gap-2',
|
|
20
|
+
row: 'flex-row gap-4'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
direction: 'column'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","radioRootVariants","radioIndicatorVariants","select","web","join","default","radioInnerDotVariants","radioLabelVariants","radioGroupVariants","variants","direction","column","row","defaultVariants"],"sourceRoot":"../../../../src","sources":["components/Radio/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;AAE5E,OAAO,MAAMC,iBAAiB,GAAGH,GAAG,CAAC,CACnC,6BAA6B,EAC7B,wDAAwD,EACxDC,eAAe,CAChB,CAAC;AAEF,OAAO,MAAMG,sBAAsB,GAAGJ,GAAG,CAAC,CACxC,6BAA6B,EAC7B,sCAAsC,EACtC,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,+CAA+C,EAC/C,0CAA0C,EAC1C,0CAA0C,EAC1C,8DAA8D,EAC9DD,QAAQ,CAACM,MAAM,CAAC;EACdC,GAAG,EAAE,CACHJ,iBAAiB,EACjB,0EAA0E,EAC1E,0EAA0E,EAC1E,4CAA4C,EAC5C,gJAAgJ,CACjJ,CAACK,IAAI,CAAC,GAAG,CAAC;EACXC,OAAO,EAAE;AACX,CAAC,CAAC,CACH,CAAC;AAEF,OAAO,MAAMC,qBAAqB,GAAGT,GAAG,CAAC,CACvC,sCAAsC,EACtC,aAAa,EACb,SAAS,EACT,+BAA+B,EAC/B,0BAA0B,EAC1B,8CAA8C,EAC9CD,QAAQ,CAACM,MAAM,CAAC;EACdC,GAAG,EAAE,CACH,kDAAkD,EAClD,sEAAsE,CACvE,CAACC,IAAI,CAAC,GAAG,CAAC;EACXC,OAAO,EAAE;AACX,CAAC,CAAC,CACH,CAAC;AAEF,OAAO,MAAME,kBAAkB,GAAGV,GAAG,CAAC,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAE1E,OAAO,MAAMW,kBAAkB,GAAGX,GAAG,CAAC,EAAE,EAAE;EACxCY,QAAQ,EAAE;IACRC,SAAS,EAAE;MACTC,MAAM,EAAE,OAAO;MACfC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,eAAe,EAAE;IAAEH,SAAS,EAAE;EAAS;AACzC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
export const textStyle = cva([
|
|
6
|
-
web: 'font-
|
|
5
|
+
export const textStyle = cva(['text-content-primary', Platform.select({
|
|
6
|
+
web: 'font-body my-0 bg-transparent no-underline',
|
|
7
7
|
default: ''
|
|
8
8
|
})], {
|
|
9
9
|
variants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","cva","textStyle","select","web","default","variants","size","xl","lg","md","sm","xs"],"sourceRoot":"../../../../src","sources":["components/Text/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AAEjE,OAAO,MAAMC,SAAS,GAAGD,GAAG,CAC1B,CACE,
|
|
1
|
+
{"version":3,"names":["Platform","cva","textStyle","select","web","default","variants","size","xl","lg","md","sm","xs"],"sourceRoot":"../../../../src","sources":["components/Text/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AAEjE,OAAO,MAAMC,SAAS,GAAGD,GAAG,CAC1B,CACE,sBAAsB,EACtBD,QAAQ,CAACG,MAAM,CAAC;EACdC,GAAG,EAAE,4CAA4C;EACjDC,OAAO,EAAE;AACX,CAAC,CAAC,CACH,EACD;EACEC,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE;IACN;EACF;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { Pressable, Text, View } from 'react-native';
|
|
5
|
+
import { createTile, useTileContext } from '@cdx-ui/primitives';
|
|
6
|
+
import { Check } from '@cdx-ui/icons';
|
|
7
|
+
import { dataAttributes } from '@cdx-ui/primitives';
|
|
8
|
+
import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
9
|
+
import { checkboxIndicatorVariants, checkboxIconVariants } from '../Checkbox/styles';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
import { radioIndicatorVariants, radioInnerDotVariants } from '../Radio/styles';
|
|
12
|
+
import { tileContentVariants, tileDescriptionVariants, tileGroupVariants, tileIndicatorVariants, tileLeadingSlotVariants, tileRootVariants, tileTitleVariants, tileTrailingSlotVariants } from './styles';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const TILE_SCOPE = 'TILE';
|
|
15
|
+
const TILE_GROUP_SCOPE = 'TILE_GROUP';
|
|
16
|
+
const RootPressable = withStyleContext(Pressable, TILE_SCOPE);
|
|
17
|
+
const GroupView = withStyleContext(View, TILE_GROUP_SCOPE);
|
|
18
|
+
const useTileGroupStyleContext = () => {
|
|
19
|
+
// `useStyleContext` types the result as a `Record`, but at runtime the value is
|
|
20
|
+
// `undefined` when no provider is in scope (e.g. standalone Tile). Cast through
|
|
21
|
+
// `unknown` to acknowledge that.
|
|
22
|
+
const ctx = useStyleContext(TILE_GROUP_SCOPE);
|
|
23
|
+
return ctx ?? {};
|
|
24
|
+
};
|
|
25
|
+
const TilePrimitive = createTile({
|
|
26
|
+
Pressable: RootPressable,
|
|
27
|
+
Group: GroupView,
|
|
28
|
+
LeadingSlot: View,
|
|
29
|
+
Content: View,
|
|
30
|
+
Title: Text,
|
|
31
|
+
Description: Text,
|
|
32
|
+
Indicator: View,
|
|
33
|
+
TrailingSlot: View
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// TILE GROUP
|
|
38
|
+
// =============================================================================
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Discriminated union mirroring `ITileGroupProps`, with `className` and layout variants added at
|
|
42
|
+
* the styled layer. Distributing the intersection across each branch keeps `interface … extends`
|
|
43
|
+
* ergonomics and avoids tripping `@typescript-eslint` on `(union) & { ... }`.
|
|
44
|
+
*
|
|
45
|
+
* `direction` and `spacing` constrain the group layout to the three supported patterns:
|
|
46
|
+
* - `direction="column"` + `spacing="default"` — vertical stack with gaps (default).
|
|
47
|
+
* - `direction="column"` + `spacing="none"` — tight vertical stack (rows touch).
|
|
48
|
+
* - `direction="row"` + `spacing="default"` — side-by-side horizontal layout.
|
|
49
|
+
*
|
|
50
|
+
* `shape` (when set) is propagated to child `Tile`s via `withStyleContext`, matching the
|
|
51
|
+
* Avatar size-propagation pattern. A per-tile `shape` prop overrides the inherited value.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
const TileGroup = /*#__PURE__*/forwardRef(({
|
|
55
|
+
className,
|
|
56
|
+
style,
|
|
57
|
+
children,
|
|
58
|
+
direction,
|
|
59
|
+
spacing,
|
|
60
|
+
shape,
|
|
61
|
+
...props
|
|
62
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.Group, {
|
|
63
|
+
ref: ref,
|
|
64
|
+
className: cn(tileGroupVariants({
|
|
65
|
+
direction,
|
|
66
|
+
spacing
|
|
67
|
+
}), className),
|
|
68
|
+
style: style,
|
|
69
|
+
context: {
|
|
70
|
+
shape
|
|
71
|
+
},
|
|
72
|
+
...props,
|
|
73
|
+
children: children
|
|
74
|
+
}));
|
|
75
|
+
TileGroup.displayName = 'Tile.Group';
|
|
76
|
+
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// TILE ROOT
|
|
79
|
+
// =============================================================================
|
|
80
|
+
|
|
81
|
+
const TileRoot = /*#__PURE__*/forwardRef(({
|
|
82
|
+
shape: shapeProp,
|
|
83
|
+
showSeparator,
|
|
84
|
+
className,
|
|
85
|
+
style,
|
|
86
|
+
context,
|
|
87
|
+
...props
|
|
88
|
+
}, ref) => {
|
|
89
|
+
const {
|
|
90
|
+
shape: inheritedShape
|
|
91
|
+
} = useTileGroupStyleContext();
|
|
92
|
+
const shape = shapeProp ?? inheritedShape ?? 'card';
|
|
93
|
+
const computedClassName = cn(tileRootVariants({
|
|
94
|
+
shape,
|
|
95
|
+
showSeparator
|
|
96
|
+
}), className);
|
|
97
|
+
return /*#__PURE__*/_jsx(TilePrimitive, {
|
|
98
|
+
ref: ref,
|
|
99
|
+
className: computedClassName,
|
|
100
|
+
context: {
|
|
101
|
+
...context,
|
|
102
|
+
shape
|
|
103
|
+
},
|
|
104
|
+
style: style,
|
|
105
|
+
...props
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
TileRoot.displayName = 'Tile';
|
|
109
|
+
|
|
110
|
+
// =============================================================================
|
|
111
|
+
// SLOTS
|
|
112
|
+
// =============================================================================
|
|
113
|
+
|
|
114
|
+
const TileLeadingSlot = /*#__PURE__*/forwardRef(({
|
|
115
|
+
className,
|
|
116
|
+
style,
|
|
117
|
+
...props
|
|
118
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.LeadingSlot, {
|
|
119
|
+
ref: ref,
|
|
120
|
+
className: cn(tileLeadingSlotVariants(), className),
|
|
121
|
+
style: style,
|
|
122
|
+
...props
|
|
123
|
+
}));
|
|
124
|
+
TileLeadingSlot.displayName = 'Tile.LeadingSlot';
|
|
125
|
+
const TileContent = /*#__PURE__*/forwardRef(({
|
|
126
|
+
className,
|
|
127
|
+
style,
|
|
128
|
+
...props
|
|
129
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.Content, {
|
|
130
|
+
ref: ref,
|
|
131
|
+
className: cn(tileContentVariants(), className),
|
|
132
|
+
style: style,
|
|
133
|
+
...props
|
|
134
|
+
}));
|
|
135
|
+
TileContent.displayName = 'Tile.Content';
|
|
136
|
+
const TileTitle = /*#__PURE__*/forwardRef(({
|
|
137
|
+
className,
|
|
138
|
+
style,
|
|
139
|
+
numberOfLines = 1,
|
|
140
|
+
...props
|
|
141
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.Title, {
|
|
142
|
+
ref: ref,
|
|
143
|
+
className: cn(tileTitleVariants(), className),
|
|
144
|
+
style: style,
|
|
145
|
+
numberOfLines: numberOfLines,
|
|
146
|
+
...props
|
|
147
|
+
}));
|
|
148
|
+
TileTitle.displayName = 'Tile.Title';
|
|
149
|
+
const TileDescription = /*#__PURE__*/forwardRef(({
|
|
150
|
+
className,
|
|
151
|
+
style,
|
|
152
|
+
...props
|
|
153
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.Description, {
|
|
154
|
+
ref: ref,
|
|
155
|
+
className: cn(tileDescriptionVariants(), className),
|
|
156
|
+
style: style,
|
|
157
|
+
...props
|
|
158
|
+
}));
|
|
159
|
+
TileDescription.displayName = 'Tile.Description';
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Decorative selection affordance. Renders pure CVA-styled Views — no interactive hooks,
|
|
163
|
+
* no nested Pressable, zero runtime overhead. The Tile root owns the press target and
|
|
164
|
+
* ARIA role; this subtree is `aria-hidden` via `createTileIndicator`.
|
|
165
|
+
*
|
|
166
|
+
* The visual is inferred from the tile context: `single` (radio semantics) → radio ring,
|
|
167
|
+
* `multiple` (checkbox semantics) → checkbox square. An explicit `indicatorType` prop
|
|
168
|
+
* overrides — primarily for standalone tiles that want a radio-style visual.
|
|
169
|
+
*/
|
|
170
|
+
function TileIndicatorVisual({
|
|
171
|
+
indicatorType
|
|
172
|
+
}) {
|
|
173
|
+
const {
|
|
174
|
+
isSelected,
|
|
175
|
+
isDisabled,
|
|
176
|
+
selectionType
|
|
177
|
+
} = useTileContext();
|
|
178
|
+
const effectiveType = indicatorType ?? (selectionType === 'single' ? 'radio' : 'checkbox');
|
|
179
|
+
const stateAttrs = dataAttributes({
|
|
180
|
+
checked: isSelected,
|
|
181
|
+
disabled: isDisabled
|
|
182
|
+
});
|
|
183
|
+
if (effectiveType === 'radio') {
|
|
184
|
+
return /*#__PURE__*/_jsx(View, {
|
|
185
|
+
className: radioIndicatorVariants(),
|
|
186
|
+
...stateAttrs,
|
|
187
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
188
|
+
className: radioInnerDotVariants(),
|
|
189
|
+
...dataAttributes({
|
|
190
|
+
checked: isSelected,
|
|
191
|
+
invalid: false
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return /*#__PURE__*/_jsx(View, {
|
|
197
|
+
className: cn(checkboxIndicatorVariants()),
|
|
198
|
+
...stateAttrs,
|
|
199
|
+
children: isSelected && /*#__PURE__*/_jsx(Icon, {
|
|
200
|
+
as: Check,
|
|
201
|
+
className: checkboxIconVariants()
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const TileIndicator = /*#__PURE__*/forwardRef(({
|
|
206
|
+
className,
|
|
207
|
+
children,
|
|
208
|
+
style,
|
|
209
|
+
indicatorType,
|
|
210
|
+
...props
|
|
211
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.Indicator, {
|
|
212
|
+
ref: ref,
|
|
213
|
+
className: cn(tileIndicatorVariants(), className),
|
|
214
|
+
style: style,
|
|
215
|
+
indicatorType: indicatorType,
|
|
216
|
+
...props,
|
|
217
|
+
children: children ?? /*#__PURE__*/_jsx(TileIndicatorVisual, {
|
|
218
|
+
indicatorType: indicatorType
|
|
219
|
+
})
|
|
220
|
+
}));
|
|
221
|
+
TileIndicator.displayName = 'Tile.Indicator';
|
|
222
|
+
const TileTrailingSlot = /*#__PURE__*/forwardRef(({
|
|
223
|
+
className,
|
|
224
|
+
style,
|
|
225
|
+
...props
|
|
226
|
+
}, ref) => /*#__PURE__*/_jsx(TilePrimitive.TrailingSlot, {
|
|
227
|
+
ref: ref,
|
|
228
|
+
className: cn(tileTrailingSlotVariants(), className),
|
|
229
|
+
style: style,
|
|
230
|
+
...props
|
|
231
|
+
}));
|
|
232
|
+
TileTrailingSlot.displayName = 'Tile.TrailingSlot';
|
|
233
|
+
export const Tile = Object.assign(TileRoot, {
|
|
234
|
+
Group: TileGroup,
|
|
235
|
+
LeadingSlot: TileLeadingSlot,
|
|
236
|
+
Content: TileContent,
|
|
237
|
+
Title: TileTitle,
|
|
238
|
+
Description: TileDescription,
|
|
239
|
+
Indicator: TileIndicator,
|
|
240
|
+
TrailingSlot: TileTrailingSlot
|
|
241
|
+
});
|
|
242
|
+
export { useTileContext };
|
|
243
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["forwardRef","Pressable","Text","View","createTile","useTileContext","Check","dataAttributes","cn","useStyleContext","withStyleContext","checkboxIndicatorVariants","checkboxIconVariants","Icon","radioIndicatorVariants","radioInnerDotVariants","tileContentVariants","tileDescriptionVariants","tileGroupVariants","tileIndicatorVariants","tileLeadingSlotVariants","tileRootVariants","tileTitleVariants","tileTrailingSlotVariants","jsx","_jsx","TILE_SCOPE","TILE_GROUP_SCOPE","RootPressable","GroupView","useTileGroupStyleContext","ctx","TilePrimitive","Group","LeadingSlot","Content","Title","Description","Indicator","TrailingSlot","TileGroup","className","style","children","direction","spacing","shape","props","ref","context","displayName","TileRoot","shapeProp","showSeparator","inheritedShape","computedClassName","TileLeadingSlot","TileContent","TileTitle","numberOfLines","TileDescription","TileIndicatorVisual","indicatorType","isSelected","isDisabled","selectionType","effectiveType","stateAttrs","checked","disabled","invalid","as","TileIndicator","TileTrailingSlot","Tile","Object","assign"],"sourceRoot":"../../../../src","sources":["components/Tile/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAwB,OAAO;AAClD,SAASC,SAAS,EAAEC,IAAI,EAAEC,IAAI,QAAwC,cAAc;AACpF,SACEC,UAAU,EAOVC,cAAc,QACT,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,eAAe;AACrC,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,EAAE,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,eAAe;AACrE,SAASC,yBAAyB,EAAEC,oBAAoB,QAAQ,oBAAoB;AACpF,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,sBAAsB,EAAEC,qBAAqB,QAAQ,iBAAiB;AAC/E,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,iBAAiB,EACjBC,qBAAqB,EACrBC,uBAAuB,EACvBC,gBAAgB,EAChBC,iBAAiB,EACjBC,wBAAwB,QAGnB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,UAAU,GAAG,MAAM;AACzB,MAAMC,gBAAgB,GAAG,YAAY;AAErC,MAAMC,aAAa,GAAGlB,gBAAgB,CAACT,SAAS,EAAEyB,UAAU,C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AC,EAAEC,GAAG,kBAClCvB,IAAA,CAACO,aAAa,CAACO,YAAY;EACzBS,GAAG,EAAEA,GAAa;EAClBP,SAAS,EAAEjC,EAAE,CAACe,wBAAwB,CAAC,CAAC,EAAEkB,SAAS,CAAE;EACrDC,KAAK,EAAEA,KAAM;EAAA,GACTK;AAAK,CACV,CAEL,CAAC;AAED0B,gBAAgB,CAACvB,WAAW,GAAG,mBAAmB;AAYlD,OAAO,MAAMwB,IAAI,GAAGC,MAAM,CAACC,MAAM,CAACzB,QAAQ,EAAE;EAC1ClB,KAAK,EAAEO,SAAS;EAChBN,WAAW,EAAEsB,eAAe;EAC5BrB,OAAO,EAAEsB,WAAW;EACpBrB,KAAK,EAAEsB,SAAS;EAChBrB,WAAW,EAAEuB,eAAe;EAC5BtB,SAAS,EAAEkC,aAAa;EACxBjC,YAAY,EAAEkC;AAChB,CAAC,CAAiB;AAElB,SAASpE,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
6
|
+
export const tileGroupVariants = cva(['flex w-full'], {
|
|
7
|
+
variants: {
|
|
8
|
+
direction: {
|
|
9
|
+
column: 'flex-col',
|
|
10
|
+
row: 'flex-row'
|
|
11
|
+
},
|
|
12
|
+
spacing: {
|
|
13
|
+
default: 'gap-2',
|
|
14
|
+
none: 'gap-0'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
direction: 'column',
|
|
19
|
+
spacing: 'default'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export const tileRootVariants = cva(['flex-row self-stretch gap-3 px-4 py-3', 'data-[disabled=true]:opacity-50', TRANSITION_COLORS, Platform.select({
|
|
23
|
+
web: ['outline-none', 'data-[hover=true]:data-[disabled=false]:bg-surface-action-tint-hover', 'data-[active=true]:data-[disabled=false]:data-[hover=true]:bg-surface-action-tint-active', 'data-[hover=true]:data-[disabled=false]:data-[state=unselected]:border-stroke-action', 'focus-visible:data-[disabled=false]:ring-2 focus-visible:data-[disabled=false]:ring-stroke-focus focus-visible:data-[disabled=false]:ring-offset-2'].join(' '),
|
|
24
|
+
default: ['data-[active=true]:bg-surface-action-tint-hover', 'data-[active=true]:border-stroke-action'].join(' ')
|
|
25
|
+
})], {
|
|
26
|
+
variants: {
|
|
27
|
+
shape: {
|
|
28
|
+
flat: 'rounded-none border-0 bg-transparent',
|
|
29
|
+
card: ['rounded-[var(--border-radius-default)] border-1 border-solid', 'border-stroke-secondary', 'bg-surface-primary', 'data-[state=selected]:border-stroke-action', 'data-[state=selected]:border-1.5', 'data-[state=selected]:bg-surface-action-tint'].join(' ')
|
|
30
|
+
},
|
|
31
|
+
showSeparator: {
|
|
32
|
+
true: ['border-b border-solid border-stroke-secondary! native:data-[active=true]:border-stroke-secondary' // Override border-stroke-action on hover
|
|
33
|
+
],
|
|
34
|
+
false: ''
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
shape: 'card',
|
|
39
|
+
showSeparator: false
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export const tileLeadingSlotVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
43
|
+
export const tileTrailingSlotVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
44
|
+
export const tileContentVariants = cva(['min-w-0 flex-1 flex-col gap-0.5 no-underline']);
|
|
45
|
+
export const tileTitleVariants = cva(['text-base font-medium text-content-primary no-underline']);
|
|
46
|
+
export const tileDescriptionVariants = cva(['text-sm text-content-secondary no-underline']);
|
|
47
|
+
export const tileIndicatorVariants = cva(['flex shrink-0 items-center justify-center']);
|
|
48
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","cva","TRANSITION_COLORS","tileGroupVariants","variants","direction","column","row","spacing","default","none","defaultVariants","tileRootVariants","select","web","join","shape","flat","card","showSeparator","true","false","tileLeadingSlotVariants","tileTrailingSlotVariants","tileContentVariants","tileTitleVariants","tileDescriptionVariants","tileIndicatorVariants"],"sourceRoot":"../../../../src","sources":["components/Tile/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,OAAO,MAAMC,iBAAiB,GAAGF,GAAG,CAAC,CAAC,aAAa,CAAC,EAAE;EACpDG,QAAQ,EAAE;IACRC,SAAS,EAAE;MACTC,MAAM,EAAE,UAAU;MAClBC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE;MACPC,OAAO,EAAE,OAAO;MAChBC,IAAI,EAAE;IACR;EACF,CAAC;EACDC,eAAe,EAAE;IACfN,SAAS,EAAE,QAAQ;IACnBG,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAIF,OAAO,MAAMI,gBAAgB,GAAGX,GAAG,CACjC,CACE,uCAAuC,EACvC,iCAAiC,EACjCC,iBAAiB,EACjBF,QAAQ,CAACa,MAAM,CAAC;EACdC,GAAG,EAAE,CACH,cAAc,EACd,sEAAsE,EACtE,0FAA0F,EAC1F,sFAAsF,EACtF,oJAAoJ,CACrJ,CAACC,IAAI,CAAC,GAAG,CAAC;EACXN,OAAO,EAAE,CACP,iDAAiD,EACjD,yCAAyC,CAC1C,CAACM,IAAI,CAAC,GAAG;AACZ,CAAC,CAAC,CACH,EACD;EACEX,QAAQ,EAAE;IACRY,KAAK,EAAE;MACLC,IAAI,EAAE,sCAAsC;MAC5CC,IAAI,EAAE,CACJ,8DAA8D,EAC9D,yBAAyB,EACzB,oBAAoB,EACpB,4CAA4C,EAC5C,kCAAkC,EAClC,8CAA8C,CAC/C,CAACH,IAAI,CAAC,GAAG;IACZ,CAAC;IACDI,aAAa,EAAE;MACbC,IAAI,EAAE,CACJ,kGAAkG,CAAE;MAAA,CACrG;MACDC,KAAK,EAAE;IACT;EACF,CAAC;EACDV,eAAe,EAAE;IACfK,KAAK,EAAE,MAAM;IACbG,aAAa,EAAE;EACjB;AACF,CACF,CAAC;AAED,OAAO,MAAMG,uBAAuB,GAAGrB,GAAG,CAAC,CAAC,2CAA2C,CAAC,CAAC;AAEzF,OAAO,MAAMsB,wBAAwB,GAAGtB,GAAG,CAAC,CAAC,2CAA2C,CAAC,CAAC;AAE1F,OAAO,MAAMuB,mBAAmB,GAAGvB,GAAG,CAAC,CAAC,8CAA8C,CAAC,CAAC;AAExF,OAAO,MAAMwB,iBAAiB,GAAGxB,GAAG,CAAC,CAAC,yDAAyD,CAAC,CAAC;AAEjG,OAAO,MAAMyB,uBAAuB,GAAGzB,GAAG,CAAC,CAAC,6CAA6C,CAAC,CAAC;AAE3F,OAAO,MAAM0B,qBAAqB,GAAG1B,GAAG,CAAC,CAAC,2CAA2C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -15,11 +15,14 @@ export * from './Image';
|
|
|
15
15
|
export * from './Input';
|
|
16
16
|
export * from './OtpInput';
|
|
17
17
|
export * from './Link';
|
|
18
|
+
export * from './ListItem';
|
|
18
19
|
export * from './ProgressBar';
|
|
19
20
|
export * from './ProgressSegmented';
|
|
21
|
+
export * from './Radio';
|
|
20
22
|
export * from './Select';
|
|
21
23
|
export * from './VirtualizedList';
|
|
22
24
|
export * from './Switch';
|
|
25
|
+
export * from './Tile';
|
|
23
26
|
export { HStack, VStack } from './Stack';
|
|
24
27
|
export * from './Heading';
|
|
25
28
|
export * from './Text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--React-Native-Components?node-id=449-377
|
|
4
|
+
// source=packages/components/src/components/Avatar/index.tsx
|
|
5
|
+
// component=Avatar
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// size: 1:1 mapping between Figma and code values
|
|
10
|
+
const size = instance.getEnum('size', {
|
|
11
|
+
'2xs': '2xs',
|
|
12
|
+
xs: 'xs',
|
|
13
|
+
sm: 'sm',
|
|
14
|
+
md: 'md',
|
|
15
|
+
lg: 'lg',
|
|
16
|
+
xl: 'xl',
|
|
17
|
+
'2xl': '2xl'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// type: VARIANT — determines which Avatar sub-component to render.
|
|
21
|
+
// Not a code prop; used only to choose Avatar.Image, Avatar.Text, or Avatar.Icon.
|
|
22
|
+
const type = instance.getEnum('type', {
|
|
23
|
+
image: 'image',
|
|
24
|
+
text: 'text',
|
|
25
|
+
icon: 'icon'
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// icon: INSTANCE_SWAP → Avatar.Icon `as` prop (CdxIcon identifier).
|
|
29
|
+
// Prefer metadata.props.componentName exposed by icon Code Connect templates.
|
|
30
|
+
// Falls back to executeTemplate().example (placeholder pill) when the icon lacks Code Connect.
|
|
31
|
+
const iconResult = instance.getInstanceSwap('icon')?.executeTemplate();
|
|
32
|
+
const iconName = iconResult?.metadata?.props?.componentName;
|
|
33
|
+
const iconSnippet = iconName ?? iconResult?.example;
|
|
34
|
+
const iconImports = iconName ? [`import { ${iconName} } from '@cdx-ui/icons'`] : [];
|
|
35
|
+
|
|
36
|
+
// text: TEXT property — the initials or label rendered inside Avatar.Text
|
|
37
|
+
const textContent = instance.getString('text');
|
|
38
|
+
export default {
|
|
39
|
+
id: 'avatar',
|
|
40
|
+
imports: ["import { Avatar } from '@cdx-ui/components'", ...iconImports],
|
|
41
|
+
example: figma.code`
|
|
42
|
+
<Avatar size="${size}">
|
|
43
|
+
${type === 'image' ? figma.code`<Avatar.Image src="..." />` : null}
|
|
44
|
+
${type === 'text' ? figma.code`<Avatar.Text>${textContent}</Avatar.Text>` : null}
|
|
45
|
+
${type === 'icon' ? figma.code`<Avatar.Icon as={${iconSnippet}} />` : null}
|
|
46
|
+
</Avatar>`
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=Avatar.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","size","getEnum","xs","sm","md","lg","xl","type","image","text","icon","iconResult","getInstanceSwap","executeTemplate","iconName","metadata","props","componentName","iconSnippet","example","iconImports","textContent","getString","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Avatar.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,IAAI,GAAGF,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE;EACpC,KAAK,EAAE,KAAK;EACZC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACR,KAAK,EAAE;AACT,CAAC,CAAC;;AAEF;AACA;AACA,MAAMC,IAAI,GAAGT,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE;EACpCO,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AACA;AACA,MAAMC,UAAU,GAAGb,QAAQ,CAACc,eAAe,CAAC,MAAM,CAAC,EAAEC,eAAe,CAAC,CAAC;AACtE,MAAMC,QAAQ,GAAGH,UAAU,EAAEI,QAAQ,EAAEC,KAAK,EAAEC,aAAmC;AACjF,MAAMC,WAAW,GAAGJ,QAAQ,IAAIH,UAAU,EAAEQ,OAAO;AAEnD,MAAMC,WAAW,GAAGN,QAAQ,GAAG,CAAC,YAAYA,QAAQ,yBAAyB,CAAC,GAAG,EAAE;;AAEnF;AACA,MAAMO,WAAW,GAAGvB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