@aiquants/period-slider 0.2.0 → 0.4.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/README.md +465 -85
- package/dist/DateSelector.d.ts +43 -14
- package/dist/DateSelector.d.ts.map +1 -1
- package/dist/MonthSelector.d.ts +26 -9
- package/dist/MonthSelector.d.ts.map +1 -1
- package/dist/PeriodSlider.d.ts +257 -125
- package/dist/PeriodSlider.d.ts.map +1 -1
- package/dist/YearSelector.d.ts +26 -9
- package/dist/YearSelector.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1642 -1382
- package/dist/styles/period-slider.css +1 -1
- package/dist/styles/period-slider.standalone.css +1 -1
- package/dist/usePeriodSlider.d.ts +83 -78
- package/dist/usePeriodSlider.d.ts.map +1 -1
- package/package.json +17 -10
- package/src/DateSelector.tsx +495 -194
- package/src/MonthSelector.tsx +258 -137
- package/src/PeriodSlider.tsx +1109 -572
- package/src/YearSelector.tsx +174 -55
- package/src/index.ts +13 -0
- package/src/styles/period-slider.css +41 -7
- package/src/usePeriodSlider.ts +466 -277
- package/dist/period-slider.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,326 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { memo as
|
|
4
|
-
|
|
5
|
-
if (r && r.length > 0)
|
|
6
|
-
return r.filter((n) => n && !Number.isNaN(n.getTime())).map((n) => {
|
|
7
|
-
const b = new Date(n);
|
|
8
|
-
return b.setHours(0, 0, 0, 0), b;
|
|
9
|
-
}).sort((n, b) => b.getTime() - n.getTime()).map((n) => {
|
|
10
|
-
const b = Nt(n, "yyyy-MM-dd");
|
|
11
|
-
return { label: b, value: b };
|
|
12
|
-
});
|
|
13
|
-
const l = e.getFullYear(), s = t ?? new Date(l - 1, 0, 1), d = a ?? new Date(l + 1, 11, 31), h = new Date(Math.min(s.getTime(), e.getTime()));
|
|
14
|
-
h.setHours(0, 0, 0, 0);
|
|
15
|
-
const u = new Date(Math.max(d.getTime(), e.getTime()));
|
|
16
|
-
u.setHours(0, 0, 0, 0);
|
|
17
|
-
const m = [];
|
|
18
|
-
let p = u;
|
|
19
|
-
for (; p >= h; ) {
|
|
20
|
-
const A = Nt(p, "yyyy-MM-dd");
|
|
21
|
-
m.push({ label: A, value: A }), p = Wt(p, -1);
|
|
22
|
-
}
|
|
23
|
-
return m;
|
|
24
|
-
}
|
|
25
|
-
const ja = (e) => {
|
|
26
|
-
const { value: t, initialDate: a, onChange: r, children: l, minYear: s, maxYear: d, minDate: h, maxDate: u, allowedDates: m, variant: p = "dropdown", className: A = "", style: n, disabled: b = !1, prevDateAriaLabel: W = "前日", nextDateAriaLabel: z = "翌日", selectAriaLabel: P = "年月日" } = e, F = t ?? a, [B, V] = De(() => {
|
|
27
|
-
const o = new Date(F ?? /* @__PURE__ */ new Date());
|
|
28
|
-
return o.setHours(0, 0, 0, 0), o;
|
|
29
|
-
}), O = t !== void 0, f = R(() => {
|
|
30
|
-
if (O) {
|
|
31
|
-
if (t && !Number.isNaN(t.getTime())) {
|
|
32
|
-
const H = new Date(t);
|
|
33
|
-
return H.setHours(0, 0, 0, 0), H;
|
|
34
|
-
}
|
|
35
|
-
const o = /* @__PURE__ */ new Date();
|
|
36
|
-
return o.setHours(0, 0, 0, 0), o;
|
|
37
|
-
}
|
|
38
|
-
return B;
|
|
39
|
-
}, [O, t?.getTime(), B]), I = h?.getTime(), v = u?.getTime(), M = R(() => {
|
|
40
|
-
if (h) {
|
|
41
|
-
const o = new Date(h);
|
|
42
|
-
return o.setHours(0, 0, 0, 0), o;
|
|
43
|
-
}
|
|
44
|
-
if (s !== void 0) {
|
|
45
|
-
const o = new Date(s, 0, 1);
|
|
46
|
-
return o.setFullYear(s), o.setHours(0, 0, 0, 0), o;
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}, [I, s]), x = R(() => {
|
|
50
|
-
if (u) {
|
|
51
|
-
const o = new Date(u);
|
|
52
|
-
return o.setHours(0, 0, 0, 0), o;
|
|
53
|
-
}
|
|
54
|
-
if (d !== void 0) {
|
|
55
|
-
const o = new Date(d, 11, 31);
|
|
56
|
-
return o.setFullYear(d), o.setHours(0, 0, 0, 0), o;
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
}, [v, d]), oe = F?.getTime();
|
|
60
|
-
ot(() => {
|
|
61
|
-
if (!O && F && !Number.isNaN(F.getTime())) {
|
|
62
|
-
const o = new Date(F);
|
|
63
|
-
o.setHours(0, 0, 0, 0), V(o);
|
|
64
|
-
}
|
|
65
|
-
}, [O, oe]);
|
|
66
|
-
const N = (o) => {
|
|
67
|
-
if (b) return;
|
|
68
|
-
let H = new Date(o);
|
|
69
|
-
H.setHours(0, 0, 0, 0), M && H < M && (H = new Date(M)), x && H > x && (H = new Date(x)), O || V(H), r?.(H);
|
|
70
|
-
}, G = R(() => Wt(f, -1), [f]), k = R(() => Wt(f, 1), [f]), j = b || M !== null && G < M, q = b || x !== null && k > x, fe = () => N(G), me = () => N(k), se = (o) => {
|
|
71
|
-
if (o.target.value) {
|
|
72
|
-
const H = Ca(o.target.value);
|
|
73
|
-
Number.isNaN(H.getTime()) || N(H);
|
|
74
|
-
}
|
|
75
|
-
}, ee = (o) => {
|
|
76
|
-
if (o.target.value) {
|
|
77
|
-
const H = Ca(o.target.value);
|
|
78
|
-
Number.isNaN(H.getTime()) || N(H);
|
|
79
|
-
}
|
|
80
|
-
}, X = f.getFullYear(), de = f.getMonth() + 1, Ve = f.getDate(), xe = M?.getTime() ?? null, Ye = x?.getTime() ?? null, Re = f.getTime(), we = R(() => {
|
|
81
|
-
if (m && m.length > 0)
|
|
82
|
-
return m.map((ke) => ke.getTime()).join(",");
|
|
83
|
-
const o = xe ?? new Date(X - 1, 0, 1).getTime(), H = Ye ?? new Date(X + 1, 11, 31).getTime(), w = Math.min(o, Re), pe = Math.max(H, Re);
|
|
84
|
-
return `${w}_${pe}`;
|
|
85
|
-
}, [m, xe, Ye, Re, X]), je = R(() => p !== "dropdown" ? [] : Ka(f, M, x, m), [p, we, f]), Ee = R(() => {
|
|
86
|
-
if (p !== "split-dropdown") return [];
|
|
87
|
-
const o = M ? M.getFullYear() : X - 10, H = x ? x.getFullYear() : X + 1, w = Math.min(o, X), pe = Math.max(H, X), ke = [];
|
|
88
|
-
for (let Ie = pe; Ie >= w; Ie--)
|
|
89
|
-
ke.push(Ie);
|
|
90
|
-
return ke;
|
|
91
|
-
}, [p, M, x, X]), L = R(() => {
|
|
92
|
-
if (p !== "split-dropdown") return [];
|
|
93
|
-
let o = 1, H = 12;
|
|
94
|
-
M && X === M.getFullYear() && (o = M.getMonth() + 1), x && X === x.getFullYear() && (H = x.getMonth() + 1);
|
|
95
|
-
const w = [];
|
|
96
|
-
for (let pe = o; pe <= H; pe++)
|
|
97
|
-
w.push(pe);
|
|
98
|
-
return w;
|
|
99
|
-
}, [p, M, x, X]), S = R(() => {
|
|
100
|
-
if (p !== "split-dropdown") return [];
|
|
101
|
-
const o = Na(f);
|
|
102
|
-
let H = 1, w = o;
|
|
103
|
-
M && X === M.getFullYear() && de === M.getMonth() + 1 && (H = M.getDate()), x && X === x.getFullYear() && de === x.getMonth() + 1 && (w = x.getDate());
|
|
104
|
-
const pe = [];
|
|
105
|
-
for (let ke = H; ke <= w; ke++)
|
|
106
|
-
pe.push(ke);
|
|
107
|
-
return pe;
|
|
108
|
-
}, [p, M, x, f, X, de]), Z = (o, H, w) => {
|
|
109
|
-
const pe = Na(new Date(o, H - 1, 1)), ke = Math.min(w, pe), Ie = new Date(o, H - 1, ke);
|
|
110
|
-
Ie.setFullYear(o), N(Ie);
|
|
111
|
-
}, ae = Nt(f, "yyyy-MM-dd"), Y = M ? Nt(M, "yyyy-MM-dd") : void 0, ie = x ? Nt(x, "yyyy-MM-dd") : void 0;
|
|
112
|
-
return /* @__PURE__ */ le("div", { className: `inline-flex items-center ${p === "split-dropdown" ? "w-auto" : "w-38"} ${A}`, style: n, children: [
|
|
113
|
-
/* @__PURE__ */ T(
|
|
114
|
-
"button",
|
|
115
|
-
{
|
|
116
|
-
type: "button",
|
|
117
|
-
"aria-label": W,
|
|
118
|
-
disabled: j,
|
|
119
|
-
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
120
|
-
onClick: fe,
|
|
121
|
-
children: /* @__PURE__ */ T("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
p === "dropdown" ? /* @__PURE__ */ T("select", { "aria-label": P, disabled: b, className: "mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: ae, onChange: ee, children: je.map((o) => /* @__PURE__ */ T("option", { value: o.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: o.label }, o.value)) }) : p === "split-dropdown" ? /* @__PURE__ */ le("div", { className: "mx-1 my-auto inline-flex items-center gap-1", children: [
|
|
125
|
-
/* @__PURE__ */ T(
|
|
126
|
-
"select",
|
|
127
|
-
{
|
|
128
|
-
"aria-label": "年",
|
|
129
|
-
disabled: b,
|
|
130
|
-
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
131
|
-
value: X,
|
|
132
|
-
onChange: (o) => Z(Number(o.target.value), de, Ve),
|
|
133
|
-
children: Ee.map((o) => /* @__PURE__ */ le("option", { value: o, className: "dark:bg-slate-700 dark:text-slate-100", children: [
|
|
134
|
-
o,
|
|
135
|
-
"年"
|
|
136
|
-
] }, o))
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ T(
|
|
140
|
-
"select",
|
|
141
|
-
{
|
|
142
|
-
"aria-label": "月",
|
|
143
|
-
disabled: b,
|
|
144
|
-
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
145
|
-
value: de,
|
|
146
|
-
onChange: (o) => Z(X, Number(o.target.value), Ve),
|
|
147
|
-
children: L.map((o) => /* @__PURE__ */ le("option", { value: o, className: "dark:bg-slate-700 dark:text-slate-100", children: [
|
|
148
|
-
String(o).padStart(2, "0"),
|
|
149
|
-
"月"
|
|
150
|
-
] }, o))
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
/* @__PURE__ */ T(
|
|
154
|
-
"select",
|
|
155
|
-
{
|
|
156
|
-
"aria-label": "日",
|
|
157
|
-
disabled: b,
|
|
158
|
-
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
159
|
-
value: Ve,
|
|
160
|
-
onChange: (o) => Z(X, de, Number(o.target.value)),
|
|
161
|
-
children: S.map((o) => /* @__PURE__ */ le("option", { value: o, className: "dark:bg-slate-700 dark:text-slate-100", children: [
|
|
162
|
-
String(o).padStart(2, "0"),
|
|
163
|
-
"日"
|
|
164
|
-
] }, o))
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
] }) : /* @__PURE__ */ T(
|
|
168
|
-
"input",
|
|
169
|
-
{
|
|
170
|
-
"aria-label": P,
|
|
171
|
-
disabled: b,
|
|
172
|
-
className: "mx-1 my-auto w-28 rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-gray-900 text-xs focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",
|
|
173
|
-
value: ae,
|
|
174
|
-
min: Y,
|
|
175
|
-
max: ie,
|
|
176
|
-
onChange: se,
|
|
177
|
-
type: "date"
|
|
178
|
-
}
|
|
179
|
-
),
|
|
180
|
-
/* @__PURE__ */ T(
|
|
181
|
-
"button",
|
|
182
|
-
{
|
|
183
|
-
type: "button",
|
|
184
|
-
"aria-label": z,
|
|
185
|
-
disabled: q,
|
|
186
|
-
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
187
|
-
onClick: me,
|
|
188
|
-
children: /* @__PURE__ */ T("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
l
|
|
192
|
-
] });
|
|
193
|
-
}, _a = Ct(ja, (e, t) => {
|
|
194
|
-
const a = e.value ?? e.initialDate, r = t.value ?? t.initialDate, l = a && !Number.isNaN(a.getTime()) ? a.getFullYear() * 1e4 + (a.getMonth() + 1) * 100 + a.getDate() : null, s = r && !Number.isNaN(r.getTime()) ? r.getFullYear() * 1e4 + (r.getMonth() + 1) * 100 + r.getDate() : null;
|
|
195
|
-
if (l !== s || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
|
|
196
|
-
const d = e.minDate && !Number.isNaN(e.minDate.getTime()) ? e.minDate.getFullYear() * 1e4 + (e.minDate.getMonth() + 1) * 100 + e.minDate.getDate() : null, h = t.minDate && !Number.isNaN(t.minDate.getTime()) ? t.minDate.getFullYear() * 1e4 + (t.minDate.getMonth() + 1) * 100 + t.minDate.getDate() : null;
|
|
197
|
-
if (d !== h) return !1;
|
|
198
|
-
const u = e.maxDate && !Number.isNaN(e.maxDate.getTime()) ? e.maxDate.getFullYear() * 1e4 + (e.maxDate.getMonth() + 1) * 100 + e.maxDate.getDate() : null, m = t.maxDate && !Number.isNaN(t.maxDate.getTime()) ? t.maxDate.getFullYear() * 1e4 + (t.maxDate.getMonth() + 1) * 100 + t.maxDate.getDate() : null;
|
|
199
|
-
return !(u !== m || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel);
|
|
200
|
-
});
|
|
201
|
-
_a.displayName = "DateSelector";
|
|
202
|
-
function Ga(e, t, a, r, l) {
|
|
203
|
-
const s = e.getFullYear(), d = t ?? (r ? r.getFullYear() : s - 5), h = a ?? (l ? l.getFullYear() : s + 5), u = Math.min(d, s), m = Math.max(h, s), p = r ? new Date(r.getFullYear(), r.getMonth(), 1).getTime() : null, A = l ? new Date(l.getFullYear(), l.getMonth(), 1).getTime() : null, n = [];
|
|
204
|
-
for (let b = m; b >= u; b--)
|
|
205
|
-
for (let W = 12; W >= 1; W--) {
|
|
206
|
-
const z = new Date(b, W - 1, 1);
|
|
207
|
-
z.setFullYear(b);
|
|
208
|
-
const P = z.getTime();
|
|
209
|
-
if (p !== null && P < p || A !== null && P > A) continue;
|
|
210
|
-
const F = String(W).padStart(2, "0"), B = `${b}-${F}`;
|
|
211
|
-
n.push({ label: B, value: B });
|
|
212
|
-
}
|
|
213
|
-
return n;
|
|
214
|
-
}
|
|
215
|
-
const Wa = (e) => {
|
|
216
|
-
const { value: t, initialDate: a, onChange: r, children: l, variant: s = "date", minYear: d, maxYear: h, minDate: u, maxDate: m, isWarning: p = !1, className: A = "", style: n, disabled: b = !1, prevMonthAriaLabel: W = "前月", nextMonthAriaLabel: z = "翌月", selectAriaLabel: P = "年月" } = e, F = t ?? a, [B, V] = De(() => {
|
|
217
|
-
const Y = F ?? /* @__PURE__ */ new Date(), ie = new Date(Y.getFullYear(), Y.getMonth(), 1);
|
|
218
|
-
return ie.setFullYear(Y.getFullYear()), ie;
|
|
219
|
-
}), O = t !== void 0, f = R(() => {
|
|
220
|
-
if (O) {
|
|
221
|
-
if (t && !Number.isNaN(t.getTime())) {
|
|
222
|
-
const Y = new Date(t.getFullYear(), t.getMonth(), 1);
|
|
223
|
-
return Y.setFullYear(t.getFullYear()), Y;
|
|
224
|
-
}
|
|
225
|
-
return /* @__PURE__ */ new Date();
|
|
226
|
-
}
|
|
227
|
-
return B;
|
|
228
|
-
}, [O, t?.getTime(), B]), I = u?.getTime(), v = m?.getTime(), M = R(() => {
|
|
229
|
-
if (u) {
|
|
230
|
-
const Y = new Date(u.getFullYear(), u.getMonth(), 1);
|
|
231
|
-
return Y.setFullYear(u.getFullYear()), Y;
|
|
232
|
-
}
|
|
233
|
-
if (d !== void 0) {
|
|
234
|
-
const Y = new Date(d, 0, 1);
|
|
235
|
-
return Y.setFullYear(d), Y;
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
238
|
-
}, [I, d]), x = R(() => {
|
|
239
|
-
if (m) {
|
|
240
|
-
const Y = new Date(m.getFullYear(), m.getMonth(), 1);
|
|
241
|
-
return Y.setFullYear(m.getFullYear()), Y;
|
|
242
|
-
}
|
|
243
|
-
if (h !== void 0) {
|
|
244
|
-
const Y = new Date(h, 11, 1);
|
|
245
|
-
return Y.setFullYear(h), Y;
|
|
246
|
-
}
|
|
247
|
-
return null;
|
|
248
|
-
}, [v, h]), oe = F?.getTime();
|
|
249
|
-
ot(() => {
|
|
250
|
-
if (!O && F && !Number.isNaN(F.getTime())) {
|
|
251
|
-
const Y = new Date(F.getFullYear(), F.getMonth(), 1);
|
|
252
|
-
Y.setFullYear(F.getFullYear()), V(Y);
|
|
253
|
-
}
|
|
254
|
-
}, [O, oe]);
|
|
255
|
-
const N = (Y) => {
|
|
256
|
-
if (b) return;
|
|
257
|
-
let ie = Y;
|
|
258
|
-
M && ie < M && (ie = new Date(M)), x && ie > x && (ie = new Date(x)), O || V(ie);
|
|
259
|
-
const ne = ie.getFullYear() * 100 + (ie.getMonth() + 1);
|
|
260
|
-
r?.(ie, ne);
|
|
261
|
-
}, G = R(() => {
|
|
262
|
-
const Y = new Date(f.getFullYear(), f.getMonth() - 1, 1);
|
|
263
|
-
return Y.setFullYear(f.getMonth() === 0 ? f.getFullYear() - 1 : f.getFullYear()), Y;
|
|
264
|
-
}, [f]), k = R(() => {
|
|
265
|
-
const Y = new Date(f.getFullYear(), f.getMonth() + 1, 1);
|
|
266
|
-
return Y.setFullYear(f.getMonth() === 11 ? f.getFullYear() + 1 : f.getFullYear()), Y;
|
|
267
|
-
}, [f]), j = b || M !== null && G < M, q = b || x !== null && k > x, fe = () => {
|
|
268
|
-
N(G);
|
|
269
|
-
}, me = () => {
|
|
270
|
-
N(k);
|
|
271
|
-
}, se = (Y) => {
|
|
272
|
-
const ie = Y.target.value;
|
|
273
|
-
if (!ie) return;
|
|
274
|
-
const [ne, ce] = ie.split("-"), o = Number(ne), H = Number(ce) - 1;
|
|
275
|
-
if (!(Number.isNaN(o) || Number.isNaN(H))) {
|
|
276
|
-
const w = new Date(o, H, 1);
|
|
277
|
-
w.setFullYear(o), N(w);
|
|
278
|
-
}
|
|
279
|
-
}, ee = (Y) => {
|
|
280
|
-
const ie = Y.target.value;
|
|
281
|
-
if (!ie) return;
|
|
282
|
-
const [ne, ce] = ie.split("-"), o = Number(ne), H = Number(ce) - 1;
|
|
283
|
-
if (!(Number.isNaN(o) || Number.isNaN(H))) {
|
|
284
|
-
const w = new Date(o, H, 1);
|
|
285
|
-
w.setFullYear(o), N(w);
|
|
286
|
-
}
|
|
287
|
-
}, X = `${f.getFullYear()}-${String(f.getMonth() + 1).padStart(2, "0")}`, de = M ? `${M.getFullYear()}-${String(M.getMonth() + 1).padStart(2, "0")}` : void 0, Ve = x ? `${x.getFullYear()}-${String(x.getMonth() + 1).padStart(2, "0")}` : void 0, xe = f.getFullYear(), Ye = d ?? (u ? u.getFullYear() : xe - 5), Re = h ?? (m ? m.getFullYear() : xe + 5), we = Math.min(Ye, xe), je = Math.max(Re, xe), Ee = `${we}_${je}_${I ?? "none"}_${v ?? "none"}`, L = R(() => s !== "dropdown" ? [] : Ga(f, d, h, u, m), [s, Ee, f]), S = p ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", Z = `mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${S}`, ae = `mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 ${S}`;
|
|
288
|
-
return /* @__PURE__ */ le("div", { className: `inline-flex w-38 items-center ${A}`, style: n, children: [
|
|
289
|
-
/* @__PURE__ */ T(
|
|
290
|
-
"button",
|
|
291
|
-
{
|
|
292
|
-
type: "button",
|
|
293
|
-
"aria-label": W,
|
|
294
|
-
disabled: j,
|
|
295
|
-
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
296
|
-
onClick: fe,
|
|
297
|
-
children: /* @__PURE__ */ T("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
|
|
298
|
-
}
|
|
299
|
-
),
|
|
300
|
-
s === "dropdown" ? /* @__PURE__ */ T("select", { "aria-label": P, disabled: b, className: ae, value: X, onChange: ee, children: L.map((Y) => /* @__PURE__ */ T("option", { value: Y.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: Y.label }, Y.value)) }) : /* @__PURE__ */ T("input", { "aria-label": P, disabled: b, className: Z, value: X, min: de, max: Ve, onChange: se, type: "month" }),
|
|
301
|
-
/* @__PURE__ */ T(
|
|
302
|
-
"button",
|
|
303
|
-
{
|
|
304
|
-
type: "button",
|
|
305
|
-
"aria-label": z,
|
|
306
|
-
disabled: q,
|
|
307
|
-
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
308
|
-
onClick: me,
|
|
309
|
-
children: /* @__PURE__ */ T("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
|
|
310
|
-
}
|
|
311
|
-
),
|
|
312
|
-
l
|
|
313
|
-
] });
|
|
314
|
-
}, qa = Ct(Wa, (e, t) => {
|
|
315
|
-
const a = e.value ?? e.initialDate, r = t.value ?? t.initialDate, l = a && !Number.isNaN(a.getTime()) ? a.getFullYear() * 12 + a.getMonth() : null, s = r && !Number.isNaN(r.getTime()) ? r.getFullYear() * 12 + r.getMonth() : null;
|
|
316
|
-
if (l !== s || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.isWarning !== t.isWarning || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
|
|
317
|
-
const d = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, h = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
|
|
318
|
-
if (d !== h) return !1;
|
|
319
|
-
const u = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, m = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
|
|
320
|
-
return !(u !== m || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel);
|
|
321
|
-
});
|
|
322
|
-
qa.displayName = "MonthSelector";
|
|
323
|
-
const La = {
|
|
1
|
+
import { jsx as w, jsxs as le, Fragment as ln } from "react/jsx-runtime";
|
|
2
|
+
import { addYears as Un, addMonths as Bn, addDays as Dr, format as Ht, getDaysInMonth as sn, parseISO as cn } from "date-fns";
|
|
3
|
+
import { memo as tr, useId as zn, useRef as j, useMemo as Y, useCallback as U, useState as he, useEffect as xt } from "react";
|
|
4
|
+
const _n = {
|
|
324
5
|
"blue-rose": {
|
|
325
6
|
macro: "#0284c7",
|
|
326
7
|
macroLight: "#38bdf8",
|
|
@@ -363,970 +44,1127 @@ const La = {
|
|
|
363
44
|
microLight: "#71717a",
|
|
364
45
|
accent: "#27272a"
|
|
365
46
|
}
|
|
366
|
-
},
|
|
367
|
-
if (!
|
|
368
|
-
const
|
|
369
|
-
return e === "year" ? (
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}, Me = (e, t) => {
|
|
47
|
+
}, dt = (e) => e instanceof Date && !Number.isNaN(e.getTime()), ve = (e) => e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : String(e), We = (e, t) => {
|
|
48
|
+
if (!dt(t)) throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${ve(t)})`);
|
|
49
|
+
const r = new Date(t.getTime());
|
|
50
|
+
return e === "year" ? (r.setMonth(0, 1), r.setHours(0, 0, 0, 0)) : (e === "month" && r.setDate(1), r.setHours(0, 0, 0, 0)), r;
|
|
51
|
+
}, re = (e, t) => {
|
|
52
|
+
const r = We(e, t), n = r.getFullYear(), a = r.getMonth() + 1, s = r.getDate();
|
|
53
|
+
return e === "year" ? n : e === "month" ? n * 12 + (a - 1) : Math.floor(Date.UTC(n, a - 1, s) / (1440 * 60 * 1e3));
|
|
54
|
+
}, ce = (e, t) => {
|
|
375
55
|
if (e === "year") return new Date(t, 0, 1);
|
|
376
56
|
if (e === "month") {
|
|
377
|
-
const
|
|
378
|
-
return new Date(
|
|
57
|
+
const n = Math.floor(t / 12), a = t % 12;
|
|
58
|
+
return new Date(n, a, 1);
|
|
379
59
|
}
|
|
380
|
-
const
|
|
381
|
-
return new Date(
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
return e === "year" ?
|
|
385
|
-
},
|
|
386
|
-
if (!
|
|
60
|
+
const r = new Date(t * 24 * 60 * 60 * 1e3);
|
|
61
|
+
return new Date(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate());
|
|
62
|
+
}, ke = (e, t, r) => {
|
|
63
|
+
if (!dt(t)) throw new RangeError(`addUnit: d must be a valid Date (received: ${ve(t)})`);
|
|
64
|
+
return e === "year" ? Un(t, r) : e === "month" ? Bn(t, r) : Dr(t, r);
|
|
65
|
+
}, yt = (e, t, r) => {
|
|
66
|
+
if (!dt(r)) throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${ve(r)})`);
|
|
387
67
|
if (e === t)
|
|
388
|
-
return
|
|
389
|
-
const
|
|
68
|
+
return We(t, r);
|
|
69
|
+
const n = r.getFullYear(), a = r.getMonth();
|
|
390
70
|
if (e === "year") {
|
|
391
71
|
if (t === "month")
|
|
392
|
-
return new Date(
|
|
72
|
+
return new Date(n, 11, 1);
|
|
393
73
|
if (t === "day")
|
|
394
|
-
return new Date(
|
|
74
|
+
return new Date(n, 11, 31);
|
|
395
75
|
}
|
|
396
|
-
return e === "month" && t === "day" ? new Date(
|
|
397
|
-
},
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
76
|
+
return e === "month" && t === "day" ? new Date(n, a + 1, 0) : We(t, r);
|
|
77
|
+
}, Xn = {
|
|
78
|
+
year: { year: "numeric" },
|
|
79
|
+
month: { year: "numeric", month: "2-digit" },
|
|
80
|
+
day: { year: "numeric", month: "2-digit", day: "2-digit" }
|
|
81
|
+
}, un = /* @__PURE__ */ new Map(), Kn = (e, t) => {
|
|
82
|
+
const r = `${e}\0${t}`, n = un.get(r);
|
|
83
|
+
if (n !== void 0) return n;
|
|
84
|
+
const a = new Intl.DateTimeFormat(t, Xn[e]);
|
|
85
|
+
return un.set(r, a), a;
|
|
86
|
+
}, qn = (e, t) => {
|
|
87
|
+
const r = String(t.getFullYear()).padStart(4, "0");
|
|
88
|
+
if (e === "year") return r;
|
|
89
|
+
const n = String(t.getMonth() + 1).padStart(2, "0");
|
|
90
|
+
if (e === "month") return `${r}-${n}`;
|
|
91
|
+
const a = String(t.getDate()).padStart(2, "0");
|
|
92
|
+
return `${r}-${n}-${a}`;
|
|
93
|
+
}, Ae = (e, t, r, n) => dt(t) ? r ? r(t) : n === void 0 ? qn(e, t) : Kn(e, n).format(t) : "", Et = (e, t, r, n) => Ae(e, t, r, n), ut = (e, t, r) => {
|
|
408
94
|
if (!e || e.length === 0 || e.length === 1) return 0;
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
if (
|
|
412
|
-
if (
|
|
413
|
-
for (;
|
|
414
|
-
const
|
|
415
|
-
if (
|
|
416
|
-
|
|
95
|
+
const n = re(r, t);
|
|
96
|
+
let a = 0, s = e.length - 1;
|
|
97
|
+
if (n <= re(r, e[a])) return 0;
|
|
98
|
+
if (n >= re(r, e[s])) return s;
|
|
99
|
+
for (; a <= s; ) {
|
|
100
|
+
const g = a + s >> 1, h = re(r, e[g]);
|
|
101
|
+
if (h === n) return g;
|
|
102
|
+
h < n ? a = g + 1 : s = g - 1;
|
|
417
103
|
}
|
|
418
|
-
const
|
|
419
|
-
return
|
|
420
|
-
},
|
|
104
|
+
const o = Math.abs(re(r, e[a]) - n), d = Math.abs(re(r, e[s]) - n);
|
|
105
|
+
return o < d ? a : s;
|
|
106
|
+
}, Qt = (e, t, r, n) => {
|
|
421
107
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const m = te(t, u);
|
|
427
|
-
s.has(m) || s.set(m, u);
|
|
428
|
-
}
|
|
429
|
-
let h = Array.from(s.keys()).sort((u, m) => u - m).map((u) => s.get(u)).filter((u) => u !== void 0);
|
|
430
|
-
if (a && !Number.isNaN(a.getTime())) {
|
|
431
|
-
const u = te(t, a);
|
|
432
|
-
h = h.filter((m) => te(t, m) >= u);
|
|
433
|
-
}
|
|
434
|
-
if (r && !Number.isNaN(r.getTime())) {
|
|
435
|
-
const u = te(t, r);
|
|
436
|
-
h = h.filter((m) => te(t, m) <= u);
|
|
108
|
+
const a = re(t, r), s = re(t, n), o = /* @__PURE__ */ new Map();
|
|
109
|
+
for (const d of e) {
|
|
110
|
+
const g = We(t, d), h = re(t, g);
|
|
111
|
+
h < a || h > s || o.has(h) || o.set(h, g);
|
|
437
112
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
113
|
+
if (o.size === 0)
|
|
114
|
+
throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${ve(r)}, maxDate: ${ve(n)}, entries: ${e.length})`);
|
|
115
|
+
return Array.from(o.keys()).sort((d, g) => d - g).map((d) => o.get(d));
|
|
116
|
+
}, dn = (e, t, r, n, a, s, o) => {
|
|
117
|
+
let d = r, g = n;
|
|
118
|
+
return o ? (d = t, g = t) : e === "low" ? t > n ? (d = n, g = t) : d = t : t < r ? (g = r, d = t) : g = t, [Math.max(a, Math.min(s, d)), Math.max(a, Math.min(s, g))];
|
|
119
|
+
}, jn = (e, t, r, n, a) => a ? "low" : e === "low" ? t > n ? "high" : "low" : t < r ? "low" : "high", Gn = ({ posDiffPct: e, startLowVal: t, startHighVal: r, rangeMin: n, rangeMax: a, isDiscrete: s, sortedAllowedDates: o, snapMode: d, unit: g }) => {
|
|
445
120
|
if (s) {
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
|
|
449
|
-
|
|
121
|
+
const _ = o.length - 1;
|
|
122
|
+
if (_ <= 0) return [0, 0];
|
|
123
|
+
const Z = Math.max(0, Math.min(_, Math.round(t))), D = Math.max(Z, Math.min(_, Math.round(r)));
|
|
124
|
+
if (d === "time") {
|
|
125
|
+
const A = o[0].getTime(), O = o[_].getTime(), y = o[Z].getTime(), B = o[D].getTime() - y;
|
|
126
|
+
let E = y + e * (O - A), m = E + B;
|
|
127
|
+
E < A && (E = A, m = A + B), m > O && (m = O, E = O - B);
|
|
128
|
+
const L = ut(o, new Date(E), g), S = ut(o, new Date(m), g);
|
|
129
|
+
return [L, Math.max(L, S)];
|
|
130
|
+
}
|
|
131
|
+
const W = Math.round(e * _);
|
|
132
|
+
let C = Z + W, Q = D + W;
|
|
133
|
+
return C < 0 && (Q += -C, C = 0), Q > _ && (C -= Q - _, Q = _), [Math.max(0, Math.min(_, C)), Math.max(0, Math.min(_, Q))];
|
|
450
134
|
}
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
135
|
+
const h = (_) => Math.max(n, Math.min(a, _)), M = a - n;
|
|
136
|
+
if (M <= 0) return [h(t), h(r)];
|
|
137
|
+
const x = Math.round(e * M);
|
|
138
|
+
let c = t + x, p = r + x;
|
|
139
|
+
return c < n && (p += n - c, c = n), p > a && (c -= p - a, p = a), [h(c), h(p)];
|
|
140
|
+
}, Wn = (e, t, r, n, a, s, o, d) => {
|
|
141
|
+
let g = 0, h = !1, M = !1;
|
|
457
142
|
switch (e) {
|
|
458
143
|
case "ArrowRight":
|
|
459
144
|
case "ArrowUp":
|
|
460
|
-
|
|
145
|
+
g = d;
|
|
461
146
|
break;
|
|
462
147
|
case "ArrowLeft":
|
|
463
148
|
case "ArrowDown":
|
|
464
|
-
|
|
149
|
+
g = -d;
|
|
465
150
|
break;
|
|
466
151
|
case "PageUp":
|
|
467
|
-
|
|
152
|
+
g = d * 5;
|
|
468
153
|
break;
|
|
469
154
|
case "PageDown":
|
|
470
|
-
|
|
155
|
+
g = -d * 5;
|
|
471
156
|
break;
|
|
472
157
|
case "Home":
|
|
473
|
-
|
|
158
|
+
h = !0;
|
|
474
159
|
break;
|
|
475
160
|
case "End":
|
|
476
|
-
|
|
161
|
+
M = !0;
|
|
477
162
|
break;
|
|
478
163
|
default:
|
|
479
164
|
return null;
|
|
480
165
|
}
|
|
481
|
-
if (
|
|
482
|
-
let
|
|
483
|
-
return
|
|
166
|
+
if (o) {
|
|
167
|
+
let p = r;
|
|
168
|
+
return h ? p = a : M ? p = s : p = Math.max(a, Math.min(s, r + g)), [p, p];
|
|
484
169
|
}
|
|
485
|
-
let
|
|
486
|
-
return t === "low" ?
|
|
487
|
-
},
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
const
|
|
170
|
+
let x = r, c = n;
|
|
171
|
+
return t === "low" ? h ? x = a : M ? x = n : x = Math.max(a, Math.min(n, r + g)) : h ? c = r : M ? c = s : c = Math.max(r, Math.min(s, n + g)), [x, c];
|
|
172
|
+
}, Dn = 8, Mn = 2, xn = 16, Jn = 12, Zn = 90, yn = (e, t) => {
|
|
173
|
+
const r = t?.estimatedHeightPx ?? xn, a = Dn + (t?.anchorGapY ?? Mn) + r / 2, s = e === "top" ? -a : a;
|
|
174
|
+
return {
|
|
175
|
+
lowAngleDeg: 0,
|
|
176
|
+
highAngleDeg: 0,
|
|
177
|
+
lowOffsetX: 0,
|
|
178
|
+
highOffsetX: 0,
|
|
179
|
+
lowOffsetY: s,
|
|
180
|
+
highOffsetY: s,
|
|
181
|
+
isSlanted: !1,
|
|
182
|
+
proximity: 0
|
|
183
|
+
};
|
|
184
|
+
}, Qn = (e, t, r, n = "top", a) => {
|
|
185
|
+
const s = a?.estimatedWidthPx, o = a?.estimatedHeightPx ?? xn, d = a?.paddingPx ?? Jn, g = a?.maxAngleDeg ?? Zn, h = Dn + (a?.anchorGapY ?? Mn), M = yn(n, a);
|
|
186
|
+
if (!(Number.isFinite(r) && r > 0) || s === void 0 || !Number.isFinite(s) || s <= 0) return M;
|
|
187
|
+
const x = Math.max(0, t - e) / 100 * r, c = s + d;
|
|
188
|
+
if (x >= c) return M;
|
|
189
|
+
const p = Math.max(0, Math.min(1, (c - x) / c)), Z = p * p * p * (p * (p * 6 - 15) + 10) * g, D = n === "top" ? -Z : Z, W = Z * Math.PI / 180, C = s / 2 * Math.abs(Math.sin(W)) + o / 2 * Math.abs(Math.cos(W)), Q = h + C, A = n === "top" ? -Q : +Q, O = s * Math.abs(Math.cos(W)) + o * Math.abs(Math.sin(W)), y = Math.max(0, (O + d - x) / 2);
|
|
501
190
|
return {
|
|
502
|
-
lowAngleDeg:
|
|
503
|
-
highAngleDeg:
|
|
504
|
-
lowOffsetX: -
|
|
505
|
-
highOffsetX:
|
|
506
|
-
lowOffsetY:
|
|
507
|
-
highOffsetY:
|
|
508
|
-
isSlanted:
|
|
509
|
-
proximity:
|
|
191
|
+
lowAngleDeg: D,
|
|
192
|
+
highAngleDeg: D,
|
|
193
|
+
lowOffsetX: -y,
|
|
194
|
+
highOffsetX: y,
|
|
195
|
+
lowOffsetY: A,
|
|
196
|
+
highOffsetY: A,
|
|
197
|
+
isSlanted: p > 1e-3,
|
|
198
|
+
proximity: p
|
|
510
199
|
};
|
|
511
200
|
};
|
|
512
|
-
function
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
const
|
|
516
|
-
return
|
|
201
|
+
function ea(e, t, r, n, a, s, o = "macro-top", d = 0.05) {
|
|
202
|
+
const g = o === "macro-top" || o === "macro-left", h = t <= 0;
|
|
203
|
+
if (g && h || !(g || h)) {
|
|
204
|
+
const c = Math.abs(e - r), p = Math.abs(e - n);
|
|
205
|
+
return c <= d && c <= p ? "macro-low" : p <= d && p < c ? "macro-high" : e >= r && e <= n ? "macro-connect" : c < p ? "macro-low" : "macro-high";
|
|
517
206
|
}
|
|
518
|
-
const
|
|
519
|
-
return
|
|
207
|
+
const M = Math.abs(e - a), x = Math.abs(e - s);
|
|
208
|
+
return M <= d && M <= x ? "micro-low" : x <= d && x < M ? "micro-high" : e >= a && e <= s ? "micro-connect" : M < x ? "micro-low" : "micro-high";
|
|
520
209
|
}
|
|
521
|
-
function
|
|
210
|
+
function ta(e, t, r, n, a) {
|
|
522
211
|
if (e === "macro-connect") {
|
|
523
|
-
const
|
|
524
|
-
return [
|
|
212
|
+
const o = t - r, d = a - n, g = Math.max(0, Math.min(1 - d, n + o)), h = g + d;
|
|
213
|
+
return [g, h, "macro-connect"];
|
|
525
214
|
}
|
|
526
215
|
if (e === "macro-low") {
|
|
527
|
-
const
|
|
528
|
-
return
|
|
216
|
+
const o = Math.max(0, Math.min(1, t));
|
|
217
|
+
return o > a ? [a, o, "macro-high"] : [o, a, "macro-low"];
|
|
529
218
|
}
|
|
530
219
|
const s = Math.max(0, Math.min(1, t));
|
|
531
|
-
return s <
|
|
220
|
+
return s < n ? [s, n, "macro-low"] : [n, s, "macro-high"];
|
|
532
221
|
}
|
|
533
|
-
function
|
|
222
|
+
function ra(e, t, r, n, a) {
|
|
534
223
|
if (e === "micro-connect") {
|
|
535
|
-
const
|
|
536
|
-
return [
|
|
224
|
+
const o = t - r, d = a - n, g = Math.max(0, Math.min(1 - d, n + o)), h = g + d;
|
|
225
|
+
return [g, h, "micro-connect"];
|
|
537
226
|
}
|
|
538
227
|
if (e === "micro-low") {
|
|
539
|
-
const
|
|
540
|
-
return
|
|
228
|
+
const o = Math.max(0, Math.min(1, t));
|
|
229
|
+
return o > a ? [a, o, "micro-high"] : [o, a, "micro-low"];
|
|
541
230
|
}
|
|
542
231
|
const s = Math.max(0, Math.min(1, t));
|
|
543
|
-
return s <
|
|
232
|
+
return s < n ? [s, n, "micro-low"] : [n, s, "micro-high"];
|
|
544
233
|
}
|
|
545
|
-
const
|
|
546
|
-
let
|
|
547
|
-
return
|
|
234
|
+
const Jt = tr(({ type: e, isTop: t = !0, isVertical: r = !1, isLeft: n = !0 }) => {
|
|
235
|
+
let a, s;
|
|
236
|
+
return r ? (a = n ? "M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z", s = `period-slider-knob period-slider-knob-svg is-vertical ${n ? "is-semicircle-left" : "is-semicircle-right"}`) : (a = t ? "M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z", s = `period-slider-knob period-slider-knob-svg ${t ? "is-semicircle-top" : "is-semicircle-bottom"}`), /* @__PURE__ */ w("svg", { className: s, width: r ? "8" : "16", height: r ? "16" : "8", viewBox: r ? "0 0 8 16" : "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ w("path", { d: a, className: e === "macro" ? "period-slider-knob-path-macro" : "period-slider-knob-path-micro", shapeRendering: "geometricPrecision", strokeWidth: "1.25" }) });
|
|
548
237
|
});
|
|
549
|
-
|
|
550
|
-
const
|
|
238
|
+
Jt.displayName = "VernierKnobSvg";
|
|
239
|
+
const na = (e, t) => {
|
|
240
|
+
if (!dt(e)) throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${ve(e)})`);
|
|
241
|
+
if (!dt(t)) throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${ve(t)})`);
|
|
242
|
+
if (t.getTime() <= e.getTime())
|
|
243
|
+
throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${ve(e)}, maxDate: ${ve(t)})`);
|
|
244
|
+
}, Ar = (e, t) => {
|
|
245
|
+
if (!Array.isArray(t) || t.length !== 2)
|
|
246
|
+
throw new RangeError(`PeriodSlider: ${e} is required and must be a [start, end] Date tuple (received: ${ve(t)})`);
|
|
247
|
+
const [r, n] = t;
|
|
248
|
+
if (!dt(r)) throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${ve(r)})`);
|
|
249
|
+
if (!dt(n)) throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${ve(n)})`);
|
|
250
|
+
if (n.getTime() < r.getTime())
|
|
251
|
+
throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${ve(r)}, end: ${ve(n)})`);
|
|
252
|
+
}, aa = (e, t, r) => {
|
|
253
|
+
if (Ar("macroRange", e), t !== void 0)
|
|
254
|
+
return Ar("microRange", t), t;
|
|
255
|
+
if (r !== void 0)
|
|
256
|
+
return Ar("defaultMicroRange", r), r;
|
|
257
|
+
throw new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)");
|
|
258
|
+
}, br = (e, t, r, n, a, s, o, d) => {
|
|
259
|
+
const g = ut(e, n, t), h = ut(e, a, t);
|
|
260
|
+
if (o) return e[g];
|
|
261
|
+
if (d) return e[h];
|
|
262
|
+
const M = Math.max(g, Math.min(h, ut(e, r, t) + s));
|
|
263
|
+
return e[M];
|
|
264
|
+
}, Cr = (e) => {
|
|
265
|
+
e.timerId !== null && clearTimeout(e.timerId), e.timerId = null, e.emit = null;
|
|
266
|
+
}, oa = (e, t) => {
|
|
267
|
+
try {
|
|
268
|
+
Intl.DateTimeFormat.supportedLocalesOf([t]);
|
|
269
|
+
} catch {
|
|
270
|
+
throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`);
|
|
271
|
+
}
|
|
272
|
+
}, mn = () => {
|
|
273
|
+
const [e, t] = he(null), r = j(null), n = U((a) => {
|
|
274
|
+
if (r.current?.disconnect(), r.current = null, a === null) {
|
|
275
|
+
t(null);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (typeof ResizeObserver > "u") return;
|
|
279
|
+
const s = new ResizeObserver((o) => {
|
|
280
|
+
for (const d of o) {
|
|
281
|
+
const g = d.borderBoxSize?.[0];
|
|
282
|
+
g !== void 0 && t((h) => h !== null && Math.abs(h.widthPx - g.inlineSize) < 0.5 && Math.abs(h.heightPx - g.blockSize) < 0.5 ? h : { widthPx: g.inlineSize, heightPx: g.blockSize });
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
s.observe(a), r.current = s;
|
|
286
|
+
}, []);
|
|
287
|
+
return xt(
|
|
288
|
+
() => () => {
|
|
289
|
+
r.current?.disconnect(), r.current = null;
|
|
290
|
+
},
|
|
291
|
+
[]
|
|
292
|
+
), [n, e];
|
|
293
|
+
}, ia = {
|
|
294
|
+
horizontal: { decrease: "◀", increase: "▶" },
|
|
295
|
+
vertical: { decrease: "▼", increase: "▲" }
|
|
296
|
+
}, la = {
|
|
297
|
+
horizontal: { decrease: "period-slider-stepper-prev", increase: "period-slider-stepper-next" },
|
|
298
|
+
vertical: { decrease: "period-slider-stepper-prev period-slider-stepper-down", increase: "period-slider-stepper-next period-slider-stepper-up" }
|
|
299
|
+
}, sa = (e) => {
|
|
551
300
|
const {
|
|
552
301
|
unit: t,
|
|
553
|
-
minDate:
|
|
554
|
-
maxDate:
|
|
555
|
-
allowedDates:
|
|
302
|
+
minDate: r,
|
|
303
|
+
maxDate: n,
|
|
304
|
+
allowedDates: a,
|
|
556
305
|
snapMode: s = "index",
|
|
557
|
-
disabled:
|
|
558
|
-
className:
|
|
559
|
-
showStepper:
|
|
560
|
-
tooltipStyle:
|
|
561
|
-
labelPosition:
|
|
562
|
-
autoSlantLabels:
|
|
563
|
-
isVertical:
|
|
564
|
-
hideConnectBar:
|
|
565
|
-
showTicks:
|
|
566
|
-
colorScheme:
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
let D = te(t, c);
|
|
576
|
-
return D <= g && (c = Le(t, i, 1), D = te(t, c)), { rangeMin: g, rangeMax: D };
|
|
577
|
-
}, [I, f, t, V, O]), x = e.mode === "point", oe = K(
|
|
306
|
+
disabled: o = !1,
|
|
307
|
+
className: d = "",
|
|
308
|
+
showStepper: g = !0,
|
|
309
|
+
tooltipStyle: h = "always",
|
|
310
|
+
labelPosition: M = "top",
|
|
311
|
+
autoSlantLabels: x = !0,
|
|
312
|
+
isVertical: c = !1,
|
|
313
|
+
hideConnectBar: p = !1,
|
|
314
|
+
showTicks: _ = !1,
|
|
315
|
+
colorScheme: Z = "blue-rose",
|
|
316
|
+
locale: D,
|
|
317
|
+
decreaseAriaLabel: W = "Decrease",
|
|
318
|
+
increaseAriaLabel: C = "Increase"
|
|
319
|
+
} = e;
|
|
320
|
+
na(r, n), D !== void 0 && oa("locale", D);
|
|
321
|
+
const Q = e.mode === "vernier" ? aa(e.macroRange, e.microRange, e.defaultMicroRange) : null, A = _n[Z], O = zn(), y = j(e);
|
|
322
|
+
y.current = e;
|
|
323
|
+
const B = r.getTime(), E = n.getTime(), m = Y(() => Qt(a, t, r, n), [a, t, B, E]), L = m.length > 0, { rangeMin: S, rangeMax: H } = Y(() => L ? { rangeMin: 0, rangeMax: m.length - 1 } : { rangeMin: re(t, r), rangeMax: re(t, n) }, [L, m, t, B, E]), P = e.mode === "point", ne = U(
|
|
578
324
|
(i) => {
|
|
579
|
-
if (
|
|
580
|
-
const
|
|
581
|
-
return
|
|
325
|
+
if (L) {
|
|
326
|
+
const l = Math.max(0, Math.min(m.length - 1, Math.round(i)));
|
|
327
|
+
return m[l];
|
|
582
328
|
}
|
|
583
|
-
return
|
|
329
|
+
return ce(t, Math.round(i));
|
|
584
330
|
},
|
|
585
|
-
[
|
|
586
|
-
),
|
|
331
|
+
[L, m, t]
|
|
332
|
+
), K = U(
|
|
587
333
|
(i) => {
|
|
588
|
-
if (
|
|
589
|
-
const
|
|
590
|
-
return
|
|
334
|
+
if (i === void 0) return S;
|
|
335
|
+
const l = We(t, i);
|
|
336
|
+
return L ? ut(m, l, t) : re(t, l);
|
|
591
337
|
},
|
|
592
|
-
[
|
|
593
|
-
),
|
|
338
|
+
[L, m, t, S]
|
|
339
|
+
), [X, te] = he(() => Q), ae = e.mode !== "vernier" ? null : e.microRange !== void 0 ? e.microRange : X, me = e.mode === "range" ? e.range?.[0] ?? e.defaultRange?.[0] : e.mode === "vernier" ? ae?.[0] : void 0, ze = e.mode === "range" ? e.range?.[1] ?? e.defaultRange?.[1] : e.mode === "vernier" ? ae?.[1] : void 0, oe = e.mode === "point" ? e.value ?? e.defaultValue : void 0, Ze = e.mode === "point" ? oe?.getTime() : me?.getTime(), mt = e.mode === "range" ? ze?.getTime() : Ze, [Se, pe] = Y(() => {
|
|
594
340
|
if (e.mode === "point") {
|
|
595
|
-
const
|
|
596
|
-
return [
|
|
341
|
+
const u = K(oe);
|
|
342
|
+
return [u, u];
|
|
597
343
|
}
|
|
598
|
-
const i =
|
|
599
|
-
return [Math.min(i,
|
|
600
|
-
}, [e.mode,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const [
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
return
|
|
612
|
-
}, [
|
|
613
|
-
|
|
614
|
-
const i =
|
|
615
|
-
return
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
344
|
+
const i = K(me), l = K(ze);
|
|
345
|
+
return [Math.min(i, l), Math.max(i, l)];
|
|
346
|
+
}, [e.mode, Ze, mt, K, oe, me, ze]), ue = e.mode === "point" ? e.value !== void 0 : e.mode === "range" ? e.range !== void 0 : e.microRange !== void 0, [I, F] = he(() => [Se, pe]), [G, de] = he(null), [$, be] = he(null), Ee = j(null);
|
|
347
|
+
Ee.current = $;
|
|
348
|
+
const [Qe, se] = he("high"), [De, ft] = he(null), [Ft, rr] = he(null), fe = G ? G[0] : ue ? Se : I[0], ge = G ? G[1] : ue ? pe : I[1], J = e.mode === "vernier", gt = e.mode === "vernier" ? e.vernierOrientation ?? (c ? "macro-left" : "macro-top") : "macro-top", T = gt === "macro-top" || gt === "macro-left", nr = e.mode === "vernier" ? e.showVernierProjection ?? !0 : !1, ar = e.mode === "vernier" ? e.showVernierTicks ?? !0 : !1, Tt = e.mode === "vernier" ? e.showHairline ?? !0 : !1, z = J ? e.macroUnit ?? t : t, N = J ? e.microUnit ?? t : t, Vt = J ? e.macroIsDiscrete ?? !1 : L, it = J ? e.microIsDiscrete ?? !1 : L, Mr = J ? e.macroAllowedDates ?? a : a, xr = J ? e.microAllowedDates ?? a : a, f = J ? e.formatMacroLabel ?? e.formatLabel : e.formatLabel, k = J ? e.formatMicroLabel ?? e.formatLabel : e.formatLabel, Ie = e.mode === "vernier" ? e.macroRange[0].getTime() : void 0, Lt = e.mode === "vernier" ? e.macroRange[1].getTime() : void 0, ht = me?.getTime(), et = ze?.getTime(), [Le, or] = he(null), bt = j(null);
|
|
349
|
+
bt.current = Le;
|
|
350
|
+
const [Pe, ir] = he("micro-high"), $e = Y(() => re(z, r), [B, z]), Rt = Y(() => {
|
|
351
|
+
const i = re(z, n);
|
|
352
|
+
if (J && i <= $e)
|
|
353
|
+
throw new RangeError(`PeriodSlider: macroUnit "${z}" cannot distinguish minDate from maxDate (minDate: ${ve(r)}, maxDate: ${ve(n)})`);
|
|
354
|
+
return i;
|
|
355
|
+
}, [J, B, E, $e, z]), He = Y(() => J ? Qt(Mr, z, r, n) : [], [J, Mr, z, B, E]), _e = Y(() => e.mode !== "vernier" ? $e : re(z, e.macroRange[0]), [e.mode, Ie, $e, z]), Xe = Y(() => e.mode !== "vernier" ? Rt : re(z, e.macroRange[1]), [e.mode, Lt, Rt, z]), we = Y(() => e.mode !== "vernier" ? re(N, r) : Math.max(re(N, e.macroRange[0]), re(N, r)), [e.mode, Ie, N, B]), Oe = Y(() => e.mode !== "vernier" ? re(N, n) : Math.min(re(N, yt(z, N, e.macroRange[1])), re(N, n)), [e.mode, Lt, z, N, E]), Fe = Y(() => J ? Qt(xr, N, r, n).filter((l) => {
|
|
356
|
+
const u = re(N, l);
|
|
357
|
+
return u >= we && u <= Oe;
|
|
358
|
+
}) : [], [J, xr, N, B, E, we, Oe]), Me = Y(() => ae === null ? we : re(N, ae[0]), [ht, we, N, ae]), xe = Y(() => ae === null ? Oe : re(N, ae[1]), [et, Oe, N, ae]), Ut = Y(() => ce(N, Me), [N, Me]), Bt = Y(() => ce(N, xe), [N, xe]), zt = Math.max(1, Rt - $e), ye = Math.max(0, Math.min(1, (_e - $e) / zt)), Ne = Math.max(ye, Math.min(1, (Xe - $e) / zt)), _t = Math.max(1, Oe - we), Ke = Math.max(0, Math.min(1, (Me - we) / _t)), wt = Math.max(Ke, Math.min(1, (xe - we) / _t)), yr = j({ timerId: null, emit: null }), Tr = j({ timerId: null, emit: null }), Lr = j({ timerId: null, emit: null });
|
|
359
|
+
xt(() => {
|
|
360
|
+
const i = [yr, Tr, Lr];
|
|
361
|
+
return () => {
|
|
362
|
+
for (const l of i)
|
|
363
|
+
Cr(l.current);
|
|
364
|
+
};
|
|
619
365
|
}, []);
|
|
620
|
-
const
|
|
621
|
-
(i
|
|
622
|
-
|
|
623
|
-
|
|
366
|
+
const St = U((i, l, u) => {
|
|
367
|
+
Cr(i);
|
|
368
|
+
const { debounceMs: b } = y.current;
|
|
369
|
+
if (u || !b || b <= 0) {
|
|
370
|
+
l();
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
i.emit = l, i.timerId = setTimeout(() => {
|
|
374
|
+
i.timerId = null, i.emit = null, l();
|
|
375
|
+
}, b);
|
|
376
|
+
}, []), Rr = U((i) => {
|
|
377
|
+
const l = i.emit;
|
|
378
|
+
Cr(i), l?.();
|
|
379
|
+
}, []), $t = U((i) => new Date(Math.min(Math.max(i.getTime(), B), E)), [B, E]), zr = j(null), qe = U(
|
|
380
|
+
(i, l, u = !1) => {
|
|
381
|
+
const b = ne(i), R = ne(l), ee = y.current.mode === "point" ? `${b.getTime()}` : `${b.getTime()}-${R.getTime()}`;
|
|
382
|
+
if (ee === zr.current && yr.current.timerId === null)
|
|
624
383
|
return;
|
|
625
|
-
const
|
|
626
|
-
|
|
384
|
+
const ie = () => {
|
|
385
|
+
zr.current = ee;
|
|
386
|
+
const V = y.current;
|
|
387
|
+
V.mode === "point" ? V.onChangePoint?.(b) : V.mode === "range" && V.onChangeRange?.(b, R);
|
|
627
388
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
389
|
+
St(yr.current, ie, u);
|
|
390
|
+
},
|
|
391
|
+
[ne, St]
|
|
392
|
+
), kt = U(
|
|
393
|
+
(i, l, u = !1) => {
|
|
394
|
+
if (y.current.mode !== "vernier") return;
|
|
395
|
+
const b = $t(i), R = $t(l);
|
|
396
|
+
St(
|
|
397
|
+
Tr.current,
|
|
398
|
+
() => {
|
|
399
|
+
const ee = y.current;
|
|
400
|
+
ee.mode === "vernier" && ee.onChangeMacroRange?.(b, R);
|
|
401
|
+
},
|
|
402
|
+
u
|
|
403
|
+
);
|
|
404
|
+
},
|
|
405
|
+
[$t, St]
|
|
406
|
+
), tt = U(
|
|
407
|
+
(i, l, u = !1) => {
|
|
408
|
+
const b = y.current;
|
|
409
|
+
if (b.mode !== "vernier") return;
|
|
410
|
+
const R = $t(i), ee = $t(l);
|
|
411
|
+
b.microRange === void 0 && te([R, ee]), St(
|
|
412
|
+
Lr.current,
|
|
413
|
+
() => {
|
|
414
|
+
const ie = y.current;
|
|
415
|
+
ie.mode === "vernier" && ie.onChangeMicroRange?.(R, ee);
|
|
416
|
+
},
|
|
417
|
+
u
|
|
418
|
+
);
|
|
631
419
|
},
|
|
632
|
-
[
|
|
633
|
-
),
|
|
420
|
+
[$t, St]
|
|
421
|
+
), lr = U(
|
|
634
422
|
(i) => {
|
|
635
|
-
if (
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
638
|
-
const
|
|
639
|
-
return Math.max(0, Math.min(100, (
|
|
423
|
+
if (L && s === "time" && m.length > 1) {
|
|
424
|
+
const b = Math.max(0, Math.min(m.length - 1, Math.round(i))), R = m[0].getTime(), ie = m[m.length - 1].getTime() - R;
|
|
425
|
+
if (ie <= 0) return 0;
|
|
426
|
+
const V = m[b].getTime();
|
|
427
|
+
return Math.max(0, Math.min(100, (V - R) / ie * 100));
|
|
640
428
|
}
|
|
641
|
-
const
|
|
642
|
-
if (
|
|
643
|
-
const
|
|
644
|
-
return Math.max(0, Math.min(100,
|
|
429
|
+
const l = H - S;
|
|
430
|
+
if (l <= 0) return 0;
|
|
431
|
+
const u = (i - S) / l * 100;
|
|
432
|
+
return Math.max(0, Math.min(100, u));
|
|
645
433
|
},
|
|
646
|
-
[
|
|
647
|
-
),
|
|
434
|
+
[L, s, m, S, H]
|
|
435
|
+
), sr = U(
|
|
648
436
|
(i) => {
|
|
649
|
-
const
|
|
650
|
-
if (
|
|
651
|
-
if (s === "time" &&
|
|
652
|
-
const
|
|
653
|
-
return
|
|
437
|
+
const l = Math.max(0, Math.min(100, i));
|
|
438
|
+
if (L) {
|
|
439
|
+
if (s === "time" && m.length > 1) {
|
|
440
|
+
const R = m[0].getTime(), ie = m[m.length - 1].getTime() - R, V = R + l / 100 * ie;
|
|
441
|
+
return ut(m, new Date(V), t);
|
|
654
442
|
}
|
|
655
|
-
const
|
|
656
|
-
return Math.max(0, Math.min(
|
|
443
|
+
const b = Math.round(l / 100 * (m.length - 1));
|
|
444
|
+
return Math.max(0, Math.min(m.length - 1, b));
|
|
657
445
|
}
|
|
658
|
-
const
|
|
659
|
-
return Math.round(
|
|
446
|
+
const u = S + l / 100 * (H - S);
|
|
447
|
+
return Math.round(u);
|
|
660
448
|
},
|
|
661
|
-
[
|
|
662
|
-
),
|
|
663
|
-
|
|
664
|
-
const i =
|
|
449
|
+
[L, s, m, S, H, t]
|
|
450
|
+
), rt = j(null), [_r, Xr] = he(0), [Ln, vt] = mn(), [Rn, cr] = mn();
|
|
451
|
+
xt(() => {
|
|
452
|
+
const i = rt.current;
|
|
665
453
|
if (!i) return;
|
|
666
|
-
const
|
|
667
|
-
const
|
|
668
|
-
|
|
454
|
+
const l = () => {
|
|
455
|
+
const u = i.getBoundingClientRect(), b = c ? u.height : u.width;
|
|
456
|
+
b > 0 && Xr((R) => Math.abs(R - b) < 0.5 ? R : b);
|
|
669
457
|
};
|
|
670
|
-
if (
|
|
671
|
-
const
|
|
672
|
-
for (const
|
|
673
|
-
const
|
|
674
|
-
|
|
458
|
+
if (l(), typeof ResizeObserver < "u") {
|
|
459
|
+
const u = new ResizeObserver((b) => {
|
|
460
|
+
for (const R of b) {
|
|
461
|
+
const ee = c ? R.contentRect.height : R.contentRect.width;
|
|
462
|
+
ee > 0 && Xr((ie) => Math.abs(ie - ee) < 0.5 ? ie : ee);
|
|
675
463
|
}
|
|
676
464
|
});
|
|
677
|
-
return
|
|
465
|
+
return u.observe(i), () => u.disconnect();
|
|
678
466
|
}
|
|
679
|
-
return window.addEventListener("resize",
|
|
680
|
-
}, [
|
|
681
|
-
const
|
|
682
|
-
(i,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
const D = g.width > 0 ? g.width : 100, C = i - g.left;
|
|
688
|
-
return Math.max(0, Math.min(100, C / D * 100));
|
|
467
|
+
return window.addEventListener("resize", l), () => window.removeEventListener("resize", l);
|
|
468
|
+
}, [c]);
|
|
469
|
+
const pt = U(
|
|
470
|
+
(i, l, u) => {
|
|
471
|
+
const b = c ? u.height : u.width;
|
|
472
|
+
if (!(Number.isFinite(b) && b > 0)) return null;
|
|
473
|
+
const R = c ? u.bottom - l : i - u.left;
|
|
474
|
+
return Number.isFinite(R) ? Math.max(0, Math.min(1, R / b)) : null;
|
|
689
475
|
},
|
|
690
|
-
[
|
|
691
|
-
),
|
|
692
|
-
(i,
|
|
693
|
-
|
|
694
|
-
|
|
476
|
+
[c]
|
|
477
|
+
), Kr = U(
|
|
478
|
+
(i, l) => {
|
|
479
|
+
const u = rt.current;
|
|
480
|
+
if (!u) return null;
|
|
481
|
+
const b = pt(i, l, u.getBoundingClientRect());
|
|
482
|
+
return b === null ? null : b * 100;
|
|
483
|
+
},
|
|
484
|
+
[pt]
|
|
485
|
+
), ur = j(null), Sr = j(null), je = j(null), $r = j(null), Xt = j(null), qr = U(
|
|
695
486
|
(i) => {
|
|
696
|
-
if (
|
|
697
|
-
if (
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const
|
|
701
|
-
if (
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const Ke = gt.length - 1, Je = Math.max(0, Math.min(Ke, Math.round(wt * Ke))), et = Math.max(Je, Math.min(Ke, Math.round(Dt * Ke)));
|
|
710
|
-
ge = gt[Je] ?? /* @__PURE__ */ new Date(), Ce = gt[et] ?? /* @__PURE__ */ new Date();
|
|
487
|
+
if (o) return;
|
|
488
|
+
if (J) {
|
|
489
|
+
const v = Sr.current;
|
|
490
|
+
if (!v || i.pointerId !== 0 && i.pointerId !== v.pointerId || !rt.current) return;
|
|
491
|
+
const Ye = pt(i.clientX, i.clientY, rt.current.getBoundingClientRect());
|
|
492
|
+
if (Ye === null) return;
|
|
493
|
+
if (v.handle === "macro-low" || v.handle === "macro-high" || v.handle === "macro-connect") {
|
|
494
|
+
const [Dt, Kt, nt] = ta(v.handle, Ye, v.startPointerRatio, v.startMacroLowRatio, v.startMacroHighRatio);
|
|
495
|
+
nt !== bt.current && (bt.current = nt, or(nt), ir(nt));
|
|
496
|
+
let Te, Ve;
|
|
497
|
+
if (Vt && He.length > 0) {
|
|
498
|
+
const Ge = He.length - 1, ot = Math.max(0, Math.min(Ge, Math.round(Dt * Ge))), st = Math.max(ot, Math.min(Ge, Math.round(Kt * Ge)));
|
|
499
|
+
Te = He[ot], Ve = He[st];
|
|
711
500
|
} else {
|
|
712
|
-
const
|
|
713
|
-
|
|
501
|
+
const Ge = Math.round($e + Dt * zt), ot = Math.round($e + Kt * zt);
|
|
502
|
+
Te = ce(z, Ge), Ve = ce(z, ot);
|
|
714
503
|
}
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
let
|
|
718
|
-
if (
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
if (
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
} else if (
|
|
725
|
-
const
|
|
726
|
-
|
|
504
|
+
const qt = `${Te.getTime()}_${Ve.getTime()}`;
|
|
505
|
+
qt !== $r.current && ($r.current = qt, kt(Te, Ve));
|
|
506
|
+
let Ue, at;
|
|
507
|
+
if (v.handle === "macro-connect") {
|
|
508
|
+
const Ge = We(N, Te), ot = yt(z, N, Ve);
|
|
509
|
+
let st, At;
|
|
510
|
+
if (z === "year") {
|
|
511
|
+
const ct = Te.getFullYear() - v.startMacroLowDate.getFullYear();
|
|
512
|
+
st = ke("year", v.initialMicroLowDate, ct), At = ke("year", v.initialMicroHighDate, ct);
|
|
513
|
+
} else if (z === "month") {
|
|
514
|
+
const ct = (Te.getFullYear() - v.startMacroLowDate.getFullYear()) * 12 + (Te.getMonth() - v.startMacroLowDate.getMonth());
|
|
515
|
+
st = ke("month", v.initialMicroLowDate, ct), At = ke("month", v.initialMicroHighDate, ct);
|
|
727
516
|
} else {
|
|
728
|
-
const
|
|
729
|
-
|
|
517
|
+
const ct = Math.round((Te.getTime() - v.startMacroLowDate.getTime()) / 864e5);
|
|
518
|
+
st = ke("day", v.initialMicroLowDate, ct), At = ke("day", v.initialMicroHighDate, ct);
|
|
730
519
|
}
|
|
731
|
-
const
|
|
732
|
-
let
|
|
733
|
-
|
|
520
|
+
const Ct = Ge.getTime(), jt = ot.getTime(), on = v.initialMicroHighDate.getTime() - v.initialMicroLowDate.getTime();
|
|
521
|
+
let Gt = st.getTime(), Wt = At.getTime();
|
|
522
|
+
Gt < Ct && (Gt = Ct, Wt = Math.min(jt, Gt + on)), Wt > jt && (Wt = jt, Gt = Math.max(Ct, Wt - on)), Ue = We(N, new Date(Gt)), at = We(N, new Date(Wt));
|
|
734
523
|
} else {
|
|
735
|
-
const
|
|
736
|
-
|
|
524
|
+
const Ge = Te.getTime(), ot = yt(z, N, Ve).getTime(), st = v.initialMicroLowDate.getTime(), At = v.initialMicroHighDate.getTime(), Ct = Math.max(Ge, Math.min(ot, st)), jt = Math.max(Ct, Math.min(ot, At));
|
|
525
|
+
Ue = We(N, new Date(Ct)), at = We(N, new Date(jt));
|
|
737
526
|
}
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
} else if (
|
|
741
|
-
const [
|
|
742
|
-
|
|
743
|
-
let
|
|
744
|
-
if (
|
|
745
|
-
const
|
|
746
|
-
|
|
527
|
+
const hr = `${Ue.getTime()}_${at.getTime()}`;
|
|
528
|
+
hr !== Xt.current && (Xt.current = hr, tt(Ue, at));
|
|
529
|
+
} else if (v.handle === "micro-low" || v.handle === "micro-high" || v.handle === "micro-connect") {
|
|
530
|
+
const [Dt, Kt, nt] = ra(v.handle, Ye, v.startPointerRatio, v.startMicroLowRatio, v.startMicroHighRatio);
|
|
531
|
+
nt !== bt.current && (bt.current = nt, or(nt), ir(nt));
|
|
532
|
+
let Te, Ve;
|
|
533
|
+
if (it && Fe.length > 0) {
|
|
534
|
+
const Ue = Fe.length - 1, at = Math.max(0, Math.min(Ue, Math.round(Dt * Ue))), hr = Math.max(at, Math.min(Ue, Math.round(Kt * Ue)));
|
|
535
|
+
Te = Fe[at], Ve = Fe[hr];
|
|
747
536
|
} else {
|
|
748
|
-
const
|
|
749
|
-
|
|
537
|
+
const Ue = Math.round(we + Dt * _t), at = Math.round(we + Kt * _t);
|
|
538
|
+
Te = ce(N, Ue), Ve = ce(N, at);
|
|
750
539
|
}
|
|
751
|
-
const
|
|
752
|
-
|
|
540
|
+
const qt = `${Te.getTime()}_${Ve.getTime()}`;
|
|
541
|
+
qt !== Xt.current && (Xt.current = qt, tt(Te, Ve));
|
|
753
542
|
}
|
|
754
543
|
return;
|
|
755
544
|
}
|
|
756
|
-
const
|
|
757
|
-
if (!
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
if (
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
545
|
+
const l = ur.current;
|
|
546
|
+
if (!l || i.pointerId !== 0 && i.pointerId !== l.pointerId || !rt.current) return;
|
|
547
|
+
const u = rt.current.getBoundingClientRect(), b = c ? i.clientY : i.clientX, R = c ? u.height : u.width;
|
|
548
|
+
if (!(Number.isFinite(R) && R > 0)) return;
|
|
549
|
+
if (l.handle === "connect") {
|
|
550
|
+
const v = c ? (l.startPointerPos - b) / R : (b - l.startPointerPos) / R, Ye = Gn({
|
|
551
|
+
posDiffPct: v,
|
|
552
|
+
startLowVal: l.startLowVal,
|
|
553
|
+
startHighVal: l.startHighVal,
|
|
554
|
+
rangeMin: S,
|
|
555
|
+
rangeMax: H,
|
|
556
|
+
isDiscrete: L,
|
|
557
|
+
sortedAllowedDates: m,
|
|
558
|
+
snapMode: s,
|
|
559
|
+
unit: t
|
|
560
|
+
});
|
|
561
|
+
if (je.current && je.current[0] === Ye[0] && je.current[1] === Ye[1])
|
|
562
|
+
return;
|
|
563
|
+
je.current = Ye, de(Ye), qe(Ye[0], Ye[1], !1);
|
|
767
564
|
return;
|
|
768
565
|
}
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
|
|
772
|
-
|
|
566
|
+
const ee = pt(i.clientX, i.clientY, u);
|
|
567
|
+
if (ee === null) return;
|
|
568
|
+
const ie = sr(ee * 100), [V, q] = dn(l.handle, ie, l.startLowVal, l.startHighVal, S, H, P);
|
|
569
|
+
if ((!je.current || je.current[0] !== V || je.current[1] !== q) && (je.current = [V, q], de([V, q]), qe(V, q, !1)), !P && (l.handle === "low" || l.handle === "high")) {
|
|
570
|
+
const v = jn(l.handle, ie, l.startLowVal, l.startHighVal, P);
|
|
571
|
+
Ee.current !== v && (Ee.current = v, be(v), se(v));
|
|
773
572
|
}
|
|
774
573
|
},
|
|
775
574
|
[
|
|
776
|
-
d,
|
|
777
575
|
o,
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
576
|
+
J,
|
|
577
|
+
c,
|
|
578
|
+
z,
|
|
579
|
+
N,
|
|
580
|
+
Vt,
|
|
581
|
+
it,
|
|
582
|
+
He,
|
|
583
|
+
Fe,
|
|
584
|
+
$e,
|
|
585
|
+
zt,
|
|
586
|
+
we,
|
|
587
|
+
_t,
|
|
588
|
+
S,
|
|
589
|
+
H,
|
|
590
|
+
L,
|
|
591
|
+
m,
|
|
592
|
+
s,
|
|
593
|
+
t,
|
|
594
|
+
pt,
|
|
595
|
+
sr,
|
|
596
|
+
qe,
|
|
597
|
+
kt,
|
|
598
|
+
tt,
|
|
599
|
+
P
|
|
797
600
|
]
|
|
798
|
-
),
|
|
601
|
+
), jr = U(
|
|
799
602
|
(i) => {
|
|
800
|
-
if (
|
|
801
|
-
|
|
603
|
+
if (J) {
|
|
604
|
+
$r.current = null, Xt.current = null, Sr.current = null, bt.current = null, or(null), Rr(Tr.current), Rr(Lr.current);
|
|
802
605
|
return;
|
|
803
606
|
}
|
|
804
|
-
const
|
|
805
|
-
if (!
|
|
806
|
-
const
|
|
807
|
-
|
|
607
|
+
const l = ur.current;
|
|
608
|
+
if (!l || i.pointerId !== 0 && i.pointerId !== l.pointerId) return;
|
|
609
|
+
const u = je.current ?? G;
|
|
610
|
+
u && (qe(u[0], u[1], !0), F(u)), je.current = null, de(null), ur.current = null, Ee.current = null, be(null);
|
|
808
611
|
},
|
|
809
|
-
[
|
|
810
|
-
),
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
if (!
|
|
817
|
-
const i = (
|
|
818
|
-
return window.addEventListener("pointermove", i), window.addEventListener("pointerup",
|
|
819
|
-
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup",
|
|
612
|
+
[J, G, qe, Rr]
|
|
613
|
+
), Gr = j(qr);
|
|
614
|
+
Gr.current = qr;
|
|
615
|
+
const Wr = j(jr);
|
|
616
|
+
Wr.current = jr;
|
|
617
|
+
const Jr = $ !== null || Le !== null;
|
|
618
|
+
xt(() => {
|
|
619
|
+
if (!Jr) return;
|
|
620
|
+
const i = (u) => Gr.current(u), l = (u) => Wr.current(u);
|
|
621
|
+
return window.addEventListener("pointermove", i), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", l), () => {
|
|
622
|
+
window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l);
|
|
820
623
|
};
|
|
821
|
-
}, [
|
|
822
|
-
const
|
|
823
|
-
(i,
|
|
824
|
-
|
|
624
|
+
}, [Jr]);
|
|
625
|
+
const kr = U(
|
|
626
|
+
(i, l, u) => {
|
|
627
|
+
ur.current = {
|
|
825
628
|
pointerId: i,
|
|
826
|
-
handle:
|
|
827
|
-
startPointerPos:
|
|
828
|
-
startLowVal:
|
|
829
|
-
startHighVal:
|
|
830
|
-
}, Ee.current =
|
|
629
|
+
handle: l,
|
|
630
|
+
startPointerPos: u,
|
|
631
|
+
startLowVal: fe,
|
|
632
|
+
startHighVal: ge
|
|
633
|
+
}, Ee.current = l, be(l), l !== "connect" && se(l);
|
|
831
634
|
},
|
|
832
|
-
[
|
|
833
|
-
),
|
|
834
|
-
(i,
|
|
835
|
-
const
|
|
836
|
-
|
|
635
|
+
[fe, ge]
|
|
636
|
+
), Zr = U(
|
|
637
|
+
(i, l, u) => {
|
|
638
|
+
const b = y.current;
|
|
639
|
+
b.mode === "vernier" && (Sr.current = {
|
|
837
640
|
pointerId: i,
|
|
838
|
-
handle:
|
|
839
|
-
startPointerRatio:
|
|
840
|
-
startMacroLowRatio:
|
|
841
|
-
startMacroHighRatio:
|
|
842
|
-
startMicroLowRatio:
|
|
843
|
-
startMicroHighRatio:
|
|
641
|
+
handle: l,
|
|
642
|
+
startPointerRatio: u,
|
|
643
|
+
startMacroLowRatio: ye,
|
|
644
|
+
startMacroHighRatio: Ne,
|
|
645
|
+
startMicroLowRatio: Ke,
|
|
646
|
+
startMicroHighRatio: wt,
|
|
844
647
|
startMacroLowEnc: _e,
|
|
845
|
-
startMacroHighEnc:
|
|
846
|
-
startMicroLowEnc:
|
|
847
|
-
startMicroHighEnc:
|
|
848
|
-
startMacroLowDate:
|
|
849
|
-
startMacroHighDate:
|
|
850
|
-
initialMicroLowDate:
|
|
851
|
-
initialMicroHighDate:
|
|
852
|
-
},
|
|
648
|
+
startMacroHighEnc: Xe,
|
|
649
|
+
startMicroLowEnc: Me,
|
|
650
|
+
startMicroHighEnc: xe,
|
|
651
|
+
startMacroLowDate: b.macroRange[0],
|
|
652
|
+
startMacroHighDate: b.macroRange[1],
|
|
653
|
+
initialMicroLowDate: Ut,
|
|
654
|
+
initialMicroHighDate: Bt
|
|
655
|
+
}, bt.current = l, or(l), ir(l));
|
|
853
656
|
},
|
|
854
|
-
[
|
|
855
|
-
),
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
},
|
|
861
|
-
if (
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
657
|
+
[ye, Ne, Ke, wt, _e, Xe, Me, xe, Ut, Bt]
|
|
658
|
+
), Qr = (i) => (l) => {
|
|
659
|
+
if (o) return;
|
|
660
|
+
l.stopPropagation(), l.preventDefault(), se(i);
|
|
661
|
+
const u = c ? l.clientY : l.clientX;
|
|
662
|
+
kr(l.pointerId, i, u);
|
|
663
|
+
}, Pt = (i) => (l) => {
|
|
664
|
+
if (o) return;
|
|
665
|
+
l.stopPropagation(), l.preventDefault();
|
|
666
|
+
const u = rt.current;
|
|
667
|
+
if (!u) return;
|
|
668
|
+
const b = pt(l.clientX, l.clientY, u.getBoundingClientRect());
|
|
669
|
+
b !== null && Zr(l.pointerId, i, b);
|
|
670
|
+
}, Sn = (i) => {
|
|
671
|
+
if (o || p) return;
|
|
866
672
|
i.stopPropagation(), i.preventDefault();
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
},
|
|
870
|
-
if (
|
|
871
|
-
if (
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
673
|
+
const l = c ? i.clientY : i.clientX;
|
|
674
|
+
kr(i.pointerId, "connect", l);
|
|
675
|
+
}, $n = (i) => {
|
|
676
|
+
if (o) return;
|
|
677
|
+
if (J) {
|
|
678
|
+
const V = rt.current;
|
|
679
|
+
if (!V) return;
|
|
680
|
+
const q = V.getBoundingClientRect(), v = pt(i.clientX, i.clientY, q);
|
|
681
|
+
if (v === null) return;
|
|
682
|
+
const Ye = c ? i.clientX - (q.left + q.width / 2) : i.clientY - (q.top + q.height / 2), Dt = ea(v, Ye, ye, Ne, Ke, wt, gt);
|
|
683
|
+
Zr(i.pointerId, Dt, v);
|
|
875
684
|
return;
|
|
876
685
|
}
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
686
|
+
const l = Kr(i.clientX, i.clientY);
|
|
687
|
+
if (l === null) return;
|
|
688
|
+
const u = sr(l);
|
|
689
|
+
let b = "low";
|
|
690
|
+
if (!P) {
|
|
691
|
+
const V = Math.abs(u - fe), q = Math.abs(u - ge);
|
|
692
|
+
V < q ? b = "low" : q < V ? b = "high" : b = u > ge ? "high" : "low";
|
|
882
693
|
}
|
|
883
|
-
|
|
884
|
-
const [
|
|
885
|
-
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
},
|
|
889
|
-
if (
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
},
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
694
|
+
se(b);
|
|
695
|
+
const [R, ee] = dn(b, u, fe, ge, S, H, P);
|
|
696
|
+
de([R, ee]), qe(R, ee, !0);
|
|
697
|
+
const ie = c ? i.clientY : i.clientX;
|
|
698
|
+
kr(i.pointerId, b, ie);
|
|
699
|
+
}, kn = (i) => {
|
|
700
|
+
if (o || $ !== null) return;
|
|
701
|
+
const l = Kr(i.clientX, i.clientY);
|
|
702
|
+
if (l === null) return;
|
|
703
|
+
const u = sr(l);
|
|
704
|
+
ft(u), rr(lr(u));
|
|
705
|
+
}, Pn = () => {
|
|
706
|
+
ft(null), rr(null);
|
|
707
|
+
}, en = (i) => (l) => {
|
|
708
|
+
if (o) return;
|
|
709
|
+
se(i);
|
|
710
|
+
const u = Wn(l.key, i, fe, ge, S, H, P, 1);
|
|
711
|
+
u && (l.preventDefault(), ue || F(u), qe(u[0], u[1], !0));
|
|
712
|
+
}, dr = (i) => (l) => {
|
|
713
|
+
if (o || !J || e.mode !== "vernier") return;
|
|
714
|
+
ir(i);
|
|
715
|
+
let u = 0, b = !1, R = !1;
|
|
716
|
+
switch (l.key) {
|
|
904
717
|
case "ArrowRight":
|
|
905
718
|
case "ArrowUp":
|
|
906
|
-
|
|
719
|
+
u = 1;
|
|
907
720
|
break;
|
|
908
721
|
case "ArrowLeft":
|
|
909
722
|
case "ArrowDown":
|
|
910
|
-
|
|
723
|
+
u = -1;
|
|
911
724
|
break;
|
|
912
725
|
case "PageUp":
|
|
913
|
-
|
|
726
|
+
u = 5;
|
|
914
727
|
break;
|
|
915
728
|
case "PageDown":
|
|
916
|
-
|
|
729
|
+
u = -5;
|
|
917
730
|
break;
|
|
918
731
|
case "Home":
|
|
919
|
-
|
|
732
|
+
b = !0;
|
|
920
733
|
break;
|
|
921
734
|
case "End":
|
|
922
|
-
|
|
735
|
+
R = !0;
|
|
923
736
|
break;
|
|
924
737
|
default:
|
|
925
738
|
return;
|
|
926
739
|
}
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
e.onChangeMacroRange?.(y, J), e.onChangeMacroRangeTuple?.([y, J]), e.onChangeMacro?.([y, J]);
|
|
930
|
-
}, re = (y, J) => {
|
|
931
|
-
e.onChangeRange?.(y, J), e.onChangeRangeTuple?.([y, J]), e.onChangeMicroRange?.(y, J), e.onChangeMicroRangeTuple?.([y, J]), e.onChangeMicro?.([y, J]);
|
|
932
|
-
};
|
|
740
|
+
l.preventDefault();
|
|
741
|
+
const ee = Vt && He.length > 0, ie = it && Fe.length > 0;
|
|
933
742
|
if (i === "macro-low") {
|
|
934
|
-
|
|
935
|
-
|
|
743
|
+
const V = ce(z, _e), q = ce(z, Xe);
|
|
744
|
+
if (ee) {
|
|
745
|
+
kt(br(He, z, V, He[0], q, u, b, R), q, !0);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
let v;
|
|
749
|
+
b ? v = $e : R ? v = Xe : v = Math.max($e, Math.min(Xe, _e + u)), kt(ce(z, v), q, !0);
|
|
936
750
|
} else if (i === "macro-high") {
|
|
937
|
-
|
|
938
|
-
|
|
751
|
+
const V = ce(z, _e), q = ce(z, Xe);
|
|
752
|
+
if (ee) {
|
|
753
|
+
kt(V, br(He, z, q, V, He[He.length - 1], u, b, R), !0);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
let v;
|
|
757
|
+
b ? v = _e : R ? v = Rt : v = Math.max(_e, Math.min(Rt, Xe + u)), kt(V, ce(z, v), !0);
|
|
939
758
|
} else if (i === "micro-low") {
|
|
940
|
-
|
|
941
|
-
|
|
759
|
+
const V = ce(N, Me), q = ce(N, xe);
|
|
760
|
+
if (ie) {
|
|
761
|
+
tt(br(Fe, N, V, Fe[0], q, u, b, R), q, !0);
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
let v;
|
|
765
|
+
b ? v = we : R ? v = xe : v = Math.max(we, Math.min(xe, Me + u)), tt(ce(N, v), q, !0);
|
|
942
766
|
} else if (i === "micro-high") {
|
|
943
|
-
|
|
944
|
-
|
|
767
|
+
const V = ce(N, Me), q = ce(N, xe);
|
|
768
|
+
if (ie) {
|
|
769
|
+
tt(V, br(Fe, N, q, V, Fe[Fe.length - 1], u, b, R), !0);
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
let v;
|
|
773
|
+
b ? v = Me : R ? v = Oe : v = Math.max(Me, Math.min(Oe, xe + u)), tt(V, ce(N, v), !0);
|
|
945
774
|
}
|
|
946
|
-
},
|
|
775
|
+
}, Nn = U(
|
|
947
776
|
(i) => {
|
|
948
|
-
const
|
|
949
|
-
if (!
|
|
950
|
-
if (
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
} else if (
|
|
954
|
-
const
|
|
955
|
-
let
|
|
956
|
-
|
|
957
|
-
const $ = Me(E, y), be = Me(E, J);
|
|
958
|
-
c.onChangeRange?.($, be), c.onChangeRangeTuple?.([$, be]);
|
|
959
|
-
}
|
|
777
|
+
const l = y.current;
|
|
778
|
+
if (!l.disabled)
|
|
779
|
+
if (l.mode === "point") {
|
|
780
|
+
const u = Math.max(S, Math.min(H, fe + i));
|
|
781
|
+
ue || F([u, u]), qe(u, u, !0);
|
|
782
|
+
} else if (l.mode === "vernier") {
|
|
783
|
+
const u = Me, b = xe, R = we, ee = Oe, ie = b - u;
|
|
784
|
+
let V = u + i, q = b + i;
|
|
785
|
+
i < 0 && V < R ? (V = R, q = Math.min(ee, V + ie)) : i > 0 && q > ee && (q = ee, V = Math.max(R, q - ie)), (V !== u || q !== b) && tt(ce(N, V), ce(N, q), !0);
|
|
960
786
|
} else {
|
|
961
|
-
const
|
|
962
|
-
let
|
|
963
|
-
i < 0 &&
|
|
787
|
+
const u = ge - fe;
|
|
788
|
+
let b = fe + i, R = ge + i;
|
|
789
|
+
i < 0 && b < S ? (b = S, R = Math.min(H, b + u)) : i > 0 && R > H && (R = H, b = Math.max(S, R - u)), b <= R && (ue || F([b, R]), qe(b, R, !0));
|
|
964
790
|
}
|
|
965
791
|
},
|
|
966
|
-
[
|
|
967
|
-
),
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
highOffsetY: i,
|
|
976
|
-
isSlanted: !1,
|
|
977
|
-
proximity: 0
|
|
978
|
-
} : en(st, ct, oa, p, t);
|
|
979
|
-
}, [x, A, n, st, ct, oa, p, t]), Pt = we === "low" || we !== "high" && L === "low", Et = !x && (we === "high" || we !== "low" && L === "high"), Ea = R(() => n ? {
|
|
792
|
+
[fe, ge, S, H, ue, qe, tt, Me, xe, we, Oe, N]
|
|
793
|
+
), Nt = lr(fe), Yt = lr(ge), Pr = ne(fe), Nr = ne(ge), Yr = Y(() => {
|
|
794
|
+
if (P) return vt === null ? void 0 : { estimatedWidthPx: vt.widthPx, estimatedHeightPx: vt.heightPx };
|
|
795
|
+
if (!(vt === null || cr === null))
|
|
796
|
+
return {
|
|
797
|
+
estimatedWidthPx: Math.max(vt.widthPx, cr.widthPx),
|
|
798
|
+
estimatedHeightPx: Math.max(vt.heightPx, cr.heightPx)
|
|
799
|
+
};
|
|
800
|
+
}, [P, vt, cr]), Re = Y(() => P || !x || c ? yn(M, Yr) : Qn(Nt, Yt, _r, M, Yr), [P, x, c, Nt, Yt, _r, M, Yr]), mr = $ === "low" || $ !== "high" && Qe === "low", fr = !P && ($ === "high" || $ !== "low" && Qe === "high"), Yn = Y(() => c ? {
|
|
980
801
|
"--ps-tooltip-origin": "100% 50%",
|
|
981
802
|
"--ps-tooltip-tx": "0px",
|
|
982
803
|
"--ps-tooltip-ty": "-50%",
|
|
983
804
|
"--ps-tooltip-rot": "0deg"
|
|
984
805
|
} : {
|
|
985
806
|
"--ps-tooltip-origin": "50% 50%",
|
|
986
|
-
"--ps-tooltip-tx": `calc(-50% + ${
|
|
987
|
-
"--ps-tooltip-ty": `calc(-50% + ${
|
|
988
|
-
"--ps-tooltip-rot": `${
|
|
989
|
-
}, [
|
|
807
|
+
"--ps-tooltip-tx": `calc(-50% + ${Re.lowOffsetX}px)`,
|
|
808
|
+
"--ps-tooltip-ty": `calc(-50% + ${Re.lowOffsetY}px)`,
|
|
809
|
+
"--ps-tooltip-rot": `${Re.lowAngleDeg}deg`
|
|
810
|
+
}, [c, Re.lowOffsetX, Re.lowOffsetY, Re.lowAngleDeg]), An = Y(() => c ? {
|
|
990
811
|
"--ps-tooltip-origin": "100% 50%",
|
|
991
812
|
"--ps-tooltip-tx": "0px",
|
|
992
813
|
"--ps-tooltip-ty": "-50%",
|
|
993
814
|
"--ps-tooltip-rot": "0deg"
|
|
994
815
|
} : {
|
|
995
816
|
"--ps-tooltip-origin": "50% 50%",
|
|
996
|
-
"--ps-tooltip-tx": `calc(-50% + ${
|
|
997
|
-
"--ps-tooltip-ty": `calc(-50% + ${
|
|
998
|
-
"--ps-tooltip-rot": `${
|
|
999
|
-
}, [
|
|
1000
|
-
bottom: `${
|
|
1001
|
-
height: `${
|
|
817
|
+
"--ps-tooltip-tx": `calc(-50% + ${Re.highOffsetX}px)`,
|
|
818
|
+
"--ps-tooltip-ty": `calc(-50% + ${Re.highOffsetY}px)`,
|
|
819
|
+
"--ps-tooltip-rot": `${Re.highAngleDeg}deg`
|
|
820
|
+
}, [c, Re.highOffsetX, Re.highOffsetY, Re.highAngleDeg]), gr = Math.min(Nt, Yt), tn = Math.max(Nt, Yt), Cn = c ? {
|
|
821
|
+
bottom: `${gr}%`,
|
|
822
|
+
height: `${tn - gr}%`,
|
|
1002
823
|
top: "auto",
|
|
1003
824
|
left: "0",
|
|
1004
825
|
right: "0"
|
|
1005
826
|
} : {
|
|
1006
|
-
left: `${
|
|
1007
|
-
width: `${
|
|
827
|
+
left: `${gr}%`,
|
|
828
|
+
width: `${tn - gr}%`,
|
|
1008
829
|
top: "0",
|
|
1009
830
|
bottom: "0"
|
|
1010
|
-
},
|
|
831
|
+
}, En = Math.max(0.01, Ne - ye), rn = Math.max(0.06, Math.min(0.25, 0.28 * Math.sqrt(En))), In = c ? { bottom: `${Nt}%`, left: "50%", transform: "translate(-50%, 50%)", zIndex: mr ? 40 : 30 } : { left: `${Nt}%`, top: "50%", transform: "translate(-50%, -50%)", zIndex: mr ? 40 : 30 }, Hn = c ? { bottom: `${Yt}%`, left: "50%", transform: "translate(-50%, 50%)", zIndex: fr ? 40 : 30 } : { left: `${Yt}%`, top: "50%", transform: "translate(-50%, -50%)", zIndex: fr ? 40 : 30 }, On = c ? { bottom: `${Ft}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${Ft}%`, top: "50%", transform: "translate(-50%, -50%)" }, nn = De !== null ? ne(De) : null, Fn = o || (J ? Me <= we : P ? fe <= S : fe <= S && ge <= S), Vn = o || (J ? xe >= Oe : (P || fe >= H) && ge >= H), lt = o ? "cursor-not-allowed opacity-50" : "cursor-pointer", an = (i) => {
|
|
832
|
+
const l = c ? "vertical" : "horizontal", u = i === "decrease", b = la[l][i];
|
|
833
|
+
return /* @__PURE__ */ w(
|
|
834
|
+
"button",
|
|
835
|
+
{
|
|
836
|
+
type: "button",
|
|
837
|
+
className: `period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${b} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${lt}`,
|
|
838
|
+
onClick: () => Nn(u ? -1 : 1),
|
|
839
|
+
disabled: u ? Fn : Vn,
|
|
840
|
+
"aria-label": u ? W : C,
|
|
841
|
+
children: ia[l][i]
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
};
|
|
1011
845
|
return /* @__PURE__ */ le(
|
|
1012
846
|
"div",
|
|
1013
847
|
{
|
|
1014
848
|
style: e.style,
|
|
1015
|
-
className: `period-slider flex select-none items-center gap-2 ${
|
|
1016
|
-
"data-disabled":
|
|
849
|
+
className: `period-slider flex select-none items-center gap-2 ${c ? "flex-col" : "flex-row"} ${d}`,
|
|
850
|
+
"data-disabled": o ? "true" : void 0,
|
|
1017
851
|
"data-unit": t,
|
|
1018
852
|
"data-mode": e.mode,
|
|
1019
|
-
"data-orientation":
|
|
1020
|
-
"data-label-position":
|
|
1021
|
-
"data-color-scheme":
|
|
853
|
+
"data-orientation": c ? "vertical" : "horizontal",
|
|
854
|
+
"data-label-position": M,
|
|
855
|
+
"data-color-scheme": Z,
|
|
1022
856
|
children: [
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
{
|
|
1026
|
-
type: "button",
|
|
1027
|
-
className: `period-slider-stepper-btn relative after:absolute after:inset-[-10px] after:content-[''] ${n ? "period-slider-stepper-next period-slider-stepper-up" : "period-slider-stepper-prev"} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${qe}`,
|
|
1028
|
-
onClick: () => ha(n ? 1 : -1),
|
|
1029
|
-
disabled: n ? xa : Da,
|
|
1030
|
-
"aria-label": n ? "1つ後へ" : "1つ前へ",
|
|
1031
|
-
children: n ? "▲" : "◀"
|
|
1032
|
-
}
|
|
1033
|
-
),
|
|
1034
|
-
/* @__PURE__ */ T(
|
|
857
|
+
g && an(c ? "increase" : "decrease"),
|
|
858
|
+
/* @__PURE__ */ w(
|
|
1035
859
|
"div",
|
|
1036
860
|
{
|
|
1037
|
-
ref:
|
|
861
|
+
ref: rt,
|
|
1038
862
|
"data-testid": "period-slider-track",
|
|
1039
|
-
"data-orientation":
|
|
1040
|
-
"data-vernier-orientation":
|
|
1041
|
-
className: `period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${
|
|
1042
|
-
onPointerDown:
|
|
1043
|
-
onPointerMove:
|
|
1044
|
-
onPointerLeave:
|
|
1045
|
-
children:
|
|
1046
|
-
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
863
|
+
"data-orientation": c ? "vertical" : "horizontal",
|
|
864
|
+
"data-vernier-orientation": J ? gt : void 0,
|
|
865
|
+
className: `period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${c ? "h-48 w-2" : "h-2 w-full"} ${lt}`,
|
|
866
|
+
onPointerDown: $n,
|
|
867
|
+
onPointerMove: kn,
|
|
868
|
+
onPointerLeave: Pn,
|
|
869
|
+
children: J ? /* @__PURE__ */ le(ln, { children: [
|
|
870
|
+
nr && (c ? /* @__PURE__ */ le("svg", { className: "period-slider-vernier-projection is-vertical", role: "presentation", "aria-hidden": "true", width: "32", height: "100%", viewBox: "0 0 32 100", preserveAspectRatio: "none", children: [
|
|
871
|
+
/* @__PURE__ */ w("defs", { children: /* @__PURE__ */ le("linearGradient", { id: O, x1: "0", y1: "0", x2: "1", y2: "0", children: [
|
|
872
|
+
/* @__PURE__ */ w("stop", { offset: "0%", stopColor: T ? A.macro : A.micro, stopOpacity: "0.28" }),
|
|
873
|
+
/* @__PURE__ */ w("stop", { offset: "100%", stopColor: T ? A.micro : A.macro, stopOpacity: rn })
|
|
1050
874
|
] }) }),
|
|
1051
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ w("polygon", { points: T ? `12,${(1 - Ne) * 100} 12,${(1 - ye) * 100} 20,100 20,0` : `12,0 12,100 20,${(1 - ye) * 100} 20,${(1 - Ne) * 100}`, fill: `url(#${O})` })
|
|
1052
876
|
] }) : /* @__PURE__ */ le("svg", { className: "period-slider-vernier-projection", role: "presentation", "aria-hidden": "true", width: "100%", height: "32", viewBox: "0 0 100 32", preserveAspectRatio: "none", children: [
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ w("defs", { children: /* @__PURE__ */ le("linearGradient", { id: O, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
878
|
+
/* @__PURE__ */ w("stop", { offset: "0%", stopColor: T ? A.macro : A.micro, stopOpacity: "0.28" }),
|
|
879
|
+
/* @__PURE__ */ w("stop", { offset: "100%", stopColor: T ? A.micro : A.macro, stopOpacity: rn })
|
|
1056
880
|
] }) }),
|
|
1057
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ w("polygon", { points: T ? `${ye * 100},12 ${Ne * 100},12 100,20 0,20` : `0,12 100,12 ${Ne * 100},20 ${ye * 100},20`, fill: `url(#${O})` })
|
|
1058
882
|
] })),
|
|
1059
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ w(
|
|
1060
884
|
"div",
|
|
1061
885
|
{
|
|
1062
886
|
"data-testid": "period-slider-connect-macro",
|
|
1063
887
|
className: "period-slider-connect-macro",
|
|
1064
|
-
style:
|
|
1065
|
-
bottom: `calc(${
|
|
1066
|
-
height: `calc(${Math.max(0, (
|
|
888
|
+
style: c ? {
|
|
889
|
+
bottom: `calc(${ye * 100}% - 8px)`,
|
|
890
|
+
height: `calc(${Math.max(0, (Ne - ye) * 100)}% + 16px)`
|
|
1067
891
|
} : {
|
|
1068
|
-
left: `calc(${
|
|
1069
|
-
width: `calc(${Math.max(0, (
|
|
892
|
+
left: `calc(${ye * 100}% - 8px)`,
|
|
893
|
+
width: `calc(${Math.max(0, (Ne - ye) * 100)}% + 16px)`
|
|
1070
894
|
},
|
|
1071
|
-
onPointerDown:
|
|
895
|
+
onPointerDown: Pt("macro-connect")
|
|
1072
896
|
}
|
|
1073
897
|
),
|
|
1074
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ w(
|
|
1075
899
|
"div",
|
|
1076
900
|
{
|
|
1077
901
|
"data-testid": "period-slider-connect-micro",
|
|
1078
902
|
className: "period-slider-connect-micro",
|
|
1079
|
-
style:
|
|
1080
|
-
bottom: `calc(${
|
|
1081
|
-
height: `calc(${Math.max(0, (
|
|
903
|
+
style: c ? {
|
|
904
|
+
bottom: `calc(${Ke * 100}% - 8px)`,
|
|
905
|
+
height: `calc(${Math.max(0, (wt - Ke) * 100)}% + 16px)`
|
|
1082
906
|
} : {
|
|
1083
|
-
left: `calc(${
|
|
1084
|
-
width: `calc(${Math.max(0, (
|
|
907
|
+
left: `calc(${Ke * 100}% - 8px)`,
|
|
908
|
+
width: `calc(${Math.max(0, (wt - Ke) * 100)}% + 16px)`
|
|
1085
909
|
},
|
|
1086
|
-
onPointerDown:
|
|
910
|
+
onPointerDown: Pt("micro-connect")
|
|
1087
911
|
}
|
|
1088
912
|
),
|
|
1089
|
-
|
|
1090
|
-
[0.2, 0.4, 0.6, 0.8].map((i) => /* @__PURE__ */
|
|
1091
|
-
[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((i) => /* @__PURE__ */
|
|
913
|
+
ar && /* @__PURE__ */ le("div", { className: "period-slider-vernier-ticks pointer-events-none absolute inset-0", children: [
|
|
914
|
+
[0.2, 0.4, 0.6, 0.8].map((i) => /* @__PURE__ */ w("div", { "data-testid": "period-slider-tick", "data-tick-scale": "macro", className: "period-slider-tick period-slider-tick-macro", style: c ? { bottom: `${i * 100}%` } : { left: `${i * 100}%` } }, `macro-tick-${i}`)),
|
|
915
|
+
[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((i) => /* @__PURE__ */ w("div", { "data-testid": "period-slider-tick", "data-tick-scale": "micro", className: "period-slider-tick period-slider-tick-micro", style: c ? { bottom: `${i * 100}%` } : { left: `${i * 100}%` } }, `micro-tick-${i}`))
|
|
1092
916
|
] }),
|
|
1093
917
|
/* @__PURE__ */ le(
|
|
1094
918
|
"div",
|
|
1095
919
|
{
|
|
1096
|
-
tabIndex:
|
|
920
|
+
tabIndex: o ? -1 : 0,
|
|
1097
921
|
role: "slider",
|
|
1098
|
-
"aria-label": e.macroLowerAriaLabel ?? "
|
|
1099
|
-
"aria-disabled":
|
|
1100
|
-
"aria-valuemin":
|
|
1101
|
-
"aria-valuemax":
|
|
922
|
+
"aria-label": e.macroLowerAriaLabel ?? "Macro range start",
|
|
923
|
+
"aria-disabled": o ? "true" : void 0,
|
|
924
|
+
"aria-valuemin": $e,
|
|
925
|
+
"aria-valuemax": Xe,
|
|
1102
926
|
"aria-valuenow": _e,
|
|
1103
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(e.macroRange[0],
|
|
1104
|
-
"aria-orientation":
|
|
1105
|
-
className: `period-slider-handle period-slider-handle-vernier ${
|
|
1106
|
-
style:
|
|
1107
|
-
bottom: `${
|
|
1108
|
-
left:
|
|
1109
|
-
right:
|
|
1110
|
-
transform:
|
|
1111
|
-
zIndex:
|
|
927
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(e.macroRange[0], z) : Et(z, e.macroRange[0], f, D),
|
|
928
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
929
|
+
className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? T ? "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : T ? "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0" : "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${lt}`,
|
|
930
|
+
style: c ? {
|
|
931
|
+
bottom: `${ye * 100}%`,
|
|
932
|
+
left: T ? 0 : "auto",
|
|
933
|
+
right: T ? "auto" : 0,
|
|
934
|
+
transform: T ? "translate(-100%, 50%)" : "translate(100%, 50%)",
|
|
935
|
+
zIndex: Le === "macro-low" || Pe === "macro-low" ? 30 : 15
|
|
1112
936
|
} : {
|
|
1113
|
-
left: `${
|
|
1114
|
-
top:
|
|
1115
|
-
bottom:
|
|
1116
|
-
transform:
|
|
1117
|
-
zIndex:
|
|
937
|
+
left: `${ye * 100}%`,
|
|
938
|
+
top: T ? 0 : "auto",
|
|
939
|
+
bottom: T ? "auto" : 0,
|
|
940
|
+
transform: T ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
|
|
941
|
+
zIndex: Le === "macro-low" || Pe === "macro-low" ? 30 : 15
|
|
1118
942
|
},
|
|
1119
|
-
onPointerDown:
|
|
1120
|
-
onKeyDown:
|
|
1121
|
-
"data-active":
|
|
1122
|
-
"data-front":
|
|
1123
|
-
"data-vernier-pos":
|
|
943
|
+
onPointerDown: Pt("macro-low"),
|
|
944
|
+
onKeyDown: dr("macro-low"),
|
|
945
|
+
"data-active": Le === "macro-low" ? "true" : void 0,
|
|
946
|
+
"data-front": Pe === "macro-low" ? "true" : void 0,
|
|
947
|
+
"data-vernier-pos": c ? T ? "left" : "right" : T ? "top" : "bottom",
|
|
1124
948
|
"data-handle-type": "macro-low",
|
|
1125
949
|
children: [
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
|
|
1128
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ w(Jt, { type: "macro", isTop: T, isVertical: c, isLeft: T }),
|
|
951
|
+
Tt && /* @__PURE__ */ w("div", { className: "period-slider-hairline" }),
|
|
952
|
+
/* @__PURE__ */ w("div", { className: "period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800", children: Ae(z, e.macroRange[0], f, D) })
|
|
1129
953
|
]
|
|
1130
954
|
}
|
|
1131
955
|
),
|
|
1132
956
|
/* @__PURE__ */ le(
|
|
1133
957
|
"div",
|
|
1134
958
|
{
|
|
1135
|
-
tabIndex:
|
|
959
|
+
tabIndex: o ? -1 : 0,
|
|
1136
960
|
role: "slider",
|
|
1137
|
-
"aria-label": e.macroUpperAriaLabel ?? "
|
|
1138
|
-
"aria-disabled":
|
|
961
|
+
"aria-label": e.macroUpperAriaLabel ?? "Macro range end",
|
|
962
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1139
963
|
"aria-valuemin": _e,
|
|
1140
|
-
"aria-valuemax":
|
|
1141
|
-
"aria-valuenow":
|
|
1142
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(e.macroRange[1],
|
|
1143
|
-
"aria-orientation":
|
|
1144
|
-
className: `period-slider-handle period-slider-handle-vernier ${
|
|
1145
|
-
style:
|
|
1146
|
-
bottom: `${
|
|
1147
|
-
left:
|
|
1148
|
-
right:
|
|
1149
|
-
transform:
|
|
1150
|
-
zIndex:
|
|
964
|
+
"aria-valuemax": Rt,
|
|
965
|
+
"aria-valuenow": Xe,
|
|
966
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(e.macroRange[1], z) : Et(z, e.macroRange[1], f, D),
|
|
967
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
968
|
+
className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? T ? "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : T ? "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0" : "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${lt}`,
|
|
969
|
+
style: c ? {
|
|
970
|
+
bottom: `${Ne * 100}%`,
|
|
971
|
+
left: T ? 0 : "auto",
|
|
972
|
+
right: T ? "auto" : 0,
|
|
973
|
+
transform: T ? "translate(-100%, 50%)" : "translate(100%, 50%)",
|
|
974
|
+
zIndex: Le === "macro-high" || Pe === "macro-high" ? 30 : 15
|
|
1151
975
|
} : {
|
|
1152
|
-
left: `${
|
|
1153
|
-
top:
|
|
1154
|
-
bottom:
|
|
1155
|
-
transform:
|
|
1156
|
-
zIndex:
|
|
976
|
+
left: `${Ne * 100}%`,
|
|
977
|
+
top: T ? 0 : "auto",
|
|
978
|
+
bottom: T ? "auto" : 0,
|
|
979
|
+
transform: T ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
|
|
980
|
+
zIndex: Le === "macro-high" || Pe === "macro-high" ? 30 : 15
|
|
1157
981
|
},
|
|
1158
|
-
onPointerDown:
|
|
1159
|
-
onKeyDown:
|
|
1160
|
-
"data-active":
|
|
1161
|
-
"data-front":
|
|
1162
|
-
"data-vernier-pos":
|
|
982
|
+
onPointerDown: Pt("macro-high"),
|
|
983
|
+
onKeyDown: dr("macro-high"),
|
|
984
|
+
"data-active": Le === "macro-high" ? "true" : void 0,
|
|
985
|
+
"data-front": Pe === "macro-high" ? "true" : void 0,
|
|
986
|
+
"data-vernier-pos": c ? T ? "left" : "right" : T ? "top" : "bottom",
|
|
1163
987
|
"data-handle-type": "macro-high",
|
|
1164
988
|
children: [
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
|
|
1167
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ w(Jt, { type: "macro", isTop: T, isVertical: c, isLeft: T }),
|
|
990
|
+
Tt && /* @__PURE__ */ w("div", { className: "period-slider-hairline" }),
|
|
991
|
+
/* @__PURE__ */ w("div", { className: "period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800", children: Ae(z, e.macroRange[1], f, D) })
|
|
1168
992
|
]
|
|
1169
993
|
}
|
|
1170
994
|
),
|
|
1171
995
|
/* @__PURE__ */ le(
|
|
1172
996
|
"div",
|
|
1173
997
|
{
|
|
1174
|
-
tabIndex:
|
|
998
|
+
tabIndex: o ? -1 : 0,
|
|
1175
999
|
role: "slider",
|
|
1176
|
-
"aria-label": e.lowerAriaLabel ?? "
|
|
1177
|
-
"aria-disabled":
|
|
1178
|
-
"aria-valuemin":
|
|
1179
|
-
"aria-valuemax":
|
|
1180
|
-
"aria-valuenow":
|
|
1181
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(
|
|
1182
|
-
"aria-orientation":
|
|
1183
|
-
className: `period-slider-handle period-slider-handle-vernier ${
|
|
1184
|
-
style:
|
|
1185
|
-
bottom: `${
|
|
1186
|
-
left:
|
|
1187
|
-
right:
|
|
1188
|
-
transform:
|
|
1189
|
-
zIndex:
|
|
1000
|
+
"aria-label": e.lowerAriaLabel ?? "Micro range start",
|
|
1001
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1002
|
+
"aria-valuemin": we,
|
|
1003
|
+
"aria-valuemax": xe,
|
|
1004
|
+
"aria-valuenow": Me,
|
|
1005
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Ut, N) : Et(N, Ut, k, D),
|
|
1006
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
1007
|
+
className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? T ? "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : T ? "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4" : "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${lt}`,
|
|
1008
|
+
style: c ? {
|
|
1009
|
+
bottom: `${Ke * 100}%`,
|
|
1010
|
+
left: T ? "auto" : 0,
|
|
1011
|
+
right: T ? 0 : "auto",
|
|
1012
|
+
transform: T ? "translate(100%, 50%)" : "translate(-100%, 50%)",
|
|
1013
|
+
zIndex: Le === "micro-low" || Pe === "micro-low" ? 30 : 20
|
|
1190
1014
|
} : {
|
|
1191
|
-
left: `${
|
|
1192
|
-
top:
|
|
1193
|
-
bottom:
|
|
1194
|
-
transform:
|
|
1195
|
-
zIndex:
|
|
1015
|
+
left: `${Ke * 100}%`,
|
|
1016
|
+
top: T ? "auto" : 0,
|
|
1017
|
+
bottom: T ? 0 : "auto",
|
|
1018
|
+
transform: T ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
|
|
1019
|
+
zIndex: Le === "micro-low" || Pe === "micro-low" ? 30 : 20
|
|
1196
1020
|
},
|
|
1197
|
-
onPointerDown:
|
|
1198
|
-
onKeyDown:
|
|
1199
|
-
"data-active":
|
|
1200
|
-
"data-front":
|
|
1201
|
-
"data-vernier-pos":
|
|
1021
|
+
onPointerDown: Pt("micro-low"),
|
|
1022
|
+
onKeyDown: dr("micro-low"),
|
|
1023
|
+
"data-active": Le === "micro-low" ? "true" : void 0,
|
|
1024
|
+
"data-front": Pe === "micro-low" ? "true" : void 0,
|
|
1025
|
+
"data-vernier-pos": c ? T ? "right" : "left" : T ? "bottom" : "top",
|
|
1202
1026
|
"data-handle-type": "micro-low",
|
|
1203
1027
|
children: [
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
|
|
1206
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ w(Jt, { type: "micro", isTop: !T, isVertical: c, isLeft: !T }),
|
|
1029
|
+
Tt && /* @__PURE__ */ w("div", { className: "period-slider-hairline" }),
|
|
1030
|
+
/* @__PURE__ */ w("div", { className: "period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800", children: Ae(N, Ut, k, D) })
|
|
1207
1031
|
]
|
|
1208
1032
|
}
|
|
1209
1033
|
),
|
|
1210
1034
|
/* @__PURE__ */ le(
|
|
1211
1035
|
"div",
|
|
1212
1036
|
{
|
|
1213
|
-
tabIndex:
|
|
1037
|
+
tabIndex: o ? -1 : 0,
|
|
1214
1038
|
role: "slider",
|
|
1215
|
-
"aria-label": e.upperAriaLabel ?? "
|
|
1216
|
-
"aria-disabled":
|
|
1217
|
-
"aria-valuemin":
|
|
1218
|
-
"aria-valuemax":
|
|
1219
|
-
"aria-valuenow":
|
|
1220
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(
|
|
1221
|
-
"aria-orientation":
|
|
1222
|
-
className: `period-slider-handle period-slider-handle-vernier ${
|
|
1223
|
-
style:
|
|
1224
|
-
bottom: `${
|
|
1225
|
-
left:
|
|
1226
|
-
right:
|
|
1227
|
-
transform:
|
|
1228
|
-
zIndex:
|
|
1039
|
+
"aria-label": e.upperAriaLabel ?? "Micro range end",
|
|
1040
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1041
|
+
"aria-valuemin": Me,
|
|
1042
|
+
"aria-valuemax": Oe,
|
|
1043
|
+
"aria-valuenow": xe,
|
|
1044
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Bt, N) : Et(N, Bt, k, D),
|
|
1045
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
1046
|
+
className: `period-slider-handle period-slider-handle-vernier ${c ? "is-vertical" : ""} group absolute touch-none ${c ? T ? "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : T ? "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4" : "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${lt}`,
|
|
1047
|
+
style: c ? {
|
|
1048
|
+
bottom: `${wt * 100}%`,
|
|
1049
|
+
left: T ? "auto" : 0,
|
|
1050
|
+
right: T ? 0 : "auto",
|
|
1051
|
+
transform: T ? "translate(100%, 50%)" : "translate(-100%, 50%)",
|
|
1052
|
+
zIndex: Le === "micro-high" || Pe === "micro-high" ? 30 : 20
|
|
1229
1053
|
} : {
|
|
1230
|
-
left: `${
|
|
1231
|
-
top:
|
|
1232
|
-
bottom:
|
|
1233
|
-
transform:
|
|
1234
|
-
zIndex:
|
|
1054
|
+
left: `${wt * 100}%`,
|
|
1055
|
+
top: T ? "auto" : 0,
|
|
1056
|
+
bottom: T ? 0 : "auto",
|
|
1057
|
+
transform: T ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
|
|
1058
|
+
zIndex: Le === "micro-high" || Pe === "micro-high" ? 30 : 20
|
|
1235
1059
|
},
|
|
1236
|
-
onPointerDown:
|
|
1237
|
-
onKeyDown:
|
|
1238
|
-
"data-active":
|
|
1239
|
-
"data-front":
|
|
1240
|
-
"data-vernier-pos":
|
|
1060
|
+
onPointerDown: Pt("micro-high"),
|
|
1061
|
+
onKeyDown: dr("micro-high"),
|
|
1062
|
+
"data-active": Le === "micro-high" ? "true" : void 0,
|
|
1063
|
+
"data-front": Pe === "micro-high" ? "true" : void 0,
|
|
1064
|
+
"data-vernier-pos": c ? T ? "right" : "left" : T ? "bottom" : "top",
|
|
1241
1065
|
"data-handle-type": "micro-high",
|
|
1242
1066
|
children: [
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
|
|
1245
|
-
/* @__PURE__ */
|
|
1067
|
+
/* @__PURE__ */ w(Jt, { type: "micro", isTop: !T, isVertical: c, isLeft: !T }),
|
|
1068
|
+
Tt && /* @__PURE__ */ w("div", { className: "period-slider-hairline" }),
|
|
1069
|
+
/* @__PURE__ */ w("div", { className: "period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800", children: Ae(N, Bt, k, D) })
|
|
1246
1070
|
]
|
|
1247
1071
|
}
|
|
1248
1072
|
)
|
|
1249
|
-
] }) : /* @__PURE__ */ le(
|
|
1250
|
-
!
|
|
1251
|
-
|
|
1252
|
-
const
|
|
1253
|
-
return /* @__PURE__ */
|
|
1073
|
+
] }) : /* @__PURE__ */ le(ln, { children: [
|
|
1074
|
+
!p && /* @__PURE__ */ w("div", { "data-testid": "period-slider-connect", className: "period-slider-connect absolute rounded-full", style: Cn, onPointerDown: Sn }),
|
|
1075
|
+
_ && L && m.length > 1 && /* @__PURE__ */ w("div", { className: "period-slider-ticks pointer-events-none absolute inset-0", children: m.map((i, l) => {
|
|
1076
|
+
const u = re(t, i), b = lr(l), R = c ? { bottom: `${b}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${b}%`, top: "50%", transform: "translate(-50%, -50%)" };
|
|
1077
|
+
return /* @__PURE__ */ w("div", { "data-testid": "period-slider-tick", className: "period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60", style: R }, `tick-${u}`);
|
|
1254
1078
|
}) }),
|
|
1255
|
-
!
|
|
1256
|
-
/* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1079
|
+
!o && De !== null && Ft !== null && $ === null && nn && /* @__PURE__ */ le("div", { "data-testid": "period-slider-hover-guide", className: "period-slider-hover-guide pointer-events-none absolute z-20 h-2 w-2", style: On, children: [
|
|
1080
|
+
/* @__PURE__ */ w("div", { "data-testid": "period-slider-hover-dot", className: "period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800" }),
|
|
1081
|
+
/* @__PURE__ */ w(
|
|
1258
1082
|
"div",
|
|
1259
1083
|
{
|
|
1260
|
-
className: `period-slider-hover-tooltip ${
|
|
1261
|
-
children:
|
|
1084
|
+
className: `period-slider-hover-tooltip ${M === "bottom" && !c ? "period-slider-hover-tooltip-bottom" : ""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,
|
|
1085
|
+
children: Ae(t, nn, e.formatLabel, D)
|
|
1262
1086
|
}
|
|
1263
1087
|
)
|
|
1264
1088
|
] }),
|
|
1265
1089
|
/* @__PURE__ */ le(
|
|
1266
1090
|
"div",
|
|
1267
1091
|
{
|
|
1268
|
-
tabIndex:
|
|
1092
|
+
tabIndex: o ? -1 : 0,
|
|
1269
1093
|
role: "slider",
|
|
1270
|
-
"aria-label":
|
|
1271
|
-
"aria-disabled":
|
|
1272
|
-
"aria-valuemin":
|
|
1273
|
-
"aria-valuemax":
|
|
1274
|
-
"aria-valuenow":
|
|
1275
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(
|
|
1276
|
-
"aria-orientation":
|
|
1277
|
-
className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${
|
|
1278
|
-
style:
|
|
1279
|
-
onPointerDown:
|
|
1280
|
-
onKeyDown:
|
|
1281
|
-
"data-active":
|
|
1282
|
-
"data-front":
|
|
1094
|
+
"aria-label": P ? e.pointAriaLabel ?? "Selected date" : e.lowerAriaLabel ?? "Range start",
|
|
1095
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1096
|
+
"aria-valuemin": S,
|
|
1097
|
+
"aria-valuemax": P ? H : ge,
|
|
1098
|
+
"aria-valuenow": fe,
|
|
1099
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Pr, t) : Et(t, Pr, e.formatLabel, D),
|
|
1100
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
1101
|
+
className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${lt}`,
|
|
1102
|
+
style: In,
|
|
1103
|
+
onPointerDown: Qr("low"),
|
|
1104
|
+
onKeyDown: en("low"),
|
|
1105
|
+
"data-active": $ === "low" ? "true" : void 0,
|
|
1106
|
+
"data-front": mr ? "true" : void 0,
|
|
1283
1107
|
children: [
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
|
|
1108
|
+
/* @__PURE__ */ w(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
"data-testid": "period-slider-knob",
|
|
1112
|
+
className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${$ === "low" ? "" : "shadow-md"}`
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
h !== "hover" && /* @__PURE__ */ w(
|
|
1286
1116
|
"div",
|
|
1287
1117
|
{
|
|
1288
|
-
className: `period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${
|
|
1289
|
-
"data-tooltip-style":
|
|
1290
|
-
"data-label-position":
|
|
1291
|
-
"data-slanted":
|
|
1292
|
-
"data-front":
|
|
1293
|
-
|
|
1294
|
-
|
|
1118
|
+
className: `period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
|
|
1119
|
+
"data-tooltip-style": h,
|
|
1120
|
+
"data-label-position": M,
|
|
1121
|
+
"data-slanted": Re.isSlanted ? "true" : void 0,
|
|
1122
|
+
"data-front": mr ? "true" : void 0,
|
|
1123
|
+
ref: Ln,
|
|
1124
|
+
style: Yn,
|
|
1125
|
+
children: Ae(t, Pr, e.formatLabel, D)
|
|
1295
1126
|
}
|
|
1296
1127
|
)
|
|
1297
1128
|
]
|
|
1298
1129
|
}
|
|
1299
1130
|
),
|
|
1300
|
-
!
|
|
1131
|
+
!P && /* @__PURE__ */ le(
|
|
1301
1132
|
"div",
|
|
1302
1133
|
{
|
|
1303
|
-
tabIndex:
|
|
1134
|
+
tabIndex: o ? -1 : 0,
|
|
1304
1135
|
role: "slider",
|
|
1305
|
-
"aria-label": e.upperAriaLabel ?? "
|
|
1306
|
-
"aria-disabled":
|
|
1307
|
-
"aria-valuemin":
|
|
1308
|
-
"aria-valuemax":
|
|
1309
|
-
"aria-valuenow":
|
|
1310
|
-
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(
|
|
1311
|
-
"aria-orientation":
|
|
1312
|
-
className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${
|
|
1313
|
-
style:
|
|
1314
|
-
onPointerDown:
|
|
1315
|
-
onKeyDown:
|
|
1316
|
-
"data-active":
|
|
1317
|
-
"data-front":
|
|
1136
|
+
"aria-label": e.upperAriaLabel ?? "Range end",
|
|
1137
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1138
|
+
"aria-valuemin": fe,
|
|
1139
|
+
"aria-valuemax": H,
|
|
1140
|
+
"aria-valuenow": ge,
|
|
1141
|
+
"aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Nr, t) : Et(t, Nr, e.formatLabel, D),
|
|
1142
|
+
"aria-orientation": c ? "vertical" : "horizontal",
|
|
1143
|
+
className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${lt}`,
|
|
1144
|
+
style: Hn,
|
|
1145
|
+
onPointerDown: Qr("high"),
|
|
1146
|
+
onKeyDown: en("high"),
|
|
1147
|
+
"data-active": $ === "high" ? "true" : void 0,
|
|
1148
|
+
"data-front": fr ? "true" : void 0,
|
|
1318
1149
|
children: [
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
m !== "hover" && /* @__PURE__ */ T(
|
|
1150
|
+
/* @__PURE__ */ w(
|
|
1321
1151
|
"div",
|
|
1322
1152
|
{
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1153
|
+
"data-testid": "period-slider-knob",
|
|
1154
|
+
className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${$ === "high" ? "" : "shadow-md"}`
|
|
1155
|
+
}
|
|
1156
|
+
),
|
|
1157
|
+
h !== "hover" && /* @__PURE__ */ w(
|
|
1158
|
+
"div",
|
|
1159
|
+
{
|
|
1160
|
+
className: `period-slider-tooltip absolute whitespace-nowrap rounded bg-slate-900 px-2 py-0.5 font-medium text-white text-xs shadow-md dark:bg-slate-800 ${h === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
|
|
1161
|
+
"data-tooltip-style": h,
|
|
1162
|
+
"data-label-position": M,
|
|
1163
|
+
"data-slanted": Re.isSlanted ? "true" : void 0,
|
|
1164
|
+
"data-front": fr ? "true" : void 0,
|
|
1165
|
+
ref: Rn,
|
|
1166
|
+
style: An,
|
|
1167
|
+
children: Ae(t, Nr, e.formatLabel, D)
|
|
1330
1168
|
}
|
|
1331
1169
|
)
|
|
1332
1170
|
]
|
|
@@ -1335,436 +1173,858 @@ const rn = (e) => {
|
|
|
1335
1173
|
] })
|
|
1336
1174
|
}
|
|
1337
1175
|
),
|
|
1338
|
-
|
|
1339
|
-
"button",
|
|
1340
|
-
{
|
|
1341
|
-
type: "button",
|
|
1342
|
-
className: `period-slider-stepper-btn relative after:absolute after:inset-[-10px] after:content-[''] ${n ? "period-slider-stepper-prev period-slider-stepper-down" : "period-slider-stepper-next"} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${qe}`,
|
|
1343
|
-
onClick: () => ha(n ? -1 : 1),
|
|
1344
|
-
disabled: n ? Da : xa,
|
|
1345
|
-
"aria-label": n ? "1つ前へ" : "1つ後へ",
|
|
1346
|
-
children: n ? "▼" : "▶"
|
|
1347
|
-
}
|
|
1348
|
-
)
|
|
1176
|
+
g && an(c ? "decrease" : "increase")
|
|
1349
1177
|
]
|
|
1350
1178
|
}
|
|
1351
1179
|
);
|
|
1352
|
-
},
|
|
1180
|
+
}, Er = (e, t) => {
|
|
1353
1181
|
if (e === t) return !0;
|
|
1354
1182
|
if (!(e && t) || e.length !== t.length) return !1;
|
|
1355
|
-
for (let
|
|
1356
|
-
if (e[
|
|
1183
|
+
for (let r = 0; r < e.length; r++)
|
|
1184
|
+
if (e[r].getTime() !== t[r].getTime()) return !1;
|
|
1357
1185
|
return !0;
|
|
1358
|
-
},
|
|
1186
|
+
}, ca = (e, t) => {
|
|
1359
1187
|
if (e === t) return !0;
|
|
1360
1188
|
if (!(e && t)) return !1;
|
|
1361
|
-
const
|
|
1362
|
-
if (
|
|
1363
|
-
for (const
|
|
1364
|
-
if (e[
|
|
1189
|
+
const r = Object.keys(e), n = Object.keys(t);
|
|
1190
|
+
if (r.length !== n.length) return !1;
|
|
1191
|
+
for (const a of r)
|
|
1192
|
+
if (e[a] !== t[a]) return !1;
|
|
1365
1193
|
return !0;
|
|
1366
|
-
},
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
return
|
|
1384
|
-
},
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1194
|
+
}, ua = (e, t) => e === t ? !0 : e.mode !== t.mode || e.unit !== t.unit || e.minDate.getTime() !== t.minDate.getTime() || e.maxDate.getTime() !== t.maxDate.getTime() || e.labelPosition !== t.labelPosition || e.autoSlantLabels !== t.autoSlantLabels || e.isVertical !== t.isVertical || e.hideConnectBar !== t.hideConnectBar || e.showTicks !== t.showTicks || e.disabled !== t.disabled || e.showStepper !== t.showStepper || e.debounceMs !== t.debounceMs || e.tooltipStyle !== t.tooltipStyle || e.colorScheme !== t.colorScheme || e.className !== t.className || !ca(e.style, t.style) || e.snapMode !== t.snapMode || e.formatLabel !== t.formatLabel || e.locale !== t.locale || e.lowerAriaLabel !== t.lowerAriaLabel || e.upperAriaLabel !== t.upperAriaLabel || e.pointAriaLabel !== t.pointAriaLabel || e.macroLowerAriaLabel !== t.macroLowerAriaLabel || e.macroUpperAriaLabel !== t.macroUpperAriaLabel || e.decreaseAriaLabel !== t.decreaseAriaLabel || e.increaseAriaLabel !== t.increaseAriaLabel || e.formatAriaValueText !== t.formatAriaValueText || !Er(e.allowedDates, t.allowedDates) ? !1 : e.mode === "point" && t.mode === "point" ? !((e.value?.getTime() ?? null) !== (t.value?.getTime() ?? null) || (e.defaultValue?.getTime() ?? null) !== (t.defaultValue?.getTime() ?? null) || e.onChangePoint !== t.onChangePoint) : e.mode === "range" && t.mode === "range" ? !((e.range?.[0]?.getTime() ?? null) !== (t.range?.[0]?.getTime() ?? null) || (e.range?.[1]?.getTime() ?? null) !== (t.range?.[1]?.getTime() ?? null) || (e.defaultRange?.[0]?.getTime() ?? null) !== (t.defaultRange?.[0]?.getTime() ?? null) || (e.defaultRange?.[1]?.getTime() ?? null) !== (t.defaultRange?.[1]?.getTime() ?? null) || e.onChangeRange !== t.onChangeRange) : e.mode === "vernier" && t.mode === "vernier" ? !((e.microRange?.[0]?.getTime() ?? null) !== (t.microRange?.[0]?.getTime() ?? null) || (e.microRange?.[1]?.getTime() ?? null) !== (t.microRange?.[1]?.getTime() ?? null) || (e.defaultMicroRange?.[0]?.getTime() ?? null) !== (t.defaultMicroRange?.[0]?.getTime() ?? null) || (e.defaultMicroRange?.[1]?.getTime() ?? null) !== (t.defaultMicroRange?.[1]?.getTime() ?? null) || e.macroRange[0].getTime() !== t.macroRange[0].getTime() || e.macroRange[1].getTime() !== t.macroRange[1].getTime() || e.vernierOrientation !== t.vernierOrientation || e.showVernierProjection !== t.showVernierProjection || e.showVernierTicks !== t.showVernierTicks || e.showHairline !== t.showHairline || e.macroUnit !== t.macroUnit || e.microUnit !== t.microUnit || e.macroIsDiscrete !== t.macroIsDiscrete || e.microIsDiscrete !== t.microIsDiscrete || e.formatMacroLabel !== t.formatMacroLabel || e.formatMicroLabel !== t.formatMicroLabel || e.onChangeMicroRange !== t.onChangeMicroRange || e.onChangeMacroRange !== t.onChangeMacroRange || !Er(e.macroAllowedDates, t.macroAllowedDates) || !Er(e.microAllowedDates, t.microAllowedDates)) : !1, da = tr(sa, ua);
|
|
1195
|
+
da.displayName = "PeriodSlider";
|
|
1196
|
+
const Je = (e) => {
|
|
1197
|
+
const t = new Date(e);
|
|
1198
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
1199
|
+
}, Zt = (e, t) => {
|
|
1200
|
+
if (Number.isNaN(t.getTime()))
|
|
1201
|
+
throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`);
|
|
1202
|
+
}, ma = (e) => {
|
|
1203
|
+
if (e !== void 0)
|
|
1204
|
+
try {
|
|
1205
|
+
Intl.DateTimeFormat.supportedLocalesOf([e]);
|
|
1206
|
+
} catch {
|
|
1207
|
+
throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`);
|
|
1208
|
+
}
|
|
1209
|
+
}, Ot = (e, t, r) => {
|
|
1210
|
+
const n = new Date(e, t - 1, r);
|
|
1211
|
+
return n.setFullYear(e), n.setHours(0, 0, 0, 0), n;
|
|
1212
|
+
}, fn = (e) => Ot(e, 1, 1), fa = (e) => Ot(e, 12, 31), ga = {
|
|
1213
|
+
year: { year: "numeric" },
|
|
1214
|
+
month: { month: "2-digit" },
|
|
1215
|
+
day: { day: "2-digit" }
|
|
1216
|
+
}, ha = {
|
|
1217
|
+
year: 4,
|
|
1218
|
+
month: 2,
|
|
1219
|
+
day: 2
|
|
1220
|
+
}, ba = {
|
|
1221
|
+
year: (e) => e.getFullYear(),
|
|
1222
|
+
month: (e) => e.getMonth() + 1,
|
|
1223
|
+
day: (e) => e.getDate()
|
|
1224
|
+
}, gn = /* @__PURE__ */ new Map(), wa = (e, t) => {
|
|
1225
|
+
const r = `${e}\0${t}`, n = gn.get(r);
|
|
1226
|
+
if (n !== void 0) return n;
|
|
1227
|
+
const a = new Intl.DateTimeFormat(t, ga[e]);
|
|
1228
|
+
return gn.set(r, a), a;
|
|
1229
|
+
}, Ir = (e, t, r) => r === void 0 ? String(ba[e](t)).padStart(ha[e], "0") : wa(e, r).format(t), va = (e, t, r) => {
|
|
1230
|
+
const n = t?.getTime() ?? null, a = r?.getTime() ?? null, s = /* @__PURE__ */ new Map();
|
|
1231
|
+
return e.forEach((o, d) => {
|
|
1232
|
+
Zt(`allowedDates[${d}]`, o);
|
|
1233
|
+
const g = Je(o), h = g.getTime();
|
|
1234
|
+
n !== null && h < n || a !== null && h > a || s.has(h) || s.set(h, g);
|
|
1235
|
+
}), Array.from(s.keys()).sort((o, d) => o - d).map((o) => s.get(o));
|
|
1236
|
+
}, pa = (e, t) => {
|
|
1237
|
+
const r = [];
|
|
1238
|
+
let n = Je(e);
|
|
1239
|
+
const a = Je(t).getTime();
|
|
1240
|
+
for (; n.getTime() <= a; )
|
|
1241
|
+
r.push(n), n = Dr(n, 1);
|
|
1242
|
+
return r;
|
|
1243
|
+
}, hn = (e, t) => {
|
|
1244
|
+
const r = [];
|
|
1245
|
+
for (let n = e.length - 1; n >= 0; n--)
|
|
1246
|
+
r.push({ label: Ae("day", e[n], void 0, t), value: Ht(e[n], "yyyy-MM-dd") });
|
|
1247
|
+
return r;
|
|
1248
|
+
}, Da = (e) => {
|
|
1249
|
+
const {
|
|
1250
|
+
value: t,
|
|
1251
|
+
initialDate: r,
|
|
1252
|
+
onChange: n,
|
|
1253
|
+
children: a,
|
|
1254
|
+
minYear: s,
|
|
1255
|
+
maxYear: o,
|
|
1256
|
+
minDate: d,
|
|
1257
|
+
maxDate: g,
|
|
1258
|
+
allowedDates: h,
|
|
1259
|
+
variant: M = "date",
|
|
1260
|
+
className: x = "",
|
|
1261
|
+
style: c,
|
|
1262
|
+
disabled: p = !1,
|
|
1263
|
+
prevDateAriaLabel: _ = "Previous day",
|
|
1264
|
+
nextDateAriaLabel: Z = "Next day",
|
|
1265
|
+
selectAriaLabel: D = "Date",
|
|
1266
|
+
yearAriaLabel: W = "Year",
|
|
1267
|
+
monthAriaLabel: C = "Month",
|
|
1268
|
+
dayAriaLabel: Q = "Day",
|
|
1269
|
+
locale: A,
|
|
1270
|
+
formatYearOption: O,
|
|
1271
|
+
formatMonthOption: y,
|
|
1272
|
+
formatDayOption: B
|
|
1273
|
+
} = e;
|
|
1274
|
+
if (ma(A), t !== void 0 && Zt("value", t), r !== void 0 && Zt("initialDate", r), d !== void 0 && Zt("minDate", d), g !== void 0 && Zt("maxDate", g), s !== void 0 && !Number.isInteger(s))
|
|
1275
|
+
throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(s)})`);
|
|
1276
|
+
if (o !== void 0 && !Number.isInteger(o))
|
|
1277
|
+
throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(o)})`);
|
|
1278
|
+
if (M === "split-dropdown" && h !== void 0)
|
|
1279
|
+
throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');
|
|
1280
|
+
const E = t ?? r;
|
|
1281
|
+
if (E === void 0)
|
|
1282
|
+
throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");
|
|
1283
|
+
const [m, L] = he(() => Je(E)), S = t !== void 0, H = t?.getTime(), P = Y(() => t !== void 0 ? Je(t) : m, [H, m]), ne = d?.getTime(), K = g?.getTime(), X = Y(() => {
|
|
1284
|
+
const f = d ? Je(d) : null, k = s !== void 0 ? fn(s) : null;
|
|
1285
|
+
return f === null ? k : k === null || f.getTime() >= k.getTime() ? f : k;
|
|
1286
|
+
}, [ne, s]), te = Y(() => {
|
|
1287
|
+
const f = g ? Je(g) : null, k = o !== void 0 ? fa(o) : null;
|
|
1288
|
+
return f === null ? k : k === null || f.getTime() <= k.getTime() ? f : k;
|
|
1289
|
+
}, [K, o]), ae = X?.getTime() ?? null, me = te?.getTime() ?? null;
|
|
1290
|
+
if (X !== null && te !== null && X.getTime() > te.getTime())
|
|
1291
|
+
throw new RangeError(`DateSelector: the resolved range is empty (min ${Ht(X, "yyyy-MM-dd")} is after max ${Ht(te, "yyyy-MM-dd")})`);
|
|
1292
|
+
if (M !== "date" && h === void 0 && (X === null || te === null))
|
|
1293
|
+
throw new RangeError(`DateSelector: variant="${M}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${M === "dropdown" ? ' or supply "allowedDates"' : ""}`);
|
|
1294
|
+
const ze = h === void 0 ? null : h.map((f) => f.getTime()).join(","), oe = Y(() => h === void 0 ? null : va(h, X, te), [ze, ae, me]), Ze = (f) => {
|
|
1295
|
+
const k = f.getTime();
|
|
1296
|
+
return oe !== null ? oe.some((Ie) => Ie.getTime() === k) : !(ae !== null && k < ae || me !== null && k > me);
|
|
1297
|
+
}, mt = E.getTime();
|
|
1298
|
+
xt(() => {
|
|
1299
|
+
S || L(Je(E));
|
|
1300
|
+
}, [S, mt]);
|
|
1301
|
+
const Se = (f) => {
|
|
1302
|
+
if (p) return;
|
|
1303
|
+
const k = Je(f);
|
|
1304
|
+
Ze(k) && (S || L(k), n?.(k));
|
|
1305
|
+
}, pe = P.getTime(), ue = Ze(P), I = Y(() => {
|
|
1306
|
+
if (oe !== null) {
|
|
1307
|
+
for (let k = oe.length - 1; k >= 0; k--)
|
|
1308
|
+
if (oe[k].getTime() < pe) return oe[k];
|
|
1309
|
+
return null;
|
|
1310
|
+
}
|
|
1311
|
+
const f = Dr(new Date(pe), -1);
|
|
1312
|
+
return ae !== null && f.getTime() < ae ? null : f;
|
|
1313
|
+
}, [oe, pe, ae]), F = Y(() => {
|
|
1314
|
+
if (oe !== null) {
|
|
1315
|
+
for (const k of oe)
|
|
1316
|
+
if (k.getTime() > pe) return k;
|
|
1317
|
+
return null;
|
|
1318
|
+
}
|
|
1319
|
+
const f = Dr(new Date(pe), 1);
|
|
1320
|
+
return me !== null && f.getTime() > me ? null : f;
|
|
1321
|
+
}, [oe, pe, me]), G = p || I === null, de = p || F === null, $ = () => {
|
|
1322
|
+
I !== null && Se(I);
|
|
1323
|
+
}, be = () => {
|
|
1324
|
+
F !== null && Se(F);
|
|
1325
|
+
}, Ee = (f) => {
|
|
1326
|
+
if (f.target.value) {
|
|
1327
|
+
const k = cn(f.target.value);
|
|
1328
|
+
Number.isNaN(k.getTime()) || Se(k);
|
|
1329
|
+
}
|
|
1330
|
+
}, Qe = (f) => {
|
|
1331
|
+
if (f.target.value) {
|
|
1332
|
+
const k = cn(f.target.value);
|
|
1333
|
+
Number.isNaN(k.getTime()) || Se(k);
|
|
1334
|
+
}
|
|
1335
|
+
}, se = P.getFullYear(), De = P.getMonth() + 1, ft = P.getDate(), Ft = Y(() => M !== "dropdown" ? [] : oe !== null ? hn(oe, A) : X === null || te === null ? [] : hn(pa(X, te), A), [M, oe, ae, me, A]), rr = Y(() => {
|
|
1336
|
+
if (M !== "split-dropdown" || X === null || te === null) return [];
|
|
1337
|
+
const f = [];
|
|
1338
|
+
for (let k = te.getFullYear(); k >= X.getFullYear(); k--)
|
|
1339
|
+
f.push(k);
|
|
1340
|
+
return f;
|
|
1341
|
+
}, [M, ae, me]), fe = Y(() => {
|
|
1342
|
+
if (M !== "split-dropdown" || X === null || te === null) return [];
|
|
1343
|
+
const f = X, k = te, Ie = se === f.getFullYear() ? f.getMonth() + 1 : 1, Lt = se === k.getFullYear() ? k.getMonth() + 1 : 12, ht = [];
|
|
1344
|
+
for (let et = Ie; et <= Lt; et++)
|
|
1345
|
+
ht.push(et);
|
|
1346
|
+
return ht;
|
|
1347
|
+
}, [M, ae, me, se]), ge = Y(() => {
|
|
1348
|
+
if (M !== "split-dropdown" || X === null || te === null) return [];
|
|
1349
|
+
const f = X, k = te, Ie = se === f.getFullYear() && De === f.getMonth() + 1 ? f.getDate() : 1, Lt = se === k.getFullYear() && De === k.getMonth() + 1 ? k.getDate() : sn(new Date(pe)), ht = [];
|
|
1350
|
+
for (let et = Ie; et <= Lt; et++)
|
|
1351
|
+
ht.push(et);
|
|
1352
|
+
return ht;
|
|
1353
|
+
}, [M, ae, me, pe, se, De]), J = (f, k, Ie) => {
|
|
1354
|
+
Ie > sn(Ot(f, k, 1)) || Se(Ot(f, k, Ie));
|
|
1355
|
+
}, gt = (f) => O ? O(f) : Ir("year", fn(f), A), T = (f) => y ? y(f) : Ir("month", Ot(se, f, 1), A), nr = (f) => B ? B(f) : Ir("day", Ot(se, De, f), A), ar = Ht(P, "yyyy-MM-dd"), Tt = Ae("day", P, void 0, A), z = X ? Ht(X, "yyyy-MM-dd") : void 0, N = te ? Ht(te, "yyyy-MM-dd") : void 0, Vt = ue ? ar : "", it = "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";
|
|
1356
|
+
return /* @__PURE__ */ le("div", { className: `inline-flex items-center ${M === "split-dropdown" ? "w-auto" : "w-38"} ${x}`, style: c, "data-variant": M, "data-out-of-range": ue ? void 0 : "true", children: [
|
|
1357
|
+
/* @__PURE__ */ w(
|
|
1358
|
+
"button",
|
|
1359
|
+
{
|
|
1360
|
+
type: "button",
|
|
1361
|
+
"aria-label": _,
|
|
1362
|
+
disabled: G,
|
|
1363
|
+
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1364
|
+
onClick: $,
|
|
1365
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
|
|
1366
|
+
}
|
|
1367
|
+
),
|
|
1368
|
+
M === "dropdown" ? /* @__PURE__ */ le("select", { "aria-label": D, disabled: p, className: "mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: Vt, onChange: Qe, children: [
|
|
1369
|
+
ue ? null : /* @__PURE__ */ w("option", { value: "", disabled: !0, className: it, children: Tt }),
|
|
1370
|
+
Ft.map((f) => /* @__PURE__ */ w("option", { value: f.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: f.label }, f.value))
|
|
1371
|
+
] }) : M === "split-dropdown" ? /* @__PURE__ */ le("div", { className: "mx-1 my-auto inline-flex items-center gap-1", children: [
|
|
1372
|
+
/* @__PURE__ */ le(
|
|
1373
|
+
"select",
|
|
1374
|
+
{
|
|
1375
|
+
"aria-label": W,
|
|
1376
|
+
disabled: p,
|
|
1377
|
+
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
1378
|
+
value: ue ? se : "",
|
|
1379
|
+
onChange: (f) => J(Number(f.target.value), De, ft),
|
|
1380
|
+
children: [
|
|
1381
|
+
ue ? null : /* @__PURE__ */ w("option", { value: "", disabled: !0, className: it, children: gt(se) }),
|
|
1382
|
+
rr.map((f) => /* @__PURE__ */ w("option", { value: f, className: "dark:bg-slate-700 dark:text-slate-100", children: gt(f) }, f))
|
|
1383
|
+
]
|
|
1384
|
+
}
|
|
1385
|
+
),
|
|
1386
|
+
/* @__PURE__ */ le(
|
|
1387
|
+
"select",
|
|
1388
|
+
{
|
|
1389
|
+
"aria-label": C,
|
|
1390
|
+
disabled: p,
|
|
1391
|
+
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
1392
|
+
value: ue ? De : "",
|
|
1393
|
+
onChange: (f) => J(se, Number(f.target.value), ft),
|
|
1394
|
+
children: [
|
|
1395
|
+
ue ? null : /* @__PURE__ */ w("option", { value: "", disabled: !0, className: it, children: T(De) }),
|
|
1396
|
+
fe.map((f) => /* @__PURE__ */ w("option", { value: f, className: "dark:bg-slate-700 dark:text-slate-100", children: T(f) }, f))
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
),
|
|
1400
|
+
/* @__PURE__ */ le(
|
|
1401
|
+
"select",
|
|
1402
|
+
{
|
|
1403
|
+
"aria-label": Q,
|
|
1404
|
+
disabled: p,
|
|
1405
|
+
className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
|
|
1406
|
+
value: ue ? ft : "",
|
|
1407
|
+
onChange: (f) => J(se, De, Number(f.target.value)),
|
|
1408
|
+
children: [
|
|
1409
|
+
ue ? null : /* @__PURE__ */ w("option", { value: "", disabled: !0, className: it, children: nr(ft) }),
|
|
1410
|
+
ge.map((f) => /* @__PURE__ */ w("option", { value: f, className: "dark:bg-slate-700 dark:text-slate-100", children: nr(f) }, f))
|
|
1411
|
+
]
|
|
1412
|
+
}
|
|
1413
|
+
)
|
|
1414
|
+
] }) : /* @__PURE__ */ w(
|
|
1415
|
+
"input",
|
|
1416
|
+
{
|
|
1417
|
+
"aria-label": D,
|
|
1418
|
+
disabled: p,
|
|
1419
|
+
className: "mx-1 my-auto w-28 rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-gray-900 text-xs focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",
|
|
1420
|
+
value: ar,
|
|
1421
|
+
min: z,
|
|
1422
|
+
max: N,
|
|
1423
|
+
onChange: Ee,
|
|
1424
|
+
type: "date"
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ w(
|
|
1428
|
+
"button",
|
|
1429
|
+
{
|
|
1430
|
+
type: "button",
|
|
1431
|
+
"aria-label": Z,
|
|
1432
|
+
disabled: de,
|
|
1433
|
+
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1434
|
+
onClick: be,
|
|
1435
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
a
|
|
1439
|
+
] });
|
|
1440
|
+
}, It = (e) => e === void 0 ? null : Je(e).getTime(), Ma = tr(Da, (e, t) => !(It(e.value ?? e.initialDate) !== It(t.value ?? t.initialDate) || It(e.minDate) !== It(t.minDate) || It(e.maxDate) !== It(t.maxDate) || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.yearAriaLabel !== t.yearAriaLabel || e.monthAriaLabel !== t.monthAriaLabel || e.dayAriaLabel !== t.dayAriaLabel || e.locale !== t.locale || e.formatYearOption !== t.formatYearOption || e.formatMonthOption !== t.formatMonthOption || e.formatDayOption !== t.formatDayOption));
|
|
1441
|
+
Ma.displayName = "DateSelector";
|
|
1442
|
+
function Be(e, t) {
|
|
1443
|
+
const r = e + Math.floor(t / 12), n = (t % 12 + 12) % 12, a = new Date(r, n, 1);
|
|
1444
|
+
return a.setFullYear(r), a;
|
|
1445
|
+
}
|
|
1446
|
+
function Mt(e) {
|
|
1447
|
+
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
|
|
1448
|
+
}
|
|
1449
|
+
function wr(e, t) {
|
|
1450
|
+
if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
|
|
1451
|
+
throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
|
|
1452
|
+
}
|
|
1453
|
+
function bn(e, t) {
|
|
1454
|
+
if (e !== void 0 && !Number.isInteger(e))
|
|
1455
|
+
throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
|
|
1456
|
+
}
|
|
1457
|
+
function xa(e) {
|
|
1458
|
+
if (e !== void 0)
|
|
1459
|
+
try {
|
|
1460
|
+
Intl.DateTimeFormat.supportedLocalesOf([e]);
|
|
1461
|
+
} catch {
|
|
1462
|
+
throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
function ya(e, t) {
|
|
1466
|
+
const r = e === void 0 ? null : Be(e, 0), n = t === void 0 ? null : Be(t.getFullYear(), t.getMonth());
|
|
1467
|
+
return r !== null && n !== null ? r >= n ? r : n : r !== null ? r : n;
|
|
1468
|
+
}
|
|
1469
|
+
function Ta(e, t) {
|
|
1470
|
+
const r = e === void 0 ? null : Be(e, 11), n = t === void 0 ? null : Be(t.getFullYear(), t.getMonth());
|
|
1471
|
+
return r !== null && n !== null ? r <= n ? r : n : r !== null ? r : n;
|
|
1472
|
+
}
|
|
1473
|
+
function Tn(e, t) {
|
|
1474
|
+
return { label: Ae("month", e, void 0, t), value: Mt(e) };
|
|
1475
|
+
}
|
|
1476
|
+
function La(e, t, r) {
|
|
1477
|
+
const n = e.getFullYear() * 12 + e.getMonth(), a = t.getFullYear() * 12 + t.getMonth(), s = [];
|
|
1478
|
+
for (let o = a; o >= n; o--)
|
|
1479
|
+
s.push(Tn(Be(Math.floor(o / 12), o % 12), r));
|
|
1480
|
+
return s;
|
|
1481
|
+
}
|
|
1482
|
+
const Ra = (e) => {
|
|
1483
|
+
const {
|
|
1484
|
+
value: t,
|
|
1485
|
+
initialDate: r,
|
|
1486
|
+
onChange: n,
|
|
1487
|
+
children: a,
|
|
1488
|
+
variant: s = "date",
|
|
1489
|
+
minYear: o,
|
|
1490
|
+
maxYear: d,
|
|
1491
|
+
minDate: g,
|
|
1492
|
+
maxDate: h,
|
|
1493
|
+
isWarning: M = !1,
|
|
1494
|
+
className: x = "",
|
|
1495
|
+
style: c,
|
|
1496
|
+
disabled: p = !1,
|
|
1497
|
+
prevMonthAriaLabel: _ = "Previous month",
|
|
1498
|
+
nextMonthAriaLabel: Z = "Next month",
|
|
1499
|
+
selectAriaLabel: D = "Month",
|
|
1500
|
+
locale: W
|
|
1501
|
+
} = e;
|
|
1502
|
+
xa(W), wr(t, "value"), wr(r, "initialDate"), wr(g, "minDate"), wr(h, "maxDate"), bn(o, "minYear"), bn(d, "maxYear");
|
|
1503
|
+
const C = t ?? r;
|
|
1504
|
+
if (C === void 0)
|
|
1505
|
+
throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");
|
|
1506
|
+
const [Q, A] = he(() => Be(C.getFullYear(), C.getMonth())), O = t !== void 0, y = Y(() => t !== void 0 ? Be(t.getFullYear(), t.getMonth()) : Q, [t?.getTime(), Q]), B = g?.getTime(), E = h?.getTime(), m = Y(() => ya(o, g), [o, B]), L = Y(() => Ta(d, h), [d, E]);
|
|
1507
|
+
if (m !== null && L !== null && m > L)
|
|
1508
|
+
throw new RangeError(`MonthSelector: the resolved lower bound ${Mt(m)} is after the resolved upper bound ${Mt(L)}.`);
|
|
1509
|
+
if (s === "dropdown" && (m === null || L === null))
|
|
1510
|
+
throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`); the option window is never invented.');
|
|
1511
|
+
const S = m !== null && y < m || L !== null && y > L, H = C.getTime();
|
|
1512
|
+
xt(() => {
|
|
1513
|
+
if (O) return;
|
|
1514
|
+
const $ = Be(C.getFullYear(), C.getMonth());
|
|
1515
|
+
A((be) => be.getTime() === $.getTime() ? be : $);
|
|
1516
|
+
}, [O, H]);
|
|
1517
|
+
const P = ($) => (m === null || $ >= m) && (L === null || $ <= L), ne = ($) => {
|
|
1518
|
+
if (p) return;
|
|
1519
|
+
if (!P($))
|
|
1520
|
+
throw new RangeError(`MonthSelector: refusing to emit ${Mt($)}, which lies outside the declared bounds.`);
|
|
1521
|
+
O || A($);
|
|
1522
|
+
const be = $.getFullYear() * 100 + ($.getMonth() + 1);
|
|
1523
|
+
n?.($, be);
|
|
1524
|
+
}, K = Y(() => Be(y.getFullYear(), y.getMonth() - 1), [y]), X = Y(() => Be(y.getFullYear(), y.getMonth() + 1), [y]), te = p || m !== null && K < m, ae = p || L !== null && X > L, me = () => {
|
|
1525
|
+
ne(K);
|
|
1526
|
+
}, ze = () => {
|
|
1527
|
+
ne(X);
|
|
1528
|
+
}, oe = ($) => {
|
|
1529
|
+
if (!$) return;
|
|
1530
|
+
const [be, Ee] = $.split("-"), Qe = Number(be), se = Number(Ee) - 1;
|
|
1531
|
+
if (!(Number.isInteger(Qe) && Number.isInteger(se))) return;
|
|
1532
|
+
const De = Be(Qe, se);
|
|
1533
|
+
P(De) && ne(De);
|
|
1534
|
+
}, Ze = ($) => {
|
|
1535
|
+
oe($.target.value);
|
|
1536
|
+
}, mt = ($) => {
|
|
1537
|
+
oe($.target.value);
|
|
1538
|
+
}, Se = Mt(y), pe = m ? Mt(m) : void 0, ue = L ? Mt(L) : void 0, I = Y(() => {
|
|
1539
|
+
if (s !== "dropdown" || m === null || L === null) return [];
|
|
1540
|
+
const $ = La(m, L, W);
|
|
1541
|
+
if (!S) return $;
|
|
1542
|
+
const be = Tn(y, W);
|
|
1543
|
+
return [...$, be].sort((Ee, Qe) => Qe.value.localeCompare(Ee.value));
|
|
1544
|
+
}, [s, m?.getTime(), L?.getTime(), S, y, W]), F = M ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", G = `mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${F}`, de = `mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${F}`;
|
|
1545
|
+
return /* @__PURE__ */ le("div", { className: `inline-flex w-38 items-center ${x}`, style: c, children: [
|
|
1546
|
+
/* @__PURE__ */ w(
|
|
1547
|
+
"button",
|
|
1548
|
+
{
|
|
1549
|
+
type: "button",
|
|
1550
|
+
"aria-label": _,
|
|
1551
|
+
disabled: te,
|
|
1552
|
+
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1553
|
+
onClick: me,
|
|
1554
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
s === "dropdown" ? /* @__PURE__ */ w("select", { "aria-label": D, disabled: p, className: de, value: Se, onChange: mt, children: I.map(($) => /* @__PURE__ */ w("option", { value: $.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: $.label }, $.value)) }) : /* @__PURE__ */ w("input", { "aria-label": D, disabled: p, className: G, value: Se, min: pe, max: ue, onChange: Ze, type: "month" }),
|
|
1558
|
+
/* @__PURE__ */ w(
|
|
1559
|
+
"button",
|
|
1560
|
+
{
|
|
1561
|
+
type: "button",
|
|
1562
|
+
"aria-label": Z,
|
|
1563
|
+
disabled: ae,
|
|
1564
|
+
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1565
|
+
onClick: ze,
|
|
1566
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
|
|
1567
|
+
}
|
|
1568
|
+
),
|
|
1569
|
+
a
|
|
1570
|
+
] });
|
|
1571
|
+
}, Sa = tr(Ra, (e, t) => {
|
|
1572
|
+
const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() * 12 + r.getMonth() : null, s = n ? n.getFullYear() * 12 + n.getMonth() : null;
|
|
1573
|
+
if (a !== s || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.isWarning !== t.isWarning || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
|
|
1574
|
+
const o = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, d = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
|
|
1575
|
+
if (o !== d) return !1;
|
|
1576
|
+
const g = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, h = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
|
|
1577
|
+
return !(g !== h || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
|
|
1578
|
+
});
|
|
1579
|
+
Sa.displayName = "MonthSelector";
|
|
1580
|
+
function er(e, t, r) {
|
|
1581
|
+
if (!(r instanceof Date) || Number.isNaN(r.getTime()))
|
|
1582
|
+
throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`);
|
|
1583
|
+
}
|
|
1584
|
+
function Ur(e, t, r) {
|
|
1585
|
+
if (er(e, "minDate", t), er(e, "maxDate", r), r.getTime() <= t.getTime())
|
|
1586
|
+
throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`);
|
|
1587
|
+
}
|
|
1588
|
+
function Hr(e, t, r) {
|
|
1589
|
+
if (!Array.isArray(r) || r.length !== 2)
|
|
1590
|
+
throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);
|
|
1591
|
+
if (er(e, `${t}[0]`, r[0]), er(e, `${t}[1]`, r[1]), r[0].getTime() > r[1].getTime())
|
|
1592
|
+
throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`);
|
|
1593
|
+
}
|
|
1594
|
+
function Or(e, t, r, n, a, s) {
|
|
1595
|
+
if (r.getTime() < n.getTime() || r.getTime() > a.getTime())
|
|
1596
|
+
throw new RangeError(`${e}: ${t} must lie within ${s} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${a.toISOString()})`);
|
|
1597
|
+
}
|
|
1598
|
+
function Fr(e, t, r, n, a, s) {
|
|
1599
|
+
Or(e, `${t}[0]`, r[0], n, a, s), Or(e, `${t}[1]`, r[1], n, a, s);
|
|
1600
|
+
}
|
|
1601
|
+
function Ce(e, t, r) {
|
|
1602
|
+
return e < t ? t : e > r ? r : e;
|
|
1603
|
+
}
|
|
1604
|
+
function vr(e, t, r, n) {
|
|
1605
|
+
const a = yt(t, r, n[1]);
|
|
1606
|
+
return [Ce(e[0], n[0], a), Ce(e[1], n[0], a)];
|
|
1607
|
+
}
|
|
1608
|
+
function Vr(e, t, r, n) {
|
|
1609
|
+
const a = ut(e, r, t) + n;
|
|
1610
|
+
return e[Math.max(0, Math.min(e.length - 1, a))];
|
|
1611
|
+
}
|
|
1612
|
+
function Br(e) {
|
|
1613
|
+
const t = j(e), r = t.current, n = e, a = Object.keys(r), s = Object.keys(n);
|
|
1614
|
+
return a.length === s.length && s.every((d) => Object.is(r[d], n[d])) || (t.current = e), t.current;
|
|
1388
1615
|
}
|
|
1389
|
-
function
|
|
1390
|
-
const { unit: t,
|
|
1391
|
-
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
const k = [N, G];
|
|
1410
|
-
b(k), z.current?.(N, G), P.current?.(k), F.current?.(k);
|
|
1411
|
-
}, []), f = K((N) => {
|
|
1412
|
-
b(N), z.current?.(N[0], N[1]), P.current?.(N), F.current?.(N);
|
|
1413
|
-
}, []), I = K(
|
|
1414
|
-
(N) => {
|
|
1415
|
-
const G = W.current, k = Le(t, G[0], N), j = Le(t, G[1], N), q = qt(k, l, s), fe = qt(j, l, s), me = [q, fe];
|
|
1416
|
-
b(me), z.current?.(me[0], me[1]), P.current?.(me), F.current?.(me);
|
|
1616
|
+
function Ca(e) {
|
|
1617
|
+
const { unit: t, minDate: r, maxDate: n, initialRange: a, onChangeRange: s, ...o } = e;
|
|
1618
|
+
Ur("usePeriodSliderRange", r, n), Hr("usePeriodSliderRange", "initialRange", a), Fr("usePeriodSliderRange", "initialRange", a, r, n, "[minDate, maxDate]");
|
|
1619
|
+
const d = Br(o), g = j(a), [h, M] = he(a);
|
|
1620
|
+
let x = h;
|
|
1621
|
+
const c = [Ce(h[0], r, n), Ce(h[1], r, n)];
|
|
1622
|
+
(c[0] !== h[0] || c[1] !== h[1]) && (x = c, M(c));
|
|
1623
|
+
const p = j(x);
|
|
1624
|
+
p.current = x;
|
|
1625
|
+
const _ = j({ minDate: r, maxDate: n, allowedDates: d.allowedDates });
|
|
1626
|
+
_.current = { minDate: r, maxDate: n, allowedDates: d.allowedDates };
|
|
1627
|
+
const Z = j(s);
|
|
1628
|
+
Z.current = s;
|
|
1629
|
+
const D = U((m) => {
|
|
1630
|
+
const { minDate: L, maxDate: S } = _.current, H = Ce(m[0], L, S), P = Ce(m[1], L, S), ne = p.current;
|
|
1631
|
+
H.getTime() === ne[0].getTime() && P.getTime() === ne[1].getTime() || (p.current = [H, P], M([H, P]), Z.current?.(H, P));
|
|
1632
|
+
}, []), W = U(
|
|
1633
|
+
(m) => {
|
|
1634
|
+
const L = p.current, S = m.getTime() > L[1].getTime() ? m : L[1];
|
|
1635
|
+
D([m, S]);
|
|
1417
1636
|
},
|
|
1418
|
-
[
|
|
1419
|
-
),
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1637
|
+
[D]
|
|
1638
|
+
), C = U(
|
|
1639
|
+
(m) => {
|
|
1640
|
+
const L = p.current, S = m.getTime() < L[0].getTime() ? m : L[0];
|
|
1641
|
+
D([S, m]);
|
|
1642
|
+
},
|
|
1643
|
+
[D]
|
|
1644
|
+
), Q = U(
|
|
1645
|
+
(m, L) => {
|
|
1646
|
+
D([m, L]);
|
|
1647
|
+
},
|
|
1648
|
+
[D]
|
|
1649
|
+
), A = U(
|
|
1650
|
+
(m) => {
|
|
1651
|
+
const { minDate: L, maxDate: S, allowedDates: H } = _.current, P = p.current, ne = Qt(H, t, L, S);
|
|
1652
|
+
if (ne.length > 0) {
|
|
1653
|
+
D([Vr(ne, t, P[0], m), Vr(ne, t, P[1], m)]);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
D([ke(t, P[0], m), ke(t, P[1], m)]);
|
|
1657
|
+
},
|
|
1658
|
+
[t, D]
|
|
1659
|
+
), O = U(() => {
|
|
1660
|
+
D(g.current);
|
|
1661
|
+
}, [D]), y = Y(
|
|
1423
1662
|
() => ({
|
|
1424
|
-
value:
|
|
1425
|
-
onChange:
|
|
1426
|
-
minDate:
|
|
1427
|
-
maxDate:
|
|
1663
|
+
value: x[0],
|
|
1664
|
+
onChange: W,
|
|
1665
|
+
minDate: r,
|
|
1666
|
+
maxDate: x[1],
|
|
1428
1667
|
unit: t
|
|
1429
1668
|
}),
|
|
1430
|
-
[
|
|
1431
|
-
),
|
|
1669
|
+
[x[0], x[1], W, r, t]
|
|
1670
|
+
), B = Y(
|
|
1432
1671
|
() => ({
|
|
1433
|
-
value:
|
|
1434
|
-
onChange:
|
|
1435
|
-
minDate:
|
|
1436
|
-
maxDate:
|
|
1672
|
+
value: x[1],
|
|
1673
|
+
onChange: C,
|
|
1674
|
+
minDate: x[0],
|
|
1675
|
+
maxDate: n,
|
|
1437
1676
|
unit: t
|
|
1438
1677
|
}),
|
|
1439
|
-
[
|
|
1440
|
-
),
|
|
1678
|
+
[x[0], x[1], C, n, t]
|
|
1679
|
+
), E = Y(
|
|
1441
1680
|
() => ({
|
|
1442
|
-
...
|
|
1681
|
+
...d,
|
|
1443
1682
|
mode: "range",
|
|
1444
1683
|
unit: t,
|
|
1445
|
-
range:
|
|
1446
|
-
minDate:
|
|
1447
|
-
maxDate:
|
|
1448
|
-
onChangeRange:
|
|
1449
|
-
onChangeRangeTuple: f,
|
|
1450
|
-
onChange: f
|
|
1684
|
+
range: x,
|
|
1685
|
+
minDate: r,
|
|
1686
|
+
maxDate: n,
|
|
1687
|
+
onChangeRange: Q
|
|
1451
1688
|
}),
|
|
1452
|
-
[
|
|
1689
|
+
[d, t, x, r, n, Q]
|
|
1453
1690
|
);
|
|
1454
1691
|
return {
|
|
1455
|
-
range:
|
|
1456
|
-
lowerDate:
|
|
1457
|
-
upperDate:
|
|
1458
|
-
setRange:
|
|
1459
|
-
setLowerDate:
|
|
1460
|
-
setUpperDate:
|
|
1461
|
-
shiftRange:
|
|
1462
|
-
resetRange:
|
|
1463
|
-
startSelectorProps:
|
|
1464
|
-
endSelectorProps:
|
|
1465
|
-
sliderProps:
|
|
1692
|
+
range: x,
|
|
1693
|
+
lowerDate: x[0],
|
|
1694
|
+
upperDate: x[1],
|
|
1695
|
+
setRange: M,
|
|
1696
|
+
setLowerDate: W,
|
|
1697
|
+
setUpperDate: C,
|
|
1698
|
+
shiftRange: A,
|
|
1699
|
+
resetRange: O,
|
|
1700
|
+
startSelectorProps: y,
|
|
1701
|
+
endSelectorProps: B,
|
|
1702
|
+
sliderProps: E
|
|
1466
1703
|
};
|
|
1467
1704
|
}
|
|
1468
|
-
function
|
|
1469
|
-
const { unit: t,
|
|
1470
|
-
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1705
|
+
function Ea(e) {
|
|
1706
|
+
const { unit: t, minDate: r, maxDate: n, initialValue: a, onChangePoint: s, ...o } = e;
|
|
1707
|
+
Ur("usePeriodSliderPoint", r, n), er("usePeriodSliderPoint", "initialValue", a), Or("usePeriodSliderPoint", "initialValue", a, r, n, "[minDate, maxDate]");
|
|
1708
|
+
const d = Br(o), g = j(a), [h, M] = he(a);
|
|
1709
|
+
let x = h;
|
|
1710
|
+
const c = Ce(h, r, n);
|
|
1711
|
+
c !== h && (x = c, M(c));
|
|
1712
|
+
const p = j(x);
|
|
1713
|
+
p.current = x;
|
|
1714
|
+
const _ = j({ minDate: r, maxDate: n, allowedDates: d.allowedDates });
|
|
1715
|
+
_.current = { minDate: r, maxDate: n, allowedDates: d.allowedDates };
|
|
1716
|
+
const Z = j(s);
|
|
1717
|
+
Z.current = s;
|
|
1718
|
+
const D = U((O) => {
|
|
1719
|
+
const { minDate: y, maxDate: B } = _.current, E = Ce(O, y, B);
|
|
1720
|
+
E.getTime() !== p.current.getTime() && (p.current = E, M(E), Z.current?.(E));
|
|
1721
|
+
}, []), W = U(
|
|
1722
|
+
(O) => {
|
|
1723
|
+
const { minDate: y, maxDate: B, allowedDates: E } = _.current, m = Qt(E, t, y, B);
|
|
1724
|
+
if (m.length > 0) {
|
|
1725
|
+
D(Vr(m, t, p.current, O));
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
D(ke(t, p.current, O));
|
|
1483
1729
|
},
|
|
1484
|
-
[t,
|
|
1485
|
-
),
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
}, []), I = R(
|
|
1730
|
+
[t, D]
|
|
1731
|
+
), C = U(() => {
|
|
1732
|
+
D(g.current);
|
|
1733
|
+
}, [D]), Q = Y(
|
|
1489
1734
|
() => ({
|
|
1490
|
-
value:
|
|
1491
|
-
onChange:
|
|
1492
|
-
minDate:
|
|
1493
|
-
maxDate:
|
|
1735
|
+
value: x,
|
|
1736
|
+
onChange: D,
|
|
1737
|
+
minDate: r,
|
|
1738
|
+
maxDate: n,
|
|
1494
1739
|
unit: t
|
|
1495
1740
|
}),
|
|
1496
|
-
[
|
|
1497
|
-
),
|
|
1741
|
+
[x, D, r, n, t]
|
|
1742
|
+
), A = Y(
|
|
1498
1743
|
() => ({
|
|
1499
|
-
...
|
|
1744
|
+
...d,
|
|
1500
1745
|
mode: "point",
|
|
1501
1746
|
unit: t,
|
|
1502
|
-
value:
|
|
1503
|
-
minDate:
|
|
1504
|
-
maxDate:
|
|
1505
|
-
onChangePoint:
|
|
1506
|
-
onChangeValue: V,
|
|
1507
|
-
onChange: V
|
|
1747
|
+
value: x,
|
|
1748
|
+
minDate: r,
|
|
1749
|
+
maxDate: n,
|
|
1750
|
+
onChangePoint: D
|
|
1508
1751
|
}),
|
|
1509
|
-
[
|
|
1752
|
+
[d, t, x, r, n, D]
|
|
1510
1753
|
);
|
|
1511
1754
|
return {
|
|
1512
|
-
value:
|
|
1513
|
-
setValue:
|
|
1514
|
-
shiftValue:
|
|
1515
|
-
resetValue:
|
|
1516
|
-
selectorProps:
|
|
1517
|
-
sliderProps:
|
|
1755
|
+
value: x,
|
|
1756
|
+
setValue: M,
|
|
1757
|
+
shiftValue: W,
|
|
1758
|
+
resetValue: C,
|
|
1759
|
+
selectorProps: Q,
|
|
1760
|
+
sliderProps: A
|
|
1518
1761
|
};
|
|
1519
1762
|
}
|
|
1520
|
-
function
|
|
1521
|
-
const {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1763
|
+
function Ia(e) {
|
|
1764
|
+
const { unit: t, minDate: r, maxDate: n, initialMacroRange: a, initialMicroRange: s, macroUnit: o = t, microUnit: d = t, onChangeMacroRange: g, onChangeMicroRange: h, ...M } = e;
|
|
1765
|
+
Ur("useVernierSlider", r, n), Hr("useVernierSlider", "initialMacroRange", a), Hr("useVernierSlider", "initialMicroRange", s), Fr("useVernierSlider", "initialMacroRange", a, r, n, "[minDate, maxDate]"), Fr("useVernierSlider", "initialMicroRange", s, a[0], yt(o, d, a[1]), "the initial macro window");
|
|
1766
|
+
const x = Br(M), c = j(a), p = j(s), [_, Z] = he(a), [D, W] = he(s);
|
|
1767
|
+
let C = _;
|
|
1768
|
+
const Q = [Ce(_[0], r, n), Ce(_[1], r, n)];
|
|
1769
|
+
(Q[0] !== _[0] || Q[1] !== _[1]) && (C = Q, Z(Q));
|
|
1770
|
+
let A = D;
|
|
1771
|
+
const O = vr(D, o, d, C);
|
|
1772
|
+
(O[0] !== D[0] || O[1] !== D[1]) && (A = O, W(O));
|
|
1773
|
+
const y = j(C);
|
|
1774
|
+
y.current = C;
|
|
1775
|
+
const B = j(A);
|
|
1776
|
+
B.current = A;
|
|
1777
|
+
const E = j({ minDate: r, maxDate: n });
|
|
1778
|
+
E.current = { minDate: r, maxDate: n };
|
|
1779
|
+
const m = j(g);
|
|
1780
|
+
m.current = g;
|
|
1781
|
+
const L = j(h);
|
|
1782
|
+
L.current = h;
|
|
1783
|
+
const S = U((I, F) => {
|
|
1784
|
+
const G = y.current, de = B.current;
|
|
1785
|
+
(I[0].getTime() !== G[0].getTime() || I[1].getTime() !== G[1].getTime()) && (y.current = I, Z(I), m.current?.(I[0], I[1])), (F[0].getTime() !== de[0].getTime() || F[1].getTime() !== de[1].getTime()) && (B.current = F, W(F), L.current?.(F[0], F[1]));
|
|
1786
|
+
}, []), H = U(
|
|
1787
|
+
(I, F) => {
|
|
1788
|
+
const { minDate: G, maxDate: de } = E.current, $ = [Ce(I, G, de), Ce(F, G, de)];
|
|
1789
|
+
S($, vr(B.current, o, d, $));
|
|
1547
1790
|
},
|
|
1548
|
-
[
|
|
1549
|
-
),
|
|
1550
|
-
(
|
|
1551
|
-
|
|
1791
|
+
[o, d, S]
|
|
1792
|
+
), P = U(
|
|
1793
|
+
(I, F) => {
|
|
1794
|
+
S(y.current, vr([I, F], o, d, y.current));
|
|
1552
1795
|
},
|
|
1553
|
-
[
|
|
1554
|
-
),
|
|
1555
|
-
(
|
|
1556
|
-
|
|
1796
|
+
[o, d, S]
|
|
1797
|
+
), ne = U(
|
|
1798
|
+
(I) => {
|
|
1799
|
+
const F = y.current[1], G = I > F ? I : F;
|
|
1800
|
+
H(I, G);
|
|
1557
1801
|
},
|
|
1558
|
-
[
|
|
1559
|
-
),
|
|
1560
|
-
(
|
|
1561
|
-
|
|
1802
|
+
[H]
|
|
1803
|
+
), K = U(
|
|
1804
|
+
(I) => {
|
|
1805
|
+
const F = y.current[0], G = I < F ? I : F;
|
|
1806
|
+
H(G, I);
|
|
1562
1807
|
},
|
|
1563
|
-
[
|
|
1564
|
-
),
|
|
1565
|
-
(
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1808
|
+
[H]
|
|
1809
|
+
), X = U(
|
|
1810
|
+
(I) => {
|
|
1811
|
+
const F = B.current[1], G = I > F ? I : F;
|
|
1812
|
+
P(I, G);
|
|
1568
1813
|
},
|
|
1569
|
-
[
|
|
1570
|
-
),
|
|
1571
|
-
(
|
|
1572
|
-
const
|
|
1573
|
-
|
|
1814
|
+
[P]
|
|
1815
|
+
), te = U(
|
|
1816
|
+
(I) => {
|
|
1817
|
+
const F = B.current[0], G = I < F ? I : F;
|
|
1818
|
+
P(G, I);
|
|
1574
1819
|
},
|
|
1575
|
-
[
|
|
1576
|
-
),
|
|
1577
|
-
(
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1820
|
+
[P]
|
|
1821
|
+
), ae = U(
|
|
1822
|
+
(I) => {
|
|
1823
|
+
const { minDate: F, maxDate: G } = E.current, de = y.current, $ = ke(o, de[0], I), be = ke(o, de[1], I);
|
|
1824
|
+
$ < F || be > G || H($, be);
|
|
1580
1825
|
},
|
|
1581
|
-
[
|
|
1582
|
-
),
|
|
1583
|
-
(
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1826
|
+
[o, H]
|
|
1827
|
+
), me = U(
|
|
1828
|
+
(I) => {
|
|
1829
|
+
const F = y.current, G = B.current, de = ke(d, G[0], I), $ = ke(d, G[1], I);
|
|
1830
|
+
de < F[0] || $ > yt(o, d, F[1]) || P(de, $);
|
|
1586
1831
|
},
|
|
1587
|
-
[
|
|
1588
|
-
),
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
},
|
|
1593
|
-
[u, t, a, k]
|
|
1594
|
-
), Ve = K(
|
|
1595
|
-
(L) => {
|
|
1596
|
-
const S = N.current, Z = G.current, ae = Le(m, Z[0], L), Y = Le(m, Z[1], L);
|
|
1597
|
-
ae < S[0] || Y > S[1] || q(ae, Y);
|
|
1598
|
-
},
|
|
1599
|
-
[m, q]
|
|
1600
|
-
), xe = K(() => {
|
|
1601
|
-
const [L, S] = f.current, [Z, ae] = I.current;
|
|
1602
|
-
k(L, S), q(Z, ae);
|
|
1603
|
-
}, [k, q]), Ye = R(
|
|
1832
|
+
[o, d, P]
|
|
1833
|
+
), ze = U(() => {
|
|
1834
|
+
const I = c.current;
|
|
1835
|
+
S(I, vr(p.current, o, d, I));
|
|
1836
|
+
}, [o, d, S]), oe = Y(() => yt(o, d, C[1]), [o, d, C[1]]), Ze = Y(
|
|
1604
1837
|
() => ({
|
|
1605
|
-
value:
|
|
1606
|
-
onChange:
|
|
1607
|
-
minDate:
|
|
1608
|
-
maxDate:
|
|
1609
|
-
unit:
|
|
1838
|
+
value: C[0],
|
|
1839
|
+
onChange: ne,
|
|
1840
|
+
minDate: r,
|
|
1841
|
+
maxDate: C[1],
|
|
1842
|
+
unit: o
|
|
1610
1843
|
}),
|
|
1611
|
-
[
|
|
1612
|
-
),
|
|
1844
|
+
[C, ne, r, o]
|
|
1845
|
+
), mt = Y(
|
|
1613
1846
|
() => ({
|
|
1614
|
-
value:
|
|
1615
|
-
onChange:
|
|
1616
|
-
minDate:
|
|
1617
|
-
maxDate:
|
|
1618
|
-
unit:
|
|
1847
|
+
value: C[1],
|
|
1848
|
+
onChange: K,
|
|
1849
|
+
minDate: C[0],
|
|
1850
|
+
maxDate: n,
|
|
1851
|
+
unit: o
|
|
1619
1852
|
}),
|
|
1620
|
-
[
|
|
1621
|
-
),
|
|
1853
|
+
[C, K, n, o]
|
|
1854
|
+
), Se = Y(
|
|
1622
1855
|
() => ({
|
|
1623
|
-
value:
|
|
1624
|
-
onChange:
|
|
1625
|
-
minDate:
|
|
1626
|
-
maxDate:
|
|
1627
|
-
unit:
|
|
1856
|
+
value: A[0],
|
|
1857
|
+
onChange: X,
|
|
1858
|
+
minDate: C[0],
|
|
1859
|
+
maxDate: A[1],
|
|
1860
|
+
unit: d
|
|
1628
1861
|
}),
|
|
1629
|
-
[
|
|
1630
|
-
),
|
|
1862
|
+
[A, X, C, d]
|
|
1863
|
+
), pe = Y(
|
|
1631
1864
|
() => ({
|
|
1632
|
-
value:
|
|
1633
|
-
onChange:
|
|
1634
|
-
minDate:
|
|
1635
|
-
maxDate:
|
|
1636
|
-
unit:
|
|
1865
|
+
value: A[1],
|
|
1866
|
+
onChange: te,
|
|
1867
|
+
minDate: A[0],
|
|
1868
|
+
maxDate: oe,
|
|
1869
|
+
unit: d
|
|
1637
1870
|
}),
|
|
1638
|
-
[
|
|
1639
|
-
),
|
|
1871
|
+
[A, te, oe, d]
|
|
1872
|
+
), ue = Y(
|
|
1640
1873
|
() => ({
|
|
1641
|
-
...
|
|
1874
|
+
...x,
|
|
1642
1875
|
mode: "vernier",
|
|
1643
|
-
unit:
|
|
1644
|
-
macroUnit:
|
|
1645
|
-
microUnit:
|
|
1646
|
-
minDate:
|
|
1647
|
-
maxDate:
|
|
1648
|
-
macroRange:
|
|
1649
|
-
microRange:
|
|
1650
|
-
onChangeMacroRange:
|
|
1651
|
-
|
|
1652
|
-
onChangeMacro: j,
|
|
1653
|
-
onChangeRange: q,
|
|
1654
|
-
onChangeRangeTuple: fe,
|
|
1655
|
-
onChangeMicroRange: q,
|
|
1656
|
-
onChangeMicroRangeTuple: fe,
|
|
1657
|
-
onChangeMicro: fe
|
|
1876
|
+
unit: t,
|
|
1877
|
+
macroUnit: o,
|
|
1878
|
+
microUnit: d,
|
|
1879
|
+
minDate: r,
|
|
1880
|
+
maxDate: n,
|
|
1881
|
+
macroRange: C,
|
|
1882
|
+
microRange: A,
|
|
1883
|
+
onChangeMacroRange: H,
|
|
1884
|
+
onChangeMicroRange: P
|
|
1658
1885
|
}),
|
|
1659
|
-
[
|
|
1886
|
+
[x, t, o, d, r, n, C, A, H, P]
|
|
1660
1887
|
);
|
|
1661
1888
|
return {
|
|
1662
|
-
macroRange:
|
|
1663
|
-
setMacroRange:
|
|
1664
|
-
microRange:
|
|
1665
|
-
setMicroRange:
|
|
1666
|
-
setMacroLowerDate:
|
|
1667
|
-
setMacroUpperDate:
|
|
1668
|
-
setMicroLowerDate:
|
|
1669
|
-
setMicroUpperDate:
|
|
1670
|
-
shiftMacroRange:
|
|
1671
|
-
shiftMicroRange:
|
|
1672
|
-
resetVernier:
|
|
1673
|
-
macroStartSelectorProps:
|
|
1674
|
-
macroEndSelectorProps:
|
|
1675
|
-
microStartSelectorProps:
|
|
1676
|
-
microEndSelectorProps:
|
|
1677
|
-
sliderProps:
|
|
1889
|
+
macroRange: C,
|
|
1890
|
+
setMacroRange: Z,
|
|
1891
|
+
microRange: A,
|
|
1892
|
+
setMicroRange: W,
|
|
1893
|
+
setMacroLowerDate: ne,
|
|
1894
|
+
setMacroUpperDate: K,
|
|
1895
|
+
setMicroLowerDate: X,
|
|
1896
|
+
setMicroUpperDate: te,
|
|
1897
|
+
shiftMacroRange: ae,
|
|
1898
|
+
shiftMicroRange: me,
|
|
1899
|
+
resetVernier: ze,
|
|
1900
|
+
macroStartSelectorProps: Ze,
|
|
1901
|
+
macroEndSelectorProps: mt,
|
|
1902
|
+
microStartSelectorProps: Se,
|
|
1903
|
+
microEndSelectorProps: pe,
|
|
1904
|
+
sliderProps: ue
|
|
1678
1905
|
};
|
|
1679
1906
|
}
|
|
1680
|
-
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1907
|
+
function wn(e) {
|
|
1908
|
+
const t = new Date(e, 0, 1);
|
|
1909
|
+
return t.setFullYear(e), t;
|
|
1910
|
+
}
|
|
1911
|
+
function pr(e, t) {
|
|
1912
|
+
if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
|
|
1913
|
+
throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
|
|
1914
|
+
}
|
|
1915
|
+
function vn(e, t) {
|
|
1916
|
+
if (e !== void 0 && !Number.isInteger(e))
|
|
1917
|
+
throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
|
|
1918
|
+
}
|
|
1919
|
+
function $a(e) {
|
|
1920
|
+
if (e !== void 0)
|
|
1921
|
+
try {
|
|
1922
|
+
Intl.DateTimeFormat.supportedLocalesOf([e]);
|
|
1923
|
+
} catch {
|
|
1924
|
+
throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
function pn(e, t, r) {
|
|
1928
|
+
const n = e === void 0 ? null : e, a = t === void 0 ? null : t.getFullYear();
|
|
1929
|
+
return n !== null && a !== null ? r(n, a) : n !== null ? n : a;
|
|
1930
|
+
}
|
|
1931
|
+
const ka = (e) => {
|
|
1932
|
+
const { value: t, initialDate: r, onChange: n, children: a, minYear: s, maxYear: o, minDate: d, maxDate: g, className: h = "", style: M, disabled: x = !1, prevYearAriaLabel: c = "Previous year", nextYearAriaLabel: p = "Next year", selectAriaLabel: _ = "Year", locale: Z } = e;
|
|
1933
|
+
pr(t, "value"), pr(r, "initialDate"), pr(d, "minDate"), pr(g, "maxDate"), vn(s, "minYear"), vn(o, "maxYear"), $a(Z);
|
|
1934
|
+
const D = t ?? r;
|
|
1935
|
+
if (D === void 0)
|
|
1936
|
+
throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");
|
|
1937
|
+
const [W, C] = he(() => D.getFullYear()), Q = d?.getTime(), A = g?.getTime(), O = Y(() => pn(s, d, Math.max), [s, Q]), y = Y(() => pn(o, g, Math.min), [o, A]);
|
|
1938
|
+
if (O === null || y === null)
|
|
1939
|
+
throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`) are both required; the year option list is never invented.");
|
|
1940
|
+
if (O > y)
|
|
1941
|
+
throw new RangeError(`YearSelector: the resolved lower bound ${O} is after the resolved upper bound ${y}.`);
|
|
1942
|
+
const B = t !== void 0, E = t !== void 0 ? t.getFullYear() : W, m = E < O || E > y, L = D.getTime();
|
|
1943
|
+
xt(() => {
|
|
1944
|
+
B || C(D.getFullYear());
|
|
1945
|
+
}, [B, L]);
|
|
1946
|
+
const S = (K) => {
|
|
1947
|
+
if (!x) {
|
|
1948
|
+
if (K < O || K > y)
|
|
1949
|
+
throw new RangeError(`YearSelector: refusing to emit ${K}, which lies outside the declared bounds ${O}-${y}.`);
|
|
1950
|
+
B || C(K), n?.(wn(K), K);
|
|
1951
|
+
}
|
|
1952
|
+
}, H = x || E - 1 < O, P = x || E + 1 > y, ne = Y(() => {
|
|
1953
|
+
const K = [];
|
|
1954
|
+
for (let X = y; X >= O; X--)
|
|
1955
|
+
K.push(X);
|
|
1956
|
+
return m && (K.push(E), K.sort((X, te) => te - X)), K;
|
|
1957
|
+
}, [O, y, m, E]);
|
|
1958
|
+
return /* @__PURE__ */ le("div", { className: `inline-flex w-32 items-center ${h}`, style: M, children: [
|
|
1959
|
+
/* @__PURE__ */ w(
|
|
1705
1960
|
"button",
|
|
1706
1961
|
{
|
|
1707
1962
|
type: "button",
|
|
1708
|
-
"aria-label":
|
|
1709
|
-
disabled:
|
|
1963
|
+
"aria-label": c,
|
|
1964
|
+
disabled: H,
|
|
1710
1965
|
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1711
|
-
onClick: () =>
|
|
1712
|
-
children: /* @__PURE__ */
|
|
1966
|
+
onClick: () => S(E - 1),
|
|
1967
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
|
|
1713
1968
|
}
|
|
1714
1969
|
),
|
|
1715
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ w(
|
|
1716
1971
|
"select",
|
|
1717
1972
|
{
|
|
1718
|
-
"aria-label":
|
|
1719
|
-
disabled:
|
|
1973
|
+
"aria-label": _,
|
|
1974
|
+
disabled: x,
|
|
1720
1975
|
className: "mx-1 my-auto w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",
|
|
1721
|
-
value:
|
|
1722
|
-
onChange: (
|
|
1723
|
-
|
|
1976
|
+
value: E,
|
|
1977
|
+
onChange: (K) => {
|
|
1978
|
+
if (!K.target.value) return;
|
|
1979
|
+
const X = Number(K.target.value);
|
|
1980
|
+
Number.isInteger(X) && S(X);
|
|
1724
1981
|
},
|
|
1725
|
-
children:
|
|
1982
|
+
children: ne.map((K) => /* @__PURE__ */ w("option", { value: K, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: Ae("year", wn(K), void 0, Z) }, K))
|
|
1726
1983
|
}
|
|
1727
1984
|
),
|
|
1728
|
-
/* @__PURE__ */
|
|
1985
|
+
/* @__PURE__ */ w(
|
|
1729
1986
|
"button",
|
|
1730
1987
|
{
|
|
1731
1988
|
type: "button",
|
|
1732
|
-
"aria-label":
|
|
1733
|
-
disabled:
|
|
1989
|
+
"aria-label": p,
|
|
1990
|
+
disabled: P,
|
|
1734
1991
|
className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
|
|
1735
|
-
onClick: () =>
|
|
1736
|
-
children: /* @__PURE__ */
|
|
1992
|
+
onClick: () => S(E + 1),
|
|
1993
|
+
children: /* @__PURE__ */ w("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
|
|
1737
1994
|
}
|
|
1738
1995
|
),
|
|
1739
|
-
|
|
1996
|
+
a
|
|
1740
1997
|
] });
|
|
1741
|
-
},
|
|
1742
|
-
const
|
|
1743
|
-
return !(
|
|
1998
|
+
}, Pa = tr(ka, (e, t) => {
|
|
1999
|
+
const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() : null, s = n ? n.getFullYear() : null;
|
|
2000
|
+
return !(a !== s || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.minDate?.getFullYear() !== t.minDate?.getFullYear() || e.maxDate?.getFullYear() !== t.maxDate?.getFullYear() || e.onChange !== t.onChange || e.children !== t.children || e.prevYearAriaLabel !== t.prevYearAriaLabel || e.nextYearAriaLabel !== t.nextYearAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
|
|
1744
2001
|
});
|
|
1745
|
-
|
|
2002
|
+
Pa.displayName = "YearSelector";
|
|
1746
2003
|
export {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
2004
|
+
_n as COLOR_SCHEME_PALETTES,
|
|
2005
|
+
Ma as DateSelector,
|
|
2006
|
+
Sa as MonthSelector,
|
|
2007
|
+
da as PeriodSlider,
|
|
2008
|
+
Pa as YearSelector,
|
|
2009
|
+
ke as addUnit,
|
|
2010
|
+
ca as areStylesEqual,
|
|
2011
|
+
Gn as calculateConnectDragValues,
|
|
2012
|
+
dn as calculateHandleDragValues,
|
|
2013
|
+
Wn as calculateKeyboardActionValues,
|
|
2014
|
+
Qn as calculateLabelSlant,
|
|
2015
|
+
ta as calculateVernierMacroDrag,
|
|
2016
|
+
ra as calculateVernierMicroDrag,
|
|
2017
|
+
ce as decode,
|
|
2018
|
+
re as encode,
|
|
2019
|
+
ut as findNearestDateIndex,
|
|
2020
|
+
Ae as formatLabel,
|
|
2021
|
+
Et as formatScreenReaderLabel,
|
|
2022
|
+
jn as getActiveDragHandle,
|
|
2023
|
+
yt as getMacroWindowEndDate,
|
|
2024
|
+
Qt as getSortedAllowedDates,
|
|
2025
|
+
We as normalizeDateByUnit,
|
|
2026
|
+
ea as resolveVernierTargetHandle,
|
|
2027
|
+
Ea as usePeriodSliderPoint,
|
|
2028
|
+
Ca as usePeriodSliderRange,
|
|
2029
|
+
Ia as useVernierSlider
|
|
1770
2030
|
};
|