@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 CHANGED
@@ -1410,19 +1410,22 @@ function DatePicker({ value, onChange, placeholder, className, disabled, error,
1410
1410
  skipNextOpen.current = false;
1411
1411
  return;
1412
1412
  }
1413
- const rect = wrapperRef.current.getBoundingClientRect();
1414
- const spaceBelow = window.innerHeight - rect.bottom;
1415
- const spaceAbove = rect.top;
1416
- const isNarrow = window.innerWidth < 368;
1417
- const style = {
1418
- position: "fixed",
1419
- left: isNarrow ? 8 : Math.max(8, Math.min(rect.left, window.innerWidth - POPOVER_WIDTH - 8)),
1420
- width: isNarrow ? `calc(100vw - 16px)` : void 0
1421
- };
1422
- if (spaceBelow >= CALENDAR_HEIGHT || spaceBelow >= spaceAbove) style.top = rect.bottom + 6;
1423
- else style.top = rect.top - CALENDAR_HEIGHT - 6;
1424
- setPopupStyle(style);
1425
- setIsOpen(true);
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
- const rect = wrapperRef.current.getBoundingClientRect();
1390
- const spaceBelow = window.innerHeight - rect.bottom;
1391
- const spaceAbove = rect.top;
1392
- const isNarrow = window.innerWidth < 368;
1393
- const style = {
1394
- position: "fixed",
1395
- left: isNarrow ? 8 : Math.max(8, Math.min(rect.left, window.innerWidth - POPOVER_WIDTH - 8)),
1396
- width: isNarrow ? `calc(100vw - 16px)` : void 0
1397
- };
1398
- if (spaceBelow >= CALENDAR_HEIGHT || spaceBelow >= spaceAbove) style.top = rect.bottom + 6;
1399
- else style.top = rect.top - CALENDAR_HEIGHT - 6;
1400
- setPopupStyle(style);
1401
- setIsOpen(true);
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) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diwauhris/ui",
3
3
  "private": false,
4
- "version": "1.7.14",
4
+ "version": "1.7.15",
5
5
  "type": "module",
6
6
  "description": "DIWA UHRIS UI component library — React + Tailwind CSS",
7
7
  "keywords": [