asma-ui-core 3.87.4 → 3.88.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,18 +1,19 @@
1
- import { CloseIcon as l } from "../../../icons/close-icon/CloseIcon.js";
2
- import { StyledTooltip as i } from "../../../data-display/tooltip/StyledTooltip.js";
1
+ import { CloseIcon as i } from "../../../icons/close-icon/CloseIcon.js";
2
+ import { StyledTooltip as n } from "../../../data-display/tooltip/StyledTooltip.js";
3
3
  import { StyledButton as a } from "../../../inputs/button/StyledButton.js";
4
4
  import "react";
5
5
  import { jsx as t } from "react/jsx-runtime";
6
- var f = ({ showCloseIcon: e, tooltipTitle: r, onClick: o }) => e ? /* @__PURE__ */ t(i, {
6
+ var h = ({ showCloseIcon: e, tooltipTitle: r, onClick: o, buttonRef: l }) => e ? /* @__PURE__ */ t(n, {
7
7
  title: r,
8
8
  placement: "top",
9
9
  children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(a, {
10
10
  dataTest: "close-button",
11
+ refLink: l,
11
12
  "aria-label": r,
12
13
  variant: "textGray",
13
14
  size: "small",
14
15
  onClick: o,
15
- endIcon: /* @__PURE__ */ t(l, {
16
+ endIcon: /* @__PURE__ */ t(i, {
16
17
  height: 20,
17
18
  width: 20,
18
19
  color: "text-delta-700"
@@ -20,5 +21,5 @@ var f = ({ showCloseIcon: e, tooltipTitle: r, onClick: o }) => e ? /* @__PURE__
20
21
  }) })
21
22
  }) : null;
22
23
  export {
23
- f as CloseBtn
24
+ h as CloseBtn
24
25
  };
@@ -1,37 +1,46 @@
1
- import { cn as s } from "../../../../helpers/cn.js";
2
- import { firstTabbable as q } from "../../../../helpers/focusable.js";
3
- import { StyledTooltip as E } from "../../../data-display/tooltip/StyledTooltip.js";
4
- import { useMobileMediaQuery as P } from "../../../../hooks/useMediaQuery.hook.js";
5
- import { useFocusTrap as V } from "../../../../hooks/useFocusTrap.hook.js";
6
- import { CloseBtn as w } from "../components/CloseBtn.js";
7
- import { MinimizeBtn as C } from "../components/MinimizeBtn.js";
8
- import { FullScreenBtn as W } from "../components/FullscreenBtn.js";
9
- import c from "./MinimizableDialogV2.module.js";
10
- import { useTranslations as _ } from "./useTranslations.js";
11
- import { useControlledProps as $ } from "./useControlledProps.js";
12
- import H from "clsx";
13
- import { useLayoutEffect as L, useRef as F } from "react";
14
- import { Fragment as O, jsx as e, jsxs as o } from "react/jsx-runtime";
15
- var ae = (h) => {
16
- const { showCloseIcon: v = !0, showMinimizeIcon: S = !0, showExpandIcon: T = !0, enableFullscreen: M = !0, title: n, label: d, children: k, open: g, onClose: I, classNameOverrides: f = {
1
+ import { cn as a } from "../../../../helpers/cn.js";
2
+ import { firstTabbable as M } from "../../../../helpers/focusable.js";
3
+ import { StyledTooltip as $ } from "../../../data-display/tooltip/StyledTooltip.js";
4
+ import { useMobileMediaQuery as H } from "../../../../hooks/useMediaQuery.hook.js";
5
+ import { useFocusTrap as L } from "../../../../hooks/useFocusTrap.hook.js";
6
+ import { CloseBtn as k } from "../components/CloseBtn.js";
7
+ import { MinimizeBtn as B } from "../components/MinimizeBtn.js";
8
+ import { FullScreenBtn as Q } from "../components/FullscreenBtn.js";
9
+ import p from "./MinimizableDialogV2.module.js";
10
+ import { useTranslations as G } from "./useTranslations.js";
11
+ import { useControlledProps as J } from "./useControlledProps.js";
12
+ import K from "clsx";
13
+ import { useLayoutEffect as I, useRef as u } from "react";
14
+ import { Fragment as U, jsx as e, jsxs as n } from "react/jsx-runtime";
15
+ var ue = (g) => {
16
+ const { showCloseIcon: z = !0, showMinimizeIcon: j = !0, showExpandIcon: A = !0, enableFullscreen: D = !0, title: o, label: x, children: O, open: m, onClose: q, classNameOverrides: h = {
17
17
  maximized: "",
18
18
  minimized: "",
19
19
  fullscreen: ""
20
- }, dataTest: j, actionNode: A, locale: R = "en", style: b } = h, r = P(), a = _(R), m = F(null), p = F(null), { minimized: i, setMinimized: z, fullScreen: t, setFullScreen: y } = $(h), l = t && !i, u = () => {
21
- z(!1), I();
20
+ }, dataTest: E, actionNode: P, locale: V = "en", style: y, initialFocusRef: w } = g, r = H(), s = G(V), d = u(null), f = u(null), N = u(null), C = u(null), F = u(!1), { minimized: t, setMinimized: S, fullScreen: i, setFullScreen: R } = J(g), l = i && !t, v = () => {
21
+ S(!1), q();
22
22
  };
23
- L(() => {
24
- m.current?.toggleAttribute("inert", i), p.current?.toggleAttribute("inert", !i);
25
- }, [i]);
26
- const N = () => {
27
- const D = i ? m : p;
28
- z(!i), requestAnimationFrame(() => {
29
- const x = D.current;
30
- x && (x.querySelector('[data-testid="toggle-minimize-btn"]') ?? q(x))?.focus({ preventScroll: !0 });
23
+ I(() => {
24
+ d.current?.toggleAttribute("inert", t), f.current?.toggleAttribute("inert", !t);
25
+ }, [t]), I(() => {
26
+ const b = m && !F.current;
27
+ if (F.current = m, !b) return;
28
+ const c = t ? f.current : d.current, _ = t ? C.current : N.current;
29
+ (w?.current ?? _ ?? (c ? M(c) : void 0))?.focus({ preventScroll: !0 });
30
+ }, [
31
+ w,
32
+ t,
33
+ m
34
+ ]);
35
+ const T = () => {
36
+ const b = t ? d : f;
37
+ S(!t), requestAnimationFrame(() => {
38
+ const c = b.current;
39
+ c && (c.querySelector('[data-testid="toggle-minimize-btn"]') ?? M(c))?.focus({ preventScroll: !0 });
31
40
  });
32
41
  };
33
- V(g && l, m, u);
34
- const B = l ? r ? {
42
+ L(m && l, d, v);
43
+ const W = l ? r ? {
35
44
  inset: 0,
36
45
  maxHeight: "100dvh",
37
46
  maxWidth: "100dvw",
@@ -48,38 +57,39 @@ var ae = (h) => {
48
57
  maxWidth: "min(1000px, calc(100vw - 32px))",
49
58
  height: "95dvh"
50
59
  } : void 0;
51
- return g ? /* @__PURE__ */ o(O, { children: [
60
+ return m ? /* @__PURE__ */ n(U, { children: [
52
61
  /* @__PURE__ */ e("div", {
53
- ref: p,
62
+ ref: f,
54
63
  style: {
55
64
  zIndex: 51,
56
- ...b
65
+ ...y
57
66
  },
58
- className: s(c["minimized-dialog"], !i && c.hidden, f.minimized),
59
- children: /* @__PURE__ */ o("div", {
60
- className: H("flex items-center justify-between", !i && "hidden"),
61
- "data-testid": j,
67
+ className: a(p["minimized-dialog"], !t && p.hidden, h.minimized),
68
+ children: /* @__PURE__ */ n("div", {
69
+ className: K("flex items-center justify-between", !t && "hidden"),
70
+ "data-testid": E,
62
71
  children: [/* @__PURE__ */ e("div", {
63
72
  className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
64
- children: /* @__PURE__ */ e(E, {
65
- title: n,
73
+ children: /* @__PURE__ */ e($, {
74
+ title: o,
66
75
  placement: "top",
67
76
  children: /* @__PURE__ */ e("div", {
68
77
  className: "truncate",
69
- children: n
78
+ children: o
70
79
  })
71
80
  })
72
- }), /* @__PURE__ */ o("div", {
81
+ }), /* @__PURE__ */ n("div", {
73
82
  className: "flex items-center gap-x-1",
74
- children: [/* @__PURE__ */ e(C, {
83
+ children: [/* @__PURE__ */ e(B, {
75
84
  type: "expand",
76
- visibility: T,
77
- onClick: N,
78
- tooltipTitle: a.expand
79
- }), /* @__PURE__ */ e(w, {
80
- showCloseIcon: v,
81
- onClick: u,
82
- tooltipTitle: a.close
85
+ visibility: A,
86
+ onClick: T,
87
+ tooltipTitle: s.expand
88
+ }), /* @__PURE__ */ e(k, {
89
+ buttonRef: C,
90
+ showCloseIcon: z,
91
+ onClick: v,
92
+ tooltipTitle: s.close
83
93
  })]
84
94
  })]
85
95
  })
@@ -87,66 +97,67 @@ var ae = (h) => {
87
97
  l && /* @__PURE__ */ e("div", {
88
98
  className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
89
99
  onClick: () => {
90
- y(!1);
100
+ R(!1);
91
101
  }
92
102
  }),
93
- /* @__PURE__ */ o("div", {
103
+ /* @__PURE__ */ n("div", {
94
104
  style: {
95
105
  zIndex: 51,
96
- ...b,
97
- ...B
106
+ ...y,
107
+ ...W
98
108
  },
99
- ref: m,
109
+ ref: d,
100
110
  role: l ? "dialog" : void 0,
101
111
  "aria-modal": l ? !0 : void 0,
102
- "aria-label": l && typeof n == "string" ? n : void 0,
103
- className: s(c.dialog, i && c.hidden, !t && f.maximized, t && f.fullscreen, l && "fixed z-[53] duration-0"),
104
- children: [/* @__PURE__ */ o("div", {
105
- className: s("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
106
- children: [/* @__PURE__ */ o("div", {
112
+ "aria-label": l && typeof o == "string" ? o : void 0,
113
+ className: a(p.dialog, t && p.hidden, !i && h.maximized, i && h.fullscreen, l && "fixed z-[53] duration-0"),
114
+ children: [/* @__PURE__ */ n("div", {
115
+ className: a("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
116
+ children: [/* @__PURE__ */ n("div", {
107
117
  className: "flex items-center justify-between",
108
- children: [d ? /* @__PURE__ */ e("div", {
118
+ children: [x ? /* @__PURE__ */ e("div", {
109
119
  className: "text-sm text-delta-700",
110
- children: d
120
+ children: x
111
121
  }) : /* @__PURE__ */ e("div", {
112
- className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
113
- children: n
114
- }), /* @__PURE__ */ o("div", {
122
+ className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
123
+ children: o
124
+ }), /* @__PURE__ */ n("div", {
115
125
  className: "flex items-center gap-x-1",
116
126
  children: [
117
- A,
118
- /* @__PURE__ */ e(C, {
119
- visibility: S && !r && !t,
127
+ P,
128
+ /* @__PURE__ */ e(B, {
129
+ visibility: j && !r && !i,
120
130
  type: "minimize",
121
- onClick: N,
122
- tooltipTitle: a.minimize
131
+ onClick: T,
132
+ tooltipTitle: s.minimize
123
133
  }),
124
- /* @__PURE__ */ e(W, {
125
- showFullScreenIcon: M && !r,
126
- fullScreen: t,
134
+ /* @__PURE__ */ e(Q, {
135
+ showFullScreenIcon: D && !r,
136
+ fullScreen: i,
127
137
  onClick: () => {
128
- y(!t);
138
+ R(!i);
129
139
  },
130
- tooltipTitle: t ? a.exitFullscreen : a.fullscreen
140
+ tooltipTitle: i ? s.exitFullscreen : s.fullscreen
131
141
  }),
132
- /* @__PURE__ */ e(w, {
133
- showCloseIcon: v,
134
- onClick: u,
135
- tooltipTitle: a.close
142
+ /* @__PURE__ */ e(k, {
143
+ buttonRef: N,
144
+ showCloseIcon: z,
145
+ onClick: v,
146
+ tooltipTitle: s.close
136
147
  })
137
148
  ]
138
149
  })]
139
- }), d && /* @__PURE__ */ e("div", {
140
- className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
141
- children: n
150
+ }), x && /* @__PURE__ */ e("div", {
151
+ className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
152
+ children: o
142
153
  })]
143
154
  }), /* @__PURE__ */ e("div", {
144
- className: s(i && "hidden", "flex flex-grow flex-col overflow-y-auto"),
145
- children: k
155
+ className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto"),
156
+ children: O
146
157
  })]
147
158
  })
148
159
  ] }) : null;
149
160
  };
150
161
  export {
151
- ae as MinimizableDialogV2
162
+ ue as MinimizableDialogV2
152
163
  };
@@ -1,28 +1,28 @@
1
1
  import { useMemo as m, useState as D } from "react";
2
- function w(a, c) {
2
+ function w(i, c) {
3
3
  const o = c.trim();
4
4
  if (o.length === 0) return !0;
5
5
  const r = o.replace(/^\+/, "").replace(/\D/g, "");
6
- return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || a.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && a.dialCode.startsWith(r);
6
+ return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || i.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && i.dialCode.startsWith(r);
7
7
  }
8
- function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, onDismiss: b }) {
9
- const [p, s] = D(null), n = m(() => a.filter((e) => w(e, o)), [a, o]), i = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), k = (e) => `${r}-option-${e}`, g = (e) => {
8
+ function C({ countries: i, selectedIso2: c, query: o, listId: r, onSelect: b, onDismiss: v }) {
9
+ const [p, s] = D(null), n = m(() => i.filter((e) => w(e, o)), [i, o]), a = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), g = (e) => `${r}-option-${e}`, k = (e) => {
10
10
  const t = e === 1 ? n[0] : n[n.length - 1], l = n.find((d) => d.iso2 === c) ?? t;
11
11
  l !== void 0 && s(l.iso2);
12
12
  }, h = (e) => {
13
13
  if (n.length === 0) return;
14
- const t = n.findIndex((d) => d.iso2 === c), l = n[((i ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
14
+ const t = n.findIndex((d) => d.iso2 === c), l = n[((a ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
15
15
  l !== void 0 && s(l.iso2);
16
16
  }, u = (e, t = !0) => {
17
- t && s(null), v(e, t);
17
+ t && s(null), b(e, t);
18
18
  }, f = () => {
19
- s(null), b();
19
+ s(null), v();
20
20
  };
21
21
  return {
22
22
  visible: n,
23
- activeIndex: i,
24
- optionId: k,
25
- openWithKeyboard: g,
23
+ activeIndex: a,
24
+ optionId: g,
25
+ openWithKeyboard: k,
26
26
  select: u,
27
27
  dismiss: f,
28
28
  handleKeyDown: (e) => {
@@ -48,18 +48,18 @@ function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, on
48
48
  case " ": {
49
49
  if (o !== "") break;
50
50
  e.preventDefault();
51
- const t = i === null ? void 0 : n[i];
51
+ const t = a === null ? void 0 : n[a];
52
52
  t !== void 0 && u(t.iso2, !1);
53
53
  break;
54
54
  }
55
55
  case "Enter": {
56
56
  e.preventDefault();
57
- const t = i === null ? void 0 : n[i];
57
+ const t = a === null ? void 0 : n[a];
58
58
  t !== void 0 && u(t.iso2);
59
59
  break;
60
60
  }
61
61
  case "Escape":
62
- e.preventDefault(), f();
62
+ e.preventDefault(), e.stopPropagation(), f();
63
63
  break;
64
64
  case "Tab":
65
65
  f();
@@ -8,16 +8,16 @@ import { StyledCheckbox as ae } from "../checkbox/base-ui/StyledCheckbox.js";
8
8
  import { TOP_LAYER_PROPS as ot, TOP_LAYER_RESET_STYLE as nt, getOpenModalDialogAncestor as at, shouldUsePopoverTopLayer as it, useTopLayerRef as ct } from "../../../hooks/useTopLayer.hook.js";
9
9
  import { LoadingIcon as dt } from "../../../table/shared-components/LoadingIcon.js";
10
10
  import z from "./StyledSelectAutocomplete.module.js";
11
- import { useEffect as ie, useMemo as W, useRef as ce, useState as D } from "react";
11
+ import { useEffect as ie, useMemo as W, useRef as ce, useState as v } from "react";
12
12
  import { jsx as o, jsxs as I } from "react/jsx-runtime";
13
13
  import { FloatingPortal as ut, autoUpdate as pt, flip as ft, offset as mt, shift as ht, size as bt, useDismiss as gt, useFloating as xt, useInteractions as wt, useMergeRefs as de, useRole as yt } from "@floating-ui/react";
14
- var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), vt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
- function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: ve, allowSelectAll: T, selectAllLabel: De = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: $e, slotProps: q }) {
16
- const r = ve === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [Pe, Le] = D(!1), a = Y ?? Pe, u = (e) => {
14
+ var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Dt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
15
+ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: De, allowSelectAll: T, selectAllLabel: ve = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: Pe, slotProps: q }) {
16
+ const r = De === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [$e, Le] = v(!1), a = Y ?? $e, u = (e) => {
17
17
  e && (g || M) || (Y === void 0 && Le(e), e ? Ce?.() : (x(null), Me?.()));
18
- }, [Ee, G] = D(""), b = R ?? Ee, $ = (e, t, n) => {
18
+ }, [Ee, G] = v(""), b = R ?? Ee, P = (e, t, n) => {
19
19
  R === void 0 && G(t), Ne?.(e, t, n);
20
- }, [s, x] = D(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = D(null), [Z, Oe] = D(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
20
+ }, [s, x] = v(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = v(null), [Z, Oe] = v(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
21
21
  ie(() => {
22
22
  R !== void 0 || r || G(K);
23
23
  }, [
@@ -25,7 +25,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
25
25
  r,
26
26
  K
27
27
  ]);
28
- const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), P = (e) => $e?.(e) ?? vt(e), ee = W(() => {
28
+ const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), $ = (e) => Pe?.(e) ?? Dt(e), ee = W(() => {
29
29
  const e = [...p];
30
30
  if (_) return _(e, { inputValue: b });
31
31
  const t = !r && w !== null ? d(w).toLowerCase() : null;
@@ -37,7 +37,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
37
37
  b,
38
38
  _,
39
39
  A
40
- ]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => P(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
40
+ ]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => $(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
41
41
  ie(() => {
42
42
  if (!a) return;
43
43
  const e = s ?? k;
@@ -69,21 +69,21 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
69
69
  const n = c.indexOf(t ?? k);
70
70
  return n === -1 ? c[e === 1 ? 0 : c.length - 1] ?? null : c[Math.min(Math.max(n + e, 0), c.length - 1)] ?? null;
71
71
  });
72
- }, v = (e, t, n = !r || !we) => {
72
+ }, D = (e, t, n = !r || !we) => {
73
73
  if (r) {
74
74
  const m = i.some((h) => S(t, h)), y = m ? i.filter((h) => !S(t, h)) : [...i, t];
75
- N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), $(e, "", "reset"), n && u(!1);
75
+ N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), n && u(!1);
76
76
  } else
77
- N?.(e, t, "selectOption", { option: t }), $(e, d(t), "reset"), n && u(!1);
77
+ N?.(e, t, "selectOption", { option: t }), P(e, d(t), "reset"), n && u(!1);
78
78
  }, se = (e) => {
79
- N?.(e, r ? [] : null, "clear", void 0), $(e, "", "clear");
79
+ N?.(e, r ? [] : null, "clear", void 0), P(e, "", "clear");
80
80
  }, j = (e) => {
81
81
  const t = p.length > 0 && i.length === p.length;
82
82
  N?.(e, t ? [] : p, t ? "clear" : "selectOption", void 0);
83
83
  }, Ye = (e) => {
84
84
  if (e.key === "Backspace" && b === "" && oe) {
85
85
  const t = i[i.length - 1];
86
- r ? t !== void 0 && v(e, t, !1) : se(e);
86
+ r ? t !== void 0 && D(e, t, !1) : se(e);
87
87
  } else if (e.key === "Enter" && !a)
88
88
  e.preventDefault(), u(!0);
89
89
  else if (e.key === "Enter" && s === -1)
@@ -91,7 +91,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
91
91
  else if (e.key === "Enter" && s != null && f[s] != null) {
92
92
  e.preventDefault();
93
93
  const t = f[s];
94
- P(t) || v(e, t, !0);
94
+ $(t) || D(e, t, !0);
95
95
  } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
96
96
  if (e.preventDefault(), !a) {
97
97
  x(Be(e.key === "ArrowDown" ? 1 : -1)), u(!0);
@@ -105,8 +105,8 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
105
105
  else if (e.key === " " && s != null && f[s] != null) {
106
106
  e.preventDefault();
107
107
  const t = f[s];
108
- P(t) || v(e, t, !1);
109
- } else e.key === "Escape" ? (e.preventDefault(), u(!1)) : e.key === "Tab" && u(!1);
108
+ $(t) || D(e, t, !1);
109
+ } else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), u(!1)) : e.key === "Tab" && u(!1);
110
110
  }, oe = !xe && !g && !M && (r ? i.length > 0 : w !== null);
111
111
  let ne;
112
112
  a && s != null && (s === -1 || f[s] !== void 0) && (ne = s === -1 ? `${l}-select-all` : `${l}-option-${s}`);
@@ -117,7 +117,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
117
117
  label: d(e),
118
118
  readOnly: g,
119
119
  deleteButtonTabIndex: -1,
120
- onDelete: g ? void 0 : (n) => v(n, e)
120
+ onDelete: g ? void 0 : (n) => D(n, e)
121
121
  }, C ? C(e) : `${d(e)}-${t}`)) : void 0, Je = /* @__PURE__ */ I("span", {
122
122
  className: "flex items-center gap-1",
123
123
  children: [
@@ -168,7 +168,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
168
168
  helperText: be,
169
169
  value: b,
170
170
  onChange: (e) => {
171
- x(null), $(e, e.target.value, "input"), a || u(!0);
171
+ x(null), P(e, e.target.value, "input"), a || u(!0);
172
172
  },
173
173
  onKeyDown: Ye,
174
174
  slotProps: {
@@ -220,11 +220,11 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
220
220
  ]
221
221
  }, m);
222
222
  }, Ke = (e, t) => {
223
- const n = P(e), m = {
223
+ const n = $(e), m = {
224
224
  ...He({
225
225
  onMouseDown: (h) => h.preventDefault(),
226
226
  onClick: (h) => {
227
- n || v(h, e);
227
+ n || D(h, e);
228
228
  },
229
229
  onMouseMove: () => x(null)
230
230
  }),
@@ -289,7 +289,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
289
289
  }),
290
290
  /* @__PURE__ */ o("span", {
291
291
  className: "flex-1 truncate py-2",
292
- children: De
292
+ children: ve
293
293
  })
294
294
  ]
295
295
  }), B ? /* @__PURE__ */ o("li", {
@@ -5,44 +5,44 @@ import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js"
5
5
  import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
6
6
  import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
7
7
  import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
8
- import { useEffect as C, useState as a } from "react";
9
- import { Fragment as E, jsx as t, jsxs as w } from "react/jsx-runtime";
10
- var L = (m) => {
11
- const s = x(), [e, i] = a(null), [p, d] = a(!1), [f, c] = a(!1), u = (r) => {
12
- i(r.currentTarget), P(r, d);
8
+ import { useEffect as C, useState as s } from "react";
9
+ import { Fragment as D, jsx as t, jsxs as E } from "react/jsx-runtime";
10
+ var L = (p) => {
11
+ const i = x(), [e, c] = s(null), [m, d] = s(!1), [f, l] = s(!1), u = (r) => {
12
+ c(r.currentTarget), P(r, d);
13
13
  }, o = () => {
14
- c(!0), i(null);
14
+ l(!0), c(null);
15
15
  };
16
16
  C(() => {
17
17
  if (!e) return;
18
- const r = (l) => {
19
- document.activeElement === e && (l.key === "Escape" || l.key === "Tab") && o();
18
+ const r = (n) => {
19
+ document.activeElement === e && (n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), o()) : n.key === "Tab" && o());
20
20
  };
21
21
  return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
22
22
  }, [e]), h({
23
23
  open: !!e,
24
24
  onClose: o
25
25
  });
26
- const n = {
27
- ...m,
26
+ const a = {
27
+ ...p,
28
28
  validateOnCalendarClose: f,
29
- onValidatedOnce: () => c(!1)
29
+ onValidatedOnce: () => l(!1)
30
30
  };
31
- return /* @__PURE__ */ w(E, { children: [
31
+ return /* @__PURE__ */ E(D, { children: [
32
32
  /* @__PURE__ */ t(y, {
33
- datePickerProps: n,
33
+ datePickerProps: a,
34
34
  onClick: u
35
35
  }),
36
- !s && /* @__PURE__ */ t(v, {
37
- datePickerProps: { ...n },
36
+ !i && /* @__PURE__ */ t(v, {
37
+ datePickerProps: { ...a },
38
38
  popoverProps: {
39
39
  open: !!e,
40
40
  anchorEl: e,
41
41
  onClose: o
42
42
  },
43
- positionAbove: p
43
+ positionAbove: m
44
44
  }),
45
- s && /* @__PURE__ */ t(b, {
45
+ i && /* @__PURE__ */ t(b, {
46
46
  anchor: "bottom",
47
47
  open: !!e,
48
48
  onClose: o,
@@ -50,7 +50,7 @@ var L = (m) => {
50
50
  children: /* @__PURE__ */ t("div", {
51
51
  className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
52
52
  children: /* @__PURE__ */ t(k, {
53
- datePickerProps: { ...n },
53
+ datePickerProps: { ...a },
54
54
  popoverProps: {
55
55
  open: !!e,
56
56
  anchorEl: e,
@@ -1,5 +1,5 @@
1
- import { useIsMobileView as O } from "../../hooks/useWindowWidthSize.hook.js";
2
- import { StyledDrawer as D } from "../../../components/navigation/drawer/StyledDrawer.js";
1
+ import { useIsMobileView as N } from "../../hooks/useWindowWidthSize.hook.js";
2
+ import { StyledDrawer as O } from "../../../components/navigation/drawer/StyledDrawer.js";
3
3
  import { useBackNavigationClose as I } from "../../hooks/useBackNavigationClose.hook.js";
4
4
  import { usePopupState as j } from "../../../hooks/usePopupState.js";
5
5
  import { ClickAwayListener as A } from "../../../components/mui-compat/ClickAwayListener.js";
@@ -7,97 +7,97 @@ import { TimePickerPanel as B } from "./components/TimePickerPanel.js";
7
7
  import { TimePickerPopper as M } from "./TimePickerPopper.js";
8
8
  import { getTimeFromValue as S } from "./helpers/getTimeFromValue.js";
9
9
  import { TimePickerInput as F } from "./TimePickerInput.js";
10
- import { useEffect as K, useState as v } from "react";
11
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
12
- import { format as y, isBefore as q, isValid as z } from "date-fns";
13
- var te = (n) => {
14
- const { value: a, onSelect: r, notBeforeTime: u } = n, t = j({
10
+ import { useEffect as K, useState as y } from "react";
11
+ import { jsx as r, jsxs as C } from "react/jsx-runtime";
12
+ import { format as k, isBefore as q, isValid as z } from "date-fns";
13
+ var oe = (i) => {
14
+ const { value: a, onSelect: n, notBeforeTime: u } = i, o = j({
15
15
  variant: "popper",
16
16
  popupId: "time-picker-popper"
17
- }), c = O();
17
+ }), c = N();
18
18
  I({
19
- open: c && t.isOpen,
20
- onClose: t.close
19
+ open: c && o.isOpen,
20
+ onClose: o.close
21
21
  });
22
- const { isOpen: k, anchorEl: V, close: w } = t;
22
+ const { isOpen: V, anchorEl: w, close: p } = o;
23
23
  K(() => {
24
- if (!k || c) return;
25
- const e = (i) => {
26
- V?.contains(document.activeElement) && (i.key === "Escape" || i.key === "Tab") && w();
24
+ if (!V || c) return;
25
+ const e = (t) => {
26
+ w?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), p()) : t.key === "Tab" && p());
27
27
  };
28
28
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
29
29
  }, [
30
- k,
31
30
  V,
32
31
  w,
32
+ p,
33
33
  c
34
34
  ]);
35
- const E = a ? y(a, "HH:mm") : "", [b, m] = v(E), [g, l] = v(!1), [H, s] = v(!0), p = g ? b : E, f = (e) => !e || !u || !z(u) || !q(e, u), x = p.length === 5 ? S(p, a) : null, L = x ? f(x) : !0, N = (e) => {
36
- const i = e.target.value;
37
- if (l(!0), m(i), i.length !== 5) {
35
+ const E = a ? k(a, "HH:mm") : "", [b, m] = y(E), [g, l] = y(!1), [D, s] = y(!0), f = g ? b : E, d = (e) => !e || !u || !z(u) || !q(e, u), x = f.length === 5 ? S(f, a) : null, H = x ? d(x) : !0, L = (e) => {
36
+ const t = e.target.value;
37
+ if (l(!0), m(t), t.length !== 5) {
38
38
  s(!1);
39
39
  return;
40
40
  }
41
- const h = S(i, a);
42
- if (!h) {
43
- r(void 0), s(!1);
41
+ const v = S(t, a);
42
+ if (!v) {
43
+ n(void 0), s(!1);
44
44
  return;
45
45
  }
46
- s(!0), f(h) ? (r(h), l(!1), t.close()) : r(void 0);
47
- }, T = (e) => {
48
- if (s(!0), f(e)) {
49
- r(e), m(e ? y(e, "HH:mm") : ""), l(!1);
46
+ s(!0), d(v) ? (n(v), l(!1), o.close()) : n(void 0);
47
+ }, P = (e) => {
48
+ if (s(!0), d(e)) {
49
+ n(e), m(e ? k(e, "HH:mm") : ""), l(!1);
50
50
  return;
51
51
  }
52
- r(void 0), m(e ? y(e, "HH:mm") : ""), l(!0);
53
- }, P = () => {
54
- r(void 0), m(""), l(!1), s(!0);
55
- }, d = /* @__PURE__ */ o(F, {
56
- ...n,
57
- popupState: t,
58
- localValue: p,
59
- isValidTime: H,
60
- isValidEndTime: L,
61
- handleChange: N
52
+ n(void 0), m(e ? k(e, "HH:mm") : ""), l(!0);
53
+ }, T = () => {
54
+ n(void 0), m(""), l(!1), s(!0);
55
+ }, h = /* @__PURE__ */ r(F, {
56
+ ...i,
57
+ popupState: o,
58
+ localValue: f,
59
+ isValidTime: D,
60
+ isValidEndTime: H,
61
+ handleChange: L
62
62
  });
63
- return n.disabled || n.readOnly ? d : c ? /* @__PURE__ */ C("div", {
63
+ return i.disabled || i.readOnly ? h : c ? /* @__PURE__ */ C("div", {
64
64
  className: "relative h-auto w-auto",
65
- children: [/* @__PURE__ */ o("div", {
65
+ children: [/* @__PURE__ */ r("div", {
66
66
  className: "m-0 flex h-fit items-center justify-center p-0",
67
- children: d
68
- }), /* @__PURE__ */ o(D, {
67
+ children: h
68
+ }), /* @__PURE__ */ r(O, {
69
69
  anchor: "bottom",
70
- open: t.isOpen,
71
- onClose: t.close,
72
- anchorEl: t.anchorEl,
73
- children: /* @__PURE__ */ o("div", {
70
+ open: o.isOpen,
71
+ onClose: o.close,
72
+ anchorEl: o.anchorEl,
73
+ children: /* @__PURE__ */ r("div", {
74
74
  className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
75
- children: /* @__PURE__ */ o(B, {
76
- dataTest: n.dataTest,
75
+ children: /* @__PURE__ */ r(B, {
76
+ dataTest: i.dataTest,
77
77
  value: a,
78
- onSelect: T,
79
- handleClear: P,
80
- onConfirm: t.close
78
+ onSelect: P,
79
+ handleClear: T,
80
+ onConfirm: o.close
81
81
  })
82
82
  })
83
83
  })]
84
- }) : /* @__PURE__ */ o(A, {
84
+ }) : /* @__PURE__ */ r(A, {
85
85
  mouseEvent: "onMouseDown",
86
- onClickAway: t.close,
86
+ onClickAway: o.close,
87
87
  children: /* @__PURE__ */ C("div", {
88
88
  className: "relative h-auto w-auto",
89
- children: [/* @__PURE__ */ o("div", {
89
+ children: [/* @__PURE__ */ r("div", {
90
90
  className: "m-0 flex h-fit items-center justify-center p-0",
91
- children: d
92
- }), t.isOpen && /* @__PURE__ */ o(M, {
93
- ...n,
94
- popupState: t,
95
- handleClear: P,
96
- onSelect: T
91
+ children: h
92
+ }), o.isOpen && /* @__PURE__ */ r(M, {
93
+ ...i,
94
+ popupState: o,
95
+ handleClear: T,
96
+ onSelect: P
97
97
  })]
98
98
  })
99
99
  });
100
100
  };
101
101
  export {
102
- te as StyledTimePicker
102
+ oe as StyledTimePicker
103
103
  };
@@ -3,4 +3,5 @@ export declare const CloseBtn: React.FC<{
3
3
  showCloseIcon: boolean;
4
4
  onClick: () => void;
5
5
  tooltipTitle: string;
6
+ buttonRef?: React.Ref<HTMLButtonElement>;
6
7
  }>;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, RefObject } from 'react';
2
2
  export type ILocale = 'en' | 'no';
3
3
  /**
4
4
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#20049-111828 (Design-System · "Dialog minimized")
@@ -32,6 +32,11 @@ export interface IMinimizableDialogV2Props {
32
32
  locale?: ILocale;
33
33
  dataTest: string;
34
34
  style?: React.CSSProperties;
35
+ /**
36
+ * Overrides the Close button as the focus target when the dialog opens.
37
+ * Docked dialogs remain non-modal and do not trap subsequent keyboard navigation.
38
+ */
39
+ initialFocusRef?: RefObject<HTMLElement | null>;
35
40
  minimizedState?: boolean;
36
41
  handleMinimizedState?: (minimized: boolean) => void;
37
42
  enableFullscreen?: boolean;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.87.4",
6
+ "version": "3.88.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",