@diwauhris/ui 1.7.21 → 1.7.22

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
@@ -3976,16 +3976,21 @@ function Menu({ trigger, items, ariaLabel = "Menu", align = "right", open: contr
3976
3976
  const panelHeight = panelRef.current?.offsetHeight ?? items.length * ROW_HEIGHT + HEADER_HEIGHT;
3977
3977
  const spaceBelow = window.innerHeight - rect.bottom;
3978
3978
  const flipUp = spaceBelow < panelHeight + GAP + MARGIN && rect.top > spaceBelow;
3979
- const panelWidth = Math.max(panelRef.current?.offsetWidth ?? 0, rect.width, PANEL_MIN_WIDTH);
3980
- const desiredLeft = align === "left" ? rect.left : rect.right - panelWidth;
3981
- const maxLeft = window.innerWidth - panelWidth - MARGIN;
3982
- const left = Math.min(Math.max(MARGIN, desiredLeft), Math.max(MARGIN, maxLeft));
3979
+ const available = window.innerWidth - 16;
3980
+ const horizontal = align === "left" ? {
3981
+ left: Math.max(MARGIN, Math.min(rect.left, window.innerWidth - MARGIN)),
3982
+ right: "auto"
3983
+ } : {
3984
+ right: Math.max(MARGIN, window.innerWidth - rect.right),
3985
+ left: "auto"
3986
+ };
3983
3987
  setPanelStyle({
3984
3988
  position: "fixed",
3985
3989
  ...flipUp ? { bottom: Math.max(MARGIN, window.innerHeight - rect.top + GAP) } : { top: rect.bottom + GAP },
3986
- left,
3990
+ ...horizontal,
3987
3991
  zIndex: 9999,
3988
- minWidth: Math.max(rect.width, PANEL_MIN_WIDTH)
3992
+ minWidth: PANEL_MIN_WIDTH,
3993
+ maxWidth: available
3989
3994
  });
3990
3995
  };
3991
3996
  reposition();
package/lib/index.mjs CHANGED
@@ -3952,16 +3952,21 @@ function Menu({ trigger, items, ariaLabel = "Menu", align = "right", open: contr
3952
3952
  const panelHeight = panelRef.current?.offsetHeight ?? items.length * ROW_HEIGHT + HEADER_HEIGHT;
3953
3953
  const spaceBelow = window.innerHeight - rect.bottom;
3954
3954
  const flipUp = spaceBelow < panelHeight + GAP + MARGIN && rect.top > spaceBelow;
3955
- const panelWidth = Math.max(panelRef.current?.offsetWidth ?? 0, rect.width, PANEL_MIN_WIDTH);
3956
- const desiredLeft = align === "left" ? rect.left : rect.right - panelWidth;
3957
- const maxLeft = window.innerWidth - panelWidth - MARGIN;
3958
- const left = Math.min(Math.max(MARGIN, desiredLeft), Math.max(MARGIN, maxLeft));
3955
+ const available = window.innerWidth - 16;
3956
+ const horizontal = align === "left" ? {
3957
+ left: Math.max(MARGIN, Math.min(rect.left, window.innerWidth - MARGIN)),
3958
+ right: "auto"
3959
+ } : {
3960
+ right: Math.max(MARGIN, window.innerWidth - rect.right),
3961
+ left: "auto"
3962
+ };
3959
3963
  setPanelStyle({
3960
3964
  position: "fixed",
3961
3965
  ...flipUp ? { bottom: Math.max(MARGIN, window.innerHeight - rect.top + GAP) } : { top: rect.bottom + GAP },
3962
- left,
3966
+ ...horizontal,
3963
3967
  zIndex: 9999,
3964
- minWidth: Math.max(rect.width, PANEL_MIN_WIDTH)
3968
+ minWidth: PANEL_MIN_WIDTH,
3969
+ maxWidth: available
3965
3970
  });
3966
3971
  };
3967
3972
  reposition();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diwauhris/ui",
3
3
  "private": false,
4
- "version": "1.7.21",
4
+ "version": "1.7.22",
5
5
  "type": "module",
6
6
  "description": "DIWA UHRIS UI component library — React + Tailwind CSS",
7
7
  "keywords": [