@lets-events/react 12.3.7 → 12.3.9
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 +12 -0
- package/dist/index.js +103 -80
- package/dist/index.mjs +42 -19
- package/package.json +1 -1
- package/src/components/Card.tsx +4 -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.9 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.53 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 836ms
|
|
14
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m380.45 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 837ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 5017ms
|
|
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
|
}) }));
|
|
@@ -9142,12 +9159,18 @@ function Card(_a) {
|
|
|
9142
9159
|
"padding",
|
|
9143
9160
|
"radius"
|
|
9144
9161
|
]);
|
|
9145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
9162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
9163
|
+
CardStyled,
|
|
9164
|
+
__spreadProps(__spreadValues({}, props), {
|
|
9165
|
+
css: __spreadValues({ padding, borderRadius: radius }, props.css),
|
|
9166
|
+
children
|
|
9167
|
+
})
|
|
9168
|
+
);
|
|
9146
9169
|
}
|
|
9147
9170
|
|
|
9148
9171
|
// src/components/TextareaField.tsx
|
|
9149
9172
|
var import_themes17 = require("@radix-ui/themes");
|
|
9150
|
-
var
|
|
9173
|
+
var import_react12 = __toESM(require("react"));
|
|
9151
9174
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
9152
9175
|
var TextareaFieldStyle = styled(import_themes17.TextArea, {
|
|
9153
9176
|
display: "flex",
|
|
@@ -9212,11 +9235,11 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9212
9235
|
padding: "$4"
|
|
9213
9236
|
}
|
|
9214
9237
|
});
|
|
9215
|
-
var TextareaField =
|
|
9238
|
+
var TextareaField = import_react12.default.forwardRef((_a, forwardedRef) => {
|
|
9216
9239
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9217
|
-
const inputRef = (0,
|
|
9218
|
-
const [remaining, setRemaining] = (0,
|
|
9219
|
-
(0,
|
|
9240
|
+
const inputRef = (0, import_react12.useRef)(null);
|
|
9241
|
+
const [remaining, setRemaining] = (0, import_react12.useState)(maxLength);
|
|
9242
|
+
(0, import_react12.useEffect)(() => {
|
|
9220
9243
|
var _a2;
|
|
9221
9244
|
if (maxLength && inputRef.current) {
|
|
9222
9245
|
setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
|
|
@@ -9251,12 +9274,12 @@ var TextareaField = import_react11.default.forwardRef((_a, forwardedRef) => {
|
|
|
9251
9274
|
});
|
|
9252
9275
|
|
|
9253
9276
|
// src/components/Toast/components/ToastItem.tsx
|
|
9254
|
-
var
|
|
9277
|
+
var import_react14 = require("react");
|
|
9255
9278
|
|
|
9256
9279
|
// src/components/Toast/styles/index.ts
|
|
9257
|
-
var
|
|
9280
|
+
var import_react13 = require("@stitches/react");
|
|
9258
9281
|
var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
|
|
9259
|
-
var slideIn = (0,
|
|
9282
|
+
var slideIn = (0, import_react13.keyframes)({
|
|
9260
9283
|
from: {
|
|
9261
9284
|
transform: "translateX(calc(100% + 25px))",
|
|
9262
9285
|
opacity: 0
|
|
@@ -9266,7 +9289,7 @@ var slideIn = (0, import_react12.keyframes)({
|
|
|
9266
9289
|
opacity: 1
|
|
9267
9290
|
}
|
|
9268
9291
|
});
|
|
9269
|
-
var slideOut = (0,
|
|
9292
|
+
var slideOut = (0, import_react13.keyframes)({
|
|
9270
9293
|
from: {
|
|
9271
9294
|
transform: "translateX(0)",
|
|
9272
9295
|
opacity: 1
|
|
@@ -9276,7 +9299,7 @@ var slideOut = (0, import_react12.keyframes)({
|
|
|
9276
9299
|
opacity: 0
|
|
9277
9300
|
}
|
|
9278
9301
|
});
|
|
9279
|
-
var swipeOut = (0,
|
|
9302
|
+
var swipeOut = (0, import_react13.keyframes)({
|
|
9280
9303
|
from: {
|
|
9281
9304
|
transform: "translateX(var(--radix-toast-swipe-end-x))",
|
|
9282
9305
|
opacity: 1
|
|
@@ -9382,7 +9405,7 @@ function ToastItem({
|
|
|
9382
9405
|
toast,
|
|
9383
9406
|
onRemove
|
|
9384
9407
|
}) {
|
|
9385
|
-
const [open, setOpen] = (0,
|
|
9408
|
+
const [open, setOpen] = (0, import_react14.useState)(true);
|
|
9386
9409
|
const handleOpenChange = (open2) => {
|
|
9387
9410
|
setOpen(open2);
|
|
9388
9411
|
if (!open2) {
|
|
@@ -9406,17 +9429,17 @@ function ToastItem({
|
|
|
9406
9429
|
}
|
|
9407
9430
|
|
|
9408
9431
|
// src/components/Toast/components/ToastProvider.tsx
|
|
9409
|
-
var
|
|
9432
|
+
var import_react15 = require("react");
|
|
9410
9433
|
var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
|
|
9411
9434
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
9412
|
-
var ToastContext = (0,
|
|
9435
|
+
var ToastContext = (0, import_react15.createContext)(null);
|
|
9413
9436
|
function ToastProvider({
|
|
9414
9437
|
children,
|
|
9415
9438
|
defaultDuration = 5e3,
|
|
9416
9439
|
maxToasts = 5,
|
|
9417
9440
|
swipeDirection = "right"
|
|
9418
9441
|
}) {
|
|
9419
|
-
const [toasts, setToasts] = (0,
|
|
9442
|
+
const [toasts, setToasts] = (0, import_react15.useState)([]);
|
|
9420
9443
|
const addToast = (toastData) => {
|
|
9421
9444
|
const id = Math.random().toString(36).substr(2, 9);
|
|
9422
9445
|
const newToast = __spreadProps(__spreadValues({
|
|
@@ -9452,9 +9475,9 @@ function ToastProvider({
|
|
|
9452
9475
|
}
|
|
9453
9476
|
|
|
9454
9477
|
// src/components/Toast/hooks/useToast.ts
|
|
9455
|
-
var
|
|
9478
|
+
var import_react16 = require("react");
|
|
9456
9479
|
var useToast = () => {
|
|
9457
|
-
const context = (0,
|
|
9480
|
+
const context = (0, import_react16.useContext)(ToastContext);
|
|
9458
9481
|
if (!context) {
|
|
9459
9482
|
throw new Error("useToast deve ser usado dentro de um ToastProvider");
|
|
9460
9483
|
}
|
|
@@ -9512,11 +9535,11 @@ function Tooltip({
|
|
|
9512
9535
|
}
|
|
9513
9536
|
|
|
9514
9537
|
// src/components/MultiSelect/index.tsx
|
|
9515
|
-
var
|
|
9538
|
+
var import_react17 = __toESM(require("react"));
|
|
9516
9539
|
var import_themes19 = require("@radix-ui/themes");
|
|
9517
9540
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
9518
9541
|
var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
|
|
9519
|
-
var
|
|
9542
|
+
var import_react18 = require("react");
|
|
9520
9543
|
|
|
9521
9544
|
// src/components/MultiSelect/styledComponents.ts
|
|
9522
9545
|
var import_themes18 = require("@radix-ui/themes");
|
|
@@ -9666,7 +9689,7 @@ var ButtonSelectAllStyled = styled("button", {
|
|
|
9666
9689
|
|
|
9667
9690
|
// src/components/MultiSelect/index.tsx
|
|
9668
9691
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9669
|
-
var MultiSelect =
|
|
9692
|
+
var MultiSelect = import_react17.default.forwardRef(
|
|
9670
9693
|
({
|
|
9671
9694
|
placeholder,
|
|
9672
9695
|
value: selectedValues = [],
|
|
@@ -9684,24 +9707,24 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9684
9707
|
selectedAllText,
|
|
9685
9708
|
selectedScroll = false
|
|
9686
9709
|
}, fowardedRef) => {
|
|
9687
|
-
const [isOpen, setIsOpen] = (0,
|
|
9688
|
-
const triggerRef = (0,
|
|
9689
|
-
const [allOptionsSelected, setAllOptionsSelected] = (0,
|
|
9690
|
-
const labelByValue = (0,
|
|
9710
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
9711
|
+
const triggerRef = (0, import_react17.useRef)(null);
|
|
9712
|
+
const [allOptionsSelected, setAllOptionsSelected] = (0, import_react17.useState)(false);
|
|
9713
|
+
const labelByValue = (0, import_react18.useMemo)(() => {
|
|
9691
9714
|
return options.reduce((prev, curr) => {
|
|
9692
9715
|
return __spreadProps(__spreadValues({}, prev), {
|
|
9693
9716
|
[curr.value]: curr.label
|
|
9694
9717
|
});
|
|
9695
9718
|
}, {});
|
|
9696
9719
|
}, [options]);
|
|
9697
|
-
const handleRemove = (0,
|
|
9720
|
+
const handleRemove = (0, import_react17.useCallback)(
|
|
9698
9721
|
(value) => {
|
|
9699
9722
|
const newValue = selectedValues.filter((v) => v !== value);
|
|
9700
9723
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
9701
9724
|
},
|
|
9702
9725
|
[selectedValues, onValueChange]
|
|
9703
9726
|
);
|
|
9704
|
-
const handleSelectAll = (0,
|
|
9727
|
+
const handleSelectAll = (0, import_react17.useCallback)(
|
|
9705
9728
|
(e) => {
|
|
9706
9729
|
e.preventDefault();
|
|
9707
9730
|
e.stopPropagation();
|
|
@@ -9716,7 +9739,7 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9716
9739
|
},
|
|
9717
9740
|
[selectedValues, options, onValueChange]
|
|
9718
9741
|
);
|
|
9719
|
-
const text = (0,
|
|
9742
|
+
const text = (0, import_react18.useMemo)(() => {
|
|
9720
9743
|
if (selectedValues.length > 0 && singleSelect) {
|
|
9721
9744
|
const value = selectedValues[0];
|
|
9722
9745
|
return labelByValue[value];
|
|
@@ -9727,7 +9750,7 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9727
9750
|
onValueChange == null ? void 0 : onValueChange([v]);
|
|
9728
9751
|
setIsOpen(false);
|
|
9729
9752
|
};
|
|
9730
|
-
const handleToggle = (0,
|
|
9753
|
+
const handleToggle = (0, import_react17.useCallback)(
|
|
9731
9754
|
(e) => {
|
|
9732
9755
|
e.preventDefault();
|
|
9733
9756
|
e.stopPropagation();
|
|
@@ -10166,7 +10189,7 @@ var TextAreaFormField = (_a) => {
|
|
|
10166
10189
|
|
|
10167
10190
|
// src/components/FormFields/TextFormField.tsx
|
|
10168
10191
|
var import_react_hook_form2 = require("react-hook-form");
|
|
10169
|
-
var
|
|
10192
|
+
var import_react19 = require("react");
|
|
10170
10193
|
var import_mask2 = require("@react-input/mask");
|
|
10171
10194
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10172
10195
|
var TextFormField = (_a) => {
|
|
@@ -10189,7 +10212,7 @@ var TextFormField = (_a) => {
|
|
|
10189
10212
|
"onChange",
|
|
10190
10213
|
"valueFormatter"
|
|
10191
10214
|
]);
|
|
10192
|
-
const handleValidate = (0,
|
|
10215
|
+
const handleValidate = (0, import_react19.useCallback)(
|
|
10193
10216
|
(value) => {
|
|
10194
10217
|
var _a2;
|
|
10195
10218
|
if (value === void 0 || value === null || !required && value.trim() === "")
|
|
@@ -10211,7 +10234,7 @@ var TextFormField = (_a) => {
|
|
|
10211
10234
|
const haveError = !!fieldError;
|
|
10212
10235
|
const errorMsg = fieldError == null ? void 0 : fieldError.message;
|
|
10213
10236
|
const { value: formValue, onChange: formChange } = field;
|
|
10214
|
-
const formattedValue = (0,
|
|
10237
|
+
const formattedValue = (0, import_react19.useMemo)(() => {
|
|
10215
10238
|
let value = formValue;
|
|
10216
10239
|
if (valueFormatter) value = valueFormatter.format(value);
|
|
10217
10240
|
if (mask) value = (0, import_mask2.format)(value != null ? value : "", mask);
|
|
@@ -10806,7 +10829,7 @@ function StateFormField({
|
|
|
10806
10829
|
}
|
|
10807
10830
|
|
|
10808
10831
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10809
|
-
var
|
|
10832
|
+
var import_react20 = require("react");
|
|
10810
10833
|
var import_react_hook_form7 = require("react-hook-form");
|
|
10811
10834
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10812
10835
|
function CityFormField({
|
|
@@ -10819,9 +10842,9 @@ function CityFormField({
|
|
|
10819
10842
|
}) {
|
|
10820
10843
|
const { control, watch } = (0, import_react_hook_form7.useFormContext)();
|
|
10821
10844
|
const selectedState = watch(stateName);
|
|
10822
|
-
const [cities, setCities] = (0,
|
|
10823
|
-
const [loading, setLoading] = (0,
|
|
10824
|
-
(0,
|
|
10845
|
+
const [cities, setCities] = (0, import_react20.useState)([]);
|
|
10846
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
10847
|
+
(0, import_react20.useEffect)(() => {
|
|
10825
10848
|
if (!isBrazil) {
|
|
10826
10849
|
setCities([]);
|
|
10827
10850
|
return;
|
|
@@ -11209,10 +11232,10 @@ var EmailFormField = ({
|
|
|
11209
11232
|
var import_react_hook_form12 = require("react-hook-form");
|
|
11210
11233
|
|
|
11211
11234
|
// src/components/RichEditor/RichEditor.tsx
|
|
11212
|
-
var
|
|
11235
|
+
var import_react22 = require("react");
|
|
11213
11236
|
|
|
11214
11237
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11215
|
-
var
|
|
11238
|
+
var import_react21 = require("react");
|
|
11216
11239
|
var import_react_quilljs = require("react-quilljs");
|
|
11217
11240
|
|
|
11218
11241
|
// src/utils/uploadService.ts
|
|
@@ -12281,12 +12304,12 @@ var QuillComponent = ({
|
|
|
12281
12304
|
onCharacterCountChange,
|
|
12282
12305
|
maxLength
|
|
12283
12306
|
}) => {
|
|
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,
|
|
12307
|
+
const [showVideoModal, setShowVideoModal] = (0, import_react21.useState)(false);
|
|
12308
|
+
const [videoUrl, setVideoUrl] = (0, import_react21.useState)("");
|
|
12309
|
+
const [showLinkModal, setShowLinkModal] = (0, import_react21.useState)(false);
|
|
12310
|
+
const [linkUrl, setLinkUrl] = (0, import_react21.useState)("");
|
|
12311
|
+
const videoModalRef = (0, import_react21.useRef)(null);
|
|
12312
|
+
const linkModalRef = (0, import_react21.useRef)(null);
|
|
12290
12313
|
const { addToast, removeToast } = useToast();
|
|
12291
12314
|
const formatHTML = (html) => {
|
|
12292
12315
|
const parser = new DOMParser();
|
|
@@ -12350,7 +12373,7 @@ var QuillComponent = ({
|
|
|
12350
12373
|
placeholder,
|
|
12351
12374
|
readOnly: disabled
|
|
12352
12375
|
});
|
|
12353
|
-
const handleImageUpload = (0,
|
|
12376
|
+
const handleImageUpload = (0, import_react21.useCallback)(
|
|
12354
12377
|
(file) => __async(null, null, function* () {
|
|
12355
12378
|
if (disabled || !quill || !uploadConfig) return;
|
|
12356
12379
|
try {
|
|
@@ -12382,7 +12405,7 @@ var QuillComponent = ({
|
|
|
12382
12405
|
}),
|
|
12383
12406
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
12384
12407
|
);
|
|
12385
|
-
(0,
|
|
12408
|
+
(0, import_react21.useEffect)(() => {
|
|
12386
12409
|
if (quill && value) {
|
|
12387
12410
|
const currentContent = quill.root.innerHTML;
|
|
12388
12411
|
if (currentContent !== value) {
|
|
@@ -12396,7 +12419,7 @@ var QuillComponent = ({
|
|
|
12396
12419
|
}
|
|
12397
12420
|
}
|
|
12398
12421
|
}, [quill, value]);
|
|
12399
|
-
(0,
|
|
12422
|
+
(0, import_react21.useEffect)(() => {
|
|
12400
12423
|
if (quill) {
|
|
12401
12424
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
12402
12425
|
if (source === "user") {
|
|
@@ -12451,7 +12474,7 @@ var QuillComponent = ({
|
|
|
12451
12474
|
}, 2e3);
|
|
12452
12475
|
}
|
|
12453
12476
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange]);
|
|
12454
|
-
(0,
|
|
12477
|
+
(0, import_react21.useEffect)(() => {
|
|
12455
12478
|
if (quill) {
|
|
12456
12479
|
quill.enable(!disabled);
|
|
12457
12480
|
if (!disabled) {
|
|
@@ -12462,11 +12485,11 @@ var QuillComponent = ({
|
|
|
12462
12485
|
}
|
|
12463
12486
|
}
|
|
12464
12487
|
}, [quill, disabled]);
|
|
12465
|
-
const handleLinkCancel = (0,
|
|
12488
|
+
const handleLinkCancel = (0, import_react21.useCallback)(() => {
|
|
12466
12489
|
setLinkUrl("");
|
|
12467
12490
|
setShowLinkModal(false);
|
|
12468
12491
|
}, []);
|
|
12469
|
-
const handleLinkSubmit = (0,
|
|
12492
|
+
const handleLinkSubmit = (0, import_react21.useCallback)(() => {
|
|
12470
12493
|
if (!linkUrl.trim() || !quill) return;
|
|
12471
12494
|
const url = linkUrl.trim();
|
|
12472
12495
|
const selection = quill.getSelection();
|
|
@@ -12481,11 +12504,11 @@ var QuillComponent = ({
|
|
|
12481
12504
|
setLinkUrl("");
|
|
12482
12505
|
setShowLinkModal(false);
|
|
12483
12506
|
}, [linkUrl, quill]);
|
|
12484
|
-
const handleVideoCancel = (0,
|
|
12507
|
+
const handleVideoCancel = (0, import_react21.useCallback)(() => {
|
|
12485
12508
|
setVideoUrl("");
|
|
12486
12509
|
setShowVideoModal(false);
|
|
12487
12510
|
}, []);
|
|
12488
|
-
const handleVideoSubmit = (0,
|
|
12511
|
+
const handleVideoSubmit = (0, import_react21.useCallback)(() => {
|
|
12489
12512
|
var _a, _b;
|
|
12490
12513
|
if (!videoUrl.trim() || !quill) return;
|
|
12491
12514
|
let processedUrl = videoUrl.trim();
|
|
@@ -12518,7 +12541,7 @@ var QuillComponent = ({
|
|
|
12518
12541
|
setVideoUrl("");
|
|
12519
12542
|
setShowVideoModal(false);
|
|
12520
12543
|
}, [videoUrl, quill]);
|
|
12521
|
-
(0,
|
|
12544
|
+
(0, import_react21.useEffect)(() => {
|
|
12522
12545
|
const handleClickOutside = (event) => {
|
|
12523
12546
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
12524
12547
|
handleVideoCancel();
|
|
@@ -12680,8 +12703,8 @@ var QuillComponent_default = QuillComponent;
|
|
|
12680
12703
|
// src/components/RichEditor/RichEditor.tsx
|
|
12681
12704
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
12682
12705
|
var RichEditor = (props) => {
|
|
12683
|
-
const [isClient, setIsClient] = (0,
|
|
12684
|
-
(0,
|
|
12706
|
+
const [isClient, setIsClient] = (0, import_react22.useState)(false);
|
|
12707
|
+
(0, import_react22.useEffect)(() => {
|
|
12685
12708
|
setIsClient(typeof window !== "undefined");
|
|
12686
12709
|
}, []);
|
|
12687
12710
|
if (!isClient) return null;
|
|
@@ -12690,7 +12713,7 @@ var RichEditor = (props) => {
|
|
|
12690
12713
|
var RichEditor_default = RichEditor;
|
|
12691
12714
|
|
|
12692
12715
|
// src/components/FormFields/RichEditorFormField.tsx
|
|
12693
|
-
var
|
|
12716
|
+
var import_react23 = require("react");
|
|
12694
12717
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
12695
12718
|
var RichEditorFormField = (_a) => {
|
|
12696
12719
|
var _b = _a, {
|
|
@@ -12725,7 +12748,7 @@ var RichEditorFormField = (_a) => {
|
|
|
12725
12748
|
},
|
|
12726
12749
|
defaultValue: ""
|
|
12727
12750
|
});
|
|
12728
|
-
const [caracterQuantity, setCaracterQuantity] = (0,
|
|
12751
|
+
const [caracterQuantity, setCaracterQuantity] = (0, import_react23.useState)(maxLength);
|
|
12729
12752
|
const handleCharacterCountChange = (count) => {
|
|
12730
12753
|
if (maxLength !== void 0) {
|
|
12731
12754
|
setCaracterQuantity(Math.max(0, maxLength - count));
|
|
@@ -12773,7 +12796,7 @@ var RichEditorFormField = (_a) => {
|
|
|
12773
12796
|
|
|
12774
12797
|
// src/components/FormFields/CalendarFormField.tsx
|
|
12775
12798
|
var import_react_hook_form13 = require("react-hook-form");
|
|
12776
|
-
var
|
|
12799
|
+
var import_react24 = require("react");
|
|
12777
12800
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
12778
12801
|
var CalendarFormField = (_a) => {
|
|
12779
12802
|
var _b = _a, {
|
|
@@ -12797,7 +12820,7 @@ var CalendarFormField = (_a) => {
|
|
|
12797
12820
|
"allowPastDates",
|
|
12798
12821
|
"maxYearsFromNow"
|
|
12799
12822
|
]);
|
|
12800
|
-
const handleValidate = (0,
|
|
12823
|
+
const handleValidate = (0, import_react24.useCallback)(
|
|
12801
12824
|
(value) => {
|
|
12802
12825
|
var _a2;
|
|
12803
12826
|
if (value === void 0 || value === null) {
|
|
@@ -12852,7 +12875,7 @@ var CalendarFormField = (_a) => {
|
|
|
12852
12875
|
|
|
12853
12876
|
// src/components/FormFields/TimePickerFormField.tsx
|
|
12854
12877
|
var import_react_hook_form14 = require("react-hook-form");
|
|
12855
|
-
var
|
|
12878
|
+
var import_react25 = require("react");
|
|
12856
12879
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12857
12880
|
var TimePickerFormField = (_a) => {
|
|
12858
12881
|
var _b = _a, {
|
|
@@ -12870,7 +12893,7 @@ var TimePickerFormField = (_a) => {
|
|
|
12870
12893
|
"validationErrorMessage",
|
|
12871
12894
|
"rules"
|
|
12872
12895
|
]);
|
|
12873
|
-
const handleValidate = (0,
|
|
12896
|
+
const handleValidate = (0, import_react25.useCallback)(
|
|
12874
12897
|
(value) => {
|
|
12875
12898
|
var _a2;
|
|
12876
12899
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -12922,11 +12945,11 @@ var TimePickerFormField = (_a) => {
|
|
|
12922
12945
|
};
|
|
12923
12946
|
|
|
12924
12947
|
// src/hooks/useImageUpload.ts
|
|
12925
|
-
var
|
|
12948
|
+
var import_react26 = require("react");
|
|
12926
12949
|
var useImageUpload = (options) => {
|
|
12927
|
-
const [isUploading, setIsUploading] = (0,
|
|
12928
|
-
const [progress, setProgress] = (0,
|
|
12929
|
-
const [error, setError] = (0,
|
|
12950
|
+
const [isUploading, setIsUploading] = (0, import_react26.useState)(false);
|
|
12951
|
+
const [progress, setProgress] = (0, import_react26.useState)(null);
|
|
12952
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
12930
12953
|
const {
|
|
12931
12954
|
onSuccess,
|
|
12932
12955
|
onError,
|
|
@@ -12936,7 +12959,7 @@ var useImageUpload = (options) => {
|
|
|
12936
12959
|
allowedTypes = ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
|
12937
12960
|
uploadConfig
|
|
12938
12961
|
} = options;
|
|
12939
|
-
const validateFile = (0,
|
|
12962
|
+
const validateFile = (0, import_react26.useCallback)(
|
|
12940
12963
|
(file) => {
|
|
12941
12964
|
if (!allowedTypes.includes(file.type)) {
|
|
12942
12965
|
const errorMsg = "Tipo de arquivo n\xE3o suportado";
|
|
@@ -12954,7 +12977,7 @@ var useImageUpload = (options) => {
|
|
|
12954
12977
|
},
|
|
12955
12978
|
[allowedTypes, maxFileSize, onError]
|
|
12956
12979
|
);
|
|
12957
|
-
const uploadFile = (0,
|
|
12980
|
+
const uploadFile = (0, import_react26.useCallback)(
|
|
12958
12981
|
(file) => __async(null, null, function* () {
|
|
12959
12982
|
if (!validateFile(file)) {
|
|
12960
12983
|
return null;
|
|
@@ -13007,7 +13030,7 @@ var useImageUpload = (options) => {
|
|
|
13007
13030
|
}),
|
|
13008
13031
|
[validateFile, onSuccess, onError, onProgress]
|
|
13009
13032
|
);
|
|
13010
|
-
const reset = (0,
|
|
13033
|
+
const reset = (0, import_react26.useCallback)(() => {
|
|
13011
13034
|
setIsUploading(false);
|
|
13012
13035
|
setProgress(null);
|
|
13013
13036
|
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) => {
|
|
@@ -9030,12 +9047,18 @@ function Card(_a) {
|
|
|
9030
9047
|
"padding",
|
|
9031
9048
|
"radius"
|
|
9032
9049
|
]);
|
|
9033
|
-
return /* @__PURE__ */ jsx21(
|
|
9050
|
+
return /* @__PURE__ */ jsx21(
|
|
9051
|
+
CardStyled,
|
|
9052
|
+
__spreadProps(__spreadValues({}, props), {
|
|
9053
|
+
css: __spreadValues({ padding, borderRadius: radius }, props.css),
|
|
9054
|
+
children
|
|
9055
|
+
})
|
|
9056
|
+
);
|
|
9034
9057
|
}
|
|
9035
9058
|
|
|
9036
9059
|
// src/components/TextareaField.tsx
|
|
9037
9060
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
9038
|
-
import React8, { useRef as
|
|
9061
|
+
import React8, { useRef as useRef6, useState as useState4, useEffect as useEffect5 } from "react";
|
|
9039
9062
|
import { jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
9040
9063
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
9041
9064
|
display: "flex",
|
|
@@ -9102,9 +9125,9 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
9102
9125
|
});
|
|
9103
9126
|
var TextareaField = React8.forwardRef((_a, forwardedRef) => {
|
|
9104
9127
|
var _b = _a, { maxLength, color } = _b, props = __objRest(_b, ["maxLength", "color"]);
|
|
9105
|
-
const inputRef =
|
|
9128
|
+
const inputRef = useRef6(null);
|
|
9106
9129
|
const [remaining, setRemaining] = useState4(maxLength);
|
|
9107
|
-
|
|
9130
|
+
useEffect5(() => {
|
|
9108
9131
|
var _a2;
|
|
9109
9132
|
if (maxLength && inputRef.current) {
|
|
9110
9133
|
setRemaining(maxLength - ((_a2 = inputRef.current.value.length) != null ? _a2 : 0));
|
|
@@ -9400,7 +9423,7 @@ function Tooltip({
|
|
|
9400
9423
|
}
|
|
9401
9424
|
|
|
9402
9425
|
// src/components/MultiSelect/index.tsx
|
|
9403
|
-
import React9, { useCallback as useCallback2, useRef as
|
|
9426
|
+
import React9, { useCallback as useCallback2, useRef as useRef7, useState as useState7 } from "react";
|
|
9404
9427
|
import { DropdownMenu as DropdownMenu4, Theme as Theme3 } from "@radix-ui/themes";
|
|
9405
9428
|
import { FontAwesomeIcon as FontAwesomeIcon3 } from "@fortawesome/react-fontawesome";
|
|
9406
9429
|
import {
|
|
@@ -9577,7 +9600,7 @@ var MultiSelect = React9.forwardRef(
|
|
|
9577
9600
|
selectedScroll = false
|
|
9578
9601
|
}, fowardedRef) => {
|
|
9579
9602
|
const [isOpen, setIsOpen] = useState7(false);
|
|
9580
|
-
const triggerRef =
|
|
9603
|
+
const triggerRef = useRef7(null);
|
|
9581
9604
|
const [allOptionsSelected, setAllOptionsSelected] = useState7(false);
|
|
9582
9605
|
const labelByValue = useMemo2(() => {
|
|
9583
9606
|
return options.reduce((prev, curr) => {
|
|
@@ -10703,7 +10726,7 @@ function StateFormField({
|
|
|
10703
10726
|
}
|
|
10704
10727
|
|
|
10705
10728
|
// src/components/FormFields/AddressFormFields/CityFormField.tsx
|
|
10706
|
-
import { useEffect as
|
|
10729
|
+
import { useEffect as useEffect6, useState as useState8 } from "react";
|
|
10707
10730
|
import { useFormContext as useFormContext5, Controller as Controller2 } from "react-hook-form";
|
|
10708
10731
|
import { Fragment as Fragment4, jsx as jsx45 } from "react/jsx-runtime";
|
|
10709
10732
|
function CityFormField({
|
|
@@ -10718,7 +10741,7 @@ function CityFormField({
|
|
|
10718
10741
|
const selectedState = watch(stateName);
|
|
10719
10742
|
const [cities, setCities] = useState8([]);
|
|
10720
10743
|
const [loading, setLoading] = useState8(false);
|
|
10721
|
-
|
|
10744
|
+
useEffect6(() => {
|
|
10722
10745
|
if (!isBrazil) {
|
|
10723
10746
|
setCities([]);
|
|
10724
10747
|
return;
|
|
@@ -11106,10 +11129,10 @@ var EmailFormField = ({
|
|
|
11106
11129
|
import { useController as useController3 } from "react-hook-form";
|
|
11107
11130
|
|
|
11108
11131
|
// src/components/RichEditor/RichEditor.tsx
|
|
11109
|
-
import { useEffect as
|
|
11132
|
+
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
11110
11133
|
|
|
11111
11134
|
// src/components/RichEditor/QuillComponent.tsx
|
|
11112
|
-
import { useState as useState9, useRef as
|
|
11135
|
+
import { useState as useState9, useRef as useRef8, useEffect as useEffect7, useCallback as useCallback4 } from "react";
|
|
11113
11136
|
import { useQuill } from "react-quilljs";
|
|
11114
11137
|
|
|
11115
11138
|
// src/utils/uploadService.ts
|
|
@@ -12182,8 +12205,8 @@ var QuillComponent = ({
|
|
|
12182
12205
|
const [videoUrl, setVideoUrl] = useState9("");
|
|
12183
12206
|
const [showLinkModal, setShowLinkModal] = useState9(false);
|
|
12184
12207
|
const [linkUrl, setLinkUrl] = useState9("");
|
|
12185
|
-
const videoModalRef =
|
|
12186
|
-
const linkModalRef =
|
|
12208
|
+
const videoModalRef = useRef8(null);
|
|
12209
|
+
const linkModalRef = useRef8(null);
|
|
12187
12210
|
const { addToast, removeToast } = useToast();
|
|
12188
12211
|
const formatHTML = (html) => {
|
|
12189
12212
|
const parser = new DOMParser();
|
|
@@ -12279,7 +12302,7 @@ var QuillComponent = ({
|
|
|
12279
12302
|
}),
|
|
12280
12303
|
[disabled, quill, addToast, removeToast, uploadConfig, onChange]
|
|
12281
12304
|
);
|
|
12282
|
-
|
|
12305
|
+
useEffect7(() => {
|
|
12283
12306
|
if (quill && value) {
|
|
12284
12307
|
const currentContent = quill.root.innerHTML;
|
|
12285
12308
|
if (currentContent !== value) {
|
|
@@ -12293,7 +12316,7 @@ var QuillComponent = ({
|
|
|
12293
12316
|
}
|
|
12294
12317
|
}
|
|
12295
12318
|
}, [quill, value]);
|
|
12296
|
-
|
|
12319
|
+
useEffect7(() => {
|
|
12297
12320
|
if (quill) {
|
|
12298
12321
|
quill.on("text-change", (delta, oldDelta, source) => {
|
|
12299
12322
|
if (source === "user") {
|
|
@@ -12348,7 +12371,7 @@ var QuillComponent = ({
|
|
|
12348
12371
|
}, 2e3);
|
|
12349
12372
|
}
|
|
12350
12373
|
}, [quill, onChange, handleImageUpload, onCharacterCountChange]);
|
|
12351
|
-
|
|
12374
|
+
useEffect7(() => {
|
|
12352
12375
|
if (quill) {
|
|
12353
12376
|
quill.enable(!disabled);
|
|
12354
12377
|
if (!disabled) {
|
|
@@ -12415,7 +12438,7 @@ var QuillComponent = ({
|
|
|
12415
12438
|
setVideoUrl("");
|
|
12416
12439
|
setShowVideoModal(false);
|
|
12417
12440
|
}, [videoUrl, quill]);
|
|
12418
|
-
|
|
12441
|
+
useEffect7(() => {
|
|
12419
12442
|
const handleClickOutside = (event) => {
|
|
12420
12443
|
if (showVideoModal && videoModalRef.current && !videoModalRef.current.contains(event.target)) {
|
|
12421
12444
|
handleVideoCancel();
|
|
@@ -12578,7 +12601,7 @@ var QuillComponent_default = QuillComponent;
|
|
|
12578
12601
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
12579
12602
|
var RichEditor = (props) => {
|
|
12580
12603
|
const [isClient, setIsClient] = useState10(false);
|
|
12581
|
-
|
|
12604
|
+
useEffect8(() => {
|
|
12582
12605
|
setIsClient(typeof window !== "undefined");
|
|
12583
12606
|
}, []);
|
|
12584
12607
|
if (!isClient) return null;
|
package/package.json
CHANGED
package/src/components/Card.tsx
CHANGED
|
@@ -57,7 +57,10 @@ export function Card({
|
|
|
57
57
|
...props
|
|
58
58
|
}: CardProps) {
|
|
59
59
|
return (
|
|
60
|
-
<CardStyled
|
|
60
|
+
<CardStyled
|
|
61
|
+
{...props}
|
|
62
|
+
css={{ padding, borderRadius: radius, ...props.css }}
|
|
63
|
+
>
|
|
61
64
|
{children}
|
|
62
65
|
</CardStyled>
|
|
63
66
|
);
|
|
@@ -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
|