@lets-events/react 12.2.2 → 12.2.3

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 (99) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +19 -21
  3. package/CHANGELOG.md +6 -0
  4. package/dist/index.css +138 -1023
  5. package/dist/index.js +3 -1
  6. package/dist/index.mjs +3 -1
  7. package/package.json +1 -1
  8. package/src/components/Alert.tsx +303 -303
  9. package/src/components/Avatar.tsx +55 -55
  10. package/src/components/Badge.tsx +125 -125
  11. package/src/components/Box.tsx +3 -3
  12. package/src/components/Button/index.tsx +16 -16
  13. package/src/components/Button/styledComponents.ts +290 -288
  14. package/src/components/ButtonGroup.tsx +484 -484
  15. package/src/components/Calendar/index.tsx +146 -146
  16. package/src/components/Calendar/styledComponents.ts +250 -250
  17. package/src/components/Card.tsx +48 -48
  18. package/src/components/CheckboxGroup.tsx +176 -176
  19. package/src/components/Container.tsx +39 -39
  20. package/src/components/Drawer/index.tsx +138 -138
  21. package/src/components/Drawer/styledComponents.ts +52 -52
  22. package/src/components/Dropdown.tsx +302 -302
  23. package/src/components/Filter.tsx +164 -164
  24. package/src/components/Flex.tsx +118 -118
  25. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  26. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  27. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  28. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  29. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  30. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  31. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  32. package/src/components/FormFields/CPFFormField.tsx +78 -78
  33. package/src/components/FormFields/CalendarFormField.tsx +92 -92
  34. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  35. package/src/components/FormFields/EmailFormField.tsx +27 -27
  36. package/src/components/FormFields/Form.tsx +39 -39
  37. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
  38. package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
  39. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  40. package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
  41. package/src/components/FormFields/RichEditorFormField.tsx +98 -98
  42. package/src/components/FormFields/SelectFormField.tsx +93 -93
  43. package/src/components/FormFields/SwitchFormField.tsx +46 -46
  44. package/src/components/FormFields/TextAreaFormField.tsx +57 -57
  45. package/src/components/FormFields/TextFormField.tsx +112 -112
  46. package/src/components/FormFields/TimePickerFormField.tsx +88 -88
  47. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  48. package/src/components/FormFields/subComponents/FormLabel.tsx +29 -29
  49. package/src/components/FormFields/utils/validation.ts +23 -23
  50. package/src/components/Grid.tsx +137 -137
  51. package/src/components/Icon.tsx +47 -47
  52. package/src/components/MenuDropdown/index.tsx +38 -38
  53. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  54. package/src/components/Modal.tsx +90 -90
  55. package/src/components/MultiSelect/index.tsx +243 -243
  56. package/src/components/MultiSelect/styledComponents.ts +160 -160
  57. package/src/components/RadioGroup.tsx +210 -210
  58. package/src/components/RichEditor/QuillComponent.tsx +444 -444
  59. package/src/components/RichEditor/RichEditor.tsx +48 -48
  60. package/src/components/RichEditor/index.ts +2 -2
  61. package/src/components/RichEditor/styledComponents.ts +1151 -1151
  62. package/src/components/Section.tsx +33 -33
  63. package/src/components/Step.tsx +164 -164
  64. package/src/components/Switch.tsx +108 -108
  65. package/src/components/Text.tsx +38 -38
  66. package/src/components/TextField.tsx +372 -372
  67. package/src/components/TextareaField.tsx +127 -127
  68. package/src/components/TimePicker.tsx +328 -328
  69. package/src/components/Toast/components/ToastItem.tsx +41 -41
  70. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  71. package/src/components/Toast/hooks/useToast.ts +12 -12
  72. package/src/components/Toast/index.tsx +5 -5
  73. package/src/components/Toast/styles/index.ts +135 -135
  74. package/src/components/Toast/types/index.ts +46 -46
  75. package/src/components/Tooltip/index.tsx +66 -66
  76. package/src/components/Tooltip/styles.ts +77 -77
  77. package/src/hooks/useCountries.ts +41 -41
  78. package/src/hooks/useImageUpload.ts +139 -139
  79. package/src/hooks/useOnClickOutside.tsx +42 -42
  80. package/src/index.tsx +68 -68
  81. package/src/styles/index.ts +38 -38
  82. package/src/types/typographyValues.ts +178 -178
  83. package/src/utils/getNestedValue.ts +3 -3
  84. package/src/utils/states.ts +29 -29
  85. package/src/utils/uploadService.ts +180 -180
  86. package/tsconfig.json +3 -3
  87. package/tsup.config.ts +38 -38
  88. package/dist/QuillComponent-2YO26WOT.mjs +0 -458
  89. package/dist/QuillComponent-36H54CRL.mjs +0 -451
  90. package/dist/QuillComponent-A5KIFPCL.mjs +0 -438
  91. package/dist/QuillComponent-C2NXFWIZ.mjs +0 -459
  92. package/dist/QuillComponent-EIWPUIIH.mjs +0 -456
  93. package/dist/QuillComponent-FPVFLYUK.mjs +0 -448
  94. package/dist/QuillComponent-O5RSHCDS.mjs +0 -459
  95. package/dist/QuillComponent-PPWKGS74.mjs +0 -452
  96. package/dist/QuillComponent-QFVVQA6K.mjs +0 -459
  97. package/dist/QuillComponent-TLIZCM6V.mjs +0 -458
  98. package/dist/QuillComponent-ZLQ2VKPD.mjs +0 -457
  99. package/dist/chunk-TU7LKUXZ.mjs +0 -1927
