asma-ui-core 3.116.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.
@@ -1,36 +1,36 @@
1
1
  import { cn as h } from "../../../helpers/cn.js";
2
- import { firstTabbable as me } from "../../../helpers/focusable.js";
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 fe } from "../../icons/dots-vertical-icon/DotsVerticalIcon.js";
5
- import { CloseIcon as K } from "../../icons/close-icon/CloseIcon.js";
6
- import { MinimizeIcon as he } from "../../icons/minimize-icon/MinimizeIcon.js";
7
- import { KeyboardCapslockIcon as ue } from "../../icons/keyboard-capslock-icon/KeyboardCapslockIcon.js";
8
- import { ArrowExpandIcon as ve } from "../../icons/arrow-expand-icon/ArrowExpandIcon.js";
9
- import { ArrowShrinkIcon as be } from "../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
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 pe, isOverlayBackNavigationPending as ge, useBackCloses as xe } from "../../../hooks/useBackCloses.hook.js";
12
- import { useFocusTrap as ke } from "../../../hooks/useFocusTrap.hook.js";
13
- import { StyledMenu as ye } from "../../navigation/menu/StyledMenu.js";
14
- import { StyledMenuItem as we } from "../../navigation/menu/StyledMenuItem.js";
15
- import { fullScreenFieldWidthVars as ze } from "../../inputs/field-styles.js";
16
- import T from "./MinimizableDialog.module.js";
17
- import { useToggleMenuVisibility as Ne } from "../../../hooks/useToggleMenuVisibility.hook.js";
18
- import H from "clsx";
19
- import { useLayoutEffect as Ce, useRef as J, useState as Q } from "react";
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 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 = () => {
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
- L();
25
- }, o = O ?? V, a = o && !i;
26
- if (ke(k && a, s, b), xe({
27
- active: k && !i,
28
- requestClose: () => !a && ge() ? !1 : b(),
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
- }), Ce(() => {
31
- s.current?.toggleAttribute("inert", i), w.current?.toggleAttribute("inert", !i);
32
- }, [i]), !k) return null;
33
- const ce = a ? {
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
- ...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
+ ...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
- }), W && F && /* @__PURE__ */ e(r, {
49
+ }), $ && _ && /* @__PURE__ */ e(r, {
50
50
  dataTest: "save-button",
51
51
  loading: n,
52
- locale: t,
53
- disabled: B,
54
- disabledReason: ee,
55
- onClick: F,
52
+ locale: i,
53
+ disabled: ie,
54
+ disabledReason: te,
55
+ onClick: _,
56
56
  children: S
57
- })] }), A = () => {
58
- const c = i ? s : w;
59
- re(!i), requestAnimationFrame(() => {
60
- const N = c.current;
61
- N && (N.querySelector('[data-testid="minimize-button"]') ?? me(N))?.focus({ preventScroll: !0 });
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(T.dialog, !i && T.hidden),
69
+ className: h(J.dialog, !t && J.hidden),
70
70
  children: /* @__PURE__ */ l("div", {
71
- className: H("flex items-center justify-between", !i && "hidden"),
72
- "data-testid": q,
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: [Y && /* @__PURE__ */ e(u, {
79
- title: t === "en" ? "Expand" : "Utvid",
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": I ? void 0 : t === "en" ? "Expand" : "Utvid",
82
+ "aria-label": M ? void 0 : i === "en" ? "Expand" : "Utvid",
83
83
  variant: "text",
84
84
  size: "small",
85
- onClick: A,
86
- endIcon: /* @__PURE__ */ e(ue, {
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: I
91
+ children: M
92
92
  }) })
93
- }), R && /* @__PURE__ */ e(u, {
94
- title: t === "en" ? "Close" : "Lukk",
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 : t === "en" ? "Close" : "Lukk",
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(K, {
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: ce,
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", j && !i && !o ? j : "", i && "!h-0 !w-0 opacity-0 duration-0", a && "fixed duration-0"),
122
- "data-testid": q,
123
- children: /* @__PURE__ */ l(pe.Provider, {
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
- te,
139
- X && !o && /* @__PURE__ */ e(u, {
140
- title: t === "en" ? "Minimize" : "Minimer",
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": C ? void 0 : t === "en" ? "Minimize" : "Minimer",
143
+ "aria-label": I ? void 0 : i === "en" ? "Minimize" : "Minimer",
144
144
  variant: "textGray",
145
145
  size: "small",
146
- onClick: A,
147
- endIcon: /* @__PURE__ */ e(he, {
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: C
152
+ children: I
153
153
  }) })
154
154
  }),
155
- le && Z && /* @__PURE__ */ e(u, {
156
- title: P,
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": M ? void 0 : P,
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
- O !== void 0 && D ? D() : ne(!V);
166
+ V !== void 0 && P ? P(!o) : ae(!W);
164
167
  },
165
- endIcon: o ? /* @__PURE__ */ e(be, {
168
+ endIcon: o ? /* @__PURE__ */ e(ge, {
166
169
  width: 20,
167
170
  height: 20,
168
171
  color: "text-delta-700"
169
- }) : /* @__PURE__ */ e(ve, {
172
+ }) : /* @__PURE__ */ e(pe, {
170
173
  width: 20,
171
174
  height: 20,
172
175
  color: "text-delta-700"
173
176
  }),
174
- children: M
177
+ children: R
175
178
  }) })
176
179
  }),
177
- R && /* @__PURE__ */ e(u, {
178
- title: t === "en" ? "Close" : "Lukk",
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 : t === "en" ? "Close" : "Lukk",
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(K, {
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: H("flex flex-col", o && !i && "h-[87dvh]"),
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 || 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),
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(fe, {
216
+ startIcon: /* @__PURE__ */ e(ue, {
214
217
  width: 24,
215
218
  height: 24
216
219
  }),
217
- onClick: oe,
220
+ onClick: ce,
218
221
  children: f
219
- }), /* @__PURE__ */ e(ye, {
220
- open: de,
221
- anchorEl: ae,
222
- onClose: se,
223
- children: d.map((c) => /* @__PURE__ */ e(we, {
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
- G,
236
- U ? /* @__PURE__ */ e("div", {
237
- className: h("flex justify-end gap-x-2", E),
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: U ? /* @__PURE__ */ e("div", {
242
- className: h("flex justify-end gap-x-2 border-t-[1px] border-delta-200 p-4", E),
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
- Qe as MinimizableDialog
254
+ Ye as MinimizableDialog
252
255
  };
@@ -1,21 +1,24 @@
1
- import { StyledTooltip as i } from "../../../data-display/tooltip/StyledTooltip.js";
2
- import { ArrowExpandIcon as n } from "../../../icons/arrow-expand-icon/ArrowExpandIcon.js";
3
- import { ArrowShrinkIcon as a } from "../../../icons/arrow-shrink-icon/ArrowShrinkIcon.js";
4
- import { StyledButton as d } from "../../../inputs/button/StyledButton.js";
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 u = ({ fullScreen: e, showFullScreenIcon: o, tooltipTitle: t, onClick: l }) => o ? /* @__PURE__ */ r(i, {
7
- title: t,
8
- children: /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(d, {
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": t,
11
+ "aria-label": o,
11
12
  variant: "textGray",
12
13
  size: "small",
13
- onClick: l,
14
- endIcon: e ? /* @__PURE__ */ r(a, {
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(n, {
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
- u as FullScreenBtn
29
+ x as FullScreenBtn
27
30
  };