@lets-events/react 12.2.2 → 12.2.4

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