@lets-events/react 12.10.17 → 12.11.1

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 (98) hide show
  1. package/.eslintrc.json +2 -2
  2. package/.turbo/turbo-build.log +21 -19
  3. package/CHANGELOG.md +12 -0
  4. package/dist/index.d.mts +19 -7
  5. package/dist/index.d.ts +19 -7
  6. package/dist/index.js +422 -264
  7. package/dist/index.mjs +432 -274
  8. package/package.json +1 -1
  9. package/src/components/Alert.tsx +303 -303
  10. package/src/components/Avatar.tsx +55 -55
  11. package/src/components/Badge.tsx +132 -132
  12. package/src/components/Box.tsx +3 -3
  13. package/src/components/Button/index.tsx +85 -85
  14. package/src/components/Button/styledComponents.ts +361 -361
  15. package/src/components/ButtonGroup.tsx +484 -484
  16. package/src/components/Calendar/index.tsx +168 -168
  17. package/src/components/Calendar/styledComponents.ts +480 -480
  18. package/src/components/Card.tsx +74 -74
  19. package/src/components/CheckboxGroup.tsx +176 -176
  20. package/src/components/Container.tsx +39 -39
  21. package/src/components/Divider.tsx +7 -7
  22. package/src/components/DoubleCalendar/index.tsx +204 -204
  23. package/src/components/Drawer/index.tsx +113 -113
  24. package/src/components/Drawer/styledComponents.ts +97 -97
  25. package/src/components/Dropdown.tsx +302 -302
  26. package/src/components/Filter.tsx +164 -164
  27. package/src/components/Flex.tsx +130 -130
  28. package/src/components/FormFields/AddressFormFields/CityFormField.tsx +111 -111
  29. package/src/components/FormFields/AddressFormFields/CountryFormField.tsx +33 -33
  30. package/src/components/FormFields/AddressFormFields/PostalCodeFormField.tsx +39 -39
  31. package/src/components/FormFields/AddressFormFields/StateFormField.tsx +32 -32
  32. package/src/components/FormFields/AddressFormFields/index.tsx +141 -141
  33. package/src/components/FormFields/BirthDateFormField.tsx +84 -84
  34. package/src/components/FormFields/CNPJFormField.tsx +87 -87
  35. package/src/components/FormFields/CPFFormField.tsx +78 -78
  36. package/src/components/FormFields/CalendarFormField.tsx +98 -98
  37. package/src/components/FormFields/CheckboxGroupFormField.tsx +91 -91
  38. package/src/components/FormFields/DateAndTimeFormField.tsx +217 -217
  39. package/src/components/FormFields/DoubleCalendarFormField.tsx +96 -96
  40. package/src/components/FormFields/EmailFormField.tsx +27 -27
  41. package/src/components/FormFields/Form.tsx +39 -39
  42. package/src/components/FormFields/IdentityDocumentNumberFormField.tsx +32 -32
  43. package/src/components/FormFields/MultiSelectFormField.tsx +64 -64
  44. package/src/components/FormFields/PhoneFormField.tsx +40 -40
  45. package/src/components/FormFields/RadioGroupFormField.tsx +88 -88
  46. package/src/components/FormFields/RichEditorFormField.tsx +128 -128
  47. package/src/components/FormFields/SelectFormField.tsx +113 -113
  48. package/src/components/FormFields/SwitchFormField.tsx +46 -46
  49. package/src/components/FormFields/TextAreaFormField.tsx +61 -61
  50. package/src/components/FormFields/TextFormField.tsx +112 -112
  51. package/src/components/FormFields/TimePickerFormField.tsx +88 -88
  52. package/src/components/FormFields/subComponents/ErrorFormMessage.tsx +36 -36
  53. package/src/components/FormFields/subComponents/FormLabel.tsx +36 -36
  54. package/src/components/FormFields/utils/validation.ts +23 -23
  55. package/src/components/Grid.tsx +137 -137
  56. package/src/components/Icon.tsx +47 -47
  57. package/src/components/MenuDropdown/index.tsx +38 -38
  58. package/src/components/MenuDropdown/styledComponents.ts +31 -31
  59. package/src/components/Modal.tsx +131 -114
  60. package/src/components/MultiSelect/index.tsx +417 -305
  61. package/src/components/MultiSelect/styledComponents.ts +176 -160
  62. package/src/components/RadioGroup.tsx +210 -210
  63. package/src/components/RichEditor/QuillComponent.tsx +419 -419
  64. package/src/components/RichEditor/RichEditor.tsx +53 -53
  65. package/src/components/RichEditor/RichTextPresenter.tsx +18 -18
  66. package/src/components/RichEditor/editorConfig.ts +149 -149
  67. package/src/components/RichEditor/index.ts +3 -3
  68. package/src/components/RichEditor/styledComponents.ts +1175 -1175
  69. package/src/components/RichEditor/types.ts +12 -12
  70. package/src/components/Section.tsx +33 -33
  71. package/src/components/Step.tsx +164 -164
  72. package/src/components/Switch.tsx +108 -108
  73. package/src/components/Text.tsx +54 -54
  74. package/src/components/TextField.tsx +423 -423
  75. package/src/components/TextareaField.tsx +116 -116
  76. package/src/components/TimePicker.tsx +357 -357
  77. package/src/components/Toast/components/ToastItem.tsx +41 -41
  78. package/src/components/Toast/components/ToastProvider.tsx +63 -63
  79. package/src/components/Toast/hooks/useToast.ts +12 -12
  80. package/src/components/Toast/index.tsx +5 -5
  81. package/src/components/Toast/styles/index.ts +135 -135
  82. package/src/components/Toast/types/index.ts +46 -46
  83. package/src/components/ToggleElement/index.tsx +58 -58
  84. package/src/components/Tooltip/index.tsx +126 -73
  85. package/src/components/Tooltip/styles.ts +77 -77
  86. package/src/hooks/useCountries.ts +41 -41
  87. package/src/hooks/useHasHover.ts +21 -0
  88. package/src/hooks/useImageUpload.ts +139 -139
  89. package/src/hooks/useMediaQuery.ts +19 -0
  90. package/src/hooks/useOnClickOutside.tsx +42 -42
  91. package/src/index.tsx +72 -72
  92. package/src/styles/index.ts +41 -41
  93. package/src/types/typographyValues.ts +178 -178
  94. package/src/utils/getNestedValue.ts +3 -3
  95. package/src/utils/states.ts +29 -29
  96. package/src/utils/uploadService.ts +180 -180
  97. package/tsconfig.json +3 -3
  98. package/tsup.config.ts +38 -38
