@lets-events/react 4.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.
Files changed (40) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +20 -18
  3. package/CHANGELOG.md +13 -0
  4. package/dist/index.d.mts +2855 -164
  5. package/dist/index.d.ts +2855 -164
  6. package/dist/index.js +1428 -403
  7. package/dist/index.mjs +1374 -369
  8. package/package.json +1 -1
  9. package/src/components/Alert.tsx +256 -0
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +129 -121
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button.tsx +328 -348
  14. package/src/components/ButtonGroup.tsx +484 -477
  15. package/src/components/CheckboxGroup.tsx +214 -208
  16. package/src/components/Container.tsx +40 -0
  17. package/src/components/Dropdown.tsx +167 -109
  18. package/src/components/Filter.tsx +164 -95
  19. package/src/components/Flex.tsx +118 -47
  20. package/src/components/Grid.tsx +138 -0
  21. package/src/components/Icon.tsx +47 -47
  22. package/src/components/Modal.tsx +109 -0
  23. package/src/components/RadioGroup.tsx +210 -203
  24. package/src/components/Section.tsx +34 -0
  25. package/src/components/Step.tsx +148 -0
  26. package/src/components/Switch.tsx +109 -0
  27. package/src/components/Text.tsx +32 -26
  28. package/src/components/TextField.tsx +241 -193
  29. package/src/index.tsx +27 -23
  30. package/src/styles/index.ts +38 -38
  31. package/src/types/typographyValues.ts +179 -0
  32. package/tsconfig.json +3 -3
  33. package/src/components/BadgeText.tsx +0 -29
  34. package/src/components/BodyText.tsx +0 -24
  35. package/src/components/CaptionText.tsx +0 -16
  36. package/src/components/DisplayText.tsx +0 -26
  37. package/src/components/Headline.tsx +0 -29
  38. package/src/components/Label.tsx +0 -28
  39. package/src/components/Subtitle.tsx +0 -26
  40. package/src/components/TooltipText.tsx +0 -15
