@rpcbase/ui 0.282.0 → 0.283.0
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/index13.js +0 -1
- package/dist/index13.js.map +1 -1
- package/dist/index14.js.map +1 -1
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +45 -37
- package/dist/index16.js.map +1 -1
- package/dist/index182.js +162 -145
- package/dist/index182.js.map +1 -1
- package/dist/index294.js +27 -16
- package/dist/index294.js.map +1 -1
- package/dist/index296.js +83 -56
- package/dist/index296.js.map +1 -1
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +18 -12
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +352 -255
- package/dist/index300.js.map +1 -1
- package/dist/index301.js.map +1 -1
- package/dist/index356.js.map +1 -1
- package/dist/index358.js.map +1 -1
- package/dist/index361.js.map +1 -1
- package/dist/index362.js.map +1 -1
- package/dist/index4.js.map +1 -1
- package/dist/index416.js +62 -40
- package/dist/index416.js.map +1 -1
- package/dist/index417.js.map +1 -1
- package/dist/index419.js.map +1 -1
- package/dist/index420.js.map +1 -1
- package/dist/index421.js.map +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +133 -91
- package/dist/index7.js.map +1 -1
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +19 -16
- package/dist/index9.js.map +1 -1
- package/package.json +3 -5
package/dist/index182.js
CHANGED
|
@@ -2,82 +2,95 @@ import { useIsTouchDevice as e } from "./index4.js";
|
|
|
2
2
|
import { cn as t } from "./index12.js";
|
|
3
3
|
import { dateMatchModifiers as n } from "./index122.js";
|
|
4
4
|
import { DayPicker as r } from "./index181.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
5
|
+
import { c as i } from "react/compiler-runtime";
|
|
6
|
+
import * as a from "react";
|
|
7
|
+
import { CalendarDays as o, ChevronLeft as s, ChevronRight as c } from "lucide-react";
|
|
8
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import { createPortal as f } from "react-dom";
|
|
10
|
+
import { IMaskInput as p } from "react-imask";
|
|
11
|
+
import m, { InputMask as h } from "imask";
|
|
11
12
|
//#region src/components/DayPickerField/index.tsx
|
|
12
|
-
var
|
|
13
|
-
typeof
|
|
14
|
-
function
|
|
15
|
-
|
|
13
|
+
var g = m;
|
|
14
|
+
typeof g.InputMask != "function" && (g.InputMask = h);
|
|
15
|
+
function _(e) {
|
|
16
|
+
let n = i(18), a, o, s, c, l;
|
|
17
|
+
n[0] === e ? (a = n[1], o = n[2], s = n[3], c = n[4], l = n[5]) : ({className: a, classNames: o, components: s, showOutsideDays: l, ...c} = e, n[0] = e, n[1] = a, n[2] = o, n[3] = s, n[4] = c, n[5] = l);
|
|
18
|
+
let d = l === void 0 || l, f;
|
|
19
|
+
n[6] === a ? f = n[7] : (f = t("p-3", a), n[6] = a, n[7] = f);
|
|
20
|
+
let p;
|
|
21
|
+
n[8] === o ? p = n[9] : (p = {
|
|
22
|
+
month: "space-y-4",
|
|
23
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-y-0 relative gap-2",
|
|
24
|
+
month_caption: "flex justify-center pt-1 relative items-center",
|
|
25
|
+
month_grid: "w-full border-collapse space-y-1",
|
|
26
|
+
caption_label: "text-sm font-medium",
|
|
27
|
+
nav: "flex items-center justify-between absolute inset-x-0 z-10",
|
|
28
|
+
button_previous: "inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 shadow-sm transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 z-10",
|
|
29
|
+
button_next: "inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 shadow-sm transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 z-10",
|
|
30
|
+
weeks: "w-full border-collapse",
|
|
31
|
+
weekdays: "flex",
|
|
32
|
+
weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
33
|
+
week: "flex w-full mt-2",
|
|
34
|
+
day: "h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md first:aria-selected:rounded-l-md last:aria-selected:rounded-r-md",
|
|
35
|
+
day_button: "inline-flex h-9 w-9 items-center justify-center rounded-md p-0 text-center text-sm font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
36
|
+
range_start: "day-range-start !bg-accent rounded-l-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
37
|
+
range_end: "day-range-end !bg-accent rounded-r-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
38
|
+
range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground !rounded-none",
|
|
39
|
+
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
40
|
+
today: "bg-gray-50 text-accent-foreground !rounded-md",
|
|
41
|
+
outside: "day-outside text-muted-foreground opacity-50 !aria-selected:bg-accent/50 !aria-selected:text-muted-foreground !aria-selected:opacity-30",
|
|
42
|
+
disabled: "text-muted-foreground opacity-50",
|
|
43
|
+
hidden: "invisible",
|
|
44
|
+
...o
|
|
45
|
+
}, n[8] = o, n[9] = p);
|
|
46
|
+
let m;
|
|
47
|
+
n[10] === s ? m = n[11] : (m = {
|
|
48
|
+
Chevron: v,
|
|
49
|
+
...s
|
|
50
|
+
}, n[10] = s, n[11] = m);
|
|
51
|
+
let h;
|
|
52
|
+
return n[12] !== c || n[13] !== d || n[14] !== f || n[15] !== p || n[16] !== m ? (h = /* @__PURE__ */ u(r, {
|
|
16
53
|
weekStartsOn: 1,
|
|
17
|
-
showOutsideDays:
|
|
18
|
-
className:
|
|
19
|
-
classNames:
|
|
20
|
-
|
|
21
|
-
months: "flex flex-col sm:flex-row space-y-4 sm:space-y-0 relative gap-2",
|
|
22
|
-
month_caption: "flex justify-center pt-1 relative items-center",
|
|
23
|
-
month_grid: "w-full border-collapse space-y-1",
|
|
24
|
-
caption_label: "text-sm font-medium",
|
|
25
|
-
nav: "flex items-center justify-between absolute inset-x-0 z-10",
|
|
26
|
-
button_previous: "inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 shadow-sm transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 z-10",
|
|
27
|
-
button_next: "inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-transparent p-0 opacity-50 shadow-sm transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 z-10",
|
|
28
|
-
weeks: "w-full border-collapse",
|
|
29
|
-
weekdays: "flex",
|
|
30
|
-
weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
31
|
-
week: "flex w-full mt-2",
|
|
32
|
-
day: "h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md first:aria-selected:rounded-l-md last:aria-selected:rounded-r-md",
|
|
33
|
-
day_button: "inline-flex h-9 w-9 items-center justify-center rounded-md p-0 text-center text-sm font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
34
|
-
range_start: "day-range-start !bg-accent rounded-l-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
35
|
-
range_end: "day-range-end !bg-accent rounded-r-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
36
|
-
range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground !rounded-none",
|
|
37
|
-
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
38
|
-
today: "bg-gray-50 text-accent-foreground !rounded-md",
|
|
39
|
-
outside: "day-outside text-muted-foreground opacity-50 !aria-selected:bg-accent/50 !aria-selected:text-muted-foreground !aria-selected:opacity-30",
|
|
40
|
-
disabled: "text-muted-foreground opacity-50",
|
|
41
|
-
hidden: "invisible",
|
|
42
|
-
...n
|
|
43
|
-
},
|
|
44
|
-
components: {
|
|
45
|
-
Chevron: (e) => e.orientation === "left" ? /* @__PURE__ */ l(o, {
|
|
46
|
-
...e,
|
|
47
|
-
className: "h-4 w-4"
|
|
48
|
-
}) : /* @__PURE__ */ l(s, {
|
|
49
|
-
...e,
|
|
50
|
-
className: "h-4 w-4"
|
|
51
|
-
}),
|
|
52
|
-
...i
|
|
53
|
-
},
|
|
54
|
+
showOutsideDays: d,
|
|
55
|
+
className: f,
|
|
56
|
+
classNames: p,
|
|
57
|
+
components: m,
|
|
54
58
|
...c
|
|
59
|
+
}), n[12] = c, n[13] = d, n[14] = f, n[15] = p, n[16] = m, n[17] = h) : h = n[17], h;
|
|
60
|
+
}
|
|
61
|
+
function v(e) {
|
|
62
|
+
return e.orientation === "left" ? /* @__PURE__ */ u(s, {
|
|
63
|
+
...e,
|
|
64
|
+
className: "h-4 w-4"
|
|
65
|
+
}) : /* @__PURE__ */ u(c, {
|
|
66
|
+
...e,
|
|
67
|
+
className: "h-4 w-4"
|
|
55
68
|
});
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
function
|
|
70
|
+
_.displayName = "DayPicker";
|
|
71
|
+
function y(e) {
|
|
59
72
|
return String(e).padStart(2, "0");
|
|
60
73
|
}
|
|
61
|
-
function
|
|
74
|
+
function b(e) {
|
|
62
75
|
let t = new Date(e);
|
|
63
76
|
return t.setHours(0, 0, 0, 0), t;
|
|
64
77
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
78
|
+
function x(e) {
|
|
79
|
+
return b(new Date(e.getFullYear(), e.getMonth(), 1));
|
|
67
80
|
}
|
|
68
|
-
function
|
|
69
|
-
return `${
|
|
81
|
+
function S(e) {
|
|
82
|
+
return `${y(e.getDate())}/${y(e.getMonth() + 1)}/${e.getFullYear()}`;
|
|
70
83
|
}
|
|
71
|
-
function
|
|
84
|
+
function C({ day: e, month: t, year: n }) {
|
|
72
85
|
if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n)) return null;
|
|
73
86
|
let r = new Date(n, t - 1, e);
|
|
74
|
-
return r.getFullYear() !== n || r.getMonth() !== t - 1 || r.getDate() !== e ? null :
|
|
87
|
+
return r.getFullYear() !== n || r.getMonth() !== t - 1 || r.getDate() !== e ? null : b(r);
|
|
75
88
|
}
|
|
76
|
-
function
|
|
89
|
+
function w(e, t) {
|
|
77
90
|
let n = e.trim();
|
|
78
91
|
if (!n) return null;
|
|
79
92
|
let r = /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(n);
|
|
80
|
-
if (r) return
|
|
93
|
+
if (r) return C({
|
|
81
94
|
day: Number(r[1]),
|
|
82
95
|
month: Number(r[2]),
|
|
83
96
|
year: Number(r[3])
|
|
@@ -85,37 +98,37 @@ function S(e, t) {
|
|
|
85
98
|
let i = /^(\d{2})\/(\d{2})\/(\d{2})$/.exec(n);
|
|
86
99
|
if (i) {
|
|
87
100
|
let e = Number(i[3]);
|
|
88
|
-
return Number.isFinite(e) ?
|
|
101
|
+
return Number.isFinite(e) ? C({
|
|
89
102
|
day: Number(i[1]),
|
|
90
103
|
month: Number(i[2]),
|
|
91
104
|
year: 2e3 + e
|
|
92
105
|
}) : null;
|
|
93
106
|
}
|
|
94
107
|
let a = /^(\d{2})\/(\d{2})$/.exec(n);
|
|
95
|
-
return a ?
|
|
108
|
+
return a ? C({
|
|
96
109
|
day: Number(a[1]),
|
|
97
110
|
month: Number(a[2]),
|
|
98
111
|
year: t.getFullYear()
|
|
99
112
|
}) : null;
|
|
100
113
|
}
|
|
101
|
-
var
|
|
102
|
-
let P =
|
|
114
|
+
var T = a.forwardRef(function({ value: e, onChange: r, onValueUpdate: i, className: s, inputClassName: c, placeholder: m = "DD/MM/YYYY", disabled: h, readOnly: g, open: v, onOpenChange: C, dayPickerComponent: T, dayPickerProps: E, onFocus: D, onBlur: O, onKeyDown: k, onPointerDown: A, onMouseDown: j, ...M }, N) {
|
|
115
|
+
let P = a.useRef(null), F = a.useRef(null), I = a.useRef(null), L = a.useRef(!1), R = a.useRef(!1), z = a.useRef(!1), B = a.useRef(!1), V = a.useRef(!1), H = a.useRef(null), [ee, te] = a.useState(!1), U = v ?? ee, W = C ?? te;
|
|
103
116
|
R.current = U;
|
|
104
|
-
let [G, K] =
|
|
117
|
+
let [G, K] = a.useState(() => e ? S(e) : ""), q = a.useMemo(() => w(G, /* @__PURE__ */ new Date()), [G]), [ne, J] = a.useState(() => x(e ?? /* @__PURE__ */ new Date())), [Y, re] = a.useState(() => ({
|
|
105
118
|
left: 0,
|
|
106
119
|
top: 0
|
|
107
|
-
})), X =
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
|
|
111
|
-
}, [r,
|
|
112
|
-
|
|
113
|
-
L.current || K(e ?
|
|
114
|
-
}, [e]),
|
|
115
|
-
U && J(
|
|
116
|
-
}, [U, e]),
|
|
117
|
-
U && q && J(
|
|
118
|
-
}, [q, U]),
|
|
120
|
+
})), X = a.useCallback((e) => {
|
|
121
|
+
i && i(e);
|
|
122
|
+
}, [i]), Z = a.useCallback((e) => {
|
|
123
|
+
i && i(e), r(e);
|
|
124
|
+
}, [r, i]);
|
|
125
|
+
a.useEffect(() => {
|
|
126
|
+
L.current || K(e ? S(e) : "");
|
|
127
|
+
}, [e]), a.useEffect(() => {
|
|
128
|
+
U && J(x(e ?? /* @__PURE__ */ new Date()));
|
|
129
|
+
}, [U, e]), a.useEffect(() => {
|
|
130
|
+
U && q && J(x(q));
|
|
131
|
+
}, [q, U]), a.useEffect(() => {
|
|
119
132
|
if (!U) return;
|
|
120
133
|
let e = P.current?.ownerDocument ?? document, t = e.defaultView ?? window, n = (e) => {
|
|
121
134
|
let t = e.target;
|
|
@@ -128,7 +141,7 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
128
141
|
return e.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", r, !0), () => {
|
|
129
142
|
e.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", r, !0);
|
|
130
143
|
};
|
|
131
|
-
}, [U]),
|
|
144
|
+
}, [U]), a.useEffect(() => {
|
|
132
145
|
if (!U || typeof window > "u" || !("IntersectionObserver" in window)) return;
|
|
133
146
|
let e = P.current;
|
|
134
147
|
if (!e) return;
|
|
@@ -141,9 +154,9 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
141
154
|
t = !1, n.disconnect();
|
|
142
155
|
};
|
|
143
156
|
}, [U]);
|
|
144
|
-
let ie =
|
|
157
|
+
let ie = a.useCallback((e) => {
|
|
145
158
|
I.current = e, typeof N == "function" ? N(e) : N && (N.current = e);
|
|
146
|
-
}, [N]), Q = () => W(!1), ae = T ??
|
|
159
|
+
}, [N]), Q = () => W(!1), ae = T ?? _, $ = a.useCallback(() => {
|
|
147
160
|
if (typeof window > "u") return;
|
|
148
161
|
let e = P.current, t = F.current;
|
|
149
162
|
if (!e || !t) return;
|
|
@@ -155,7 +168,7 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
155
168
|
top: c
|
|
156
169
|
});
|
|
157
170
|
}, []);
|
|
158
|
-
return
|
|
171
|
+
return a.useLayoutEffect(() => {
|
|
159
172
|
if (!U || h || typeof window > "u") return;
|
|
160
173
|
$();
|
|
161
174
|
let e = window.requestAnimationFrame($);
|
|
@@ -166,16 +179,16 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
166
179
|
h,
|
|
167
180
|
U,
|
|
168
181
|
$
|
|
169
|
-
]), /* @__PURE__ */
|
|
182
|
+
]), /* @__PURE__ */ d("div", {
|
|
170
183
|
ref: P,
|
|
171
184
|
"data-slot": "day-picker-input",
|
|
172
185
|
className: t("relative group", s),
|
|
173
186
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ u(p, {
|
|
175
188
|
...M,
|
|
176
189
|
"data-slot": "day-picker-input-input",
|
|
177
190
|
disabled: h,
|
|
178
|
-
readOnly:
|
|
191
|
+
readOnly: g,
|
|
179
192
|
autoComplete: "off",
|
|
180
193
|
inputRef: ie,
|
|
181
194
|
mask: [
|
|
@@ -198,10 +211,10 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
198
211
|
},
|
|
199
212
|
placeholder: m,
|
|
200
213
|
value: G,
|
|
201
|
-
className: t("flex h-10 w-full rounded-md border border-input bg-background py-2 pr-3 pl-[37px] text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-colors group-hover:bg-accent group-hover:text-accent-foreground",
|
|
214
|
+
className: t("flex h-10 w-full rounded-md border border-input bg-background py-2 pr-3 pl-[37px] text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-colors group-hover:bg-accent group-hover:text-accent-foreground", c),
|
|
202
215
|
onAccept: (e) => {
|
|
203
216
|
let t = typeof e == "string" ? e : String(e ?? ""), n = G.replace(/\D/g, "").length;
|
|
204
|
-
K(t), t.replace(/\D/g, "").length === 0 && (U && J(
|
|
217
|
+
K(t), t.replace(/\D/g, "").length === 0 && (U && J(x(/* @__PURE__ */ new Date())), n !== 0 && X(null));
|
|
205
218
|
},
|
|
206
219
|
onComplete: (t) => {
|
|
207
220
|
let n = typeof t == "string" ? t : String(t ?? "");
|
|
@@ -209,8 +222,8 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
209
222
|
H.current = null;
|
|
210
223
|
return;
|
|
211
224
|
}
|
|
212
|
-
let r =
|
|
213
|
-
r && (e && r.getTime() ===
|
|
225
|
+
let r = w(n, /* @__PURE__ */ new Date());
|
|
226
|
+
r && (e && r.getTime() === b(e).getTime() || X(r));
|
|
214
227
|
},
|
|
215
228
|
onPointerDown: (e) => {
|
|
216
229
|
z.current = !0, B.current = typeof document < "u" && document.activeElement === e.currentTarget, A?.(e);
|
|
@@ -232,22 +245,22 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
232
245
|
if (t.key === "Enter") {
|
|
233
246
|
if (!q) return;
|
|
234
247
|
if (t.preventDefault(), U) {
|
|
235
|
-
let e = `${q.getFullYear()}-${
|
|
248
|
+
let e = `${q.getFullYear()}-${y(q.getMonth() + 1)}-${y(q.getDate())}`, t = F.current?.querySelector(`[data-day='${e}']:not([data-outside]) button`);
|
|
236
249
|
if (t instanceof HTMLButtonElement) {
|
|
237
250
|
if (t.disabled) return;
|
|
238
251
|
t.focus();
|
|
239
252
|
}
|
|
240
253
|
}
|
|
241
|
-
K(
|
|
254
|
+
K(S(q)), Z(q), W(!1);
|
|
242
255
|
return;
|
|
243
256
|
}
|
|
244
257
|
if (t.key === "ArrowUp" || t.key === "ArrowDown") {
|
|
245
258
|
let r = q ?? e;
|
|
246
259
|
if (!r) return;
|
|
247
|
-
let i =
|
|
260
|
+
let i = b(new Date(r));
|
|
248
261
|
if (i.setDate(i.getDate() + (t.key === "ArrowUp" ? 1 : -1)), E?.disabled && n(i, E.disabled)) return;
|
|
249
262
|
t.preventDefault();
|
|
250
|
-
let a =
|
|
263
|
+
let a = S(i);
|
|
251
264
|
H.current = a, K(a), X(i);
|
|
252
265
|
}
|
|
253
266
|
U || (t.key.length === 1 || t.key === "Backspace" || t.key === "Delete" || t.key === "ArrowUp" || t.key === "ArrowDown") && !t.ctrlKey && !t.metaKey && !t.altKey && W(!0), t.key === "Tab" && !t.defaultPrevented && W(!1);
|
|
@@ -273,15 +286,15 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
273
286
|
e && (K(""), Z(null));
|
|
274
287
|
return;
|
|
275
288
|
}
|
|
276
|
-
let a =
|
|
289
|
+
let a = w(i, /* @__PURE__ */ new Date());
|
|
277
290
|
if (a) {
|
|
278
|
-
K(
|
|
291
|
+
K(S(a)), (!e || a.getTime() !== b(e).getTime()) && Z(a);
|
|
279
292
|
return;
|
|
280
293
|
}
|
|
281
|
-
K(e ?
|
|
294
|
+
K(e ? S(e) : "");
|
|
282
295
|
}
|
|
283
296
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ u("button", {
|
|
285
298
|
type: "button",
|
|
286
299
|
tabIndex: -1,
|
|
287
300
|
disabled: h,
|
|
@@ -297,13 +310,13 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
297
310
|
onClick: () => {
|
|
298
311
|
h || (I.current?.focus({ preventScroll: !0 }), W(!0));
|
|
299
312
|
},
|
|
300
|
-
children: /* @__PURE__ */
|
|
313
|
+
children: /* @__PURE__ */ u(o, {
|
|
301
314
|
"aria-hidden": !0,
|
|
302
315
|
className: "size-4"
|
|
303
316
|
})
|
|
304
317
|
}),
|
|
305
318
|
U && !h && (() => {
|
|
306
|
-
let t = G.trim() === "" ? void 0 : q ?? e ?? void 0, n = /* @__PURE__ */ l
|
|
319
|
+
let t = G.trim() === "" ? void 0 : q ?? e ?? void 0, n = /* @__PURE__ */ u(l, { children: /* @__PURE__ */ u("div", {
|
|
307
320
|
ref: F,
|
|
308
321
|
"data-slot": "day-picker-input-popover",
|
|
309
322
|
className: "pointer-events-auto fixed z-[60] w-max rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
@@ -317,7 +330,7 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
317
330
|
onMouseDownCapture: () => {
|
|
318
331
|
V.current = !0;
|
|
319
332
|
},
|
|
320
|
-
children: /* @__PURE__ */
|
|
333
|
+
children: /* @__PURE__ */ u(ae, {
|
|
321
334
|
mode: "single",
|
|
322
335
|
month: ne,
|
|
323
336
|
onMonthChange: J,
|
|
@@ -327,28 +340,28 @@ var C = i.forwardRef(function({ value: e, onChange: r, onValueUpdate: o, classNa
|
|
|
327
340
|
e && Z(null), K(""), Q();
|
|
328
341
|
return;
|
|
329
342
|
}
|
|
330
|
-
let n =
|
|
331
|
-
(!e || n.getTime() !==
|
|
343
|
+
let n = b(t);
|
|
344
|
+
(!e || n.getTime() !== b(e).getTime()) && Z(n), K(S(n)), Q();
|
|
332
345
|
},
|
|
333
346
|
...E
|
|
334
347
|
})
|
|
335
348
|
}) });
|
|
336
|
-
return typeof document > "u" ? n :
|
|
349
|
+
return typeof document > "u" ? n : f(n, document.body);
|
|
337
350
|
})()
|
|
338
351
|
]
|
|
339
352
|
});
|
|
340
353
|
});
|
|
341
|
-
|
|
342
|
-
function
|
|
343
|
-
let T =
|
|
354
|
+
T.displayName = "DayPickerInput";
|
|
355
|
+
function E({ id: e, value: n, onChange: r, onValueUpdate: i, className: s, inputClassName: c, placeholder: p = "DD/MM/YYYY", disabled: m, open: h, onOpenChange: g, dayPickerComponent: v, dayPickerProps: y, triggerTestId: C, isHydrated: w }) {
|
|
356
|
+
let T = a.useRef(null), E = a.useRef(null), D = a.useRef(!1), [O, k] = a.useState(!1), A = h ?? O, j = g ?? k;
|
|
344
357
|
D.current = A;
|
|
345
|
-
let [M, N] =
|
|
358
|
+
let [M, N] = a.useState(() => x(n ?? /* @__PURE__ */ new Date())), [P, F] = a.useState(() => ({
|
|
346
359
|
left: 0,
|
|
347
360
|
top: 0
|
|
348
361
|
}));
|
|
349
|
-
|
|
350
|
-
A && N(
|
|
351
|
-
}, [A, n]),
|
|
362
|
+
a.useEffect(() => {
|
|
363
|
+
A && N(x(n ?? /* @__PURE__ */ new Date()));
|
|
364
|
+
}, [A, n]), a.useEffect(() => {
|
|
352
365
|
if (!A) return;
|
|
353
366
|
let e = T.current?.ownerDocument ?? document, t = e.defaultView ?? window, n = (e) => {
|
|
354
367
|
let t = e.target;
|
|
@@ -361,7 +374,7 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
361
374
|
return e.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", r, !0), () => {
|
|
362
375
|
e.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", r, !0);
|
|
363
376
|
};
|
|
364
|
-
}, [A]),
|
|
377
|
+
}, [A]), a.useEffect(() => {
|
|
365
378
|
if (!A || typeof window > "u" || !("IntersectionObserver" in window)) return;
|
|
366
379
|
let e = T.current;
|
|
367
380
|
if (!e) return;
|
|
@@ -374,7 +387,7 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
374
387
|
t = !1, n.disconnect();
|
|
375
388
|
};
|
|
376
389
|
}, [A]);
|
|
377
|
-
let I =
|
|
390
|
+
let I = v ?? _, L = a.useCallback(() => {
|
|
378
391
|
if (typeof window > "u") return;
|
|
379
392
|
let e = T.current, t = E.current;
|
|
380
393
|
if (!e || !t) return;
|
|
@@ -386,7 +399,7 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
386
399
|
top: c
|
|
387
400
|
});
|
|
388
401
|
}, []);
|
|
389
|
-
|
|
402
|
+
a.useLayoutEffect(() => {
|
|
390
403
|
if (!A || m || typeof window > "u") return;
|
|
391
404
|
L();
|
|
392
405
|
let e = window.requestAnimationFrame(L);
|
|
@@ -398,30 +411,30 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
398
411
|
A,
|
|
399
412
|
L
|
|
400
413
|
]);
|
|
401
|
-
let R =
|
|
402
|
-
|
|
403
|
-
}, [r,
|
|
404
|
-
return /* @__PURE__ */
|
|
414
|
+
let R = a.useCallback((e) => {
|
|
415
|
+
i && i(e), r(e);
|
|
416
|
+
}, [r, i]);
|
|
417
|
+
return /* @__PURE__ */ d("div", {
|
|
405
418
|
ref: T,
|
|
406
419
|
"data-slot": "day-picker-input",
|
|
407
420
|
className: t("relative group", s),
|
|
408
|
-
children: [/* @__PURE__ */
|
|
421
|
+
children: [/* @__PURE__ */ d("button", {
|
|
409
422
|
id: e,
|
|
410
423
|
type: "button",
|
|
411
424
|
disabled: m,
|
|
412
425
|
"data-testid": C,
|
|
413
426
|
"data-hydrated": w ? "true" : void 0,
|
|
414
427
|
"data-slot": "day-picker-input-input",
|
|
415
|
-
className: t("flex h-10 w-full items-center rounded-md border border-input bg-background px-3 py-2 text-left text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-colors group-hover:bg-accent group-hover:text-accent-foreground", !n && "text-muted-foreground", A && "ring-2 ring-primary ring-offset-2",
|
|
428
|
+
className: t("flex h-10 w-full items-center rounded-md border border-input bg-background px-3 py-2 text-left text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "transition-colors group-hover:bg-accent group-hover:text-accent-foreground", !n && "text-muted-foreground", A && "ring-2 ring-primary ring-offset-2", c),
|
|
416
429
|
onClick: () => {
|
|
417
430
|
m || j(!A);
|
|
418
431
|
},
|
|
419
|
-
children: [/* @__PURE__ */
|
|
432
|
+
children: [/* @__PURE__ */ u(o, {
|
|
420
433
|
"aria-hidden": !0,
|
|
421
434
|
className: "mr-2 size-4 text-muted-foreground transition-colors group-hover:text-accent-foreground"
|
|
422
|
-
}), n ?
|
|
435
|
+
}), n ? S(n) : p]
|
|
423
436
|
}), A && !m && (() => {
|
|
424
|
-
let e = /* @__PURE__ */ l
|
|
437
|
+
let e = /* @__PURE__ */ u(l, { children: /* @__PURE__ */ u("div", {
|
|
425
438
|
ref: E,
|
|
426
439
|
"data-slot": "day-picker-input-popover",
|
|
427
440
|
className: "pointer-events-auto fixed z-[60] w-max rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
@@ -429,7 +442,7 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
429
442
|
left: P.left,
|
|
430
443
|
top: P.top
|
|
431
444
|
},
|
|
432
|
-
children: /* @__PURE__ */
|
|
445
|
+
children: /* @__PURE__ */ u(I, {
|
|
433
446
|
mode: "single",
|
|
434
447
|
month: M,
|
|
435
448
|
onMonthChange: N,
|
|
@@ -439,38 +452,42 @@ function w({ id: e, value: n, onChange: r, onValueUpdate: o, className: s, input
|
|
|
439
452
|
R(null), j(!1);
|
|
440
453
|
return;
|
|
441
454
|
}
|
|
442
|
-
let t =
|
|
443
|
-
(!n || t.getTime() !==
|
|
455
|
+
let t = b(e);
|
|
456
|
+
(!n || t.getTime() !== b(n).getTime()) && R(t), j(!1);
|
|
444
457
|
},
|
|
445
|
-
...
|
|
458
|
+
...y
|
|
446
459
|
})
|
|
447
460
|
}) });
|
|
448
|
-
return typeof document > "u" ? e :
|
|
461
|
+
return typeof document > "u" ? e : f(e, document.body);
|
|
449
462
|
})()]
|
|
450
463
|
});
|
|
451
464
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
465
|
+
function D(t) {
|
|
466
|
+
let n = i(18);
|
|
467
|
+
if (e()) {
|
|
468
|
+
let e;
|
|
469
|
+
return n[0] === t ? e = n[1] : (e = /* @__PURE__ */ u(E, { ...t }), n[0] = t, n[1] = e), e;
|
|
470
|
+
}
|
|
471
|
+
let { id: r, value: a, onChange: o, onValueUpdate: s, className: c, inputClassName: l, placeholder: d, disabled: f, readOnly: p, dayPickerComponent: m, dayPickerProps: h, triggerTestId: g, isHydrated: _, open: v, onOpenChange: y } = t, b = d === void 0 ? "DD/MM/YYYY" : d, x = _ ? "true" : void 0, S;
|
|
472
|
+
return n[2] !== c || n[3] !== m || n[4] !== h || n[5] !== f || n[6] !== r || n[7] !== l || n[8] !== o || n[9] !== y || n[10] !== s || n[11] !== v || n[12] !== b || n[13] !== p || n[14] !== x || n[15] !== g || n[16] !== a ? (S = /* @__PURE__ */ u(T, {
|
|
473
|
+
id: r,
|
|
474
|
+
value: a,
|
|
475
|
+
onChange: o,
|
|
476
|
+
onValueUpdate: s,
|
|
477
|
+
className: c,
|
|
478
|
+
inputClassName: l,
|
|
479
|
+
placeholder: b,
|
|
480
|
+
disabled: f,
|
|
481
|
+
readOnly: p,
|
|
482
|
+
open: v,
|
|
483
|
+
onOpenChange: y,
|
|
484
|
+
dayPickerComponent: m,
|
|
485
|
+
dayPickerProps: h,
|
|
486
|
+
"data-testid": g,
|
|
487
|
+
"data-hydrated": x
|
|
488
|
+
}), n[2] = c, n[3] = m, n[4] = h, n[5] = f, n[6] = r, n[7] = l, n[8] = o, n[9] = y, n[10] = s, n[11] = v, n[12] = b, n[13] = p, n[14] = x, n[15] = g, n[16] = a, n[17] = S) : S = n[17], S;
|
|
472
489
|
}
|
|
473
490
|
//#endregion
|
|
474
|
-
export {
|
|
491
|
+
export { _ as DayPicker, D as DayPickerField, T as DayPickerInput };
|
|
475
492
|
|
|
476
493
|
//# sourceMappingURL=index182.js.map
|