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