Files
NapCatQQ/.pnpm-store/v3/files/05/1a16b5a2f7c94c2dc76dfb082d0de6ba0707e08198a9642dd70280803361fef96162d375b859275c49dd4c320e7cb9fc48d081ca2df8e13871611a575f2041
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

38 lines
810 B
Plaintext

// src/index.ts
import {
ariaHideOutside,
useOverlay,
usePreventScroll,
useOverlayFocusContain
} from "@react-aria/overlays";
import { mergeProps } from "@react-aria/utils";
import { useEffect } from "react";
function useAriaModalOverlay(props = {
shouldBlockScroll: true
}, state, ref) {
let { overlayProps, underlayProps } = useOverlay(
{
...props,
isOpen: state.isOpen,
onClose: state.close
},
ref
);
usePreventScroll({
isDisabled: !state.isOpen || !props.shouldBlockScroll
});
useOverlayFocusContain();
useEffect(() => {
if (state.isOpen && ref.current) {
return ariaHideOutside([ref.current]);
}
}, [state.isOpen, ref]);
return {
modalProps: mergeProps(overlayProps),
underlayProps
};
}
export {
useAriaModalOverlay
};