@lets-events/react 12.2.7 → 12.2.8
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 +21 -19
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +14 -7
- package/dist/index.mjs +14 -7
- package/package.json +2 -2
- 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 +300 -300
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +148 -146
- package/src/components/Calendar/styledComponents.ts +250 -250
- package/src/components/Card.tsx +48 -48
- package/src/components/CheckboxGroup.tsx +176 -176
- package/src/components/Container.tsx +39 -39
- package/src/components/Drawer/index.tsx +138 -138
- package/src/components/Drawer/styledComponents.ts +52 -52
- 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 -92
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- 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 +102 -102
- package/src/components/FormFields/SelectFormField.tsx +93 -93
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +57 -57
- 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 +90 -90
- package/src/components/MultiSelect/index.tsx +243 -243
- package/src/components/MultiSelect/styledComponents.ts +160 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +458 -458
- 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 +127 -127
- 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 +68 -68
- package/src/styles/index.ts +38 -38
- 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
- package/dist/index.css +0 -171
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
2
|
-
import { styled } from "../styles";
|
|
3
|
-
import React, { ComponentProps, useRef, useState, useEffect } from "react";
|
|
4
|
-
import { typographyValues } from "../types/typographyValues";
|
|
5
|
-
import { Text } from "./Text";
|
|
6
|
-
|
|
7
|
-
export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8
|
-
display: "flex",
|
|
9
|
-
flex: 1,
|
|
10
|
-
textarea: {
|
|
11
|
-
width: "100%",
|
|
12
|
-
border: "none",
|
|
13
|
-
padding: "$12 $14",
|
|
14
|
-
fontFamily: "$default",
|
|
15
|
-
outline: "none",
|
|
16
|
-
resize: "vertical",
|
|
17
|
-
height: "auto",
|
|
18
|
-
},
|
|
19
|
-
variants: {
|
|
20
|
-
typography: typographyValues,
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
typography: "labelSmall",
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const TextareaContainer = styled("div", {
|
|
28
|
-
display: "flex",
|
|
29
|
-
flexDirection: "column",
|
|
30
|
-
overflow: "hidden",
|
|
31
|
-
width: "100%",
|
|
32
|
-
border: "1px solid",
|
|
33
|
-
borderRadius: "$sm",
|
|
34
|
-
|
|
35
|
-
"&:has(textarea:focus)": {
|
|
36
|
-
border: "1px solid $brand300",
|
|
37
|
-
},
|
|
38
|
-
"&:has(textarea:disabled)": {
|
|
39
|
-
backgroundColor: "$dark100",
|
|
40
|
-
color: "$dark400",
|
|
41
|
-
border: "1px solid $dark200",
|
|
42
|
-
cursor: "not-allowed",
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
variants: {
|
|
46
|
-
color: {
|
|
47
|
-
default: {
|
|
48
|
-
borderColor: "$dark300",
|
|
49
|
-
},
|
|
50
|
-
error: {
|
|
51
|
-
borderColor: "$error400",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
defaultVariants: {
|
|
57
|
-
color: "default",
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const TextareaLimitIndicator = styled("div", {
|
|
62
|
-
padding: "$12 $16",
|
|
63
|
-
borderTop: "1px solid $neutral300",
|
|
64
|
-
width: "100%",
|
|
65
|
-
flex: 1,
|
|
66
|
-
display: "flex",
|
|
67
|
-
backgroundColor: "$dark50",
|
|
68
|
-
span: {
|
|
69
|
-
backgroundColor: "$neutral200",
|
|
70
|
-
color: "$neutral700",
|
|
71
|
-
borderRadius: "$2xs",
|
|
72
|
-
padding: "$4",
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
export type TextareaFieldProps = Omit<
|
|
77
|
-
ComponentProps<typeof TextareaFieldStyle>,
|
|
78
|
-
"color"
|
|
79
|
-
> &
|
|
80
|
-
ComponentProps<typeof TextareaContainer>;
|
|
81
|
-
|
|
82
|
-
export const TextareaField = React.forwardRef<
|
|
83
|
-
HTMLTextAreaElement,
|
|
84
|
-
TextareaFieldProps
|
|
85
|
-
>(({ maxLength, color, ...props }, forwardedRef) => {
|
|
86
|
-
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
87
|
-
const [remaining, setRemaining] = useState(maxLength);
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (maxLength && inputRef.current) {
|
|
91
|
-
setRemaining(maxLength - (inputRef.current.value.length ?? 0));
|
|
92
|
-
}
|
|
93
|
-
}, [maxLength]);
|
|
94
|
-
|
|
95
|
-
const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
|
|
96
|
-
if (maxLength) {
|
|
97
|
-
setRemaining(maxLength - e.currentTarget.value.length);
|
|
98
|
-
}
|
|
99
|
-
props.onInput?.(e);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<TextareaContainer color={color}>
|
|
104
|
-
<TextareaFieldStyle
|
|
105
|
-
rows={4}
|
|
106
|
-
ref={(r) => {
|
|
107
|
-
if (!r) return;
|
|
108
|
-
inputRef.current = r;
|
|
109
|
-
if (forwardedRef) {
|
|
110
|
-
if (typeof forwardedRef === "function") forwardedRef(r);
|
|
111
|
-
else forwardedRef.current = r;
|
|
112
|
-
}
|
|
113
|
-
}}
|
|
114
|
-
onInput={handleInput}
|
|
115
|
-
maxLength={maxLength}
|
|
116
|
-
{...props}
|
|
117
|
-
/>
|
|
118
|
-
{maxLength && (
|
|
119
|
-
<TextareaLimitIndicator>
|
|
120
|
-
<Text typography="badgeMedium">
|
|
121
|
-
{remaining}
|
|
122
|
-
</Text>
|
|
123
|
-
</TextareaLimitIndicator>
|
|
124
|
-
)}
|
|
125
|
-
</TextareaContainer>
|
|
126
|
-
);
|
|
127
|
-
});
|
|
1
|
+
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
2
|
+
import { styled } from "../styles";
|
|
3
|
+
import React, { ComponentProps, useRef, useState, useEffect } from "react";
|
|
4
|
+
import { typographyValues } from "../types/typographyValues";
|
|
5
|
+
import { Text } from "./Text";
|
|
6
|
+
|
|
7
|
+
export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flex: 1,
|
|
10
|
+
textarea: {
|
|
11
|
+
width: "100%",
|
|
12
|
+
border: "none",
|
|
13
|
+
padding: "$12 $14",
|
|
14
|
+
fontFamily: "$default",
|
|
15
|
+
outline: "none",
|
|
16
|
+
resize: "vertical",
|
|
17
|
+
height: "auto",
|
|
18
|
+
},
|
|
19
|
+
variants: {
|
|
20
|
+
typography: typographyValues,
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
typography: "labelSmall",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const TextareaContainer = styled("div", {
|
|
28
|
+
display: "flex",
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
width: "100%",
|
|
32
|
+
border: "1px solid",
|
|
33
|
+
borderRadius: "$sm",
|
|
34
|
+
|
|
35
|
+
"&:has(textarea:focus)": {
|
|
36
|
+
border: "1px solid $brand300",
|
|
37
|
+
},
|
|
38
|
+
"&:has(textarea:disabled)": {
|
|
39
|
+
backgroundColor: "$dark100",
|
|
40
|
+
color: "$dark400",
|
|
41
|
+
border: "1px solid $dark200",
|
|
42
|
+
cursor: "not-allowed",
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
variants: {
|
|
46
|
+
color: {
|
|
47
|
+
default: {
|
|
48
|
+
borderColor: "$dark300",
|
|
49
|
+
},
|
|
50
|
+
error: {
|
|
51
|
+
borderColor: "$error400",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
color: "default",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const TextareaLimitIndicator = styled("div", {
|
|
62
|
+
padding: "$12 $16",
|
|
63
|
+
borderTop: "1px solid $neutral300",
|
|
64
|
+
width: "100%",
|
|
65
|
+
flex: 1,
|
|
66
|
+
display: "flex",
|
|
67
|
+
backgroundColor: "$dark50",
|
|
68
|
+
span: {
|
|
69
|
+
backgroundColor: "$neutral200",
|
|
70
|
+
color: "$neutral700",
|
|
71
|
+
borderRadius: "$2xs",
|
|
72
|
+
padding: "$4",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export type TextareaFieldProps = Omit<
|
|
77
|
+
ComponentProps<typeof TextareaFieldStyle>,
|
|
78
|
+
"color"
|
|
79
|
+
> &
|
|
80
|
+
ComponentProps<typeof TextareaContainer>;
|
|
81
|
+
|
|
82
|
+
export const TextareaField = React.forwardRef<
|
|
83
|
+
HTMLTextAreaElement,
|
|
84
|
+
TextareaFieldProps
|
|
85
|
+
>(({ maxLength, color, ...props }, forwardedRef) => {
|
|
86
|
+
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
87
|
+
const [remaining, setRemaining] = useState(maxLength);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (maxLength && inputRef.current) {
|
|
91
|
+
setRemaining(maxLength - (inputRef.current.value.length ?? 0));
|
|
92
|
+
}
|
|
93
|
+
}, [maxLength]);
|
|
94
|
+
|
|
95
|
+
const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
|
|
96
|
+
if (maxLength) {
|
|
97
|
+
setRemaining(maxLength - e.currentTarget.value.length);
|
|
98
|
+
}
|
|
99
|
+
props.onInput?.(e);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<TextareaContainer color={color}>
|
|
104
|
+
<TextareaFieldStyle
|
|
105
|
+
rows={4}
|
|
106
|
+
ref={(r) => {
|
|
107
|
+
if (!r) return;
|
|
108
|
+
inputRef.current = r;
|
|
109
|
+
if (forwardedRef) {
|
|
110
|
+
if (typeof forwardedRef === "function") forwardedRef(r);
|
|
111
|
+
else forwardedRef.current = r;
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
onInput={handleInput}
|
|
115
|
+
maxLength={maxLength}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
{maxLength && (
|
|
119
|
+
<TextareaLimitIndicator>
|
|
120
|
+
<Text typography="badgeMedium">
|
|
121
|
+
{remaining}
|
|
122
|
+
</Text>
|
|
123
|
+
</TextareaLimitIndicator>
|
|
124
|
+
)}
|
|
125
|
+
</TextareaContainer>
|
|
126
|
+
);
|
|
127
|
+
});
|