@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 +11 -6
- package/lib/index.mjs +11 -6
- package/package.json +1 -1
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
|
|
3980
|
-
const
|
|
3981
|
-
|
|
3982
|
-
|
|
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
|
-
|
|
3990
|
+
...horizontal,
|
|
3987
3991
|
zIndex: 9999,
|
|
3988
|
-
minWidth:
|
|
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
|
|
3956
|
-
const
|
|
3957
|
-
|
|
3958
|
-
|
|
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
|
-
|
|
3966
|
+
...horizontal,
|
|
3963
3967
|
zIndex: 9999,
|
|
3964
|
-
minWidth:
|
|
3968
|
+
minWidth: PANEL_MIN_WIDTH,
|
|
3969
|
+
maxWidth: available
|
|
3965
3970
|
});
|
|
3966
3971
|
};
|
|
3967
3972
|
reposition();
|