lawgic-dev-kit 0.15.9 → 0.16.2

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 (25) hide show
  1. package/dist/_virtual/index2.js +2 -3
  2. package/dist/_virtual/index3.js +3 -3
  3. package/dist/_virtual/index4.js +3 -5
  4. package/dist/_virtual/index5.js +5 -2
  5. package/dist/_virtual/index6.js +2 -2
  6. package/dist/_virtual/index7.js +2 -2
  7. package/dist/components/molecules/AlertModal/AlertModal.js +21 -21
  8. package/dist/components/molecules/AlertModal/AlertModal.types.d.ts +2 -2
  9. package/dist/components/molecules/CalendarSelector/CalendarSelector.d.ts +2 -0
  10. package/dist/components/molecules/CalendarSelector/CalendarSelector.js +120 -118
  11. package/dist/components/molecules/DateInput/DateInput.d.ts +3 -1
  12. package/dist/components/molecules/DateInput/DateInput.js +47 -46
  13. package/dist/components/molecules/DialogModal/DialogModal.js +37 -37
  14. package/dist/components/molecules/DialogModal/DialogModal.types.d.ts +3 -3
  15. package/dist/components/molecules/UncontrolledDateInput/UncontrolledDateInput.d.ts +3 -1
  16. package/dist/components/molecules/UncontrolledDateInput/UncontrolledDateInput.js +37 -34
  17. package/dist/lawgic-dev-kit.umd.js +60 -60
  18. package/dist/node_modules/prop-types/index.js +1 -1
  19. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  20. package/dist/node_modules/toposort/index.js +1 -1
  21. package/dist/node_modules/yup/index.esm.js +3 -3
  22. package/dist/src/components/molecules/CalendarSelector/CalendarSelector.d.ts +11 -0
  23. package/dist/src/components/molecules/DateInput/DateInput.d.ts +13 -0
  24. package/dist/src/components/molecules/UncontrolledDateInput/UncontrolledDateInput.d.ts +12 -0
  25. package/package.json +1 -1
