@lets-events/react 12.10.3 → 12.10.5
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 +12 -0
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +187 -77
- package/dist/index.mjs +187 -77
- package/package.json +1 -1
- package/src/components/Alert.tsx +303 -303
- package/src/components/Avatar.tsx +55 -55
- package/src/components/Badge.tsx +123 -123
- package/src/components/Box.tsx +3 -3
- package/src/components/Button/index.tsx +74 -74
- package/src/components/Button/styledComponents.ts +361 -361
- package/src/components/ButtonGroup.tsx +484 -484
- package/src/components/Calendar/index.tsx +168 -168
- package/src/components/Calendar/styledComponents.ts +480 -480
- 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 +204 -182
- package/src/components/Drawer/index.tsx +103 -103
- package/src/components/Drawer/styledComponents.ts +97 -97
- 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 +98 -98
- package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
- package/src/components/FormFields/DateAndTimeFormField.tsx +217 -217
- package/src/components/FormFields/DoubleCalendarFormField.tsx +96 -96
- 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 +86 -86
- package/src/components/FormFields/RichEditorFormField.tsx +105 -103
- package/src/components/FormFields/SelectFormField.tsx +113 -113
- package/src/components/FormFields/SwitchFormField.tsx +46 -46
- package/src/components/FormFields/TextAreaFormField.tsx +61 -61
- 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 +36 -36
- 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 +305 -305
- package/src/components/MultiSelect/styledComponents.ts +160 -160
- package/src/components/RadioGroup.tsx +210 -210
- package/src/components/RichEditor/QuillComponent.tsx +415 -468
- package/src/components/RichEditor/RichEditor.tsx +53 -49
- package/src/components/RichEditor/RichTextPresenter.tsx +18 -18
- package/src/components/RichEditor/editorConfig.ts +149 -0
- package/src/components/RichEditor/index.ts +3 -3
- package/src/components/RichEditor/styledComponents.ts +1175 -1170
- package/src/components/RichEditor/types.ts +12 -0
- 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 -116
- package/src/components/TimePicker.tsx +357 -357
- 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/ToggleElement/index.tsx +58 -58
- package/src/components/Tooltip/index.tsx +73 -73
- 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 +72 -72
- 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,50 +1,54 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { ToastProvider } from "../Toast";
|
|
3
|
-
import QuillComponent from "./QuillComponent";
|
|
4
|
-
|
|
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
|
-
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { ToastProvider } from "../Toast";
|
|
3
|
+
import QuillComponent from "./QuillComponent";
|
|
4
|
+
import { RichEditorElement } from "./types";
|
|
5
|
+
|
|
6
|
+
export type { RichEditorElement };
|
|
7
|
+
|
|
8
|
+
export interface UploadConfig {
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
s3Bucket: string;
|
|
11
|
+
s3Region: string;
|
|
12
|
+
s3Url: string;
|
|
13
|
+
timeout?: number;
|
|
14
|
+
maxFileSize?: number;
|
|
15
|
+
endpoints?: {
|
|
16
|
+
presignedUrl: string;
|
|
17
|
+
upload: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RichEditorProps {
|
|
22
|
+
value?: string;
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
uploadConfig?: UploadConfig;
|
|
29
|
+
simpleVersion?: boolean;
|
|
30
|
+
richEditorElements?: RichEditorElement[];
|
|
31
|
+
onCharacterCountChange?: (count: number) => void;
|
|
32
|
+
maxLength?: number;
|
|
33
|
+
disableVideo?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const RichEditor = (props: RichEditorProps) => {
|
|
37
|
+
const [isClient, setIsClient] = useState(false);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setIsClient(typeof window !== "undefined");
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
if (!isClient) return null;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div>
|
|
47
|
+
<ToastProvider>
|
|
48
|
+
<QuillComponent {...props} />
|
|
49
|
+
</ToastProvider>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
50
54
|
export default RichEditor;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { QuillEditor } from "./styledComponents";
|
|
2
|
-
|
|
3
|
-
type Props = {
|
|
4
|
-
richText: string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const RichTextPresenter = ({ richText }: Props) => {
|
|
8
|
-
return (
|
|
9
|
-
<QuillEditor>
|
|
10
|
-
<div
|
|
11
|
-
className="ql-editor"
|
|
12
|
-
dangerouslySetInnerHTML={{ __html: richText }}
|
|
13
|
-
/>
|
|
14
|
-
</QuillEditor>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default RichTextPresenter;
|
|
1
|
+
import { QuillEditor } from "./styledComponents";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
richText: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const RichTextPresenter = ({ richText }: Props) => {
|
|
8
|
+
return (
|
|
9
|
+
<QuillEditor>
|
|
10
|
+
<div
|
|
11
|
+
className="ql-editor"
|
|
12
|
+
dangerouslySetInnerHTML={{ __html: richText }}
|
|
13
|
+
/>
|
|
14
|
+
</QuillEditor>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default RichTextPresenter;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { RichEditorElement } from "./types";
|
|
2
|
+
|
|
3
|
+
const TEXT_FORMATS: RichEditorElement[] = ["bold", "italic", "underline"];
|
|
4
|
+
const MEDIA_FORMATS: RichEditorElement[] = ["link", "image", "video"];
|
|
5
|
+
|
|
6
|
+
export const buildToolbarFromElements = (
|
|
7
|
+
elements: RichEditorElement[],
|
|
8
|
+
): unknown[] => {
|
|
9
|
+
const toolbar: unknown[] = [];
|
|
10
|
+
|
|
11
|
+
if (elements.includes("header")) {
|
|
12
|
+
toolbar.push([{ header: [1, 2, false] }]);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const textGroup = elements.filter((element) =>
|
|
16
|
+
TEXT_FORMATS.includes(element),
|
|
17
|
+
);
|
|
18
|
+
if (textGroup.length > 0) {
|
|
19
|
+
toolbar.push(textGroup);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const colorGroup: unknown[] = [];
|
|
23
|
+
if (elements.includes("color")) colorGroup.push({ color: [] });
|
|
24
|
+
if (elements.includes("background")) colorGroup.push({ background: [] });
|
|
25
|
+
if (colorGroup.length > 0) {
|
|
26
|
+
toolbar.push(colorGroup);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (elements.includes("align")) {
|
|
30
|
+
toolbar.push([{ align: [] }]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (elements.includes("list")) {
|
|
34
|
+
toolbar.push([{ list: "ordered" }, { list: "bullet" }]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const mediaGroup = elements.filter((element) =>
|
|
38
|
+
MEDIA_FORMATS.includes(element),
|
|
39
|
+
);
|
|
40
|
+
if (mediaGroup.length > 0) {
|
|
41
|
+
toolbar.push(mediaGroup);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return toolbar;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const buildFormatsFromElements = (
|
|
48
|
+
elements: RichEditorElement[],
|
|
49
|
+
): string[] => elements;
|
|
50
|
+
|
|
51
|
+
export const getEditorModulesAndFormats = (
|
|
52
|
+
richEditorElements?: RichEditorElement[],
|
|
53
|
+
simpleVersion = false,
|
|
54
|
+
disableVideo = false,
|
|
55
|
+
): { modules: Record<string, unknown>; formats: string[] } => {
|
|
56
|
+
const clipboard = { matchVisual: false };
|
|
57
|
+
|
|
58
|
+
if (richEditorElements && richEditorElements.length > 0) {
|
|
59
|
+
return {
|
|
60
|
+
modules: {
|
|
61
|
+
toolbar: buildToolbarFromElements(richEditorElements),
|
|
62
|
+
clipboard,
|
|
63
|
+
},
|
|
64
|
+
formats: buildFormatsFromElements(richEditorElements),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (simpleVersion) {
|
|
69
|
+
return {
|
|
70
|
+
modules: {
|
|
71
|
+
toolbar: [
|
|
72
|
+
[{ header: [1, 2, false] }],
|
|
73
|
+
["bold", "italic", "underline"],
|
|
74
|
+
[{ color: [] }, { background: [] }],
|
|
75
|
+
[{ align: [] }],
|
|
76
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
77
|
+
],
|
|
78
|
+
clipboard,
|
|
79
|
+
},
|
|
80
|
+
formats: [
|
|
81
|
+
"header",
|
|
82
|
+
"bold",
|
|
83
|
+
"italic",
|
|
84
|
+
"underline",
|
|
85
|
+
"color",
|
|
86
|
+
"background",
|
|
87
|
+
"align",
|
|
88
|
+
"list",
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (disableVideo) {
|
|
94
|
+
return {
|
|
95
|
+
modules: {
|
|
96
|
+
toolbar: [
|
|
97
|
+
[{ header: [1, 2, false] }],
|
|
98
|
+
["bold", "italic", "underline", "strike"],
|
|
99
|
+
[{ color: [] }, { background: [] }],
|
|
100
|
+
[{ align: [] }],
|
|
101
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
102
|
+
["link", "image"],
|
|
103
|
+
],
|
|
104
|
+
clipboard,
|
|
105
|
+
},
|
|
106
|
+
formats: [
|
|
107
|
+
"header",
|
|
108
|
+
"bold",
|
|
109
|
+
"italic",
|
|
110
|
+
"underline",
|
|
111
|
+
"strike",
|
|
112
|
+
"color",
|
|
113
|
+
"background",
|
|
114
|
+
"align",
|
|
115
|
+
"list",
|
|
116
|
+
"link",
|
|
117
|
+
"image",
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
modules: {
|
|
124
|
+
toolbar: [
|
|
125
|
+
[{ header: [1, 2, false] }],
|
|
126
|
+
["bold", "italic", "underline", "strike"],
|
|
127
|
+
[{ color: [] }, { background: [] }],
|
|
128
|
+
[{ align: [] }],
|
|
129
|
+
[{ list: "ordered" }, { list: "bullet" }],
|
|
130
|
+
["link", "image", "video"],
|
|
131
|
+
],
|
|
132
|
+
clipboard,
|
|
133
|
+
},
|
|
134
|
+
formats: [
|
|
135
|
+
"header",
|
|
136
|
+
"bold",
|
|
137
|
+
"italic",
|
|
138
|
+
"underline",
|
|
139
|
+
"strike",
|
|
140
|
+
"color",
|
|
141
|
+
"background",
|
|
142
|
+
"align",
|
|
143
|
+
"list",
|
|
144
|
+
"link",
|
|
145
|
+
"image",
|
|
146
|
+
"video",
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as RichEditor } from "./RichEditor";
|
|
2
|
-
export type { RichEditorProps } from "./RichEditor";
|
|
3
|
-
export { default as RichTextPresenter } from "./RichTextPresenter";
|
|
1
|
+
export { default as RichEditor } from "./RichEditor";
|
|
2
|
+
export type { RichEditorProps, RichEditorElement } from "./RichEditor";
|
|
3
|
+
export { default as RichTextPresenter } from "./RichTextPresenter";
|