@lets-events/react 5.0.0 → 6.0.0

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.
@@ -1,343 +1,329 @@
1
- import { ComponentProps } from 'react'
2
- import { styled } from '../styles'
3
- import { Button as ButtonRadix } from '@radix-ui/themes'
4
-
5
- export const ButtonStyled = styled(ButtonRadix, {
6
- fontFamily: '$default',
7
- letterSpacing: 0,
8
- border: 0,
9
- transition: 'all 300ms ease-out',
10
- cursor: 'pointer',
11
- borderRadius: '$xs',
12
- boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)',
13
- display: 'flex',
14
- alignItems: 'center',
15
- justifyContent: 'center',
16
- gap: '$10',
17
- '&:disabled': {
18
- cursor: 'not-allowed',
19
- transition: 'none',
20
- },
21
- variants: {
22
- color: {
23
- brand: {},
24
- neutral: {},
25
- purple: {},
26
- },
27
- variant: {
28
- text: {
29
- backgroundColor: 'transparent',
30
- boxShadow: 'none',
31
- padding: 0,
32
- border: 0,
33
- },
34
- contained: {
35
- '&:hover': {
36
- borderWidth: '$2',
37
- borderStyle: 'solid',
38
- },
39
- '&:focus': {
40
- border: 0,
41
- },
42
- '&:active': {
43
- borderWidth: '$4',
44
- borderStyle: 'solid',
45
- },
46
- '&:disabled': {
47
- borderWidth: '$1',
48
- borderStyle: 'solid',
49
- boxShadow: 'none',
50
- }
51
- },
52
- outlined: {
53
- borderWidth: '$1',
54
- borderStyle: 'solid',
55
- '&:hover': {
56
- borderWidth: '$2',
57
- borderStyle: 'solid',
58
- },
59
- '&:focus': {
60
- borderWidth: '$2',
61
- borderStyle: 'solid',
62
- },
63
- '&:active': {
64
- borderWidth: '$2',
65
- borderStyle: 'solid',
66
- },
67
- '&:disabled': {
68
- borderWidth: '$1',
69
- borderStyle: 'solid',
70
- color: '$neutral400',
71
- }
72
- }
73
- },
74
- size: {
75
- xs: {
76
- padding: '$6 $12',
77
- fontSize: '$12',
78
- lineHeight: '$base',
79
- },
80
- sm: {
81
- padding: '$8 $14',
82
- fontSize: '$13',
83
- lineHeight: '$smaller',
84
- },
85
- md: {
86
- padding: '$12 $16',
87
- fontSize: '$14',
88
- lineHeight: '$smaller',
89
- },
90
- lg: {
91
- padding: '$13 $20',
92
- fontSize: '$18',
93
- lineHeight: '$smaller',
94
- },
95
- },
96
- radii: {
97
- 'full': {
98
- borderRadius: '$full',
99
- }
100
- },
101
- },
102
-
103
- defaultVariants: {
104
- variant: 'contained',
105
- size: 'md',
106
- color: 'brand',
107
- },
108
-
109
- compoundVariants: [
110
- {
111
- variant: 'text',
112
- color: 'brand',
113
- css: {
114
- color: '$brand500',
115
- '&:hover': { color: '$brand600' },
116
- '&:focus': { color: '$brand700' },
117
- '&:active': { color: '$brand500' },
118
- '&:disabled': { color: '$dark400' },
119
- }
120
- },
121
- {
122
- variant: 'text',
123
- color: 'neutral',
124
- css: {
125
- color: '$neutral600',
126
- '&:hover': { color: '$neutral700' },
127
- '&:focus': { color: '$neutral800' },
128
- '&:active': { color: '$neutral500' },
129
- '&:disabled': { color: '$dark400' },
130
- }
131
- },
132
- {
133
- variant: 'text',
134
- color: 'purple',
135
- css: {
136
- color: '$purple500',
137
- '&:hover': { color: '$purple600' },
138
- '&:focus': { color: '$purple700' },
139
- '&:active': { color: '$purple500' },
140
- '&:disabled': { color: '$dark400' },
141
- }
142
- },
143
- {
144
- variant: 'text',
145
- color: 'green',
146
- css: {
147
- color: '$green500',
148
- '&:hover': { color: '$green600' },
149
- '&:focus': { color: '$green700' },
150
- '&:active': { color: '$green500' },
151
- '&:disabled': { color: '$dark400' },
152
- }
153
- },
154
- {
155
- variant: 'text',
156
- color: 'blue',
157
- css: {
158
- color: '$blue500',
159
- '&:hover': { color: '$blue600' },
160
- '&:focus': { color: '$blue700' },
161
- '&:active': { color: '$blue500' },
162
- '&:disabled': { color: '$dark400' },
163
- }
164
- },
165
- {
166
- variant: 'text',
167
- color: 'red',
168
- css: {
169
- color: '$red500',
170
- '&:hover': { color: '$red600' },
171
- '&:focus': { color: '$red700' },
172
- '&:active': { color: '$red500' },
173
- '&:disabled': { color: '$dark400' },
174
- }
175
- },
176
-
177
- // contained
178
- {
179
- variant: 'contained',
180
- color: 'brand',
181
- css: {
182
- color: '$grey50',
183
- backgroundColor: '$brand500',
184
- borderWidth: '$2',
185
- borderStyle: 'solid',
186
- borderColor: 'transparent',
187
- '&:hover': {
188
- borderColor: '$brand700',
189
- backgroundColor: '$blue600',
190
- },
191
- '&:focus': {
192
- backgroundColor: '$blue700',
193
- },
194
- '&:active': {
195
- borderColor: '$brand300',
196
- backgroundColor: '$blue500',
197
- },
198
- '&:disabled': {
199
- borderColor: '$brand50',
200
- backgroundColor: '$brand50',
201
- color: '$neutral400',
202
- }
203
- }
204
- },
205
- {
206
- variant: 'contained',
207
- color: 'neutral',
208
- css: {
209
- backgroundColor: '$neutral600',
210
- color: '$grey50',
211
- '&:hover': {
212
- backgroundColor: '$neutral700',
213
- borderColor: '$neutral800',
214
- },
215
- '&:focus': {
216
- backgroundColor: '$neutral800',
217
- },
218
- '&:active': {
219
- backgroundColor: '$neutral500',
220
- borderColor: '$neutral400',
221
- },
222
- '&:disabled': {
223
- backgroundColor: '$neutral50',
224
- borderColor: '$neutral200',
225
- color: '$neutral400',
226
- }
227
- }
228
- },
229
- {
230
- variant: 'contained',
231
- color: 'purple',
232
- css: {
233
- backgroundColor: '$purple500',
234
- color: '$grey50',
235
- '&:hover': {
236
- backgroundColor: '$purple600',
237
- borderColor: '$purple700',
238
- },
239
- '&:focus': {
240
- backgroundColor: '$purple700',
241
- },
242
- '&:active': {
243
- borderColor: '$purple300',
244
- backgroundColor: '$purple500',
245
- },
246
- '&:disabled': {
247
- borderColor: '$purple200',
248
- backgroundColor: '$purple200',
249
- color: '$neutral400',
250
- }
251
- }
252
- },
253
-
254
-
255
-
256
- // outlined
257
- {
258
- variant: 'outlined',
259
- color: 'brand',
260
- css: {
261
- color: '$brand500',
262
- borderColor: '$brand300',
263
- backgroundColor: '$grey50',
264
- '&:hover': {
265
- borderColor: '$brand400',
266
- backgroundColor: '$brand50',
267
- },
268
- '&:focus': {
269
- borderColor: '$brand400',
270
- backgroundColor: '$brand50',
271
- },
272
- '&:active': {
273
- borderColor: '$brand300',
274
- backgroundColor: '$grey50',
275
- },
276
- '&:disabled': {
277
- borderColor: '$brand200',
278
- backgroundColor: '$neutral200',
279
- }
280
- }
281
- },
282
- {
283
- variant: 'outlined',
284
- color: 'neutral',
285
- css: {
286
- color: '$neutral600',
287
- borderColor: '$neutral300',
288
- backgroundColor: '$grey50',
289
- '&:hover': {
290
- borderColor: '$neutral400',
291
- backgroundColor: '$grey100',
292
- },
293
- '&:focus': {
294
- borderColor: '$neutral400',
295
- backgroundColor: '$grey100',
296
- },
297
- '&:active': {
298
- borderColor: '$neutral300',
299
- backgroundColor: '$grey50',
300
- },
301
- '&:disabled': {
302
- borderColor: '$neutral200',
303
- backgroundColor: '$neutral200',
304
- }
305
- }
306
- },
307
- {
308
- variant: 'outlined',
309
- color: 'purple',
310
- css: {
311
- color: '$purple500',
312
- borderColor: '$purple300',
313
- backgroundColor: '$grey50',
314
- '&:hover': {
315
- borderColor: '$purple400',
316
- backgroundColor: '$purple50',
317
- },
318
- '&:focus': {
319
- borderColor: '$purple400',
320
- backgroundColor: '$purple50',
321
- },
322
- '&:active': {
323
- borderColor: '$purple300',
324
- backgroundColor: '$grey50',
325
- },
326
- '&:disabled': {
327
- borderColor: '$purple200',
328
- backgroundColor: '$neutral200',
329
- }
330
- }
331
- },
332
-
333
- ]
334
- })
335
-
336
- export interface ButtonProps extends ComponentProps<typeof ButtonStyled> {
337
- asChild?: boolean,
338
- }
339
-
340
- export function Button({ asChild, ...props }: ButtonProps) {
341
- const Component = asChild ? ButtonRadix : 'button'
342
- return <ButtonStyled as={Component} {...props} />
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Button as ButtonRadix } from '@radix-ui/themes'
4
+ import { typographyButtonValues } from '../types/typographyValues'
5
+
6
+ export const ButtonStyled = styled(ButtonRadix, {
7
+ fontFamily: '$default',
8
+ letterSpacing: 0,
9
+ border: 0,
10
+ transition: 'all 300ms ease-out',
11
+ cursor: 'pointer',
12
+ borderRadius: '$xs',
13
+ boxShadow: '0px 4px 4px 0px rgba(35, 53, 67, 0.08), 0px 2px 4px 0px rgba(35, 53, 67, 0.16)',
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ justifyContent: 'center',
17
+ gap: '$10',
18
+ '&:disabled': {
19
+ cursor: 'not-allowed',
20
+ transition: 'none',
21
+ },
22
+ variants: {
23
+ color: {
24
+ brand: {},
25
+ neutral: {},
26
+ purple: {},
27
+ },
28
+ variant: {
29
+ text: {
30
+ backgroundColor: 'transparent',
31
+ boxShadow: 'none',
32
+ padding: 0,
33
+ border: 0,
34
+ },
35
+ contained: {
36
+ '&:hover': {
37
+ borderWidth: '$2',
38
+ borderStyle: 'solid',
39
+ },
40
+ '&:focus': {
41
+ border: 0,
42
+ },
43
+ '&:active': {
44
+ borderWidth: '$4',
45
+ borderStyle: 'solid',
46
+ },
47
+ '&:disabled': {
48
+ borderWidth: '$1',
49
+ borderStyle: 'solid',
50
+ boxShadow: 'none',
51
+ }
52
+ },
53
+ outlined: {
54
+ borderWidth: '$1',
55
+ borderStyle: 'solid',
56
+ '&:hover': {
57
+ borderWidth: '$2',
58
+ borderStyle: 'solid',
59
+ },
60
+ '&:focus': {
61
+ borderWidth: '$2',
62
+ borderStyle: 'solid',
63
+ },
64
+ '&:active': {
65
+ borderWidth: '$2',
66
+ borderStyle: 'solid',
67
+ },
68
+ '&:disabled': {
69
+ borderWidth: '$1',
70
+ borderStyle: 'solid',
71
+ color: '$neutral400',
72
+ }
73
+ }
74
+ },
75
+ typography: typographyButtonValues,
76
+ fontWeight: {
77
+ regular: { fontWeight: '$regular' },
78
+ medium: { fontWeight: '$medium' },
79
+ semibold: { fontWeight: '$semibold' },
80
+ bold: { fontWeight: '$bold' },
81
+ },
82
+ radii: {
83
+ 'full': {
84
+ borderRadius: '$full',
85
+ }
86
+ },
87
+ },
88
+
89
+ defaultVariants: {
90
+ variant: 'contained',
91
+ typography: 'buttonMedium',
92
+ color: 'brand',
93
+ },
94
+
95
+ compoundVariants: [
96
+ {
97
+ variant: 'text',
98
+ color: 'brand',
99
+ css: {
100
+ color: '$brand500',
101
+ '&:hover': { color: '$brand600' },
102
+ '&:focus': { color: '$brand700' },
103
+ '&:active': { color: '$brand500' },
104
+ '&:disabled': { color: '$dark400' },
105
+ }
106
+ },
107
+ {
108
+ variant: 'text',
109
+ color: 'neutral',
110
+ css: {
111
+ color: '$neutral600',
112
+ '&:hover': { color: '$neutral700' },
113
+ '&:focus': { color: '$neutral800' },
114
+ '&:active': { color: '$neutral500' },
115
+ '&:disabled': { color: '$dark400' },
116
+ }
117
+ },
118
+ {
119
+ variant: 'text',
120
+ color: 'purple',
121
+ css: {
122
+ color: '$purple500',
123
+ '&:hover': { color: '$purple600' },
124
+ '&:focus': { color: '$purple700' },
125
+ '&:active': { color: '$purple500' },
126
+ '&:disabled': { color: '$dark400' },
127
+ }
128
+ },
129
+ {
130
+ variant: 'text',
131
+ color: 'green',
132
+ css: {
133
+ color: '$green500',
134
+ '&:hover': { color: '$green600' },
135
+ '&:focus': { color: '$green700' },
136
+ '&:active': { color: '$green500' },
137
+ '&:disabled': { color: '$dark400' },
138
+ }
139
+ },
140
+ {
141
+ variant: 'text',
142
+ color: 'blue',
143
+ css: {
144
+ color: '$blue500',
145
+ '&:hover': { color: '$blue600' },
146
+ '&:focus': { color: '$blue700' },
147
+ '&:active': { color: '$blue500' },
148
+ '&:disabled': { color: '$dark400' },
149
+ }
150
+ },
151
+ {
152
+ variant: 'text',
153
+ color: 'red',
154
+ css: {
155
+ color: '$red500',
156
+ '&:hover': { color: '$red600' },
157
+ '&:focus': { color: '$red700' },
158
+ '&:active': { color: '$red500' },
159
+ '&:disabled': { color: '$dark400' },
160
+ }
161
+ },
162
+
163
+ // contained
164
+ {
165
+ variant: 'contained',
166
+ color: 'brand',
167
+ css: {
168
+ color: '$grey50',
169
+ backgroundColor: '$brand500',
170
+ borderWidth: '$2',
171
+ borderStyle: 'solid',
172
+ borderColor: 'transparent',
173
+ '&:hover': {
174
+ borderColor: '$brand700',
175
+ backgroundColor: '$blue600',
176
+ },
177
+ '&:focus': {
178
+ backgroundColor: '$blue700',
179
+ },
180
+ '&:active': {
181
+ borderColor: '$brand300',
182
+ backgroundColor: '$blue500',
183
+ },
184
+ '&:disabled': {
185
+ borderColor: '$brand50',
186
+ backgroundColor: '$brand50',
187
+ color: '$neutral400',
188
+ }
189
+ }
190
+ },
191
+ {
192
+ variant: 'contained',
193
+ color: 'neutral',
194
+ css: {
195
+ backgroundColor: '$neutral600',
196
+ color: '$grey50',
197
+ '&:hover': {
198
+ backgroundColor: '$neutral700',
199
+ borderColor: '$neutral800',
200
+ },
201
+ '&:focus': {
202
+ backgroundColor: '$neutral800',
203
+ },
204
+ '&:active': {
205
+ backgroundColor: '$neutral500',
206
+ borderColor: '$neutral400',
207
+ },
208
+ '&:disabled': {
209
+ backgroundColor: '$neutral50',
210
+ borderColor: '$neutral200',
211
+ color: '$neutral400',
212
+ }
213
+ }
214
+ },
215
+ {
216
+ variant: 'contained',
217
+ color: 'purple',
218
+ css: {
219
+ backgroundColor: '$purple500',
220
+ color: '$grey50',
221
+ '&:hover': {
222
+ backgroundColor: '$purple600',
223
+ borderColor: '$purple700',
224
+ },
225
+ '&:focus': {
226
+ backgroundColor: '$purple700',
227
+ },
228
+ '&:active': {
229
+ borderColor: '$purple300',
230
+ backgroundColor: '$purple500',
231
+ },
232
+ '&:disabled': {
233
+ borderColor: '$purple200',
234
+ backgroundColor: '$purple200',
235
+ color: '$neutral400',
236
+ }
237
+ }
238
+ },
239
+
240
+
241
+
242
+ // outlined
243
+ {
244
+ variant: 'outlined',
245
+ color: 'brand',
246
+ css: {
247
+ color: '$brand500',
248
+ borderColor: '$brand300',
249
+ backgroundColor: '$grey50',
250
+ '&:hover': {
251
+ borderColor: '$brand400',
252
+ backgroundColor: '$brand50',
253
+ },
254
+ '&:focus': {
255
+ borderColor: '$brand400',
256
+ backgroundColor: '$brand50',
257
+ },
258
+ '&:active': {
259
+ borderColor: '$brand300',
260
+ backgroundColor: '$grey50',
261
+ },
262
+ '&:disabled': {
263
+ borderColor: '$brand200',
264
+ backgroundColor: '$neutral200',
265
+ }
266
+ }
267
+ },
268
+ {
269
+ variant: 'outlined',
270
+ color: 'neutral',
271
+ css: {
272
+ color: '$neutral600',
273
+ borderColor: '$neutral300',
274
+ backgroundColor: '$grey50',
275
+ '&:hover': {
276
+ borderColor: '$neutral400',
277
+ backgroundColor: '$grey100',
278
+ },
279
+ '&:focus': {
280
+ borderColor: '$neutral400',
281
+ backgroundColor: '$grey100',
282
+ },
283
+ '&:active': {
284
+ borderColor: '$neutral300',
285
+ backgroundColor: '$grey50',
286
+ },
287
+ '&:disabled': {
288
+ borderColor: '$neutral200',
289
+ backgroundColor: '$neutral200',
290
+ }
291
+ }
292
+ },
293
+ {
294
+ variant: 'outlined',
295
+ color: 'purple',
296
+ css: {
297
+ color: '$purple500',
298
+ borderColor: '$purple300',
299
+ backgroundColor: '$grey50',
300
+ '&:hover': {
301
+ borderColor: '$purple400',
302
+ backgroundColor: '$purple50',
303
+ },
304
+ '&:focus': {
305
+ borderColor: '$purple400',
306
+ backgroundColor: '$purple50',
307
+ },
308
+ '&:active': {
309
+ borderColor: '$purple300',
310
+ backgroundColor: '$grey50',
311
+ },
312
+ '&:disabled': {
313
+ borderColor: '$purple200',
314
+ backgroundColor: '$neutral200',
315
+ }
316
+ }
317
+ },
318
+
319
+ ]
320
+ })
321
+
322
+ export interface ButtonProps extends ComponentProps<typeof ButtonStyled> {
323
+ asChild?: boolean,
324
+ }
325
+
326
+ export function Button({ asChild, ...props }: ButtonProps) {
327
+ const Component = asChild ? ButtonRadix : 'button'
328
+ return <ButtonStyled as={Component} {...props} />
343
329
  }