@cdx-ui/components 0.0.1-beta.23 → 0.0.1-beta.25
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/lib/commonjs/components/Button/styles.js +1 -1
- package/lib/commonjs/components/Card/index.js +7 -1
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/Card/styles.js +12 -2
- 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/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/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/Radio/index.js +3 -1
- package/lib/commonjs/components/Radio/index.js.map +1 -1
- package/lib/commonjs/components/Radio/styles.js +6 -5
- package/lib/commonjs/components/Radio/styles.js.map +1 -1
- 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/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/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/Select.figma.js +53 -0
- package/lib/commonjs/figma/Select.figma.js.map +1 -0
- package/lib/module/components/Button/styles.js +1 -1
- package/lib/module/components/Card/index.js +7 -1
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Card/styles.js +12 -2
- 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/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/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/Radio/index.js +3 -1
- package/lib/module/components/Radio/index.js.map +1 -1
- package/lib/module/components/Radio/styles.js +6 -6
- package/lib/module/components/Radio/styles.js.map +1 -1
- 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/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/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/Select.figma.js +47 -0
- package/lib/module/figma/Select.figma.js.map +1 -0
- package/lib/typescript/components/Card/index.d.ts +2 -2
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Card/styles.d.ts +4 -1
- 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/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/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/Radio/index.d.ts.map +1 -1
- package/lib/typescript/components/Radio/styles.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/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/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/Select.figma.d.ts +8 -0
- package/lib/typescript/figma/Select.figma.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/Button/styles.ts +1 -1
- package/src/components/Card/index.tsx +9 -4
- package/src/components/Card/styles.ts +15 -3
- package/src/components/Checkbox/index.tsx +8 -19
- package/src/components/Checkbox/styles.ts +82 -84
- 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/IconButton/index.tsx +3 -2
- package/src/components/IconButton/styles.ts +135 -9
- package/src/components/Input/styles.ts +12 -7
- package/src/components/Radio/index.tsx +2 -1
- package/src/components/Radio/styles.ts +11 -11
|
@@ -7,7 +7,7 @@ export type BaseFieldLabelProps = ViewProps & {
|
|
|
7
7
|
htmlFor?: string;
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
/** @platform native — ignored on DOM `<label>`; set by form primitive for Uniwind. */
|
|
10
|
-
dataSet?: Record<string, string>;
|
|
10
|
+
dataSet?: Record<string, boolean | string>;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
/** Real `<label>` so clicking the label focuses the associated control (`htmlFor` → input `id`). */
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
IFieldLabelProps,
|
|
9
9
|
type IFieldRootProps,
|
|
10
10
|
} from '@cdx-ui/primitives';
|
|
11
|
-
import { cn } from '@cdx-ui/utils';
|
|
11
|
+
import { cn, useFormControlContext } from '@cdx-ui/utils';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
13
13
|
import { BaseFieldLabel } from './FieldLabel';
|
|
14
14
|
import {
|
|
@@ -70,7 +70,14 @@ export interface FieldLabelProps extends IFieldLabelProps, FieldLabelVariantProp
|
|
|
70
70
|
|
|
71
71
|
const FieldLabel = forwardRef<View, FieldLabelProps>(
|
|
72
72
|
({ className, children, style, htmlFor, ...props }, ref) => {
|
|
73
|
-
const
|
|
73
|
+
const { isLabelFocused, isInvalid } = useFormControlContext();
|
|
74
|
+
// Native: inject text-content-action via context (group-has CSS handles web).
|
|
75
|
+
// native: prefix keeps this class inert on web so it never conflicts with text-content-primary.
|
|
76
|
+
const labelClassName = cn(
|
|
77
|
+
fieldLabelVariants(),
|
|
78
|
+
isLabelFocused && !isInvalid && 'native:text-content-action',
|
|
79
|
+
className,
|
|
80
|
+
);
|
|
74
81
|
|
|
75
82
|
return (
|
|
76
83
|
<FieldPrimitive.Label
|
|
@@ -79,7 +86,7 @@ const FieldLabel = forwardRef<View, FieldLabelProps>(
|
|
|
79
86
|
style={style}
|
|
80
87
|
htmlFor={htmlFor}
|
|
81
88
|
requiredIndicator={
|
|
82
|
-
<Text className="text-
|
|
89
|
+
<Text className="text-content-danger" aria-hidden>
|
|
83
90
|
{' *'}
|
|
84
91
|
</Text>
|
|
85
92
|
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { DISABLED_OPACITY } from '../../styles/primitives';
|
|
3
3
|
|
|
4
|
-
export const fieldRootVariants = cva(['flex-col gap-2', 'web:last:mb-0', DISABLED_OPACITY]);
|
|
4
|
+
export const fieldRootVariants = cva(['group flex-col gap-2', 'web:last:mb-0', DISABLED_OPACITY]);
|
|
5
5
|
|
|
6
6
|
export const fieldLabelVariants = cva([
|
|
7
7
|
'body-md',
|
|
8
8
|
'font-medium',
|
|
9
9
|
'text-content-primary',
|
|
10
10
|
'flex-row items-center',
|
|
11
|
-
|
|
11
|
+
'overflow-hidden',
|
|
12
12
|
'web:cursor-pointer',
|
|
13
|
+
'web:group-has-[[data-focus=true]]:data-[invalid=false]:text-content-action',
|
|
13
14
|
'data-[invalid=true]:text-content-danger',
|
|
14
15
|
]);
|
|
15
16
|
|
|
16
|
-
export const fieldHelperVariants = cva(['flex-row items-center']);
|
|
17
|
+
export const fieldHelperVariants = cva(['flex-row items-center min-h-4']);
|
|
17
18
|
|
|
18
19
|
export const fieldHelperTextVariants = cva(['body-sm', 'text-content-tertiary']);
|
|
19
20
|
|
|
20
|
-
export const fieldErrorVariants = cva(['flex-row items-center gap-
|
|
21
|
+
export const fieldErrorVariants = cva(['flex-row items-center gap-0.5 min-h-4']);
|
|
21
22
|
|
|
22
23
|
export const fieldErrorTextVariants = cva(['body-sm', 'text-content-danger']);
|
|
23
24
|
|
|
@@ -53,6 +53,7 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
|
|
|
53
53
|
(
|
|
54
54
|
{
|
|
55
55
|
variant = 'solid',
|
|
56
|
+
color = 'neutral',
|
|
56
57
|
size = 'default',
|
|
57
58
|
className,
|
|
58
59
|
style,
|
|
@@ -63,11 +64,11 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
|
|
|
63
64
|
},
|
|
64
65
|
ref,
|
|
65
66
|
) => {
|
|
66
|
-
const rootClassName = cn(iconButtonRootVariants({ variant, size }), className);
|
|
67
|
+
const rootClassName = cn(iconButtonRootVariants({ variant, color, size }), className);
|
|
67
68
|
|
|
68
69
|
const glyphClassName = cn(
|
|
69
70
|
iconButtonGlyphVariants({ size }),
|
|
70
|
-
iconButtonIconColorVariants(),
|
|
71
|
+
iconButtonIconColorVariants({ variant, color }),
|
|
71
72
|
iconClassName,
|
|
72
73
|
);
|
|
73
74
|
|
|
@@ -10,33 +10,131 @@ export const iconButtonRootVariants = cva(
|
|
|
10
10
|
TRANSITION_COLORS,
|
|
11
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,7 +3,7 @@ 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
8
|
'border-solid border-[length:var(--border-width-default)] border-stroke-primary',
|
|
9
9
|
'rounded-[var(--border-radius-default)]',
|
|
@@ -24,11 +24,16 @@ export const inputRootVariants = cva(
|
|
|
24
24
|
outline: [],
|
|
25
25
|
},
|
|
26
26
|
size: {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
default: [
|
|
28
|
+
'h-11 min-h-11 px-4 py-3 gap-4',
|
|
29
|
+
// Subtract one hairline from padding when focused so the wider focus border doesn’t shift layout.
|
|
30
|
+
'data-[focus=true]:px-[calc(var(--spacing-4)-var(--spacing-px))]',
|
|
31
|
+
'data-[focus=true]:py-[calc(var(--spacing-3)-var(--spacing-px))]',
|
|
32
|
+
],
|
|
29
33
|
small: [
|
|
30
|
-
'h-8 px-3 py-
|
|
31
|
-
'data-[focus=true]:px-[
|
|
34
|
+
'h-8 min-h-8 px-3 py-2 gap-1.5',
|
|
35
|
+
'data-[focus=true]:px-[calc(var(--spacing-3)-var(--spacing-px))]',
|
|
36
|
+
'data-[focus=true]:py-[calc(var(--spacing-2)-var(--spacing-px))]',
|
|
32
37
|
],
|
|
33
38
|
},
|
|
34
39
|
},
|
|
@@ -42,7 +47,7 @@ export const inputRootVariants = cva(
|
|
|
42
47
|
export const inputFieldVariants = cva(
|
|
43
48
|
[
|
|
44
49
|
'flex-1 justify-center bg-transparent p-0',
|
|
45
|
-
'
|
|
50
|
+
'text-content-primary',
|
|
46
51
|
'placeholder:text-content-tertiary',
|
|
47
52
|
'web:outline-none',
|
|
48
53
|
'tracking-normal',
|
|
@@ -60,7 +65,7 @@ export const inputFieldVariants = cva(
|
|
|
60
65
|
},
|
|
61
66
|
);
|
|
62
67
|
|
|
63
|
-
export const inputSlotVariants = cva(['items-center justify-center self-center']);
|
|
68
|
+
export const inputSlotVariants = cva(['items-center justify-center self-center shrink-0']);
|
|
64
69
|
|
|
65
70
|
export const inputIconVariants = cva(['text-content-tertiary'], {
|
|
66
71
|
variants: {
|
|
@@ -21,12 +21,13 @@ const RadioIndicatorBase = forwardRef<View, ViewProps & { className?: string }>(
|
|
|
21
21
|
const ds = (props as any).dataSet;
|
|
22
22
|
const isChecked = ds ? ds.checked === true : (props as any)['data-checked'] === 'true';
|
|
23
23
|
const isInvalid = ds ? ds.invalid === true : (props as any)['data-invalid'] === 'true';
|
|
24
|
+
const isHovered = ds ? ds.hover === true : (props as any)['data-hover'] === 'true';
|
|
24
25
|
|
|
25
26
|
return (
|
|
26
27
|
<View ref={ref} className={cn(radioIndicatorVariants(), className)} style={style} {...props}>
|
|
27
28
|
<View
|
|
28
29
|
className={cn(radioInnerDotVariants())}
|
|
29
|
-
{...dataAttributes({ checked: isChecked, invalid: isInvalid })}
|
|
30
|
+
{...dataAttributes({ checked: isChecked, invalid: isInvalid, hover: isHovered })}
|
|
30
31
|
/>
|
|
31
32
|
{children}
|
|
32
33
|
</View>
|
|
@@ -2,8 +2,6 @@ import { Platform } from 'react-native';
|
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
3
|
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
4
4
|
|
|
5
|
-
// TODO: Add hover, active, and focus-visible styles based on Figma
|
|
6
|
-
|
|
7
5
|
export const radioRootVariants = cva([
|
|
8
6
|
'flex-row items-center gap-2',
|
|
9
7
|
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
@@ -15,23 +13,18 @@ export const radioIndicatorVariants = cva([
|
|
|
15
13
|
'rounded-[var(--border-radius-round)]',
|
|
16
14
|
'border-[length:var(--border-width-selected)]',
|
|
17
15
|
'h-5 w-5',
|
|
18
|
-
'border-stroke-primary',
|
|
19
|
-
'data-[checked=false]:border-slate-300',
|
|
20
16
|
'bg-surface-primary',
|
|
17
|
+
'data-[checked=false]:border-content-secondary',
|
|
21
18
|
'data-[checked=true]:border-stroke-action',
|
|
22
19
|
'data-[invalid=true]:border-stroke-danger',
|
|
23
20
|
'data-[checked=true]:data-[invalid=true]:border-stroke-danger',
|
|
24
21
|
Platform.select({
|
|
25
22
|
web: [
|
|
26
23
|
TRANSITION_COLORS,
|
|
27
|
-
'data-[hover=true]:data-[checked=
|
|
28
|
-
'data-[hover=true]:data-[
|
|
24
|
+
'data-[hover=true]:data-[checked=true]:border-surface-action-strong-hover',
|
|
25
|
+
'data-[hover=true]:data-[invalid=true]:border-surface-danger-strong-hover',
|
|
29
26
|
'web:data-[focus-visible=true]:outline-none',
|
|
30
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-offset-2',
|
|
31
|
-
'web:data-[focus-visible=true]:data-[checked=false]:ring-slate-400/50',
|
|
32
|
-
'web:data-[focus-visible=true]:data-[checked=true]:ring-stroke-focus',
|
|
33
|
-
'data-[invalid=true]:data-[hover=true]:border-stroke-danger',
|
|
34
|
-
'web:data-[invalid=true]:data-[focus-visible=true]:ring-stroke-danger',
|
|
27
|
+
'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',
|
|
35
28
|
].join(' '),
|
|
36
29
|
default: '',
|
|
37
30
|
}),
|
|
@@ -44,6 +37,13 @@ export const radioInnerDotVariants = cva([
|
|
|
44
37
|
'data-[checked=true]:scale-100',
|
|
45
38
|
'bg-surface-action-strong',
|
|
46
39
|
'data-[invalid=true]:bg-surface-danger-strong',
|
|
40
|
+
Platform.select({
|
|
41
|
+
web: [
|
|
42
|
+
'data-[hover=true]:bg-surface-action-strong-hover',
|
|
43
|
+
'data-[hover=true]:data-[invalid=true]:bg-surface-danger-strong-hover',
|
|
44
|
+
].join(' '),
|
|
45
|
+
default: '',
|
|
46
|
+
}),
|
|
47
47
|
]);
|
|
48
48
|
|
|
49
49
|
export const radioLabelVariants = cva(['body-md', 'text-content-primary']);
|