asma-ui-core 3.104.0 → 3.106.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.
Files changed (70) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/module/header-layout/DynamicToolbar.js +99 -97
  3. package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +62 -43
  4. package/dist/components/custom/module/header-layout/ToolbarRows.js +51 -47
  5. package/dist/components/custom/module/header-layout/useTranslations.js +12 -10
  6. package/dist/components/custom/page/page-header/PageHeader.js +41 -40
  7. package/dist/components/custom/widget/widget/StyledWidget.js +21 -20
  8. package/dist/components/data-display/chip/StyledChip.js +70 -52
  9. package/dist/components/data-display/tooltip/StyledTooltip.js +110 -65
  10. package/dist/components/feedback/dialog/DialogBusyContext.js +32 -0
  11. package/dist/components/feedback/dialog/StyledDialog.js +104 -80
  12. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +76 -71
  13. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +133 -137
  14. package/dist/components/feedback/minimizable-dialog/components/CloseBtn.js +11 -8
  15. package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +6 -6
  16. package/dist/components/feedback/minimizable-dialog/components/MinimizeBtn.js +1 -1
  17. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +94 -85
  18. package/dist/components/feedback/minimizable-dialog/v2/useTranslations.js +6 -4
  19. package/dist/components/inputs/button/StyledButton.js +83 -33
  20. package/dist/components/inputs/button/StyledButton.module.js +8 -8
  21. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +32 -32
  22. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +91 -82
  23. package/dist/components/inputs/select/StyledSelect.js +8 -8
  24. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +152 -152
  25. package/dist/components/navigation/link/StyledLink.js +53 -26
  26. package/dist/components/navigation/link/StyledLink.module.js +6 -6
  27. package/dist/components/navigation/menu/StyledMenuItem.js +35 -30
  28. package/dist/components/navigation/menu/StyledMenuList.js +47 -38
  29. package/dist/components/navigation/tabs/StyledTab.js +25 -18
  30. package/dist/components/navigation/tabs/StyledTabs.js +33 -33
  31. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +6 -6
  32. package/dist/components/utils/copy-wrapper/CopyButton.js +4 -4
  33. package/dist/components/utils/copy-wrapper/CopyWrapper.js +4 -4
  34. package/dist/datetime/shared-components/button/StyledButton.module.js +11 -11
  35. package/dist/helpers/focusable.js +4 -3
  36. package/dist/helpers/warnUnnamedDialog.js +6 -0
  37. package/dist/index.js +589 -585
  38. package/dist/src/components/custom/module/header-layout/ToolbarActionGroup.d.ts +13 -2
  39. package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +2 -1
  40. package/dist/src/components/custom/module/header-layout/planToolbarActions.d.ts +18 -1
  41. package/dist/src/components/custom/module/header-layout/useTranslations.d.ts +2 -0
  42. package/dist/src/components/custom/widget/widget/StyledWidget.d.ts +5 -0
  43. package/dist/src/components/data-display/chip/StyledChip.d.ts +6 -0
  44. package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +7 -1
  45. package/dist/src/components/data-display/tooltip/StyledTooltip.d.ts +16 -2
  46. package/dist/src/components/feedback/dialog/DialogBusy.test.d.ts +1 -0
  47. package/dist/src/components/feedback/dialog/DialogBusyContext.d.ts +28 -0
  48. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +15 -2
  49. package/dist/src/components/feedback/dialog/dialog-footer/StyledDialogFooter.d.ts +10 -7
  50. package/dist/src/components/feedback/dialog/index.d.ts +1 -0
  51. package/dist/src/components/feedback/minimizable-dialog/components/CloseBtn.d.ts +2 -0
  52. package/dist/src/components/feedback/minimizable-dialog/types.d.ts +11 -0
  53. package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +2 -0
  54. package/dist/src/components/feedback/minimizable-dialog/v2/useTranslations.d.ts +2 -0
  55. package/dist/src/components/inputs/button/StyledButton.d.ts +25 -1
  56. package/dist/src/components/inputs/button/StyledButtonBusy.test.d.ts +1 -0
  57. package/dist/src/components/navigation/link/StyledLink.d.ts +6 -0
  58. package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +8 -1
  59. package/dist/src/components/navigation/menu/StyledMenuList.d.ts +2 -1
  60. package/dist/src/components/navigation/tabs/StyledTab.d.ts +17 -1
  61. package/dist/src/forms/submitChanged.d.ts +3 -0
  62. package/dist/src/helpers/focusable.d.ts +9 -0
  63. package/dist/src/helpers/index.d.ts +1 -0
  64. package/dist/src/helpers/uiCoreLocale.d.ts +1 -0
  65. package/dist/src/helpers/warnUnnamedDialog.d.ts +5 -0
  66. package/dist/src/table/shared-components/StyledMenuItem.d.ts +5 -1
  67. package/dist/table/components/columns/action-column/components/RowActionMenu.js +57 -50
  68. package/dist/table/shared-components/StyledMenuItem.js +28 -16
  69. package/dist/table/shared-components/button/StyledButton.module.js +11 -11
  70. package/package.json +1 -1