@@ -1,79 +1,80 @@
1
- import { j as m } from "../../../_virtual/jsx-runtime.js";
2
- import { useState as C, useEffect as F } from "react";
3
- import { useController as M } from "react-hook-form";
4
- import { faX as E } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
5
- import { FontAwesomeIcon as V } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
6
- import k from "../FloatingMenu/FloatingMenu.js";
7
- import A from "../CalendarSelector/CalendarSelector.js";
8
- import B from "../../atoms/UncontrolledTextInput/UncontrolledTextInput.js";
9
- import { useTheme as K } from "../../../hooks/useTheme.js";
10
- import { formatDate as O } from "../../../node_modules/date-fns/format.js";
11
- const D = (a) => O(a, "dd/MM/yyyy"), N = (a) => {
1
+ import { j as c } from "../../../_virtual/jsx-runtime.js";
2
+ import { useState as x, useEffect as E } from "react";
3
+ import { useController as V } from "react-hook-form";
4
+ import { faX as k } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
5
+ import { FontAwesomeIcon as A } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
6
+ import B from "../FloatingMenu/FloatingMenu.js";
7
+ import K from "../CalendarSelector/CalendarSelector.js";
8
+ import O from "../../atoms/UncontrolledTextInput/UncontrolledTextInput.js";
9
+ import { useTheme as R } from "../../../hooks/useTheme.js";
10
+ import { formatDate as U } from "../../../node_modules/date-fns/format.js";
11
+ const N = (a) => U(a, "dd/MM/yyyy"), D = (a) => {
12
12
  const [t, n, o] = a.split("/");
13
13
  if ((t == null ? void 0 : t.length) === 2 && (n == null ? void 0 : n.length) === 2 && (o == null ? void 0 : o.length) === 4) {
14
14
  const l = new Date(Number(o), Number(n) - 1, Number(t));
15
15
  return isNaN(l.getTime()) ? null : l;
16
16
  }
17
17
  return null;
18
- }, Q = ({ control: a, name: t, showTimeSelector: n = !1, label: o, translateKey: l = "", placeholder: j }) => {
18
+ }, Y = ({ control: a, name: t, showTimeSelector: n = !1, label: o, translateKey: l = "", placeholder: j, futureDates: I = !1, pastDates: b = !0 }) => {
19
19
  const {
20
- field: { value: i, onChange: p, onBlur: I },
21
- fieldState: { error: u }
22
- } = M({ name: t, control: a }), { t: g } = K(), b = g(t), S = g(l), [T, c] = C(!1), [h, r] = C("");
23
- F(() => {
24
- i instanceof Date && !isNaN(i.getTime()) ? r(D(i)) : r("");
20
+ field: { value: i, onChange: p, onBlur: S },
21
+ fieldState: { error: m }
22
+ } = V({ name: t, control: a }), { t: g } = R(), T = g(t), v = g(l), [y, f] = x(!1), [h, r] = x("");
23
+ E(() => {
24
+ i instanceof Date && !isNaN(i.getTime()) ? r(N(i)) : r("");
25
25
  }, [i]);
26
- const x = N(h), v = (e) => {
27
- const s = e.replace(/\D/g, "").slice(0, 8), f = [];
28
- s.length > 0 && f.push(s.slice(0, 2)), s.length > 2 && f.push(s.slice(2, 4)), s.length > 4 && f.push(s.slice(4, 8));
29
- const d = f.join("/");
30
- if (r(d), c(!1), d.length === 10) {
31
- const y = N(d);
32
- p(y);
26
+ const C = D(h), F = (e) => {
27
+ const s = e.replace(/\D/g, "").slice(0, 8), u = [];
28
+ s.length > 0 && u.push(s.slice(0, 2)), s.length > 2 && u.push(s.slice(2, 4)), s.length > 4 && u.push(s.slice(4, 8));
29
+ const d = u.join("/");
30
+ if (r(d), f(!1), d.length === 10) {
31
+ const w = D(d);
32
+ p(w);
33
33
  }
34
- }, w = () => {
34
+ }, M = () => {
35
35
  p(null), r("");
36
36
  };
37
- return /* @__PURE__ */ m.jsx(
38
- k,
37
+ return /* @__PURE__ */ c.jsx(
38
+ B,
39
39
  {
40
- open: T,
40
+ open: y,
41
41
  strategy: "fixed",
42
42
  padding: 0,
43
43
  offset: 0,
44
- onClose: () => c(!1),
44
+ onClose: () => f(!1),
45
45
  className: "p-0!",
46
- component: /* @__PURE__ */ m.jsx(
47
- A,
46
+ component: /* @__PURE__ */ c.jsx(
47
+ K,
48
48
  {
49
- date: x || /* @__PURE__ */ new Date(),
49
+ date: C || /* @__PURE__ */ new Date(),
50
50
  onDateChange: (e) => {
51
- r(D(e)), p(e), c(!1);
51
+ r(N(e)), p(e), f(!1);
52
52
  },
53
53
  showTimeSelector: n,
54
- maxDate: /* @__PURE__ */ new Date()
54
+ futureDates: I,
55
+ pastDates: b
55
56
  }
56
57
  ),
57
- children: /* @__PURE__ */ m.jsx(
58
- B,
58
+ children: /* @__PURE__ */ c.jsx(
59
+ O,
59
60
  {
60
- onBlur: I,
61
- name: S || b,
61
+ onBlur: S,
62
+ name: v || T,
62
63
  label: o,
63
64
  value: h,
64
65
  onFocus: (e) => {
65
- e.preventDefault(), c(!0);
66
+ e.preventDefault(), f(!0);
66
67
  },
67
68
  disabledInput: !0,
68
- onChange: (e) => v(e),
69
+ onChange: (e) => F(e),
69
70
  placeholder: j,
70
- error: u == null ? void 0 : u.message,
71
- rightSide: !!x && /* @__PURE__ */ m.jsx(
72
- V,
71
+ error: m == null ? void 0 : m.message,
72
+ rightSide: !!C && /* @__PURE__ */ c.jsx(
73
+ A,
73
74
  {
74
- icon: E,
75
+ icon: k,
75
76
  className: "text-gray-500 cursor-pointer",
76
- onClick: w
77
+ onClick: M
77
78
  }
78
79
  )
79
80
  }
@@ -82,5 +83,5 @@ const D = (a) => O(a, "dd/MM/yyyy"), N = (a) => {
82
83
  );
83
84
  };
84
85
  export {
85
- Q as default
86
+ Y as default
86
87
  };
@@ -1,6 +1,6 @@
1
- import { j as i } from "../../../_virtual/jsx-runtime.js";
1
+ import { j as e } from "../../../_virtual/jsx-runtime.js";
2
2
  import { faX as u } from "../../../node_modules/@fortawesome/pro-light-svg-icons/index.js";
3
- import { FontAwesomeIcon as a } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
3
+ import { FontAwesomeIcon as l } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
4
4
  import "react";
5
5
  import "../../../_virtual/lodash.js";
6
6
  import { useTheme as y } from "../../../hooks/useTheme.js";
@@ -8,19 +8,19 @@ import { faCheck as v } from "../../../node_modules/@fortawesome/pro-solid-svg-i
8
8
  import "react-hook-form";
9
9
  import "../InformationContainer/InformationContainer.js";
10
10
  import g from "../../atoms/BoxContainer/BoxContainer.js";
11
- import l from "../../atoms/Button/Button.js";
11
+ import r from "../../atoms/Button/Button.js";
12
12
  import "../../../constants/countries.js";
13
13
  import "../../atoms/ImageProfileInput/ImageProfileInput.validators.js";
14
14
  import "fuse.js";
15
15
  import { AnimatePresence as N } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js";
16
- import { motion as r } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/render/components/motion/proxy.js";
17
- const X = ({
16
+ import { motion as c } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/render/components/motion/proxy.js";
17
+ const q = ({
18
18
  title: n,
19
- description: c,
19
+ description: m,
20
20
  open: o,
21
- onClose: e,
22
- onConfirm: m,
23
- onCancel: t,
21
+ onClose: i,
22
+ onConfirm: t,
23
+ onCancel: s,
24
24
  icon: x = v
25
25
  }) => {
26
26
  const d = {
@@ -51,21 +51,21 @@ const X = ({
51
51
  }
52
52
  }
53
53
  }, p = () => {
54
- m(), e();
54
+ t == null || t(), i();
55
55
  }, h = () => {
56
- t == null || t(), e();
57
- }, { t: s } = y();
58
- return /* @__PURE__ */ i.jsx(N, { children: o && /* @__PURE__ */ i.jsx(i.Fragment, { children: /* @__PURE__ */ i.jsx(
59
- r.div,
56
+ s == null || s(), i();
57
+ }, { t: a } = y();
58
+ return /* @__PURE__ */ e.jsx(N, { children: o && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
59
+ c.div,
60
60
  {
61
61
  className: "fixed inset-0 bg-black/50 z-9999 flex items-center justify-center",
62
62
  initial: "hidden",
63
63
  animate: "visible",
64
64
  exit: "hidden",
65
65
  variants: d,
66
- onClick: e,
67
- children: /* @__PURE__ */ i.jsx(
68
- r.div,
66
+ onClick: i,
67
+ children: /* @__PURE__ */ e.jsx(
68
+ c.div,
69
69
  {
70
70
  className: "w-full max-w-sm mx-16 z-50",
71
71
  variants: f,
@@ -73,46 +73,46 @@ const X = ({
73
73
  animate: "visible",
74
74
  exit: "exit",
75
75
  onClick: (j) => j.stopPropagation(),
76
- children: /* @__PURE__ */ i.jsxs(g, { className: "flex flex-col gap-20 p-32", children: [
77
- /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col", children: [
78
- /* @__PURE__ */ i.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ i.jsx(
79
- a,
76
+ children: /* @__PURE__ */ e.jsxs(g, { className: "flex flex-col gap-20 p-32", children: [
77
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
78
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(
79
+ l,
80
80
  {
81
81
  icon: u,
82
82
  className: "cursor-pointer text-2xl text-gray-500 transition-all duration-300 hover:text-gray-700",
83
- onClick: e
83
+ onClick: i
84
84
  }
85
85
  ) }),
86
- /* @__PURE__ */ i.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ i.jsx("div", { className: "bg-blue-100 rounded-full w-76 h-76 flex justify-center items-center", children: /* @__PURE__ */ i.jsx(
87
- a,
86
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "bg-blue-100 rounded-full w-76 h-76 flex justify-center items-center", children: /* @__PURE__ */ e.jsx(
87
+ l,
88
88
  {
89
89
  icon: x,
90
90
  className: "w-32 h-36 min-h-36 min-w-36 text-blue-500",
91
- onClick: e
91
+ onClick: i
92
92
  }
93
93
  ) }) })
94
94
  ] }),
95
- /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col gap-20 items-center justify-center", children: [
96
- /* @__PURE__ */ i.jsxs("div", { className: "text-center w-full", children: [
97
- /* @__PURE__ */ i.jsx("h3", { className: "text-black font-700 text-3xl w-full", children: n }),
98
- /* @__PURE__ */ i.jsx("p", { className: "text-gray-500 text-xl font-600 w-full", children: c })
95
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-20 items-center justify-center", children: [
96
+ /* @__PURE__ */ e.jsxs("div", { className: "text-center w-full", children: [
97
+ /* @__PURE__ */ e.jsx("h3", { className: "text-black font-700 text-3xl w-full", children: n }),
98
+ /* @__PURE__ */ e.jsx("p", { className: "text-gray-500 text-xl font-600 w-full", children: m })
99
99
  ] }),
100
- /* @__PURE__ */ i.jsxs("div", { className: "flex justify-center w-full gap-16", children: [
101
- !!t && /* @__PURE__ */ i.jsx(
102
- l,
100
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-center w-full gap-16", children: [
101
+ !!s && /* @__PURE__ */ e.jsx(
102
+ r,
103
103
  {
104
104
  size: "lg",
105
105
  onClick: h,
106
106
  variant: "transparent",
107
- children: s("cancel")
107
+ children: a("cancel")
108
108
  }
109
109
  ),
110
- /* @__PURE__ */ i.jsx(
111
- l,
110
+ !!t && /* @__PURE__ */ e.jsx(
111
+ r,
112
112
  {
113
113
  size: "lg",
114
114
  onClick: p,
115
- children: s("confirm")
115
+ children: a("confirm")
116
116
  }
117
117
  )
118
118
  ] })
@@ -124,5 +124,5 @@ const X = ({
124
124
  ) }) });
125
125
  };
126
126
  export {
127
- X as default
127
+ q as default
128
128
  };
@@ -1,10 +1,10 @@
1
1
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
2
2
  export interface DialogModalProps {
3
3
  title: string;
4
- description: string;
4
+ description?: string;
5
5
  open: boolean;
6
6
  icon?: IconProp;
7
7
  onClose: () => void;
8
- onConfirm: () => void;
9
- onCancel: () => void;
8
+ onConfirm?: () => void;
9
+ onCancel?: () => void;
10
10
  }
@@ -5,6 +5,8 @@ export type UncontrolledDateInputProps = {
5
5
  placeholder?: string;
6
6
  error?: string;
7
7
  translatedKey: string;
8
+ futureDates?: boolean;
9
+ pastDates?: boolean;
8
10
  showTimeSelector?: boolean;
9
11
  };
10
- export default function UncontrolledDateInput({ currentDate, onDateChange, label, placeholder, error, translatedKey, showTimeSelector, }: UncontrolledDateInputProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function UncontrolledDateInput({ currentDate, onDateChange, label, placeholder, error, translatedKey, showTimeSelector, futureDates, pastDates, }: UncontrolledDateInputProps): import("react/jsx-runtime").JSX.Element;
@@ -1,90 +1,93 @@
1
1
  import { j as m } from "../../../_virtual/jsx-runtime.js";
2
- import { useState as d, useEffect as y } from "react";
3
- import { faX as I } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
4
- import { FontAwesomeIcon as b } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
5
- import w from "../CalendarSelector/CalendarSelector.js";
6
- import M from "../FloatingMenu/FloatingMenu.js";
2
+ import { useState as d, useEffect as b } from "react";
3
+ import { faX as M } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
4
+ import { FontAwesomeIcon as S } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
5
+ import k from "../CalendarSelector/CalendarSelector.js";
6
+ import v from "../FloatingMenu/FloatingMenu.js";
7
7
  import "../../../_virtual/lodash.js";
8
8
  import "../../../contexts/themeContext.js";
9
9
  import "react-hook-form";
10
- import S from "../../atoms/UncontrolledTextInput/UncontrolledTextInput.js";
10
+ import w from "../../atoms/UncontrolledTextInput/UncontrolledTextInput.js";
11
11
  import "../InformationContainer/InformationContainer.js";
12
12
  import "../../../constants/countries.js";
13
13
  import "../../atoms/ImageProfileInput/ImageProfileInput.validators.js";
14
14
  import "fuse.js";
15
- import { formatDate as k } from "../../../node_modules/date-fns/format.js";
16
- const c = (e) => k(e, "dd/MM/yyyy"), v = (e) => {
15
+ import { formatDate as E } from "../../../node_modules/date-fns/format.js";
16
+ const c = (e) => E(e, "dd/MM/yyyy"), F = (e) => {
17
17
  const [t, n, s] = e.split("/");
18
18
  if ((t == null ? void 0 : t.length) === 2 && (n == null ? void 0 : n.length) === 2 && (s == null ? void 0 : s.length) === 4) {
19
- const a = new Date(Number(s), Number(n) - 1, Number(t));
20
- return isNaN(a.getTime()) ? null : a;
19
+ const i = new Date(Number(s), Number(n) - 1, Number(t));
20
+ return isNaN(i.getTime()) ? null : i;
21
21
  }
22
22
  return null;
23
23
  };
24
- function J({
24
+ function L({
25
25
  currentDate: e,
26
26
  onDateChange: t,
27
27
  label: n,
28
28
  placeholder: s = "dd/mm/yyyy",
29
- error: a,
29
+ error: i,
30
30
  translatedKey: g,
31
- showTimeSelector: h = !1
31
+ showTimeSelector: h = !1,
32
+ futureDates: x = !1,
33
+ pastDates: C = !0
32
34
  }) {
33
- const [x, i] = d(!1), [C, r] = d(
35
+ const [j, a] = d(!1), [N, r] = d(
34
36
  e ? c(e) : ""
35
37
  );
36
- y(() => {
38
+ b(() => {
37
39
  r(e ? c(e) : "");
38
40
  }, [e]);
39
- const j = (o) => {
41
+ const y = (o) => {
40
42
  const l = o.replace(/\D/g, "").slice(0, 8), p = [];
41
43
  l.length > 0 && p.push(l.slice(0, 2)), l.length > 2 && p.push(l.slice(2, 4)), l.length > 4 && p.push(l.slice(4, 8));
42
44
  const f = p.join("/");
43
- if (r(f), i(!1), f.length === 10) {
44
- const u = v(f);
45
+ if (r(f), a(!1), f.length === 10) {
46
+ const u = F(f);
45
47
  u && t(u);
46
48
  }
47
- }, N = () => {
49
+ }, I = () => {
48
50
  t(null), r("");
49
51
  };
50
52
  return /* @__PURE__ */ m.jsx(
51
- M,
53
+ v,
52
54
  {
53
- open: x,
55
+ open: j,
54
56
  strategy: "fixed",
55
57
  padding: 0,
56
58
  offset: 0,
57
- onClose: () => i(!1),
59
+ onClose: () => a(!1),
58
60
  className: "p-0!",
59
61
  component: /* @__PURE__ */ m.jsx(
60
- w,
62
+ k,
61
63
  {
62
64
  date: e || /* @__PURE__ */ new Date(),
63
65
  onDateChange: (o) => {
64
- t(o), r(c(o)), i(!1);
66
+ t(o), r(c(o)), a(!1);
65
67
  },
66
68
  showTimeSelector: h,
67
- maxDate: /* @__PURE__ */ new Date()
69
+ futureDates: x,
70
+ pastDates: C
68
71
  }
69
72
  ),
70
73
  children: /* @__PURE__ */ m.jsx(
71
- S,
74
+ w,
72
75
  {
73
76
  name: g,
74
77
  label: n,
75
- value: C,
78
+ value: N,
76
79
  onClick: (o) => {
77
- o.preventDefault(), i(!0);
80
+ o.preventDefault(), a(!0);
78
81
  },
79
- onChange: (o) => j(o),
82
+ onChange: (o) => y(o),
80
83
  placeholder: s,
81
- error: a,
84
+ error: i,
82
85
  rightSide: e && /* @__PURE__ */ m.jsx(
83
- b,
86
+ S,
84
87
  {
85
- icon: I,
88
+ icon: M,
86
89
  className: "text-gray-500 cursor-pointer",
87
- onClick: N
90
+ onClick: I
88
91
  }
89
92
  )
90
93
  }
@@ -93,5 +96,5 @@ function J({
93
96
  );
94
97
  }
95
98
  export {
96
- J as default
99
+ L as default
97
100
  };