@lets-events/react 11.8.0 → 12.0.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 (87) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +21 -18
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +124 -6
  5. package/dist/index.d.ts +124 -6
  6. package/dist/index.js +1033 -276
  7. package/dist/index.mjs +1027 -276
  8. package/package.json +7 -2
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +125 -125
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +16 -16
  14. package/src/components/Button/styledComponents.ts +287 -287
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +139 -136
  17. package/src/components/Calendar/styledComponents.ts +209 -209
  18. package/src/components/Card.tsx +48 -48
  19. package/src/components/CheckboxGroup.tsx +176 -176
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Drawer/index.tsx +55 -55
  22. package/src/components/Drawer/styledComponents.ts +46 -46
  23. package/src/components/Dropdown.tsx +302 -302
  24. package/src/components/Filter.tsx +164 -164
  25. package/src/components/Flex.tsx +118 -118
  26. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  27. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  28. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  29. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  30. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  31. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  32. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  33. package/src/components/FormFields/CPFFormField.tsx +78 -78
  34. package/src/components/FormFields/CalendarFormField.tsx +89 -0
  35. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  36. package/src/components/FormFields/EmailFormField.tsx +27 -27
  37. package/src/components/FormFields/Form.tsx +39 -39
  38. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +40 -40
  39. package/src/components/FormFields/MultiSelectFormField.tsx +61 -55
  40. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  41. package/src/components/FormFields/RadioGroupFormField.tsx +84 -84
  42. package/src/components/FormFields/RichEditorFormField.tsx +69 -0
  43. package/src/components/FormFields/SelectFormField.tsx +93 -93
  44. package/src/components/FormFields/TextAreaFormField.tsx +57 -48
  45. package/src/components/FormFields/TextFormField.tsx +112 -112
  46. package/src/components/FormFields/TimePickerFormField.tsx +88 -0
  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.tsx +266 -252
  56. package/src/components/RadioGroup.tsx +210 -210
  57. package/src/components/RichEditor/QuillComponent.tsx +415 -0
  58. package/src/components/RichEditor/RichEditor.tsx +38 -0
  59. package/src/components/RichEditor/index.ts +2 -0
  60. package/src/components/RichEditor/styledComponents.ts +62 -0
  61. package/src/components/Section.tsx +33 -33
  62. package/src/components/Step.tsx +164 -164
  63. package/src/components/Switch.tsx +108 -108
  64. package/src/components/Text.tsx +38 -38
  65. package/src/components/TextField.tsx +372 -365
  66. package/src/components/TextareaField.tsx +128 -128
  67. package/src/components/TimePicker.tsx +301 -298
  68. package/src/components/Toast/components/ToastItem.tsx +41 -41
  69. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  70. package/src/components/Toast/hooks/useToast.ts +12 -12
  71. package/src/components/Toast/index.tsx +5 -5
  72. package/src/components/Toast/styles/index.ts +135 -135
  73. package/src/components/Toast/types/index.ts +46 -46
  74. package/src/components/Tooltip/index.tsx +66 -66
  75. package/src/components/Tooltip/styles.ts +77 -77
  76. package/src/hooks/useCountries.ts +41 -41
  77. package/src/hooks/useImageUpload.ts +139 -0
  78. package/src/hooks/useOnClickOutside.tsx +20 -20
  79. package/src/index.tsx +67 -55
  80. package/src/styles/index.ts +38 -38
  81. package/src/types/typographyValues.ts +178 -178
  82. package/src/utils/getNestedValue.ts +3 -3
  83. package/src/utils/states.ts +29 -29
  84. package/src/utils/uploadService.ts +180 -0
  85. package/tsconfig.json +3 -3
  86. package/tsup.config.ts +38 -0
  87. package/dist/index.css +0 -171
package/dist/index.mjs CHANGED
@@ -74,124 +74,11 @@ var __async = (__this, __arguments, generator) => {
74
74
  });
75
75
  };
76
76
 
77
- // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
78
- var require_react_is_production_min = __commonJS({
79
- "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
80
- "use strict";
81
- var b = "function" === typeof Symbol && Symbol.for;
82
- var c = b ? Symbol.for("react.element") : 60103;
83
- var d = b ? Symbol.for("react.portal") : 60106;
84
- var e = b ? Symbol.for("react.fragment") : 60107;
85
- var f = b ? Symbol.for("react.strict_mode") : 60108;
86
- var g = b ? Symbol.for("react.profiler") : 60114;
87
- var h = b ? Symbol.for("react.provider") : 60109;
88
- var k = b ? Symbol.for("react.context") : 60110;
89
- var l = b ? Symbol.for("react.async_mode") : 60111;
90
- var m = b ? Symbol.for("react.concurrent_mode") : 60111;
91
- var n = b ? Symbol.for("react.forward_ref") : 60112;
92
- var p = b ? Symbol.for("react.suspense") : 60113;
93
- var q = b ? Symbol.for("react.suspense_list") : 60120;
94
- var r = b ? Symbol.for("react.memo") : 60115;
95
- var t = b ? Symbol.for("react.lazy") : 60116;
96
- var v = b ? Symbol.for("react.block") : 60121;
97
- var w = b ? Symbol.for("react.fundamental") : 60117;
98
- var x = b ? Symbol.for("react.responder") : 60118;
99
- var y = b ? Symbol.for("react.scope") : 60119;
100
- function z(a) {
101
- if ("object" === typeof a && null !== a) {
102
- var u = a.$$typeof;
103
- switch (u) {
104
- case c:
105
- switch (a = a.type, a) {
106
- case l:
107
- case m:
108
- case e:
109
- case g:
110
- case f:
111
- case p:
112
- return a;
113
- default:
114
- switch (a = a && a.$$typeof, a) {
115
- case k:
116
- case n:
117
- case t:
118
- case r:
119
- case h:
120
- return a;
121
- default:
122
- return u;
123
- }
124
- }
125
- case d:
126
- return u;
127
- }
128
- }
129
- }
130
- function A(a) {
131
- return z(a) === m;
132
- }
133
- exports.AsyncMode = l;
134
- exports.ConcurrentMode = m;
135
- exports.ContextConsumer = k;
136
- exports.ContextProvider = h;
137
- exports.Element = c;
138
- exports.ForwardRef = n;
139
- exports.Fragment = e;
140
- exports.Lazy = t;
141
- exports.Memo = r;
142
- exports.Portal = d;
143
- exports.Profiler = g;
144
- exports.StrictMode = f;
145
- exports.Suspense = p;
146
- exports.isAsyncMode = function(a) {
147
- return A(a) || z(a) === l;
148
- };
149
- exports.isConcurrentMode = A;
150
- exports.isContextConsumer = function(a) {
151
- return z(a) === k;
152
- };
153
- exports.isContextProvider = function(a) {
154
- return z(a) === h;
155
- };
156
- exports.isElement = function(a) {
157
- return "object" === typeof a && null !== a && a.$$typeof === c;
158
- };
159
- exports.isForwardRef = function(a) {
160
- return z(a) === n;
161
- };
162
- exports.isFragment = function(a) {
163
- return z(a) === e;
164
- };
165
- exports.isLazy = function(a) {
166
- return z(a) === t;
167
- };
168
- exports.isMemo = function(a) {
169
- return z(a) === r;
170
- };
171
- exports.isPortal = function(a) {
172
- return z(a) === d;
173
- };
174
- exports.isProfiler = function(a) {
175
- return z(a) === g;
176
- };
177
- exports.isStrictMode = function(a) {
178
- return z(a) === f;
179
- };
180
- exports.isSuspense = function(a) {
181
- return z(a) === p;
182
- };
183
- exports.isValidElementType = function(a) {
184
- return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
185
- };
186
- exports.typeOf = z;
187
- }
188
- });
189
-
190
77
  // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
