lawgic-dev-kit 0.9.3 → 0.9.6

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.
Files changed (33) hide show
  1. package/dist/_virtual/index.js +2 -5
  2. package/dist/_virtual/index2.js +5 -2
  3. package/dist/_virtual/index3.js +3 -2
  4. package/dist/_virtual/index4.js +3 -3
  5. package/dist/_virtual/index5.js +5 -3
  6. package/dist/_virtual/index6.js +2 -5
  7. package/dist/_virtual/index7.js +2 -2
  8. package/dist/_virtual/index8.js +2 -2
  9. package/dist/components/atoms/Avatar/Avatar.js +5 -4
  10. package/dist/components/atoms/CountrySelectInput/CountryDropdown.js +1 -1
  11. package/dist/components/atoms/ImageProfileInput/ImageProfileInput.js +1 -1
  12. package/dist/components/atoms/PasswordInput/PasswordInput.js +1 -1
  13. package/dist/components/atoms/PhoneInput/PhoneInput.js +1 -1
  14. package/dist/components/atoms/SelectDropdown/SelectDropdown.js +1 -1
  15. package/dist/components/atoms/TextInput/TextInput.js +23 -25
  16. package/dist/components/atoms/UploadContainer/UploadContainer.js +3 -2
  17. package/dist/components/molecules/AlertModal/AlertModal.js +3 -2
  18. package/dist/components/molecules/CalendarSelector/CalendarSelector.js +3 -2
  19. package/dist/components/molecules/DateInput/DateInput.js +1 -1
  20. package/dist/components/molecules/DialogModal/DialogModal.js +3 -2
  21. package/dist/components/molecules/FloatingMenu/FloatingMenu.js +7 -6
  22. package/dist/components/molecules/Tabs/Tabs.js +3 -2
  23. package/dist/lawgic-dev-kit.umd.js +113 -113
  24. package/dist/node_modules/@fortawesome/react-fontawesome/index.es.js +1 -1
  25. package/dist/node_modules/prop-types/index.js +1 -1
  26. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  27. package/dist/node_modules/scheduler/index.js +1 -1
  28. package/dist/node_modules/toposort/index.js +1 -1
  29. package/dist/node_modules/yup/index.esm.js +3 -3
  30. package/dist/utils/modal.js +21 -20
  31. package/dist/utils/toast.js +16 -15
  32. package/package.json +2 -1
  33. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -203
@@ -1,5 +1,5 @@
1
1
  import { parse as j, icon as F } from "../fontawesome-svg-core/index.js";
2
- import n from "../../../_virtual/index.js";
2
+ import n from "../../../_virtual/index2.js";
3
3
  import C from "react";
