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,92 +1,137 @@
1
- import { cn as N } from "../../../helpers/cn.js";
2
- import { resolveSx as U } from "../../../helpers/sx.js";
3
- import { firstTabbable as Y } from "../../../helpers/focusable.js";
4
- import { TOP_LAYER_PROPS as j, TOP_LAYER_RESET_STYLE as k, getOpenModalDialogAncestor as D, shouldUsePopoverTopLayer as z, useTopLayerRef as G } from "../../../hooks/useTopLayer.hook.js";
5
- import { Fragment as W, cloneElement as $, useEffect as q, useLayoutEffect as J, useRef as K, useState as Q } from "react";
6
- import { Fragment as V, jsx as c, jsxs as v } from "react/jsx-runtime";
7
- import { FloatingArrow as X, FloatingPortal as Z, arrow as ee, autoUpdate as te, flip as oe, offset as ne, safePolygon as re, shift as se, useDismiss as ie, useFloating as ae, useFocus as le, useHover as ce, useInteractions as fe, useMergeRefs as de, useRole as pe } from "@floating-ui/react";
8
- var ue = "#363E4A", me = (t) => {
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
10
  return n.selectNodeContents(t), n.getBoundingClientRect();
11
- }, Te = (t) => !t.title && t.title !== 0 ? t.children : /* @__PURE__ */ c(ge, { ...t }), ge = ({ title: t, children: n, placement: x = "top", arrow: f = !1, enterDelay: h = 500, leaveDelay: E = 0, open: b, onOpen: F, onClose: T, disableHoverListener: A, disableFocusListener: P, offsetDistance: _, className: w, slotProps: d }) => {
12
- const [L, O] = Q(!1), p = b !== void 0, s = b ?? L, R = K(null), S = (e) => {
13
- p || O(e), e ? F?.() : T?.();
14
- }, { refs: o, floatingStyles: C, context: r } = ae({
15
- open: s,
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,
16
44
  onOpenChange: S,
17
- placement: x,
45
+ placement: E,
18
46
  strategy: "fixed",
19
- whileElementsMounted: te,
47
+ whileElementsMounted: ye,
20
48
  middleware: [
21
- ne(_ ?? (f ? 8 : 6)),
22
- oe({ padding: 8 }),
23
- se({ padding: 8 }),
24
- ...f ? [ee({ 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: B } = fe([
27
- ce(r, {
28
- enabled: !p && !A,
54
+ }), { getReferenceProps: C, getFloatingProps: q } = Oe([
55
+ Fe(f, {
56
+ enabled: !T && !i,
29
57
  delay: {
30
- open: h,
31
- close: E
58
+ open: l,
59
+ close: a
32
60
  },
33
61
  move: !1,
34
- handleClose: re()
62
+ mouseOnly: !!d,
63
+ handleClose: he()
35
64
  }),
36
- le(r, { enabled: !p && !P }),
37
- ie(r),
38
- pe(r, { role: "tooltip" })
39
- ]), y = s ? D(o.domReference.current) : void 0, u = z(y), H = G(o.setFloating, u), { floatingId: i } = r;
40
- q(() => {
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(() => {
41
87
  const e = o.domReference.current;
42
- if (!s || !i || !(e instanceof HTMLElement)) return;
43
- const a = Y(e) ?? e, l = a.getAttribute("aria-describedby");
44
- return a.setAttribute("aria-describedby", l ? `${l} ${i}` : i), () => {
45
- l === null ? a.removeAttribute("aria-describedby") : a.setAttribute("aria-describedby", l);
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");
46
93
  };
47
94
  }, [
48
- s,
95
+ O,
49
96
  o.domReference,
50
- i
51
- ]);
52
- const m = n.type === W, g = m ? /* @__PURE__ */ c("span", {
53
- style: { display: "contents" },
54
- children: n
55
- }) : n;
56
- J(() => {
97
+ u,
98
+ A
99
+ ]), U(() => {
100
+ const e = o.domReference.current;
101
+ !O || !u || !(e instanceof HTMLElement) || N(I(e), u);
102
+ }), L(() => {
57
103
  const e = o.domReference.current;
58
- !m || !e || o.setPositionReference({
104
+ !s || !e || o.setPositionReference({
59
105
  contextElement: e,
60
- getBoundingClientRect: () => me(e)
106
+ getBoundingClientRect: () => De(e)
61
107
  });
62
- }, [m, o]);
63
- const { ["aria-describedby"]: be, ...I } = M({
64
- ref: de([o.setReference, g.ref]),
65
- ...g.props
66
- });
67
- return /* @__PURE__ */ v(V, { children: [$(g, I), s && /* @__PURE__ */ c(Z, {
68
- root: y,
69
- children: /* @__PURE__ */ v("div", {
70
- ref: H,
71
- ...u ? j : {},
72
- ...B(),
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(),
73
118
  style: {
74
- ...u ? k : {},
75
- ...C,
119
+ ...F ? se : {},
120
+ ...$,
76
121
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
77
122
  overflow: "visible",
78
- ...d?.tooltip?.style,
79
- ...U(d?.tooltip?.sx)
123
+ ...x?.tooltip?.style,
124
+ ...te(x?.tooltip?.sx)
80
125
  },
81
- className: N("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)]", w, d?.tooltip?.className),
82
- children: [t, f && /* @__PURE__ */ c(X, {
83
- ref: R,
84
- context: r,
85
- fill: ue
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
86
131
  })]
87
132
  })
88
133
  })] });
89
134
  };
90
135
  export {
91
- Te as StyledTooltip
136
+ ke as StyledTooltip
92
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,143 +1,167 @@
1
- import { cn as h } from "../../../helpers/cn.js";
2
- import { resolveSx as D } from "../../../helpers/sx.js";
3
- import { CloseIcon as J } from "../../icons/close-icon/CloseIcon.js";
4
- import { registerOpenModalDialog as U } from "../../../hooks/useTopLayer.hook.js";
5
- import { StyledButton as V } from "../../inputs/button/StyledButton.js";
6
- import { useMobileMediaQuery as Y } from "../../../hooks/useMediaQuery.hook.js";
7
- import Z from "./StyledDialog.module.js";
8
- import { StyledDialogTitleContext as ee } from "./dialogTitleContext.js";
9
- import { useEffect as w, useId as te, useLayoutEffect as le, useMemo as ne, useRef as s, useState as re } from "react";
10
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
11
- var oe = {
1
+ import { cn as k } from "../../../helpers/cn.js";
2
+ import { resolveSx as W } from "../../../helpers/sx.js";
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 = {
12
14
  xs: 444,
13
15
  sm: 600,
14
16
  md: 900,
15
17
  lg: 1200,
16
18
  xl: 1536
17
- }, he = ({ open: t, onClose: c, children: I, dataTest: y, maxWidth: v = "sm", fullWidth: H, fullScreen: M, scroll: _ = "paper", disableEscapeKeyDown: j, className: O, style: R, sx: W, classes: b, PaperProps: z, slotProps: o, onCloseText: g, showCloseIcon: k = !0, dialogLabel: m, dialogTitle: i, ariaLabel: L, dialogHeaderNode: P }) => {
18
- const d = te(), [q, A] = re(), B = ne(() => ({
19
- titleId: d,
20
- setTitleId: A
21
- }), [d]), E = i ? d : q, F = Y(), u = s(null), f = s(null), x = s(!1), C = s(t), a = M ?? F;
22
- w(() => {
23
- C.current && !t && o?.transition?.onExited?.(), C.current = t;
24
- }, [t, o]), le(() => {
25
- const e = u.current;
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(() => ({
21
+ titleId: m,
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;
26
+ o && !o.id && (o.id = _);
27
+ const O = o?.id;
28
+ O !== h && ne(O), e && t && !n && !o && !B.current && (B.current = !0, pe(a));
29
+ }, [
30
+ t,
31
+ f,
32
+ w,
33
+ C,
34
+ h,
35
+ _,
36
+ a
37
+ ]), E(() => {
38
+ M.current && !t && s?.transition?.onExited?.(), M.current = t;
39
+ }, [t, s]), P(() => {
40
+ const e = l.current;
26
41
  if (!e || !t) return;
27
- e.open || (f.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
28
- const l = U(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);
29
44
  return () => {
30
- l(), f.current?.isConnected && f.current.focus({ preventScroll: !0 });
45
+ n(), v.current?.isConnected && v.current.focus({ preventScroll: !0 });
31
46
  };
32
- }, [t]), w(() => {
47
+ }, [t]), E(() => {
33
48
  if (!t) return;
34
- const e = document.body.style.overflow, l = document.documentElement.style.overflow;
49
+ const e = document.body.style.overflow, n = document.documentElement.style.overflow;
35
50
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
36
- document.body.style.overflow = e, document.documentElement.style.overflow = l;
51
+ document.body.style.overflow = e, document.documentElement.style.overflow = n;
37
52
  };
38
53
  }, [t]);
39
- const p = {
40
- ...z,
41
- ...o?.paper
42
- }, N = v === !1 ? void 0 : oe[v], { className: K, style: T, onClick: X, ...G } = o?.backdrop ?? {}, Q = (e) => {
43
- x.current || (x.current = !0, window.setTimeout(() => {
44
- x.current = !1;
45
- }, 0), c?.(e, "escapeKeyDown"));
46
- }, $ = (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) => {
47
62
  e.preventDefault();
48
63
  };
49
- return w(() => {
50
- if (!t || j) return;
51
- const e = (l) => {
52
- if (l.key !== "Escape" || l.defaultPrevented) return;
53
- const S = document.activeElement;
54
- S instanceof Element && S.closest("dialog[open]") !== u.current || Q(l);
64
+ return E(() => {
65
+ if (!t || F) return;
66
+ const e = (n) => {
67
+ if (n.key !== "Escape" || n.defaultPrevented) return;
68
+ const o = document.activeElement;
69
+ o instanceof Element && o.closest("dialog[open]") !== l.current || de(n);
55
70
  };
56
71
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
57
- }), t ? /* @__PURE__ */ r("dialog", {
58
- ref: u,
72
+ }), t ? /* @__PURE__ */ d("dialog", {
73
+ ref: l,
59
74
  tabIndex: -1,
60
- "data-testid": y,
61
- "aria-labelledby": E,
62
- "aria-label": E ? void 0 : L,
63
- onCancel: $,
64
- className: h(Z.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", _ === "body" && "overflow-y-auto", O, b?.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),
65
83
  style: {
66
84
  zIndex: 999,
67
- ...D(W),
68
- ...R
85
+ ...W(X),
86
+ ...U
69
87
  },
70
- children: [/* @__PURE__ */ n("div", {
71
- ...G,
72
- className: h("absolute inset-0 bg-[#626e7eb2]", K),
73
- style: T,
88
+ children: [/* @__PURE__ */ r("div", {
89
+ ...ie,
90
+ className: k("absolute inset-0 bg-[#626e7eb2]", oe),
91
+ style: re,
74
92
  onClick: (e) => {
75
- X?.(e), e.defaultPrevented || c?.(e, "backdropClick");
93
+ le?.(e), !e.defaultPrevented && !p && y?.(e, "backdropClick");
76
94
  }
77
- }), /* @__PURE__ */ r("div", {
78
- className: h("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]", a && "rounded-none", p.className, b?.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),
79
97
  style: {
80
98
  minWidth: 0,
81
99
  minHeight: 0,
82
- ...!a && N ? { maxWidth: N } : {},
83
- ...a ? {
100
+ ...!x && j ? { maxWidth: j } : {},
101
+ ...x ? {
84
102
  width: "100%",
85
103
  maxWidth: "100%",
86
104
  height: "100%",
87
105
  maxHeight: "100%"
88
106
  } : {
89
- width: H ? "calc(100% - 64px)" : "auto",
107
+ width: z ? "calc(100% - 64px)" : "auto",
90
108
  maxHeight: "100%"
91
109
  },
92
- ...D(p.sx),
93
- ...p.style,
94
- ...a ? {
110
+ ...W(g.sx),
111
+ ...g.style,
112
+ ...x ? {
95
113
  width: "100%",
96
114
  maxWidth: "100%",
97
115
  height: "100%",
98
116
  maxHeight: "100%"
99
117
  } : { maxHeight: "calc(100% - 64px)" }
100
118
  },
101
- children: [(!!m || !!i || k) && /* @__PURE__ */ r("div", {
119
+ children: [(!!c || !!u || H) && /* @__PURE__ */ d("div", {
102
120
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
103
- children: [/* @__PURE__ */ r("div", {
121
+ children: [/* @__PURE__ */ d("div", {
104
122
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
105
- children: [m && /* @__PURE__ */ n("div", {
123
+ children: [c && /* @__PURE__ */ r("div", {
124
+ id: R,
106
125
  className: "flex h-8 items-center text-sm font-normal leading-5 text-delta-600",
107
- children: m
108
- }), i && /* @__PURE__ */ n("div", {
109
- id: d,
126
+ children: c
127
+ }), u && /* @__PURE__ */ r("div", {
128
+ id: m,
110
129
  className: "flex text-2xl font-semibold leading-8 text-delta-800",
111
- children: i
130
+ children: u
112
131
  })]
113
- }), k && /* @__PURE__ */ r("div", {
132
+ }), H && /* @__PURE__ */ d("div", {
114
133
  className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
115
- children: [P, /* @__PURE__ */ n(V, {
116
- dataTest: `close-button-${y}`,
117
- "aria-label": g ? void 0 : "Close",
134
+ children: [V, /* @__PURE__ */ r(fe, {
135
+ dataTest: `close-button-${a}`,
136
+ "aria-label": N ? void 0 : "Close",
118
137
  variant: "textGray",
119
138
  size: "small",
120
- endIcon: /* @__PURE__ */ n(J, {
139
+ endIcon: /* @__PURE__ */ r(ce, {
121
140
  width: 20,
122
141
  height: 20
123
142
  }),
124
143
  className: "max-w-full shrink-0 whitespace-nowrap",
125
- onClick: (e) => c?.(e, "escapeKeyDown"),
144
+ disabled: p,
145
+ disabledReason: ee,
146
+ onClick: (e) => y?.(e, "escapeKeyDown"),
126
147
  style: {
127
148
  color: "var(--colors-delta-800)",
128
149
  paddingRight: "6px",
129
150
  paddingLeft: "6px"
130
151
  },
131
- children: g
152
+ children: N
132
153
  })]
133
154
  })]
134
- }), /* @__PURE__ */ n(ee.Provider, {
135
- value: B,
136
- children: I
155
+ }), /* @__PURE__ */ r(ye.Provider, {
156
+ value: Y,
157
+ children: /* @__PURE__ */ r(ue.Provider, {
158
+ value: te,
159
+ children: C
160
+ })
137
161
  })]
138
162
  })]
139
163
  }) : null;
140
164
  };
141
165
  export {
142
- he as StyledDialog
166
+ _e as StyledDialog
143
167
  };