@lets-events/react 5.0.0 → 6.1.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 (37) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +20 -18
  3. package/CHANGELOG.md +14 -1
  4. package/dist/index.d.mts +1916 -12
  5. package/dist/index.d.ts +1916 -12
  6. package/dist/index.js +5129 -348
  7. package/dist/index.mjs +5083 -307
  8. package/package.json +3 -2
  9. package/src/components/Alert.tsx +255 -255
  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/index.tsx +13 -0
  14. package/src/components/Button/styledComponents.ts +359 -0
  15. package/src/components/ButtonGroup.tsx +484 -477
  16. package/src/components/Calendar/index.tsx +122 -0
  17. package/src/components/Calendar/styledComponents.ts +195 -0
  18. package/src/components/CheckboxGroup.tsx +214 -208
  19. package/src/components/Container.tsx +39 -39
  20. package/src/components/Dropdown.tsx +167 -109
  21. package/src/components/Filter.tsx +164 -95
  22. package/src/components/Flex.tsx +117 -117
  23. package/src/components/Grid.tsx +137 -137
  24. package/src/components/Icon.tsx +47 -47
  25. package/src/components/Modal.tsx +108 -108
  26. package/src/components/RadioGroup.tsx +210 -203
  27. package/src/components/Section.tsx +33 -33
  28. package/src/components/Step.tsx +147 -147
  29. package/src/components/Switch.tsx +108 -108
  30. package/src/components/Text.tsx +31 -31
  31. package/src/components/TextField.tsx +261 -193
  32. package/src/components/TimePicker.tsx +125 -0
  33. package/src/index.tsx +29 -27
  34. package/src/styles/index.ts +38 -38
  35. package/src/types/typographyValues.ts +179 -0
  36. package/tsconfig.json +3 -3
  37. package/src/components/Button.tsx +0 -343
