asma-ui-core 3.113.0 → 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.
- package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +63 -52
- package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +43 -42
- package/dist/components/inputs/full-screen-picker/inputModality.js +11 -0
- package/dist/src/components/inputs/full-screen-picker/inputModality.d.ts +13 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn as j } from "../../../../helpers/cn.js";
|
|
2
|
-
import { StyledTooltip as
|
|
3
|
-
import { DotsVerticalIcon as
|
|
4
|
-
import { DialogBusyContext as
|
|
2
|
+
import { StyledTooltip as H } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
|
+
import { DotsVerticalIcon as K } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
4
|
+
import { DialogBusyContext as U, WAIT_UNTIL_SAVED as V, useReportDialogBusy as G } from "../DialogBusyContext.js";
|
|
5
5
|
import { StyledButton as P } from "../../../inputs/button/StyledButton.js";
|
|
6
6
|
import { StyledMenu as X } from "../../../navigation/menu/StyledMenu.js";
|
|
7
7
|
import { StyledMenuItem as Y } from "../../../navigation/menu/StyledMenuItem.js";
|
|
@@ -10,38 +10,49 @@ import { useWidthRegistry as J } from "../../../../hooks/useWidthRegistry.js";
|
|
|
10
10
|
import { planToolbarActions as Q } from "../../../custom/module/header-layout/planToolbarActions.js";
|
|
11
11
|
import { ToolbarActionButton as Z, overflowItemState as ee } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
|
|
12
12
|
import { useToolbarTranslations as oe } from "../../../custom/module/header-layout/useTranslations.js";
|
|
13
|
-
import { useContext as re, useMemo as R, useState as
|
|
14
|
-
import { Fragment as _, jsx as o, jsxs as
|
|
15
|
-
var
|
|
16
|
-
function Te({ leftActions:
|
|
17
|
-
const
|
|
13
|
+
import { useContext as re, useMemo as R, useState as ne } from "react";
|
|
14
|
+
import { Fragment as _, jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
15
|
+
var le = 2, ie = 470, te = 8, M = "dialog-footer-right", O = "dialog-footer-more", k = (n, l) => `dialog-footer-action:${n}:${l ? "label" : "icon"}`;
|
|
16
|
+
function Te({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAction: p, fixed: E = !1, rounded: L = !0, locale: i = "en", className: W, dataTest: h = "styled-dialog-footer" }) {
|
|
17
|
+
const T = re(U), u = oe(i), { ref: S, widthPx: g } = q(), { register: x, widths: t } = J(), [v, b] = ne(null), a = g > 0 && g < ie, D = a ? 8 : 16, s = R(() => n.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
|
|
18
18
|
...e,
|
|
19
19
|
canHideLabel: !1
|
|
20
|
-
} : e), [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
} : e), [n]), $ = t[M] ?? 0, w = f != null || p != null, B = Math.max(0, g - D * 2 - $ - (w ? te : 0)), d = R(() => {
|
|
21
|
+
if (s.length >= le) return {
|
|
22
|
+
inlineActions: [],
|
|
23
|
+
overflowActions: s,
|
|
24
|
+
showMoreMenu: !0
|
|
25
|
+
};
|
|
26
|
+
const e = Q({
|
|
27
|
+
actions: s,
|
|
28
|
+
availableWidth: B,
|
|
29
|
+
collapseLabels: !0,
|
|
30
|
+
resolveActionWidth: (r, c) => t[k(r.id, c)],
|
|
31
|
+
moreButtonWidthPx: t[O]
|
|
32
|
+
});
|
|
33
|
+
return a ? {
|
|
34
|
+
...e,
|
|
35
|
+
inlineActions: e.inlineActions.map((r) => r.action.canHideLabel === !1 ? r : {
|
|
36
|
+
...r,
|
|
37
|
+
showLabel: !1
|
|
38
|
+
})
|
|
39
|
+
} : e;
|
|
40
|
+
}, [
|
|
41
|
+
s,
|
|
32
42
|
B,
|
|
33
|
-
t
|
|
43
|
+
t,
|
|
44
|
+
a
|
|
34
45
|
]);
|
|
35
|
-
G(
|
|
36
|
-
const C = (e, r,
|
|
37
|
-
const N =
|
|
46
|
+
G(l == null && d.overflowActions.some((e) => !!e.loading && e.holdsDialog !== !1));
|
|
47
|
+
const C = (e, r, c) => {
|
|
48
|
+
const N = c === "secondary" && T?.busy, y = !!e.disabled || !!N, A = N ? T.busyReason ?? V[i] : e.tooltip, I = y || !!e.loading, z = /* @__PURE__ */ o(P, {
|
|
38
49
|
locale: i,
|
|
39
|
-
dataTest: e.dataTest ?? `${
|
|
50
|
+
dataTest: e.dataTest ?? `${h}-${c}`,
|
|
40
51
|
variant: e.variant ?? r,
|
|
41
52
|
error: e.tone === "danger",
|
|
42
53
|
size: "medium",
|
|
43
54
|
type: e.type ?? "button",
|
|
44
|
-
disabled:
|
|
55
|
+
disabled: y && !!A,
|
|
45
56
|
"aria-disabled": I || void 0,
|
|
46
57
|
disabledReason: A,
|
|
47
58
|
loading: !!e.loading,
|
|
@@ -51,52 +62,52 @@ function Te({ leftActions: l = [], leadingSlot: n, secondaryAction: c, primaryAc
|
|
|
51
62
|
"aria-label": e.ariaLabel,
|
|
52
63
|
children: e.label
|
|
53
64
|
});
|
|
54
|
-
return /* @__PURE__ */ o(
|
|
65
|
+
return /* @__PURE__ */ o(H, {
|
|
55
66
|
arrow: !0,
|
|
56
67
|
title: e.tooltip,
|
|
57
|
-
open:
|
|
68
|
+
open: y || !e.tooltip ? !1 : void 0,
|
|
58
69
|
children: /* @__PURE__ */ o("span", {
|
|
59
70
|
className: "inline-flex",
|
|
60
71
|
children: z
|
|
61
72
|
})
|
|
62
73
|
});
|
|
63
74
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
ref:
|
|
66
|
-
"data-testid":
|
|
67
|
-
className: j("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white",
|
|
75
|
+
return /* @__PURE__ */ m("div", {
|
|
76
|
+
ref: S,
|
|
77
|
+
"data-testid": h,
|
|
78
|
+
className: j("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", a ? "gap-2 p-2" : "gap-4 p-4", L && "rounded-b-lg", E && "sticky bottom-0 z-[1]", W),
|
|
68
79
|
children: [/* @__PURE__ */ o("div", {
|
|
69
80
|
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
70
|
-
children:
|
|
71
|
-
ref:
|
|
81
|
+
children: l ?? /* @__PURE__ */ m(_, { children: [d.inlineActions.map(({ action: e, showLabel: r }) => /* @__PURE__ */ o("span", {
|
|
82
|
+
ref: x(k(e.id, r)),
|
|
72
83
|
className: "inline-flex shrink-0",
|
|
73
84
|
children: /* @__PURE__ */ o(Z, {
|
|
74
85
|
action: e,
|
|
75
86
|
showLabel: r,
|
|
76
|
-
inProgressLabel:
|
|
87
|
+
inProgressLabel: u.inProgress
|
|
77
88
|
})
|
|
78
|
-
}, e.id)),
|
|
79
|
-
ref:
|
|
89
|
+
}, e.id)), d.showMoreMenu && /* @__PURE__ */ m(_, { children: [/* @__PURE__ */ o("span", {
|
|
90
|
+
ref: x(O),
|
|
80
91
|
className: "inline-flex shrink-0",
|
|
81
92
|
children: /* @__PURE__ */ o(P, {
|
|
82
93
|
locale: i,
|
|
83
|
-
dataTest: `${
|
|
94
|
+
dataTest: `${h}-more`,
|
|
84
95
|
variant: "outlined",
|
|
85
96
|
size: "medium",
|
|
86
97
|
type: "button",
|
|
87
|
-
onClick: (e) =>
|
|
88
|
-
"aria-label":
|
|
98
|
+
onClick: (e) => b(e.currentTarget),
|
|
99
|
+
"aria-label": u.more,
|
|
89
100
|
"aria-haspopup": "menu",
|
|
90
|
-
"aria-expanded":
|
|
91
|
-
startIcon: /* @__PURE__ */ o(
|
|
101
|
+
"aria-expanded": v != null,
|
|
102
|
+
startIcon: /* @__PURE__ */ o(K, {
|
|
92
103
|
width: 24,
|
|
93
104
|
height: 24
|
|
94
105
|
})
|
|
95
106
|
})
|
|
96
107
|
}), /* @__PURE__ */ o(X, {
|
|
97
|
-
anchorEl:
|
|
98
|
-
open:
|
|
99
|
-
onClose: () =>
|
|
108
|
+
anchorEl: v,
|
|
109
|
+
open: v != null,
|
|
110
|
+
onClose: () => b(null),
|
|
100
111
|
anchorOrigin: {
|
|
101
112
|
vertical: "top",
|
|
102
113
|
horizontal: "left"
|
|
@@ -105,10 +116,10 @@ function Te({ leftActions: l = [], leadingSlot: n, secondaryAction: c, primaryAc
|
|
|
105
116
|
vertical: "bottom",
|
|
106
117
|
horizontal: "left"
|
|
107
118
|
},
|
|
108
|
-
children:
|
|
109
|
-
...ee(e,
|
|
119
|
+
children: d.overflowActions.map((e) => /* @__PURE__ */ o(Y, {
|
|
120
|
+
...ee(e, u.inProgress),
|
|
110
121
|
onClick: () => {
|
|
111
|
-
|
|
122
|
+
b(null), e.onClick();
|
|
112
123
|
},
|
|
113
124
|
children: /* @__PURE__ */ o("span", {
|
|
114
125
|
className: e.tone === "danger" ? "text-beta-500" : "text-delta-700",
|
|
@@ -116,12 +127,12 @@ function Te({ leftActions: l = [], leadingSlot: n, secondaryAction: c, primaryAc
|
|
|
116
127
|
})
|
|
117
128
|
}, e.id))
|
|
118
129
|
})] })] })
|
|
119
|
-
}),
|
|
130
|
+
}), w && /* @__PURE__ */ o("span", {
|
|
120
131
|
className: "flex min-w-px flex-1 flex-nowrap items-center justify-end",
|
|
121
|
-
children: /* @__PURE__ */
|
|
122
|
-
ref:
|
|
132
|
+
children: /* @__PURE__ */ m("span", {
|
|
133
|
+
ref: x(M),
|
|
123
134
|
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
124
|
-
children: [
|
|
135
|
+
children: [f && C(f, "outlined", "secondary"), p && C(p, "contained", "primary")]
|
|
125
136
|
})
|
|
126
137
|
})]
|
|
127
138
|
});
|
|
@@ -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;
|