package/dist/index.js CHANGED
@@ -149,7 +149,7 @@ var require_react_is_development = __commonJS({
149
149
  var ContextProvider = REACT_PROVIDER_TYPE;
150
150
  var Element = REACT_ELEMENT_TYPE;
151
151
  var ForwardRef = REACT_FORWARD_REF_TYPE;
152
- var Fragment7 = REACT_FRAGMENT_TYPE;
152
+ var Fragment8 = REACT_FRAGMENT_TYPE;
153
153
  var Lazy = REACT_LAZY_TYPE;
154
154
  var Memo = REACT_MEMO_TYPE;
155
155
  var Portal = REACT_PORTAL_TYPE;
@@ -208,7 +208,7 @@ var require_react_is_development = __commonJS({
208
208
  exports2.ContextProvider = ContextProvider;
209
209
  exports2.Element = Element;
210
210
  exports2.ForwardRef = ForwardRef;
211
- exports2.Fragment = Fragment7;
211
+ exports2.Fragment = Fragment8;
212
212
  exports2.Lazy = Lazy;
213
213
  exports2.Memo = Memo;
214
214
  exports2.Portal = Portal;
@@ -426,7 +426,7 @@ var require_factoryWithTypeCheckers = __commonJS({
426
426
  function emptyFunctionThatReturnsNull() {
427
427
  return null;
428
428
  }
429
- module2.exports = function(isValidElement, throwOnDirectAccess) {
429
+ module2.exports = function(isValidElement2, throwOnDirectAccess) {
430
430
  var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
431
431
  var FAUX_ITERATOR_SYMBOL = "@@iterator";
432
432
  function getIteratorFn(maybeIterable) {
@@ -554,7 +554,7 @@ var require_factoryWithTypeCheckers = __commonJS({
554
554
  function createElementTypeChecker() {
555
555
  function validate(props, propName, componentName, location, propFullName) {
556
556
  var propValue = props[propName];
557
- if (!isValidElement(propValue)) {
557
+ if (!isValidElement2(propValue)) {
558
558
  var propType = getPropType(propValue);
559
559
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
560
560
  }
@@ -742,7 +742,7 @@ var require_factoryWithTypeCheckers = __commonJS({
742
742
  if (Array.isArray(propValue)) {
743
743
  return propValue.every(isNode);
744
744
  }
745
- if (propValue === null || isValidElement(propValue)) {
745
+ if (propValue === null || isValidElement2(propValue)) {
746
746
  return true;
747
747
  }
748
748
  var iteratorFn = getIteratorFn(propValue);
@@ -3877,7 +3877,8 @@ var ModalTitleStyled = styled(import_radix_ui.Dialog.Title, {
3877
3877
  fontSize: "$18",
3878
3878
  fontWeight: "medium",
3879
3879
  fontStyle: "normal",
3880
- textTransform: "uppercase"
3880
+ textTransform: "uppercase",
3881
+ width: "calc(100% - 48px)"
3881
3882
  });
3882
3883
  function Modal(_a) {
3883
3884
  var _b = _a, {
@@ -3885,13 +3886,21 @@ function Modal(_a) {
3885
3886
  title,
3886
3887
  trigger,
3887
3888
  zIndex,
3888
- maxWidth
3889
+ maxWidth,
3890
+ maxHeight,
3891
+ height,
3892
+ preventAutoFocus = false,
3893
+ fitContent = false
3889
3894
  } = _b, props = __objRest(_b, [
3890
3895
  "children",
3891
3896
  "title",
3892
3897
  "trigger",
3893
3898
  "zIndex",
3894
- "maxWidth"
3899
+ "maxWidth",
3900
+ "maxHeight",
3901
+ "height",
3902
+ "preventAutoFocus",
3903
+ "fitContent"
3895
3904
  ]);
3896
3905
  const { onOpenChange } = props;
3897
3906
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_radix_ui.Dialog.Root, __spreadProps(__spreadValues({}, props), { children: [
@@ -3905,9 +3914,14 @@ function Modal(_a) {
3905
3914
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3906
3915
  ModalContentStyled,
3907
3916
  {
3908
- css: {
3909
- maxWidth
3917
+ onOpenAutoFocus: (event) => {
3918
+ if (preventAutoFocus) {
3919
+ event.preventDefault();
3920
+ }
3910
3921
  },
3922
+ css: __spreadValues(__spreadValues(__spreadValues({
3923
+ maxWidth
3924
+ }, maxHeight !== void 0 && { maxHeight }), height !== void 0 && { height }), fitContent && height === void 0 && { height: "fit-content" }),
3911
3925
  children: [
3912
3926
  title && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ModalHeaderStyled, { children: [
3913
3927
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalTitleStyled, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { typography: "headline6", fontWeight: "medium", children: title }) }),
@@ -10036,7 +10050,26 @@ var useToast = () => {
10036
10050
  };
10037
10051
 
10038
10052
  // src/components/Tooltip/index.tsx
10053
+ var React10 = __toESM(require("react"));
10039
10054
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
10055
+
10056
+ // src/hooks/useHasHover.ts
10057
+ var import_react18 = require("react");
10058
+ function useHasHover() {
10059
+ const [hasHover, setHasHover] = (0, import_react18.useState)(true);
10060
+ (0, import_react18.useEffect)(() => {
10061
+ const media = window.matchMedia("(hover: hover)");
10062
+ setHasHover(media.matches);
10063
+ const listener = (event) => {
10064
+ setHasHover(event.matches);
10065
+ };
10066
+ media.addEventListener("change", listener);
10067
+ return () => media.removeEventListener("change", listener);
10068
+ }, []);
10069
+ return hasHover;
10070
+ }
10071
+
10072
+ // src/components/Tooltip/index.tsx
10040
10073
  var import_jsx_runtime26 = require("react/jsx-runtime");
10041
10074
  var TooltipProvider = TooltipPrimitive.Provider;
10042
10075
  var TooltipRoot = TooltipPrimitive.Root;
@@ -10070,27 +10103,86 @@ var TooltipContent = styled(TooltipPrimitive.Content, {
10070
10103
  var TooltipArrow = styled(TooltipPrimitive.Arrow, {
10071
10104
  fill: "$dark800"
10072
10105
  });
10106
+ function mergeTouchTriggerProps(child, onToggle) {
10107
+ return React10.cloneElement(child, {
10108
+ onClick: (event) => {
10109
+ var _a, _b;
10110
+ (_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, event);
10111
+ if (!event.defaultPrevented) {
10112
+ onToggle();
10113
+ }
10114
+ }
10115
+ });
10116
+ }
10073
10117
  function Tooltip({
10074
10118
  children,
10075
10119
  content,
10076
10120
  delayDuration = 200,
10077
- side = "top"
10121
+ side = "top",
10122
+ supportMobileTap = true
10078
10123
  }) {
10079
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipRoot, { delayDuration, children: [
10080
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children }),
10081
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { side, sideOffset: 5, children: [
10082
- typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { typography: "tooltip", color: "grey50", children: content }) : content,
10083
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipArrow, {})
10084
- ] })
10085
- ] }) });
10124
+ const hasHover = useHasHover();
10125
+ const [open, setOpen] = React10.useState(false);
10126
+ const isTouchToggleRef = React10.useRef(false);
10127
+ const useTouchBehavior = supportMobileTap && !hasHover;
10128
+ const handleTouchOpenChange = React10.useCallback((nextOpen) => {
10129
+ if (isTouchToggleRef.current) {
10130
+ isTouchToggleRef.current = false;
10131
+ return;
10132
+ }
10133
+ setOpen(nextOpen);
10134
+ }, []);
10135
+ const triggerChild = React10.useMemo(() => {
10136
+ if (!useTouchBehavior || !React10.isValidElement(children)) {
10137
+ return children;
10138
+ }
10139
+ return mergeTouchTriggerProps(
10140
+ children,
10141
+ () => {
10142
+ isTouchToggleRef.current = true;
10143
+ setOpen((prev) => !prev);
10144
+ }
10145
+ );
10146
+ }, [children, useTouchBehavior]);
10147
+ const tooltipContent = typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { typography: "tooltip", color: "grey50", children: content }) : content;
10148
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
10149
+ TooltipRoot,
10150
+ __spreadProps(__spreadValues({
10151
+ delayDuration: useTouchBehavior ? 0 : delayDuration
10152
+ }, useTouchBehavior ? { open, onOpenChange: handleTouchOpenChange } : {}), {
10153
+ children: [
10154
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: triggerChild }),
10155
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { side, sideOffset: 5, children: [
10156
+ tooltipContent,
10157
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipArrow, {})
10158
+ ] })
10159
+ ]
10160
+ })
10161
+ ) });
10086
10162
  }
10087
10163
 
10088
10164
  // src/components/MultiSelect/index.tsx
10089
- var import_react18 = __toESM(require("react"));
10165
+ var import_react20 = __toESM(require("react"));
10090
10166
  var import_themes19 = require("@radix-ui/themes");
10091
10167
  var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
10092
10168
  var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
10169
+ var import_react21 = require("react");
10170
+
10171
+ // src/hooks/useMediaQuery.ts
10093
10172
  var import_react19 = require("react");
10173
+ function useMediaQuery(query) {
10174
+ const [matches, setMatches] = (0, import_react19.useState)(
10175
+ () => typeof window !== "undefined" ? window.matchMedia(query).matches : false
10176
+ );
10177
+ (0, import_react19.useEffect)(() => {
10178
+ const media = window.matchMedia(query);
10179
+ const listener = (event) => setMatches(event.matches);
10180
+ setMatches(media.matches);
10181
+ media.addEventListener("change", listener);
10182
+ return () => media.removeEventListener("change", listener);
10183
+ }, [query]);
10184
+ return matches;
10185
+ }
10094
10186
 
10095
10187
  // src/components/MultiSelect/styledComponents.ts
10096
10188
  var import_themes18 = require("@radix-ui/themes");
@@ -10203,6 +10295,19 @@ var StyledText = styled(Text, {
10203
10295
  whiteSpace: "nowrap",
10204
10296
  textOverflow: "ellipsis"
10205
10297
  });
10298
+ var StyledSectionDivider = styled("div", {
10299
+ borderBottom: "1px solid #CFCFCF",
10300
+ margin: "0 16px"
10301
+ });
10302
+ var StyledSectionTitle = styled(Text, {
10303
+ padding: "$8 $16 $4"
10304
+ });
10305
+ var StyledModalOptionsWrapper = styled("div", {
10306
+ overflowY: "auto",
10307
+ padding: "$16 0",
10308
+ width: "100%",
10309
+ boxSizing: "border-box"
10310
+ });
10206
10311
  var ButtonSelectAllStyled = styled("button", {
10207
10312
  display: "flex !important",
10208
10313
  alignItems: "center",
@@ -10240,12 +10345,16 @@ var ButtonSelectAllStyled = styled("button", {
10240
10345
 
10241
10346
  // src/components/MultiSelect/index.tsx
10242
10347
  var import_jsx_runtime27 = require("react/jsx-runtime");
10243
- var MultiSelect = import_react18.default.forwardRef(
10348
+ var MOBILE_MODAL_MAX_HEIGHT = "90vh";
10349
+ var MOBILE_MODAL_HEADER_OFFSET = "65px";
10350
+ var MOBILE_BREAKPOINT = "(max-width: 840px)";
10351
+ var MultiSelect = import_react20.default.forwardRef(
10244
10352
  ({
10245
10353
  placeholder,
10246
10354
  value: selectedValues = [],
10247
10355
  onValueChange,
10248
- options,
10356
+ options = [],
10357
+ optionsBySection,
10249
10358
  color,
10250
10359
  width = "100%",
10251
10360
  zIndex = "auto",
@@ -10259,52 +10368,64 @@ var MultiSelect = import_react18.default.forwardRef(
10259
10368
  selectedScroll = false,
10260
10369
  showMoreButton = false,
10261
10370
  showMoreButtonLabel = "Carregar mais",
10262
- showMoreButtonOnClick
10371
+ showMoreButtonOnClick,
10372
+ helperTextAfterField = ""
10263
10373
  }, fowardedRef) => {
10264
- const [isOpen, setIsOpen] = (0, import_react18.useState)(false);
10265
- const triggerRef = (0, import_react18.useRef)(null);
10266
- const [allOptionsSelected, setAllOptionsSelected] = (0, import_react18.useState)(false);
10267
- const labelByValue = (0, import_react19.useMemo)(() => {
10268
- return options.reduce((prev, curr) => {
10374
+ const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
10375
+ const triggerRef = (0, import_react20.useRef)(null);
10376
+ const [allOptionsSelected, setAllOptionsSelected] = (0, import_react20.useState)(false);
10377
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
10378
+ const hasSections = !!(optionsBySection == null ? void 0 : optionsBySection.length);
10379
+ const resolvedOptions = (0, import_react21.useMemo)(() => {
10380
+ if (hasSections) {
10381
+ return optionsBySection.reduce(
10382
+ (acc, section) => acc.concat(section.options),
10383
+ []
10384
+ );
10385
+ }
10386
+ return options;
10387
+ }, [hasSections, options, optionsBySection]);
10388
+ const labelByValue = (0, import_react21.useMemo)(() => {
10389
+ return resolvedOptions.reduce((prev, curr) => {
10269
10390
  return __spreadProps(__spreadValues({}, prev), {
10270
10391
  [curr.value]: curr.label
10271
10392
  });
10272
10393
  }, {});
10273
- }, [options]);
10274
- const handleRemove = (0, import_react18.useCallback)(
10394
+ }, [resolvedOptions]);
10395
+ const handleRemove = (0, import_react20.useCallback)(
10275
10396
  (value) => {
10276
10397
  const newValue = selectedValues.filter((v) => v !== value);
10277
10398
  onValueChange == null ? void 0 : onValueChange(newValue);
10278
10399
  },
10279
10400
  [selectedValues, onValueChange]
10280
10401
  );
10281
- const handleSelectAll = (0, import_react18.useCallback)(
10402
+ const handleSelectAll = (0, import_react20.useCallback)(
10282
10403
  (e) => {
10283
10404
  e.preventDefault();
10284
10405
  e.stopPropagation();
10285
- const allSelected = selectedValues.length === options.length;
10406
+ const allSelected = selectedValues.length === resolvedOptions.length;
10286
10407
  if (allSelected) {
10287
10408
  onValueChange == null ? void 0 : onValueChange([]);
10288
10409
  setAllOptionsSelected(false);
10289
10410
  } else {
10290
- onValueChange == null ? void 0 : onValueChange(options.map((o) => o.value));
10411
+ onValueChange == null ? void 0 : onValueChange(resolvedOptions.map((o) => o.value));
10291
10412
  setAllOptionsSelected(true);
10292
10413
  }
10293
10414
  },
10294
- [selectedValues, options, onValueChange]
10415
+ [selectedValues, resolvedOptions, onValueChange]
10295
10416
  );
10296
- const text = (0, import_react19.useMemo)(() => {
10417
+ const text = (0, import_react21.useMemo)(() => {
10297
10418
  if (selectedValues.length > 0 && singleSelect) {
10298
10419
  const value = selectedValues[0];
10299
10420
  return labelByValue[value];
10300
10421
  }
10301
10422
  return placeholder != null ? placeholder : "Selecione";
10302
- }, [selectedValues, placeholder, singleSelect]);
10423
+ }, [selectedValues, placeholder, singleSelect, labelByValue]);
10303
10424
  const handleItemClick = (v) => {
10304
10425
  onValueChange == null ? void 0 : onValueChange([v]);
10305
10426
  setIsOpen(false);
10306
10427
  };
10307
- const handleToggle = (0, import_react18.useCallback)(
10428
+ const handleToggle = (0, import_react20.useCallback)(
10308
10429
  (e) => {
10309
10430
  e.preventDefault();
10310
10431
  e.stopPropagation();
@@ -10313,43 +10434,153 @@ var MultiSelect = import_react18.default.forwardRef(
10313
10434
  },
10314
10435
  [disabled]
10315
10436
  );
10316
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.Theme, { style: width !== "100%" ? { width } : void 0, children: [
10317
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.DropdownMenu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
10318
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_themes19.DropdownMenu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10319
- StyledTrigger,
10437
+ const triggerElement = /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10438
+ StyledTrigger,
10439
+ {
10440
+ ref: (r) => {
10441
+ if (!r) return;
10442
+ triggerRef.current = r;
10443
+ if (fowardedRef) {
10444
+ if (typeof fowardedRef === "function") fowardedRef(r);
10445
+ else fowardedRef.current = r;
10446
+ }
10447
+ },
10448
+ color,
10449
+ disabled,
10450
+ style: width !== "100%" ? { width } : void 0,
10451
+ onClick: !isMobile ? handleToggle : void 0,
10452
+ children: [
10453
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10454
+ StyledText,
10455
+ {
10456
+ typography: "labelMedium",
10457
+ color: disabled ? "dark400" : void 0,
10458
+ children: text
10459
+ }
10460
+ ),
10461
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10462
+ import_react_fontawesome3.FontAwesomeIcon,
10463
+ {
10464
+ icon: isOpen ? import_free_solid_svg_icons3.faChevronUp : import_free_solid_svg_icons3.faChevronDown,
10465
+ size: "sm",
10466
+ color: disabled ? colors.dark400 : colors.dark600
10467
+ }
10468
+ )
10469
+ ]
10470
+ }
10471
+ );
10472
+ const selectAllBlock = selectedAllOptions && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
10473
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10474
+ ButtonSelectAllStyled,
10475
+ {
10476
+ css: itemStyle,
10477
+ onClick: (e) => {
10478
+ handleSelectAll(e);
10479
+ setIsOpen(false);
10480
+ },
10481
+ type: "button",
10482
+ children: [
10483
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: allOptionsSelected ? "checked" : "" }),
10484
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
10485
+ ]
10486
+ }
10487
+ ),
10488
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {})
10489
+ ] });
10490
+ const showMoreButtonBlock = showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10491
+ Button,
10492
+ {
10493
+ variant: "menuDropdownItem",
10494
+ color: "brand",
10495
+ onClick: showMoreButtonOnClick,
10496
+ fontWeight: "semibold",
10497
+ type: "button",
10498
+ css: {
10499
+ justifyContent: "flex-start",
10500
+ color: "var(--colors-brand500)!important"
10501
+ },
10502
+ children: showMoreButtonLabel
10503
+ }
10504
+ );
10505
+ const renderCheckboxOptions = () => {
10506
+ if (hasSections) {
10507
+ return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
10508
+ sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
10509
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
10510
+ section.options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
10511
+ ] }, section.name));
10512
+ }
10513
+ return resolvedOptions.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i));
10514
+ };
10515
+ const renderSingleSelectOptions = () => {
10516
+ if (hasSections) {
10517
+ return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
10518
+ sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
10519
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
10520
+ section.options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
10521
+ ] }, section.name));
10522
+ }
10523
+ return resolvedOptions.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i));
10524
+ };
10525
+ const optionsContent = !singleSelect ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10526
+ CheckboxGroup,
10527
+ {
10528
+ value: selectedValues,
10529
+ onValueChange: (v) => {
10530
+ onValueChange == null ? void 0 : onValueChange(v);
10531
+ setAllOptionsSelected((v || []).length === resolvedOptions.length);
10532
+ },
10533
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10534
+ StyledFlexWithMaxHeight,
10320
10535
  {
10321
- ref: (r) => {
10322
- if (!r) return;
10323
- triggerRef.current = r;
10324
- if (fowardedRef) {
10325
- if (typeof fowardedRef === "function") fowardedRef(r);
10326
- else fowardedRef.current = r;
10327
- }
10328
- },
10329
- color,
10330
- disabled,
10331
- style: width !== "100%" ? { width } : void 0,
10332
- onClick: handleToggle,
10536
+ direction: "column",
10537
+ gap: 8,
10538
+ hasMaxHeight: !!maxHeight && !isMobile,
10539
+ style: maxHeight && !isMobile ? { maxHeight } : void 0,
10333
10540
  children: [
10334
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10335
- StyledText,
10336
- {
10337
- typography: "labelMedium",
10338
- color: disabled ? "dark400" : void 0,
10339
- children: text
10340
- }
10341
- ),
10342
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10343
- import_react_fontawesome3.FontAwesomeIcon,
10344
- {
10345
- icon: isOpen ? import_free_solid_svg_icons3.faChevronUp : import_free_solid_svg_icons3.faChevronDown,
10346
- size: "sm",
10347
- color: disabled ? colors.dark400 : colors.dark600
10348
- }
10349
- )
10541
+ selectAllBlock,
10542
+ renderCheckboxOptions(),
10543
+ showMoreButtonBlock
10350
10544
  ]
10351
10545
  }
10352
- ) }),
10546
+ )
10547
+ }
10548
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10549
+ StyledFlexWithMaxHeight,
10550
+ {
10551
+ direction: "column",
10552
+ gap: 8,
10553
+ hasMaxHeight: !!maxHeight && !isMobile,
10554
+ style: maxHeight && !isMobile ? { maxHeight } : void 0,
10555
+ children: [
10556
+ renderSingleSelectOptions(),
10557
+ showMoreButtonBlock
10558
+ ]
10559
+ }
10560
+ );
10561
+ const modalZIndex = zIndex === "auto" ? void 0 : Number(zIndex);
10562
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.Theme, { style: width !== "100%" ? { width } : void 0, children: [
10563
+ isMobile ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10564
+ Modal,
10565
+ {
10566
+ open: disabled ? false : isOpen,
10567
+ onOpenChange: (open) => !disabled && setIsOpen(open),
10568
+ trigger: triggerElement,
10569
+ title: placeholder != null ? placeholder : "Selecione",
10570
+ maxHeight: MOBILE_MODAL_MAX_HEIGHT,
10571
+ zIndex: modalZIndex,
10572
+ preventAutoFocus: true,
10573
+ fitContent: true,
10574
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10575
+ StyledModalOptionsWrapper,
10576
+ {
10577
+ css: { maxHeight: `calc(${MOBILE_MODAL_MAX_HEIGHT} - ${MOBILE_MODAL_HEADER_OFFSET})` },
10578
+ children: optionsContent
10579
+ }
10580
+ )
10581
+ }
10582
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_themes19.DropdownMenu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
10583
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_themes19.DropdownMenu.Trigger, { children: triggerElement }),
10353
10584
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10354
10585
  StyledContent,