@@ -1,193 +1,261 @@
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
+ textAlign: 'inherit',
27
+ },
28
+
29
+ '&:has(input:focus)': {
30
+ border: '2px solid $brand300',
31
+ },
32
+ '&:has(input:disabled)': {
33
+ backgroundColor: '$dark100',
34
+ color: '$dark400',
35
+ border: '1px solid $dark200',
36
+ cursor: 'not-allowed',
37
+ },
38
+
39
+ variants: {
40
+ color: {
41
+ default: {
42
+ color: '$dark400',
43
+ border: '1px solid $dark200',
44
+ '&:has(input:focus)': {
45
+ border: '2px solid $brand300',
46
+ },
47
+ '&:has(input:disabled)': {
48
+ backgroundColor: '$dark100',
49
+ color: '$dark400',
50
+ border: '1px solid $dark200',
51
+ cursor: 'not-allowed',
52
+ },
53
+ },
54
+ error: {
55
+ border: '1px solid $error400',
56
+ color: '$error400',
57
+ 'input::placeholder': {
58
+ color: '$error400',
59
+ },
60
+ '&:has(input:focus)': {
61
+ border: '2px solid $error400',
62
+ },
63
+ '&:has(input:disabled)': {
64
+ backgroundColor: '$error50',
65
+ color: '$error300',
66
+ border: '1px solid $error100',
67
+ cursor: 'not-allowed',
68
+ },
69
+ }
70
+ },
71
+
72
+ typography: typographyValues,
73
+ fontWeight: {
74
+ regular: { fontWeight: '$regular' },
75
+ medium: { fontWeight: '$medium' },
76
+ semibold: { fontWeight: '$semibold' },
77
+ bold: { fontWeight: '$bold' },
78
+ },
79
+ textAlign: {
80
+ left: { textAlign: 'left' },
81
+ center: { textAlign: 'center' },
82
+ right: { textAlign: 'right' },
83
+ },
84
+ isValid: {
85
+ true: {},
86
+ false: {}
87
+ },
88
+ },
89
+
90
+ compoundVariants: [
91
+ {
92
+ isValid: false,
93
+ css: {
94
+ border: '1px solid $error400',
95
+ color: '$error400',
96
+ backgroundColor: '$error50',
97
+ 'input': {
98
+ '&::placeholder': {
99
+ color: '$error400',
100
+ },
101
+ backgroundColor: '$error50',
102
+ },
103
+ '&:has(input:focus)': {
104
+ border: '2px solid $error400',
105
+ },
106
+ '&:has(input:disabled)': {
107
+ 'input': {
108
+ backgroundColor: '$error50',
109
+ },
110
+ backgroundColor: '$error50',
111
+ color: '$error300',
112
+ border: '1px solid $error100',
113
+ cursor: 'not-allowed',
114
+ },
115
+ }
116
+ },
117
+ {
118
+ isValid: true,
119
+ css: {
120
+ '&:has(input:focus)': {
121
+ border: '2px solid $success500',
122
+ },
123
+ '&:has(input:disabled)': {
124
+ backgroundColor: '$dark100',
125
+ color: '$dark400',
126
+ border: '1px solid $dark200',
127
+ cursor: 'not-allowed',
128
+ },
129
+ }
130
+ }
131
+ ],
132
+ })
133
+
134
+ export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
135
+ display: 'flex',
136
+ alignItems: 'center',
137
+ justifyContent: 'center',
138
+
139
+ variants: {
140
+ typography: typographyValues,
141
+ fontWeight: {
142
+ regular: { fontWeight: '$regular' },
143
+ medium: { fontWeight: '$medium' },
144
+ semibold: { fontWeight: '$semibold' },
145
+ bold: { fontWeight: '$bold' },
146
+ },
147
+ textAlign: {
148
+ left: { textAlign: 'left' },
149
+ right: { textAlign: 'right' },
150
+ center: { textAlign: 'center' },
151
+ }
152
+ }
153
+ })
154
+
155
+ export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
156
+ placeholder?: string
157
+ children?: React.ReactNode
158
+ isValid?: boolean
159
+ name?: string
160
+ typography?: string
161
+ fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
162
+ textAlign?: 'left' | 'right' | 'center'
163
+ }
164
+
165
+ export type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, 'color'> & {
166
+ placeholder?: string
167
+ children?: React.ReactNode
168
+ position?: 'flex-start' | 'flex-end'
169
+ onClick?: () => void
170
+ color?: "error" | "success" | undefined
171
+ typography?: string
172
+ fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
173
+ textAlign?: 'left' | 'right' | 'center'
174
+ }
175
+
176
+ export function TextField({
177
+ children,
178
+ isValid,
179
+ name,
180
+ color,
181
+ typography,
182
+ fontWeight,
183
+ textAlign = 'right',
184
+ ...props
185
+ }: TextFieldProps) {
186
+ return (
187
+ <TextFieldStyled
188
+ color={color}
189
+ isValid={isValid}
190
+ name={name}
191
+ typography={typography}
192
+ fontWeight={fontWeight}
193
+ textAlign={textAlign}
194
+ {...props}
195
+ >
196
+ {children}
197
+ {isValid && (
198
+ <TextFieldSlot
199
+ position='flex-end'
200
+ name={name}
201
+ color={color as TextFieldSlotProps['color']}
202
+ typography={typography}
203
+ fontWeight={fontWeight}
204
+ textAlign={textAlign}
205
+ >
206
+ <Icon name='check' />
207
+ </TextFieldSlot>
208
+ )}
209
+ </TextFieldStyled>
210
+ )
211
+ }
212
+
213
+ export function TextFieldSlot({
214
+ children,
215
+ position = 'flex-start',
216
+ onClick,
217
+ typography = 'bodyXS',
218
+ fontWeight = 'regular',
219
+ textAlign = 'right',
220
+ ...props
221
+ }: TextFieldSlotProps) {
222
+ const sharedStyles = {
223
+ typography,
224
+ fontWeight,
225
+ textAlign,
226
+ ...props,
227
+ color: undefined,
228
+ }
229
+
230
+ return !!onClick ? (
231
+ <TextFieldSlotStyled
232
+ {...sharedStyles}
233
+ style={{
234
+ position: 'absolute',
235
+ left: position === 'flex-end' ? 'none' : 15,
236
+ right: position === 'flex-start' ? 'none' : 15,
237
+ textAlign: textAlign,
238
+ padding: 13,
239
+ zIndex: 2,
240
+ top: 0,
241
+ cursor: 'pointer',
242
+ }}
243
+ onClick={() => onClick()}
244
+ >
245
+ {children}
246
+ </TextFieldSlotStyled>
247
+ ) : (
248
+ <TextFieldSlotStyled
249
+ {...sharedStyles}
250
+ style={{
251
+ float: position === 'flex-start' ? 'left' : 'right',
252
+ order: position === 'flex-start' ? 0 : 2,
253
+ marginLeft: position === 'flex-start' ? 0 : 15,
254
+ marginRight: position === 'flex-end' ? 0 : 15,
255
+ textAlign: textAlign,
256
+ }}
257
+ >
258
+ {children}
259
+ </TextFieldSlotStyled>
260
+ )
261
+ }
@@ -0,0 +1,125 @@
1
+ import React, { useCallback, useState } from 'react'
2
+ import { Dialog as TimePickerRadix } from '@radix-ui/themes'
3
+ import { Box } from './Box'
4
+ import { Button } from './Button'
5
+ import { TextField, TextFieldSlot } from './TextField'
6
+ import { Text } from './Text'
7
+ import Icon from './Icon'
8
+ import { styled } from '../styles'
9
+
10
+ export const TimePickerStyled = styled('div', {
11
+ fontFamily: '$default',
12
+ lineHeight: '$base',
13
+ fontSize: '$14',
14
+ maxWidth: '200px',
15
+ borderRadius: '$sm',
16
+ })
17
+ export const TimePickerDialogStyled = styled(TimePickerRadix.Content, {
18
+ width: '100%',
19
+ maxWidth: '8.875rem',
20
+ border: '1px solid $neutral300',
21
+ borderRadius: '$sm',
22
+ boxShadow: '0px 2px 8px 0px $shadow50',
23
+ })
24
+ export const TimePickerFooterStyled = styled('div', {
25
+ borderTop: '2px solid $neutral100',
26
+ padding: '$4 $16',
27
+ display: 'flex',
28
+ justifyContent: 'center',
29
+ alignItems: 'center',
30
+ height: '3rem',
31
+ })
32
+ export const TimerPickerContentStyled = styled('div', {
33
+ display: 'flex',
34
+ gap: '$16',
35
+ alignItems: 'center',
36
+ padding: '$16 $16 $8 ',
37
+ '& > div:nth-child(2)': {
38
+ order: 2
39
+ }
40
+ })
41
+ export type TimePickerProps = {
42
+ selected: string | undefined
43
+ setSelected: React.Dispatch<React.SetStateAction<string | undefined>>
44
+ }
45
+
46
+ export function TimePicker({ selected, setSelected }: TimePickerProps) {
47
+ const [hours, setHours] = useState('00')
48
+ const [minutes, setMinutes] = useState('00')
49
+
50
+ const pad = (num: number) => String(num).padStart(2, '0')
51
+
52
+ const handleInputValue = useCallback((time: string) => {
53
+ setSelected(time)
54
+ }, [setSelected])
55
+
56
+ const handleIncrement = useCallback((type: 'hours' | 'minutes') => {
57
+ if (type === 'hours') {
58
+ const next = (parseInt(hours) + 1) % 24
59
+ setHours(pad(next))
60
+ } else {
61
+ const next = (parseInt(minutes) + 1) % 60
62
+ setMinutes(pad(next))
63
+ }
64
+ }, [hours, minutes])
65
+
66
+ const handleDecrement = useCallback((type: 'hours' | 'minutes') => {
67
+ if (type === 'hours') {
68
+ const prev = (parseInt(hours) - 1 + 24) % 24
69
+ setHours(pad(prev))
70
+ } else {
71
+ const prev = (parseInt(minutes) - 1 + 60) % 60
72
+ setMinutes(pad(prev))
73
+ }
74
+ }, [hours, minutes])
75
+
76
+ return (
77
+ <TimePickerRadix.Root>
78
+ <TimePickerStyled >
79
+ <TimePickerRadix.Trigger>
80
+ <TextField value={selected} readOnly type="text" placeholder="00:00" typography="labelSmall" fontWeight="regular">
81
+ <TextFieldSlot>
82
+ <Icon name="clock" size="xl" />
83
+ </TextFieldSlot>
84
+ </TextField>
85
+ </TimePickerRadix.Trigger>
86
+ <TimePickerDialogStyled>
87
+ <TimerPickerContentStyled>
88
+ {['hours', 'minutes'].map((unit) => (
89
+ <Box key={unit} style={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
90
+ <Button variant='text' onClick={() => handleIncrement(unit as 'hours' | 'minutes')}>
91
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
92
+ <path d="M0 8C0 3.58172 3.58172 0 8 0H24C28.4183 0 32 3.58172 32 8V24C32 28.4183 28.4183 32 24 32H8C3.58172 32 0 28.4183 0 24V8Z" fill="white" />
93
+ <path d="M16.7063 12.2937C16.3157 11.9031 15.6813 11.9031 15.2907 12.2937L10.2907 17.2937C9.9001 17.6843 9.9001 18.3187 10.2907 18.7093C10.6813 19.1 11.3157 19.1 11.7063 18.7093L16.0001 14.4156L20.2938 18.7062C20.6845 19.0968 21.3188 19.0968 21.7095 18.7062C22.1001 18.3156 22.1001 17.6812 21.7095 17.2906L16.7095 12.2906L16.7063 12.2937Z" fill="#808289" />
94
+ </svg>
95
+ </Button>
96
+ <TextField value={unit === 'hours' ? hours : minutes} onChange={(e) => handleInputValue(e.target.value)} type="text" placeholder="00" typography="labelSmall" fontWeight="regular" textAlign="center" style={{ padding: '4px' }} />
97
+
98
+ <Button variant='text' onClick={() => handleDecrement(unit as 'hours' | 'minutes')}>
99
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
100
+ <path d="M0 8C0 3.58172 3.58172 0 8 0H24C28.4183 0 32 3.58172 32 8V24C32 28.4183 28.4183 32 24 32H8C3.58172 32 0 28.4183 0 24V8Z" fill="white" />
101
+ <path d="M15.2937 19.7063C15.6843 20.0969 16.3187 20.0969 16.7093 19.7063L21.7093 14.7063C22.0999 14.3157 22.0999 13.6813 21.7093 13.2907C21.3187 12.9 20.6843 12.9 20.2937 13.2907L15.9999 17.5844L11.7062 13.2938C11.3155 12.9032 10.6812 12.9032 10.2905 13.2938C9.8999 13.6844 9.8999 14.3188 10.2905 14.7094L15.2905 19.7094L15.2937 19.7063Z" fill="#808289" />
102
+ </svg>
103
+ </Button>
104
+ </Box>
105
+ ))}
106
+ <Text >:</Text>
107
+ </TimerPickerContentStyled>
108
+ <TimePickerFooterStyled>
109
+ <TimePickerRadix.Close>
110
+ <Button
111
+ variant='text'
112
+ color='brand'
113
+ onClick={() => handleInputValue(`${hours}:${minutes}`)}
114
+ typography='buttonMedium'
115
+ fontWeight='medium'
116
+ >
117
+ Aplicar
118
+ </Button>
119
+ </TimePickerRadix.Close>
120
+ </TimePickerFooterStyled>
121
+ </TimePickerDialogStyled>
122
+ </TimePickerStyled>
123
+ </TimePickerRadix.Root>
124
+ )
125
+ }
package/src/index.tsx CHANGED
@@ -1,27 +1,29 @@
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'
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/Calendar'
19
+ export * from './components/TimePicker'
20
+ export * from './components/Alert'
21
+ export * from './components/Switch'
22
+ export * from './components/Step'
23
+
24
+ // Layouts
25
+ export * from './components/Flex'
26
+ export * from './components/Box'
27
+ export * from './components/Grid'
28
+ export * from './components/Container'
29
+ export * from './components/Section'