@lets-events/react 11.5.3 → 11.6.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 (74) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +20 -18
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +105 -14
  5. package/dist/index.d.ts +105 -14
  6. package/dist/index.js +1005 -143
  7. package/dist/index.mjs +966 -112
  8. package/package.json +2 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +125 -125
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +16 -16
  14. package/src/components/Button/styledComponents.ts +287 -287
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +136 -136
  17. package/src/components/Calendar/styledComponents.ts +209 -209
  18. package/src/components/Card.tsx +48 -48
  19. package/src/components/CheckboxGroup.tsx +176 -196
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Drawer/index.tsx +48 -48
  22. package/src/components/Drawer/styledComponents.ts +46 -46
  23. package/src/components/Dropdown.tsx +192 -167
  24. package/src/components/Filter.tsx +164 -164
  25. package/src/components/Flex.tsx +118 -118
  26. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -0
  27. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -0
  28. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +45 -0
  29. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -0
  30. package/src/components/FormFields/AddressFormFields/index.tsx +139 -0
  31. package/src/components/FormFields/BirthDateFormField.tsx +87 -0
  32. package/src/components/FormFields/CNPJFormField.tsx +89 -0
  33. package/src/components/FormFields/CPFFormField.tsx +79 -0
  34. package/src/components/FormFields/CheckboxGroupFormField.tsx +90 -0
  35. package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
  36. package/src/components/FormFields/Form.tsx +29 -25
  37. package/src/components/FormFields/FormLabel.tsx +29 -29
  38. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +42 -0
  39. package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
  40. package/src/components/FormFields/PhoneFormField.tsx +130 -130
  41. package/src/components/FormFields/RadioGroupFormField.tsx +84 -0
  42. package/src/components/FormFields/SelectFormField.tsx +93 -0
  43. package/src/components/FormFields/TextAreaFormField.tsx +48 -49
  44. package/src/components/FormFields/TextFormField.tsx +76 -46
  45. package/src/components/Grid.tsx +137 -137
  46. package/src/components/Icon.tsx +47 -47
  47. package/src/components/MenuDropdown/index.tsx +30 -30
  48. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  49. package/src/components/Modal.tsx +90 -90
  50. package/src/components/MultiSelect.tsx +218 -218
  51. package/src/components/RadioGroup.tsx +210 -210
  52. package/src/components/Section.tsx +33 -33
  53. package/src/components/Step.tsx +164 -164
  54. package/src/components/Switch.tsx +108 -108
  55. package/src/components/Text.tsx +38 -38
  56. package/src/components/TextField.tsx +312 -315
  57. package/src/components/TextareaField.tsx +128 -128
  58. package/src/components/TimePicker.tsx +298 -298
  59. package/src/components/Toast/components/ToastItem.tsx +41 -41
  60. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  61. package/src/components/Toast/hooks/useToast.ts +12 -12
  62. package/src/components/Toast/index.tsx +5 -5
  63. package/src/components/Toast/styles/index.ts +135 -135
  64. package/src/components/Toast/types/index.ts +46 -46
  65. package/src/components/Tooltip/index.tsx +66 -66
  66. package/src/components/Tooltip/styles.ts +77 -77
  67. package/src/hooks/useCountries.ts +41 -0
  68. package/src/hooks/useOnClickOutside.tsx +20 -20
  69. package/src/index.tsx +52 -45
  70. package/src/styles/index.ts +38 -38
  71. package/src/types/typographyValues.ts +178 -178
  72. package/src/utils/getNestedValue.ts +3 -0
  73. package/src/utils/states.ts +29 -0
  74. package/tsconfig.json +3 -3
