@cfx-dev/ui-components 0.0.26 → 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/dist/utils/hooks.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import o from "react";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const r = o.useRef(
|
|
7
|
-
return r.current ===
|
|
3
|
+
import { $ as m } from "../index-C1KmDBa6.js";
|
|
4
|
+
const l = Symbol("Uninitialized");
|
|
5
|
+
function v(e, ...t) {
|
|
6
|
+
const r = o.useRef(l);
|
|
7
|
+
return r.current === l && (r.current = e(...t)), r.current;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function a(e) {
|
|
10
10
|
const t = o.useRef(e);
|
|
11
11
|
return t.current = e, t;
|
|
12
12
|
}
|
|
@@ -36,14 +36,14 @@ i.shouldProcessEvent = (e) => {
|
|
|
36
36
|
return !0;
|
|
37
37
|
};
|
|
38
38
|
function d(e) {
|
|
39
|
-
const t =
|
|
39
|
+
const t = a((r) => {
|
|
40
40
|
d.isCloseEvent(r) && e();
|
|
41
41
|
});
|
|
42
42
|
i(t);
|
|
43
43
|
}
|
|
44
44
|
d.isCloseEvent = (e) => e.key === "Escape";
|
|
45
|
-
function
|
|
46
|
-
const t =
|
|
45
|
+
function R(e) {
|
|
46
|
+
const t = a(e);
|
|
47
47
|
o.useEffect(() => {
|
|
48
48
|
const r = () => t.current();
|
|
49
49
|
return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
|
|
@@ -70,10 +70,10 @@ function g(e, t = "original") {
|
|
|
70
70
|
}, [e, t]), r;
|
|
71
71
|
}
|
|
72
72
|
export {
|
|
73
|
-
|
|
73
|
+
a as useDynamicRef,
|
|
74
74
|
i as useGlobalKeyboardEvent,
|
|
75
|
-
|
|
75
|
+
v as useInstance,
|
|
76
76
|
d as useKeyboardClose,
|
|
77
77
|
g as useOutlet,
|
|
78
|
-
|
|
78
|
+
R as useWindowResize
|
|
79
79
|
};
|
package/package.json
CHANGED
package/dist/utils/outlet.d.ts
DELETED
package/dist/utils/outlet.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { R as o } from "../index-2hJuj4UN.js";
|
|
2
|
-
function u(t) {
|
|
3
|
-
let e = null;
|
|
4
|
-
if (typeof window < "u" && (e = document.getElementById(t)), !e)
|
|
5
|
-
throw new Error(`Attempted to connect the outlet to the DOM node with ID #${t}, but no such node exists.`);
|
|
6
|
-
return ({
|
|
7
|
-
children: n
|
|
8
|
-
}) => o.createPortal(n, e);
|
|
9
|
-
}
|
|
10
|
-
function l() {
|
|
11
|
-
let t = null;
|
|
12
|
-
if (typeof window < "u" && (t = document.createElement("div"), document.body.appendChild(t)), !t)
|
|
13
|
-
throw new Error("Attempted to create an outlet, but no such outlet exists.");
|
|
14
|
-
return ({
|
|
15
|
-
children: e
|
|
16
|
-
}) => o.createPortal(e, t);
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
u as attachOutlet,
|
|
20
|
-
l as createOutlet
|
|
21
|
-
};
|