10355
10586
  {
@@ -10357,158 +10588,85 @@ var MultiSelect = import_react18.default.forwardRef(
10357
10588
  width: "100%",
10358
10589
  zIndex: zIndex === "auto" ? 999999 : zIndex
10359
10590
  },
10360
- children: !singleSelect ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10361
- CheckboxGroup,
10362
- {
10363
- value: selectedValues,
10364
- onValueChange: (v) => {
10365
- onValueChange == null ? void 0 : onValueChange(v);
10366
- setAllOptionsSelected((v || []).length === options.length);
10367
- },
10368
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10369
- StyledFlexWithMaxHeight,
10370
- {
10371
- direction: "column",
10372
- gap: 8,
10373
- hasMaxHeight: !!maxHeight,
10374
- style: maxHeight ? { maxHeight } : void 0,
10375
- children: [
10376
- selectedAllOptions && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10377
- ButtonSelectAllStyled,
10378
- {
10379
- css: itemStyle,
10380
- onClick: (e) => {
10381
- handleSelectAll(e), setIsOpen(false);
10382
- },
10383
- type: "button",
10384
- children: [
10385
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: allOptionsSelected ? "checked" : "" }),
10386
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
10387
- ]
10388
- }
10389
- ),
10390
- options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10391
- showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10392
- Button,
10393
- {
10394
- variant: "menuDropdownItem",
10395
- color: "brand",
10396
- onClick: showMoreButtonOnClick,
10397
- fontWeight: "semibold",
10398
- type: "button",
10399
- css: {
10400
- justifyContent: "flex-start",
10401
- color: "var(--colors-brand500)!important"
10402
- },
10403
- children: showMoreButtonLabel
10404
- }
10405
- )
10406
- ]
10407
- }
10408
- )
10409
- }
10410
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10411
- StyledFlexWithMaxHeight,
10591
+ children: optionsContent
10592
+ }
10593
+ )
10594
+ ] }),
10595
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { padding: "4px 8px 0 0" }, children: [
10596
+ helperTextAfterField && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "captionMedium", fontWeight: "regular", color: "dark600", children: helperTextAfterField }),
10597
+ selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10598
+ StyledFlexSelectedItems,
10599
+ {
10600
+ direction: selectedOrientation,
10601
+ gap: 8,
10602
+ align: selectedOrientation === "column" ? "start" : "center",
10603
+ justify: "start",
10604
+ css: __spreadValues({}, selectedScroll && { maxHeight: maxHeight || "400px" }),
10605
+ children: allOptionsSelected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10606
+ Flex,
10412
10607
  {
10413
- direction: "column",
10414
- gap: 8,
10415
- hasMaxHeight: !!maxHeight,
10416
- style: maxHeight ? { maxHeight } : void 0,
10608
+ gap: 4,
10609
+ align: "center",
10610
+ css: { flexWrap: "wrap" },
10417
10611
  children: [
10418
- options.map(({ value, label }, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { typography: "labelSmall", children: label }) }, i)),
10419
- showMoreButton && showMoreButtonOnClick && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10420
- Button,
10612
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10613
+ CloseBtnStyled,
10421
10614
  {
10422
- variant: "menuDropdownItem",
10423
- color: "brand",
10424
- onClick: showMoreButtonOnClick,
10425
- fontWeight: "semibold",
10615
+ onClick: (e) => {
10616
+ e.stopPropagation();
10617
+ onValueChange == null ? void 0 : onValueChange([]);
10618
+ setAllOptionsSelected(false);
10619
+ },
10426
10620
  type: "button",
10427
- css: {
10428
- justifyContent: "flex-start",
10429
- color: "var(--colors-brand500)!important"
10621
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
10622
+ }
10623
+ ),
10624
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10625
+ Text,
10626
+ {
10627
+ typography: "captionMedium",
10628
+ fontWeight: "regular",
10629
+ color: "dark600",
10630
+ children: "Todos selecionados"
10631
+ }
10632
+ )
10633
+ ]
10634
+ },
10635
+ "all-selected"
10636
+ ) : selectedValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10637
+ Flex,
10638
+ {
10639
+ gap: 4,
10640
+ align: "center",
10641
+ css: { flexWrap: "wrap" },
10642
+ children: [
10643
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10644
+ CloseBtnStyled,
10645
+ {
10646
+ onClick: (e) => {
10647
+ e.stopPropagation();
10648
+ handleRemove(value);
10430
10649
  },
10431
- children: showMoreButtonLabel
10650
+ type: "button",
10651
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
10652
+ }
10653
+ ),
10654
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10655
+ Text,
10656
+ {
10657
+ typography: "captionMedium",
10658
+ fontWeight: "regular",
10659
+ color: "dark600",
10660
+ children: labelByValue[value]
10432
10661
  }
10433
10662
  )