@@ -1,315 +1,312 @@
1
- import React, { ComponentProps, ReactNode } 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
- import { TextStyle } from "./Text";
7
- import { Flex } from "./Flex";
8
- import { format, MaskOptions, useMask, unformat } from "@react-input/mask";
9
-
10
- export const TextFieldStyled = styled(TextFieldRadix.Root, {
11
- height: "$40",
12
- fontFamily: "$default",
13
- borderRadius: "$sm",
14
- boxSizing: "border-box",
15
- color: "$dark500",
16
- border: "1px solid $dark300",
17
- position: "relative",
18
- display: "flex",
19
- width: "100%",
20
- alignItems: "center",
21
- padding: "0 $14",
22
- gap: "$14",
23
- backgroundColor: '$dark50',
24
- input: {
25
- order: 1,
26
- outline: "none",
27
- border: "none",
28
- margin: 0,
29
- width: "100%",
30
- font: "inherit",
31
- textAlign: "left",
32
- },
33
-
34
- "&:has(input:focus)": {
35
- border: "2px solid $brand300",
36
- },
37
- "&:has(input:disabled)": {
38
- backgroundColor: "$dark100",
39
- color: "$dark400",
40
- border: "1px solid $dark200",
41
- cursor: "not-allowed",
42
- },
43
-
44
- variants: {
45
- color: {
46
- default: {
47
- color: "$dark400",
48
- border: "1px solid $dark300",
49
- "&:has(input:focus)": {
50
- border: "2px solid $brand300",
51
- },
52
- "&:has(input:disabled)": {
53
- backgroundColor: "$dark100",
54
- color: "$dark400",
55
- border: "1px solid $dark300",
56
- cursor: "not-allowed",
57
- },
58
- },
59
- error: {
60
- border: "1px solid $error400",
61
- color: "$error400",
62
- "input::placeholder": {
63
- color: "$error400",
64
- },
65
- "&:has(input:focus)": {
66
- border: "2px solid $error400",
67
- },
68
- "&:has(input:disabled)": {
69
- backgroundColor: "$error50",
70
- color: "$error300",
71
- border: "1px solid $error100",
72
- cursor: "not-allowed",
73
- },
74
- },
75
- },
76
-
77
- typography: typographyValues,
78
- fontWeight: {
79
- regular: { fontWeight: "$regular" },
80
- medium: { fontWeight: "$medium" },
81
- semibold: { fontWeight: "$semibold" },
82
- bold: { fontWeight: "$bold" },
83
- },
84
- textAlign: {
85
- left: { textAlign: "left" },
86
- center: { textAlign: "center" },
87
- right: { textAlign: "right" },
88
- },
89
- isValid: {
90
- true: {},
91
- false: {},
92
- },
93
- },
94
-
95
- compoundVariants: [
96
- {
97
- isValid: false,
98
- css: {
99
- border: "1px solid $error400",
100
- color: "$error400",
101
- backgroundColor: "$error50",
102
- input: {
103
- "&::placeholder": {
104
- color: "$error400",
105
- },
106
- backgroundColor: "$error50",
107
- },
108
- "&:has(input:focus)": {
109
- border: "2px solid $error400",
110
- },
111
- "&:has(input:disabled)": {
112
- input: {
113
- backgroundColor: "$error50",
114
- },
115
- backgroundColor: "$error50",
116
- color: "$error300",
117
- border: "1px solid $error100",
118
- cursor: "not-allowed",
119
- },
120
- },
121
- },
122
- {
123
- isValid: true,
124
- css: {
125
- "&:has(input:focus)": {
126
- border: "2px solid $success500",
127
- },
128
- "&:has(input:disabled)": {
129
- backgroundColor: "$dark100",
130
- color: "$dark400",
131
- border: "1px solid $dark200",
132
- cursor: "not-allowed",
133
- },
134
- },
135
- },
136
- ],
137
- });
138
-
139
- export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
140
- display: "flex",
141
- alignItems: "center",
142
- justifyContent: "center",
143
- padding: 4,
144
-
145
- variants: {
146
- typography: typographyValues,
147
- fontWeight: {
148
- regular: { fontWeight: "$regular" },
149
- medium: { fontWeight: "$medium" },
150
- semibold: { fontWeight: "$semibold" },
151
- bold: { fontWeight: "$bold" },
152
- },
153
- textAlign: {
154
- left: { textAlign: "left" },
155
- right: { textAlign: "right" },
156
- center: { textAlign: "center" },
157
- },
158
- },
159
- });
160
-
161
- export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
162
- addon?: ReactNode;
163
- placeholder?: string;
164
- children?: React.ReactNode;
165
- isValid?: boolean;
166
- name?: string;
167
- typography?: string;
168
- fontWeight?: "regular" | "medium" | "semibold" | "bold";
169
- textAlign?: "left" | "right" | "center";
170
- mask?: MaskOptions;
171
- };
172
-
173
- export type TextFieldSlotProps = Omit<
174
- ComponentProps<typeof TextFieldStyled>,
175
- "color"
176
- > & {
177
- placeholder?: string;
178
- children?: React.ReactNode;
179
- position?: "flex-start" | "flex-end";
180
- onClick?: () => void;
181
- color?: "error" | "success" | undefined;
182
- typography?: string;
183
- fontWeight?: "regular" | "medium" | "semibold" | "bold";
184
- textAlign?: "left" | "right" | "center";
185
- };
186
-
187
- const InputAddon = styled(TextStyle, {
188
- boxSizing: "border-box",
189
- border: "1px solid $dark300",
190
- height: "$40",
191
- padding: "0 $12",
192
- margin: "0 auto",
193
-
194
- color: "$dark600",
195
- whiteSpace: "nowrap",
196
- borderRadius: "$sm 0px 0px $sm",
197
- borderRightWidth: "0px",
198
- display: "flex",
199
- flexWrap: "nowrap",
200
- alignItems: "center",
201
- lineHeight: 1,
202
- });
203
- export const maskFormat = format;
204
- export const maskUnformat = unformat;
205
-
206
- export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
207
- (
208
- {
209
- children,
210
- isValid,
211
- name,
212
- color,
213
- typography,
214
- fontWeight,
215
- addon,
216
- textAlign = "left",
217
- mask,
218
- ...props
219
- },
220
- fowardedRef
221
- ) => {
222
- const maskRef = mask ? useMask(mask) : undefined;
223
-
224
- return (
225
- <Flex gap={"0"} css={{ width: "100%" }}>
226
- {!!addon && <InputAddon typography="labelSmall">{addon}</InputAddon>}
227
-
228
- <TextFieldStyled
229
- color={color}
230
- isValid={isValid}
231
- name={name}
232
- typography={typography}
233
- fontWeight={fontWeight}
234
- textAlign={textAlign}
235
- ref={(r) => {
236
- if (!r) return;
237
- if (maskRef) maskRef.current = r;
238
-
239
- if (fowardedRef) {
240
- if (typeof fowardedRef === "function") fowardedRef(r);
241
- else {
242
- fowardedRef.current = r;
243
- }
244
- }
245
- }}
246
- {...props}
247
- style={
248
- addon
249
- ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" }
250
- : undefined
251
- }
252
- >
253
- {children}
254
- {isValid && (
255
- <TextFieldSlot
256
- position="flex-end"
257
- name={name}
258
- color={color as TextFieldSlotProps["color"]}
259
- typography={typography}
260
- fontWeight={fontWeight}
261
- textAlign={textAlign}
262
- >
263
- <Icon name="check" />
264
- </TextFieldSlot>
265
- )}
266
- </TextFieldStyled>
267
- </Flex>
268
- );
269
- }
270
- );
271
-
272
- export function TextFieldSlot({
273
- children,
274
- position = "flex-start",
275
- onClick,
276
- typography = "bodyXS",
277
- fontWeight = "regular",
278
- textAlign = "right",
279
- ...props
280
- }: TextFieldSlotProps) {
281
- const sharedStyles = {
282
- typography,
283
- fontWeight,
284
- textAlign,
285
- ...props,
286
- color: undefined,
287
- };
288
-
289
- return onClick ? (
290
- <TextFieldSlotStyled
291
- {...sharedStyles}
292
- style={{
293
- float: position === "flex-start" ? "left" : "right",
294
- order: position === "flex-start" ? 0 : 2,
295
- textAlign,
296
- zIndex: 2,
297
- cursor: "pointer",
298
- }}
299
- onClick={() => onClick()}
300
- >
301
- {children}
302
- </TextFieldSlotStyled>
303
- ) : (
304
- <TextFieldSlotStyled
305
- {...sharedStyles}
306
- style={{
307
- float: position === "flex-start" ? "left" : "right",
308
- order: position === "flex-start" ? 0 : 2,
309
- textAlign,
310
- }}
311
- >
312
- {children}
313
- </TextFieldSlotStyled>
314
- );
315
- }
1
+ import React, { ComponentProps, ReactNode } 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
+ import { TextStyle } from "./Text";
7
+ import { Flex } from "./Flex";
8
+ import { format, MaskOptions, useMask, unformat } from "@react-input/mask";
9
+
10
+ export const TextFieldStyled = styled(TextFieldRadix.Root, {
11
+ height: "$40",
12
+ fontFamily: "$default",
13
+ borderRadius: "$sm",
14
+ boxSizing: "border-box",
15
+ color: "$dark500",
16
+ border: "1px solid $dark300",
17
+ position: "relative",
18
+ display: "flex",
19
+ width: "100%",
20
+ alignItems: "center",
21
+ padding: "0 $14",
22
+ gap: "$14",
23
+ backgroundColor: "$dark50",
24
+ input: {
25
+ order: 1,
26
+ outline: "none",
27
+ border: "none",
28
+ margin: 0,
29
+ width: "100%",
30
+ font: "inherit",
31
+ textAlign: "left",
32
+ },
33
+
34
+ "&:has(input:focus)": {
35
+ border: "2px solid $brand300",
36
+ },
37
+ "&:has(input:disabled)": {
38
+ backgroundColor: "$dark100",
39
+ color: "$dark400",
40
+ border: "1px solid $dark200",
41
+ cursor: "not-allowed",
42
+ },
43
+
44
+ variants: {
45
+ color: {
46
+ default: {
47
+ color: "$dark400",
48
+ border: "1px solid $dark300",
49
+ "&:has(input:focus)": {
50
+ border: "2px solid $brand300",
51
+ },
52
+ "&:has(input:disabled)": {
53
+ backgroundColor: "$dark100",
54
+ color: "$dark400",
55
+ border: "1px solid $dark300",
56
+ cursor: "not-allowed",
57
+ },
58
+ },
59
+ error: {
60
+ border: "1px solid $error400",
61
+ color: "$error400",
62
+ "input::placeholder": {
63
+ color: "$error400",
64
+ },
65
+ "&:has(input:focus)": {
66
+ border: "2px solid $error400",
67
+ },
68
+ "&:has(input:disabled)": {
69
+ backgroundColor: "$error50",
70
+ color: "$error300",
71
+ border: "1px solid $error100",
72
+ cursor: "not-allowed",
73
+ },
74
+ },
75
+ },
76
+
77
+ typography: typographyValues,
78
+ fontWeight: {
79
+ regular: { fontWeight: "$regular" },
80
+ medium: { fontWeight: "$medium" },
81
+ semibold: { fontWeight: "$semibold" },
82
+ bold: { fontWeight: "$bold" },
83
+ },
84
+ textAlign: {
85
+ left: { textAlign: "left" },
86
+ center: { textAlign: "center" },
87
+ right: { textAlign: "right" },
88
+ },
89
+ isValid: {
90
+ true: {},
91
+ false: {},
92
+ },
93
+ },
94
+
95
+ compoundVariants: [
96
+ {
97
+ isValid: false,
98
+ css: {
99
+ border: "1px solid $error400",
100
+ color: "$error400",
101
+ backgroundColor: "$error50",
102
+ input: {
103
+ "&::placeholder": {
104
+ color: "$error400",
105
+ },
106
+ backgroundColor: "$error50",
107
+ },
108
+ "&:has(input:focus)": {
109
+ border: "2px solid $error400",
110
+ },
111
+ "&:has(input:disabled)": {
112
+ input: {
113
+ backgroundColor: "$error50",
114
+ },
115
+ backgroundColor: "$error50",
116
+ color: "$error300",
117
+ border: "1px solid $error100",
118
+ cursor: "not-allowed",
119
+ },
120
+ },
121
+ },
122
+ {
123
+ isValid: true,
124
+ css: {
125
+ "&:has(input:focus)": {
126
+ border: "2px solid $success500",
127
+ },
128
+ "&:has(input:disabled)": {
129
+ backgroundColor: "$dark100",
130
+ color: "$dark400",
131
+ border: "1px solid $dark200",
132
+ cursor: "not-allowed",
133
+ },
134
+ },
135
+ },
136
+ ],
137
+ });
138
+
139
+ export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
140
+ display: "flex",
141
+ alignItems: "center",
142
+ justifyContent: "center",
143
+ padding: 4,
144
+
145
+ variants: {
146
+ typography: typographyValues,
147
+ fontWeight: {
148
+ regular: { fontWeight: "$regular" },
149
+ medium: { fontWeight: "$medium" },
150
+ semibold: { fontWeight: "$semibold" },
151
+ bold: { fontWeight: "$bold" },
152
+ },
153
+ textAlign: {
154
+ left: { textAlign: "left" },
155
+ right: { textAlign: "right" },
156
+ center: { textAlign: "center" },
157
+ },
158
+ },
159
+ });
160
+
161
+ export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
162
+ addon?: ReactNode;
163
+ placeholder?: string;
164
+ children?: React.ReactNode;
165
+ isValid?: boolean;
166
+ name?: string;
167
+ typography?: string;
168
+ fontWeight?: "regular" | "medium" | "semibold" | "bold";
169
+ textAlign?: "left" | "right" | "center";
170
+ mask?: MaskOptions;
171
+ };
172
+
173
+ export type TextFieldSlotProps = Omit<
174
+ ComponentProps<typeof TextFieldStyled>,
175
+ "color"
176
+ > & {
177
+ placeholder?: string;
178
+ children?: React.ReactNode;
179
+ position?: "flex-start" | "flex-end";
180
+ onClick?: () => void;
181
+ color?: "error" | "success" | undefined;
182
+ typography?: string;
183
+ fontWeight?: "regular" | "medium" | "semibold" | "bold";
184
+ textAlign?: "left" | "right" | "center";
185
+ };
186
+
187
+ const InputAddon = styled(TextStyle, {
188
+ boxSizing: "border-box",
189
+ border: "1px solid $dark300",
190
+ height: "$40",
191
+ padding: "0 $12",
192
+ margin: "0 auto",
193
+
194
+ color: "$dark600",
195
+ whiteSpace: "nowrap",
196
+ borderRadius: "$sm 0px 0px $sm",
197
+ borderRightWidth: "0px",
198
+ display: "flex",
199
+ flexWrap: "nowrap",
200
+ alignItems: "center",
201
+ lineHeight: 1,
202
+ });
203
+ export const maskFormat = format;
204
+ export const maskUnformat = unformat;
205
+
206
+ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
207
+ (
208
+ {
209
+ children,
210
+ isValid,
211
+ name,
212
+ color,
213
+ typography,
214
+ fontWeight,
215
+ addon,
216
+ textAlign = "left",
217
+ mask,
218
+ ...props
219
+ },
220
+ fowardedRef
221
+ ) => {
222
+ const maskRef = mask ? useMask(mask) : undefined;
223
+ return (
224
+ <Flex gap={"0"} css={{ width: "100%" }}>
225
+ {!!addon && <InputAddon typography="labelSmall">{addon}</InputAddon>}
226
+
227
+ <TextFieldStyled
228
+ color={color}
229
+ isValid={isValid}
230
+ name={name}
231
+ typography={typography}
232
+ fontWeight={fontWeight}
233
+ textAlign={textAlign}
234
+ ref={(r) => {
235
+ if (!r) return;
236
+ if (maskRef) maskRef.current = r;
237
+
238
+ if (fowardedRef) {
239
+ if (typeof fowardedRef === "function") fowardedRef(r);
240
+ else fowardedRef.current = r;
241
+ }
242
+ }}
243
+ {...props}
244
+ style={
245
+ addon
246
+ ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" }
247
+ : undefined
248
+ }
249
+ >
250
+ {children}
251
+ {isValid && (
252
+ <TextFieldSlot
253
+ position="flex-end"
254
+ name={name}
255
+ color={color as TextFieldSlotProps["color"]}
256
+ typography={typography}
257
+ fontWeight={fontWeight}
258
+ textAlign={textAlign}
259
+ >
260
+ <Icon name="check" />
261
+ </TextFieldSlot>
262
+ )}
263
+ </TextFieldStyled>
264
+ </Flex>
265
+ );
266
+ }
267
+ );
268
+
269
+ export function TextFieldSlot({
270
+ children,
271
+ position = "flex-start",
272
+ onClick,
273
+ typography = "bodyXS",
274
+ fontWeight = "regular",
275
+ textAlign = "right",
276
+ ...props
277
+ }: TextFieldSlotProps) {
278
+ const sharedStyles = {
279
+ typography,
280
+ fontWeight,
281
+ textAlign,
282
+ ...props,
283
+ color: undefined,
284
+ };
285
+
286
+ return onClick ? (
287
+ <TextFieldSlotStyled
288
+ {...sharedStyles}
289
+ style={{
290
+ float: position === "flex-start" ? "left" : "right",
291
+ order: position === "flex-start" ? 0 : 2,
292
+ textAlign,
293
+ zIndex: 2,
294
+ cursor: "pointer",
295
+ }}
296
+ onClick={() => onClick()}
297
+ >
298
+ {children}
299
+ </TextFieldSlotStyled>
300
+ ) : (
301
+ <TextFieldSlotStyled
302
+ {...sharedStyles}
303
+ style={{
304
+ float: position === "flex-start" ? "left" : "right",
305
+ order: position === "flex-start" ? 0 : 2,
306
+ textAlign,
307
+ }}
308
+ >
309
+ {children}
310
+ </TextFieldSlotStyled>
311
+ );
312
+ }