react-bounded-overlay-manager 1.0.4 → 1.1.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.
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import "../../assets/OverlaysContainer.css";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import s from "react";
|
|
4
|
-
const l = "_overlaysContainer_wi19r_1", i = "_overlaysContainerContent_wi19r_6",
|
|
4
|
+
const l = "_overlaysContainer_wi19r_1", i = "_overlaysContainerContent_wi19r_6", o = {
|
|
5
5
|
overlaysContainer: l,
|
|
6
6
|
overlaysContainerContent: i
|
|
7
|
-
}, C =
|
|
7
|
+
}, C = o.overlaysContainer, c = o.overlaysContainerContent, y = ({ children: e, show: n, unmountContentWhenHidden: a }, r) => /* @__PURE__ */ t(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
"data-overlay-container": !0,
|
|
11
|
+
className: C,
|
|
12
|
+
ref: r,
|
|
13
|
+
children: a && !n ? null : /* @__PURE__ */ t(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
"data-overlay-container-content": !0,
|
|
17
|
+
className: c,
|
|
18
|
+
style: { display: n ? "block" : "none" },
|
|
19
|
+
children: e
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
), f = s.forwardRef(y);
|
|
8
24
|
export {
|
|
9
25
|
f as default,
|
|
10
26
|
C as overlaysContainerClassName,
|
|
@@ -2,27 +2,27 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import r, { overlaysContainerClassName as d, overlaysContainerContentClassName as h } from "../OverlaysContainer.js";
|
|
3
3
|
import "../../../index-7ofMxoL9.js";
|
|
4
4
|
import { a as i } from "../../../react.esm-GKFzux-6.js";
|
|
5
|
-
const u = (
|
|
5
|
+
const u = (a) => a.querySelector("[data-overlay-container]"), c = (a) => a.querySelector("[data-overlay-container-content]");
|
|
6
6
|
describe("OverlaysContainer", () => {
|
|
7
|
-
const
|
|
7
|
+
const a = "Mock Child", l = "mock-child-id", o = /* @__PURE__ */ t("div", { "data-testid": l, children: a });
|
|
8
8
|
it("renders children", () => {
|
|
9
9
|
const { getByTestId: e } = i(
|
|
10
10
|
/* @__PURE__ */ t(r, { show: !0, unmountContentWhenHidden: !1, children: o })
|
|
11
11
|
);
|
|
12
|
-
expect(e(
|
|
12
|
+
expect(e(l)).toBeInTheDocument();
|
|
13
13
|
}), it("toggles visibility of content based on show prop", () => {
|
|
14
|
-
const { rerender: e, container:
|
|
14
|
+
const { rerender: e, container: s } = i(
|
|
15
15
|
/* @__PURE__ */ t(r, { show: !1, unmountContentWhenHidden: !1, children: o })
|
|
16
16
|
);
|
|
17
|
-
let n =
|
|
17
|
+
let n = c(s);
|
|
18
18
|
expect(n).toHaveStyle("display: none"), e(
|
|
19
19
|
/* @__PURE__ */ t(r, { show: !0, unmountContentWhenHidden: !1, children: o })
|
|
20
20
|
), expect(n).toHaveStyle("display: block");
|
|
21
21
|
}), it("unmounts content when hidden and unmountContentWhenHidden prop is true", () => {
|
|
22
|
-
const { rerender: e, container:
|
|
22
|
+
const { rerender: e, container: s } = i(
|
|
23
23
|
/* @__PURE__ */ t(r, { show: !0, unmountContentWhenHidden: !0, children: o })
|
|
24
24
|
);
|
|
25
|
-
let n =
|
|
25
|
+
let n = c(s);
|
|
26
26
|
expect(n).toBeInTheDocument(), e(
|
|
27
27
|
/* @__PURE__ */ t(r, { show: !1, unmountContentWhenHidden: !0, children: o })
|
|
28
28
|
), expect(n).not.toBeInTheDocument();
|
|
@@ -30,7 +30,7 @@ describe("OverlaysContainer", () => {
|
|
|
30
30
|
const { container: e } = i(
|
|
31
31
|
/* @__PURE__ */ t(r, { show: !0, unmountContentWhenHidden: !1, children: o })
|
|
32
32
|
);
|
|
33
|
-
let
|
|
34
|
-
expect(
|
|
33
|
+
let s = u(e), n = c(e);
|
|
34
|
+
expect(s).toHaveClass(d), expect(n).toHaveClass(h);
|
|
35
35
|
});
|
|
36
36
|
});
|