lawgic-dev-kit 0.16.0 → 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.
@@ -1,5 +1,4 @@
1
- import { __require as r } from "../node_modules/property-expr/index.js";
2
- var e = r();
1
+ var p = { exports: {} };
3
2
  export {
4
- e as p
3
+ p as __module
5
4
  };
@@ -1,5 +1,5 @@
1
- import { __require as r } from "../node_modules/tiny-case/index.js";
2
- var a = r();
1
+ import { __require as r } from "../node_modules/property-expr/index.js";
2
+ var e = r();
3
3
  export {
4
- a as t
4
+ e as p
5
5
  };
@@ -1,7 +1,5 @@
1
- import { getDefaultExportFromCjs as o } from "./_commonjsHelpers.js";
2
- import { __require as r } from "../node_modules/toposort/index.js";
3
- var t = r();
4
- const s = /* @__PURE__ */ o(t);
1
+ import { __require as r } from "../node_modules/tiny-case/index.js";
2
+ var a = r();
5
3
  export {
6
- s as default
4
+ a as t
7
5
  };
@@ -1,4 +1,7 @@
1
- var p = { exports: {} };
1
+ import { getDefaultExportFromCjs as o } from "./_commonjsHelpers.js";
2
+ import { __require as r } from "../node_modules/toposort/index.js";
3
+ var t = r();
4
+ const s = /* @__PURE__ */ o(t);
2
5
  export {
3
- p as __module
6
+ s as default
4
7
  };
@@ -1,4 +1,4 @@
1
- var o = { exports: {} };
1
+ var e = { exports: {} };
2
2
  export {
3
- o as __module
3
+ e as __module
4
4
  };
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ var o = { exports: {} };
2
2
  export {
3
- e as __module
3
+ o as __module
4
4
  };
@@ -4,6 +4,8 @@ export type CalendarSelectorProps = {
4
4
  onDateChange: (date: Date) => void;
5
5
  showTimeSelector?: boolean;
6
6
  maxDate?: Date;
7
+ futureDates?: boolean;
8
+ pastDates?: boolean;
7
9
  };
8
10
  declare const CalendarSelector: React.FC<CalendarSelectorProps>;
9
11
  export default CalendarSelector;
@@ -1,144 +1,146 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- import { faChevronRight as oe } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
- import { faChevronLeft as ne } from "../../../node_modules/@fortawesome/pro-solid-svg-icons/index.js";
4
- import { useState as p, useEffect as $, useRef as H } from "react";
5
- import { FontAwesomeIcon as se } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
2
+ import { faChevronRight as se } from "../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";
3
+ import { faChevronLeft as ae } from "../../../node_modules/@fortawesome/pro-solid-svg-icons/index.js";
4
+ import { useState as u, useEffect as H, useRef as $ } from "react";
5
+ import { FontAwesomeIcon as ie } from "../../../node_modules/@fortawesome/react-fontawesome/index.es.js";
6
6
  import "../../../_virtual/lodash.js";
7
- import { useTheme as ae } from "../../../hooks/useTheme.js";
7
+ import { useTheme as le } from "../../../hooks/useTheme.js";
8
8
  import Y from "../FloatingMenu/FloatingMenu.js";
9
- import ie from "./PeriodToggle.js";
10
- import le from "./TimeDisplay.js";
11
- import { faChevronDown as ce } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
9
+ import ce from "./PeriodToggle.js";
10
+ import me from "./TimeDisplay.js";
11
+ import { faChevronDown as de } from "../../../node_modules/@fortawesome/pro-regular-svg-icons/index.js";
12
12
  import "react-hook-form";
13
13
  import "../InformationContainer/InformationContainer.js";
14
14
  import "../../../constants/countries.js";
15
15
  import I from "../../atoms/IconButton/IconButton.js";
16
16
  import "../../atoms/ImageProfileInput/ImageProfileInput.validators.js";
17
17
  import "fuse.js";
