asma-ui-core 3.109.0 → 3.111.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/feedback/minimizable-dialog/MinimizableDialog.js +41 -39
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +62 -60
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +61 -58
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +74 -71
- package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +13 -10
- package/dist/components/inputs/field-styles.js +16 -6
- package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
- package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
- package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
- package/dist/components/inputs/input-field/StyledInputField.js +235 -198
- package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
- package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
- package/dist/components/inputs/select/StyledSelect.js +110 -108
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
- package/dist/components/inputs/slider/StyledSlider.js +2 -2
- package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
- package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
- package/dist/components/miscellaneous/StyledFormControl.js +29 -25
- package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
- package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
- package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
- package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
- package/dist/helpers/CharacterCounter.js +21 -0
- package/dist/hooks/useBackCloses.hook.js +67 -38
- package/dist/hooks/useTopLayer.hook.js +30 -26
- package/dist/index.js +284 -273
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
- package/dist/src/components/inputs/dynamic-select/types.d.ts +3 -0
- package/dist/src/components/inputs/field-styles.d.ts +22 -0
- package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
- package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
- package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
- package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
- package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
- package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
- package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
- package/dist/src/helpers/CharacterCounter.d.ts +16 -0
- package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
- package/dist/src/hooks/useBackCloses.hook.d.ts +47 -2
- package/dist/src/hooks/useTopLayer.hook.d.ts +6 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/tailwind.config.d.ts +14 -0
- package/package.json +1 -1
- package/src/styles/fieldWidthTokens.css +8 -0
- package/src/styles/index.css +1 -0
- package/tw-configs/twConfigs.json +14 -0
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as h } from "../../../helpers/cn.js";
|
|
2
2
|
import { firstTabbable as me } from "../../../helpers/focusable.js";
|
|
3
3
|
import { StyledTooltip as u } from "../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
-
import { DotsVerticalIcon as
|
|
4
|
+
import { DotsVerticalIcon as fe } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
5
5
|
import { CloseIcon as K } from "../../icons/close-icon/CloseIcon.js";
|
|
6
|
-
import { MinimizeIcon as
|
|
6
|
+
import { MinimizeIcon as he } from "../../icons/minimize-icon/MinimizeIcon.js";
|
|
7
7
|
import { KeyboardCapslockIcon as ue } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
|
|
8
8
|
import { ArrowExpandIcon as ve } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
|
|
9
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 pe,
|
|
12
|
-
import { useFocusTrap as
|
|
11
|
+
import { OverlayBackOwnerContext as pe, isOverlayBackNavigationPending as ge, useBackCloses as xe } from "../../../hooks/useBackCloses.hook.js";
|
|
12
|
+
import { useFocusTrap as ke } from "../../../hooks/useFocusTrap.hook.js";
|
|
13
13
|
import { StyledMenu as ye } from "../../navigation/menu/StyledMenu.js";
|
|
14
|
-
import { StyledMenuItem as
|
|
14
|
+
import { StyledMenuItem as we } from "../../navigation/menu/StyledMenuItem.js";
|
|
15
|
+
import { fullScreenFieldWidthVars as ze } from "../../inputs/field-styles.js";
|
|
15
16
|
import T from "./MinimizableDialog.module.js";
|
|
16
|
-
import { useToggleMenuVisibility as
|
|
17
|
+
import { useToggleMenuVisibility as Ne } from "../../../hooks/useToggleMenuVisibility.hook.js";
|
|
17
18
|
import H from "clsx";
|
|
18
|
-
import { useLayoutEffect as
|
|
19
|
+
import { useLayoutEffect as Ce, useRef as J, useState as Q } from "react";
|
|
19
20
|
import { Fragment as p, jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
20
|
-
var
|
|
21
|
-
const [i, re] = Q(!1), [V, ne] = Q(!1), { open: de, anchorEl: ae, handleOpen: oe, handleClose: se } =
|
|
21
|
+
var Qe = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", onFullScreenText: M = "", showCloseIcon: R = !0, showMinimizeIcon: X = !0, showExpandIcon: Y = !0, showFullScreenIcon: Z = !0, title: m, label: g, children: x, open: k, onClose: L, className: j = "", primaryButtonText: S, primaryButtonLoading: n = !1, primaryButtonDisabled: B, primaryButtonDisabledReason: ee, secondaryButtonText: y, onPrimaryButtonClick: F, onSecondaryButtonClick: _, dataTest: q, actionNode: te, extraActions: d, extraActionsText: f, btnContainerClassName: E, footerClassName: ie, footerInfo: G, locale: t = "en", enableFullscreen: le = !0, fullScreenState: O, handleFullScreenState: D }) => {
|
|
22
|
+
const [i, re] = Q(!1), [V, ne] = Q(!1), { open: de, anchorEl: ae, handleOpen: oe, handleClose: se } = Ne(), s = J(null), w = J(null), z = t === "en" ? "Wait until saved" : "Vent til lagringen er ferdig", b = () => {
|
|
22
23
|
if (n) return !1;
|
|
23
24
|
L();
|
|
24
25
|
}, o = O ?? V, a = o && !i;
|
|
25
|
-
if (
|
|
26
|
-
active:
|
|
27
|
-
requestClose: b,
|
|
26
|
+
if (ke(k && a, s, b), xe({
|
|
27
|
+
active: k && !i,
|
|
28
|
+
requestClose: () => !a && ge() ? !1 : b(),
|
|
28
29
|
ownerRef: s
|
|
29
|
-
}),
|
|
30
|
+
}), Ce(() => {
|
|
30
31
|
s.current?.toggleAttribute("inert", i), w.current?.toggleAttribute("inert", !i);
|
|
31
|
-
}, [i]), !
|
|
32
|
+
}, [i]), !k) return null;
|
|
32
33
|
const ce = a ? {
|
|
33
34
|
right: "auto",
|
|
34
35
|
bottom: "auto",
|
|
@@ -36,15 +37,16 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
36
37
|
top: "50%",
|
|
37
38
|
transform: "translate(-50%, -50%)",
|
|
38
39
|
width: "min(1000px, calc(100vw - 32px))",
|
|
39
|
-
height: "95dvh"
|
|
40
|
-
|
|
40
|
+
height: "95dvh",
|
|
41
|
+
...ze
|
|
42
|
+
} : void 0, P = o ? t === "en" ? "Exit full screen" : "Avslutt fullskjerm" : t === "en" ? "Full screen" : "Fullskjerm", W = S ?? n, U = W || y, $ = /* @__PURE__ */ l(p, { children: [y && _ && /* @__PURE__ */ e(r, {
|
|
41
43
|
dataTest: "cancel-button",
|
|
42
44
|
variant: "outlined",
|
|
43
45
|
disabled: n,
|
|
44
46
|
disabledReason: z,
|
|
45
47
|
onClick: _,
|
|
46
|
-
children:
|
|
47
|
-
}),
|
|
48
|
+
children: y
|
|
49
|
+
}), W && F && /* @__PURE__ */ e(r, {
|
|
48
50
|
dataTest: "save-button",
|
|
49
51
|
loading: n,
|
|
50
52
|
locale: t,
|
|
@@ -64,10 +66,10 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
64
66
|
/* @__PURE__ */ e("div", {
|
|
65
67
|
ref: w,
|
|
66
68
|
style: { zIndex: 51 },
|
|
67
|
-
className:
|
|
69
|
+
className: h(T.dialog, !i && T.hidden),
|
|
68
70
|
children: /* @__PURE__ */ l("div", {
|
|
69
71
|
className: H("flex items-center justify-between", !i && "hidden"),
|
|
70
|
-
"data-testid":
|
|
72
|
+
"data-testid": q,
|
|
71
73
|
children: [/* @__PURE__ */ e("div", {
|
|
72
74
|
className: "truncate text-lg font-semibold text-delta-800",
|
|
73
75
|
children: m
|
|
@@ -116,8 +118,8 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
116
118
|
role: a ? "dialog" : void 0,
|
|
117
119
|
"aria-modal": a ? !0 : void 0,
|
|
118
120
|
"aria-label": a && typeof m == "string" ? m : void 0,
|
|
119
|
-
className:
|
|
120
|
-
"data-testid":
|
|
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", j && !i && !o ? j : "", i && "!h-0 !w-0 opacity-0 duration-0", a && "fixed duration-0"),
|
|
122
|
+
"data-testid": q,
|
|
121
123
|
children: /* @__PURE__ */ l(pe.Provider, {
|
|
122
124
|
value: s,
|
|
123
125
|
children: [/* @__PURE__ */ l("div", {
|
|
@@ -142,7 +144,7 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
142
144
|
variant: "textGray",
|
|
143
145
|
size: "small",
|
|
144
146
|
onClick: A,
|
|
145
|
-
endIcon: /* @__PURE__ */ e(
|
|
147
|
+
endIcon: /* @__PURE__ */ e(he, {
|
|
146
148
|
height: 20,
|
|
147
149
|
width: 20,
|
|
148
150
|
color: "text-delta-700"
|
|
@@ -158,7 +160,7 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
158
160
|
variant: "textGray",
|
|
159
161
|
size: "small",
|
|
160
162
|
onClick: () => {
|
|
161
|
-
O !== void 0 &&
|
|
163
|
+
O !== void 0 && D ? D() : ne(!V);
|
|
162
164
|
},
|
|
163
165
|
endIcon: o ? /* @__PURE__ */ e(be, {
|
|
164
166
|
width: 20,
|
|
@@ -202,42 +204,42 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
202
204
|
children: [/* @__PURE__ */ e("div", {
|
|
203
205
|
className: "flex-grow overflow-y-auto overscroll-contain",
|
|
204
206
|
children: typeof x == "function" ? x({ fullScreen: o }) : x
|
|
205
|
-
}), (Array.isArray(d) && d.length || typeof d == "function") &&
|
|
206
|
-
className:
|
|
207
|
+
}), (Array.isArray(d) && d.length || typeof d == "function") && f || G ? /* @__PURE__ */ l("div", {
|
|
208
|
+
className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", ie),
|
|
207
209
|
children: [
|
|
208
|
-
Array.isArray(d) && d.length &&
|
|
210
|
+
Array.isArray(d) && d.length && f ? /* @__PURE__ */ l(p, { children: [/* @__PURE__ */ e(r, {
|
|
209
211
|
dataTest: "extra-actions-button",
|
|
210
212
|
variant: "textGray",
|
|
211
|
-
startIcon: /* @__PURE__ */ e(
|
|
213
|
+
startIcon: /* @__PURE__ */ e(fe, {
|
|
212
214
|
width: 24,
|
|
213
215
|
height: 24
|
|
214
216
|
}),
|
|
215
217
|
onClick: oe,
|
|
216
|
-
children:
|
|
218
|
+
children: f
|
|
217
219
|
}), /* @__PURE__ */ e(ye, {
|
|
218
220
|
open: de,
|
|
219
221
|
anchorEl: ae,
|
|
220
222
|
onClose: se,
|
|
221
|
-
children: d.map((c) => /* @__PURE__ */ e(
|
|
223
|
+
children: d.map((c) => /* @__PURE__ */ e(we, {
|
|
222
224
|
className: c.className,
|
|
223
225
|
onClick: c.onClick,
|
|
224
226
|
children: c.label
|
|
225
227
|
}, c.label))
|
|
226
|
-
})] }) :
|
|
228
|
+
})] }) : f && typeof d == "function" && /* @__PURE__ */ e(r, {
|
|
227
229
|
dataTest: "extra-action-button",
|
|
228
230
|
variant: "text",
|
|
229
231
|
onClick: d,
|
|
230
|
-
children:
|
|
232
|
+
children: f
|
|
231
233
|
}),
|
|
232
234
|
" ",
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
className:
|
|
235
|
+
G,
|
|
236
|
+
U ? /* @__PURE__ */ e("div", {
|
|
237
|
+
className: h("flex justify-end gap-x-2", E),
|
|
236
238
|
children: $
|
|
237
239
|
}) : null
|
|
238
240
|
]
|
|
239
|
-
}) : /* @__PURE__ */ e(p, { children:
|
|
240
|
-
className:
|
|
241
|
+
}) : /* @__PURE__ */ e(p, { children: U ? /* @__PURE__ */ e("div", {
|
|
242
|
+
className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", E),
|
|
241
243
|
children: $
|
|
242
244
|
}) : null })]
|
|
243
245
|
})]
|
|
@@ -246,5 +248,5 @@ var Ke = ({ onCloseText: v = "", onMinimizeText: C = "", onExpandText: I = "", o
|
|
|
246
248
|
] });
|
|
247
249
|
};
|
|
248
250
|
export {
|
|
249
|
-
|
|
251
|
+
Qe as MinimizableDialog
|
|
250
252
|
};
|
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
import { cn as a } from "../../../../helpers/cn.js";
|
|
2
|
-
import { firstTabbable as
|
|
2
|
+
import { firstTabbable as q } from "../../../../helpers/focusable.js";
|
|
3
3
|
import { StyledTooltip as te } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
-
import { DialogBusyContext as
|
|
4
|
+
import { DialogBusyContext as D, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
|
|
5
5
|
import { useMobileMediaQuery as le } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
-
import { OverlayBackOwnerContext as ne,
|
|
7
|
-
import { useFocusTrap as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { OverlayBackOwnerContext as ne, isOverlayBackNavigationPending as oe, useBackCloses as re } from "../../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useFocusTrap as se } from "../../../../hooks/useFocusTrap.hook.js";
|
|
8
|
+
import { fullScreenFieldWidthVars as ce } from "../../../inputs/field-styles.js";
|
|
9
|
+
import { CloseBtn as A } from "../components/CloseBtn.js";
|
|
10
|
+
import { MinimizeBtn as V } from "../components/MinimizeBtn.js";
|
|
11
|
+
import { FullScreenBtn as ae } from "../components/FullscreenBtn.js";
|
|
11
12
|
import h from "./MinimizableDialogV2.module.js";
|
|
12
|
-
import { useTranslations as
|
|
13
|
-
import { useControlledProps as
|
|
14
|
-
import
|
|
15
|
-
import { useId as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
var
|
|
18
|
-
const { showCloseIcon:
|
|
13
|
+
import { useTranslations as de } from "./useTranslations.js";
|
|
14
|
+
import { useControlledProps as me } from "./useControlledProps.js";
|
|
15
|
+
import ue from "clsx";
|
|
16
|
+
import { useId as $, useLayoutEffect as W, useRef as d } from "react";
|
|
17
|
+
import { Fragment as fe, jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
18
|
+
var Ee = (w) => {
|
|
19
|
+
const { showCloseIcon: N = !0, showMinimizeIcon: H = !0, showExpandIcon: L = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: i, onClose: U, classNameOverrides: b = {
|
|
19
20
|
maximized: "",
|
|
20
21
|
minimized: "",
|
|
21
22
|
fullscreen: ""
|
|
22
|
-
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style:
|
|
23
|
+
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: R, initialFocusRef: B } = w, s = le(), l = de(K), n = d(null), p = d(null), S = d(null), F = d(null), g = d(!1), y = d(null), x = $(), k = $(), { minimized: t, setMinimized: T, fullScreen: o, setFullScreen: I } = me(w), c = o && !t, { busy: z, busyReason: M, contextValue: E } = ie(X ?? l.waitUntilSaved), v = () => {
|
|
23
24
|
if (z) return !1;
|
|
24
|
-
|
|
25
|
+
T(!1), U();
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
+
W(() => {
|
|
27
28
|
n.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
28
|
-
}, [t]),
|
|
29
|
-
const
|
|
29
|
+
}, [t]), W(() => {
|
|
30
|
+
const C = i && !g.current, m = !i && g.current;
|
|
30
31
|
if (g.current = i, m) {
|
|
31
|
-
const
|
|
32
|
-
y.current = null, (!document.activeElement || document.activeElement === document.body) &&
|
|
32
|
+
const O = y.current;
|
|
33
|
+
y.current = null, (!document.activeElement || document.activeElement === document.body) && O?.isConnected && O.focus({ preventScroll: !0 });
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
if (!
|
|
36
|
+
if (!C) return;
|
|
36
37
|
y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
37
|
-
const
|
|
38
|
-
(
|
|
38
|
+
const j = t ? p.current : n.current, ee = t ? F.current : S.current;
|
|
39
|
+
(B?.current ?? ee ?? (j ? q(j) : void 0))?.focus({ preventScroll: !0 });
|
|
39
40
|
}, [
|
|
40
|
-
|
|
41
|
+
B,
|
|
41
42
|
t,
|
|
42
43
|
i
|
|
43
44
|
]);
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const m =
|
|
48
|
-
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ??
|
|
45
|
+
const P = () => {
|
|
46
|
+
const C = t ? n : p;
|
|
47
|
+
T(!t), requestAnimationFrame(() => {
|
|
48
|
+
const m = C.current;
|
|
49
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(m))?.focus({ preventScroll: !0 });
|
|
49
50
|
});
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
-
active: i &&
|
|
53
|
-
requestClose: v,
|
|
52
|
+
se(i && c, n, v), re({
|
|
53
|
+
active: i && !t,
|
|
54
|
+
requestClose: () => !c && oe() ? !1 : v(),
|
|
54
55
|
ownerRef: n
|
|
55
56
|
});
|
|
56
57
|
const Y = c ? s ? {
|
|
@@ -68,20 +69,21 @@ var Te = (C) => {
|
|
|
68
69
|
transform: "translate(-50%, -50%)",
|
|
69
70
|
width: "min(1000px, calc(100vw - 32px))",
|
|
70
71
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
71
|
-
height: "95dvh"
|
|
72
|
+
height: "95dvh",
|
|
73
|
+
...ce
|
|
72
74
|
} : void 0;
|
|
73
75
|
if (!i) return null;
|
|
74
|
-
const Z = f ? `${
|
|
75
|
-
return /* @__PURE__ */ r(
|
|
76
|
+
const Z = f ? `${k} ${x}` : x;
|
|
77
|
+
return /* @__PURE__ */ r(fe, { children: [
|
|
76
78
|
/* @__PURE__ */ e("div", {
|
|
77
79
|
ref: p,
|
|
78
80
|
style: {
|
|
79
81
|
zIndex: 51,
|
|
80
|
-
...
|
|
82
|
+
...R
|
|
81
83
|
},
|
|
82
84
|
className: a(h["minimized-dialog"], !t && h.hidden, b.minimized),
|
|
83
85
|
children: /* @__PURE__ */ r("div", {
|
|
84
|
-
className:
|
|
86
|
+
className: ue("flex items-center justify-between", !t && "hidden"),
|
|
85
87
|
"data-testid": G,
|
|
86
88
|
children: [/* @__PURE__ */ e("div", {
|
|
87
89
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
@@ -95,16 +97,16 @@ var Te = (C) => {
|
|
|
95
97
|
})
|
|
96
98
|
}), /* @__PURE__ */ r("div", {
|
|
97
99
|
className: "flex items-center gap-x-1",
|
|
98
|
-
children: [/* @__PURE__ */ e(
|
|
100
|
+
children: [/* @__PURE__ */ e(V, {
|
|
99
101
|
type: "expand",
|
|
100
|
-
visibility:
|
|
101
|
-
onClick:
|
|
102
|
+
visibility: L,
|
|
103
|
+
onClick: P,
|
|
102
104
|
tooltipTitle: l.expand
|
|
103
|
-
}), /* @__PURE__ */ e(
|
|
104
|
-
buttonRef:
|
|
105
|
-
showCloseIcon:
|
|
105
|
+
}), /* @__PURE__ */ e(A, {
|
|
106
|
+
buttonRef: F,
|
|
107
|
+
showCloseIcon: N,
|
|
106
108
|
onClick: v,
|
|
107
|
-
disabledReason: z ?
|
|
109
|
+
disabledReason: z ? M : void 0,
|
|
108
110
|
tooltipTitle: l.close
|
|
109
111
|
})]
|
|
110
112
|
})]
|
|
@@ -113,13 +115,13 @@ var Te = (C) => {
|
|
|
113
115
|
c && /* @__PURE__ */ e("div", {
|
|
114
116
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
115
117
|
onClick: () => {
|
|
116
|
-
|
|
118
|
+
I(!1);
|
|
117
119
|
}
|
|
118
120
|
}),
|
|
119
121
|
/* @__PURE__ */ e("div", {
|
|
120
122
|
style: {
|
|
121
123
|
zIndex: 51,
|
|
122
|
-
...
|
|
124
|
+
...R,
|
|
123
125
|
...Y
|
|
124
126
|
},
|
|
125
127
|
ref: n,
|
|
@@ -134,7 +136,7 @@ var Te = (C) => {
|
|
|
134
136
|
children: [/* @__PURE__ */ r("div", {
|
|
135
137
|
className: "flex items-center justify-between",
|
|
136
138
|
children: [f ? /* @__PURE__ */ e("div", {
|
|
137
|
-
id:
|
|
139
|
+
id: k,
|
|
138
140
|
className: "text-sm text-delta-700",
|
|
139
141
|
children: f
|
|
140
142
|
}) : /* @__PURE__ */ e("div", {
|
|
@@ -144,29 +146,29 @@ var Te = (C) => {
|
|
|
144
146
|
}), /* @__PURE__ */ r("div", {
|
|
145
147
|
className: "flex items-center gap-x-1",
|
|
146
148
|
children: [
|
|
147
|
-
/* @__PURE__ */ e(
|
|
149
|
+
/* @__PURE__ */ e(D.Provider, {
|
|
148
150
|
value: E,
|
|
149
151
|
children: J
|
|
150
152
|
}),
|
|
151
|
-
/* @__PURE__ */ e(
|
|
152
|
-
visibility:
|
|
153
|
+
/* @__PURE__ */ e(V, {
|
|
154
|
+
visibility: H && !s && !o,
|
|
153
155
|
type: "minimize",
|
|
154
|
-
onClick:
|
|
156
|
+
onClick: P,
|
|
155
157
|
tooltipTitle: l.minimize
|
|
156
158
|
}),
|
|
157
|
-
/* @__PURE__ */ e(
|
|
159
|
+
/* @__PURE__ */ e(ae, {
|
|
158
160
|
showFullScreenIcon: _ && !s,
|
|
159
161
|
fullScreen: o,
|
|
160
162
|
onClick: () => {
|
|
161
|
-
|
|
163
|
+
I(!o);
|
|
162
164
|
},
|
|
163
165
|
tooltipTitle: o ? l.exitFullscreen : l.fullscreen
|
|
164
166
|
}),
|
|
165
|
-
/* @__PURE__ */ e(
|
|
166
|
-
buttonRef:
|
|
167
|
-
showCloseIcon:
|
|
167
|
+
/* @__PURE__ */ e(A, {
|
|
168
|
+
buttonRef: S,
|
|
169
|
+
showCloseIcon: N,
|
|
168
170
|
onClick: v,
|
|
169
|
-
disabledReason: z ?
|
|
171
|
+
disabledReason: z ? M : void 0,
|
|
170
172
|
tooltipTitle: l.close
|
|
171
173
|
})
|
|
172
174
|
]
|
|
@@ -178,7 +180,7 @@ var Te = (C) => {
|
|
|
178
180
|
})]
|
|
179
181
|
}), /* @__PURE__ */ e("div", {
|
|
180
182
|
className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
181
|
-
children: /* @__PURE__ */ e(
|
|
183
|
+
children: /* @__PURE__ */ e(D.Provider, {
|
|
182
184
|
value: E,
|
|
183
185
|
children: Q
|
|
184
186
|
})
|
|
@@ -188,5 +190,5 @@ var Te = (C) => {
|
|
|
188
190
|
] });
|
|
189
191
|
};
|
|
190
192
|
export {
|
|
191
|
-
|
|
193
|
+
Ee as MinimizableDialogV2
|
|
192
194
|
};
|
|
@@ -1,61 +1,64 @@
|
|
|
1
1
|
import { cn as v } from "../../../../helpers/cn.js";
|
|
2
|
-
import { StyledTooltip as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { ErrorOutlineIcon as
|
|
5
|
-
import { StyledChip as
|
|
6
|
-
import { StyledInteractiveChip as
|
|
7
|
-
import { StyledButton as
|
|
8
|
-
import { useHelperAlertRole as
|
|
9
|
-
import { warnMissingErrorMessage as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { StyledTooltip as Q } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
|
+
import { CloseIcon as j } from "../../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { ErrorOutlineIcon as U } from "../../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
5
|
+
import { StyledChip as X } from "../../../data-display/chip/StyledChip.js";
|
|
6
|
+
import { StyledInteractiveChip as O } from "../../../data-display/interactive-chip/StyledInteractiveChip.js";
|
|
7
|
+
import { StyledButton as Y } from "../../button/StyledButton.js";
|
|
8
|
+
import { useHelperAlertRole as Z } from "../../../../helpers/useHelperAlertRole.js";
|
|
9
|
+
import { warnMissingErrorMessage as _ } from "../../../../helpers/warnMissingErrorMessage.js";
|
|
10
|
+
import { fieldWidthStyle as ee } from "../../field-styles.js";
|
|
11
|
+
import { useWrap as te } from "../helpers/useWrap.js";
|
|
12
|
+
import { DynamicSelectTitle as le } from "./DynamicSelectTitle.js";
|
|
12
13
|
import { Skeleton as N } from "../../../mui-compat/Skeleton.js";
|
|
13
|
-
import { forwardRef as
|
|
14
|
-
import { jsx as t, jsxs as
|
|
15
|
-
var
|
|
16
|
-
const { options: d, dataTest:
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
14
|
+
import { forwardRef as re, useEffect as ie, useId as ae } from "react";
|
|
15
|
+
import { jsx as t, jsxs as S } from "react/jsx-runtime";
|
|
16
|
+
var ve = re((V, A) => {
|
|
17
|
+
const { options: d, dataTest: D, value: r, readOnly: a, multiple: n, title: R, titleSize: z, width: T = "full", disabled: b, onChange: p, required: E, error: f, helperText: C, valueKey: L = "value", labelKey: $ = "label", renderLabel: o, getOptionTooltip: I, loading: B, size: y, locale: q = "en", clearSelectionLabel: G } = V, K = ae();
|
|
18
|
+
_("DynamicInteractiveChipGroup", f, C);
|
|
19
|
+
const M = Z(f), { containerRef: m, wrapDisabled: w } = te({ dependencyList: [d, d.length] });
|
|
20
|
+
ie(() => {
|
|
20
21
|
m.current && (m.current.inert = !0);
|
|
21
22
|
}, [m]);
|
|
22
|
-
const u = (e) => typeof e == "object" ? e?.[
|
|
23
|
-
const l =
|
|
23
|
+
const u = (e) => typeof e == "object" ? e?.[$]?.toString() ?? "" : e?.toString() ?? "", g = (e) => typeof e == "object" ? e?.[L] : e, c = (e) => {
|
|
24
|
+
const l = g(e);
|
|
24
25
|
return l == null ? "" : typeof l == "string" || typeof l == "number" || typeof l == "boolean" ? String(l) : e == null ? "" : u(e);
|
|
25
|
-
}, s = (e, l) =>
|
|
26
|
+
}, s = (e, l) => g(e) === g(l), W = n ? Array.isArray(r) && r.length > 0 : r != null, F = (e) => {
|
|
26
27
|
if (!n) {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
p(
|
|
28
|
+
const i = s(e, r) ? null : e;
|
|
29
|
+
if (i === null) return;
|
|
30
|
+
p(i);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
const l = r ?? [];
|
|
33
|
-
p(l.find((
|
|
34
|
-
}, h =
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
"data-testid": `${
|
|
34
|
+
p(l.find((i) => s(i, e)) ? l.filter((i) => !s(i, e)) : [...l, e]);
|
|
35
|
+
}, h = a ? d.filter((e) => !!(n ? r?.find((l) => s(l, e)) : s(r, e))) : d, H = h.findIndex((e) => !(typeof e == "object" && e?.disabled) && !a);
|
|
36
|
+
return /* @__PURE__ */ S("div", {
|
|
37
|
+
"data-testid": `${D}-dynamic-radio-group`,
|
|
37
38
|
className: "relative flex flex-col gap-y-1",
|
|
39
|
+
"data-field-width": T,
|
|
40
|
+
style: ee(T),
|
|
38
41
|
children: [
|
|
39
|
-
/* @__PURE__ */ t(
|
|
40
|
-
title:
|
|
41
|
-
titleSize:
|
|
42
|
+
/* @__PURE__ */ t(le, {
|
|
43
|
+
title: R,
|
|
44
|
+
titleSize: z
|
|
42
45
|
}),
|
|
43
46
|
/* @__PURE__ */ t("div", {
|
|
44
47
|
"aria-hidden": !0,
|
|
45
48
|
ref: m,
|
|
46
49
|
className: "pointer-events-none absolute left-0 top-0 flex flex-wrap gap-2 opacity-0",
|
|
47
50
|
style: { width: "100%" },
|
|
48
|
-
children: h.map((e) => /* @__PURE__ */ t(
|
|
51
|
+
children: h.map((e) => /* @__PURE__ */ t(O, {
|
|
49
52
|
className: "w-fit",
|
|
50
|
-
readOnly:
|
|
53
|
+
readOnly: a,
|
|
51
54
|
type: n ? "checkbox" : "radio",
|
|
52
55
|
dataTest: `ic-${c(e)}-hidden`,
|
|
53
56
|
label: o ? o(e) : u(e)
|
|
54
57
|
}, c(e)))
|
|
55
58
|
}),
|
|
56
59
|
/* @__PURE__ */ t("div", {
|
|
57
|
-
className: v("flex flex-wrap gap-2",
|
|
58
|
-
children:
|
|
60
|
+
className: v("flex flex-wrap gap-2", w && "flex-col gap-1"),
|
|
61
|
+
children: B ? /* @__PURE__ */ S("div", {
|
|
59
62
|
className: "flex flex-wrap gap-2",
|
|
60
63
|
children: [
|
|
61
64
|
/* @__PURE__ */ t(N, { className: "h-[32px] w-[60px]" }),
|
|
@@ -63,34 +66,34 @@ var ge = te((O, V) => {
|
|
|
63
66
|
/* @__PURE__ */ t(N, { className: "h-[32px] w-[60px]" })
|
|
64
67
|
]
|
|
65
68
|
}) : h?.length ? h.map((e, l) => {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const x = typeof e == "object" ? !!e?.disabled : !1,
|
|
69
|
-
return /* @__PURE__ */ t(
|
|
70
|
-
title:
|
|
69
|
+
const i = !!(n ? r?.find((P) => s(P, e)) : s(r, e)), J = I ? I(e) : null;
|
|
70
|
+
if (a && !i) return null;
|
|
71
|
+
const x = typeof e == "object" ? !!e?.disabled : !1, k = !x && !a && l === H ? A : void 0;
|
|
72
|
+
return /* @__PURE__ */ t(Q, {
|
|
73
|
+
title: J,
|
|
71
74
|
arrow: !0,
|
|
72
75
|
children: /* @__PURE__ */ t("span", {
|
|
73
76
|
className: v(x && "cursor-not-allowed"),
|
|
74
|
-
children:
|
|
75
|
-
ref:
|
|
77
|
+
children: a && !w ? /* @__PURE__ */ t(X, {
|
|
78
|
+
ref: k,
|
|
76
79
|
disabled: !!b || x,
|
|
77
80
|
classes: { root: "min-h-[32px] h-full" },
|
|
78
81
|
className: "w-fit",
|
|
79
82
|
dataTest: `ic-${c(e)}`,
|
|
80
83
|
label: o ? o(e) : u(e)
|
|
81
|
-
}) : /* @__PURE__ */ t(
|
|
82
|
-
ref:
|
|
84
|
+
}) : /* @__PURE__ */ t(O, {
|
|
85
|
+
ref: k,
|
|
83
86
|
disabled: !!b || x,
|
|
84
|
-
classes:
|
|
87
|
+
classes: w ? {
|
|
85
88
|
root: "border-none outline-none bg-transparent w-full flex justify-start h-full min-h-[40px] shadow-none",
|
|
86
89
|
label: "block whitespace-normal break-words overflow-visible"
|
|
87
90
|
} : { root: "min-h-[32px] h-full" },
|
|
88
91
|
className: "w-fit",
|
|
89
|
-
readOnly:
|
|
92
|
+
readOnly: a,
|
|
90
93
|
type: n ? "checkbox" : "radio",
|
|
91
94
|
dataTest: `ic-${c(e)}`,
|
|
92
|
-
checked:
|
|
93
|
-
size:
|
|
95
|
+
checked: i,
|
|
96
|
+
size: y,
|
|
94
97
|
onClick: () => F(e),
|
|
95
98
|
label: o ? o(e) : u(e)
|
|
96
99
|
})
|
|
@@ -98,39 +101,39 @@ var ge = te((O, V) => {
|
|
|
98
101
|
}, c(e));
|
|
99
102
|
}) : /* @__PURE__ */ t("span", { children: "-" })
|
|
100
103
|
}),
|
|
101
|
-
!
|
|
104
|
+
!E && W && !a && !b && /* @__PURE__ */ t(Y, {
|
|
102
105
|
dataTest: "clear-selection-btn",
|
|
103
106
|
variant: "text",
|
|
104
|
-
startIcon:
|
|
107
|
+
startIcon: y === "medium" ? /* @__PURE__ */ t(j, {
|
|
105
108
|
height: 24,
|
|
106
109
|
width: 24,
|
|
107
110
|
className: "size-6"
|
|
108
|
-
}) : /* @__PURE__ */ t(
|
|
111
|
+
}) : /* @__PURE__ */ t(j, {
|
|
109
112
|
height: 20,
|
|
110
113
|
width: 20,
|
|
111
114
|
className: "size-5"
|
|
112
115
|
}),
|
|
113
116
|
className: "w-fit",
|
|
114
|
-
size:
|
|
117
|
+
size: y,
|
|
115
118
|
onClick: () => p(n ? [] : null),
|
|
116
|
-
children:
|
|
119
|
+
children: G ?? (q === "en" ? "Clear selection" : "Fjern valget")
|
|
117
120
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
id:
|
|
120
|
-
role:
|
|
121
|
+
/* @__PURE__ */ S("div", {
|
|
122
|
+
id: K,
|
|
123
|
+
role: M,
|
|
121
124
|
className: v("flex min-h-[24px] items-center gap-1 pt-1 text-sm/5 text-delta-600", f && "text-error-500"),
|
|
122
|
-
children: [f && /* @__PURE__ */ t(
|
|
125
|
+
children: [f && /* @__PURE__ */ t(U, {
|
|
123
126
|
width: 20,
|
|
124
127
|
height: 20,
|
|
125
128
|
className: "min-w-5"
|
|
126
129
|
}), /* @__PURE__ */ t("span", {
|
|
127
130
|
className: "line-clamp-1",
|
|
128
|
-
children:
|
|
131
|
+
children: C
|
|
129
132
|
})]
|
|
130
133
|
})
|
|
131
134
|
]
|
|
132
135
|
});
|
|
133
136
|
});
|
|
134
137
|
export {
|
|
135
|
-
|
|
138
|
+
ve as DynamicInteractiveChipGroup
|
|
136
139
|
};
|