10434
10663
  ]
10435
- }
10436
- )
10664
+ },
10665
+ value
10666
+ ))
10437
10667
  }
10438
10668
  )
10439
- ] }),
10440
- selectedValues.length > 0 && showSelectedValues && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10441
- StyledFlexSelectedItems,
10442
- {
10443
- direction: selectedOrientation,
10444
- gap: 8,
10445
- align: selectedOrientation === "column" ? "start" : "center",
10446
- justify: "start",
10447
- css: __spreadValues({}, selectedScroll && { maxHeight: maxHeight || "400px" }),
10448
- children: allOptionsSelected ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10449
- Flex,
10450
- {
10451
- gap: 4,
10452
- align: "center",
10453
- css: { flexWrap: "wrap" },
10454
- children: [
10455
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10456
- CloseBtnStyled,
10457
- {
10458
- onClick: (e) => {
10459
- e.stopPropagation();
10460
- onValueChange == null ? void 0 : onValueChange([]);
10461
- setAllOptionsSelected(false);
10462
- },
10463
- type: "button",
10464
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
10465
- }
10466
- ),
10467
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10468
- Text,
10469
- {
10470
- typography: "captionMedium",
10471
- fontWeight: "regular",
10472
- color: "dark600",
10473
- children: "Todos selecionados"
10474
- }
10475
- )
10476
- ]
10477
- },
10478
- "all-selected"
10479
- ) : selectedValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
10480
- Flex,
10481
- {
10482
- gap: 4,
10483
- align: "center",
10484
- css: { flexWrap: "wrap" },
10485
- children: [
10486
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10487
- CloseBtnStyled,
10488
- {
10489
- onClick: (e) => {
10490
- e.stopPropagation();
10491
- handleRemove(value);
10492
- },
10493
- type: "button",
10494
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
10495
- }
10496
- ),
10497
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10498
- Text,
10499
- {
10500
- typography: "captionMedium",
10501
- fontWeight: "regular",
10502
- color: "dark600",
10503
- children: labelByValue[value]
10504
- }
10505
- )
10506
- ]
10507
- },
10508
- value
10509
- ))
10510
- }
10511
- )
10669
+ ] })
10512
10670
  ] });
