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 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
  });
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.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",