@lets-events/react 3.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.
@@ -8,6 +8,7 @@ export const ButtonItemStyled = styled(Button, {
8
8
  border: 0,
9
9
  transition: 'all 300ms ease-out',
10
10
  cursor: 'pointer',
11
+ boxSizing: 'border-box',
11
12
  variants: {
12
13
  active: {
13
14
  true: {
@@ -21,44 +22,66 @@ export const ButtonGroupStyled = styled(Flex, {
21
22
  borderRadius: '$md',
22
23
  overflow: 'hidden',
23
24
  variants: {
25
+ color: {
26
+ brand: {},
27
+ neutral: {},
28
+ purple: {},
29
+ green: {},
30
+ blue: {},
31
+ red: {},
32
+ },
24
33
  variant: {
25
- primary: {
34
+ text: {
26
35
  [`& ${ButtonItemStyled}`]: {
27
- backgroundColor: '$brand500',
28
- color: '$grey50',
29
- '&:hover': { backgroundColor: '$blue600' },
30
- '&:focus': { backgroundColor: '$blue700' },
31
- '&:active': { backgroundColor: '$blue400' },
32
-
33
- },
34
- [`& ${ButtonItemStyled}.active`]: {
35
- backgroundColor: '$brand700',
36
- '&:hover': { backgroundColor: '$brand700' },
37
- '&:focus': { backgroundColor: '$brand700' },
38
- '&:active': { backgroundColor: '$brand700' },
36
+ backgroundColor: 'transparent',
37
+ boxShadow: 'none',
38
+ padding: 0,
39
+ border: 0,
39
40
  },
40
-
41
41
  },
42
- simple: {
42
+ contained: {
43
43
  [`& ${ButtonItemStyled}`]: {
44
- backgroundColor: 'transparent',
45
- border: '1px solid $dark300',
46
- color: '$dark600',
47
- '&:hover': { backgroundColor: '$neutral' },
48
- },
49
- [`& ${ButtonItemStyled}.active`]: {
50
- backgroundColor: '$dark200',
51
- color: '$dark600',
52
- '&:hover': { backgroundColor: '$dark200', color: '$dark600', },
53
- },
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
+ }
54
59
  },
55
60
  },
56
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
+ },
57
80
  sm: {
58
81
  [`& ${ButtonItemStyled}`]: {
59
82
  padding: '$8 $14',
60
83
  fontSize: '$13',
61
-
84
+ lineHeight: '$smaller',
62
85
  '&:not(:first-child)': {
63
86
  borderLeft: 'none',
64
87
  },
@@ -76,6 +99,7 @@ export const ButtonGroupStyled = styled(Flex, {
76
99
  [`& ${ButtonItemStyled}`]: {
77
100
  padding: '$12 $16',
78
101
  fontSize: '$14',
102
+ lineHeight: '$smaller',
79
103
  '&:not(:first-child)': {
80
104
  borderLeft: 'none',
81
105
  },
@@ -93,6 +117,7 @@ export const ButtonGroupStyled = styled(Flex, {
93
117
  [`& ${ButtonItemStyled}`]: {
94
118
  padding: '$13 $20',
95
119
  fontSize: '$18',
120
+ lineHeight: '$smaller',
96
121
  '&:not(:first-child)': {
97
122
  borderLeft: 'none',
98
123
  },
@@ -107,11 +132,336 @@ export const ButtonGroupStyled = styled(Flex, {
107
132
  }
108
133
  },
109
134
  },
110
-
111
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
+
112
461
  defaultVariants: {
113
- variant: 'primary',
462
+ variant: 'contained',
114
463
  size: 'md',
464
+ color: 'brand',
115
465
  }
116
466
  });
117
467
 
@@ -51,8 +51,8 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
51
51
  },
52
52
 
53
53
  variants: {
54
- isValid: {
55
- true: {
54
+ color: {
55
+ success: {
56
56
  'label': {
57
57
  '&:focus button, &:hover button': {
58
58
  boxShadow: '0px 0px 0px 4px rgba(38, 167, 67, 0.50)',
@@ -66,7 +66,8 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
66
66
  backgroundColor: '$green500',
67
67
  },
68
68
  },
69
- false: {
69
+ blue: {},
70
+ error: {
70
71
  'label': {
71
72
  '&:focus button, &:hover button': {
72
73
  boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
@@ -101,7 +102,7 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
101
102
  compoundVariants: [
102
103
 
103
104
  {
104
- isValid: undefined,
105
+ color: 'blue',
105
106
  disabled: false,
106
107
  css: {
107
108
  'label': {
@@ -119,7 +120,7 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
119
120
  },
120
121
 
121
122
  {
122
- isValid: undefined,
123
+ color: 'blue',
123
124
  disabled: true,
124
125
  css: {
125
126
  'label button': {
@@ -133,7 +134,7 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
133
134
  },
134
135
 
135
136
  {
136
- isValid: true,
137
+ color: 'success',
137
138
  disabled: true,
138
139
  css: {
139
140
  'label button': {
@@ -147,7 +148,7 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
147
148
  },
148
149
 
149
150
  {
150
- isValid: false,
151
+ color: 'error',
151
152
  disabled: true,
152
153
  css: {
153
154
  'label button': {
@@ -159,13 +160,17 @@ export const CheckboxGroupStyled = styled(CheckboxGroupRadix.Root, {
159
160
  }
160
161
  }
161
162
  }
162
- ]
163
+ ],
164
+ defaultVariants: {
165
+ color: 'blue',
166
+ disabled: false
167
+ }
163
168
  })
164
169
 
165
170
  export type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupStyled> & {
166
171
  placeholder?: string
167
172
  children?: React.ReactNode
168
- isValid?: boolean
173
+ color?: string
169
174
  disabled?: boolean
170
175
  }
171
176
 
@@ -9,23 +9,34 @@ import PropTypes from "prop-types";
9
9
 
10
10
  library.add(fas, far, fab);
11
11
 
12
- interface IconProps extends Omit<FontAwesomeIconProps, "icon"> {
12
+ interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
13
13
  name: IconName;
14
+ size?: 'xs' | 'sm' | 'md' | 'xl';
14
15
  prefix?: IconPrefix;
15
16
  }
16
17
 
17
- export const Icon = ({ name, prefix = "fas", size = "1x", color = "currentColor", className = "", ...props }: IconProps) => {
18
+ export const Icon = ({ name, prefix = "fas", size = "sm", color = "currentColor", className = "", ...props }: IconProps) => {
19
+ const sizeMap = {
20
+
21
+ 'xs': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
22
+ 'sm': { width: '0.625rem', height: '0.625rem', fontSize: '0.625rem' },
23
+ 'md': { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
24
+ 'xl': { width: '1rem', height: '1rem', fontSize: '1rem' },
25
+ undefined: { width: '0.75rem', height: '0.75rem', fontSize: '0.75rem' },
26
+ } as const;
27
+
18
28
  return (
19
29
  <FontAwesomeIcon
20
30
  icon={[prefix, name]}
21
- size={size}
31
+ style={sizeMap[size]}
22
32
  color={color}
23
33
  className={className}
24
34
  {...props}
35
+ width={sizeMap[size]?.width}
36
+ height={sizeMap[size]?.height}
25
37
  />
26
38
  );
27
39
  };
28
-
29
40
  Icon.propTypes = {
30
41
  name: PropTypes.string.isRequired,
31
42
  prefix: PropTypes.string,
@@ -50,8 +50,8 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
50
50
  },
51
51
 
52
52
  variants: {
53
- isValid: {
54
- true: {
53
+ color: {
54
+ success: {
55
55
  'label': {
56
56
  '&:focus button, &:hover button': {
57
57
  boxShadow: '0px 0px 0px 4px rgba(38, 167, 67, 0.50)',
@@ -65,7 +65,8 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
65
65
  backgroundColor: '$green500',
66
66
  },
67
67
  },
68
- false: {
68
+ blue: {},
69
+ error: {
69
70
  'label': {
70
71
  '&:focus button, &:hover button': {
71
72
  boxShadow: '0px 0px 0px 4px rgba(225, 86, 98, 0.50)'
@@ -98,9 +99,8 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
98
99
  },
99
100
 
100
101
  compoundVariants: [
101
-
102
102
  {
103
- isValid: undefined,
103
+ color: 'blue',
104
104
  disabled: false,
105
105
  css: {
106
106
  'label': {
@@ -118,7 +118,7 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
118
118
  },
119
119
 
120
120
  {
121
- isValid: undefined,
121
+ color: 'blue',
122
122
  disabled: true,
123
123
  css: {
124
124
  'label button': {
@@ -132,7 +132,7 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
132
132
  },
133
133
 
134
134
  {
135
- isValid: true,
135
+ color: 'success',
136
136
  disabled: true,
137
137
  css: {
138
138
  'label button': {
@@ -146,7 +146,7 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
146
146
  },
147
147
 
148
148
  {
149
- isValid: false,
149
+ color: 'error',
150
150
  disabled: true,
151
151
  css: {
152
152
  'label button': {
@@ -158,13 +158,17 @@ export const RadioGroupStyled = styled(RadioGroupRadix.Root, {
158
158
  }
159
159
  }
160
160
  }
161
- ]
161
+ ],
162
+ defaultVariants: {
163
+ color: 'blue',
164
+ disabled: false
165
+ }
162
166
  })
163
167
 
164
168
  export type RadioGroupProps = ComponentProps<typeof RadioGroupStyled> & {
165
169
  placeholder?: string
166
170
  children?: React.ReactNode
167
- isValid?: boolean
171
+ color?: string
168
172
  disabled?: boolean
169
173
  }
170
174
 
@@ -175,14 +179,12 @@ export type RadioItemProps = {
175
179
 
176
180
  export function RadioGroup({
177
181
  children,
178
- isValid,
179
182
  disabled,
180
183
  ...props
181
184
  }: RadioGroupProps) {
182
185
  return (
183
186
  <RadioGroupStyled
184
187
  disabled={disabled}
185
- isValid={isValid}
186
188
  {...props}
187
189
  >
188
190
  {children}