@@ -1,459 +0,0 @@
1
- import {
2
- Flex,
3
- Text,
4
- UploadService,
5
- __async,
6
- styled,
7
- useToast
8
- } from "./chunk-TU7LKUXZ.mjs";
9
-
10
- // src/components/RichEditor/QuillComponent.tsx
11
- import { useState, useRef, useEffect, useCallback } from "react";
12
- import { useQuill } from "react-quilljs";
13
- import "quill/dist/quill.snow.css";
14
-
15
- // src/components/RichEditor/styledComponents.ts
16
- var QuillContainer = styled("div", {
17
- display: "flex",
18
- flexDirection: "column"
19
- });
20
- var QuillEditor = styled("div", {
21
- "& .ql-editor": {
22
- minHeight: "200px",
23
- padding: "$12",
24
- fontSize: "$14",
25
- lineHeight: "$base",
26
- fontFamily: "$default",
27
- color: "$neutral900",
28
- backgroundColor: "$white",
29
- border: "none",
30
- outline: "none",
31
- cursor: "text",
32
- caretColor: "$primary500",
33
- "&:focus": {
34
- borderColor: "$primary500",
35
- boxShadow: "0 0 0 1px $primary500"
36
- },
37
- "& p": {
38
- margin: "0 0 $8 0"
39
- },
40
- "& h1 span, & h1, & h2, & h2 span ": {
41
- lineHeight: "1.5rem"
42
- },
43
- "& p:last-child": {
44
- marginBottom: 0
45
- },
46
- "& .ql-cursor": {
47
- borderLeft: "2px solid $primary500"
48
- }
49
- },
50
- "& .ql-toolbar": {
51
- backgroundColor: "$grey100",
52
- border: "1px solid $neutral300",
53
- borderBottom: "none",
54
- borderTopLeftRadius: "$sm",
55
- borderTopRightRadius: "$sm",
56
- padding: "$8 $12"
57
- },
58
- "& .ql-container": {
59
- border: "1px solid $neutral300",
60
- borderTop: "none",
61
- borderBottomLeftRadius: "$sm",
62
- borderBottomRightRadius: "$sm",
63
- fontFamily: "$default"
64
- },
65
- "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before": {
66
- content: "T\xEDtulo 1"
67
- },
68
- "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before": {
69
- content: "T\xEDtulo 2"
70
- }
71
- });
72
-
73
- // src/components/RichEditor/QuillComponent.tsx
74
- import { jsx, jsxs } from "react/jsx-runtime";
75
- var QuillComponent = ({
76
- value = "",
77
- onChange,
78
- placeholder = "Digite seu texto aqui...",
79
- disabled = false,
80
- className,
81
- uploadConfig,
82
- simpleVersion = false,
83
- onCharacterCountChange,
84
- maxLength
85
- }) => {
86
- const [showVideoModal, setShowVideoModal] = useState(false);
87
- const [videoUrl, setVideoUrl] = useState("");
88
- const [showLinkModal, setShowLinkModal] = useState(false);
89
- const [linkUrl, setLinkUrl] = useState("");
90
- const videoModalRef = useRef(null);
91
- const linkModalRef = useRef(null);
92
- const { addToast, removeToast } = useToast();
93
- const modules = simpleVersion ? {
94
- toolbar: [
95
- ["bold", "italic", "underline"],
96
- [{ list: "ordered" }, { list: "bullet" }],
97
- ["link"]
98
- ],
99
- clipboard: {
100
- matchVisual: false
101
- }
102
- } : {
103
- toolbar: [
104
- [{ header: [1, 2, false] }],
105
- ["bold", "italic", "underline", "strike"],
106
- [{ color: [] }, { background: [] }],
107
- [{ align: [] }],
108
- [{ list: "ordered" }, { list: "bullet" }],
109
- ["link", "image", "video"]
110
- ],
111
- clipboard: {
112
- matchVisual: false
113
- }
114
- };
115
- const formats = simpleVersion ? ["bold", "italic", "underline", "list", "link"] : [
116
- "header",
117
- "bold",
118
- "italic",
119
- "underline",
120
- "strike",
121
- "color",
122
- "background",
123
- "align",
124
- "list",
125
- "link",
126
- "image",
127
- "video"
128
- ];
129
- const { quill, quillRef } = useQuill({
130
- theme: "snow",
131
- modules,
132
- formats,
133
- placeholder,
134
- readOnly: disabled
135
- });
136
- const handleImageUpload = useCallback(
137
- (file) => __async(null, null, function* () {
138
- if (disabled || !quill || !uploadConfig) return;
139
- try {
140
- addToast({
141
- type: "info",
142
- message: "Carregando imagem...",
143
- duration: 2e3
144
- });
145
- const uploadedFile = yield UploadService.uploadToS3(file, uploadConfig);
146
- removeToast("info");
147
- addToast({
148
- type: "success",
149
- message: "Imagem adicionada com sucesso!"
150
- });
151
- const selection = quill.getSelection();
152
- const index = selection ? selection.index : quill.getLength();
153
- quill.insertEmbed(index, "image", uploadedFile.url);
154
- quill.setSelection(index + 1, 0);
155
- } catch (error) {
156
- console.error("Erro no upload:", error);
157
- addToast({
158
- type: "error",
159
- message: "Erro no upload: N\xE3o foi poss\xEDvel enviar a imagem. Tente novamente."
160
- });
161
- }
162
- }),
163
- [disabled, quill, addToast, removeToast, uploadConfig]
164
- );
165
- useEffect(() => {
166
- if (quill && value) {
167
- const currentContent = quill.root.innerHTML;
168
- if (currentContent !== value) {
169
- const selection = quill.getSelection();
170
- quill.clipboard.dangerouslyPasteHTML(value);
171
- if (selection) {
172
- quill.setSelection(selection.index, selection.length);
173
- } else {
174
- quill.setSelection(quill.getLength(), 0);
175
- }
176
- }
177
- }
178
- }, [quill, value]);
179
- useEffect(() => {
180
- if (quill) {
181
- quill.on("text-change", (delta, oldDelta, source) => {
182
- if (source === "user") {
183
- const text = quill.getText().trim();
184
- const count = text.length;
185
- if (maxLength !== void 0 && count > maxLength) {
186
- quill.deleteText(maxLength, count - maxLength);
187
- return;
188
- }
189
- onChange == null ? void 0 : onChange(quill.root.innerHTML);
190
- onCharacterCountChange == null ? void 0 : onCharacterCountChange(count);
191
- }
192
- });
193
- const toolbar = quill.getModule("toolbar");
194
- if (toolbar) {
195
- toolbar.addHandler("link", () => setShowLinkModal(true));
196
- toolbar.addHandler("video", () => setShowVideoModal(true));
197
- toolbar.addHandler("image", () => {
198
- const input = document.createElement("input");
199
- input.setAttribute("type", "file");
200
- input.setAttribute("accept", "image/*");
201
- input.click();
202
- input.onchange = () => __async(null, null, function* () {
203
- var _a;
204
- const file = (_a = input.files) == null ? void 0 : _a[0];
205
- if (file) {
206
- yield handleImageUpload(file);
207
- }
208
- });
209
- });
210
- }
211
- setTimeout(() => {
212
- var _a, _b;
213
- const toolbarElement = (_b = (_a = quillRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.querySelector(".ql-toolbar");
214
- if (toolbarElement) {
215
- const headerSelect = toolbarElement.querySelector(
216
- "select[data-value]"
217
- );
218
- if (headerSelect) {
219
- const options = headerSelect.querySelectorAll("option");
220
- options.forEach((option) => {
221
- if (option.value === "1") {
222
- option.textContent = "T\xEDtulo 1";
223
- } else if (option.value === "2") {
224
- option.textContent = "T\xEDtulo 2";
225
- } else if (option.value === "") {
226
- option.textContent = "Normal";
227
- }
228
- });
229
- }
230
- }
231
- }, 2e3);
232
- }
233
- }, [quill, onChange, handleImageUpload, onCharacterCountChange]);
234
- useEffect(() => {
235
- if (quill) {
236
- quill.enable(!disabled);
237
- if (!disabled) {
238
- if (quill.getLength() <= 1) {
239
- quill.focus();
240
- quill.setSelection(0, 0);
241
- }
242
- }
243
- }
244
- }, [quill, disabled]);
245
- const handleLinkCancel = useCallback(() => {
246
- setLinkUrl("");
247
- setShowLinkModal(false);
248
- }, []);
249
- const handleLinkSubmit = useCallback(() => {
250
- if (!linkUrl.trim() || !quill) return;
251
- const url = linkUrl.trim();
252
- const selection = quill.getSelection();
253
- if (selection && selection.length > 0) {
254
- quill.format("link", url);
255
- } else {
256
- const index = quill.getLength();
257
- quill.insertText(index, url, "link", url);
258
- quill.setSelection(index + url.length, 0);
259
- }
260
- setLinkUrl("");
261
- setShowLinkModal(false);
262
- }, [linkUrl, quill]);
263
- const handleVideoCancel = useCallback(() => {
264
- setVideoUrl("");
265
- setShowVideoModal(false);
266
- }, []);
267
- const handleVideoSubmit = useCallback(() => {
268
- var _a, _b;
269
- if (!videoUrl.trim() || !quill) return;
270
- let processedUrl = videoUrl.trim();
271
- if (processedUrl.includes("youtube.com/watch")) {
272
- const videoId = (_a = processedUrl.match(/[?&]v=([^&]+)/)) == null ? void 0 : _a[1];
273
- if (videoId) {
274
- processedUrl = `https://www.youtube.com/embed/${videoId}`;
275
- }
276
- } else if (processedUrl.includes("youtu.be/")) {
277
- const videoId = (_b = processedUrl.split("youtu.be/")[1]) == null ? void 0 : _b.split("?")[0];
278
- if (videoId) {
279
- processedUrl = `https://www.youtube.com/embed/${videoId}`;
280
- }
281
- }
282
- const videoHTML = `
283
- <iframe
284
- src="${processedUrl}"
285
- style="max-width:100%; height:315px; border:0;"
286
- title="Video player"
287
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
288
- allowfullscreen>
289
- </iframe>
290
- <br/>
291
- `;
292
- const selection = quill.getSelection();
293
- const insertIndex = selection ? selection.index : quill.getLength();
294
- quill.clipboard.dangerouslyPasteHTML(insertIndex, videoHTML);
295
- quill.setSelection(insertIndex + 1, 0);
296
- setVideoUrl("");
297
- setShowVideoModal(false);
298
- }, [videoUrl, quill]);
299
- useEffect(() => {
300
- const handleClickOutside = (event) => {
301
- if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
302
- handleVideoCancel();
303
- }
304
- if (showLinkModal && linkModalRef.current && !linkModalRef.current.contains(event.target)) {
305
- handleLinkCancel();
306
- }
307
- };
308
- document.addEventListener("mousedown", handleClickOutside);
309
- return () => document.removeEventListener("mousedown", handleClickOutside);
310
- }, [showVideoModal, showLinkModal, handleVideoCancel, handleLinkCancel]);
311
- return /* @__PURE__ */ jsx(QuillContainer, { className, children: /* @__PURE__ */ jsxs(QuillEditor, { style: { position: "relative" }, children: [
312
- /* @__PURE__ */ jsx("div", { ref: quillRef }),
313
- showVideoModal && /* @__PURE__ */ jsx(
314
- "div",
315
- {
316
- ref: videoModalRef,
317
- style: {
318
- position: "absolute",
319
- top: "20px",
320
- left: "20px",
321
- right: "20px",
322
- backgroundColor: "white",
323
- border: "1px solid #e0e0e0",
324
- borderRadius: "4px",
325
- padding: "12px",
326
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
327
- zIndex: 1e3,
328
- width: "fit-content"
329
- },
330
- children: /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
331
- /* @__PURE__ */ jsx(
332
- Text,
333
- {
334
- style: { fontSize: "14px", fontWeight: "500", color: "#333" },
335
- children: "V\xEDdeo:"
336
- }
337
- ),
338
- /* @__PURE__ */ jsx(
339
- "input",
340
- {
341
- type: "text",
342
- value: videoUrl,
343
- onChange: (e) => setVideoUrl(e.target.value),
344
- placeholder: "Embed URL",
345
- style: {
346
- padding: "8px 12px",
347
- border: "1px solid #d0d0d0",
348
- borderRadius: "4px",
349
- fontSize: "14px",
350
- backgroundColor: "#f8f8f8"
351
- },
352
- onKeyDown: (e) => {
353
- if (e.key === "Enter") {
354
- handleVideoSubmit();
355
- } else if (e.key === "Escape") {
356
- handleVideoCancel();
357
- }
358
- },
359
- autoFocus: true
360
- }
361
- ),
362
- /* @__PURE__ */ jsx(
363
- "button",
364
- {
365
- onClick: handleVideoSubmit,
366
- disabled: !videoUrl.trim(),
367
- style: {
368
- padding: "8px 16px",
369
- backgroundColor: "#007bff",
370
- color: "white",
371
- border: "none",
372
- borderRadius: "4px",
373
- fontSize: "14px",
374
- cursor: videoUrl.trim() ? "pointer" : "not-allowed",
375
- opacity: videoUrl.trim() ? 1 : 0.6
376
- },
377
- children: "Ok"
378
- }
379
- )
380
- ] })
381
- }
382
- ),
383
- showLinkModal && /* @__PURE__ */ jsx(
384
- "div",
385
- {
386
- ref: linkModalRef,
387
- style: {
388
- position: "absolute",
389
- top: "20px",
390
- left: "20px",
391
- right: "20px",
392
- backgroundColor: "white",
393
- border: "1px solid #e0e0e0",
394
- borderRadius: "4px",
395
- padding: "12px",
396
- boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
397
- zIndex: 1e3,
398
- width: "fit-content"
399
- },
400
- children: /* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", children: [
401
- /* @__PURE__ */ jsx(
402
- Text,
403
- {
404
- style: { fontSize: "14px", fontWeight: "500", color: "#333" },
405
- children: "Link:"
406
- }
407
- ),
408
- /* @__PURE__ */ jsx(
409
- "input",
410
- {
411
- type: "text",
412
- value: linkUrl,
413
- onChange: (e) => setLinkUrl(e.target.value),
414
- placeholder: "URL do link",
415
- style: {
416
- padding: "8px 12px",
417
- border: "1px solid #d0d0d0",
418
- borderRadius: "4px",
419
- fontSize: "14px",
420
- backgroundColor: "#f8f8f8",
421
- width: "300px"
422
- },
423
- onKeyDown: (e) => {
424
- if (e.key === "Enter") {
425
- handleLinkSubmit();
426
- } else if (e.key === "Escape") {
427
- handleLinkCancel();
428
- }
429
- },
430
- autoFocus: true
431
- }
432
- ),
433
- /* @__PURE__ */ jsx(
434
- "button",
435
- {
436
- onClick: handleLinkSubmit,
437
- disabled: !linkUrl.trim(),
438
- style: {
439
- padding: "8px 16px",
440
- backgroundColor: "#007bff",
441
- color: "white",
442
- border: "none",
443
- borderRadius: "4px",
444
- fontSize: "14px",
445
- cursor: linkUrl.trim() ? "pointer" : "not-allowed",
446
- opacity: linkUrl.trim() ? 1 : 0.6
447
- },
448
- children: "Ok"
449
- }
450
- )
451
- ] })
452
- }
453
- )
454
- ] }) });
455
- };
456
- var QuillComponent_default = QuillComponent;
457
- export {
458
- QuillComponent_default as default
459
- };