lawgic-dev-kit 0.12.6 → 0.12.9

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,4 +1,4 @@
1
- import { __module as r } from "../../_virtual/index6.js";
1
+ import { __module as r } from "../../_virtual/index5.js";
2
2
  import { __require as s } from "./node_modules/react-is/index.js";
3
3
  import { __require as t } from "./factoryWithTypeCheckers.js";
4
4
  import { __require as p } from "./factoryWithThrowingShims.js";
@@ -1,4 +1,4 @@
1
- import { __module as e } from "../../_virtual/index2.js";
1
+ import { __module as e } from "../../_virtual/index6.js";
2
2
  import { __require as o } from "./cjs/scheduler.production.js";
3
3
  import { __require as u } from "./cjs/scheduler.development.js";
4
4
  var r;
@@ -1,6 +1,6 @@
1
- import { p as v } from "../../_virtual/index3.js";
2
- import { t as U } from "../../_virtual/index4.js";
3
- import oe from "../../_virtual/index5.js";
1
+ import { p as v } from "../../_virtual/index2.js";
2
+ import { t as U } from "../../_virtual/index3.js";
3
+ import oe from "../../_virtual/index4.js";
4
4
  const ce = Object.prototype.toString, he = Error.prototype.toString, fe = RegExp.prototype.toString, de = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", pe = /^Symbol\((.*)\)(.*)$/;
