prometeo-design-system 4.6.1 → 4.6.3

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,87 +1,88 @@
1
1
  import { j as o } from "./jsx-runtime-GkKLlHH4.js";
2
- import { forwardRef as w, memo as r, useState as C, useRef as x, useCallback as n, useImperativeHandle as R } from "react";
3
- import { createPortal as O } from "react-dom";
4
- import { c as b } from "./cn-B6yFEsav.js";
5
- const y = w(
6
- ({ children: e, onClose: t, className: s, attachToParent: c = !1 }, i) => {
7
- const [l, g] = C(!1), [u, f] = C(null), m = x(t), d = x(u);
8
- m.current = t, d.current = u;
9
- const D = n((a) => {
10
- f(a ?? null), g(!0);
11
- }, []), p = n(() => {
12
- g(!1), m.current?.(d.current), setTimeout(() => f(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);
13
13
  }, []);
14
- R(
14
+ O(
15
15
  i,
16
16
  () => ({
17
- open: D,
18
- close: p,
19
- isOpen: l,
20
- getContext: () => d.current
17
+ open: j,
18
+ close: x,
19
+ isOpen: u,
20
+ getContext: () => p.current
21
21
  }),
22
- [D, p, l]
22
+ [j, x, u]
23
23
  );
24
- const j = /* @__PURE__ */ o.jsx(o.Fragment, { children: l && /* @__PURE__ */ o.jsxs(
24
+ const C = /* @__PURE__ */ o.jsx(o.Fragment, { children: u && /* @__PURE__ */ o.jsxs(
25
25
  "div",
26
26
  {
27
27
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
28
- onClick: p,
28
+ style: { zIndex: c },
29
+ onClick: x,
29
30
  children: [
30
31
  /* @__PURE__ */ o.jsx(
31
32
  "div",
32
33
  {
33
- onClick: (a) => a.stopPropagation(),
34
+ onClick: (l) => l.stopPropagation(),
34
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 "
35
36
  }
36
37
  ),
37
38
  /* @__PURE__ */ o.jsx(
38
39
  "div",
39
40
  {
40
- onClick: (a) => a.stopPropagation(),
41
- className: b(
41
+ onClick: (l) => l.stopPropagation(),
42
+ className: y(
42
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",
43
- s
44
+ r
44
45
  ),
45
- children: typeof e == "function" ? e(u) : e
46
+ children: typeof e == "function" ? e(d) : e
46
47
  }
47
48
  )
48
49
  ]
49
50
  }
50
51
  ) });
51
- return c ? j : O(j, document.body);
52
+ return s ? C : F(C, document.body);
52
53
  }
53
54
  );
54
- y.displayName = "Dialog";
55
- const N = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: b("flex flex-col gap-4 h-full"), children: e }) }));
56
- N.displayName = "DialogContent";
57
- const h = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }));
58
- h.displayName = "DialogTitle";
59
- const v = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
60
- v.displayName = "DialogHeader";
61
- const k = r(({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }));
62
- k.displayName = "DialogFooter";
63
- const F = Object.assign(y, {
64
- Content: N,
65
- Header: v,
66
- Footer: k,
67
- Title: h
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
68
69
  });
