asma-ui-core 3.103.1 → 3.105.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 (25) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +6 -6
  3. package/dist/components/data-display/chip/StyledChip.js +48 -47
  4. package/dist/components/data-display/tooltip/StyledTooltip.js +62 -60
  5. package/dist/components/feedback/dialog/StyledDialog.js +94 -79
  6. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +51 -51
  7. package/dist/components/inputs/button/StyledButton.module.js +13 -13
  8. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +91 -82
  9. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +152 -152
  10. package/dist/components/navigation/menu/StyledMenu.js +17 -16
  11. package/dist/components/navigation/menu/StyledMenu.module.js +5 -2
  12. package/dist/components/navigation/menu/StyledMenuList.js +50 -36
  13. package/dist/components/navigation/tabs/StyledTab.js +28 -19
  14. package/dist/components/navigation/tabs/StyledTabs.js +33 -33
  15. package/dist/helpers/focusable.js +3 -2
  16. package/dist/helpers/warnUnnamedDialog.js +6 -0
  17. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +10 -2
  18. package/dist/src/components/feedback/dialog/dialog-footer/StyledDialogFooter.d.ts +5 -3
  19. package/dist/src/components/navigation/menu/StyledMenuList.d.ts +2 -1
  20. package/dist/src/components/navigation/tabs/StyledTab.d.ts +11 -1
  21. package/dist/src/helpers/focusable.d.ts +1 -0
  22. package/dist/src/helpers/warnUnnamedDialog.d.ts +5 -0
  23. package/dist/table/components/columns/action-column/components/RowActionMenu.js +60 -47
  24. package/dist/table/shared-components/button/StyledButton.module.js +11 -11
  25. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { cn as h } from "../../../../helpers/cn.js";
2
2
  import { DotsVerticalIcon as g } from "../../../icons/dots-vertical-icon/DotsVerticalIcon.js";
3
3
  import { StyledButton as p } from "../../../inputs/button/StyledButton.js";
4
- import { StyledMenu as x } from "../../../navigation/menu/StyledMenu.js";
5
- import { StyledMenuItem as v } from "../../../navigation/menu/StyledMenuItem.js";
4
+ import { StyledMenu as v } from "../../../navigation/menu/StyledMenu.js";
5
+ import { StyledMenuItem as x } from "../../../navigation/menu/StyledMenuItem.js";
6
6
  import { useState as k } from "react";
7
7
  import { Fragment as y, jsx as n, jsxs as s } from "react/jsx-runtime";
8
8
  function O(e) {
@@ -17,9 +17,9 @@ function T({ action: e, showLabel: l, selectionTone: t = !1 }) {
17
17
  error: e.tone === "danger",
18
18
  size: e.size ?? "large",
19
19
  type: "button",
20
- disabled: e.disabled,
20
+ "aria-disabled": e.disabled ? !0 : void 0,
21
21
  startIcon: e.icon,
22
- onClick: e.onClick,
22
+ onClick: e.disabled ? void 0 : e.onClick,
23
23
  "aria-label": l && e.ariaLabel == null ? void 0 : o,
24
24
  children: l ? e.label : void 0
25
25
  });
