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