asma-ui-core 3.113.0 → 3.113.1
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
|
|
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
|
});
|