4
4
  function N(e, t) {
5
5
  var r = Object.keys(e);
@@ -1,4 +1,4 @@
1
- import { __module as r } from "../../_virtual/index3.js";
1
+ import { __module as r } from "../../_virtual/index6.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/index7.js";
1
+ import { __module as e } from "../../../../_virtual/index8.js";
2
2
  import { __require as o } from "./cjs/react-is.production.min.js";
3
3
  import { __require as t } from "./cjs/react-is.development.js";
4
4
  var r;
@@ -1,4 +1,4 @@
1
- import { __module as e } from "../../_virtual/index2.js";
1
+ import { __module as e } from "../../_virtual/index.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,4 +1,4 @@
1
- import { __module as w } from "../../_virtual/index8.js";
1
+ import { __module as w } from "../../_virtual/index7.js";
2
2
  var p;
3
3
  function x() {
4
4
  if (p) return w.exports;
@@ -1,6 +1,6 @@
1
- import { p as v } from "../../_virtual/index4.js";
2
- import { t as U } from "../../_virtual/index5.js";
3
- import oe from "../../_virtual/index6.js";
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";
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;
@@ -5,12 +5,13 @@ import M from "../components/molecules/AlertModal/AlertModal.js";
5
5
  import "../node_modules/@fortawesome/react-fontawesome/index.es.js";
6
6
  import "react-dom";
7
7
  import "../contexts/themeContext.js";
8
- import w from "../components/atoms/CenterModal/CenterModal.js";
8
+ import m from "../components/atoms/CenterModal/CenterModal.js";
9
+ import "react-hook-form";
9
10
  import "../components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
10
11
  import "../constants/countries.js";
11
- import m from "../components/molecules/DialogModal/DialogModal.js";
12
- const b = () => {
13
- const [p, n] = l([]), t = a([]), s = d((e) => {
12
+ import w from "../components/molecules/DialogModal/DialogModal.js";
13
+ const k = () => {
14
+ const [p, t] = l([]), n = a([]), s = d((e) => {
14
15
  const r = {
15
16
  ...e,
16
17
  id: (e == null ? void 0 : e.id) || u.uniqueId(),
@@ -22,14 +23,14 @@ const b = () => {
22
23
  onClose: () => o(e.id || u.uniqueId())
23
24
  }
24
25
  };
25
- t.current = [...t.current, r], n(t.current);
26
+ n.current = [...n.current, r], t(n.current);
26
27
  }, []), o = d((e) => {
27
- t.current = t.current.map(
28
+ n.current = n.current.map(
28
29
  (r) => r.id === e ? { ...r, open: !1 } : r
29
- ), n(t.current), setTimeout(() => {
30
- t.current = t.current.filter(
30
+ ), t(n.current), setTimeout(() => {
31
+ n.current = n.current.filter(
31
32
  (r) => r.id !== e
32
- ), n(t.current);
33
+ ), t(n.current);
33
34
  }, 150);
34
35
  }, []);
35
36
  return f(() => {
@@ -38,7 +39,7 @@ const b = () => {
38
39
  if (e.type === "dialog") {
39
40
  const { props: c } = e;
40
41
  return /* @__PURE__ */ i.jsx(
41
- m,
42
+ w,
42
43
  {
43
44
  ...c,
44
45
  open: e.open,
@@ -61,7 +62,7 @@ const b = () => {
61
62
  }
62
63
  const { props: r } = e;
63
64
  return /* @__PURE__ */ i.jsx(
64
- w,
65
+ m,
65
66
  {
66
67
  ...r,
67
68
  open: e.open,
@@ -72,16 +73,16 @@ const b = () => {
72
73
  );
73
74
  }) });
74
75
  };
75
- function k(p) {
76
- var n;
77
- (n = window == null ? void 0 : window.openModal) == null || n.call(window, p);
78
- }
79
76
  function A(p) {
80
- var n;
81
- (n = window == null ? void 0 : window.closeModal) == null || n.call(window, p);
77
+ var t;
78
+ (t = window == null ? void 0 : window.openModal) == null || t.call(window, p);
79
+ }
80
+ function F(p) {
81
+ var t;
82
+ (t = window == null ? void 0 : window.closeModal) == null || t.call(window, p);
82
83
  }
83
84
  export {
84
- b as ModalContainer,
85
- A as closeModal,
86
- k as openModal
85
+ k as ModalContainer,
86
+ F as closeModal,
87
+ A as openModal
87
88
  };
@@ -2,14 +2,15 @@ import { j as l } from "../_virtual/jsx-runtime.js";
2
2
  import { createPortal as C } from "react-dom";
3
3
  import "../node_modules/@fortawesome/react-fontawesome/index.es.js";
4
4
  import { AsyncToast as T } from "../components/atoms/AsyncToast/index.js";
5
- import { useState as u, useEffect as j } from "react";
5
+ import { useState as p, useEffect as j } from "react";
6
6
  import "../_virtual/lodash.js";
7
7
  import "../contexts/themeContext.js";
8
+ import "react-hook-form";
8
9
  import "../components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
9
10
  import E from "../components/atoms/Toast/Toast.js";
10
11
  import "../constants/countries.js";
11
12
  const f = [];
12
- function p(t = "bottom-center") {
13
+ function u(t = "bottom-center") {
13
14
  var s;
14
15
  if (!f.find((e) => e.id === t)) {
15
16
  const e = document.createElement("div");
@@ -61,14 +62,14 @@ function h({
61
62
  return e && e(), () => clearTimeout(n);
62
63
  }, [t, e]), C(s, t);
63
64
  }
64
- function m(t, s = "success", { position: e = "top-right", duration: n = 3e3 } = {}) {
65
- const o = p(e);
65
+ function d(t, s = "success", { position: e = "top-right", duration: n = 3e3 } = {}) {
66
+ const o = u(e);
66
67
  if (!o) return;
67
68
  const r = document.createElement("div");
68
69
  o.prepend(r);
69
70
  const c = () => {
70
- const [a, d] = u(!0), x = () => {
71
- d(!1), setTimeout(() => {
71
+ const [a, m] = p(!0), x = () => {
72
+ m(!1), setTimeout(() => {
72
73
  r.parentNode === o && o.removeChild(r);
73
74
  }, 300);
74
75
  };
@@ -87,12 +88,12 @@ function m(t, s = "success", { position: e = "top-right", duration: n = 3e3 } =
87
88
  });
88
89
  }
89
90
  const b = (t, s, e = {}) => {
90
- const n = p(e.position);
91
+ const n = u(e.position);
91
92
  if (!n) return;
92
93
  const o = document.createElement("div");
93
94
  n.prepend(o);
94
95
  const r = () => {
95
- const [i, a] = u(!0), d = () => {
96
+ const [i, a] = p(!0), m = () => {
96
97
  a(!1), setTimeout(() => {
97
98
  o.parentNode === n && n.removeChild(o);
98
99
  }, 300);
@@ -103,7 +104,7 @@ const b = (t, s, e = {}) => {
103
104
  promise: t,
104
105
  messages: s,
105
106
  options: e,
106
- onClose: d
107
+ onClose: m
107
108
  }
108
109
  ) }) : null;
109
110
  }, c = document.createElement("div");
@@ -121,16 +122,16 @@ const b = (t, s, e = {}) => {
121
122
  resolve: e,
122
123
  reject: n
123
124
  };
124
- }, N = {
125
- success: (t, s = {}) => m(t, "success", s),
126
- error: (t, s = {}) => m(t, "error", s),
127
- warning: (t, s = {}) => m(t, "warning", s),
128
- info: (t, s = {}) => m(t, "info", s),
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),
129
130
  async: (t, s, e = {}) => b(t, s, e),
130
131
  loading: (t, s = {}) => L(t, s)
131
132
  };
132
133
  export {
133
134
  b as showToastAsync,
134
135
  L as showToastLoading,
135
- N as toast
136
+ z as toast
136
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawgic-dev-kit",
3
- "version": "0.9.3",
3
+ "version": "0.9.6",
4
4
  "description": "Componentes de UI para Lawgic",
5
5
  "type": "module",
6
6
  "private": false,
@@ -84,6 +84,7 @@
84
84
  "@fortawesome/pro-solid-svg-icons": "^6.5.1",
85
85
  "@fortawesome/react-fontawesome": "^0.2.0",
86
86
  "react": "^18.0.0 || ^19.0.0",
87
+ "react-hook-form": "^7.54.2",
87
88
  "react-dom": "^18.0.0 || ^19.0.0"
88
89
  },
89
90
  "dependencies": {
@@ -1,203 +0,0 @@
1
- import o from "react";
2
- var D = (e) => e.type === "checkbox", R = (e) => e instanceof Date, O = (e) => e == null;
3
- const B = (e) => typeof e == "object";
4
- var g = (e) => !O(e) && !Array.isArray(e) && B(e) && !R(e), L = (e) => g(e) && e.target ? D(e.target) ? e.target.checked : e.target.value : e, U = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, M = (e, s) => e.has(U(s)), I = (e) => {
5
- const s = e.constructor && e.constructor.prototype;
6
- return g(s) && s.hasOwnProperty("isPrototypeOf");
7
- }, T = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
- function w(e) {
9
- let s;
10
- const t = Array.isArray(e), n = typeof FileList < "u" ? e instanceof FileList : !1;
11
- if (e instanceof Date)
12
- s = new Date(e);
13
- else if (e instanceof Set)
14
- s = new Set(e);
15
- else if (!(T && (e instanceof Blob || n)) && (t || g(e)))
16
- if (s = t ? [] : {}, !t && !I(e))
17
- s = e;
18
- else
19
- for (const r in e)
20
- e.hasOwnProperty(r) && (s[r] = w(e[r]));
21
- else
22
- return e;
23
- return s;
24
- }
25
- var P = (e) => Array.isArray(e) ? e.filter(Boolean) : [], v = (e) => e === void 0, c = (e, s, t) => {
26
- if (!s || !g(e))
27
- return t;
28
- const n = P(s.split(/[,[\].]+?/)).reduce((r, i) => O(r) ? r : r[i], e);
29
- return v(n) || n === e ? v(e[s]) ? t : e[s] : n;
30
- }, V = (e) => typeof e == "boolean", H = (e) => /^\w*$/.test(e), W = (e) => P(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, s, t) => {
31
- let n = -1;
32
- const r = H(s) ? [s] : W(s), i = r.length, l = i - 1;
33
- for (; ++n < i; ) {
34
- const u = r[n];
35
- let a = t;
36
- if (n !== l) {
37
- const f = e[u];
38
- a = g(f) || Array.isArray(f) ? f : isNaN(+r[n + 1]) ? {} : [];
39
- }
40
- if (u === "__proto__" || u === "constructor" || u === "prototype")
41
- return;
42
- e[u] = a, e = e[u];
43
- }
44
- };
45
- const k = {
46
- BLUR: "blur",
47
- CHANGE: "change"
48
- }, E = {
49
- all: "all"
50
- }, G = o.createContext(null), h = () => o.useContext(G);
51
- var $ = (e, s, t, n = !0) => {
52
- const r = {
53
- defaultValues: s._defaultValues
54
- };
55
- for (const i in e)
56
- Object.defineProperty(r, i, {
57
- get: () => {
58
- const l = i;
59
- return s._proxyFormState[l] !== E.all && (s._proxyFormState[l] = !n || E.all), t && (t[l] = !0), e[l];
60
- }
61
- });
62
- return r;
63
- };
64
- function j(e) {
65
- const s = h(), { control: t = s.control, disabled: n, name: r, exact: i } = e || {}, [l, u] = o.useState(t._formState), a = o.useRef({
66
- isDirty: !1,
67
- isLoading: !1,
68
- dirtyFields: !1,
69
- touchedFields: !1,
70
- validatingFields: !1,
71
- isValidating: !1,
72
- isValid: !1,
73
- errors: !1
74
- }), f = o.useRef(r);
75
- return f.current = r, o.useEffect(() => t._subscribe({
76
- name: f.current,
77
- formState: a.current,
78
- exact: i,
79
- callback: (y) => {
80
- !n && u({
81
- ...t._formState,
82
- ...y
83
- });
84
- }
85
- }), [t, n, i]), o.useEffect(() => {
86
- a.current.isValid && t._setValid(!0);
87
- }, [t]), o.useMemo(() => $(l, t, a.current, !1), [l, t]);
88
- }
89
- var K = (e) => typeof e == "string", q = (e, s, t, n, r) => K(e) ? c(t, e, r) : Array.isArray(e) ? e.map((i) => c(t, i)) : t;
90
- function z(e) {
91
- const s = h(), { control: t = s.control, name: n, defaultValue: r, disabled: i, exact: l } = e || {}, u = o.useRef(n), a = o.useRef(r);
92
- u.current = n, o.useEffect(() => t._subscribe({
93
- name: u.current,
94
- formState: {
95
- values: !0
96
- },
97
- exact: l,
98
- callback: (b) => !i && y(q(u.current, t._names, b.values || t._formValues, !1, a.current))
99
- }), [t, i, l]);
100
- const [f, y] = o.useState(t._getWatch(n, r));
101
- return o.useEffect(() => t._removeUnmounted()), f;
102
- }
103
- function J(e) {
104
- const s = h(), { name: t, disabled: n, control: r = s.control, shouldUnregister: i } = e, l = M(r._names.array, t), u = z({
105
- control: r,
106
- name: t,
107
- defaultValue: c(r._formValues, t, c(r._defaultValues, t, e.defaultValue)),
108
- exact: !0
109
- }), a = j({
110
- control: r,
111
- name: t,
112
- exact: !0
113
- }), f = o.useRef(e), y = o.useRef(r.register(t, {
114
- ...e.rules,
115
- value: u,
116
- ...V(e.disabled) ? { disabled: e.disabled } : {}
117
- })), b = o.useMemo(() => Object.defineProperties({}, {
118
- invalid: {
119
- enumerable: !0,
120
- get: () => !!c(a.errors, t)
121
- },
122
- isDirty: {
123
- enumerable: !0,
124
- get: () => !!c(a.dirtyFields, t)
125
- },
126
- isTouched: {
127
- enumerable: !0,
128
- get: () => !!c(a.touchedFields, t)
129
- },
130
- isValidating: {
131
- enumerable: !0,
132
- get: () => !!c(a.validatingFields, t)
133
- },
134
- error: {
135
- enumerable: !0,
136
- get: () => c(a.errors, t)
137
- }
138
- }), [a, t]), F = o.useCallback((d) => y.current.onChange({
139
- target: {
140
- value: L(d),
141
- name: t
142
- },
143
- type: k.CHANGE
144
- }), [t]), A = o.useCallback(() => y.current.onBlur({
145
- target: {
146
- value: c(r._formValues, t),
147
- name: t
148
- },
149
- type: k.BLUR
150
- }), [t, r._formValues]), C = o.useCallback((d) => {
151
- const m = c(r._fields, t);
152
- m && d && (m._f.ref = {
153
- focus: () => d.focus(),
154
- select: () => d.select(),
155
- setCustomValidity: (_) => d.setCustomValidity(_),
156
- reportValidity: () => d.reportValidity()
157
- });
158
- }, [r._fields, t]), S = o.useMemo(() => ({
159
- name: t,
160
- value: u,
161
- ...V(n) || a.disabled ? { disabled: a.disabled || n } : {},
162
- onChange: F,
163
- onBlur: A,
164
- ref: C
165
- }), [t, n, a.disabled, F, A, C, u]);
166
- return o.useEffect(() => {
167
- const d = r._options.shouldUnregister || i;
168
- r.register(t, {
169
- ...f.current.rules,
170
- ...V(f.current.disabled) ? { disabled: f.current.disabled } : {}
171
- });
172
- const m = (_, N) => {
173
- const p = c(r._fields, _);
174
- p && p._f && (p._f.mount = N);
175
- };
176
- if (m(t, !0), d) {
177
- const _ = w(c(r._options.defaultValues, t));
178
- x(r._defaultValues, t, _), v(c(r._formValues, t)) && x(r._formValues, t, _);
179
- }
180
- return !l && r.register(t), () => {
181
- (l ? d && !r._state.action : d) ? r.unregister(t) : m(t, !1);
182
- };
183
- }, [t, r, l, i]), o.useEffect(() => {
184
- r._setDisabledField({
185
- disabled: n,
186
- name: t
187
- });
188
- }, [n, t, r]), o.useMemo(() => ({
189
- field: S,
190
- formState: a,
191
- fieldState: b
192
- }), [S, a, b]);
193
- }
194
- const X = (e) => e.render(J(e));
195
- export {
196
- X as Controller,
197
- c as get,
198
- x as set,
199
- J as useController,
200
- h as useFormContext,
201
- j as useFormState,
202
- z as useWatch
203
- };