@diwauhris/ui 1.7.37 → 1.7.38

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
@@ -3994,14 +3994,24 @@ function Dropdown({ trigger, isOpen, onToggle, onClose, children, triggerClassNa
3994
3994
  const [panelStyle, setPanelStyle] = (0, react.useState)({});
3995
3995
  (0, react.useEffect)(() => {
3996
3996
  if (!isOpen || !triggerRef.current) return;
3997
- const rect = triggerRef.current.getBoundingClientRect();
3998
- setPanelStyle({
3999
- position: "fixed",
4000
- top: rect.bottom + 4,
4001
- left: rect.left,
4002
- zIndex: 9999,
4003
- minWidth: Math.max(rect.width, 180)
4004
- });
3997
+ const updatePosition = () => {
3998
+ if (!triggerRef.current) return;
3999
+ const rect = triggerRef.current.getBoundingClientRect();
4000
+ setPanelStyle({
4001
+ position: "fixed",
4002
+ top: rect.bottom + 4,
4003
+ left: rect.left,
4004
+ zIndex: 9999,
4005
+ minWidth: Math.max(rect.width, 180)
4006
+ });
4007
+ };
4008
+ updatePosition();
4009
+ window.addEventListener("scroll", updatePosition, true);
4010
+ window.addEventListener("resize", updatePosition);
4011
+ return () => {
4012
+ window.removeEventListener("scroll", updatePosition, true);
4013
+ window.removeEventListener("resize", updatePosition);
4014
+ };
4005
4015
  }, [isOpen]);
4006
4016
  (0, react.useEffect)(() => {
4007
4017
  if (!isOpen) return;
package/lib/index.mjs CHANGED
@@ -3970,14 +3970,24 @@ function Dropdown({ trigger, isOpen, onToggle, onClose, children, triggerClassNa
3970
3970
  const [panelStyle, setPanelStyle] = useState({});
3971
3971
  useEffect(() => {
3972
3972
  if (!isOpen || !triggerRef.current) return;
3973
- const rect = triggerRef.current.getBoundingClientRect();
3974
- setPanelStyle({
3975
- position: "fixed",
3976
- top: rect.bottom + 4,
3977
- left: rect.left,
3978
- zIndex: 9999,
3979
- minWidth: Math.max(rect.width, 180)
3980
- });
3973
+ const updatePosition = () => {
3974
+ if (!triggerRef.current) return;
3975
+ const rect = triggerRef.current.getBoundingClientRect();
3976
+ setPanelStyle({
3977
+ position: "fixed",
3978
+ top: rect.bottom + 4,
3979
+ left: rect.left,
3980
+ zIndex: 9999,
3981
+ minWidth: Math.max(rect.width, 180)
3982
+ });
3983
+ };
3984
+ updatePosition();
3985
+ window.addEventListener("scroll", updatePosition, true);
3986
+ window.addEventListener("resize", updatePosition);
3987
+ return () => {
3988
+ window.removeEventListener("scroll", updatePosition, true);
3989
+ window.removeEventListener("resize", updatePosition);
3990
+ };
3981
3991
  }, [isOpen]);
3982
3992
  useEffect(() => {
3983
3993
  if (!isOpen) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@diwauhris/ui",
3
3
  "private": false,
4
- "version": "1.7.37",
4
+ "version": "1.7.38",
5
5
  "type": "module",
6
6
  "description": "DIWA UHRIS UI component library — React + Tailwind CSS",
7
7
  "keywords": [