18
- import { AnimatePresence as me } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js";
18
+ import { AnimatePresence as pe } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/components/AnimatePresence/index.js";
19
19
  import { motion as B } from "../../../node_modules/motion/dist/es/framer-motion/dist/es/render/components/motion/proxy.js";
20
- import { startOfWeek as de } from "../../../node_modules/date-fns/startOfWeek.js";
21
- import { startOfMonth as pe } from "../../../node_modules/date-fns/startOfMonth.js";
22
- import { endOfWeek as ue } from "../../../node_modules/date-fns/endOfWeek.js";
23
- import { endOfMonth as fe } from "../../../node_modules/date-fns/endOfMonth.js";
24
- import { eachDayOfInterval as xe } from "../../../node_modules/date-fns/eachDayOfInterval.js";
25
- import { isSameDay as he } from "../../../node_modules/date-fns/isSameDay.js";
26
- import { isSameMonth as ge } from "../../../node_modules/date-fns/isSameMonth.js";
27
- import { isToday as Me } from "../../../node_modules/date-fns/isToday.js";
28
- import { subMonths as ye } from "../../../node_modules/date-fns/subMonths.js";
29
- import { addMonths as ve } from "../../../node_modules/date-fns/addMonths.js";
20
+ import { startOfWeek as ue } from "../../../node_modules/date-fns/startOfWeek.js";
21
+ import { startOfMonth as fe } from "../../../node_modules/date-fns/startOfMonth.js";
22
+ import { endOfWeek as xe } from "../../../node_modules/date-fns/endOfWeek.js";
23
+ import { endOfMonth as he } from "../../../node_modules/date-fns/endOfMonth.js";
24
+ import { eachDayOfInterval as ge } from "../../../node_modules/date-fns/eachDayOfInterval.js";
25
+ import { isSameDay as Me } from "../../../node_modules/date-fns/isSameDay.js";
26
+ import { isSameMonth as ye } from "../../../node_modules/date-fns/isSameMonth.js";
27
+ import { isToday as ve } from "../../../node_modules/date-fns/isToday.js";
28
+ import { subMonths as we } from "../../../node_modules/date-fns/subMonths.js";
29
+ import { addMonths as be } from "../../../node_modules/date-fns/addMonths.js";
30
30
  import { setHours as U } from "../../../node_modules/date-fns/setHours.js";
31
31
  import { setMinutes as R } from "../../../node_modules/date-fns/setMinutes.js";
32
32
  import { setSeconds as L } from "../../../node_modules/date-fns/setSeconds.js";