@@ -0,0 +1,109 @@
1
+ import { Switch as RadixSwitch } from '@radix-ui/themes'
2
+ import type { ComponentProps } from 'react'
3
+ import { styled } from '../styles'
4
+
5
+ export const SwitchStyled = styled(RadixSwitch, {
6
+ all: 'unset',
7
+ borderRadius: '$full',
8
+ position: 'relative',
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ transition: 'all 0.3s',
13
+ cursor: 'pointer',
14
+
15
+ '&::before': {
16
+ content: '""',
17
+ position: 'absolute',
18
+ borderRadius: '$full',
19
+ pointerEvents: 'none',
20
+ cursor: 'pointer',
21
+ },
22
+ 'span': {
23
+ position: 'absolute',
24
+ top: '50%',
25
+ left: 0,
26
+ transform: 'translate(0, -50%)',
27
+ borderRadius: '50%',
28
+ transition: 'all 0.3s',
29
+ cursor: 'pointer',
30
+ borderWidth: '1px',
31
+ borderStyle: 'solid',
32
+ boxShadow: '0px 0px 4px 0px rgba(0, 0, 0, 0.24)',
33
+ },
34
+
35
+ '&[data-state="checked"] span': {
36
+ left: 'auto',
37
+ transform: 'translate(50%, -50%)',
38
+ },
39
+
40
+ variants: {
41
+ color: {
42
+ brand: {
43
+ '&::before': {
44
+ backgroundColor: '$brand50',
45
+ },
46
+ 'span': {
47
+ backgroundColor: '$dark50',
48
+ borderColor: '$neutral300',
49
+ },
50
+ '&[data-state="checked"] span': {
51
+ backgroundColor: '$brand500',
52
+ borderColor: '$brand500',
53
+ },
54
+ }
55
+ },
56
+ size: {
57
+ sm: {
58
+ width: '32px',
59
+ height: '20px',
60
+ '&::before': {
61
+ width: '$32',
62
+ height: '$12',
63
+ },
64
+
65
+ 'span': {
66
+ width: '$20',
67
+ height: '$20',
68
+ },
69
+ },
70
+ md: {
71
+ width: '40px',
72
+ height: '20px',
73
+ '&::before': {
74
+ width: '40px',
75
+ height: '16px',
76
+ },
77
+ 'span': {
78
+ width: '24px',
79
+ height: '24px',
80
+ },
81
+ },
82
+ lg: {
83
+ width: '56px',
84
+ height: '32px',
85
+ '&::before': {
86
+ width: '56px',
87
+ height: '24px',
88
+ },
89
+ 'span': {
90
+ width: '32px',
91
+ height: '32px',
92
+ },
93
+ },
94
+ },
95
+ },
96
+ defaultVariants: {
97
+ size: 'md',
98
+ color: 'brand',
99
+ },
100
+
101
+ })
102
+ export type SwitchProps = ComponentProps<typeof RadixSwitch> & {
103
+ color?: 'brand'
104
+ size?: 'sm' | 'md' | 'lg'
105
+ }
106
+
107
+ export function Switch(props: SwitchProps) {
108
+ return <SwitchStyled color="brand" defaultChecked {...props} />
109
+ }
@@ -1,26 +1,32 @@
1
- import { ComponentProps, ElementType } from 'react'
2
- import { styled } from '../styles'
3
- import { Text as TextRadix } from '@radix-ui/themes'
4
-
5
- export const Text = styled(TextRadix, {
6
- fontFamily: '$default',
7
- lineHeight: '$base',
8
- color: '$gray100',
9
- letterSpacing: '$2',
10
- fontWeight: '$semibold',
11
- variants: {
12
- size: {
13
- lg: { fontSize: '$56' },
14
- md: { fontSize: '$48' },
15
- sm: { fontSize: '$36' },
16
- },
17
- },
18
-
19
- defaultVariants: {
20
- size: 'md',
21
- },
22
- })
23
-
24
- export type TextProps = ComponentProps<typeof Text> & {
25
- as?: ElementType
26
- }
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+ import { Text as TextRadix } from '@radix-ui/themes'
4
+ import { CSS } from '@stitches/react'
5
+ import { typographyValues } from '../types/typographyValues'
6
+
7
+ export const TextStyle = styled(TextRadix, {
8
+ fontFamily: '$default',
9
+ lineHeight: '$base',
10
+ color: '$gray100',
11
+ variants: {
12
+ typography: typographyValues,
13
+ fontWeight: {
14
+ regular: { fontWeight: '$regular' },
15
+ medium: { fontWeight: '$medium' },
16
+ semibold: { fontWeight: '$semibold' },
17
+ bold: { fontWeight: '$bold' },
18
+ }
19
+ }
20
+ })
21
+
22
+ export type TextProps = ComponentProps<typeof TextStyle> & {
23
+ as?: ElementType,
24
+ asChild?: boolean
25
+ css?: CSS
26
+ }
27
+
28
+ export function Text({ ...props }: TextProps) {
29
+ return (
30
+ <TextStyle {...props} />
31
+ )
32
+ }
@@ -1,193 +1,241 @@
1
- import { ComponentProps, useState } from 'react'
2
- import { styled } from '../styles'
3
- import { TextField as TextFieldRadix } from "@radix-ui/themes";
4
- import Icon from './Icon';
5
-
6
- export const TextFieldStyled = styled(TextFieldRadix.Root, {
7
- height: '$40',
8
- fontFamily: '$default',
9
- letterSpacing: '0px',
10
- fontSize: '$13',
11
- padding: '$12 $14',
12
- borderRadius: '$sm',
13
- boxSizing: 'border-box',
14
- color: '$dark500',
15
- border: '1px solid $dark300',
16
- position: 'relative',
17
- display: 'flex',
18
- 'input': {
19
- order: 1,
20
- border: 'none',
21
- outline: 'none',
22
- padding: 0,
23
- margin: 0,
24
- width: '100%',
25
- },
26
-
27
- '&:has(input:focus)': {
28
- border: '2px solid $brand300',
29
- },
30
- '&:has(input:disabled)': {
31
- backgroundColor: '$dark100',
32
- color: '$dark400',
33
- border: '1px solid $dark200',
34
- cursor: 'not-allowed',
35
- },
36
- variants: {
37
- color: {
38
- default: {
39
- color: '$dark400',
40
- border: '1px solid $dark200',
41
- '&:has(input:focus)': {
42
- border: '2px solid $brand300',
43
- },
44
- '&:has(input:disabled)': {
45
- backgroundColor: '$dark100',
46
- color: '$dark400',
47
- border: '1px solid $dark200',
48
- cursor: 'not-allowed',
49
- },
50
- },
51
- error:{
52
- border: '1px solid $error400',
53
- color: '$error400',
54
- 'input::placeholder': {
55
- color: '$error400',
56
- },
57
- '& hast(input:focus)': {
58
- border: '2px solid $error400',
59
- },
60
- '&:has(input:disabled)': {
61
- backgroundColor: '$error50',
62
- color: '$error300',
63
- border: '1px solid $error100',
64
- cursor: 'not-allowed',
65
- },
66
- },
67
-
68
- },
69
- isValid: {
70
- true: {},
71
- false: {
72
- }
73
- },
74
- },
75
-
76
- compoundVariants: [
77
- {
78
- isValid: false,
79
- css: {
80
- border: '1px solid $error400',
81
- color: '$error400',
82
- backgroundColor: '$error50',
83
- 'input': {
84
- '&::placeholder': {
85
- color: '$error400',
86
- },
87
- backgroundColor: '$error50',
88
- },
89
- '&:has(input:focus)': {
90
- border: '2px solid $error400',
91
- },
92
- '&:has(input:disabled)': {
93
- 'input': {
94
- backgroundColor: '$error50',
95
- },
96
- backgroundColor: '$error50',
97
- color: '$error300',
98
- border: '1px solid $error100',
99
- cursor: 'not-allowed',
100
- },
101
- }
102
- },
103
- {
104
- isValid: true,
105
- css: {
106
- '&:has(input:focus)': {
107
- border: '2px solid $success500',
108
- },
109
- '&:has(input:disabled)': {
110
- backgroundColor: '$dark100',
111
- color: '$dark400',
112
- border: '1px solid $dark200',
113
- cursor: 'not-allowed',
114
- },
115
- }
116
- }
117
- ],
118
- })
119
-
120
- export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
121
- display: 'flex',
122
- alignItems: 'center',
123
- justifyContent: 'center',
124
- })
125
-
126
- export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
127
- placeholder?: string
128
- children?: React.ReactNode
129
- isValid?: boolean,
130
- name?: string,
131
- }
132
-
133
- export type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, 'color'> & {
134
- placeholder?: string
135
- children?: React.ReactNode
136
- position?: 'flex-start' | 'flex-end'
137
- onClick?: () => void,
138
- color?: "error" | "success" | undefined
139
- }
140
-
141
- export function TextField({
142
- children,
143
- isValid,
144
- name,
145
- color,
146
- ...props
147
- }: TextFieldProps) {
148
-
149
- return (
150
- <TextFieldStyled color={color} isValid={isValid} name={name} {...props}>
151
- {children}
152
- {isValid && (
153
- <TextFieldSlot position='flex-end' name={name} color={color as TextFieldSlotProps['color']}>
154
- <Icon name='check' />
155
- </TextFieldSlot>
156
- )}
157
- </TextFieldStyled>
158
- )
159
- }
160
-
161
- export function TextFieldSlot({
162
- children,
163
- position = 'flex-start',
164
- onClick,
165
- ...props
166
- }: TextFieldSlotProps) {
167
- console.log('onclick', onClick)
168
-
169
- return (
170
- <>
171
- {
172
- !!onClick ?
173
- <TextFieldSlotStyled {...{ ...props, color: undefined }} style={{
174
- position: 'absolute',
175
- left: position === 'flex-end' ? 'none' : 15,
176
- right: position === 'flex-start' ? 'none' : 15,
177
- padding: 13,
178
- zIndex: 2,
179
- top: 0,
180
- cursor: 'pointer',
181
- }} onClick={() => onClick()}>{children}</TextFieldSlotStyled>
182
- :
183
- <TextFieldSlotStyled {...{ ...props, color: undefined }} style={{
184
- float: position === 'flex-start' ? 'left' : 'right',
185
- order: position === 'flex-start' ? 0 : 2,
186
- marginLeft: position === 'flex-start' ? 0 : 15,
187
- marginRight: position === 'flex-end' ? 0 : 15,
188
- }}>{children}</TextFieldSlotStyled>
189
-
190
- }
191
- </>
192
- )
193
- }
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+ import { TextField as TextFieldRadix } from "@radix-ui/themes";
4
+ import Icon from './Icon';
5
+ import { typographyValues } from '../types/typographyValues';
6
+
7
+ export const TextFieldStyled = styled(TextFieldRadix.Root, {
8
+ height: '$40',
9
+ fontFamily: '$default',
10
+ padding: '$12 $14',
11
+ borderRadius: '$sm',
12
+ boxSizing: 'border-box',
13
+ color: '$dark500',
14
+ border: '1px solid $dark300',
15
+ position: 'relative',
16
+ display: 'flex',
17
+
18
+ 'input': {
19
+ order: 1,
20
+ border: 'none',
21
+ outline: 'none',
22
+ padding: 0,
23
+ margin: 0,
24
+ width: '100%',
25
+ font: 'inherit',
26
+ },
27
+
28
+ '&:has(input:focus)': {
29
+ border: '2px solid $brand300',
30
+ },
31
+ '&:has(input:disabled)': {
32
+ backgroundColor: '$dark100',
33
+ color: '$dark400',
34
+ border: '1px solid $dark200',
35
+ cursor: 'not-allowed',
36
+ },
37
+
38
+ variants: {
39
+ color: {
40
+ default: {
41
+ color: '$dark400',
42
+ border: '1px solid $dark200',
43
+ '&:has(input:focus)': {
44
+ border: '2px solid $brand300',
45
+ },
46
+ '&:has(input:disabled)': {
47
+ backgroundColor: '$dark100',
48
+ color: '$dark400',
49
+ border: '1px solid $dark200',
50
+ cursor: 'not-allowed',
51
+ },
52
+ },
53
+ error: {
54
+ border: '1px solid $error400',
55
+ color: '$error400',
56
+ 'input::placeholder': {
57
+ color: '$error400',
58
+ },
59
+ '&:has(input:focus)': {
60
+ border: '2px solid $error400',
61
+ },
62
+ '&:has(input:disabled)': {
63
+ backgroundColor: '$error50',
64
+ color: '$error300',
65
+ border: '1px solid $error100',
66
+ cursor: 'not-allowed',
67
+ },
68
+ }
69
+ },
70
+
71
+ typography: typographyValues,
72
+ fontWeight: {
73
+ regular: { fontWeight: '$regular' },
74
+ medium: { fontWeight: '$medium' },
75
+ semibold: { fontWeight: '$semibold' },
76
+ bold: { fontWeight: '$bold' },
77
+ },
78
+ isValid: {
79
+ true: {},
80
+ false: {}
81
+ },
82
+ },
83
+
84
+ compoundVariants: [
85
+ {
86
+ isValid: false,
87
+ css: {
88
+ border: '1px solid $error400',
89
+ color: '$error400',
90
+ backgroundColor: '$error50',
91
+ 'input': {
92
+ '&::placeholder': {
93
+ color: '$error400',
94
+ },
95
+ backgroundColor: '$error50',
96
+ },
97
+ '&:has(input:focus)': {
98
+ border: '2px solid $error400',
99
+ },
100
+ '&:has(input:disabled)': {
101
+ 'input': {
102
+ backgroundColor: '$error50',
103
+ },
104
+ backgroundColor: '$error50',
105
+ color: '$error300',
106
+ border: '1px solid $error100',
107
+ cursor: 'not-allowed',
108
+ },
109
+ }
110
+ },
111
+ {
112
+ isValid: true,
113
+ css: {
114
+ '&:has(input:focus)': {
115
+ border: '2px solid $success500',
116
+ },
117
+ '&:has(input:disabled)': {
118
+ backgroundColor: '$dark100',
119
+ color: '$dark400',
120
+ border: '1px solid $dark200',
121
+ cursor: 'not-allowed',
122
+ },
123
+ }
124
+ }
125
+ ],
126
+ })
127
+
128
+ export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
129
+ display: 'flex',
130
+ alignItems: 'center',
131
+ justifyContent: 'center',
132
+
133
+ variants: {
134
+ typography: typographyValues,
135
+ fontWeight: {
136
+ regular: { fontWeight: '$regular' },
137
+ medium: { fontWeight: '$medium' },
138
+ semibold: { fontWeight: '$semibold' },
139
+ bold: { fontWeight: '$bold' },
140
+ }
141
+ }
142
+ })
143
+
144
+ export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
145
+ placeholder?: string
146
+ children?: React.ReactNode
147
+ isValid?: boolean
148
+ name?: string
149
+ typography?: string
150
+ fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
151
+ }
152
+
153
+ export type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, 'color'> & {
154
+ placeholder?: string
155
+ children?: React.ReactNode
156
+ position?: 'flex-start' | 'flex-end'
157
+ onClick?: () => void
158
+ color?: "error" | "success" | undefined
159
+ typography?: string
160
+ fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
161
+ }
162
+
163
+ export function TextField({
164
+ children,
165
+ isValid,
166
+ name,
167
+ color,
168
+ typography,
169
+ fontWeight,
170
+ ...props
171
+ }: TextFieldProps) {
172
+ return (
173
+ <TextFieldStyled
174
+ color={color}
175
+ isValid={isValid}
176
+ name={name}
177
+ typography={typography}
178
+ fontWeight={fontWeight}
179
+ {...props}
180
+ >
181
+ {children}
182
+ {isValid && (
183
+ <TextFieldSlot
184
+ position='flex-end'
185
+ name={name}
186
+ color={color as TextFieldSlotProps['color']}
187
+ typography={typography}
188
+ fontWeight={fontWeight}
189
+ >
190
+ <Icon name='check' />
191
+ </TextFieldSlot>
192
+ )}
193
+ </TextFieldStyled>
194
+ )
195
+ }
196
+
197
+ export function TextFieldSlot({
198
+ children,
199
+ position = 'flex-start',
200
+ onClick,
201
+ typography = 'bodyXS',
202
+ fontWeight = 'regular',
203
+ ...props
204
+ }: TextFieldSlotProps) {
205
+ const sharedStyles = {
206
+ typography,
207
+ fontWeight,
208
+ ...props,
209
+ color: undefined,
210
+ }
211
+
212
+ return !!onClick ? (
213
+ <TextFieldSlotStyled
214
+ {...sharedStyles}
215
+ style={{
216
+ position: 'absolute',
217
+ left: position === 'flex-end' ? 'none' : 15,
218
+ right: position === 'flex-start' ? 'none' : 15,
219
+ padding: 13,
220
+ zIndex: 2,
221
+ top: 0,
222
+ cursor: 'pointer',
223
+ }}
224
+ onClick={() => onClick()}
225
+ >
226
+ {children}
227
+ </TextFieldSlotStyled>
228
+ ) : (
229
+ <TextFieldSlotStyled
230
+ {...sharedStyles}
231
+ style={{
232
+ float: position === 'flex-start' ? 'left' : 'right',
233
+ order: position === 'flex-start' ? 0 : 2,
234
+ marginLeft: position === 'flex-start' ? 0 : 15,
235
+ marginRight: position === 'flex-end' ? 0 : 15,
236
+ }}
237
+ >
238
+ {children}
239
+ </TextFieldSlotStyled>
240
+ )
241
+ }
package/src/index.tsx CHANGED
@@ -1,23 +1,27 @@
1
- export * from './components/Icon'
2
- export * from './components/Text'
3
- export * from './components/DisplayText'
4
- export * from './components/Headline'
5
- export * from './components/Subtitle'
6
- export * from './components/BodyText'
7
- export * from './components/Label'
8
- export * from './components/BadgeText'
9
- export * from './components/CaptionText'
10
- export * from './components/TooltipText'
11
-
12
- export * from './components/Button'
13
- export * from './components/ButtonGroup'
14
- export * from './components/Avatar'
15
- export * from './components/Flex'
16
- export * from './components/Box'
17
- export * from './components/TextField'
18
- export * from './components/RadioGroup'
19
- export * from './components/CheckboxGroup'
20
- export * from './components/Filter'
21
- export * from './components/Dropdown'
22
- export * from './components/Badge'
23
-
1
+ // Icon
2
+ export * from './components/Icon'
3
+
4
+ // Text
5
+ export * from './components/Text'
6
+
7
+ // Components
8
+ export * from './components/Button'
9
+ export * from './components/ButtonGroup'
10
+ export * from './components/Avatar'
11
+ export * from './components/TextField'
12
+ export * from './components/RadioGroup'
13
+ export * from './components/CheckboxGroup'
14
+ export * from './components/Filter'
15
+ export * from './components/Dropdown'
16
+ export * from './components/Badge'
17
+ export * from './components/Modal'
18
+ export * from './components/Alert'
19
+ export * from './components/Switch'
20
+ export * from './components/Step'
21
+
22
+ // Layouts
23
+ export * from './components/Flex'
24
+ export * from './components/Box'
25
+ export * from './components/Grid'
26
+ export * from './components/Container'
27
+ export * from './components/Section'