asma-ui-core 3.105.0 → 3.107.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 (72) 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 +60 -41
  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 -53
  9. package/dist/components/data-display/tooltip/StyledTooltip.js +116 -73
  10. package/dist/components/feedback/dialog/DialogBusyContext.js +32 -0
  11. package/dist/components/feedback/dialog/StyledDialog.js +81 -72
  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 +108 -88
  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 +13 -13
  21. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +32 -32
  22. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +6 -6
  23. package/dist/components/inputs/select/StyledSelect.js +8 -8
  24. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +14 -14
  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/tabs/StyledTab.js +23 -25
  29. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +6 -6
  30. package/dist/components/utils/copy-wrapper/CopyButton.js +4 -4
  31. package/dist/components/utils/copy-wrapper/CopyWrapper.js +4 -4
  32. package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +66 -56
  33. package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +13 -12
  34. package/dist/datetime/components/time-picker/TimePickerInput.js +47 -39
  35. package/dist/datetime/helpers/getTitleLabelling.js +10 -0
  36. package/dist/datetime/shared-components/button/StyledButton.module.js +11 -11
  37. package/dist/helpers/focusable.js +2 -2
  38. package/dist/index.js +589 -585
  39. package/dist/src/components/custom/module/header-layout/ToolbarActionGroup.d.ts +13 -2
  40. package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +2 -1
  41. package/dist/src/components/custom/module/header-layout/planToolbarActions.d.ts +18 -1
  42. package/dist/src/components/custom/module/header-layout/useTranslations.d.ts +2 -0
  43. package/dist/src/components/custom/widget/widget/StyledWidget.d.ts +5 -0
  44. package/dist/src/components/data-display/chip/StyledChip.d.ts +6 -0
  45. package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +7 -1
  46. package/dist/src/components/data-display/tooltip/StyledTooltip.d.ts +16 -2
  47. package/dist/src/components/feedback/dialog/DialogBusy.test.d.ts +1 -0
  48. package/dist/src/components/feedback/dialog/DialogBusyContext.d.ts +28 -0
  49. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +5 -0
  50. package/dist/src/components/feedback/dialog/dialog-footer/StyledDialogFooter.d.ts +9 -8
  51. package/dist/src/components/feedback/dialog/index.d.ts +1 -0
  52. package/dist/src/components/feedback/minimizable-dialog/components/CloseBtn.d.ts +2 -0
  53. package/dist/src/components/feedback/minimizable-dialog/types.d.ts +11 -0
  54. package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +2 -0
  55. package/dist/src/components/feedback/minimizable-dialog/v2/useTranslations.d.ts +2 -0
  56. package/dist/src/components/inputs/button/StyledButton.d.ts +25 -1
  57. package/dist/src/components/inputs/button/StyledButtonBusy.test.d.ts +1 -0
  58. package/dist/src/components/navigation/link/StyledLink.d.ts +6 -0
  59. package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +8 -1
  60. package/dist/src/components/navigation/tabs/StyledTab.d.ts +6 -0
  61. package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
  62. package/dist/src/datetime/components/date-picker/types.d.ts +6 -0
  63. package/dist/src/datetime/components/time-picker/types.d.ts +6 -1
  64. package/dist/src/datetime/helpers/getTitleLabelling.d.ts +12 -0
  65. package/dist/src/forms/submitChanged.d.ts +3 -0
  66. package/dist/src/helpers/focusable.d.ts +8 -0
  67. package/dist/src/helpers/index.d.ts +1 -0
  68. package/dist/src/helpers/uiCoreLocale.d.ts +1 -0
  69. package/dist/src/table/shared-components/StyledMenuItem.d.ts +5 -1
  70. package/dist/table/components/columns/action-column/components/RowActionMenu.js +63 -69
  71. package/dist/table/shared-components/StyledMenuItem.js +28 -16
  72. package/package.json +1 -1