5
5
  function me(n) {
6
6
  return n != +n ? "NaN" : n === 0 && 1 / n < 0 ? "-0" : "" + n;
@@ -3,15 +3,14 @@ import { l as u } from "../_virtual/lodash.js";
3
3
  import { useState as l, useRef as a, useCallback as d, useEffect as f } from "react";
4
4
  import M from "../components/molecules/AlertModal/AlertModal.js";
5
5
  import "../node_modules/@fortawesome/react-fontawesome/index.es.js";
6
- import "react-dom";
7
6
  import "../contexts/themeContext.js";
8
- import m from "../components/atoms/CenterModal/CenterModal.js";
7
+ import w from "../components/atoms/CenterModal/CenterModal.js";
9
8
  import "react-hook-form";
10
9
  import "../constants/countries.js";
11
10
  import "../components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
12
- import w from "../components/molecules/DialogModal/DialogModal.js";
13
- const k = () => {
14
- const [p, t] = l([]), n = a([]), s = d((e) => {
11
+ import m from "../components/molecules/DialogModal/DialogModal.js";
12
+ const b = () => {
13
+ const [p, n] = l([]), t = a([]), s = d((e) => {
15
14
  const r = {
16
15
  ...e,
17
16
  id: (e == null ? void 0 : e.id) || u.uniqueId(),
@@ -23,14 +22,14 @@ const k = () => {
23
22
  onClose: () => o(e.id || u.uniqueId())
24
23
  }
25
24
  };
26
- n.current = [...n.current, r], t(n.current);
25
+ t.current = [...t.current, r], n(t.current);
27
26
  }, []), o = d((e) => {
28
- n.current = n.current.map(
27
+ t.current = t.current.map(
29
28
  (r) => r.id === e ? { ...r, open: !1 } : r
30
- ), t(n.current), setTimeout(() => {
31
- n.current = n.current.filter(
29
+ ), n(t.current), setTimeout(() => {
30
+ t.current = t.current.filter(
32
31
  (r) => r.id !== e
33
- ), t(n.current);
32
+ ), n(t.current);
34
33
  }, 150);
35
34
  }, []);
36
35
  return f(() => {
@@ -39,7 +38,7 @@ const k = () => {
39
38
  if (e.type === "dialog") {
40
39
  const { props: c } = e;
41
40
  return /* @__PURE__ */ i.jsx(
42
- w,
41
+ m,
43
42
  {
44
43
  ...c,
45
44
  open: e.open,
@@ -62,7 +61,7 @@ const k = () => {
62
61
  }
63
62
  const { props: r } = e;
64
63
  return /* @__PURE__ */ i.jsx(
65
- m,
64
+ w,
66
65
  {
67
66
  ...r,
68
67
  open: e.open,
@@ -73,16 +72,16 @@ const k = () => {
73
72
  );
74
73
  }) });
75
74
  };
76
- function A(p) {
77
- var t;
78
- (t = window == null ? void 0 : window.openModal) == null || t.call(window, p);
75
+ function k(p) {
76
+ var n;
77
+ (n = window == null ? void 0 : window.openModal) == null || n.call(window, p);
79
78
  }
80
- function F(p) {
81
- var t;
82
- (t = window == null ? void 0 : window.closeModal) == null || t.call(window, p);
79
+ function A(p) {
80
+ var n;
81
+ (n = window == null ? void 0 : window.closeModal) == null || n.call(window, p);
83
82
  }
84
83
  export {
85
- k as ModalContainer,
86
- F as closeModal,
87
- A as openModal
84
+ b as ModalContainer,
85
+ A as closeModal,
86
+ k as openModal
88
87
  };
@@ -1,4 +1,4 @@
1
- import { ToastContent, ToastMethods, ToastOptions } from '../types';
1
+ import { ToastContent, ToastMethods, ToastOptions } from '../types/toast';
2
2
  export declare const showToastAsync: (promise: Promise<unknown>, messages: {
3
3
  loading: ToastContent;
4
4
  success: ToastContent;
@@ -1,20 +1,19 @@
1
- import { j as l } from "../_virtual/jsx-runtime.js";
2
- import { createPortal as C } from "react-dom";
1
+ import { j as d } from "../_virtual/jsx-runtime.js";
3
2
  import "../node_modules/@fortawesome/react-fontawesome/index.es.js";
4
- import { AsyncToast as T } from "../components/atoms/AsyncToast/index.js";
5
- import { useState as p, useEffect as j } from "react";
3
+ import { AsyncToast as u } from "../components/atoms/AsyncToast/index.js";
4
+ import "react";
6
5
  import "../_virtual/lodash.js";
7
6
  import "../contexts/themeContext.js";
8
7
  import "react-hook-form";
9
8
  import "../constants/countries.js";
10
9
  import "../components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
11
- import E from "../components/atoms/Toast/Toast.js";
12
- const f = [];
13
- function u(t = "bottom-center") {
14
- var s;
15
- if (!f.find((e) => e.id === t)) {
16
- const e = document.createElement("div");
17
- switch (e.classList.add(
10
+ import h from "../components/atoms/Toast/Toast.js";
11
+ const m = [];
12
+ function l(e = "bottom-center") {
13
+ var o;
14
+ if (!m.find((t) => t.id === e)) {
15
+ const t = document.createElement("div");
16
+ switch (t.classList.add(
18
17
  "fixed",
19
18
  "z-50",
20
19
  "flex",
@@ -22,116 +21,98 @@ function u(t = "bottom-center") {
22
21
  "items-center",
23
22
  "w-fit",
24
23
  "min-w-[18rem]"
25
- ), t) {
24
+ ), e) {
26
25
  case "top-left":
27
- e.classList.add("top-8", "left-8");
26
+ t.classList.add("top-8", "left-8");
28
27
  break;
29
28
  case "top-right":
30
- e.classList.add("top-8", "right-8");
29
+ t.classList.add("top-8", "right-8");
31
30
  break;
32
31
  case "bottom-left":
33
- e.classList.add("bottom-8", "left-8");
32
+ t.classList.add("bottom-8", "left-8");
34
33
  break;
35
34
  case "bottom-right":
36
- e.classList.add("bottom-8", "right-8");
35
+ t.classList.add("bottom-8", "right-8");
37
36
  break;
38
37
  case "top-center":
39
- e.classList.add("top-8", "left-1/2", "-translate-x-1/2");
38
+ t.classList.add("top-8", "left-1/2", "-translate-x-1/2");
40
39
  break;
41
40
  case "bottom-center":
42
41
  default:
43
- e.classList.add(
42
+ t.classList.add(
44
43
  "bottom-8",
45
44
  "left-1/2",
46
45
  "-translate-x-1/2"
47
46
  );
48
47
  }
49
- f.push({ id: t, element: e }), document.body.appendChild(e);
48
+ m.push({ id: e, element: t }), document.body.appendChild(t);
50
49
  }
51
- return (s = f.find((e) => e.id === t)) == null ? void 0 : s.element;
50
+ return (o = m.find((t) => t.id === e)) == null ? void 0 : o.element;
52
51
  }
53
- function h({
54
- container: t,
55
- children: s,
56
- onMount: e
57
- }) {
58
- return j(() => {
59
- const n = setTimeout(() => {
60
- t.firstChild instanceof HTMLElement && t.firstChild.classList.add("mt-[0.5rem]");
61
- }, 10);
62
- return e && e(), () => clearTimeout(n);
63
- }, [t, e]), C(s, t);
64
- }
65
- function d(t, s = "success", { position: e = "top-right", duration: n = 3e3 } = {}) {
66
- const o = u(e);
67
- if (!o) return;
68
- const r = document.createElement("div");
69
- o.prepend(r);
70
- const c = () => {
71
- const [a, m] = p(!0), x = () => {
72
- m(!1), setTimeout(() => {
73
- r.parentNode === o && o.removeChild(r);
74
- }, 300);
52
+ function i(e, o = "success", { position: t = "top-right", duration: a = 3e3 } = {}) {
53
+ import("../_virtual/client.js").then((n) => n.c).then(({ createRoot: n }) => {
54
+ const s = l(t);
55
+ if (!s) return;
56
+ const r = document.createElement("div"), c = n(r), f = () => {
57
+ c.unmount(), s.removeChild(r);
75
58
  };
76
- return a ? /* @__PURE__ */ l.jsx(h, { container: r, children: /* @__PURE__ */ l.jsx(
77
- E,
78
- {
79
- content: t,
80
- type: s,
81
- duration: n,
82
- onClose: x
83
- }
84
- ) }) : null;
85
- }, i = document.createElement("div");
86
- r.appendChild(i), import("../_virtual/client.js").then((a) => a.c).then(({ createRoot: a }) => {
87
- a(i).render(/* @__PURE__ */ l.jsx(c, {}));
59
+ c.render(
60
+ /* @__PURE__ */ d.jsx(
61
+ h,
62
+ {
63
+ content: e,
64
+ type: o,
65
+ duration: a,
66
+ onClose: f
67
+ }
68
+ )
69
+ ), s.prepend(r), setTimeout(() => {
70
+ r.classList.add("mt-[0.5rem]");
71
+ }, 10);
88
72
  });
89
73
  }
90
- const b = (t, s, e = {}) => {
91
- const n = u(e.position);
92
- if (!n) return;
93
- const o = document.createElement("div");
94
- n.prepend(o);
95
- const r = () => {
96
- const [i, a] = p(!0), m = () => {
97
- a(!1), setTimeout(() => {
98
- o.parentNode === n && n.removeChild(o);
99
- }, 300);
74
+ const p = (e, o, t = {}) => {
75
+ import("../_virtual/client.js").then((a) => a.c).then(({ createRoot: a }) => {
76
+ const n = l(t.position);
77
+ if (!n) return;
78
+ const s = document.createElement("div"), r = a(s), c = () => {
79
+ r.unmount(), n.removeChild(s);
100
80
  };
101
- return i ? /* @__PURE__ */ l.jsx(h, { container: o, children: /* @__PURE__ */ l.jsx(
102
- T,
103
- {
104
- promise: t,
105
- messages: s,
106
- options: e,
107
- onClose: m
108
- }
109
- ) }) : null;
110
- }, c = document.createElement("div");
111
- o.appendChild(c), import("../_virtual/client.js").then((i) => i.c).then(({ createRoot: i }) => {
112
- i(c).render(/* @__PURE__ */ l.jsx(r, {}));
81
+ r.render(
82
+ /* @__PURE__ */ d.jsx(
83
+ u,
84
+ {
85
+ promise: e,
86
+ messages: o,
87
+ options: t,
88
+ onClose: c
89
+ }
90
+ )
91
+ ), n.prepend(s), setTimeout(() => {
92
+ s.classList.add("mt-[0.5rem]");
93
+ }, 10);
113
94
  });
114
- }, L = (t, s = {}) => {
115
- let e = () => {
116
- }, n = () => {
95
+ }, b = (e, o = {}) => {
96
+ let t = () => {
97
+ }, a = () => {
117
98
  };
118
- const o = new Promise((r, c) => {
119
- e = r, n = c;
99
+ const n = new Promise((s, r) => {
100
+ t = s, a = r;
120
101
  });
121
- return b(o, t, s), {
122
- resolve: e,
123
- reject: n
102
+ return p(n, e, o), {
103
+ resolve: t,
104
+ reject: a
124
105
  };
125
- }, z = {
126
- success: (t, s = {}) => d(t, "success", s),
127
- error: (t, s = {}) => d(t, "error", s),
128
- warning: (t, s = {}) => d(t, "warning", s),
129
- info: (t, s = {}) => d(t, "info", s),
130
- async: (t, s, e = {}) => b(t, s, e),
131
- loading: (t, s = {}) => L(t, s)
106
+ }, y = {
107
+ success: (e, o = {}) => i(e, "success", o),
108
+ error: (e, o = {}) => i(e, "error", o),
109
+ warning: (e, o = {}) => i(e, "warning", o),
110
+ info: (e, o = {}) => i(e, "info", o),
111
+ async: (e, o, t = {}) => p(e, o, t),
112
+ loading: (e, o = {}) => b(e, o)
132
113
  };
133
114
  export {
134
- b as showToastAsync,
135
- L as showToastLoading,
136
- z as toast
115
+ p as showToastAsync,
116
+ b as showToastLoading,
117
+ y as toast
137
118
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawgic-dev-kit",
3
- "version": "0.12.6",
3
+ "version": "0.12.9",
4
4
  "description": "Componentes de UI para Lawgic",
5
5
  "type": "module",
6
6
  "private": false,
@@ -1,11 +0,0 @@
1
- import { Control, FieldValues, Path } from 'react-hook-form';
2
- export type DateInputProps<T extends FieldValues = FieldValues> = {
3
- control: Control<T>;
4
- name: Path<T>;
5
- label?: string;
6
- placeholder?: string;
7
- showTimeSelector?: boolean;
8
- translateKey?: string;
9
- };
10
- declare const DateInput: <T extends FieldValues = FieldValues>({ control, name, showTimeSelector, label, translateKey, placeholder }: DateInputProps<T>) => React.ReactElement;
11
- export default DateInput;