asma-ui-core 3.79.1 → 3.80.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +15 -15
- package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +72 -55
- package/dist/src/components/feedback/dialog/dialog-footer/StyledDialogFooter.d.ts +15 -0
- package/package.json +1 -1
|
@@ -8,23 +8,23 @@ import { Fragment as T, jsx as n, jsxs as o } from "react/jsx-runtime";
|
|
|
8
8
|
function O(e) {
|
|
9
9
|
return e != null && (e.inlineActions.length > 0 || e.showMoreMenu);
|
|
10
10
|
}
|
|
11
|
-
function A({ action: e, showLabel:
|
|
12
|
-
if (e.render) return e.render({ showLabel:
|
|
11
|
+
function A({ action: e, showLabel: l, selectionTone: i = !1 }) {
|
|
12
|
+
if (e.render) return e.render({ showLabel: l });
|
|
13
13
|
const a = e.ariaLabel ?? e.label;
|
|
14
14
|
return /* @__PURE__ */ n(p, {
|
|
15
15
|
dataTest: e.dataTest ?? `dynamic-toolbar-action-${e.id}`,
|
|
16
|
-
variant: e.variant ?? (
|
|
16
|
+
variant: e.variant ?? (i ? "text" : "outlined"),
|
|
17
17
|
error: e.tone === "danger",
|
|
18
18
|
size: e.size ?? "large",
|
|
19
19
|
type: "button",
|
|
20
20
|
disabled: e.disabled,
|
|
21
21
|
startIcon: e.icon,
|
|
22
22
|
onClick: e.onClick,
|
|
23
|
-
"aria-label":
|
|
24
|
-
children:
|
|
23
|
+
"aria-label": l && e.ariaLabel == null ? void 0 : a,
|
|
24
|
+
children: l ? e.label : void 0
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function C({ overflowMenuLabel: e, onOpen:
|
|
27
|
+
function C({ overflowMenuLabel: e, onOpen: l }) {
|
|
28
28
|
return /* @__PURE__ */ n(p, {
|
|
29
29
|
dataTest: "dynamic-toolbar-overflow-actions",
|
|
30
30
|
variant: "text",
|
|
@@ -34,30 +34,30 @@ function C({ overflowMenuLabel: e, onOpen: t }) {
|
|
|
34
34
|
width: 20,
|
|
35
35
|
height: 20
|
|
36
36
|
}),
|
|
37
|
-
onClick: (
|
|
37
|
+
onClick: (i) => l?.(i.currentTarget),
|
|
38
38
|
"aria-label": e,
|
|
39
39
|
"aria-haspopup": "menu",
|
|
40
40
|
children: e
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
function j({ plan: e, overflowMenuLabel:
|
|
43
|
+
function j({ plan: e, overflowMenuLabel: l, className: i, selectionTone: a = !1, registerActionWidth: d }) {
|
|
44
44
|
const [u, s] = y(null), { inlineActions: m, overflowActions: b, showMoreMenu: c } = e;
|
|
45
45
|
return !m.length && !c ? null : /* @__PURE__ */ o("div", {
|
|
46
|
-
className: f("flex shrink-0 flex-nowrap items-center gap-2",
|
|
47
|
-
children: [m.map(({ action: r, showLabel:
|
|
46
|
+
className: f("flex shrink-0 flex-nowrap items-center gap-2", i),
|
|
47
|
+
children: [m.map(({ action: r, showLabel: t }) => {
|
|
48
48
|
const h = /* @__PURE__ */ n(A, {
|
|
49
49
|
action: r,
|
|
50
|
-
showLabel:
|
|
50
|
+
showLabel: t,
|
|
51
51
|
selectionTone: a
|
|
52
52
|
}, r.id);
|
|
53
53
|
return d == null || r.measureInStrip !== !1 ? h : /* @__PURE__ */ n("span", {
|
|
54
|
-
ref: d(r.id,
|
|
54
|
+
ref: d(r.id, t),
|
|
55
55
|
className: "inline-flex shrink-0",
|
|
56
56
|
children: h
|
|
57
57
|
}, r.id);
|
|
58
58
|
}), c && /* @__PURE__ */ o(T, { children: [/* @__PURE__ */ n(C, {
|
|
59
|
-
overflowMenuLabel:
|
|
60
|
-
onOpen: s
|
|
59
|
+
overflowMenuLabel: l,
|
|
60
|
+
onOpen: (r) => s((t) => t ? null : r)
|
|
61
61
|
}), /* @__PURE__ */ n(x, {
|
|
62
62
|
anchorEl: u,
|
|
63
63
|
open: !!u,
|
|
@@ -70,7 +70,7 @@ function j({ plan: e, overflowMenuLabel: t, className: l, selectionTone: a = !1,
|
|
|
70
70
|
vertical: "top",
|
|
71
71
|
horizontal: "right"
|
|
72
72
|
},
|
|
73
|
-
children: b.map((r,
|
|
73
|
+
children: b.map((r, t) => /* @__PURE__ */ o(k, { children: [t > 0 && /* @__PURE__ */ n("hr", { className: "m-0 border-0 border-t border-solid border-delta-200" }), /* @__PURE__ */ n(v, {
|
|
74
74
|
disabled: r.disabled,
|
|
75
75
|
onClick: () => {
|
|
76
76
|
s(null), r.onClick();
|
|
@@ -1,76 +1,93 @@
|
|
|
1
1
|
import { cn as T } from "../../../../helpers/cn.js";
|
|
2
|
-
import { DotsVerticalIcon as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { DotsVerticalIcon as O } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
3
|
+
import { LoadingIcon as $ } from "../../../icons/loading-icon/LoadingIcon.js";
|
|
4
|
+
import { StyledTooltip as z } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
5
|
+
import { StyledButton as w } from "../../../inputs/button/StyledButton.js";
|
|
6
|
+
import { StyledMenu as j } from "../../../navigation/menu/StyledMenu.js";
|
|
7
|
+
import { StyledMenuItem as K } from "../../../navigation/menu/StyledMenuItem.js";
|
|
8
|
+
import { useElementWidthPx as F } from "../../../../hooks/useElementWidthPx.js";
|
|
9
|
+
import { useWidthRegistry as H } from "../../../../hooks/useWidthRegistry.js";
|
|
10
|
+
import { planToolbarActions as D } from "../../../custom/module/header-layout/planToolbarActions.js";
|
|
11
|
+
import { ToolbarActionButton as G } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
|
|
12
|
+
import { useToolbarTranslations as U } from "../../../custom/module/header-layout/useTranslations.js";
|
|
13
|
+
import { useMemo as C, useState as X } from "react";
|
|
14
|
+
import { Fragment as _, jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
15
|
+
var Y = 470, V = 8, k = "dialog-footer-right", N = "dialog-footer-more", I = (o, t) => `dialog-footer-action:${o}:${t ? "label" : "icon"}`;
|
|
16
|
+
function ce({ leftActions: o = [], leadingSlot: t, secondaryAction: a, primaryAction: s, fixed: P = !1, rounded: B = !0, locale: E = "en", className: M, dataTest: d = "styled-dialog-footer" }) {
|
|
17
|
+
const W = U(E), { ref: R, widthPx: c } = F(), { register: m, widths: n } = H(), [p, h] = X(null), g = c > 0 && c < Y, S = g ? 8 : 16, u = C(() => o.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
|
|
16
18
|
...e,
|
|
17
19
|
canHideLabel: !1
|
|
18
|
-
} : e), [
|
|
19
|
-
actions:
|
|
20
|
-
availableWidth:
|
|
20
|
+
} : e), [o]), A = n[k] ?? 0, x = a != null || s != null, v = Math.max(0, c - S * 2 - A - (x ? V : 0)), f = C(() => D({
|
|
21
|
+
actions: u,
|
|
22
|
+
availableWidth: v,
|
|
21
23
|
collapseLabels: !0,
|
|
22
|
-
resolveActionWidth: (e,
|
|
23
|
-
moreButtonWidthPx:
|
|
24
|
+
resolveActionWidth: (e, i) => n[I(e.id, i)],
|
|
25
|
+
moreButtonWidthPx: n[N]
|
|
24
26
|
}), [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
]),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
u,
|
|
28
|
+
v,
|
|
29
|
+
n
|
|
30
|
+
]), b = (e, i, L) => {
|
|
31
|
+
const y = /* @__PURE__ */ r(w, {
|
|
32
|
+
dataTest: e.dataTest ?? `${d}-${L}`,
|
|
33
|
+
variant: e.variant ?? i,
|
|
34
|
+
error: e.tone === "danger",
|
|
35
|
+
size: "medium",
|
|
36
|
+
type: e.type ?? "button",
|
|
37
|
+
disabled: !!e.disabled || !!e.loading,
|
|
38
|
+
startIcon: e.icon,
|
|
39
|
+
endIcon: e.loading ? /* @__PURE__ */ r($, {
|
|
40
|
+
width: 20,
|
|
41
|
+
height: 20
|
|
42
|
+
}) : e.endIcon,
|
|
43
|
+
onClick: e.onClick,
|
|
44
|
+
"aria-label": e.ariaLabel,
|
|
45
|
+
"aria-busy": e.loading,
|
|
46
|
+
children: e.label
|
|
47
|
+
});
|
|
48
|
+
return e.tooltip ? /* @__PURE__ */ r(z, {
|
|
49
|
+
arrow: !0,
|
|
50
|
+
title: e.tooltip,
|
|
51
|
+
children: /* @__PURE__ */ r("span", {
|
|
52
|
+
className: "inline-flex",
|
|
53
|
+
children: y
|
|
54
|
+
})
|
|
55
|
+
}) : y;
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ l("div", {
|
|
58
|
+
ref: R,
|
|
42
59
|
"data-testid": d,
|
|
43
|
-
className: T("flex items-center justify-end border-0 border-t border-solid border-delta-200 bg-white",
|
|
60
|
+
className: T("flex items-center justify-end border-0 border-t border-solid border-delta-200 bg-white", g ? "gap-2 p-2" : "gap-4 p-4", B && "rounded-b-lg", P && "sticky bottom-0 z-[1] shadow-[0_0_16px_0_rgba(34,33,51,0.2)]", M),
|
|
44
61
|
children: [/* @__PURE__ */ r("div", {
|
|
45
62
|
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
46
|
-
children:
|
|
47
|
-
ref: m(
|
|
63
|
+
children: t ?? /* @__PURE__ */ l(_, { children: [f.inlineActions.map(({ action: e, showLabel: i }) => /* @__PURE__ */ r("span", {
|
|
64
|
+
ref: m(I(e.id, i)),
|
|
48
65
|
className: "inline-flex shrink-0",
|
|
49
|
-
children: /* @__PURE__ */ r(
|
|
66
|
+
children: /* @__PURE__ */ r(G, {
|
|
50
67
|
action: e,
|
|
51
|
-
showLabel:
|
|
68
|
+
showLabel: i
|
|
52
69
|
})
|
|
53
|
-
}, e.id)),
|
|
54
|
-
ref: m(
|
|
70
|
+
}, e.id)), f.showMoreMenu && /* @__PURE__ */ l(_, { children: [/* @__PURE__ */ r("span", {
|
|
71
|
+
ref: m(N),
|
|
55
72
|
className: "inline-flex shrink-0",
|
|
56
|
-
children: /* @__PURE__ */ r(
|
|
73
|
+
children: /* @__PURE__ */ r(w, {
|
|
57
74
|
dataTest: `${d}-more`,
|
|
58
75
|
variant: "outlined",
|
|
59
76
|
size: "medium",
|
|
60
77
|
type: "button",
|
|
61
|
-
onClick: (e) =>
|
|
62
|
-
"aria-label":
|
|
78
|
+
onClick: (e) => h(e.currentTarget),
|
|
79
|
+
"aria-label": W.more,
|
|
63
80
|
"aria-haspopup": "menu",
|
|
64
81
|
"aria-expanded": p != null,
|
|
65
|
-
startIcon: /* @__PURE__ */ r(
|
|
82
|
+
startIcon: /* @__PURE__ */ r(O, {
|
|
66
83
|
width: 24,
|
|
67
84
|
height: 24
|
|
68
85
|
})
|
|
69
86
|
})
|
|
70
|
-
}), /* @__PURE__ */ r(
|
|
87
|
+
}), /* @__PURE__ */ r(j, {
|
|
71
88
|
anchorEl: p,
|
|
72
89
|
open: p != null,
|
|
73
|
-
onClose: () =>
|
|
90
|
+
onClose: () => h(null),
|
|
74
91
|
anchorOrigin: {
|
|
75
92
|
vertical: "top",
|
|
76
93
|
horizontal: "left"
|
|
@@ -79,12 +96,12 @@ function ae({ leftActions: i = [], leadingSlot: n, secondaryAction: o, primaryAc
|
|
|
79
96
|
vertical: "bottom",
|
|
80
97
|
horizontal: "left"
|
|
81
98
|
},
|
|
82
|
-
children:
|
|
99
|
+
children: f.overflowActions.map((e) => /* @__PURE__ */ r(K, {
|
|
83
100
|
disabled: e.disabled,
|
|
84
101
|
onClick: () => {
|
|
85
|
-
|
|
102
|
+
h(null), e.onClick();
|
|
86
103
|
},
|
|
87
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ l("div", {
|
|
88
105
|
className: T("flex items-center gap-2", e.tone === "danger" ? "text-beta-500" : "text-delta-700"),
|
|
89
106
|
children: [e.icon, /* @__PURE__ */ r("span", { children: e.label })]
|
|
90
107
|
})
|
|
@@ -92,14 +109,14 @@ function ae({ leftActions: i = [], leadingSlot: n, secondaryAction: o, primaryAc
|
|
|
92
109
|
})] })] })
|
|
93
110
|
}), x && /* @__PURE__ */ r("span", {
|
|
94
111
|
className: "flex min-w-px flex-1 flex-nowrap items-center justify-end",
|
|
95
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ l("span", {
|
|
96
113
|
ref: m(k),
|
|
97
114
|
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
98
|
-
children: [
|
|
115
|
+
children: [a && b(a, "outlined", "secondary"), s && b(s, "contained", "primary")]
|
|
99
116
|
})
|
|
100
117
|
})]
|
|
101
118
|
});
|
|
102
119
|
}
|
|
103
120
|
export {
|
|
104
|
-
|
|
121
|
+
ce as StyledDialogFooter
|
|
105
122
|
};
|
|
@@ -14,6 +14,21 @@ export interface StyledDialogFooterButton {
|
|
|
14
14
|
/** Renders in the destructive palette (Figma `Danger = on`). */
|
|
15
15
|
tone?: 'default' | 'danger';
|
|
16
16
|
icon?: ReactNode;
|
|
17
|
+
/** Trailing icon. `loading` supplies its own and wins. */
|
|
18
|
+
endIcon?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Shows a spinner after the label and disables the button. Consumers previously swapped
|
|
21
|
+
* the label *for* a spinner, which changes the button's width mid-submit — hence the
|
|
22
|
+
* hard-coded `w-[98px]` workarounds in the footers this replaces. Keeping the label
|
|
23
|
+
* makes the width stable on its own.
|
|
24
|
+
*/
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Wraps the button in a `StyledTooltip`. Falsy renders no tooltip, so the common
|
|
28
|
+
* `tooltip={disabled && 'Locked for editing'}` reads naturally. A disabled button does
|
|
29
|
+
* not emit pointer events, so the tooltip is anchored on a wrapper around it.
|
|
30
|
+
*/
|
|
31
|
+
tooltip?: ReactNode;
|
|
17
32
|
dataTest?: string;
|
|
18
33
|
ariaLabel?: string;
|
|
19
34
|
}
|