@lets-events/react 11.8.1 → 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 +6 -0
  4. package/dist/index.d.mts +122 -6
  5. package/dist/index.d.ts +122 -6
  6. package/dist/index.js +976 -237
  7. package/dist/index.mjs +970 -237
  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 -267
  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.js CHANGED
@@ -80,124 +80,11 @@ var __async = (__this, __arguments, generator) => {
80
80
  });
81
81
  };
82
82
 
83
- // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js
84
- var require_react_is_production_min = __commonJS({
85
- "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js"(exports2) {
86
- "use strict";
87
- var b = "function" === typeof Symbol && Symbol.for;
88
- var c = b ? Symbol.for("react.element") : 60103;
89
- var d = b ? Symbol.for("react.portal") : 60106;
90
- var e = b ? Symbol.for("react.fragment") : 60107;
91
- var f = b ? Symbol.for("react.strict_mode") : 60108;
92
- var g = b ? Symbol.for("react.profiler") : 60114;
93
- var h = b ? Symbol.for("react.provider") : 60109;
94
- var k = b ? Symbol.for("react.context") : 60110;
95
- var l = b ? Symbol.for("react.async_mode") : 60111;
96
- var m = b ? Symbol.for("react.concurrent_mode") : 60111;
97
- var n = b ? Symbol.for("react.forward_ref") : 60112;
98
- var p = b ? Symbol.for("react.suspense") : 60113;
99
- var q = b ? Symbol.for("react.suspense_list") : 60120;
100
- var r = b ? Symbol.for("react.memo") : 60115;
101
- var t = b ? Symbol.for("react.lazy") : 60116;
102
- var v = b ? Symbol.for("react.block") : 60121;
103
- var w = b ? Symbol.for("react.fundamental") : 60117;
104
- var x = b ? Symbol.for("react.responder") : 60118;
105
- var y = b ? Symbol.for("react.scope") : 60119;
106
- function z(a) {
107
- if ("object" === typeof a && null !== a) {
108
- var u = a.$$typeof;
109
- switch (u) {
110
- case c:
111
- switch (a = a.type, a) {
112
- case l:
113
- case m:
114
- case e:
115
- case g:
116
- case f:
117
- case p:
118
- return a;
119
- default:
120
- switch (a = a && a.$$typeof, a) {
121
- case k:
122
- case n:
123
- case t:
124
- case r:
125
- case h:
126
- return a;
127
- default:
128
- return u;
129
- }
130
- }
131
- case d:
132
- return u;
133
- }
134
- }
135
- }
136
- function A(a) {
137
- return z(a) === m;
138
- }
139
- exports2.AsyncMode = l;
140
- exports2.ConcurrentMode = m;
141
- exports2.ContextConsumer = k;
142
- exports2.ContextProvider = h;
143
- exports2.Element = c;
144
- exports2.ForwardRef = n;
145
- exports2.Fragment = e;
146
- exports2.Lazy = t;
147
- exports2.Memo = r;
148
- exports2.Portal = d;
149
- exports2.Profiler = g;
150
- exports2.StrictMode = f;
151
- exports2.Suspense = p;
152
- exports2.isAsyncMode = function(a) {
153
- return A(a) || z(a) === l;
154
- };
155
- exports2.isConcurrentMode = A;
156
- exports2.isContextConsumer = function(a) {
157
- return z(a) === k;
158
- };
159
- exports2.isContextProvider = function(a) {
160
- return z(a) === h;
161
- };
162
- exports2.isElement = function(a) {
163
- return "object" === typeof a && null !== a && a.$$typeof === c;
164
- };
165
- exports2.isForwardRef = function(a) {
166
- return z(a) === n;
167
- };
168
- exports2.isFragment = function(a) {
169
- return z(a) === e;
170
- };
171
- exports2.isLazy = function(a) {
172
- return z(a) === t;
173
- };
174
- exports2.isMemo = function(a) {
175
- return z(a) === r;
176
- };
177
- exports2.isPortal = function(a) {
178
- return z(a) === d;
179
- };
180
- exports2.isProfiler = function(a) {
181
- return z(a) === g;
182
- };
183
- exports2.isStrictMode = function(a) {
184
- return z(a) === f;
185
- };
186
- exports2.isSuspense = function(a) {
187
- return z(a) === p;
188
- };
189
- exports2.isValidElementType = function(a) {
190
- 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);
191
- };
192
- exports2.typeOf = z;
193
- }
194
- });
195
-
196
83
  // ../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