@@ -58,7 +58,7 @@ function j({ plan: e, overflowMenuLabel: l, className: t, selectionTone: o = !1,
58
58
  }), c && /* @__PURE__ */ s(y, { children: [/* @__PURE__ */ n(A, {
59
59
  overflowMenuLabel: l,
60
60
  onOpen: (r) => a((i) => i ? null : r)
61
- }), /* @__PURE__ */ n(x, {
61
+ }), /* @__PURE__ */ n(v, {
62
62
  anchorEl: u,
63
63
  open: !!u,
64
64
  onClose: () => a(null),
@@ -70,7 +70,7 @@ function j({ plan: e, overflowMenuLabel: l, className: t, selectionTone: o = !1,
70
70
  vertical: "top",
71
71
  horizontal: "right"
72
72
  },
73
- children: b.map((r) => /* @__PURE__ */ n(v, {
73
+ children: b.map((r) => /* @__PURE__ */ n(x, {
74
74
  disabled: r.disabled,
75
75
  onClick: () => {
76
76
  a(null), r.onClick();
@@ -1,59 +1,60 @@
1
1
  import { cn as i } from "../../../helpers/cn.js";
2
- import { resolveSx as E } from "../../../helpers/sx.js";
3
- import { CloseIcon as L } from "../../icons/close-icon/CloseIcon.js";
4
- import { consumerOverrides as x } from "../../../helpers/classOverride.js";
5
- import { getChipPadding as U } from "./chipPadding.js";
6
- import q from "./StyledChip.module.js";
7
- import { forwardRef as A } from "react";
8
- import { jsx as m, jsxs as F } from "react/jsx-runtime";
9
- var O = A(({ dataTest: u, label: c, size: r = "medium", disabled: t, readOnly: o, clickable: b, icon: w, avatar: g, deleteIcon: y, onDelete: l, onClick: p, onMouseDown: _, onMouseUp: k, className: h, classes: a, sx: S, tabIndex: v, deleteButtonTabIndex: j, "aria-label": C, role: s, "aria-checked": R, "aria-readonly": B, "data-hovered": D, "data-focus": I, variant: G, color: H }, M) => {
10
- const n = !o && !t && (!!b || !!p), f = g ?? w, d = U(r, !!f, !!(l && !o)), N = {
11
- paddingTop: d.top,
12
- paddingRight: d.right,
13
- paddingBottom: d.bottom,
14
- paddingLeft: d.left
15
- }, K = (e) => {
16
- e.stopPropagation(), l?.(e);
2
+ import { resolveSx as L } from "../../../helpers/sx.js";
3
+ import { CloseIcon as U } from "../../icons/close-icon/CloseIcon.js";
4
+ import { consumerOverrides as b } from "../../../helpers/classOverride.js";
5
+ import { getChipPadding as q } from "./chipPadding.js";
6
+ import A from "./StyledChip.module.js";
7
+ import { forwardRef as F } from "react";
8
+ import { jsx as p, jsxs as G } from "react/jsx-runtime";
9
+ var oo = F(({ dataTest: v, label: l, size: r = "medium", disabled: o, readOnly: t, clickable: x, icon: _, avatar: w, deleteIcon: y, onDelete: h, onClick: n, onMouseDown: S, onMouseUp: k, className: s, classes: a, sx: j, tabIndex: u, deleteButtonTabIndex: D, "aria-label": R, role: f, "aria-checked": B, "aria-readonly": C, "data-hovered": M, "data-focus": N, variant: H, color: J }, I) => {
10
+ const d = !t && !o && (!!x || !!n), m = !t && !!o && (!!x || !!n), g = w ?? _, c = q(r, !!g, !!(h && !t)), K = {
11
+ paddingTop: c.top,
12
+ paddingRight: c.right,
13
+ paddingBottom: c.bottom,
14
+ paddingLeft: c.left
17
15
  }, P = (e) => {
18
- n && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p?.(e));
19
- }, W = x(h, "width"), $ = x(h, "max-width");
20
- return /* @__PURE__ */ F("div", {
21
- ref: M,
22
- "data-testid": u,
23
- "aria-label": C,
24
- "data-hovered": D,
25
- "data-focus": I,
26
- role: s ?? (n ? "button" : void 0),
27
- "aria-checked": s ? R : void 0,
28
- "aria-readonly": s ? B : void 0,
29
- tabIndex: o || t ? void 0 : n ? v ?? 0 : v,
30
- onClick: t || o ? void 0 : p,
31
- onKeyDown: t || o ? void 0 : P,
32
- onMouseDown: t || o ? void 0 : _,
33
- onMouseUp: t || o ? void 0 : k,
34
- className: i("box-border inline-flex items-center gap-1 rounded-[25px] border border-solid border-delta-300 bg-white text-base text-delta-700", !W && "w-fit", !$ && "max-w-full", r === "small" ? "h-6" : "h-8", o && "pointer-events-none", t && "pointer-events-none opacity-[0.38]", n && i("cursor-pointer outline-none", "asma-touch-ready", "data-[hovered]:border-gama-200 data-[hovered]:bg-gama-25 hover:border-gama-200 hover:bg-gama-25", "active:!border-gama-400 active:bg-gama-25 active:shadow-[0_0_0_2px_var(--colors-gama-400)]"), q["focus-ring"], a?.root, h),
16
+ e.stopPropagation(), h?.(e);
17
+ }, W = (e) => {
18
+ d && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.(e));
19
+ }, $ = b(s, "width"), E = b(s, "max-width");
20
+ return /* @__PURE__ */ G("div", {
21
+ ref: I,
22
+ "data-testid": v,
23
+ "aria-label": R,
24
+ "data-hovered": M,
25
+ "data-focus": N,
26
+ role: f ?? (d || m ? "button" : void 0),
27
+ "aria-checked": f ? B : void 0,
28
+ "aria-readonly": f ? C : void 0,
29
+ "aria-disabled": m ? !0 : void 0,
30
+ tabIndex: m ? u ?? 0 : t || o ? void 0 : d ? u ?? 0 : u,
31
+ onClick: o || t ? void 0 : n,
32
+ onKeyDown: o || t ? void 0 : W,
33
+ onMouseDown: o || t ? void 0 : S,
34
+ onMouseUp: o || t ? void 0 : k,
35
+ className: i("box-border inline-flex items-center gap-1 rounded-[25px] border border-solid border-delta-300 bg-white text-base text-delta-700", !$ && "w-fit", !E && "max-w-full", r === "small" ? "h-6" : "h-8", t && "pointer-events-none", o && "opacity-[0.38]", o && (m ? "cursor-not-allowed" : "pointer-events-none"), d && i("cursor-pointer outline-none", "asma-touch-ready", "data-[hovered]:border-gama-200 data-[hovered]:bg-gama-25 hover:border-gama-200 hover:bg-gama-25", "active:!border-gama-400 active:bg-gama-25 active:shadow-[0_0_0_2px_var(--colors-gama-400)]"), A["focus-ring"], a?.root, s),
35
36
  style: {
36
- ...N,
37
- ...E(S)
37
+ ...K,
38
+ ...L(j)
38
39
  },
39
40
  children: [
40
- f && /* @__PURE__ */ m("span", {
41
- className: i("flex shrink-0 items-center justify-center", r === "small" ? "h-[18px] w-[18px]" : "h-6 w-6", g ? a?.avatar : a?.icon),
42
- children: f
41
+ g && /* @__PURE__ */ p("span", {
42
+ className: i("flex shrink-0 items-center justify-center", r === "small" ? "h-[18px] w-[18px]" : "h-6 w-6", w ? a?.avatar : a?.icon),
43
+ children: g
43
44
  }),
44
- /* @__PURE__ */ m("span", {
45
+ /* @__PURE__ */ p("span", {
45
46
  className: i("min-w-0 truncate", a?.label),
46
- children: c
47
+ children: l
47
48
  }),
48
- l && !o && /* @__PURE__ */ m("button", {
49
+ h && !t && /* @__PURE__ */ p("button", {
49
50
  type: "button",
50
- tabIndex: j,
51
- "data-testid": `${u}-delete`,
52
- "aria-label": typeof c == "string" ? `Remove ${c}` : "Remove",
53
- onClick: K,
54
- disabled: t,
51
+ tabIndex: D,
52
+ "data-testid": `${v}-delete`,
53
+ "aria-label": typeof l == "string" ? `Remove ${l}` : "Remove",
54
+ onClick: P,
55
+ disabled: o,
55
56
  className: i("flex shrink-0 items-center justify-center rounded-full border border-solid border-delta-100 bg-delta-50 p-0 text-delta-700 [outline:none]", r === "small" ? "h-[18px] w-[18px]" : "h-5 w-5", a?.deleteIcon),
56
- children: y ?? /* @__PURE__ */ m(L, {
57
+ children: y ?? /* @__PURE__ */ p(U, {
57
58
  height: r === "small" ? 14 : 16,
58
59
  width: r === "small" ? 14 : 16,
59
60
  className: "min-w-0 shrink-0"
@@ -63,5 +64,5 @@ var O = A(({ dataTest: u, label: c, size: r = "medium", disabled: t, readOnly: o
63
64
  });
64
65
  });
65
66
  export {
66
- O as StyledChip
67
+ oo as StyledChip
67
68
  };
@@ -1,92 +1,94 @@
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 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) => {
9
9
  const n = document.createRange();
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({
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
15
  open: s,
16
- onOpenChange: S,
17
- placement: x,
16
+ onOpenChange: B,
17
+ placement: h,
18
18
  strategy: "fixed",
19
- whileElementsMounted: te,
19
+ whileElementsMounted: se,
20
20
  middleware: [
21
- ne(_ ?? (f ? 8 : 6)),
22
- oe({ padding: 8 }),
23
- se({ padding: 8 }),
24
- ...f ? [ee({ element: R })] : []
21
+ ae(L ?? (f ? 8 : 6)),
22
+ ie({ padding: 8 }),
23
+ ce({ padding: 8 }),
24
+ ...f ? [re({ element: R })] : []
25
25
  ]
26
- }), { getReferenceProps: M, getFloatingProps: B } = fe([
27
- ce(r, {
28
- enabled: !p && !A,
26
+ }), { getReferenceProps: M, getFloatingProps: H } = ue([
27
+ me(r, {
28
+ enabled: !p && !_,
29
29
  delay: {
30
- open: h,
31
- close: E
30
+ open: F,
31
+ close: T
32
32
  },
33
33
  move: !1,
34
- handleClose: re()
34
+ handleClose: le()
35
35
  }),
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(() => {
41
- 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);
46
- };
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
+ };
47
48
  }, [
48
49
  s,
49
50
  o.domReference,
50
- i
51
+ a,
52
+ e
51
53
  ]);
52
- const m = n.type === W, g = m ? /* @__PURE__ */ c("span", {
54
+ const u = n.type === K, g = u ? /* @__PURE__ */ c("span", {
53
55
  style: { display: "contents" },
54
56
  children: n
55
57
  }) : n;
56
- J(() => {
57
- const e = o.domReference.current;
58
- !m || !e || o.setPositionReference({
59
- contextElement: e,
60
- getBoundingClientRect: () => me(e)
58
+ X(() => {
59
+ const t = o.domReference.current;
60
+ !u || !t || o.setPositionReference({
61
+ contextElement: t,
62
+ getBoundingClientRect: () => Re(t)
61
63
  });
62
- }, [m, o]);
63
- const { ["aria-describedby"]: be, ...I } = M({
64
- ref: de([o.setReference, g.ref]),
64
+ }, [u, o]);
65
+ const { ["aria-describedby"]: ve, ...U } = M({
66
+ ref: ge([o.setReference, g.ref]),
65
67
  ...g.props
66
68
  });
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(),
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(),
73
75
  style: {
74
- ...u ? k : {},
75
- ...C,
76
+ ...m ? W : {},
77
+ ...I,
76
78
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
77
79
  overflow: "visible",
78
80
  ...d?.tooltip?.style,
79
- ...U(d?.tooltip?.sx)
81
+ ...k(d?.tooltip?.sx)
80
82
  },
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
+ 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, {
83
85
  ref: R,
84
86
  context: r,
85
- fill: ue
87
+ fill: ye
86
88
  })]
87
89
  })
88
90
  })] });
89
91
  };
90
92
  export {
91
- Te as StyledTooltip
93
+ we as StyledTooltip
92
94
  };
@@ -1,143 +1,158 @@
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 g } from "../../../helpers/cn.js";
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 = {
12
13
  xs: 444,
13
14
  sm: 600,
14
15
  md: 900,
15
16
  lg: 1200,
16
17
  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;
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(() => ({
20
+ 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;
25
+ o && !o.id && (o.id = _);
26
+ const O = o?.id;
27
+ O !== h && V(O), e && t && !n && !o && !R.current && (R.current = !0, ae(d));
28
+ }, [
29
+ t,
30
+ u,
31
+ w,
32
+ I,
33
+ h,
34
+ _,
35
+ d
36
+ ]), k(() => {
37
+ M.current && !t && a?.transition?.onExited?.(), M.current = t;
38
+ }, [t, a]), B(() => {
39
+ const e = f.current;
26
40
  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);
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);
29
43
  return () => {
30
- l(), f.current?.isConnected && f.current.focus({ preventScroll: !0 });
44
+ n(), y.current?.isConnected && y.current.focus({ preventScroll: !0 });
31
45
  };
32
- }, [t]), w(() => {
46
+ }, [t]), k(() => {
33
47
  if (!t) return;
34
- const e = document.body.style.overflow, l = document.documentElement.style.overflow;
48
+ const e = document.body.style.overflow, n = document.documentElement.style.overflow;
35
49
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
36
- document.body.style.overflow = e, document.documentElement.style.overflow = l;
50
+ document.body.style.overflow = e, document.documentElement.style.overflow = n;
37
51
  };
38
52
  }, [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) => {
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) => {
47
61
  e.preventDefault();
48
62
  };
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);
63
+ return k(() => {
64
+ if (!t || F) return;
65
+ const e = (n) => {
66
+ if (n.key !== "Escape" || n.defaultPrevented) return;
67
+ const o = document.activeElement;
68
+ o instanceof Element && o.closest("dialog[open]") !== f.current || ne(n);
55
69
  };
56
70
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
57
- }), t ? /* @__PURE__ */ r("dialog", {
58
- ref: u,
71
+ }), t ? /* @__PURE__ */ i("dialog", {
72
+ ref: f,
59
73
  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),
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),
65
79
  style: {
66
80
  zIndex: 999,
67
- ...D(W),
68
- ...R
81
+ ...W(U),
82
+ ...L
69
83
  },
70
- children: [/* @__PURE__ */ n("div", {
71
- ...G,
72
- className: h("absolute inset-0 bg-[#626e7eb2]", K),
73
- style: T,
84
+ children: [/* @__PURE__ */ l("div", {
85
+ ...te,
86
+ className: g("absolute inset-0 bg-[#626e7eb2]", Y),
87
+ style: Z,
74
88
  onClick: (e) => {
75
- X?.(e), e.defaultPrevented || c?.(e, "backdropClick");
89
+ ee?.(e), e.defaultPrevented || p?.(e, "backdropClick");
76
90
  }
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),
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),
79
93
  style: {
80
94
  minWidth: 0,
81
95
  minHeight: 0,
82
- ...!a && N ? { maxWidth: N } : {},
83
- ...a ? {
96
+ ...!x && j ? { maxWidth: j } : {},
97
+ ...x ? {
84
98
  width: "100%",
85
99
  maxWidth: "100%",
86
100
  height: "100%",
87
101
  maxHeight: "100%"
88
102
  } : {
89
- width: H ? "calc(100% - 64px)" : "auto",
103
+ width: z ? "calc(100% - 64px)" : "auto",
90
104
  maxHeight: "100%"
91
105
  },
92
- ...D(p.sx),
93
- ...p.style,
94
- ...a ? {
106
+ ...W(b.sx),
107
+ ...b.style,
108
+ ...x ? {
95
109
  width: "100%",
96
110
  maxWidth: "100%",
97
111
  height: "100%",
98
112
  maxHeight: "100%"
99
113
  } : { maxHeight: "calc(100% - 64px)" }
100
114
  },
101
- children: [(!!m || !!i || k) && /* @__PURE__ */ r("div", {
115
+ children: [(!!c || !!s || D) && /* @__PURE__ */ i("div", {
102
116
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
103
- children: [/* @__PURE__ */ r("div", {
117
+ children: [/* @__PURE__ */ i("div", {
104
118
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
105
- children: [m && /* @__PURE__ */ n("div", {
119
+ children: [c && /* @__PURE__ */ l("div", {
120
+ id: H,
106
121
  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,
122
+ children: c
123
+ }), s && /* @__PURE__ */ l("div", {
124
+ id: m,
110
125
  className: "flex text-2xl font-semibold leading-8 text-delta-800",
111
- children: i
126
+ children: s
112
127
  })]
113
- }), k && /* @__PURE__ */ r("div", {
128
+ }), D && /* @__PURE__ */ i("div", {
114
129
  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",
130
+ children: [G, /* @__PURE__ */ l(ie, {
131
+ dataTest: `close-button-${d}`,
132
+ "aria-label": N ? void 0 : "Close",
118
133
  variant: "textGray",
119
134
  size: "small",
120
- endIcon: /* @__PURE__ */ n(J, {
135
+ endIcon: /* @__PURE__ */ l(le, {
121
136
  width: 20,
122
137
  height: 20
123
138
  }),
124
139
  className: "max-w-full shrink-0 whitespace-nowrap",
125
- onClick: (e) => c?.(e, "escapeKeyDown"),
140
+ onClick: (e) => p?.(e, "escapeKeyDown"),
126
141
  style: {
127
142
  color: "var(--colors-delta-800)",
128
143
  paddingRight: "6px",
129
144
  paddingLeft: "6px"
130
145
  },
131
- children: g
146
+ children: N
132
147
  })]
133
148
  })]
134
- }), /* @__PURE__ */ n(ee.Provider, {
135
- value: B,
149
+ }), /* @__PURE__ */ l(se.Provider, {
150
+ value: J,
136
151
  children: I
137
152
  })]
138
153
  })]
139
154
  }) : null;
140
155
  };
141
156
  export {
142
- he as StyledDialog
157
+ Ie as StyledDialog
143
158
  };