191
78
  var require_react_is_development = __commonJS({
192
79
  "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports) {
193
80
  "use strict";
194
- if (process.env.NODE_ENV !== "production") {
81
+ if (true) {
195
82
  (function() {
196
83
  "use strict";
197
84
  var hasSymbol = typeof Symbol === "function" && Symbol.for;
@@ -346,8 +233,8 @@ var require_react_is_development = __commonJS({
346
233
  var require_react_is = __commonJS({
347
234
  "../../node_modules/prop-types/node_modules/react-is/index.js"(exports, module) {
348
235
  "use strict";
349
- if (process.env.NODE_ENV === "production") {
350
- module.exports = require_react_is_production_min();
236
+ if (false) {
237
+ module.exports = null;
351
238
  } else {
352
239
  module.exports = require_react_is_development();
353
240
  }
@@ -447,7 +334,7 @@ var require_checkPropTypes = __commonJS({
447
334
  "use strict";
448
335
  var printWarning = function() {
449
336
  };
450
- if (process.env.NODE_ENV !== "production") {
337
+ if (true) {
451
338
  ReactPropTypesSecret = require_ReactPropTypesSecret();
452
339
  loggedTypeFailures = {};
453
340
  has = require_has();
@@ -466,7 +353,7 @@ var require_checkPropTypes = __commonJS({
466
353
  var loggedTypeFailures;
467
354
  var has;
468
355
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
469
- if (process.env.NODE_ENV !== "production") {
356
+ if (true) {
470
357
  for (var typeSpecName in typeSpecs) {
471
358
  if (has(typeSpecs, typeSpecName)) {
472
359
  var error;
@@ -499,7 +386,7 @@ var require_checkPropTypes = __commonJS({
499
386
  }
500
387
  }
501
388
  checkPropTypes.resetWarningCache = function() {
502
- if (process.env.NODE_ENV !== "production") {
389
+ if (true) {
503
390
  loggedTypeFailures = {};
504
391
  }
505
392
  };
@@ -518,7 +405,7 @@ var require_factoryWithTypeCheckers = __commonJS({
518
405
  var checkPropTypes = require_checkPropTypes();
519
406
  var printWarning = function() {
520
407
  };
521
- if (process.env.NODE_ENV !== "production") {
408
+ if (true) {
522
409
  printWarning = function(text) {
523
410
  var message2 = "Warning: " + text;
524
411
  if (typeof console !== "undefined") {
@@ -578,7 +465,7 @@ var require_factoryWithTypeCheckers = __commonJS({
578
465
  }
579
466
  PropTypeError.prototype = Error.prototype;
580
467
  function createChainableTypeChecker(validate) {
581
- if (process.env.NODE_ENV !== "production") {
468
+ if (true) {
582
469
  var manualPropTypeCallCache = {};
583
470
  var manualPropTypeWarningCount = 0;
584
471
  }
@@ -592,7 +479,7 @@ var require_factoryWithTypeCheckers = __commonJS({
592
479
  );
593
480
  err.name = "Invariant Violation";
594
481
  throw err;
595
- } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
482
+ } else if (typeof console !== "undefined") {
596
483
  var cacheKey = componentName + ":" + propName;
597
484
  if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
598
485
  manualPropTypeWarningCount < 3) {
@@ -693,7 +580,7 @@ var require_factoryWithTypeCheckers = __commonJS({
693
580
  }
694
581
  function createEnumTypeChecker(expectedValues) {
695
582
  if (!Array.isArray(expectedValues)) {
696
- if (process.env.NODE_ENV !== "production") {
583
+ if (true) {
697
584
  if (arguments.length > 1) {
698
585
  printWarning(
699
586
  "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
@@ -746,7 +633,7 @@ var require_factoryWithTypeCheckers = __commonJS({
746
633
  }
747
634
  function createUnionTypeChecker(arrayOfTypeCheckers) {
748
635
  if (!Array.isArray(arrayOfTypeCheckers)) {
749
- process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
636
+ true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
750
637
  return emptyFunctionThatReturnsNull;
751
638
  }
752
639
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
@@ -950,72 +837,16 @@ var require_factoryWithTypeCheckers = __commonJS({
950
837
  }
951
838
  });
952
839
 
953
- // ../../node_modules/prop-types/factoryWithThrowingShims.js
954
- var require_factoryWithThrowingShims = __commonJS({
955
- "../../node_modules/prop-types/factoryWithThrowingShims.js"(exports, module) {
956
- "use strict";
957
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
958
- function emptyFunction() {
959
- }
960
- function emptyFunctionWithReset() {
961
- }
962
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
963
- module.exports = function() {
964
- function shim(props, propName, componentName, location, propFullName, secret) {
965
- if (secret === ReactPropTypesSecret) {
966
- return;
967
- }
968
- var err = new Error(
969
- "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
970
- );
971
- err.name = "Invariant Violation";
972
- throw err;
973
- }
974
- ;
975
- shim.isRequired = shim;
976
- function getShim() {
977
- return shim;
978
- }
979
- ;
980
- var ReactPropTypes = {
981
- array: shim,
982
- bigint: shim,
983
- bool: shim,
984
- func: shim,
985
- number: shim,
986
- object: shim,
987
- string: shim,
988
- symbol: shim,
989
- any: shim,
990
- arrayOf: getShim,
991
- element: shim,
992
- elementType: shim,
993
- instanceOf: getShim,
994
- node: shim,
995
- objectOf: getShim,
996
- oneOf: getShim,
997
- oneOfType: getShim,
998
- shape: getShim,
999
- exact: getShim,
1000
- checkPropTypes: emptyFunctionWithReset,
1001
- resetWarningCache: emptyFunction
1002
- };
1003
- ReactPropTypes.PropTypes = ReactPropTypes;
1004
- return ReactPropTypes;
1005
- };
1006
- }
1007
- });
1008
-
1009
840
  // ../../node_modules/prop-types/index.js
1010
841
  var require_prop_types = __commonJS({
1011
842
  "../../node_modules/prop-types/index.js"(exports, module) {
1012
843
  "use strict";
1013
- if (process.env.NODE_ENV !== "production") {
844
+ if (true) {
1014
845
  ReactIs = require_react_is();
1015
846
  throwOnDirectAccess = true;
1016
847
  module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1017
848
  } else {
1018
- module.exports = require_factoryWithThrowingShims()();
849
+ module.exports = null();
1019
850
  }
1020
851
  var ReactIs;
1021
852
  var throwOnDirectAccess;
@@ -2735,7 +2566,8 @@ var TextField = React.forwardRef(
2735
2566
  addon,
2736
2567
  textAlign = "left",
2737
2568
  mask,
2738
- maxLength
2569
+ maxLength,
2570
+ hasError
2739
2571
  } = _b, props = __objRest(_b, [
2740
2572
  "children",
2741
2573
  "isValid",
@@ -2746,7 +2578,8 @@ var TextField = React.forwardRef(
2746
2578
  "addon",
2747
2579
  "textAlign",
2748
2580
  "mask",
2749
- "maxLength"
2581
+ "maxLength",
2582
+ "hasError"
2750
2583
  ]);
2751
2584
  const maskRef = mask ? useMask(mask) : void 0;
2752
2585
  const inputRef = React.useRef(null);
@@ -2764,11 +2597,18 @@ var TextField = React.forwardRef(
2764
2597
  };
2765
2598
  return /* @__PURE__ */ jsxs(Flex2, { direction: "column", css: { width: "100%", position: "relative" }, children: [
2766
2599
  /* @__PURE__ */ jsxs(Flex2, { gap: "0", css: { width: "100%" }, children: [
2767
- !!addon && /* @__PURE__ */ jsx7(InputAddon, { color, typography: "labelSmall", children: addon }),
2600
+ !!addon && /* @__PURE__ */ jsx7(
2601
+ InputAddon,
2602
+ {
2603
+ color: hasError ? "error" : color,
2604
+ typography: "labelSmall",
2605
+ children: addon
2606
+ }
2607
+ ),
2768
2608
  /* @__PURE__ */ jsxs(
2769
2609
  TextFieldStyled,
2770
2610
  __spreadProps(__spreadValues({
2771
- color,
2611
+ color: hasError ? "error" : color || "default",
2772
2612
  isValid: isValid2,
2773
2613
  name,
2774
2614
  typography,
@@ -2797,7 +2637,7 @@ var TextField = React.forwardRef(
2797
2637
  {
2798
2638
  position: "flex-end",
2799
2639
  name,
2800
- color,
2640
+ color: hasError ? "error" : color,
2801
2641
  typography,
2802
2642
  fontWeight,
2803
2643
  textAlign,
@@ -7964,14 +7804,16 @@ function Calendar(_a) {
7964
7804
  calendarLayout,
7965
7805
  selected,
7966
7806
  setSelected,
7967
- position = "bottom"
7807
+ position = "bottom",
7808
+ hasError
7968
7809
  } = _b, props = __objRest(_b, [
7969
7810
  "action",
7970
7811
  "actionText",
7971
7812
  "calendarLayout",
7972
7813
  "selected",
7973
7814
  "setSelected",
7974
- "position"
7815
+ "position",
7816
+ "hasError"
7975
7817
  ]);
7976
7818
  const [inputValue, setInputValue] = useState2("");
7977
7819
  const [showContainer, setShowCalendar] = useState2(false);
@@ -8013,6 +7855,7 @@ function Calendar(_a) {
8013
7855
  onChange: handleInputChange,
8014
7856
  inputMode: "numeric",
8015
7857
  textAlign: "right",
7858
+ color: hasError ? "error" : "default",
8016
7859
  children: /* @__PURE__ */ jsx15(TextFieldSlot, { children: /* @__PURE__ */ jsx15(Icon_default, { name: "calendar", size: "xl" }) })
8017
7860
  }
8018
7861
  )
@@ -8241,7 +8084,8 @@ var pad = (num) => String(num).padStart(2, "0");
8241
8084
  function TimePicker({
8242
8085
  selected,
8243
8086
  setSelected,
8244
- position = "bottom"
8087
+ position = "bottom",
8088
+ hasError
8245
8089
  }) {
8246
8090
  const [hours, setHours] = useState3("00");
8247
8091
  const [minutes, setMinutes] = useState3("00");
@@ -8293,6 +8137,7 @@ function TimePicker({
8293
8137
  placeholder: "00:00",
8294
8138
  typography: "labelSmall",
8295
8139
  fontWeight: "regular",
8140
+ color: hasError ? "error" : "default",
8296
8141
  children: /* @__PURE__ */ jsx17(TextFieldSlot, { children: /* @__PURE__ */ jsx17(Icon_default, { name: "clock", size: "xl" }) })
8297
8142
  }
8298
8143
  )
@@ -9362,6 +9207,12 @@ var StyledTrigger = styled("div", {
9362
9207
  error: {
9363
9208
  border: "1px solid $error400"
9364
9209
  }
9210
+ },
9211
+ disabled: {
9212
+ true: {
9213
+ cursor: "not-allowed",
9214
+ border: "1px solid $dark100"
9215
+ }
9365
9216
  }
9366
9217
  },
9367
9218
  defaultVariants: {
@@ -9380,13 +9231,6 @@ var itemStyle = {
9380
9231
  }
9381
9232
  };
9382
9233
  var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9383
- var BadgeWrapper = styled("div", {
9384
- flex: "1",
9385
- display: "flex",
9386
- gap: "4px",
9387
- marginTop: "8px",
9388
- flexDirection: "column"
9389
- });
9390
9234
  var BadgeCloseBtn = styled("div", {
9391
9235
  cursor: "pointer"
9392
9236
  });
@@ -9400,7 +9244,9 @@ var MultiSelect = React9.forwardRef(
9400
9244
  width = "100%",
9401
9245
  zIndex = "auto",
9402
9246
  showSelectedValues = true,
9403
- singleSelect = false
9247
+ singleSelect = false,
9248
+ selectedOrientation = "column",
9249
+ disabled = false
9404
9250
  }, fowardedRef) => {
9405
9251
  var _a;
9406
9252
  const [isOpen, setIsOpen] = useState6(false);
@@ -9433,48 +9279,59 @@ var MultiSelect = React9.forwardRef(
9433
9279
  };
9434
9280
  return /* @__PURE__ */ jsxs14(Theme3, { children: [
9435
9281
  /* @__PURE__ */ jsxs14(DropdownMenu3.Root, { open: isOpen, onOpenChange: () => setIsOpen(false), children: [
9436
- /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { onClick: () => setIsOpen(true), children: /* @__PURE__ */ jsxs14(
9437
- StyledTrigger,
9282
+ /* @__PURE__ */ jsx26(
9283
+ DropdownMenu3.Trigger,
9438
9284
  {
9439
- css: {
9440
- width
9285
+ onClick: () => {
9286
+ if (disabled) return;
9287
+ setIsOpen(true);
9441
9288
  },
9442
- ref: (r) => {
9443
- if (!r) return;
9444
- triggerRef.current = r;
9445
- if (fowardedRef) {
9446
- if (typeof fowardedRef === "function") fowardedRef(r);
9447
- else {
9448
- fowardedRef.current = r;
9449
- }
9289
+ children: /* @__PURE__ */ jsxs14(
9290
+ StyledTrigger,
9291
+ {
9292
+ css: {
9293
+ width
9294
+ },
9295
+ ref: (r) => {
9296
+ if (!r) return;
9297
+ triggerRef.current = r;
9298
+ if (fowardedRef) {
9299
+ if (typeof fowardedRef === "function") fowardedRef(r);
9300
+ else {
9301
+ fowardedRef.current = r;
9302
+ }
9303
+ }
9304
+ },
9305
+ color,
9306
+ disabled,
9307
+ children: [
9308
+ /* @__PURE__ */ jsx26(
9309
+ Text,
9310
+ {
9311
+ typography: "labelMedium",
9312
+ css: {
9313
+ flex: 1,
9314
+ overflow: "hidden",
9315
+ whiteSpace: "nowrap",
9316
+ textOverflow: "ellipsis"
9317
+ },
9318
+ color: disabled ? "dark400" : void 0,
9319
+ children: text
9320
+ }
9321
+ ),
9322
+ /* @__PURE__ */ jsx26(
9323
+ FontAwesomeIcon3,
9324
+ {
9325
+ icon: isOpen ? faChevronUp2 : faChevronDown2,
9326
+ size: "sm",
9327
+ color: disabled ? colors.dark400 : colors.dark600
9328
+ }
9329
+ )
9330
+ ]
9450
9331
  }
9451
- },
9452
- color,
9453
- children: [
9454
- /* @__PURE__ */ jsx26(
9455
- Text,
9456
- {
9457
- typography: "labelMedium",
9458
- css: {
9459
- flex: 1,
9460
- overflow: "hidden",
9461
- whiteSpace: "nowrap",
9462
- textOverflow: "ellipsis"
9463
- },
9464
- children: text
9465
- }
9466
- ),
9467
- /* @__PURE__ */ jsx26(
9468
- FontAwesomeIcon3,
9469
- {
9470
- icon: isOpen ? faChevronUp2 : faChevronDown2,
9471
- size: "sm",
9472
- color: colors.dark600
9473
- }
9474
- )
9475
- ]
9332
+ )
9476
9333
  }
9477
- ) }),
9334
+ ),
9478
9335
  /* @__PURE__ */ jsx26(
9479
9336
  StyledContent,
9480
9337
  {
@@ -9495,30 +9352,42 @@ var MultiSelect = React9.forwardRef(
9495
9352
  }
9496
9353
  )
9497
9354
  ] }),
9498
- selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(BadgeWrapper, { children: selectedValues.map((value) => {
9499
- return /* @__PURE__ */ jsxs14(Flex2, { gap: 4, children: [
9500
- /* @__PURE__ */ jsx26(
9501
- BadgeCloseBtn,
9502
- {
9503
- onClick: (e) => {
9504
- e.stopPropagation();
9505
- handleRemove(value);
9506
- },
9507
- role: "button",
9508
- children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
9509
- }
9510
- ),
9511
- /* @__PURE__ */ jsx26(
9512
- Text,
9513
- {
9514
- typography: "captionMedium",
9515
- fontWeight: "regular",
9516
- color: "dark600",
9517
- children: labelByValue[value]
9518
- }
9519
- )
9520
- ] });
9521
- }) }) })
9355
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ jsx26(Fragment2, { children: /* @__PURE__ */ jsx26(
9356
+ Flex2,
9357
+ {
9358
+ direction: selectedOrientation,
9359
+ gap: 8,
9360
+ align: "center",
9361
+ justify: "start",
9362
+ css: {
9363
+ margin: "8px 0"
9364
+ },
9365
+ children: selectedValues.map((value) => {
9366
+ return /* @__PURE__ */ jsxs14(Flex2, { gap: 4, align: "center", css: { flexWrap: "wrap" }, children: [
9367
+ /* @__PURE__ */ jsx26(
9368
+ BadgeCloseBtn,
9369
+ {
9370
+ onClick: (e) => {
9371
+ e.stopPropagation();
9372
+ handleRemove(value);
9373
+ },
9374
+ role: "button",
9375
+ children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
9376
+ }
9377
+ ),
9378
+ /* @__PURE__ */ jsx26(
9379
+ Text,
9380
+ {
9381
+ typography: "captionMedium",
9382
+ fontWeight: "regular",
9383
+ color: "dark600",
9384
+ children: labelByValue[value]
9385
+ }
9386
+ )
9387
+ ] });
9388
+ })
9389
+ }
9390
+ ) })
9522
9391
  ] });
9523
9392
  }
9524
9393
  );
@@ -9761,12 +9630,16 @@ var TextAreaFormField = (_a) => {
9761
9630
  name,
9762
9631
  label,
9763
9632
  required,
9764
- placeholder
9633
+ placeholder,
9634
+ validate,
9635
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
9765
9636
  } = _b, props = __objRest(_b, [
9766
9637
  "name",
9767
9638
  "label",
9768
9639
  "required",
9769
- "placeholder"
9640
+ "placeholder",
9641
+ "validate",
9642
+ "validationErrorMessage"
9770
9643
  ]);
9771
9644
  var _a2;
9772
9645
  const {
@@ -9775,6 +9648,10 @@ var TextAreaFormField = (_a) => {
9775
9648
  } = useFormContext();
9776
9649
  const haveError = !!errors[name];
9777
9650
  const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
9651
+ const validationRules = {
9652
+ required: required ? validationErrorMessage : false,
9653
+ validate
9654
+ };
9778
9655
  return /* @__PURE__ */ jsxs17(Flex2, { direction: "column", children: [
9779
9656
  /* @__PURE__ */ jsx32(
9780
9657
  FormLabel,
@@ -9787,7 +9664,7 @@ var TextAreaFormField = (_a) => {
9787
9664
  ),
9788
9665
  /* @__PURE__ */ jsx32(
9789
9666
  TextareaField,
9790
- __spreadProps(__spreadValues(__spreadValues({}, props), register(name, { required })), {
9667
+ __spreadProps(__spreadValues(__spreadValues({}, props), register(name, validationRules)), {
9791
9668
  placeholder,
9792
9669
  color: haveError ? "error" : "default",
9793
9670
  "aria-labelledby": `${name}-label`
@@ -9915,11 +9792,15 @@ var MultiSelectFormField = (_a) => {
9915
9792
  var _b = _a, {
9916
9793
  name,
9917
9794
  label,
9918
- required
9795
+ required,
9796
+ selectedOrientation = "column",
9797
+ zIndex
9919
9798
  } = _b, rest = __objRest(_b, [
9920
9799
  "name",
9921
9800
  "label",
9922
- "required"
9801
+ "required",
9802
+ "selectedOrientation",
9803
+ "zIndex"
9923
9804
  ]);
9924
9805
  var _a2;
9925
9806
  const { field, fieldState } = useController2({
@@ -9951,7 +9832,9 @@ var MultiSelectFormField = (_a) => {
9951
9832
  value,
9952
9833
  onValueChange: handleChange,
9953
9834
  ref,
9954
- color: haveError ? "error" : "default"
9835
+ color: haveError ? "error" : "default",
9836
+ selectedOrientation,
9837
+ zIndex
9955
9838
  }, rest)
9956
9839
  ),
9957
9840
  /* @__PURE__ */ jsx35(ErrorFormMessage, { message: errorMsg })
@@ -10804,6 +10687,878 @@ var EmailFormField = ({
10804
10687
  }
10805
10688
  );
10806
10689
  };
10690
+
10691
+ // src/components/FormFields/RichEditorFormField.tsx
10692
+ import { useController as useController3 } from "react-hook-form";
10693
+
10694
+ // src/components/RichEditor/QuillComponent.tsx
10695
+ import { useState as useState8, useRef as useRef8, useEffect as useEffect5, useCallback as useCallback4 } from "react";
10696
+ import { useQuill } from "react-quilljs";
10697
+ import "quill/dist/quill.snow.css";
10698
+
10699
+ // src/utils/uploadService.ts
10700
+ var generateUniqueFilename = (originalName) => {
10701
+ const timestamp = Date.now().toString(36);
10702
+ const random = Math.random().toString(36).substring(2, 8);
10703
+ const extension = originalName.split(".").pop();
10704
+ return `${timestamp}_${random}.${extension}`;
10705
+ };
10706
+ var UploadService = class {
10707
+ static getPresignedUrl(filename, contentType, config2) {
10708
+ return __async(this, null, function* () {
10709
+ var _a;
10710
+ const apiUrl = config2.apiUrl;
10711
+ const presignedUrlEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.presignedUrl;
10712
+ const bucket = config2.s3Bucket;
10713
+ try {
10714
+ const response = yield fetch(`${apiUrl}${presignedUrlEndpoint}`, {
10715
+ method: "POST",
10716
+ headers: {
10717
+ "Content-Type": "application/json"
10718
+ },
10719
+ body: JSON.stringify({
10720
+ filename,
10721
+ contentType,
10722
+ bucket
10723
+ })
10724
+ });
10725
+ if (!response.ok) {
10726
+ throw new Error("Falha ao gerar URL de upload");
10727
+ }
10728
+ const data = yield response.json();
10729
+ return data.presignedUrl;
10730
+ } catch (error) {
10731
+ console.error("Erro ao gerar URL pr\xE9-assinada:", error);
10732
+ throw new Error("Falha ao gerar URL de upload");
10733
+ }
10734
+ });
10735
+ }
10736
+ static uploadToS3(file, config2, onProgress) {
10737
+ return __async(this, null, function* () {
10738
+ try {
10739
+ const uniqueFilename = generateUniqueFilename(file.name);
10740
+ const blob = new Blob([file], { type: file.type });
10741
+ const s3Url = `${config2.s3Url}/${uniqueFilename}`;
10742
+ return new Promise((resolve, reject) => {
10743
+ const xhr = new XMLHttpRequest();
10744
+ xhr.upload.addEventListener("progress", (event) => {
10745
+ if (event.lengthComputable) {
10746
+ const percentComplete = Math.round(
10747
+ event.loaded / event.total * 100
10748
+ );
10749
+ onProgress == null ? void 0 : onProgress({
10750
+ amount: percentComplete,
10751
+ message: `Fazendo upload... ${percentComplete}%`
10752
+ });
10753
+ }
10754
+ });
10755
+ xhr.addEventListener("load", () => {
10756
+ if (xhr.status === 200) {
10757
+ resolve({
10758
+ url: s3Url,
10759
+ filename: uniqueFilename,
10760
+ size: file.size,
10761
+ type: file.type
10762
+ });
10763
+ } else {
10764
+ reject(new Error(`Upload falhou com status: ${xhr.status}`));
10765
+ }
10766
+ });
10767
+ xhr.addEventListener("error", () => {
10768
+ reject(new Error("Erro de rede durante upload"));
10769
+ });
10770
+ xhr.open("PUT", s3Url);
10771
+ xhr.setRequestHeader("Content-Type", file.type);
10772
+ xhr.send(blob);
10773
+ });
10774
+ } catch (error) {
10775
+ console.error("Erro no upload:", error);
10776
+ throw error;
10777
+ }
10778
+ });
10779
+ }
10780
+ static uploadViaAPI(file, config2, onProgress) {
10781
+ return __async(this, null, function* () {
10782
+ try {
10783
+ const formData = new FormData();
10784
+ formData.append("file", file);
10785
+ const bucket = config2.s3Bucket;
10786
+ formData.append("bucket", bucket);
10787
+ const xhr = new XMLHttpRequest();
10788
+ return new Promise((resolve, reject) => {
10789
+ var _a;
10790
+ xhr.upload.addEventListener("progress", (event) => {
10791
+ if (event.lengthComputable) {
10792
+ const percentComplete = Math.round(
10793
+ event.loaded / event.total * 100
10794
+ );
10795
+ onProgress == null ? void 0 : onProgress({
10796
+ amount: percentComplete,
10797
+ message: `Fazendo upload... ${percentComplete}%`
10798
+ });
10799
+ }
10800
+ });
10801
+ xhr.addEventListener("load", () => {
10802
+ if (xhr.status === 200) {
10803
+ try {
10804
+ const response = JSON.parse(xhr.responseText);
10805
+ resolve({
10806
+ url: response.url,
10807
+ filename: response.filename,
10808
+ size: file.size,
10809
+ type: file.type
10810
+ });
10811
+ } catch (error) {
10812
+ reject(new Error("Resposta inv\xE1lida do servidor"));
10813
+ }
10814
+ } else {
10815
+ reject(new Error(`Upload falhou com status: ${xhr.status}`));
10816
+ }
10817
+ });
10818
+ xhr.addEventListener("error", () => {
10819
+ reject(new Error("Erro de rede durante upload"));
10820
+ });
10821
+ const apiUrl = config2.apiUrl;
10822
+ const uploadEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.upload;
10823
+ xhr.open("POST", `${apiUrl}${uploadEndpoint}`);
10824
+ xhr.send(formData);
10825
+ });
10826
+ } catch (error) {
10827
+ console.error("Erro no upload via API:", error);
10828
+ throw error;
10829
+ }
10830
+ });
10831
+ }
10832
+ };
10833
+
10834
+ // src/components/RichEditor/styledComponents.ts
10835
+ var QuillContainer = styled("div", {
10836
+ display: "flex",
10837
+ flexDirection: "column"
10838
+ });
10839
+ var QuillEditor = styled("div", {
10840
+ "& .ql-editor": {
10841
+ minHeight: "200px",
10842
+ padding: "$12",
10843
+ fontSize: "$14",
10844
+ lineHeight: "$base",
10845
+ fontFamily: "$default",
10846
+ color: "$neutral900",
10847
+ backgroundColor: "$white",
10848
+ border: "none",
10849
+ outline: "none",
10850
+ cursor: "text",
10851
+ caretColor: "$primary500",
10852
+ "&:focus": {
10853
+ borderColor: "$primary500",
10854
+ boxShadow: "0 0 0 1px $primary500"
10855
+ },
10856
+ "& p": {
10857
+ margin: "0 0 $8 0"
10858
+ },
10859
+ "& p:last-child": {
10860
+ marginBottom: 0
10861
+ },
10862
+ "& .ql-cursor": {
10863
+ borderLeft: "2px solid $primary500"
10864
+ }
10865
+ },
10866
+ "& .ql-toolbar": {
10867
+ backgroundColor: "$grey100",
10868
+ border: "1px solid $neutral300",
10869
+ borderBottom: "none",
10870
+ borderTopLeftRadius: "$sm",
10871
+ borderTopRightRadius: "$sm",
10872
+ padding: "$8 $12"
10873
+ },
10874
+ "& .ql-container": {
10875
+ border: "1px solid $neutral300",
10876
+ borderTop: "none",
10877
+ borderBottomLeftRadius: "$sm",
10878
+ borderBottomRightRadius: "$sm",
10879
+ fontFamily: "$default"
10880
+ },
10881
+ "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before": {
10882
+ content: "T\xEDtulo 1"
10883
+ },
10884
+ "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before": {
10885
+ content: "T\xEDtulo 2"
10886
+ }
10887
+ });
10888
+
10889
+ // src/components/RichEditor/QuillComponent.tsx
10890
+ import { jsx as jsx50, jsxs as jsxs25 } from "react/jsx-runtime";
10891
+ var QuillComponent = ({
10892
+ value = "",
10893
+ onChange,
10894
+ placeholder = "Digite seu texto aqui...",
10895
+ disabled = false,
10896
+ className,
10897
+ uploadConfig
10898
+ }) => {
10899
+ const [showVideoModal, setShowVideoModal] = useState8(false);
10900
+ const [videoUrl, setVideoUrl] = useState8("");
10901
+ const [showLinkModal, setShowLinkModal] = useState8(false);
10902
+ const [linkUrl, setLinkUrl] = useState8("");
10903
+ const videoModalRef = useRef8(null);
10904
+ const linkModalRef = useRef8(null);
10905
+ const { addToast, removeToast } = useToast();
10906
+ const modules = {
10907
+ toolbar: [
10908
+ [{ header: [1, 2, false] }],
10909
+ ["bold", "italic", "underline", "strike"],
10910
+ [{ color: [] }, { background: [] }],
10911
+ [{ align: [] }],
10912
+ [{ list: "ordered" }, { list: "bullet" }],
10913
+ ["link", "image", "video"]
10914
+ ],
10915
+ clipboard: {
10916
+ matchVisual: false
10917
+ }
10918
+ };
10919
+ const formats = [
10920
+ "header",
10921
+ "bold",
10922
+ "italic",
10923
+ "underline",
10924
+ "strike",
10925
+ "color",
10926
+ "background",
10927
+ "align",
10928
+ "list",
10929
+ "link",
10930
+ "image",
10931
+ "video"
10932
+ ];
10933
+ const { quill, quillRef } = useQuill({
10934
+ theme: "snow",
10935
+ modules,
10936
+ formats,
10937
+ placeholder,
10938
+ readOnly: disabled
10939
+ });
10940
+ const handleImageUpload = useCallback4(
10941
+ (file) => __async(null, null, function* () {
10942
+ if (disabled || !quill || !uploadConfig) return;
10943
+ try {
10944
+ addToast({
10945
+ type: "info",
10946
+ message: "Carregando imagem...",
10947
+ duration: 2e3
10948
+ });
10949
+ const uploadedFile = yield UploadService.uploadToS3(file, uploadConfig);
10950
+ removeToast("info");
10951
+ addToast({
10952
+ type: "success",
10953
+ message: "Imagem adicionada com sucesso!"
10954
+ });
10955
+ const selection = quill.getSelection();
10956
+ const index = selection ? selection.index : quill.getLength();
10957
+ quill.insertEmbed(index, "image", uploadedFile.url);
10958
+ quill.setSelection(index + 1, 0);
10959
+ } catch (error) {
10960
+ console.error("Erro no upload:", error);
10961
+ addToast({
10962
+ type: "error",
10963
+ message: "Erro no upload: N\xE3o foi poss\xEDvel enviar a imagem. Tente novamente."
10964
+ });
10965
+ }
10966
+ }),
10967
+ [disabled, quill, addToast, removeToast, uploadConfig]
10968
+ );
10969
+ useEffect5(() => {
10970
+ if (quill && value) {
10971
+ const currentContent = quill.root.innerHTML;
10972
+ if (currentContent !== value) {
10973
+ const selection = quill.getSelection();
10974
+ quill.clipboard.dangerouslyPasteHTML(value);
10975
+ if (selection) {
10976
+ quill.setSelection(selection.index, selection.length);
10977
+ } else {
10978
+ quill.setSelection(quill.getLength(), 0);
10979
+ }
10980
+ }
10981
+ }
10982
+ }, [quill, value]);
10983
+ useEffect5(() => {
10984
+ if (quill) {
10985
+ quill.on("text-change", (delta, oldDelta, source) => {
10986
+ if (source === "user") {
10987
+ const html = quill.root.innerHTML;
10988
+ onChange == null ? void 0 : onChange(html);
10989
+ }
10990
+ });
10991
+ const toolbar = quill.getModule("toolbar");
10992
+ if (toolbar) {
10993
+ toolbar.addHandler("link", () => setShowLinkModal(true));
10994
+ toolbar.addHandler("video", () => setShowVideoModal(true));
10995
+ toolbar.addHandler("image", () => {
10996
+ const input = document.createElement("input");
10997
+ input.setAttribute("type", "file");
10998
+ input.setAttribute("accept", "image/*");
10999
+ input.click();
11000
+ input.onchange = () => __async(null, null, function* () {
11001
+ var _a;
11002
+ const file = (_a = input.files) == null ? void 0 : _a[0];
11003
+ if (file) {
11004
+ yield handleImageUpload(file);
11005
+ }
11006
+ });
11007
+ });
11008
+ }
11009
+ setTimeout(() => {
11010
+ var _a, _b;
11011
+ const toolbarElement = (_b = (_a = quillRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.querySelector(".ql-toolbar");
11012
+ if (toolbarElement) {
11013
+ const headerSelect = toolbarElement.querySelector(
11014
+ "select[data-value]"
11015
+ );
11016
+ console.log(headerSelect, "headerSelect");
11017
+ if (headerSelect) {
11018
+ const options = headerSelect.querySelectorAll("option");
11019
+ console.log(options, "options");
11020
+ options.forEach((option) => {
11021
+ if (option.value === "1") {
11022
+ option.textContent = "T\xEDtulo 1";
11023
+ } else if (option.value === "2") {
11024
+ option.textContent = "T\xEDtulo 2";
11025
+ } else if (option.value === "") {
11026
+ option.textContent = "Normal";
11027
+ }
11028
+ });
11029
+ }
11030
+ }
11031
+ }, 100);
11032
+ }
11033
+ }, [quill, onChange, handleImageUpload]);
11034
+ useEffect5(() => {
11035
+ if (quill) {
11036
+ quill.enable(!disabled);
11037
+ if (!disabled) {
11038
+ if (quill.getLength() <= 1) {
11039
+ quill.focus();
11040
+ quill.setSelection(0, 0);
11041
+ }
11042
+ }
11043
+ }
11044
+ }, [quill, disabled]);
11045
+ const handleLinkCancel = useCallback4(() => {
11046
+ setLinkUrl("");
11047
+ setShowLinkModal(false);
11048
+ }, []);
11049
+ const handleLinkSubmit = useCallback4(() => {
11050
+ if (!linkUrl.trim() || !quill) return;
11051
+ const url = linkUrl.trim();
11052
+ const selection = quill.getSelection();
11053
+ if (selection && selection.length > 0) {
11054
+ quill.format("link", url);
11055
+ } else {
11056
+ const index = quill.getLength();
11057
+ quill.insertText(index, url, "link", url);
11058
+ quill.setSelection(index + url.length, 0);
11059
+ }
11060
+ setLinkUrl("");
11061
+ setShowLinkModal(false);
11062
+ }, [linkUrl, quill]);
11063
+ const handleVideoCancel = useCallback4(() => {
11064
+ setVideoUrl("");
11065
+ setShowVideoModal(false);
11066
+ }, []);
11067
+ const handleVideoSubmit = useCallback4(() => {
11068
+ var _a, _b;
11069
+ if (!videoUrl.trim() || !quill) return;
11070
+ let processedUrl = videoUrl.trim();
11071
+ if (processedUrl.includes("youtube.com/watch")) {
11072
+ const videoId = (_a = processedUrl.match(/[?&]v=([^&]+)/)) == null ? void 0 : _a[1];
11073
+ if (videoId) {
11074
+ processedUrl = `https://www.youtube.com/embed/${videoId}`;
11075
+ }
11076
+ } else if (processedUrl.includes("youtu.be/")) {
11077
+ const videoId = (_b = processedUrl.split("youtu.be/")[1]) == null ? void 0 : _b.split("?")[0];
11078
+ if (videoId) {
11079
+ processedUrl = `https://www.youtube.com/embed/${videoId}`;
11080
+ }
11081
+ }
11082
+ const videoHTML = `
11083
+ <iframe
11084
+ src="${processedUrl}"
11085
+ style="max-width:100%; height:315px; border:0;"
11086
+ title="Video player"
11087
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
11088
+ allowfullscreen>
11089
+ </iframe>
11090
+ <br/>
11091
+ `;
11092
+ const selection = quill.getSelection();
11093
+ const insertIndex = selection ? selection.index : quill.getLength();
11094
+ quill.clipboard.dangerouslyPasteHTML(insertIndex, videoHTML);
11095
+ quill.setSelection(insertIndex + 1, 0);
11096
+ setVideoUrl("");
11097
+ setShowVideoModal(false);
11098
+ }, [videoUrl, quill]);
11099
+ useEffect5(() => {
11100
+ const handleClickOutside = (event) => {
11101
+ if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
11102
+ handleVideoCancel();
11103
+ }
11104
+ if (showLinkModal && linkModalRef.current && !linkModalRef.current.contains(event.target)) {
11105
+ handleLinkCancel();
11106
+ }
11107
+ };
11108
+ document.addEventListener("mousedown", handleClickOutside);
11109
+ return () => document.removeEventListener("mousedown", handleClickOutside);
11110
+ }, [showVideoModal, showLinkModal, handleVideoCancel, handleLinkCancel]);
11111
+ return /* @__PURE__ */ jsx50(QuillContainer, { className, children: /* @__PURE__ */ jsxs25(QuillEditor, { style: { position: "relative" }, children: [
11112
+ /* @__PURE__ */ jsx50("div", { ref: quillRef }),
11113
+ showVideoModal && /* @__PURE__ */ jsx50(
11114
+ "div",
11115
+ {
11116
+ ref: videoModalRef,
11117
+ style: {
11118
+ position: "absolute",
11119
+ top: "20px",
11120
+ left: "20px",
11121
+ right: "20px",
11122
+ backgroundColor: "white",
11123
+ border: "1px solid #e0e0e0",
11124
+ borderRadius: "4px",
11125
+ padding: "12px",
11126
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
11127
+ zIndex: 1e3,
11128
+ width: "fit-content"
11129
+ },
11130
+ children: /* @__PURE__ */ jsxs25(Flex2, { gap: 8, align: "center", children: [
11131
+ /* @__PURE__ */ jsx50(
11132
+ Text,
11133
+ {
11134
+ style: { fontSize: "14px", fontWeight: "500", color: "#333" },
11135
+ children: "V\xEDdeo:"
11136
+ }
11137
+ ),
11138
+ /* @__PURE__ */ jsx50(
11139
+ "input",
11140
+ {
11141
+ type: "text",
11142
+ value: videoUrl,
11143
+ onChange: (e) => setVideoUrl(e.target.value),
11144
+ placeholder: "Embed URL",
11145
+ style: {
11146
+ padding: "8px 12px",
11147
+ border: "1px solid #d0d0d0",
11148
+ borderRadius: "4px",
11149
+ fontSize: "14px",
11150
+ backgroundColor: "#f8f8f8"
11151
+ },
11152
+ onKeyDown: (e) => {
11153
+ if (e.key === "Enter") {
11154
+ handleVideoSubmit();
11155
+ } else if (e.key === "Escape") {
11156
+ handleVideoCancel();
11157
+ }
11158
+ },
11159
+ autoFocus: true
11160
+ }
11161
+ ),
11162
+ /* @__PURE__ */ jsx50(
11163
+ "button",
11164
+ {
11165
+ onClick: handleVideoSubmit,
11166
+ disabled: !videoUrl.trim(),
11167
+ style: {
11168
+ padding: "8px 16px",
11169
+ backgroundColor: "#007bff",
11170
+ color: "white",
11171
+ border: "none",
11172
+ borderRadius: "4px",
11173
+ fontSize: "14px",
11174
+ cursor: videoUrl.trim() ? "pointer" : "not-allowed",
11175
+ opacity: videoUrl.trim() ? 1 : 0.6
11176
+ },
11177
+ children: "Ok"
11178
+ }
11179
+ )
11180
+ ] })
11181
+ }
11182
+ ),
11183
+ showLinkModal && /* @__PURE__ */ jsx50(
11184
+ "div",
11185
+ {
11186
+ ref: linkModalRef,
11187
+ style: {
11188
+ position: "absolute",
11189
+ top: "20px",
11190
+ left: "20px",
11191
+ right: "20px",
11192
+ backgroundColor: "white",
11193
+ border: "1px solid #e0e0e0",
11194
+ borderRadius: "4px",
11195
+ padding: "12px",
11196
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
11197
+ zIndex: 1e3,
11198
+ width: "fit-content"
11199
+ },
11200
+ children: /* @__PURE__ */ jsxs25(Flex2, { gap: 8, align: "center", children: [
11201
+ /* @__PURE__ */ jsx50(
11202
+ Text,
11203
+ {
11204
+ style: { fontSize: "14px", fontWeight: "500", color: "#333" },
11205
+ children: "Link:"
11206
+ }
11207
+ ),
11208
+ /* @__PURE__ */ jsx50(
11209
+ "input",
11210
+ {
11211
+ type: "text",
11212
+ value: linkUrl,
11213
+ onChange: (e) => setLinkUrl(e.target.value),
11214
+ placeholder: "URL do link",
11215
+ style: {
11216
+ padding: "8px 12px",
11217
+ border: "1px solid #d0d0d0",
11218
+ borderRadius: "4px",
11219
+ fontSize: "14px",
11220
+ backgroundColor: "#f8f8f8",
11221
+ width: "300px"
11222
+ },
11223
+ onKeyDown: (e) => {
11224
+ if (e.key === "Enter") {
11225
+ handleLinkSubmit();
11226
+ } else if (e.key === "Escape") {
11227
+ handleLinkCancel();
11228
+ }
11229
+ },
11230
+ autoFocus: true
11231
+ }
11232
+ ),
11233
+ /* @__PURE__ */ jsx50(
11234
+ "button",
11235
+ {
11236
+ onClick: handleLinkSubmit,
11237
+ disabled: !linkUrl.trim(),
11238
+ style: {
11239
+ padding: "8px 16px",
11240
+ backgroundColor: "#007bff",
11241
+ color: "white",
11242
+ border: "none",
11243
+ borderRadius: "4px",
11244
+ fontSize: "14px",
11245
+ cursor: linkUrl.trim() ? "pointer" : "not-allowed",
11246
+ opacity: linkUrl.trim() ? 1 : 0.6
11247
+ },
11248
+ children: "Ok"
11249
+ }
11250
+ )
11251
+ ] })
11252
+ }
11253
+ )
11254
+ ] }) });
11255
+ };
11256
+ var QuillComponent_default = QuillComponent;
11257
+
11258
+ // src/components/RichEditor/RichEditor.tsx
11259
+ import { jsx as jsx51 } from "react/jsx-runtime";
11260
+ var RichEditor = (props) => {
11261
+ return /* @__PURE__ */ jsx51("div", { children: /* @__PURE__ */ jsx51(ToastProvider, { children: /* @__PURE__ */ jsx51(QuillComponent_default, __spreadValues({}, props)) }) });
11262
+ };
11263
+ var RichEditor_default = RichEditor;
11264
+
11265
+ // src/components/FormFields/RichEditorFormField.tsx
11266
+ import { jsx as jsx52, jsxs as jsxs26 } from "react/jsx-runtime";
11267
+ var RichEditorFormField = (_a) => {
11268
+ var _b = _a, {
11269
+ name,
11270
+ label,
11271
+ required,
11272
+ validate,
11273
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
11274
+ } = _b, props = __objRest(_b, [
11275
+ "name",
11276
+ "label",
11277
+ "required",
11278
+ "validate",
11279
+ "validationErrorMessage"
11280
+ ]);
11281
+ const { field, fieldState } = useController3({
11282
+ name,
11283
+ rules: {
11284
+ required: required ? validationErrorMessage : false,
11285
+ validate: (value) => {
11286
+ var _a2;
11287
+ if (value === void 0 || value === null || !required && value.trim() === "")
11288
+ return true;
11289
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11290
+ }
11291
+ },
11292
+ defaultValue: ""
11293
+ });
11294
+ const fieldError = fieldState.error;
11295
+ const haveError = !!fieldError;
11296
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11297
+ return /* @__PURE__ */ jsxs26(Flex2, { direction: "column", children: [
11298
+ label && /* @__PURE__ */ jsx52(
11299
+ FormLabel,
11300
+ {
11301
+ name,
11302
+ label,
11303
+ required,
11304
+ haveError
11305
+ }
11306
+ ),
11307
+ /* @__PURE__ */ jsx52(
11308
+ RichEditor_default,
11309
+ __spreadProps(__spreadValues({}, props), {
11310
+ value: field.value,
11311
+ onChange: field.onChange,
11312
+ "aria-labelledby": `${name}-label`
11313
+ })
11314
+ ),
11315
+ /* @__PURE__ */ jsx52(ErrorFormMessage, { message: errorMsg })
11316
+ ] });
11317
+ };
11318
+
11319
+ // src/components/FormFields/CalendarFormField.tsx
11320
+ import { useController as useController4 } from "react-hook-form";
11321
+ import { useCallback as useCallback5 } from "react";
11322
+ import { jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
11323
+ var CalendarFormField = (_a) => {
11324
+ var _b = _a, {
11325
+ name,
11326
+ label,
11327
+ required,
11328
+ validate,
11329
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11330
+ rules,
11331
+ onChange
11332
+ } = _b, calendarProps = __objRest(_b, [
11333
+ "name",
11334
+ "label",
11335
+ "required",
11336
+ "validate",
11337
+ "validationErrorMessage",
11338
+ "rules",
11339
+ "onChange"
11340
+ ]);
11341
+ const handleValidate = useCallback5(
11342
+ (value) => {
11343
+ var _a2;
11344
+ if (value === void 0 || value === null) {
11345
+ if (required) return validationErrorMessage;
11346
+ return true;
11347
+ }
11348
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11349
+ },
11350
+ [validate, required, validationErrorMessage]
11351
+ );
11352
+ const { field, fieldState } = useController4({
11353
+ name,
11354
+ rules: __spreadValues({
11355
+ required: required ? validationErrorMessage : false,
11356
+ validate: handleValidate
11357
+ }, rules),
11358
+ defaultValue: void 0
11359
+ });
11360
+ const fieldError = fieldState.error;
11361
+ const haveError = !!fieldError;
11362
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11363
+ const { value: selected, onChange: setSelected } = field;
11364
+ const handleCalendarChange = (date) => {
11365
+ setSelected(date);
11366
+ };
11367
+ return /* @__PURE__ */ jsxs27(Flex2, { direction: "column", children: [
11368
+ label && /* @__PURE__ */ jsx53(
11369
+ FormLabel,
11370
+ {
11371
+ name,
11372
+ label,
11373
+ required,
11374
+ haveError
11375
+ }
11376
+ ),
11377
+ /* @__PURE__ */ jsx53(
11378
+ Calendar,
11379
+ __spreadValues({
11380
+ selected,
11381
+ setSelected: (value) => {
11382
+ const date = typeof value === "function" ? value(selected) : value;
11383
+ handleCalendarChange(date);
11384
+ },
11385
+ hasError: haveError
11386
+ }, calendarProps)
11387
+ ),
11388
+ /* @__PURE__ */ jsx53(ErrorFormMessage, { message: errorMsg })
11389
+ ] });
11390
+ };
11391
+
11392
+ // src/components/FormFields/TimePickerFormField.tsx
11393
+ import { useController as useController5 } from "react-hook-form";
11394
+ import { useCallback as useCallback6 } from "react";
11395
+ import { jsx as jsx54, jsxs as jsxs28 } from "react/jsx-runtime";
11396
+ var TimePickerFormField = (_a) => {
11397
+ var _b = _a, {
11398
+ name,
11399
+ label,
11400
+ required,
11401
+ validate,
11402
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11403
+ rules
11404
+ } = _b, timePickerProps = __objRest(_b, [
11405
+ "name",
11406
+ "label",
11407
+ "required",
11408
+ "validate",
11409
+ "validationErrorMessage",
11410
+ "rules"
11411
+ ]);
11412
+ const handleValidate = useCallback6(
11413
+ (value) => {
11414
+ var _a2;
11415
+ if (value === void 0 || value === null || value === "") {
11416
+ if (required) return validationErrorMessage;
11417
+ return true;
11418
+ }
11419
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11420
+ },
11421
+ [validate, required, validationErrorMessage]
11422
+ );
11423
+ const { field, fieldState } = useController5({
11424
+ name,
11425
+ rules: __spreadValues({
11426
+ required: required ? validationErrorMessage : false,
11427
+ validate: handleValidate
11428
+ }, rules),
11429
+ defaultValue: void 0
11430
+ });
11431
+ const fieldError = fieldState.error;
11432
+ const haveError = !!fieldError;
11433
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11434
+ const { value: selected, onChange: setSelected } = field;
11435
+ const handleTimePickerChange = (time) => {
11436
+ setSelected(time);
11437
+ };
11438
+ return /* @__PURE__ */ jsxs28(Flex2, { direction: "column", children: [
11439
+ label && /* @__PURE__ */ jsx54(
11440
+ FormLabel,
11441
+ {
11442
+ name,
11443
+ label,
11444
+ required,
11445
+ haveError
11446
+ }
11447
+ ),
11448
+ /* @__PURE__ */ jsx54(
11449
+ TimePicker,
11450
+ __spreadValues({
11451
+ selected,
11452
+ setSelected: (value) => {
11453
+ const time = typeof value === "function" ? value(selected) : value;
11454
+ handleTimePickerChange(time);
11455
+ },
11456
+ hasError: haveError
11457
+ }, timePickerProps)
11458
+ ),
11459
+ /* @__PURE__ */ jsx54(ErrorFormMessage, { message: errorMsg })
11460
+ ] });
11461
+ };
11462
+
11463
+ // src/hooks/useImageUpload.ts
11464
+ import { useState as useState9, useCallback as useCallback7 } from "react";
11465
+ var useImageUpload = (options) => {
11466
+ const [isUploading, setIsUploading] = useState9(false);
11467
+ const [progress, setProgress] = useState9(null);
11468
+ const [error, setError] = useState9(null);
11469
+ const {
11470
+ onSuccess,
11471
+ onError,
11472
+ onProgress,
11473
+ maxFileSize = 5 * 1024 * 1024,
11474
+ // 5MB default
11475
+ allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
11476
+ uploadConfig
11477
+ } = options;
11478
+ const validateFile = useCallback7(
11479
+ (file) => {
11480
+ if (!allowedTypes.includes(file.type)) {
11481
+ const errorMsg = "Tipo de arquivo n\xE3o suportado";
11482
+ setError(errorMsg);
11483
+ onError == null ? void 0 : onError(errorMsg);
11484
+ return false;
11485
+ }
11486
+ if (file.size > maxFileSize) {
11487
+ const errorMsg = `Arquivo muito grande. M\xE1ximo: ${(maxFileSize / 1024 / 1024).toFixed(1)}MB`;
11488
+ setError(errorMsg);
11489
+ onError == null ? void 0 : onError(errorMsg);
11490
+ return false;
11491
+ }
11492
+ return true;
11493
+ },
11494
+ [allowedTypes, maxFileSize, onError]
11495
+ );
11496
+ const uploadFile = useCallback7(
11497
+ (file) => __async(null, null, function* () {
11498
+ if (!validateFile(file)) {
11499
+ return null;
11500
+ }
11501
+ setIsUploading(true);
11502
+ setError(null);
11503
+ setProgress(null);
11504
+ try {
11505
+ const uploadedFile = yield UploadService.uploadToS3(
11506
+ file,
11507
+ uploadConfig,
11508
+ (progress2) => {
11509
+ setProgress(progress2);
11510
+ onProgress == null ? void 0 : onProgress(progress2);
11511
+ }
11512
+ );
11513
+ setIsUploading(false);
11514
+ setProgress(null);
11515
+ onSuccess == null ? void 0 : onSuccess(uploadedFile);
11516
+ return uploadedFile;
11517
+ } catch (error2) {
11518
+ console.error("Erro no upload S3:", error2);
11519
+ try {
11520
+ setProgress({
11521
+ amount: 0,
11522
+ message: "Tentando m\xE9todo alternativo..."
11523
+ });
11524
+ const uploadedFile = yield UploadService.uploadViaAPI(
11525
+ file,
11526
+ uploadConfig,
11527
+ (progress2) => {
11528
+ setProgress(progress2);
11529
+ onProgress == null ? void 0 : onProgress(progress2);
11530
+ }
11531
+ );
11532
+ setIsUploading(false);
11533
+ setProgress(null);
11534
+ onSuccess == null ? void 0 : onSuccess(uploadedFile);
11535
+ return uploadedFile;
11536
+ } catch (fallbackError) {
11537
+ console.error("Erro no fallback:", fallbackError);
11538
+ const errorMsg = "Falha no upload da imagem. Tente novamente.";
11539
+ setError(errorMsg);
11540
+ setIsUploading(false);
11541
+ setProgress(null);
11542
+ onError == null ? void 0 : onError(errorMsg);
11543
+ return null;
11544
+ }
11545
+ }
11546
+ }),
11547
+ [validateFile, onSuccess, onError, onProgress]
11548
+ );
11549
+ const reset = useCallback7(() => {
11550
+ setIsUploading(false);
11551
+ setProgress(null);
11552
+ setError(null);
11553
+ }, []);
11554
+ return {
11555
+ uploadFile,
11556
+ isUploading,
11557
+ progress,
11558
+ error,
11559
+ reset
11560
+ };
11561
+ };
10807
11562
  export {
10808
11563
  AddressFormFields,
10809
11564
  Alert,
@@ -10828,6 +11583,7 @@ export {
10828
11583
  CNPJFormField,
10829
11584
  CPFFormField,
10830
11585
  Calendar,
11586
+ CalendarFormField,
10831
11587
  Card,
10832
11588
  CardStyled,
10833
11589
  CheckboxGroup,
@@ -10862,6 +11618,8 @@ export {
10862
11618
  RadioGroupFormField,
10863
11619
  RadioGroupStyled,
10864
11620
  RadioItem,
11621
+ RichEditor_default as RichEditor,
11622
+ RichEditorFormField,
10865
11623
  Section,
10866
11624
  SectionStyled,
10867
11625
  SelectFormField,
@@ -10887,6 +11645,7 @@ export {
10887
11645
  TimePickerButtonStyled,
10888
11646
  TimePickerDropdownStyled,
10889
11647
  TimePickerFooterStyled,
11648
+ TimePickerFormField,
10890
11649
  TimePickerStyled,
10891
11650
  TimerPickerContentStyled,
10892
11651
  ToastItem,
@@ -10896,23 +11655,15 @@ export {
10896
11655
  TooltipProvider,
10897
11656
  TooltipRoot,
10898
11657
  TooltipTrigger,
11658
+ UploadService,
10899
11659
  isValidCNPJ,
10900
11660
  maskFormat,
10901
11661
  maskUnformat,
11662
+ useImageUpload,
10902
11663
  useToast
10903
11664
  };
10904
11665
  /*! Bundled license information:
10905
11666
 
10906
- react-is/cjs/react-is.production.min.js:
10907
- (** @license React v16.13.1
10908
- * react-is.production.min.js
10909
- *
10910
- * Copyright (c) Facebook, Inc. and its affiliates.
10911
- *
10912
- * This source code is licensed under the MIT license found in the
10913
- * LICENSE file in the root directory of this source tree.
10914
- *)
10915
-
10916
11667
  react-is/cjs/react-is.development.js:
10917
11668
  (** @license React v16.13.1
10918
11669
  * react-is.development.js