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.
@@ -1,7 +1,7 @@
1
1
  import { cn as j } from "../../../../helpers/cn.js";
2
- import { StyledTooltip as K } from "../../../data-display/tooltip/StyledTooltip.js";
3
- import { DotsVerticalIcon as U } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
4
- import { DialogBusyContext as H, WAIT_UNTIL_SAVED as V, useReportDialogBusy as G } from "../DialogBusyContext.js";
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 le } from "react";
14
- import { Fragment as _, jsx as o, jsxs as d } from "react/jsx-runtime";
15
- var ne = 2, ie = 470, te = 8, M = "dialog-footer-right", O = "dialog-footer-more", k = (l, n) => `dialog-footer-action:${l}:${n ? "label" : "icon"}`;
16
- function Te({ leftActions: l = [], leadingSlot: n, secondaryAction: c, primaryAction: m, fixed: E = !1, rounded: W = !0, locale: i = "en", className: S, dataTest: f = "styled-dialog-footer" }) {
17
- const b = re(H), p = oe(i), { ref: L, widthPx: h } = q(), { register: u, widths: t } = J(), [g, x] = le(null), y = h > 0 && h < ie, D = y ? 8 : 16, a = R(() => l.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
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), [l]), $ = t[M] ?? 0, T = c != null || m != null, B = Math.max(0, h - D * 2 - $ - (T ? te : 0)), s = R(() => a.length >= ne ? {
21
- inlineActions: [],
22
- overflowActions: a,
23
- showMoreMenu: !0
24
- } : Q({
25
- actions: a,
26
- availableWidth: B,
27
- collapseLabels: !0,
28
- resolveActionWidth: (e, r) => t[k(e.id, r)],
29
- moreButtonWidthPx: t[O]
30
- }), [
31
- a,
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(n == null && s.overflowActions.some((e) => !!e.loading && e.holdsDialog !== !1));
36
- const C = (e, r, w) => {
37
- const N = w === "secondary" && b?.busy, v = !!e.disabled || !!N, A = N ? b.busyReason ?? V[i] : e.tooltip, I = v || !!e.loading, z = /* @__PURE__ */ o(P, {
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 ?? `${f}-${w}`,
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: v && !!A,
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(K, {
65
+ return /* @__PURE__ */ o(H, {
55
66
  arrow: !0,
56
67
  title: e.tooltip,
57
- open: v || !e.tooltip ? !1 : void 0,
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__ */ d("div", {
65
- ref: L,
66
- "data-testid": f,
67
- className: j("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", y ? "gap-2 p-2" : "gap-4 p-4", W && "rounded-b-lg", E && "sticky bottom-0 z-[1]", S),
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: n ?? /* @__PURE__ */ d(_, { children: [s.inlineActions.map(({ action: e, showLabel: r }) => /* @__PURE__ */ o("span", {
71
- ref: u(k(e.id, r)),
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: p.inProgress
87
+ inProgressLabel: u.inProgress
77
88
  })
78
- }, e.id)), s.showMoreMenu && /* @__PURE__ */ d(_, { children: [/* @__PURE__ */ o("span", {
79
- ref: u(O),
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: `${f}-more`,
94
+ dataTest: `${h}-more`,
84
95
  variant: "outlined",
85
96
  size: "medium",
86
97
  type: "button",
87
- onClick: (e) => x(e.currentTarget),
88
- "aria-label": p.more,
98
+ onClick: (e) => b(e.currentTarget),
99
+ "aria-label": u.more,
89
100
  "aria-haspopup": "menu",
90
- "aria-expanded": g != null,
91
- startIcon: /* @__PURE__ */ o(U, {
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: g,
98
- open: g != null,
99
- onClose: () => x(null),
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: s.overflowActions.map((e) => /* @__PURE__ */ o(Y, {
109
- ...ee(e, p.inProgress),
119
+ children: d.overflowActions.map((e) => /* @__PURE__ */ o(Y, {
120
+ ...ee(e, u.inProgress),
110
121
  onClick: () => {
111
- x(null), e.onClick();
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
- }), T && /* @__PURE__ */ o("span", {
130
+ }), w && /* @__PURE__ */ o("span", {
120
131
  className: "flex min-w-px flex-1 flex-nowrap items-center justify-end",
121
- children: /* @__PURE__ */ d("span", {
122
- ref: u(M),
132
+ children: /* @__PURE__ */ m("span", {
133
+ ref: x(M),
123
134
  className: "flex shrink-0 flex-nowrap items-center gap-2",
124
- children: [c && C(c, "outlined", "secondary"), m && C(m, "contained", "primary")]
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 b } from "../../icons/close-icon/CloseIcon.js";
2
- import { StyledButton as w } from "../button/StyledButton.js";
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 y } from "../../feedback/dialog/StyledDialog.js";
4
+ import { StyledDialog as k } from "../../feedback/dialog/StyledDialog.js";
5
5
  import { PickerLiveRegion as N } from "./PickerLiveRegion.js";
6
- import { useVisualViewportHeight as S } from "./useVisualViewportHeight.js";
7
- import { useEffect as k, useRef as x } from "react";
8
- import { jsx as e, jsxs as f } from "react/jsx-runtime";
9
- var q = ({ open: i, onClose: l, dataTest: o, title: r, fallbackName: a, ...n }) => {
10
- const t = r != null && r !== !1 && r !== "";
11
- return /* @__PURE__ */ e(y, {
12
- open: i,
13
- onClose: (h, s) => l(s),
14
- dataTest: o,
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: t ? void 0 : a,
18
- children: /* @__PURE__ */ e(I, {
18
+ ariaLabel: l ? void 0 : a,
19
+ children: /* @__PURE__ */ e($, {
19
20
  ...n,
20
- dataTest: o,
21
- title: t ? r : void 0,
22
- onClose: l
21
+ dataTest: i,
22
+ title: l ? r : void 0,
23
+ onClose: t
23
24
  })
24
25
  });
25
- }, I = ({ dataTest: i, title: l, closeLabel: o, search: r, headerRow: a, children: n, announcement: t, onClose: h }) => {
26
- const s = g(), p = S(), c = x(null), u = x(null);
27
- return k(() => {
28
- const v = requestAnimationFrame(() => {
29
- const d = c.current?.closest("dialog");
30
- if (!d || document.activeElement !== d || !d.matches(":focus-visible")) return;
31
- const m = u.current?.querySelector('[role="listbox"]');
32
- (m && m.tabIndex >= 0 ? m : c.current)?.focus({ preventScroll: !0 });
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(v);
35
- }, []), /* @__PURE__ */ f("div", {
35
+ return () => cancelAnimationFrame(b);
36
+ }, []), /* @__PURE__ */ m("div", {
36
37
  className: "flex min-h-0 flex-col",
37
- style: { height: p },
38
+ style: { height: v },
38
39
  children: [
39
- /* @__PURE__ */ f("div", {
40
- "data-testid": `${i}-header`,
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__ */ f("div", {
44
+ /* @__PURE__ */ m("div", {
44
45
  className: "flex items-start gap-2",
45
46
  children: [
46
- l !== void 0 && /* @__PURE__ */ e("h2", {
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: l
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(w, {
55
- dataTest: `${i}-close`,
55
+ /* @__PURE__ */ e(y, {
56
+ dataTest: `${o}-close`,
56
57
  refLink: c,
57
- "aria-label": o,
58
+ "aria-label": i,
58
59
  variant: "textGray",
59
- startIcon: /* @__PURE__ */ e(b, {
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: () => h("closeButton")
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": `${i}-body`,
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: t,
86
- dataTest: `${i}-live`
86
+ announcement: l,
87
+ dataTest: `${o}-live`
87
88
  })
88
89
  ]
89
90
  });
90
91
  };
91
92
  export {
92
- q as FullScreenPicker
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;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.113.0",
6
+ "version": "3.113.2",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",