@lets-events/react 12.10.16 → 12.11.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 (97) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +21 -19
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +70 -52
  5. package/dist/index.d.ts +70 -52
  6. package/dist/index.js +358 -263
  7. package/dist/index.mjs +335 -240
  8. package/package.json +1 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +132 -132
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +85 -85
  14. package/src/components/Button/styledComponents.ts +361 -361
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +168 -168
  17. package/src/components/Calendar/styledComponents.ts +480 -480
  18. package/src/components/Card.tsx +74 -67
  19. package/src/components/CheckboxGroup.tsx +176 -176
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Divider.tsx +7 -7
  22. package/src/components/DoubleCalendar/index.tsx +204 -204
  23. package/src/components/Drawer/index.tsx +113 -113
  24. package/src/components/Drawer/styledComponents.ts +97 -97
  25. package/src/components/Dropdown.tsx +302 -302
  26. package/src/components/Filter.tsx +164 -164
  27. package/src/components/Flex.tsx +130 -130
  28. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  29. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  30. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  31. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  32. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  33. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  34. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  35. package/src/components/FormFields/CPFFormField.tsx +78 -78
  36. package/src/components/FormFields/CalendarFormField.tsx +98 -98
  37. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  38. package/src/components/FormFields/DateAndTimeFormField.tsx +217 -217
  39. package/src/components/FormFields/DoubleCalendarFormField.tsx +96 -96
  40. package/src/components/FormFields/EmailFormField.tsx +27 -27
  41. package/src/components/FormFields/Form.tsx +39 -39
  42. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
  43. package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
  44. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  45. package/src/components/FormFields/RadioGroupFormField.tsx +88 -88
  46. package/src/components/FormFields/RichEditorFormField.tsx +128 -128
  47. package/src/components/FormFields/SelectFormField.tsx +113 -113
  48. package/src/components/FormFields/SwitchFormField.tsx +46 -46
  49. package/src/components/FormFields/TextAreaFormField.tsx +61 -61
  50. package/src/components/FormFields/TextFormField.tsx +112 -112
  51. package/src/components/FormFields/TimePickerFormField.tsx +88 -88
  52. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  53. package/src/components/FormFields/subComponents/FormLabel.tsx +36 -36
  54. package/src/components/FormFields/utils/validation.ts +23 -23
  55. package/src/components/Grid.tsx +137 -137
  56. package/src/components/Icon.tsx +47 -47
  57. package/src/components/MenuDropdown/index.tsx +38 -38
  58. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  59. package/src/components/Modal.tsx +130 -114
  60. package/src/components/MultiSelect/index.tsx +417 -305
  61. package/src/components/MultiSelect/styledComponents.ts +176 -160
  62. package/src/components/RadioGroup.tsx +210 -210
  63. package/src/components/RichEditor/QuillComponent.tsx +419 -419
  64. package/src/components/RichEditor/RichEditor.tsx +53 -53
  65. package/src/components/RichEditor/RichTextPresenter.tsx +18 -18
  66. package/src/components/RichEditor/editorConfig.ts +149 -149
  67. package/src/components/RichEditor/index.ts +3 -3
  68. package/src/components/RichEditor/styledComponents.ts +1175 -1175
  69. package/src/components/RichEditor/types.ts +12 -12
  70. package/src/components/Section.tsx +33 -33
  71. package/src/components/Step.tsx +164 -164
  72. package/src/components/Switch.tsx +108 -108
  73. package/src/components/Text.tsx +54 -54
  74. package/src/components/TextField.tsx +423 -423
  75. package/src/components/TextareaField.tsx +116 -116
  76. package/src/components/TimePicker.tsx +357 -357
  77. package/src/components/Toast/components/ToastItem.tsx +41 -41
  78. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  79. package/src/components/Toast/hooks/useToast.ts +12 -12
  80. package/src/components/Toast/index.tsx +5 -5
  81. package/src/components/Toast/styles/index.ts +135 -135
  82. package/src/components/Toast/types/index.ts +46 -46
  83. package/src/components/ToggleElement/index.tsx +58 -58
  84. package/src/components/Tooltip/index.tsx +73 -73
  85. package/src/components/Tooltip/styles.ts +77 -77
  86. package/src/hooks/useCountries.ts +41 -41
  87. package/src/hooks/useImageUpload.ts +139 -139
  88. package/src/hooks/useMediaQuery.ts +19 -0
  89. package/src/hooks/useOnClickOutside.tsx +42 -42
  90. package/src/index.tsx +72 -72
  91. package/src/styles/index.ts +41 -41
  92. package/src/types/typographyValues.ts +178 -178
  93. package/src/utils/getNestedValue.ts +3 -3
  94. package/src/utils/states.ts +29 -29
  95. package/src/utils/uploadService.ts +180 -180
  96. package/tsconfig.json +3 -3
  97. package/tsup.config.ts +38 -38
@@ -1,54 +1,54 @@
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
-
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
+
54
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;
@@ -1,149 +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
+ 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, RichEditorElement } 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";