prometeo-design-system 4.6.0 → 4.6.2

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,84 +1,88 @@
1
1
  import { j as o } from "./jsx-runtime-GkKLlHH4.js";
2
- import { forwardRef as y, memo as r, useState as D, useRef as x, useCallback as l, useImperativeHandle as k } from "react";
3
- import { c as j } from "./cn-B6yFEsav.js";
4
- const C = y(
5
- ({ children: e, onClose: t, className: c }, i) => {
6
- const [n, s] = D(!1), [u, g] = D(null), f = x(t), p = x(u);
7
- f.current = t, p.current = u;
8
- const m = l((a) => {
9
- g(a ?? null), s(!0);
10
- }, []), d = l(() => {
11
- s(!1), f.current?.(p.current), setTimeout(() => g(null), 300);
2
+ import { forwardRef as R, memo as a, useState as b, useRef as g, useCallback as n, useImperativeHandle as O } from "react";
3
+ import { createPortal as F } from "react-dom";
4
+ import { c as y } from "./cn-B6yFEsav.js";
5
+ const N = R(
6
+ ({ children: e, onClose: t, className: r, attachToParent: s = !1, zindex: c = 500 }, i) => {
7
+ const [u, f] = b(!1), [d, m] = b(null), D = g(t), p = g(d);
8
+ D.current = t, p.current = d;
9
+ const j = n((l) => {
10
+ m(l ?? null), f(!0);
11
+ }, []), x = n(() => {
12
+ f(!1), D.current?.(p.current), setTimeout(() => m(null), 300);
12
13
  }, []);
13
- return k(
14
+ O(
14
15
  i,
15
16
  () => ({
16
- open: m,
17
- close: d,
18
- isOpen: n,
17
+ open: j,
18
+ close: x,
19
+ isOpen: u,
19
20
  getContext: () => p.current
20
21
  }),
21
- [m, d, n]
22
- ), /* @__PURE__ */ o.jsx(o.Fragment, { children: n && /* @__PURE__ */ o.jsxs(
22
+ [j, x, u]
23
+ );
24
+ const C = /* @__PURE__ */ o.jsx(o.Fragment, { children: u && /* @__PURE__ */ o.jsxs(
23
25
  "div",
24
26
  {
25
27
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
26
- onClick: d,
28
+ style: { zIndex: c },
29
+ onClick: x,
27
30
  children: [
28
31
  /* @__PURE__ */ o.jsx(
29
32
  "div",
30
33
  {
31
- onClick: (a) => a.stopPropagation(),
34
+ onClick: (l) => l.stopPropagation(),
32
35
  className: "absolute bg-transparent z-[-1] w-[calc(75%+10px)] h-[calc(75%+10px)] xl:w-[calc(75%+30px)] xl:h-[calc(83.33%+30px)] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 "
33
36
  }
34
37
  ),
35
38
  /* @__PURE__ */ o.jsx(
36
39
  "div",
37
40
  {
38
- onClick: (a) => a.stopPropagation(),
39
- className: j(
41
+ onClick: (l) => l.stopPropagation(),
42
+ className: y(
40
43
  "bg-neutral-default-default w-3/4 h-3/4 xl:w-3/4 xl:h-10/12 rounded-lg shadow-lg border-neutral-strong-default border relative p-6",
41
- c
44
+ r
42
45
  ),
43
- children: typeof e == "function" ? e(u) : e
46
+ children: typeof e == "function" ? e(d) : e
44
47
  }
45
48
  )
46
49
  ]
47
50
  }
48
51
  ) });
52
+ return s ? C : F(C, document.body);
49
53
  }
50
54
  );
51
- C.displayName = "Dialog";
52
- const b = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: j("flex flex-col gap-4 h-full"), children: e }) }));
53
- b.displayName = "DialogContent";
54
- const N = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }));
55
- N.displayName = "DialogTitle";
56
- const h = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
57
- h.displayName = "DialogHeader";
58
- const v = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
59
- v.displayName = "DialogFooter";
60
- const w = Object.assign(C, {
61
- Content: b,
62
- Header: h,
63
- Footer: v,
64
- Title: N
55
+ N.displayName = "Dialog";
56
+ const h = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: y("flex flex-col gap-4 h-full"), children: e }) }));
57
+ h.displayName = "DialogContent";
58
+ const v = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }));
59
+ v.displayName = "DialogTitle";
60
+ const k = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
61
+ k.displayName = "DialogHeader";
62
+ const w = a(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
63
+ w.displayName = "DialogFooter";
64
+ const H = Object.assign(N, {
65
+ Content: h,
66
+ Header: k,
67
+ Footer: w,
68
+ Title: v
65
69
  });
66
- w.displayName = "DialogModal";
67
- const H = () => {
68
- const e = x(null), t = l((s) => {
69
- e.current?.open(s);
70
- }, []), c = l(() => {
70
+ H.displayName = "DialogModal";
71
+ const M = () => {
72
+ const e = g(null), t = n((i) => {
73
+ e.current?.open(i);
74
+ }, []), r = n(() => {
71
75
  e.current?.close();
72
- }, []), i = l(() => e.current?.isOpen ?? !1, []), n = l(() => e.current?.getContext() ?? null, []);
76
+ }, []), s = n(() => e.current?.isOpen ?? !1, []), c = n(() => e.current?.getContext() ?? null, []);
73
77
  return {
74
78
  ref: e,
75
79
  open: t,
76
- close: c,
77
- isOpen: i,
78
- getContext: n
80
+ close: r,
81
+ isOpen: s,
82
+ getContext: c
79
83
  };
80
84
  };
81
85
  export {
82
- w as default,
83
- H as useDialogControl
86
+ H as default,
87
+ M as useDialogControl
84
88
  };
@@ -1,116 +1,119 @@
1
1
  import { j as f } from "./jsx-runtime-GkKLlHH4.js";
2
2
  import { c as R } from "./cn-B6yFEsav.js";
3
3
  import { c as j } from "./index-BOQuZ0gG.js";
4
- import { createPortal as P } from "react-dom";
5
- import { forwardRef as B, useRef as m, useState as v, useEffect as s, useCallback as C, useImperativeHandle as L } from "react";
6
- import Y from "./Button.es.js";
7
- import { Close as F } from "./Icons/Close.es.js";
8
- const H = B((t, i) => {
9
- const a = m(null), [e, u] = v(t.defaultOpen || !1), [r, o] = v(null), d = m(t.onClose), l = m(r), p = m(/* @__PURE__ */ new Set()), {
4
+ import { createPortal as B } from "react-dom";
5
+ import { forwardRef as L, useRef as m, useState as v, useEffect as a, useCallback as x, useImperativeHandle as Y } from "react";
6
+ import F from "./Button.es.js";
7
+ import { Close as H } from "./Icons/Close.es.js";
8
+ const $ = L((t, i) => {
9
+ const l = m(null), [e, u] = v(t.defaultOpen || !1), [r, s] = v(null), d = m(t.onClose), c = m(r), p = m(/* @__PURE__ */ new Set()), {
10
10
  modal: b = !1,
11
11
  children: y,
12
12
  className: g,
13
13
  direction: O = "left",
14
- attachToParent: c = !1,
15
- closeOnOverlayClick: h = !1,
14
+ attachToParent: h = !1,
15
+ closeOnOverlayClick: n = !1,
16
16
  hideCloseButton: N = !1,
17
- unmountChildrenOnClose: x = !1
18
- } = t, k = m(h), D = m(e);
19
- l.current = r;
20
- const [T, V] = v(() => !x);
21
- s(() => {
22
- x && e && V(!0);
23
- }, [e, x]), s(() => {
17
+ unmountChildrenOnClose: C = !1,
18
+ zindex: T = 499
19
+ } = t, k = m(n), D = m(e);
20
+ c.current = r;
21
+ const [V, P] = v(() => !C);
22
+ a(() => {
23
+ C && e && P(!0);
24
+ }, [e, C]), a(() => {
24
25
  D.current = e;
25
- }, [e]), s(() => {
26
- l.current = r;
27
- }, [r]), s(() => {
28
- k.current = h;
29
- }, [h]);
30
- const S = (n) => {
31
- if (!a.current)
26
+ }, [e]), a(() => {
27
+ c.current = r;
28
+ }, [r]), a(() => {
29
+ k.current = n;
30
+ }, [n]);
31
+ const z = (o) => {
32
+ if (!l.current)
32
33
  return;
33
- const I = a.current;
34
- I && !I.contains(n.target) && k.current && D.current && w();
34
+ const E = l.current;
35
+ E && !E.contains(o.target) && k.current && D.current && w();
35
36
  };
36
- s(() => {
37
+ a(() => {
37
38
  if (!k.current || b || !e)
38
39
  return;
39
- const n = setTimeout(() => {
40
- document.addEventListener("click", S);
40
+ const o = setTimeout(() => {
41
+ document.addEventListener("click", z);
41
42
  }, 0);
42
43
  return () => {
43
- clearTimeout(n), document.removeEventListener("click", S);
44
+ clearTimeout(o), document.removeEventListener("click", z);
44
45
  };
45
- }, [h, e, b]), s(() => {
46
+ }, [n, e, b]), a(() => {
46
47
  d.current = t.onClose;
47
48
  }, [t.onClose]);
48
- const z = C((n) => {
49
- o(n ?? null), u(!0);
50
- }, []), w = C(() => {
51
- u(!1), d.current?.(l.current), setTimeout(() => o(null), 300);
49
+ const I = x((o) => {
50
+ s(o ?? null), u(!0);
51
+ }, []), w = x(() => {
52
+ u(!1), d.current?.(c.current), setTimeout(() => s(null), 300);
52
53
  }, []);
53
- s(() => {
54
- p.current.forEach((n) => {
54
+ a(() => {
55
+ p.current.forEach((o) => {
55
56
  try {
56
- n(e);
57
+ o(e);
57
58
  } catch {
58
59
  }
59
60
  });
60
- }, [e]), L(
61
+ }, [e]), Y(
61
62
  i,
62
63
  () => ({
63
- open: z,
64
+ open: I,
64
65
  close: w,
65
66
  isOpen: e,
66
- subscribeOpenChange: (n) => (p.current.add(n), () => {
67
- p.current.delete(n);
67
+ subscribeOpenChange: (o) => (p.current.add(o), () => {
68
+ p.current.delete(o);
68
69
  }),
69
- getContext: () => l.current
70
+ getContext: () => c.current
70
71
  }),
71
- [e, z, w]
72
+ [e, I, w]
72
73
  );
73
- const E = /* @__PURE__ */ f.jsx(
74
- $,
74
+ const S = /* @__PURE__ */ f.jsx(
75
+ q,
75
76
  {
76
77
  context: r,
77
- ref: a,
78
+ ref: l,
78
79
  isOpen: e,
79
80
  close: w,
80
81
  direction: O,
81
82
  modal: b,
82
83
  className: g,
83
- attachToParent: c,
84
- closeOnOverlayClick: h,
84
+ attachToParent: h,
85
+ closeOnOverlayClick: n,
85
86
  hideCloseButton: N,
86
- children: (!x || T) && (typeof y == "function" ? y(r) : y)
87
+ zindex: T,
88
+ children: (!C || V) && (typeof y == "function" ? y(r) : y)
87
89
  }
88
90
  );
89
- return c ? E : P(E, document.body);
91
+ return h ? S : B(S, document.body);
90
92
  });
91
- H.displayName = "DrawerDesktopV2";
92
- const $ = ({
93
+ $.displayName = "DrawerDesktopV2";
94
+ const q = ({
93
95
  ref: t,
94
96
  children: i,
95
- direction: a = "left",
97
+ direction: l = "left",
96
98
  isOpen: e,
97
99
  close: u,
98
100
  modal: r = !1,
99
- className: o,
101
+ className: s,
100
102
  attachToParent: d = !1,
101
- closeOnOverlayClick: l = !1,
103
+ closeOnOverlayClick: c = !1,
102
104
  hideCloseButton: p = !1,
103
- context: b
105
+ context: b,
106
+ zindex: y = 499
104
107
  }) => {
105
- s(() => {
108
+ a(() => {
106
109
  if (e && r) {
107
- const c = window.scrollY;
108
- return document.body.style.position = "fixed", document.body.style.top = `-${c}px`, document.body.style.width = "100%", () => {
109
- document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, c);
110
+ const n = window.scrollY;
111
+ return document.body.style.position = "fixed", document.body.style.top = `-${n}px`, document.body.style.width = "100%", () => {
112
+ document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", window.scrollTo(0, n);
110
113
  };
111
114
  }
112
115
  }, [e, r]);
113
- const y = j("border-neutral-strong-default", {
116
+ const g = j("border-neutral-strong-default", {
114
117
  variants: {
115
118
  isOpen: {
116
119
  true: "desktop-drawer-visible",
@@ -121,7 +124,7 @@ const $ = ({
121
124
  right: "right-0 border-l-[1px] border-r-0"
122
125
  }
123
126
  }
124
- }), g = j(
127
+ }), O = j(
125
128
  "fixed inset-0 bg-black/60 z-[55] cursor-default",
126
129
  {
127
130
  variants: {
@@ -131,7 +134,7 @@ const $ = ({
131
134
  }
132
135
  }
133
136
  }
134
- ), O = j("", {
137
+ ), h = j("", {
135
138
  variants: {
136
139
  direction: {
137
140
  left: "right-0",
@@ -143,9 +146,10 @@ const $ = ({
143
146
  r && /* @__PURE__ */ f.jsx(
144
147
  "div",
145
148
  {
146
- className: R(g({ isOpen: e })),
147
- onClick: (c) => {
148
- c.preventDefault(), c.stopPropagation(), l && u();
149
+ className: R(O({ isOpen: e })),
150
+ style: { zIndex: y },
151
+ onClick: (n) => {
152
+ n.preventDefault(), n.stopPropagation(), c && u();
149
153
  },
150
154
  "aria-hidden": "true"
151
155
  }
@@ -157,17 +161,17 @@ const $ = ({
157
161
  className: R(
158
162
  "bg-neutral-strong-default h-full top-0 z-60 w-max overflow-y-auto",
159
163
  d ? "absolute" : "fixed",
160
- y({ isOpen: e, direction: a }),
164
+ g({ isOpen: e, direction: l }),
161
165
  !p && "p-4 pt-10",
162
- o
166
+ s
163
167
  ),
164
168
  role: "dialog",
165
169
  "aria-modal": r,
166
170
  children: [
167
171
  !p && /* @__PURE__ */ f.jsx(
168
- Y,
172
+ F,
169
173
  {
170
- icon: /* @__PURE__ */ f.jsx(F, { size: 24 }),
174
+ icon: /* @__PURE__ */ f.jsx(H, { size: 24 }),
171
175
  animate: !1,
172
176
  animateIcon: !1,
173
177
  type: "button",
@@ -178,7 +182,7 @@ const $ = ({
178
182
  color: "secondary",
179
183
  className: R(
180
184
  "absolute top-0 z-50",
181
- O({ direction: a })
185
+ h({ direction: l })
182
186
  ),
183
187
  "aria-label": "Close drawer"
184
188
  }
@@ -188,17 +192,17 @@ const $ = ({
188
192
  }
189
193
  )
190
194
  ] });
191
- }, U = () => {
192
- const t = m(null), [i, a] = v(!1), e = C((o) => {
193
- t.current?.open(o);
194
- }, []), u = C(() => {
195
+ }, W = () => {
196
+ const t = m(null), [i, l] = v(!1), e = x((s) => {
197
+ t.current?.open(s);
198
+ }, []), u = x(() => {
195
199
  t.current?.close();
196
- }, []), r = C(() => t.current?.getContext() ?? null, []);
197
- return s(() => {
198
- const o = t.current?.subscribeOpenChange;
199
- if (!o) return;
200
- const d = o((l) => {
201
- a(l);
200
+ }, []), r = x(() => t.current?.getContext() ?? null, []);
201
+ return a(() => {
202
+ const s = t.current?.subscribeOpenChange;
203
+ if (!s) return;
204
+ const d = s((c) => {
205
+ l(c);
202
206
  });
203
207
  return () => {
204
208
  d && d();
@@ -212,6 +216,6 @@ const $ = ({
212
216
  };
213
217
  };
214
218
  export {
215
- H as default,
216
- U as useDrawerDesktop
219
+ $ as default,
220
+ W as useDrawerDesktop
217
221
  };
@@ -3,6 +3,8 @@ interface DialogProps<TContext = unknown> {
3
3
  children: React.ReactNode | ((context: TContext | null) => React.ReactNode);
4
4
  onClose?: (context: TContext | null) => void;
5
5
  className?: string;
6
+ zindex?: number;
7
+ attachToParent?: boolean;
6
8
  }
7
9
  export interface DialogHandle<TContext = unknown> {
8
10
  open: (context?: TContext) => void;
@@ -16,6 +16,7 @@ export interface DrawerDesktopProps<TContext = unknown> {
16
16
  closeOnOverlayClick?: boolean;
17
17
  hideCloseButton?: boolean;
18
18
  unmountChildrenOnClose?: boolean;
19
+ zindex?: number;
19
20
  }
20
21
  declare const DrawerDesktop: import('react').ForwardRefExoticComponent<DrawerDesktopProps<any> & import('react').RefAttributes<DrawerDesktopHandle<any>>>;
21
22
  export default DrawerDesktop;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "4.6.0",
4
+ "version": "4.6.2",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",