@yuno-payments/dashboard-design-system 2.1.1 → 2.2.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,14 +1,14 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- import * as i from "react";
3
- import "react-dom";
2
+ import * as a from "react";
3
+ import { createPortal as M } from "react-dom";
4
4
  import { cva as x } from "../../../node_modules/class-variance-authority/dist/index.js";
5
5
  import { cn as m, normalizeDimension as g } from "../../../lib/utils.js";
6
- import { useBodyScrollLock as C } from "../../../hooks/use-body-scroll-lock.js";
7
- import { useEscapeKey as L } from "../../../hooks/use-escape-key.js";
8
- import { DialogHeader as M } from "../../molecules/dialog-header/dialog-header.js";
9
- import { DialogContent as B } from "../../molecules/dialog-content/dialog-content.js";
10
- import { DialogFooter as F } from "../../molecules/dialog-footer/dialog-footer.js";
11
- const I = x(
6
+ import { useBodyScrollLock as B } from "../../../hooks/use-body-scroll-lock.js";
7
+ import { useEscapeKey as C } from "../../../hooks/use-escape-key.js";
8
+ import { DialogHeader as F } from "../../molecules/dialog-header/dialog-header.js";
9
+ import { DialogContent as I } from "../../molecules/dialog-content/dialog-content.js";
10
+ import { DialogFooter as R } from "../../molecules/dialog-footer/dialog-footer.js";
11
+ const H = x(
12
12
  "fixed inset-0 z-dialog flex items-center justify-center p-4",
13
13
  {
14
14
  variants: {
@@ -22,7 +22,7 @@ const I = x(
22
22
  verticalAlign: "center"
23
23
  }
24
24
  }
25
- ), R = x(
25
+ ), K = x(
26
26
  "relative bg-background rounded-lg shadow-lg border border-border max-h-[90vh] overflow-hidden flex flex-col",
27
27
  {
28
28
  variants: {
@@ -38,15 +38,15 @@ const I = x(
38
38
  size: "default"
39
39
  }
40
40
  }
41
- ), H = i.forwardRef(
41
+ ), O = a.forwardRef(
42
42
  ({
43
43
  className: w,
44
44
  verticalAlign: p,
45
45
  title: v,
46
- open: a,
47
- closeIcon: l,
46
+ open: i,
47
+ closeIcon: o,
48
48
  buttons: y = [],
49
- widthContainer: o,
49
+ widthContainer: r,
50
50
  heightContainer: d,
51
51
  backButtonAction: b,
52
52
  showActions: h = !0,
@@ -58,25 +58,24 @@ const I = x(
58
58
  footerClassName: E,
59
59
  ...T
60
60
  }, V) => {
61
- const [s, S] = i.useState(!1), [r, c] = i.useState(a), [u, f] = i.useState(!1);
62
- if (i.useEffect(() => {
61
+ const [s, S] = a.useState(!1), [l, c] = a.useState(i), [u, f] = a.useState(!1);
62
+ if (a.useEffect(() => {
63
63
  const t = () => {
64
64
  S(window.innerWidth <= 599);
65
65
  };
66
66
  return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
67
- }, []), i.useEffect(() => {
67
+ }, []), a.useEffect(() => {
68
68
  let t, n;
69
- return a ? (c(!0), t = setTimeout(() => f(!0), 10)) : r && (f(!1), n = setTimeout(() => {
69
+ return i ? (c(!0), t = setTimeout(() => f(!0), 10)) : l && (f(!1), n = setTimeout(() => {
70
70
  c(!1);
71
71
  }, 600)), () => {
72
72
  t && clearTimeout(t), n && clearTimeout(n);
73
73
  };
74
- }, [a, r]), C(a), L(a, l), !r) return null;
74
+ }, [i, l]), B(i), C(i, o), !l) return null;
75
75
  const A = {
76
- width: o && !s ? g(o) : void 0,
76
+ width: r && !s ? g(r) : void 0,
77
77
  height: d && !s ? g(d) : void 0
78
- };
79
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
78
+ }, L = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
80
79
  /* @__PURE__ */ e.jsx(
81
80
  "div",
82
81
  {
@@ -84,22 +83,22 @@ const I = x(
84
83
  "fixed inset-0 z-dialog bg-black/25 transition-opacity duration-600 ease-out",
85
84
  u ? "opacity-100" : "opacity-0"
86
85
  ),
87
- onClick: l,
86
+ onClick: o,
88
87
  "aria-hidden": "true"
89
88
  }
90
89
  ),
91
- /* @__PURE__ */ e.jsx("div", { className: m(I({ verticalAlign: p })), children: /* @__PURE__ */ e.jsxs(
90
+ /* @__PURE__ */ e.jsx("div", { className: m(H({ verticalAlign: p })), children: /* @__PURE__ */ e.jsxs(
92
91
  "div",
93
92
  {
94
93
  ref: V,
95
94
  className: m(
96
95
  "yuno-dialog",
97
- R({
96
+ K({
98
97
  size: s ? "fullscreen" : "default"
99
98
  }),
100
99
  "transition-all duration-600 ease-out",
101
100
  u ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-98 -translate-y-2",
102
- o && !s && "max-w-none",
101
+ r && !s && "max-w-none",
103
102
  w
104
103
  ),
105
104
  style: A,
@@ -108,24 +107,25 @@ const I = x(
108
107
  ...T,
109
108
  children: [
110
109
  z && /* @__PURE__ */ e.jsx(
111
- M,
110
+ F,
112
111
  {
113
112
  title: v,
114
- onClose: l,
113
+ onClose: o,
115
114
  onBack: b,
116
115
  otherActions: j,
117
116
  className: k
118
117
  }
119
118
  ),
120
- /* @__PURE__ */ e.jsx(B, { className: D, children: N }),
121
- h && /* @__PURE__ */ e.jsx(F, { buttons: y, className: E })
119
+ /* @__PURE__ */ e.jsx(I, { className: D, children: N }),
120
+ h && /* @__PURE__ */ e.jsx(R, { buttons: y, className: E })
122
121
  ]
123
122
  }
124
123
  ) })
125
124
  ] });
125
+ return M(L, document.body);
126
126
  }
127
127
  );
128
- H.displayName = "Dialog";
128
+ O.displayName = "Dialog";
129
129
  export {
130
- H as Dialog
130
+ O as Dialog
131
131
  };
@@ -1,14 +1,14 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
2
  import * as i from "react";
3
- import "react-dom";
3
+ import { createPortal as H } from "react-dom";
4
4
  import { cva as g } from "../../../node_modules/class-variance-authority/dist/index.js";
5
5
  import { cn as r, normalizeDimension as p } from "../../../lib/utils.js";
6
- import { useBodyScrollLock as B } from "../../../hooks/use-body-scroll-lock.js";
7
- import { useEscapeKey as H } from "../../../hooks/use-escape-key.js";
8
- import { Icon as M } from "../../atoms/icon/icon.js";
6
+ import { useBodyScrollLock as M } from "../../../hooks/use-body-scroll-lock.js";
7
+ import { useEscapeKey as R } from "../../../hooks/use-escape-key.js";
8
+ import { Icon as W } from "../../atoms/icon/icon.js";
9
9
  import { Button as x } from "../../atoms/button/button.js";
10
10
  import { Typography as b } from "../../atoms/typography/typography.js";
11
- const R = g(
11
+ const D = g(
12
12
  "fixed z-sheet bg-background shadow-lg transition-transform duration-300 ease-in-out",
13
13
  {
14
14
  variants: {
@@ -38,7 +38,7 @@ const R = g(
38
38
  isOpen: !1
39
39
  }
40
40
  }
41
- ), W = g(
41
+ ), F = g(
42
42
  "fixed inset-0 z-sheet bg-black/50 transition-opacity duration-300",
43
43
  {
44
44
  variants: {
@@ -51,7 +51,7 @@ const R = g(
51
51
  isOpen: !1
52
52
  }
53
53
  }
54
- ), D = i.forwardRef(
54
+ ), K = i.forwardRef(
55
55
  ({
56
56
  className: y,
57
57
  side: s = "right",
@@ -70,9 +70,9 @@ const R = g(
70
70
  footerClassName: z,
71
71
  loading: T = !1,
72
72
  ...V
73
- }, C) => {
74
- const [E, f] = i.useState(!1), [u, h] = i.useState(!1);
75
- if (B(a), H(a, n), i.useEffect(() => {
73
+ }, E) => {
74
+ const [I, f] = i.useState(!1), [u, h] = i.useState(!1);
75
+ if (M(a), R(a, n), i.useEffect(() => {
76
76
  if (a) {
77
77
  f(!0);
78
78
  const t = setTimeout(() => h(!0), 10);
@@ -82,16 +82,15 @@ const R = g(
82
82
  const t = setTimeout(() => f(!1), 300);
83
83
  return () => clearTimeout(t);
84
84
  }
85
- }, [a]), !E) return null;
86
- const d = p(j), m = p(v), I = {
85
+ }, [a]), !I) return null;
86
+ const d = p(j), m = p(v), A = {
87
87
  ...d && (s === "left" || s === "right") ? { width: d, maxWidth: d } : {},
88
88
  ...m && (s === "top" || s === "bottom") ? { height: m, maxHeight: m } : {}
89
- };
90
- return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
89
+ }, B = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
91
90
  /* @__PURE__ */ e.jsx(
92
91
  "div",
93
92
  {
94
- className: W({ isOpen: u }),
93
+ className: F({ isOpen: u }),
95
94
  onClick: n,
96
95
  "aria-hidden": "true"
97
96
  }
@@ -99,9 +98,9 @@ const R = g(
99
98
  /* @__PURE__ */ e.jsx(
100
99
  "div",
101
100
  {
102
- ref: C,
103
- className: r(R({ side: s, isOpen: u }), y),
104
- style: I,
101
+ ref: E,
102
+ className: r(D({ side: s, isOpen: u }), y),
103
+ style: A,
105
104
  role: "dialog",
106
105
  "aria-modal": "true",
107
106
  "aria-labelledby": l ? "sheet-title" : void 0,
@@ -145,7 +144,7 @@ const R = g(
145
144
  onClick: n,
146
145
  "aria-label": "Close",
147
146
  className: "h-6 w-6",
148
- children: /* @__PURE__ */ e.jsx(M, { name: "X", size: "md" })
147
+ children: /* @__PURE__ */ e.jsx(W, { name: "X", size: "md" })
149
148
  }
150
149
  )
151
150
  ]
@@ -159,13 +158,13 @@ const R = g(
159
158
  "flex items-center justify-end gap-3 border-t border-border p-6",
160
159
  z
161
160
  ),
162
- children: c.map((t, A) => /* @__PURE__ */ e.jsx(
161
+ children: c.map((t, C) => /* @__PURE__ */ e.jsx(
163
162
  x,
164
163
  {
165
164
  disabled: T || t.disabled,
166
165
  ...t
167
166
  },
168
- A
167
+ C
169
168
  ))
170
169
  }
171
170
  )
@@ -173,9 +172,10 @@ const R = g(
173
172
  }
174
173
  )
175
174
  ] });
175
+ return H(B, document.body);
176
176
  }
177
177
  );
178
- D.displayName = "Sheet";
178
+ K.displayName = "Sheet";
179
179
  export {
180
- D as Sheet
180
+ K as Sheet
181
181
  };