@diwauhris/ui 1.7.14 → 1.7.15
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/lib/index.cjs +16 -13
- package/lib/index.mjs +16 -13
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1410,19 +1410,22 @@ function DatePicker({ value, onChange, placeholder, className, disabled, error,
|
|
|
1410
1410
|
skipNextOpen.current = false;
|
|
1411
1411
|
return;
|
|
1412
1412
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1413
|
+
requestAnimationFrame(() => {
|
|
1414
|
+
if (!wrapperRef.current) return;
|
|
1415
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1416
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1417
|
+
const spaceAbove = rect.top;
|
|
1418
|
+
const isNarrow = window.innerWidth < 368;
|
|
1419
|
+
const style = {
|
|
1420
|
+
position: "fixed",
|
|
1421
|
+
left: isNarrow ? 8 : Math.max(8, Math.min(rect.left, window.innerWidth - POPOVER_WIDTH - 8)),
|
|
1422
|
+
width: isNarrow ? `calc(100vw - 16px)` : void 0
|
|
1423
|
+
};
|
|
1424
|
+
if (spaceBelow >= CALENDAR_HEIGHT || spaceBelow >= spaceAbove) style.top = rect.bottom + 6;
|
|
1425
|
+
else style.top = Math.max(8, rect.top - CALENDAR_HEIGHT - 6);
|
|
1426
|
+
setPopupStyle(style);
|
|
1427
|
+
setIsOpen(true);
|
|
1428
|
+
});
|
|
1426
1429
|
}, [disabled]);
|
|
1427
1430
|
(0, react.useEffect)(() => {
|
|
1428
1431
|
function handleClickOutside(e) {
|
package/lib/index.mjs
CHANGED
|
@@ -1386,19 +1386,22 @@ function DatePicker({ value, onChange, placeholder, className, disabled, error,
|
|
|
1386
1386
|
skipNextOpen.current = false;
|
|
1387
1387
|
return;
|
|
1388
1388
|
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1389
|
+
requestAnimationFrame(() => {
|
|
1390
|
+
if (!wrapperRef.current) return;
|
|
1391
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
1392
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
1393
|
+
const spaceAbove = rect.top;
|
|
1394
|
+
const isNarrow = window.innerWidth < 368;
|
|
1395
|
+
const style = {
|
|
1396
|
+
position: "fixed",
|
|
1397
|
+
left: isNarrow ? 8 : Math.max(8, Math.min(rect.left, window.innerWidth - POPOVER_WIDTH - 8)),
|
|
1398
|
+
width: isNarrow ? `calc(100vw - 16px)` : void 0
|
|
1399
|
+
};
|
|
1400
|
+
if (spaceBelow >= CALENDAR_HEIGHT || spaceBelow >= spaceAbove) style.top = rect.bottom + 6;
|
|
1401
|
+
else style.top = Math.max(8, rect.top - CALENDAR_HEIGHT - 6);
|
|
1402
|
+
setPopupStyle(style);
|
|
1403
|
+
setIsOpen(true);
|
|
1404
|
+
});
|
|
1402
1405
|
}, [disabled]);
|
|
1403
1406
|
useEffect(() => {
|
|
1404
1407
|
function handleClickOutside(e) {
|