@lets-events/react 3.0.0 → 5.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,6 +1,7 @@
1
- import { ComponentProps, ElementType } from 'react'
1
+ import { ComponentProps } from 'react'
2
2
  import { styled } from '../styles'
3
3
  import { Button as ButtonRadix } from '@radix-ui/themes'
4
+
4
5
  export const ButtonStyled = styled(ButtonRadix, {
5
6
  fontFamily: '$default',
6
7
  letterSpacing: 0,
@@ -13,117 +14,62 @@ export const ButtonStyled = styled(ButtonRadix, {
13
14
  alignItems: 'center',
14
15
  justifyContent: 'center',
15
16
  gap: '$10',
17
+ '&:disabled': {
18
+ cursor: 'not-allowed',
19
+ transition: 'none',
20
+ },
16
21
  variants: {
22
+ color: {
23
+ brand: {},
24
+ neutral: {},
25
+ purple: {},
26
+ },
17
27
  variant: {
18
- simple: {
28
+ text: {
19
29
  backgroundColor: 'transparent',
30
+ boxShadow: 'none',
20
31
  padding: 0,
21
- color: '$neutral600',
22
32
  border: 0,
23
- boxShadow: 'none',
24
- '&:hover': {
25
- transform: 'scale(1.05)',
26
- color: '$brand600'
27
- },
28
- '&:focus': {
29
- border: '2px solid $gray500',
30
- color: '$brand700'
31
- },
32
- '&:active': {
33
- transform: 'scale(0.95)',
34
- color: '$brand500'
35
- },
36
- '&:hover:disabled': {
37
- transform: 'none',
38
- },
39
- '&:disabled': {
40
- cursor: 'not-allowed',
41
- color: '$dark400',
42
- transition: 'none',
43
- }
44
33
  },
45
- primary: {
46
- backgroundColor: '$brand500',
47
- color: '$grey50',
34
+ contained: {
48
35
  '&:hover': {
49
- border: '$2 solid $brand700',
50
- transform: 'scale(1.05)',
51
- backgroundColor: '$blue600',
36
+ borderWidth: '$2',
37
+ borderStyle: 'solid',
52
38
  },
53
39
  '&:focus': {
54
40
  border: 0,
55
- backgroundColor: '$blue700',
56
41
  },
57
42
  '&:active': {
58
- transform: 'scale(0.95)',
59
- border: '$4 solid $brand300',
60
- backgroundColor: '$blue500',
61
- },
62
- '&:hover:disabled': {
63
- transform: 'none',
43
+ borderWidth: '$4',
44
+ borderStyle: 'solid',
64
45
  },
65
46
  '&:disabled': {
66
- border: '$1 solid $brand50',
67
- backgroundColor: '$brand50',
47
+ borderWidth: '$1',
48
+ borderStyle: 'solid',
68
49
  boxShadow: 'none',
69
- color: '$neutral400',
70
- transition: 'none',
71
50
  }
72
51
  },
73
- purple: {
74
- backgroundColor: '$purple500',
75
- color: '$grey50',
52
+ outlined: {
53
+ borderWidth: '$1',
54
+ borderStyle: 'solid',
76
55
  '&:hover': {
77
- transform: 'scale(1.05)',
78
- backgroundColor: '$purple600',
79
- border: '$2 solid $purple700',
56
+ borderWidth: '$2',
57
+ borderStyle: 'solid',
80
58
  },
81
59
  '&:focus': {
82
- border: '$2 solid $purple700',
83
- backgroundColor: '$purple600',
60
+ borderWidth: '$2',
61
+ borderStyle: 'solid',
84
62
  },
85
63
  '&:active': {
86
- transform: 'scale(0.95)',
87
- border: '$2 solid $purple300',
88
- backgroundColor: '$purple500',
89
- },
90
- '&:hover:disabled': {
91
- transform: 'none',
64
+ borderWidth: '$2',
65
+ borderStyle: 'solid',
92
66
  },
93
67
  '&:disabled': {
94
- border: '$1 solid $purple200',
95
- backgroundColor: '$purple200',
96
- transition: 'none',
97
- }
98
- },
99
- secondary: {
100
- backgroundColor: '$neutral500',
101
- border: '$1 solid $neutral300',
102
- color: '$neutral600',
103
- '&:hover': {
104
- transform: 'scale(1.05)',
105
- backgroundColor: '$neutral100',
106
- border: '$1 solid $neutral400',
107
- },
108
- '&:focus': {
109
- backgroundColor: '$neutral200',
110
- border: 0,
111
- },
112
- '&:active': {
113
- transform: 'scale(0.95)',
114
- backgroundColor: '$neutral50',
115
- border: '$1 solid $neutral300',
116
- },
117
- '&:hover:disabled': {
118
- transform: 'none',
119
- },
120
- '&:disabled': {
121
- backgroundColor: '$neutral50',
122
- border: '$1 solid $neutral200',
68
+ borderWidth: '$1',
69
+ borderStyle: 'solid',
123
70
  color: '$neutral400',
124
- transition: 'none',
125
71
  }
126
- },
72
+ }
127
73
  },
128
74
  size: {
129
75
  xs: {
@@ -152,20 +98,245 @@ export const ButtonStyled = styled(ButtonRadix, {
152
98
  borderRadius: '$full',
153
99
  }
154
100
  },
155
-
156
101
  },
157
102
 
158
103
  defaultVariants: {
159
- variant: 'simple',
104
+ variant: 'contained',
160
105
  size: 'md',
106
+ color: 'brand',
161
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
+ ]
162
334
  })
163
335
 
164
336
  export interface ButtonProps extends ComponentProps<typeof ButtonStyled> {
165
337
  asChild?: boolean,
166
338
  }
167
339
 
168
-
169
340
  export function Button({ asChild, ...props }: ButtonProps) {
170
341
  const Component = asChild ? ButtonRadix : 'button'
171
342
  return <ButtonStyled as={Component} {...props} />