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