asma-ui-core 3.121.6 → 3.123.0
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/ToolbarRows.js +64 -60
- package/dist/components/custom/widget/widget/StyledWidget.js +44 -37
- package/dist/components/custom/widget/widget-header/StyledWidgetHeader.js +7 -7
- package/dist/components/custom/widget/widget-title/StyledWidgetTitle.js +8 -8
- package/dist/components/data-display/chip/StyledChip.js +42 -42
- package/dist/components/data-display/form-label/components/StyledFormLabel.js +15 -15
- package/dist/components/feedback/dialog/StyledDialog.js +75 -75
- package/dist/components/feedback/dialog/StyledDialogActions.js +4 -4
- package/dist/components/feedback/dialog/StyledDialogTitle.js +13 -13
- package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +70 -69
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +69 -69
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +81 -81
- package/dist/components/feedback/snack-bar/StyledAlert.js +16 -16
- package/dist/components/inputs/button/StyledButton.js +36 -35
- package/dist/components/inputs/input-field/StyledInputField.js +38 -38
- package/dist/components/inputs/search-field/StyledSearchField.js +18 -17
- package/dist/components/miscellaneous/StyledFormControlLabel.js +13 -13
- package/dist/components/navigation/link/StyledLink.js +44 -44
- package/dist/components/navigation/title-chevron/StyledTitleChevron.js +13 -13
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +45 -45
- package/dist/components/utils/popover/PopoverAnatomy.js +23 -23
- package/dist/hooks/useMediaQuery.hook.js +3 -2
- package/dist/index.js +66 -63
- package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +3 -1
- package/dist/src/hooks/useMediaQuery.hook.d.ts +2 -0
- package/dist/src/table/components/table-header/SortIndicator.d.ts +12 -0
- package/dist/src/table/custom-features/order-columns/columnLayout.d.ts +24 -0
- package/dist/src/table/custom-features/order-columns/columnLayout.test.d.ts +1 -0
- package/dist/src/table/custom-features/order-columns/types.d.ts +8 -0
- package/dist/src/table/custom-features/order-columns/usePersistColumnOrder.d.ts +5 -0
- package/dist/src/table/helpers/columnIds.d.ts +27 -0
- package/dist/src/table/helpers/columnIds.test.d.ts +1 -0
- package/dist/src/table/helpers/tableStorage.d.ts +12 -0
- package/dist/src/table/helpers/tableStorage.test.d.ts +1 -0
- package/dist/src/table/hooks/useColumnSizingPersistence.d.ts +16 -3
- package/dist/src/table/hooks/useColumnSizingPersistence.test.d.ts +1 -0
- package/dist/src/table/hooks/usePersistedSorting.d.ts +54 -0
- package/dist/src/table/hooks/usePersistedSorting.test.d.ts +1 -0
- package/dist/src/table/hooks/usePersistedStateWriter.d.ts +30 -0
- package/dist/src/table/hooks/useTranslations.d.ts +6 -4
- package/dist/src/table/index.d.ts +1 -0
- package/dist/src/table/types.d.ts +9 -2
- package/dist/table/components/StyledTable.module.js +59 -56
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +61 -54
- package/dist/table/components/columns/action-column/components/TableActions.module.js +4 -4
- package/dist/table/components/table-header/SortIndicator.js +23 -0
- package/dist/table/components/table-header/TableHeader.js +30 -30
- package/dist/table/components/table-header/TableHeaderCell.js +30 -31
- package/dist/table/custom-features/order-columns/OrderColumnsFeature.js +7 -8
- package/dist/table/custom-features/order-columns/columnLayout.js +9 -0
- package/dist/table/custom-features/order-columns/usePersistColumnOrder.js +12 -11
- package/dist/table/custom-features/order-columns/usePersistedColumnOrder.js +7 -12
- package/dist/table/helpers/columnIds.js +28 -0
- package/dist/table/helpers/tableStorage.js +33 -0
- package/dist/table/hooks/useColumnSizingPersistence.js +16 -34
- package/dist/table/hooks/usePersistedPageSize.js +11 -16
- package/dist/table/hooks/usePersistedSorting.js +58 -0
- package/dist/table/hooks/usePersistedStateWriter.js +36 -0
- package/dist/table/hooks/useStyledTable.js +90 -60
- package/dist/table/hooks/useTranslations.js +13 -11
- package/dist/table/index.js +3 -2
- package/dist/table/shared-components/DropDownIcon.js +4 -2
- package/dist/table/shared-components/DropUpIcon.js +5 -3
- package/package.json +1 -1
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as i } from "../../../helpers/cn.js";
|
|
2
2
|
import { resolveSx as K } from "../../../helpers/sx.js";
|
|
3
|
-
import { registerOpenModalDialog as
|
|
4
|
-
import { CloseIcon as
|
|
5
|
-
import { DialogBusyContext as
|
|
6
|
-
import { StyledButton as
|
|
3
|
+
import { registerOpenModalDialog as he } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { CloseIcon as pe } from "../../icons/close-icon/CloseIcon.js";
|
|
5
|
+
import { DialogBusyContext as we, useDialogBusyBoundary as ye } from "./DialogBusyContext.js";
|
|
6
|
+
import { StyledButton as ve } from "../../inputs/button/StyledButton.js";
|
|
7
7
|
import { useMobileMediaQuery as ge } from "../../../hooks/useMediaQuery.hook.js";
|
|
8
8
|
import { OverlayBackOwnerContext as be, isOverlayBackEnabled as T, requestCloseTopOverlayBack as D, useBackCloses as ke } from "../../../hooks/useBackCloses.hook.js";
|
|
9
9
|
import { warnUnnamedDialog as Ce } from "../../../helpers/warnUnnamedDialog.js";
|
|
10
10
|
import Ee from "./StyledDialog.module.js";
|
|
11
11
|
import { StyledDialogTitleContext as Be } from "./dialogTitleContext.js";
|
|
12
|
-
import { useEffect as
|
|
13
|
-
import { jsx as
|
|
12
|
+
import { useEffect as c, useId as I, useLayoutEffect as U, useMemo as De, useRef as l, useState as X } from "react";
|
|
13
|
+
import { jsx as a, jsxs as u } from "react/jsx-runtime";
|
|
14
14
|
var Ie = {
|
|
15
15
|
xs: 444,
|
|
16
16
|
sm: 600,
|
|
17
17
|
md: 900,
|
|
18
18
|
lg: 1200,
|
|
19
19
|
xl: 1536
|
|
20
|
-
}, Fe = ({ open: t, onClose: R, children: S, dataTest:
|
|
21
|
-
const
|
|
22
|
-
titleId:
|
|
20
|
+
}, Fe = ({ open: t, onClose: R, children: S, dataTest: f, maxWidth: N = "sm", fullWidth: G, fullScreen: Q, scroll: V = "paper", disableEscapeKeyDown: H, className: $, style: J, sx: Y, classes: O, PaperProps: Z, slotProps: m, busyReason: ee, locale: te = "en", onCloseText: q, showCloseIcon: M = !0, dialogLabel: x, dialogTitle: h, dialogHeaderNode: re, ariaLabel: b }) => {
|
|
21
|
+
const p = I(), P = I(), [ne, oe] = X(), le = De(() => ({
|
|
22
|
+
titleId: p,
|
|
23
23
|
setTitleId: oe
|
|
24
|
-
}), [
|
|
25
|
-
|
|
24
|
+
}), [p]), w = h ? p : ne ?? (x ? P : void 0), ae = ge(), s = l(null), k = l(null), C = l(!1), E = l(!1), d = l(!1), _ = l(t);
|
|
25
|
+
c(() => {
|
|
26
26
|
_.current = t;
|
|
27
27
|
}, [t]);
|
|
28
|
-
const L = l(t), y = Q ??
|
|
28
|
+
const L = l(t), y = Q ?? ae, { busy: v, busyReason: se, contextValue: ie } = ye(ee, te), j = I(), [g, ce] = X(), W = l(!1);
|
|
29
29
|
U(() => {
|
|
30
|
-
const e = s.current, r = !!
|
|
30
|
+
const e = s.current, r = !!w || !!b, n = e && t && !r ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
|
|
31
31
|
n && !n.id && (n.id = j);
|
|
32
32
|
const o = n?.id;
|
|
33
|
-
o !==
|
|
33
|
+
o !== g && ce(o), e && t && !r && !n && !W.current && (W.current = !0, Ce(f));
|
|
34
34
|
}, [
|
|
35
35
|
t,
|
|
36
|
-
x,
|
|
37
|
-
g,
|
|
38
|
-
S,
|
|
39
36
|
w,
|
|
37
|
+
b,
|
|
38
|
+
S,
|
|
39
|
+
g,
|
|
40
40
|
j,
|
|
41
|
-
|
|
42
|
-
]),
|
|
43
|
-
L.current && !t &&
|
|
44
|
-
}, [t,
|
|
41
|
+
f
|
|
42
|
+
]), c(() => {
|
|
43
|
+
L.current && !t && m?.transition?.onExited?.(), L.current = t;
|
|
44
|
+
}, [t, m]), U(() => {
|
|
45
45
|
const e = s.current;
|
|
46
46
|
if (!e || !t) return;
|
|
47
|
-
e.open || (
|
|
48
|
-
const r =
|
|
47
|
+
e.open || (k.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
|
|
48
|
+
const r = he(e);
|
|
49
49
|
return () => {
|
|
50
|
-
r(),
|
|
50
|
+
r(), k.current?.isConnected && k.current.focus({ preventScroll: !0 });
|
|
51
51
|
};
|
|
52
|
-
}, [t]),
|
|
52
|
+
}, [t]), c(() => {
|
|
53
53
|
if (!t) return;
|
|
54
54
|
const e = document.body.style.overflow, r = document.documentElement.style.overflow;
|
|
55
55
|
return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
|
|
56
56
|
document.body.style.overflow = e, document.documentElement.style.overflow = r;
|
|
57
57
|
};
|
|
58
58
|
}, [t]);
|
|
59
|
-
const
|
|
59
|
+
const B = {
|
|
60
60
|
...Z,
|
|
61
|
-
...
|
|
62
|
-
}, z = N === !1 ? void 0 : Ie[N], { className: de, style: ue, onClick: fe, ...me } =
|
|
63
|
-
if (
|
|
61
|
+
...m?.paper
|
|
62
|
+
}, z = N === !1 ? void 0 : Ie[N], { className: de, style: ue, onClick: fe, ...me } = m?.backdrop ?? {}, A = (e, r) => {
|
|
63
|
+
if (v || d.current) return;
|
|
64
64
|
const n = R?.(e, r);
|
|
65
65
|
if (n && typeof n.then == "function") {
|
|
66
|
-
|
|
66
|
+
d.current = !0;
|
|
67
67
|
const o = () => {
|
|
68
|
-
|
|
68
|
+
d.current = !1;
|
|
69
69
|
};
|
|
70
70
|
n.then(o, o);
|
|
71
71
|
}
|
|
72
72
|
return n;
|
|
73
|
-
}, F = (e) =>
|
|
74
|
-
|
|
73
|
+
}, F = (e) => C.current ? !1 : (C.current = !0, window.setTimeout(() => {
|
|
74
|
+
C.current = !1;
|
|
75
75
|
}, 0), A(e, "escapeKeyDown"));
|
|
76
76
|
ke({
|
|
77
77
|
active: t,
|
|
78
|
-
requestClose: (e) => !R || H ||
|
|
78
|
+
requestClose: (e) => !R || H || v || d.current ? !1 : F(e ?? new Event("overlayBack")),
|
|
79
79
|
ownerRef: s
|
|
80
80
|
});
|
|
81
|
-
const
|
|
82
|
-
e.cancelable && e.preventDefault(), !
|
|
81
|
+
const xe = (e) => {
|
|
82
|
+
e.cancelable && e.preventDefault(), !E.current && T() && D();
|
|
83
83
|
};
|
|
84
|
-
return
|
|
84
|
+
return c(() => {
|
|
85
85
|
const e = s.current;
|
|
86
86
|
if (!e || !t) return;
|
|
87
87
|
let r = !1;
|
|
@@ -90,48 +90,48 @@ var Ie = {
|
|
|
90
90
|
r = !1, _.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
|
|
91
91
|
});
|
|
92
92
|
}, o = () => {
|
|
93
|
-
r || (r = !0, T() && !
|
|
93
|
+
r || (r = !0, T() && !d.current && D(), n());
|
|
94
94
|
};
|
|
95
95
|
return e.addEventListener("close", o), () => e.removeEventListener("close", o);
|
|
96
|
-
}, [t]),
|
|
96
|
+
}, [t]), c(() => {
|
|
97
97
|
if (!t || H) return;
|
|
98
98
|
const e = (r) => {
|
|
99
99
|
r.key !== "Escape" || r.defaultPrevented || (r.preventDefault(), r.stopImmediatePropagation(), D(r));
|
|
100
100
|
};
|
|
101
101
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
102
|
-
}),
|
|
102
|
+
}), c(() => {
|
|
103
103
|
if (!t) return;
|
|
104
104
|
const e = (r) => {
|
|
105
|
-
r.key === "Escape" && (
|
|
106
|
-
|
|
105
|
+
r.key === "Escape" && (E.current = !0, window.setTimeout(() => {
|
|
106
|
+
E.current = !1;
|
|
107
107
|
}, 0));
|
|
108
108
|
};
|
|
109
109
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
110
|
-
}, [t]), t ? /* @__PURE__ */
|
|
110
|
+
}, [t]), t ? /* @__PURE__ */ u("dialog", {
|
|
111
111
|
ref: s,
|
|
112
112
|
tabIndex: -1,
|
|
113
|
-
"data-testid":
|
|
114
|
-
"aria-labelledby":
|
|
115
|
-
"aria-label":
|
|
116
|
-
onCancel:
|
|
113
|
+
"data-testid": f,
|
|
114
|
+
"aria-labelledby": w ?? g,
|
|
115
|
+
"aria-label": w || g ? void 0 : b,
|
|
116
|
+
onCancel: xe,
|
|
117
117
|
onKeyDown: (e) => {
|
|
118
|
-
!
|
|
118
|
+
!v || e.key !== "Escape" || e.target.closest("dialog[open]") === s.current && e.preventDefault();
|
|
119
119
|
},
|
|
120
|
-
className:
|
|
120
|
+
className: i(Ee.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", V === "body" && "overflow-y-auto", $, O?.root),
|
|
121
121
|
style: {
|
|
122
122
|
zIndex: 999,
|
|
123
123
|
...K(Y),
|
|
124
124
|
...J
|
|
125
125
|
},
|
|
126
|
-
children: [/* @__PURE__ */
|
|
126
|
+
children: [/* @__PURE__ */ a("div", {
|
|
127
127
|
...me,
|
|
128
|
-
className:
|
|
128
|
+
className: i("absolute inset-0 bg-[#626e7eb2]", de),
|
|
129
129
|
style: ue,
|
|
130
130
|
onClick: (e) => {
|
|
131
131
|
fe?.(e), e.defaultPrevented || A(e, "backdropClick");
|
|
132
132
|
}
|
|
133
|
-
}), /* @__PURE__ */
|
|
134
|
-
className:
|
|
133
|
+
}), /* @__PURE__ */ u("div", {
|
|
134
|
+
className: i("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", y && "rounded-none", B.className, O?.paper),
|
|
135
135
|
style: {
|
|
136
136
|
minWidth: 0,
|
|
137
137
|
minHeight: 0,
|
|
@@ -145,8 +145,8 @@ var Ie = {
|
|
|
145
145
|
width: G ? "calc(100% - 64px)" : "auto",
|
|
146
146
|
maxHeight: "100%"
|
|
147
147
|
},
|
|
148
|
-
...K(
|
|
149
|
-
...
|
|
148
|
+
...K(B.sx),
|
|
149
|
+
...B.style,
|
|
150
150
|
...y ? {
|
|
151
151
|
width: "100%",
|
|
152
152
|
maxWidth: "100%",
|
|
@@ -154,32 +154,32 @@ var Ie = {
|
|
|
154
154
|
maxHeight: "100%"
|
|
155
155
|
} : { maxHeight: "calc(100% - 64px)" }
|
|
156
156
|
},
|
|
157
|
-
children: [(!!
|
|
158
|
-
className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [(!!x || !!h || M) && /* @__PURE__ */ u("div", {
|
|
158
|
+
className: i("box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4", "max-xs:flex-col-reverse max-xs:gap-2"),
|
|
159
|
+
children: [/* @__PURE__ */ u("div", {
|
|
160
160
|
className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
|
|
161
|
-
children: [
|
|
161
|
+
children: [x && /* @__PURE__ */ a("div", {
|
|
162
162
|
id: P,
|
|
163
|
-
className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
|
|
164
|
-
children:
|
|
165
|
-
}), h && /* @__PURE__ */
|
|
166
|
-
id:
|
|
167
|
-
className: "flex text-2xl font-semibold leading-8 text-delta-800",
|
|
163
|
+
className: i("flex h-8 items-center text-sm font-normal leading-5 text-delta-600", "max-xs:h-auto max-xs:min-h-8 max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]"),
|
|
164
|
+
children: x
|
|
165
|
+
}), h && /* @__PURE__ */ a("div", {
|
|
166
|
+
id: p,
|
|
167
|
+
className: i("flex text-2xl font-semibold leading-8 text-delta-800", "max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]"),
|
|
168
168
|
children: h
|
|
169
169
|
})]
|
|
170
|
-
}), M && /* @__PURE__ */
|
|
171
|
-
className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
|
|
172
|
-
children: [re, /* @__PURE__ */
|
|
173
|
-
dataTest: `close-button-${
|
|
170
|
+
}), M && /* @__PURE__ */ u("div", {
|
|
171
|
+
className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2 max-xs:flex-wrap max-xs:gap-y-2",
|
|
172
|
+
children: [re, /* @__PURE__ */ a(ve, {
|
|
173
|
+
dataTest: `close-button-${f}`,
|
|
174
174
|
"aria-label": q ? void 0 : "Close",
|
|
175
175
|
variant: "textGray",
|
|
176
176
|
size: "small",
|
|
177
|
-
endIcon: /* @__PURE__ */
|
|
177
|
+
endIcon: /* @__PURE__ */ a(pe, {
|
|
178
178
|
width: 20,
|
|
179
179
|
height: 20
|
|
180
180
|
}),
|
|
181
181
|
className: "max-w-full shrink-0 whitespace-nowrap",
|
|
182
|
-
disabled:
|
|
182
|
+
disabled: v,
|
|
183
183
|
disabledReason: se,
|
|
184
184
|
onClick: (e) => {
|
|
185
185
|
F(e);
|
|
@@ -192,12 +192,12 @@ var Ie = {
|
|
|
192
192
|
children: q
|
|
193
193
|
})]
|
|
194
194
|
})]
|
|
195
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), /* @__PURE__ */ a(be.Provider, {
|
|
196
196
|
value: s,
|
|
197
|
-
children: /* @__PURE__ */
|
|
197
|
+
children: /* @__PURE__ */ a(Be.Provider, {
|
|
198
198
|
value: le,
|
|
199
|
-
children: /* @__PURE__ */
|
|
200
|
-
value:
|
|
199
|
+
children: /* @__PURE__ */ a(we.Provider, {
|
|
200
|
+
value: ie,
|
|
201
201
|
children: S
|
|
202
202
|
})
|
|
203
203
|
})
|
|
@@ -2,16 +2,16 @@ import { resolveSx as r } from "../../../helpers/sx.js";
|
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
-
var x = ({ children: e, className:
|
|
5
|
+
var x = ({ children: e, className: a, sx: i, style: l, classes: c, disableSpacing: d, ...t }) => /* @__PURE__ */ s("div", {
|
|
6
6
|
"data-testid": "styled-dialog-actions",
|
|
7
7
|
className: "m-0 flex shrink-0 justify-center p-0",
|
|
8
8
|
style: {
|
|
9
|
-
...r(
|
|
10
|
-
...
|
|
9
|
+
...r(i),
|
|
10
|
+
...l
|
|
11
11
|
},
|
|
12
12
|
...t,
|
|
13
13
|
children: /* @__PURE__ */ s("div", {
|
|
14
|
-
className: o("flex w-full justify-end gap-2 p-4",
|
|
14
|
+
className: o("flex w-full justify-end gap-2 p-4 max-xs:flex-wrap", a),
|
|
15
15
|
children: e
|
|
16
16
|
})
|
|
17
17
|
});
|
|
@@ -2,30 +2,30 @@ import { resolveSx as n } from "../../../helpers/sx.js";
|
|
|
2
2
|
import { StyledDialogTitleContext as x } from "./dialogTitleContext.js";
|
|
3
3
|
import f from "clsx";
|
|
4
4
|
import { useContext as p, useLayoutEffect as u } from "react";
|
|
5
|
-
import { jsx as
|
|
6
|
-
var
|
|
7
|
-
const t = p(x),
|
|
5
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
6
|
+
var I = ({ children: e, className: l, sx: r, style: i, id: a, classes: c, ...m }) => {
|
|
7
|
+
const t = p(x), s = !!e, o = a ?? t?.titleId;
|
|
8
8
|
if (u(() => {
|
|
9
|
-
if (!(!
|
|
9
|
+
if (!(!s || !t))
|
|
10
10
|
return t.setTitleId(o), () => t.setTitleId(void 0);
|
|
11
11
|
}, [
|
|
12
|
-
|
|
12
|
+
s,
|
|
13
13
|
t,
|
|
14
14
|
o
|
|
15
15
|
]), !e) return null;
|
|
16
|
-
const
|
|
17
|
-
...n(
|
|
18
|
-
...
|
|
16
|
+
const d = {
|
|
17
|
+
...n(r),
|
|
18
|
+
...i
|
|
19
19
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ y("h2", {
|
|
21
21
|
"data-testid": "styled-dialog-title",
|
|
22
22
|
id: o,
|
|
23
|
-
className: f("mx-3 p-4 text-[20px] font-semibold leading-[20px]",
|
|
24
|
-
style:
|
|
25
|
-
...
|
|
23
|
+
className: f("mx-3 p-4 text-[20px] font-semibold leading-[20px]", "max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]", l),
|
|
24
|
+
style: d,
|
|
25
|
+
...m,
|
|
26
26
|
children: e
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
I as StyledDialogTitle
|
|
31
31
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledTooltip as
|
|
3
|
-
import { DotsVerticalIcon as
|
|
4
|
-
import { DialogBusyContext as
|
|
5
|
-
import { StyledButton as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { cn as w } 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 X, WAIT_UNTIL_SAVED as V, useReportDialogBusy as G } from "../DialogBusyContext.js";
|
|
5
|
+
import { StyledButton as I } from "../../../inputs/button/StyledButton.js";
|
|
6
|
+
import { useMaxXsMediaQuery as Y } from "../../../../hooks/useMediaQuery.hook.js";
|
|
7
|
+
import { StyledMenu as Q } from "../../../navigation/menu/StyledMenu.js";
|
|
8
|
+
import { StyledMenuItem as q } from "../../../navigation/menu/StyledMenuItem.js";
|
|
9
|
+
import { useElementWidthPx as J } from "../../../../hooks/useElementWidthPx.js";
|
|
10
|
+
import { useWidthRegistry as Z } from "../../../../hooks/useWidthRegistry.js";
|
|
11
|
+
import { planToolbarActions as ee } from "../../../custom/module/header-layout/planToolbarActions.js";
|
|
12
|
+
import { ToolbarActionButton as oe, overflowItemState as re } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
|
|
13
|
+
import { useToolbarTranslations as ne } from "../../../custom/module/header-layout/useTranslations.js";
|
|
14
|
+
import { useContext as le, useMemo as P, useState as ae } from "react";
|
|
15
|
+
import { Fragment as R, jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
16
|
+
var ie = 2, te = 470, se = 8, _ = "dialog-footer-right", O = "dialog-footer-more", E = (n, l) => `dialog-footer-action:${n}:${l ? "label" : "icon"}`;
|
|
17
|
+
function Ce({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAction: p, fixed: L = !1, rounded: W = !0, locale: a = "en", className: S, dataTest: x = "styled-dialog-footer" }) {
|
|
18
|
+
const T = le(X), h = ne(a), { ref: D, widthPx: u } = J(), { register: g, widths: i } = Z(), [b, v] = ae(null), t = u > 0 && u < te, j = t ? 8 : 16, s = P(() => n.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
|
|
18
19
|
...e,
|
|
19
20
|
canHideLabel: !1
|
|
20
|
-
} : e), [n]), $ =
|
|
21
|
-
if (s.length >=
|
|
21
|
+
} : e), [n]), $ = i[_] ?? 0, B = f != null || p != null, z = Y(), C = Math.max(0, u - j * 2 - (z ? 0 : $ + (B ? se : 0))), d = P(() => {
|
|
22
|
+
if (s.length >= ie) return {
|
|
22
23
|
inlineActions: [],
|
|
23
24
|
overflowActions: s,
|
|
24
25
|
showMoreMenu: !0
|
|
25
26
|
};
|
|
26
|
-
const e =
|
|
27
|
+
const e = ee({
|
|
27
28
|
actions: s,
|
|
28
|
-
availableWidth:
|
|
29
|
+
availableWidth: C,
|
|
29
30
|
collapseLabels: !0,
|
|
30
|
-
resolveActionWidth: (r,
|
|
31
|
-
moreButtonWidthPx:
|
|
31
|
+
resolveActionWidth: (r, m) => i[E(r.id, m)],
|
|
32
|
+
moreButtonWidthPx: i[O]
|
|
32
33
|
});
|
|
33
|
-
return
|
|
34
|
+
return t ? {
|
|
34
35
|
...e,
|
|
35
36
|
inlineActions: e.inlineActions.map((r) => r.action.canHideLabel === !1 ? r : {
|
|
36
37
|
...r,
|
|
@@ -39,75 +40,75 @@ function Te({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAc
|
|
|
39
40
|
} : e;
|
|
40
41
|
}, [
|
|
41
42
|
s,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
C,
|
|
44
|
+
i,
|
|
45
|
+
t
|
|
45
46
|
]);
|
|
46
47
|
G(l == null && d.overflowActions.some((e) => !!e.loading && e.holdsDialog !== !1));
|
|
47
|
-
const
|
|
48
|
-
const N =
|
|
49
|
-
locale:
|
|
50
|
-
dataTest: e.dataTest ?? `${
|
|
48
|
+
const M = (e, r, m) => {
|
|
49
|
+
const N = m === "secondary" && T?.busy, y = !!e.disabled || !!N, k = N ? T.busyReason ?? V[a] : e.tooltip, A = y || !!e.loading, F = /* @__PURE__ */ o(I, {
|
|
50
|
+
locale: a,
|
|
51
|
+
dataTest: e.dataTest ?? `${x}-${m}`,
|
|
51
52
|
variant: e.variant ?? r,
|
|
52
53
|
error: e.tone === "danger",
|
|
53
54
|
size: "medium",
|
|
54
55
|
type: e.type ?? "button",
|
|
55
|
-
disabled: y && !!
|
|
56
|
-
"aria-disabled":
|
|
57
|
-
disabledReason:
|
|
56
|
+
disabled: y && !!k,
|
|
57
|
+
"aria-disabled": A || void 0,
|
|
58
|
+
disabledReason: k,
|
|
58
59
|
loading: !!e.loading,
|
|
59
60
|
startIcon: e.icon,
|
|
60
61
|
endIcon: e.endIcon,
|
|
61
|
-
onClick:
|
|
62
|
+
onClick: A ? (H) => H.preventDefault() : e.onClick,
|
|
62
63
|
"aria-label": e.ariaLabel,
|
|
63
64
|
children: e.label
|
|
64
65
|
});
|
|
65
|
-
return /* @__PURE__ */ o(
|
|
66
|
+
return /* @__PURE__ */ o(K, {
|
|
66
67
|
arrow: !0,
|
|
67
68
|
title: e.tooltip,
|
|
68
69
|
open: y || !e.tooltip ? !1 : void 0,
|
|
69
70
|
children: /* @__PURE__ */ o("span", {
|
|
70
71
|
className: "inline-flex",
|
|
71
|
-
children:
|
|
72
|
+
children: F
|
|
72
73
|
})
|
|
73
74
|
});
|
|
74
75
|
};
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
ref:
|
|
77
|
-
"data-testid":
|
|
78
|
-
className:
|
|
76
|
+
return /* @__PURE__ */ c("div", {
|
|
77
|
+
ref: D,
|
|
78
|
+
"data-testid": x,
|
|
79
|
+
className: w("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", "max-xs:flex-wrap max-xs:justify-between max-xs:gap-y-2", t ? "gap-2 p-2" : "gap-4 p-4", W && "rounded-b-lg", L && "sticky bottom-0 z-[1]", S),
|
|
79
80
|
children: [/* @__PURE__ */ o("div", {
|
|
80
|
-
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
81
|
-
children: l ?? /* @__PURE__ */
|
|
82
|
-
ref:
|
|
81
|
+
className: "flex shrink-0 flex-nowrap items-center gap-2 max-xs:min-w-0 max-xs:shrink",
|
|
82
|
+
children: l ?? /* @__PURE__ */ c(R, { children: [d.inlineActions.map(({ action: e, showLabel: r }) => /* @__PURE__ */ o("span", {
|
|
83
|
+
ref: g(E(e.id, r)),
|
|
83
84
|
className: "inline-flex shrink-0",
|
|
84
|
-
children: /* @__PURE__ */ o(
|
|
85
|
+
children: /* @__PURE__ */ o(oe, {
|
|
85
86
|
action: e,
|
|
86
87
|
showLabel: r,
|
|
87
|
-
inProgressLabel:
|
|
88
|
+
inProgressLabel: h.inProgress
|
|
88
89
|
})
|
|
89
|
-
}, e.id)), d.showMoreMenu && /* @__PURE__ */
|
|
90
|
-
ref:
|
|
90
|
+
}, e.id)), d.showMoreMenu && /* @__PURE__ */ c(R, { children: [/* @__PURE__ */ o("span", {
|
|
91
|
+
ref: g(O),
|
|
91
92
|
className: "inline-flex shrink-0",
|
|
92
|
-
children: /* @__PURE__ */ o(
|
|
93
|
-
locale:
|
|
94
|
-
dataTest: `${
|
|
93
|
+
children: /* @__PURE__ */ o(I, {
|
|
94
|
+
locale: a,
|
|
95
|
+
dataTest: `${x}-more`,
|
|
95
96
|
variant: "outlined",
|
|
96
97
|
size: "medium",
|
|
97
98
|
type: "button",
|
|
98
|
-
onClick: (e) =>
|
|
99
|
-
"aria-label":
|
|
99
|
+
onClick: (e) => v(e.currentTarget),
|
|
100
|
+
"aria-label": h.more,
|
|
100
101
|
"aria-haspopup": "menu",
|
|
101
|
-
"aria-expanded":
|
|
102
|
-
startIcon: /* @__PURE__ */ o(
|
|
102
|
+
"aria-expanded": b != null,
|
|
103
|
+
startIcon: /* @__PURE__ */ o(U, {
|
|
103
104
|
width: 24,
|
|
104
105
|
height: 24
|
|
105
106
|
})
|
|
106
107
|
})
|
|
107
|
-
}), /* @__PURE__ */ o(
|
|
108
|
-
anchorEl:
|
|
109
|
-
open:
|
|
110
|
-
onClose: () =>
|
|
108
|
+
}), /* @__PURE__ */ o(Q, {
|
|
109
|
+
anchorEl: b,
|
|
110
|
+
open: b != null,
|
|
111
|
+
onClose: () => v(null),
|
|
111
112
|
anchorOrigin: {
|
|
112
113
|
vertical: "top",
|
|
113
114
|
horizontal: "left"
|
|
@@ -116,10 +117,10 @@ function Te({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAc
|
|
|
116
117
|
vertical: "bottom",
|
|
117
118
|
horizontal: "left"
|
|
118
119
|
},
|
|
119
|
-
children: d.overflowActions.map((e) => /* @__PURE__ */ o(
|
|
120
|
-
...
|
|
120
|
+
children: d.overflowActions.map((e) => /* @__PURE__ */ o(q, {
|
|
121
|
+
...re(e, h.inProgress),
|
|
121
122
|
onClick: () => {
|
|
122
|
-
|
|
123
|
+
v(null), e.onClick();
|
|
123
124
|
},
|
|
124
125
|
children: /* @__PURE__ */ o("span", {
|
|
125
126
|
className: e.tone === "danger" ? "text-beta-500" : "text-delta-700",
|
|
@@ -127,16 +128,16 @@ function Te({ leftActions: n = [], leadingSlot: l, secondaryAction: f, primaryAc
|
|
|
127
128
|
})
|
|
128
129
|
}, e.id))
|
|
129
130
|
})] })] })
|
|
130
|
-
}),
|
|
131
|
-
className: "flex min-w-px flex-1 flex-nowrap items-center justify-end",
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
ref:
|
|
134
|
-
className: "flex shrink-0 flex-nowrap items-center gap-2",
|
|
135
|
-
children: [f &&
|
|
131
|
+
}), B && /* @__PURE__ */ o("span", {
|
|
132
|
+
className: w("flex min-w-px flex-1 flex-nowrap items-center justify-end", "max-xs:min-w-fit max-xs:flex-wrap max-xs:gap-y-2"),
|
|
133
|
+
children: /* @__PURE__ */ c("span", {
|
|
134
|
+
ref: g(_),
|
|
135
|
+
className: w("flex shrink-0 flex-nowrap items-center gap-2", "max-xs:max-w-full max-xs:shrink max-xs:flex-wrap max-xs:justify-end"),
|
|
136
|
+
children: [f && M(f, "outlined", "secondary"), p && M(p, "contained", "primary")]
|
|
136
137
|
})
|
|
137
138
|
})]
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
export {
|
|
141
|
-
|
|
142
|
+
Ce as StyledDialogFooter
|
|
142
143
|
};
|