@lets-events/react 2.0.0 → 4.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.
@@ -0,0 +1,478 @@
1
+ import { ComponentProps } from "react";
2
+ import { styled } from "../styles";
3
+ import { Button, Flex } from "@radix-ui/themes";
4
+
5
+ export const ButtonItemStyled = styled(Button, {
6
+ fontFamily: '$default',
7
+ letterSpacing: 0,
8
+ border: 0,
9
+ transition: 'all 300ms ease-out',
10
+ cursor: 'pointer',
11
+ boxSizing: 'border-box',
12
+ variants: {
13
+ active: {
14
+ true: {
15
+ },
16
+ }
17
+ },
18
+ });
19
+
20
+ export const ButtonGroupStyled = styled(Flex, {
21
+ display: 'flex',
22
+ borderRadius: '$md',
23
+ overflow: 'hidden',
24
+ variants: {
25
+ color: {
26
+ brand: {},
27
+ neutral: {},
28
+ purple: {},
29
+ green: {},
30
+ blue: {},
31
+ red: {},
32
+ },
33
+ variant: {
34
+ text: {
35
+ [`& ${ButtonItemStyled}`]: {
36
+ backgroundColor: 'transparent',
37
+ boxShadow: 'none',
38
+ padding: 0,
39
+ border: 0,
40
+ },
41
+ },
42
+ contained: {
43
+ [`& ${ButtonItemStyled}`]: {
44
+ borderWidth: '$1',
45
+ borderStyle: 'solid',
46
+ '&:disabled': {
47
+ boxShadow: 'none',
48
+ }
49
+ }
50
+ },
51
+ outlined: {
52
+ [`& ${ButtonItemStyled}`]: {
53
+ borderWidth: '$1',
54
+ borderStyle: 'solid',
55
+ '&:disabled': {
56
+ color: '$neutral400',
57
+ }
58
+ }
59
+ },
60
+ },
61
+ size: {
62
+ xs: {
63
+ [`& ${ButtonItemStyled}`]: {
64
+ padding: '$6 $12',
65
+ fontSize: '$12',
66
+ lineHeight: '$base',
67
+ '&:not(:first-child)': {
68
+ borderLeft: 'none',
69
+ },
70
+ '&:first-child': {
71
+ borderTopLeftRadius: '$xs',
72
+ borderBottomLeftRadius: '$xs',
73
+ },
74
+ '&:last-child': {
75
+ borderTopRightRadius: '$xs',
76
+ borderBottomRightRadius: '$xs',
77
+ },
78
+ }
79
+ },
80
+ sm: {
81
+ [`& ${ButtonItemStyled}`]: {
82
+ padding: '$8 $14',
83
+ fontSize: '$13',
84
+ lineHeight: '$smaller',
85
+ '&:not(:first-child)': {
86
+ borderLeft: 'none',
87
+ },
88
+ '&:first-child': {
89
+ borderTopLeftRadius: '$sm',
90
+ borderBottomLeftRadius: '$sm',
91
+ },
92
+ '&:last-child': {
93
+ borderTopRightRadius: '$sm',
94
+ borderBottomRightRadius: '$sm',
95
+ },
96
+ }
97
+ },
98
+ md: {
99
+ [`& ${ButtonItemStyled}`]: {
100
+ padding: '$12 $16',
101
+ fontSize: '$14',
102
+ lineHeight: '$smaller',
103
+ '&:not(:first-child)': {
104
+ borderLeft: 'none',
105
+ },
106
+ '&:first-child': {
107
+ borderTopLeftRadius: '$md',
108
+ borderBottomLeftRadius: '$md',
109
+ },
110
+ '&:last-child': {
111
+ borderTopRightRadius: '$md',
112
+ borderBottomRightRadius: '$md',
113
+ },
114
+ }
115
+ },
116
+ lg: {
117
+ [`& ${ButtonItemStyled}`]: {
118
+ padding: '$13 $20',
119
+ fontSize: '$18',
120
+ lineHeight: '$smaller',
121
+ '&:not(:first-child)': {
122
+ borderLeft: 'none',
123
+ },
124
+ '&:first-child': {
125
+ borderTopLeftRadius: '$lg',
126
+ borderBottomLeftRadius: '$lg',
127
+ },
128
+ '&:last-child': {
129
+ borderTopRightRadius: '$lg',
130
+ borderBottomRightRadius: '$lg',
131
+ },
132
+ }
133
+ },
134
+ },
135
+ },
136
+
137
+ compoundVariants: [
138
+ // text
139
+ {
140
+ variant: 'text',
141
+ color: 'brand',
142
+ css: {
143
+ [`& ${ButtonItemStyled}`]: {
144
+ color: '$brand500',
145
+ '&:hover': { color: '$brand600' },
146
+ '&:focus': { color: '$brand700' },
147
+ '&:active': { color: '$brand500' },
148
+ '&:disabled': { color: '$dark400' },
149
+ },
150
+ [`& ${ButtonItemStyled}.active`]: {
151
+ color: '$brand700',
152
+ '&:hover': { color: '$brand700' },
153
+ '&:focus': { color: '$brand700' },
154
+ '&:active': { color: '$brand700' },
155
+ },
156
+ }
157
+ },
158
+ {
159
+ variant: 'text',
160
+ color: 'neutral',
161
+ css: {
162
+ [`& ${ButtonItemStyled}`]: {
163
+ color: '$neutral600',
164
+ '&:hover': { color: '$neutral700' },
165
+ '&:focus': { color: '$neutral800' },
166
+ '&:active': { color: '$neutral500' },
167
+ '&:disabled': { color: '$dark400' },
168
+ },
169
+ [`& ${ButtonItemStyled}.active`]: {
170
+ color: '$neutral800',
171
+ '&:hover': { color: '$neutral800' },
172
+ '&:focus': { color: '$neutral800' },
173
+ '&:active': { color: '$neutral800' },
174
+ },
175
+ }
176
+ },
177
+ {
178
+ variant: 'text',
179
+ color: 'purple',
180
+ css: {
181
+ [`& ${ButtonItemStyled}`]: {
182
+ color: '$purple500',
183
+ '&:hover': { color: '$purple600' },
184
+ '&:focus': { color: '$purple700' },
185
+ '&:active': { color: '$purple500' },
186
+ '&:disabled': { color: '$dark400' },
187
+ },
188
+ [`& ${ButtonItemStyled}.active`]: {
189
+ color: '$purple700',
190
+ '&:hover': { color: '$purple700' },
191
+ '&:focus': { color: '$purple700' },
192
+ '&:active': { color: '$purple700' },
193
+ },
194
+ }
195
+ },
196
+ {
197
+ variant: 'text',
198
+ color: 'green',
199
+ css: {
200
+ [`& ${ButtonItemStyled}`]: {
201
+ color: '$green500',
202
+ '&:hover': { color: '$green600' },
203
+ '&:focus': { color: '$green700' },
204
+ '&:active': { color: '$green500' },
205
+ '&:disabled': { color: '$dark400' },
206
+ },
207
+ [`& ${ButtonItemStyled}.active`]: {
208
+ color: '$green700',
209
+ '&:hover': { color: '$green700' },
210
+ '&:focus': { color: '$green700' },
211
+ '&:active': { color: '$green700' },
212
+ },
213
+ }
214
+ },
215
+ {
216
+ variant: 'text',
217
+ color: 'blue',
218
+ css: {
219
+ [`& ${ButtonItemStyled}`]: {
220
+ color: '$blue500',
221
+ '&:hover': { color: '$blue600' },
222
+ '&:focus': { color: '$blue700' },
223
+ '&:active': { color: '$blue500' },
224
+ '&:disabled': { color: '$dark400' },
225
+ },
226
+ [`& ${ButtonItemStyled}.active`]: {
227
+ color: '$blue700',
228
+ '&:hover': { color: '$blue700' },
229
+ '&:focus': { color: '$blue700' },
230
+ '&:active': { color: '$blue700' },
231
+ },
232
+ }
233
+ },
234
+ {
235
+ variant: 'text',
236
+ color: 'red',
237
+ css: {
238
+ [`& ${ButtonItemStyled}`]: {
239
+ color: '$red500',
240
+ '&:hover': { color: '$red600' },
241
+ '&:focus': { color: '$red700' },
242
+ '&:active': { color: '$red500' },
243
+ '&:disabled': { color: '$dark400' },
244
+ },
245
+ [`& ${ButtonItemStyled}.active`]: {
246
+ color: '$red700',
247
+ '&:hover': { color: '$red700' },
248
+ '&:focus': { color: '$red700' },
249
+ '&:active': { color: '$red700' },
250
+ },
251
+ }
252
+ },
253
+
254
+ // contained
255
+ {
256
+ variant: 'contained',
257
+ color: 'brand',
258
+ css: {
259
+ [`& ${ButtonItemStyled}`]: {
260
+ color: '$grey50',
261
+ backgroundColor: '$brand500',
262
+ borderColor: '$brand500',
263
+ '&:hover': {
264
+ backgroundColor: '$blue600',
265
+ },
266
+ '&:focus': {
267
+ backgroundColor: '$blue700',
268
+ },
269
+ '&:active': {
270
+ backgroundColor: '$blue500',
271
+ },
272
+ '&:disabled': {
273
+ backgroundColor: '$brand50',
274
+ color: '$neutral400',
275
+ }
276
+ },
277
+ [`& ${ButtonItemStyled}.active`]: {
278
+ backgroundColor: '$brand700',
279
+ '&:hover': { backgroundColor: '$brand700' },
280
+ '&:focus': { backgroundColor: '$brand700' },
281
+ '&:active': { backgroundColor: '$brand700' },
282
+ },
283
+ }
284
+ },
285
+ {
286
+ variant: 'contained',
287
+ color: 'neutral',
288
+ css: {
289
+ [`& ${ButtonItemStyled}`]: {
290
+ backgroundColor: '$neutral600',
291
+ color: '$grey50',
292
+ '&:hover': {
293
+ backgroundColor: '$neutral700',
294
+ borderColor: '$neutral800',
295
+ },
296
+ '&:focus': {
297
+ backgroundColor: '$neutral800',
298
+ },
299
+ '&:active': {
300
+ backgroundColor: '$neutral500',
301
+ borderColor: '$neutral400',
302
+ },
303
+ '&:disabled': {
304
+ backgroundColor: '$neutral50',
305
+ borderColor: '$neutral200',
306
+ color: '$neutral400',
307
+ }
308
+ },
309
+ [`& ${ButtonItemStyled}.active`]: {
310
+ backgroundColor: '$neutral800',
311
+ '&:hover': { backgroundColor: '$neutral800' },
312
+ '&:focus': { backgroundColor: '$neutral800' },
313
+ '&:active': { backgroundColor: '$neutral800' },
314
+ },
315
+ }
316
+ },
317
+ {
318
+ variant: 'contained',
319
+ color: 'purple',
320
+ css: {
321
+ [`& ${ButtonItemStyled}`]: {
322
+ backgroundColor: '$purple500',
323
+ color: '$grey50',
324
+ '&:hover': {
325
+ backgroundColor: '$purple600',
326
+ borderColor: '$purple700',
327
+ },
328
+ '&:focus': {
329
+ backgroundColor: '$purple700',
330
+ },
331
+ '&:active': {
332
+ borderColor: '$purple300',
333
+ backgroundColor: '$purple500',
334
+ },
335
+ '&:disabled': {
336
+ borderColor: '$purple200',
337
+ backgroundColor: '$purple200',
338
+ color: '$neutral400',
339
+ }
340
+ },
341
+ [`& ${ButtonItemStyled}.active`]: {
342
+ backgroundColor: '$purple700',
343
+ '&:hover': { backgroundColor: '$purple700' },
344
+ '&:focus': { backgroundColor: '$purple700' },
345
+ '&:active': { backgroundColor: '$purple700' },
346
+ },
347
+ }
348
+ },
349
+ // outlined
350
+ {
351
+ variant: 'outlined',
352
+ color: 'brand',
353
+ css: {
354
+ [`& ${ButtonItemStyled}`]: {
355
+ color: '$brand500',
356
+ borderColor: '$brand300',
357
+ backgroundColor: '$grey50',
358
+ '&:hover': {
359
+ borderColor: '$brand400',
360
+ backgroundColor: '$brand50',
361
+ },
362
+ '&:focus': {
363
+ borderColor: '$brand400',
364
+ backgroundColor: '$brand50',
365
+ },
366
+ '&:active': {
367
+ borderColor: '$brand300',
368
+ backgroundColor: '$grey50',
369
+ },
370
+ '&:disabled': {
371
+ borderColor: '$brand200',
372
+ backgroundColor: '$neutral200',
373
+ color: '$neutral400',
374
+ }
375
+ },
376
+ [`& ${ButtonItemStyled}.active`]: {
377
+ color: '$brand700',
378
+ borderColor: '$brand600',
379
+ backgroundColor: '$brand50',
380
+ '&:hover': { backgroundColor: '$brand50', borderColor: '$brand600' },
381
+ '&:focus': { backgroundColor: '$brand50', borderColor: '$brand600' },
382
+ '&:active': { backgroundColor: '$brand50', borderColor: '$brand600' },
383
+ },
384
+ }
385
+ },
386
+ {
387
+ variant: 'outlined',
388
+ color: 'neutral',
389
+ css: {
390
+ [`& ${ButtonItemStyled}`]: {
391
+ color: '$neutral600',
392
+ borderColor: '$neutral300',
393
+ backgroundColor: '$grey50',
394
+ '&:hover': {
395
+ borderColor: '$neutral400',
396
+ backgroundColor: '$grey100',
397
+ },
398
+ '&:focus': {
399
+ borderColor: '$neutral400',
400
+ backgroundColor: '$grey100',
401
+ },
402
+ '&:active': {
403
+ borderColor: '$neutral300',
404
+ backgroundColor: '$grey50',
405
+ },
406
+ '&:disabled': {
407
+ borderColor: '$neutral200',
408
+ backgroundColor: '$neutral200',
409
+ color: '$neutral400',
410
+ }
411
+ },
412
+ [`& ${ButtonItemStyled}.active`]: {
413
+ color: '$neutral800',
414
+ borderColor: '$neutral600',
415
+ backgroundColor: '$grey100',
416
+ '&:hover': { backgroundColor: '$grey100', borderColor: '$neutral600' },
417
+ '&:focus': { backgroundColor: '$grey100', borderColor: '$neutral600' },
418
+ '&:active': { backgroundColor: '$grey100', borderColor: '$neutral600' },
419
+ },
420
+ }
421
+ },
422
+ {
423
+ variant: 'outlined',
424
+ color: 'purple',
425
+ css: {
426
+ [`& ${ButtonItemStyled}`]: {
427
+ color: '$purple500',
428
+ borderColor: '$purple300',
429
+ backgroundColor: '$grey50',
430
+ '&:hover': {
431
+ borderColor: '$purple400',
432
+ backgroundColor: '$purple50',
433
+ },
434
+ '&:focus': {
435
+ borderColor: '$purple400',
436
+ backgroundColor: '$purple50',
437
+ },
438
+ '&:active': {
439
+ borderColor: '$purple300',
440
+ backgroundColor: '$grey50',
441
+ },
442
+ '&:disabled': {
443
+ borderColor: '$purple200',
444
+ backgroundColor: '$neutral200',
445
+ color: '$neutral400',
446
+ }
447
+ },
448
+ [`& ${ButtonItemStyled}.active`]: {
449
+ color: '$purple700',
450
+ borderColor: '$purple600',
451
+ backgroundColor: '$purple50',
452
+ '&:hover': { backgroundColor: '$purple50', borderColor: '$purple600' },
453
+ '&:focus': { backgroundColor: '$purple50', borderColor: '$purple600' },
454
+ '&:active': { backgroundColor: '$purple50', borderColor: '$purple600' },
455
+ },
456
+ }
457
+ },
458
+
459
+ ],
460
+
461
+ defaultVariants: {
462
+ variant: 'contained',
463
+ size: 'md',
464
+ color: 'brand',
465
+ }
466
+ });
467
+
468
+ export interface ButtonItemProps extends ComponentProps<typeof ButtonItemStyled> { }
469
+
470
+ export type ButtonGroupProps = ComponentProps<typeof ButtonGroupStyled>
471
+
472
+ export function ButtonItem({ children, active, ...props }: ButtonItemProps) {
473
+ return <ButtonItemStyled className={active ? 'active' : ''} {...props}>{children}</ButtonItemStyled>;
474
+ }
475
+
476
+ export function ButtonGroup({ children, ...props }: ButtonGroupProps) {
477
+ return <ButtonGroupStyled {...props}>{children}</ButtonGroupStyled>;
478
+ }
@@ -0,0 +1,16 @@
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Text } from '@radix-ui/themes'
4
+
5
+ export const CaptionText = styled(Text, {
6
+ fontFamily: '$default',
7
+ color: '$gray100',
8
+ letterSpacing: '0px',
9
+ fontSize: '$14',
10
+ lineHeight: '$16',
11
+ fontWeight: '$regular',
12
+ })
13
+
14
+ export type CaptionTextProps = ComponentProps<typeof CaptionText> & {
15
+ as?: ElementType
16
+ }
@@ -0,0 +1,208 @@
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+ import { CheckboxGroup as CheckboxGroupRadix } from "@radix-ui/themes";
4
+
5
+ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
6
+ fontFamily: '$default',
7
+ letterSpacing: '0px',
8
+ fontSize: '$13',
9
+ 'svg': {
10
+ display: 'none'
11
+ },
12
+ 'label': {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ gap: '$8',
16
+ cursor: 'pointer',
17
+ '&:focus button, &:hover button': {
18
+ transition: 'all 300ms ease-out',
19
+ boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
20
+ }
21
+ },
22
+ 'label button': {
23
+ backgroundColor: '$white',
24
+ borderRadius: '2px',
25
+ height: '$16',
26
+ width: '$16',
27
+ position: 'relative',
28
+ border: '2px solid $dark300',
29
+ cursor: 'pointer',
30
+ },
31
+ 'label button[data-state=checked]:before': {
32
+ backgroundColor: '$dark50',
33
+ content: '',
34
+ width: '8px',
35
+ height: '8px',
36
+ position: 'absolute',
37
+ top: '2px',
38
+ right: '2px',
39
+ zIndex: 2,
40
+ },
41
+ 'label button[data-state=checked]:after': {
42
+ backgroundColor: '$brand500',
43
+ content: '',
44
+ height: '$16',
45
+ width: '$16',
46
+ position: 'absolute',
47
+ top: '-2px',
48
+ right: '-2px',
49
+ borderRadius: '2px',
50
+ zIndex: 1,
51
+ },
52
+
53
+ variants: {
54
+ color: {
55
+ success: {
56
+ 'label': {
57
+ '&:focus button, &:hover button': {
58
+ boxShadow: '0px 0px 0px 4px rgba(38, 167, 67, 0.50)',
59
+ }
60
+ },
61
+ 'label button': {
62
+ borderColor: '$green500',
63
+ backgroundColor: '$dark50',
64
+ },
65
+ 'label button[data-state=checked]:after': {
66
+ backgroundColor: '$green500',
67
+ },
68
+ },
69
+ blue: {},
70
+ error: {
71
+ 'label': {
72
+ '&:focus button, &:hover button': {
73
+ boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
74
+ }
75
+ },
76
+ 'label button': {
77
+ borderColor: '$error400',
78
+ backgroundColor: '$dark50',
79
+ },
80
+ 'label button[data-state=checked]:after': {
81
+ backgroundColor: '$error600',
82
+ },
83
+ }
84
+ },
85
+ disabled: {
86
+ true: {
87
+ 'label': {
88
+ cursor: 'not-allowed',
89
+ opacity: 0.5,
90
+ '&:focus button, &:hover button': {
91
+ boxShadow: 'none',
92
+ }
93
+ },
94
+ 'label button': {
95
+ cursor: 'not-allowed',
96
+ }
97
+ },
98
+ false: {}
99
+ }
100
+ },
101
+
102
+ compoundVariants: [
103
+
104
+ {
105
+ color: 'blue',
106
+ disabled: false,
107
+ css: {
108
+ 'label': {
109
+ '&:focus button, &:hover button': {
110
+ boxShadow: '0px 0px 0px 4px rgba(56, 129, 255, 0.50)'
111
+ }
112
+ },
113
+ 'label button': {
114
+ borderColor: '$dark300',
115
+ },
116
+ 'label button[data-state=checked]:after': {
117
+ backgroundColor: '$brand500',
118
+ },
119
+ }
120
+ },
121
+
122
+ {
123
+ color: 'blue',
124
+ disabled: true,
125
+ css: {
126
+ 'label button': {
127
+ borderColor: '$brand100',
128
+ backgroundColor: '$dark50',
129
+ },
130
+ 'label button[data-state=checked]:after': {
131
+ backgroundColor: '$brand100',
132
+ },
133
+ }
134
+ },
135
+
136
+ {
137
+ color: 'success',
138
+ disabled: true,
139
+ css: {
140
+ 'label button': {
141
+ borderColor: '$success100',
142
+ backgroundColor: '$dark50',
143
+ },
144
+ 'label button[data-state=checked]:after': {
145
+ backgroundColor: '$success100',
146
+ }
147
+ }
148
+ },
149
+
150
+ {
151
+ color: 'error',
152
+ disabled: true,
153
+ css: {
154
+ 'label button': {
155
+ borderColor: '$error100',
156
+ backgroundColor: '$dark50',
157
+ },
158
+ 'label button[data-state=checked]:after': {
159
+ backgroundColor: '$error100',
160
+ }
161
+ }
162
+ }
163
+ ],
164
+ defaultVariants: {
165
+ color: 'blue',
166
+ disabled: false
167
+ }
168
+ })
169
+
170
+ export type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupStyled> & {
171
+ placeholder?: string
172
+ children?: React.ReactNode
173
+ color?: string
174
+ disabled?: boolean
175
+ }
176
+
177
+ export type CheckboxItemProps = {
178
+ children?: React.ReactNode
179
+ value: string,
180
+ style?: React.CSSProperties
181
+ }
182
+
183
+ export function CheckboxGroup({
184
+ children,
185
+
186
+ ...props
187
+ }: CheckboxGroupProps) {
188
+ return (
189
+ <CheckboxGroupStyled {...props}>
190
+ {children}
191
+ </CheckboxGroupStyled>
192
+ )
193
+ }
194
+
195
+
196
+ export function CheckboxItem({
197
+ children,
198
+
199
+ ...props
200
+ }: CheckboxItemProps) {
201
+ return (
202
+ <CheckboxGroupRadix.Item {...props}>
203
+ {children}
204
+ </CheckboxGroupRadix.Item>
205
+ )
206
+ }
207
+
208
+