wini-web-components 2.6.4 → 2.6.7
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/dist/component/button/button.d.ts +1 -3
- package/dist/component/button/button.js +65 -14
- package/dist/component/date-time-picker/date-time-picker.js +35 -81
- package/dist/component/input-otp/input-otp.js +22 -8
- package/dist/component/popup/popup.js +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,5 @@ interface ButtonProps {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
19
19
|
}
|
|
20
|
-
export declare
|
|
21
|
-
render(): React.JSX.Element;
|
|
22
|
-
}
|
|
20
|
+
export declare function Button(props: ButtonProps): React.JSX.Element;
|
|
23
21
|
export {};
|
|
@@ -1,22 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Button =
|
|
7
|
-
const react_1 =
|
|
39
|
+
exports.Button = Button;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const text_1 = require("../text/text");
|
|
9
42
|
const button_module_css_1 = __importDefault(require("./button.module.css"));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
function Button(props) {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
const btnRef = (0, react_1.useRef)(null);
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
47
|
+
if (btnRef.current) {
|
|
48
|
+
switch (props.type) {
|
|
49
|
+
case "submit":
|
|
50
|
+
function handleSubmit(ev) {
|
|
51
|
+
switch (ev.key.toLowerCase()) {
|
|
52
|
+
case "enter":
|
|
53
|
+
btnRef.current.click();
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
window.addEventListener("keydown", handleSubmit);
|
|
60
|
+
return () => { window.removeEventListener("keydown", handleSubmit); };
|
|
61
|
+
default:
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [props.type, btnRef.current]);
|
|
66
|
+
return props.linkTo ? react_1.default.createElement("a", { id: props.id, href: props.disabled ? undefined : props.linkTo, target: props.target, className: `${button_module_css_1.default['button-container']} row ${(_a = props.className) !== null && _a !== void 0 ? _a : "button-text-3"}`, style: props.style, onClick: props.onClick },
|
|
67
|
+
props.prefix,
|
|
68
|
+
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, props.label),
|
|
69
|
+
props.suffix) : react_1.default.createElement("button", { ref: btnRef, id: props.id, type: (_b = props.type) !== null && _b !== void 0 ? _b : "button", disabled: props.disabled, className: `${button_module_css_1.default['button-container']} row ${(_c = props.className) !== null && _c !== void 0 ? _c : "button-text-3"}`, style: props.style, onClick: props.onClick },
|
|
70
|
+
props.prefix,
|
|
71
|
+
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, props.label),
|
|
72
|
+
props.suffix);
|
|
21
73
|
}
|
|
22
|
-
exports.Button = Button;
|
|
@@ -111,7 +111,7 @@ function DateTimePicker(props) {
|
|
|
111
111
|
return react_2.default.createElement(text_1.Text, { className: date_time_picker_module_css_1.default["value"] }, dateToString(value, `dd/mm/yyyy${((_b = props.pickerType) === null || _b === void 0 ? void 0 : _b.includes("time")) ? " hh:mm" : ""}`));
|
|
112
112
|
else
|
|
113
113
|
return react_2.default.createElement(react_2.default.Fragment, null,
|
|
114
|
-
react_2.default.createElement(text_1.Text, { className: date_time_picker_module_css_1.default["value"] },
|
|
114
|
+
react_2.default.createElement(text_1.Text, { className: date_time_picker_module_css_1.default["value"], style: { flex: "none", width: "fit-content" } },
|
|
115
115
|
dateToString((_c = value.start) !== null && _c !== void 0 ? _c : new Date(), `dd/mm/yyyy${(((_d = props.pickerType) === null || _d === void 0 ? void 0 : _d.includes("time")) || props.pickerType === "auto") ? " hh:mm" : ""}`),
|
|
116
116
|
" - ",
|
|
117
117
|
dateToString((_e = value.end) !== null && _e !== void 0 ? _e : new Date(), `dd/mm/yyyy${(((_f = props.pickerType) === null || _f === void 0 ? void 0 : _f.includes("time")) || props.pickerType === "auto") ? " hh:mm" : ""}`)),
|
|
@@ -140,7 +140,7 @@ function DateTimePicker(props) {
|
|
|
140
140
|
(0, popup_1.showPopup)({
|
|
141
141
|
ref: popupRef,
|
|
142
142
|
clickOverlayClosePopup: true,
|
|
143
|
-
content: react_2.default.createElement(PopupDateTimePicker, { ref: popupRef, value: value instanceof Date ? value : value === null || value === void 0 ? void 0 : value.start, endValue: value instanceof Date ? undefined : value === null || value === void 0 ? void 0 : value.end, pickerType: props.pickerType, enableRepeat: props.enableRepeat, style: { top: rect.bottom + 2, left: rect.left + 16 }, onApply: (ev) => {
|
|
143
|
+
content: react_2.default.createElement(PopupDateTimePicker, { ref: popupRef, max: props.max, min: props.min, value: value instanceof Date ? value : value === null || value === void 0 ? void 0 : value.start, endValue: value instanceof Date ? undefined : value === null || value === void 0 ? void 0 : value.end, pickerType: props.pickerType, enableRepeat: props.enableRepeat, style: { top: rect.bottom + 2, left: rect.left + 16 }, onApply: (ev) => {
|
|
144
144
|
setValue(ev);
|
|
145
145
|
(0, popup_1.closePopup)(popupRef);
|
|
146
146
|
if (props.onChange)
|
|
@@ -210,7 +210,6 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
210
210
|
const inputStartRef = (0, react_1.useRef)(null);
|
|
211
211
|
const inputEndRef = (0, react_1.useRef)(null);
|
|
212
212
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
213
|
-
const [dropdownChildren, setDropdownChildren] = (0, react_1.useState)();
|
|
214
213
|
const regexDate = /[0-9]{1,2}(\/|-)[0-9]{1,2}(\/|-)[0-9]{4}/g;
|
|
215
214
|
const regexTime = /^(?:[01]\d|2[0-3]):[0-5]\d(?:[:][0-5]\d)?$/g;
|
|
216
215
|
(0, react_1.useEffect)(() => {
|
|
@@ -266,7 +265,6 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
266
265
|
}, [endValue, inputEndRef, pickerType]);
|
|
267
266
|
return react_2.default.createElement("div", { className: "col", style: Object.assign({ width: "31.2rem" }, style) },
|
|
268
267
|
react_2.default.createElement(popup_1.Popup, { ref: popupRef }),
|
|
269
|
-
dropdownChildren ? react_2.default.createElement(Dropdown, { style: dropdownChildren.style, children: dropdownChildren.data, onClose: () => { setDropdownChildren(undefined); } }) : null,
|
|
270
268
|
react_2.default.createElement(calendar_1.Calendar, { min: min, max: max, range: pickerType.includes("range") || pickerType === "auto", value: pickerType === "date" || pickerType === "datetime" ? methods.watch('date-start') : (methods.watch('date-start') && methods.watch('date-end') ? { sTime: methods.watch('date-start'), eTime: methods.watch('date-end') } : undefined), header: pickerType !== "date" && react_2.default.createElement("div", { className: 'row', style: { flexWrap: "wrap", gap: "0.8rem 1.2rem", padding: "1.6rem", borderBottom: "var(--neutral-main-border)" } },
|
|
271
269
|
react_2.default.createElement(text_field_1.TextField, { ref: inputStartRef, autoComplete: "off", className: 'col12 body-3', style: { "--gutter": "1.2rem", padding: "0.4rem 1.2rem" }, placeholder: pickerType.includes("range") || pickerType === "auto" ? t("start-date") : "dd/mm/yyyy", onComplete: (ev) => ev.target.blur(), onBlur: (ev) => {
|
|
272
270
|
const inputValue = ev.target.value;
|
|
@@ -279,7 +277,7 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
279
277
|
methods.setValue('date-start', dateValue);
|
|
280
278
|
}
|
|
281
279
|
else
|
|
282
|
-
ev.target.value = dateToString(methods.getValues('date-start'));
|
|
280
|
+
ev.target.value = methods.getValues('date-start') ? dateToString(methods.getValues('date-start')) : "";
|
|
283
281
|
} }),
|
|
284
282
|
(pickerType.includes("range") || pickerType === "auto") &&
|
|
285
283
|
react_2.default.createElement(text_field_1.TextField, { ref: inputEndRef, autoComplete: "off", className: 'col12 body-3', style: { "--gutter": "1.2rem", padding: "0.4rem 1.2rem" }, placeholder: t("end-date"), onComplete: (ev) => ev.target.blur(), onBlur: (ev) => {
|
|
@@ -293,7 +291,7 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
293
291
|
methods.setValue('date-end', dateValue);
|
|
294
292
|
}
|
|
295
293
|
else
|
|
296
|
-
ev.target.value = dateToString(methods.getValues('date-end'));
|
|
294
|
+
ev.target.value = methods.getValues('date-end') ? dateToString(methods.getValues('date-end')) : "";
|
|
297
295
|
} }),
|
|
298
296
|
selectTime && react_2.default.createElement(react_2.default.Fragment, null,
|
|
299
297
|
react_2.default.createElement(text_field_1.TextField, { autoComplete: "off", name: 'time-start', style: { "--gutter": "1.2rem", padding: "0.4rem 1.2rem" }, onComplete: (ev) => { ev.target.blur(); }, register: methods.register("time-start", {
|
|
@@ -304,26 +302,24 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
304
302
|
}
|
|
305
303
|
else
|
|
306
304
|
ev.target.value = "";
|
|
307
|
-
setDropdownChildren(undefined);
|
|
308
305
|
}
|
|
309
306
|
}), className: 'col12 body-3', placeholder: "hh:mm", onFocus: (ev) => {
|
|
310
307
|
const rect = ev.target.closest("div").getBoundingClientRect();
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}, 168);
|
|
308
|
+
(0, popup_1.showPopup)({
|
|
309
|
+
ref: popupRef,
|
|
310
|
+
clickOverlayClosePopup: true,
|
|
311
|
+
content: react_2.default.createElement("div", { className: `col ${date_time_picker_module_css_1.default['popup-actions']}`, style: { maxHeight: "24rem", top: rect.bottom + 2, right: document.body.offsetWidth - rect.right, width: rect.width, overflow: "hidden auto", backgroundColor: "var(--neutral-absolute-background-color)", borderRadius: "0.8rem" } }, Array.from({ length: 48 }).map((_, i) => {
|
|
312
|
+
if (i % 2 === 0)
|
|
313
|
+
var timeValue = `${(i / 2) < 9 ? `0${i / 2}` : (i / 2)}:00`;
|
|
314
|
+
else
|
|
315
|
+
timeValue = `${((i - 1) / 2) < 9 ? `0${(i - 1) / 2}` : ((i - 1) / 2)}:30`;
|
|
316
|
+
return react_2.default.createElement("button", { key: "time-" + i, type: "button", className: "row", onClick: () => {
|
|
317
|
+
methods.setValue("time-start", timeValue);
|
|
318
|
+
(0, popup_1.closePopup)(popupRef);
|
|
319
|
+
} },
|
|
320
|
+
react_2.default.createElement(text_1.Text, { className: "body-3" }, timeValue));
|
|
321
|
+
}))
|
|
322
|
+
});
|
|
327
323
|
} }),
|
|
328
324
|
(pickerType.includes("range") || pickerType === "auto") &&
|
|
329
325
|
react_2.default.createElement(text_field_1.TextField, { autoComplete: "off", name: 'time-end', style: { "--gutter": "1.2rem", padding: "0.4rem 1.2rem" }, onComplete: (ev) => { ev.target.blur(); }, register: methods.register("time-end", {
|
|
@@ -334,26 +330,24 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
334
330
|
}
|
|
335
331
|
else
|
|
336
332
|
ev.target.value = "";
|
|
337
|
-
setDropdownChildren(undefined);
|
|
338
333
|
}
|
|
339
334
|
}), className: 'col12 body-3', placeholder: "hh:mm", onFocus: (ev) => {
|
|
340
335
|
const rect = ev.target.closest("div").getBoundingClientRect();
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}, 168);
|
|
336
|
+
(0, popup_1.showPopup)({
|
|
337
|
+
ref: popupRef,
|
|
338
|
+
clickOverlayClosePopup: true,
|
|
339
|
+
content: react_2.default.createElement("div", { className: `col ${date_time_picker_module_css_1.default['popup-actions']}`, style: { maxHeight: "24rem", top: rect.bottom + 2, right: document.body.offsetWidth - rect.right, width: rect.width, overflow: "hidden auto", backgroundColor: "var(--neutral-absolute-background-color)", borderRadius: "0.8rem" } }, Array.from({ length: 48 }).map((_, i) => {
|
|
340
|
+
if (i % 2 === 0)
|
|
341
|
+
var timeValue = `${(i / 2) < 9 ? `0${i / 2}` : (i / 2)}:00`;
|
|
342
|
+
else
|
|
343
|
+
timeValue = `${((i - 1) / 2) < 9 ? `0${(i - 1) / 2}` : ((i - 1) / 2)}:30`;
|
|
344
|
+
return react_2.default.createElement("button", { key: "time-" + i, type: "button", className: "row", onClick: () => {
|
|
345
|
+
methods.setValue("time-end", timeValue);
|
|
346
|
+
(0, popup_1.closePopup)(popupRef);
|
|
347
|
+
} },
|
|
348
|
+
react_2.default.createElement(text_1.Text, { className: "body-3" }, timeValue));
|
|
349
|
+
}))
|
|
350
|
+
});
|
|
357
351
|
} }))), footer: pickerType !== "date" && react_2.default.createElement(react_2.default.Fragment, null,
|
|
358
352
|
isRepeat && react_2.default.createElement("div", { className: 'col', style: { borderTop: "var(--neutral-main-border)" } },
|
|
359
353
|
react_2.default.createElement("div", { className: 'row', style: { gap: 4, padding: "1.2rem 1.6rem" } },
|
|
@@ -506,7 +500,7 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
506
500
|
let timeEndValue = selectTime ? (((_b = methods.getValues("time-end")) === null || _b === void 0 ? void 0 : _b.length) ? methods.getValues("time-end") : "23:59") : "23:59";
|
|
507
501
|
dateEndValue.setHours(parseInt(timeEndValue.split(':')[0]), parseInt(timeEndValue.split(':')[1]), selectTime ? 59 : 0, 0);
|
|
508
502
|
}
|
|
509
|
-
onApply(!pickerType.includes("range") ? dateStartValue : { start: dateStartValue, end: dateEndValue, repeatData: isRepeat ? repeatData : undefined });
|
|
503
|
+
onApply(!pickerType.includes("range") && pickerType !== "auto" ? dateStartValue : { start: dateStartValue, end: dateEndValue, repeatData: isRepeat ? repeatData : undefined });
|
|
510
504
|
(0, popup_1.closePopup)(ref);
|
|
511
505
|
} }))), onSelect: (ev) => {
|
|
512
506
|
if (pickerType !== "date") {
|
|
@@ -532,43 +526,3 @@ const PopupDateTimePicker = (0, react_1.forwardRef)(function PopupDateTimePicker
|
|
|
532
526
|
}
|
|
533
527
|
} }));
|
|
534
528
|
});
|
|
535
|
-
const Dropdown = (props) => {
|
|
536
|
-
var _a;
|
|
537
|
-
const containerRef = (0, react_1.useRef)(null);
|
|
538
|
-
(0, react_1.useEffect)(() => {
|
|
539
|
-
if (containerRef.current) {
|
|
540
|
-
function onClickDropDown(ev) {
|
|
541
|
-
var _a;
|
|
542
|
-
if (ev.target !== containerRef.current && !((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.contains(ev.target)))
|
|
543
|
-
props.onClose();
|
|
544
|
-
}
|
|
545
|
-
window.document.body.addEventListener("click", onClickDropDown);
|
|
546
|
-
return () => {
|
|
547
|
-
window.document.body.removeEventListener("click", onClickDropDown);
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
}, [containerRef]);
|
|
551
|
-
(0, react_1.useEffect)(() => {
|
|
552
|
-
if (containerRef.current && containerRef.current.firstChild) {
|
|
553
|
-
const popupContent = containerRef.current.firstChild;
|
|
554
|
-
const rect = popupContent.getBoundingClientRect();
|
|
555
|
-
if (rect.x < 0) {
|
|
556
|
-
popupContent.style.left = "0px";
|
|
557
|
-
popupContent.style.right = "unset";
|
|
558
|
-
}
|
|
559
|
-
else if (rect.right > document.body.offsetWidth) {
|
|
560
|
-
popupContent.style.right = "0px";
|
|
561
|
-
popupContent.style.left = "unset";
|
|
562
|
-
}
|
|
563
|
-
if (rect.y < 0) {
|
|
564
|
-
popupContent.style.top = "0px";
|
|
565
|
-
popupContent.style.bottom = "unset";
|
|
566
|
-
}
|
|
567
|
-
else if (rect.bottom > document.body.offsetHeight) {
|
|
568
|
-
popupContent.style.bottom = "0px";
|
|
569
|
-
popupContent.style.top = "unset";
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}, [containerRef]);
|
|
573
|
-
return react_2.default.createElement("div", { ref: containerRef, className: "col popup-actions", style: Object.assign({ position: "fixed", zIndex: 99, backgroundColor: "var(--neutral-absolute-background-color)", overflow: "hidden auto", borderRadius: "0.8rem", boxShadow: "0 2px 8px rgba(0, 0, 0, 0.25)" }, ((_a = props.style) !== null && _a !== void 0 ? _a : {})) }, props.children);
|
|
574
|
-
};
|
|
@@ -97,14 +97,28 @@ class InputOtp extends react_1.default.Component {
|
|
|
97
97
|
default:
|
|
98
98
|
ev.preventDefault();
|
|
99
99
|
ev.stopPropagation();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
if (key === "v" && ev.ctrlKey) {
|
|
101
|
+
return navigator.clipboard.readText().then(text => {
|
|
102
|
+
const otpRegex = /^\d{6}$/g;
|
|
103
|
+
if (otpRegex.test(text)) {
|
|
104
|
+
const inputList = [...ev.target.closest("div").childNodes];
|
|
105
|
+
inputList.forEach((input, i) => {
|
|
106
|
+
input.value = text[i];
|
|
107
|
+
input.focus();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const numberCheck = /[0-9]/g;
|
|
114
|
+
if (numberCheck.test(key) && !key.startsWith("f")) {
|
|
115
|
+
if (!ev.target.value.length)
|
|
116
|
+
ev.target.value = key;
|
|
117
|
+
if (((_b = ev.target.nextSibling) === null || _b === void 0 ? void 0 : _b.localName) === "input" && !ev.target.nextSibling.value.length)
|
|
118
|
+
ev.target.nextSibling.focus();
|
|
119
|
+
else
|
|
120
|
+
ev.target.blur();
|
|
121
|
+
}
|
|
108
122
|
}
|
|
109
123
|
break;
|
|
110
124
|
}
|
|
@@ -86,7 +86,7 @@ function PopupOverlay({ children, onClose, className, style, onOpen }) {
|
|
|
86
86
|
(0, react_1.useEffect)(() => {
|
|
87
87
|
if (overlayRef.current && onClose) {
|
|
88
88
|
const onClickDropDown = (ev) => {
|
|
89
|
-
if (ev.target
|
|
89
|
+
if (ev.target === overlayRef.current || !overlayRef.current.contains(ev.target))
|
|
90
90
|
onClose(ev);
|
|
91
91
|
};
|
|
92
92
|
window.document.body.addEventListener("mousedown", onClickDropDown);
|
|
@@ -94,11 +94,11 @@ function PopupOverlay({ children, onClose, className, style, onOpen }) {
|
|
|
94
94
|
window.document.body.removeEventListener("mousedown", onClickDropDown);
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
}, [overlayRef]);
|
|
97
|
+
}, [overlayRef.current]);
|
|
98
98
|
(0, react_1.useEffect)(() => {
|
|
99
99
|
if (overlayRef.current && onOpen)
|
|
100
100
|
onOpen(overlayRef.current);
|
|
101
|
-
}, [overlayRef, onOpen]);
|
|
101
|
+
}, [overlayRef.current, onOpen]);
|
|
102
102
|
(0, react_1.useEffect)(() => {
|
|
103
103
|
if (overlayRef.current && overlayRef.current.firstChild) {
|
|
104
104
|
const popupContent = overlayRef.current.firstChild;
|