prometeo-design-system 2.3.2 → 2.3.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,52 +1,56 @@
1
- import { j as t } from "./jsx-runtime-DKDX3adD.js";
2
- import { forwardRef as u, useState as p, useImperativeHandle as f, useRef as g } from "react";
3
- import { c as i } from "./cn-B6yFEsav.js";
4
- const x = u(({
1
+ import { j as o } from "./jsx-runtime-DKDX3adD.js";
2
+ import { forwardRef as p, useState as d, useImperativeHandle as f, useRef as m } from "react";
3
+ import { c as x } from "./cn-B6yFEsav.js";
4
+ const j = p(({
5
5
  children: e,
6
- onClose: o,
7
- className: s
8
- }, n) => {
9
- const [r, l] = p(!1), c = () => l(!0), a = () => {
10
- l(!1), o?.();
6
+ onClose: t,
7
+ className: a
8
+ }, c) => {
9
+ const [s, n] = d(!1), [r, i] = d(null), g = (l) => {
10
+ i(l ?? null), n(!0);
11
+ }, u = () => {
12
+ n(!1), t?.(r), setTimeout(() => i(null), 300);
11
13
  };
12
- return f(n, () => ({
13
- open: c,
14
- close: a,
15
- isOpen: r
16
- })), /* @__PURE__ */ t.jsx(t.Fragment, { children: r && /* @__PURE__ */ t.jsx(
14
+ return f(c, () => ({
15
+ open: g,
16
+ close: u,
17
+ isOpen: s,
18
+ getContext: () => r
19
+ })), /* @__PURE__ */ o.jsx(o.Fragment, { children: s && /* @__PURE__ */ o.jsx(
17
20
  "div",
18
21
  {
19
22
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-[1.5px]",
20
- onClick: a,
21
- children: /* @__PURE__ */ t.jsx(
23
+ onClick: u,
24
+ children: /* @__PURE__ */ o.jsx(
22
25
  "div",
23
26
  {
24
- className: i("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", s),
25
- onClick: (d) => d.stopPropagation(),
26
- children: e
27
+ className: x("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", a),
28
+ onClick: (l) => l.stopPropagation(),
29
+ children: typeof e == "function" ? e(r) : e
27
30
  }
28
31
  )
29
32
  }
30
33
  ) });
31
- }), m = ({ children: e, className: o }) => /* @__PURE__ */ t.jsx("div", { className: o, children: /* @__PURE__ */ t.jsx("div", { className: i("flex flex-col gap-4"), children: e }) }), j = ({ children: e, className: o }) => /* @__PURE__ */ t.jsx("h1", { className: o, children: e }), D = ({ children: e, className: o }) => /* @__PURE__ */ t.jsx("div", { className: o, children: e }), b = ({ children: e, className: o }) => /* @__PURE__ */ t.jsx("div", { className: o, children: e }), C = Object.assign(x, {
32
- Content: m,
33
- Header: D,
34
- Footer: b,
35
- Title: j
36
- }), k = () => {
37
- const e = g(null);
34
+ }), C = ({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: /* @__PURE__ */ o.jsx("div", { className: x("flex flex-col gap-4"), children: e }) }), D = ({ children: e, className: t }) => /* @__PURE__ */ o.jsx("h1", { className: t, children: e }), b = ({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }), v = ({ children: e, className: t }) => /* @__PURE__ */ o.jsx("div", { className: t, children: e }), w = Object.assign(j, {
35
+ Content: C,
36
+ Header: b,
37
+ Footer: v,
38
+ Title: D
39
+ }), R = () => {
40
+ const e = m(null);
38
41
  return {
39
42
  ref: e,
40
- open: () => {
41
- e.current?.open();
43
+ open: (n) => {
44
+ e.current?.open(n);
42
45
  },
43
46
  close: () => {
44
47
  e.current?.close();
45
48
  },
46
- isOpen: () => e.current?.isOpen ?? !1
49
+ isOpen: () => e.current?.isOpen ?? !1,
50
+ getContext: () => e.current?.getContext() ?? null
47
51
  };
48
52
  };
49
53
  export {
50
- C as default,
51
- k as useDialogControl
54
+ w as default,
55
+ R as useDialogControl
52
56
  };
@@ -1,13 +1,14 @@
1
- interface DialogProps {
1
+ interface DialogProps<TContext = unknown> {
2
2
  title?: string;
3
- children: React.ReactNode;
4
- onClose?: () => void;
3
+ children: React.ReactNode | ((context: TContext | null) => React.ReactNode);
4
+ onClose?: (context: TContext | null) => void;
5
5
  className?: string;
6
6
  }
7
- export interface DialogHandle {
8
- open: () => void;
7
+ export interface DialogHandle<TContext = unknown> {
8
+ open: (context?: TContext) => void;
9
9
  close: () => void;
10
10
  isOpen: boolean;
11
+ getContext: () => TContext | null;
11
12
  }
12
13
  interface DialogContentProps {
13
14
  children?: React.ReactNode;
@@ -25,7 +26,7 @@ interface DialogFooterProps {
25
26
  children?: React.ReactNode;
26
27
  className?: string;
27
28
  }
28
- declare const DialogModal: import('react').ForwardRefExoticComponent<DialogProps & import('react').RefAttributes<DialogHandle>> & {
29
+ declare const DialogModal: import('react').ForwardRefExoticComponent<DialogProps<any> & import('react').RefAttributes<DialogHandle<any>>> & {
29
30
  Content: ({ children, className }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
30
31
  Header: ({ children, className }: DialogHeaderProps) => import("react/jsx-runtime").JSX.Element;
31
32
  Footer: ({ children, className }: DialogFooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { DialogHandle } from './Dialog';
2
- export declare const useDialogControl: () => {
3
- ref: import('react').RefObject<DialogHandle | null>;
4
- open: () => void;
2
+ export declare const useDialogControl: <TContext = unknown>() => {
3
+ ref: import('react').RefObject<DialogHandle<TContext> | null>;
4
+ open: (context?: TContext) => void;
5
5
  close: () => void;
6
6
  isOpen: () => boolean;
7
+ getContext: () => NonNullable<TContext> | null;
7
8
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prometeo-design-system",
3
3
  "private": false,
4
- "version": "2.3.2",
4
+ "version": "2.3.3",
5
5
  "type": "module",
6
6
  "description": "design kit system",
7
7
  "main": "dist/prometeo-design-system.umd.js",