197
84
  var require_react_is_development = __commonJS({
198
85
  "../../node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"(exports2) {
199
86
  "use strict";
200
- if (process.env.NODE_ENV !== "production") {
87
+ if (true) {
201
88
  (function() {
202
89
  "use strict";
203
90
  var hasSymbol = typeof Symbol === "function" && Symbol.for;
@@ -352,8 +239,8 @@ var require_react_is_development = __commonJS({
352
239
  var require_react_is = __commonJS({
353
240
  "../../node_modules/prop-types/node_modules/react-is/index.js"(exports2, module2) {
354
241
  "use strict";
355
- if (process.env.NODE_ENV === "production") {
356
- module2.exports = require_react_is_production_min();
242
+ if (false) {
243
+ module2.exports = null;
357
244
  } else {
358
245
  module2.exports = require_react_is_development();
359
246
  }
@@ -453,7 +340,7 @@ var require_checkPropTypes = __commonJS({
453
340
  "use strict";
454
341
  var printWarning = function() {
455
342
  };
456
- if (process.env.NODE_ENV !== "production") {
343
+ if (true) {
457
344
  ReactPropTypesSecret = require_ReactPropTypesSecret();
458
345
  loggedTypeFailures = {};
459
346
  has = require_has();
@@ -472,7 +359,7 @@ var require_checkPropTypes = __commonJS({
472
359
  var loggedTypeFailures;
473
360
  var has;
474
361
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
475
- if (process.env.NODE_ENV !== "production") {
362
+ if (true) {
476
363
  for (var typeSpecName in typeSpecs) {
477
364
  if (has(typeSpecs, typeSpecName)) {
478
365
  var error;
@@ -505,7 +392,7 @@ var require_checkPropTypes = __commonJS({
505
392
  }
506
393
  }
507
394
  checkPropTypes.resetWarningCache = function() {
508
- if (process.env.NODE_ENV !== "production") {
395
+ if (true) {
509
396
  loggedTypeFailures = {};
510
397
  }
511
398
  };
@@ -524,7 +411,7 @@ var require_factoryWithTypeCheckers = __commonJS({
524
411
  var checkPropTypes = require_checkPropTypes();
525
412
  var printWarning = function() {
526
413
  };
527
- if (process.env.NODE_ENV !== "production") {
414
+ if (true) {
528
415
  printWarning = function(text) {
529
416
  var message2 = "Warning: " + text;
530
417
  if (typeof console !== "undefined") {
@@ -584,7 +471,7 @@ var require_factoryWithTypeCheckers = __commonJS({
584
471
  }
585
472
  PropTypeError.prototype = Error.prototype;
586
473
  function createChainableTypeChecker(validate) {
587
- if (process.env.NODE_ENV !== "production") {
474
+ if (true) {
588
475
  var manualPropTypeCallCache = {};
589
476
  var manualPropTypeWarningCount = 0;
590
477
  }
@@ -598,7 +485,7 @@ var require_factoryWithTypeCheckers = __commonJS({
598
485
  );
599
486
  err.name = "Invariant Violation";
600
487
  throw err;
601
- } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
488
+ } else if (typeof console !== "undefined") {
602
489
  var cacheKey = componentName + ":" + propName;
603
490
  if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
604
491
  manualPropTypeWarningCount < 3) {
@@ -699,7 +586,7 @@ var require_factoryWithTypeCheckers = __commonJS({
699
586
  }
700
587
  function createEnumTypeChecker(expectedValues) {
701
588
  if (!Array.isArray(expectedValues)) {
702
- if (process.env.NODE_ENV !== "production") {
589
+ if (true) {
703
590
  if (arguments.length > 1) {
704
591
  printWarning(
705
592
  "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])."
@@ -752,7 +639,7 @@ var require_factoryWithTypeCheckers = __commonJS({
752
639
  }
753
640
  function createUnionTypeChecker(arrayOfTypeCheckers) {
754
641
  if (!Array.isArray(arrayOfTypeCheckers)) {
755
- process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
642
+ true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
756
643
  return emptyFunctionThatReturnsNull;
757
644
  }
758
645
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
@@ -956,72 +843,16 @@ var require_factoryWithTypeCheckers = __commonJS({
956
843
  }
957
844
  });
958
845
 
959
- // ../../node_modules/prop-types/factoryWithThrowingShims.js
960
- var require_factoryWithThrowingShims = __commonJS({
961
- "../../node_modules/prop-types/factoryWithThrowingShims.js"(exports2, module2) {
962
- "use strict";
963
- var ReactPropTypesSecret = require_ReactPropTypesSecret();
964
- function emptyFunction() {
965
- }
966
- function emptyFunctionWithReset() {
967
- }
968
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
969
- module2.exports = function() {
970
- function shim(props, propName, componentName, location, propFullName, secret) {
971
- if (secret === ReactPropTypesSecret) {
972
- return;
973
- }
974
- var err = new Error(
975
- "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"
976
- );
977
- err.name = "Invariant Violation";
978
- throw err;
979
- }
980
- ;
981
- shim.isRequired = shim;
982
- function getShim() {
983
- return shim;
984
- }
985
- ;
986
- var ReactPropTypes = {
987
- array: shim,
988
- bigint: shim,
989
- bool: shim,
990
- func: shim,
991
- number: shim,
992
- object: shim,
993
- string: shim,
994
- symbol: shim,
995
- any: shim,
996
- arrayOf: getShim,
997
- element: shim,
998
- elementType: shim,
999
- instanceOf: getShim,
1000
- node: shim,
1001
- objectOf: getShim,
1002
- oneOf: getShim,
1003
- oneOfType: getShim,
1004
- shape: getShim,
1005
- exact: getShim,
1006
- checkPropTypes: emptyFunctionWithReset,
1007
- resetWarningCache: emptyFunction
1008
- };
1009
- ReactPropTypes.PropTypes = ReactPropTypes;
1010
- return ReactPropTypes;
1011
- };
1012
- }
1013
- });
1014
-
1015
846
  // ../../node_modules/prop-types/index.js
1016
847
  var require_prop_types = __commonJS({
1017
848
  "../../node_modules/prop-types/index.js"(exports2, module2) {
1018
849
  "use strict";
1019
- if (process.env.NODE_ENV !== "production") {
850
+ if (true) {
1020
851
  ReactIs = require_react_is();
1021
852
  throwOnDirectAccess = true;
1022
853
  module2.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1023
854
  } else {
1024
- module2.exports = require_factoryWithThrowingShims()();
855
+ module2.exports = null();
1025
856
  }
1026
857
  var ReactIs;
1027
858
  var throwOnDirectAccess;
@@ -1054,6 +885,7 @@ __export(index_exports, {
1054
885
  CNPJFormField: () => CNPJFormField,
1055
886
  CPFFormField: () => CPFFormField,
1056
887
  Calendar: () => Calendar,
888
+ CalendarFormField: () => CalendarFormField,
1057
889
  Card: () => Card,
1058
890
  CardStyled: () => CardStyled,
1059
891
  CheckboxGroup: () => CheckboxGroup,
@@ -1088,6 +920,8 @@ __export(index_exports, {
1088
920
  RadioGroupFormField: () => RadioGroupFormField,
1089
921
  RadioGroupStyled: () => RadioGroupStyled,
1090
922
  RadioItem: () => RadioItem,
923
+ RichEditor: () => RichEditor_default,
924
+ RichEditorFormField: () => RichEditorFormField,
1091
925
  Section: () => Section,
1092
926
  SectionStyled: () => SectionStyled,
1093
927
  SelectFormField: () => SelectFormField,
@@ -1113,6 +947,7 @@ __export(index_exports, {
1113
947
  TimePickerButtonStyled: () => TimePickerButtonStyled,
1114
948
  TimePickerDropdownStyled: () => TimePickerDropdownStyled,
1115
949
  TimePickerFooterStyled: () => TimePickerFooterStyled,
950
+ TimePickerFormField: () => TimePickerFormField,
1116
951
  TimePickerStyled: () => TimePickerStyled,
1117
952
  TimerPickerContentStyled: () => TimerPickerContentStyled,
1118
953
  ToastItem: () => ToastItem,
@@ -1122,9 +957,11 @@ __export(index_exports, {
1122
957
  TooltipProvider: () => TooltipProvider,
1123
958
  TooltipRoot: () => TooltipRoot,
1124
959
  TooltipTrigger: () => TooltipTrigger,
960
+ UploadService: () => UploadService,
1125
961
  isValidCNPJ: () => isValidCNPJ,
1126
962
  maskFormat: () => maskFormat,
1127
963
  maskUnformat: () => maskUnformat,
964
+ useImageUpload: () => useImageUpload,
1128
965
  useToast: () => useToast
1129
966
  });
1130
967
  module.exports = __toCommonJS(index_exports);
@@ -2842,7 +2679,8 @@ var TextField = import_react2.default.forwardRef(
2842
2679
  addon,
2843
2680
  textAlign = "left",
2844
2681
  mask,
2845
- maxLength
2682
+ maxLength,
2683
+ hasError
2846
2684
  } = _b, props = __objRest(_b, [
2847
2685
  "children",
2848
2686
  "isValid",
@@ -2853,7 +2691,8 @@ var TextField = import_react2.default.forwardRef(
2853
2691
  "addon",
2854
2692
  "textAlign",
2855
2693
  "mask",
2856
- "maxLength"
2694
+ "maxLength",
2695
+ "hasError"
2857
2696
  ]);
2858
2697
  const maskRef = mask ? (0, import_mask.useMask)(mask) : void 0;
2859
2698
  const inputRef = import_react2.default.useRef(null);
@@ -2871,11 +2710,18 @@ var TextField = import_react2.default.forwardRef(
2871
2710
  };
2872
2711
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Flex2, { direction: "column", css: { width: "100%", position: "relative" }, children: [
2873
2712
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Flex2, { gap: "0", css: { width: "100%" }, children: [
2874
- !!addon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InputAddon, { color, typography: "labelSmall", children: addon }),
2713
+ !!addon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2714
+ InputAddon,
2715
+ {
2716
+ color: hasError ? "error" : color,
2717
+ typography: "labelSmall",
2718
+ children: addon
2719
+ }
2720
+ ),
2875
2721
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2876
2722
  TextFieldStyled,
2877
2723
  __spreadProps(__spreadValues({
2878
- color,
2724
+ color: hasError ? "error" : color || "default",
2879
2725
  isValid: isValid2,
2880
2726
  name,
2881
2727
  typography,
@@ -2904,7 +2750,7 @@ var TextField = import_react2.default.forwardRef(
2904
2750
  {
2905
2751
  position: "flex-end",
2906
2752
  name,
2907
- color,
2753
+ color: hasError ? "error" : color,
2908
2754
  typography,
2909
2755
  fontWeight,
2910
2756
  textAlign,
@@ -8067,14 +7913,16 @@ function Calendar(_a) {
8067
7913
  calendarLayout,
8068
7914
  selected,
8069
7915
  setSelected,
8070
- position = "bottom"
7916
+ position = "bottom",
7917
+ hasError
8071
7918
  } = _b, props = __objRest(_b, [
8072
7919
  "action",
8073
7920
  "actionText",
8074
7921
  "calendarLayout",
8075
7922
  "selected",
8076
7923
  "setSelected",
8077
- "position"
7924
+ "position",
7925
+ "hasError"
8078
7926
  ]);
8079
7927
  const [inputValue, setInputValue] = (0, import_react7.useState)("");
8080
7928
  const [showContainer, setShowCalendar] = (0, import_react7.useState)(false);
@@ -8116,6 +7964,7 @@ function Calendar(_a) {
8116
7964
  onChange: handleInputChange,
8117
7965
  inputMode: "numeric",
8118
7966
  textAlign: "right",
7967
+ color: hasError ? "error" : "default",
8119
7968
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { name: "calendar", size: "xl" }) })
8120
7969
  }
8121
7970
  )
@@ -8344,7 +8193,8 @@ var pad = (num) => String(num).padStart(2, "0");
8344
8193
  function TimePicker({
8345
8194
  selected,
8346
8195
  setSelected,
8347
- position = "bottom"
8196
+ position = "bottom",
8197
+ hasError
8348
8198
  }) {
8349
8199
  const [hours, setHours] = (0, import_react9.useState)("00");
8350
8200
  const [minutes, setMinutes] = (0, import_react9.useState)("00");
@@ -8396,6 +8246,7 @@ function TimePicker({
8396
8246
  placeholder: "00:00",
8397
8247
  typography: "labelSmall",
8398
8248
  fontWeight: "regular",
8249
+ color: hasError ? "error" : "default",
8399
8250
  children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextFieldSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon_default, { name: "clock", size: "xl" }) })
8400
8251
  }
8401
8252
  )
@@ -9485,13 +9336,6 @@ var itemStyle = {
9485
9336
  }
9486
9337
  };
9487
9338
  var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
9488
- var BadgeWrapper = styled("div", {
9489
- flex: "1",
9490
- display: "flex",
9491
- gap: "4px",
9492
- marginTop: "8px",
9493
- flexDirection: "column"
9494
- });
9495
9339
  var BadgeCloseBtn = styled("div", {
9496
9340
  cursor: "pointer"
9497
9341
  });
@@ -9506,6 +9350,7 @@ var MultiSelect = import_react17.default.forwardRef(
9506
9350
  zIndex = "auto",
9507
9351
  showSelectedValues = true,
9508
9352
  singleSelect = false,
9353
+ selectedOrientation = "column",
9509
9354
  disabled = false
9510
9355
  }, fowardedRef) => {
9511
9356
  var _a;
@@ -9612,30 +9457,42 @@ var MultiSelect = import_react17.default.forwardRef(
9612
9457
  }
9613
9458
  )
9614
9459
  ] }),
9615
- selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BadgeWrapper, { children: selectedValues.map((value) => {
9616
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Flex2, { gap: 4, children: [
9617
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9618
- BadgeCloseBtn,
9619
- {
9620
- onClick: (e) => {
9621
- e.stopPropagation();
9622
- handleRemove(value);
9623
- },
9624
- role: "button",
9625
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
9626
- }
9627
- ),
9628
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9629
- Text,
9630
- {
9631
- typography: "captionMedium",
9632
- fontWeight: "regular",
9633
- color: "dark600",
9634
- children: labelByValue[value]
9635
- }
9636
- )
9637
- ] });
9638
- }) }) })
9460
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9461
+ Flex2,
9462
+ {
9463
+ direction: selectedOrientation,
9464
+ gap: 8,
9465
+ align: "center",
9466
+ justify: "start",
9467
+ css: {
9468
+ margin: "8px 0"
9469
+ },
9470
+ children: selectedValues.map((value) => {
9471
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Flex2, { gap: 4, align: "center", css: { flexWrap: "wrap" }, children: [
9472
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9473
+ BadgeCloseBtn,
9474
+ {
9475
+ onClick: (e) => {
9476
+ e.stopPropagation();
9477
+ handleRemove(value);
9478
+ },
9479
+ role: "button",
9480
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
9481
+ }
9482
+ ),
9483
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9484
+ Text,
9485
+ {
9486
+ typography: "captionMedium",
9487
+ fontWeight: "regular",
9488
+ color: "dark600",
9489
+ children: labelByValue[value]
9490
+ }
9491
+ )
9492
+ ] });
9493
+ })
9494
+ }
9495
+ ) })
9639
9496
  ] });
9640
9497
  }
9641
9498
  );
@@ -9878,12 +9735,16 @@ var TextAreaFormField = (_a) => {
9878
9735
  name,
9879
9736
  label,
9880
9737
  required,
9881
- placeholder
9738
+ placeholder,
9739
+ validate,
9740
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
9882
9741
  } = _b, props = __objRest(_b, [
9883
9742
  "name",
9884
9743
  "label",
9885
9744
  "required",
9886
- "placeholder"
9745
+ "placeholder",
9746
+ "validate",
9747
+ "validationErrorMessage"
9887
9748
  ]);
9888
9749
  var _a2;
9889
9750
  const {
@@ -9892,6 +9753,10 @@ var TextAreaFormField = (_a) => {
9892
9753
  } = (0, import_react_hook_form.useFormContext)();
9893
9754
  const haveError = !!errors[name];
9894
9755
  const errorMsg = (_a2 = errors[name]) == null ? void 0 : _a2.message;
9756
+ const validationRules = {
9757
+ required: required ? validationErrorMessage : false,
9758
+ validate
9759
+ };
9895
9760
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex2, { direction: "column", children: [
9896
9761
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
9897
9762
  FormLabel,
@@ -9904,7 +9769,7 @@ var TextAreaFormField = (_a) => {
9904
9769
  ),
9905
9770
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
9906
9771
  TextareaField,
9907
- __spreadProps(__spreadValues(__spreadValues({}, props), register(name, { required })), {
9772
+ __spreadProps(__spreadValues(__spreadValues({}, props), register(name, validationRules)), {
9908
9773
  placeholder,
9909
9774
  color: haveError ? "error" : "default",
9910
9775
  "aria-labelledby": `${name}-label`
@@ -10027,11 +9892,15 @@ var MultiSelectFormField = (_a) => {
10027
9892
  var _b = _a, {
10028
9893
  name,
10029
9894
  label,
10030
- required
9895
+ required,
9896
+ selectedOrientation = "column",
9897
+ zIndex
10031
9898
  } = _b, rest = __objRest(_b, [
10032
9899
  "name",
10033
9900
  "label",
10034
- "required"
9901
+ "required",
9902
+ "selectedOrientation",
9903
+ "zIndex"
10035
9904
  ]);
10036
9905
  var _a2;
10037
9906
  const { field, fieldState } = (0, import_react_hook_form4.useController)({
@@ -10063,7 +9932,9 @@ var MultiSelectFormField = (_a) => {
10063
9932
  value,
10064
9933
  onValueChange: handleChange,
10065
9934
  ref,
10066
- color: haveError ? "error" : "default"
9935
+ color: haveError ? "error" : "default",
9936
+ selectedOrientation,
9937
+ zIndex
10067
9938
  }, rest)
10068
9939
  ),
10069
9940
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ErrorFormMessage, { message: errorMsg })
@@ -10916,6 +10787,878 @@ var EmailFormField = ({
10916
10787
  }
10917
10788
  );
10918
10789
  };
10790
+
10791
+ // src/components/FormFields/RichEditorFormField.tsx
10792
+ var import_react_hook_form11 = require("react-hook-form");
10793
+
10794
+ // src/components/RichEditor/QuillComponent.tsx
10795
+ var import_react20 = require("react");
10796
+ var import_react_quilljs = require("react-quilljs");
10797
+ var import_quill_snow = require("quill/dist/quill.snow.css");
10798
+
10799
+ // src/utils/uploadService.ts
10800
+ var generateUniqueFilename = (originalName) => {
10801
+ const timestamp = Date.now().toString(36);
10802
+ const random = Math.random().toString(36).substring(2, 8);
10803
+ const extension = originalName.split(".").pop();
10804
+ return `${timestamp}_${random}.${extension}`;
10805
+ };
10806
+ var UploadService = class {
10807
+ static getPresignedUrl(filename, contentType, config2) {
10808
+ return __async(this, null, function* () {
10809
+ var _a;
10810
+ const apiUrl = config2.apiUrl;
10811
+ const presignedUrlEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.presignedUrl;
10812
+ const bucket = config2.s3Bucket;
10813
+ try {
10814
+ const response = yield fetch(`${apiUrl}${presignedUrlEndpoint}`, {
10815
+ method: "POST",
10816
+ headers: {
10817
+ "Content-Type": "application/json"
10818
+ },
10819
+ body: JSON.stringify({
10820
+ filename,
10821
+ contentType,
10822
+ bucket
10823
+ })
10824
+ });
10825
+ if (!response.ok) {
10826
+ throw new Error("Falha ao gerar URL de upload");
10827
+ }
10828
+ const data = yield response.json();
10829
+ return data.presignedUrl;
10830
+ } catch (error) {
10831
+ console.error("Erro ao gerar URL pr\xE9-assinada:", error);
10832
+ throw new Error("Falha ao gerar URL de upload");
10833
+ }
10834
+ });
10835
+ }
10836
+ static uploadToS3(file, config2, onProgress) {
10837
+ return __async(this, null, function* () {
10838
+ try {
10839
+ const uniqueFilename = generateUniqueFilename(file.name);
10840
+ const blob = new Blob([file], { type: file.type });
10841
+ const s3Url = `${config2.s3Url}/${uniqueFilename}`;
10842
+ return new Promise((resolve, reject) => {
10843
+ const xhr = new XMLHttpRequest();
10844
+ xhr.upload.addEventListener("progress", (event) => {
10845
+ if (event.lengthComputable) {
10846
+ const percentComplete = Math.round(
10847
+ event.loaded / event.total * 100
10848
+ );
10849
+ onProgress == null ? void 0 : onProgress({
10850
+ amount: percentComplete,
10851
+ message: `Fazendo upload... ${percentComplete}%`
10852
+ });
10853
+ }
10854
+ });
10855
+ xhr.addEventListener("load", () => {
10856
+ if (xhr.status === 200) {
10857
+ resolve({
10858
+ url: s3Url,
10859
+ filename: uniqueFilename,
10860
+ size: file.size,
10861
+ type: file.type
10862
+ });
10863
+ } else {
10864
+ reject(new Error(`Upload falhou com status: ${xhr.status}`));
10865
+ }
10866
+ });
10867
+ xhr.addEventListener("error", () => {
10868
+ reject(new Error("Erro de rede durante upload"));
10869
+ });
10870
+ xhr.open("PUT", s3Url);
10871
+ xhr.setRequestHeader("Content-Type", file.type);
10872
+ xhr.send(blob);
10873
+ });
10874
+ } catch (error) {
10875
+ console.error("Erro no upload:", error);
10876
+ throw error;
10877
+ }
10878
+ });
10879
+ }
10880
+ static uploadViaAPI(file, config2, onProgress) {
10881
+ return __async(this, null, function* () {
10882
+ try {
10883
+ const formData = new FormData();
10884
+ formData.append("file", file);
10885
+ const bucket = config2.s3Bucket;
10886
+ formData.append("bucket", bucket);
10887
+ const xhr = new XMLHttpRequest();
10888
+ return new Promise((resolve, reject) => {
10889
+ var _a;
10890
+ xhr.upload.addEventListener("progress", (event) => {
10891
+ if (event.lengthComputable) {
10892
+ const percentComplete = Math.round(
10893
+ event.loaded / event.total * 100
10894
+ );
10895
+ onProgress == null ? void 0 : onProgress({
10896
+ amount: percentComplete,
10897
+ message: `Fazendo upload... ${percentComplete}%`
10898
+ });
10899
+ }
10900
+ });
10901
+ xhr.addEventListener("load", () => {
10902
+ if (xhr.status === 200) {
10903
+ try {
10904
+ const response = JSON.parse(xhr.responseText);
10905
+ resolve({
10906
+ url: response.url,
10907
+ filename: response.filename,
10908
+ size: file.size,
10909
+ type: file.type
10910
+ });
10911
+ } catch (error) {
10912
+ reject(new Error("Resposta inv\xE1lida do servidor"));
10913
+ }
10914
+ } else {
10915
+ reject(new Error(`Upload falhou com status: ${xhr.status}`));
10916
+ }
10917
+ });
10918
+ xhr.addEventListener("error", () => {
10919
+ reject(new Error("Erro de rede durante upload"));
10920
+ });
10921
+ const apiUrl = config2.apiUrl;
10922
+ const uploadEndpoint = (_a = config2.endpoints) == null ? void 0 : _a.upload;
10923
+ xhr.open("POST", `${apiUrl}${uploadEndpoint}`);
10924
+ xhr.send(formData);
10925
+ });
10926
+ } catch (error) {
10927
+ console.error("Erro no upload via API:", error);
10928
+ throw error;
10929
+ }
10930
+ });
10931
+ }
10932
+ };
10933
+
10934
+ // src/components/RichEditor/styledComponents.ts
10935
+ var QuillContainer = styled("div", {
10936
+ display: "flex",
10937
+ flexDirection: "column"
10938
+ });
10939
+ var QuillEditor = styled("div", {
10940
+ "& .ql-editor": {
10941
+ minHeight: "200px",
10942
+ padding: "$12",
10943
+ fontSize: "$14",
10944
+ lineHeight: "$base",
10945
+ fontFamily: "$default",
10946
+ color: "$neutral900",
10947
+ backgroundColor: "$white",
10948
+ border: "none",
10949
+ outline: "none",
10950
+ cursor: "text",
10951
+ caretColor: "$primary500",
10952
+ "&:focus": {
10953
+ borderColor: "$primary500",
10954
+ boxShadow: "0 0 0 1px $primary500"
10955
+ },
10956
+ "& p": {
10957
+ margin: "0 0 $8 0"
10958
+ },
10959
+ "& p:last-child": {
10960
+ marginBottom: 0
10961
+ },
10962
+ "& .ql-cursor": {
10963
+ borderLeft: "2px solid $primary500"
10964
+ }
10965
+ },
10966
+ "& .ql-toolbar": {
10967
+ backgroundColor: "$grey100",
10968
+ border: "1px solid $neutral300",
10969
+ borderBottom: "none",
10970
+ borderTopLeftRadius: "$sm",
10971
+ borderTopRightRadius: "$sm",
10972
+ padding: "$8 $12"
10973
+ },
10974
+ "& .ql-container": {
10975
+ border: "1px solid $neutral300",
10976
+ borderTop: "none",
10977
+ borderBottomLeftRadius: "$sm",
10978
+ borderBottomRightRadius: "$sm",
10979
+ fontFamily: "$default"
10980
+ },
10981
+ "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before": {
10982
+ content: "T\xEDtulo 1"
10983
+ },
10984
+ "& .ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before": {
10985
+ content: "T\xEDtulo 2"
10986
+ }
10987
+ });
10988
+
10989
+ // src/components/RichEditor/QuillComponent.tsx
10990
+ var import_jsx_runtime50 = require("react/jsx-runtime");
10991
+ var QuillComponent = ({
10992
+ value = "",
10993
+ onChange,
10994
+ placeholder = "Digite seu texto aqui...",
10995
+ disabled = false,
10996
+ className,
10997
+ uploadConfig
10998
+ }) => {
10999
+ const [showVideoModal, setShowVideoModal] = (0, import_react20.useState)(false);
11000
+ const [videoUrl, setVideoUrl] = (0, import_react20.useState)("");
11001
+ const [showLinkModal, setShowLinkModal] = (0, import_react20.useState)(false);
11002
+ const [linkUrl, setLinkUrl] = (0, import_react20.useState)("");
11003
+ const videoModalRef = (0, import_react20.useRef)(null);
11004
+ const linkModalRef = (0, import_react20.useRef)(null);
11005
+ const { addToast, removeToast } = useToast();
11006
+ const modules = {
11007
+ toolbar: [
11008
+ [{ header: [1, 2, false] }],
11009
+ ["bold", "italic", "underline", "strike"],
11010
+ [{ color: [] }, { background: [] }],
11011
+ [{ align: [] }],
11012
+ [{ list: "ordered" }, { list: "bullet" }],
11013
+ ["link", "image", "video"]
11014
+ ],
11015
+ clipboard: {
11016
+ matchVisual: false
11017
+ }
11018
+ };
11019
+ const formats = [
11020
+ "header",
11021
+ "bold",
11022
+ "italic",
11023
+ "underline",
11024
+ "strike",
11025
+ "color",
11026
+ "background",
11027
+ "align",
11028
+ "list",
11029
+ "link",
11030
+ "image",
11031
+ "video"
11032
+ ];
11033
+ const { quill, quillRef } = (0, import_react_quilljs.useQuill)({
11034
+ theme: "snow",
11035
+ modules,
11036
+ formats,
11037
+ placeholder,
11038
+ readOnly: disabled
11039
+ });
11040
+ const handleImageUpload = (0, import_react20.useCallback)(
11041
+ (file) => __async(null, null, function* () {
11042
+ if (disabled || !quill || !uploadConfig) return;
11043
+ try {
11044
+ addToast({
11045
+ type: "info",
11046
+ message: "Carregando imagem...",
11047
+ duration: 2e3
11048
+ });
11049
+ const uploadedFile = yield UploadService.uploadToS3(file, uploadConfig);
11050
+ removeToast("info");
11051
+ addToast({
11052
+ type: "success",
11053
+ message: "Imagem adicionada com sucesso!"
11054
+ });
11055
+ const selection = quill.getSelection();
11056
+ const index = selection ? selection.index : quill.getLength();
11057
+ quill.insertEmbed(index, "image", uploadedFile.url);
11058
+ quill.setSelection(index + 1, 0);
11059
+ } catch (error) {
11060
+ console.error("Erro no upload:", error);
11061
+ addToast({
11062
+ type: "error",
11063
+ message: "Erro no upload: N\xE3o foi poss\xEDvel enviar a imagem. Tente novamente."
11064
+ });
11065
+ }
11066
+ }),
11067
+ [disabled, quill, addToast, removeToast, uploadConfig]
11068
+ );
11069
+ (0, import_react20.useEffect)(() => {
11070
+ if (quill && value) {
11071
+ const currentContent = quill.root.innerHTML;
11072
+ if (currentContent !== value) {
11073
+ const selection = quill.getSelection();
11074
+ quill.clipboard.dangerouslyPasteHTML(value);
11075
+ if (selection) {
11076
+ quill.setSelection(selection.index, selection.length);
11077
+ } else {
11078
+ quill.setSelection(quill.getLength(), 0);
11079
+ }
11080
+ }
11081
+ }
11082
+ }, [quill, value]);
11083
+ (0, import_react20.useEffect)(() => {
11084
+ if (quill) {
11085
+ quill.on("text-change", (delta, oldDelta, source) => {
11086
+ if (source === "user") {
11087
+ const html = quill.root.innerHTML;
11088
+ onChange == null ? void 0 : onChange(html);
11089
+ }
11090
+ });
11091
+ const toolbar = quill.getModule("toolbar");
11092
+ if (toolbar) {
11093
+ toolbar.addHandler("link", () => setShowLinkModal(true));
11094
+ toolbar.addHandler("video", () => setShowVideoModal(true));
11095
+ toolbar.addHandler("image", () => {
11096
+ const input = document.createElement("input");
11097
+ input.setAttribute("type", "file");
11098
+ input.setAttribute("accept", "image/*");
11099
+ input.click();
11100
+ input.onchange = () => __async(null, null, function* () {
11101
+ var _a;
11102
+ const file = (_a = input.files) == null ? void 0 : _a[0];
11103
+ if (file) {
11104
+ yield handleImageUpload(file);
11105
+ }
11106
+ });
11107
+ });
11108
+ }
11109
+ setTimeout(() => {
11110
+ var _a, _b;
11111
+ const toolbarElement = (_b = (_a = quillRef.current) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.querySelector(".ql-toolbar");
11112
+ if (toolbarElement) {
11113
+ const headerSelect = toolbarElement.querySelector(
11114
+ "select[data-value]"
11115
+ );
11116
+ console.log(headerSelect, "headerSelect");
11117
+ if (headerSelect) {
11118
+ const options = headerSelect.querySelectorAll("option");
11119
+ console.log(options, "options");
11120
+ options.forEach((option) => {
11121
+ if (option.value === "1") {
11122
+ option.textContent = "T\xEDtulo 1";
11123
+ } else if (option.value === "2") {
11124
+ option.textContent = "T\xEDtulo 2";
11125
+ } else if (option.value === "") {
11126
+ option.textContent = "Normal";
11127
+ }
11128
+ });
11129
+ }
11130
+ }
11131
+ }, 100);
11132
+ }
11133
+ }, [quill, onChange, handleImageUpload]);
11134
+ (0, import_react20.useEffect)(() => {
11135
+ if (quill) {
11136
+ quill.enable(!disabled);
11137
+ if (!disabled) {
11138
+ if (quill.getLength() <= 1) {
11139
+ quill.focus();
11140
+ quill.setSelection(0, 0);
11141
+ }
11142
+ }
11143
+ }
11144
+ }, [quill, disabled]);
11145
+ const handleLinkCancel = (0, import_react20.useCallback)(() => {
11146
+ setLinkUrl("");
11147
+ setShowLinkModal(false);
11148
+ }, []);
11149
+ const handleLinkSubmit = (0, import_react20.useCallback)(() => {
11150
+ if (!linkUrl.trim() || !quill) return;
11151
+ const url = linkUrl.trim();
11152
+ const selection = quill.getSelection();
11153
+ if (selection && selection.length > 0) {
11154
+ quill.format("link", url);
11155
+ } else {
11156
+ const index = quill.getLength();
11157
+ quill.insertText(index, url, "link", url);
11158
+ quill.setSelection(index + url.length, 0);
11159
+ }
11160
+ setLinkUrl("");
11161
+ setShowLinkModal(false);
11162
+ }, [linkUrl, quill]);
11163
+ const handleVideoCancel = (0, import_react20.useCallback)(() => {
11164
+ setVideoUrl("");
11165
+ setShowVideoModal(false);
11166
+ }, []);
11167
+ const handleVideoSubmit = (0, import_react20.useCallback)(() => {
11168
+ var _a, _b;
11169
+ if (!videoUrl.trim() || !quill) return;
11170
+ let processedUrl = videoUrl.trim();
11171
+ if (processedUrl.includes("youtube.com/watch")) {
11172
+ const videoId = (_a = processedUrl.match(/[?&]v=([^&]+)/)) == null ? void 0 : _a[1];
11173
+ if (videoId) {
11174
+ processedUrl = `https://www.youtube.com/embed/${videoId}`;
11175
+ }
11176
+ } else if (processedUrl.includes("youtu.be/")) {
11177
+ const videoId = (_b = processedUrl.split("youtu.be/")[1]) == null ? void 0 : _b.split("?")[0];
11178
+ if (videoId) {
11179
+ processedUrl = `https://www.youtube.com/embed/${videoId}`;
11180
+ }
11181
+ }
11182
+ const videoHTML = `
11183
+ <iframe
11184
+ src="${processedUrl}"
11185
+ style="max-width:100%; height:315px; border:0;"
11186
+ title="Video player"
11187
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
11188
+ allowfullscreen>
11189
+ </iframe>
11190
+ <br/>
11191
+ `;
11192
+ const selection = quill.getSelection();
11193
+ const insertIndex = selection ? selection.index : quill.getLength();
11194
+ quill.clipboard.dangerouslyPasteHTML(insertIndex, videoHTML);
11195
+ quill.setSelection(insertIndex + 1, 0);
11196
+ setVideoUrl("");
11197
+ setShowVideoModal(false);
11198
+ }, [videoUrl, quill]);
11199
+ (0, import_react20.useEffect)(() => {
11200
+ const handleClickOutside = (event) => {
11201
+ if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
11202
+ handleVideoCancel();
11203
+ }
11204
+ if (showLinkModal && linkModalRef.current && !linkModalRef.current.contains(event.target)) {
11205
+ handleLinkCancel();
11206
+ }
11207
+ };
11208
+ document.addEventListener("mousedown", handleClickOutside);
11209
+ return () => document.removeEventListener("mousedown", handleClickOutside);
11210
+ }, [showVideoModal, showLinkModal, handleVideoCancel, handleLinkCancel]);
11211
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(QuillContainer, { className, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(QuillEditor, { style: { position: "relative" }, children: [
11212
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { ref: quillRef }),
11213
+ showVideoModal && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11214
+ "div",
11215
+ {
11216
+ ref: videoModalRef,
11217
+ style: {
11218
+ position: "absolute",
11219
+ top: "20px",
11220
+ left: "20px",
11221
+ right: "20px",
11222
+ backgroundColor: "white",
11223
+ border: "1px solid #e0e0e0",
11224
+ borderRadius: "4px",
11225
+ padding: "12px",
11226
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
11227
+ zIndex: 1e3,
11228
+ width: "fit-content"
11229
+ },
11230
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Flex2, { gap: 8, align: "center", children: [
11231
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11232
+ Text,
11233
+ {
11234
+ style: { fontSize: "14px", fontWeight: "500", color: "#333" },
11235
+ children: "V\xEDdeo:"
11236
+ }
11237
+ ),
11238
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11239
+ "input",
11240
+ {
11241
+ type: "text",
11242
+ value: videoUrl,
11243
+ onChange: (e) => setVideoUrl(e.target.value),
11244
+ placeholder: "Embed URL",
11245
+ style: {
11246
+ padding: "8px 12px",
11247
+ border: "1px solid #d0d0d0",
11248
+ borderRadius: "4px",
11249
+ fontSize: "14px",
11250
+ backgroundColor: "#f8f8f8"
11251
+ },
11252
+ onKeyDown: (e) => {
11253
+ if (e.key === "Enter") {
11254
+ handleVideoSubmit();
11255
+ } else if (e.key === "Escape") {
11256
+ handleVideoCancel();
11257
+ }
11258
+ },
11259
+ autoFocus: true
11260
+ }
11261
+ ),
11262
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11263
+ "button",
11264
+ {
11265
+ onClick: handleVideoSubmit,
11266
+ disabled: !videoUrl.trim(),
11267
+ style: {
11268
+ padding: "8px 16px",
11269
+ backgroundColor: "#007bff",
11270
+ color: "white",
11271
+ border: "none",
11272
+ borderRadius: "4px",
11273
+ fontSize: "14px",
11274
+ cursor: videoUrl.trim() ? "pointer" : "not-allowed",
11275
+ opacity: videoUrl.trim() ? 1 : 0.6
11276
+ },
11277
+ children: "Ok"
11278
+ }
11279
+ )
11280
+ ] })
11281
+ }
11282
+ ),
11283
+ showLinkModal && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11284
+ "div",
11285
+ {
11286
+ ref: linkModalRef,
11287
+ style: {
11288
+ position: "absolute",
11289
+ top: "20px",
11290
+ left: "20px",
11291
+ right: "20px",
11292
+ backgroundColor: "white",
11293
+ border: "1px solid #e0e0e0",
11294
+ borderRadius: "4px",
11295
+ padding: "12px",
11296
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
11297
+ zIndex: 1e3,
11298
+ width: "fit-content"
11299
+ },
11300
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Flex2, { gap: 8, align: "center", children: [
11301
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11302
+ Text,
11303
+ {
11304
+ style: { fontSize: "14px", fontWeight: "500", color: "#333" },
11305
+ children: "Link:"
11306
+ }
11307
+ ),
11308
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11309
+ "input",
11310
+ {
11311
+ type: "text",
11312
+ value: linkUrl,
11313
+ onChange: (e) => setLinkUrl(e.target.value),
11314
+ placeholder: "URL do link",
11315
+ style: {
11316
+ padding: "8px 12px",
11317
+ border: "1px solid #d0d0d0",
11318
+ borderRadius: "4px",
11319
+ fontSize: "14px",
11320
+ backgroundColor: "#f8f8f8",
11321
+ width: "300px"
11322
+ },
11323
+ onKeyDown: (e) => {
11324
+ if (e.key === "Enter") {
11325
+ handleLinkSubmit();
11326
+ } else if (e.key === "Escape") {
11327
+ handleLinkCancel();
11328
+ }
11329
+ },
11330
+ autoFocus: true
11331
+ }
11332
+ ),
11333
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11334
+ "button",
11335
+ {
11336
+ onClick: handleLinkSubmit,
11337
+ disabled: !linkUrl.trim(),
11338
+ style: {
11339
+ padding: "8px 16px",
11340
+ backgroundColor: "#007bff",
11341
+ color: "white",
11342
+ border: "none",
11343
+ borderRadius: "4px",
11344
+ fontSize: "14px",
11345
+ cursor: linkUrl.trim() ? "pointer" : "not-allowed",
11346
+ opacity: linkUrl.trim() ? 1 : 0.6
11347
+ },
11348
+ children: "Ok"
11349
+ }
11350
+ )
11351
+ ] })
11352
+ }
11353
+ )
11354
+ ] }) });
11355
+ };
11356
+ var QuillComponent_default = QuillComponent;
11357
+
11358
+ // src/components/RichEditor/RichEditor.tsx
11359
+ var import_jsx_runtime51 = require("react/jsx-runtime");
11360
+ var RichEditor = (props) => {
11361
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ToastProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(QuillComponent_default, __spreadValues({}, props)) }) });
11362
+ };
11363
+ var RichEditor_default = RichEditor;
11364
+
11365
+ // src/components/FormFields/RichEditorFormField.tsx
11366
+ var import_jsx_runtime52 = require("react/jsx-runtime");
11367
+ var RichEditorFormField = (_a) => {
11368
+ var _b = _a, {
11369
+ name,
11370
+ label,
11371
+ required,
11372
+ validate,
11373
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio."
11374
+ } = _b, props = __objRest(_b, [
11375
+ "name",
11376
+ "label",
11377
+ "required",
11378
+ "validate",
11379
+ "validationErrorMessage"
11380
+ ]);
11381
+ const { field, fieldState } = (0, import_react_hook_form11.useController)({
11382
+ name,
11383
+ rules: {
11384
+ required: required ? validationErrorMessage : false,
11385
+ validate: (value) => {
11386
+ var _a2;
11387
+ if (value === void 0 || value === null || !required && value.trim() === "")
11388
+ return true;
11389
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11390
+ }
11391
+ },
11392
+ defaultValue: ""
11393
+ });
11394
+ const fieldError = fieldState.error;
11395
+ const haveError = !!fieldError;
11396
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11397
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Flex2, { direction: "column", children: [
11398
+ label && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11399
+ FormLabel,
11400
+ {
11401
+ name,
11402
+ label,
11403
+ required,
11404
+ haveError
11405
+ }
11406
+ ),
11407
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
11408
+ RichEditor_default,
11409
+ __spreadProps(__spreadValues({}, props), {
11410
+ value: field.value,
11411
+ onChange: field.onChange,
11412
+ "aria-labelledby": `${name}-label`
11413
+ })
11414
+ ),
11415
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ErrorFormMessage, { message: errorMsg })
11416
+ ] });
11417
+ };
11418
+
11419
+ // src/components/FormFields/CalendarFormField.tsx
11420
+ var import_react_hook_form12 = require("react-hook-form");
11421
+ var import_react21 = require("react");
11422
+ var import_jsx_runtime53 = require("react/jsx-runtime");
11423
+ var CalendarFormField = (_a) => {
11424
+ var _b = _a, {
11425
+ name,
11426
+ label,
11427
+ required,
11428
+ validate,
11429
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11430
+ rules,
11431
+ onChange
11432
+ } = _b, calendarProps = __objRest(_b, [
11433
+ "name",
11434
+ "label",
11435
+ "required",
11436
+ "validate",
11437
+ "validationErrorMessage",
11438
+ "rules",
11439
+ "onChange"
11440
+ ]);
11441
+ const handleValidate = (0, import_react21.useCallback)(
11442
+ (value) => {
11443
+ var _a2;
11444
+ if (value === void 0 || value === null) {
11445
+ if (required) return validationErrorMessage;
11446
+ return true;
11447
+ }
11448
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11449
+ },
11450
+ [validate, required, validationErrorMessage]
11451
+ );
11452
+ const { field, fieldState } = (0, import_react_hook_form12.useController)({
11453
+ name,
11454
+ rules: __spreadValues({
11455
+ required: required ? validationErrorMessage : false,
11456
+ validate: handleValidate
11457
+ }, rules),
11458
+ defaultValue: void 0
11459
+ });
11460
+ const fieldError = fieldState.error;
11461
+ const haveError = !!fieldError;
11462
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11463
+ const { value: selected, onChange: setSelected } = field;
11464
+ const handleCalendarChange = (date) => {
11465
+ setSelected(date);
11466
+ };
11467
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Flex2, { direction: "column", children: [
11468
+ label && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11469
+ FormLabel,
11470
+ {
11471
+ name,
11472
+ label,
11473
+ required,
11474
+ haveError
11475
+ }
11476
+ ),
11477
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11478
+ Calendar,
11479
+ __spreadValues({
11480
+ selected,
11481
+ setSelected: (value) => {
11482
+ const date = typeof value === "function" ? value(selected) : value;
11483
+ handleCalendarChange(date);
11484
+ },
11485
+ hasError: haveError
11486
+ }, calendarProps)
11487
+ ),
11488
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorFormMessage, { message: errorMsg })
11489
+ ] });
11490
+ };
11491
+
11492
+ // src/components/FormFields/TimePickerFormField.tsx
11493
+ var import_react_hook_form13 = require("react-hook-form");
11494
+ var import_react22 = require("react");
11495
+ var import_jsx_runtime54 = require("react/jsx-runtime");
11496
+ var TimePickerFormField = (_a) => {
11497
+ var _b = _a, {
11498
+ name,
11499
+ label,
11500
+ required,
11501
+ validate,
11502
+ validationErrorMessage = "Este campo \xE9 obrigat\xF3rio.",
11503
+ rules
11504
+ } = _b, timePickerProps = __objRest(_b, [
11505
+ "name",
11506
+ "label",
11507
+ "required",
11508
+ "validate",
11509
+ "validationErrorMessage",
11510
+ "rules"
11511
+ ]);
11512
+ const handleValidate = (0, import_react22.useCallback)(
11513
+ (value) => {
11514
+ var _a2;
11515
+ if (value === void 0 || value === null || value === "") {
11516
+ if (required) return validationErrorMessage;
11517
+ return true;
11518
+ }
11519
+ return (_a2 = validate == null ? void 0 : validate(value)) != null ? _a2 : true;
11520
+ },
11521
+ [validate, required, validationErrorMessage]
11522
+ );
11523
+ const { field, fieldState } = (0, import_react_hook_form13.useController)({
11524
+ name,
11525
+ rules: __spreadValues({
11526
+ required: required ? validationErrorMessage : false,
11527
+ validate: handleValidate
11528
+ }, rules),
11529
+ defaultValue: void 0
11530
+ });
11531
+ const fieldError = fieldState.error;
11532
+ const haveError = !!fieldError;
11533
+ const errorMsg = fieldError == null ? void 0 : fieldError.message;
11534
+ const { value: selected, onChange: setSelected } = field;
11535
+ const handleTimePickerChange = (time) => {
11536
+ setSelected(time);
11537
+ };
11538
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Flex2, { direction: "column", children: [
11539
+ label && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11540
+ FormLabel,
11541
+ {
11542
+ name,
11543
+ label,
11544
+ required,
11545
+ haveError
11546
+ }
11547
+ ),
11548
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
11549
+ TimePicker,
11550
+ __spreadValues({
11551
+ selected,
11552
+ setSelected: (value) => {
11553
+ const time = typeof value === "function" ? value(selected) : value;
11554
+ handleTimePickerChange(time);
11555
+ },
11556
+ hasError: haveError
11557
+ }, timePickerProps)
11558
+ ),
11559
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ErrorFormMessage, { message: errorMsg })
11560
+ ] });
11561
+ };
11562
+
11563
+ // src/hooks/useImageUpload.ts
11564
+ var import_react23 = require("react");
11565
+ var useImageUpload = (options) => {
11566
+ const [isUploading, setIsUploading] = (0, import_react23.useState)(false);
11567
+ const [progress, setProgress] = (0, import_react23.useState)(null);
11568
+ const [error, setError] = (0, import_react23.useState)(null);
11569
+ const {
11570
+ onSuccess,
11571
+ onError,
11572
+ onProgress,
11573
+ maxFileSize = 5 * 1024 * 1024,
11574
+ // 5MB default
11575
+ allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
11576
+ uploadConfig
11577
+ } = options;
11578
+ const validateFile = (0, import_react23.useCallback)(
11579
+ (file) => {
11580
+ if (!allowedTypes.includes(file.type)) {
11581
+ const errorMsg = "Tipo de arquivo n\xE3o suportado";
11582
+ setError(errorMsg);
11583
+ onError == null ? void 0 : onError(errorMsg);
11584
+ return false;
11585
+ }
11586
+ if (file.size > maxFileSize) {
11587
+ const errorMsg = `Arquivo muito grande. M\xE1ximo: ${(maxFileSize / 1024 / 1024).toFixed(1)}MB`;
11588
+ setError(errorMsg);
11589
+ onError == null ? void 0 : onError(errorMsg);
11590
+ return false;
11591
+ }
11592
+ return true;
11593
+ },
11594
+ [allowedTypes, maxFileSize, onError]
11595
+ );
11596
+ const uploadFile = (0, import_react23.useCallback)(
11597
+ (file) => __async(null, null, function* () {
11598
+ if (!validateFile(file)) {
11599
+ return null;
11600
+ }
11601
+ setIsUploading(true);
11602
+ setError(null);
11603
+ setProgress(null);
11604
+ try {
11605
+ const uploadedFile = yield UploadService.uploadToS3(
11606
+ file,
11607
+ uploadConfig,
11608
+ (progress2) => {
11609
+ setProgress(progress2);
11610
+ onProgress == null ? void 0 : onProgress(progress2);
11611
+ }
11612
+ );
11613
+ setIsUploading(false);
11614
+ setProgress(null);
11615
+ onSuccess == null ? void 0 : onSuccess(uploadedFile);
11616
+ return uploadedFile;
11617
+ } catch (error2) {
11618
+ console.error("Erro no upload S3:", error2);
11619
+ try {
11620
+ setProgress({
11621
+ amount: 0,
11622
+ message: "Tentando m\xE9todo alternativo..."
11623
+ });
11624
+ const uploadedFile = yield UploadService.uploadViaAPI(
11625
+ file,
11626
+ uploadConfig,
11627
+ (progress2) => {
11628
+ setProgress(progress2);
11629
+ onProgress == null ? void 0 : onProgress(progress2);
11630
+ }
11631
+ );
11632
+ setIsUploading(false);
11633
+ setProgress(null);
11634
+ onSuccess == null ? void 0 : onSuccess(uploadedFile);
11635
+ return uploadedFile;
11636
+ } catch (fallbackError) {
11637
+ console.error("Erro no fallback:", fallbackError);
11638
+ const errorMsg = "Falha no upload da imagem. Tente novamente.";
11639
+ setError(errorMsg);
11640
+ setIsUploading(false);
11641
+ setProgress(null);
11642
+ onError == null ? void 0 : onError(errorMsg);
11643
+ return null;
11644
+ }
11645
+ }
11646
+ }),
11647
+ [validateFile, onSuccess, onError, onProgress]
11648
+ );
11649
+ const reset = (0, import_react23.useCallback)(() => {
11650
+ setIsUploading(false);
11651
+ setProgress(null);
11652
+ setError(null);
11653
+ }, []);
11654
+ return {
11655
+ uploadFile,
11656
+ isUploading,
11657
+ progress,
11658
+ error,
11659
+ reset
11660
+ };
11661
+ };
10919
11662
  // Annotate the CommonJS export names for ESM import in node:
10920
11663
  0 && (module.exports = {
10921
11664
  AddressFormFields,
@@ -10941,6 +11684,7 @@ var EmailFormField = ({
10941
11684
  CNPJFormField,
10942
11685
  CPFFormField,
10943
11686
  Calendar,
11687
+ CalendarFormField,
10944
11688
  Card,
10945
11689
  CardStyled,
10946
11690
  CheckboxGroup,
@@ -10975,6 +11719,8 @@ var EmailFormField = ({
10975
11719
  RadioGroupFormField,
10976
11720
  RadioGroupStyled,
10977
11721
  RadioItem,
11722
+ RichEditor,
11723
+ RichEditorFormField,
10978
11724
  Section,
10979
11725
  SectionStyled,
10980
11726
  SelectFormField,
@@ -11000,6 +11746,7 @@ var EmailFormField = ({
11000
11746
  TimePickerButtonStyled,
11001
11747
  TimePickerDropdownStyled,
11002
11748
  TimePickerFooterStyled,
11749
+ TimePickerFormField,
11003
11750
  TimePickerStyled,
11004
11751
  TimerPickerContentStyled,
11005
11752
  ToastItem,
@@ -11009,23 +11756,15 @@ var EmailFormField = ({
11009
11756
  TooltipProvider,
11010
11757
  TooltipRoot,
11011
11758
  TooltipTrigger,
11759
+ UploadService,
11012
11760
  isValidCNPJ,
11013
11761
  maskFormat,
11014
11762
  maskUnformat,
11763
+ useImageUpload,
11015
11764
  useToast
11016
11765
  });
11017
11766
  /*! Bundled license information:
11018
11767
 
11019
- react-is/cjs/react-is.production.min.js:
11020
- (** @license React v16.13.1
11021
- * react-is.production.min.js
11022
- *
11023
- * Copyright (c) Facebook, Inc. and its affiliates.
11024
- *
11025
- * This source code is licensed under the MIT license found in the
11026
- * LICENSE file in the root directory of this source tree.
11027
- *)
11028
-
11029
11768
  react-is/cjs/react-is.development.js:
11030
11769
  (** @license React v16.13.1
11031
11770
  * react-is.development.js