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