@lets-events/react 12.3.7 → 12.3.8
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 +6 -6
- package/CHANGELOG.md +6 -0
- package/dist/index.js +96 -79
- package/dist/index.mjs +35 -18
- package/package.json +1 -1
- package/src/components/Drawer/index.tsx +19 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @lets-events/react@12.3.
|
|
2
|
+
> @lets-events/react@12.3.8 build
|
|
3
3
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
[34mCLI[39m Target: es6
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist\index.mjs [22m[
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist\index.js [22m[32m394.47 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 235ms
|
|
14
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m380.40 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 237ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 4757ms
|
|
18
18
|
[32mDTS[39m [1mdist\index.d.mts [22m[32m401.14 KB[39m
|
|
19
19
|
[32mDTS[39m [1mdist\index.d.ts [22m[32m401.14 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -8141,6 +8141,9 @@ function Calendar(_a) {
|
|
|
8141
8141
|
] })) });
|
|
8142
8142
|
}
|
|
8143
8143
|
|
|
8144
|
+
// src/components/Drawer/index.tsx
|
|
8145
|
+
var import_react9 = require("react");
|
|
8146
|
+
|
|
8144
8147
|
// src/components/Drawer/styledComponents.ts
|
|
8145
8148
|
var DrawerOverlayStyled = styled("div", {
|
|
8146
8149
|
position: "fixed",
|
|
@@ -8246,6 +8249,20 @@ function Drawer({
|
|
|
8246
8249
|
goBackAction,
|
|
8247
8250
|
zIndex = 1e3
|
|
8248
8251
|
}) {
|
|
8252
|
+
(0, import_react9.useEffect)(() => {
|
|
8253
|
+
if (isOpen) {
|
|
8254
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
8255
|
+
document.body.style.overflow = "hidden";
|
|
8256
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
8257
|
+
} else {
|
|
8258
|
+
document.body.style.overflow = "";
|
|
8259
|
+
document.body.style.paddingRight = "";
|
|
8260
|
+
}
|
|
8261
|
+
return () => {
|
|
8262
|
+
document.body.style.overflow = "";
|
|
8263
|
+
document.body.style.paddingRight = "";
|
|
8264
|
+
};
|
|
8265
|
+
}, [isOpen]);
|
|
8249
8266
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
8250
8267
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8251
8268
|
DrawerOverlayStyled,
|
|
@@ -8290,7 +8307,7 @@ function Drawer({
|
|
|
8290
8307
|
}
|
|
8291
8308
|
|
|
8292
8309
|
// src/components/TimePicker.tsx
|
|
8293
|
-
var
|
|
8310
|
+
var import_react10 = require("react");
|
|
8294
8311
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8295
8312
|
var TimePickerStyled = styled("div", {
|
|
8296
8313
|
position: "relative",
|
|
@@ -8413,14 +8430,14 @@ function TimePicker({
|
|
|
8413
8430
|
hasError,
|
|
8414
8431
|
expand = false
|
|
8415
8432
|
}) {
|
|
8416
|
-
const [hours, setHours] = (0,
|
|
8417
|
-
const [minutes, setMinutes] = (0,
|
|
8418
|
-
const [rawHours, setRawHours] = (0,
|
|
8419
|
-
const [rawMinutes, setRawMinutes] = (0,
|
|
8420
|
-
const [isOpen, setIsOpen] = (0,
|
|
8421
|
-
const dropdownRef = (0,
|
|
8433
|
+
const [hours, setHours] = (0, import_react10.useState)("00");
|
|
8434
|
+
const [minutes, setMinutes] = (0, import_react10.useState)("00");
|
|
8435
|
+
const [rawHours, setRawHours] = (0, import_react10.useState)("00");
|
|
8436
|
+
const [rawMinutes, setRawMinutes] = (0, import_react10.useState)("00");
|
|
8437
|
+
const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
|
|
8438
|
+
const dropdownRef = (0, import_react10.useRef)(null);
|
|
8422
8439
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8423
|
-
const handleIncrement = (0,
|
|
8440
|
+
const handleIncrement = (0, import_react10.useCallback)(
|
|
8424
8441
|
(type) => {
|
|
8425
8442
|
if (type === "hours") {
|
|
8426
8443
|
const next = (parseInt(hours) + 1) % 24;
|
|
@@ -8434,7 +8451,7 @@ function TimePicker({
|
|
|
8434
8451
|
},
|
|
8435
8452
|
[hours, minutes]
|
|
8436
8453
|
);
|
|
8437
|
-
const handleDecrement = (0,
|
|
8454
|
+
const handleDecrement = (0, import_react10.useCallback)(
|
|
8438
8455
|
(type) => {
|
|
8439
8456
|
if (type === "hours") {
|
|
8440
8457
|
const prev = (parseInt(hours) - 1 + 24) % 24;
|
|
@@ -8958,7 +8975,7 @@ function Switch(props) {
|
|
|
8958
8975
|
}
|
|
8959
8976
|
|
|
8960
8977
|
// src/components/Step.tsx
|
|
8961
|
-
var
|
|
8978
|
+
var import_react11 = __toESM(require("react"));
|
|
8962
8979
|
var import_themes15 = require("@radix-ui/themes");
|
|
8963
8980
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
8964
8981
|
var StepStyled = styled("div", {
|
|
@@ -9074,9 +9091,9 @@ function StepList(_a) {
|
|
|
9074
9091
|
"children",
|
|
9075
9092
|
"currentStep"
|
|
9076
9093
|
]);
|
|
9077
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
9078
|
-
if (
|
|
9079
|
-
return
|
|
9094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children: import_react11.default.Children.map(children, (child) => {
|
|
9095
|
+
if (import_react11.default.isValidElement(child) && child.type === StepTrigger) {
|
|
9096
|
+
return import_react11.default.cloneElement(child, { currentStep });
|
|
9080
9097
|
}
|
|
9081
9098
|
return child;
|
|
9082
9099
|
}) }));
|
|
@@ -9147,7 +9164,7 @@ function Card(_a) {
|
|
|
9147
9164
|
|
|
9148
9165
|
// src/components/TextareaField.tsx
|
|
9149
9166
|
var import_themes17 = require("@radix-ui/themes");
|
|
9150
|
-
var
|
|
9167
|
+
var import_react12 = __toESM(require("react"));
|
|
9151
9168
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
9152
9169
|
var TextareaFieldStyle = styled(import_themes17.TextArea, {
|
|
9153
9170
|
display: "flex",
|
|
@@ -9212,11 +9229,11 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9212
9229
|
padding: "$4"
|
|
9213
9230
|
}
|
|
9214
9231
|
});
|
|
9215
|
-
var TextareaField =
|
|
9232
|
+
var TextareaField = import_react12.default.forwardRef((_a, forwardedRef) => {
|
|
9216
9233
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9217
|
-
const inputRef = (0,
|
|
9218
|
-
const [remaining, setRemaining] = (0,
|
|
9219
|
-
(0,
|
|
9234
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
9235
|
+
const [remaining, setRemaining] = (0, import_react12.useState)(maxLength);
|
|
9236
|
+
(0, import_react12.useEffect)(() => {
|
|
9220
9237
|
var _a2;
|
|
9221
9238
|
if (maxLength && inputRef.current) {
|
|
9222
9239
|
setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
|
|
@@ -9251,12 +9268,12 @@ var TextareaField = import_react11.default.forwardRef((_a, forwardedRef) => {
|
|
|
9251
9268
|
});
|
|
9252
9269
|
|
|
9253
9270
|
// src/components/Toast/components/ToastItem.tsx
|
|
9254
|
-
var
|
|
9271
|
+
var import_react14 = require("react");
|
|
9255
9272
|
|
|
9256
9273
|
// src/components/Toast/styles/index.ts
|
|
9257
|
-
var
|
|
9274
|
+
var import_react13 = require("@stitches/react");
|
|
9258
9275
|
var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
|
|
9259
|
-
var slideIn = (0,
|
|
9276
|
+
var slideIn = (0, import_react13.keyframes)({
|
|
9260
9277
|
from: {
|
|
9261
9278
|
transform: "translateX(calc(100% + 25px))",
|
|
9262
9279
|
opacity: 0
|
|
@@ -9266,7 +9283,7 @@ var slideIn = (0, import_react12.keyframes)({
|
|
|
9266
9283
|
opacity: 1
|
|
9267
9284
|
}
|
|
9268
9285
|
});
|
|
9269
|
-
var slideOut = (0,
|
|
9286
|
+
var slideOut = (0, import_react13.keyframes)({
|
|
9270
9287
|
from: {
|
|
9271
9288
|
transform: "translateX(0)",
|
|
9272
9289
|
opacity: 1
|
|
@@ -9276,7 +9293,7 @@ var slideOut = (0, import_react12.keyframes)({
|
|
|
9276
9293
|
opacity: 0
|
|
9277
9294
|
}
|
|
9278
9295
|
});
|
|
9279
|
-
var swipeOut = (0,
|
|
9296
|
+
var swipeOut = (0, import_react13.keyframes)({
|
|
9280
9297
|
from: {
|
|
9281
9298
|
transform: "translateX(var(--radix-toast-swipe-end-x))",
|
|
9282
9299
|
opacity: 1
|
|
@@ -9382,7 +9399,7 @@ function ToastItem({
|
|
|
9382
9399
|
toast,
|
|
9383
9400
|
onRemove
|
|
9384
9401
|
}) {
|
|
9385
|
-
const [open, setOpen] = (0,
|
|
9402
|
+
const [open, setOpen] = (0, import_react14.useState)(true);
|
|
9386
9403
|
const handleOpenChange = (open2) => {
|
|
9387
9404
|
setOpen(open2);
|
|
9388
9405
|
if (!open2) {
|
|
@@ -9406,17 +9423,17 @@ function ToastItem({
|
|
|
9406
9423
|
}
|
|
9407
9424
|
|
|
9408
9425
|
// src/components/Toast/components/ToastProvider.tsx
|
|
9409
|
-
var
|
|
9426
|
+
var import_react15 = require("react");
|
|
9410
9427
|
var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
|
|
9411
9428
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
9412
|
-
var ToastContext = (0,
|
|
9429
|
+
var ToastContext = (0, import_react15.createContext)(null);
|
|
9413
9430
|
function ToastProvider({
|
|
9414
9431
|
children,
|
|
9415
9432
|
defaultDuration = 5e3,
|
|
9416
9433
|
maxToasts = 5,
|
|
9417
9434
|
swipeDirection = "right"
|
|
9418
9435
|
}) {
|
|
9419
|
-
const [toasts, setToasts] = (0,
|
|
9436
|
+
const [toasts, setToasts] = (0, import_react15.useState)([]);
|
|
9420
9437
|
const addToast = (toastData) => {
|
|
9421
9438
|
const id = Math.random().toString(36).substr(2, 9);
|
|
9422
9439
|
const newToast = __spreadProps(__spreadValues({
|
|
@@ -9452,9 +9469,9 @@ function ToastProvider({
|
|
|
9452
9469
|
}
|
|
9453
9470
|
|
|
9454
9471
|
// src/components/Toast/hooks/useToast.ts
|
|
9455
|
-
var
|
|
9472
|
+
var import_react16 = require("react");
|
|
9456
9473
|
var useToast = () => {
|
|
9457
|
-
const context = (0,
|
|
9474
|
+
const context = (0, import_react16.useContext)(ToastContext);
|
|
9458
9475
|
if (!context) {
|
|
9459
9476
|
throw new Error("useToast deve ser usado dentro de um ToastProvider");
|
|
9460
9477
|
}
|
|
@@ -9512,11 +9529,11 @@ function Tooltip({
|
|
|
9512
9529
|
}
|
|
9513
9530
|
|
|
9514
9531
|
// src/components/MultiSelect/index.tsx
|
|
9515
|
-
var
|
|
9532
|
+
var import_react17 = __toESM(require("react"));
|
|
9516
9533
|
var import_themes19 = require("@radix-ui/themes");
|
|
9517
9534
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
9518
9535
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
9519
|
-
var
|
|
9536
|
+
var import_react18 = require("react");
|
|
9520
9537
|
|
|
9521
9538
|
// src/components/MultiSelect/styledComponents.ts
|
|
9522
9539
|
var import_themes18 = require("@radix-ui/themes");
|
|
@@ -9666,7 +9683,7 @@ var ButtonSelectAllStyled = styled("button", {
|
|
|
9666
9683
|
|
|
9667
9684
|
// src/components/MultiSelect/index.tsx
|
|
9668
9685
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9669
|
-
var MultiSelect =
|
|
9686
|
+
var MultiSelect = import_react17.default.forwardRef(
|
|
9670
9687
|
({
|
|
9671
9688
|
placeholder,
|
|
9672
9689
|
value: selectedValues = [],
|
|
@@ -9684,24 +9701,24 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9684
9701
|
selectedAllText,
|
|
9685
9702
|
selectedScroll = false
|
|
9686
9703
|
}, fowardedRef) => {
|
|
9687
|
-
const [isOpen, setIsOpen] = (0,
|
|
9688
|
-
const triggerRef = (0,
|
|
9689
|
-
const [allOptionsSelected, setAllOptionsSelected] = (0,
|
|
9690
|
-
const labelByValue = (0,
|
|
9704
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
9705
|
+
const triggerRef = (0, import_react17.useRef)(null);
|
|
9706
|
+
const [allOptionsSelected, setAllOptionsSelected] = (0, import_react17.useState)(false);
|
|
9707
|
+
const labelByValue = (0, import_react18.useMemo)(() => {
|
|
9691
9708
|
return options.reduce((prev, curr) => {
|
|
9692
9709
|
return __spreadProps(__spreadValues({}, prev), {
|
|
9693
9710
|
[curr.value]: curr.label
|
|
9694
9711
|
});
|
|
9695
9712
|
}, {});
|
|
9696
9713
|
}, [options]);
|
|
9697
|
-
const handleRemove = (0,
|
|
9714
|
+
const handleRemove = (0, import_react17.useCallback)(
|
|
9698
9715
|
(value) => {
|
|
9699
9716
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
9700
9717
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
9701
9718
|
},
|
|
9702
9719
|
[selectedValues, onValueChange]
|
|
9703
9720
|
);
|
|
9704
|
-
const handleSelectAll = (0,
|
|
9721
|
+
const handleSelectAll = (0, import_react17.useCallback)(
|
|
9705
9722
|
(e) => {
|
|
9706
9723
|
e.preventDefault();
|
|
9707
9724
|
e.stopPropagation();
|
|
@@ -9716,7 +9733,7 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9716
9733
|
},
|
|
9717
9734
|
[selectedValues, options, onValueChange]
|
|
9718
9735
|
);
|
|
9719
|
-
const text = (0,
|
|
9736
|
+
const text = (0, import_react18.useMemo)(() => {
|
|
9720
9737
|
if (selectedValues.length > 0 && singleSelect) {
|
|
9721
9738
|
const value = selectedValues[0];
|
|
9722
9739
|
return labelByValue[value];
|
|
@@ -9727,7 +9744,7 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9727
9744
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
9728
9745
|
setIsOpen(false);
|
|
9729
9746
|
};
|
|
9730
|
-
const handleToggle = (0,
|
|
9747
|
+
const handleToggle = (0, import_react17.useCallback)(
|
|
9731
9748
|
(e) => {
|
|
9732
9749
|
e.preventDefault();
|
|
9733
9750
|
e.stopPropagation();
|
|
@@ -10166,7 +10183,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10166
10183
|
|
|
10167
10184
|
// src/components/FormFields/TextFormField.tsx
|
|
10168
10185
|
var import_react_hook_form2 = require("react-hook-form");
|
|
10169
|
-
var
|
|
10186
|
+
var import_react19 = require("react");
|
|
10170
10187
|
var import_mask2 = require("@react-input/mask");
|
|
10171
10188
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10172
10189
|
var TextFormField = (_a) => {
|
|
@@ -10189,7 +10206,7 @@ var TextFormField = (_a) => {
|
|
|
10189
10206
|
"onChange",
|
|
10190
10207
|
"valueFormatter"
|
|
10191
10208
|
]);
|
|
10192
|
-
const handleValidate = (0,
|
|
10209
|
+
const handleValidate = (0, import_react19.useCallback)(
|
|
10193
10210
|
(value) => {
|
|
10194
10211
|
var _a2;
|
|
10195
10212
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10211,7 +10228,7 @@ var TextFormField = (_a) => {
|
|
|
10211
10228
|
const haveError = !!fieldError;
|
|
10212
10229
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10213
10230
|
const { value: formValue, onChange: formChange } = field;
|
|
10214
|
-
const formattedValue = (0,
|
|
10231
|
+
const formattedValue = (0, import_react19.useMemo)(() => {
|
|
10215
10232
|
let value = formValue;
|
|
10216
10233
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
10217
10234
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -10806,7 +10823,7 @@ function StateFormField({
|
|
|
10806
10823
|
}
|
|
10807
10824
|
|
|
10808
10825
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10809
|
-
var
|
|
10826
|
+
var import_react20 = require("react");
|
|
10810
10827
|
var import_react_hook_form7 = require("react-hook-form");
|
|
10811
10828
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10812
10829
|
function CityFormField({
|
|
@@ -10819,9 +10836,9 @@ function CityFormField({
|
|
|
10819
10836
|
}) {
|
|
10820
10837
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
10821
10838
|
const selectedState = watch(stateName);
|
|
10822
|
-
const [cities, setCities] = (0,
|
|
10823
|
-
const [loading, setLoading] = (0,
|
|
10824
|
-
(0,
|
|
10839
|
+
const [cities, setCities] = (0, import_react20.useState)([]);
|
|
10840
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
10841
|
+
(0, import_react20.useEffect)(() => {
|
|
10825
10842
|
if (!isBrazil) {
|
|
10826
10843
|
setCities([]);
|
|
10827
10844
|
return;
|
|
@@ -11209,10 +11226,10 @@ var EmailFormField = ({
|
|
|
11209
11226
|
var import_react_hook_form12 = require("react-hook-form");
|
|
11210
11227
|
|
|
11211
11228
|
// src/components/RichEditor/RichEditor.tsx
|
|
11212
|
-
var
|
|
11229
|
+
var import_react22 = require("react");
|
|
11213
11230
|
|
|
11214
11231
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11215
|
-
var
|
|
11232
|
+
var import_react21 = require("react");
|
|
11216
11233
|
var import_react_quilljs = require("react-quilljs");
|
|
11217
11234
|
|
|
11218
11235
|
// src/utils/uploadService.ts
|
|
@@ -12281,12 +12298,12 @@ var QuillComponent = ({
|
|
|
12281
12298
|
onCharacterCountChange,
|
|
12282
12299
|
maxLength
|
|
12283
12300
|
}) => {
|
|
12284
|
-
const [showVideoModal, setShowVideoModal] = (0,
|
|
12285
|
-
const [videoUrl, setVideoUrl] = (0,
|
|
12286
|
-
const [showLinkModal, setShowLinkModal] = (0,
|
|
12287
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
12288
|
-
const videoModalRef = (0,
|
|
12289
|
-
const linkModalRef = (0,
|
|
12301
|
+
const [showVideoModal, setShowVideoModal] = (0, import_react21.useState)(false);
|
|
12302
|
+
const [videoUrl, setVideoUrl] = (0, import_react21.useState)("");
|
|
12303
|
+
const [showLinkModal, setShowLinkModal] = (0, import_react21.useState)(false);
|
|
12304
|
+
const [linkUrl, setLinkUrl] = (0, import_react21.useState)("");
|
|
12305
|
+
const videoModalRef = (0, import_react21.useRef)(null);
|
|
12306
|
+
const linkModalRef = (0, import_react21.useRef)(null);
|
|
12290
12307
|
const { addToast, removeToast } = useToast();
|
|
12291
12308
|
const formatHTML = (html) => {
|
|
12292
12309
|
const parser = new DOMParser();
|
|
@@ -12350,7 +12367,7 @@ var QuillComponent = ({
|
|
|
12350
12367
|
placeholder,
|
|
12351
12368
|
readOnly: disabled
|
|
12352
12369
|
});
|
|
12353
|
-
const handleImageUpload = (0,
|
|
12370
|
+
const handleImageUpload = (0, import_react21.useCallback)(
|
|
12354
12371
|
(file) => __async(null, null, function* () {
|
|
12355
12372
|
if (disabled || !quill || !uploadConfig) return;
|
|
12356
12373
|
try {
|
|
@@ -12382,7 +12399,7 @@ var QuillComponent = ({
|
|
|
12382
12399
|
}),
|
|
12383
12400
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
12384
12401
|
);
|
|
12385
|
-
(0,
|
|
12402
|
+
(0, import_react21.useEffect)(() => {
|
|
12386
12403
|
if (quill && value) {
|
|
12387
12404
|
const currentContent = quill.root.innerHTML;
|
|
12388
12405
|
if (currentContent !== value) {
|
|
@@ -12396,7 +12413,7 @@ var QuillComponent = ({
|
|
|
12396
12413
|
}
|
|
12397
12414
|
}
|
|
12398
12415
|
}, [quill, value]);
|
|
12399
|
-
(0,
|
|
12416
|
+
(0, import_react21.useEffect)(() => {
|
|
12400
12417
|
if (quill) {
|
|
12401
12418
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
12402
12419
|
if (source === "user") {
|
|
@@ -12451,7 +12468,7 @@ var QuillComponent = ({
|
|
|
12451
12468
|
}, 2e3);
|
|
12452
12469
|
}
|
|
12453
12470
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange]);
|
|
12454
|
-
(0,
|
|
12471
|
+
(0, import_react21.useEffect)(() => {
|
|
12455
12472
|
if (quill) {
|
|
12456
12473
|
quill.enable(!disabled);
|
|
12457
12474
|
if (!disabled) {
|
|
@@ -12462,11 +12479,11 @@ var QuillComponent = ({
|
|
|
12462
12479
|
}
|
|
12463
12480
|
}
|
|
12464
12481
|
}, [quill, disabled]);
|
|
12465
|
-
const handleLinkCancel = (0,
|
|
12482
|
+
const handleLinkCancel = (0, import_react21.useCallback)(() => {
|
|
12466
12483
|
setLinkUrl("");
|
|
12467
12484
|
setShowLinkModal(false);
|
|
12468
12485
|
}, []);
|
|
12469
|
-
const handleLinkSubmit = (0,
|
|
12486
|
+
const handleLinkSubmit = (0, import_react21.useCallback)(() => {
|
|
12470
12487
|
if (!linkUrl.trim() || !quill) return;
|
|
12471
12488
|
const url = linkUrl.trim();
|
|
12472
12489
|
const selection = quill.getSelection();
|
|
@@ -12481,11 +12498,11 @@ var QuillComponent = ({
|
|
|
12481
12498
|
setLinkUrl("");
|
|
12482
12499
|
setShowLinkModal(false);
|
|
12483
12500
|
}, [linkUrl, quill]);
|
|
12484
|
-
const handleVideoCancel = (0,
|
|
12501
|
+
const handleVideoCancel = (0, import_react21.useCallback)(() => {
|
|
12485
12502
|
setVideoUrl("");
|
|
12486
12503
|
setShowVideoModal(false);
|
|
12487
12504
|
}, []);
|
|
12488
|
-
const handleVideoSubmit = (0,
|
|
12505
|
+
const handleVideoSubmit = (0, import_react21.useCallback)(() => {
|
|
12489
12506
|
var _a, _b;
|
|
12490
12507
|
if (!videoUrl.trim() || !quill) return;
|
|
12491
12508
|
let processedUrl = videoUrl.trim();
|
|
@@ -12518,7 +12535,7 @@ var QuillComponent = ({
|
|
|
12518
12535
|
setVideoUrl("");
|
|
12519
12536
|
setShowVideoModal(false);
|
|
12520
12537
|
}, [videoUrl, quill]);
|
|
12521
|
-
(0,
|
|
12538
|
+
(0, import_react21.useEffect)(() => {
|
|
12522
12539
|
const handleClickOutside = (event) => {
|
|
12523
12540
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
12524
12541
|
handleVideoCancel();
|
|
@@ -12680,8 +12697,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
12680
12697
|
// src/components/RichEditor/RichEditor.tsx
|
|
12681
12698
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
12682
12699
|
var RichEditor = (props) => {
|
|
12683
|
-
const [isClient, setIsClient] = (0,
|
|
12684
|
-
(0,
|
|
12700
|
+
const [isClient, setIsClient] = (0, import_react22.useState)(false);
|
|
12701
|
+
(0, import_react22.useEffect)(() => {
|
|
12685
12702
|
setIsClient(typeof window !== "undefined");
|
|
12686
12703
|
}, []);
|
|
12687
12704
|
if (!isClient) return null;
|
|
@@ -12690,7 +12707,7 @@ var RichEditor = (props) => {
|
|
|
12690
12707
|
var RichEditor_default = RichEditor;
|
|
12691
12708
|
|
|
12692
12709
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
12693
|
-
var
|
|
12710
|
+
var import_react23 = require("react");
|
|
12694
12711
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
12695
12712
|
var RichEditorFormField = (_a) => {
|
|
12696
12713
|
var _b = _a, {
|
|
@@ -12725,7 +12742,7 @@ var RichEditorFormField = (_a) => {
|
|
|
12725
12742
|
},
|
|
12726
12743
|
defaultValue: ""
|
|
12727
12744
|
});
|
|
12728
|
-
const [caracterQuantity, setCaracterQuantity] = (0,
|
|
12745
|
+
const [caracterQuantity, setCaracterQuantity] = (0, import_react23.useState)(maxLength);
|
|
12729
12746
|
const handleCharacterCountChange = (count) => {
|
|
12730
12747
|
if (maxLength !== void 0) {
|
|
12731
12748
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
@@ -12773,7 +12790,7 @@ var RichEditorFormField = (_a) => {
|
|
|
12773
12790
|
|
|
12774
12791
|
// src/components/FormFields/CalendarFormField.tsx
|
|
12775
12792
|
var import_react_hook_form13 = require("react-hook-form");
|
|
12776
|
-
var
|
|
12793
|
+
var import_react24 = require("react");
|
|
12777
12794
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
12778
12795
|
var CalendarFormField = (_a) => {
|
|
12779
12796
|
var _b = _a, {
|
|
@@ -12797,7 +12814,7 @@ var CalendarFormField = (_a) => {
|
|
|
12797
12814
|
"allowPastDates",
|
|
12798
12815
|
"maxYearsFromNow"
|
|
12799
12816
|
]);
|
|
12800
|
-
const handleValidate = (0,
|
|
12817
|
+
const handleValidate = (0, import_react24.useCallback)(
|
|
12801
12818
|
(value) => {
|
|
12802
12819
|
var _a2;
|
|
12803
12820
|
if (value === void 0 || value === null) {
|
|
@@ -12852,7 +12869,7 @@ var CalendarFormField = (_a) => {
|
|
|
12852
12869
|
|
|
12853
12870
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
12854
12871
|
var import_react_hook_form14 = require("react-hook-form");
|
|
12855
|
-
var
|
|
12872
|
+
var import_react25 = require("react");
|
|
12856
12873
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12857
12874
|
var TimePickerFormField = (_a) => {
|
|
12858
12875
|
var _b = _a, {
|
|
@@ -12870,7 +12887,7 @@ var TimePickerFormField = (_a) => {
|
|
|
12870
12887
|
"validationErrorMessage",
|
|
12871
12888
|
"rules"
|
|
12872
12889
|
]);
|
|
12873
|
-
const handleValidate = (0,
|
|
12890
|
+
const handleValidate = (0, import_react25.useCallback)(
|
|
12874
12891
|
(value) => {
|
|
12875
12892
|
var _a2;
|
|
12876
12893
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -12922,11 +12939,11 @@ var TimePickerFormField = (_a) => {
|
|
|
12922
12939
|
};
|
|
12923
12940
|
|
|
12924
12941
|
// src/hooks/useImageUpload.ts
|
|
12925
|
-
var
|
|
12942
|
+
var import_react26 = require("react");
|
|
12926
12943
|
var useImageUpload = (options) => {
|
|
12927
|
-
const [isUploading, setIsUploading] = (0,
|
|
12928
|
-
const [progress, setProgress] = (0,
|
|
12929
|
-
const [error, setError] = (0,
|
|
12944
|
+
const [isUploading, setIsUploading] = (0, import_react26.useState)(false);
|
|
12945
|
+
const [progress, setProgress] = (0, import_react26.useState)(null);
|
|
12946
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
12930
12947
|
const {
|
|
12931
12948
|
onSuccess,
|
|
12932
12949
|
onError,
|
|
@@ -12936,7 +12953,7 @@ var useImageUpload = (options) => {
|
|
|
12936
12953
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
12937
12954
|
uploadConfig
|
|
12938
12955
|
} = options;
|
|
12939
|
-
const validateFile = (0,
|
|
12956
|
+
const validateFile = (0, import_react26.useCallback)(
|
|
12940
12957
|
(file) => {
|
|
12941
12958
|
if (!allowedTypes.includes(file.type)) {
|
|
12942
12959
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -12954,7 +12971,7 @@ var useImageUpload = (options) => {
|
|
|
12954
12971
|
},
|
|
12955
12972
|
[allowedTypes, maxFileSize, onError]
|
|
12956
12973
|
);
|
|
12957
|
-
const uploadFile = (0,
|
|
12974
|
+
const uploadFile = (0, import_react26.useCallback)(
|
|
12958
12975
|
(file) => __async(null, null, function* () {
|
|
12959
12976
|
if (!validateFile(file)) {
|
|
12960
12977
|
return null;
|
|
@@ -13007,7 +13024,7 @@ var useImageUpload = (options) => {
|
|
|
13007
13024
|
}),
|
|
13008
13025
|
[validateFile, onSuccess, onError, onProgress]
|
|
13009
13026
|
);
|
|
13010
|
-
const reset = (0,
|
|
13027
|
+
const reset = (0, import_react26.useCallback)(() => {
|
|
13011
13028
|
setIsUploading(false);
|
|
13012
13029
|
setProgress(null);
|
|
13013
13030
|
setError(null);
|
package/dist/index.mjs
CHANGED
|
@@ -8029,6 +8029,9 @@ function Calendar(_a) {
|
|
|
8029
8029
|
] })) });
|
|
8030
8030
|
}
|
|
8031
8031
|
|
|
8032
|
+
// src/components/Drawer/index.tsx
|
|
8033
|
+
import { useEffect as useEffect4 } from "react";
|
|
8034
|
+
|
|
8032
8035
|
// src/components/Drawer/styledComponents.ts
|
|
8033
8036
|
var DrawerOverlayStyled = styled("div", {
|
|
8034
8037
|
position: "fixed",
|
|
@@ -8134,6 +8137,20 @@ function Drawer({
|
|
|
8134
8137
|
goBackAction,
|
|
8135
8138
|
zIndex = 1e3
|
|
8136
8139
|
}) {
|
|
8140
|
+
useEffect4(() => {
|
|
8141
|
+
if (isOpen) {
|
|
8142
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
8143
|
+
document.body.style.overflow = "hidden";
|
|
8144
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
8145
|
+
} else {
|
|
8146
|
+
document.body.style.overflow = "";
|
|
8147
|
+
document.body.style.paddingRight = "";
|
|
8148
|
+
}
|
|
8149
|
+
return () => {
|
|
8150
|
+
document.body.style.overflow = "";
|
|
8151
|
+
document.body.style.paddingRight = "";
|
|
8152
|
+
};
|
|
8153
|
+
}, [isOpen]);
|
|
8137
8154
|
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
8138
8155
|
/* @__PURE__ */ jsx16(
|
|
8139
8156
|
DrawerOverlayStyled,
|
|
@@ -8178,7 +8195,7 @@ function Drawer({
|
|
|
8178
8195
|
}
|
|
8179
8196
|
|
|
8180
8197
|
// src/components/TimePicker.tsx
|
|
8181
|
-
import { useCallback, useRef as
|
|
8198
|
+
import { useCallback, useRef as useRef5, useState as useState3 } from "react";
|
|
8182
8199
|
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8183
8200
|
var TimePickerStyled = styled("div", {
|
|
8184
8201
|
position: "relative",
|
|
@@ -8306,7 +8323,7 @@ function TimePicker({
|
|
|
8306
8323
|
const [rawHours, setRawHours] = useState3("00");
|
|
8307
8324
|
const [rawMinutes, setRawMinutes] = useState3("00");
|
|
8308
8325
|
const [isOpen, setIsOpen] = useState3(false);
|
|
8309
|
-
const dropdownRef =
|
|
8326
|
+
const dropdownRef = useRef5(null);
|
|
8310
8327
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8311
8328
|
const handleIncrement = useCallback(
|
|
8312
8329
|
(type) => {
|
|
@@ -9035,7 +9052,7 @@ function Card(_a) {
|
|
|
9035
9052
|
|
|
9036
9053
|
// src/components/TextareaField.tsx
|
|
9037
9054
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
9038
|
-
import React8, { useRef as
|
|
9055
|
+
import React8, { useRef as useRef6, useState as useState4, useEffect as useEffect5 } from "react";
|
|
9039
9056
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
9040
9057
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
9041
9058
|
display: "flex",
|
|
@@ -9102,9 +9119,9 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9102
9119
|
});
|
|
9103
9120
|
var TextareaField = React8.forwardRef((_a, forwardedRef) => {
|
|
9104
9121
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9105
|
-
const inputRef =
|
|
9122
|
+
const inputRef = useRef6(null);
|
|
9106
9123
|
const [remaining, setRemaining] = useState4(maxLength);
|
|
9107
|
-
|
|
9124
|
+
useEffect5(() => {
|
|
9108
9125
|
var _a2;
|
|
9109
9126
|
if (maxLength && inputRef.current) {
|
|
9110
9127
|
setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
|
|
@@ -9400,7 +9417,7 @@ function Tooltip({
|
|
|
9400
9417
|
}
|
|
9401
9418
|
|
|
9402
9419
|
// src/components/MultiSelect/index.tsx
|
|
9403
|
-
import React9, { useCallback as useCallback2, useRef as
|
|
9420
|
+
import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState7 } from "react";
|
|
9404
9421
|
import { DropdownMenu as DropdownMenu4, Theme as Theme3 } from "@radix-ui/themes";
|
|
9405
9422
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9406
9423
|
import {
|
|
@@ -9577,7 +9594,7 @@ var MultiSelect = React9.forwardRef(
|
|
|
9577
9594
|
selectedScroll = false
|
|
9578
9595
|
}, fowardedRef) => {
|
|
9579
9596
|
const [isOpen, setIsOpen] = useState7(false);
|
|
9580
|
-
const triggerRef =
|
|
9597
|
+
const triggerRef = useRef7(null);
|
|
9581
9598
|
const [allOptionsSelected, setAllOptionsSelected] = useState7(false);
|
|
9582
9599
|
const labelByValue = useMemo2(() => {
|
|
9583
9600
|
return options.reduce((prev, curr) => {
|
|
@@ -10703,7 +10720,7 @@ function StateFormField({
|
|
|
10703
10720
|
}
|
|
10704
10721
|
|
|
10705
10722
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10706
|
-
import { useEffect as
|
|
10723
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
10707
10724
|
import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
|
|
10708
10725
|
import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
|
|
10709
10726
|
function CityFormField({
|
|
@@ -10718,7 +10735,7 @@ function CityFormField({
|
|
|
10718
10735
|
const selectedState = watch(stateName);
|
|
10719
10736
|
const [cities, setCities] = useState8([]);
|
|
10720
10737
|
const [loading, setLoading] = useState8(false);
|
|
10721
|
-
|
|
10738
|
+
useEffect6(() => {
|
|
10722
10739
|
if (!isBrazil) {
|
|
10723
10740
|
setCities([]);
|
|
10724
10741
|
return;
|
|
@@ -11106,10 +11123,10 @@ var EmailFormField = ({
|
|
|
11106
11123
|
import { useController as useController3 } from "react-hook-form";
|
|
11107
11124
|
|
|
11108
11125
|
// src/components/RichEditor/RichEditor.tsx
|
|
11109
|
-
import { useEffect as
|
|
11126
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
11110
11127
|
|
|
11111
11128
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11112
|
-
import { useState as useState9, useRef as
|
|
11129
|
+
import { useState as useState9, useRef as useRef8, useEffect as useEffect7, useCallback as useCallback4 } from "react";
|
|
11113
11130
|
import { useQuill } from "react-quilljs";
|
|
11114
11131
|
|
|
11115
11132
|
// src/utils/uploadService.ts
|
|
@@ -12182,8 +12199,8 @@ var QuillComponent = ({
|
|
|
12182
12199
|
const [videoUrl, setVideoUrl] = useState9("");
|
|
12183
12200
|
const [showLinkModal, setShowLinkModal] = useState9(false);
|
|
12184
12201
|
const [linkUrl, setLinkUrl] = useState9("");
|
|
12185
|
-
const videoModalRef =
|
|
12186
|
-
const linkModalRef =
|
|
12202
|
+
const videoModalRef = useRef8(null);
|
|
12203
|
+
const linkModalRef = useRef8(null);
|
|
12187
12204
|
const { addToast, removeToast } = useToast();
|
|
12188
12205
|
const formatHTML = (html) => {
|
|
12189
12206
|
const parser = new DOMParser();
|
|
@@ -12279,7 +12296,7 @@ var QuillComponent = ({
|
|
|
12279
12296
|
}),
|
|
12280
12297
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
12281
12298
|
);
|
|
12282
|
-
|
|
12299
|
+
useEffect7(() => {
|
|
12283
12300
|
if (quill && value) {
|
|
12284
12301
|
const currentContent = quill.root.innerHTML;
|
|
12285
12302
|
if (currentContent !== value) {
|
|
@@ -12293,7 +12310,7 @@ var QuillComponent = ({
|
|
|
12293
12310
|
}
|
|
12294
12311
|
}
|
|
12295
12312
|
}, [quill, value]);
|
|
12296
|
-
|
|
12313
|
+
useEffect7(() => {
|
|
12297
12314
|
if (quill) {
|
|
12298
12315
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
12299
12316
|
if (source === "user") {
|
|
@@ -12348,7 +12365,7 @@ var QuillComponent = ({
|
|
|
12348
12365
|
}, 2e3);
|
|
12349
12366
|
}
|
|
12350
12367
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange]);
|
|
12351
|
-
|
|
12368
|
+
useEffect7(() => {
|
|
12352
12369
|
if (quill) {
|
|
12353
12370
|
quill.enable(!disabled);
|
|
12354
12371
|
if (!disabled) {
|
|
@@ -12415,7 +12432,7 @@ var QuillComponent = ({
|
|
|
12415
12432
|
setVideoUrl("");
|
|
12416
12433
|
setShowVideoModal(false);
|
|
12417
12434
|
}, [videoUrl, quill]);
|
|
12418
|
-
|
|
12435
|
+
useEffect7(() => {
|
|
12419
12436
|
const handleClickOutside = (event) => {
|
|
12420
12437
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
12421
12438
|
handleVideoCancel();
|
|
@@ -12578,7 +12595,7 @@ var QuillComponent_default = QuillComponent;
|
|
|
12578
12595
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
12579
12596
|
var RichEditor = (props) => {
|
|
12580
12597
|
const [isClient, setIsClient] = useState10(false);
|
|
12581
|
-
|
|
12598
|
+
useEffect8(() => {
|
|
12582
12599
|
setIsClient(typeof window !== "undefined");
|
|
12583
12600
|
}, []);
|
|
12584
12601
|
if (!isClient) return null;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode, useRef } from "react";
|
|
1
|
+
import { ComponentProps, ReactNode, useEffect, useRef } from "react";
|
|
2
2
|
import { colors, Colors } from "@lets-events/tokens";
|
|
3
3
|
import Icon from "../Icon";
|
|
4
4
|
import {
|
|
@@ -36,6 +36,24 @@ export function Drawer({
|
|
|
36
36
|
goBackAction,
|
|
37
37
|
zIndex = 1000,
|
|
38
38
|
}: DrawerProps) {
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (isOpen) {
|
|
41
|
+
const scrollbarWidth =
|
|
42
|
+
window.innerWidth - document.documentElement.clientWidth;
|
|
43
|
+
|
|
44
|
+
document.body.style.overflow = "hidden";
|
|
45
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
46
|
+
} else {
|
|
47
|
+
document.body.style.overflow = "";
|
|
48
|
+
document.body.style.paddingRight = "";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return () => {
|
|
52
|
+
document.body.style.overflow = "";
|
|
53
|
+
document.body.style.paddingRight = "";
|
|
54
|
+
};
|
|
55
|
+
}, [isOpen]);
|
|
56
|
+
|
|
39
57
|
return (
|
|
40
58
|
<>
|
|
41
59
|
<DrawerOverlayStyled
|