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.
@@ -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: t, selectionTone: l = !1 }) {
12
- if (e.render) return e.render({ showLabel: t });
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 ?? (l ? "text" : "outlined"),
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": t && e.ariaLabel == null ? void 0 : a,
24
- children: t ? e.label : void 0
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: t }) {
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: (l) => t?.(l.currentTarget),
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: t, className: l, selectionTone: a = !1, registerActionWidth: d }) {
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", l),
47
- children: [m.map(({ action: r, showLabel: i }) => {
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: i,
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, i),
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: t,
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, i) => /* @__PURE__ */ o(k, { children: [i > 0 && /* @__PURE__ */ n("hr", { className: "m-0 border-0 border-t border-solid border-delta-200" }), /* @__PURE__ */ n(v, {
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 S } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
3
- import { StyledButton as y } from "../../../inputs/button/StyledButton.js";
4
- import { StyledMenu as $ } from "../../../navigation/menu/StyledMenu.js";
5
- import { StyledMenuItem as z } from "../../../navigation/menu/StyledMenuItem.js";
6
- import { useElementWidthPx as L } from "../../../../hooks/useElementWidthPx.js";
7
- import { useWidthRegistry as j } from "../../../../hooks/useWidthRegistry.js";
8
- import { planToolbarActions as K } from "../../../custom/module/header-layout/planToolbarActions.js";
9
- import { ToolbarActionButton as F } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
10
- import { useToolbarTranslations as H } from "../../../custom/module/header-layout/useTranslations.js";
11
- import { useMemo as C, useState as D } from "react";
12
- import { Fragment as _, jsx as r, jsxs as t } from "react/jsx-runtime";
13
- var G = 470, U = 8, k = "dialog-footer-right", w = "dialog-footer-more", N = (i, n) => `dialog-footer-action:${i}:${n ? "label" : "icon"}`;
14
- function ae({ leftActions: i = [], leadingSlot: n, secondaryAction: o, primaryAction: s, fixed: P = !1, rounded: E = !0, locale: M = "en", className: W, dataTest: d = "styled-dialog-footer" }) {
15
- const R = H(M), { ref: A, widthPx: c } = L(), { register: m, widths: a } = j(), [p, f] = D(null), u = c > 0 && c < G, B = u ? 8 : 16, g = C(() => i.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
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), [i]), I = a[k] ?? 0, x = o != null || s != null, b = Math.max(0, c - B * 2 - I - (x ? U : 0)), h = C(() => K({
19
- actions: g,
20
- availableWidth: b,
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, l) => a[N(e.id, l)],
23
- moreButtonWidthPx: a[w]
24
+ resolveActionWidth: (e, i) => n[I(e.id, i)],
25
+ moreButtonWidthPx: n[N]
24
26
  }), [
25
- g,
26
- b,
27
- a
28
- ]), v = (e, l, O) => /* @__PURE__ */ r(y, {
29
- dataTest: e.dataTest ?? `${d}-${O}`,
30
- variant: e.variant ?? l,
31
- error: e.tone === "danger",
32
- size: "medium",
33
- type: e.type ?? "button",
34
- disabled: e.disabled,
35
- startIcon: e.icon,
36
- onClick: e.onClick,
37
- "aria-label": e.ariaLabel,
38
- children: e.label
39
- });
40
- return /* @__PURE__ */ t("div", {
41
- ref: A,
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", u ? "gap-2 p-2" : "gap-4 p-4", E && "rounded-b-lg", P && "sticky bottom-0 z-[1] shadow-[0_0_16px_0_rgba(34,33,51,0.2)]", W),
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: n ?? /* @__PURE__ */ t(_, { children: [h.inlineActions.map(({ action: e, showLabel: l }) => /* @__PURE__ */ r("span", {
47
- ref: m(N(e.id, l)),
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(F, {
66
+ children: /* @__PURE__ */ r(G, {
50
67
  action: e,
51
- showLabel: l
68
+ showLabel: i
52
69
  })
53
- }, e.id)), h.showMoreMenu && /* @__PURE__ */ t(_, { children: [/* @__PURE__ */ r("span", {
54
- ref: m(w),
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(y, {
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) => f(e.currentTarget),
62
- "aria-label": R.more,
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(S, {
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: () => f(null),
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: h.overflowActions.map((e) => /* @__PURE__ */ r(z, {
99
+ children: f.overflowActions.map((e) => /* @__PURE__ */ r(K, {
83
100
  disabled: e.disabled,
84
101
  onClick: () => {
85
- f(null), e.onClick();
102
+ h(null), e.onClick();
86
103
  },
87
- children: /* @__PURE__ */ t("div", {
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__ */ t("span", {
112
+ children: /* @__PURE__ */ l("span", {
96
113
  ref: m(k),
97
114
  className: "flex shrink-0 flex-nowrap items-center gap-2",
98
- children: [o && v(o, "outlined", "secondary"), s && v(s, "contained", "primary")]
115
+ children: [a && b(a, "outlined", "secondary"), s && b(s, "contained", "primary")]
99
116
  })
100
117
  })]
101
118
  });
102
119
  }
103
120
  export {
104
- ae as StyledDialogFooter
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
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.79.1",
6
+ "version": "3.80.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",