prometeo-design-system 4.6.0 → 4.6.1

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,29 +1,31 @@
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 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);
12
13
  }, []);
13
- return k(
14
+ R(
14
15
  i,
15
16
  () => ({
16
- open: m,
17
- close: d,
18
- isOpen: n,
19
- getContext: () => p.current
17
+ open: D,
18
+ close: p,
19
+ isOpen: l,
20
+ getContext: () => d.current
20
21
  }),
21
- [m, d, n]
22
- ), /* @__PURE__ */ o.jsx(o.Fragment, { children: n && /* @__PURE__ */ o.jsxs(
22
+ [D, p, l]
23
+ );
24
+ const j = /* @__PURE__ */ o.jsx(o.Fragment, { children: l && /* @__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
+ onClick: p,
27
29
  children: [
28
30
  /* @__PURE__ */ o.jsx(
29
31
  "div",
@@ -36,9 +38,9 @@ const C = y(
36
38
  "div",
37
39
  {
38
40
  onClick: (a) => a.stopPropagation(),
39
- className: j(
41
+ className: b(
40
42
  "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
43
+ s
42
44
  ),
43
45
  children: typeof e == "function" ? e(u) : e
44
46
  }
@@ -46,39 +48,40 @@ const C = y(
46
48
  ]
47
49
  }
48
50
  ) });
51
+ return c ? j : O(j, document.body);
49
52
  }
50
53
  );
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";
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";
58
59
  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
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
65
68
  });
66
- w.displayName = "DialogModal";
67
- const H = () => {
68
- const e = x(null), t = l((s) => {
69
- e.current?.open(s);
70
- }, []), c = l(() => {
69
+ F.displayName = "DialogModal";
70
+ const I = () => {
71
+ const e = x(null), t = n((l) => {
72
+ e.current?.open(l);
73
+ }, []), s = n(() => {
71
74
  e.current?.close();
72
- }, []), i = l(() => e.current?.isOpen ?? !1, []), n = l(() => e.current?.getContext() ?? null, []);
75
+ }, []), c = n(() => e.current?.isOpen ?? !1, []), i = n(() => e.current?.getContext() ?? null, []);
73
76
  return {
74
77
  ref: e,
75
78
  open: t,
76
- close: c,
77
- isOpen: i,
78
- getContext: n
79
+ close: s,
80
+ isOpen: c,
81
+ getContext: i
79
82
  };
80
83
  };
81
84
  export {
82
- w as default,
83
- H as useDialogControl
85
+ F as default,
86
+ I as useDialogControl
84
87
  };
@@ -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
+ attachToParent?: boolean;
6
7
  }
7
8
  export interface DialogHandle<TContext = unknown> {
8
9
  open: (context?: TContext) => void;
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.1",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",