10513
10671
  }
10514
10672
  );
@@ -10521,7 +10679,7 @@ var Divider = styled("div", {
10521
10679
  });
10522
10680
 
10523
10681
  // src/components/ToggleElement/index.tsx
10524
- var import_react20 = require("react");
10682
+ var import_react22 = require("react");
10525
10683
  var import_jsx_runtime28 = require("react/jsx-runtime");
10526
10684
  function ToggleElement({
10527
10685
  children,
@@ -10533,7 +10691,7 @@ function ToggleElement({
10533
10691
  buttonProps,
10534
10692
  onOpenChange
10535
10693
  }) {
10536
- const [internalOpen, setInternalOpen] = (0, import_react20.useState)(defaultOpen);
10694
+ const [internalOpen, setInternalOpen] = (0, import_react22.useState)(defaultOpen);
10537
10695
  const isControlled = open !== void 0;
10538
10696
  const isOpen = isControlled ? open : internalOpen;
10539
10697
  const handleClick = () => {
@@ -10855,7 +11013,7 @@ var TextAreaFormField = (_a) => {
10855
11013
 
10856
11014
  // src/components/FormFields/TextFormField.tsx
10857
11015
  var import_react_hook_form2 = require("react-hook-form");
10858
- var import_react21 = require("react");
11016
+ var import_react23 = require("react");
10859
11017
  var import_mask2 = require("@react-input/mask");
10860
11018
  var import_jsx_runtime35 = require("react/jsx-runtime");
10861
11019
  var TextFormField = (_a) => {
@@ -10878,7 +11036,7 @@ var TextFormField = (_a) => {
10878
11036
  "onChange",
10879
11037
  "valueFormatter"
10880
11038
  ]);
10881
- const handleValidate = (0, import_react21.useCallback)(
11039
+ const handleValidate = (0, import_react23.useCallback)(
10882
11040
  (value) => {
10883
11041
  var _a2;
10884
11042
  if (value === void 0 || value === null || !required && value.trim() === "")
@@ -10900,7 +11058,7 @@ var TextFormField = (_a) => {
10900
11058
  const haveError = !!fieldError;
10901
11059
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
10902
11060
  const { value: formValue, onChange: formChange } = field;
10903
- const formattedValue = (0, import_react21.useMemo)(() => {
11061
+ const formattedValue = (0, import_react23.useMemo)(() => {
10904
11062
  let value = formValue;
10905
11063
  if (valueFormatter) value = valueFormatter.format(value);
10906
11064
  if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
@@ -11512,7 +11670,7 @@ function StateFormField({
11512
11670
  }
11513
11671
 
11514
11672
  // src/components/FormFields/AddressFormFields/CityFormField.tsx
11515
- var import_react22 = require("react");
11673
+ var import_react24 = require("react");
11516
11674
  var import_react_hook_form7 = require("react-hook-form");
11517
11675
  var import_jsx_runtime47 = require("react/jsx-runtime");
11518
11676
  function CityFormField({
@@ -11525,9 +11683,9 @@ function CityFormField({
11525
11683
  }) {
11526
11684
  const { control, watch } = (0, import_react_hook_form7.useFormContext)();
11527
11685
  const selectedState = watch(stateName);
11528
- const [cities, setCities] = (0, import_react22.useState)([]);
11529
- const [loading, setLoading] = (0, import_react22.useState)(false);
11530
- (0, import_react22.useEffect)(() => {
11686
+ const [cities, setCities] = (0, import_react24.useState)([]);
11687
+ const [loading, setLoading] = (0, import_react24.useState)(false);
11688
+ (0, import_react24.useEffect)(() => {
11531
11689
  if (!isBrazil) {
11532
11690
  setCities([]);
11533
11691
  return;
@@ -11913,10 +12071,10 @@ var EmailFormField = ({
11913
12071
  var import_react_hook_form12 = require("react-hook-form");
11914
12072
 
11915
12073
  // src/components/RichEditor/RichEditor.tsx
11916
- var import_react24 = require("react");
12074
+ var import_react26 = require("react");
11917
12075
 
11918
12076
  // src/components/RichEditor/QuillComponent.tsx
11919
- var import_react23 = require("react");
12077
+ var import_react25 = require("react");
11920
12078
  var import_react_quilljs = require("react-quilljs");
11921
12079
 
11922
12080
  // src/utils/uploadService.ts
@@ -13119,12 +13277,12 @@ var QuillComponent = ({
13119
13277
  onCharacterCountChange,
13120
13278
  maxLength
13121
13279
  }) => {
13122
- const [showVideoModal, setShowVideoModal] = (0, import_react23.useState)(false);
13123
- const [videoUrl, setVideoUrl] = (0, import_react23.useState)("");
13124
- const [showLinkModal, setShowLinkModal] = (0, import_react23.useState)(false);
13125
- const [linkUrl, setLinkUrl] = (0, import_react23.useState)("");
13126
- const videoModalRef = (0, import_react23.useRef)(null);
13127
- const linkModalRef = (0, import_react23.useRef)(null);
13280
+ const [showVideoModal, setShowVideoModal] = (0, import_react25.useState)(false);
13281
+ const [videoUrl, setVideoUrl] = (0, import_react25.useState)("");
13282
+ const [showLinkModal, setShowLinkModal] = (0, import_react25.useState)(false);
13283
+ const [linkUrl, setLinkUrl] = (0, import_react25.useState)("");
13284
+ const videoModalRef = (0, import_react25.useRef)(null);
13285
+ const linkModalRef = (0, import_react25.useRef)(null);
13128
13286
  const { addToast, removeToast } = useToast();
13129
13287
  const formatHTML = (html) => {
13130
13288
  const parser = new DOMParser();
@@ -13143,7 +13301,7 @@ var QuillComponent = ({
13143
13301
  placeholder,
13144
13302
  readOnly: disabled
13145
13303
  });
13146
- const handleImageUpload = (0, import_react23.useCallback)(
13304
+ const handleImageUpload = (0, import_react25.useCallback)(
13147
13305
  (file) => __async(null, null, function* () {
13148
13306
  if (disabled || !quill || !uploadConfig) return;
13149
13307
  try {
@@ -13175,7 +13333,7 @@ var QuillComponent = ({
13175
13333
  }),
13176
13334
  [disabled, quill, addToast, removeToast, uploadConfig, onChange]
13177
13335
  );
13178
- (0, import_react23.useEffect)(() => {
13336
+ (0, import_react25.useEffect)(() => {
13179
13337
  if (!quill) return;
13180
13338
  if (value !== void 0 && value !== null) {
13181
13339
  const currentContent = quill.root.innerHTML;
@@ -13191,7 +13349,7 @@ var QuillComponent = ({
13191
13349
  }
13192
13350
  onCharacterCountChange == null ? void 0 : onCharacterCountChange(quill.getText().trim().length);
13193
13351
  }, [quill, value, onCharacterCountChange]);
13194
- (0, import_react23.useEffect)(() => {
13352
+ (0, import_react25.useEffect)(() => {
13195
13353
  if (quill) {
13196
13354
  quill.on("text-change", (delta, oldDelta, source) => {
13197
13355
  if (source === "user") {
@@ -13252,7 +13410,7 @@ var QuillComponent = ({
13252
13410
  }, 2e3);
13253
13411
  }
13254
13412
  }, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
13255
- (0, import_react23.useEffect)(() => {
13413
+ (0, import_react25.useEffect)(() => {
13256
13414
  if (quill) {
13257
13415
  quill.enable(!disabled);
13258
13416
  if (!disabled) {
@@ -13263,11 +13421,11 @@ var QuillComponent = ({
13263
13421
  }
13264
13422
  }
13265
13423
  }, [quill, disabled]);
13266
- const handleLinkCancel = (0, import_react23.useCallback)(() => {
13424
+ const handleLinkCancel = (0, import_react25.useCallback)(() => {
13267
13425
  setLinkUrl("");
13268
13426
  setShowLinkModal(false);
13269
13427
  }, []);
13270
- const handleLinkSubmit = (0, import_react23.useCallback)(() => {
13428
+ const handleLinkSubmit = (0, import_react25.useCallback)(() => {
13271
13429
  if (!linkUrl.trim() || !quill) return;
13272
13430
  const url = linkUrl.trim();
13273
13431
  const selection = quill.getSelection();
@@ -13282,11 +13440,11 @@ var QuillComponent = ({
13282
13440
  setLinkUrl("");
13283
13441
  setShowLinkModal(false);
13284
13442
  }, [linkUrl, quill]);
13285
- const handleVideoCancel = (0, import_react23.useCallback)(() => {
13443
+ const handleVideoCancel = (0, import_react25.useCallback)(() => {
13286
13444
  setVideoUrl("");
13287
13445
  setShowVideoModal(false);
13288
13446
  }, []);
13289
- const handleVideoSubmit = (0, import_react23.useCallback)(() => {
13447
+ const handleVideoSubmit = (0, import_react25.useCallback)(() => {
13290
13448
  var _a, _b;
13291
13449
  if (!videoUrl.trim() || !quill) return;
13292
13450
  let processedUrl = videoUrl.trim();
@@ -13319,7 +13477,7 @@ var QuillComponent = ({
13319
13477
  setVideoUrl("");
13320
13478
  setShowVideoModal(false);
13321
13479
  }, [videoUrl, quill]);
13322
- (0, import_react23.useEffect)(() => {
13480
+ (0, import_react25.useEffect)(() => {
13323
13481
  const handleClickOutside = (event) => {
13324
13482
  if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
13325
13483
  handleVideoCancel();
@@ -13481,8 +13639,8 @@ var QuillComponent_default = QuillComponent;
13481
13639
  // src/components/RichEditor/RichEditor.tsx
13482
13640
  var import_jsx_runtime54 = require("react/jsx-runtime");
13483
13641
  var RichEditor = (props) => {
13484
- const [isClient, setIsClient] = (0, import_react24.useState)(false);
13485
- (0, import_react24.useEffect)(() => {
13642
+ const [isClient, setIsClient] = (0, import_react26.useState)(false);
13643
+ (0, import_react26.useEffect)(() => {
13486
13644
  setIsClient(typeof window !== "undefined");
13487
13645
  }, []);
13488
13646
  if (!isClient) return null;
@@ -13504,7 +13662,7 @@ var RichTextPresenter = ({ richText }) => {
13504
13662
  var RichTextPresenter_default = RichTextPresenter;
13505
13663
 
13506
13664
  // src/components/FormFields/RichEditorFormField.tsx
13507
- var import_react25 = require("react");
13665
+ var import_react27 = require("react");
13508
13666
  var import_jsx_runtime56 = require("react/jsx-runtime");
13509
13667
  var getPlainTextLengthFromHtml = (html) => {
13510
13668
  var _a, _b;
@@ -13553,7 +13711,7 @@ var RichEditorFormField = (_a) => {
13553
13711
  }
13554
13712
  }
13555
13713
  });
13556
- const [caracterQuantity, setCaracterQuantity] = (0, import_react25.useState)(
13714
+ const [caracterQuantity, setCaracterQuantity] = (0, import_react27.useState)(
13557
13715
  () => getRemainingCharacters(maxLength, field.value)
13558
13716
  );
13559
13717
  const handleCharacterCountChange = (count) => {
@@ -13561,7 +13719,7 @@ var RichEditorFormField = (_a) => {
13561
13719
  setCaracterQuantity(Math.max(0, maxLength - count));
13562
13720
  }
13563
13721
  };
13564
- (0, import_react25.useEffect)(() => {
13722
+ (0, import_react27.useEffect)(() => {
13565
13723
  setCaracterQuantity(getRemainingCharacters(maxLength, field.value));
13566
13724
  }, [field.value, maxLength]);
13567
13725
  const fieldError = fieldState.error;
@@ -13607,7 +13765,7 @@ var RichEditorFormField = (_a) => {
13607
13765
 
13608
13766
  // src/components/FormFields/CalendarFormField.tsx
13609
13767
  var import_react_hook_form13 = require("react-hook-form");
13610
- var import_react26 = require("react");
13768
+ var import_react28 = require("react");
13611
13769
  var import_jsx_runtime57 = require("react/jsx-runtime");
13612
13770
  var CalendarFormField = (_a) => {
13613
13771
  var _b = _a, {
@@ -13633,7 +13791,7 @@ var CalendarFormField = (_a) => {
13633
13791
  "maxYearsFromNow",
13634
13792
  "maxDate"
13635
13793
  ]);
13636
- const handleValidate = (0, import_react26.useCallback)(
13794
+ const handleValidate = (0, import_react28.useCallback)(
13637
13795
  (value) => {
13638
13796
  var _a2;
13639
13797
  if (value === void 0 || value === null) {
@@ -13688,7 +13846,7 @@ var CalendarFormField = (_a) => {
13688
13846
  };
13689
13847
 
13690
13848
  // src/components/FormFields/DoubleCalendarFormField.tsx
13691
- var import_react27 = require("react");
13849
+ var import_react29 = require("react");
13692
13850
  var import_react_hook_form14 = require("react-hook-form");
13693
13851
  var import_jsx_runtime58 = require("react/jsx-runtime");
13694
13852
  var DoubleCalendarFormField = (_a) => {
@@ -13715,7 +13873,7 @@ var DoubleCalendarFormField = (_a) => {
13715
13873
  "maxDate",
13716
13874
  "disabled"
13717
13875
  ]);
13718
- const handleValidate = (0, import_react27.useCallback)(
13876
+ const handleValidate = (0, import_react29.useCallback)(
13719
13877
  (value) => {
13720
13878
  var _a2;
13721
13879
  if (value === void 0 || value === null) {
@@ -13764,7 +13922,7 @@ var DoubleCalendarFormField = (_a) => {
13764
13922
 
13765
13923
  // src/components/FormFields/TimePickerFormField.tsx
13766
13924
  var import_react_hook_form15 = require("react-hook-form");
13767
- var import_react28 = require("react");
13925
+ var import_react30 = require("react");
13768
13926
  var import_jsx_runtime59 = require("react/jsx-runtime");
13769
13927
  var TimePickerFormField = (_a) => {
13770
13928
  var _b = _a, {
@@ -13782,7 +13940,7 @@ var TimePickerFormField = (_a) => {
13782
13940
  "validationErrorMessage",
13783
13941
  "rules"
13784
13942
  ]);
13785
- const handleValidate = (0, import_react28.useCallback)(
13943
+ const handleValidate = (0, import_react30.useCallback)(
13786
13944
  (value) => {
13787
13945
  var _a2;
13788
13946
  if (value === void 0 || value === null || value === "") {
@@ -13835,7 +13993,7 @@ var TimePickerFormField = (_a) => {
13835
13993
 
13836
13994
  // src/components/FormFields/DateAndTimeFormField.tsx
13837
13995
  var import_react_hook_form16 = require("react-hook-form");
13838
- var import_react29 = require("react");
13996
+ var import_react31 = require("react");
13839
13997
  var import_jsx_runtime60 = require("react/jsx-runtime");
13840
13998
  var DateAndTimeFormField = (_a) => {
13841
13999
  var _b = _a, {
@@ -13864,7 +14022,7 @@ var DateAndTimeFormField = (_a) => {
13864
14022
  "maxDate"
13865
14023
  ]);
13866
14024
  const { addToast } = useToast();
13867
- const handleDisabledClick = (0, import_react29.useCallback)(
14025
+ const handleDisabledClick = (0, import_react31.useCallback)(
13868
14026
  (event) => {
13869
14027
  if (!disabled) return;
13870
14028
  event.preventDefault();
@@ -13877,7 +14035,7 @@ var DateAndTimeFormField = (_a) => {
13877
14035
  },
13878
14036
  [addToast, disabled, disabledInfo]
13879
14037
  );
13880
- const handleDisabledMouseDown = (0, import_react29.useCallback)(
14038
+ const handleDisabledMouseDown = (0, import_react31.useCallback)(
13881
14039
  (event) => {
13882
14040
  if (!disabled) return;
13883
14041
  event.preventDefault();
@@ -13885,7 +14043,7 @@ var DateAndTimeFormField = (_a) => {
13885
14043
  },
13886
14044
  [disabled]
13887
14045
  );
13888
- const handleValidate = (0, import_react29.useCallback)(
14046
+ const handleValidate = (0, import_react31.useCallback)(
13889
14047
  (value) => {
13890
14048
  var _a2;
13891
14049
  if (value === void 0 || value === null || value === "") {
@@ -13908,7 +14066,7 @@ var DateAndTimeFormField = (_a) => {
13908
14066
  const haveError = !!fieldError;
13909
14067
  const errorMsg = fieldError == null ? void 0 : fieldError.message;
13910
14068
  const { value: isoValue, onChange: setIsoValue } = field;
13911
- const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react29.useMemo)(() => {
14069
+ const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react31.useMemo)(() => {
13912
14070
  if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13913
14071
  try {
13914
14072
  const date = new Date(isoValue);
@@ -13923,13 +14081,13 @@ var DateAndTimeFormField = (_a) => {
13923
14081
  return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
13924
14082
  }
13925
14083
  }, [isoValue]);
13926
- const [draftDate, setDraftDate] = (0, import_react29.useState)(selectedDateFromIso);
13927
- const [draftTime, setDraftTime] = (0, import_react29.useState)(selectedTimeFromIso);
13928
- (0, import_react29.useEffect)(() => {
14084
+ const [draftDate, setDraftDate] = (0, import_react31.useState)(selectedDateFromIso);
14085
+ const [draftTime, setDraftTime] = (0, import_react31.useState)(selectedTimeFromIso);
14086
+ (0, import_react31.useEffect)(() => {
13929
14087
  setDraftDate(selectedDateFromIso);
13930
14088
  setDraftTime(selectedTimeFromIso);
13931
14089
  }, [selectedDateFromIso, selectedTimeFromIso]);
13932
- const combineDateTime = (0, import_react29.useCallback)(
14090
+ const combineDateTime = (0, import_react31.useCallback)(
13933
14091
  (date, time) => {
13934
14092
  if (!date) {
13935
14093
  setIsoValue("");
@@ -14016,11 +14174,11 @@ var DateAndTimeFormField = (_a) => {
14016
14174
  };
14017
14175
 
14018
14176
  // src/hooks/useImageUpload.ts
14019
- var import_react30 = require("react");
14177
+ var import_react32 = require("react");
14020
14178
  var useImageUpload = (options) => {
14021
- const [isUploading, setIsUploading] = (0, import_react30.useState)(false);
14022
- const [progress, setProgress] = (0, import_react30.useState)(null);
14023
- const [error, setError] = (0, import_react30.useState)(null);
14179
+ const [isUploading, setIsUploading] = (0, import_react32.useState)(false);
14180
+ const [progress, setProgress] = (0, import_react32.useState)(null);
14181
+ const [error, setError] = (0, import_react32.useState)(null);
14024
14182
  const {
14025
14183
  onSuccess,
14026
14184
  onError,
@@ -14030,7 +14188,7 @@ var useImageUpload = (options) => {
14030
14188
  allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
14031
14189
  uploadConfig
14032
14190
  } = options;
14033
- const validateFile = (0, import_react30.useCallback)(
14191
+ const validateFile = (0, import_react32.useCallback)(
14034
14192
  (file) => {
14035
14193
  if (!allowedTypes.includes(file.type)) {
14036
14194
  const errorMsg = "Tipo de arquivo n\xE3o suportado";
@@ -14048,7 +14206,7 @@ var useImageUpload = (options) => {
14048
14206
  },
14049
14207
  [allowedTypes, maxFileSize, onError]
14050
14208
  );
14051
- const uploadFile = (0, import_react30.useCallback)(
14209
+ const uploadFile = (0, import_react32.useCallback)(
14052
14210
  (file) => __async(null, null, function* () {
14053
14211
  if (!validateFile(file)) {
14054
14212
  return null;
@@ -14101,7 +14259,7 @@ var useImageUpload = (options) => {
14101
14259
  }),
14102
14260
  [validateFile, onSuccess, onError, onProgress]
14103
14261
  );
14104
- const reset = (0, import_react30.useCallback)(() => {
14262
+ const reset = (0, import_react32.useCallback)(() => {
14105
14263
  setIsUploading(false);
14106
14264
  setProgress(null);
14107
14265
  setError(null);