react-bounded-overlay-manager 1.0.0-beta.1 → 1.0.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 +21 -0
- package/README.md +40 -21
- package/dist/{index-7ofMxoL9.js → index-6HDrCuH_.mjs} +1 -1
- package/dist/src/components/test/BoundedOverlayManager.test.js +2 -2
- package/dist/src/components/test/BoundedOverlayManagerContent.test.js +2 -2
- package/dist/src/components/test/Overlay.test.js +2 -2
- package/dist/src/components/test/OverlaysContainer.test.js +2 -2
- package/dist/src/context/OverlayManagerContext.js +1 -1
- package/dist/src/context/test/OverlayManagerContext.test.js +2 -2
- package/dist/src/hooks/test/useApiUpdateHandler.test.js +1 -1
- package/dist/src/hooks/test/useForwardBoundingComponentEvents.test.js +1 -1
- package/dist/src/hooks/test/useForwardOverlayEvents.test.js +1 -1
- package/dist/src/hooks/test/useFullscreenChange.test.js +1 -1
- package/dist/src/hooks/test/useOverlayManagerEvents.test.js +2 -2
- package/dist/src/hooks/test/useResizeObserver.test.js +1 -1
- package/dist/src/hooks/test/useScrollOnDocument.test.js +1 -1
- package/dist/src/hooks/test/useTimedEventManager.test.js +1 -1
- package/dist/src/hooks/test/useWindowResize.test.js +1 -1
- package/dist/src/hooks/test/util.js +1 -1
- package/dist/src/hooks/useResizeObserver.js +1 -1
- package/dist/src/hooks/useScrollOnDocument.js +1 -1
- package/dist/src/hooks/useWindowResize.js +1 -1
- package/package.json +11 -2
- /package/dist/{events-B7I8KoZ9.js → events-B7I8KoZ9.mjs} +0 -0
- /package/dist/{index.module-WXM1Xk0w.js → index.module-WXM1Xk0w.mjs} +0 -0
- /package/dist/{react.esm-GKFzux-6.js → react.esm-GKFzux-6.mjs} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 metincansiper
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
# React
|
|
1
|
+
# React Bounded Overlay Manager
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`React Bounded Overlay Manager` is a React library designed to create and manage overlay components within a specified bounding container. It offers flexible positioning, dynamic show/hide behavior, customizable event handling, and an API for extended control.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
7
|
+
## Key Features
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- **Flexible Positioning**: Utilize `position` and `offset` parameters within the Overlay component to achieve precise and strategic placement of overlays.
|
|
10
|
+
- **Dynamic Visibility**: Effortlessly configure the appearance and disappearance of overlays in response to user interactions, enhancing user experience and interface responsiveness.
|
|
11
|
+
- **Customizable Event Handling**: Tailor overlay visibility to align with specific application requirements. This includes the ability to control when overlays appear or disappear based on user interactions, system events, or custom triggers. Configure these settings to suit your application's behavior and user experience needs.
|
|
12
|
+
- **Extended Control via API**: Access the API for comprehensive control over overlay behavior, extending beyond the capabilities offered by component properties.
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
## Installation
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
```bash
|
|
17
|
+
npm install react-bounded-overlay-manager
|
|
18
|
+
```
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
## Basic Example
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import React, { useRef } from 'react';
|
|
24
|
+
import BoundedOverlayManager, { Overlay, PredefinedPosition } from 'react-bounded-overlay-manager';
|
|
25
|
+
|
|
26
|
+
const BasicExample = () => {
|
|
27
|
+
const boundingComponentRef = useRef(null);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div>
|
|
31
|
+
<div ref={boundingComponentRef} style={{ width: '70vw', height: '50vh', border: '1px solid black' }}>
|
|
32
|
+
Hover over this div to display overlays.
|
|
33
|
+
</div>
|
|
34
|
+
<BoundedOverlayManager boundingComponentRef={boundingComponentRef}>
|
|
35
|
+
<Overlay position={PredefinedPosition.BOTTOM_CENTER}>
|
|
36
|
+
<button>Overlay Button</button>
|
|
37
|
+
</Overlay>
|
|
38
|
+
<!-- more overlays here -->
|
|
39
|
+
</BoundedOverlayManager>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
26
43
|
```
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
## Learn More
|
|
46
|
+
For more detailed information on how to utilize `React Bounded Overlay Manager` to its fullest, explore the [documentation](https://metincansiper.github.io/react-bounded-overlay-manager)
|
|
47
|
+
|
|
48
|
+
## For Developers
|
|
49
|
+
If you are interested in contributing to the project or want to build and test the library, please refer to our [Developer Guide](./readme_supplements/DEVELOPER_GUIDE.md) for detailed instructions on setup, development, testing, and deployment.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as W, b as U, d as Dl, e as Ul } from "./react.esm-GKFzux-6.
|
|
1
|
+
import { g as W, b as U, d as Dl, e as Ul } from "./react.esm-GKFzux-6.mjs";
|
|
2
2
|
var Vl = (e) => {
|
|
3
3
|
const r = e.match(/^[ \t]*(?=\S)/gm);
|
|
4
4
|
return r ? r.reduce((t, o) => Math.min(t, o.length), 1 / 0) : 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { s as i, a as m } from "../../../react.esm-GKFzux-6.
|
|
2
|
+
import { s as i, a as m } from "../../../react.esm-GKFzux-6.mjs";
|
|
3
3
|
import u from "../BoundedOverlayManager.js";
|
|
4
|
-
import "../../../index-
|
|
4
|
+
import "../../../index-6HDrCuH_.mjs";
|
|
5
5
|
jest.mock("../../context/OverlayManagerContext", () => ({
|
|
6
6
|
OverlayManagerContextProvider: ({ children: t, boundingComponentRef: e }) => (e == null || e(), t)
|
|
7
7
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import c from "react";
|
|
3
|
-
import { a as s } from "../../../react.esm-GKFzux-6.
|
|
4
|
-
import "../../../index-
|
|
3
|
+
import { a as s } from "../../../react.esm-GKFzux-6.mjs";
|
|
4
|
+
import "../../../index-6HDrCuH_.mjs";
|
|
5
5
|
import n from "../BoundedOverlayManagerContent.js";
|
|
6
6
|
import { useOverlayManagerContext as v } from "../../context/OverlayManagerContext.js";
|
|
7
7
|
import d from "../../hooks/useTimedEventManager.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { a as r } from "../../../react.esm-GKFzux-6.
|
|
3
|
-
import "../../../index-
|
|
2
|
+
import { a as r } from "../../../react.esm-GKFzux-6.mjs";
|
|
3
|
+
import "../../../index-6HDrCuH_.mjs";
|
|
4
4
|
import n, { overlayClassName as c } from "../Overlay.js";
|
|
5
5
|
import t from "../../enum/PredefinedPosition.js";
|
|
6
6
|
import { useOverlayManagerContext as f } from "../../context/OverlayManagerContext.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import r, { overlaysContainerClassName as d, overlaysContainerContentClassName as h } from "../OverlaysContainer.js";
|
|
3
|
-
import "../../../index-
|
|
4
|
-
import { a as i } from "../../../react.esm-GKFzux-6.
|
|
3
|
+
import "../../../index-6HDrCuH_.mjs";
|
|
4
|
+
import { a as i } from "../../../react.esm-GKFzux-6.mjs";
|
|
5
5
|
const u = (s) => s.querySelector("[role='overlays-container']"), l = (s) => s.querySelector("[role='overlays-container-content']");
|
|
6
6
|
describe("OverlaysContainer", () => {
|
|
7
7
|
const s = "Mock Child", c = "mock-child-id", o = /* @__PURE__ */ t("div", { "data-testid": c, children: s });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as s, useContext as v, useState as i, useEffect as u } from "react";
|
|
3
|
-
import { e as x } from "../../events-B7I8KoZ9.
|
|
3
|
+
import { e as x } from "../../events-B7I8KoZ9.mjs";
|
|
4
4
|
const r = s(void 0), E = () => {
|
|
5
5
|
const e = v(r);
|
|
6
6
|
if (e === void 0)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { c as m, a as o, s as r } from "../../../react.esm-GKFzux-6.
|
|
2
|
+
import { c as m, a as o, s as r } from "../../../react.esm-GKFzux-6.mjs";
|
|
3
3
|
import { OverlayManagerContextProvider as s, useOverlayManagerContext as c } from "../OverlayManagerContext.js";
|
|
4
|
-
import { e as a } from "../../../events-B7I8KoZ9.
|
|
4
|
+
import { e as a } from "../../../events-B7I8KoZ9.mjs";
|
|
5
5
|
const i = () => {
|
|
6
6
|
const { overlayManagerEventEmitter: e, boundingComponentRef: n } = c();
|
|
7
7
|
return /* @__PURE__ */ d("div", { children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as o } from "../../../react.esm-GKFzux-6.
|
|
1
|
+
import { r as o } from "../../../react.esm-GKFzux-6.mjs";
|
|
2
2
|
import { useOverlayManagerContext as m } from "../../context/OverlayManagerContext.js";
|
|
3
3
|
import a from "../useForwardBoundingComponentEvents.js";
|
|
4
4
|
import { makeEventOnlyMockComponentRef as s } from "./util.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as o, w as m } from "../../../react.esm-GKFzux-6.
|
|
1
|
+
import { r as o, w as m } from "../../../react.esm-GKFzux-6.mjs";
|
|
2
2
|
import { useOverlayManagerContext as i } from "../../context/OverlayManagerContext.js";
|
|
3
3
|
import r from "../useForwardOverlayEvents.js";
|
|
4
4
|
import { makeEventOnlyMockComponentRef as s } from "./util.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as c, w as u } from "../../../react.esm-GKFzux-6.
|
|
1
|
+
import { r as c, w as u } from "../../../react.esm-GKFzux-6.mjs";
|
|
2
2
|
import r from "../useFullscreenChange.js";
|
|
3
3
|
describe("useFullscreenChange", () => {
|
|
4
4
|
const n = jest.fn(), l = ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], a = (e, t) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as o } from "../../../react.esm-GKFzux-6.
|
|
1
|
+
import { r as o } from "../../../react.esm-GKFzux-6.mjs";
|
|
2
2
|
import a from "../useOverlayManagerEvents.js";
|
|
3
3
|
import p from "../../timer/TimedEventManager.js";
|
|
4
4
|
import { useOverlayManagerContext as O } from "../../context/OverlayManagerContext.js";
|
|
5
|
-
import { e as y } from "../../../events-B7I8KoZ9.
|
|
5
|
+
import { e as y } from "../../../events-B7I8KoZ9.mjs";
|
|
6
6
|
jest.mock("../../context/OverlayManagerContext");
|
|
7
7
|
describe("useOverlayManagerEvents", () => {
|
|
8
8
|
let e, u, r, m;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as t } from "react";
|
|
2
|
-
import { c as r } from "../../index.module-WXM1Xk0w.
|
|
2
|
+
import { c as r } from "../../index.module-WXM1Xk0w.mjs";
|
|
3
3
|
const l = ({ handleScroll: o }) => {
|
|
4
4
|
const e = r(o, 1);
|
|
5
5
|
t(() => (document.addEventListener("scroll", e), () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as o } from "react";
|
|
2
|
-
import { c as r } from "../../index.module-WXM1Xk0w.
|
|
2
|
+
import { c as r } from "../../index.module-WXM1Xk0w.mjs";
|
|
3
3
|
const s = ({ handleResize: n }) => {
|
|
4
4
|
const e = r(n, 1);
|
|
5
5
|
o(() => (window.addEventListener("resize", e), () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-bounded-overlay-manager",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"preview": "vite preview",
|
|
16
16
|
"test": "jest",
|
|
17
17
|
"storybook": "storybook dev -p 6007",
|
|
18
|
-
"build-storybook": "storybook build"
|
|
18
|
+
"build-storybook": "storybook build",
|
|
19
|
+
"test:browser": "cypress run --component",
|
|
20
|
+
"build-and-deploy-storybook": "npm run build-storybook && npm run deploy-storybook",
|
|
21
|
+
"deploy-storybook": "node deploy-storybook.mjs"
|
|
19
22
|
},
|
|
20
23
|
"peerDependencies": {
|
|
21
24
|
"react": "^18.2.0",
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
48
51
|
"eslint-plugin-react-refresh": "^0.4.5",
|
|
49
52
|
"eslint-plugin-storybook": "^0.6.15",
|
|
53
|
+
"gh-pages": "^6.1.1",
|
|
50
54
|
"glob": "^10.3.10",
|
|
51
55
|
"identity-obj-proxy": "^3.0.0",
|
|
52
56
|
"jest": "^29.7.0",
|
|
@@ -66,5 +70,10 @@
|
|
|
66
70
|
"dependencies": {
|
|
67
71
|
"events": "^3.3.0",
|
|
68
72
|
"use-debounce": "^10.0.0"
|
|
73
|
+
},
|
|
74
|
+
"license": "MIT",
|
|
75
|
+
"repository": {
|
|
76
|
+
"type": "git",
|
|
77
|
+
"url": "https://github.com/metincansiper/react-bounded-overlay-manager"
|
|
69
78
|
}
|
|
70
79
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|