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