asma-ui-core 3.49.2 → 3.50.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,10 +1,10 @@
1
1
  import { cn as f } from "../../../helpers/cn.js";
2
- import { resolveSx as D } from "../../../helpers/sx.js";
3
- import { CloseIcon as B } from "../../icons/close-icon/CloseIcon.js";
4
- import { StyledButton as F } from "../../inputs/button/StyledButton.js";
2
+ import { resolveSx as S } from "../../../helpers/sx.js";
3
+ import { CloseIcon as X } from "../../icons/close-icon/CloseIcon.js";
4
+ import { StyledButton as B } from "../../inputs/button/StyledButton.js";
5
5
  import { useMobileMediaQuery as G } from "../../../hooks/useMediaQuery.hook.js";
6
6
  import P from "./StyledDialog.module.js";
7
- import { useEffect as _, useLayoutEffect as Q, useRef as u } from "react";
7
+ import { useEffect as D, useLayoutEffect as Q, useRef as u } from "react";
8
8
  import { jsx as l, jsxs as r } from "react/jsx-runtime";
9
9
  var $ = {
10
10
  xs: 444,
@@ -12,51 +12,51 @@ var $ = {
12
12
  md: 900,
13
13
  lg: 1200,
14
14
  xl: 1536
15
- }, te = ({ open: t, onClose: a, children: C, dataTest: i, maxWidth: x = "sm", fullWidth: E, fullScreen: H, scroll: p = "paper", disableEscapeKeyDown: h, className: S, style: j, sx: M, classes: y, PaperProps: R, slotProps: o, onCloseText: w, showCloseIcon: b = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: W }) => {
16
- const I = G(), v = u(null), c = u(!1), g = u(t), n = I ? !0 : H;
17
- _(() => {
15
+ }, te = ({ open: t, onClose: a, children: _, dataTest: i, maxWidth: x = "sm", fullWidth: C, fullScreen: E, scroll: p = "paper", disableEscapeKeyDown: h, className: H, style: j, sx: M, classes: y, PaperProps: R, slotProps: o, onCloseText: w, showCloseIcon: v = !0, dialogLabel: d, dialogTitle: s, dialogHeaderNode: W }) => {
16
+ const I = G(), b = u(null), c = u(!1), g = u(t), n = I ? !0 : E;
17
+ D(() => {
18
18
  g.current && !t && o?.transition?.onExited?.(), g.current = t;
19
19
  }, [t, o]), Q(() => {
20
- const e = v.current;
21
- e && t && !e.open && e.showModal();
22
- }, [t]), _(() => {
20
+ const e = b.current;
21
+ !e || !t || e.open || (e.showModal(), e.focus({ preventScroll: !0 }), requestAnimationFrame(() => e.open && e.focus({ preventScroll: !0 })));
22
+ }, [t]), D(() => {
23
23
  if (!t) return;
24
- const e = document.body.style.overflow, A = document.documentElement.style.overflow;
24
+ const e = document.body.style.overflow, K = document.documentElement.style.overflow;
25
25
  return document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden", () => {
26
- document.body.style.overflow = e, document.documentElement.style.overflow = A;
26
+ document.body.style.overflow = e, document.documentElement.style.overflow = K;
27
27
  };
28
28
  }, [t]);
29
29
  const m = {
30
30
  ...R,
31
31
  ...o?.paper
32
- }, k = x === !1 ? void 0 : $[x], { className: O, style: z, onClick: K, ...X } = o?.backdrop ?? {}, N = (e) => {
32
+ }, k = x === !1 ? void 0 : $[x], { className: O, style: z, onClick: q, ...A } = o?.backdrop ?? {}, N = (e) => {
33
33
  c.current || (c.current = !0, window.setTimeout(() => {
34
34
  c.current = !1;
35
35
  }, 0), a?.(e, "escapeKeyDown"));
36
- }, q = (e) => {
36
+ }, F = (e) => {
37
37
  e.preventDefault(), h || N(e);
38
38
  };
39
39
  return t ? /* @__PURE__ */ r("dialog", {
40
- ref: v,
40
+ ref: b,
41
41
  tabIndex: -1,
42
42
  "data-testid": i,
43
43
  "aria-label": i,
44
- onCancel: q,
44
+ onCancel: F,
45
45
  onKeyDown: (e) => {
46
46
  e.key !== "Escape" || h || (e.preventDefault(), N(e));
47
47
  },
48
- className: f(P.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", p === "body" && "overflow-y-auto", S, y?.root),
48
+ className: f(P.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", p === "body" && "overflow-y-auto", H, y?.root),
49
49
  style: {
50
50
  zIndex: 999,
51
- ...D(M),
51
+ ...S(M),
52
52
  ...j
53
53
  },
54
54
  children: [/* @__PURE__ */ l("div", {
55
- ...X,
55
+ ...A,
56
56
  className: f("absolute inset-0 bg-[#626e7eb2]", O),
57
57
  style: z,
58
58
  onClick: (e) => {
59
- K?.(e), e.defaultPrevented || a?.(e, "backdropClick");
59
+ q?.(e), e.defaultPrevented || a?.(e, "backdropClick");
60
60
  }
61
61
  }), /* @__PURE__ */ r("div", {
62
62
  className: f("relative z-[1] flex overflow-hidden rounded-lg border-0 bg-white p-0 text-delta-800 shadow-[0px_4px_40px_0px_#22213366]", p === "paper" && "flex-col", n && "rounded-none", m.className, y?.paper),
@@ -70,10 +70,10 @@ var $ = {
70
70
  height: "100%",
71
71
  maxHeight: "100%"
72
72
  } : {
73
- width: E ? "calc(100% - 64px)" : "auto",
73
+ width: C ? "calc(100% - 64px)" : "auto",
74
74
  maxHeight: "100%"
75
75
  },
76
- ...D(m.sx),
76
+ ...S(m.sx),
77
77
  ...m.style,
78
78
  ...n ? {
79
79
  width: "100%",
@@ -82,7 +82,7 @@ var $ = {
82
82
  maxHeight: "100%"
83
83
  } : { maxHeight: "calc(100% - 64px)" }
84
84
  },
85
- children: [(!!d || !!s || b) && /* @__PURE__ */ r("div", {
85
+ children: [(!!d || !!s || v) && /* @__PURE__ */ r("div", {
86
86
  className: "box-border flex w-full min-w-0 max-w-full justify-between px-4 pt-4",
87
87
  children: [/* @__PURE__ */ r("div", {
88
88
  className: "flex min-w-0 flex-1 flex-col justify-start gap-0.5",
@@ -93,14 +93,14 @@ var $ = {
93
93
  className: "flex text-2xl font-semibold leading-8 text-delta-800",
94
94
  children: s
95
95
  })]
96
- }), b && /* @__PURE__ */ r("div", {
96
+ }), v && /* @__PURE__ */ r("div", {
97
97
  className: "flex min-w-0 max-w-full shrink-0 justify-end gap-2",
98
- children: [W, /* @__PURE__ */ l(F, {
98
+ children: [W, /* @__PURE__ */ l(B, {
99
99
  dataTest: `close-button-${i}`,
100
100
  "aria-label": w ? void 0 : "Close",
101
101
  variant: "textGray",
102
102
  size: "small",
103
- endIcon: /* @__PURE__ */ l(B, {
103
+ endIcon: /* @__PURE__ */ l(X, {
104
104
  width: 20,
105
105
  height: 20
106
106
  }),
@@ -114,7 +114,7 @@ var $ = {
114
114
  children: w
115
115
  })]
116
116
  })]
117
- }), C]
117
+ }), _]
118
118
  })]
119
119
  }) : null;
120
120
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.49.2",
6
+ "version": "3.50.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",