@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/dist/index.mjs
CHANGED
|
@@ -420,7 +420,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
420
420
|
function emptyFunctionThatReturnsNull() {
|
|
421
421
|
return null;
|
|
422
422
|
}
|
|
423
|
-
module.exports = function(
|
|
423
|
+
module.exports = function(isValidElement2, throwOnDirectAccess) {
|
|
424
424
|
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
425
425
|
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
426
426
|
function getIteratorFn(maybeIterable) {
|
|
@@ -548,7 +548,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
548
548
|
function createElementTypeChecker() {
|
|
549
549
|
function validate(props, propName, componentName, location, propFullName) {
|
|
550
550
|
var propValue = props[propName];
|
|
551
|
-
if (!
|
|
551
|
+
if (!isValidElement2(propValue)) {
|
|
552
552
|
var propType = getPropType(propValue);
|
|
553
553
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
554
554
|
}
|
|
@@ -736,7 +736,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
|
736
736
|
if (Array.isArray(propValue)) {
|
|
737
737
|
return propValue.every(isNode);
|
|
738
738
|
}
|
|
739
|
-
if (propValue === null ||
|
|
739
|
+
if (propValue === null || isValidElement2(propValue)) {
|
|
740
740
|
return true;
|
|
741
741
|
}
|
|
742
742
|
var iteratorFn = getIteratorFn(propValue);
|
|
@@ -3760,7 +3760,8 @@ var ModalTitleStyled = styled(ModalRadix.Title, {
|
|
|
3760
3760
|
fontSize: "$18",
|
|
3761
3761
|
fontWeight: "medium",
|
|
3762
3762
|
fontStyle: "normal",
|
|
3763
|
-
textTransform: "uppercase"
|
|
3763
|
+
textTransform: "uppercase",
|
|
3764
|
+
width: "calc(100% - 48px)"
|
|
3764
3765
|
});
|
|
3765
3766
|
function Modal(_a) {
|
|
3766
3767
|
var _b = _a, {
|
|
@@ -9932,7 +9933,26 @@ var useToast = () => {
|
|
|
9932
9933
|
};
|
|
9933
9934
|
|
|
9934
9935
|
// src/components/Tooltip/index.tsx
|
|
9936
|
+
import * as React10 from "react";
|
|
9935
9937
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
9938
|
+
|
|
9939
|
+
// src/hooks/useHasHover.ts
|
|
9940
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
9941
|
+
function useHasHover() {
|
|
9942
|
+
const [hasHover, setHasHover] = useState9(true);
|
|
9943
|
+
useEffect8(() => {
|
|
9944
|
+
const media = window.matchMedia("(hover: hover)");
|
|
9945
|
+
setHasHover(media.matches);
|
|
9946
|
+
const listener = (event) => {
|
|
9947
|
+
setHasHover(event.matches);
|
|
9948
|
+
};
|
|
9949
|
+
media.addEventListener("change", listener);
|
|
9950
|
+
return () => media.removeEventListener("change", listener);
|
|
9951
|
+
}, []);
|
|
9952
|
+
return hasHover;
|
|
9953
|
+
}
|
|
9954
|
+
|
|
9955
|
+
// src/components/Tooltip/index.tsx
|
|
9936
9956
|
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9937
9957
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
9938
9958
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
@@ -9966,23 +9986,66 @@ var TooltipContent = styled(TooltipPrimitive.Content, {
|
|
|
9966
9986
|
var TooltipArrow = styled(TooltipPrimitive.Arrow, {
|
|
9967
9987
|
fill: "$dark800"
|
|
9968
9988
|
});
|
|
9989
|
+
function mergeTouchTriggerProps(child, onToggle) {
|
|
9990
|
+
return React10.cloneElement(child, {
|
|
9991
|
+
onClick: (event) => {
|
|
9992
|
+
var _a, _b;
|
|
9993
|
+
(_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, event);
|
|
9994
|
+
if (!event.defaultPrevented) {
|
|
9995
|
+
onToggle();
|
|
9996
|
+
}
|
|
9997
|
+
}
|
|
9998
|
+
});
|
|
9999
|
+
}
|
|
9969
10000
|
function Tooltip({
|
|
9970
10001
|
children,
|
|
9971
10002
|
content,
|
|
9972
10003
|
delayDuration = 200,
|
|
9973
|
-
side = "top"
|
|
10004
|
+
side = "top",
|
|
10005
|
+
supportMobileTap = true
|
|
9974
10006
|
}) {
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
10007
|
+
const hasHover = useHasHover();
|
|
10008
|
+
const [open, setOpen] = React10.useState(false);
|
|
10009
|
+
const isTouchToggleRef = React10.useRef(false);
|
|
10010
|
+
const useTouchBehavior = supportMobileTap && !hasHover;
|
|
10011
|
+
const handleTouchOpenChange = React10.useCallback((nextOpen) => {
|
|
10012
|
+
if (isTouchToggleRef.current) {
|
|
10013
|
+
isTouchToggleRef.current = false;
|
|
10014
|
+
return;
|
|
10015
|
+
}
|
|
10016
|
+
setOpen(nextOpen);
|
|
10017
|
+
}, []);
|
|
10018
|
+
const triggerChild = React10.useMemo(() => {
|
|
10019
|
+
if (!useTouchBehavior || !React10.isValidElement(children)) {
|
|
10020
|
+
return children;
|
|
10021
|
+
}
|
|
10022
|
+
return mergeTouchTriggerProps(
|
|
10023
|
+
children,
|
|
10024
|
+
() => {
|
|
10025
|
+
isTouchToggleRef.current = true;
|
|
10026
|
+
setOpen((prev) => !prev);
|
|
10027
|
+
}
|
|
10028
|
+
);
|
|
10029
|
+
}, [children, useTouchBehavior]);
|
|
10030
|
+
const tooltipContent = typeof content === "string" ? /* @__PURE__ */ jsx26(Text, { typography: "tooltip", color: "grey50", children: content }) : content;
|
|
10031
|
+
return /* @__PURE__ */ jsx26(TooltipProvider, { children: /* @__PURE__ */ jsxs15(
|
|
10032
|
+
TooltipRoot,
|
|
10033
|
+
__spreadProps(__spreadValues({
|
|
10034
|
+
delayDuration: useTouchBehavior ? 0 : delayDuration
|
|
10035
|
+
}, useTouchBehavior ? { open, onOpenChange: handleTouchOpenChange } : {}), {
|
|
10036
|
+
children: [
|
|
10037
|
+
/* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: triggerChild }),
|
|
10038
|
+
/* @__PURE__ */ jsxs15(TooltipContent, { side, sideOffset: 5, children: [
|
|
10039
|
+
tooltipContent,
|
|
10040
|
+
/* @__PURE__ */ jsx26(TooltipArrow, {})
|
|
10041
|
+
] })
|
|
10042
|
+
]
|
|
10043
|
+
})
|
|
10044
|
+
) });
|
|
9982
10045
|
}
|
|
9983
10046
|
|
|
9984
10047
|
// src/components/MultiSelect/index.tsx
|
|
9985
|
-
import
|
|
10048
|
+
import React11, { useCallback as useCallback3, useRef as useRef9, useState as useState12 } from "react";
|
|
9986
10049
|
import { DropdownMenu as DropdownMenu4, Theme as Theme3 } from "@radix-ui/themes";
|
|
9987
10050
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9988
10051
|
import {
|
|
@@ -9990,15 +10053,15 @@ import {
|
|
|
9990
10053
|
faChevronUp as faChevronUp2,
|
|
9991
10054
|
faSquareXmark
|
|
9992
10055
|
} from "@fortawesome/free-solid-svg-icons";
|
|
9993
|
-
import { useMemo as
|
|
10056
|
+
import { useMemo as useMemo3 } from "react";
|
|
9994
10057
|
|
|
9995
10058
|
// src/hooks/useMediaQuery.ts
|
|
9996
|
-
import { useEffect as
|
|
10059
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
9997
10060
|
function useMediaQuery(query) {
|
|
9998
|
-
const [matches, setMatches] =
|
|
10061
|
+
const [matches, setMatches] = useState11(
|
|
9999
10062
|
() => typeof window !== "undefined" ? window.matchMedia(query).matches : false
|
|
10000
10063
|
);
|
|
10001
|
-
|
|
10064
|
+
useEffect9(() => {
|
|
10002
10065
|
const media = window.matchMedia(query);
|
|
10003
10066
|
const listener = (event) => setMatches(event.matches);
|
|
10004
10067
|
setMatches(media.matches);
|
|
@@ -10172,7 +10235,7 @@ import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-r
|
|
|
10172
10235
|
var MOBILE_MODAL_MAX_HEIGHT = "90vh";
|
|
10173
10236
|
var MOBILE_MODAL_HEADER_OFFSET = "65px";
|
|
10174
10237
|
var MOBILE_BREAKPOINT = "(max-width: 840px)";
|
|
10175
|
-
var MultiSelect =
|
|
10238
|
+
var MultiSelect = React11.forwardRef(
|
|
10176
10239
|
({
|
|
10177
10240
|
placeholder,
|
|
10178
10241
|
value: selectedValues = [],
|
|
@@ -10195,12 +10258,12 @@ var MultiSelect = React10.forwardRef(
|
|
|
10195
10258
|
showMoreButtonOnClick,
|
|
10196
10259
|
helperTextAfterField = ""
|
|
10197
10260
|
}, fowardedRef) => {
|
|
10198
|
-
const [isOpen, setIsOpen] =
|
|
10199
|
-
const triggerRef =
|
|
10200
|
-
const [allOptionsSelected, setAllOptionsSelected] =
|
|
10261
|
+
const [isOpen, setIsOpen] = useState12(false);
|
|
10262
|
+
const triggerRef = useRef9(null);
|
|
10263
|
+
const [allOptionsSelected, setAllOptionsSelected] = useState12(false);
|
|
10201
10264
|
const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
|
|
10202
10265
|
const hasSections = !!(optionsBySection == null ? void 0 : optionsBySection.length);
|
|
10203
|
-
const resolvedOptions =
|
|
10266
|
+
const resolvedOptions = useMemo3(() => {
|
|
10204
10267
|
if (hasSections) {
|
|
10205
10268
|
return optionsBySection.reduce(
|
|
10206
10269
|
(acc, section) => acc.concat(section.options),
|
|
@@ -10209,21 +10272,21 @@ var MultiSelect = React10.forwardRef(
|
|
|
10209
10272
|
}
|
|
10210
10273
|
return options;
|
|
10211
10274
|
}, [hasSections, options, optionsBySection]);
|
|
10212
|
-
const labelByValue =
|
|
10275
|
+
const labelByValue = useMemo3(() => {
|
|
10213
10276
|
return resolvedOptions.reduce((prev, curr) => {
|
|
10214
10277
|
return __spreadProps(__spreadValues({}, prev), {
|
|
10215
10278
|
[curr.value]: curr.label
|
|
10216
10279
|
});
|
|
10217
10280
|
}, {});
|
|
10218
10281
|
}, [resolvedOptions]);
|
|
10219
|
-
const handleRemove =
|
|
10282
|
+
const handleRemove = useCallback3(
|
|
10220
10283
|
(value) => {
|
|
10221
10284
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
10222
10285
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
10223
10286
|
},
|
|
10224
10287
|
[selectedValues, onValueChange]
|
|
10225
10288
|
);
|
|
10226
|
-
const handleSelectAll =
|
|
10289
|
+
const handleSelectAll = useCallback3(
|
|
10227
10290
|
(e) => {
|
|
10228
10291
|
e.preventDefault();
|
|
10229
10292
|
e.stopPropagation();
|
|
@@ -10238,7 +10301,7 @@ var MultiSelect = React10.forwardRef(
|
|
|
10238
10301
|
},
|
|
10239
10302
|
[selectedValues, resolvedOptions, onValueChange]
|
|
10240
10303
|
);
|
|
10241
|
-
const text =
|
|
10304
|
+
const text = useMemo3(() => {
|
|
10242
10305
|
if (selectedValues.length > 0 && singleSelect) {
|
|
10243
10306
|
const value = selectedValues[0];
|
|
10244
10307
|
return labelByValue[value];
|
|
@@ -10249,7 +10312,7 @@ var MultiSelect = React10.forwardRef(
|
|
|
10249
10312
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
10250
10313
|
setIsOpen(false);
|
|
10251
10314
|
};
|
|
10252
|
-
const handleToggle =
|
|
10315
|
+
const handleToggle = useCallback3(
|
|
10253
10316
|
(e) => {
|
|
10254
10317
|
e.preventDefault();
|
|
10255
10318
|
e.stopPropagation();
|
|
@@ -10328,7 +10391,7 @@ var MultiSelect = React10.forwardRef(
|
|
|
10328
10391
|
);
|
|
10329
10392
|
const renderCheckboxOptions = () => {
|
|
10330
10393
|
if (hasSections) {
|
|
10331
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ jsxs16(
|
|
10394
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ jsxs16(React11.Fragment, { children: [
|
|
10332
10395
|
sectionIndex > 0 && /* @__PURE__ */ jsx27(StyledSectionDivider, {}),
|
|
10333
10396
|
/* @__PURE__ */ jsx27(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10334
10397
|
section.options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(CheckboxItem, { value, css: itemStyle, children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
|
|
@@ -10338,7 +10401,7 @@ var MultiSelect = React10.forwardRef(
|
|
|
10338
10401
|
};
|
|
10339
10402
|
const renderSingleSelectOptions = () => {
|
|
10340
10403
|
if (hasSections) {
|
|
10341
|
-
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ jsxs16(
|
|
10404
|
+
return optionsBySection.map((section, sectionIndex) => /* @__PURE__ */ jsxs16(React11.Fragment, { children: [
|
|
10342
10405
|
sectionIndex > 0 && /* @__PURE__ */ jsx27(StyledSectionDivider, {}),
|
|
10343
10406
|
/* @__PURE__ */ jsx27(StyledSectionTitle, { typography: "labelSmall", fontWeight: "semibold", color: "dark600", children: section.name }),
|
|
10344
10407
|
section.options.map(({ value, label }, i) => /* @__PURE__ */ jsx27(StyledItem2, { onClick: () => handleItemClick(value), children: /* @__PURE__ */ jsx27(Text, { typography: "labelSmall", children: label }) }, `${section.name}-${i}`))
|
|
@@ -10503,7 +10566,7 @@ var Divider = styled("div", {
|
|
|
10503
10566
|
});
|
|
10504
10567
|
|
|
10505
10568
|
// src/components/ToggleElement/index.tsx
|
|
10506
|
-
import { useState as
|
|
10569
|
+
import { useState as useState13 } from "react";
|
|
10507
10570
|
import { Fragment as Fragment4, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
10508
10571
|
function ToggleElement({
|
|
10509
10572
|
children,
|
|
@@ -10515,7 +10578,7 @@ function ToggleElement({
|
|
|
10515
10578
|
buttonProps,
|
|
10516
10579
|
onOpenChange
|
|
10517
10580
|
}) {
|
|
10518
|
-
const [internalOpen, setInternalOpen] =
|
|
10581
|
+
const [internalOpen, setInternalOpen] = useState13(defaultOpen);
|
|
10519
10582
|
const isControlled = open !== void 0;
|
|
10520
10583
|
const isOpen = isControlled ? open : internalOpen;
|
|
10521
10584
|
const handleClick = () => {
|
|
@@ -10839,7 +10902,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10839
10902
|
import {
|
|
10840
10903
|
useController
|
|
10841
10904
|
} from "react-hook-form";
|
|
10842
|
-
import { useCallback as
|
|
10905
|
+
import { useCallback as useCallback4, useMemo as useMemo4 } from "react";
|
|
10843
10906
|
import { format as format3, unformat as unformat2 } from "@react-input/mask";
|
|
10844
10907
|
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10845
10908
|
var TextFormField = (_a) => {
|
|
@@ -10862,7 +10925,7 @@ var TextFormField = (_a) => {
|
|
|
10862
10925
|
"onChange",
|
|
10863
10926
|
"valueFormatter"
|
|
10864
10927
|
]);
|
|
10865
|
-
const handleValidate =
|
|
10928
|
+
const handleValidate = useCallback4(
|
|
10866
10929
|
(value) => {
|
|
10867
10930
|
var _a2;
|
|
10868
10931
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10884,7 +10947,7 @@ var TextFormField = (_a) => {
|
|
|
10884
10947
|
const haveError = !!fieldError;
|
|
10885
10948
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10886
10949
|
const { value: formValue, onChange: formChange } = field;
|
|
10887
|
-
const formattedValue =
|
|
10950
|
+
const formattedValue = useMemo4(() => {
|
|
10888
10951
|
let value = formValue;
|
|
10889
10952
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
10890
10953
|
if (mask) value = format3(value != null ? value : "", mask);
|
|
@@ -11499,7 +11562,7 @@ function StateFormField({
|
|
|
11499
11562
|
}
|
|
11500
11563
|
|
|
11501
11564
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
11502
|
-
import { useEffect as
|
|
11565
|
+
import { useEffect as useEffect10, useState as useState14 } from "react";
|
|
11503
11566
|
import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
|
|
11504
11567
|
import { Fragment as Fragment6, jsx as jsx47 } from "react/jsx-runtime";
|
|
11505
11568
|
function CityFormField({
|
|
@@ -11512,9 +11575,9 @@ function CityFormField({
|
|
|
11512
11575
|
}) {
|
|
11513
11576
|
const { control, watch } = useFormContext5();
|
|
11514
11577
|
const selectedState = watch(stateName);
|
|
11515
|
-
const [cities, setCities] =
|
|
11516
|
-
const [loading, setLoading] =
|
|
11517
|
-
|
|
11578
|
+
const [cities, setCities] = useState14([]);
|
|
11579
|
+
const [loading, setLoading] = useState14(false);
|
|
11580
|
+
useEffect10(() => {
|
|
11518
11581
|
if (!isBrazil) {
|
|
11519
11582
|
setCities([]);
|
|
11520
11583
|
return;
|
|
@@ -11900,10 +11963,10 @@ var EmailFormField = ({
|
|
|
11900
11963
|
import { useController as useController3 } from "react-hook-form";
|
|
11901
11964
|
|
|
11902
11965
|
// src/components/RichEditor/RichEditor.tsx
|
|
11903
|
-
import { useEffect as
|
|
11966
|
+
import { useEffect as useEffect12, useState as useState16 } from "react";
|
|
11904
11967
|
|
|
11905
11968
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11906
|
-
import { useState as
|
|
11969
|
+
import { useState as useState15, useRef as useRef10, useEffect as useEffect11, useCallback as useCallback5 } from "react";
|
|
11907
11970
|
import { useQuill } from "react-quilljs";
|
|
11908
11971
|
|
|
11909
11972
|
// src/utils/uploadService.ts
|
|
@@ -13106,12 +13169,12 @@ var QuillComponent = ({
|
|
|
13106
13169
|
onCharacterCountChange,
|
|
13107
13170
|
maxLength
|
|
13108
13171
|
}) => {
|
|
13109
|
-
const [showVideoModal, setShowVideoModal] =
|
|
13110
|
-
const [videoUrl, setVideoUrl] =
|
|
13111
|
-
const [showLinkModal, setShowLinkModal] =
|
|
13112
|
-
const [linkUrl, setLinkUrl] =
|
|
13113
|
-
const videoModalRef =
|
|
13114
|
-
const linkModalRef =
|
|
13172
|
+
const [showVideoModal, setShowVideoModal] = useState15(false);
|
|
13173
|
+
const [videoUrl, setVideoUrl] = useState15("");
|
|
13174
|
+
const [showLinkModal, setShowLinkModal] = useState15(false);
|
|
13175
|
+
const [linkUrl, setLinkUrl] = useState15("");
|
|
13176
|
+
const videoModalRef = useRef10(null);
|
|
13177
|
+
const linkModalRef = useRef10(null);
|
|
13115
13178
|
const { addToast, removeToast } = useToast();
|
|
13116
13179
|
const formatHTML = (html) => {
|
|
13117
13180
|
const parser = new DOMParser();
|
|
@@ -13130,7 +13193,7 @@ var QuillComponent = ({
|
|
|
13130
13193
|
placeholder,
|
|
13131
13194
|
readOnly: disabled
|
|
13132
13195
|
});
|
|
13133
|
-
const handleImageUpload =
|
|
13196
|
+
const handleImageUpload = useCallback5(
|
|
13134
13197
|
(file) => __async(null, null, function* () {
|
|
13135
13198
|
if (disabled || !quill || !uploadConfig) return;
|
|
13136
13199
|
try {
|
|
@@ -13162,7 +13225,7 @@ var QuillComponent = ({
|
|
|
13162
13225
|
}),
|
|
13163
13226
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
13164
13227
|
);
|
|
13165
|
-
|
|
13228
|
+
useEffect11(() => {
|
|
13166
13229
|
if (!quill) return;
|
|
13167
13230
|
if (value !== void 0 && value !== null) {
|
|
13168
13231
|
const currentContent = quill.root.innerHTML;
|
|
@@ -13178,7 +13241,7 @@ var QuillComponent = ({
|
|
|
13178
13241
|
}
|
|
13179
13242
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(quill.getText().trim().length);
|
|
13180
13243
|
}, [quill, value, onCharacterCountChange]);
|
|
13181
|
-
|
|
13244
|
+
useEffect11(() => {
|
|
13182
13245
|
if (quill) {
|
|
13183
13246
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
13184
13247
|
if (source === "user") {
|
|
@@ -13239,7 +13302,7 @@ var QuillComponent = ({
|
|
|
13239
13302
|
}, 2e3);
|
|
13240
13303
|
}
|
|
13241
13304
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange, formats]);
|
|
13242
|
-
|
|
13305
|
+
useEffect11(() => {
|
|
13243
13306
|
if (quill) {
|
|
13244
13307
|
quill.enable(!disabled);
|
|
13245
13308
|
if (!disabled) {
|
|
@@ -13250,11 +13313,11 @@ var QuillComponent = ({
|
|
|
13250
13313
|
}
|
|
13251
13314
|
}
|
|
13252
13315
|
}, [quill, disabled]);
|
|
13253
|
-
const handleLinkCancel =
|
|
13316
|
+
const handleLinkCancel = useCallback5(() => {
|
|
13254
13317
|
setLinkUrl("");
|
|
13255
13318
|
setShowLinkModal(false);
|
|
13256
13319
|
}, []);
|
|
13257
|
-
const handleLinkSubmit =
|
|
13320
|
+
const handleLinkSubmit = useCallback5(() => {
|
|
13258
13321
|
if (!linkUrl.trim() || !quill) return;
|
|
13259
13322
|
const url = linkUrl.trim();
|
|
13260
13323
|
const selection = quill.getSelection();
|
|
@@ -13269,11 +13332,11 @@ var QuillComponent = ({
|
|
|
13269
13332
|
setLinkUrl("");
|
|
13270
13333
|
setShowLinkModal(false);
|
|
13271
13334
|
}, [linkUrl, quill]);
|
|
13272
|
-
const handleVideoCancel =
|
|
13335
|
+
const handleVideoCancel = useCallback5(() => {
|
|
13273
13336
|
setVideoUrl("");
|
|
13274
13337
|
setShowVideoModal(false);
|
|
13275
13338
|
}, []);
|
|
13276
|
-
const handleVideoSubmit =
|
|
13339
|
+
const handleVideoSubmit = useCallback5(() => {
|
|
13277
13340
|
var _a, _b;
|
|
13278
13341
|
if (!videoUrl.trim() || !quill) return;
|
|
13279
13342
|
let processedUrl = videoUrl.trim();
|
|
@@ -13306,7 +13369,7 @@ var QuillComponent = ({
|
|
|
13306
13369
|
setVideoUrl("");
|
|
13307
13370
|
setShowVideoModal(false);
|
|
13308
13371
|
}, [videoUrl, quill]);
|
|
13309
|
-
|
|
13372
|
+
useEffect11(() => {
|
|
13310
13373
|
const handleClickOutside = (event) => {
|
|
13311
13374
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
13312
13375
|
handleVideoCancel();
|
|
@@ -13468,8 +13531,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
13468
13531
|
// src/components/RichEditor/RichEditor.tsx
|
|
13469
13532
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
13470
13533
|
var RichEditor = (props) => {
|
|
13471
|
-
const [isClient, setIsClient] =
|
|
13472
|
-
|
|
13534
|
+
const [isClient, setIsClient] = useState16(false);
|
|
13535
|
+
useEffect12(() => {
|
|
13473
13536
|
setIsClient(typeof window !== "undefined");
|
|
13474
13537
|
}, []);
|
|
13475
13538
|
if (!isClient) return null;
|
|
@@ -13491,7 +13554,7 @@ var RichTextPresenter = ({ richText }) => {
|
|
|
13491
13554
|
var RichTextPresenter_default = RichTextPresenter;
|
|
13492
13555
|
|
|
13493
13556
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
13494
|
-
import { useEffect as
|
|
13557
|
+
import { useEffect as useEffect13, useState as useState17 } from "react";
|
|
13495
13558
|
import { Fragment as Fragment7, jsx as jsx56, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
13496
13559
|
var getPlainTextLengthFromHtml = (html) => {
|
|
13497
13560
|
var _a, _b;
|
|
@@ -13540,7 +13603,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13540
13603
|
}
|
|
13541
13604
|
}
|
|
13542
13605
|
});
|
|
13543
|
-
const [caracterQuantity, setCaracterQuantity] =
|
|
13606
|
+
const [caracterQuantity, setCaracterQuantity] = useState17(
|
|
13544
13607
|
() => getRemainingCharacters(maxLength, field.value)
|
|
13545
13608
|
);
|
|
13546
13609
|
const handleCharacterCountChange = (count) => {
|
|
@@ -13548,7 +13611,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13548
13611
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
13549
13612
|
}
|
|
13550
13613
|
};
|
|
13551
|
-
|
|
13614
|
+
useEffect13(() => {
|
|
13552
13615
|
setCaracterQuantity(getRemainingCharacters(maxLength, field.value));
|
|
13553
13616
|
}, [field.value, maxLength]);
|
|
13554
13617
|
const fieldError = fieldState.error;
|
|
@@ -13594,7 +13657,7 @@ var RichEditorFormField = (_a) => {
|
|
|
13594
13657
|
|
|
13595
13658
|
// src/components/FormFields/CalendarFormField.tsx
|
|
13596
13659
|
import { useController as useController4 } from "react-hook-form";
|
|
13597
|
-
import { useCallback as
|
|
13660
|
+
import { useCallback as useCallback6 } from "react";
|
|
13598
13661
|
import { jsx as jsx57, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
13599
13662
|
var CalendarFormField = (_a) => {
|
|
13600
13663
|
var _b = _a, {
|
|
@@ -13620,7 +13683,7 @@ var CalendarFormField = (_a) => {
|
|
|
13620
13683
|
"maxYearsFromNow",
|
|
13621
13684
|
"maxDate"
|
|
13622
13685
|
]);
|
|
13623
|
-
const handleValidate =
|
|
13686
|
+
const handleValidate = useCallback6(
|
|
13624
13687
|
(value) => {
|
|
13625
13688
|
var _a2;
|
|
13626
13689
|
if (value === void 0 || value === null) {
|
|
@@ -13675,7 +13738,7 @@ var CalendarFormField = (_a) => {
|
|
|
13675
13738
|
};
|
|
13676
13739
|
|
|
13677
13740
|
// src/components/FormFields/DoubleCalendarFormField.tsx
|
|
13678
|
-
import { useCallback as
|
|
13741
|
+
import { useCallback as useCallback7 } from "react";
|
|
13679
13742
|
import { useController as useController5 } from "react-hook-form";
|
|
13680
13743
|
import { jsx as jsx58, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
13681
13744
|
var DoubleCalendarFormField = (_a) => {
|
|
@@ -13702,7 +13765,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13702
13765
|
"maxDate",
|
|
13703
13766
|
"disabled"
|
|
13704
13767
|
]);
|
|
13705
|
-
const handleValidate =
|
|
13768
|
+
const handleValidate = useCallback7(
|
|
13706
13769
|
(value) => {
|
|
13707
13770
|
var _a2;
|
|
13708
13771
|
if (value === void 0 || value === null) {
|
|
@@ -13751,7 +13814,7 @@ var DoubleCalendarFormField = (_a) => {
|
|
|
13751
13814
|
|
|
13752
13815
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
13753
13816
|
import { useController as useController6 } from "react-hook-form";
|
|
13754
|
-
import { useCallback as
|
|
13817
|
+
import { useCallback as useCallback8 } from "react";
|
|
13755
13818
|
import { jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
13756
13819
|
var TimePickerFormField = (_a) => {
|
|
13757
13820
|
var _b = _a, {
|
|
@@ -13769,7 +13832,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13769
13832
|
"validationErrorMessage",
|
|
13770
13833
|
"rules"
|
|
13771
13834
|
]);
|
|
13772
|
-
const handleValidate =
|
|
13835
|
+
const handleValidate = useCallback8(
|
|
13773
13836
|
(value) => {
|
|
13774
13837
|
var _a2;
|
|
13775
13838
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13822,7 +13885,7 @@ var TimePickerFormField = (_a) => {
|
|
|
13822
13885
|
|
|
13823
13886
|
// src/components/FormFields/DateAndTimeFormField.tsx
|
|
13824
13887
|
import { useController as useController7 } from "react-hook-form";
|
|
13825
|
-
import { useCallback as
|
|
13888
|
+
import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo5, useState as useState18 } from "react";
|
|
13826
13889
|
import { jsx as jsx60, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
13827
13890
|
var DateAndTimeFormField = (_a) => {
|
|
13828
13891
|
var _b = _a, {
|
|
@@ -13851,7 +13914,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13851
13914
|
"maxDate"
|
|
13852
13915
|
]);
|
|
13853
13916
|
const { addToast } = useToast();
|
|
13854
|
-
const handleDisabledClick =
|
|
13917
|
+
const handleDisabledClick = useCallback9(
|
|
13855
13918
|
(event) => {
|
|
13856
13919
|
if (!disabled) return;
|
|
13857
13920
|
event.preventDefault();
|
|
@@ -13864,7 +13927,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13864
13927
|
},
|
|
13865
13928
|
[addToast, disabled, disabledInfo]
|
|
13866
13929
|
);
|
|
13867
|
-
const handleDisabledMouseDown =
|
|
13930
|
+
const handleDisabledMouseDown = useCallback9(
|
|
13868
13931
|
(event) => {
|
|
13869
13932
|
if (!disabled) return;
|
|
13870
13933
|
event.preventDefault();
|
|
@@ -13872,7 +13935,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13872
13935
|
},
|
|
13873
13936
|
[disabled]
|
|
13874
13937
|
);
|
|
13875
|
-
const handleValidate =
|
|
13938
|
+
const handleValidate = useCallback9(
|
|
13876
13939
|
(value) => {
|
|
13877
13940
|
var _a2;
|
|
13878
13941
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -13895,7 +13958,7 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13895
13958
|
const haveError = !!fieldError;
|
|
13896
13959
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
13897
13960
|
const { value: isoValue, onChange: setIsoValue } = field;
|
|
13898
|
-
const { selectedDateFromIso, selectedTimeFromIso } =
|
|
13961
|
+
const { selectedDateFromIso, selectedTimeFromIso } = useMemo5(() => {
|
|
13899
13962
|
if (!isoValue) return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
13900
13963
|
try {
|
|
13901
13964
|
const date = new Date(isoValue);
|
|
@@ -13910,13 +13973,13 @@ var DateAndTimeFormField = (_a) => {
|
|
|
13910
13973
|
return { selectedDateFromIso: void 0, selectedTimeFromIso: void 0 };
|
|
13911
13974
|
}
|
|
13912
13975
|
}, [isoValue]);
|
|
13913
|
-
const [draftDate, setDraftDate] =
|
|
13914
|
-
const [draftTime, setDraftTime] =
|
|
13915
|
-
|
|
13976
|
+
const [draftDate, setDraftDate] = useState18(selectedDateFromIso);
|
|
13977
|
+
const [draftTime, setDraftTime] = useState18(selectedTimeFromIso);
|
|
13978
|
+
useEffect14(() => {
|
|
13916
13979
|
setDraftDate(selectedDateFromIso);
|
|
13917
13980
|
setDraftTime(selectedTimeFromIso);
|
|
13918
13981
|
}, [selectedDateFromIso, selectedTimeFromIso]);
|
|
13919
|
-
const combineDateTime =
|
|
13982
|
+
const combineDateTime = useCallback9(
|
|
13920
13983
|
(date, time) => {
|
|
13921
13984
|
if (!date) {
|
|
13922
13985
|
setIsoValue("");
|
|
@@ -14003,11 +14066,11 @@ var DateAndTimeFormField = (_a) => {
|
|
|
14003
14066
|
};
|
|
14004
14067
|
|
|
14005
14068
|
// src/hooks/useImageUpload.ts
|
|
14006
|
-
import { useState as
|
|
14069
|
+
import { useState as useState19, useCallback as useCallback10 } from "react";
|
|
14007
14070
|
var useImageUpload = (options) => {
|
|
14008
|
-
const [isUploading, setIsUploading] =
|
|
14009
|
-
const [progress, setProgress] =
|
|
14010
|
-
const [error, setError] =
|
|
14071
|
+
const [isUploading, setIsUploading] = useState19(false);
|
|
14072
|
+
const [progress, setProgress] = useState19(null);
|
|
14073
|
+
const [error, setError] = useState19(null);
|
|
14011
14074
|
const {
|
|
14012
14075
|
onSuccess,
|
|
14013
14076
|
onError,
|
|
@@ -14017,7 +14080,7 @@ var useImageUpload = (options) => {
|
|
|
14017
14080
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
14018
14081
|
uploadConfig
|
|
14019
14082
|
} = options;
|
|
14020
|
-
const validateFile =
|
|
14083
|
+
const validateFile = useCallback10(
|
|
14021
14084
|
(file) => {
|
|
14022
14085
|
if (!allowedTypes.includes(file.type)) {
|
|
14023
14086
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -14035,7 +14098,7 @@ var useImageUpload = (options) => {
|
|
|
14035
14098
|
},
|
|
14036
14099
|
[allowedTypes, maxFileSize, onError]
|
|
14037
14100
|
);
|
|
14038
|
-
const uploadFile =
|
|
14101
|
+
const uploadFile = useCallback10(
|
|
14039
14102
|
(file) => __async(null, null, function* () {
|
|
14040
14103
|
if (!validateFile(file)) {
|
|
14041
14104
|
return null;
|
|
@@ -14088,7 +14151,7 @@ var useImageUpload = (options) => {
|
|
|
14088
14151
|
}),
|
|
14089
14152
|
[validateFile, onSuccess, onError, onProgress]
|
|
14090
14153
|
);
|
|
14091
|
-
const reset =
|
|
14154
|
+
const reset = useCallback10(() => {
|
|
14092
14155
|
setIsUploading(false);
|
|
14093
14156
|
setProgress(null);
|
|
14094
14157
|
setError(null);
|
package/package.json
CHANGED
package/src/components/Modal.tsx
CHANGED