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