asma-ui-core 3.117.0 → 3.118.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/components/feedback/minimizable-dialog/MinimizableDialog.js +96 -93
- package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +15 -12
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +80 -79
- package/dist/components/feedback/minimizable-dialog/v2/useControlledProps.js +6 -6
- package/dist/src/components/feedback/minimizable-dialog/components/FullscreenBtn.d.ts +8 -1
- package/dist/src/components/feedback/minimizable-dialog/types.d.ts +19 -1
- package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +19 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { cn as h } from "../../../helpers/cn.js";
|
|
2
|
-
import { firstTabbable as
|
|
2
|
+
import { firstTabbable as he } from "../../../helpers/focusable.js";
|
|
3
3
|
import { StyledTooltip as u } from "../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
-
import { DotsVerticalIcon as
|
|
5
|
-
import { CloseIcon as
|
|
6
|
-
import { MinimizeIcon as
|
|
7
|
-
import { KeyboardCapslockIcon as
|
|
8
|
-
import { ArrowExpandIcon as
|
|
9
|
-
import { ArrowShrinkIcon as
|
|
4
|
+
import { DotsVerticalIcon as ue } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
5
|
+
import { CloseIcon as H } from "../../icons/close-icon/CloseIcon.js";
|
|
6
|
+
import { MinimizeIcon as ve } from "../../icons/minimize-icon/MinimizeIcon.js";
|
|
7
|
+
import { KeyboardCapslockIcon as be } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
|
|
8
|
+
import { ArrowExpandIcon as pe } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
|
|
9
|
+
import { ArrowShrinkIcon as ge } 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
|
|
13
|
-
import { StyledMenu as
|
|
14
|
-
import { StyledMenuItem as
|
|
15
|
-
import { fullScreenFieldWidthVars as
|
|
16
|
-
import
|
|
17
|
-
import { useToggleMenuVisibility as
|
|
18
|
-
import
|
|
19
|
-
import { useLayoutEffect as
|
|
11
|
+
import { OverlayBackOwnerContext as xe, isOverlayBackNavigationPending as ke, useBackCloses as ye } from "../../../hooks/useBackCloses.hook.js";
|
|
12
|
+
import { useFocusTrap as we } from "../../../hooks/useFocusTrap.hook.js";
|
|
13
|
+
import { StyledMenu as ze } from "../../navigation/menu/StyledMenu.js";
|
|
14
|
+
import { StyledMenuItem as Ne } from "../../navigation/menu/StyledMenuItem.js";
|
|
15
|
+
import { fullScreenFieldWidthVars as Ce } from "../../inputs/field-styles.js";
|
|
16
|
+
import J from "./MinimizableDialog.module.js";
|
|
17
|
+
import { useToggleMenuVisibility as Ie } from "../../../hooks/useToggleMenuVisibility.hook.js";
|
|
18
|
+
import Q from "clsx";
|
|
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
|
|
22
|
-
const [
|
|
21
|
+
var Ye = ({ onCloseText: v = "", onMinimizeText: I = "", onExpandText: M = "", onFullScreenText: R = "", showCloseIcon: j = !0, showMinimizeIcon: Z = !0, showExpandIcon: B = !0, showFullScreenIcon: L = !0, title: m, label: g, children: x, open: k, onClose: ee, className: F = "", primaryButtonText: S, primaryButtonLoading: n = !1, primaryButtonDisabled: ie, primaryButtonDisabledReason: te, secondaryButtonText: y, onPrimaryButtonClick: _, onSecondaryButtonClick: q, dataTest: E, actionNode: le, extraActions: d, extraActionsText: f, btnContainerClassName: G, footerClassName: re, footerInfo: O, locale: i = "en", enableFullscreen: ne = !0, fullscreenLockedReason: D, fullScreenState: V, handleFullScreenState: P }) => {
|
|
22
|
+
const [t, de] = Y(!1), [W, ae] = Y(!1), { open: oe, anchorEl: se, handleOpen: ce, handleClose: me } = Ie(), s = X(null), w = X(null), z = i === "en" ? "Wait until saved" : "Vent til lagringen er ferdig", b = () => {
|
|
23
23
|
if (n) return !1;
|
|
24
|
-
|
|
25
|
-
}, o =
|
|
26
|
-
if (
|
|
27
|
-
active: k && !
|
|
28
|
-
requestClose: () => !a &&
|
|
24
|
+
ee();
|
|
25
|
+
}, o = V ?? W, a = o && !t, N = !!D;
|
|
26
|
+
if (we(k && a, s, b), ye({
|
|
27
|
+
active: k && !t,
|
|
28
|
+
requestClose: () => !a && ke() ? !1 : b(),
|
|
29
29
|
ownerRef: s
|
|
30
|
-
}),
|
|
31
|
-
s.current?.toggleAttribute("inert",
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
30
|
+
}), Me(() => {
|
|
31
|
+
s.current?.toggleAttribute("inert", t), w.current?.toggleAttribute("inert", !t);
|
|
32
|
+
}, [t]), !k) return null;
|
|
33
|
+
const fe = a ? {
|
|
34
34
|
right: "auto",
|
|
35
35
|
bottom: "auto",
|
|
36
36
|
left: "50%",
|
|
@@ -38,27 +38,27 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
38
38
|
transform: "translate(-50%, -50%)",
|
|
39
39
|
width: "min(1000px, calc(100vw - 32px))",
|
|
40
40
|
height: "95dvh",
|
|
41
|
-
...
|
|
42
|
-
} : void 0,
|
|
41
|
+
...Ce
|
|
42
|
+
} : void 0, U = o ? i === "en" ? "Exit full screen" : "Avslutt fullskjerm" : i === "en" ? "Full screen" : "Fullskjerm", $ = S ?? n, A = $ || y, K = /* @__PURE__ */ l(p, { children: [y && q && /* @__PURE__ */ e(r, {
|
|
43
43
|
dataTest: "cancel-button",
|
|
44
44
|
variant: "outlined",
|
|
45
45
|
disabled: n,
|
|
46
46
|
disabledReason: z,
|
|
47
|
-
onClick:
|
|
47
|
+
onClick: q,
|
|
48
48
|
children: y
|
|
49
|
-
}),
|
|
49
|
+
}), $ && _ && /* @__PURE__ */ e(r, {
|
|
50
50
|
dataTest: "save-button",
|
|
51
51
|
loading: n,
|
|
52
|
-
locale:
|
|
53
|
-
disabled:
|
|
54
|
-
disabledReason:
|
|
55
|
-
onClick:
|
|
52
|
+
locale: i,
|
|
53
|
+
disabled: ie,
|
|
54
|
+
disabledReason: te,
|
|
55
|
+
onClick: _,
|
|
56
56
|
children: S
|
|
57
|
-
})] }),
|
|
58
|
-
const c =
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
57
|
+
})] }), T = () => {
|
|
58
|
+
const c = t ? s : w;
|
|
59
|
+
de(!t), requestAnimationFrame(() => {
|
|
60
|
+
const C = c.current;
|
|
61
|
+
C && (C.querySelector('[data-testid="minimize-button"]') ?? he(C))?.focus({ preventScroll: !0 });
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
64
|
return /* @__PURE__ */ l(p, { children: [
|
|
@@ -66,42 +66,42 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
66
66
|
/* @__PURE__ */ e("div", {
|
|
67
67
|
ref: w,
|
|
68
68
|
style: { zIndex: 51 },
|
|
69
|
-
className: h(
|
|
69
|
+
className: h(J.dialog, !t && J.hidden),
|
|
70
70
|
children: /* @__PURE__ */ l("div", {
|
|
71
|
-
className:
|
|
72
|
-
"data-testid":
|
|
71
|
+
className: Q("flex items-center justify-between", !t && "hidden"),
|
|
72
|
+
"data-testid": E,
|
|
73
73
|
children: [/* @__PURE__ */ e("div", {
|
|
74
74
|
className: "truncate text-lg font-semibold text-delta-800",
|
|
75
75
|
children: m
|
|
76
76
|
}), /* @__PURE__ */ l("div", {
|
|
77
77
|
className: "flex items-center gap-x-1",
|
|
78
|
-
children: [
|
|
79
|
-
title:
|
|
78
|
+
children: [B && /* @__PURE__ */ e(u, {
|
|
79
|
+
title: i === "en" ? "Expand" : "Utvid",
|
|
80
80
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
81
81
|
dataTest: "minimize-button",
|
|
82
|
-
"aria-label":
|
|
82
|
+
"aria-label": M ? void 0 : i === "en" ? "Expand" : "Utvid",
|
|
83
83
|
variant: "text",
|
|
84
84
|
size: "small",
|
|
85
|
-
onClick:
|
|
86
|
-
endIcon: /* @__PURE__ */ e(
|
|
85
|
+
onClick: T,
|
|
86
|
+
endIcon: /* @__PURE__ */ e(be, {
|
|
87
87
|
height: 20,
|
|
88
88
|
width: 20,
|
|
89
89
|
color: "text-gama-500"
|
|
90
90
|
}),
|
|
91
|
-
children:
|
|
91
|
+
children: M
|
|
92
92
|
}) })
|
|
93
|
-
}),
|
|
94
|
-
title:
|
|
93
|
+
}), j && /* @__PURE__ */ e(u, {
|
|
94
|
+
title: i === "en" ? "Close" : "Lukk",
|
|
95
95
|
open: n ? !1 : void 0,
|
|
96
96
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
97
97
|
dataTest: "close-button",
|
|
98
|
-
"aria-label": v ? void 0 :
|
|
98
|
+
"aria-label": v ? void 0 : i === "en" ? "Close" : "Lukk",
|
|
99
99
|
variant: "textGray",
|
|
100
100
|
size: "small",
|
|
101
101
|
disabled: n,
|
|
102
102
|
disabledReason: z,
|
|
103
103
|
onClick: b,
|
|
104
|
-
endIcon: /* @__PURE__ */ e(
|
|
104
|
+
endIcon: /* @__PURE__ */ e(H, {
|
|
105
105
|
height: 20,
|
|
106
106
|
width: 20,
|
|
107
107
|
color: "text-delta-700"
|
|
@@ -114,13 +114,13 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
114
114
|
}),
|
|
115
115
|
/* @__PURE__ */ e("div", {
|
|
116
116
|
ref: s,
|
|
117
|
-
style:
|
|
117
|
+
style: fe,
|
|
118
118
|
role: a ? "dialog" : void 0,
|
|
119
119
|
"aria-modal": a ? !0 : void 0,
|
|
120
120
|
"aria-label": a && typeof m == "string" ? m : void 0,
|
|
121
|
-
className: h("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",
|
|
122
|
-
"data-testid":
|
|
123
|
-
children: /* @__PURE__ */ l(
|
|
121
|
+
className: h("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", F && !t && !o ? F : "", t && "!h-0 !w-0 opacity-0 duration-0", a && "fixed duration-0"),
|
|
122
|
+
"data-testid": E,
|
|
123
|
+
children: /* @__PURE__ */ l(xe.Provider, {
|
|
124
124
|
value: s,
|
|
125
125
|
children: [/* @__PURE__ */ l("div", {
|
|
126
126
|
className: "flex flex-col gap-y-2 border-b-[1px] border-delta-200 p-4",
|
|
@@ -135,57 +135,60 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
135
135
|
}), /* @__PURE__ */ l("div", {
|
|
136
136
|
className: "flex items-center gap-x-1",
|
|
137
137
|
children: [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
title:
|
|
138
|
+
le,
|
|
139
|
+
Z && /* @__PURE__ */ e(u, {
|
|
140
|
+
title: i === "en" ? "Minimize" : "Minimer",
|
|
141
141
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
142
142
|
dataTest: "minimize-button",
|
|
143
|
-
"aria-label":
|
|
143
|
+
"aria-label": I ? void 0 : i === "en" ? "Minimize" : "Minimer",
|
|
144
144
|
variant: "textGray",
|
|
145
145
|
size: "small",
|
|
146
|
-
onClick:
|
|
147
|
-
endIcon: /* @__PURE__ */ e(
|
|
146
|
+
onClick: T,
|
|
147
|
+
endIcon: /* @__PURE__ */ e(ve, {
|
|
148
148
|
height: 20,
|
|
149
149
|
width: 20,
|
|
150
150
|
color: "text-delta-700"
|
|
151
151
|
}),
|
|
152
|
-
children:
|
|
152
|
+
children: I
|
|
153
153
|
}) })
|
|
154
154
|
}),
|
|
155
|
-
|
|
156
|
-
title:
|
|
155
|
+
(ne || N) && L && /* @__PURE__ */ e(u, {
|
|
156
|
+
title: U,
|
|
157
|
+
open: N ? !1 : void 0,
|
|
157
158
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
158
159
|
dataTest: "fullscreen-button",
|
|
159
|
-
"aria-label":
|
|
160
|
+
"aria-label": R ? void 0 : U,
|
|
160
161
|
variant: "textGray",
|
|
161
162
|
size: "small",
|
|
163
|
+
disabled: N,
|
|
164
|
+
disabledReason: D,
|
|
162
165
|
onClick: () => {
|
|
163
|
-
|
|
166
|
+
V !== void 0 && P ? P(!o) : ae(!W);
|
|
164
167
|
},
|
|
165
|
-
endIcon: o ? /* @__PURE__ */ e(
|
|
168
|
+
endIcon: o ? /* @__PURE__ */ e(ge, {
|
|
166
169
|
width: 20,
|
|
167
170
|
height: 20,
|
|
168
171
|
color: "text-delta-700"
|
|
169
|
-
}) : /* @__PURE__ */ e(
|
|
172
|
+
}) : /* @__PURE__ */ e(pe, {
|
|
170
173
|
width: 20,
|
|
171
174
|
height: 20,
|
|
172
175
|
color: "text-delta-700"
|
|
173
176
|
}),
|
|
174
|
-
children:
|
|
177
|
+
children: R
|
|
175
178
|
}) })
|
|
176
179
|
}),
|
|
177
|
-
|
|
178
|
-
title:
|
|
180
|
+
j && /* @__PURE__ */ e(u, {
|
|
181
|
+
title: i === "en" ? "Close" : "Lukk",
|
|
179
182
|
open: n ? !1 : void 0,
|
|
180
183
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(r, {
|
|
181
184
|
dataTest: "close-button",
|
|
182
|
-
"aria-label": v ? void 0 :
|
|
185
|
+
"aria-label": v ? void 0 : i === "en" ? "Close" : "Lukk",
|
|
183
186
|
variant: "textGray",
|
|
184
187
|
size: "small",
|
|
185
188
|
disabled: n,
|
|
186
189
|
disabledReason: z,
|
|
187
190
|
onClick: b,
|
|
188
|
-
endIcon: /* @__PURE__ */ e(
|
|
191
|
+
endIcon: /* @__PURE__ */ e(H, {
|
|
189
192
|
height: 20,
|
|
190
193
|
width: 20,
|
|
191
194
|
color: "text-delta-700"
|
|
@@ -200,27 +203,27 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
200
203
|
children: m
|
|
201
204
|
})]
|
|
202
205
|
}), /* @__PURE__ */ l("div", {
|
|
203
|
-
className:
|
|
206
|
+
className: Q("flex flex-col", o && !t && "h-[87dvh]"),
|
|
204
207
|
children: [/* @__PURE__ */ e("div", {
|
|
205
208
|
className: "flex-grow overflow-y-auto overscroll-contain",
|
|
206
209
|
children: typeof x == "function" ? x({ fullScreen: o }) : x
|
|
207
|
-
}), (Array.isArray(d) && d.length || typeof d == "function") && f ||
|
|
208
|
-
className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4",
|
|
210
|
+
}), (Array.isArray(d) && d.length || typeof d == "function") && f || O ? /* @__PURE__ */ l("div", {
|
|
211
|
+
className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", re),
|
|
209
212
|
children: [
|
|
210
213
|
Array.isArray(d) && d.length && f ? /* @__PURE__ */ l(p, { children: [/* @__PURE__ */ e(r, {
|
|
211
214
|
dataTest: "extra-actions-button",
|
|
212
215
|
variant: "textGray",
|
|
213
|
-
startIcon: /* @__PURE__ */ e(
|
|
216
|
+
startIcon: /* @__PURE__ */ e(ue, {
|
|
214
217
|
width: 24,
|
|
215
218
|
height: 24
|
|
216
219
|
}),
|
|
217
|
-
onClick:
|
|
220
|
+
onClick: ce,
|
|
218
221
|
children: f
|
|
219
|
-
}), /* @__PURE__ */ e(
|
|
220
|
-
open:
|
|
221
|
-
anchorEl:
|
|
222
|
-
onClose:
|
|
223
|
-
children: d.map((c) => /* @__PURE__ */ e(
|
|
222
|
+
}), /* @__PURE__ */ e(ze, {
|
|
223
|
+
open: oe,
|
|
224
|
+
anchorEl: se,
|
|
225
|
+
onClose: me,
|
|
226
|
+
children: d.map((c) => /* @__PURE__ */ e(Ne, {
|
|
224
227
|
className: c.className,
|
|
225
228
|
onClick: c.onClick,
|
|
226
229
|
children: c.label
|
|
@@ -232,15 +235,15 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
232
235
|
children: f
|
|
233
236
|
}),
|
|
234
237
|
" ",
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
className: h("flex justify-end gap-x-2",
|
|
238
|
-
children:
|
|
238
|
+
O,
|
|
239
|
+
A ? /* @__PURE__ */ e("div", {
|
|
240
|
+
className: h("flex justify-end gap-x-2", G),
|
|
241
|
+
children: K
|
|
239
242
|
}) : null
|
|
240
243
|
]
|
|
241
|
-
}) : /* @__PURE__ */ e(p, { children:
|
|
242
|
-
className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4",
|
|
243
|
-
children:
|
|
244
|
+
}) : /* @__PURE__ */ e(p, { children: A ? /* @__PURE__ */ e("div", {
|
|
245
|
+
className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", G),
|
|
246
|
+
children: K
|
|
244
247
|
}) : null })]
|
|
245
248
|
})]
|
|
246
249
|
})
|
|
@@ -248,5 +251,5 @@ var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
248
251
|
] });
|
|
249
252
|
};
|
|
250
253
|
export {
|
|
251
|
-
|
|
254
|
+
Ye as MinimizableDialog
|
|
252
255
|
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { StyledTooltip as
|
|
2
|
-
import { ArrowExpandIcon as
|
|
3
|
-
import { ArrowShrinkIcon as
|
|
4
|
-
import { StyledButton as
|
|
1
|
+
import { StyledTooltip as n } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
2
|
+
import { ArrowExpandIcon as a } from "../../../icons/arrow-expand-icon/ArrowExpandIcon.js";
|
|
3
|
+
import { ArrowShrinkIcon as d } from "../../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
|
|
4
|
+
import { StyledButton as m } from "../../../inputs/button/StyledButton.js";
|
|
5
5
|
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
-
var
|
|
7
|
-
title:
|
|
8
|
-
|
|
6
|
+
var x = ({ fullScreen: e, showFullScreenIcon: l, tooltipTitle: o, onClick: i, disabledReason: t }) => l ? /* @__PURE__ */ r(n, {
|
|
7
|
+
title: o,
|
|
8
|
+
open: t ? !1 : void 0,
|
|
9
|
+
children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(m, {
|
|
9
10
|
dataTest: "fullscreen-button",
|
|
10
|
-
"aria-label":
|
|
11
|
+
"aria-label": o,
|
|
11
12
|
variant: "textGray",
|
|
12
13
|
size: "small",
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
disabled: !!t,
|
|
15
|
+
disabledReason: t,
|
|
16
|
+
onClick: i,
|
|
17
|
+
endIcon: e ? /* @__PURE__ */ r(d, {
|
|
15
18
|
width: 20,
|
|
16
19
|
height: 20,
|
|
17
20
|
color: "text-delta-700"
|
|
18
|
-
}) : /* @__PURE__ */ r(
|
|
21
|
+
}) : /* @__PURE__ */ r(a, {
|
|
19
22
|
width: 20,
|
|
20
23
|
height: 20,
|
|
21
24
|
color: "text-delta-700"
|
|
@@ -23,5 +26,5 @@ var u = ({ fullScreen: e, showFullScreenIcon: o, tooltipTitle: t, onClick: l })
|
|
|
23
26
|
}) })
|
|
24
27
|
}) : null;
|
|
25
28
|
export {
|
|
26
|
-
|
|
29
|
+
x as FullScreenBtn
|
|
27
30
|
};
|
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { cn as a } from "../../../../helpers/cn.js";
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { DialogBusyContext as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { OverlayBackOwnerContext as
|
|
7
|
-
import { useFocusTrap as
|
|
8
|
-
import { fullScreenFieldWidthVars as
|
|
9
|
-
import { CloseBtn as
|
|
10
|
-
import { MinimizeBtn as
|
|
11
|
-
import { FullScreenBtn as
|
|
2
|
+
import { firstTabbable as A } from "../../../../helpers/focusable.js";
|
|
3
|
+
import { StyledTooltip as le } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { DialogBusyContext as L, useDialogBusyBoundary as ne } from "../../dialog/DialogBusyContext.js";
|
|
5
|
+
import { useMobileMediaQuery as oe } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { OverlayBackOwnerContext as re, isOverlayBackNavigationPending as se, useBackCloses as ce } from "../../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useFocusTrap as ae } from "../../../../hooks/useFocusTrap.hook.js";
|
|
8
|
+
import { fullScreenFieldWidthVars as de } from "../../../inputs/field-styles.js";
|
|
9
|
+
import { CloseBtn as V } from "../components/CloseBtn.js";
|
|
10
|
+
import { MinimizeBtn as $ } from "../components/MinimizeBtn.js";
|
|
11
|
+
import { FullScreenBtn as me } from "../components/FullscreenBtn.js";
|
|
12
12
|
import h from "./MinimizableDialogV2.module.js";
|
|
13
|
-
import { useTranslations as
|
|
14
|
-
import { useControlledProps as
|
|
15
|
-
import
|
|
16
|
-
import { useId as
|
|
17
|
-
import { Fragment as
|
|
18
|
-
var
|
|
19
|
-
const { showCloseIcon:
|
|
13
|
+
import { useTranslations as ue } from "./useTranslations.js";
|
|
14
|
+
import { useControlledProps as fe } from "./useControlledProps.js";
|
|
15
|
+
import pe from "clsx";
|
|
16
|
+
import { useId as W, useLayoutEffect as H, useRef as d } from "react";
|
|
17
|
+
import { Fragment as xe, jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
18
|
+
var je = (w) => {
|
|
19
|
+
const { showCloseIcon: R = !0, showMinimizeIcon: _ = !0, showExpandIcon: Q = !0, enableFullscreen: U = !0, fullscreenLockedReason: N, title: u, label: f, children: G, open: i, onClose: J, classNameOverrides: b = {
|
|
20
20
|
maximized: "",
|
|
21
21
|
minimized: "",
|
|
22
22
|
fullscreen: ""
|
|
23
|
-
}, dataTest:
|
|
23
|
+
}, dataTest: K, actionNode: X, locale: Y = "en", busyReason: Z, style: B, initialFocusRef: F } = w, r = oe(), l = ue(Y), n = d(null), p = d(null), S = d(null), k = d(null), g = d(!1), y = d(null), x = W(), T = W(), { minimized: t, setMinimized: I, fullScreen: s, setFullScreen: M } = fe(w), c = s && !t, E = !!N, { busy: z, busyReason: P, contextValue: j } = ne(Z ?? l.waitUntilSaved), v = () => {
|
|
24
24
|
if (z) return !1;
|
|
25
|
-
|
|
25
|
+
I(!1), J();
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
H(() => {
|
|
28
28
|
n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
29
|
-
}, [t]),
|
|
29
|
+
}, [t]), H(() => {
|
|
30
30
|
const C = i && !g.current, m = !i && g.current;
|
|
31
31
|
if (g.current = i, m) {
|
|
32
|
-
const
|
|
33
|
-
y.current = null, (!document.activeElement || document.activeElement === document.body) &&
|
|
32
|
+
const D = y.current;
|
|
33
|
+
y.current = null, (!document.activeElement || document.activeElement === document.body) && D?.isConnected && D.focus({ preventScroll: !0 });
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
if (!C) return;
|
|
37
37
|
y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
const q = t ? p.current : n.current, ie = t ? k.current : S.current;
|
|
39
|
+
(F?.current ?? ie ?? (q ? A(q) : void 0))?.focus({ preventScroll: !0 });
|
|
40
40
|
}, [
|
|
41
|
-
|
|
41
|
+
F,
|
|
42
42
|
t,
|
|
43
43
|
i
|
|
44
44
|
]);
|
|
45
|
-
const
|
|
45
|
+
const O = () => {
|
|
46
46
|
const C = t ? n : p;
|
|
47
|
-
|
|
47
|
+
I(!t), requestAnimationFrame(() => {
|
|
48
48
|
const m = C.current;
|
|
49
|
-
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ??
|
|
49
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? A(m))?.focus({ preventScroll: !0 });
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
ae(i && c, n, v), ce({
|
|
53
53
|
active: i && !t,
|
|
54
|
-
requestClose: () => !c &&
|
|
54
|
+
requestClose: () => !c && se() ? !1 : v(),
|
|
55
55
|
ownerRef: n
|
|
56
56
|
});
|
|
57
|
-
const
|
|
57
|
+
const ee = c ? r ? {
|
|
58
58
|
inset: 0,
|
|
59
59
|
maxHeight: "100dvh",
|
|
60
60
|
maxWidth: "100dvw",
|
|
@@ -70,24 +70,24 @@ var Ee = (w) => {
|
|
|
70
70
|
width: "min(1000px, calc(100vw - 32px))",
|
|
71
71
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
72
72
|
height: "95dvh",
|
|
73
|
-
...
|
|
73
|
+
...de
|
|
74
74
|
} : void 0;
|
|
75
75
|
if (!i) return null;
|
|
76
|
-
const
|
|
77
|
-
return /* @__PURE__ */
|
|
76
|
+
const te = f ? `${T} ${x}` : x;
|
|
77
|
+
return /* @__PURE__ */ o(xe, { children: [
|
|
78
78
|
/* @__PURE__ */ e("div", {
|
|
79
79
|
ref: p,
|
|
80
80
|
style: {
|
|
81
81
|
zIndex: 51,
|
|
82
|
-
...
|
|
82
|
+
...B
|
|
83
83
|
},
|
|
84
84
|
className: a(h["minimized-dialog"], !t && h.hidden, b.minimized),
|
|
85
|
-
children: /* @__PURE__ */
|
|
86
|
-
className:
|
|
87
|
-
"data-testid":
|
|
85
|
+
children: /* @__PURE__ */ o("div", {
|
|
86
|
+
className: pe("flex items-center justify-between", !t && "hidden"),
|
|
87
|
+
"data-testid": K,
|
|
88
88
|
children: [/* @__PURE__ */ e("div", {
|
|
89
89
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
90
|
-
children: /* @__PURE__ */ e(
|
|
90
|
+
children: /* @__PURE__ */ e(le, {
|
|
91
91
|
title: u,
|
|
92
92
|
placement: "top",
|
|
93
93
|
children: /* @__PURE__ */ e("div", {
|
|
@@ -95,18 +95,18 @@ var Ee = (w) => {
|
|
|
95
95
|
children: u
|
|
96
96
|
})
|
|
97
97
|
})
|
|
98
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ o("div", {
|
|
99
99
|
className: "flex items-center gap-x-1",
|
|
100
|
-
children: [/* @__PURE__ */ e(
|
|
100
|
+
children: [/* @__PURE__ */ e($, {
|
|
101
101
|
type: "expand",
|
|
102
|
-
visibility:
|
|
103
|
-
onClick:
|
|
102
|
+
visibility: Q,
|
|
103
|
+
onClick: O,
|
|
104
104
|
tooltipTitle: l.expand
|
|
105
|
-
}), /* @__PURE__ */ e(
|
|
106
|
-
buttonRef:
|
|
107
|
-
showCloseIcon:
|
|
105
|
+
}), /* @__PURE__ */ e(V, {
|
|
106
|
+
buttonRef: k,
|
|
107
|
+
showCloseIcon: R,
|
|
108
108
|
onClick: v,
|
|
109
|
-
disabledReason: z ?
|
|
109
|
+
disabledReason: z ? P : void 0,
|
|
110
110
|
tooltipTitle: l.close
|
|
111
111
|
})]
|
|
112
112
|
})]
|
|
@@ -115,74 +115,75 @@ var Ee = (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
|
+
E || M(!1);
|
|
119
119
|
}
|
|
120
120
|
}),
|
|
121
121
|
/* @__PURE__ */ e("div", {
|
|
122
122
|
style: {
|
|
123
123
|
zIndex: 51,
|
|
124
|
-
...
|
|
125
|
-
...
|
|
124
|
+
...B,
|
|
125
|
+
...ee
|
|
126
126
|
},
|
|
127
127
|
ref: n,
|
|
128
128
|
role: "dialog",
|
|
129
129
|
"aria-modal": c ? !0 : void 0,
|
|
130
|
-
"aria-labelledby":
|
|
131
|
-
className: a(h.dialog, t && h.hidden, !
|
|
132
|
-
children: /* @__PURE__ */
|
|
130
|
+
"aria-labelledby": te,
|
|
131
|
+
className: a(h.dialog, t && h.hidden, !s && b.maximized, s && b.fullscreen, c && "fixed z-[53] duration-0"),
|
|
132
|
+
children: /* @__PURE__ */ o(re.Provider, {
|
|
133
133
|
value: n,
|
|
134
|
-
children: [/* @__PURE__ */
|
|
135
|
-
className: a("flex flex-col border-b-[1px] border-delta-200 px-4",
|
|
136
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ o("div", {
|
|
135
|
+
className: a("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
|
|
136
|
+
children: [/* @__PURE__ */ o("div", {
|
|
137
137
|
className: "flex items-center justify-between",
|
|
138
138
|
children: [f ? /* @__PURE__ */ e("div", {
|
|
139
|
-
id:
|
|
139
|
+
id: T,
|
|
140
140
|
className: "text-sm text-delta-700",
|
|
141
141
|
children: f
|
|
142
142
|
}) : /* @__PURE__ */ e("div", {
|
|
143
143
|
id: x,
|
|
144
|
-
className: a("font-semibold text-delta-800",
|
|
144
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
145
145
|
children: u
|
|
146
|
-
}), /* @__PURE__ */
|
|
146
|
+
}), /* @__PURE__ */ o("div", {
|
|
147
147
|
className: "flex items-center gap-x-1",
|
|
148
148
|
children: [
|
|
149
|
-
/* @__PURE__ */ e(
|
|
150
|
-
value:
|
|
151
|
-
children:
|
|
149
|
+
/* @__PURE__ */ e(L.Provider, {
|
|
150
|
+
value: j,
|
|
151
|
+
children: X
|
|
152
152
|
}),
|
|
153
|
-
/* @__PURE__ */ e(
|
|
154
|
-
visibility:
|
|
153
|
+
/* @__PURE__ */ e($, {
|
|
154
|
+
visibility: _ && !r,
|
|
155
155
|
type: "minimize",
|
|
156
|
-
onClick:
|
|
156
|
+
onClick: O,
|
|
157
157
|
tooltipTitle: l.minimize
|
|
158
158
|
}),
|
|
159
|
-
/* @__PURE__ */ e(
|
|
160
|
-
showFullScreenIcon:
|
|
161
|
-
|
|
159
|
+
/* @__PURE__ */ e(me, {
|
|
160
|
+
showFullScreenIcon: (U || E) && !r,
|
|
161
|
+
disabledReason: N,
|
|
162
|
+
fullScreen: s,
|
|
162
163
|
onClick: () => {
|
|
163
|
-
|
|
164
|
+
M(!s);
|
|
164
165
|
},
|
|
165
|
-
tooltipTitle:
|
|
166
|
+
tooltipTitle: s ? l.exitFullscreen : l.fullscreen
|
|
166
167
|
}),
|
|
167
|
-
/* @__PURE__ */ e(
|
|
168
|
+
/* @__PURE__ */ e(V, {
|
|
168
169
|
buttonRef: S,
|
|
169
|
-
showCloseIcon:
|
|
170
|
+
showCloseIcon: R,
|
|
170
171
|
onClick: v,
|
|
171
|
-
disabledReason: z ?
|
|
172
|
+
disabledReason: z ? P : void 0,
|
|
172
173
|
tooltipTitle: l.close
|
|
173
174
|
})
|
|
174
175
|
]
|
|
175
176
|
})]
|
|
176
177
|
}), f && /* @__PURE__ */ e("div", {
|
|
177
178
|
id: x,
|
|
178
|
-
className: a("font-semibold text-delta-800",
|
|
179
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
179
180
|
children: u
|
|
180
181
|
})]
|
|
181
182
|
}), /* @__PURE__ */ e("div", {
|
|
182
183
|
className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
183
|
-
children: /* @__PURE__ */ e(
|
|
184
|
-
value:
|
|
185
|
-
children:
|
|
184
|
+
children: /* @__PURE__ */ e(L.Provider, {
|
|
185
|
+
value: j,
|
|
186
|
+
children: G
|
|
186
187
|
})
|
|
187
188
|
})]
|
|
188
189
|
})
|
|
@@ -190,5 +191,5 @@ var Ee = (w) => {
|
|
|
190
191
|
] });
|
|
191
192
|
};
|
|
192
193
|
export {
|
|
193
|
-
|
|
194
|
+
je as MinimizableDialogV2
|
|
194
195
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useState as t } from "react";
|
|
2
|
-
var p = ({ fullScreenState: i, handleFullScreenState: s, minimizedState:
|
|
3
|
-
const [
|
|
2
|
+
var p = ({ fullScreenState: i, handleFullScreenState: s, minimizedState: o, handleMinimizedState: n }) => {
|
|
3
|
+
const [r, c] = t(!1), [l, m] = t(!1);
|
|
4
4
|
return {
|
|
5
|
-
fullScreen: i ??
|
|
6
|
-
setFullScreen: (e) => s ? s() : m(e),
|
|
7
|
-
minimized:
|
|
8
|
-
setMinimized: (e) => n ? n(e) :
|
|
5
|
+
fullScreen: i ?? l,
|
|
6
|
+
setFullScreen: (e) => s ? s(e) : m(e),
|
|
7
|
+
minimized: o ?? r,
|
|
8
|
+
setMinimized: (e) => n ? n(e) : c(e)
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
export declare const FullScreenBtn: FC<{
|
|
3
3
|
fullScreen: boolean;
|
|
4
4
|
showFullScreenIcon: boolean;
|
|
5
5
|
tooltipTitle: string;
|
|
6
6
|
onClick: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* While set, the button is soft-disabled with this reason instead of being taken away — a dialog
|
|
9
|
+
* that only exists in fullscreen still shows its exit control, says why it cannot be used and
|
|
10
|
+
* stays focusable. Same contract as `CloseBtn`'s: `StyledButton` renders `aria-disabled`, the
|
|
11
|
+
* not-allowed cursor and the reason on hover, focus and tap.
|
|
12
|
+
*/
|
|
13
|
+
disabledReason?: ReactNode;
|
|
7
14
|
}>;
|
|
@@ -44,8 +44,26 @@ export interface IMinimizableDialogProps {
|
|
|
44
44
|
footerClassName?: string;
|
|
45
45
|
footerInfo?: ReactNode;
|
|
46
46
|
enableFullscreen?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Why fullscreen cannot be left, for a dialog that only ever runs fullscreen.
|
|
49
|
+
*
|
|
50
|
+
* While set, the fullscreen toggle is **shown disabled** with this reason rather than hidden:
|
|
51
|
+
* the header's minimize / fullscreen / close triad is a place people have learned, so a control
|
|
52
|
+
* missing from it reads as "this dialog cannot do that" instead of "not here, and here is why"
|
|
53
|
+
* (hide-or-disable HOD-4, disabled-states DIS-1/2/3). `StyledButton` keeps it focusable with
|
|
54
|
+
* `aria-disabled` and opens the reason on hover, focus and tap.
|
|
55
|
+
*
|
|
56
|
+
* App-owned and localized: shared components render no default reason, so leaving this unset
|
|
57
|
+
* keeps today's behaviour.
|
|
58
|
+
*/
|
|
59
|
+
fullscreenLockedReason?: ReactNode;
|
|
47
60
|
fullScreenState?: boolean;
|
|
48
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Called with the state being asked for, mirroring `handleMinimizedState`. A zero-argument
|
|
63
|
+
* toggle stays valid — TypeScript accepts the narrower signature, and the extra argument is
|
|
64
|
+
* ignored at runtime — so existing consumers need no change.
|
|
65
|
+
*/
|
|
66
|
+
handleFullScreenState?: (fullScreen: boolean) => void;
|
|
49
67
|
locale?: 'no' | 'en';
|
|
50
68
|
dataTest: string;
|
|
51
69
|
}
|
|
@@ -42,6 +42,24 @@ export interface IMinimizableDialogV2Props {
|
|
|
42
42
|
minimizedState?: boolean;
|
|
43
43
|
handleMinimizedState?: (minimized: boolean) => void;
|
|
44
44
|
enableFullscreen?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Why fullscreen cannot be left, for a dialog that only ever runs fullscreen.
|
|
47
|
+
*
|
|
48
|
+
* While set, the fullscreen toggle is **shown disabled** with this reason rather than hidden:
|
|
49
|
+
* the header's minimize / fullscreen / close triad is a place people have learned, so a control
|
|
50
|
+
* missing from it reads as "this dialog cannot do that" instead of "not here, and here is why"
|
|
51
|
+
* (hide-or-disable HOD-4, disabled-states DIS-1/2/3). `StyledButton` keeps it focusable with
|
|
52
|
+
* `aria-disabled` and opens the reason on hover, focus and tap.
|
|
53
|
+
*
|
|
54
|
+
* App-owned and localized: shared components render no default reason, so leaving this unset
|
|
55
|
+
* keeps today's behaviour.
|
|
56
|
+
*/
|
|
57
|
+
fullscreenLockedReason?: ReactNode;
|
|
45
58
|
fullScreenState?: boolean;
|
|
46
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Called with the state being asked for, mirroring `handleMinimizedState`. A zero-argument
|
|
61
|
+
* toggle stays valid — TypeScript accepts the narrower signature, and the extra argument is
|
|
62
|
+
* ignored at runtime — so existing consumers need no change.
|
|
63
|
+
*/
|
|
64
|
+
handleFullScreenState?: (fullScreen: boolean) => void;
|
|
47
65
|
}
|