asma-ui-core 3.113.1 → 3.113.2
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,67 +1,68 @@
|
|
|
1
|
-
import { CloseIcon as
|
|
2
|
-
import { StyledButton as
|
|
1
|
+
import { CloseIcon as w } from "../../icons/close-icon/CloseIcon.js";
|
|
2
|
+
import { StyledButton as y } from "../button/StyledButton.js";
|
|
3
3
|
import { useShortViewportMediaQuery as g } from "../../../hooks/useMediaQuery.hook.js";
|
|
4
|
-
import { StyledDialog as
|
|
4
|
+
import { StyledDialog as k } from "../../feedback/dialog/StyledDialog.js";
|
|
5
5
|
import { PickerLiveRegion as N } from "./PickerLiveRegion.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import { isKeyboardModality as S, trackInputModality as I } from "./inputModality.js";
|
|
7
|
+
import { useVisualViewportHeight as R } from "./useVisualViewportHeight.js";
|
|
8
|
+
import { useEffect as x, useRef as p } from "react";
|
|
9
|
+
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
var B = ({ open: o, onClose: t, dataTest: i, title: r, fallbackName: a, ...n }) => {
|
|
11
|
+
const l = r != null && r !== !1 && r !== "";
|
|
12
|
+
return x(I, []), /* @__PURE__ */ e(k, {
|
|
13
|
+
open: o,
|
|
14
|
+
onClose: (f, s) => t(s),
|
|
15
|
+
dataTest: i,
|
|
15
16
|
fullScreen: !0,
|
|
16
17
|
showCloseIcon: !1,
|
|
17
|
-
ariaLabel:
|
|
18
|
-
children: /* @__PURE__ */ e(
|
|
18
|
+
ariaLabel: l ? void 0 : a,
|
|
19
|
+
children: /* @__PURE__ */ e($, {
|
|
19
20
|
...n,
|
|
20
|
-
dataTest:
|
|
21
|
-
title:
|
|
22
|
-
onClose:
|
|
21
|
+
dataTest: i,
|
|
22
|
+
title: l ? r : void 0,
|
|
23
|
+
onClose: t
|
|
23
24
|
})
|
|
24
25
|
});
|
|
25
|
-
},
|
|
26
|
-
const s = g(),
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
(
|
|
26
|
+
}, $ = ({ dataTest: o, title: t, closeLabel: i, search: r, headerRow: a, children: n, announcement: l, onClose: f }) => {
|
|
27
|
+
const s = g(), v = R(), c = p(null), u = p(null);
|
|
28
|
+
return x(() => {
|
|
29
|
+
const b = requestAnimationFrame(() => {
|
|
30
|
+
const h = c.current?.closest("dialog");
|
|
31
|
+
if (!h || document.activeElement !== h || !S()) return;
|
|
32
|
+
const d = u.current?.querySelector('[role="listbox"]');
|
|
33
|
+
(d && d.tabIndex >= 0 ? d : c.current)?.focus({ preventScroll: !0 });
|
|
33
34
|
});
|
|
34
|
-
return () => cancelAnimationFrame(
|
|
35
|
-
}, []), /* @__PURE__ */
|
|
35
|
+
return () => cancelAnimationFrame(b);
|
|
36
|
+
}, []), /* @__PURE__ */ m("div", {
|
|
36
37
|
className: "flex min-h-0 flex-col",
|
|
37
|
-
style: { height:
|
|
38
|
+
style: { height: v },
|
|
38
39
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
"data-testid": `${
|
|
40
|
+
/* @__PURE__ */ m("div", {
|
|
41
|
+
"data-testid": `${o}-header`,
|
|
41
42
|
className: "flex shrink-0 flex-col border-0 border-b border-solid border-delta-200 bg-white",
|
|
42
43
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ m("div", {
|
|
44
45
|
className: "flex items-start gap-2",
|
|
45
46
|
children: [
|
|
46
|
-
|
|
47
|
+
t !== void 0 && /* @__PURE__ */ e("h2", {
|
|
47
48
|
className: "m-0 min-w-0 flex-1 break-words pl-4 pt-2 text-[20px] font-semibold leading-7 text-delta-800",
|
|
48
|
-
children:
|
|
49
|
+
children: t
|
|
49
50
|
}),
|
|
50
51
|
s && /* @__PURE__ */ e("div", {
|
|
51
52
|
className: "min-w-0 max-w-[240px] flex-1 pt-2",
|
|
52
53
|
children: r
|
|
53
54
|
}),
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
-
dataTest: `${
|
|
55
|
+
/* @__PURE__ */ e(y, {
|
|
56
|
+
dataTest: `${o}-close`,
|
|
56
57
|
refLink: c,
|
|
57
|
-
"aria-label":
|
|
58
|
+
"aria-label": i,
|
|
58
59
|
variant: "textGray",
|
|
59
|
-
startIcon: /* @__PURE__ */ e(
|
|
60
|
+
startIcon: /* @__PURE__ */ e(w, {
|
|
60
61
|
width: 24,
|
|
61
62
|
height: 24
|
|
62
63
|
}),
|
|
63
64
|
className: "ml-auto h-10 w-10 min-w-10 shrink-0 px-0",
|
|
64
|
-
onClick: () =>
|
|
65
|
+
onClick: () => f("closeButton")
|
|
65
66
|
})
|
|
66
67
|
]
|
|
67
68
|
}),
|
|
@@ -77,17 +78,17 @@ var q = ({ open: i, onClose: l, dataTest: o, title: r, fallbackName: a, ...n })
|
|
|
77
78
|
}),
|
|
78
79
|
/* @__PURE__ */ e("div", {
|
|
79
80
|
ref: u,
|
|
80
|
-
"data-testid": `${
|
|
81
|
+
"data-testid": `${o}-body`,
|
|
81
82
|
className: "flex min-h-0 flex-1 flex-col overflow-y-auto px-4",
|
|
82
83
|
children: n
|
|
83
84
|
}),
|
|
84
85
|
/* @__PURE__ */ e(N, {
|
|
85
|
-
announcement:
|
|
86
|
-
dataTest: `${
|
|
86
|
+
announcement: l,
|
|
87
|
+
dataTest: `${o}-live`
|
|
87
88
|
})
|
|
88
89
|
]
|
|
89
90
|
});
|
|
90
91
|
};
|
|
91
92
|
export {
|
|
92
|
-
|
|
93
|
+
B as FullScreenPicker
|
|
93
94
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var t = !1, r = !1, a = () => {
|
|
2
|
+
r || typeof document > "u" || (r = !0, document.addEventListener("keydown", (e) => {
|
|
3
|
+
e.isTrusted && !e.metaKey && !e.ctrlKey && !e.altKey && (t = !0);
|
|
4
|
+
}, !0), document.addEventListener("pointerdown", (e) => {
|
|
5
|
+
e.isTrusted && (t = !1);
|
|
6
|
+
}, !0));
|
|
7
|
+
}, d = () => t;
|
|
8
|
+
export {
|
|
9
|
+
d as isKeyboardModality,
|
|
10
|
+
a as trackInputModality
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts tracking, once per page, whether the user's last action was a key press or a pointer press
|
|
3
|
+
* (mouse, pen, touch). Capture phase, so it sees the press that opens a picker before anything
|
|
4
|
+
* handles it. Only trusted events count: a script's synthetic events say nothing about the user.
|
|
5
|
+
*
|
|
6
|
+
* Why not `:focus-visible`: when a picker opens, `StyledDialog` moves focus from the field to its own
|
|
7
|
+
* shell, and a browser lets a scripted focus move inherit the field's focus-visible state. A text
|
|
8
|
+
* field is always focus-visible, so a tap on a field that already had focus (after an earlier choice)
|
|
9
|
+
* read as keyboard and put the active-row marker in the list (ASMA-8468).
|
|
10
|
+
*/
|
|
11
|
+
export declare const trackInputModality: () => void;
|
|
12
|
+
/** The user's last action was a key press (see {@link trackInputModality}). */
|
|
13
|
+
export declare const isKeyboardModality: () => boolean;
|