@lets-events/react 11.5.4 → 11.6.1
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/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +20 -18
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +103 -11
- package/dist/index.d.ts +103 -11
- package/dist/index.js +990 -133
- package/dist/index.mjs +951 -102
- package/package.json +2 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +125 -125
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +16 -16
- package/src/components/Button/styledComponents.ts +287 -287
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +136 -136
- package/src/components/Calendar/styledComponents.ts +209 -209
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +176 -196
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +48 -48
- package/src/components/Drawer/styledComponents.ts +46 -46
- package/src/components/Dropdown.tsx +192 -167
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -0
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -0
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +45 -0
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -0
- package/src/components/FormFields/AddressFormFields/index.tsx +139 -0
- package/src/components/FormFields/BirthDateFormField.tsx +87 -0
- package/src/components/FormFields/CNPJFormField.tsx +89 -0
- package/src/components/FormFields/CPFFormField.tsx +79 -0
- package/src/components/FormFields/CheckboxGroupFormField.tsx +90 -0
- package/src/components/FormFields/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/Form.tsx +29 -25
- package/src/components/FormFields/FormLabel.tsx +29 -29
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +42 -0
- package/src/components/FormFields/MultiSelectFormField.tsx +59 -59
- package/src/components/FormFields/PhoneFormField.tsx +130 -130
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -0
- package/src/components/FormFields/SelectFormField.tsx +93 -0
- package/src/components/FormFields/TextAreaFormField.tsx +48 -48
- package/src/components/FormFields/TextFormField.tsx +76 -46
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +30 -30
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +90 -90
- package/src/components/MultiSelect.tsx +218 -218
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/Section.tsx +33 -33
- package/src/components/Step.tsx +164 -164
- package/src/components/Switch.tsx +108 -108
- package/src/components/Text.tsx +38 -38
- package/src/components/TextField.tsx +312 -315
- package/src/components/TextareaField.tsx +128 -128
- package/src/components/TimePicker.tsx +298 -298
- package/src/components/Toast/components/ToastItem.tsx +41 -41
- package/src/components/Toast/components/ToastProvider.tsx +63 -63
- package/src/components/Toast/hooks/useToast.ts +12 -12
- package/src/components/Toast/index.tsx +5 -5
- package/src/components/Toast/styles/index.ts +135 -135
- package/src/components/Toast/types/index.ts +46 -46
- package/src/components/Tooltip/index.tsx +66 -66
- package/src/components/Tooltip/styles.ts +77 -77
- package/src/hooks/useCountries.ts +41 -0
- package/src/hooks/useOnClickOutside.tsx +20 -20
- package/src/index.tsx +52 -45
- package/src/styles/index.ts +38 -38
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -0
- package/src/utils/states.ts +29 -0
- package/tsconfig.json +3 -3
|
@@ -1,167 +1,192 @@
|
|
|
1
|
-
import { ComponentProps, ElementType } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { typographyLabelValues } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
1
|
+
import { useState, ComponentProps, ElementType } from "react";
|
|
2
|
+
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import { Theme, DropdownMenu as DropdownMenuRadix } from "@radix-ui/themes";
|
|
4
|
+
import { typographyLabelValues } from "../types/typographyValues";
|
|
5
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
+
import { colors } from "@lets-events/tokens";
|
|
7
|
+
import { styled } from "../styles";
|
|
8
|
+
|
|
9
|
+
const DropdownMenuItemStyled = styled(DropdownMenuRadix.Item, {
|
|
10
|
+
fontFamily: "$default",
|
|
11
|
+
color: "$dark600",
|
|
12
|
+
letterSpacing: "0px",
|
|
13
|
+
padding: "$8 $16",
|
|
14
|
+
"&:hover, &:focus": {
|
|
15
|
+
backgroundColor: "$dark100",
|
|
16
|
+
border: "none",
|
|
17
|
+
outline: "none",
|
|
18
|
+
cursor: "pointer",
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
typography: typographyLabelValues,
|
|
22
|
+
fontWeight: {
|
|
23
|
+
regular: { fontWeight: "$regular" },
|
|
24
|
+
medium: { fontWeight: "$medium" },
|
|
25
|
+
semibold: { fontWeight: "$semibold" },
|
|
26
|
+
bold: { fontWeight: "$bold" },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const DropdownMenuStyled = styled("div", {
|
|
32
|
+
fontFamily: "$default",
|
|
33
|
+
color: "$dark600",
|
|
34
|
+
letterSpacing: "0px",
|
|
35
|
+
cursor: "pointer",
|
|
36
|
+
border: "1px solid $dark300",
|
|
37
|
+
borderRadius: "$xs",
|
|
38
|
+
padding: "$8 $12",
|
|
39
|
+
width: "calc(100% - 24px)",
|
|
40
|
+
display: "flex",
|
|
41
|
+
button: {
|
|
42
|
+
fontFamily: "$default",
|
|
43
|
+
color: "$dark600",
|
|
44
|
+
letterSpacing: "0px",
|
|
45
|
+
backgroundColor: "transparent",
|
|
46
|
+
border: "none",
|
|
47
|
+
width: "100%",
|
|
48
|
+
outline: "none",
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
gap: "$8",
|
|
52
|
+
cursor: "pointer",
|
|
53
|
+
svg: {
|
|
54
|
+
marginLeft: "auto",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
variants: {
|
|
58
|
+
typography: {
|
|
59
|
+
labelLarge: {
|
|
60
|
+
button: {
|
|
61
|
+
fontSize: "$labelLarge",
|
|
62
|
+
lineHeight: "$labelLarge",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
labelMedium: {
|
|
66
|
+
button: {
|
|
67
|
+
fontSize: "$labelMedium",
|
|
68
|
+
lineHeight: "$labelMedium",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
labelSmall: {
|
|
72
|
+
button: {
|
|
73
|
+
fontSize: "$labelSmall",
|
|
74
|
+
lineHeight: "$labelSmall",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
labelExtraSmall: {
|
|
78
|
+
button: {
|
|
79
|
+
fontSize: "$labelExtraSmall",
|
|
80
|
+
lineHeight: "$labelExtraSmall",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
fontWeight: {
|
|
85
|
+
regular: { button: { fontWeight: "$regular" } },
|
|
86
|
+
medium: { button: { fontWeight: "$medium" } },
|
|
87
|
+
semibold: { button: { fontWeight: "$semibold" } },
|
|
88
|
+
bold: { button: { fontWeight: "$bold" } },
|
|
89
|
+
},
|
|
90
|
+
color: {
|
|
91
|
+
default: {
|
|
92
|
+
border: "1px solid $dark300",
|
|
93
|
+
},
|
|
94
|
+
error: {
|
|
95
|
+
border: "1px solid $error400",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const DropdownMenuContentStyled = styled(DropdownMenuRadix.Content, {
|
|
102
|
+
background: "white",
|
|
103
|
+
border: "1px solid $dark300",
|
|
104
|
+
borderRadius: "$xs",
|
|
105
|
+
boxShadow: "0px 4px 4px 0px rgba(35, 53, 67, 0.08)",
|
|
106
|
+
width: "calc(var(--radix-popper-anchor-width) + 24px);",
|
|
107
|
+
minWidth: "100%",
|
|
108
|
+
marginTop: "3px",
|
|
109
|
+
maxHeight: "400px",
|
|
110
|
+
height: "100%",
|
|
111
|
+
position: "relative",
|
|
112
|
+
overflow: "auto",
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export type DropdownMenuProps = ComponentProps<
|
|
116
|
+
typeof DropdownMenuRadix.Root
|
|
117
|
+
> & {
|
|
118
|
+
as?: ElementType;
|
|
119
|
+
placeholder?: string;
|
|
120
|
+
fontWeight: "regular" | "medium" | "semibold" | "bold";
|
|
121
|
+
typography: "labelExtraSmall" | "labelSmall" | "labelMedium" | "labelLarge";
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
color?: "default" | "error";
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type DropdownMenuItemProps = ComponentProps<
|
|
127
|
+
typeof DropdownMenuItemStyled
|
|
128
|
+
> & {
|
|
129
|
+
as?: ElementType;
|
|
130
|
+
value: string;
|
|
131
|
+
typography: DropdownMenuProps["typography"];
|
|
132
|
+
fontWeight: DropdownMenuProps["fontWeight"];
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/* Componente principal */
|
|
136
|
+
export function DropdownMenu({
|
|
137
|
+
children,
|
|
138
|
+
placeholder,
|
|
139
|
+
typography,
|
|
140
|
+
color,
|
|
141
|
+
fontWeight,
|
|
142
|
+
...props
|
|
143
|
+
}: DropdownMenuProps) {
|
|
144
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
145
|
+
return (
|
|
146
|
+
<Theme>
|
|
147
|
+
<DropdownMenuRadix.Root open={isOpen} onOpenChange={setIsOpen} {...props}>
|
|
148
|
+
<DropdownMenuStyled
|
|
149
|
+
typography={typography}
|
|
150
|
+
fontWeight={fontWeight}
|
|
151
|
+
color={color}
|
|
152
|
+
>
|
|
153
|
+
<DropdownMenuRadix.Trigger>
|
|
154
|
+
<button aria-label={placeholder || "Filtrar"}>
|
|
155
|
+
<span>{placeholder || "Filtrar"}</span>
|
|
156
|
+
<FontAwesomeIcon
|
|
157
|
+
icon={isOpen ? faChevronUp : faChevronDown}
|
|
158
|
+
size="sm"
|
|
159
|
+
color={colors.dark600}
|
|
160
|
+
/>
|
|
161
|
+
</button>
|
|
162
|
+
</DropdownMenuRadix.Trigger>
|
|
163
|
+
<DropdownMenuContentStyled
|
|
164
|
+
avoidCollisions={false}
|
|
165
|
+
align="start"
|
|
166
|
+
alignOffset={-14}
|
|
167
|
+
>
|
|
168
|
+
<DropdownMenuRadix.Group>{children}</DropdownMenuRadix.Group>
|
|
169
|
+
</DropdownMenuContentStyled>
|
|
170
|
+
</DropdownMenuStyled>
|
|
171
|
+
</DropdownMenuRadix.Root>
|
|
172
|
+
</Theme>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Componente de item */
|
|
177
|
+
export function DropdownMenuItem({
|
|
178
|
+
children,
|
|
179
|
+
typography,
|
|
180
|
+
fontWeight,
|
|
181
|
+
...props
|
|
182
|
+
}: DropdownMenuItemProps) {
|
|
183
|
+
return (
|
|
184
|
+
<DropdownMenuItemStyled
|
|
185
|
+
typography={typography}
|
|
186
|
+
fontWeight={fontWeight}
|
|
187
|
+
{...props}
|
|
188
|
+
>
|
|
189
|
+
{children}
|
|
190
|
+
</DropdownMenuItemStyled>
|
|
191
|
+
);
|
|
192
|
+
}
|