@cdx-ui/components 0.0.1-alpha.32 → 0.0.1-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commonjs/components/Button/index.js +4 -11
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +148 -112
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/Heading/styles.js +6 -7
- package/lib/commonjs/components/Heading/styles.js.map +1 -1
- package/lib/commonjs/components/IconButton/index.js +2 -7
- package/lib/commonjs/components/IconButton/index.js.map +1 -1
- package/lib/commonjs/components/IconButton/styles.js +15 -62
- package/lib/commonjs/components/IconButton/styles.js.map +1 -1
- package/lib/commonjs/components/Input/styles.js +10 -9
- package/lib/commonjs/components/Input/styles.js.map +1 -1
- package/lib/commonjs/components/Link/styles.js +5 -7
- package/lib/commonjs/components/Link/styles.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +6 -7
- package/lib/commonjs/components/Text/styles.js.map +1 -1
- package/lib/module/components/Button/index.js +4 -11
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +149 -112
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/Heading/styles.js +6 -7
- package/lib/module/components/Heading/styles.js.map +1 -1
- package/lib/module/components/IconButton/index.js +2 -7
- package/lib/module/components/IconButton/index.js.map +1 -1
- package/lib/module/components/IconButton/styles.js +16 -63
- package/lib/module/components/IconButton/styles.js.map +1 -1
- package/lib/module/components/Input/styles.js +11 -10
- package/lib/module/components/Input/styles.js.map +1 -1
- package/lib/module/components/Link/styles.js +6 -7
- package/lib/module/components/Link/styles.js.map +1 -1
- package/lib/module/components/Text/styles.js +6 -7
- package/lib/module/components/Text/styles.js.map +1 -1
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +3 -6
- package/lib/typescript/components/Button/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/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 +1 -6
- package/lib/typescript/components/IconButton/styles.d.ts.map +1 -1
- package/lib/typescript/components/Input/styles.d.ts.map +1 -1
- package/lib/typescript/components/Link/styles.d.ts +2 -0
- package/lib/typescript/components/Link/styles.d.ts.map +1 -1
- package/lib/typescript/components/Text/styles.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Button/index.tsx +6 -10
- package/src/components/Button/styles.ts +127 -138
- package/src/components/Heading/styles.tsx +6 -7
- package/src/components/IconButton/index.tsx +2 -3
- package/src/components/IconButton/styles.ts +18 -90
- package/src/components/Input/styles.ts +26 -35
- package/src/components/Link/styles.ts +12 -11
- package/src/components/Text/styles.tsx +6 -7
- package/lib/commonjs/components/Button/buttonSharedVariants.js +0 -200
- package/lib/commonjs/components/Button/buttonSharedVariants.js.map +0 -1
- package/lib/module/components/Button/buttonSharedVariants.js +0 -195
- package/lib/module/components/Button/buttonSharedVariants.js.map +0 -1
- package/lib/typescript/components/Button/buttonSharedVariants.d.ts +0 -29
- package/lib/typescript/components/Button/buttonSharedVariants.d.ts.map +0 -1
- package/src/components/Button/buttonSharedVariants.ts +0 -281
|
@@ -1,69 +1,25 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
4
|
-
COLOR_BORDER_DEFAULT,
|
|
5
|
-
DISABLED_CURSOR,
|
|
6
|
-
DISABLED_OPACITY,
|
|
7
|
-
RADIUS_SM,
|
|
8
|
-
TRANSITION_COLORS,
|
|
9
|
-
} from '../../styles/primitives';
|
|
10
|
-
import {
|
|
11
|
-
sharedFilledForegroundTextCompounds,
|
|
12
|
-
sharedFilledSurfaceCompounds,
|
|
13
|
-
sharedGhostSurfaceCompounds,
|
|
14
|
-
sharedOutlineGhostForegroundTextCompounds,
|
|
15
|
-
} from './buttonSharedVariants';
|
|
3
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
16
4
|
|
|
17
|
-
|
|
18
|
-
variant: 'strong' as const,
|
|
19
|
-
...c,
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
const buttonGhostSurfaceCompounds = sharedGhostSurfaceCompounds.map((c) => ({
|
|
23
|
-
variant: 'ghost' as const,
|
|
24
|
-
...c,
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
const buttonStrongForegroundTextCompounds = sharedFilledForegroundTextCompounds.map((c) => ({
|
|
28
|
-
variant: 'strong' as const,
|
|
29
|
-
...c,
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
const buttonOutlineGhostForegroundTextCompounds = sharedOutlineGhostForegroundTextCompounds.map(
|
|
33
|
-
(c) => ({
|
|
34
|
-
variant: ['outline', 'ghost'] as ('outline' | 'ghost')[],
|
|
35
|
-
...c,
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// TODO: Split into 2 files
|
|
40
|
-
// TODO: Create cva wrapper
|
|
5
|
+
// TODO: Validate that `dark:` syntax works with Uniwind `ScopedTheme`
|
|
41
6
|
|
|
42
7
|
export const buttonRootVariants = cva(
|
|
43
8
|
[
|
|
44
9
|
'flex-row items-center justify-center',
|
|
45
|
-
|
|
10
|
+
'rounded-[var(--border-radius-button)]',
|
|
46
11
|
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
47
12
|
TRANSITION_COLORS,
|
|
48
|
-
|
|
13
|
+
'data-[disabled=true]:opacity-[--opacity-disabled]',
|
|
49
14
|
DISABLED_CURSOR,
|
|
50
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-
|
|
15
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[--color-stroke-focus] web:data-[focus-visible=true]:ring-offset-2',
|
|
51
16
|
],
|
|
52
17
|
{
|
|
53
18
|
variants: {
|
|
54
19
|
variant: {
|
|
55
|
-
strong: [],
|
|
56
|
-
outline: [
|
|
57
|
-
|
|
58
|
-
`border ${COLOR_BORDER_DEFAULT}`,
|
|
59
|
-
'data-[hover=true]:bg-slate-50',
|
|
60
|
-
'data-[active=true]:bg-slate-100',
|
|
61
|
-
],
|
|
62
|
-
ghost: [
|
|
63
|
-
'bg-transparent',
|
|
64
|
-
'data-[hover=true]:bg-slate-50',
|
|
65
|
-
'data-[active=true]:bg-slate-100',
|
|
66
|
-
],
|
|
20
|
+
strong: ['border-b-1 border-black/75'], // TODO: Replace with token
|
|
21
|
+
outline: ['bg-transparent', 'border border-stroke-primary'],
|
|
22
|
+
ghost: ['bg-transparent'],
|
|
67
23
|
},
|
|
68
24
|
color: {
|
|
69
25
|
action: [],
|
|
@@ -76,145 +32,182 @@ export const buttonRootVariants = cva(
|
|
|
76
32
|
default: 'h-10 px-4 gap-2',
|
|
77
33
|
small: 'h-8 px-3 gap-1.5',
|
|
78
34
|
},
|
|
79
|
-
mode: {
|
|
80
|
-
light: [],
|
|
81
|
-
dark: [],
|
|
82
|
-
},
|
|
83
35
|
fullWidth: {
|
|
84
36
|
true: 'w-full',
|
|
85
37
|
false: '',
|
|
86
38
|
},
|
|
87
39
|
},
|
|
88
40
|
compoundVariants: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// --- outline × color (light mode) ---
|
|
41
|
+
// ── strong × color (filled surface) ──────────────────────────────
|
|
92
42
|
{
|
|
93
|
-
variant: '
|
|
43
|
+
variant: 'strong',
|
|
94
44
|
color: 'action',
|
|
95
45
|
className: [
|
|
96
|
-
'
|
|
46
|
+
'bg-surface-action-strong',
|
|
97
47
|
Platform.select({
|
|
98
|
-
default: 'data-[active=true]:
|
|
99
|
-
web: 'data-[hover=true]:
|
|
48
|
+
default: 'data-[active=true]:bg-surface-action-strong-active',
|
|
49
|
+
web: 'data-[hover=true]:bg-surface-action-strong-hover data-[active=true]:data-[hover=true]:bg-surface-action-strong-active',
|
|
100
50
|
}),
|
|
101
51
|
],
|
|
102
52
|
},
|
|
103
53
|
{
|
|
104
|
-
variant: '
|
|
54
|
+
variant: 'strong',
|
|
105
55
|
color: 'danger',
|
|
106
56
|
className: [
|
|
107
|
-
'
|
|
57
|
+
'bg-surface-danger-strong',
|
|
108
58
|
Platform.select({
|
|
109
|
-
default: 'data-[active=true]:
|
|
110
|
-
web: 'data-[hover=true]:
|
|
59
|
+
default: 'data-[active=true]:bg-surface-danger-strong-active',
|
|
60
|
+
web: 'data-[hover=true]:bg-surface-danger-strong-hover data-[active=true]:data-[hover=true]:bg-surface-danger-strong-active',
|
|
111
61
|
}),
|
|
112
62
|
],
|
|
113
63
|
},
|
|
114
64
|
{
|
|
115
|
-
variant: '
|
|
65
|
+
variant: 'strong',
|
|
116
66
|
color: 'warning',
|
|
117
67
|
className: [
|
|
118
|
-
'
|
|
68
|
+
'bg-surface-warning-strong',
|
|
119
69
|
Platform.select({
|
|
120
|
-
default: 'data-[active=true]:
|
|
121
|
-
web: 'data-[hover=true]:
|
|
70
|
+
default: 'data-[active=true]:bg-amber-600',
|
|
71
|
+
web: 'data-[hover=true]:bg-amber-500 data-[active=true]:data-[hover=true]:bg-amber-600',
|
|
122
72
|
}),
|
|
123
73
|
],
|
|
124
74
|
},
|
|
125
75
|
{
|
|
126
|
-
variant: '
|
|
76
|
+
variant: 'strong',
|
|
127
77
|
color: 'success',
|
|
128
78
|
className: [
|
|
129
|
-
'
|
|
79
|
+
'bg-surface-success-strong',
|
|
130
80
|
Platform.select({
|
|
131
|
-
default: 'data-[active=true]:
|
|
132
|
-
web: 'data-[hover=true]:
|
|
81
|
+
default: 'data-[active=true]:bg-green-800',
|
|
82
|
+
web: 'data-[hover=true]:bg-green-700 data-[active=true]:data-[hover=true]:bg-green-800',
|
|
133
83
|
}),
|
|
134
84
|
],
|
|
135
85
|
},
|
|
136
86
|
{
|
|
137
|
-
variant: '
|
|
87
|
+
variant: 'strong',
|
|
138
88
|
color: 'info',
|
|
139
89
|
className: [
|
|
140
|
-
'
|
|
90
|
+
'bg-surface-info-strong',
|
|
141
91
|
Platform.select({
|
|
142
|
-
default: 'data-[active=true]:
|
|
143
|
-
web: 'data-[hover=true]:
|
|
92
|
+
default: 'data-[active=true]:bg-sky-700',
|
|
93
|
+
web: 'data-[hover=true]:bg-sky-600 data-[active=true]:data-[hover=true]:bg-sky-700',
|
|
144
94
|
}),
|
|
145
95
|
],
|
|
146
96
|
},
|
|
147
97
|
|
|
148
|
-
//
|
|
98
|
+
// ── outline × color (border + hover/active surface) ─────────────
|
|
149
99
|
{
|
|
150
100
|
variant: 'outline',
|
|
151
101
|
color: 'action',
|
|
152
|
-
mode: 'dark',
|
|
153
102
|
className: [
|
|
154
|
-
'
|
|
103
|
+
'border-stroke-action',
|
|
155
104
|
Platform.select({
|
|
156
|
-
default: 'data-[active=true]:bg-
|
|
157
|
-
web: 'data-[hover=true]:bg-
|
|
105
|
+
default: 'data-[active=true]:bg-surface-action-subtle-active',
|
|
106
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-subtle-active',
|
|
158
107
|
}),
|
|
159
108
|
],
|
|
160
109
|
},
|
|
161
|
-
// --- outline × semantic colors × mode: dark ---
|
|
162
110
|
{
|
|
163
111
|
variant: 'outline',
|
|
164
112
|
color: 'danger',
|
|
165
|
-
mode: 'dark',
|
|
166
113
|
className: [
|
|
167
|
-
'
|
|
114
|
+
'border-stroke-danger',
|
|
168
115
|
Platform.select({
|
|
169
|
-
default: 'data-[active=true]:bg-
|
|
170
|
-
web: 'data-[hover=true]:bg-
|
|
116
|
+
default: 'data-[active=true]:bg-surface-danger-subtle-active',
|
|
117
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-subtle-active',
|
|
171
118
|
}),
|
|
172
119
|
],
|
|
173
120
|
},
|
|
174
121
|
{
|
|
175
122
|
variant: 'outline',
|
|
176
123
|
color: 'warning',
|
|
177
|
-
mode: 'dark',
|
|
178
124
|
className: [
|
|
179
|
-
'
|
|
125
|
+
'border-stroke-warning',
|
|
180
126
|
Platform.select({
|
|
181
|
-
default: 'data-[active=true]:bg-
|
|
182
|
-
web: 'data-[hover=true]:bg-
|
|
127
|
+
default: 'data-[active=true]:bg-surface-warning-subtle',
|
|
128
|
+
web: 'data-[hover=true]:bg-surface-warning-tint data-[active=true]:data-[hover=true]:bg-surface-warning-subtle',
|
|
183
129
|
}),
|
|
184
130
|
],
|
|
185
131
|
},
|
|
186
132
|
{
|
|
187
133
|
variant: 'outline',
|
|
188
134
|
color: 'success',
|
|
189
|
-
mode: 'dark',
|
|
190
135
|
className: [
|
|
191
|
-
'
|
|
136
|
+
'border-stroke-success',
|
|
192
137
|
Platform.select({
|
|
193
|
-
default: 'data-[active=true]:bg-
|
|
194
|
-
web: 'data-[hover=true]:bg-
|
|
138
|
+
default: 'data-[active=true]:bg-surface-success-subtle',
|
|
139
|
+
web: 'data-[hover=true]:bg-surface-success-tint data-[active=true]:data-[hover=true]:bg-surface-success-subtle',
|
|
195
140
|
}),
|
|
196
141
|
],
|
|
197
142
|
},
|
|
198
143
|
{
|
|
199
144
|
variant: 'outline',
|
|
200
145
|
color: 'info',
|
|
201
|
-
mode: 'dark',
|
|
202
146
|
className: [
|
|
203
|
-
'
|
|
147
|
+
'border-stroke-info',
|
|
204
148
|
Platform.select({
|
|
205
|
-
default: 'data-[active=true]:bg-
|
|
206
|
-
web: 'data-[hover=true]:bg-
|
|
149
|
+
default: 'data-[active=true]:bg-surface-info-subtle',
|
|
150
|
+
web: 'data-[hover=true]:bg-surface-info-tint data-[active=true]:data-[hover=true]:bg-surface-info-subtle',
|
|
207
151
|
}),
|
|
208
152
|
],
|
|
209
153
|
},
|
|
210
154
|
|
|
211
|
-
|
|
155
|
+
// ── ghost × color (hover/active surface fills) ──────────────────
|
|
156
|
+
{
|
|
157
|
+
variant: 'ghost',
|
|
158
|
+
color: 'action',
|
|
159
|
+
className: [
|
|
160
|
+
Platform.select({
|
|
161
|
+
default: 'data-[active=true]:bg-surface-action-subtle-active',
|
|
162
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-subtle-active',
|
|
163
|
+
}),
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
variant: 'ghost',
|
|
168
|
+
color: 'danger',
|
|
169
|
+
className: [
|
|
170
|
+
Platform.select({
|
|
171
|
+
default: 'data-[active=true]:bg-surface-danger-subtle-active',
|
|
172
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-subtle-active',
|
|
173
|
+
}),
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
variant: 'ghost',
|
|
178
|
+
color: 'warning',
|
|
179
|
+
className: [
|
|
180
|
+
Platform.select({
|
|
181
|
+
default: 'data-[active=true]:bg-surface-warning-subtle',
|
|
182
|
+
web: 'data-[hover=true]:bg-surface-warning-tint data-[active=true]:data-[hover=true]:bg-surface-warning-subtle',
|
|
183
|
+
}),
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
variant: 'ghost',
|
|
188
|
+
color: 'success',
|
|
189
|
+
className: [
|
|
190
|
+
Platform.select({
|
|
191
|
+
default: 'data-[active=true]:bg-surface-success-subtle',
|
|
192
|
+
web: 'data-[hover=true]:bg-surface-success-tint data-[active=true]:data-[hover=true]:bg-surface-success-subtle',
|
|
193
|
+
}),
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
variant: 'ghost',
|
|
198
|
+
color: 'info',
|
|
199
|
+
className: [
|
|
200
|
+
Platform.select({
|
|
201
|
+
default: 'data-[active=true]:bg-surface-info-subtle',
|
|
202
|
+
web: 'data-[hover=true]:bg-surface-info-tint data-[active=true]:data-[hover=true]:bg-surface-info-subtle',
|
|
203
|
+
}),
|
|
204
|
+
],
|
|
205
|
+
},
|
|
212
206
|
],
|
|
213
207
|
defaultVariants: {
|
|
214
208
|
variant: 'strong',
|
|
215
209
|
color: 'action',
|
|
216
210
|
size: 'default',
|
|
217
|
-
mode: 'light',
|
|
218
211
|
fullWidth: false,
|
|
219
212
|
},
|
|
220
213
|
},
|
|
@@ -238,27 +231,33 @@ export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
|
238
231
|
default: 'text-base',
|
|
239
232
|
small: 'text-sm',
|
|
240
233
|
},
|
|
241
|
-
mode: {
|
|
242
|
-
light: [],
|
|
243
|
-
dark: [],
|
|
244
|
-
},
|
|
245
234
|
},
|
|
246
235
|
compoundVariants: [
|
|
247
|
-
|
|
248
|
-
|
|
236
|
+
// ── strong × color (filled foreground text) ──────────────────────
|
|
237
|
+
{ variant: 'strong', color: 'action', className: 'text-content-action-on-strong' },
|
|
238
|
+
{ variant: 'strong', color: 'danger', className: 'text-content-danger-on-strong' },
|
|
239
|
+
{ variant: 'strong', color: 'warning', className: 'text-content-warning-on-strong' },
|
|
240
|
+
{ variant: 'strong', color: 'success', className: 'text-content-success-on-strong' },
|
|
241
|
+
{ variant: 'strong', color: 'info', className: 'text-content-info-on-strong' },
|
|
242
|
+
|
|
243
|
+
// ── outline/ghost × color (transparent foreground text) ──────────
|
|
244
|
+
{ variant: ['outline', 'ghost'], color: 'action', className: 'text-content-action' },
|
|
245
|
+
{ variant: ['outline', 'ghost'], color: 'danger', className: 'text-content-danger' },
|
|
246
|
+
{ variant: ['outline', 'ghost'], color: 'warning', className: 'text-content-warning' },
|
|
247
|
+
{ variant: ['outline', 'ghost'], color: 'success', className: 'text-content-success' },
|
|
248
|
+
{ variant: ['outline', 'ghost'], color: 'info', className: 'text-content-info' },
|
|
249
249
|
],
|
|
250
250
|
defaultVariants: {
|
|
251
251
|
variant: 'strong',
|
|
252
252
|
color: 'action',
|
|
253
253
|
size: 'default',
|
|
254
|
-
mode: 'light',
|
|
255
254
|
},
|
|
256
255
|
});
|
|
257
256
|
|
|
258
257
|
export const buttonSpinnerVariants = cva([], {
|
|
259
258
|
variants: {
|
|
260
259
|
variant: {
|
|
261
|
-
strong:
|
|
260
|
+
strong: [],
|
|
262
261
|
outline: [],
|
|
263
262
|
ghost: [],
|
|
264
263
|
},
|
|
@@ -269,75 +268,65 @@ export const buttonSpinnerVariants = cva([], {
|
|
|
269
268
|
success: [],
|
|
270
269
|
info: [],
|
|
271
270
|
},
|
|
272
|
-
mode: {
|
|
273
|
-
light: [],
|
|
274
|
-
dark: [],
|
|
275
|
-
},
|
|
276
271
|
},
|
|
277
272
|
compoundVariants: [
|
|
278
|
-
//
|
|
273
|
+
// ── strong × color ───────────────────────────────────────────────
|
|
279
274
|
{
|
|
280
|
-
variant:
|
|
275
|
+
variant: 'strong',
|
|
281
276
|
color: 'action',
|
|
282
|
-
className: 'accent-
|
|
277
|
+
className: 'accent-[var(--color-content-action-on-strong)]',
|
|
283
278
|
},
|
|
284
279
|
{
|
|
285
|
-
variant:
|
|
280
|
+
variant: 'strong',
|
|
286
281
|
color: 'danger',
|
|
287
|
-
className: 'accent-
|
|
282
|
+
className: 'accent-[var(--color-content-danger-on-strong)]',
|
|
288
283
|
},
|
|
289
284
|
{
|
|
290
|
-
variant:
|
|
285
|
+
variant: 'strong',
|
|
291
286
|
color: 'warning',
|
|
292
|
-
className: 'accent-
|
|
287
|
+
className: 'accent-[var(--color-content-warning-on-strong)]',
|
|
293
288
|
},
|
|
294
289
|
{
|
|
295
|
-
variant:
|
|
290
|
+
variant: 'strong',
|
|
296
291
|
color: 'success',
|
|
297
|
-
className: 'accent-
|
|
292
|
+
className: 'accent-[var(--color-content-success-on-strong)]',
|
|
298
293
|
},
|
|
299
294
|
{
|
|
300
|
-
variant:
|
|
295
|
+
variant: 'strong',
|
|
301
296
|
color: 'info',
|
|
302
|
-
className: 'accent-
|
|
297
|
+
className: 'accent-[var(--color-content-info-on-strong)]',
|
|
303
298
|
},
|
|
304
299
|
|
|
305
|
-
//
|
|
300
|
+
// ── outline/ghost × color ────────────────────────────────────────
|
|
306
301
|
{
|
|
307
302
|
variant: ['outline', 'ghost'],
|
|
308
303
|
color: 'action',
|
|
309
|
-
|
|
310
|
-
className: 'accent-white',
|
|
304
|
+
className: 'accent-[var(--color-content-action)]',
|
|
311
305
|
},
|
|
312
306
|
{
|
|
313
307
|
variant: ['outline', 'ghost'],
|
|
314
308
|
color: 'danger',
|
|
315
|
-
|
|
316
|
-
className: 'accent-red-300',
|
|
309
|
+
className: 'accent-[var(--color-content-danger)]',
|
|
317
310
|
},
|
|
318
311
|
{
|
|
319
312
|
variant: ['outline', 'ghost'],
|
|
320
313
|
color: 'warning',
|
|
321
|
-
|
|
322
|
-
className: 'accent-amber-300',
|
|
314
|
+
className: 'accent-[var(--color-content-warning)]',
|
|
323
315
|
},
|
|
324
316
|
{
|
|
325
317
|
variant: ['outline', 'ghost'],
|
|
326
318
|
color: 'success',
|
|
327
|
-
|
|
328
|
-
className: 'accent-green-300',
|
|
319
|
+
className: 'accent-[var(--color-content-success)]',
|
|
329
320
|
},
|
|
330
321
|
{
|
|
331
322
|
variant: ['outline', 'ghost'],
|
|
332
323
|
color: 'info',
|
|
333
|
-
|
|
334
|
-
className: 'accent-sky-300',
|
|
324
|
+
className: 'accent-[var(--color-content-info)]',
|
|
335
325
|
},
|
|
336
326
|
],
|
|
337
327
|
defaultVariants: {
|
|
338
328
|
variant: 'strong',
|
|
339
329
|
color: 'action',
|
|
340
|
-
mode: 'light',
|
|
341
330
|
},
|
|
342
331
|
});
|
|
343
332
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { COLOR_TEXT_PRIMARY } from '../../styles/primitives';
|
|
4
3
|
|
|
5
4
|
export const headingStyle = cva(
|
|
6
5
|
[
|
|
7
|
-
|
|
6
|
+
`text-content-primary font-semibold tracking-tight my-0`,
|
|
8
7
|
Platform.select({
|
|
9
8
|
web: 'font-sans bg-transparent display-inline no-underline',
|
|
10
9
|
default: '',
|
|
@@ -13,11 +12,11 @@ export const headingStyle = cva(
|
|
|
13
12
|
{
|
|
14
13
|
variants: {
|
|
15
14
|
size: {
|
|
16
|
-
xl: '
|
|
17
|
-
lg: '
|
|
18
|
-
md: '
|
|
19
|
-
sm: '
|
|
20
|
-
xs: '
|
|
15
|
+
xl: 'heading-xl',
|
|
16
|
+
lg: 'heading-lg',
|
|
17
|
+
md: 'heading-md',
|
|
18
|
+
sm: 'heading-sm',
|
|
19
|
+
xs: 'heading-xs',
|
|
21
20
|
},
|
|
22
21
|
},
|
|
23
22
|
},
|
|
@@ -54,7 +54,6 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
|
|
|
54
54
|
{
|
|
55
55
|
variant = 'solid',
|
|
56
56
|
size = 'default',
|
|
57
|
-
mode = 'light',
|
|
58
57
|
className,
|
|
59
58
|
style,
|
|
60
59
|
as: IconComponent,
|
|
@@ -64,11 +63,11 @@ const IconButtonRoot = forwardRef<View, IconButtonProps>(
|
|
|
64
63
|
},
|
|
65
64
|
ref,
|
|
66
65
|
) => {
|
|
67
|
-
const rootClassName = cn(iconButtonRootVariants({ variant, size
|
|
66
|
+
const rootClassName = cn(iconButtonRootVariants({ variant, size }), className);
|
|
68
67
|
|
|
69
68
|
const glyphClassName = cn(
|
|
70
69
|
iconButtonGlyphVariants({ size }),
|
|
71
|
-
iconButtonIconColorVariants(
|
|
70
|
+
iconButtonIconColorVariants(),
|
|
72
71
|
iconClassName,
|
|
73
72
|
);
|
|
74
73
|
|
|
@@ -1,98 +1,43 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
4
|
-
COLOR_BORDER_DEFAULT,
|
|
5
|
-
DISABLED_CURSOR,
|
|
6
|
-
DISABLED_OPACITY,
|
|
7
|
-
RADIUS_FULL,
|
|
8
|
-
TRANSITION_COLORS,
|
|
9
|
-
} from '../../styles/primitives';
|
|
10
|
-
import {
|
|
11
|
-
type SharedButtonSemanticColor,
|
|
12
|
-
sharedGhostSurfaceCompounds,
|
|
13
|
-
sharedOutlineGhostForegroundTextCompounds,
|
|
14
|
-
} from '../Button/buttonSharedVariants';
|
|
15
|
-
|
|
16
|
-
function actionOnlyCompounds<T extends { color: SharedButtonSemanticColor }>(
|
|
17
|
-
compounds: T[],
|
|
18
|
-
): Omit<T, 'color'>[] {
|
|
19
|
-
return compounds
|
|
20
|
-
.filter((c) => c.color === 'action')
|
|
21
|
-
.map((c) => {
|
|
22
|
-
const { color, ...rest } = c;
|
|
23
|
-
void color;
|
|
24
|
-
return rest;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Dark-mode hover/active surface for ghost (solid uses a separate compound with border). */
|
|
29
|
-
const iconButtonDarkGhostSurfaceCompounds = actionOnlyCompounds(sharedGhostSurfaceCompounds).map(
|
|
30
|
-
(c) => ({
|
|
31
|
-
variant: 'ghost' as const,
|
|
32
|
-
...c,
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const iconButtonForegroundTextCompounds = actionOnlyCompounds(
|
|
37
|
-
sharedOutlineGhostForegroundTextCompounds,
|
|
38
|
-
).map((c) => ({
|
|
39
|
-
variant: ['solid', 'ghost'] as ('solid' | 'ghost')[],
|
|
40
|
-
...c,
|
|
41
|
-
}));
|
|
3
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
42
4
|
|
|
43
5
|
export const iconButtonRootVariants = cva(
|
|
44
6
|
[
|
|
45
7
|
'flex items-center justify-center',
|
|
46
|
-
|
|
8
|
+
'rounded-[var(--border-radius-round)]',
|
|
47
9
|
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
48
10
|
TRANSITION_COLORS,
|
|
49
|
-
|
|
11
|
+
'data-[disabled=true]:opacity-[--opacity-disabled]',
|
|
50
12
|
DISABLED_CURSOR,
|
|
51
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-
|
|
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',
|
|
52
14
|
],
|
|
53
15
|
{
|
|
54
16
|
variants: {
|
|
55
17
|
variant: {
|
|
56
|
-
/** Same surface as ghost, with a light gray border (aligned with Button `outline`). */
|
|
57
18
|
solid: [
|
|
58
|
-
'bg-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
19
|
+
'bg-surface-primary border border-stroke-secondary',
|
|
20
|
+
Platform.select({
|
|
21
|
+
default: 'data-[active=true]:bg-surface-primary-active',
|
|
22
|
+
web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
|
|
23
|
+
}),
|
|
62
24
|
],
|
|
63
25
|
ghost: [
|
|
64
26
|
'bg-transparent',
|
|
65
|
-
|
|
66
|
-
|
|
27
|
+
Platform.select({
|
|
28
|
+
default: 'data-[active=true]:bg-surface-primary-active',
|
|
29
|
+
web: 'data-[hover=true]:bg-surface-primary-hover data-[active=true]:data-[hover=true]:bg-surface-secondary-active',
|
|
30
|
+
}),
|
|
67
31
|
],
|
|
68
32
|
},
|
|
69
33
|
size: {
|
|
70
|
-
default: 'h-
|
|
71
|
-
small: 'h-8 w-8 min-w-8 shrink-0 p-
|
|
72
|
-
},
|
|
73
|
-
mode: {
|
|
74
|
-
light: [],
|
|
75
|
-
dark: [],
|
|
34
|
+
default: 'h-11 w-11 min-w-11 shrink-0 p-2.5',
|
|
35
|
+
small: 'h-8 w-8 min-w-8 shrink-0 p-1.5',
|
|
76
36
|
},
|
|
77
37
|
},
|
|
78
|
-
compoundVariants: [
|
|
79
|
-
...iconButtonDarkGhostSurfaceCompounds,
|
|
80
|
-
{
|
|
81
|
-
variant: 'solid',
|
|
82
|
-
mode: 'dark',
|
|
83
|
-
className: [
|
|
84
|
-
'border-slate-700',
|
|
85
|
-
Platform.select({
|
|
86
|
-
default: 'data-[active=true]:bg-slate-700',
|
|
87
|
-
web: 'data-[hover=true]:bg-slate-800 data-[active=true]:data-[hover=true]:bg-slate-700',
|
|
88
|
-
}),
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
38
|
defaultVariants: {
|
|
93
39
|
variant: 'solid',
|
|
94
40
|
size: 'default',
|
|
95
|
-
mode: 'light',
|
|
96
41
|
},
|
|
97
42
|
},
|
|
98
43
|
);
|
|
@@ -100,8 +45,8 @@ export const iconButtonRootVariants = cva(
|
|
|
100
45
|
export const iconButtonGlyphVariants = cva([], {
|
|
101
46
|
variants: {
|
|
102
47
|
size: {
|
|
103
|
-
default: 'size-
|
|
104
|
-
small: 'size-
|
|
48
|
+
default: 'size-6',
|
|
49
|
+
small: 'size-5',
|
|
105
50
|
},
|
|
106
51
|
},
|
|
107
52
|
defaultVariants: {
|
|
@@ -109,23 +54,6 @@ export const iconButtonGlyphVariants = cva([], {
|
|
|
109
54
|
},
|
|
110
55
|
});
|
|
111
56
|
|
|
112
|
-
|
|
113
|
-
export const iconButtonIconColorVariants = cva([], {
|
|
114
|
-
variants: {
|
|
115
|
-
variant: {
|
|
116
|
-
solid: [],
|
|
117
|
-
ghost: [],
|
|
118
|
-
},
|
|
119
|
-
mode: {
|
|
120
|
-
light: [],
|
|
121
|
-
dark: [],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
compoundVariants: [...iconButtonForegroundTextCompounds],
|
|
125
|
-
defaultVariants: {
|
|
126
|
-
variant: 'solid',
|
|
127
|
-
mode: 'light',
|
|
128
|
-
},
|
|
129
|
-
});
|
|
57
|
+
export const iconButtonIconColorVariants = cva(['text-content-primary']);
|
|
130
58
|
|
|
131
59
|
export type IconButtonVariantProps = VariantProps<typeof iconButtonRootVariants>;
|