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.
- package/dist/_virtual/index2.js +2 -3
- package/dist/_virtual/index3.js +3 -3
- package/dist/_virtual/index4.js +3 -5
- package/dist/_virtual/index5.js +5 -2
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/molecules/CalendarSelector/CalendarSelector.d.ts +2 -0
- package/dist/components/molecules/CalendarSelector/CalendarSelector.js +120 -118
- package/dist/components/molecules/DateInput/DateInput.d.ts +3 -1
- package/dist/components/molecules/DateInput/DateInput.js +47 -46
- package/dist/components/molecules/UncontrolledDateInput/UncontrolledDateInput.d.ts +3 -1
- package/dist/components/molecules/UncontrolledDateInput/UncontrolledDateInput.js +37 -34
- package/dist/lawgic-dev-kit.umd.js +60 -60
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/toposort/index.js +1 -1
- package/dist/node_modules/yup/index.esm.js +3 -3
- package/dist/src/components/molecules/CalendarSelector/CalendarSelector.d.ts +11 -0
- package/dist/src/components/molecules/DateInput/DateInput.d.ts +13 -0
- package/dist/src/components/molecules/UncontrolledDateInput/UncontrolledDateInput.d.ts +12 -0
- package/package.json +1 -1
package/dist/_virtual/index2.js
CHANGED
package/dist/_virtual/index3.js
CHANGED
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
|
|
4
|
+
a as t
|
|
7
5
|
};
|
package/dist/_virtual/index5.js
CHANGED
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.js
CHANGED
|
@@ -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
|
|
3
|
-
import { faChevronLeft as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { FontAwesomeIcon as
|
|
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
|
|
7
|
+
import { useTheme as le } from "../../../hooks/useTheme.js";
|
|
8
8
|
import Y from "../FloatingMenu/FloatingMenu.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { faChevronDown as
|
|
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
|
|
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
|
|
21
|
-
import { startOfMonth as
|
|
22
|
-
import { endOfWeek as
|
|
23
|
-
import { endOfMonth as
|
|
24
|
-
import { eachDayOfInterval as
|
|
25
|
-
import { isSameDay as
|
|
26
|
-
import { isSameMonth as
|
|
27
|
-
import { isToday as
|
|
28
|
-
import { subMonths as
|
|
29
|
-
import { addMonths as
|
|
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
|
|
34
|
-
import { es as
|
|
35
|
-
const
|
|
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:
|
|
39
|
+
maxDate: M,
|
|
40
|
+
futureDates: W = !1,
|
|
41
|
+
pastDates: q = !0
|
|
40
42
|
}) => {
|
|
41
|
-
const [
|
|
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,
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const G = () => {
|
|
50
|
+
P(-1), setTimeout(() => {
|
|
51
|
+
y(we(i));
|
|
50
52
|
}, 10);
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
}, J = () => {
|
|
54
|
+
P(1), setTimeout(() => {
|
|
55
|
+
y(be(i, 1));
|
|
54
56
|
}, 10);
|
|
55
|
-
},
|
|
56
|
-
if (
|
|
57
|
+
}, K = (t) => {
|
|
58
|
+
if (M && t > M)
|
|
57
59
|
return;
|
|
58
|
-
const
|
|
60
|
+
const a = U(
|
|
59
61
|
R(L(t, 0), 0),
|
|
60
|
-
b === "AM" ?
|
|
62
|
+
b === "AM" ? v % 12 : v % 12 + 12
|
|
61
63
|
);
|
|
62
|
-
w(
|
|
63
|
-
},
|
|
64
|
+
w(a), S(a);
|
|
65
|
+
}, Q = (t) => {
|
|
64
66
|
k(t);
|
|
65
|
-
const
|
|
67
|
+
const a = U(
|
|
66
68
|
R(L(E, 0), 0),
|
|
67
69
|
b === "AM" ? t % 12 : t % 12 + 12
|
|
68
70
|
);
|
|
69
|
-
w(
|
|
70
|
-
},
|
|
71
|
+
w(a), S(a), j(!1);
|
|
72
|
+
}, V = (t) => {
|
|
71
73
|
A(t);
|
|
72
|
-
},
|
|
73
|
-
const t = /* @__PURE__ */ new Date(),
|
|
74
|
-
const o = new Date(t.getFullYear(), t.getMonth() -
|
|
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:
|
|
78
|
+
name: f(o, "MMMM", { locale: g }).replace(/^./, (s) => s.toUpperCase()),
|
|
77
79
|
index: o.getMonth(),
|
|
78
80
|
year: o.getFullYear(),
|
|
79
|
-
displayName: `${
|
|
81
|
+
displayName: `${f(o, "MMMM", { locale: g }).replace(
|
|
80
82
|
/^./,
|
|
81
|
-
(
|
|
83
|
+
(s) => s.toUpperCase()
|
|
82
84
|
)} ${o.getFullYear()}`
|
|
83
85
|
};
|
|
84
|
-
})),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
r[0].isIntersecting &&
|
|
88
|
-
const o =
|
|
89
|
-
const
|
|
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:
|
|
92
|
-
index:
|
|
93
|
-
year:
|
|
94
|
-
displayName: `${
|
|
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
|
-
)} ${
|
|
99
|
+
)} ${h.getFullYear()}`
|
|
98
100
|
};
|
|
99
101
|
});
|
|
100
|
-
return [...
|
|
102
|
+
return [...n, ...re];
|
|
101
103
|
});
|
|
102
|
-
}),
|
|
103
|
-
}, [
|
|
104
|
-
const
|
|
105
|
-
const o = new Date(
|
|
106
|
-
o.setMonth(r), o.setFullYear(
|
|
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:
|
|
109
|
-
const o =
|
|
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 ?
|
|
114
|
-
onClick: () =>
|
|
115
|
-
className: `text-start p-6 font-600 transition-all duration-100 rounded-lg hover:bg-gray-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}-${
|
|
120
|
+
`${r.name}-${r.year}-${n}`
|
|
119
121
|
);
|
|
120
122
|
}) });
|
|
121
|
-
},
|
|
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: () =>
|
|
127
|
-
component:
|
|
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: () =>
|
|
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:
|
|
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(
|
|
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:
|
|
154
|
-
onClick:
|
|
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:
|
|
163
|
-
onClick:
|
|
164
|
+
icon: se,
|
|
165
|
+
onClick: J
|
|
164
166
|
}
|
|
165
167
|
)
|
|
166
168
|
] })
|
|
167
|
-
] }),
|
|
168
|
-
const t =
|
|
169
|
-
return /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-7 gap-2", children: m.map((
|
|
170
|
-
const
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
onClick: () =>
|
|
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:
|
|
183
|
-
color:
|
|
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:
|
|
195
|
+
whileHover: !s && !p ? {
|
|
194
196
|
backgroundColor: "#E5E7EB"
|
|
195
197
|
} : {},
|
|
196
|
-
whileTap:
|
|
197
|
-
backgroundColor:
|
|
198
|
-
}
|
|
199
|
-
children:
|
|
198
|
+
whileTap: s ? {} : {
|
|
199
|
+
backgroundColor: p ? "#7AA5E0" : "#D1D5DB"
|
|
200
|
+
},
|
|
201
|
+
children: f(l, "d")
|
|
200
202
|
},
|
|
201
|
-
|
|
203
|
+
x
|
|
202
204
|
);
|
|
203
205
|
}) });
|
|
204
|
-
},
|
|
205
|
-
const t = Array.from({ length: 12 }, (m,
|
|
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: () =>
|
|
209
|
-
className: `w-full text-center py-2 transition-all duration-100 rounded-lg hover:bg-gray-100 ${m ===
|
|
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:
|
|
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:
|
|
225
|
+
open: O,
|
|
224
226
|
onClose: () => j(!1),
|
|
225
|
-
component:
|
|
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
|
-
|
|
232
|
+
me,
|
|
231
233
|
{
|
|
232
234
|
setHourMenuOpen: j,
|
|
233
|
-
hourMenuOpen:
|
|
234
|
-
selectedHour:
|
|
235
|
+
hourMenuOpen: O,
|
|
236
|
+
selectedHour: v
|
|
235
237
|
}
|
|
236
238
|
)
|
|
237
239
|
}
|
|
238
240
|
),
|
|
239
241
|
/* @__PURE__ */ e.jsx(
|
|
240
|
-
|
|
242
|
+
ce,
|
|
241
243
|
{
|
|
242
244
|
selectedPeriod: b,
|
|
243
|
-
handlePeriodChange:
|
|
245
|
+
handlePeriodChange: V
|
|
244
246
|
}
|
|
245
247
|
)
|
|
246
248
|
] })
|
|
247
249
|
] });
|
|
248
|
-
},
|
|
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
|
-
|
|
284
|
-
/* @__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:
|
|
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:
|
|
294
|
+
children: ee()
|
|
293
295
|
},
|
|
294
|
-
|
|
296
|
+
f(i, "yyyy-MM")
|
|
295
297
|
) }),
|
|
296
|
-
_ &&
|
|
298
|
+
_ && te()
|
|
297
299
|
] });
|
|
298
300
|
};
|
|
299
301
|
export {
|
|
300
|
-
|
|
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
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useController as
|
|
4
|
-
import { faX as
|
|
5
|
-
import { FontAwesomeIcon as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useTheme as
|
|
10
|
-
import { formatDate as
|
|
11
|
-
const
|
|
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
|
-
},
|
|
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:
|
|
21
|
-
fieldState: { error:
|
|
22
|
-
} =
|
|
23
|
-
|
|
24
|
-
i instanceof Date && !isNaN(i.getTime()) ? 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
|
|
27
|
-
const s = e.replace(/\D/g, "").slice(0, 8),
|
|
28
|
-
s.length > 0 &&
|
|
29
|
-
const d =
|
|
30
|
-
if (r(d),
|
|
31
|
-
const
|
|
32
|
-
p(
|
|
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
|
-
},
|
|
34
|
+
}, M = () => {
|
|
35
35
|
p(null), r("");
|
|
36
36
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
37
|
+
return /* @__PURE__ */ c.jsx(
|
|
38
|
+
B,
|
|
39
39
|
{
|
|
40
|
-
open:
|
|
40
|
+
open: y,
|
|
41
41
|
strategy: "fixed",
|
|
42
42
|
padding: 0,
|
|
43
43
|
offset: 0,
|
|
44
|
-
onClose: () =>
|
|
44
|
+
onClose: () => f(!1),
|
|
45
45
|
className: "p-0!",
|
|
46
|
-
component: /* @__PURE__ */
|
|
47
|
-
|
|
46
|
+
component: /* @__PURE__ */ c.jsx(
|
|
47
|
+
K,
|
|
48
48
|
{
|
|
49
|
-
date:
|
|
49
|
+
date: C || /* @__PURE__ */ new Date(),
|
|
50
50
|
onDateChange: (e) => {
|
|
51
|
-
r(
|
|
51
|
+
r(N(e)), p(e), f(!1);
|
|
52
52
|
},
|
|
53
53
|
showTimeSelector: n,
|
|
54
|
-
|
|
54
|
+
futureDates: I,
|
|
55
|
+
pastDates: b
|
|
55
56
|
}
|
|
56
57
|
),
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
-
|
|
58
|
+
children: /* @__PURE__ */ c.jsx(
|
|
59
|
+
O,
|
|
59
60
|
{
|
|
60
|
-
onBlur:
|
|
61
|
-
name:
|
|
61
|
+
onBlur: S,
|
|
62
|
+
name: v || T,
|
|
62
63
|
label: o,
|
|
63
64
|
value: h,
|
|
64
65
|
onFocus: (e) => {
|
|
65
|
-
e.preventDefault(),
|
|
66
|
+
e.preventDefault(), f(!0);
|
|
66
67
|
},
|
|
67
68
|
disabledInput: !0,
|
|
68
|
-
onChange: (e) =>
|
|
69
|
+
onChange: (e) => F(e),
|
|
69
70
|
placeholder: j,
|
|
70
|
-
error:
|
|
71
|
-
rightSide: !!
|
|
72
|
-
|
|
71
|
+
error: m == null ? void 0 : m.message,
|
|
72
|
+
rightSide: !!C && /* @__PURE__ */ c.jsx(
|
|
73
|
+
A,
|
|
73
74
|
{
|
|
74
|
-
icon:
|
|
75
|
+
icon: k,
|
|
75
76
|
className: "text-gray-500 cursor-pointer",
|
|
76
|
-
onClick:
|
|
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
|
-
|
|
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;
|