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