69
- F.displayName = "DialogModal";
70
- const I = () => {
71
- const e = x(null), t = n((l) => {
72
- e.current?.open(l);
73
- }, []), s = n(() => {
70
+ H.displayName = "DialogModal";
71
+ const M = () => {
72
+ const e = g(null), t = n((i) => {
73
+ e.current?.open(i);
74
+ }, []), r = n(() => {
74
75
  e.current?.close();
75
- }, []), c = n(() => e.current?.isOpen ?? !1, []), i = n(() => e.current?.getContext() ?? null, []);
76
+ }, []), s = n(() => e.current?.isOpen ?? !1, []), c = n(() => e.current?.getContext() ?? null, []);
76
77
  return {
77
78
  ref: e,
78
79
  open: t,
79
- close: s,
80
- isOpen: c,
81
- getContext: i
80
+ close: r,
81
+ isOpen: s,
82
+ getContext: c
82
83
  };
83
84
  };
84
85
  export {
85
- F as default,
86
- I as useDialogControl
86
+ H as default,
87
+ M as useDialogControl
87
88
  };
@@ -1,116 +1,119 @@
1
- import { j as f } from "./jsx-runtime-GkKLlHH4.js";
1
+ import { j as m } 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()), {
10
- modal: b = !1,
11
- children: y,
4
+ import { createPortal as B } from "react-dom";
5
+ import { forwardRef as L, useRef as p, 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 = p(null), [e, u] = v(t.defaultOpen || !1), [r, s] = v(null), d = p(t.onClose), c = p(r), b = p(/* @__PURE__ */ new Set()), {
10
+ modal: y = !1,
11
+ children: f,
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 = p(n), D = p(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 I = (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
- if (!k.current || b || !e)
37
+ a(() => {
38
+ if (!k.current || y || !e)
38
39
  return;
39
- const n = setTimeout(() => {
40
- document.addEventListener("click", S);
40
+ const o = setTimeout(() => {
41
+ document.addEventListener("click", I);
41
42
  }, 0);
42
43
  return () => {
43
- clearTimeout(n), document.removeEventListener("click", S);
44
+ clearTimeout(o), document.removeEventListener("click", I);
44
45
  };
45
- }, [h, e, b]), s(() => {
46
+ }, [n, e, y]), 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 z = 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
+ b.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
64
  open: z,
64
65
  close: w,
65
66
  isOpen: e,
66
- subscribeOpenChange: (n) => (p.current.add(n), () => {
67
- p.current.delete(n);
67
+ subscribeOpenChange: (o) => (b.current.add(o), () => {
68
+ b.current.delete(o);
68
69
  }),
69
- getContext: () => l.current
70
+ getContext: () => c.current
70
71
  }),
71
72
  [e, z, w]
72
73
  );
73
- const E = /* @__PURE__ */ f.jsx(
74
- $,
74
+ const S = /* @__PURE__ */ m.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
- modal: b,
82
+ modal: y,
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 f == "function" ? f(r) : f)
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,
102
- hideCloseButton: p = !1,
103
- context: b
103
+ closeOnOverlayClick: c = !1,
104
+ hideCloseButton: b = !1,
105
+ context: y,
106
+ zindex: f = 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",
@@ -139,35 +142,37 @@ const $ = ({
139
142
  }
140
143
  }
141
144
  });
142
- return /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
143
- r && /* @__PURE__ */ f.jsx(
145
+ return /* @__PURE__ */ m.jsxs(m.Fragment, { children: [
146
+ r && /* @__PURE__ */ m.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: f },
151
+ onClick: (n) => {
152
+ n.preventDefault(), n.stopPropagation(), c && u();
149
153
  },
150
154
  "aria-hidden": "true"
151
155
  }
152
156
  ),
153
- /* @__PURE__ */ f.jsxs(
157
+ /* @__PURE__ */ m.jsxs(
154
158
  "div",
155
159
  {
156
160
  ref: t,
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 }),
161
- !p && "p-4 pt-10",
162
- o
164
+ g({ isOpen: e, direction: l }),
165
+ !b && "p-4 pt-10",
166
+ s
163
167
  ),
164
168
  role: "dialog",
165
169
  "aria-modal": r,
170
+ style: { zIndex: f + 1 },
166
171
  children: [
167
- !p && /* @__PURE__ */ f.jsx(
168
- Y,
172
+ !b && /* @__PURE__ */ m.jsx(
173
+ F,
169
174
  {
170
- icon: /* @__PURE__ */ f.jsx(F, { size: 24 }),
175
+ icon: /* @__PURE__ */ m.jsx(H, { size: 24 }),
171
176
  animate: !1,
172
177
  animateIcon: !1,
173
178
  type: "button",
@@ -178,27 +183,28 @@ const $ = ({
178
183
  color: "secondary",
179
184
  className: R(
180
185
  "absolute top-0 z-50",
181
- O({ direction: a })
186
+ h({ direction: l })
182
187
  ),
183
- "aria-label": "Close drawer"
188
+ "aria-label": "Close drawer",
189
+ style: { zIndex: f + 2 }
184
190
  }
185
191
  ),
186
- typeof i == "function" ? i(b) : i
192
+ typeof i == "function" ? i(y) : i
187
193
  ]
188
194
  }
189
195
  )
190
196
  ] });
191
- }, U = () => {
192
- const t = m(null), [i, a] = v(!1), e = C((o) => {
193
- t.current?.open(o);
194
- }, []), u = C(() => {
197
+ }, W = () => {
198
+ const t = p(null), [i, l] = v(!1), e = x((s) => {
199
+ t.current?.open(s);
200
+ }, []), u = x(() => {
195
201
  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);
202
+ }, []), r = x(() => t.current?.getContext() ?? null, []);
203
+ return a(() => {
204
+ const s = t.current?.subscribeOpenChange;
205
+ if (!s) return;
206
+ const d = s((c) => {
207
+ l(c);
202
208
  });
203
209
  return () => {
204
210
  d && d();
@@ -212,6 +218,6 @@ const $ = ({
212
218
  };
213
219
  };
214
220
  export {
215
- H as default,
216
- U as useDrawerDesktop
221
+ $ as default,
222
+ W as useDrawerDesktop
217
223
  };
@@ -3,6 +3,7 @@ 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;
6
7
  attachToParent?: boolean;
7
8
  }
8
9
  export interface DialogHandle<TContext = unknown> {
@@ -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.1",
4
+ "version": "4.6.3",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",