@lets-events/react 12.11.0 → 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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +145 -82
- package/dist/index.mjs +145 -82
- package/package.json +1 -1
- package/src/components/Modal.tsx +1 -0
- package/src/components/Tooltip/index.tsx +62 -9
- package/src/hooks/useHasHover.ts +21 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @lets-events/react@12.11.
|
|
3
|
+
> @lets-events/react@12.11.1 build
|
|
4
4
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
5
5
|
|
|
6
6
|
[1G[0K[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
[34mCLI[39m Target: es6
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m437.94 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 305ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m421.87 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 305ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
19
|
-
DTS dist/index.d.mts 411.
|
|
20
|
-
DTS dist/index.d.ts 411.
|
|
18
|
+
DTS ⚡️ Build success in 6455ms
|
|
19
|
+
DTS dist/index.d.mts 411.09 KB
|
|
20
|
+
DTS dist/index.d.ts 411.09 KB
|
|
21
21
|
[1G[0K⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -12952,8 +12952,9 @@ interface TooltipProps {
|
|
|
12952
12952
|
content: react.ReactNode;
|
|
12953
12953
|
delayDuration?: number;
|
|
12954
12954
|
side?: "top" | "right" | "bottom" | "left";
|
|
12955
|
+
supportMobileTap?: boolean;
|
|
12955
12956
|
}
|
|
12956
|
-
declare function Tooltip({ children, content, delayDuration, side, }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
12957
|
+
declare function Tooltip({ children, content, delayDuration, side, supportMobileTap, }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
12957
12958
|
|
|
12958
12959
|
declare const FlexStyled: _stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_radix_ui_themes.FlexProps & react.RefAttributes<HTMLDivElement>>, {
|
|
12959
12960
|
display?: "flex" | "inline-flex" | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -12952,8 +12952,9 @@ interface TooltipProps {
|
|
|
12952
12952
|
content: react.ReactNode;
|
|
12953
12953
|
delayDuration?: number;
|
|
12954
12954
|
side?: "top" | "right" | "bottom" | "left";
|
|
12955
|
+
supportMobileTap?: boolean;
|
|
12955
12956
|
}
|
|
12956
|
-
declare function Tooltip({ children, content, delayDuration, side, }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
12957
|
+
declare function Tooltip({ children, content, delayDuration, side, supportMobileTap, }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
12957
12958
|
|
|
12958
12959
|
declare const FlexStyled: _stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_radix_ui_themes.FlexProps & react.RefAttributes<HTMLDivElement>>, {
|
|
12959
12960
|
display?: "flex" | "inline-flex" | undefined;
|
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, {
|
|
@@ -10049,7 +10050,26 @@ var useToast = () => {
|
|
|
10049
10050
|
};
|
|
10050
10051
|
|
|
10051
10052
|
// src/components/Tooltip/index.tsx
|
|
10053
|
+
var React10 = __toESM(require("react"));
|
|
10052
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
|
|
10053
10073
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
10054
10074
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
10055
10075
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
@@ -10083,35 +10103,78 @@ var TooltipContent = styled(TooltipPrimitive.Content, {
|
|
|
10083
10103
|
var TooltipArrow = styled(TooltipPrimitive.Arrow, {
|
|
10084
10104
|
fill: "$dark800"
|
|
10085
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
|
+
}
|
|
10086
10117
|
function Tooltip({
|
|
10087
10118
|
children,
|
|
10088
10119
|
content,
|
|
10089
10120
|
delayDuration = 200,
|
|
10090
|
-
side = "top"
|
|
10121
|
+
side = "top",
|
|
10122
|
+
supportMobileTap = true
|
|
10091
10123
|
}) {
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
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
|
+
) });
|
|
10099
10162
|
}
|
|
10100
10163
|
|
|
10101
10164
|
// src/components/MultiSelect/index.tsx
|
|
10102
|
-
var
|
|
10165
|
+
var import_react20 = __toESM(require("react"));
|
|
10103
10166
|
var import_themes19 = require("@radix-ui/themes");
|
|
10104
10167
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
10105
10168
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
10106
|
-
var
|
|
10169
|
+
var import_react21 = require("react");
|
|
10107
10170
|
|
|
10108
10171
|
// src/hooks/useMediaQuery.ts
|
|
10109
|
-
var
|
|
10172
|
+
var import_react19 = require("react");
|
|
10110
10173
|
function useMediaQuery(query) {
|
|
10111
|
-
const [matches, setMatches] = (0,
|
|
10174
|
+
const [matches, setMatches] = (0, import_react19.useState)(
|
|
10112
10175
|
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
10113
10176
|
);
|
|
10114
|
-
(0,
|
|
10177
|
+
(0, import_react19.useEffect)(() => {
|
|
10115
10178
|
const media = window.matchMedia(query);
|
|
10116
10179
|
const listener = (event) => setMatches(event.matches);
|
|
10117
10180
|
setMatches(media.matches);
|
|
@@ -10285,7 +10348,7 @@ var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
|
10285
10348
|
var MOBILE_MODAL_MAX_HEIGHT = "90vh";
|
|
10286
10349
|
var MOBILE_MODAL_HEADER_OFFSET = "65px";
|
|
10287
10350
|
var MOBILE_BREAKPOINT = "(max-width: 840px)";
|
|
10288
|
-
var MultiSelect =
|
|
10351
|
+
var MultiSelect = import_react20.default.forwardRef(
|
|
10289
10352
|
({
|
|
10290
10353
|
placeholder,
|
|
10291
10354
|
value: selectedValues = [],
|
|
@@ -10308,12 +10371,12 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10308
10371
|
showMoreButtonOnClick,
|
|
10309
10372
|
helperTextAfterField = ""
|
|
10310
10373
|
}, fowardedRef) => {
|
|
10311
|
-
const [isOpen, setIsOpen] = (0,
|
|
10312
|
-
const triggerRef = (0,
|
|
10313
|
-
const [allOptionsSelected, setAllOptionsSelected] = (0,
|
|
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);
|
|
10314
10377
|
const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
|
|
10315
10378
|
const hasSections = !!(optionsBySection == null ? void 0 : optionsBySection.length);
|
|
10316
|
-
const resolvedOptions = (0,
|
|
10379
|
+
const resolvedOptions = (0, import_react21.useMemo)(() => {
|
|
10317
10380
|
if (hasSections) {
|
|
10318
10381
|
return optionsBySection.reduce(
|
|
10319
10382
|
(acc, section) => acc.concat(section.options),
|
|
@@ -10322,21 +10385,21 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10322
10385
|
}
|
|
10323
10386
|
return options;
|
|
10324
10387
|
}, [hasSections, options, optionsBySection]);
|
|
10325
|
-
const labelByValue = (0,
|
|
10388
|
+
const labelByValue = (0, import_react21.useMemo)(() => {
|
|
10326
10389
|
return resolvedOptions.reduce((prev, curr) => {
|
|
10327
10390
|
return __spreadProps(__spreadValues({}, prev), {
|
|
10328
10391
|
[curr.value]: curr.label
|
|
10329
10392
|
});
|
|
10330
10393
|
}, {});
|
|
10331
10394
|
}, [resolvedOptions]);
|
|
10332
|
-
const handleRemove = (0,
|
|
10395
|
+
const handleRemove = (0, import_react20.useCallback)(
|
|
10333
10396
|
(value) => {
|
|
10334
10397
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
10335
10398
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
10336
10399
|
},
|
|
10337
10400
|
[selectedValues, onValueChange]
|
|
10338
10401
|
);
|
|
10339
|
-
const handleSelectAll = (0,
|
|
10402
|
+
const handleSelectAll = (0, import_react20.useCallback)(
|
|
10340
10403
|
(e) => {
|
|
10341
10404
|
e.preventDefault();
|
|
10342
10405
|
e.stopPropagation();
|
|
@@ -10351,7 +10414,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10351
10414
|
},
|
|
10352
10415
|
[selectedValues, resolvedOptions, onValueChange]
|
|
10353
10416
|
);
|
|
10354
|
-
const text = (0,
|
|
10417
|
+
const text = (0, import_react21.useMemo)(() => {
|
|
10355
10418
|
if (selectedValues.length > 0 && singleSelect) {
|
|
10356
10419
|
const value = selectedValues[0];
|
|
10357
10420
|
return labelByValue[value];
|
|
@@ -10362,7 +10425,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10362
10425
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
10363
10426
|
setIsOpen(false);
|
|
10364
10427
|
};
|
|
10365
|
-
const handleToggle = (0,
|
|
10428
|
+
const handleToggle = (0, import_react20.useCallback)(
|
|
10366
10429
|
(e) => {
|
|
10367
10430
|
e.preventDefault();
|
|
10368
10431
|
e.stopPropagation();
|
|
@@ -10441,7 +10504,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10441
10504
|
);
|
|
10442
10505
|
const renderCheckboxOptions = () => {
|
|
10443
10506
|
if (hasSections) {
|
|
10444
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10507
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
|
|
10445
10508
|
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10446
10509
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10447
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}`))
|
|
@@ -10451,7 +10514,7 @@ var MultiSelect = import_react19.default.forwardRef(
|
|
|
10451
10514
|
};
|
|
10452
10515
|
const renderSingleSelectOptions = () => {
|
|
10453
10516
|
if (hasSections) {
|
|
10454
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
10517
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react20.default.Fragment, { children: [
|
|
10455
10518
|
sectionIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionDivider, {}),
|
|
10456
10519
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10457
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}`))
|
|
@@ -10616,7 +10679,7 @@ var Divider = styled("div", {
|
|
|
10616
10679
|
});
|
|
10617
10680
|
|
|
10618
10681
|
// src/components/ToggleElement/index.tsx
|
|
10619
|
-
var
|
|
10682
|
+
var import_react22 = require("react");
|
|
10620
10683
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10621
10684
|
function ToggleElement({
|
|
10622
10685
|
children,
|
|
@@ -10628,7 +10691,7 @@ function ToggleElement({
|
|
|
10628
10691
|
buttonProps,
|
|
10629
10692
|
onOpenChange
|
|
10630
10693
|
}) {
|
|
10631
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
10694
|
+
const [internalOpen, setInternalOpen] = (0, import_react22.useState)(defaultOpen);
|
|
10632
10695
|
const isControlled = open !== void 0;
|
|
10633
10696
|
const isOpen = isControlled ? open : internalOpen;
|
|
10634
10697
|
const handleClick = () => {
|
|
@@ -10950,7 +11013,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10950
11013
|
|
|
10951
11014
|
// src/components/FormFields/TextFormField.tsx
|
|
10952
11015
|
var import_react_hook_form2 = require("react-hook-form");
|
|
10953
|
-
var
|
|
11016
|
+
var import_react23 = require("react");
|
|
10954
11017
|
var import_mask2 = require("@react-input/mask");
|
|
10955
11018
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10956
11019
|
var TextFormField = (_a) => {
|
|
@@ -10973,7 +11036,7 @@ var TextFormField = (_a) => {
|
|
|
10973
11036
|
"onChange",
|
|
10974
11037
|
"valueFormatter"
|
|
10975
11038
|
]);
|
|
10976
|
-
const handleValidate = (0,
|
|
11039
|
+
const handleValidate = (0, import_react23.useCallback)(
|
|
10977
11040
|
(value) => {
|
|
10978
11041
|
var _a2;
|
|
10979
11042
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10995,7 +11058,7 @@ var TextFormField = (_a) => {
|
|
|
10995
11058
|
const haveError = !!fieldError;
|
|
10996
11059
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10997
11060
|
const { value: formValue, onChange: formChange } = field;
|
|
10998
|
-
const formattedValue = (0,
|
|
11061
|
+
const formattedValue = (0, import_react23.useMemo)(() => {
|
|
10999
11062
|
let value = formValue;
|
|
11000
11063
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
11001
11064
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -11607,7 +11670,7 @@ function StateFormField({
|
|
|
11607
11670
|
}
|
|
11608
11671
|
|
|
11609
11672
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
11610
|
-
var
|
|
11673
|
+
var import_react24 = require("react");
|
|
11611
11674
|
var import_react_hook_form7 = require("react-hook-form");
|
|
11612
11675
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11613
11676
|
function CityFormField({
|
|
@@ -11620,9 +11683,9 @@ function CityFormField({
|
|
|
11620
11683
|
}) {
|
|
11621
11684
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
11622
11685
|
const selectedState = watch(stateName);
|
|
11623
|
-
const [cities, setCities] = (0,
|
|
11624
|
-
const [loading, setLoading] = (0,
|
|
11625
|
-
(0,
|
|
11686
|
+
const [cities, setCities] = (0, import_react24.useState)([]);
|
|
11687
|
+
const [loading, setLoading] = (0, import_react24.useState)(false);
|
|
11688
|
+
(0, import_react24.useEffect)(() => {
|
|
11626
11689
|
if (!isBrazil) {
|
|
11627
11690
|
setCities([]);
|
|
11628
11691
|
return;
|
|
@@ -12008,10 +12071,10 @@ var EmailFormField = ({
|
|
|
12008
12071
|
var import_react_hook_form12 = require("react-hook-form");
|
|
12009
12072
|
|
|
12010
12073
|
// src/components/RichEditor/RichEditor.tsx
|
|
12011
|
-
var
|
|
12074
|
+
var import_react26 = require("react");
|
|
12012
12075
|
|
|
12013
12076
|
// src/components/RichEditor/QuillComponent.tsx
|
|
12014
|
-
var
|
|
12077
|
+
var import_react25 = require("react");
|
|
12015
12078
|
var import_react_quilljs = require("react-quilljs");
|
|
12016
12079
|
|
|
12017
12080
|
// src/utils/uploadService.ts
|
|
@@ -13214,12 +13277,12 @@ var QuillComponent = ({
|
|
|
13214
13277
|
onCharacterCountChange,
|
|
13215
13278
|
maxLength
|
|
13216
13279
|
}) => {
|
|
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,
|
|
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);
|
|
13223
13286
|
const { addToast, removeToast } = useToast();
|
|
13224
13287
|
const formatHTML = (html) => {
|
|
13225
13288
|
const parser = new DOMParser();
|
|
@@ -13238,7 +13301,7 @@ var QuillComponent = ({
|
|
|
13238
13301
|
placeholder,
|
|
13239
13302
|
readOnly: disabled
|
|
13240
13303
|
});
|
|
13241
|
-
const handleImageUpload = (0,
|
|
13304
|
+
const handleImageUpload = (0, import_react25.useCallback)(
|
|
13242
13305
|
(file) => __async(null, null, function* () {
|
|
13243
13306
|
if (disabled || !quill || !uploadConfig) return;
|
|
13244
13307
|
try {
|
|
@@ -13270,7 +13333,7 @@ var QuillComponent = ({
|
|
|
13270
13333
|
}),
|
|
13271
13334
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
13272
13335
|
);
|
|
13273
|
-
(0,
|
|
13336
|
+
(0, import_react25.useEffect)(() => {
|
|
13274
13337
|
if (!quill) return;
|
|
13275
13338
|
if (value !== void 0 && value !== null) {
|
|
13276
13339
|
const currentContent = quill.root.innerHTML;
|
|
@@ -13286,7 +13349,7 @@ var QuillComponent = ({
|
|
|
13286
13349
|
}
|
|
13287
13350
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(quill.getText().trim().length);
|
|
13288
13351
|
}, [quill, value, onCharacterCountChange]);
|
|
13289
|
-
(0,
|
|
13352
|
+
(0, import_react25.useEffect)(() => {
|
|
13290
13353
|
if (quill) {
|
|
13291
13354
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
13292
13355
|
if (source === "user") {
|
|
@@ -13347,7 +13410,7 @@ var QuillComponent = ({
|
|
|
13347
13410
|
}, 2e3);
|
|
13348
13411
|
}
|
|
13349
13412
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
|
|
13350
|
-
(0,
|
|
13413
|
+
(0, import_react25.useEffect)(() => {
|
|
13351
13414
|
if (quill) {
|
|
13352
13415
|
quill.enable(!disabled);
|
|
13353
13416
|
if (!disabled) {
|
|
@@ -13358,11 +13421,11 @@ var QuillComponent = ({
|
|
|
13358
13421
|
}
|
|
13359
13422
|
}
|
|
13360
13423
|
}, [quill, disabled]);
|
|
13361
|
-
const handleLinkCancel = (0,
|
|
13424
|
+
const handleLinkCancel = (0, import_react25.useCallback)(() => {
|
|
13362
13425
|
setLinkUrl("");
|
|
13363
13426
|
setShowLinkModal(false);
|
|
13364
13427
|
}, []);
|
|
13365
|
-
const handleLinkSubmit = (0,
|
|
13428
|
+
const handleLinkSubmit = (0, import_react25.useCallback)(() => {
|
|
13366
13429
|
if (!linkUrl.trim() || !quill) return;
|
|
13367
13430
|
const url = linkUrl.trim();
|
|
13368
13431
|
const selection = quill.getSelection();
|
|
@@ -13377,11 +13440,11 @@ var QuillComponent = ({
|
|
|
13377
13440
|
setLinkUrl("");
|
|
13378
13441
|
setShowLinkModal(false);
|
|
13379
13442
|
}, [linkUrl, quill]);
|
|
13380
|
-
const handleVideoCancel = (0,
|
|
13443
|
+
const handleVideoCancel = (0, import_react25.useCallback)(() => {
|
|
13381
13444
|
setVideoUrl("");
|
|
13382
13445
|
setShowVideoModal(false);
|
|
13383
13446
|
}, []);
|
|
13384
|
-
const handleVideoSubmit = (0,
|
|
13447
|
+
const handleVideoSubmit = (0, import_react25.useCallback)(() => {
|
|
13385
13448
|
var _a, _b;
|
|
13386
13449
|
if (!videoUrl.trim() || !quill) return;
|
|
13387
13450
|
let processedUrl = videoUrl.trim();
|
|
@@ -13414,7 +13477,7 @@ var QuillComponent = ({
|
|
|
13414
13477
|
setVideoUrl("");
|
|
13415
13478
|
setShowVideoModal(false);
|
|
13416
13479
|
}, [videoUrl, quill]);
|
|
13417
|
-
(0,
|
|
13480
|
+
(0, import_react25.useEffect)(() => {
|
|
13418
13481
|
const handleClickOutside = (event) => {
|
|
13419
13482
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
13420
13483
|
handleVideoCancel();
|
|
@@ -13576,8 +13639,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
13576
13639
|
// src/components/RichEditor/RichEditor.tsx
|
|
13577
13640
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
13578
13641
|
var RichEditor = (props) => {
|
|
13579
|
-
const [isClient, setIsClient] = (0,
|
|
13580
|
-
(0,
|
|
13642
|
+
const [isClient, setIsClient] = (0, import_react26.useState)(false);
|
|
13643
|
+
(0, import_react26.useEffect)(() => {
|
|
13581
13644
|
setIsClient(typeof window !== "undefined");
|
|
13582
13645
|
}, []);
|
|
13583
13646
|
if (!isClient) return null;
|
|
@@ -13599,7 +13662,7 @@ var RichTextPresenter = ({ richText }) => {
|
|
|
13599
13662
|
var RichTextPresenter_default = RichTextPresenter;
|
|
13600
13663
|
|
|
13601
13664
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
13602
|
-
var
|
|
13665
|
+
var import_react27 = require("react");
|
|
13603
13666
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
13604
13667
|
var getPlainTextLengthFromHtml = (html) => {
|
|
13605
13668
|
var _a, _b;
|
|
@@ -13648,7 +13711,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13648
13711
|
}
|
|
13649
13712
|
}
|
|
13650
13713
|
});
|
|
13651
|
-
const [caracterQuantity, setCaracterQuantity] = (0,
|
|
13714
|
+
const [caracterQuantity, setCaracterQuantity] = (0, import_react27.useState)(
|
|
13652
13715
|
() => getRemainingCharacters(maxLength, field.value)
|
|
13653
13716
|
);
|
|
13654
13717
|
const handleCharacterCountChange = (count) => {
|
|
@@ -13656,7 +13719,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13656
13719
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
13657
13720
|
}
|
|
13658
13721
|
};
|
|
13659
|
-
(0,
|
|
13722
|
+
(0, import_react27.useEffect)(() => {
|
|
13660
13723
|
setCaracterQuantity(getRemainingCharacters(maxLength, field.value));
|
|
13661
13724
|
}, [field.value, maxLength]);
|
|
13662
13725
|
const fieldError = fieldState.error;
|
|
@@ -13702,7 +13765,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13702
13765
|
|
|
13703
13766
|
// src/components/FormFields/CalendarFormField.tsx
|
|
13704
13767
|
var import_react_hook_form13 = require("react-hook-form");
|
|
13705
|
-
var
|
|
13768
|
+
var import_react28 = require("react");
|
|
13706
13769
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
13707
13770
|
var CalendarFormField = (_a) => {
|
|
13708
13771
|
var _b = _a, {
|
|
@@ -13728,7 +13791,7 @@ var CalendarFormField = (_a) => {
|
|
|
13728
13791
|
"maxYearsFromNow",
|
|
13729
13792
|
"maxDate"
|
|
13730
13793
|
]);
|
|
13731
|
-
const handleValidate = (0,
|
|
13794
|
+
const handleValidate = (0, import_react28.useCallback)(
|
|
13732
13795
|
(value) => {
|
|
13733
13796
|
var _a2;
|
|
13734
13797
|
if (value === void 0 || value === null) {
|
|
@@ -13783,7 +13846,7 @@ var CalendarFormField = (_a) => {
|
|
|
13783
13846
|
};
|
|
13784
13847
|
|
|
13785
13848
|
// src/components/FormFields/DoubleCalendarFormField.tsx
|
|
13786
|
-
var
|
|
13849
|
+
var import_react29 = require("react");
|
|
13787
13850
|
var import_react_hook_form14 = require("react-hook-form");
|
|
13788
13851
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
13789
13852
|
var DoubleCalendarFormField = (_a) => {
|
|
@@ -13810,7 +13873,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13810
13873
|
"maxDate",
|
|
13811
13874
|
"disabled"
|
|
13812
13875
|
]);
|
|
13813
|
-
const handleValidate = (0,
|
|
13876
|
+
const handleValidate = (0, import_react29.useCallback)(
|
|
13814
13877
|
(value) => {
|
|
13815
13878
|
var _a2;
|
|
13816
13879
|
if (value === void 0 || value === null) {
|
|
@@ -13859,7 +13922,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13859
13922
|
|
|
13860
13923
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
13861
13924
|
var import_react_hook_form15 = require("react-hook-form");
|
|
13862
|
-
var
|
|
13925
|
+
var import_react30 = require("react");
|
|
13863
13926
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
13864
13927
|
var TimePickerFormField = (_a) => {
|
|
13865
13928
|
var _b = _a, {
|
|
@@ -13877,7 +13940,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13877
13940
|
"validationErrorMessage",
|
|
13878
13941
|
"rules"
|
|
13879
13942
|
]);
|
|
13880
|
-
const handleValidate = (0,
|
|
13943
|
+
const handleValidate = (0, import_react30.useCallback)(
|
|
13881
13944
|
(value) => {
|
|
13882
13945
|
var _a2;
|
|
13883
13946
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13930,7 +13993,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13930
13993
|
|
|
13931
13994
|
// src/components/FormFields/DateAndTimeFormField.tsx
|
|
13932
13995
|
var import_react_hook_form16 = require("react-hook-form");
|
|
13933
|
-
var
|
|
13996
|
+
var import_react31 = require("react");
|
|
13934
13997
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
13935
13998
|
var DateAndTimeFormField = (_a) => {
|
|
13936
13999
|
var _b = _a, {
|
|
@@ -13959,7 +14022,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13959
14022
|
"maxDate"
|
|
13960
14023
|
]);
|
|
13961
14024
|
const { addToast } = useToast();
|
|
13962
|
-
const handleDisabledClick = (0,
|
|
14025
|
+
const handleDisabledClick = (0, import_react31.useCallback)(
|
|
13963
14026
|
(event) => {
|
|
13964
14027
|
if (!disabled) return;
|
|
13965
14028
|
event.preventDefault();
|
|
@@ -13972,7 +14035,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13972
14035
|
},
|
|
13973
14036
|
[addToast, disabled, disabledInfo]
|
|
13974
14037
|
);
|
|
13975
|
-
const handleDisabledMouseDown = (0,
|
|
14038
|
+
const handleDisabledMouseDown = (0, import_react31.useCallback)(
|
|
13976
14039
|
(event) => {
|
|
13977
14040
|
if (!disabled) return;
|
|
13978
14041
|
event.preventDefault();
|
|
@@ -13980,7 +14043,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13980
14043
|
},
|
|
13981
14044
|
[disabled]
|
|
13982
14045
|
);
|
|
13983
|
-
const handleValidate = (0,
|
|
14046
|
+
const handleValidate = (0, import_react31.useCallback)(
|
|
13984
14047
|
(value) => {
|
|
13985
14048
|
var _a2;
|
|
13986
14049
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -14003,7 +14066,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14003
14066
|
const haveError = !!fieldError;
|
|
14004
14067
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
14005
14068
|
const { value: isoValue, onChange: setIsoValue } = field;
|
|
14006
|
-
const { selectedDateFromIso, selectedTimeFromIso } = (0,
|
|
14069
|
+
const { selectedDateFromIso, selectedTimeFromIso } = (0, import_react31.useMemo)(() => {
|
|
14007
14070
|
if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
14008
14071
|
try {
|
|
14009
14072
|
const date = new Date(isoValue);
|
|
@@ -14018,13 +14081,13 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14018
14081
|
return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
14019
14082
|
}
|
|
14020
14083
|
}, [isoValue]);
|
|
14021
|
-
const [draftDate, setDraftDate] = (0,
|
|
14022
|
-
const [draftTime, setDraftTime] = (0,
|
|
14023
|
-
(0,
|
|
14084
|
+
const [draftDate, setDraftDate] = (0, import_react31.useState)(selectedDateFromIso);
|
|
14085
|
+
const [draftTime, setDraftTime] = (0, import_react31.useState)(selectedTimeFromIso);
|
|
14086
|
+
(0, import_react31.useEffect)(() => {
|
|
14024
14087
|
setDraftDate(selectedDateFromIso);
|
|
14025
14088
|
setDraftTime(selectedTimeFromIso);
|
|
14026
14089
|
}, [selectedDateFromIso, selectedTimeFromIso]);
|
|
14027
|
-
const combineDateTime = (0,
|
|
14090
|
+
const combineDateTime = (0, import_react31.useCallback)(
|
|
14028
14091
|
(date, time) => {
|
|
14029
14092
|
if (!date) {
|
|
14030
14093
|
setIsoValue("");
|
|
@@ -14111,11 +14174,11 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14111
14174
|
};
|
|
14112
14175
|
|
|
14113
14176
|
// src/hooks/useImageUpload.ts
|
|
14114
|
-
var
|
|
14177
|
+
var import_react32 = require("react");
|
|
14115
14178
|
var useImageUpload = (options) => {
|
|
14116
|
-
const [isUploading, setIsUploading] = (0,
|
|
14117
|
-
const [progress, setProgress] = (0,
|
|
14118
|
-
const [error, setError] = (0,
|
|
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);
|
|
14119
14182
|
const {
|
|
14120
14183
|
onSuccess,
|
|
14121
14184
|
onError,
|
|
@@ -14125,7 +14188,7 @@ var useImageUpload = (options) => {
|
|
|
14125
14188
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
14126
14189
|
uploadConfig
|
|
14127
14190
|
} = options;
|
|
14128
|
-
const validateFile = (0,
|
|
14191
|
+
const validateFile = (0, import_react32.useCallback)(
|
|
14129
14192
|
(file) => {
|
|
14130
14193
|
if (!allowedTypes.includes(file.type)) {
|
|
14131
14194
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -14143,7 +14206,7 @@ var useImageUpload = (options) => {
|
|
|
14143
14206
|
},
|
|
14144
14207
|
[allowedTypes, maxFileSize, onError]
|
|
14145
14208
|
);
|
|
14146
|
-
const uploadFile = (0,
|
|
14209
|
+
const uploadFile = (0, import_react32.useCallback)(
|
|
14147
14210
|
(file) => __async(null, null, function* () {
|
|
14148
14211
|
if (!validateFile(file)) {
|
|
14149
14212
|
return null;
|
|
@@ -14196,7 +14259,7 @@ var useImageUpload = (options) => {
|
|
|
14196
14259
|
}),
|
|
14197
14260
|
[validateFile, onSuccess, onError, onProgress]
|
|
14198
14261
|
);
|
|
14199
|
-
const reset = (0,
|
|
14262
|
+
const reset = (0, import_react32.useCallback)(() => {
|
|
14200
14263
|
setIsUploading(false);
|
|
14201
14264
|
setProgress(null);
|
|
14202
14265
|
setError(null);
|