@@ -1,94 +1,137 @@
1
- import { cn as j } from "../../../helpers/cn.js";
2
- import { resolveSx as k } from "../../../helpers/sx.js";
3
- import { firstFocusable as D, firstTabbable as z } from "../../../helpers/focusable.js";
4
- import { TOP_LAYER_PROPS as G, TOP_LAYER_RESET_STYLE as W, getOpenModalDialogAncestor as $, shouldUsePopoverTopLayer as q, useTopLayerRef as J } from "../../../hooks/useTopLayer.hook.js";
5
- import { Fragment as K, cloneElement as Q, useEffect as V, useLayoutEffect as X, useRef as Z, useState as ee } from "react";
6
- import { Fragment as te, jsx as c, jsxs as E } from "react/jsx-runtime";
7
- import { FloatingArrow as oe, FloatingPortal as ne, arrow as re, autoUpdate as se, flip as ie, offset as ae, safePolygon as le, shift as ce, useDismiss as fe, useFloating as de, useFocus as pe, useHover as me, useInteractions as ue, useMergeRefs as ge, useRole as be } from "@floating-ui/react";
8
- var ye = "#363E4A", Re = (e) => {
1
+ import { cn as ee } from "../../../helpers/cn.js";
2
+ import { resolveSx as te } from "../../../helpers/sx.js";
3
+ import { firstFocusable as oe, firstTabbable as ne } from "../../../helpers/focusable.js";
4
+ import { TOP_LAYER_PROPS as re, TOP_LAYER_RESET_STYLE as se, getOpenModalDialogAncestor as ie, shouldUsePopoverTopLayer as ce, useTopLayerRef as le } from "../../../hooks/useTopLayer.hook.js";
5
+ import { Fragment as ae, cloneElement as fe, useCallback as ue, useEffect as U, useId as pe, useLayoutEffect as L, useMemo as de, useRef as H, useState as me } from "react";
6
+ import { Fragment as k, jsx as b, jsxs as _ } from "react/jsx-runtime";
7
+ import { FloatingArrow as ge, FloatingPortal as be, arrow as Re, autoUpdate as ye, flip as ve, offset as Ee, safePolygon as he, shift as Pe, useDismiss as xe, useFloating as Te, useFocus as we, useHover as Fe, useInteractions as Oe, useMergeRefs as Ae, useRole as Le } from "@floating-ui/react";
8
+ var _e = "#363E4A", De = (t) => {
9
9
  const n = document.createRange();
10
- return n.selectNodeContents(e), n.getBoundingClientRect();
11
- }, we = (e) => !e.title && e.title !== 0 ? e.children : /* @__PURE__ */ c(xe, { ...e }), xe = ({ title: e, children: n, placement: h = "top", arrow: f = !1, enterDelay: F = 500, leaveDelay: T = 0, open: y, onOpen: A, onClose: P, disableHoverListener: _, disableFocusListener: w, offsetDistance: L, className: O, slotProps: d }) => {
12
- const [S, C] = ee(!1), p = y !== void 0, s = y ?? S, R = Z(null), B = (t) => {
13
- p || C(t), t ? A?.() : P?.();
14
- }, { refs: o, floatingStyles: I, context: r } = de({
15
- open: s,
16
- onOpenChange: B,
17
- placement: h,
10
+ return n.selectNodeContents(t), n.getBoundingClientRect();
11
+ }, Me = [
12
+ "onFocus",
13
+ "onBlur",
14
+ "onMouseEnter",
15
+ "onMouseLeave",
16
+ "onMouseMove",
17
+ "onPointerDown",
18
+ "onPointerEnter",
19
+ "onPointerUp",
20
+ "onKeyDown"
21
+ ], ke = ({ children: t, ...n }) => {
22
+ const s = H({ element: null }), E = ue((i) => {
23
+ s.current.element = i, s.current.setReference?.(i);
24
+ }, []), c = t.type === ae, l = c ? /* @__PURE__ */ b("span", {
25
+ style: { display: "contents" },
26
+ children: t
27
+ }) : t, a = l.props, R = Ae([E, Object.getOwnPropertyDescriptor(a, "ref")?.value ?? Object.getOwnPropertyDescriptor(l, "ref")?.value]), h = de(() => Object.fromEntries(Me.map((i) => [i, (P) => {
28
+ const d = (s.current.getReferenceProps?.(a) ?? a)[i];
29
+ d?.(P);
30
+ }])), [a]), y = !!n.title || n.title === 0;
31
+ return /* @__PURE__ */ _(k, { children: [y ? fe(l, {
32
+ ...h,
33
+ ref: R
34
+ }) : l, y && /* @__PURE__ */ b(Se, {
35
+ ...n,
36
+ referenceRef: s,
37
+ isFragment: c
38
+ })] });
39
+ }, Se = ({ title: t, referenceRef: n, isFragment: s, placement: E = "top", arrow: c = !1, enterDelay: l = 500, leaveDelay: a = 0, open: R, onOpen: h, onClose: y, disableHoverListener: i, disableFocusListener: P, openOnTap: d, persistentDescription: Y, persistentDescriptionId: z, offsetDistance: G, className: K, slotProps: x }) => {
40
+ const [V, W] = me(!1), T = R !== void 0, D = !!t || t === 0, m = D && (R ?? V), w = D && Y, M = H(null), S = (e) => {
41
+ T || W(e), e ? h?.() : y?.();
42
+ }, { refs: o, floatingStyles: $, context: f } = Te({
43
+ open: m,
44
+ onOpenChange: S,
45
+ placement: E,
18
46
  strategy: "fixed",
19
- whileElementsMounted: se,
47
+ whileElementsMounted: ye,
20
48
  middleware: [
21
- ae(L ?? (f ? 8 : 6)),
22
- ie({ padding: 8 }),
23
- ce({ padding: 8 }),
24
- ...f ? [re({ element: R })] : []
49
+ Ee(G ?? (c ? 8 : 6)),
50
+ ve({ padding: 8 }),
51
+ Pe({ padding: 8 }),
52
+ ...c ? [Re({ element: M })] : []
25
53
  ]
26
- }), { getReferenceProps: M, getFloatingProps: H } = ue([
27
- me(r, {
28
- enabled: !p && !_,
54
+ }), { getReferenceProps: C, getFloatingProps: q } = Oe([
55
+ Fe(f, {
56
+ enabled: !T && !i,
29
57
  delay: {
30
- open: F,
31
- close: T
58
+ open: l,
59
+ close: a
32
60
  },
33
61
  move: !1,
34
- handleClose: le()
62
+ mouseOnly: !!d,
63
+ handleClose: he()
35
64
  }),
36
- pe(r, { enabled: !p && !w }),
37
- fe(r),
38
- be(r, { role: "tooltip" })
39
- ]), x = s ? $(o.domReference.current) : void 0, m = q(x), N = J(o.setFloating, m), { floatingId: a } = r;
40
- V(() => {
41
- const t = o.domReference.current;
42
- if (!s || !a || !(t instanceof HTMLElement)) return;
43
- const l = z(t) ?? D(t) ?? t, i = l.getAttribute("aria-describedby"), v = typeof e == "string" || typeof e == "number" ? String(e).trim() : "", Y = (b) => document.getElementById(b)?.textContent?.trim();
44
- if (!(v && i?.split(/\s+/).some((b) => Y(b) === v)))
45
- return l.setAttribute("aria-describedby", i ? `${i} ${a}` : a), () => {
46
- i === null ? l.removeAttribute("aria-describedby") : l.setAttribute("aria-describedby", i);
47
- };
65
+ we(f, { enabled: !T && !P }),
66
+ xe(f, { ancestorScroll: !!d }),
67
+ Le(f, { role: "tooltip" }),
68
+ { reference: { onPointerUp: (e) => {
69
+ !d || e.pointerType !== "touch" || S(!m);
70
+ } } }
71
+ ]);
72
+ L(() => {
73
+ const e = n.current;
74
+ return e.setReference = o.setReference, o.setReference(e.element), () => {
75
+ e.setReference = void 0, e.getReferenceProps = void 0, o.setReference(null);
76
+ };
77
+ }, [n, o]), L(() => {
78
+ n.current.getReferenceProps = C;
79
+ }, [n, C]);
80
+ const B = m ? ie(o.domReference.current) : void 0, F = ce(B), J = le(o.setFloating, F), { floatingId: Q } = f, X = pe(), j = z ?? X, u = w ? j : Q, O = !!w || m, I = (e) => ne(e) ?? oe(e) ?? e, A = typeof t == "string" || typeof t == "number" ? String(t).trim() : "", N = (e, r) => {
81
+ const p = e.getAttribute("aria-describedby"), g = p?.split(/\s+/) ?? [];
82
+ if (g.includes(r)) return;
83
+ const Z = (v) => document.getElementById(v)?.textContent?.trim();
84
+ A && g.some((v) => v !== r && Z(v) === A) || e.setAttribute("aria-describedby", p ? `${p} ${r}` : r);
85
+ };
86
+ return U(() => {
87
+ const e = o.domReference.current;
88
+ if (!O || !u || !(e instanceof HTMLElement)) return;
89
+ const r = I(e);
90
+ return N(r, u), () => {
91
+ const p = r.getAttribute("aria-describedby")?.split(/\s+/).filter((g) => g && g !== u).join(" ");
92
+ p ? r.setAttribute("aria-describedby", p) : r.removeAttribute("aria-describedby");
93
+ };
48
94
  }, [
49
- s,
95
+ O,
50
96
  o.domReference,
51
- a,
52
- e
53
- ]);
54
- const u = n.type === K, g = u ? /* @__PURE__ */ c("span", {
55
- style: { display: "contents" },
56
- children: n
57
- }) : n;
58
- X(() => {
59
- const t = o.domReference.current;
60
- !u || !t || o.setPositionReference({
61
- contextElement: t,
62
- getBoundingClientRect: () => Re(t)
97
+ u,
98
+ A
99
+ ]), U(() => {
100
+ const e = o.domReference.current;
101
+ !O || !u || !(e instanceof HTMLElement) || N(I(e), u);
102
+ }), L(() => {
103
+ const e = o.domReference.current;
104
+ !s || !e || o.setPositionReference({
105
+ contextElement: e,
106
+ getBoundingClientRect: () => De(e)
63
107
  });
64
- }, [u, o]);
65
- const { ["aria-describedby"]: ve, ...U } = M({
66
- ref: ge([o.setReference, g.ref]),
67
- ...g.props
68
- });
69
- return /* @__PURE__ */ E(te, { children: [Q(g, U), s && /* @__PURE__ */ c(ne, {
70
- root: x,
71
- children: /* @__PURE__ */ E("div", {
72
- ref: N,
73
- ...m ? G : {},
74
- ...H(),
108
+ }, [s, o]), /* @__PURE__ */ _(k, { children: [w && /* @__PURE__ */ b("span", {
109
+ id: j,
110
+ hidden: !0,
111
+ children: t
112
+ }), m && /* @__PURE__ */ b(be, {
113
+ root: B,
114
+ children: /* @__PURE__ */ _("div", {
115
+ ref: J,
116
+ ...F ? re : {},
117
+ ...q(),
75
118
  style: {
76
- ...m ? W : {},
77
- ...I,
119
+ ...F ? se : {},
120
+ ...$,
78
121
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
79
122
  overflow: "visible",
80
- ...d?.tooltip?.style,
81
- ...k(d?.tooltip?.sx)
123
+ ...x?.tooltip?.style,
124
+ ...te(x?.tooltip?.sx)
82
125
  },
83
- className: j("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", O, d?.tooltip?.className),
84
- children: [e, f && /* @__PURE__ */ c(oe, {
85
- ref: R,
86
- context: r,
87
- fill: ye
126
+ className: ee("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", K, x?.tooltip?.className),
127
+ children: [t, c && /* @__PURE__ */ b(ge, {
128
+ ref: M,
129
+ context: f,
130
+ fill: _e
88
131
  })]
89
132
  })
90
133
  })] });
91
134
  };
92
135
  export {
93
- we as StyledTooltip
136
+ ke as StyledTooltip
94
137
  };
@@ -0,0 +1,32 @@
1
+ import { createContext as a, useCallback as i, useContext as l, useEffect as c, useMemo as g, useState as B } from "react";
2
+ var y = {
3
+ en: "Wait until saved",
4
+ no: "Vent til lagringen er ferdig"
5
+ }, f = a(null), x = (e, t = "en") => {
6
+ const [o, u] = B(0), s = i(() => (u((n) => n + 1), () => u((n) => n - 1)), []), r = o > 0;
7
+ return {
8
+ busy: r,
9
+ busyReason: e ?? y[t],
10
+ contextValue: g(() => ({
11
+ registerBusy: s,
12
+ busy: r,
13
+ busyReason: e
14
+ }), [
15
+ s,
16
+ r,
17
+ e
18
+ ])
19
+ };
20
+ }, C = (e) => {
21
+ const t = l(f)?.registerBusy;
22
+ c(() => {
23
+ if (!(!e || !t))
24
+ return t();
25
+ }, [e, t]);
26
+ };
27
+ export {
28
+ f as DialogBusyContext,
29
+ y as WAIT_UNTIL_SAVED,
30
+ x as useDialogBusyBoundary,
31
+ C as useReportDialogBusy
32
+ };
@@ -1,95 +1,99 @@
1
- import { cn as g } from "../../../helpers/cn.js";
1
+ import { cn as k } from "../../../helpers/cn.js";
2
2
  import { resolveSx as W } from "../../../helpers/sx.js";
3
- import { CloseIcon as le } from "../../icons/close-icon/CloseIcon.js";
4
- import { registerOpenModalDialog as re } from "../../../hooks/useTopLayer.hook.js";
5
- import { StyledButton as ie } from "../../inputs/button/StyledButton.js";
6
- import { useMobileMediaQuery as de } from "../../../hooks/useMediaQuery.hook.js";
7
- import { warnUnnamedDialog as ae } from "../../../helpers/warnUnnamedDialog.js";
8
- import ce from "./StyledDialog.module.js";
9
- import { StyledDialogTitleContext as se } from "./dialogTitleContext.js";
10
- import { useEffect as k, useId as E, useLayoutEffect as B, useMemo as me, useRef as r, useState as q } from "react";
11
- import { jsx as l, jsxs as i } from "react/jsx-runtime";
12
- var ue = {
3
+ import { registerOpenModalDialog as se } from "../../../hooks/useTopLayer.hook.js";
4
+ import { CloseIcon as ce } from "../../icons/close-icon/CloseIcon.js";
5
+ import { DialogBusyContext as ue, useDialogBusyBoundary as me } from "./DialogBusyContext.js";
6
+ import { StyledButton as fe } from "../../inputs/button/StyledButton.js";
7
+ import { useMobileMediaQuery as xe } from "../../../hooks/useMediaQuery.hook.js";
8
+ import { warnUnnamedDialog as pe } from "../../../helpers/warnUnnamedDialog.js";
9
+ import he from "./StyledDialog.module.js";
10
+ import { StyledDialogTitleContext as ye } from "./dialogTitleContext.js";
11
+ import { useEffect as E, useId as D, useLayoutEffect as P, useMemo as we, useRef as i, useState as q } from "react";
12
+ import { jsx as r, jsxs as d } from "react/jsx-runtime";
13
+ var ve = {
13
14
  xs: 444,
14
15
  sm: 600,
15
16
  md: 900,
16
17
  lg: 1200,
17
18
  xl: 1536
18
- }, Ie = ({ open: t, onClose: p, children: I, dataTest: d, maxWidth: S = "sm", fullWidth: z, fullScreen: P, scroll: A = "paper", disableEscapeKeyDown: F, className: K, style: L, sx: U, classes: C, PaperProps: X, slotProps: a, onCloseText: N, showCloseIcon: D = !0, dialogLabel: c, dialogTitle: s, dialogHeaderNode: G, ariaLabel: w }) => {
19
- const m = E(), H = E(), [Q, $] = q(), J = me(() => ({
19
+ }, _e = ({ open: t, onClose: y, children: C, dataTest: a, maxWidth: I = "sm", fullWidth: z, fullScreen: K, scroll: A = "paper", disableEscapeKeyDown: F, className: L, style: U, sx: X, classes: S, PaperProps: G, slotProps: s, busyReason: Q, locale: T = "en", onCloseText: N, showCloseIcon: H = !0, dialogLabel: c, dialogTitle: u, dialogHeaderNode: V, ariaLabel: w }) => {
20
+ const m = D(), R = D(), [$, J] = q(), Y = we(() => ({
20
21
  titleId: m,
21
- setTitleId: $
22
- }), [m]), u = s ? m : Q ?? (c ? H : void 0), T = de(), f = r(null), y = r(null), v = r(!1), M = r(t), x = P ?? T, _ = E(), [h, V] = q(), R = r(!1);
23
- B(() => {
24
- const e = f.current, n = !!u || !!w, o = e && t && !n ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
22
+ setTitleId: J
23
+ }), [m]), f = u ? m : $ ?? (c ? R : void 0), Z = xe(), l = i(null), v = i(null), b = i(!1), M = i(t), x = K ?? Z, { busy: p, busyReason: ee, contextValue: te } = me(Q, T), _ = D(), [h, ne] = q(), B = i(!1);
24
+ P(() => {
25
+ const e = l.current, n = !!f || !!w, o = e && t && !n ? e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]') : null;
25
26
  o && !o.id && (o.id = _);
26
27
  const O = o?.id;
27
- O !== h && V(O), e && t && !n && !o && !R.current && (R.current = !0, ae(d));
28
+ O !== h && ne(O), e && t && !n && !o && !B.current && (B.current = !0, pe(a));
28
29
  }, [
29
30
  t,
30
- u,
31
+ f,
31
32
  w,
32
- I,
33
+ C,
33
34
  h,
34
35
  _,
35
- d
36
- ]), k(() => {
37
- M.current && !t && a?.transition?.onExited?.(), M.current = t;
38
- }, [t, a]), B(() => {
39
- const e = f.current;
36
+ a
37
+ ]), E(() => {
38
+ M.current && !t && s?.transition?.onExited?.(), M.current = t;
39
+ }, [t, s]), P(() => {
40
+ const e = l.current;
40
41
  if (!e || !t) return;
41
- e.open || (y.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
42
- const n = re(e);
42
+ e.open || (v.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
43
+ const n = se(e);
43
44
  return () => {
44
- n(), y.current?.isConnected && y.current.focus({ preventScroll: !0 });
45
+ n(), v.current?.isConnected && v.current.focus({ preventScroll: !0 });
45
46
  };
46
- }, [t]), k(() => {
47
+ }, [t]), E(() => {
47
48
  if (!t) return;
48
49
  const e = document.body.style.overflow, n = document.documentElement.style.overflow;
49
50
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
50
51
  document.body.style.overflow = e, document.documentElement.style.overflow = n;
51
52
  };
52
53
  }, [t]);
53
- const b = {
54
- ...X,
55
- ...a?.paper
56
- }, j = S === !1 ? void 0 : ue[S], { className: Y, style: Z, onClick: ee, ...te } = a?.backdrop ?? {}, ne = (e) => {
57
- v.current || (v.current = !0, window.setTimeout(() => {
58
- v.current = !1;
59
- }, 0), p?.(e, "escapeKeyDown"));
60
- }, oe = (e) => {
54
+ const g = {
55
+ ...G,
56
+ ...s?.paper
57
+ }, j = I === !1 ? void 0 : ve[I], { className: oe, style: re, onClick: le, ...ie } = s?.backdrop ?? {}, de = (e) => {
58
+ p || b.current || (b.current = !0, window.setTimeout(() => {
59
+ b.current = !1;
60
+ }, 0), y?.(e, "escapeKeyDown"));
61
+ }, ae = (e) => {
61
62
  e.preventDefault();
62
63
  };
63
- return k(() => {
64
+ return E(() => {
64
65
  if (!t || F) return;
65
66
  const e = (n) => {
66
67
  if (n.key !== "Escape" || n.defaultPrevented) return;
67
68
  const o = document.activeElement;
68
- o instanceof Element && o.closest("dialog[open]") !== f.current || ne(n);
69
+ o instanceof Element && o.closest("dialog[open]") !== l.current || de(n);
69
70
  };
70
71
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
71
- }), t ? /* @__PURE__ */ i("dialog", {
72
- ref: f,
72
+ }), t ? /* @__PURE__ */ d("dialog", {
73
+ ref: l,
73
74
  tabIndex: -1,
74
- "data-testid": d,
75
- "aria-labelledby": u ?? h,
76
- "aria-label": u || h ? void 0 : w,
77
- onCancel: oe,
78
- className: g(ce.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", A === "body" && "overflow-y-auto", K, C?.root),
75
+ "data-testid": a,
76
+ "aria-labelledby": f ?? h,
77
+ "aria-label": f || h ? void 0 : w,
78
+ onCancel: ae,
79
+ onKeyDown: (e) => {
80
+ !p || e.key !== "Escape" || e.target.closest("dialog[open]") === l.current && e.preventDefault();
81
+ },
82
+ className: k(he.StyledDialog, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none items-center justify-center overflow-hidden border-0 bg-transparent p-0 outline-none open:flex", A === "body" && "overflow-y-auto", L, S?.root),
79
83
  style: {
80
84
  zIndex: 999,
81
- ...W(U),
82
- ...L
85
+ ...W(X),
86
+ ...U
83
87
  },
84
- children: [/* @__PURE__ */ l("div", {
85
- ...te,
86
- className: g("absolute inset-0 bg-[#626e7eb2]", Y),
87
- style: Z,
88
+ children: [/* @__PURE__ */ r("div", {
89
+ ...ie,
90
+ className: k("absolute inset-0 bg-[#626e7eb2]", oe),
91
+ style: re,
88
92
  onClick: (e) => {
89
- ee?.(e), e.defaultPrevented || p?.(e, "backdropClick");
93
+ le?.(e), !e.defaultPrevented && !p && y?.(e, "backdropClick");
90
94
  }
91
- }), /* @__PURE__ */ i("div", {
92
- className: g("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", x && "rounded-none", b.className, C?.paper),
95
+ }), /* @__PURE__ */ d("div", {
96
+ className: k("relative z-[1] flex flex-col overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", x && "rounded-none", g.className, S?.paper),
93
97
  style: {
94
98
  minWidth: 0,
95
99
  minHeight: 0,
@@ -103,8 +107,8 @@ var ue = {
103
107
  width: z ? "calc(100% - 64px)" : "auto",
104
108
  maxHeight: "100%"
105
109
  },
106
- ...W(b.sx),
107
- ...b.style,
110
+ ...W(g.sx),
111
+ ...g.style,
108
112
  ...x ? {
109
113
  width: "100%",
110
114
  maxWidth: "100%",
@@ -112,32 +116,34 @@ var ue = {
112
116
  maxHeight: "100%"
113
117
  } : { maxHeight: "calc(100% - 64px)" }
114
118
  },
115
- children: [(!!c || !!s || D) && /* @__PURE__ */ i("div", {
119
+ children: [(!!c || !!u || H) && /* @__PURE__ */ d("div", {
116
120
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
117
- children: [/* @__PURE__ */ i("div", {
121
+ children: [/* @__PURE__ */ d("div", {
118
122
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
119
- children: [c && /* @__PURE__ */ l("div", {
120
- id: H,
123
+ children: [c && /* @__PURE__ */ r("div", {
124
+ id: R,
121
125
  className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
122
126
  children: c
123
- }), s && /* @__PURE__ */ l("div", {
127
+ }), u && /* @__PURE__ */ r("div", {
124
128
  id: m,
125
129
  className: "flex text-2xl font-semibold leading-8 text-delta-800",
126
- children: s
130
+ children: u
127
131
  })]
128
- }), D && /* @__PURE__ */ i("div", {
132
+ }), H && /* @__PURE__ */ d("div", {
129
133
  className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
130
- children: [G, /* @__PURE__ */ l(ie, {
131
- dataTest: `close-button-${d}`,
134
+ children: [V, /* @__PURE__ */ r(fe, {
135
+ dataTest: `close-button-${a}`,
132
136
  "aria-label": N ? void 0 : "Close",
133
137
  variant: "textGray",
134
138
  size: "small",
135
- endIcon: /* @__PURE__ */ l(le, {
139
+ endIcon: /* @__PURE__ */ r(ce, {
136
140
  width: 20,
137
141
  height: 20
138
142
  }),
139
143
  className: "max-w-full shrink-0 whitespace-nowrap",
140
- onClick: (e) => p?.(e, "escapeKeyDown"),
144
+ disabled: p,
145
+ disabledReason: ee,
146
+ onClick: (e) => y?.(e, "escapeKeyDown"),
141
147
  style: {
142
148
  color: "var(--colors-delta-800)",
143
149
  paddingRight: "6px",
@@ -146,13 +152,16 @@ var ue = {
146
152
  children: N
147
153
  })]
148
154
  })]
149
- }), /* @__PURE__ */ l(se.Provider, {
150
- value: J,
151
- children: I
155
+ }), /* @__PURE__ */ r(ye.Provider, {
156
+ value: Y,
157
+ children: /* @__PURE__ */ r(ue.Provider, {
158
+ value: te,
159
+ children: C
160
+ })
152
161
  })]
153
162
  })]
154
163
  }) : null;
155
164
  };
156
165
  export {
157
- Ie as StyledDialog
166
+ _e as StyledDialog
158
167
  };