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