@cfx-dev/ui-components 0.0.20 → 0.0.22
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/components/BackdropPortal/BackdropPortal.d.ts +1 -0
- package/dist/components/BackdropPortal/BackdropPortal.js +9 -7
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.js +96 -50
- package/dist/components/Button/LinkButton.d.ts +3 -11
- package/dist/components/Button/LinkButton.js +23 -38
- package/dist/components/Flyout/Flyout.d.ts +1 -0
- package/dist/components/Flyout/Flyout.js +20 -19
- package/dist/components/Overlay/Overlay.d.ts +1 -0
- package/dist/components/Overlay/Overlay.js +13 -12
- package/dist/components/Shroud/Shroud.js +16 -15
- package/dist/components/Title/Title.d.ts +1 -0
- package/dist/components/Title/Title.js +26 -25
- package/dist/main.d.ts +6 -5
- package/dist/main.js +128 -126
- package/dist/utils/hooks.d.ts +2 -3
- package/dist/utils/hooks.js +42 -65
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useOutlet as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useOutlet as c } from "../../utils/hooks.js";
|
|
3
|
+
const e = "backdrop-outlet";
|
|
4
|
+
function n({
|
|
5
|
+
children: t
|
|
5
6
|
}) {
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
const o = c(e);
|
|
8
|
+
return /* @__PURE__ */ r(o, { children: t });
|
|
8
9
|
}
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
e as BACKDROP_OUTLET_ID,
|
|
12
|
+
n as BackdropPortal
|
|
11
13
|
};
|
|
@@ -21,4 +21,6 @@ export interface ButtonProps {
|
|
|
21
21
|
onMouseUp?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
22
22
|
decorator?: React.ReactNode;
|
|
23
23
|
}
|
|
24
|
+
export declare function ButtonContent(props: Partial<ButtonProps>): React.ReactNode;
|
|
25
|
+
export declare function getButtonClassName(props: Partial<ButtonProps>): string;
|
|
24
26
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,59 +1,105 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { clsx as
|
|
4
|
-
import { noop as
|
|
5
|
-
import { s as
|
|
6
|
-
|
|
1
|
+
import { jsx as c, jsxs as j, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import b from "react";
|
|
3
|
+
import { clsx as z } from "../../utils/clsx.js";
|
|
4
|
+
import { noop as p } from "../../utils/functional.js";
|
|
5
|
+
import { s as t } from "../../Button.module-Z6njvP9Z.js";
|
|
6
|
+
function F(a) {
|
|
7
7
|
const {
|
|
8
|
-
text:
|
|
9
|
-
icon:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
text: e = null,
|
|
9
|
+
icon: l = null,
|
|
10
|
+
decorator: o = null
|
|
11
|
+
} = a;
|
|
12
|
+
return /* @__PURE__ */ j(w, { children: [
|
|
13
|
+
!!l && /* @__PURE__ */ c("span", { className: t["icon-node"], children: l }),
|
|
14
|
+
e,
|
|
15
|
+
!!o && /* @__PURE__ */ c("div", { className: t.decorator, children: o })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
function I(a) {
|
|
19
|
+
const {
|
|
20
|
+
text: e = null,
|
|
21
|
+
icon: l = null,
|
|
22
|
+
theme: o = "default",
|
|
23
|
+
size: s = "normal",
|
|
24
|
+
disabled: f = !1,
|
|
25
|
+
straightCorners: d = !1,
|
|
26
|
+
className: r = "",
|
|
27
|
+
autofocus: u = !1,
|
|
28
|
+
fullWidth: i = !1,
|
|
29
|
+
tabIndex: n
|
|
30
|
+
} = a;
|
|
31
|
+
return z(t.root, t[o], t[s], r, {
|
|
32
|
+
[t.disabled]: f,
|
|
33
|
+
[t.icon]: !!l && (e === null || typeof e > "u"),
|
|
34
|
+
[t.text]: !!e,
|
|
35
|
+
[t.autofocus]: u || typeof n < "u",
|
|
36
|
+
[t["straight-borders"]]: d,
|
|
37
|
+
[t.fullWidth]: i
|
|
32
38
|
});
|
|
33
|
-
|
|
39
|
+
}
|
|
40
|
+
const U = b.forwardRef(function(e, l) {
|
|
41
|
+
const {
|
|
42
|
+
text: o = null,
|
|
43
|
+
icon: s = null,
|
|
44
|
+
title: f = "",
|
|
45
|
+
type: d = "button",
|
|
46
|
+
className: r = "",
|
|
47
|
+
theme: u = "default",
|
|
48
|
+
size: i = "normal",
|
|
49
|
+
disabled: n = !1,
|
|
50
|
+
straightCorners: x = !1,
|
|
51
|
+
onClick: C = p,
|
|
52
|
+
onMouseDown: g = p,
|
|
53
|
+
onMouseUp: k = p,
|
|
54
|
+
autofocus: m = !1,
|
|
55
|
+
fullWidth: N = !1,
|
|
56
|
+
tabIndex: h,
|
|
57
|
+
ariaLabel: B = ""
|
|
58
|
+
} = e, y = b.useMemo(() => I({
|
|
59
|
+
text: o,
|
|
60
|
+
icon: s,
|
|
61
|
+
theme: u,
|
|
62
|
+
size: i,
|
|
63
|
+
disabled: n,
|
|
64
|
+
straightCorners: x,
|
|
65
|
+
className: r,
|
|
66
|
+
autofocus: m,
|
|
67
|
+
fullWidth: N,
|
|
68
|
+
tabIndex: h
|
|
69
|
+
}), [
|
|
70
|
+
m,
|
|
71
|
+
r,
|
|
72
|
+
n,
|
|
73
|
+
N,
|
|
74
|
+
s,
|
|
75
|
+
i,
|
|
76
|
+
x,
|
|
77
|
+
h,
|
|
78
|
+
o,
|
|
79
|
+
u
|
|
80
|
+
]), M = b.useCallback((W) => {
|
|
81
|
+
n || C(W);
|
|
82
|
+
}, [n, C]);
|
|
83
|
+
return /* @__PURE__ */ c(
|
|
34
84
|
"button",
|
|
35
85
|
{
|
|
36
|
-
ref:
|
|
37
|
-
disabled:
|
|
38
|
-
className:
|
|
39
|
-
onClick:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"aria-label": y,
|
|
49
|
-
children: [
|
|
50
|
-
!!e && /* @__PURE__ */ i("span", { className: o["icon-node"], children: e }),
|
|
51
|
-
t,
|
|
52
|
-
!!r && /* @__PURE__ */ i("div", { className: o.decorator, children: r })
|
|
53
|
-
]
|
|
86
|
+
ref: l,
|
|
87
|
+
disabled: n,
|
|
88
|
+
className: y,
|
|
89
|
+
onClick: M,
|
|
90
|
+
onMouseDown: g,
|
|
91
|
+
onMouseUp: k,
|
|
92
|
+
autoFocus: m,
|
|
93
|
+
tabIndex: h,
|
|
94
|
+
title: f,
|
|
95
|
+
type: d,
|
|
96
|
+
"aria-label": B,
|
|
97
|
+
children: /* @__PURE__ */ c(F, { ...e })
|
|
54
98
|
}
|
|
55
99
|
);
|
|
56
100
|
});
|
|
57
101
|
export {
|
|
58
|
-
|
|
102
|
+
U as Button,
|
|
103
|
+
F as ButtonContent,
|
|
104
|
+
I as getButtonClassName
|
|
59
105
|
};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonProps } from './Button';
|
|
3
3
|
|
|
4
|
-
export interface LinkButtonProps {
|
|
4
|
+
export interface LinkButtonProps extends Omit<ButtonProps, 'autofocus' | 'onCLick' | 'onMouseDown' | 'onMouseUp' | 'ariaLabel'> {
|
|
5
5
|
to: string;
|
|
6
|
-
|
|
7
|
-
title?: string;
|
|
8
|
-
icon?: React.ReactNode;
|
|
9
|
-
theme?: ButtonTheme;
|
|
10
|
-
size?: ButtonSize;
|
|
11
|
-
disabled?: boolean;
|
|
6
|
+
isHrefProp?: boolean;
|
|
12
7
|
onClick?(): void;
|
|
13
|
-
tabIndex?: number;
|
|
14
|
-
className?: string;
|
|
15
8
|
target?: string;
|
|
16
9
|
Component?: React.ElementType;
|
|
17
|
-
decorator?: React.ReactNode;
|
|
18
10
|
}
|
|
19
11
|
export declare const LinkButton: React.ForwardRefExoticComponent<LinkButtonProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const P = a.forwardRef(function(i, c) {
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import { noop as k } from "../../utils/functional.js";
|
|
4
|
+
import { isExternalUrl as d } from "../../utils/links.js";
|
|
5
|
+
import { getButtonClassName as x, ButtonContent as B } from "./Button.js";
|
|
6
|
+
const M = n.forwardRef(function(t, a) {
|
|
8
7
|
const {
|
|
9
|
-
to:
|
|
10
|
-
text: t = null,
|
|
11
|
-
icon: n = null,
|
|
8
|
+
to: o,
|
|
12
9
|
title: m = "",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Component: h
|
|
22
|
-
} = i, N = j(o.root, o[f], o[p], d, {
|
|
23
|
-
[o.disabled]: u,
|
|
24
|
-
[o.icon]: !!n && !t,
|
|
25
|
-
[o.text]: !!t
|
|
26
|
-
}), r = E(e), b = r ? "a" : h || "a", L = a.useMemo(() => r ? { href: e } : { to: e }, [e, r]);
|
|
27
|
-
return /* @__PURE__ */ R(
|
|
28
|
-
b,
|
|
10
|
+
tabIndex: s,
|
|
11
|
+
target: f = "",
|
|
12
|
+
onClick: l = k,
|
|
13
|
+
isHrefProp: r = !1,
|
|
14
|
+
Component: c
|
|
15
|
+
} = t, u = n.useMemo(() => x(t), [t]), e = d(o), C = e ? "a" : c || "a", p = n.useMemo(() => e || r ? { href: o } : { to: o }, [o, e, r]);
|
|
16
|
+
return /* @__PURE__ */ i(
|
|
17
|
+
C,
|
|
29
18
|
{
|
|
30
|
-
ref:
|
|
31
|
-
className:
|
|
32
|
-
tabIndex:
|
|
19
|
+
ref: a,
|
|
20
|
+
className: u,
|
|
21
|
+
tabIndex: s,
|
|
33
22
|
title: m,
|
|
34
|
-
target:
|
|
23
|
+
target: f,
|
|
35
24
|
rel: "noopener noreferrer",
|
|
36
|
-
onClickCapture:
|
|
37
|
-
...
|
|
38
|
-
children:
|
|
39
|
-
!!n && /* @__PURE__ */ l("span", { className: o["icon-node"], children: n }),
|
|
40
|
-
t,
|
|
41
|
-
!!s && /* @__PURE__ */ l("div", { className: o.decorator, children: s })
|
|
42
|
-
]
|
|
25
|
+
onClickCapture: l,
|
|
26
|
+
...p,
|
|
27
|
+
children: /* @__PURE__ */ i(B, { ...t })
|
|
43
28
|
}
|
|
44
29
|
);
|
|
45
30
|
});
|
|
46
31
|
export {
|
|
47
|
-
|
|
32
|
+
M as LinkButton
|
|
48
33
|
};
|
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
import { jsxs as i, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import _ from "react";
|
|
3
3
|
import { F as p } from "../../Combination-Dp_plIQU.js";
|
|
4
4
|
import { Button as h } from "../Button/Button.js";
|
|
5
5
|
import { Interactive as f } from "../Interactive/Interactive.js";
|
|
6
6
|
import { I as u } from "../../Icons-BlBKvJD8.js";
|
|
7
|
-
import { clsx as
|
|
7
|
+
import { clsx as l } from "../../utils/clsx.js";
|
|
8
8
|
import { noop as v } from "../../utils/functional.js";
|
|
9
9
|
import { useOutlet as b, useKeyboardClose as z } from "../../utils/hooks.js";
|
|
10
|
-
import '../../assets/Flyout.css';const N = "_root_11ks7_1", C = "_holder_11ks7_6", y = "_active_11ks7_15",
|
|
10
|
+
import '../../assets/Flyout.css';const N = "_root_11ks7_1", C = "_holder_11ks7_6", y = "_active_11ks7_15", F = "_backdrop_11ks7_15", x = "_mask_11ks7_28", I = "_content_11ks7_90", L = "_header_11ks7_95", O = "_title_11ks7_101", e = {
|
|
11
11
|
root: N,
|
|
12
12
|
"size-normal": "_size-normal_11ks7_6",
|
|
13
13
|
holder: C,
|
|
14
14
|
"size-small": "_size-small_11ks7_9",
|
|
15
15
|
"size-xsmall": "_size-xsmall_11ks7_12",
|
|
16
16
|
active: y,
|
|
17
|
-
backdrop:
|
|
17
|
+
backdrop: F,
|
|
18
18
|
"backdrop-appearance": "_backdrop-appearance_11ks7_1",
|
|
19
|
-
mask:
|
|
19
|
+
mask: x,
|
|
20
20
|
"holder-appearance": "_holder-appearance_11ks7_1",
|
|
21
21
|
content: I,
|
|
22
22
|
header: L,
|
|
23
|
-
title:
|
|
24
|
-
};
|
|
25
|
-
function
|
|
23
|
+
title: O
|
|
24
|
+
}, E = "flyout-outlet";
|
|
25
|
+
function T(c) {
|
|
26
26
|
const {
|
|
27
27
|
disabled: o = !1,
|
|
28
28
|
size: a = "normal",
|
|
29
29
|
onClose: r = v,
|
|
30
|
-
children:
|
|
31
|
-
holderClassName:
|
|
32
|
-
} =
|
|
33
|
-
|
|
30
|
+
children: n,
|
|
31
|
+
holderClassName: d
|
|
32
|
+
} = c, m = b(E);
|
|
33
|
+
_.useEffect(() => {
|
|
34
34
|
if (o)
|
|
35
35
|
return;
|
|
36
36
|
const t = document.getElementById("cfxui-root");
|
|
37
37
|
return t == null || t.classList.add("shrink"), () => t == null ? void 0 : t.classList.remove("shrink");
|
|
38
38
|
}, [o]), z(r);
|
|
39
|
-
const k =
|
|
39
|
+
const k = l(e.root, e[`size-${a}`], {
|
|
40
40
|
[e.active]: !o
|
|
41
41
|
});
|
|
42
|
-
return /* @__PURE__ */ s(
|
|
42
|
+
return /* @__PURE__ */ s(m, { children: /* @__PURE__ */ i("div", { className: k, children: [
|
|
43
43
|
/* @__PURE__ */ s(f, { showPointer: !1, className: e.backdrop, onClick: r }),
|
|
44
|
-
/* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className:
|
|
44
|
+
/* @__PURE__ */ s("div", { className: e.mask, children: /* @__PURE__ */ s("div", { className: l(e.holder, d), children: /* @__PURE__ */ s(p, { disabled: !!o, className: e.content, children: n }) }) })
|
|
45
45
|
] }) });
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
T.Header = _.forwardRef(function(o, a) {
|
|
48
48
|
const {
|
|
49
49
|
onClose: r,
|
|
50
|
-
children:
|
|
50
|
+
children: n
|
|
51
51
|
} = o;
|
|
52
52
|
return /* @__PURE__ */ i("div", { ref: a, className: e.header, children: [
|
|
53
|
-
/* @__PURE__ */ s("div", { className: e.title, children:
|
|
53
|
+
/* @__PURE__ */ s("div", { className: e.title, children: n }),
|
|
54
54
|
!!r && /* @__PURE__ */ s(h, { size: "large", icon: u.exit, onClick: r })
|
|
55
55
|
] });
|
|
56
56
|
});
|
|
57
57
|
export {
|
|
58
|
-
|
|
58
|
+
E as FLYOUT_OUTLET_ID,
|
|
59
|
+
T as Flyout
|
|
59
60
|
};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import a from "react";
|
|
3
3
|
import { F as i } from "../../Combination-Dp_plIQU.js";
|
|
4
4
|
import { Interactive as m } from "../Interactive/Interactive.js";
|
|
5
5
|
import { clsx as e } from "../../utils/clsx.js";
|
|
6
6
|
import { useOutlet as u } from "../../utils/hooks.js";
|
|
7
|
-
import '../../assets/Overlay.css';const
|
|
8
|
-
root:
|
|
9
|
-
backdrop:
|
|
7
|
+
import '../../assets/Overlay.css';const _ = "_root_15udb_1", f = "_backdrop_15udb_9", p = "_content_15udb_27", n = {
|
|
8
|
+
root: _,
|
|
9
|
+
backdrop: f,
|
|
10
10
|
"backdrop-appearance": "_backdrop-appearance_15udb_1",
|
|
11
11
|
content: p
|
|
12
|
-
};
|
|
12
|
+
}, b = "overlay-outlet";
|
|
13
13
|
function l(c) {
|
|
14
14
|
const {
|
|
15
15
|
className: o,
|
|
16
|
-
children:
|
|
17
|
-
} = c,
|
|
18
|
-
return /* @__PURE__ */
|
|
16
|
+
children: t
|
|
17
|
+
} = c, s = e(n.root, o), d = u(b);
|
|
18
|
+
return /* @__PURE__ */ r(d, { children: /* @__PURE__ */ r("div", { className: s, children: t }) });
|
|
19
19
|
}
|
|
20
|
-
l.Backdrop = a.forwardRef(function(o,
|
|
21
|
-
return /* @__PURE__ */
|
|
20
|
+
l.Backdrop = a.forwardRef(function(o, t) {
|
|
21
|
+
return /* @__PURE__ */ r(m, { ref: t, onClick: o.onClick, className: e(n.backdrop, o.className), children: o.children });
|
|
22
22
|
});
|
|
23
|
-
l.Content = a.forwardRef(function(o,
|
|
24
|
-
return /* @__PURE__ */
|
|
23
|
+
l.Content = a.forwardRef(function(o, t) {
|
|
24
|
+
return /* @__PURE__ */ r("div", { ref: t, className: e(n.content, o.className), children: /* @__PURE__ */ r(i, { children: o.children }) });
|
|
25
25
|
});
|
|
26
26
|
export {
|
|
27
|
+
b as OVERLAY_OUTLET_ID,
|
|
27
28
|
l as Overlay
|
|
28
29
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import r from "react";
|
|
3
|
+
import { TITLE_OUTLET_ID as p } from "../Title/Title.js";
|
|
4
|
+
import { ui as _ } from "../ui.js";
|
|
5
|
+
import { useOutlet as v, useWindowResize as x } from "../../utils/hooks.js";
|
|
6
|
+
import '../../assets/Shroud.css';const b = "_root_7v6x1_1", g = "_tile_7v6x1_6", e = {
|
|
7
|
+
root: b,
|
|
7
8
|
tile: g
|
|
8
|
-
}, S =
|
|
9
|
+
}, S = r.forwardRef(function(c, n) {
|
|
9
10
|
const {
|
|
10
|
-
forRef:
|
|
11
|
-
} = c, [u, d] =
|
|
12
|
-
if (!
|
|
11
|
+
forRef: s
|
|
12
|
+
} = c, [u, d] = r.useState({}), f = v(p, "before"), i = r.useCallback(() => {
|
|
13
|
+
if (!s.current)
|
|
13
14
|
return;
|
|
14
|
-
const o =
|
|
15
|
+
const o = s.current.getBoundingClientRect(), m = {
|
|
15
16
|
x: o.x,
|
|
16
17
|
y: o.y,
|
|
17
18
|
w: o.width,
|
|
@@ -21,14 +22,14 @@ import '../../assets/Shroud.css';const _ = "_root_7v6x1_1", g = "_tile_7v6x1_6",
|
|
|
21
22
|
};
|
|
22
23
|
d(
|
|
23
24
|
Object.fromEntries(
|
|
24
|
-
Object.entries(
|
|
25
|
-
[`--${
|
|
26
|
-
[`--${
|
|
25
|
+
Object.entries(m).flatMap(([a, l]) => [
|
|
26
|
+
[`--${a}`, _.px(l)],
|
|
27
|
+
[`--${a}-raw`, l]
|
|
27
28
|
])
|
|
28
29
|
)
|
|
29
30
|
);
|
|
30
31
|
}, []);
|
|
31
|
-
return
|
|
32
|
+
return r.useEffect(i, []), x(i), /* @__PURE__ */ t(f, { children: /* @__PURE__ */ h("div", { ref: n, className: e.root, style: u, children: [
|
|
32
33
|
/* @__PURE__ */ t("div", { className: e.tile, "data-top": !0 }),
|
|
33
34
|
/* @__PURE__ */ t("div", { className: e.tile, "data-left": !0 }),
|
|
34
35
|
/* @__PURE__ */ t("div", { className: e.tile, "data-right": !0 }),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
|
+
export declare const TITLE_OUTLET_ID = "title-outlet";
|
|
3
4
|
type FixedOn = 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left';
|
|
4
5
|
type TitleChildren = ((ref: React.RefObject<any>) => React.ReactNode) | React.ReactElement;
|
|
5
6
|
export interface TitleProps {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as T, Fragment as w, jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
3
|
import { clsx as O } from "../../utils/clsx.js";
|
|
4
|
-
import { useOutlet as
|
|
5
|
-
import { mergeRefs as
|
|
6
|
-
import '../../assets/Title.css';const
|
|
7
|
-
wrapper:
|
|
8
|
-
appearance:
|
|
4
|
+
import { useOutlet as k } from "../../utils/hooks.js";
|
|
5
|
+
import { mergeRefs as y } from "../../utils/mergeRefs.js";
|
|
6
|
+
import '../../assets/Title.css';const C = "_wrapper_1l1sn_1", R = "_appearance_1l1sn_1", $ = "_animated_1l1sn_26", M = "_root_1l1sn_71", N = "_shortcut_1l1sn_84", m = {
|
|
7
|
+
wrapper: C,
|
|
8
|
+
appearance: R,
|
|
9
9
|
animated: $,
|
|
10
10
|
"fixed-on-top": "_fixed-on-top_1l1sn_29",
|
|
11
11
|
"fixed-on-top-left": "_fixed-on-top-left_1l1sn_35",
|
|
@@ -16,9 +16,9 @@ import '../../assets/Title.css';const R = "_wrapper_1l1sn_1", T = "_appearance_1
|
|
|
16
16
|
"fixed-on-right": "_fixed-on-right_1l1sn_65",
|
|
17
17
|
root: M,
|
|
18
18
|
shortcut: N
|
|
19
|
-
}, i = 10;
|
|
20
|
-
function
|
|
21
|
-
const r =
|
|
19
|
+
}, i = 10, S = "title-outlet";
|
|
20
|
+
function F(l, a, [e, n]) {
|
|
21
|
+
const r = l ? n : n - 20, s = l ? e : e + 16;
|
|
22
22
|
return {
|
|
23
23
|
// Prefer top and left for element to snap to the pixel grid
|
|
24
24
|
// as when using transform it will become blurry in most of the cases as top and left values are floats
|
|
@@ -26,18 +26,18 @@ function S(a, l, [e, n]) {
|
|
|
26
26
|
left: `${s}px`,
|
|
27
27
|
// transform: `translate(${left}px, ${top}px)`,
|
|
28
28
|
maxWidth: `calc(100vw - ${s}px - 10px)`,
|
|
29
|
-
animationDelay: `${
|
|
29
|
+
animationDelay: `${a}ms`
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function I(l, a) {
|
|
33
33
|
const {
|
|
34
34
|
x: e,
|
|
35
35
|
y: n,
|
|
36
36
|
width: r,
|
|
37
37
|
height: s
|
|
38
|
-
} =
|
|
38
|
+
} = l.getBoundingClientRect();
|
|
39
39
|
let t = 0, c = 0;
|
|
40
|
-
switch (
|
|
40
|
+
switch (a) {
|
|
41
41
|
case "top": {
|
|
42
42
|
t = e + r / 2, c = n - i;
|
|
43
43
|
break;
|
|
@@ -69,21 +69,21 @@ function F(a, l) {
|
|
|
69
69
|
}
|
|
70
70
|
return [t, c];
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function B(l) {
|
|
73
73
|
const {
|
|
74
|
-
title:
|
|
74
|
+
title: a,
|
|
75
75
|
children: e,
|
|
76
76
|
animated: n = !0,
|
|
77
77
|
fixedOn: r = "bottom",
|
|
78
78
|
delay: s = 0
|
|
79
|
-
} =
|
|
79
|
+
} = l, t = f.useRef(r);
|
|
80
80
|
t.current = r;
|
|
81
|
-
const c =
|
|
81
|
+
const c = k(S), o = f.useRef(null), [g, x] = f.useState(!1), [E, _] = f.useState([0, 0]);
|
|
82
82
|
f.useEffect(() => {
|
|
83
83
|
if (!o.current)
|
|
84
84
|
return;
|
|
85
85
|
const d = (u) => {
|
|
86
|
-
t.current && o.current ? _(
|
|
86
|
+
t.current && o.current ? _(I(o.current, t.current)) : _([u.clientX, u.clientY]), x(!0);
|
|
87
87
|
}, v = () => {
|
|
88
88
|
x(!1);
|
|
89
89
|
}, b = (u) => {
|
|
@@ -94,20 +94,21 @@ function D(a) {
|
|
|
94
94
|
};
|
|
95
95
|
}, []);
|
|
96
96
|
let h = null;
|
|
97
|
-
if (g &&
|
|
97
|
+
if (g && a) {
|
|
98
98
|
const d = O(m.wrapper, m[`fixed-on-${r}`], {
|
|
99
99
|
[m.animated]: n
|
|
100
100
|
});
|
|
101
|
-
h = /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p("div", { className: d, style:
|
|
101
|
+
h = /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p("div", { className: d, style: F(!!r, s, E), children: /* @__PURE__ */ p("div", { className: m.root, children: a }) }) });
|
|
102
102
|
}
|
|
103
|
-
const
|
|
104
|
-
ref:
|
|
103
|
+
const L = typeof e == "function" ? e(o) : f.cloneElement(e, {
|
|
104
|
+
ref: y(o, e.props.ref)
|
|
105
105
|
});
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
|
|
106
|
+
return /* @__PURE__ */ T(w, { children: [
|
|
107
|
+
L,
|
|
108
108
|
h
|
|
109
109
|
] });
|
|
110
110
|
}
|
|
111
111
|
export {
|
|
112
|
-
|
|
112
|
+
S as TITLE_OUTLET_ID,
|
|
113
|
+
B as Title
|
|
113
114
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export { mergeRefs } from './utils/mergeRefs';
|
|
2
2
|
export { clsx } from './utils/clsx';
|
|
3
3
|
export { getValue } from './utils/getValue';
|
|
4
|
-
export { useInstance, useDynamicRef, useGlobalKeyboardEvent, useKeyboardClose, useWindowResize, useOutlet,
|
|
4
|
+
export { useInstance, useDynamicRef, useGlobalKeyboardEvent, useKeyboardClose, useWindowResize, useOutlet, } from './utils/hooks';
|
|
5
5
|
export { noop, returnTrue, returnFalse, identity, invoke, } from './utils/functional';
|
|
6
6
|
export { isExternalUrl, matchLinks, matchLinkNodes, defaultLinkReplacerx, defaultLinkReplacer, linkifyx, linkify, Linkify, } from './utils/links';
|
|
7
7
|
export { clamp01, clamp, } from './utils/math';
|
|
8
8
|
export { unicodeCharAt, splitByIndices, replaceRange, normalizeSlashes, isTrueString, isFalseString, } from './utils/string';
|
|
9
9
|
export type { ValueOrGetter } from './utils/getValue';
|
|
10
10
|
export type { ILinkSubstitute, ILinkMatch, LinkifyProps, } from './utils/links';
|
|
11
|
+
export type { OutletPosition } from './utils/hooks';
|
|
11
12
|
export { Checkbox } from './components/Checkbox/Checkbox';
|
|
12
13
|
export { Button } from './components/Button/Button';
|
|
13
14
|
export { LinkButton } from './components/Button/LinkButton';
|
|
14
15
|
export { ButtonBar } from './components/Button/ButtonBar';
|
|
15
16
|
export { Avatar } from './components/Avatar/Avatar';
|
|
16
|
-
export { BackdropPortal } from './components/BackdropPortal/BackdropPortal';
|
|
17
|
+
export { BackdropPortal, BACKDROP_OUTLET_ID } from './components/BackdropPortal/BackdropPortal';
|
|
17
18
|
export { Badge } from './components/Badge/Badge';
|
|
18
19
|
export { ControlBox } from './components/ControlBox/ControlBox';
|
|
19
20
|
export { CountryFlag } from './components/CountryFlag/CountryFlag';
|
|
20
21
|
export { Decorate } from './components/Decorate/Decorate';
|
|
21
22
|
export { Dot } from './components/Dot/Dot';
|
|
22
|
-
export { Flyout } from './components/Flyout/Flyout';
|
|
23
|
+
export { Flyout, FLYOUT_OUTLET_ID } from './components/Flyout/Flyout';
|
|
23
24
|
export { Icon } from './components/Icon/Icon';
|
|
24
25
|
export { Indicator } from './components/Indicator/Indicator';
|
|
25
26
|
export { InfoPanel } from './components/InfoPanel/InfoPanel';
|
|
@@ -38,7 +39,7 @@ export { VirtualScrollable } from './components/Layout/Scrollable/VirtualScrolla
|
|
|
38
39
|
export { Loaf } from './components/Loaf/Loaf';
|
|
39
40
|
export { Modal } from './components/Modal/Modal';
|
|
40
41
|
export { NavList } from './components/NavList/NavList';
|
|
41
|
-
export { Overlay } from './components/Overlay/Overlay';
|
|
42
|
+
export { Overlay, OVERLAY_OUTLET_ID } from './components/Overlay/Overlay';
|
|
42
43
|
export { Popover } from './components/Popover/Popover';
|
|
43
44
|
export { PremiumBadge } from './components/PremiumBadge/PremiumBadge';
|
|
44
45
|
export { Prose } from './components/Prose/Prose';
|
|
@@ -52,7 +53,7 @@ export { Switch } from './components/Switch/Switch';
|
|
|
52
53
|
export { Tabular } from './components/Tabular/Tabular';
|
|
53
54
|
export { Text, TextBlock } from './components/Text/Text';
|
|
54
55
|
export { Textarea } from './components/Textarea/Textarea';
|
|
55
|
-
export { Title } from './components/Title/Title';
|
|
56
|
+
export { Title, TITLE_OUTLET_ID } from './components/Title/Title';
|
|
56
57
|
export { InputDropzone } from './components/InputDropzone/InputDropzone';
|
|
57
58
|
export type { InputDropzoneProps, FileWithPath } from './components/InputDropzone/InputDropzone';
|
|
58
59
|
export { Icons, BrandIcon } from './style-guide/Icons/Icons';
|
package/dist/main.js
CHANGED
|
@@ -1,145 +1,147 @@
|
|
|
1
1
|
import { mergeRefs as e } from "./utils/mergeRefs.js";
|
|
2
2
|
import { clsx as p } from "./utils/clsx.js";
|
|
3
|
-
import { getValue as
|
|
4
|
-
import { useDynamicRef as a, useGlobalKeyboardEvent as
|
|
5
|
-
import { identity as
|
|
6
|
-
import { Linkify as
|
|
7
|
-
import { clamp as
|
|
8
|
-
import { isFalseString as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { LinkButton as
|
|
12
|
-
import { ButtonBar as
|
|
13
|
-
import { Avatar as
|
|
14
|
-
import { BackdropPortal as
|
|
15
|
-
import { Badge as
|
|
16
|
-
import { ControlBox as
|
|
17
|
-
import { CountryFlag as
|
|
18
|
-
import { Decorate as
|
|
19
|
-
import { Dot as
|
|
20
|
-
import {
|
|
3
|
+
import { getValue as m } from "./utils/getValue.js";
|
|
4
|
+
import { useDynamicRef as a, useGlobalKeyboardEvent as n, useInstance as l, useKeyboardClose as i, useOutlet as s, useWindowResize as u } from "./utils/hooks.js";
|
|
5
|
+
import { identity as d, invoke as I, noop as T, returnFalse as L, returnTrue as S } from "./utils/functional.js";
|
|
6
|
+
import { Linkify as B, defaultLinkReplacer as k, defaultLinkReplacerx as R, isExternalUrl as O, linkify as g, linkifyx as D, matchLinkNodes as b, matchLinks as h } from "./utils/links.js";
|
|
7
|
+
import { clamp as E, clamp01 as P } from "./utils/math.js";
|
|
8
|
+
import { isFalseString as v, isTrueString as F, normalizeSlashes as U, replaceRange as A, splitByIndices as z, unicodeCharAt as K } from "./utils/string.js";
|
|
9
|
+
import { Checkbox as w } from "./components/Checkbox/Checkbox.js";
|
|
10
|
+
import { Button as Y } from "./components/Button/Button.js";
|
|
11
|
+
import { LinkButton as M } from "./components/Button/LinkButton.js";
|
|
12
|
+
import { ButtonBar as j } from "./components/Button/ButtonBar.js";
|
|
13
|
+
import { Avatar as H } from "./components/Avatar/Avatar.js";
|
|
14
|
+
import { BACKDROP_OUTLET_ID as Q, BackdropPortal as X } from "./components/BackdropPortal/BackdropPortal.js";
|
|
15
|
+
import { Badge as $ } from "./components/Badge/Badge.js";
|
|
16
|
+
import { ControlBox as or } from "./components/ControlBox/ControlBox.js";
|
|
17
|
+
import { CountryFlag as tr } from "./components/CountryFlag/CountryFlag.js";
|
|
18
|
+
import { Decorate as xr } from "./components/Decorate/Decorate.js";
|
|
19
|
+
import { Dot as fr } from "./components/Dot/Dot.js";
|
|
20
|
+
import { FLYOUT_OUTLET_ID as nr, Flyout as lr } from "./components/Flyout/Flyout.js";
|
|
21
21
|
import { Icon as sr } from "./components/Icon/Icon.js";
|
|
22
22
|
import { Indicator as cr } from "./components/Indicator/Indicator.js";
|
|
23
|
-
import { InfoPanel as
|
|
24
|
-
import { Input as
|
|
25
|
-
import { RichInput as
|
|
26
|
-
import { Interactive as
|
|
27
|
-
import { Island as
|
|
28
|
-
import { Box as
|
|
29
|
-
import { Center as
|
|
30
|
-
import { Flex as
|
|
31
|
-
import { FlexRestricter as
|
|
32
|
-
import { Pad as
|
|
33
|
-
import { Page as
|
|
34
|
-
import { Scrollable as
|
|
35
|
-
import { VirtualScrollable as
|
|
36
|
-
import { Loaf as
|
|
37
|
-
import { Modal as
|
|
38
|
-
import { NavList as
|
|
39
|
-
import { Overlay as
|
|
40
|
-
import { Popover as
|
|
41
|
-
import { PremiumBadge as
|
|
42
|
-
import { Prose as
|
|
43
|
-
import { Radio as
|
|
44
|
-
import { Select as
|
|
23
|
+
import { InfoPanel as Ir } from "./components/InfoPanel/InfoPanel.js";
|
|
24
|
+
import { Input as Lr } from "./components/Input/Input.js";
|
|
25
|
+
import { RichInput as yr } from "./components/Input/RichInput.js";
|
|
26
|
+
import { Interactive as kr } from "./components/Interactive/Interactive.js";
|
|
27
|
+
import { Island as Or } from "./components/Island/Island.js";
|
|
28
|
+
import { Box as Dr } from "./components/Layout/Box/Box.js";
|
|
29
|
+
import { Center as hr } from "./components/Layout/Center/Center.js";
|
|
30
|
+
import { Flex as Er } from "./components/Layout/Flex/Flex.js";
|
|
31
|
+
import { FlexRestricter as _r } from "./components/Layout/Flex/FlexRestricter.js";
|
|
32
|
+
import { Pad as Fr } from "./components/Layout/Pad/Pad.js";
|
|
33
|
+
import { Page as Ar } from "./components/Layout/Page/Page.js";
|
|
34
|
+
import { Scrollable as Kr } from "./components/Layout/Scrollable/Scrollable.js";
|
|
35
|
+
import { VirtualScrollable as wr } from "./components/Layout/Scrollable/VirtualScrollable.js";
|
|
36
|
+
import { Loaf as Yr } from "./components/Loaf/Loaf.js";
|
|
37
|
+
import { Modal as Mr } from "./components/Modal/Modal.js";
|
|
38
|
+
import { NavList as jr } from "./components/NavList/NavList.js";
|
|
39
|
+
import { OVERLAY_OUTLET_ID as Hr, Overlay as Jr } from "./components/Overlay/Overlay.js";
|
|
40
|
+
import { Popover as Xr } from "./components/Popover/Popover.js";
|
|
41
|
+
import { PremiumBadge as $r } from "./components/PremiumBadge/PremiumBadge.js";
|
|
42
|
+
import { Prose as oo } from "./components/Prose/Prose.js";
|
|
43
|
+
import { Radio as to } from "./components/Radio/Radio.js";
|
|
44
|
+
import { Select as xo } from "./components/Select/Select.js";
|
|
45
45
|
import { Separator as fo } from "./components/Separator/Separator.js";
|
|
46
|
-
import { Shroud as
|
|
47
|
-
import { Spacer as
|
|
48
|
-
import { Style as
|
|
49
|
-
import { Switch as
|
|
50
|
-
import { Tabular as
|
|
51
|
-
import { Text as
|
|
52
|
-
import { Textarea as
|
|
53
|
-
import { Title as
|
|
46
|
+
import { Shroud as no } from "./components/Shroud/Shroud.js";
|
|
47
|
+
import { Spacer as io } from "./components/Spacer/Spacer.js";
|
|
48
|
+
import { Style as uo, useContextualStyle as co } from "./components/Style/Style.js";
|
|
49
|
+
import { Switch as To } from "./components/Switch/Switch.js";
|
|
50
|
+
import { Tabular as So } from "./components/Tabular/Tabular.js";
|
|
51
|
+
import { Text as Bo, TextBlock as ko } from "./components/Text/Text.js";
|
|
52
|
+
import { Textarea as Oo } from "./components/Textarea/Textarea.js";
|
|
53
|
+
import { TITLE_OUTLET_ID as Do, Title as bo } from "./components/Title/Title.js";
|
|
54
54
|
import { InputDropzone as Co } from "./components/InputDropzone/InputDropzone.js";
|
|
55
|
-
import { B as
|
|
56
|
-
import { OnScreenSensor as
|
|
55
|
+
import { B as Po, I as _o } from "./Icons-BlBKvJD8.js";
|
|
56
|
+
import { OnScreenSensor as Fo } from "./components/OnScreenSensor.js";
|
|
57
57
|
import { ui as Ao } from "./components/ui.js";
|
|
58
|
-
import { Symbols as
|
|
58
|
+
import { Symbols as Ko } from "./components/Symbols.js";
|
|
59
59
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
H as Avatar,
|
|
61
|
+
Q as BACKDROP_OUTLET_ID,
|
|
62
|
+
X as BackdropPortal,
|
|
63
|
+
$ as Badge,
|
|
64
|
+
Dr as Box,
|
|
65
|
+
Po as BrandIcon,
|
|
66
|
+
Y as Button,
|
|
67
|
+
j as ButtonBar,
|
|
68
|
+
hr as Center,
|
|
69
|
+
w as Checkbox,
|
|
70
|
+
or as ControlBox,
|
|
71
|
+
tr as CountryFlag,
|
|
72
|
+
xr as Decorate,
|
|
73
|
+
fr as Dot,
|
|
74
|
+
nr as FLYOUT_OUTLET_ID,
|
|
75
|
+
Er as Flex,
|
|
76
|
+
_r as FlexRestricter,
|
|
77
|
+
lr as Flyout,
|
|
76
78
|
sr as Icon,
|
|
77
|
-
|
|
79
|
+
_o as Icons,
|
|
78
80
|
cr as Indicator,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
Ir as InfoPanel,
|
|
82
|
+
Lr as Input,
|
|
81
83
|
Co as InputDropzone,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
kr as Interactive,
|
|
85
|
+
Or as Island,
|
|
86
|
+
M as LinkButton,
|
|
87
|
+
B as Linkify,
|
|
88
|
+
Yr as Loaf,
|
|
89
|
+
Mr as Modal,
|
|
90
|
+
jr as NavList,
|
|
91
|
+
Hr as OVERLAY_OUTLET_ID,
|
|
92
|
+
Fo as OnScreenSensor,
|
|
93
|
+
Jr as Overlay,
|
|
94
|
+
Fr as Pad,
|
|
95
|
+
Ar as Page,
|
|
96
|
+
Xr as Popover,
|
|
97
|
+
$r as PremiumBadge,
|
|
98
|
+
oo as Prose,
|
|
99
|
+
to as Radio,
|
|
100
|
+
yr as RichInput,
|
|
101
|
+
Kr as Scrollable,
|
|
102
|
+
xo as Select,
|
|
100
103
|
fo as Separator,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
no as Shroud,
|
|
105
|
+
io as Spacer,
|
|
106
|
+
uo as Style,
|
|
107
|
+
To as Switch,
|
|
108
|
+
Ko as Symbols,
|
|
109
|
+
Do as TITLE_OUTLET_ID,
|
|
110
|
+
So as Tabular,
|
|
111
|
+
Bo as Text,
|
|
112
|
+
ko as TextBlock,
|
|
113
|
+
Oo as Textarea,
|
|
114
|
+
bo as Title,
|
|
115
|
+
wr as VirtualScrollable,
|
|
116
|
+
E as clamp,
|
|
117
|
+
P as clamp01,
|
|
114
118
|
p as clsx,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
k as defaultLinkReplacer,
|
|
120
|
+
R as defaultLinkReplacerx,
|
|
121
|
+
m as getValue,
|
|
122
|
+
d as identity,
|
|
123
|
+
I as invoke,
|
|
124
|
+
O as isExternalUrl,
|
|
125
|
+
v as isFalseString,
|
|
126
|
+
F as isTrueString,
|
|
127
|
+
g as linkify,
|
|
128
|
+
D as linkifyx,
|
|
129
|
+
b as matchLinkNodes,
|
|
130
|
+
h as matchLinks,
|
|
127
131
|
e as mergeRefs,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
T as noop,
|
|
133
|
+
U as normalizeSlashes,
|
|
134
|
+
A as replaceRange,
|
|
135
|
+
L as returnFalse,
|
|
136
|
+
S as returnTrue,
|
|
137
|
+
z as splitByIndices,
|
|
134
138
|
Ao as ui,
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
K as unicodeCharAt,
|
|
140
|
+
co as useContextualStyle,
|
|
137
141
|
a as useDynamicRef,
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
n as useGlobalKeyboardEvent,
|
|
143
|
+
l as useInstance,
|
|
140
144
|
i as useKeyboardClose,
|
|
141
145
|
s as useOutlet,
|
|
142
|
-
u as
|
|
143
|
-
c as useOutletBefore,
|
|
144
|
-
d as useWindowResize
|
|
146
|
+
u as useWindowResize
|
|
145
147
|
};
|
package/dist/utils/hooks.d.ts
CHANGED
|
@@ -11,6 +11,5 @@ export declare namespace useKeyboardClose {
|
|
|
11
11
|
var isCloseEvent: (event: KeyboardEvent) => boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare function useWindowResize<T extends () => void>(callback: T): void;
|
|
14
|
-
export
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function useOutlet(id: string): React.FC<React.PropsWithChildren>;
|
|
14
|
+
export type OutletPosition = 'original' | 'before' | 'after';
|
|
15
|
+
export declare function useOutlet(id: string, position?: OutletPosition): React.FC<React.PropsWithChildren>;
|
package/dist/utils/hooks.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { R as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import o from "react";
|
|
3
|
+
import { R as m } from "../index-2hJuj4UN.js";
|
|
4
|
+
const a = Symbol("Uninitialized");
|
|
5
|
+
function h(e, ...t) {
|
|
6
|
+
const r = o.useRef(a);
|
|
7
|
+
return r.current === a && (r.current = e(...t)), r.current;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const t =
|
|
9
|
+
function l(e) {
|
|
10
|
+
const t = o.useRef(e);
|
|
11
11
|
return t.current = e, t;
|
|
12
12
|
}
|
|
13
|
-
function i(e, t = "keydown",
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
i.shouldProcessEvent(
|
|
13
|
+
function i(e, t = "keydown", r) {
|
|
14
|
+
o.useEffect(() => {
|
|
15
|
+
const s = (n) => {
|
|
16
|
+
i.shouldProcessEvent(n) && e.current(n);
|
|
17
17
|
};
|
|
18
|
-
return window.addEventListener(t,
|
|
19
|
-
window.removeEventListener(t,
|
|
18
|
+
return window.addEventListener(t, s, r), () => {
|
|
19
|
+
window.removeEventListener(t, s, r);
|
|
20
20
|
};
|
|
21
|
-
}, [t,
|
|
21
|
+
}, [t, r]);
|
|
22
22
|
}
|
|
23
23
|
i.shouldProcessEvent = (e) => {
|
|
24
24
|
if (e.target instanceof Element) {
|
|
@@ -35,68 +35,45 @@ i.shouldProcessEvent = (e) => {
|
|
|
35
35
|
}
|
|
36
36
|
return !0;
|
|
37
37
|
};
|
|
38
|
-
function
|
|
39
|
-
const t =
|
|
40
|
-
|
|
38
|
+
function d(e) {
|
|
39
|
+
const t = l((r) => {
|
|
40
|
+
d.isCloseEvent(r) && e();
|
|
41
41
|
});
|
|
42
42
|
i(t);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
d.isCloseEvent = (e) => e.key === "Escape";
|
|
45
45
|
function v(e) {
|
|
46
|
-
const t =
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
return window.addEventListener("resize",
|
|
46
|
+
const t = l(e);
|
|
47
|
+
o.useEffect(() => {
|
|
48
|
+
const r = () => t.current();
|
|
49
|
+
return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
|
|
50
50
|
}, []);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function b(e) {
|
|
53
53
|
const {
|
|
54
54
|
children: t
|
|
55
55
|
} = e;
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ E("div", { style: { display: "none" }, children: t });
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const [
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
n(() => s);
|
|
68
|
-
}, [e]), t;
|
|
69
|
-
}
|
|
70
|
-
function R(e) {
|
|
71
|
-
const [t, n] = u.useState(() => a);
|
|
72
|
-
return u.useEffect(() => {
|
|
73
|
-
const o = `${e}_before`;
|
|
74
|
-
let r = document.getElementById(o), c = document.getElementById(e);
|
|
75
|
-
c || (c = document.createElement("div"), c.id = e, document.body.appendChild(c)), r || (r = document.createElement("div"), r.id = o, document.body.insertBefore(r, c));
|
|
76
|
-
const s = ({
|
|
77
|
-
children: l
|
|
78
|
-
}) => d.createPortal(l, r);
|
|
79
|
-
n(() => s);
|
|
80
|
-
}, [e]), t;
|
|
81
|
-
}
|
|
82
|
-
function B(e) {
|
|
83
|
-
const [t, n] = u.useState(() => a);
|
|
84
|
-
return u.useEffect(() => {
|
|
85
|
-
let o = document.getElementById(e);
|
|
86
|
-
o || (o = document.createElement("div"), o.id = e, document.body.appendChild(o));
|
|
87
|
-
const r = ({
|
|
58
|
+
function g(e, t = "original") {
|
|
59
|
+
const [r, s] = o.useState(() => b);
|
|
60
|
+
return o.useEffect(() => {
|
|
61
|
+
let n = document.getElementById(e);
|
|
62
|
+
if (n || (n = document.createElement("div"), n.id = e, document.body.appendChild(n)), t !== "original") {
|
|
63
|
+
const c = n, u = `${e}_${t}`;
|
|
64
|
+
n = document.getElementById(u), n || (n = document.createElement("div"), n.id = u, t === "before" ? document.body.insertBefore(n, c) : c.after(n));
|
|
65
|
+
}
|
|
66
|
+
const f = ({
|
|
88
67
|
children: c
|
|
89
|
-
}) =>
|
|
90
|
-
|
|
91
|
-
}, [e]),
|
|
68
|
+
}) => m.createPortal(c, n);
|
|
69
|
+
s(() => f);
|
|
70
|
+
}, [e, t]), r;
|
|
92
71
|
}
|
|
93
72
|
export {
|
|
94
|
-
|
|
73
|
+
l as useDynamicRef,
|
|
95
74
|
i as useGlobalKeyboardEvent,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
h as useOutletAfter,
|
|
100
|
-
R as useOutletBefore,
|
|
75
|
+
h as useInstance,
|
|
76
|
+
d as useKeyboardClose,
|
|
77
|
+
g as useOutlet,
|
|
101
78
|
v as useWindowResize
|
|
102
79
|
};
|