33
- import { formatDate as u } from "../../../node_modules/date-fns/format.js";
34
- import { es as h } from "../../../node_modules/date-fns/locale/es.js";
35
- const rt = ({
33
+ import { formatDate as f } from "../../../node_modules/date-fns/format.js";
34
+ import { es as g } from "../../../node_modules/date-fns/locale/es.js";
35
+ const nt = ({
36
36
  date: c,
37
37
  onDateChange: S,
38
38
  showTimeSelector: _ = !0,
39
- maxDate: g
39
+ maxDate: M,
40
+ futureDates: W = !1,
41
+ pastDates: q = !0
40
42
  }) => {
41
- const [a, M] = p(c), [E, w] = p(c), [y, k] = p(c.getHours() % 12 || 12), [b, A] = p(
43
+ const [i, y] = u(c), [E, w] = u(c), [v, k] = u(c.getHours() % 12 || 12), [b, A] = u(
42
44
  c.getHours() >= 12 ? "PM" : "AM"
43
- ), [C, O] = p(0), { t: W } = ae(), [P, j] = p(!1), [T, N] = p(!1);
44
- $(() => {
45
- M(c), w(c), k(c.getHours() % 12 || 12), A(c.getHours() >= 12 ? "PM" : "AM");
45
+ ), [C, P] = u(0), { t: z } = le(), [O, j] = u(!1), [T, D] = u(!1);
46
+ H(() => {
47
+ y(c), w(c), k(c.getHours() % 12 || 12), A(c.getHours() >= 12 ? "PM" : "AM");
46
48
  }, [c]);
47
- const q = () => {
48
- O(-1), setTimeout(() => {
49
- M(ye(a));
49
+ const G = () => {
50
+ P(-1), setTimeout(() => {
51
+ y(we(i));
50
52
  }, 10);
51
- }, z = () => {
52
- O(1), setTimeout(() => {
53
- M(ve(a, 1));
53
+ }, J = () => {
54
+ P(1), setTimeout(() => {
55
+ y(be(i, 1));
54
56
  }, 10);
55
- }, G = (t) => {
56
- if (g && t > g)
57
+ }, K = (t) => {
58
+ if (M && t > M)
57
59
  return;
58
- const s = U(
60
+ const a = U(
59
61
  R(L(t, 0), 0),
60
- b === "AM" ? y % 12 : y % 12 + 12
62
+ b === "AM" ? v % 12 : v % 12 + 12
61
63
  );
62
- w(s), S(s);
63
- }, J = (t) => {
64
+ w(a), S(a);
65
+ }, Q = (t) => {
64
66
  k(t);
65
- const s = U(
67
+ const a = U(
66
68
  R(L(E, 0), 0),
67
69
  b === "AM" ? t % 12 : t % 12 + 12
68
70
  );
69
- w(s), S(s), j(!1);
70
- }, K = (t) => {
71
+ w(a), S(a), j(!1);
72
+ }, V = (t) => {
71
73
  A(t);
72
- }, Q = () => {
73
- const t = /* @__PURE__ */ new Date(), s = 20, m = 5, [n, D] = p(() => Array.from({ length: s + 1 }, (r, l) => {
74
- const o = new Date(t.getFullYear(), t.getMonth() - l, 1);
74
+ }, X = () => {
75
+ const t = /* @__PURE__ */ new Date(), a = 20, m = 5, [d, l] = u(() => Array.from({ length: a + 1 }, (r, n) => {
76
+ const o = new Date(t.getFullYear(), t.getMonth() - n, 1);
75
77
  return {
76
- name: u(o, "MMMM", { locale: h }).replace(/^./, (f) => f.toUpperCase()),
78
+ name: f(o, "MMMM", { locale: g }).replace(/^./, (s) => s.toUpperCase()),
77
79
  index: o.getMonth(),
78
80
  year: o.getFullYear(),
79
- displayName: `${u(o, "MMMM", { locale: h }).replace(
81
+ displayName: `${f(o, "MMMM", { locale: g }).replace(
80
82
  /^./,
81
- (f) => f.toUpperCase()
83
+ (s) => s.toUpperCase()
82
84
  )} ${o.getFullYear()}`
83
85
  };
84
- })), i = H(null), d = H(null);
85
- $(() => {
86
- i.current && i.current.disconnect(), i.current = new IntersectionObserver((r) => {
87
- r[0].isIntersecting && D((l) => {
88
- const o = l[l.length - 1], f = new Date(o.year, o.index - 1, 1), te = Array.from({ length: m }, (we, re) => {
89
- const x = new Date(f.getFullYear(), f.getMonth() - re, 1);
86
+ })), x = $(null), p = $(null);
87
+ H(() => {
88
+ x.current && x.current.disconnect(), x.current = new IntersectionObserver((r) => {
89
+ r[0].isIntersecting && l((n) => {
90
+ const o = n[n.length - 1], s = new Date(o.year, o.index - 1, 1), re = Array.from({ length: m }, (Ce, ne) => {
91
+ const h = new Date(s.getFullYear(), s.getMonth() - ne, 1);
90
92
  return {
91
- name: u(x, "MMMM", { locale: h }).replace(/^./, (F) => F.toUpperCase()),
92
- index: x.getMonth(),
93
- year: x.getFullYear(),
94
- displayName: `${u(x, "MMMM", { locale: h }).replace(
93
+ name: f(h, "MMMM", { locale: g }).replace(/^./, (F) => F.toUpperCase()),
94
+ index: h.getMonth(),
95
+ year: h.getFullYear(),
96
+ displayName: `${f(h, "MMMM", { locale: g }).replace(
95
97
  /^./,
96
98
  (F) => F.toUpperCase()
97
- )} ${x.getFullYear()}`
99
+ )} ${h.getFullYear()}`
98
100
  };
99
101
  });
100
- return [...l, ...te];
102
+ return [...n, ...re];
101
103
  });
102
- }), d.current && i.current.observe(d.current);
103
- }, [n]);
104
- const v = (r, l) => {
105
- const o = new Date(a);
106
- o.setMonth(r), o.setFullYear(l), M(o), N(!1);
104
+ }), p.current && x.current.observe(p.current);
105
+ }, [d]);
106
+ const N = (r, n) => {
107
+ const o = new Date(i);
108
+ o.setMonth(r), o.setFullYear(n), y(o), D(!1);
107
109
  };
108
- return /* @__PURE__ */ e.jsx("div", { className: "flex flex-col p-8 max-h-200 overflow-y-auto bg-light gap-4", children: n.map((r, l) => {
109
- const o = l === n.length - 1;
110
+ return /* @__PURE__ */ e.jsx("div", { className: "flex flex-col p-8 max-h-200 overflow-y-auto bg-light gap-4", children: d.map((r, n) => {
111
+ const o = n === d.length - 1;
110
112
  return /* @__PURE__ */ e.jsx(
111
113
  "button",
112
114
  {
113
- ref: o ? d : null,
114
- onClick: () => v(r.index, r.year),
115
- className: `text-start p-6 font-600 transition-all duration-100 rounded-lg hover:bg-gray-100 ${a.getMonth() === r.index && a.getFullYear() === r.year ? "bg-blue-100" : ""}`,
115
+ ref: o ? p : null,
116
+ onClick: () => N(r.index, r.year),
117
+ className: `text-start p-6 font-600 transition-all duration-100 rounded-lg hover:bg-gray-100 ${i.getMonth() === r.index && i.getFullYear() === r.year ? "bg-blue-100" : ""}`,
116
118
  children: r.displayName
117
119
  },
118
- `${r.name}-${r.year}-${l}`
120
+ `${r.name}-${r.year}-${n}`
119
121
  );
120
122
  }) });
121
- }, V = () => /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center mb-8", children: [
123
+ }, Z = () => /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center mb-8", children: [
122
124
  /* @__PURE__ */ e.jsx(
123
125
  Y,
124
126
  {
125
127
  open: T,
126
- onClose: () => N(!1),
127
- component: Q,
128
+ onClose: () => D(!1),
129
+ component: X,
128
130
  placement: "bottom",
129
131
  className: "!p-0 overflow-hidden bg-light",
130
132
  strategy: "fixed",
131
133
  children: /* @__PURE__ */ e.jsxs(
132
134
  "button",
133
135
  {
134
- onClick: () => N(!T),
136
+ onClick: () => D(!T),
135
137
  className: "hover:text-blue-500 transition-colors duration-150 flex gap-6 items-center",
136
138
  children: [
137
- /* @__PURE__ */ e.jsx("h4", { className: "text-header-4", children: u(a, "MMMM yyyy", { locale: h }).replace(
139
+ /* @__PURE__ */ e.jsx("h4", { className: "text-header-4", children: f(i, "MMMM yyyy", { locale: g }).replace(
138
140
  /^./,
139
141
  (t) => t.toUpperCase()
140
142
  ) }),
141
- /* @__PURE__ */ e.jsx(se, { icon: ce, className: "w-12 h-12" })
143
+ /* @__PURE__ */ e.jsx(ie, { icon: de, className: "w-12 h-12" })
142
144
  ]
143
145
  }
144
146
  )
@@ -150,8 +152,8 @@ const rt = ({
150
152
  {
151
153
  variant: "transparent",
152
154
  color: "gray",
153
- icon: ne,
154
- onClick: q
155
+ icon: ae,
156
+ onClick: G
155
157
  }
156
158
  ),
157
159
  /* @__PURE__ */ e.jsx(
@@ -159,28 +161,28 @@ const rt = ({
159
161
  {
160
162
  variant: "transparent",
161
163
  color: "gray",
162
- icon: oe,
163
- onClick: z
164
+ icon: se,
165
+ onClick: J
164
166
  }
165
167
  )
166
168
  ] })
167
- ] }), X = () => {
168
- const t = de(pe(a)), s = ue(fe(a)), m = xe({ start: t, end: s });
169
- return /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-7 gap-2", children: m.map((n, D) => {
170
- const i = he(n, E), d = ge(n, a), v = Me(n), r = g ? n > g : !1;
169
+ ] }), ee = () => {
170
+ const t = ue(fe(i)), a = xe(he(i)), m = ge({ start: t, end: a }), d = /* @__PURE__ */ new Date();
171
+ return d.setHours(0, 0, 0, 0), /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-7 gap-2", children: m.map((l, x) => {
172
+ const p = Me(l, E), N = ye(l, i), r = ve(l), n = l < d, o = l > d, s = !N || n && !q || o && !W || M && l > M;
171
173
  return /* @__PURE__ */ e.jsx(
172
174
  B.div,
173
175
  {
174
176
  className: `
175
- p-2 text-center w-[40px] h-[40px] rounded-full flex items-center justify-center font-600 select-none
176
- ${!d || r ? "text-gray-400 pointer-events-none" : "cursor-pointer"}
177
- ${v && !i ? "text-blue-600" : ""}
178
- `,
179
- onClick: () => G(n),
177
+ p-2 text-center w-[40px] h-[40px] rounded-full flex items-center justify-center font-600 select-none
178
+ ${s ? "text-gray-400 pointer-events-none" : "cursor-pointer"}
179
+ ${r && !p ? "text-blue-600" : ""}
180
+ `,
181
+ onClick: () => !s && K(l),
180
182
  initial: !1,
181
183
  animate: {
182
- backgroundColor: i ? "#93C5FD" : "transparent",
183
- color: i ? "#FFFFFF" : v ? "#2563EB" : d && !r ? "#000000" : "#9CA3AF"
184
+ backgroundColor: p ? "#93C5FD" : "transparent",
185
+ color: p ? "#FFFFFF" : r ? "#2563EB" : s ? "#9CA3AF" : "#000000"
184
186
  },
185
187
  transition: {
186
188
  duration: 0.2,
@@ -190,23 +192,23 @@ const rt = ({
190
192
  ease: "easeOut"
191
193
  }
192
194
  },
193
- whileHover: d && !i && !r ? {
195
+ whileHover: !s && !p ? {
194
196
  backgroundColor: "#E5E7EB"
195
197
  } : {},
196
- whileTap: d && !r ? {
197
- backgroundColor: i ? "#7AA5E0" : "#D1D5DB"
198
- } : {},
199
- children: u(n, "d")
198
+ whileTap: s ? {} : {
199
+ backgroundColor: p ? "#7AA5E0" : "#D1D5DB"
200
+ },
201
+ children: f(l, "d")
200
202
  },
201
- D
203
+ x
202
204
  );
203
205
  }) });
204
- }, Z = () => {
205
- const t = Array.from({ length: 12 }, (m, n) => n + 1), s = () => /* @__PURE__ */ e.jsx("div", { className: "bg-white rounded-lg shadow-lg w-80 max-h-[150px] overflow-y-auto p-4 flex flex-col gap-4", children: t.map((m) => /* @__PURE__ */ e.jsxs(
206
+ }, te = () => {
207
+ const t = Array.from({ length: 12 }, (m, d) => d + 1), a = () => /* @__PURE__ */ e.jsx("div", { className: "bg-white rounded-lg shadow-lg w-80 max-h-[150px] overflow-y-auto p-4 flex flex-col gap-4", children: t.map((m) => /* @__PURE__ */ e.jsxs(
206
208
  "button",
207
209
  {
208
- onClick: () => J(m),
209
- className: `w-full text-center py-2 transition-all duration-100 rounded-lg hover:bg-gray-100 ${m === y ? "text-blue-500 font-medium" : ""}`,
210
+ onClick: () => Q(m),
211
+ className: `w-full text-center py-2 transition-all duration-100 rounded-lg hover:bg-gray-100 ${m === v ? "text-blue-500 font-medium" : ""}`,
210
212
  children: [
211
213
  String(m).padStart(2, "0"),
212
214
  ":00"
@@ -215,37 +217,37 @@ const rt = ({
215
217
  m
216
218
  )) });
217
219
  return /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center mt-4 mb-4", children: [
218
- /* @__PURE__ */ e.jsx("h4", { className: "text-body-m font-medium", children: W("time") }),
220
+ /* @__PURE__ */ e.jsx("h4", { className: "text-body-m font-medium", children: z("time") }),
219
221
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-6", children: [
220
222
  /* @__PURE__ */ e.jsx(
221
223
  Y,
222
224
  {
223
- open: P,
225
+ open: O,
224
226
  onClose: () => j(!1),
225
- component: s,
227
+ component: a,
226
228
  placement: "bottom",
227
229
  className: "!p-0 overflow-hidden",
228
230
  strategy: "fixed",
229
231
  children: /* @__PURE__ */ e.jsx(
230
- le,
232
+ me,
231
233
  {
232
234
  setHourMenuOpen: j,
233
- hourMenuOpen: P,
234
- selectedHour: y
235
+ hourMenuOpen: O,
236
+ selectedHour: v
235
237
  }
236
238
  )
237
239
  }
238
240
  ),
239
241
  /* @__PURE__ */ e.jsx(
240
- ie,
242
+ ce,
241
243
  {
242
244
  selectedPeriod: b,
243
- handlePeriodChange: K
245
+ handlePeriodChange: V
244
246
  }
245
247
  )
246
248
  ] })
247
249
  ] });
248
- }, ee = {
250
+ }, oe = {
249
251
  slideNextEnter: {
250
252
  x: 300,
251
253
  opacity: 0
@@ -280,22 +282,22 @@ const rt = ({
280
282
  }
281
283
  };
282
284
  return /* @__PURE__ */ e.jsxs("div", { className: "rounded-3xl max-w-[300px] mx-auto bg-white p-24 relative overflow-hidden", children: [
283
- V(),
284
- /* @__PURE__ */ e.jsx(me, { initial: !1, mode: "popLayout", children: /* @__PURE__ */ e.jsx(
285
+ Z(),
286
+ /* @__PURE__ */ e.jsx(pe, { initial: !1, mode: "popLayout", children: /* @__PURE__ */ e.jsx(
285
287
  B.div,
286
288
  {
287
- variants: ee,
289
+ variants: oe,
288
290
  initial: C === 1 ? "slideNextEnter" : C === -1 ? "slidePrevEnter" : !1,
289
291
  animate: "center",
290
292
  exit: C === 1 ? "slideNextExit" : "slidePrevExit",
291
293
  className: "w-full",
292
- children: X()
294
+ children: ee()
293
295
  },
294
- u(a, "yyyy-MM")
296
+ f(i, "yyyy-MM")
295
297
  ) }),
296
- _ && Z()
298
+ _ && te()
297
299
  ] });
298
300
  };
299
301
  export {
300
- rt as default
302
+ nt as default
301
303
  };
@@ -6,6 +6,8 @@ export type DateInputProps<T extends FieldValues = FieldValues> = {
6
6
  placeholder?: string;
7
7
  showTimeSelector?: boolean;
8
8
  translateKey?: string;
9
+ futureDates?: boolean;
10
+ pastDates?: boolean;
9
11
  };
10
- declare const DateInput: <T extends FieldValues = FieldValues>({ control, name, showTimeSelector, label, translateKey, placeholder }: DateInputProps<T>) => React.ReactElement;
12
+ declare const DateInput: <T extends FieldValues = FieldValues>({ control, name, showTimeSelector, label, translateKey, placeholder, futureDates, pastDates }: DateInputProps<T>) => React.ReactElement;
11
13
  export default DateInput;
@@ -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
  };
@@ -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;