@lets-events/react 12.11.0 → 12.11.2
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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +151 -85
- package/dist/index.mjs +151 -85
- package/package.json +1 -1
- package/src/components/Modal.tsx +7 -2
- package/src/components/MultiSelect/index.tsx +1 -0
- package/src/components/Tooltip/index.tsx +62 -9
- package/src/hooks/useHasHover.ts +21 -0
package/dist/index.js
CHANGED
|
@@ -426,7 +426,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
426
426
|
function emptyFunctionThatReturnsNull() {
|
|
427
427
|
return null;
|
|
428
428
|
}
|
|
429
|
-
module2.exports = function(
|
|
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 (!
|
|
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 ||
|
|
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, {
|
|
@@ -3889,7 +3890,8 @@ function Modal(_a) {
|
|
|
3889
3890
|
maxHeight,
|
|
3890
3891
|
height,
|
|
3891
3892
|
preventAutoFocus = false,
|
|
3892
|
-
fitContent = false
|
|
3893
|
+
fitContent = false,
|
|
3894
|
+
titleTypography = "headline6"
|
|
3893
3895
|
} = _b, props = __objRest(_b, [
|
|
3894
3896
|
"children",
|
|
3895
3897
|
"title",
|
|
@@ -3899,7 +3901,8 @@ function Modal(_a) {
|
|
|
3899
3901
|
"maxHeight",
|
|
3900
3902
|
"height",
|
|
3901
3903
|
"preventAutoFocus",
|
|
3902
|
-
"fitContent"
|
|
3904
|
+
"fitContent",
|
|
3905
|
+
"titleTypography"
|
|
3903
3906
|
]);
|
|
3904
3907
|
const { onOpenChange } = props;
|
|
3905
3908
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_radix_ui.Dialog.Root, __spreadProps(__spreadValues({}, props), { children: [
|
|
@@ -3923,7 +3926,7 @@ function Modal(_a) {
|
|
|
3923
3926
|
}, maxHeight !== void 0 && { maxHeight }), height !== void 0 && { height }), fitContent && height === void 0 && { height: "fit-content" }),
|
|
3924
3927
|
children: [
|
|
3925
3928
|
title && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ModalHeaderStyled, { children: [
|
|
3926
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalTitleStyled, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { typography:
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalTitleStyled, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Text, { typography: titleTypography, fontWeight: "medium", children: title }) }),
|
|
3927
3930
|
(onOpenChange || trigger) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_radix_ui.Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ModalIconClose, { name: "close", size: "xl" }) })
|
|
3928
3931
|
] }),
|
|
3929
3932
|
children
|
|
@@ -10049,7 +10052,26 @@ var useToast = () => {
|
|
|
10049
10052
|
};
|
|
10050
10053
|
|
|
10051
10054
|
// src/components/Tooltip/index.tsx
|
|
10055
|
+
var React10 = __toESM(require("react"));
|
|
10052
10056
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
10057
|
+
|
|
10058
|
+
// src/hooks/useHasHover.ts
|
|
10059
|
+
var import_react18 = require("react");
|
|
10060
|
+
function useHasHover() {
|
|
10061
|
+
const [hasHover, setHasHover] = (0, import_react18.useState)(true);
|
|
10062
|
+
(0, import_react18.useEffect)(() => {
|
|
10063
|
+
const media = window.matchMedia("(hover: hover)");
|
|
10064
|
+
setHasHover(media.matches);
|
|
10065
|
+
const listener = (event) => {
|
|
10066
|
+
setHasHover(event.matches);
|
|
10067
|
+
};
|
|
10068
|
+
media.addEventListener("change", listener);
|
|
10069
|
+
return () => media.removeEventListener("change", listener);
|
|
10070
|
+
}, []);
|
|
10071
|
+
return hasHover;
|
|
10072
|
+
}
|
|
10073
|
+
|
|
10074
|
+
// src/components/Tooltip/index.tsx
|
|
10053
10075
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
10054
10076
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
10055
10077
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
@@ -10083,35 +10105,78 @@ var TooltipContent = styled(TooltipPrimitive.Content, {
|
|
|
10083
10105
|
var TooltipArrow = styled(TooltipPrimitive.Arrow, {
|
|
10084
10106
|
fill: "$dark800"
|
|
10085
10107
|
});
|
|
10108
|
+
function mergeTouchTriggerProps(child, onToggle) {
|
|
10109
|
+
return React10.cloneElement(child, {
|
|
10110
|
+
onClick: (event) => {
|
|
10111
|
+
var _a, _b;
|
|
10112
|
+
(_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, event);
|
|
10113
|
+
if (!event.defaultPrevented) {
|
|
10114
|
+
onToggle();
|
|
10115
|
+
}
|
|
10116
|
+
}
|
|
10117
|
+
});
|
|
10118
|
+
}
|
|
10086
10119
|
function Tooltip({
|
|
10087
10120
|
children,
|
|
10088
10121
|
content,
|
|
10089
10122
|
delayDuration = 200,
|
|
10090
|
-
side = "top"
|
|
10123
|
+
side = "top",
|
|
10124
|
+
supportMobileTap = true
|
|
10091
10125
|
}) {
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10126
|
+
const hasHover = useHasHover();
|
|
10127
|
+
const [open, setOpen] = React10.useState(false);
|
|
10128
|
+
const isTouchToggleRef = React10.useRef(false);
|
|
10129
|
+
const useTouchBehavior = supportMobileTap && !hasHover;
|
|
10130
|
+
const handleTouchOpenChange = React10.useCallback((nextOpen) => {
|
|
10131
|
+
if (isTouchToggleRef.current) {
|
|
10132
|
+
isTouchToggleRef.current = false;
|
|
10133
|
+
return;
|
|
10134
|
+
}
|
|
10135
|
+
setOpen(nextOpen);
|
|
10136
|
+
}, []);
|
|
10137
|
+
const triggerChild = React10.useMemo(() => {
|
|
10138
|
+
if (!useTouchBehavior || !React10.isValidElement(children)) {
|
|
10139
|
+
return children;
|
|
10140
|
+
}
|
|
10141
|
+
return mergeTouchTriggerProps(
|
|
10142
|
+
children,
|
|
10143
|
+
() => {
|
|
10144
|
+
isTouchToggleRef.current = true;
|
|
10145
|
+
setOpen((prev) => !prev);
|
|
10146
|
+
}
|
|
10147
|
+
);
|
|
10148
|
+
}, [children, useTouchBehavior]);
|
|
10149
|
+
const tooltipContent = typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { typography: "tooltip", color: "grey50", children: content }) : content;
|
|
10150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
10151
|
+
TooltipRoot,
|
|
10152
|
+
__spreadProps(__spreadValues({
|
|
10153
|
+
delayDuration: useTouchBehavior ? 0 : delayDuration
|
|
10154
|
+
}, useTouchBehavior ? { open, onOpenChange: handleTouchOpenChange } : {}), {
|
|
10155
|
+
children: [
|
|
10156
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: triggerChild }),
|
|
10157
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { side, sideOffset: 5, children: [
|
|
10158
|
+
tooltipContent,
|
|
10159
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipArrow, {})
|
|
10160
|
+
] })
|
|
10161
|
+
]
|
|
10162
|
+
})
|
|
10163
|
+
) });
|
|
10099
10164
|
}
|
|
10100
10165
|
|
|
10101
10166
|
// src/components/MultiSelect/index.tsx
|
|
10102
|
-
var
|
|
10167
|
+
var import_react20 = __toESM(require("react"));
|
|
10103
10168
|
var import_themes19 = require("@radix-ui/themes");
|
|
10104
10169
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
10105
10170
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
10106
|
-
var
|
|
10171
|
+
var import_react21 = require("react");
|
|
10107
10172
|
|
|
10108
10173
|
// src/hooks/useMediaQuery.ts
|
|
10109
|
-
var
|
|
10174
|
+
var import_react19 = require("react");
|
|
10110
10175
|
function useMediaQuery(query) {
|
|
10111
|
-
const [matches, setMatches] = (0,
|
|
10176
|
+
const [matches, setMatches] = (0, import_react19.useState)(
|
|
10112
10177
|
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
10113
10178
|
);
|
|
10114
|
-
(0,
|
|
10179
|
+
(0, import_react19.useEffect)(() => {
|
|
10115
10180
|
const media = window.matchMedia(query);
|
|
10116
10181
|
const listener = (event) => setMatches(event.matches);
|
|
10117
10182
|
setMatches(media.matches);
|
|
@@ -10285,7 +10350,7 @@ var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
|
10285
10350
|
var MOBILE_MODAL_MAX_HEIGHT = "90vh";
|
|
10286
10351
|
var MOBILE_MODAL_HEADER_OFFSET = "65px";
|
|
10287
10352
|
var MOBILE_BREAKPOINT = "(max-width: 840px)";
|
|
10288
|
-
var MultiSelect =
|
|
10353
|
+
var MultiSelect = import_react20.default.forwardRef(
|
|
10289
10354
|
({
|
|
10290
10355
|
placeholder,
|
|
10291
10356
|
value: selectedValues = [],
|
|
@@ -10308,12 +10373,12 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10308
10373
|
showMoreButtonOnClick,
|
|
10309
10374
|
helperTextAfterField = ""
|
|
10310
10375
|
}, fowardedRef) => {
|
|
10311
|
-
const [isOpen, setIsOpen] = (0,
|
|
10312
|
-
const triggerRef = (0,
|
|
10313
|
-
const [allOptionsSelected, setAllOptionsSelected] = (0,
|
|
10376
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
10377
|
+
const triggerRef = (0, import_react20.useRef)(null);
|
|
10378
|
+
const [allOptionsSelected, setAllOptionsSelected] = (0, import_react20.useState)(false);
|
|
10314
10379
|
const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
|
|
10315
10380
|
const hasSections = !!(optionsBySection == null ? void 0 : optionsBySection.length);
|
|
10316
|
-
const resolvedOptions = (0,
|
|
10381
|
+
const resolvedOptions = (0, import_react21.useMemo)(() => {
|
|
10317
10382
|
if (hasSections) {
|
|
10318
10383
|
return optionsBySection.reduce(
|
|
10319
10384
|
(acc, section) => acc.concat(section.options),
|
|
@@ -10322,21 +10387,21 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10322
10387
|
}
|
|
10323
10388
|
return options;
|
|
10324
10389
|
}, [hasSections, options, optionsBySection]);
|
|
10325
|
-
const labelByValue = (0,
|
|
10390
|
+
const labelByValue = (0, import_react21.useMemo)(() => {
|
|
10326
10391
|
return resolvedOptions.reduce((prev, curr) => {
|
|
10327
10392
|
return __spreadProps(__spreadValues({}, prev), {
|
|
10328
10393
|
[curr.value]: curr.label
|
|
10329
10394
|
});
|
|
10330
10395
|
}, {});
|
|
10331
10396
|
}, [resolvedOptions]);
|
|
10332
|
-
const handleRemove = (0,
|
|
10397
|
+
const handleRemove = (0, import_react20.useCallback)(
|
|
10333
10398
|
(value) => {
|
|
10334
10399
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
10335
10400
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
10336
10401
|
},
|
|
10337
10402
|
[selectedValues, onValueChange]
|
|
10338
10403
|
);
|
|
10339
|
-
const handleSelectAll = (0,
|
|
10404
|
+
const handleSelectAll = (0, import_react20.useCallback)(
|
|
10340
10405
|
(e) => {
|
|
10341
10406
|
e.preventDefault();
|
|
10342
10407
|
e.stopPropagation();
|
|
@@ -10351,7 +10416,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10351
10416
|
},
|
|
10352
10417
|
[selectedValues, resolvedOptions, onValueChange]
|
|
10353
10418
|
);
|
|
10354
|
-
const text = (0,
|
|
10419
|
+
const text = (0, import_react21.useMemo)(() => {
|
|
10355
10420
|
if (selectedValues.length > 0 && singleSelect) {
|
|
10356
10421
|
const value = selectedValues[0];
|
|
10357
10422
|
return labelByValue[value];
|
|
@@ -10362,7 +10427,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10362
10427
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
10363
10428
|
setIsOpen(false);
|
|
10364
10429
|
};
|
|
10365
|
-
const handleToggle = (0,
|
|
10430
|
+
const handleToggle = (0, import_react20.useCallback)(
|
|
10366
10431
|
(e) => {
|
|
10367
10432
|
e.preventDefault();
|
|
10368
10433
|
e.stopPropagation();
|
|
@@ -10441,7 +10506,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10441
10506
|
);
|
|
10442
10507
|
const renderCheckboxOptions = () => {
|
|
10443
10508
|
if (hasSections) {
|
|
10444
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10509
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
|
|
10445
10510
|
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10446
10511
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10447
10512
|
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}`))
|
|
@@ -10451,7 +10516,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10451
10516
|
};
|
|
10452
10517
|
const renderSingleSelectOptions = () => {
|
|
10453
10518
|
if (hasSections) {
|
|
10454
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10519
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
|
|
10455
10520
|
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10456
10521
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10457
10522
|
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}`))
|
|
@@ -10507,6 +10572,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10507
10572
|
maxHeight: MOBILE_MODAL_MAX_HEIGHT,
|
|
10508
10573
|
zIndex: modalZIndex,
|
|
10509
10574
|
preventAutoFocus: true,
|
|
10575
|
+
titleTypography: "headline8",
|
|
10510
10576
|
fitContent: true,
|
|
10511
10577
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
10512
10578
|
StyledModalOptionsWrapper,
|
|
@@ -10616,7 +10682,7 @@ var Divider = styled("div", {
|
|
|
10616
10682
|
});
|
|
10617
10683
|
|
|
10618
10684
|
// src/components/ToggleElement/index.tsx
|
|
10619
|
-
var
|
|
10685
|
+
var import_react22 = require("react");
|
|
10620
10686
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10621
10687
|
function ToggleElement({
|
|
10622
10688
|
children,
|
|
@@ -10628,7 +10694,7 @@ function ToggleElement({
|
|
|
10628
10694
|
buttonProps,
|
|
10629
10695
|
onOpenChange
|
|
10630
10696
|
}) {
|
|
10631
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
10697
|
+
const [internalOpen, setInternalOpen] = (0, import_react22.useState)(defaultOpen);
|
|
10632
10698
|
const isControlled = open !== void 0;
|
|
10633
10699
|
const isOpen = isControlled ? open : internalOpen;
|
|
10634
10700
|
const handleClick = () => {
|
|
@@ -10950,7 +11016,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10950
11016
|
|
|
10951
11017
|
// src/components/FormFields/TextFormField.tsx
|
|
10952
11018
|
var import_react_hook_form2 = require("react-hook-form");
|
|
10953
|
-
var
|
|
11019
|
+
var import_react23 = require("react");
|
|
10954
11020
|
var import_mask2 = require("@react-input/mask");
|
|
10955
11021
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10956
11022
|
var TextFormField = (_a) => {
|
|
@@ -10973,7 +11039,7 @@ var TextFormField = (_a) => {
|
|
|
10973
11039
|
"onChange",
|
|
10974
11040
|
"valueFormatter"
|
|
10975
11041
|
]);
|
|
10976
|
-
const handleValidate = (0,
|
|
11042
|
+
const handleValidate = (0, import_react23.useCallback)(
|
|
10977
11043
|
(value) => {
|
|
10978
11044
|
var _a2;
|
|
10979
11045
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10995,7 +11061,7 @@ var TextFormField = (_a) => {
|
|
|
10995
11061
|
const haveError = !!fieldError;
|
|
10996
11062
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10997
11063
|
const { value: formValue, onChange: formChange } = field;
|
|
10998
|
-
const formattedValue = (0,
|
|
11064
|
+
const formattedValue = (0, import_react23.useMemo)(() => {
|
|
10999
11065
|
let value = formValue;
|
|
11000
11066
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
11001
11067
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -11607,7 +11673,7 @@ function StateFormField({
|
|
|
11607
11673
|
}
|
|
11608
11674
|
|
|
11609
11675
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
11610
|
-
var
|
|
11676
|
+
var import_react24 = require("react");
|
|
11611
11677
|
var import_react_hook_form7 = require("react-hook-form");
|
|
11612
11678
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11613
11679
|
function CityFormField({
|
|
@@ -11620,9 +11686,9 @@ function CityFormField({
|
|
|
11620
11686
|
}) {
|
|
11621
11687
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
11622
11688
|
const selectedState = watch(stateName);
|
|
11623
|
-
const [cities, setCities] = (0,
|
|
11624
|
-
const [loading, setLoading] = (0,
|
|
11625
|
-
(0,
|
|
11689
|
+
const [cities, setCities] = (0, import_react24.useState)([]);
|
|
11690
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
11691
|
+
(0, import_react24.useEffect)(() => {
|
|
11626
11692
|
if (!isBrazil) {
|
|
11627
11693
|
setCities([]);
|
|
11628
11694
|
return;
|
|
@@ -12008,10 +12074,10 @@ var EmailFormField = ({
|
|
|
12008
12074
|
var import_react_hook_form12 = require("react-hook-form");
|
|
12009
12075
|
|
|
12010
12076
|
// src/components/RichEditor/RichEditor.tsx
|
|
12011
|
-
var
|
|
12077
|
+
var import_react26 = require("react");
|
|
12012
12078
|
|
|
12013
12079
|
// src/components/RichEditor/QuillComponent.tsx
|
|
12014
|
-
var
|
|
12080
|
+
var import_react25 = require("react");
|
|
12015
12081
|
var import_react_quilljs = require("react-quilljs");
|
|
12016
12082
|
|
|
12017
12083
|
// src/utils/uploadService.ts
|
|
@@ -13214,12 +13280,12 @@ var QuillComponent = ({
|
|
|
13214
13280
|
onCharacterCountChange,
|
|
13215
13281
|
maxLength
|
|
13216
13282
|
}) => {
|
|
13217
|
-
const [showVideoModal, setShowVideoModal] = (0,
|
|
13218
|
-
const [videoUrl, setVideoUrl] = (0,
|
|
13219
|
-
const [showLinkModal, setShowLinkModal] = (0,
|
|
13220
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
13221
|
-
const videoModalRef = (0,
|
|
13222
|
-
const linkModalRef = (0,
|
|
13283
|
+
const [showVideoModal, setShowVideoModal] = (0, import_react25.useState)(false);
|
|
13284
|
+
const [videoUrl, setVideoUrl] = (0, import_react25.useState)("");
|
|
13285
|
+
const [showLinkModal, setShowLinkModal] = (0, import_react25.useState)(false);
|
|
13286
|
+
const [linkUrl, setLinkUrl] = (0, import_react25.useState)("");
|
|
13287
|
+
const videoModalRef = (0, import_react25.useRef)(null);
|
|
13288
|
+
const linkModalRef = (0, import_react25.useRef)(null);
|
|
13223
13289
|
const { addToast, removeToast } = useToast();
|
|
13224
13290
|
const formatHTML = (html) => {
|
|
13225
13291
|
const parser = new DOMParser();
|
|
@@ -13238,7 +13304,7 @@ var QuillComponent = ({
|
|
|
13238
13304
|
placeholder,
|
|
13239
13305
|
readOnly: disabled
|
|
13240
13306
|
});
|
|
13241
|
-
const handleImageUpload = (0,
|
|
13307
|
+
const handleImageUpload = (0, import_react25.useCallback)(
|
|
13242
13308
|
(file) => __async(null, null, function* () {
|
|
13243
13309
|
if (disabled || !quill || !uploadConfig) return;
|
|
13244
13310
|
try {
|
|
@@ -13270,7 +13336,7 @@ var QuillComponent = ({
|
|
|
13270
13336
|
}),
|
|
13271
13337
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
13272
13338
|
);
|
|
13273
|
-
(0,
|
|
13339
|
+
(0, import_react25.useEffect)(() => {
|
|
13274
13340
|
if (!quill) return;
|
|
13275
13341
|
if (value !== void 0 && value !== null) {
|
|
13276
13342
|
const currentContent = quill.root.innerHTML;
|
|
@@ -13286,7 +13352,7 @@ var QuillComponent = ({
|
|
|
13286
13352
|
}
|
|
13287
13353
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(quill.getText().trim().length);
|
|
13288
13354
|
}, [quill, value, onCharacterCountChange]);
|
|
13289
|
-
(0,
|
|
13355
|
+
(0, import_react25.useEffect)(() => {
|
|
13290
13356
|
if (quill) {
|
|
13291
13357
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
13292
13358
|
if (source === "user") {
|
|
@@ -13347,7 +13413,7 @@ var QuillComponent = ({
|
|
|
13347
13413
|
}, 2e3);
|
|
13348
13414
|
}
|
|
13349
13415
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
|
|
13350
|
-
(0,
|
|
13416
|
+
(0, import_react25.useEffect)(() => {
|
|
13351
13417
|
if (quill) {
|
|
13352
13418
|
quill.enable(!disabled);
|
|
13353
13419
|
if (!disabled) {
|
|
@@ -13358,11 +13424,11 @@ var QuillComponent = ({
|
|
|
13358
13424
|
}
|
|
13359
13425
|
}
|
|
13360
13426
|
}, [quill, disabled]);
|
|
13361
|
-
const handleLinkCancel = (0,
|
|
13427
|
+
const handleLinkCancel = (0, import_react25.useCallback)(() => {
|
|
13362
13428
|
setLinkUrl("");
|
|
13363
13429
|
setShowLinkModal(false);
|
|
13364
13430
|
}, []);
|
|
13365
|
-
const handleLinkSubmit = (0,
|
|
13431
|
+
const handleLinkSubmit = (0, import_react25.useCallback)(() => {
|
|
13366
13432
|
if (!linkUrl.trim() || !quill) return;
|
|
13367
13433
|
const url = linkUrl.trim();
|
|
13368
13434
|
const selection = quill.getSelection();
|
|
@@ -13377,11 +13443,11 @@ var QuillComponent = ({
|
|
|
13377
13443
|
setLinkUrl("");
|
|
13378
13444
|
setShowLinkModal(false);
|
|
13379
13445
|
}, [linkUrl, quill]);
|
|
13380
|
-
const handleVideoCancel = (0,
|
|
13446
|
+
const handleVideoCancel = (0, import_react25.useCallback)(() => {
|
|
13381
13447
|
setVideoUrl("");
|
|
13382
13448
|
setShowVideoModal(false);
|
|
13383
13449
|
}, []);
|
|
13384
|
-
const handleVideoSubmit = (0,
|
|
13450
|
+
const handleVideoSubmit = (0, import_react25.useCallback)(() => {
|
|
13385
13451
|
var _a, _b;
|
|
13386
13452
|
if (!videoUrl.trim() || !quill) return;
|
|
13387
13453
|
let processedUrl = videoUrl.trim();
|
|
@@ -13414,7 +13480,7 @@ var QuillComponent = ({
|
|
|
13414
13480
|
setVideoUrl("");
|
|
13415
13481
|
setShowVideoModal(false);
|
|
13416
13482
|
}, [videoUrl, quill]);
|
|
13417
|
-
(0,
|
|
13483
|
+
(0, import_react25.useEffect)(() => {
|
|
13418
13484
|
const handleClickOutside = (event) => {
|
|
13419
13485
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
13420
13486
|
handleVideoCancel();
|
|
@@ -13576,8 +13642,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
13576
13642
|
// src/components/RichEditor/RichEditor.tsx
|
|
13577
13643
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
13578
13644
|
var RichEditor = (props) => {
|
|
13579
|
-
const [isClient, setIsClient] = (0,
|
|
13580
|
-
(0,
|
|
13645
|
+
const [isClient, setIsClient] = (0, import_react26.useState)(false);
|
|
13646
|
+
(0, import_react26.useEffect)(() => {
|
|
13581
13647
|
setIsClient(typeof window !== "undefined");
|
|
13582
13648
|
}, []);
|
|
13583
13649
|
if (!isClient) return null;
|
|
@@ -13599,7 +13665,7 @@ var RichTextPresenter = ({ richText }) => {
|
|
|
13599
13665
|
var RichTextPresenter_default = RichTextPresenter;
|
|
13600
13666
|
|
|
13601
13667
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
13602
|
-
var
|
|
13668
|
+
var import_react27 = require("react");
|
|
13603
13669
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
13604
13670
|
var getPlainTextLengthFromHtml = (html) => {
|
|
13605
13671
|
var _a, _b;
|
|
@@ -13648,7 +13714,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13648
13714
|
}
|
|
13649
13715
|
}
|
|
13650
13716
|
});
|
|
13651
|
-
const [caracterQuantity, setCaracterQuantity] = (0,
|
|
13717
|
+
const [caracterQuantity, setCaracterQuantity] = (0, import_react27.useState)(
|
|
13652
13718
|
() => getRemainingCharacters(maxLength, field.value)
|
|
13653
13719
|
);
|
|
13654
13720
|
const handleCharacterCountChange = (count) => {
|
|
@@ -13656,7 +13722,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13656
13722
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
13657
13723
|
}
|
|
13658
13724
|
};
|
|
13659
|
-
(0,
|
|
13725
|
+
(0, import_react27.useEffect)(() => {
|
|
13660
13726
|
setCaracterQuantity(getRemainingCharacters(maxLength, field.value));
|
|
13661
13727
|
}, [field.value, maxLength]);
|
|
13662
13728
|
const fieldError = fieldState.error;
|
|
@@ -13702,7 +13768,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13702
13768
|
|
|
13703
13769
|
// src/components/FormFields/CalendarFormField.tsx
|
|
13704
13770
|
var import_react_hook_form13 = require("react-hook-form");
|
|
13705
|
-
var
|
|
13771
|
+
var import_react28 = require("react");
|
|
13706
13772
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
13707
13773
|
var CalendarFormField = (_a) => {
|
|
13708
13774
|
var _b = _a, {
|
|
@@ -13728,7 +13794,7 @@ var CalendarFormField = (_a) => {
|
|
|
13728
13794
|
"maxYearsFromNow",
|
|
13729
13795
|
"maxDate"
|
|
13730
13796
|
]);
|
|
13731
|
-
const handleValidate = (0,
|
|
13797
|
+
const handleValidate = (0, import_react28.useCallback)(
|
|
13732
13798
|
(value) => {
|
|
13733
13799
|
var _a2;
|
|
13734
13800
|
if (value === void 0 || value === null) {
|
|
@@ -13783,7 +13849,7 @@ var CalendarFormField = (_a) => {
|
|
|
13783
13849
|
};
|
|
13784
13850
|
|
|
13785
13851
|
// src/components/FormFields/DoubleCalendarFormField.tsx
|
|
13786
|
-
var
|
|
13852
|
+
var import_react29 = require("react");
|
|
13787
13853
|
var import_react_hook_form14 = require("react-hook-form");
|
|
13788
13854
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
13789
13855
|
var DoubleCalendarFormField = (_a) => {
|
|
@@ -13810,7 +13876,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13810
13876
|
"maxDate",
|
|
13811
13877
|
"disabled"
|
|
13812
13878
|
]);
|
|
13813
|
-
const handleValidate = (0,
|
|
13879
|
+
const handleValidate = (0, import_react29.useCallback)(
|
|
13814
13880
|
(value) => {
|
|
13815
13881
|
var _a2;
|
|
13816
13882
|
if (value === void 0 || value === null) {
|
|
@@ -13859,7 +13925,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13859
13925
|
|
|
13860
13926
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
13861
13927
|
var import_react_hook_form15 = require("react-hook-form");
|
|
13862
|
-
var
|
|
13928
|
+
var import_react30 = require("react");
|
|
13863
13929
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
13864
13930
|
var TimePickerFormField = (_a) => {
|
|
13865
13931
|
var _b = _a, {
|
|
@@ -13877,7 +13943,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13877
13943
|
"validationErrorMessage",
|
|
13878
13944
|
"rules"
|
|
13879
13945
|
]);
|
|
13880
|
-
const handleValidate = (0,
|
|
13946
|
+
const handleValidate = (0, import_react30.useCallback)(
|
|
13881
13947
|
(value) => {
|
|
13882
13948
|
var _a2;
|
|
13883
13949
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13930,7 +13996,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13930
13996
|
|
|
13931
13997
|
// src/components/FormFields/DateAndTimeFormField.tsx
|
|
13932
13998
|
var import_react_hook_form16 = require("react-hook-form");
|
|
13933
|
-
var
|
|
13999
|
+
var import_react31 = require("react");
|
|
13934
14000
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
13935
14001
|
var DateAndTimeFormField = (_a) => {
|
|
13936
14002
|
var _b = _a, {
|
|
@@ -13959,7 +14025,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13959
14025
|
"maxDate"
|
|
13960
14026
|
]);
|
|
13961
14027
|
const { addToast } = useToast();
|
|
13962
|
-
const handleDisabledClick = (0,
|
|
14028
|
+
const handleDisabledClick = (0, import_react31.useCallback)(
|
|
13963
14029
|
(event) => {
|
|
13964
14030
|
if (!disabled) return;
|
|
13965
14031
|
event.preventDefault();
|
|
@@ -13972,7 +14038,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13972
14038
|
},
|
|
13973
14039
|
[addToast, disabled, disabledInfo]
|
|
13974
14040
|
);
|
|
13975
|
-
const handleDisabledMouseDown = (0,
|
|
14041
|
+
const handleDisabledMouseDown = (0, import_react31.useCallback)(
|
|
13976
14042
|
(event) => {
|
|
13977
14043
|
if (!disabled) return;
|
|
13978
14044
|
event.preventDefault();
|
|
@@ -13980,7 +14046,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13980
14046
|
},
|
|
13981
14047
|
[disabled]
|
|
13982
14048
|
);
|
|
13983
|
-
const handleValidate = (0,
|
|
14049
|
+
const handleValidate = (0, import_react31.useCallback)(
|
|
13984
14050
|
(value) => {
|
|
13985
14051
|
var _a2;
|
|
13986
14052
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -14003,7 +14069,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14003
14069
|
const haveError = !!fieldError;
|
|
14004
14070
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
14005
14071
|
const { value: isoValue, onChange: setIsoValue } = field;
|
|
14006
|
-
const { selectedDateFromIso, selectedTimeFromIso } = (0,
|
|
14072
|
+
const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react31.useMemo)(() => {
|
|
14007
14073
|
if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
14008
14074
|
try {
|
|
14009
14075
|
const date = new Date(isoValue);
|
|
@@ -14018,13 +14084,13 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14018
14084
|
return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
14019
14085
|
}
|
|
14020
14086
|
}, [isoValue]);
|
|
14021
|
-
const [draftDate, setDraftDate] = (0,
|
|
14022
|
-
const [draftTime, setDraftTime] = (0,
|
|
14023
|
-
(0,
|
|
14087
|
+
const [draftDate, setDraftDate] = (0, import_react31.useState)(selectedDateFromIso);
|
|
14088
|
+
const [draftTime, setDraftTime] = (0, import_react31.useState)(selectedTimeFromIso);
|
|
14089
|
+
(0, import_react31.useEffect)(() => {
|
|
14024
14090
|
setDraftDate(selectedDateFromIso);
|
|
14025
14091
|
setDraftTime(selectedTimeFromIso);
|
|
14026
14092
|
}, [selectedDateFromIso, selectedTimeFromIso]);
|
|
14027
|
-
const combineDateTime = (0,
|
|
14093
|
+
const combineDateTime = (0, import_react31.useCallback)(
|
|
14028
14094
|
(date, time) => {
|
|
14029
14095
|
if (!date) {
|
|
14030
14096
|
setIsoValue("");
|
|
@@ -14111,11 +14177,11 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14111
14177
|
};
|
|
14112
14178
|
|
|
14113
14179
|
// src/hooks/useImageUpload.ts
|
|
14114
|
-
var
|
|
14180
|
+
var import_react32 = require("react");
|
|
14115
14181
|
var useImageUpload = (options) => {
|
|
14116
|
-
const [isUploading, setIsUploading] = (0,
|
|
14117
|
-
const [progress, setProgress] = (0,
|
|
14118
|
-
const [error, setError] = (0,
|
|
14182
|
+
const [isUploading, setIsUploading] = (0, import_react32.useState)(false);
|
|
14183
|
+
const [progress, setProgress] = (0, import_react32.useState)(null);
|
|
14184
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
14119
14185
|
const {
|
|
14120
14186
|
onSuccess,
|
|
14121
14187
|
onError,
|
|
@@ -14125,7 +14191,7 @@ var useImageUpload = (options) => {
|
|
|
14125
14191
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
14126
14192
|
uploadConfig
|
|
14127
14193
|
} = options;
|
|
14128
|
-
const validateFile = (0,
|
|
14194
|
+
const validateFile = (0, import_react32.useCallback)(
|
|
14129
14195
|
(file) => {
|
|
14130
14196
|
if (!allowedTypes.includes(file.type)) {
|
|
14131
14197
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -14143,7 +14209,7 @@ var useImageUpload = (options) => {
|
|
|
14143
14209
|
},
|
|
14144
14210
|
[allowedTypes, maxFileSize, onError]
|
|
14145
14211
|
);
|
|
14146
|
-
const uploadFile = (0,
|
|
14212
|
+
const uploadFile = (0, import_react32.useCallback)(
|
|
14147
14213
|
(file) => __async(null, null, function* () {
|
|
14148
14214
|
if (!validateFile(file)) {
|
|
14149
14215
|
return null;
|
|
@@ -14196,7 +14262,7 @@ var useImageUpload = (options) => {
|
|
|
14196
14262
|
}),
|
|
14197
14263
|
[validateFile, onSuccess, onError, onProgress]
|
|
14198
14264
|
);
|
|
14199
|
-
const reset = (0,
|
|
14265
|
+
const reset = (0, import_react32.useCallback)(() => {
|
|
14200
14266
|
setIsUploading(false);
|
|
14201
14267
|
setProgress(null);
|
|
14202
14268
|
setError(null);
|