@lets-events/react 12.5.0 → 12.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.
- package/.eslintrc.json +2 -2
- package/.turbo/turbo-build.log +24 -0
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +15402 -0
- package/dist/index.d.ts +15402 -0
- package/dist/index.js +13413 -0
- package/dist/index.mjs +13307 -0
- package/package.json +1 -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 +45 -45
- package/src/components/Button/styledComponents.ts +313 -313
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +148 -148
- package/src/components/Calendar/styledComponents.ts +259 -259
- package/src/components/Card.tsx +67 -67
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Divider.tsx +7 -7
- package/src/components/DoubleCalendar/index.tsx +170 -170
- package/src/components/Drawer/index.tsx +100 -100
- package/src/components/Drawer/styledComponents.ts +103 -103
- package/src/components/Dropdown.tsx +302 -302
- package/src/components/Filter.tsx +164 -164
- package/src/components/Flex.tsx +118 -118
- package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
- package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
- package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
- package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
- package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
- package/src/components/FormFields/BirthDateFormField.tsx +84 -84
- package/src/components/FormFields/CNPJFormField.tsx +87 -87
- package/src/components/FormFields/CPFFormField.tsx +78 -78
- package/src/components/FormFields/CalendarFormField.tsx +95 -95
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/DoubleCalendarFormField.tsx +93 -93
- package/src/components/FormFields/EmailFormField.tsx +27 -27
- package/src/components/FormFields/Form.tsx +39 -39
- package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
- package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
- package/src/components/FormFields/PhoneFormField.tsx +40 -40
- package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
- package/src/components/FormFields/RichEditorFormField.tsx +103 -103
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +61 -59
- package/src/components/FormFields/TextFormField.tsx +112 -112
- package/src/components/FormFields/TimePickerFormField.tsx +88 -88
- package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
- package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
- package/src/components/FormFields/utils/validation.ts +23 -23
- package/src/components/Grid.tsx +137 -137
- package/src/components/Icon.tsx +47 -47
- package/src/components/MenuDropdown/index.tsx +38 -38
- package/src/components/MenuDropdown/styledComponents.ts +31 -31
- package/src/components/Modal.tsx +110 -110
- package/src/components/MultiSelect/index.tsx +268 -243
- package/src/components/MultiSelect/styledComponents.ts +160 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +457 -457
- package/src/components/RichEditor/RichEditor.tsx +49 -49
- package/src/components/RichEditor/index.ts +2 -2
- package/src/components/RichEditor/styledComponents.ts +1151 -1151
- 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 +372 -372
- package/src/components/TextareaField.tsx +116 -138
- package/src/components/TimePicker.tsx +328 -328
- 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 -41
- package/src/hooks/useImageUpload.ts +139 -139
- package/src/hooks/useOnClickOutside.tsx +42 -42
- package/src/index.tsx +71 -71
- package/src/styles/index.ts +41 -41
- package/src/types/typographyValues.ts +178 -178
- package/src/utils/getNestedValue.ts +3 -3
- package/src/utils/states.ts +29 -29
- package/src/utils/uploadService.ts +180 -180
- package/tsconfig.json +3 -3
- package/tsup.config.ts +38 -38
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
-
import { SelectFormField } from "../SelectFormField";
|
|
4
|
-
import { TextFormField } from "../TextFormField";
|
|
5
|
-
|
|
6
|
-
type CityFormFieldProps = {
|
|
7
|
-
name: string;
|
|
8
|
-
label: string;
|
|
9
|
-
stateName: string;
|
|
10
|
-
required?: boolean;
|
|
11
|
-
isBrazil: boolean;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type City = {
|
|
16
|
-
id: number;
|
|
17
|
-
nome: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function CityFormField({
|
|
21
|
-
name,
|
|
22
|
-
label,
|
|
23
|
-
stateName,
|
|
24
|
-
required,
|
|
25
|
-
isBrazil,
|
|
26
|
-
placeholder,
|
|
27
|
-
}: CityFormFieldProps) {
|
|
28
|
-
const { control, watch } = useFormContext();
|
|
29
|
-
const selectedState = watch(stateName);
|
|
30
|
-
|
|
31
|
-
const [cities, setCities] = useState<City[]>([]);
|
|
32
|
-
const [loading, setLoading] = useState(false);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!isBrazil) {
|
|
36
|
-
setCities([]);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (!selectedState) {
|
|
40
|
-
setCities([]);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async function fetchCities() {
|
|
45
|
-
setLoading(true);
|
|
46
|
-
try {
|
|
47
|
-
const ufResponse = await fetch(
|
|
48
|
-
`https://servicodados.ibge.gov.br/api/v1/localidades/estados`
|
|
49
|
-
);
|
|
50
|
-
const estados = await ufResponse.json();
|
|
51
|
-
const estadoSelecionado = estados.find(
|
|
52
|
-
(e: { sigla: string }) => e.sigla === selectedState
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
if (!estadoSelecionado) {
|
|
56
|
-
setCities([]);
|
|
57
|
-
setLoading(false);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const response = await fetch(
|
|
62
|
-
`https://servicodados.ibge.gov.br/api/v1/localidades/estados/${estadoSelecionado.id}/municipios`
|
|
63
|
-
);
|
|
64
|
-
const data = await response.json();
|
|
65
|
-
|
|
66
|
-
setCities(data);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
setCities([]);
|
|
69
|
-
} finally {
|
|
70
|
-
setLoading(false);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
fetchCities();
|
|
75
|
-
}, [selectedState, isBrazil]);
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<>
|
|
79
|
-
{isBrazil && cities.length > 0 ? (
|
|
80
|
-
<Controller
|
|
81
|
-
name={name}
|
|
82
|
-
control={control}
|
|
83
|
-
rules={{ required }}
|
|
84
|
-
render={({ field }) => (
|
|
85
|
-
<SelectFormField
|
|
86
|
-
label={label}
|
|
87
|
-
required={required}
|
|
88
|
-
{...field}
|
|
89
|
-
options={cities.map((city) => ({
|
|
90
|
-
value: city.nome,
|
|
91
|
-
label: city.nome,
|
|
92
|
-
}))}
|
|
93
|
-
placeholder={
|
|
94
|
-
loading
|
|
95
|
-
? "Carregando cidades..."
|
|
96
|
-
: placeholder || "Selecione a cidade"
|
|
97
|
-
}
|
|
98
|
-
/>
|
|
99
|
-
)}
|
|
100
|
-
/>
|
|
101
|
-
) : (
|
|
102
|
-
<TextFormField
|
|
103
|
-
name={name}
|
|
104
|
-
required={required}
|
|
105
|
-
placeholder={placeholder}
|
|
106
|
-
label={label}
|
|
107
|
-
/>
|
|
108
|
-
)}
|
|
109
|
-
</>
|
|
110
|
-
);
|
|
111
|
-
}
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
3
|
+
import { SelectFormField } from "../SelectFormField";
|
|
4
|
+
import { TextFormField } from "../TextFormField";
|
|
5
|
+
|
|
6
|
+
type CityFormFieldProps = {
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
stateName: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
isBrazil: boolean;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type City = {
|
|
16
|
+
id: number;
|
|
17
|
+
nome: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function CityFormField({
|
|
21
|
+
name,
|
|
22
|
+
label,
|
|
23
|
+
stateName,
|
|
24
|
+
required,
|
|
25
|
+
isBrazil,
|
|
26
|
+
placeholder,
|
|
27
|
+
}: CityFormFieldProps) {
|
|
28
|
+
const { control, watch } = useFormContext();
|
|
29
|
+
const selectedState = watch(stateName);
|
|
30
|
+
|
|
31
|
+
const [cities, setCities] = useState<City[]>([]);
|
|
32
|
+
const [loading, setLoading] = useState(false);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!isBrazil) {
|
|
36
|
+
setCities([]);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!selectedState) {
|
|
40
|
+
setCities([]);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function fetchCities() {
|
|
45
|
+
setLoading(true);
|
|
46
|
+
try {
|
|
47
|
+
const ufResponse = await fetch(
|
|
48
|
+
`https://servicodados.ibge.gov.br/api/v1/localidades/estados`
|
|
49
|
+
);
|
|
50
|
+
const estados = await ufResponse.json();
|
|
51
|
+
const estadoSelecionado = estados.find(
|
|
52
|
+
(e: { sigla: string }) => e.sigla === selectedState
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (!estadoSelecionado) {
|
|
56
|
+
setCities([]);
|
|
57
|
+
setLoading(false);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const response = await fetch(
|
|
62
|
+
`https://servicodados.ibge.gov.br/api/v1/localidades/estados/${estadoSelecionado.id}/municipios`
|
|
63
|
+
);
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
|
|
66
|
+
setCities(data);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
setCities([]);
|
|
69
|
+
} finally {
|
|
70
|
+
setLoading(false);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
fetchCities();
|
|
75
|
+
}, [selectedState, isBrazil]);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
{isBrazil && cities.length > 0 ? (
|
|
80
|
+
<Controller
|
|
81
|
+
name={name}
|
|
82
|
+
control={control}
|
|
83
|
+
rules={{ required }}
|
|
84
|
+
render={({ field }) => (
|
|
85
|
+
<SelectFormField
|
|
86
|
+
label={label}
|
|
87
|
+
required={required}
|
|
88
|
+
{...field}
|
|
89
|
+
options={cities.map((city) => ({
|
|
90
|
+
value: city.nome,
|
|
91
|
+
label: city.nome,
|
|
92
|
+
}))}
|
|
93
|
+
placeholder={
|
|
94
|
+
loading
|
|
95
|
+
? "Carregando cidades..."
|
|
96
|
+
: placeholder || "Selecione a cidade"
|
|
97
|
+
}
|
|
98
|
+
/>
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
101
|
+
) : (
|
|
102
|
+
<TextFormField
|
|
103
|
+
name={name}
|
|
104
|
+
required={required}
|
|
105
|
+
placeholder={placeholder}
|
|
106
|
+
label={label}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Flex } from "../../Flex";
|
|
2
|
-
import { SelectFormField } from "../SelectFormField";
|
|
3
|
-
import { useCountries } from "../../../hooks/useCountries";
|
|
4
|
-
|
|
5
|
-
type CountryFormFieldProps = {
|
|
6
|
-
name: string;
|
|
7
|
-
label: string;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
language?: "es" | "pt-BR" | "en";
|
|
11
|
-
haveError?: boolean;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function CountryFormField({
|
|
15
|
-
name,
|
|
16
|
-
label,
|
|
17
|
-
required,
|
|
18
|
-
language = "pt-BR",
|
|
19
|
-
}: CountryFormFieldProps) {
|
|
20
|
-
const countries = useCountries(language);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Flex direction="column">
|
|
24
|
-
<SelectFormField
|
|
25
|
-
label={label}
|
|
26
|
-
name={name}
|
|
27
|
-
options={countries}
|
|
28
|
-
required={required}
|
|
29
|
-
defaultValue="Brasil"
|
|
30
|
-
/>
|
|
31
|
-
</Flex>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
1
|
+
import { Flex } from "../../Flex";
|
|
2
|
+
import { SelectFormField } from "../SelectFormField";
|
|
3
|
+
import { useCountries } from "../../../hooks/useCountries";
|
|
4
|
+
|
|
5
|
+
type CountryFormFieldProps = {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
language?: "es" | "pt-BR" | "en";
|
|
11
|
+
haveError?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function CountryFormField({
|
|
15
|
+
name,
|
|
16
|
+
label,
|
|
17
|
+
required,
|
|
18
|
+
language = "pt-BR",
|
|
19
|
+
}: CountryFormFieldProps) {
|
|
20
|
+
const countries = useCountries(language);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Flex direction="column">
|
|
24
|
+
<SelectFormField
|
|
25
|
+
label={label}
|
|
26
|
+
name={name}
|
|
27
|
+
options={countries}
|
|
28
|
+
required={required}
|
|
29
|
+
defaultValue="Brasil"
|
|
30
|
+
/>
|
|
31
|
+
</Flex>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { useController, useFormContext } from "react-hook-form";
|
|
2
|
-
import { TextFormField } from "../TextFormField";
|
|
3
|
-
|
|
4
|
-
export const PostalCodeFormField = ({
|
|
5
|
-
name,
|
|
6
|
-
label,
|
|
7
|
-
required,
|
|
8
|
-
placeholder,
|
|
9
|
-
validationErrorMessage,
|
|
10
|
-
onChange,
|
|
11
|
-
}: {
|
|
12
|
-
name: string;
|
|
13
|
-
label: string;
|
|
14
|
-
required?: boolean;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
validationErrorMessage: string;
|
|
17
|
-
onChange?: (cep: string) => void;
|
|
18
|
-
}) => {
|
|
19
|
-
return (
|
|
20
|
-
<TextFormField
|
|
21
|
-
name={name}
|
|
22
|
-
label={label}
|
|
23
|
-
required={required}
|
|
24
|
-
placeholder={placeholder || "00000-000"}
|
|
25
|
-
mask={{
|
|
26
|
-
mask: "_____-___",
|
|
27
|
-
replacement: { _: /[0-9]/ },
|
|
28
|
-
}}
|
|
29
|
-
onChange={(e) => onChange?.(e.target.value)}
|
|
30
|
-
validate={(value: string) => {
|
|
31
|
-
const isEmpty = value.replace(/[^\d]/g, "").length === 0;
|
|
32
|
-
if (!required && isEmpty) return true;
|
|
33
|
-
return (
|
|
34
|
-
/^\d{8}$/.test(value.replace(/\D/g, "")) || validationErrorMessage
|
|
35
|
-
);
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
1
|
+
import { useController, useFormContext } from "react-hook-form";
|
|
2
|
+
import { TextFormField } from "../TextFormField";
|
|
3
|
+
|
|
4
|
+
export const PostalCodeFormField = ({
|
|
5
|
+
name,
|
|
6
|
+
label,
|
|
7
|
+
required,
|
|
8
|
+
placeholder,
|
|
9
|
+
validationErrorMessage,
|
|
10
|
+
onChange,
|
|
11
|
+
}: {
|
|
12
|
+
name: string;
|
|
13
|
+
label: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
validationErrorMessage: string;
|
|
17
|
+
onChange?: (cep: string) => void;
|
|
18
|
+
}) => {
|
|
19
|
+
return (
|
|
20
|
+
<TextFormField
|
|
21
|
+
name={name}
|
|
22
|
+
label={label}
|
|
23
|
+
required={required}
|
|
24
|
+
placeholder={placeholder || "00000-000"}
|
|
25
|
+
mask={{
|
|
26
|
+
mask: "_____-___",
|
|
27
|
+
replacement: { _: /[0-9]/ },
|
|
28
|
+
}}
|
|
29
|
+
onChange={(e) => onChange?.(e.target.value)}
|
|
30
|
+
validate={(value: string) => {
|
|
31
|
+
const isEmpty = value.replace(/[^\d]/g, "").length === 0;
|
|
32
|
+
if (!required && isEmpty) return true;
|
|
33
|
+
return (
|
|
34
|
+
/^\d{8}$/.test(value.replace(/\D/g, "")) || validationErrorMessage
|
|
35
|
+
);
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { SelectFormField } from "../SelectFormField";
|
|
2
|
-
import { TextFormField } from "../TextFormField";
|
|
3
|
-
import { brazilianStates } from "../../../utils/states";
|
|
4
|
-
|
|
5
|
-
type StateFormFieldProps = {
|
|
6
|
-
name: string;
|
|
7
|
-
label: string;
|
|
8
|
-
required?: boolean;
|
|
9
|
-
isBrazil: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function StateFormField({
|
|
13
|
-
name,
|
|
14
|
-
label,
|
|
15
|
-
required,
|
|
16
|
-
isBrazil,
|
|
17
|
-
}: StateFormFieldProps) {
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
{isBrazil ? (
|
|
21
|
-
<SelectFormField
|
|
22
|
-
name={name}
|
|
23
|
-
options={brazilianStates}
|
|
24
|
-
required={required}
|
|
25
|
-
label={label}
|
|
26
|
-
/>
|
|
27
|
-
) : (
|
|
28
|
-
<TextFormField name={name} required={required} label={label} />
|
|
29
|
-
)}
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
1
|
+
import { SelectFormField } from "../SelectFormField";
|
|
2
|
+
import { TextFormField } from "../TextFormField";
|
|
3
|
+
import { brazilianStates } from "../../../utils/states";
|
|
4
|
+
|
|
5
|
+
type StateFormFieldProps = {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
isBrazil: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function StateFormField({
|
|
13
|
+
name,
|
|
14
|
+
label,
|
|
15
|
+
required,
|
|
16
|
+
isBrazil,
|
|
17
|
+
}: StateFormFieldProps) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
{isBrazil ? (
|
|
21
|
+
<SelectFormField
|
|
22
|
+
name={name}
|
|
23
|
+
options={brazilianStates}
|
|
24
|
+
required={required}
|
|
25
|
+
label={label}
|
|
26
|
+
/>
|
|
27
|
+
) : (
|
|
28
|
+
<TextFormField name={name} required={required} label={label} />
|
|
29
|
+
)}
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
}
|