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,15 +1,15 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
1
|
+
import { cn as s } from "../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as fe } from "../../../helpers/focusable.js";
|
|
3
3
|
import { StyledTooltip as u } from "../../data-display/tooltip/StyledTooltip.js";
|
|
4
4
|
import { DotsVerticalIcon as ue } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
5
5
|
import { CloseIcon as H } from "../../icons/close-icon/CloseIcon.js";
|
|
6
6
|
import { MinimizeIcon as ve } from "../../icons/minimize-icon/MinimizeIcon.js";
|
|
7
|
-
import { KeyboardCapslockIcon as
|
|
7
|
+
import { KeyboardCapslockIcon as xe } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
|
|
8
8
|
import { ArrowExpandIcon as pe } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
|
|
9
|
-
import { ArrowShrinkIcon as
|
|
9
|
+
import { ArrowShrinkIcon as be } from "../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
|
|
10
10
|
import { StyledButton as r } from "../../inputs/button/StyledButton.js";
|
|
11
|
-
import { OverlayBackOwnerContext as
|
|
12
|
-
import { useFocusTrap as
|
|
11
|
+
import { OverlayBackOwnerContext as ge, isOverlayBackNavigationPending as we, useBackCloses as ye } from "../../../hooks/useBackCloses.hook.js";
|
|
12
|
+
import { useFocusTrap as ke } from "../../../hooks/useFocusTrap.hook.js";
|
|
13
13
|
import { StyledMenu as ze } from "../../navigation/menu/StyledMenu.js";
|
|
14
14
|
import { StyledMenuItem as Ne } from "../../navigation/menu/StyledMenuItem.js";
|
|
15
15
|
import { fullScreenFieldWidthVars as Ce } from "../../inputs/field-styles.js";
|
|
@@ -18,19 +18,19 @@ import { useToggleMenuVisibility as Ie } from "../../../hooks/useToggleMenuVisib
|
|
|
18
18
|
import Q from "clsx";
|
|
19
19
|
import { useLayoutEffect as Me, useRef as X, useState as Y } from "react";
|
|
20
20
|
import { Fragment as p, jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
21
|
-
var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", onFullScreenText: R = "", showCloseIcon: j = !0, showMinimizeIcon: Z = !0, showExpandIcon: B = !0, showFullScreenIcon: L = !0, title:
|
|
22
|
-
const [t,
|
|
23
|
-
if (
|
|
21
|
+
var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", onFullScreenText: R = "", showCloseIcon: j = !0, showMinimizeIcon: Z = !0, showExpandIcon: B = !0, showFullScreenIcon: L = !0, title: h, label: b, children: g, open: w, onClose: ee, className: F = "", primaryButtonText: S, primaryButtonLoading: a = !1, primaryButtonDisabled: te, primaryButtonDisabledReason: ie, secondaryButtonText: y, onPrimaryButtonClick: _, onSecondaryButtonClick: q, dataTest: E, actionNode: le, extraActions: n, extraActionsText: f, btnContainerClassName: G, footerClassName: re, footerInfo: O, locale: i = "en", enableFullscreen: ae = !0, fullscreenLockedReason: D, fullScreenState: V, handleFullScreenState: P }) => {
|
|
22
|
+
const [t, ne] = Y(!1), [W, de] = Y(!1), { open: oe, anchorEl: se, handleOpen: ce, handleClose: me } = Ie(), c = X(null), k = X(null), z = i === "en" ? "Wait until saved" : "Vent til lagringen er ferdig", x = () => {
|
|
23
|
+
if (a) return !1;
|
|
24
24
|
ee();
|
|
25
|
-
}, o = V ?? W,
|
|
26
|
-
if (
|
|
27
|
-
active:
|
|
28
|
-
requestClose: () => !
|
|
29
|
-
ownerRef:
|
|
25
|
+
}, o = V ?? W, d = o && !t, N = !!D;
|
|
26
|
+
if (ke(w && d, c, x), ye({
|
|
27
|
+
active: w && !t,
|
|
28
|
+
requestClose: () => !d && we() ? !1 : x(),
|
|
29
|
+
ownerRef: c
|
|
30
30
|
}), Me(() => {
|
|
31
|
-
|
|
32
|
-
}, [t]), !
|
|
33
|
-
const
|
|
31
|
+
c.current?.toggleAttribute("inert", t), k.current?.toggleAttribute("inert", !t);
|
|
32
|
+
}, [t]), !w) return null;
|
|
33
|
+
const he = d ? {
|
|
34
34
|
right: "auto",
|
|
35
35
|
bottom: "auto",
|
|
36
36
|
left: "50%",
|
|
@@ -39,40 +39,40 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
39
39
|
width: "min(1000px, calc(100vw - 32px))",
|
|
40
40
|
height: "95dvh",
|
|
41
41
|
...Ce
|
|
42
|
-
} : void 0, U = o ? i === "en" ? "Exit full screen" : "Avslutt fullskjerm" : i === "en" ? "Full screen" : "Fullskjerm", $ = S ??
|
|
42
|
+
} : void 0, U = o ? i === "en" ? "Exit full screen" : "Avslutt fullskjerm" : i === "en" ? "Full screen" : "Fullskjerm", $ = S ?? a, A = $ || y, K = /* @__PURE__ */ l(p, { children: [y && q && /* @__PURE__ */ e(r, {
|
|
43
43
|
dataTest: "cancel-button",
|
|
44
44
|
variant: "outlined",
|
|
45
|
-
disabled:
|
|
45
|
+
disabled: a,
|
|
46
46
|
disabledReason: z,
|
|
47
47
|
onClick: q,
|
|
48
48
|
children: y
|
|
49
49
|
}), $ && _ && /* @__PURE__ */ e(r, {
|
|
50
50
|
dataTest: "save-button",
|
|
51
|
-
loading:
|
|
51
|
+
loading: a,
|
|
52
52
|
locale: i,
|
|
53
|
-
disabled:
|
|
54
|
-
disabledReason:
|
|
53
|
+
disabled: te,
|
|
54
|
+
disabledReason: ie,
|
|
55
55
|
onClick: _,
|
|
56
56
|
children: S
|
|
57
57
|
})] }), T = () => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const C =
|
|
61
|
-
C && (C.querySelector('[data-testid="minimize-button"]') ??
|
|
58
|
+
const m = t ? c : k;
|
|
59
|
+
ne(!t), requestAnimationFrame(() => {
|
|
60
|
+
const C = m.current;
|
|
61
|
+
C && (C.querySelector('[data-testid="minimize-button"]') ?? fe(C))?.focus({ preventScroll: !0 });
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
64
|
return /* @__PURE__ */ l(p, { children: [
|
|
65
|
-
|
|
65
|
+
d && /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[51] bg-[rgb(98,110,126)] bg-opacity-70" }),
|
|
66
66
|
/* @__PURE__ */ e("div", {
|
|
67
|
-
ref:
|
|
67
|
+
ref: k,
|
|
68
68
|
style: { zIndex: 51 },
|
|
69
|
-
className:
|
|
69
|
+
className: s(J.dialog, !t && J.hidden, t && "max-xs:w-[calc(100vw-32px)]"),
|
|
70
70
|
children: /* @__PURE__ */ l("div", {
|
|
71
71
|
className: Q("flex items-center justify-between", !t && "hidden"),
|
|
72
72
|
"data-testid": E,
|
|
73
73
|
children: [/* @__PURE__ */ e("div", {
|
|
74
74
|
className: "truncate text-lg font-semibold text-delta-800",
|
|
75
|
-
children:
|
|
75
|
+
children: h
|
|
76
76
|
}), /* @__PURE__ */ l("div", {
|
|
77
77
|
className: "flex items-center gap-x-1",
|
|
78
78
|
children: [B && /* @__PURE__ */ e(u, {
|
|
@@ -83,7 +83,7 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
83
83
|
variant: "text",
|
|
84
84
|
size: "small",
|
|
85
85
|
onClick: T,
|
|
86
|
-
endIcon: /* @__PURE__ */ e(
|
|
86
|
+
endIcon: /* @__PURE__ */ e(xe, {
|
|
87
87
|
height: 20,
|
|
88
88
|
width: 20,
|
|
89
89
|
color: "text-gama-500"
|
|
@@ -92,15 +92,15 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
92
92
|
}) })
|
|
93
93
|
}), j && /* @__PURE__ */ e(u, {
|
|
94
94
|
title: i === "en" ? "Close" : "Lukk",
|
|
95
|
-
open:
|
|
95
|
+
open: a ? !1 : void 0,
|
|
96
96
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
97
97
|
dataTest: "close-button",
|
|
98
98
|
"aria-label": v ? void 0 : i === "en" ? "Close" : "Lukk",
|
|
99
99
|
variant: "textGray",
|
|
100
100
|
size: "small",
|
|
101
|
-
disabled:
|
|
101
|
+
disabled: a,
|
|
102
102
|
disabledReason: z,
|
|
103
|
-
onClick:
|
|
103
|
+
onClick: x,
|
|
104
104
|
endIcon: /* @__PURE__ */ e(H, {
|
|
105
105
|
height: 20,
|
|
106
106
|
width: 20,
|
|
@@ -113,25 +113,25 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
113
113
|
})
|
|
114
114
|
}),
|
|
115
115
|
/* @__PURE__ */ e("div", {
|
|
116
|
-
ref:
|
|
117
|
-
style:
|
|
118
|
-
role:
|
|
119
|
-
"aria-modal":
|
|
120
|
-
"aria-label":
|
|
121
|
-
className:
|
|
116
|
+
ref: c,
|
|
117
|
+
style: he,
|
|
118
|
+
role: d ? "dialog" : void 0,
|
|
119
|
+
"aria-modal": d ? !0 : void 0,
|
|
120
|
+
"aria-label": d && typeof h == "string" ? h : void 0,
|
|
121
|
+
className: s("fixed bottom-4 right-4 z-[51] rounded-lg bg-white shadow-[0_4px_40px_0px_rgba(34,33,51,0.4)] transition-all duration-300", "max-xs:max-w-[calc(100vw-32px)]", F && !t && !o ? F : "", t && "!h-0 !w-0 opacity-0 duration-0", d && "fixed duration-0"),
|
|
122
122
|
"data-testid": E,
|
|
123
|
-
children: /* @__PURE__ */ l(
|
|
124
|
-
value:
|
|
123
|
+
children: /* @__PURE__ */ l(ge.Provider, {
|
|
124
|
+
value: c,
|
|
125
125
|
children: [/* @__PURE__ */ l("div", {
|
|
126
126
|
className: "flex flex-col gap-y-2 border-b-[1px] border-delta-200 p-4",
|
|
127
127
|
children: [/* @__PURE__ */ l("div", {
|
|
128
|
-
className: "flex items-center justify-between",
|
|
129
|
-
children: [
|
|
128
|
+
className: "flex items-center justify-between max-xs:flex-wrap max-xs:gap-y-1",
|
|
129
|
+
children: [b ? /* @__PURE__ */ e("div", {
|
|
130
130
|
className: "text-sm text-delta-700",
|
|
131
|
-
children:
|
|
131
|
+
children: b
|
|
132
132
|
}) : /* @__PURE__ */ e("div", {
|
|
133
|
-
className: "text-2xl font-semibold text-delta-800",
|
|
134
|
-
children:
|
|
133
|
+
className: s("text-2xl font-semibold text-delta-800", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
134
|
+
children: h
|
|
135
135
|
}), /* @__PURE__ */ l("div", {
|
|
136
136
|
className: "flex items-center gap-x-1",
|
|
137
137
|
children: [
|
|
@@ -152,7 +152,7 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
152
152
|
children: I
|
|
153
153
|
}) })
|
|
154
154
|
}),
|
|
155
|
-
(
|
|
155
|
+
(ae || N) && L && /* @__PURE__ */ e(u, {
|
|
156
156
|
title: U,
|
|
157
157
|
open: N ? !1 : void 0,
|
|
158
158
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
@@ -163,9 +163,9 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
163
163
|
disabled: N,
|
|
164
164
|
disabledReason: D,
|
|
165
165
|
onClick: () => {
|
|
166
|
-
V !== void 0 && P ? P(!o) :
|
|
166
|
+
V !== void 0 && P ? P(!o) : de(!W);
|
|
167
167
|
},
|
|
168
|
-
endIcon: o ? /* @__PURE__ */ e(
|
|
168
|
+
endIcon: o ? /* @__PURE__ */ e(be, {
|
|
169
169
|
width: 20,
|
|
170
170
|
height: 20,
|
|
171
171
|
color: "text-delta-700"
|
|
@@ -179,15 +179,15 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
179
179
|
}),
|
|
180
180
|
j && /* @__PURE__ */ e(u, {
|
|
181
181
|
title: i === "en" ? "Close" : "Lukk",
|
|
182
|
-
open:
|
|
182
|
+
open: a ? !1 : void 0,
|
|
183
183
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
184
184
|
dataTest: "close-button",
|
|
185
185
|
"aria-label": v ? void 0 : i === "en" ? "Close" : "Lukk",
|
|
186
186
|
variant: "textGray",
|
|
187
187
|
size: "small",
|
|
188
|
-
disabled:
|
|
188
|
+
disabled: a,
|
|
189
189
|
disabledReason: z,
|
|
190
|
-
onClick:
|
|
190
|
+
onClick: x,
|
|
191
191
|
endIcon: /* @__PURE__ */ e(H, {
|
|
192
192
|
height: 20,
|
|
193
193
|
width: 20,
|
|
@@ -198,19 +198,19 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
198
198
|
})
|
|
199
199
|
]
|
|
200
200
|
})]
|
|
201
|
-
}),
|
|
202
|
-
className: "truncate text-2xl font-semibold text-delta-800",
|
|
203
|
-
children:
|
|
201
|
+
}), b && /* @__PURE__ */ e("div", {
|
|
202
|
+
className: s("truncate text-2xl font-semibold text-delta-800", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
203
|
+
children: h
|
|
204
204
|
})]
|
|
205
205
|
}), /* @__PURE__ */ l("div", {
|
|
206
206
|
className: Q("flex flex-col", o && !t && "h-[87dvh]"),
|
|
207
207
|
children: [/* @__PURE__ */ e("div", {
|
|
208
208
|
className: "flex-grow overflow-y-auto overscroll-contain",
|
|
209
|
-
children: typeof
|
|
210
|
-
}), (Array.isArray(
|
|
211
|
-
className:
|
|
209
|
+
children: typeof g == "function" ? g({ fullScreen: o }) : g
|
|
210
|
+
}), (Array.isArray(n) && n.length || typeof n == "function") && f || O ? /* @__PURE__ */ l("div", {
|
|
211
|
+
className: s("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", re),
|
|
212
212
|
children: [
|
|
213
|
-
Array.isArray(
|
|
213
|
+
Array.isArray(n) && n.length && f ? /* @__PURE__ */ l(p, { children: [/* @__PURE__ */ e(r, {
|
|
214
214
|
dataTest: "extra-actions-button",
|
|
215
215
|
variant: "textGray",
|
|
216
216
|
startIcon: /* @__PURE__ */ e(ue, {
|
|
@@ -223,26 +223,26 @@ var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", o
|
|
|
223
223
|
open: oe,
|
|
224
224
|
anchorEl: se,
|
|
225
225
|
onClose: me,
|
|
226
|
-
children:
|
|
227
|
-
className:
|
|
228
|
-
onClick:
|
|
229
|
-
children:
|
|
230
|
-
},
|
|
231
|
-
})] }) : f && typeof
|
|
226
|
+
children: n.map((m) => /* @__PURE__ */ e(Ne, {
|
|
227
|
+
className: m.className,
|
|
228
|
+
onClick: m.onClick,
|
|
229
|
+
children: m.label
|
|
230
|
+
}, m.label))
|
|
231
|
+
})] }) : f && typeof n == "function" && /* @__PURE__ */ e(r, {
|
|
232
232
|
dataTest: "extra-action-button",
|
|
233
233
|
variant: "text",
|
|
234
|
-
onClick:
|
|
234
|
+
onClick: n,
|
|
235
235
|
children: f
|
|
236
236
|
}),
|
|
237
237
|
" ",
|
|
238
238
|
O,
|
|
239
239
|
A ? /* @__PURE__ */ e("div", {
|
|
240
|
-
className:
|
|
240
|
+
className: s("flex justify-end gap-x-2", G),
|
|
241
241
|
children: K
|
|
242
242
|
}) : null
|
|
243
243
|
]
|
|
244
244
|
}) : /* @__PURE__ */ e(p, { children: A ? /* @__PURE__ */ e("div", {
|
|
245
|
-
className:
|
|
245
|
+
className: s("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", G),
|
|
246
246
|
children: K
|
|
247
247
|
}) : null })]
|
|
248
248
|
})]
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as l } from "../../../../helpers/cn.js";
|
|
2
2
|
import { firstTabbable as A } from "../../../../helpers/focusable.js";
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { DialogBusyContext as L, useDialogBusyBoundary as
|
|
3
|
+
import { StyledTooltip as ne } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { DialogBusyContext as L, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
|
|
5
5
|
import { useMobileMediaQuery as oe } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
-
import { OverlayBackOwnerContext as re, isOverlayBackNavigationPending as
|
|
7
|
-
import { useFocusTrap as
|
|
8
|
-
import { fullScreenFieldWidthVars as
|
|
6
|
+
import { OverlayBackOwnerContext as re, isOverlayBackNavigationPending as ae, useBackCloses as se } from "../../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useFocusTrap as ce } from "../../../../hooks/useFocusTrap.hook.js";
|
|
8
|
+
import { fullScreenFieldWidthVars as me } from "../../../inputs/field-styles.js";
|
|
9
9
|
import { CloseBtn as V } from "../components/CloseBtn.js";
|
|
10
10
|
import { MinimizeBtn as $ } from "../components/MinimizeBtn.js";
|
|
11
|
-
import { FullScreenBtn as
|
|
12
|
-
import
|
|
11
|
+
import { FullScreenBtn as de } from "../components/FullscreenBtn.js";
|
|
12
|
+
import v from "./MinimizableDialogV2.module.js";
|
|
13
13
|
import { useTranslations as ue } from "./useTranslations.js";
|
|
14
|
-
import { useControlledProps as
|
|
15
|
-
import
|
|
16
|
-
import { useId as W, useLayoutEffect as H, useRef as
|
|
17
|
-
import { Fragment as
|
|
18
|
-
var
|
|
19
|
-
const { showCloseIcon: R = !0, showMinimizeIcon: _ = !0, showExpandIcon: Q = !0, enableFullscreen: U = !0, fullscreenLockedReason: N, title: u, label:
|
|
14
|
+
import { useControlledProps as xe } from "./useControlledProps.js";
|
|
15
|
+
import fe from "clsx";
|
|
16
|
+
import { useId as W, useLayoutEffect as H, useRef as m } from "react";
|
|
17
|
+
import { Fragment as pe, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
18
|
+
var Pe = (C) => {
|
|
19
|
+
const { showCloseIcon: R = !0, showMinimizeIcon: _ = !0, showExpandIcon: Q = !0, enableFullscreen: U = !0, fullscreenLockedReason: N, title: u, label: x, children: G, open: n, onClose: J, classNameOverrides: y = {
|
|
20
20
|
maximized: "",
|
|
21
21
|
minimized: "",
|
|
22
22
|
fullscreen: ""
|
|
23
|
-
}, dataTest: K, actionNode: X, locale: Y = "en", busyReason: Z, style: B, initialFocusRef: F } =
|
|
24
|
-
if (
|
|
23
|
+
}, dataTest: K, actionNode: X, locale: Y = "en", busyReason: Z, style: B, initialFocusRef: F } = C, a = oe(), i = ue(Y), o = m(null), f = m(null), S = m(null), k = m(null), b = m(!1), w = m(null), p = W(), T = W(), { minimized: t, setMinimized: I, fullScreen: s, setFullScreen: M } = xe(C), c = s && !t, j = !!N, { busy: g, busyReason: E, contextValue: P } = ie(Z ?? i.waitUntilSaved), h = () => {
|
|
24
|
+
if (g) return !1;
|
|
25
25
|
I(!1), J();
|
|
26
26
|
};
|
|
27
27
|
H(() => {
|
|
28
|
-
|
|
28
|
+
o.current?.toggleAttribute("inert", t), f.current?.toggleAttribute("inert", !t);
|
|
29
29
|
}, [t]), H(() => {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const D =
|
|
33
|
-
|
|
30
|
+
const z = n && !b.current, d = !n && b.current;
|
|
31
|
+
if (b.current = n, d) {
|
|
32
|
+
const D = w.current;
|
|
33
|
+
w.current = null, (!document.activeElement || document.activeElement === document.body) && D?.isConnected && D.focus({ preventScroll: !0 });
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
const q = t ?
|
|
39
|
-
(F?.current ??
|
|
36
|
+
if (!z) return;
|
|
37
|
+
w.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
38
|
+
const q = t ? f.current : o.current, le = t ? k.current : S.current;
|
|
39
|
+
(F?.current ?? le ?? (q ? A(q) : void 0))?.focus({ preventScroll: !0 });
|
|
40
40
|
}, [
|
|
41
41
|
F,
|
|
42
42
|
t,
|
|
43
|
-
|
|
43
|
+
n
|
|
44
44
|
]);
|
|
45
45
|
const O = () => {
|
|
46
|
-
const
|
|
46
|
+
const z = t ? o : f;
|
|
47
47
|
I(!t), requestAnimationFrame(() => {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const d = z.current;
|
|
49
|
+
d && (d.querySelector('[data-testid="toggle-minimize-btn"]') ?? A(d))?.focus({ preventScroll: !0 });
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
active:
|
|
54
|
-
requestClose: () => !c &&
|
|
55
|
-
ownerRef:
|
|
52
|
+
ce(n && c, o, h), se({
|
|
53
|
+
active: n && !t,
|
|
54
|
+
requestClose: () => !c && ae() ? !1 : h(),
|
|
55
|
+
ownerRef: o
|
|
56
56
|
});
|
|
57
|
-
const ee = c ?
|
|
57
|
+
const ee = c ? a ? {
|
|
58
58
|
inset: 0,
|
|
59
59
|
maxHeight: "100dvh",
|
|
60
60
|
maxWidth: "100dvw",
|
|
@@ -70,44 +70,44 @@ var je = (w) => {
|
|
|
70
70
|
width: "min(1000px, calc(100vw - 32px))",
|
|
71
71
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
72
72
|
height: "95dvh",
|
|
73
|
-
...
|
|
73
|
+
...me
|
|
74
74
|
} : void 0;
|
|
75
|
-
if (!
|
|
76
|
-
const te =
|
|
77
|
-
return /* @__PURE__ */
|
|
75
|
+
if (!n) return null;
|
|
76
|
+
const te = x ? `${T} ${p}` : p;
|
|
77
|
+
return /* @__PURE__ */ r(pe, { children: [
|
|
78
78
|
/* @__PURE__ */ e("div", {
|
|
79
|
-
ref:
|
|
79
|
+
ref: f,
|
|
80
80
|
style: {
|
|
81
81
|
zIndex: 51,
|
|
82
82
|
...B
|
|
83
83
|
},
|
|
84
|
-
className:
|
|
85
|
-
children: /* @__PURE__ */
|
|
86
|
-
className:
|
|
84
|
+
className: l(v["minimized-dialog"], !t && v.hidden, y.minimized),
|
|
85
|
+
children: /* @__PURE__ */ r("div", {
|
|
86
|
+
className: fe("flex items-center justify-between", !t && "hidden"),
|
|
87
87
|
"data-testid": K,
|
|
88
88
|
children: [/* @__PURE__ */ e("div", {
|
|
89
|
-
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
90
|
-
children: /* @__PURE__ */ e(
|
|
89
|
+
className: l("max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
90
|
+
children: /* @__PURE__ */ e(ne, {
|
|
91
91
|
title: u,
|
|
92
92
|
placement: "top",
|
|
93
93
|
children: /* @__PURE__ */ e("div", {
|
|
94
|
-
className: "truncate",
|
|
94
|
+
className: l("truncate", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
95
95
|
children: u
|
|
96
96
|
})
|
|
97
97
|
})
|
|
98
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ r("div", {
|
|
99
99
|
className: "flex items-center gap-x-1",
|
|
100
100
|
children: [/* @__PURE__ */ e($, {
|
|
101
101
|
type: "expand",
|
|
102
102
|
visibility: Q,
|
|
103
103
|
onClick: O,
|
|
104
|
-
tooltipTitle:
|
|
104
|
+
tooltipTitle: i.expand
|
|
105
105
|
}), /* @__PURE__ */ e(V, {
|
|
106
106
|
buttonRef: k,
|
|
107
107
|
showCloseIcon: R,
|
|
108
|
-
onClick:
|
|
109
|
-
disabledReason:
|
|
110
|
-
tooltipTitle:
|
|
108
|
+
onClick: h,
|
|
109
|
+
disabledReason: g ? E : void 0,
|
|
110
|
+
tooltipTitle: i.close
|
|
111
111
|
})]
|
|
112
112
|
})]
|
|
113
113
|
})
|
|
@@ -115,7 +115,7 @@ var je = (w) => {
|
|
|
115
115
|
c && /* @__PURE__ */ e("div", {
|
|
116
116
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
117
117
|
onClick: () => {
|
|
118
|
-
|
|
118
|
+
j || M(!1);
|
|
119
119
|
}
|
|
120
120
|
}),
|
|
121
121
|
/* @__PURE__ */ e("div", {
|
|
@@ -124,65 +124,65 @@ var je = (w) => {
|
|
|
124
124
|
...B,
|
|
125
125
|
...ee
|
|
126
126
|
},
|
|
127
|
-
ref:
|
|
127
|
+
ref: o,
|
|
128
128
|
role: "dialog",
|
|
129
129
|
"aria-modal": c ? !0 : void 0,
|
|
130
130
|
"aria-labelledby": te,
|
|
131
|
-
className:
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
value:
|
|
134
|
-
children: [/* @__PURE__ */
|
|
135
|
-
className:
|
|
136
|
-
children: [/* @__PURE__ */
|
|
137
|
-
className: "flex items-center justify-between",
|
|
138
|
-
children: [
|
|
131
|
+
className: l(v.dialog, t && v.hidden, !s && y.maximized, s && y.fullscreen, c && "fixed z-[53] duration-0"),
|
|
132
|
+
children: /* @__PURE__ */ r(re.Provider, {
|
|
133
|
+
value: o,
|
|
134
|
+
children: [/* @__PURE__ */ r("div", {
|
|
135
|
+
className: l("flex flex-col border-b-[1px] border-delta-200 px-4", a ? "py-3" : "py-4"),
|
|
136
|
+
children: [/* @__PURE__ */ r("div", {
|
|
137
|
+
className: l("flex items-center justify-between", "max-xs:flex-col-reverse max-xs:items-stretch max-xs:gap-2"),
|
|
138
|
+
children: [x ? /* @__PURE__ */ e("div", {
|
|
139
139
|
id: T,
|
|
140
|
-
className: "text-sm text-delta-700",
|
|
141
|
-
children:
|
|
140
|
+
className: "text-sm text-delta-700 max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]",
|
|
141
|
+
children: x
|
|
142
142
|
}) : /* @__PURE__ */ e("div", {
|
|
143
|
-
id:
|
|
144
|
-
className:
|
|
143
|
+
id: p,
|
|
144
|
+
className: l("font-semibold text-delta-800", a ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl", "max-xs:line-clamp-none", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
145
145
|
children: u
|
|
146
|
-
}), /* @__PURE__ */
|
|
147
|
-
className: "flex items-center gap-x-1",
|
|
146
|
+
}), /* @__PURE__ */ r("div", {
|
|
147
|
+
className: "flex items-center gap-x-1 max-xs:flex-wrap max-xs:justify-end max-xs:gap-y-2",
|
|
148
148
|
children: [
|
|
149
149
|
/* @__PURE__ */ e(L.Provider, {
|
|
150
|
-
value:
|
|
150
|
+
value: P,
|
|
151
151
|
children: X
|
|
152
152
|
}),
|
|
153
153
|
/* @__PURE__ */ e($, {
|
|
154
|
-
visibility: _ && !
|
|
154
|
+
visibility: _ && !a,
|
|
155
155
|
type: "minimize",
|
|
156
156
|
onClick: O,
|
|
157
|
-
tooltipTitle:
|
|
157
|
+
tooltipTitle: i.minimize
|
|
158
158
|
}),
|
|
159
|
-
/* @__PURE__ */ e(
|
|
160
|
-
showFullScreenIcon: (U ||
|
|
159
|
+
/* @__PURE__ */ e(de, {
|
|
160
|
+
showFullScreenIcon: (U || j) && !a,
|
|
161
161
|
disabledReason: N,
|
|
162
162
|
fullScreen: s,
|
|
163
163
|
onClick: () => {
|
|
164
164
|
M(!s);
|
|
165
165
|
},
|
|
166
|
-
tooltipTitle: s ?
|
|
166
|
+
tooltipTitle: s ? i.exitFullscreen : i.fullscreen
|
|
167
167
|
}),
|
|
168
168
|
/* @__PURE__ */ e(V, {
|
|
169
169
|
buttonRef: S,
|
|
170
170
|
showCloseIcon: R,
|
|
171
|
-
onClick:
|
|
172
|
-
disabledReason:
|
|
173
|
-
tooltipTitle:
|
|
171
|
+
onClick: h,
|
|
172
|
+
disabledReason: g ? E : void 0,
|
|
173
|
+
tooltipTitle: i.close
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
176
|
})]
|
|
177
|
-
}),
|
|
178
|
-
id:
|
|
179
|
-
className:
|
|
177
|
+
}), x && /* @__PURE__ */ e("div", {
|
|
178
|
+
id: p,
|
|
179
|
+
className: l("font-semibold text-delta-800", a ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl", "max-xs:line-clamp-none", "max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]"),
|
|
180
180
|
children: u
|
|
181
181
|
})]
|
|
182
182
|
}), /* @__PURE__ */ e("div", {
|
|
183
|
-
className:
|
|
183
|
+
className: l(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
184
184
|
children: /* @__PURE__ */ e(L.Provider, {
|
|
185
|
-
value:
|
|
185
|
+
value: P,
|
|
186
186
|
children: G
|
|
187
187
|
})
|
|
188
188
|
})]
|
|
@@ -191,5 +191,5 @@ var je = (w) => {
|
|
|
191
191
|
] });
|
|
192
192
|
};
|
|
193
193
|
export {
|
|
194
|
-
|
|
194
|
+
Pe as MinimizableDialogV2
|
|
195
195
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cn as i } from "../../../helpers/cn.js";
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { CheckOutlineIcon as
|
|
5
|
-
import { ErrorOutlineIcon as
|
|
6
|
-
import { InfoOutlineIcon as
|
|
2
|
+
import { resolveSx as f } from "../../../helpers/sx.js";
|
|
3
|
+
import { CloseIcon as h } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { CheckOutlineIcon as g } from "./components/CheckOutlineIcon.js";
|
|
5
|
+
import { ErrorOutlineIcon as m } from "./components/ErrorOutlineIcon.js";
|
|
6
|
+
import { InfoOutlineIcon as u } from "./components/InfoOutlineIcon.js";
|
|
7
7
|
import { WarningAmberOutlineIcon as w } from "./components/WarningAmberOutlineIcon.js";
|
|
8
8
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
9
9
|
var I = {
|
|
@@ -49,11 +49,11 @@ var I = {
|
|
|
49
49
|
filled: "px-4 py-2",
|
|
50
50
|
outlined: "px-4 py-2"
|
|
51
51
|
}, N = {
|
|
52
|
-
success: /* @__PURE__ */ r(
|
|
52
|
+
success: /* @__PURE__ */ r(g, {
|
|
53
53
|
width: 20,
|
|
54
54
|
height: 20
|
|
55
55
|
}),
|
|
56
|
-
info: /* @__PURE__ */ r(
|
|
56
|
+
info: /* @__PURE__ */ r(u, {
|
|
57
57
|
width: 20,
|
|
58
58
|
height: 20
|
|
59
59
|
}),
|
|
@@ -61,31 +61,31 @@ var I = {
|
|
|
61
61
|
width: 20,
|
|
62
62
|
height: 20
|
|
63
63
|
}),
|
|
64
|
-
error: /* @__PURE__ */ r(
|
|
64
|
+
error: /* @__PURE__ */ r(m, {
|
|
65
65
|
width: 20,
|
|
66
66
|
height: 20
|
|
67
67
|
})
|
|
68
|
-
}, D = ({ severity: e = "success", variant: t = "standard", icon: n, iconMapping:
|
|
69
|
-
const s = n === !1 ? null : n ??
|
|
68
|
+
}, D = ({ severity: e = "success", variant: t = "standard", icon: n, iconMapping: a, action: c, onClose: o, children: d, className: l, sx: x, role: b = "alert" }) => {
|
|
69
|
+
const s = n === !1 ? null : n ?? a?.[e] ?? N[e];
|
|
70
70
|
return /* @__PURE__ */ p("div", {
|
|
71
|
-
role:
|
|
71
|
+
role: b,
|
|
72
72
|
className: i("flex items-center gap-2 rounded text-sm", C[t], I[t][e], l),
|
|
73
|
-
style:
|
|
73
|
+
style: f(x),
|
|
74
74
|
children: [
|
|
75
75
|
s && /* @__PURE__ */ r("span", {
|
|
76
76
|
className: i("flex shrink-0 items-center", A[t][e]),
|
|
77
77
|
children: s
|
|
78
78
|
}),
|
|
79
79
|
/* @__PURE__ */ r("span", {
|
|
80
|
-
className: "min-w-0 flex-1",
|
|
81
|
-
children:
|
|
80
|
+
className: "min-w-0 flex-1 max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]",
|
|
81
|
+
children: d
|
|
82
82
|
}),
|
|
83
|
-
|
|
83
|
+
c ?? (o && /* @__PURE__ */ r("button", {
|
|
84
84
|
type: "button",
|
|
85
85
|
"aria-label": "Close",
|
|
86
86
|
onClick: o,
|
|
87
87
|
className: "flex h-8 min-w-8 shrink-0 items-center justify-center rounded border-0 bg-transparent px-1.5 hover:bg-black/10",
|
|
88
|
-
children: /* @__PURE__ */ r(
|
|
88
|
+
children: /* @__PURE__ */ r(h, {
|
|
89
89
|
width: 20,
|
|
90
90
|
height: 20
|
|
91
91
|
})
|