asma-ui-core 3.110.0 → 3.112.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/components/feedback/minimizable-dialog/MinimizableDialog.js +41 -41
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +57 -57
- package/dist/components/inputs/input-field/StyledInputField.js +147 -157
- package/dist/components/inputs/textarea/StyledTextarea.js +46 -47
- package/dist/hooks/useBackCloses.hook.js +67 -38
- package/dist/hooks/useTopLayer.hook.js +30 -26
- package/dist/index.js +252 -249
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +4 -1
- package/dist/src/helpers/CharacterCounter.d.ts +2 -1
- package/dist/src/hooks/useBackCloses.hook.d.ts +47 -2
- package/dist/src/hooks/useTopLayer.hook.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,91 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { findTopmostConnectedModalDialog as w } from "./useTopLayer.hook.js";
|
|
2
|
+
import { createContext as O, useContext as k, useEffect as p, useRef as B } from "react";
|
|
3
|
+
function v() {
|
|
3
4
|
return {
|
|
4
5
|
version: 1,
|
|
5
6
|
entries: [],
|
|
6
7
|
adapter: { unregister: null }
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function s() {
|
|
10
11
|
if (!(typeof window > "u"))
|
|
11
12
|
return window.rawWindow ?? document.defaultView ?? window;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
const e =
|
|
15
|
-
return
|
|
14
|
+
function c() {
|
|
15
|
+
const e = s(), n = e ? e.__asmaOverlayBackRegistry__ ??= v() : h ??= v();
|
|
16
|
+
return n.entries = A(n.entries), n;
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
+
var h, L = (e) => typeof e == "object" && e !== null && typeof e.then == "function";
|
|
18
19
|
function d(e, n) {
|
|
19
20
|
if (e.parentOwnerRef && e.parentOwnerRef === n.ownerRef) return !0;
|
|
20
21
|
const t = e.parentOwnerRef?.current ?? e.parentOwner, i = n.ownerRef?.current ?? n.owner;
|
|
21
22
|
return !!t && !!i && (t === i || i.contains(t));
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
const n = a()?.__ASMA__SHELL__?.overlayBack;
|
|
26
|
-
n?.v !== 1 || typeof n.register != "function" || (e.adapter.unregister = n.register(() => S()));
|
|
24
|
+
function S(e) {
|
|
25
|
+
return c().entries.some((n) => (n.ownerRef?.current ?? n.owner) === e);
|
|
27
26
|
}
|
|
27
|
+
var _ = /* @__PURE__ */ new WeakSet();
|
|
28
28
|
function A(e) {
|
|
29
|
+
if (_.has(e)) return e;
|
|
30
|
+
_.add(e);
|
|
31
|
+
const n = e.reduce.bind(e);
|
|
32
|
+
return Object.defineProperty(e, "reduce", {
|
|
33
|
+
configurable: !0,
|
|
34
|
+
value(t, i) {
|
|
35
|
+
return n((o, r, u, f) => y(r) ? o : t(o, r, u, f), i);
|
|
36
|
+
}
|
|
37
|
+
}), e;
|
|
38
|
+
}
|
|
39
|
+
function y(e) {
|
|
40
|
+
const n = w((i) => i.open || S(i));
|
|
41
|
+
if (!n) return !1;
|
|
42
|
+
const t = e.ownerRef?.current ?? e.owner;
|
|
43
|
+
return !t || n.contains(t) ? !1 : !E(t);
|
|
44
|
+
}
|
|
45
|
+
function E(e) {
|
|
46
|
+
return !(e instanceof HTMLElement) || typeof e.showPopover != "function" ? !1 : e.matches(":popover-open");
|
|
47
|
+
}
|
|
48
|
+
function R(e) {
|
|
49
|
+
if (e.adapter.unregister) return;
|
|
50
|
+
const n = s()?.__ASMA__SHELL__?.overlayBack;
|
|
51
|
+
n?.v !== 1 || typeof n.register != "function" || (e.adapter.unregister = n.register(() => b()));
|
|
52
|
+
}
|
|
53
|
+
function m(e) {
|
|
29
54
|
e.adapter.unregister && Promise.resolve().then(() => {
|
|
30
55
|
if (e.entries.length > 0) return;
|
|
31
56
|
const n = e.adapter.unregister;
|
|
32
57
|
e.adapter.unregister = null, n?.();
|
|
33
58
|
});
|
|
34
59
|
}
|
|
35
|
-
function
|
|
36
|
-
const r =
|
|
60
|
+
function C(e, n = null, t = null, i, o) {
|
|
61
|
+
const r = c(), u = {
|
|
37
62
|
requestClose: e,
|
|
38
63
|
pending: !1,
|
|
39
64
|
owner: n,
|
|
40
65
|
parentOwner: t,
|
|
41
66
|
ownerRef: i,
|
|
42
67
|
parentOwnerRef: o
|
|
43
|
-
},
|
|
44
|
-
r.entries.splice(
|
|
45
|
-
let
|
|
68
|
+
}, f = n || i ? r.entries.findIndex((a) => i !== void 0 && a.parentOwnerRef === i || n !== null && a.parentOwner === n || n !== null && a.owner !== null && n.contains(a.owner)) : -1;
|
|
69
|
+
r.entries.splice(f === -1 ? r.entries.length : f, 0, u), r.entries.length === 1 && R(r);
|
|
70
|
+
let l = !1;
|
|
46
71
|
return () => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
|
|
72
|
+
if (l) return;
|
|
73
|
+
l = !0;
|
|
74
|
+
const a = r.entries.indexOf(u);
|
|
75
|
+
if (a !== -1 && r.entries.splice(a, 1), r.entries.length === 0) {
|
|
76
|
+
m(r);
|
|
52
77
|
return;
|
|
53
78
|
}
|
|
54
79
|
queueMicrotask(() => {
|
|
55
|
-
const g =
|
|
80
|
+
const g = s()?.__ASMA__SHELL__?.overlayBack;
|
|
56
81
|
r.entries.length > 0 && g?.pendingNavigation && g.continuePendingNavigation?.();
|
|
57
82
|
});
|
|
58
83
|
};
|
|
59
84
|
}
|
|
60
|
-
var
|
|
61
|
-
function
|
|
62
|
-
const { entries: n } =
|
|
63
|
-
if (!t) return;
|
|
85
|
+
var M = O(void 0);
|
|
86
|
+
function b(e) {
|
|
87
|
+
const { entries: n } = c(), t = n.reduce((o, r) => y(r) ? o : !o || d(r, o) ? r : d(o, r) ? o : r, void 0);
|
|
88
|
+
if (!t) return n.length > 0 ? !1 : void 0;
|
|
64
89
|
if (t.pending) return !1;
|
|
65
90
|
const i = t.requestClose(e);
|
|
66
|
-
if (
|
|
91
|
+
if (L(i)) {
|
|
67
92
|
t.pending = !0;
|
|
68
93
|
const o = () => {
|
|
69
94
|
t.pending = !1, globalThis.setTimeout(() => {
|
|
70
|
-
const r =
|
|
71
|
-
r.entries.includes(t) &&
|
|
95
|
+
const r = c(), u = s()?.__ASMA__SHELL__?.overlayBack;
|
|
96
|
+
r.entries.includes(t) && u?.pendingNavigation && u.failOpenPendingNavigation?.();
|
|
72
97
|
}, 0);
|
|
73
98
|
};
|
|
74
99
|
i.then(o, o);
|
|
75
100
|
}
|
|
76
101
|
return i;
|
|
77
102
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
103
|
+
function I() {
|
|
104
|
+
return s()?.__ASMA__SHELL__?.overlayBack?.pendingNavigation === !0;
|
|
105
|
+
}
|
|
106
|
+
function N() {
|
|
107
|
+
const e = s()?.__ASMA__SHELL__?.overlayBack;
|
|
80
108
|
return e?.v === 1 && e.enabled === !0;
|
|
81
109
|
}
|
|
82
|
-
function
|
|
83
|
-
const i =
|
|
110
|
+
function T({ active: e, requestClose: n, ownerRef: t }) {
|
|
111
|
+
const i = k(M), o = B(n);
|
|
84
112
|
p(() => {
|
|
85
113
|
o.current = n;
|
|
86
114
|
}, [n]), p(() => {
|
|
87
115
|
if (e)
|
|
88
|
-
return
|
|
116
|
+
return C((r) => o.current(r), t?.current ?? null, i?.current ?? null, t, i);
|
|
89
117
|
}, [
|
|
90
118
|
e,
|
|
91
119
|
t,
|
|
@@ -93,8 +121,9 @@ function m({ active: e, requestClose: n, ownerRef: t }) {
|
|
|
93
121
|
]);
|
|
94
122
|
}
|
|
95
123
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
M as OverlayBackOwnerContext,
|
|
125
|
+
N as isOverlayBackEnabled,
|
|
126
|
+
I as isOverlayBackNavigationPending,
|
|
127
|
+
b as requestCloseTopOverlayBack,
|
|
128
|
+
T as useBackCloses
|
|
100
129
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
var
|
|
1
|
+
import { useCallback as s, useSyncExternalStore as a } from "react";
|
|
2
|
+
var p = { popover: "manual" }, g = {
|
|
3
3
|
margin: 0,
|
|
4
4
|
inset: "auto"
|
|
5
5
|
};
|
|
6
|
-
function
|
|
6
|
+
function w(e) {
|
|
7
7
|
if (!(e instanceof Element)) return;
|
|
8
8
|
const o = e.closest("dialog");
|
|
9
9
|
return o instanceof HTMLDialogElement && o.open ? o : void 0;
|
|
10
10
|
}
|
|
11
11
|
function t() {
|
|
12
|
-
if (typeof window > "u") return
|
|
12
|
+
if (typeof window > "u") return l ??= {
|
|
13
13
|
dialogs: [],
|
|
14
14
|
listeners: /* @__PURE__ */ new Set()
|
|
15
15
|
};
|
|
@@ -19,34 +19,37 @@ function t() {
|
|
|
19
19
|
listeners: /* @__PURE__ */ new Set()
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var l, r = () => {
|
|
23
23
|
for (const e of [...t().listeners]) e();
|
|
24
24
|
};
|
|
25
|
-
function
|
|
26
|
-
return t().dialogs.push(e),
|
|
25
|
+
function v(e) {
|
|
26
|
+
return t().dialogs.push(e), r(), () => {
|
|
27
27
|
const { dialogs: o } = t(), n = o.indexOf(e);
|
|
28
|
-
n !== -1 && (o.splice(n, 1),
|
|
28
|
+
n !== -1 && (o.splice(n, 1), r());
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const { dialogs:
|
|
33
|
-
for (let
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
31
|
+
function u(e) {
|
|
32
|
+
const { dialogs: o } = t();
|
|
33
|
+
for (let n = o.length - 1; n >= 0; n -= 1) {
|
|
34
|
+
const i = o[n];
|
|
35
|
+
if (i?.isConnected && e(i)) return i;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
function d() {
|
|
39
|
+
return u((e) => e.open);
|
|
40
|
+
}
|
|
41
|
+
var c = (e) => (t().listeners.add(e), () => {
|
|
39
42
|
t().listeners.delete(e);
|
|
40
43
|
});
|
|
41
|
-
function
|
|
42
|
-
return
|
|
44
|
+
function m() {
|
|
45
|
+
return a(c, d, () => {
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
|
-
function
|
|
48
|
+
function O(e) {
|
|
46
49
|
return e == null;
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
51
|
+
function T(e, o = !0) {
|
|
52
|
+
return s((n) => {
|
|
50
53
|
if (e(n), !(!n || !o))
|
|
51
54
|
try {
|
|
52
55
|
typeof n.showPopover == "function" && !n.matches(":popover-open") && n.showPopover();
|
|
@@ -55,11 +58,12 @@ function O(e, o = !0) {
|
|
|
55
58
|
}, [e, o]);
|
|
56
59
|
}
|
|
57
60
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
v as
|
|
63
|
-
O as
|
|
64
|
-
|
|
61
|
+
p as TOP_LAYER_PROPS,
|
|
62
|
+
g as TOP_LAYER_RESET_STYLE,
|
|
63
|
+
u as findTopmostConnectedModalDialog,
|
|
64
|
+
w as getOpenModalDialogAncestor,
|
|
65
|
+
v as registerOpenModalDialog,
|
|
66
|
+
O as shouldUsePopoverTopLayer,
|
|
67
|
+
T as useTopLayerRef,
|
|
68
|
+
m as useTopmostOpenModalDialog
|
|
65
69
|
};
|