@vx-oss/heroui-v2-use-aria-modal-overlay 2.2.20-alpha.0

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/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ SPDX-License-Identifier: MIT
2
+
3
+ The MIT License (MIT)
4
+
5
+ Parameters
6
+
7
+ Creator / Maintainer : Vezham Technologies Private Limited
8
+ Original Author : NextUI Inc
9
+ Licensor : Vezham Technologies Private Limited
10
+
11
+ Copyright © 2025, Vezham Technologies Private Limited. All rights reserved.
12
+ Copyright (c) 2020, NextUI Inc.
13
+
14
+ ---
15
+
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ of this software and associated documentation files (the "Software"), to deal
18
+ in the Software without restriction, including without limitation the rights
19
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is
21
+ furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all
24
+ copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @vx-oss/heroui-v2-use-aria-modal-overlay
2
+
3
+ A Quick description of the component
4
+
5
+ > This is an internal utility, not intended for public usage.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ yarn add @vx-oss/heroui-v2-use-aria-modal-overlay
11
+ # or
12
+ npm i @vx-oss/heroui-v2-use-aria-modal-overlay
13
+ ```
14
+
15
+ ## Contribution
16
+
17
+ Yes please! See the
18
+ [contributing guidelines](https://github.com/heroui-inc/heroui/blob/master/CONTRIBUTING.md)
19
+ for details.
20
+
21
+ ## License
22
+
23
+ This project is licensed under the terms of the
24
+ [MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
@@ -0,0 +1,20 @@
1
+ import { AriaModalOverlayProps, ModalOverlayAria } from '@react-aria/overlays';
2
+ import { OverlayTriggerState } from '@react-stately/overlays';
3
+ import { RefObject } from 'react';
4
+
5
+ interface UseAriaModalOverlayProps extends AriaModalOverlayProps {
6
+ }
7
+ /**
8
+ * Provides the behavior and accessibility implementation for a modal component.
9
+ * A modal is an overlay element which blocks interaction with elements outside it.
10
+ *
11
+ * This is a modified version from https://vscode.dev/github/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/useModalOverlay.ts#L46
12
+ *
13
+ * This implementation disables the prevent scroll when `shouldBlockScroll` prop is false.
14
+ */
15
+ declare function useAriaModalOverlay(props: (UseAriaModalOverlayProps & {
16
+ shouldBlockScroll?: boolean;
17
+ }) | undefined, state: OverlayTriggerState, ref: RefObject<HTMLElement>): ModalOverlayAria;
18
+ type UseAriaModalOverlayReturn = ReturnType<typeof useAriaModalOverlay>;
19
+
20
+ export { type UseAriaModalOverlayProps, type UseAriaModalOverlayReturn, useAriaModalOverlay };
@@ -0,0 +1,20 @@
1
+ import { AriaModalOverlayProps, ModalOverlayAria } from '@react-aria/overlays';
2
+ import { OverlayTriggerState } from '@react-stately/overlays';
3
+ import { RefObject } from 'react';
4
+
5
+ interface UseAriaModalOverlayProps extends AriaModalOverlayProps {
6
+ }
7
+ /**
8
+ * Provides the behavior and accessibility implementation for a modal component.
9
+ * A modal is an overlay element which blocks interaction with elements outside it.
10
+ *
11
+ * This is a modified version from https://vscode.dev/github/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/useModalOverlay.ts#L46
12
+ *
13
+ * This implementation disables the prevent scroll when `shouldBlockScroll` prop is false.
14
+ */
15
+ declare function useAriaModalOverlay(props: (UseAriaModalOverlayProps & {
16
+ shouldBlockScroll?: boolean;
17
+ }) | undefined, state: OverlayTriggerState, ref: RefObject<HTMLElement>): ModalOverlayAria;
18
+ type UseAriaModalOverlayReturn = ReturnType<typeof useAriaModalOverlay>;
19
+
20
+ export { type UseAriaModalOverlayProps, type UseAriaModalOverlayReturn, useAriaModalOverlay };
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ useAriaModalOverlay: () => useAriaModalOverlay
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_overlays = require("@react-aria/overlays");
27
+ var import_utils = require("@react-aria/utils");
28
+ var import_react = require("react");
29
+ var import_heroui_v2_use_aria_overlay = require("@vx-oss/heroui-v2-use-aria-overlay");
30
+ function useAriaModalOverlay(props = {
31
+ shouldBlockScroll: true
32
+ }, state, ref) {
33
+ let { overlayProps, underlayProps } = (0, import_heroui_v2_use_aria_overlay.useAriaOverlay)(
34
+ {
35
+ ...props,
36
+ isOpen: state.isOpen,
37
+ onClose: state.close
38
+ },
39
+ ref
40
+ );
41
+ (0, import_overlays.usePreventScroll)({
42
+ isDisabled: !state.isOpen || !props.shouldBlockScroll
43
+ });
44
+ (0, import_overlays.useOverlayFocusContain)();
45
+ (0, import_react.useEffect)(() => {
46
+ if (state.isOpen && ref.current) {
47
+ return (0, import_overlays.ariaHideOutside)([ref.current]);
48
+ }
49
+ }, [state.isOpen, ref]);
50
+ return {
51
+ modalProps: (0, import_utils.mergeProps)(overlayProps),
52
+ underlayProps
53
+ };
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ useAriaModalOverlay
58
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,33 @@
1
+ // src/index.ts
2
+ import { ariaHideOutside, usePreventScroll, useOverlayFocusContain } from "@react-aria/overlays";
3
+ import { mergeProps } from "@react-aria/utils";
4
+ import { useEffect } from "react";
5
+ import { useAriaOverlay } from "@vx-oss/heroui-v2-use-aria-overlay";
6
+ function useAriaModalOverlay(props = {
7
+ shouldBlockScroll: true
8
+ }, state, ref) {
9
+ let { overlayProps, underlayProps } = useAriaOverlay(
10
+ {
11
+ ...props,
12
+ isOpen: state.isOpen,
13
+ onClose: state.close
14
+ },
15
+ ref
16
+ );
17
+ usePreventScroll({
18
+ isDisabled: !state.isOpen || !props.shouldBlockScroll
19
+ });
20
+ useOverlayFocusContain();
21
+ useEffect(() => {
22
+ if (state.isOpen && ref.current) {
23
+ return ariaHideOutside([ref.current]);
24
+ }
25
+ }, [state.isOpen, ref]);
26
+ return {
27
+ modalProps: mergeProps(overlayProps),
28
+ underlayProps
29
+ };
30
+ }
31
+ export {
32
+ useAriaModalOverlay
33
+ };
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@vx-oss/heroui-v2-use-aria-modal-overlay",
3
+ "version": "2.2.20-alpha.0",
4
+ "description": "A custom implementation of react aria modal overlay, this removes the prevent scroll",
5
+ "keywords": [
6
+ "use-aria-modal-overlay"
7
+ ],
8
+ "author": "Vx OSS Devs <oss-developers@vezham.com>",
9
+ "homepage": "https://vezham.com",
10
+ "license": "MIT",
11
+ "main": "dist/index.js",
12
+ "sideEffects": false,
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/vezham/heroui-v2.git",
22
+ "directory": "packages/hooks/use-aria-modal-overlay"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/vezham/heroui-v2/issues"
26
+ },
27
+ "dependencies": {
28
+ "@react-aria/overlays": "3.30.0",
29
+ "@react-aria/utils": "3.31.0",
30
+ "@react-stately/overlays": "3.6.20",
31
+ "@vx-oss/heroui-v2-use-aria-overlay": "2.0.5-alpha.0"
32
+ },
33
+ "peerDependencies": {
34
+ "react": ">=18 || >=19.0.0-rc.0",
35
+ "react-dom": ">=18 || >=19.0.0-rc.0"
36
+ },
37
+ "clean-package": "../../../clean-package.config.json",
38
+ "tsup": {
39
+ "clean": true,
40
+ "target": "es2019",
41
+ "format": [
42
+ "cjs",
43
+ "esm"
44
+ ]
45
+ },
46
+ "module": "dist/index.mjs",
47
+ "types": "dist/index.d.ts",
48
+ "exports": {
49
+ ".": {
50
+ "types": "./dist/index.d.ts",
51
+ "import": "./dist/index.mjs",
52
+ "require": "./dist/index.js"
53
+ },
54
+ "./package.json": "./package.json"
55
+ },
56
+ "scripts": {
57
+ "build": "tsup src --dts",
58
+ "build:fast": "tsup src",
59
+ "dev": "pnpm build:fast --watch",
60
+ "clean": "rimraf dist .turbo",
61
+ "typecheck": "tsc --noEmit"
62
+ }
63
+ }