@@ -1,97 +1,102 @@
1
- import { cn as L } from "../../../../helpers/cn.js";
2
- import { DotsVerticalIcon as S } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
3
- import { LoadingIcon as $ } from "../../../icons/loading-icon/LoadingIcon.js";
4
- import { StyledTooltip as z } from "../../../data-display/tooltip/StyledTooltip.js";
5
- import { StyledButton as w } from "../../../inputs/button/StyledButton.js";
6
- import { StyledMenu as F } from "../../../navigation/menu/StyledMenu.js";
7
- import { StyledMenuItem as j } from "../../../navigation/menu/StyledMenuItem.js";
8
- import { useElementWidthPx as K } from "../../../../hooks/useElementWidthPx.js";
9
- import { useWidthRegistry as H } from "../../../../hooks/useWidthRegistry.js";
10
- import { planToolbarActions as U } from "../../../custom/module/header-layout/planToolbarActions.js";
11
- import { ToolbarActionButton as D } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
12
- import { useToolbarTranslations as G } from "../../../custom/module/header-layout/useTranslations.js";
13
- import { useMemo as y, useState as V } from "react";
14
- import { Fragment as C, jsx as r, jsxs as o } from "react/jsx-runtime";
15
- var X = 2, Y = 470, q = 8, N = "dialog-footer-right", M = "dialog-footer-more", O = (l, a) => `dialog-footer-action:${l}:${a ? "label" : "icon"}`;
16
- function me({ leftActions: l = [], leadingSlot: a, secondaryAction: s, primaryAction: d, fixed: k = !1, rounded: I = !0, locale: _ = "en", className: A, dataTest: c = "styled-dialog-footer" }) {
17
- const E = G(_), { ref: P, widthPx: m } = K(), { register: f, widths: t } = H(), [h, p] = V(null), g = m > 0 && m < Y, R = g ? 8 : 16, n = y(() => l.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
1
+ import { cn as j } from "../../../../helpers/cn.js";
2
+ import { StyledTooltip as K } from "../../../data-display/tooltip/StyledTooltip.js";
3
+ import { DotsVerticalIcon as U } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
4
+ import { DialogBusyContext as H, WAIT_UNTIL_SAVED as V, useReportDialogBusy as G } from "../DialogBusyContext.js";
5
+ import { StyledButton as P } from "../../../inputs/button/StyledButton.js";
6
+ import { StyledMenu as X } from "../../../navigation/menu/StyledMenu.js";
7
+ import { StyledMenuItem as Y } from "../../../navigation/menu/StyledMenuItem.js";
8
+ import { useElementWidthPx as q } from "../../../../hooks/useElementWidthPx.js";
9
+ import { useWidthRegistry as J } from "../../../../hooks/useWidthRegistry.js";
10
+ import { planToolbarActions as Q } from "../../../custom/module/header-layout/planToolbarActions.js";
11
+ import { ToolbarActionButton as Z, overflowItemState as ee } from "../../../custom/module/header-layout/ToolbarActionGroup.js";
12
+ import { useToolbarTranslations as oe } from "../../../custom/module/header-layout/useTranslations.js";
13
+ import { useContext as re, useMemo as R, useState as le } from "react";
14
+ import { Fragment as _, jsx as o, jsxs as d } from "react/jsx-runtime";
15
+ var ne = 2, ie = 470, te = 8, M = "dialog-footer-right", O = "dialog-footer-more", k = (l, n) => `dialog-footer-action:${l}:${n ? "label" : "icon"}`;
16
+ function Te({ leftActions: l = [], leadingSlot: n, secondaryAction: c, primaryAction: m, fixed: E = !1, rounded: W = !0, locale: i = "en", className: S, dataTest: f = "styled-dialog-footer" }) {
17
+ const b = re(H), p = oe(i), { ref: L, widthPx: h } = q(), { register: u, widths: t } = J(), [g, x] = le(null), y = h > 0 && h < ie, D = y ? 8 : 16, a = R(() => l.filter((e) => !e.hidden).map((e) => e.icon == null && e.canHideLabel == null ? {
18
18
  ...e,
19
19
  canHideLabel: !1
20
- } : e), [l]), W = t[N] ?? 0, x = s != null || d != null, v = Math.max(0, m - R * 2 - W - (x ? q : 0)), u = y(() => n.length >= X ? {
20
+ } : e), [l]), $ = t[M] ?? 0, T = c != null || m != null, B = Math.max(0, h - D * 2 - $ - (T ? te : 0)), s = R(() => a.length >= ne ? {
21
21
  inlineActions: [],
22
- overflowActions: n,
22
+ overflowActions: a,
23
23
  showMoreMenu: !0
24
- } : U({
25
- actions: n,
26
- availableWidth: v,
24
+ } : Q({
25
+ actions: a,
26
+ availableWidth: B,
27
27
  collapseLabels: !0,
28
- resolveActionWidth: (e, i) => t[O(e.id, i)],
29
- moreButtonWidthPx: t[M]
28
+ resolveActionWidth: (e, r) => t[k(e.id, r)],
29
+ moreButtonWidthPx: t[O]
30
30
  }), [
31
- n,
32
- v,
31
+ a,
32
+ B,
33
33
  t
34
- ]), b = (e, i, B) => {
35
- const T = /* @__PURE__ */ r(w, {
36
- dataTest: e.dataTest ?? `${c}-${B}`,
37
- variant: e.variant ?? i,
34
+ ]);
35
+ G(n == null && s.overflowActions.some((e) => !!e.loading && e.holdsDialog !== !1));
36
+ const C = (e, r, w) => {
37
+ const N = w === "secondary" && b?.busy, v = !!e.disabled || !!N, A = N ? b.busyReason ?? V[i] : e.tooltip, I = v || !!e.loading, z = /* @__PURE__ */ o(P, {
38
+ locale: i,
39
+ dataTest: e.dataTest ?? `${f}-${w}`,
40
+ variant: e.variant ?? r,
38
41
  error: e.tone === "danger",
39
42
  size: "medium",
40
43
  type: e.type ?? "button",
41
- disabled: !!e.disabled || !!e.loading,
44
+ disabled: v && !!A,
45
+ "aria-disabled": I || void 0,
46
+ disabledReason: A,
47
+ loading: !!e.loading,
42
48
  startIcon: e.icon,
43
- endIcon: e.loading ? /* @__PURE__ */ r($, {
44
- width: 20,
45
- height: 20
46
- }) : e.endIcon,
47
- onClick: e.onClick,
49
+ endIcon: e.endIcon,
50
+ onClick: I ? (F) => F.preventDefault() : e.onClick,
48
51
  "aria-label": e.ariaLabel,
49
- "aria-busy": e.loading,
50
52
  children: e.label
51
53
  });
52
- return e.tooltip ? /* @__PURE__ */ r(z, {
54
+ return /* @__PURE__ */ o(K, {
53
55
  arrow: !0,
54
56
  title: e.tooltip,
55
- children: /* @__PURE__ */ r("span", {
57
+ open: v || !e.tooltip ? !1 : void 0,
58
+ children: /* @__PURE__ */ o("span", {
56
59
  className: "inline-flex",
57
- children: T
60
+ children: z
58
61
  })
59
- }) : T;
62
+ });
60
63
  };
61
- return /* @__PURE__ */ o("div", {
62
- ref: P,
63
- "data-testid": c,
64
- className: L("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", g ? "gap-2 p-2" : "gap-4 p-4", I && "rounded-b-lg", k && "sticky bottom-0 z-[1]", A),
65
- children: [/* @__PURE__ */ r("div", {
64
+ return /* @__PURE__ */ d("div", {
65
+ ref: L,
66
+ "data-testid": f,
67
+ className: j("flex items-center justify-end self-stretch border-0 border-t border-solid border-delta-200 bg-white", y ? "gap-2 p-2" : "gap-4 p-4", W && "rounded-b-lg", E && "sticky bottom-0 z-[1]", S),
68
+ children: [/* @__PURE__ */ o("div", {
66
69
  className: "flex shrink-0 flex-nowrap items-center gap-2",
67
- children: a ?? /* @__PURE__ */ o(C, { children: [u.inlineActions.map(({ action: e, showLabel: i }) => /* @__PURE__ */ r("span", {
68
- ref: f(O(e.id, i)),
70
+ children: n ?? /* @__PURE__ */ d(_, { children: [s.inlineActions.map(({ action: e, showLabel: r }) => /* @__PURE__ */ o("span", {
71
+ ref: u(k(e.id, r)),
69
72
  className: "inline-flex shrink-0",
70
- children: /* @__PURE__ */ r(D, {
73
+ children: /* @__PURE__ */ o(Z, {
71
74
  action: e,
72
- showLabel: i
75
+ showLabel: r,
76
+ inProgressLabel: p.inProgress
73
77
  })
74
- }, e.id)), u.showMoreMenu && /* @__PURE__ */ o(C, { children: [/* @__PURE__ */ r("span", {
75
- ref: f(M),
78
+ }, e.id)), s.showMoreMenu && /* @__PURE__ */ d(_, { children: [/* @__PURE__ */ o("span", {
79
+ ref: u(O),
76
80
  className: "inline-flex shrink-0",
77
- children: /* @__PURE__ */ r(w, {
78
- dataTest: `${c}-more`,
81
+ children: /* @__PURE__ */ o(P, {
82
+ locale: i,
83
+ dataTest: `${f}-more`,
79
84
  variant: "outlined",
80
85
  size: "medium",
81
86
  type: "button",
82
- onClick: (e) => p(e.currentTarget),
83
- "aria-label": E.more,
87
+ onClick: (e) => x(e.currentTarget),
88
+ "aria-label": p.more,
84
89
  "aria-haspopup": "menu",
85
- "aria-expanded": h != null,
86
- startIcon: /* @__PURE__ */ r(S, {
90
+ "aria-expanded": g != null,
91
+ startIcon: /* @__PURE__ */ o(U, {
87
92
  width: 24,
88
93
  height: 24
89
94
  })
90
95
  })
91
- }), /* @__PURE__ */ r(F, {
92
- anchorEl: h,
93
- open: h != null,
94
- onClose: () => p(null),
96
+ }), /* @__PURE__ */ o(X, {
97
+ anchorEl: g,
98
+ open: g != null,
99
+ onClose: () => x(null),
95
100
  anchorOrigin: {
96
101
  vertical: "top",
97
102
  horizontal: "left"
@@ -100,27 +105,27 @@ function me({ leftActions: l = [], leadingSlot: a, secondaryAction: s, primaryAc
100
105
  vertical: "bottom",
101
106
  horizontal: "left"
102
107
  },
103
- children: u.overflowActions.map((e) => /* @__PURE__ */ r(j, {
104
- disabled: e.disabled,
108
+ children: s.overflowActions.map((e) => /* @__PURE__ */ o(Y, {
109
+ ...ee(e, p.inProgress),
105
110
  onClick: () => {
106
- p(null), e.onClick();
111
+ x(null), e.onClick();
107
112
  },
108
- children: /* @__PURE__ */ r("span", {
113
+ children: /* @__PURE__ */ o("span", {
109
114
  className: e.tone === "danger" ? "text-beta-500" : "text-delta-700",
110
115
  children: e.label
111
116
  })
112
117
  }, e.id))
113
118
  })] })] })
114
- }), x && /* @__PURE__ */ r("span", {
119
+ }), T && /* @__PURE__ */ o("span", {
115
120
  className: "flex min-w-px flex-1 flex-nowrap items-center justify-end",
116
- children: /* @__PURE__ */ o("span", {
117
- ref: f(N),
121
+ children: /* @__PURE__ */ d("span", {
122
+ ref: u(M),
118
123
  className: "flex shrink-0 flex-nowrap items-center gap-2",
119
- children: [s && b(s, "outlined", "secondary"), d && b(d, "contained", "primary")]
124
+ children: [c && C(c, "outlined", "secondary"), m && C(m, "contained", "primary")]
120
125
  })
121
126
  })]
122
127
  });
123
128
  }
124
129
  export {
125
- me as StyledDialogFooter
130
+ Te as StyledDialogFooter
126
131
  };
@@ -1,28 +1,29 @@
1
1
  import { cn as h } from "../../../helpers/cn.js";
2
- import { DotsVerticalIcon as ae } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
3
- import { LoadingIcon as A } from "../../icons/loading-icon/LoadingIcon.js";
4
- import { CloseIcon as K } from "../../icons/close-icon/CloseIcon.js";
5
- import { MinimizeIcon as oe } from "../../icons/minimize-icon/MinimizeIcon.js";
6
- import { KeyboardCapslockIcon as se } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
7
- import { ArrowExpandIcon as ce } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
8
- import { ArrowShrinkIcon as me } from "../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
9
- import { firstTabbable as he } from "../../../helpers/focusable.js";
2
+ import { firstTabbable as me } from "../../../helpers/focusable.js";
10
3
  import { StyledTooltip as f } from "../../data-display/tooltip/StyledTooltip.js";
11
- import { StyledButton as l } from "../../inputs/button/StyledButton.js";
12
- import { useFocusTrap as fe } from "../../../hooks/useFocusTrap.hook.js";
13
- import { StyledMenu as ue } from "../../navigation/menu/StyledMenu.js";
14
- import { StyledMenuItem as ve } from "../../navigation/menu/StyledMenuItem.js";
15
- import H from "./MinimizableDialog.module.js";
16
- import { useToggleMenuVisibility as pe } from "../../../hooks/useToggleMenuVisibility.hook.js";
17
- import J from "clsx";
18
- import { useLayoutEffect as be, useRef as Q, useState as T } from "react";
19
- import { Fragment as M, jsx as e, jsxs as t } from "react/jsx-runtime";
20
- var Oe = ({ onCloseText: u = "", onMinimizeText: j = "", onExpandText: C = "", onFullScreenText: F = "", showCloseIcon: _ = !0, showMinimizeIcon: W = !0, showExpandIcon: X = !0, showFullScreenIcon: Y = !0, title: s, label: g, children: x, open: E, onClose: w, className: G = "", primaryButtonText: y, primaryButtonLoading: k = !1, secondaryButtonText: c, onPrimaryButtonClick: v, onSecondaryButtonClick: p, dataTest: S, actionNode: Z, extraActions: n, extraActionsText: m, btnContainerClassName: D, footerClassName: P, footerInfo: L, locale: r = "en", enableFullscreen: B = !0, fullScreenState: R, handleFullScreenState: q }) => {
21
- const [i, ee] = T(!1), [O, te] = T(!1), { open: ie, anchorEl: le, handleOpen: re, handleClose: ne } = pe(), b = Q(null), z = Q(null), d = R ?? O, a = d && !i;
22
- if (fe(E && a, b, w), be(() => {
23
- b.current?.toggleAttribute("inert", i), z.current?.toggleAttribute("inert", !i);
24
- }, [i]), !E) return null;
25
- const de = a ? {
4
+ import { DotsVerticalIcon as he } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
5
+ import { CloseIcon as P } from "../../icons/close-icon/CloseIcon.js";
6
+ import { MinimizeIcon as fe } from "../../icons/minimize-icon/MinimizeIcon.js";
7
+ import { KeyboardCapslockIcon as ue } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
8
+ import { ArrowExpandIcon as be } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
9
+ import { ArrowShrinkIcon as ve } from "../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
10
+ import { StyledButton as n } from "../../inputs/button/StyledButton.js";
11
+ import { useFocusTrap as pe } from "../../../hooks/useFocusTrap.hook.js";
12
+ import { StyledMenu as ge } from "../../navigation/menu/StyledMenu.js";
13
+ import { StyledMenuItem as xe } from "../../navigation/menu/StyledMenuItem.js";
14
+ import T from "./MinimizableDialog.module.js";
15
+ import { useToggleMenuVisibility as ye } from "../../../hooks/useToggleMenuVisibility.hook.js";
16
+ import H from "clsx";
17
+ import { useLayoutEffect as ke, useRef as J, useState as Q } from "react";
18
+ import { Fragment as v, jsx as e, jsxs as l } from "react/jsx-runtime";
19
+ var $e = ({ onCloseText: u = "", onMinimizeText: N = "", onExpandText: I = "", onFullScreenText: C = "", showCloseIcon: M = !0, showMinimizeIcon: X = !0, showExpandIcon: Y = !0, showFullScreenIcon: Z = !0, title: c, label: p, children: g, open: j, onClose: L, className: R = "", primaryButtonText: S, primaryButtonLoading: r = !1, primaryButtonDisabled: B, primaryButtonDisabledReason: ee, secondaryButtonText: x, onPrimaryButtonClick: F, onSecondaryButtonClick: _, dataTest: E, actionNode: te, extraActions: d, extraActionsText: m, btnContainerClassName: G, footerClassName: ie, footerInfo: D, locale: t = "en", enableFullscreen: le = !0, fullScreenState: V, handleFullScreenState: q }) => {
20
+ const [i, ne] = Q(!1), [O, re] = Q(!1), { open: de, anchorEl: ae, handleOpen: oe, handleClose: se } = ye(), b = J(null), y = J(null), k = t === "en" ? "Wait until saved" : "Vent til lagringen er ferdig", w = () => {
21
+ r || L();
22
+ }, a = V ?? O, o = a && !i;
23
+ if (pe(j && o, b, w), ke(() => {
24
+ b.current?.toggleAttribute("inert", i), y.current?.toggleAttribute("inert", !i);
25
+ }, [i]), !j) return null;
26
+ const ce = o ? {
26
27
  right: "auto",
27
28
  bottom: "auto",
28
29
  left: "50%",
@@ -30,51 +31,69 @@ var Oe = ({ onCloseText: u = "", onMinimizeText: j = "", onExpandText: C = "", o
30
31
  transform: "translate(-50%, -50%)",
31
32
  width: "min(1000px, calc(100vw - 32px))",
32
33
  height: "95dvh"
33
- } : void 0, U = d ? r === "en" ? "Exit full screen" : "Avslutt fullskjerm" : r === "en" ? "Full screen" : "Fullskjerm", N = y ?? k, V = N || c, $ = () => {
34
- const o = i ? b : z;
35
- ee(!i), requestAnimationFrame(() => {
36
- const I = o.current;
37
- I && (I.querySelector('[data-testid="minimize-button"]') ?? he(I))?.focus({ preventScroll: !0 });
34
+ } : void 0, U = a ? t === "en" ? "Exit full screen" : "Avslutt fullskjerm" : t === "en" ? "Full screen" : "Fullskjerm", W = S ?? r, $ = W || x, A = /* @__PURE__ */ l(v, { children: [x && _ && /* @__PURE__ */ e(n, {
35
+ dataTest: "cancel-button",
36
+ variant: "outlined",
37
+ disabled: r,
38
+ disabledReason: k,
39
+ onClick: _,
40
+ children: x
41
+ }), W && F && /* @__PURE__ */ e(n, {
42
+ dataTest: "save-button",
43
+ loading: r,
44
+ locale: t,
45
+ disabled: B,
46
+ disabledReason: ee,
47
+ onClick: F,
48
+ children: S
49
+ })] }), K = () => {
50
+ const s = i ? b : y;
51
+ ne(!i), requestAnimationFrame(() => {
52
+ const z = s.current;
53
+ z && (z.querySelector('[data-testid="minimize-button"]') ?? me(z))?.focus({ preventScroll: !0 });
38
54
  });
39
55
  };
40
- return /* @__PURE__ */ t(M, { children: [
41
- a && /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[51] bg-[rgb(98,110,126)] bg-opacity-70" }),
56
+ return /* @__PURE__ */ l(v, { children: [
57
+ o && /* @__PURE__ */ e("div", { className: "fixed inset-0 z-[51] bg-[rgb(98,110,126)] bg-opacity-70" }),
42
58
  /* @__PURE__ */ e("div", {
43
- ref: z,
59
+ ref: y,
44
60
  style: { zIndex: 51 },
45
- className: h(H.dialog, !i && H.hidden),
46
- children: /* @__PURE__ */ t("div", {
47
- className: J("flex items-center justify-between", !i && "hidden"),
48
- "data-testid": S,
61
+ className: h(T.dialog, !i && T.hidden),
62
+ children: /* @__PURE__ */ l("div", {
63
+ className: H("flex items-center justify-between", !i && "hidden"),
64
+ "data-testid": E,
49
65
  children: [/* @__PURE__ */ e("div", {
50
66
  className: "truncate text-lg font-semibold text-delta-800",
51
- children: s
52
- }), /* @__PURE__ */ t("div", {
67
+ children: c
68
+ }), /* @__PURE__ */ l("div", {
53
69
  className: "flex items-center gap-x-1",
54
- children: [X && /* @__PURE__ */ e(f, {
55
- title: r === "en" ? "Expand" : "Utvid",
56
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(l, {
70
+ children: [Y && /* @__PURE__ */ e(f, {
71
+ title: t === "en" ? "Expand" : "Utvid",
72
+ children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n, {
57
73
  dataTest: "minimize-button",
58
- "aria-label": C ? void 0 : r === "en" ? "Expand" : "Utvid",
74
+ "aria-label": I ? void 0 : t === "en" ? "Expand" : "Utvid",
59
75
  variant: "text",
60
76
  size: "small",
61
- onClick: $,
62
- endIcon: /* @__PURE__ */ e(se, {
77
+ onClick: K,
78
+ endIcon: /* @__PURE__ */ e(ue, {
63
79
  height: 20,
64
80
  width: 20,
65
81
  color: "text-gama-500"
66
82
  }),
67
- children: C
83
+ children: I
68
84
  }) })
69
- }), _ && /* @__PURE__ */ e(f, {
70
- title: r === "en" ? "Close" : "Lukk",
71
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(l, {
85
+ }), M && /* @__PURE__ */ e(f, {
86
+ title: t === "en" ? "Close" : "Lukk",
87
+ open: r ? !1 : void 0,
88
+ children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n, {
72
89
  dataTest: "close-button",
73
- "aria-label": u ? void 0 : r === "en" ? "Close" : "Lukk",
90
+ "aria-label": u ? void 0 : t === "en" ? "Close" : "Lukk",
74
91
  variant: "textGray",
75
92
  size: "small",
93
+ disabled: r,
94
+ disabledReason: k,
76
95
  onClick: w,
77
- endIcon: /* @__PURE__ */ e(K, {
96
+ endIcon: /* @__PURE__ */ e(P, {
78
97
  height: 20,
79
98
  width: 20,
80
99
  color: "text-delta-700"
@@ -85,75 +104,78 @@ var Oe = ({ onCloseText: u = "", onMinimizeText: j = "", onExpandText: C = "", o
85
104
  })]
86
105
  })
87
106
  }),
88
- /* @__PURE__ */ t("div", {
107
+ /* @__PURE__ */ l("div", {
89
108
  ref: b,
90
- style: de,
91
- role: a ? "dialog" : void 0,
92
- "aria-modal": a ? !0 : void 0,
93
- "aria-label": a && typeof s == "string" ? s : void 0,
94
- 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", G && !i && !d ? G : "", i && "!h-0 !w-0 opacity-0 duration-0", a && "fixed duration-0"),
95
- "data-testid": S,
96
- children: [/* @__PURE__ */ t("div", {
109
+ style: ce,
110
+ role: o ? "dialog" : void 0,
111
+ "aria-modal": o ? !0 : void 0,
112
+ "aria-label": o && typeof c == "string" ? c : void 0,
113
+ 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", R && !i && !a ? R : "", i && "!h-0 !w-0 opacity-0 duration-0", o && "fixed duration-0"),
114
+ "data-testid": E,
115
+ children: [/* @__PURE__ */ l("div", {
97
116
  className: "flex flex-col gap-y-2 border-b-[1px] border-delta-200 p-4",
98
- children: [/* @__PURE__ */ t("div", {
117
+ children: [/* @__PURE__ */ l("div", {
99
118
  className: "flex items-center justify-between",
100
- children: [g ? /* @__PURE__ */ e("div", {
119
+ children: [p ? /* @__PURE__ */ e("div", {
101
120
  className: "text-sm text-delta-700",
102
- children: g
121
+ children: p
103
122
  }) : /* @__PURE__ */ e("div", {
104
123
  className: "text-2xl font-semibold text-delta-800",
105
- children: s
106
- }), /* @__PURE__ */ t("div", {
124
+ children: c
125
+ }), /* @__PURE__ */ l("div", {
107
126
  className: "flex items-center gap-x-1",
108
127
  children: [
109
- Z,
110
- W && !d && /* @__PURE__ */ e(f, {
111
- title: r === "en" ? "Minimize" : "Minimer",
112
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(l, {
128
+ te,
129
+ X && !a && /* @__PURE__ */ e(f, {
130
+ title: t === "en" ? "Minimize" : "Minimer",
131
+ children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n, {
113
132
  dataTest: "minimize-button",
114
- "aria-label": j ? void 0 : r === "en" ? "Minimize" : "Minimer",
133
+ "aria-label": N ? void 0 : t === "en" ? "Minimize" : "Minimer",
115
134
  variant: "textGray",
116
135
  size: "small",
117
- onClick: $,
118
- endIcon: /* @__PURE__ */ e(oe, {
136
+ onClick: K,
137
+ endIcon: /* @__PURE__ */ e(fe, {
119
138
  height: 20,
120
139
  width: 20,
121
140
  color: "text-delta-700"
122
141
  }),
123
- children: j
142
+ children: N
124
143
  }) })
125
144
  }),
126
- B && Y && /* @__PURE__ */ e(f, {
145
+ le && Z && /* @__PURE__ */ e(f, {
127
146
  title: U,
128
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(l, {
147
+ children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n, {
129
148
  dataTest: "fullscreen-button",
130
- "aria-label": F ? void 0 : U,
149
+ "aria-label": C ? void 0 : U,
131
150
  variant: "textGray",
132
151
  size: "small",
133
152
  onClick: () => {
134
- R !== void 0 && q ? q() : te(!O);
153
+ V !== void 0 && q ? q() : re(!O);
135
154
  },
136
- endIcon: d ? /* @__PURE__ */ e(me, {
155
+ endIcon: a ? /* @__PURE__ */ e(ve, {
137
156
  width: 20,
138
157
  height: 20,
139
158
  color: "text-delta-700"
140
- }) : /* @__PURE__ */ e(ce, {
159
+ }) : /* @__PURE__ */ e(be, {
141
160
  width: 20,
142
161
  height: 20,
143
162
  color: "text-delta-700"
144
163
  }),
145
- children: F
164
+ children: C
146
165
  }) })
147
166
  }),
148
- _ && /* @__PURE__ */ e(f, {
149
- title: r === "en" ? "Close" : "Lukk",
150
- children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(l, {
167
+ M && /* @__PURE__ */ e(f, {
168
+ title: t === "en" ? "Close" : "Lukk",
169
+ open: r ? !1 : void 0,
170
+ children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(n, {
151
171
  dataTest: "close-button",
152
- "aria-label": u ? void 0 : r === "en" ? "Close" : "Lukk",
172
+ "aria-label": u ? void 0 : t === "en" ? "Close" : "Lukk",
153
173
  variant: "textGray",
154
174
  size: "small",
175
+ disabled: r,
176
+ disabledReason: k,
155
177
  onClick: w,
156
- endIcon: /* @__PURE__ */ e(K, {
178
+ endIcon: /* @__PURE__ */ e(P, {
157
179
  height: 20,
158
180
  width: 20,
159
181
  color: "text-delta-700"
@@ -163,83 +185,57 @@ var Oe = ({ onCloseText: u = "", onMinimizeText: j = "", onExpandText: C = "", o
163
185
  })
164
186
  ]
165
187
  })]
166
- }), g && /* @__PURE__ */ e("div", {
188
+ }), p && /* @__PURE__ */ e("div", {
167
189
  className: "truncate text-2xl font-semibold text-delta-800",
168
- children: s
190
+ children: c
169
191
  })]
170
- }), /* @__PURE__ */ t("div", {
171
- className: J("flex flex-col", d && !i && "h-[87dvh]"),
192
+ }), /* @__PURE__ */ l("div", {
193
+ className: H("flex flex-col", a && !i && "h-[87dvh]"),
172
194
  children: [/* @__PURE__ */ e("div", {
173
195
  className: "flex-grow overflow-y-auto overscroll-contain",
174
- children: typeof x == "function" ? x({ fullScreen: d }) : x
175
- }), (Array.isArray(n) && n.length || typeof n == "function") && m || L ? /* @__PURE__ */ t("div", {
176
- className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", P),
196
+ children: typeof g == "function" ? g({ fullScreen: a }) : g
197
+ }), (Array.isArray(d) && d.length || typeof d == "function") && m || D ? /* @__PURE__ */ l("div", {
198
+ className: h("flex items-center justify-between border-0 border-t-[1px] border-solid border-delta-200 bg-white p-4", ie),
177
199
  children: [
178
- Array.isArray(n) && n.length && m ? /* @__PURE__ */ t(M, { children: [/* @__PURE__ */ e(l, {
200
+ Array.isArray(d) && d.length && m ? /* @__PURE__ */ l(v, { children: [/* @__PURE__ */ e(n, {
179
201
  dataTest: "extra-actions-button",
180
202
  variant: "textGray",
181
- startIcon: /* @__PURE__ */ e(ae, {
203
+ startIcon: /* @__PURE__ */ e(he, {
182
204
  width: 24,
183
205
  height: 24
184
206
  }),
185
- onClick: re,
207
+ onClick: oe,
186
208
  children: m
187
- }), /* @__PURE__ */ e(ue, {
188
- open: ie,
189
- anchorEl: le,
190
- onClose: ne,
191
- children: n.map((o) => /* @__PURE__ */ e(ve, {
192
- className: o.className,
193
- onClick: o.onClick,
194
- children: o.label
195
- }, o.label))
196
- })] }) : m && typeof n == "function" && /* @__PURE__ */ e(l, {
209
+ }), /* @__PURE__ */ e(ge, {
210
+ open: de,
211
+ anchorEl: ae,
212
+ onClose: se,
213
+ children: d.map((s) => /* @__PURE__ */ e(xe, {
214
+ className: s.className,
215
+ onClick: s.onClick,
216
+ children: s.label
217
+ }, s.label))
218
+ })] }) : m && typeof d == "function" && /* @__PURE__ */ e(n, {
197
219
  dataTest: "extra-action-button",
198
220
  variant: "text",
199
- onClick: n,
221
+ onClick: d,
200
222
  children: m
201
223
  }),
202
224
  " ",
203
- L,
204
- V ? /* @__PURE__ */ t("div", {
205
- className: h("flex justify-end gap-x-2", D),
206
- children: [c && p && /* @__PURE__ */ e(l, {
207
- dataTest: "cancel-button",
208
- variant: "outlined",
209
- onClick: p,
210
- children: c
211
- }), N && v && /* @__PURE__ */ e(l, {
212
- dataTest: "save-button",
213
- startIcon: k && /* @__PURE__ */ e(A, {
214
- width: 24,
215
- height: 24
216
- }),
217
- onClick: v,
218
- children: y
219
- })]
225
+ D,
226
+ $ ? /* @__PURE__ */ e("div", {
227
+ className: h("flex justify-end gap-x-2", G),
228
+ children: A
220
229
  }) : null
221
230
  ]
222
- }) : /* @__PURE__ */ e(M, { children: V ? /* @__PURE__ */ t("div", {
223
- className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", D),
224
- children: [c && p && /* @__PURE__ */ e(l, {
225
- dataTest: "cancel-button",
226
- variant: "outlined",
227
- onClick: p,
228
- children: c
229
- }), N && v && /* @__PURE__ */ e(l, {
230
- dataTest: "save-button",
231
- startIcon: k && /* @__PURE__ */ e(A, {
232
- width: 24,
233
- height: 24
234
- }),
235
- onClick: v,
236
- children: y
237
- })]
231
+ }) : /* @__PURE__ */ e(v, { children: $ ? /* @__PURE__ */ e("div", {
232
+ className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", G),
233
+ children: A
238
234
  }) : null })]
239
235
  })]
240
236
  })
241
237
  ] });
242
238
  };
243
239
  export {
244
- Oe as MinimizableDialog
240
+ $e as MinimizableDialog
245
241
  };
@@ -1,19 +1,22 @@
1
- import { CloseIcon as i } from "../../../icons/close-icon/CloseIcon.js";
2
1
  import { StyledTooltip as n } from "../../../data-display/tooltip/StyledTooltip.js";
3
- import { StyledButton as a } from "../../../inputs/button/StyledButton.js";
2
+ import { CloseIcon as a } from "../../../icons/close-icon/CloseIcon.js";
3
+ import { StyledButton as m } from "../../../inputs/button/StyledButton.js";
4
4
  import "react";
5
5
  import { jsx as t } from "react/jsx-runtime";
6
- var h = ({ showCloseIcon: e, tooltipTitle: r, onClick: o, buttonRef: l }) => e ? /* @__PURE__ */ t(n, {
6
+ var u = ({ showCloseIcon: e, tooltipTitle: r, onClick: l, buttonRef: i, disabledReason: o }) => e ? /* @__PURE__ */ t(n, {
7
7
  title: r,
8
8
  placement: "top",
9
- children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(a, {
9
+ open: o ? !1 : void 0,
10
+ children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(m, {
10
11
  dataTest: "close-button",
11
- refLink: l,
12
+ refLink: i,
12
13
  "aria-label": r,
13
14
  variant: "textGray",
14
15
  size: "small",
15
- onClick: o,
16
- endIcon: /* @__PURE__ */ t(i, {
16
+ disabled: !!o,
17
+ disabledReason: o,
18
+ onClick: l,
19
+ endIcon: /* @__PURE__ */ t(a, {
17
20
  height: 20,
18
21
  width: 20,
19
22
  color: "text-delta-700"
@@ -21,5 +24,5 @@ var h = ({ showCloseIcon: e, tooltipTitle: r, onClick: o, buttonRef: l }) => e ?
21
24
  }) })
22
25
  }) : null;
23
26
  export {
24
- h as CloseBtn
27
+ u as CloseBtn
25
28
  };