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