@purpur/library 9.4.0 → 9.4.3
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.json +45 -0
- package/CHANGELOG.md +25 -1
- package/dist/LICENSE.txt +8 -1
- package/dist/calendar-BXQ3v62X.js +2 -0
- package/dist/{calendar-CBBV8n3x.js.map → calendar-BXQ3v62X.js.map} +1 -1
- package/dist/{calendar-DEXw83mu.mjs → calendar-d53vgYqR.mjs} +481 -465
- package/dist/{calendar-DEXw83mu.mjs.map → calendar-d53vgYqR.mjs.map} +1 -1
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.es.js +3 -3
- package/dist/comparison-table-C74IAVqz.js +2 -0
- package/dist/comparison-table-C74IAVqz.js.map +1 -0
- package/dist/comparison-table-DctKxmX9.mjs +267 -0
- package/dist/comparison-table-DctKxmX9.mjs.map +1 -0
- package/dist/comparison-table.cjs.js +1 -1
- package/dist/comparison-table.es.js +1 -1
- package/dist/components/calendar/src/calendar.d.ts +4 -11
- package/dist/components/calendar/src/calendar.d.ts.map +1 -1
- package/dist/components/comparison-table/src/comparison-table.d.ts.map +1 -1
- package/dist/components/comparison-table/src/components/OptionCard/option-card.d.ts +2 -1
- package/dist/components/comparison-table/src/components/OptionCard/option-card.d.ts.map +1 -1
- package/dist/components/comparison-table/src/components/ScrollProgress/scroll-progress.d.ts +1 -2
- package/dist/components/comparison-table/src/components/ScrollProgress/scroll-progress.d.ts.map +1 -1
- package/dist/components/date-field/src/date-field.d.ts.map +1 -1
- package/dist/components/date-picker/src/date-picker.d.ts +11 -2
- package/dist/components/date-picker/src/date-picker.d.ts.map +1 -1
- package/dist/components/date-range-field/src/date-range-field.d.ts +27 -0
- package/dist/components/date-range-field/src/date-range-field.d.ts.map +1 -0
- package/dist/components-metadata.js +10 -0
- package/dist/date-field-BKKty89_.js +2 -0
- package/dist/{date-field-BJaomFjs.js.map → date-field-BKKty89_.js.map} +1 -1
- package/dist/{date-field-D3rTtf9Y.mjs → date-field-Cv5CKR1y.mjs} +276 -268
- package/dist/{date-field-D3rTtf9Y.mjs.map → date-field-Cv5CKR1y.mjs.map} +1 -1
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.es.js +1 -1
- package/dist/date-picker-CzxhZxsw.mjs +1611 -0
- package/dist/date-picker-CzxhZxsw.mjs.map +1 -0
- package/dist/date-picker-uyPKJulK.js +2 -0
- package/dist/date-picker-uyPKJulK.js.map +1 -0
- package/dist/date-picker.cjs.js +1 -1
- package/dist/date-picker.es.js +1 -1
- package/dist/date-range-field-CFcjprIl.mjs +142 -0
- package/dist/date-range-field-CFcjprIl.mjs.map +1 -0
- package/dist/date-range-field-D8vLeSwp.js +2 -0
- package/dist/date-range-field-D8vLeSwp.js.map +1 -0
- package/dist/date-range-field.cjs.js +2 -0
- package/dist/date-range-field.cjs.js.map +1 -0
- package/dist/date-range-field.es.js +5 -0
- package/dist/date-range-field.es.js.map +1 -0
- package/dist/{floating-ui.react-dom-gsHLgcoR.mjs → floating-ui.react-dom-EredA301.mjs} +3 -3
- package/dist/{floating-ui.react-dom-gsHLgcoR.mjs.map → floating-ui.react-dom-EredA301.mjs.map} +1 -1
- package/dist/{format-DpkYPs7O.mjs → format-CWOXI-dC.mjs} +8 -8
- package/dist/{format-DpkYPs7O.mjs.map → format-CWOXI-dC.mjs.map} +1 -1
- package/dist/libraries/library/src/date-range-field.d.ts +6 -0
- package/dist/libraries/library/src/date-range-field.d.ts.map +1 -0
- package/dist/libraries/library/src/library.d.ts +1 -0
- package/dist/libraries/library/src/library.d.ts.map +1 -1
- package/dist/library.cjs.js +1 -1
- package/dist/library.es.js +636 -633
- package/dist/library.es.js.map +1 -1
- package/dist/notification-banner-BxHwTFnH.js +2 -0
- package/dist/{notification-banner-jY8rQH2M.js.map → notification-banner-BxHwTFnH.js.map} +1 -1
- package/dist/{notification-banner-BOclxqFu.mjs → notification-banner-CZTQZ5Le.mjs} +29 -29
- package/dist/{notification-banner-BOclxqFu.mjs.map → notification-banner-CZTQZ5Le.mjs.map} +1 -1
- package/dist/notification-banner.cjs.js +1 -1
- package/dist/notification-banner.es.js +1 -1
- package/dist/{popover-_xJATlhN.mjs → popover-I26xNbTz.mjs} +2 -2
- package/dist/{popover-_xJATlhN.mjs.map → popover-I26xNbTz.mjs.map} +1 -1
- package/dist/popover.es.js +1 -1
- package/dist/purpur.css +1 -1
- package/dist/{stepper-CNnx_NiR.mjs → stepper-CWR2vGPj.mjs} +2 -2
- package/dist/{stepper-CNnx_NiR.mjs.map → stepper-CWR2vGPj.mjs.map} +1 -1
- package/dist/stepper.es.js +1 -1
- package/dist/{table-D_sdSJyr.mjs → table-g_n68i4s.mjs} +2 -2
- package/dist/{table-D_sdSJyr.mjs.map → table-g_n68i4s.mjs.map} +1 -1
- package/dist/table.es.js +1 -1
- package/dist/{tooltip-VlURN8H3.mjs → tooltip-LU2Cy-QC.mjs} +2 -2
- package/dist/{tooltip-VlURN8H3.mjs.map → tooltip-LU2Cy-QC.mjs.map} +1 -1
- package/dist/tooltip.es.js +1 -1
- package/dist/{zh-TW-oiRD71xW.mjs → zh-TW-DrQ6h7hA.mjs} +2 -2
- package/dist/{zh-TW-oiRD71xW.mjs.map → zh-TW-DrQ6h7hA.mjs.map} +1 -1
- package/package.json +29 -28
- package/src/aliases.ts +7 -0
- package/src/date-range-field.ts +6 -0
- package/src/entries.js +1 -0
- package/src/library.ts +2 -0
- package/dist/calendar-CBBV8n3x.js +0 -2
- package/dist/comparison-table-8bOJmz-L.mjs +0 -275
- package/dist/comparison-table-8bOJmz-L.mjs.map +0 -1
- package/dist/comparison-table-mKL2IHXW.js +0 -2
- package/dist/comparison-table-mKL2IHXW.js.map +0 -1
- package/dist/date-field-BJaomFjs.js +0 -2
- package/dist/date-picker-CbUNbOhn.mjs +0 -1415
- package/dist/date-picker-CbUNbOhn.mjs.map +0 -1
- package/dist/date-picker-DYXNB5aU.js +0 -2
- package/dist/date-picker-DYXNB5aU.js.map +0 -1
- package/dist/notification-banner-jY8rQH2M.js +0 -2
|
@@ -0,0 +1,1611 @@
|
|
|
1
|
+
import { jsxs as Te, jsx as k, Fragment as nn } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { useLayoutEffect as Ct, forwardRef as rn, useState as me, useRef as fe, useEffect as xt, useId as on, useCallback as Ze } from "react";
|
|
4
|
+
import { i as It, a as ue, u as sn, b as Z, g as $e, c as an, d as Be, e as un, f as cn, h as ln, j as Dt, k as At, o as Ft, l as kt } from "./floating-ui.react-dom-EredA301.mjs";
|
|
5
|
+
import * as fn from "react-dom";
|
|
6
|
+
import { C as ke, i as dn } from "./calendar-d53vgYqR.mjs";
|
|
7
|
+
import { D as et } from "./date-field-Cv5CKR1y.mjs";
|
|
8
|
+
import { r as tt, D as mn } from "./date-range-field-CFcjprIl.mjs";
|
|
9
|
+
import { D as Ee } from "./drawer-8Acg4wkV.mjs";
|
|
10
|
+
import { c as gn } from "./bind-CU-R61T-.mjs";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import { a as nt } from "./format-CWOXI-dC.mjs";
|
|
13
|
+
var vn = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"], Pe = /* @__PURE__ */ vn.join(","), Pt = typeof Element > "u", Se = Pt ? function() {
|
|
14
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Oe = !Pt && Element.prototype.getRootNode ? function(e) {
|
|
15
|
+
var t;
|
|
16
|
+
return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
|
|
17
|
+
} : function(e) {
|
|
18
|
+
return e?.ownerDocument;
|
|
19
|
+
}, Ne = function(t, n) {
|
|
20
|
+
var r;
|
|
21
|
+
n === void 0 && (n = !0);
|
|
22
|
+
var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && // closest does not exist on shadow roots, so we fall back to a manual
|
|
23
|
+
// lookup upward, in case it is not defined.
|
|
24
|
+
(typeof t.closest == "function" ? t.closest("[inert]") : Ne(t.parentNode));
|
|
25
|
+
return s;
|
|
26
|
+
}, pn = function(t) {
|
|
27
|
+
var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
|
|
28
|
+
return r === "" || r === "true";
|
|
29
|
+
}, Ot = function(t, n, r) {
|
|
30
|
+
if (Ne(t))
|
|
31
|
+
return [];
|
|
32
|
+
var o = Array.prototype.slice.apply(t.querySelectorAll(Pe));
|
|
33
|
+
return n && Se.call(t, Pe) && o.unshift(t), o = o.filter(r), o;
|
|
34
|
+
}, Me = function(t, n, r) {
|
|
35
|
+
for (var o = [], i = Array.from(t); i.length; ) {
|
|
36
|
+
var s = i.shift();
|
|
37
|
+
if (!Ne(s, !1))
|
|
38
|
+
if (s.tagName === "SLOT") {
|
|
39
|
+
var u = s.assignedElements(), l = u.length ? u : s.children, a = Me(l, !0, r);
|
|
40
|
+
r.flatten ? o.push.apply(o, a) : o.push({
|
|
41
|
+
scopeParent: s,
|
|
42
|
+
candidates: a
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
var v = Se.call(s, Pe);
|
|
46
|
+
v && r.filter(s) && (n || !t.includes(s)) && o.push(s);
|
|
47
|
+
var y = s.shadowRoot || // check for an undisclosed shadow
|
|
48
|
+
typeof r.getShadowRoot == "function" && r.getShadowRoot(s), A = !Ne(y, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
|
|
49
|
+
if (y && A) {
|
|
50
|
+
var g = Me(y === !0 ? s.children : y.children, !0, r);
|
|
51
|
+
r.flatten ? o.push.apply(o, g) : o.push({
|
|
52
|
+
scopeParent: s,
|
|
53
|
+
candidates: g
|
|
54
|
+
});
|
|
55
|
+
} else
|
|
56
|
+
i.unshift.apply(i, s.children);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return o;
|
|
60
|
+
}, Nt = function(t) {
|
|
61
|
+
return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
|
|
62
|
+
}, Mt = function(t) {
|
|
63
|
+
if (!t)
|
|
64
|
+
throw new Error("No node provided");
|
|
65
|
+
return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || pn(t)) && !Nt(t) ? 0 : t.tabIndex;
|
|
66
|
+
}, bn = function(t, n) {
|
|
67
|
+
var r = Mt(t);
|
|
68
|
+
return r < 0 && n && !Nt(t) ? 0 : r;
|
|
69
|
+
}, hn = function(t, n) {
|
|
70
|
+
return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
|
|
71
|
+
}, _t = function(t) {
|
|
72
|
+
return t.tagName === "INPUT";
|
|
73
|
+
}, Rn = function(t) {
|
|
74
|
+
return _t(t) && t.type === "hidden";
|
|
75
|
+
}, En = function(t) {
|
|
76
|
+
var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
|
|
77
|
+
return r.tagName === "SUMMARY";
|
|
78
|
+
});
|
|
79
|
+
return n;
|
|
80
|
+
}, yn = function(t, n) {
|
|
81
|
+
for (var r = 0; r < t.length; r++)
|
|
82
|
+
if (t[r].checked && t[r].form === n)
|
|
83
|
+
return t[r];
|
|
84
|
+
}, wn = function(t) {
|
|
85
|
+
if (!t.name)
|
|
86
|
+
return !0;
|
|
87
|
+
var n = t.form || Oe(t), r = function(u) {
|
|
88
|
+
return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
|
|
89
|
+
}, o;
|
|
90
|
+
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
91
|
+
o = r(window.CSS.escape(t.name));
|
|
92
|
+
else
|
|
93
|
+
try {
|
|
94
|
+
o = r(t.name);
|
|
95
|
+
} catch (s) {
|
|
96
|
+
return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
|
|
97
|
+
}
|
|
98
|
+
var i = yn(o, t.form);
|
|
99
|
+
return !i || i === t;
|
|
100
|
+
}, Tn = function(t) {
|
|
101
|
+
return _t(t) && t.type === "radio";
|
|
102
|
+
}, Sn = function(t) {
|
|
103
|
+
return Tn(t) && !wn(t);
|
|
104
|
+
}, Cn = function(t) {
|
|
105
|
+
var n, r = t && Oe(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
|
|
106
|
+
if (r && r !== t) {
|
|
107
|
+
var s, u, l;
|
|
108
|
+
for (i = !!((s = o) !== null && s !== void 0 && (u = s.ownerDocument) !== null && u !== void 0 && u.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !i && o; ) {
|
|
109
|
+
var a, v, y;
|
|
110
|
+
r = Oe(o), o = (a = r) === null || a === void 0 ? void 0 : a.host, i = !!((v = o) !== null && v !== void 0 && (y = v.ownerDocument) !== null && y !== void 0 && y.contains(o));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return i;
|
|
114
|
+
}, rt = function(t) {
|
|
115
|
+
var n = t.getBoundingClientRect(), r = n.width, o = n.height;
|
|
116
|
+
return r === 0 && o === 0;
|
|
117
|
+
}, xn = function(t, n) {
|
|
118
|
+
var r = n.displayCheck, o = n.getShadowRoot;
|
|
119
|
+
if (r === "full-native" && "checkVisibility" in t) {
|
|
120
|
+
var i = t.checkVisibility({
|
|
121
|
+
// Checking opacity might be desirable for some use cases, but natively,
|
|
122
|
+
// opacity zero elements _are_ focusable and tabbable.
|
|
123
|
+
checkOpacity: !1,
|
|
124
|
+
opacityProperty: !1,
|
|
125
|
+
contentVisibilityAuto: !0,
|
|
126
|
+
visibilityProperty: !0,
|
|
127
|
+
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
128
|
+
// support both. However, this alias has wider browser support (Chrome
|
|
129
|
+
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
130
|
+
// we include it anyway.
|
|
131
|
+
checkVisibilityCSS: !0
|
|
132
|
+
});
|
|
133
|
+
return !i;
|
|
134
|
+
}
|
|
135
|
+
if (getComputedStyle(t).visibility === "hidden")
|
|
136
|
+
return !0;
|
|
137
|
+
var s = Se.call(t, "details>summary:first-of-type"), u = s ? t.parentElement : t;
|
|
138
|
+
if (Se.call(u, "details:not([open]) *"))
|
|
139
|
+
return !0;
|
|
140
|
+
if (!r || r === "full" || // full-native can run this branch when it falls through in case
|
|
141
|
+
// Element#checkVisibility is unsupported
|
|
142
|
+
r === "full-native" || r === "legacy-full") {
|
|
143
|
+
if (typeof o == "function") {
|
|
144
|
+
for (var l = t; t; ) {
|
|
145
|
+
var a = t.parentElement, v = Oe(t);
|
|
146
|
+
if (a && !a.shadowRoot && o(a) === !0)
|
|
147
|
+
return rt(t);
|
|
148
|
+
t.assignedSlot ? t = t.assignedSlot : !a && v !== t.ownerDocument ? t = v.host : t = a;
|
|
149
|
+
}
|
|
150
|
+
t = l;
|
|
151
|
+
}
|
|
152
|
+
if (Cn(t))
|
|
153
|
+
return !t.getClientRects().length;
|
|
154
|
+
if (r !== "legacy-full")
|
|
155
|
+
return !0;
|
|
156
|
+
} else if (r === "non-zero-area")
|
|
157
|
+
return rt(t);
|
|
158
|
+
return !1;
|
|
159
|
+
}, In = function(t) {
|
|
160
|
+
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
|
|
161
|
+
for (var n = t.parentElement; n; ) {
|
|
162
|
+
if (n.tagName === "FIELDSET" && n.disabled) {
|
|
163
|
+
for (var r = 0; r < n.children.length; r++) {
|
|
164
|
+
var o = n.children.item(r);
|
|
165
|
+
if (o.tagName === "LEGEND")
|
|
166
|
+
return Se.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
|
|
167
|
+
}
|
|
168
|
+
return !0;
|
|
169
|
+
}
|
|
170
|
+
n = n.parentElement;
|
|
171
|
+
}
|
|
172
|
+
return !1;
|
|
173
|
+
}, He = function(t, n) {
|
|
174
|
+
return !(n.disabled || Rn(n) || xn(n, t) || // For a details element with a summary, the summary element gets the focus
|
|
175
|
+
En(n) || In(n));
|
|
176
|
+
}, je = function(t, n) {
|
|
177
|
+
return !(Sn(n) || Mt(n) < 0 || !He(t, n));
|
|
178
|
+
}, Dn = function(t) {
|
|
179
|
+
var n = parseInt(t.getAttribute("tabindex"), 10);
|
|
180
|
+
return !!(isNaN(n) || n >= 0);
|
|
181
|
+
}, Lt = function(t) {
|
|
182
|
+
var n = [], r = [];
|
|
183
|
+
return t.forEach(function(o, i) {
|
|
184
|
+
var s = !!o.scopeParent, u = s ? o.scopeParent : o, l = bn(u, s), a = s ? Lt(o.candidates) : u;
|
|
185
|
+
l === 0 ? s ? n.push.apply(n, a) : n.push(u) : r.push({
|
|
186
|
+
documentOrder: i,
|
|
187
|
+
tabIndex: l,
|
|
188
|
+
item: o,
|
|
189
|
+
isScope: s,
|
|
190
|
+
content: a
|
|
191
|
+
});
|
|
192
|
+
}), r.sort(hn).reduce(function(o, i) {
|
|
193
|
+
return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
|
|
194
|
+
}, []).concat(n);
|
|
195
|
+
}, Le = function(t, n) {
|
|
196
|
+
n = n || {};
|
|
197
|
+
var r;
|
|
198
|
+
return n.getShadowRoot ? r = Me([t], n.includeContainer, {
|
|
199
|
+
filter: je.bind(null, n),
|
|
200
|
+
flatten: !1,
|
|
201
|
+
getShadowRoot: n.getShadowRoot,
|
|
202
|
+
shadowRootFilter: Dn
|
|
203
|
+
}) : r = Ot(t, n.includeContainer, je.bind(null, n)), Lt(r);
|
|
204
|
+
}, An = function(t, n) {
|
|
205
|
+
n = n || {};
|
|
206
|
+
var r;
|
|
207
|
+
return n.getShadowRoot ? r = Me([t], n.includeContainer, {
|
|
208
|
+
filter: He.bind(null, n),
|
|
209
|
+
flatten: !0,
|
|
210
|
+
getShadowRoot: n.getShadowRoot
|
|
211
|
+
}) : r = Ot(t, n.includeContainer, He.bind(null, n)), r;
|
|
212
|
+
}, $t = function(t, n) {
|
|
213
|
+
if (n = n || {}, !t)
|
|
214
|
+
throw new Error("No node provided");
|
|
215
|
+
return Se.call(t, Pe) === !1 ? !1 : je(n, t);
|
|
216
|
+
};
|
|
217
|
+
function Fn() {
|
|
218
|
+
const e = navigator.userAgentData;
|
|
219
|
+
return e != null && e.platform ? e.platform : navigator.platform;
|
|
220
|
+
}
|
|
221
|
+
function Bt() {
|
|
222
|
+
const e = navigator.userAgentData;
|
|
223
|
+
return e && Array.isArray(e.brands) ? e.brands.map((t) => {
|
|
224
|
+
let {
|
|
225
|
+
brand: n,
|
|
226
|
+
version: r
|
|
227
|
+
} = t;
|
|
228
|
+
return n + "/" + r;
|
|
229
|
+
}).join(" ") : navigator.userAgent;
|
|
230
|
+
}
|
|
231
|
+
function kn() {
|
|
232
|
+
return /apple/i.test(navigator.vendor);
|
|
233
|
+
}
|
|
234
|
+
function ze() {
|
|
235
|
+
const e = /android/i;
|
|
236
|
+
return e.test(Fn()) || e.test(Bt());
|
|
237
|
+
}
|
|
238
|
+
function Pn() {
|
|
239
|
+
return Bt().includes("jsdom/");
|
|
240
|
+
}
|
|
241
|
+
const ot = "data-floating-ui-focusable", On = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
242
|
+
function Re(e) {
|
|
243
|
+
let t = e.activeElement;
|
|
244
|
+
for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
|
|
245
|
+
var n;
|
|
246
|
+
t = t.shadowRoot.activeElement;
|
|
247
|
+
}
|
|
248
|
+
return t;
|
|
249
|
+
}
|
|
250
|
+
function X(e, t) {
|
|
251
|
+
if (!e || !t)
|
|
252
|
+
return !1;
|
|
253
|
+
const n = t.getRootNode == null ? void 0 : t.getRootNode();
|
|
254
|
+
if (e.contains(t))
|
|
255
|
+
return !0;
|
|
256
|
+
if (n && It(n)) {
|
|
257
|
+
let r = t;
|
|
258
|
+
for (; r; ) {
|
|
259
|
+
if (e === r)
|
|
260
|
+
return !0;
|
|
261
|
+
r = r.parentNode || r.host;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return !1;
|
|
265
|
+
}
|
|
266
|
+
function de(e) {
|
|
267
|
+
return "composedPath" in e ? e.composedPath()[0] : e.target;
|
|
268
|
+
}
|
|
269
|
+
function Ke(e, t) {
|
|
270
|
+
if (t == null)
|
|
271
|
+
return !1;
|
|
272
|
+
if ("composedPath" in e)
|
|
273
|
+
return e.composedPath().includes(t);
|
|
274
|
+
const n = e;
|
|
275
|
+
return n.target != null && t.contains(n.target);
|
|
276
|
+
}
|
|
277
|
+
function Nn(e) {
|
|
278
|
+
return e.matches("html,body");
|
|
279
|
+
}
|
|
280
|
+
function ee(e) {
|
|
281
|
+
return e?.ownerDocument || document;
|
|
282
|
+
}
|
|
283
|
+
function Kt(e) {
|
|
284
|
+
return ue(e) && e.matches(On);
|
|
285
|
+
}
|
|
286
|
+
function it(e) {
|
|
287
|
+
return e ? e.getAttribute("role") === "combobox" && Kt(e) : !1;
|
|
288
|
+
}
|
|
289
|
+
function st(e) {
|
|
290
|
+
return e ? e.hasAttribute(ot) ? e : e.querySelector("[" + ot + "]") || e : null;
|
|
291
|
+
}
|
|
292
|
+
function ye(e, t, n) {
|
|
293
|
+
return n === void 0 && (n = !0), e.filter((o) => {
|
|
294
|
+
var i;
|
|
295
|
+
return o.parentId === t && (!n || ((i = o.context) == null ? void 0 : i.open));
|
|
296
|
+
}).flatMap((o) => [o, ...ye(e, o.id, n)]);
|
|
297
|
+
}
|
|
298
|
+
function at(e, t) {
|
|
299
|
+
var n;
|
|
300
|
+
let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId;
|
|
301
|
+
for (; o; ) {
|
|
302
|
+
const i = e.find((s) => s.id === o);
|
|
303
|
+
o = i?.parentId, i && (r = r.concat(i));
|
|
304
|
+
}
|
|
305
|
+
return r;
|
|
306
|
+
}
|
|
307
|
+
function We(e) {
|
|
308
|
+
e.preventDefault(), e.stopPropagation();
|
|
309
|
+
}
|
|
310
|
+
function Mn(e) {
|
|
311
|
+
return "nativeEvent" in e;
|
|
312
|
+
}
|
|
313
|
+
function _n(e) {
|
|
314
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : ze() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
|
315
|
+
}
|
|
316
|
+
function Ln(e) {
|
|
317
|
+
return Pn() ? !1 : !ze() && e.width === 0 && e.height === 0 || ze() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
|
|
318
|
+
e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
|
|
319
|
+
}
|
|
320
|
+
function ut(e, t) {
|
|
321
|
+
return ["mouse", "pen"].includes(e);
|
|
322
|
+
}
|
|
323
|
+
var $n = typeof document < "u", Bn = function() {
|
|
324
|
+
}, J = $n ? Ct : Bn;
|
|
325
|
+
const Kn = {
|
|
326
|
+
...d
|
|
327
|
+
};
|
|
328
|
+
function Ve(e) {
|
|
329
|
+
const t = d.useRef(e);
|
|
330
|
+
return J(() => {
|
|
331
|
+
t.current = e;
|
|
332
|
+
}), t;
|
|
333
|
+
}
|
|
334
|
+
const Wn = Kn.useInsertionEffect, Vn = Wn || ((e) => e());
|
|
335
|
+
function ie(e) {
|
|
336
|
+
const t = d.useRef(() => {
|
|
337
|
+
if (process.env.NODE_ENV !== "production")
|
|
338
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
339
|
+
});
|
|
340
|
+
return Vn(() => {
|
|
341
|
+
t.current = e;
|
|
342
|
+
}), d.useCallback(function() {
|
|
343
|
+
for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
|
|
344
|
+
r[o] = arguments[o];
|
|
345
|
+
return t.current == null ? void 0 : t.current(...r);
|
|
346
|
+
}, []);
|
|
347
|
+
}
|
|
348
|
+
const De = () => ({
|
|
349
|
+
getShadowRoot: !0,
|
|
350
|
+
displayCheck: (
|
|
351
|
+
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
352
|
+
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
353
|
+
// determines if the current environment is JSDOM-like.
|
|
354
|
+
typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
|
|
355
|
+
)
|
|
356
|
+
});
|
|
357
|
+
function Wt(e, t) {
|
|
358
|
+
const n = Le(e, De()), r = n.length;
|
|
359
|
+
if (r === 0) return;
|
|
360
|
+
const o = Re(ee(e)), i = n.indexOf(o), s = i === -1 ? t === 1 ? 0 : r - 1 : i + t;
|
|
361
|
+
return n[s];
|
|
362
|
+
}
|
|
363
|
+
function Vt(e) {
|
|
364
|
+
return Wt(ee(e).body, 1) || e;
|
|
365
|
+
}
|
|
366
|
+
function qt(e) {
|
|
367
|
+
return Wt(ee(e).body, -1) || e;
|
|
368
|
+
}
|
|
369
|
+
function xe(e, t) {
|
|
370
|
+
const n = t || e.currentTarget, r = e.relatedTarget;
|
|
371
|
+
return !r || !X(n, r);
|
|
372
|
+
}
|
|
373
|
+
function qn(e) {
|
|
374
|
+
Le(e, De()).forEach((n) => {
|
|
375
|
+
n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function ct(e) {
|
|
379
|
+
e.querySelectorAll("[data-tabindex]").forEach((n) => {
|
|
380
|
+
const r = n.dataset.tabindex;
|
|
381
|
+
delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const Un = "data-floating-ui-focusable", lt = "active", ft = "selected", Hn = {
|
|
385
|
+
...d
|
|
386
|
+
};
|
|
387
|
+
let dt = !1, jn = 0;
|
|
388
|
+
const mt = () => (
|
|
389
|
+
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
390
|
+
// on <React 18
|
|
391
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + jn++
|
|
392
|
+
);
|
|
393
|
+
function zn() {
|
|
394
|
+
const [e, t] = d.useState(() => dt ? mt() : void 0);
|
|
395
|
+
return J(() => {
|
|
396
|
+
e == null && t(mt());
|
|
397
|
+
}, []), d.useEffect(() => {
|
|
398
|
+
dt = !0;
|
|
399
|
+
}, []), e;
|
|
400
|
+
}
|
|
401
|
+
const Gn = Hn.useId, Ut = Gn || zn;
|
|
402
|
+
let Ge;
|
|
403
|
+
process.env.NODE_ENV !== "production" && (Ge = /* @__PURE__ */ new Set());
|
|
404
|
+
function Yn() {
|
|
405
|
+
for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
|
|
406
|
+
n[r] = arguments[r];
|
|
407
|
+
const o = "Floating UI: " + n.join(" ");
|
|
408
|
+
if (!((e = Ge) != null && e.has(o))) {
|
|
409
|
+
var i;
|
|
410
|
+
(i = Ge) == null || i.add(o), console.error(o);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function Xn() {
|
|
414
|
+
const e = /* @__PURE__ */ new Map();
|
|
415
|
+
return {
|
|
416
|
+
emit(t, n) {
|
|
417
|
+
var r;
|
|
418
|
+
(r = e.get(t)) == null || r.forEach((o) => o(n));
|
|
419
|
+
},
|
|
420
|
+
on(t, n) {
|
|
421
|
+
e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
|
|
422
|
+
},
|
|
423
|
+
off(t, n) {
|
|
424
|
+
var r;
|
|
425
|
+
(r = e.get(t)) == null || r.delete(n);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
const Jn = /* @__PURE__ */ d.createContext(null), Qn = /* @__PURE__ */ d.createContext(null), Zn = () => {
|
|
430
|
+
var e;
|
|
431
|
+
return ((e = d.useContext(Jn)) == null ? void 0 : e.id) || null;
|
|
432
|
+
}, Ye = () => d.useContext(Qn);
|
|
433
|
+
function Ie(e) {
|
|
434
|
+
return "data-floating-ui-" + e;
|
|
435
|
+
}
|
|
436
|
+
function er(e) {
|
|
437
|
+
e.current !== -1 && (clearTimeout(e.current), e.current = -1);
|
|
438
|
+
}
|
|
439
|
+
let gt = 0;
|
|
440
|
+
function he(e, t) {
|
|
441
|
+
t === void 0 && (t = {});
|
|
442
|
+
const {
|
|
443
|
+
preventScroll: n = !1,
|
|
444
|
+
cancelPrevious: r = !0,
|
|
445
|
+
sync: o = !1
|
|
446
|
+
} = t;
|
|
447
|
+
r && cancelAnimationFrame(gt);
|
|
448
|
+
const i = () => e?.focus({
|
|
449
|
+
preventScroll: n
|
|
450
|
+
});
|
|
451
|
+
o ? i() : gt = requestAnimationFrame(i);
|
|
452
|
+
}
|
|
453
|
+
function tr(e) {
|
|
454
|
+
return e?.ownerDocument || document;
|
|
455
|
+
}
|
|
456
|
+
const we = {
|
|
457
|
+
inert: /* @__PURE__ */ new WeakMap(),
|
|
458
|
+
"aria-hidden": /* @__PURE__ */ new WeakMap(),
|
|
459
|
+
none: /* @__PURE__ */ new WeakMap()
|
|
460
|
+
};
|
|
461
|
+
function vt(e) {
|
|
462
|
+
return e === "inert" ? we.inert : e === "aria-hidden" ? we["aria-hidden"] : we.none;
|
|
463
|
+
}
|
|
464
|
+
let Ae = /* @__PURE__ */ new WeakSet(), Fe = {}, qe = 0;
|
|
465
|
+
const nr = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype;
|
|
466
|
+
function Ht(e) {
|
|
467
|
+
return e ? It(e) ? e.host : Ht(e.parentNode) : null;
|
|
468
|
+
}
|
|
469
|
+
const rr = (e, t) => t.map((n) => {
|
|
470
|
+
if (e.contains(n))
|
|
471
|
+
return n;
|
|
472
|
+
const r = Ht(n);
|
|
473
|
+
return e.contains(r) ? r : null;
|
|
474
|
+
}).filter((n) => n != null);
|
|
475
|
+
function or(e, t, n, r) {
|
|
476
|
+
const o = "data-floating-ui-inert", i = r ? "inert" : n ? "aria-hidden" : null, s = rr(t, e), u = /* @__PURE__ */ new Set(), l = new Set(s), a = [];
|
|
477
|
+
Fe[o] || (Fe[o] = /* @__PURE__ */ new WeakMap());
|
|
478
|
+
const v = Fe[o];
|
|
479
|
+
s.forEach(y), A(t), u.clear();
|
|
480
|
+
function y(g) {
|
|
481
|
+
!g || u.has(g) || (u.add(g), g.parentNode && y(g.parentNode));
|
|
482
|
+
}
|
|
483
|
+
function A(g) {
|
|
484
|
+
!g || l.has(g) || [].forEach.call(g.children, (E) => {
|
|
485
|
+
if (Dt(E) !== "script")
|
|
486
|
+
if (u.has(E))
|
|
487
|
+
A(E);
|
|
488
|
+
else {
|
|
489
|
+
const m = i ? E.getAttribute(i) : null, C = m !== null && m !== "false", T = vt(i), b = (T.get(E) || 0) + 1, h = (v.get(E) || 0) + 1;
|
|
490
|
+
T.set(E, b), v.set(E, h), a.push(E), b === 1 && C && Ae.add(E), h === 1 && E.setAttribute(o, ""), !C && i && E.setAttribute(i, i === "inert" ? "" : "true");
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
return qe++, () => {
|
|
495
|
+
a.forEach((g) => {
|
|
496
|
+
const E = vt(i), C = (E.get(g) || 0) - 1, T = (v.get(g) || 0) - 1;
|
|
497
|
+
E.set(g, C), v.set(g, T), C || (!Ae.has(g) && i && g.removeAttribute(i), Ae.delete(g)), T || g.removeAttribute(o);
|
|
498
|
+
}), qe--, qe || (we.inert = /* @__PURE__ */ new WeakMap(), we["aria-hidden"] = /* @__PURE__ */ new WeakMap(), we.none = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakSet(), Fe = {});
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function pt(e, t, n) {
|
|
502
|
+
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
503
|
+
const r = tr(e[0]).body;
|
|
504
|
+
return or(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))), r, t, n);
|
|
505
|
+
}
|
|
506
|
+
const Xe = {
|
|
507
|
+
border: 0,
|
|
508
|
+
clip: "rect(0 0 0 0)",
|
|
509
|
+
height: "1px",
|
|
510
|
+
margin: "-1px",
|
|
511
|
+
overflow: "hidden",
|
|
512
|
+
padding: 0,
|
|
513
|
+
position: "fixed",
|
|
514
|
+
whiteSpace: "nowrap",
|
|
515
|
+
width: "1px",
|
|
516
|
+
top: 0,
|
|
517
|
+
left: 0
|
|
518
|
+
}, _e = /* @__PURE__ */ d.forwardRef(function(t, n) {
|
|
519
|
+
const [r, o] = d.useState();
|
|
520
|
+
J(() => {
|
|
521
|
+
kn() && o("button");
|
|
522
|
+
}, []);
|
|
523
|
+
const i = {
|
|
524
|
+
ref: n,
|
|
525
|
+
tabIndex: 0,
|
|
526
|
+
// Role is only for VoiceOver
|
|
527
|
+
role: r,
|
|
528
|
+
"aria-hidden": r ? void 0 : !0,
|
|
529
|
+
[Ie("focus-guard")]: "",
|
|
530
|
+
style: Xe
|
|
531
|
+
};
|
|
532
|
+
return /* @__PURE__ */ k("span", {
|
|
533
|
+
...t,
|
|
534
|
+
...i
|
|
535
|
+
});
|
|
536
|
+
}), ir = {
|
|
537
|
+
clipPath: "inset(50%)",
|
|
538
|
+
position: "fixed",
|
|
539
|
+
top: 0,
|
|
540
|
+
left: 0
|
|
541
|
+
}, jt = /* @__PURE__ */ d.createContext(null), bt = /* @__PURE__ */ Ie("portal");
|
|
542
|
+
function sr(e) {
|
|
543
|
+
e === void 0 && (e = {});
|
|
544
|
+
const {
|
|
545
|
+
id: t,
|
|
546
|
+
root: n
|
|
547
|
+
} = e, r = Ut(), o = Gt(), [i, s] = d.useState(null), u = d.useRef(null);
|
|
548
|
+
return J(() => () => {
|
|
549
|
+
i?.remove(), queueMicrotask(() => {
|
|
550
|
+
u.current = null;
|
|
551
|
+
});
|
|
552
|
+
}, [i]), J(() => {
|
|
553
|
+
if (!r || u.current) return;
|
|
554
|
+
const l = t ? document.getElementById(t) : null;
|
|
555
|
+
if (!l) return;
|
|
556
|
+
const a = document.createElement("div");
|
|
557
|
+
a.id = r, a.setAttribute(bt, ""), l.appendChild(a), u.current = a, s(a);
|
|
558
|
+
}, [t, r]), J(() => {
|
|
559
|
+
if (n === null || !r || u.current) return;
|
|
560
|
+
let l = n || o?.portalNode;
|
|
561
|
+
l && !ln(l) && (l = l.current), l = l || document.body;
|
|
562
|
+
let a = null;
|
|
563
|
+
t && (a = document.createElement("div"), a.id = t, l.appendChild(a));
|
|
564
|
+
const v = document.createElement("div");
|
|
565
|
+
v.id = r, v.setAttribute(bt, ""), l = a || l, l.appendChild(v), u.current = v, s(v);
|
|
566
|
+
}, [t, n, r, o]), i;
|
|
567
|
+
}
|
|
568
|
+
function zt(e) {
|
|
569
|
+
const {
|
|
570
|
+
children: t,
|
|
571
|
+
id: n,
|
|
572
|
+
root: r,
|
|
573
|
+
preserveTabOrder: o = !0
|
|
574
|
+
} = e, i = sr({
|
|
575
|
+
id: n,
|
|
576
|
+
root: r
|
|
577
|
+
}), [s, u] = d.useState(null), l = d.useRef(null), a = d.useRef(null), v = d.useRef(null), y = d.useRef(null), A = s?.modal, g = s?.open, E = (
|
|
578
|
+
// The FocusManager and therefore floating element are currently open/
|
|
579
|
+
// rendered.
|
|
580
|
+
!!s && // Guards are only for non-modal focus management.
|
|
581
|
+
!s.modal && // Don't render if unmount is transitioning.
|
|
582
|
+
s.open && o && !!(r || i)
|
|
583
|
+
);
|
|
584
|
+
return d.useEffect(() => {
|
|
585
|
+
if (!i || !o || A)
|
|
586
|
+
return;
|
|
587
|
+
function m(C) {
|
|
588
|
+
i && xe(C) && (C.type === "focusin" ? ct : qn)(i);
|
|
589
|
+
}
|
|
590
|
+
return i.addEventListener("focusin", m, !0), i.addEventListener("focusout", m, !0), () => {
|
|
591
|
+
i.removeEventListener("focusin", m, !0), i.removeEventListener("focusout", m, !0);
|
|
592
|
+
};
|
|
593
|
+
}, [i, o, A]), d.useEffect(() => {
|
|
594
|
+
i && (g || ct(i));
|
|
595
|
+
}, [g, i]), /* @__PURE__ */ Te(jt.Provider, {
|
|
596
|
+
value: d.useMemo(() => ({
|
|
597
|
+
preserveTabOrder: o,
|
|
598
|
+
beforeOutsideRef: l,
|
|
599
|
+
afterOutsideRef: a,
|
|
600
|
+
beforeInsideRef: v,
|
|
601
|
+
afterInsideRef: y,
|
|
602
|
+
portalNode: i,
|
|
603
|
+
setFocusManagerState: u
|
|
604
|
+
}), [o, i]),
|
|
605
|
+
children: [E && i && /* @__PURE__ */ k(_e, {
|
|
606
|
+
"data-type": "outside",
|
|
607
|
+
ref: l,
|
|
608
|
+
onFocus: (m) => {
|
|
609
|
+
if (xe(m, i)) {
|
|
610
|
+
var C;
|
|
611
|
+
(C = v.current) == null || C.focus();
|
|
612
|
+
} else {
|
|
613
|
+
const T = s ? s.domReference : null, b = qt(T);
|
|
614
|
+
b?.focus();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}), E && i && /* @__PURE__ */ k("span", {
|
|
618
|
+
"aria-owns": i.id,
|
|
619
|
+
style: ir
|
|
620
|
+
}), i && /* @__PURE__ */ fn.createPortal(t, i), E && i && /* @__PURE__ */ k(_e, {
|
|
621
|
+
"data-type": "outside",
|
|
622
|
+
ref: a,
|
|
623
|
+
onFocus: (m) => {
|
|
624
|
+
if (xe(m, i)) {
|
|
625
|
+
var C;
|
|
626
|
+
(C = y.current) == null || C.focus();
|
|
627
|
+
} else {
|
|
628
|
+
const T = s ? s.domReference : null, b = Vt(T);
|
|
629
|
+
b?.focus(), s?.closeOnFocusOut && s?.onOpenChange(!1, m.nativeEvent, "focus-out");
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
})]
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
const Gt = () => d.useContext(jt);
|
|
636
|
+
function ht(e) {
|
|
637
|
+
return d.useMemo(() => (t) => {
|
|
638
|
+
e.forEach((n) => {
|
|
639
|
+
n && (n.current = t);
|
|
640
|
+
});
|
|
641
|
+
}, e);
|
|
642
|
+
}
|
|
643
|
+
const Rt = 20;
|
|
644
|
+
let ge = [];
|
|
645
|
+
function Je() {
|
|
646
|
+
ge = ge.filter((e) => {
|
|
647
|
+
var t;
|
|
648
|
+
return (t = e.deref()) == null ? void 0 : t.isConnected;
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function ar(e) {
|
|
652
|
+
Je(), e && Dt(e) !== "body" && (ge.push(new WeakRef(e)), ge.length > Rt && (ge = ge.slice(-Rt)));
|
|
653
|
+
}
|
|
654
|
+
function Et() {
|
|
655
|
+
Je();
|
|
656
|
+
const e = ge[ge.length - 1];
|
|
657
|
+
return e?.deref();
|
|
658
|
+
}
|
|
659
|
+
function ur(e) {
|
|
660
|
+
const t = De();
|
|
661
|
+
return $t(e, t) ? e : Le(e, t)[0] || e;
|
|
662
|
+
}
|
|
663
|
+
function yt(e, t) {
|
|
664
|
+
var n;
|
|
665
|
+
if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
|
|
666
|
+
return;
|
|
667
|
+
const r = De(), i = An(e, r).filter((u) => {
|
|
668
|
+
const l = u.getAttribute("data-tabindex") || "";
|
|
669
|
+
return $t(u, r) || u.hasAttribute("data-tabindex") && !l.startsWith("-");
|
|
670
|
+
}), s = e.getAttribute("tabindex");
|
|
671
|
+
t.current.includes("floating") || i.length === 0 ? s !== "0" && e.setAttribute("tabindex", "0") : (s !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
|
|
672
|
+
}
|
|
673
|
+
const cr = /* @__PURE__ */ d.forwardRef(function(t, n) {
|
|
674
|
+
return /* @__PURE__ */ k("button", {
|
|
675
|
+
...t,
|
|
676
|
+
type: "button",
|
|
677
|
+
ref: n,
|
|
678
|
+
tabIndex: -1,
|
|
679
|
+
style: Xe
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
function Yt(e) {
|
|
683
|
+
const {
|
|
684
|
+
context: t,
|
|
685
|
+
children: n,
|
|
686
|
+
disabled: r = !1,
|
|
687
|
+
order: o = ["content"],
|
|
688
|
+
guards: i = !0,
|
|
689
|
+
initialFocus: s = 0,
|
|
690
|
+
returnFocus: u = !0,
|
|
691
|
+
restoreFocus: l = !1,
|
|
692
|
+
modal: a = !0,
|
|
693
|
+
visuallyHiddenDismiss: v = !1,
|
|
694
|
+
closeOnFocusOut: y = !0,
|
|
695
|
+
outsideElementsInert: A = !1,
|
|
696
|
+
getInsideElements: g = () => []
|
|
697
|
+
} = e, {
|
|
698
|
+
open: E,
|
|
699
|
+
onOpenChange: m,
|
|
700
|
+
events: C,
|
|
701
|
+
dataRef: T,
|
|
702
|
+
elements: {
|
|
703
|
+
domReference: b,
|
|
704
|
+
floating: h
|
|
705
|
+
}
|
|
706
|
+
} = t, P = ie(() => {
|
|
707
|
+
var x;
|
|
708
|
+
return (x = T.current.floatingContext) == null ? void 0 : x.nodeId;
|
|
709
|
+
}), H = ie(g), K = typeof s == "number" && s < 0, $ = it(b) && K, _ = nr(), j = _ ? i : !0, te = !j || _ && A, U = Ve(o), ve = Ve(s), ne = Ve(u), p = Ye(), f = Gt(), W = d.useRef(null), B = d.useRef(null), R = d.useRef(!1), L = d.useRef(!1), V = d.useRef(-1), Y = d.useRef(-1), Q = f != null, S = st(h), G = ie(function(x) {
|
|
710
|
+
return x === void 0 && (x = S), x ? Le(x, De()) : [];
|
|
711
|
+
}), N = ie((x) => {
|
|
712
|
+
const F = G(x);
|
|
713
|
+
return U.current.map((I) => b && I === "reference" ? b : S && I === "floating" ? S : F).filter(Boolean).flat();
|
|
714
|
+
});
|
|
715
|
+
d.useEffect(() => {
|
|
716
|
+
if (r || !a) return;
|
|
717
|
+
function x(I) {
|
|
718
|
+
if (I.key === "Tab") {
|
|
719
|
+
X(S, Re(ee(S))) && G().length === 0 && !$ && We(I);
|
|
720
|
+
const c = N(), D = de(I);
|
|
721
|
+
U.current[0] === "reference" && D === b && (We(I), I.shiftKey ? he(c[c.length - 1]) : he(c[1])), U.current[1] === "floating" && D === S && I.shiftKey && (We(I), he(c[0]));
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const F = ee(S);
|
|
725
|
+
return F.addEventListener("keydown", x), () => {
|
|
726
|
+
F.removeEventListener("keydown", x);
|
|
727
|
+
};
|
|
728
|
+
}, [r, b, S, a, U, $, G, N]), d.useEffect(() => {
|
|
729
|
+
if (r || !h) return;
|
|
730
|
+
function x(F) {
|
|
731
|
+
const I = de(F), D = G().indexOf(I);
|
|
732
|
+
D !== -1 && (V.current = D);
|
|
733
|
+
}
|
|
734
|
+
return h.addEventListener("focusin", x), () => {
|
|
735
|
+
h.removeEventListener("focusin", x);
|
|
736
|
+
};
|
|
737
|
+
}, [r, h, G]), d.useEffect(() => {
|
|
738
|
+
if (r || !y) return;
|
|
739
|
+
function x() {
|
|
740
|
+
L.current = !0, setTimeout(() => {
|
|
741
|
+
L.current = !1;
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function F(D) {
|
|
745
|
+
const w = D.relatedTarget, M = D.currentTarget, O = de(D);
|
|
746
|
+
queueMicrotask(() => {
|
|
747
|
+
const q = P(), pe = !(X(b, w) || X(h, w) || X(w, h) || X(f?.portalNode, w) || w != null && w.hasAttribute(Ie("focus-guard")) || p && (ye(p.nodesRef.current, q).find((ce) => {
|
|
748
|
+
var ae, le;
|
|
749
|
+
return X((ae = ce.context) == null ? void 0 : ae.elements.floating, w) || X((le = ce.context) == null ? void 0 : le.elements.domReference, w);
|
|
750
|
+
}) || at(p.nodesRef.current, q).find((ce) => {
|
|
751
|
+
var ae, le, Qe;
|
|
752
|
+
return [(ae = ce.context) == null ? void 0 : ae.elements.floating, st((le = ce.context) == null ? void 0 : le.elements.floating)].includes(w) || ((Qe = ce.context) == null ? void 0 : Qe.elements.domReference) === w;
|
|
753
|
+
})));
|
|
754
|
+
if (M === b && S && yt(S, U), l && M !== b && !(O != null && O.isConnected) && Re(ee(S)) === ee(S).body) {
|
|
755
|
+
ue(S) && S.focus();
|
|
756
|
+
const ce = V.current, ae = G(), le = ae[ce] || ae[ae.length - 1] || S;
|
|
757
|
+
ue(le) && le.focus();
|
|
758
|
+
}
|
|
759
|
+
if (T.current.insideReactTree) {
|
|
760
|
+
T.current.insideReactTree = !1;
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
($ || !a) && w && pe && !L.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
764
|
+
w !== Et() && (R.current = !0, m(!1, D, "focus-out"));
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
const I = !!(!p && f);
|
|
768
|
+
function c() {
|
|
769
|
+
er(Y), T.current.insideReactTree = !0, Y.current = window.setTimeout(() => {
|
|
770
|
+
T.current.insideReactTree = !1;
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
if (h && ue(b))
|
|
774
|
+
return b.addEventListener("focusout", F), b.addEventListener("pointerdown", x), h.addEventListener("focusout", F), I && h.addEventListener("focusout", c, !0), () => {
|
|
775
|
+
b.removeEventListener("focusout", F), b.removeEventListener("pointerdown", x), h.removeEventListener("focusout", F), I && h.removeEventListener("focusout", c, !0);
|
|
776
|
+
};
|
|
777
|
+
}, [r, b, h, S, a, p, f, m, y, l, G, $, P, U, T]);
|
|
778
|
+
const z = d.useRef(null), re = d.useRef(null), Ce = ht([z, f?.beforeInsideRef]), se = ht([re, f?.afterInsideRef]);
|
|
779
|
+
d.useEffect(() => {
|
|
780
|
+
var x, F;
|
|
781
|
+
if (r || !h) return;
|
|
782
|
+
const I = Array.from((f == null || (x = f.portalNode) == null ? void 0 : x.querySelectorAll("[" + Ie("portal") + "]")) || []), D = (F = (p ? at(p.nodesRef.current, P()) : []).find((O) => {
|
|
783
|
+
var q;
|
|
784
|
+
return it(((q = O.context) == null ? void 0 : q.elements.domReference) || null);
|
|
785
|
+
})) == null || (F = F.context) == null ? void 0 : F.elements.domReference, w = [h, D, ...I, ...H(), W.current, B.current, z.current, re.current, f?.beforeOutsideRef.current, f?.afterOutsideRef.current, U.current.includes("reference") || $ ? b : null].filter((O) => O != null), M = a || $ ? pt(w, !te, te) : pt(w);
|
|
786
|
+
return () => {
|
|
787
|
+
M();
|
|
788
|
+
};
|
|
789
|
+
}, [r, b, h, a, U, f, $, j, te, p, P, H]), J(() => {
|
|
790
|
+
if (r || !ue(S)) return;
|
|
791
|
+
const x = ee(S), F = Re(x);
|
|
792
|
+
queueMicrotask(() => {
|
|
793
|
+
const I = N(S), c = ve.current, D = (typeof c == "number" ? I[c] : c.current) || S, w = X(S, F);
|
|
794
|
+
!K && !w && E && he(D, {
|
|
795
|
+
preventScroll: D === S
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
}, [r, E, S, K, N, ve]), J(() => {
|
|
799
|
+
if (r || !S) return;
|
|
800
|
+
const x = ee(S), F = Re(x);
|
|
801
|
+
ar(F);
|
|
802
|
+
function I(w) {
|
|
803
|
+
let {
|
|
804
|
+
reason: M,
|
|
805
|
+
event: O,
|
|
806
|
+
nested: q
|
|
807
|
+
} = w;
|
|
808
|
+
if (["hover", "safe-polygon"].includes(M) && O.type === "mouseleave" && (R.current = !0), M === "outside-press")
|
|
809
|
+
if (q)
|
|
810
|
+
R.current = !1;
|
|
811
|
+
else if (_n(O) || Ln(O))
|
|
812
|
+
R.current = !1;
|
|
813
|
+
else {
|
|
814
|
+
let pe = !1;
|
|
815
|
+
document.createElement("div").focus({
|
|
816
|
+
get preventScroll() {
|
|
817
|
+
return pe = !0, !1;
|
|
818
|
+
}
|
|
819
|
+
}), pe ? R.current = !1 : R.current = !0;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
C.on("openchange", I);
|
|
823
|
+
const c = x.createElement("span");
|
|
824
|
+
c.setAttribute("tabindex", "-1"), c.setAttribute("aria-hidden", "true"), Object.assign(c.style, Xe), Q && b && b.insertAdjacentElement("afterend", c);
|
|
825
|
+
function D() {
|
|
826
|
+
if (typeof ne.current == "boolean") {
|
|
827
|
+
const w = b || Et();
|
|
828
|
+
return w && w.isConnected ? w : c;
|
|
829
|
+
}
|
|
830
|
+
return ne.current.current || c;
|
|
831
|
+
}
|
|
832
|
+
return () => {
|
|
833
|
+
C.off("openchange", I);
|
|
834
|
+
const w = Re(x), M = X(h, w) || p && ye(p.nodesRef.current, P(), !1).some((q) => {
|
|
835
|
+
var pe;
|
|
836
|
+
return X((pe = q.context) == null ? void 0 : pe.elements.floating, w);
|
|
837
|
+
}), O = D();
|
|
838
|
+
queueMicrotask(() => {
|
|
839
|
+
const q = ur(O);
|
|
840
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
841
|
+
ne.current && !R.current && ue(q) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
842
|
+
// since it likely entered a different element which should be
|
|
843
|
+
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
844
|
+
(!(q !== w && w !== x.body) || M) && q.focus({
|
|
845
|
+
preventScroll: !0
|
|
846
|
+
}), c.remove();
|
|
847
|
+
});
|
|
848
|
+
};
|
|
849
|
+
}, [r, h, S, ne, T, C, p, Q, b, P]), d.useEffect(() => (queueMicrotask(() => {
|
|
850
|
+
R.current = !1;
|
|
851
|
+
}), () => {
|
|
852
|
+
queueMicrotask(Je);
|
|
853
|
+
}), [r]), J(() => {
|
|
854
|
+
if (!r && f)
|
|
855
|
+
return f.setFocusManagerState({
|
|
856
|
+
modal: a,
|
|
857
|
+
closeOnFocusOut: y,
|
|
858
|
+
open: E,
|
|
859
|
+
onOpenChange: m,
|
|
860
|
+
domReference: b
|
|
861
|
+
}), () => {
|
|
862
|
+
f.setFocusManagerState(null);
|
|
863
|
+
};
|
|
864
|
+
}, [r, f, a, E, m, y, b]), J(() => {
|
|
865
|
+
r || S && yt(S, U);
|
|
866
|
+
}, [r, S, U]);
|
|
867
|
+
function oe(x) {
|
|
868
|
+
return r || !v || !a ? null : /* @__PURE__ */ k(cr, {
|
|
869
|
+
ref: x === "start" ? W : B,
|
|
870
|
+
onClick: (F) => m(!1, F.nativeEvent),
|
|
871
|
+
children: typeof v == "string" ? v : "Dismiss"
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
const be = !r && j && (a ? !$ : !0) && (Q || a);
|
|
875
|
+
return /* @__PURE__ */ Te(nn, {
|
|
876
|
+
children: [be && /* @__PURE__ */ k(_e, {
|
|
877
|
+
"data-type": "inside",
|
|
878
|
+
ref: Ce,
|
|
879
|
+
onFocus: (x) => {
|
|
880
|
+
if (a) {
|
|
881
|
+
const I = N();
|
|
882
|
+
he(o[0] === "reference" ? I[0] : I[I.length - 1]);
|
|
883
|
+
} else if (f != null && f.preserveTabOrder && f.portalNode)
|
|
884
|
+
if (R.current = !1, xe(x, f.portalNode)) {
|
|
885
|
+
const I = Vt(b);
|
|
886
|
+
I?.focus();
|
|
887
|
+
} else {
|
|
888
|
+
var F;
|
|
889
|
+
(F = f.beforeOutsideRef.current) == null || F.focus();
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}), !$ && oe("start"), n, oe("end"), be && /* @__PURE__ */ k(_e, {
|
|
893
|
+
"data-type": "inside",
|
|
894
|
+
ref: se,
|
|
895
|
+
onFocus: (x) => {
|
|
896
|
+
if (a)
|
|
897
|
+
he(N()[0]);
|
|
898
|
+
else if (f != null && f.preserveTabOrder && f.portalNode)
|
|
899
|
+
if (y && (R.current = !0), xe(x, f.portalNode)) {
|
|
900
|
+
const I = qt(b);
|
|
901
|
+
I?.focus();
|
|
902
|
+
} else {
|
|
903
|
+
var F;
|
|
904
|
+
(F = f.afterOutsideRef.current) == null || F.focus();
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
})]
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function wt(e) {
|
|
911
|
+
return ue(e.target) && e.target.tagName === "BUTTON";
|
|
912
|
+
}
|
|
913
|
+
function lr(e) {
|
|
914
|
+
return ue(e.target) && e.target.tagName === "A";
|
|
915
|
+
}
|
|
916
|
+
function Tt(e) {
|
|
917
|
+
return Kt(e);
|
|
918
|
+
}
|
|
919
|
+
function Xt(e, t) {
|
|
920
|
+
t === void 0 && (t = {});
|
|
921
|
+
const {
|
|
922
|
+
open: n,
|
|
923
|
+
onOpenChange: r,
|
|
924
|
+
dataRef: o,
|
|
925
|
+
elements: {
|
|
926
|
+
domReference: i
|
|
927
|
+
}
|
|
928
|
+
} = e, {
|
|
929
|
+
enabled: s = !0,
|
|
930
|
+
event: u = "click",
|
|
931
|
+
toggle: l = !0,
|
|
932
|
+
ignoreMouse: a = !1,
|
|
933
|
+
keyboardHandlers: v = !0,
|
|
934
|
+
stickIfOpen: y = !0
|
|
935
|
+
} = t, A = d.useRef(), g = d.useRef(!1), E = d.useMemo(() => ({
|
|
936
|
+
onPointerDown(m) {
|
|
937
|
+
A.current = m.pointerType;
|
|
938
|
+
},
|
|
939
|
+
onMouseDown(m) {
|
|
940
|
+
const C = A.current;
|
|
941
|
+
m.button === 0 && u !== "click" && (ut(C) && a || (n && l && (!(o.current.openEvent && y) || o.current.openEvent.type === "mousedown") ? r(!1, m.nativeEvent, "click") : (m.preventDefault(), r(!0, m.nativeEvent, "click"))));
|
|
942
|
+
},
|
|
943
|
+
onClick(m) {
|
|
944
|
+
const C = A.current;
|
|
945
|
+
if (u === "mousedown" && A.current) {
|
|
946
|
+
A.current = void 0;
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
ut(C) && a || (n && l && (!(o.current.openEvent && y) || o.current.openEvent.type === "click") ? r(!1, m.nativeEvent, "click") : r(!0, m.nativeEvent, "click"));
|
|
950
|
+
},
|
|
951
|
+
onKeyDown(m) {
|
|
952
|
+
A.current = void 0, !(m.defaultPrevented || !v || wt(m)) && (m.key === " " && !Tt(i) && (m.preventDefault(), g.current = !0), !lr(m) && m.key === "Enter" && r(!(n && l), m.nativeEvent, "click"));
|
|
953
|
+
},
|
|
954
|
+
onKeyUp(m) {
|
|
955
|
+
m.defaultPrevented || !v || wt(m) || Tt(i) || m.key === " " && g.current && (g.current = !1, r(!(n && l), m.nativeEvent, "click"));
|
|
956
|
+
}
|
|
957
|
+
}), [o, i, u, a, v, r, n, y, l]);
|
|
958
|
+
return d.useMemo(() => s ? {
|
|
959
|
+
reference: E
|
|
960
|
+
} : {}, [s, E]);
|
|
961
|
+
}
|
|
962
|
+
const fr = {
|
|
963
|
+
pointerdown: "onPointerDown",
|
|
964
|
+
mousedown: "onMouseDown",
|
|
965
|
+
click: "onClick"
|
|
966
|
+
}, dr = {
|
|
967
|
+
pointerdown: "onPointerDownCapture",
|
|
968
|
+
mousedown: "onMouseDownCapture",
|
|
969
|
+
click: "onClickCapture"
|
|
970
|
+
}, St = (e) => {
|
|
971
|
+
var t, n;
|
|
972
|
+
return {
|
|
973
|
+
escapeKey: typeof e == "boolean" ? e : (t = e?.escapeKey) != null ? t : !1,
|
|
974
|
+
outsidePress: typeof e == "boolean" ? e : (n = e?.outsidePress) != null ? n : !0
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
function Jt(e, t) {
|
|
978
|
+
t === void 0 && (t = {});
|
|
979
|
+
const {
|
|
980
|
+
open: n,
|
|
981
|
+
onOpenChange: r,
|
|
982
|
+
elements: o,
|
|
983
|
+
dataRef: i
|
|
984
|
+
} = e, {
|
|
985
|
+
enabled: s = !0,
|
|
986
|
+
escapeKey: u = !0,
|
|
987
|
+
outsidePress: l = !0,
|
|
988
|
+
outsidePressEvent: a = "pointerdown",
|
|
989
|
+
referencePress: v = !1,
|
|
990
|
+
referencePressEvent: y = "pointerdown",
|
|
991
|
+
ancestorScroll: A = !1,
|
|
992
|
+
bubbles: g,
|
|
993
|
+
capture: E
|
|
994
|
+
} = t, m = Ye(), C = ie(typeof l == "function" ? l : () => !1), T = typeof l == "function" ? C : l, b = d.useRef(!1), {
|
|
995
|
+
escapeKey: h,
|
|
996
|
+
outsidePress: P
|
|
997
|
+
} = St(g), {
|
|
998
|
+
escapeKey: H,
|
|
999
|
+
outsidePress: K
|
|
1000
|
+
} = St(E), $ = d.useRef(!1), _ = ie((p) => {
|
|
1001
|
+
var f;
|
|
1002
|
+
if (!n || !s || !u || p.key !== "Escape" || $.current)
|
|
1003
|
+
return;
|
|
1004
|
+
const W = (f = i.current.floatingContext) == null ? void 0 : f.nodeId, B = m ? ye(m.nodesRef.current, W) : [];
|
|
1005
|
+
if (!h && (p.stopPropagation(), B.length > 0)) {
|
|
1006
|
+
let R = !0;
|
|
1007
|
+
if (B.forEach((L) => {
|
|
1008
|
+
var V;
|
|
1009
|
+
if ((V = L.context) != null && V.open && !L.context.dataRef.current.__escapeKeyBubbles) {
|
|
1010
|
+
R = !1;
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
}), !R)
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
r(!1, Mn(p) ? p.nativeEvent : p, "escape-key");
|
|
1017
|
+
}), j = ie((p) => {
|
|
1018
|
+
var f;
|
|
1019
|
+
const W = () => {
|
|
1020
|
+
var B;
|
|
1021
|
+
_(p), (B = de(p)) == null || B.removeEventListener("keydown", W);
|
|
1022
|
+
};
|
|
1023
|
+
(f = de(p)) == null || f.addEventListener("keydown", W);
|
|
1024
|
+
}), te = ie((p) => {
|
|
1025
|
+
var f;
|
|
1026
|
+
const W = i.current.insideReactTree;
|
|
1027
|
+
i.current.insideReactTree = !1;
|
|
1028
|
+
const B = b.current;
|
|
1029
|
+
if (b.current = !1, a === "click" && B || W || typeof T == "function" && !T(p))
|
|
1030
|
+
return;
|
|
1031
|
+
const R = de(p), L = "[" + Ie("inert") + "]", V = ee(o.floating).querySelectorAll(L);
|
|
1032
|
+
let Y = Z(R) ? R : null;
|
|
1033
|
+
for (; Y && !Be(Y); ) {
|
|
1034
|
+
const N = un(Y);
|
|
1035
|
+
if (Be(N) || !Z(N))
|
|
1036
|
+
break;
|
|
1037
|
+
Y = N;
|
|
1038
|
+
}
|
|
1039
|
+
if (V.length && Z(R) && !Nn(R) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
1040
|
+
!X(R, o.floating) && // If the target root element contains none of the markers, then the
|
|
1041
|
+
// element was injected after the floating element rendered.
|
|
1042
|
+
Array.from(V).every((N) => !X(Y, N)))
|
|
1043
|
+
return;
|
|
1044
|
+
if (ue(R) && ne) {
|
|
1045
|
+
const N = Be(R), z = cn(R), re = /auto|scroll/, Ce = N || re.test(z.overflowX), se = N || re.test(z.overflowY), oe = Ce && R.clientWidth > 0 && R.scrollWidth > R.clientWidth, be = se && R.clientHeight > 0 && R.scrollHeight > R.clientHeight, x = z.direction === "rtl", F = be && (x ? p.offsetX <= R.offsetWidth - R.clientWidth : p.offsetX > R.clientWidth), I = oe && p.offsetY > R.clientHeight;
|
|
1046
|
+
if (F || I)
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const Q = (f = i.current.floatingContext) == null ? void 0 : f.nodeId, S = m && ye(m.nodesRef.current, Q).some((N) => {
|
|
1050
|
+
var z;
|
|
1051
|
+
return Ke(p, (z = N.context) == null ? void 0 : z.elements.floating);
|
|
1052
|
+
});
|
|
1053
|
+
if (Ke(p, o.floating) || Ke(p, o.domReference) || S)
|
|
1054
|
+
return;
|
|
1055
|
+
const G = m ? ye(m.nodesRef.current, Q) : [];
|
|
1056
|
+
if (G.length > 0) {
|
|
1057
|
+
let N = !0;
|
|
1058
|
+
if (G.forEach((z) => {
|
|
1059
|
+
var re;
|
|
1060
|
+
if ((re = z.context) != null && re.open && !z.context.dataRef.current.__outsidePressBubbles) {
|
|
1061
|
+
N = !1;
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
}), !N)
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
r(!1, p, "outside-press");
|
|
1068
|
+
}), U = ie((p) => {
|
|
1069
|
+
var f;
|
|
1070
|
+
const W = () => {
|
|
1071
|
+
var B;
|
|
1072
|
+
te(p), (B = de(p)) == null || B.removeEventListener(a, W);
|
|
1073
|
+
};
|
|
1074
|
+
(f = de(p)) == null || f.addEventListener(a, W);
|
|
1075
|
+
});
|
|
1076
|
+
d.useEffect(() => {
|
|
1077
|
+
if (!n || !s)
|
|
1078
|
+
return;
|
|
1079
|
+
i.current.__escapeKeyBubbles = h, i.current.__outsidePressBubbles = P;
|
|
1080
|
+
let p = -1;
|
|
1081
|
+
function f(V) {
|
|
1082
|
+
r(!1, V, "ancestor-scroll");
|
|
1083
|
+
}
|
|
1084
|
+
function W() {
|
|
1085
|
+
window.clearTimeout(p), $.current = !0;
|
|
1086
|
+
}
|
|
1087
|
+
function B() {
|
|
1088
|
+
p = window.setTimeout(
|
|
1089
|
+
() => {
|
|
1090
|
+
$.current = !1;
|
|
1091
|
+
},
|
|
1092
|
+
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
1093
|
+
// Only apply to WebKit for the test to remain 0ms.
|
|
1094
|
+
an() ? 5 : 0
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
const R = ee(o.floating);
|
|
1098
|
+
u && (R.addEventListener("keydown", H ? j : _, H), R.addEventListener("compositionstart", W), R.addEventListener("compositionend", B)), T && R.addEventListener(a, K ? U : te, K);
|
|
1099
|
+
let L = [];
|
|
1100
|
+
return A && (Z(o.domReference) && (L = $e(o.domReference)), Z(o.floating) && (L = L.concat($e(o.floating))), !Z(o.reference) && o.reference && o.reference.contextElement && (L = L.concat($e(o.reference.contextElement)))), L = L.filter((V) => {
|
|
1101
|
+
var Y;
|
|
1102
|
+
return V !== ((Y = R.defaultView) == null ? void 0 : Y.visualViewport);
|
|
1103
|
+
}), L.forEach((V) => {
|
|
1104
|
+
V.addEventListener("scroll", f, {
|
|
1105
|
+
passive: !0
|
|
1106
|
+
});
|
|
1107
|
+
}), () => {
|
|
1108
|
+
u && (R.removeEventListener("keydown", H ? j : _, H), R.removeEventListener("compositionstart", W), R.removeEventListener("compositionend", B)), T && R.removeEventListener(a, K ? U : te, K), L.forEach((V) => {
|
|
1109
|
+
V.removeEventListener("scroll", f);
|
|
1110
|
+
}), window.clearTimeout(p);
|
|
1111
|
+
};
|
|
1112
|
+
}, [i, o, u, T, a, n, r, A, s, h, P, _, H, j, te, K, U]), d.useEffect(() => {
|
|
1113
|
+
i.current.insideReactTree = !1;
|
|
1114
|
+
}, [i, T, a]);
|
|
1115
|
+
const ve = d.useMemo(() => ({
|
|
1116
|
+
onKeyDown: _,
|
|
1117
|
+
...v && {
|
|
1118
|
+
[fr[y]]: (p) => {
|
|
1119
|
+
r(!1, p.nativeEvent, "reference-press");
|
|
1120
|
+
},
|
|
1121
|
+
...y !== "click" && {
|
|
1122
|
+
onClick(p) {
|
|
1123
|
+
r(!1, p.nativeEvent, "reference-press");
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}), [_, r, v, y]), ne = d.useMemo(() => {
|
|
1128
|
+
function p(f) {
|
|
1129
|
+
f.button === 0 && (b.current = !0);
|
|
1130
|
+
}
|
|
1131
|
+
return {
|
|
1132
|
+
onKeyDown: _,
|
|
1133
|
+
onMouseDown: p,
|
|
1134
|
+
onMouseUp: p,
|
|
1135
|
+
[dr[a]]: () => {
|
|
1136
|
+
i.current.insideReactTree = !0;
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
}, [_, a, i]);
|
|
1140
|
+
return d.useMemo(() => s ? {
|
|
1141
|
+
reference: ve,
|
|
1142
|
+
floating: ne
|
|
1143
|
+
} : {}, [s, ve, ne]);
|
|
1144
|
+
}
|
|
1145
|
+
function mr(e) {
|
|
1146
|
+
const {
|
|
1147
|
+
open: t = !1,
|
|
1148
|
+
onOpenChange: n,
|
|
1149
|
+
elements: r
|
|
1150
|
+
} = e, o = Ut(), i = d.useRef({}), [s] = d.useState(() => Xn()), u = Zn() != null;
|
|
1151
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1152
|
+
const g = r.reference;
|
|
1153
|
+
g && !Z(g) && Yn("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
1154
|
+
}
|
|
1155
|
+
const [l, a] = d.useState(r.reference), v = ie((g, E, m) => {
|
|
1156
|
+
i.current.openEvent = g ? E : void 0, s.emit("openchange", {
|
|
1157
|
+
open: g,
|
|
1158
|
+
event: E,
|
|
1159
|
+
reason: m,
|
|
1160
|
+
nested: u
|
|
1161
|
+
}), n?.(g, E, m);
|
|
1162
|
+
}), y = d.useMemo(() => ({
|
|
1163
|
+
setPositionReference: a
|
|
1164
|
+
}), []), A = d.useMemo(() => ({
|
|
1165
|
+
reference: l || r.reference || null,
|
|
1166
|
+
floating: r.floating || null,
|
|
1167
|
+
domReference: r.reference
|
|
1168
|
+
}), [l, r.reference, r.floating]);
|
|
1169
|
+
return d.useMemo(() => ({
|
|
1170
|
+
dataRef: i,
|
|
1171
|
+
open: t,
|
|
1172
|
+
onOpenChange: v,
|
|
1173
|
+
elements: A,
|
|
1174
|
+
events: s,
|
|
1175
|
+
floatingId: o,
|
|
1176
|
+
refs: y
|
|
1177
|
+
}), [t, v, A, s, o, y]);
|
|
1178
|
+
}
|
|
1179
|
+
function Qt(e) {
|
|
1180
|
+
e === void 0 && (e = {});
|
|
1181
|
+
const {
|
|
1182
|
+
nodeId: t
|
|
1183
|
+
} = e, n = mr({
|
|
1184
|
+
...e,
|
|
1185
|
+
elements: {
|
|
1186
|
+
reference: null,
|
|
1187
|
+
floating: null,
|
|
1188
|
+
...e.elements
|
|
1189
|
+
}
|
|
1190
|
+
}), r = e.rootContext || n, o = r.elements, [i, s] = d.useState(null), [u, l] = d.useState(null), v = o?.domReference || i, y = d.useRef(null), A = Ye();
|
|
1191
|
+
J(() => {
|
|
1192
|
+
v && (y.current = v);
|
|
1193
|
+
}, [v]);
|
|
1194
|
+
const g = sn({
|
|
1195
|
+
...e,
|
|
1196
|
+
elements: {
|
|
1197
|
+
...o,
|
|
1198
|
+
...u && {
|
|
1199
|
+
reference: u
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}), E = d.useCallback((h) => {
|
|
1203
|
+
const P = Z(h) ? {
|
|
1204
|
+
getBoundingClientRect: () => h.getBoundingClientRect(),
|
|
1205
|
+
getClientRects: () => h.getClientRects(),
|
|
1206
|
+
contextElement: h
|
|
1207
|
+
} : h;
|
|
1208
|
+
l(P), g.refs.setReference(P);
|
|
1209
|
+
}, [g.refs]), m = d.useCallback((h) => {
|
|
1210
|
+
(Z(h) || h === null) && (y.current = h, s(h)), (Z(g.refs.reference.current) || g.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
1211
|
+
// `null` to support `positionReference` + an unstable `reference`
|
|
1212
|
+
// callback ref.
|
|
1213
|
+
h !== null && !Z(h)) && g.refs.setReference(h);
|
|
1214
|
+
}, [g.refs]), C = d.useMemo(() => ({
|
|
1215
|
+
...g.refs,
|
|
1216
|
+
setReference: m,
|
|
1217
|
+
setPositionReference: E,
|
|
1218
|
+
domReference: y
|
|
1219
|
+
}), [g.refs, m, E]), T = d.useMemo(() => ({
|
|
1220
|
+
...g.elements,
|
|
1221
|
+
domReference: v
|
|
1222
|
+
}), [g.elements, v]), b = d.useMemo(() => ({
|
|
1223
|
+
...g,
|
|
1224
|
+
...r,
|
|
1225
|
+
refs: C,
|
|
1226
|
+
elements: T,
|
|
1227
|
+
nodeId: t
|
|
1228
|
+
}), [g, C, T, t, r]);
|
|
1229
|
+
return J(() => {
|
|
1230
|
+
r.dataRef.current.floatingContext = b;
|
|
1231
|
+
const h = A?.nodesRef.current.find((P) => P.id === t);
|
|
1232
|
+
h && (h.context = b);
|
|
1233
|
+
}), d.useMemo(() => ({
|
|
1234
|
+
...g,
|
|
1235
|
+
context: b,
|
|
1236
|
+
refs: C,
|
|
1237
|
+
elements: T
|
|
1238
|
+
}), [g, C, T, b]);
|
|
1239
|
+
}
|
|
1240
|
+
function Ue(e, t, n) {
|
|
1241
|
+
const r = /* @__PURE__ */ new Map(), o = n === "item";
|
|
1242
|
+
let i = e;
|
|
1243
|
+
if (o && e) {
|
|
1244
|
+
const {
|
|
1245
|
+
[lt]: s,
|
|
1246
|
+
[ft]: u,
|
|
1247
|
+
...l
|
|
1248
|
+
} = e;
|
|
1249
|
+
i = l;
|
|
1250
|
+
}
|
|
1251
|
+
return {
|
|
1252
|
+
...n === "floating" && {
|
|
1253
|
+
tabIndex: -1,
|
|
1254
|
+
[Un]: ""
|
|
1255
|
+
},
|
|
1256
|
+
...i,
|
|
1257
|
+
...t.map((s) => {
|
|
1258
|
+
const u = s ? s[n] : null;
|
|
1259
|
+
return typeof u == "function" ? e ? u(e) : null : u;
|
|
1260
|
+
}).concat(e).reduce((s, u) => (u && Object.entries(u).forEach((l) => {
|
|
1261
|
+
let [a, v] = l;
|
|
1262
|
+
if (!(o && [lt, ft].includes(a)))
|
|
1263
|
+
if (a.indexOf("on") === 0) {
|
|
1264
|
+
if (r.has(a) || r.set(a, []), typeof v == "function") {
|
|
1265
|
+
var y;
|
|
1266
|
+
(y = r.get(a)) == null || y.push(v), s[a] = function() {
|
|
1267
|
+
for (var A, g = arguments.length, E = new Array(g), m = 0; m < g; m++)
|
|
1268
|
+
E[m] = arguments[m];
|
|
1269
|
+
return (A = r.get(a)) == null ? void 0 : A.map((C) => C(...E)).find((C) => C !== void 0);
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
} else
|
|
1273
|
+
s[a] = v;
|
|
1274
|
+
}), s), {})
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
function Zt(e) {
|
|
1278
|
+
e === void 0 && (e = []);
|
|
1279
|
+
const t = e.map((u) => u?.reference), n = e.map((u) => u?.floating), r = e.map((u) => u?.item), o = d.useCallback(
|
|
1280
|
+
(u) => Ue(u, e, "reference"),
|
|
1281
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1282
|
+
t
|
|
1283
|
+
), i = d.useCallback(
|
|
1284
|
+
(u) => Ue(u, e, "floating"),
|
|
1285
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1286
|
+
n
|
|
1287
|
+
), s = d.useCallback(
|
|
1288
|
+
(u) => Ue(u, e, "item"),
|
|
1289
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1290
|
+
r
|
|
1291
|
+
);
|
|
1292
|
+
return d.useMemo(() => ({
|
|
1293
|
+
getReferenceProps: o,
|
|
1294
|
+
getFloatingProps: i,
|
|
1295
|
+
getItemProps: s
|
|
1296
|
+
}), [o, i, s]);
|
|
1297
|
+
}
|
|
1298
|
+
const gr = {
|
|
1299
|
+
"date-picker-calendar-container": "_date-picker-calendar-container_1onag_1"
|
|
1300
|
+
}, en = gn.bind(gr), vr = rn(
|
|
1301
|
+
(e, t) => e.mode === "range" ? /* @__PURE__ */ k(br, { ...e, forwardedRef: t }) : /* @__PURE__ */ k(pr, { ...e, forwardedRef: t })
|
|
1302
|
+
);
|
|
1303
|
+
vr.displayName = "DatePicker";
|
|
1304
|
+
const pr = ({
|
|
1305
|
+
calendarProps: e,
|
|
1306
|
+
drawerContentProps: t,
|
|
1307
|
+
value: n,
|
|
1308
|
+
onChange: r,
|
|
1309
|
+
overlayZIndex: o,
|
|
1310
|
+
forwardedRef: i,
|
|
1311
|
+
...s
|
|
1312
|
+
}) => {
|
|
1313
|
+
const [u, l] = me(!1), [a, v] = me(!1), y = tn(), A = fe(null), { context: g, refs: E, floatingStyles: m } = Qt({
|
|
1314
|
+
open: u,
|
|
1315
|
+
onOpenChange: (j) => {
|
|
1316
|
+
s.readOnly || l(j);
|
|
1317
|
+
},
|
|
1318
|
+
placement: "bottom-start",
|
|
1319
|
+
middleware: [
|
|
1320
|
+
Ft({
|
|
1321
|
+
mainAxis: 10,
|
|
1322
|
+
crossAxis: -32
|
|
1323
|
+
// left padding + small icon
|
|
1324
|
+
}),
|
|
1325
|
+
kt()
|
|
1326
|
+
],
|
|
1327
|
+
whileElementsMounted: At
|
|
1328
|
+
}), C = Xt(g, { enabled: !s.disabled && !s.readOnly }), T = Jt(g), { getFloatingProps: b, getReferenceProps: h } = Zt([C, T]), [P, H] = me(n);
|
|
1329
|
+
xt(() => {
|
|
1330
|
+
H(n);
|
|
1331
|
+
}, [n]);
|
|
1332
|
+
const K = (j) => {
|
|
1333
|
+
j ? (H(j), r?.(j), (u || a) && (l(!1), v(!1))) : (H(void 0), r?.(void 0));
|
|
1334
|
+
}, $ = on(), _ = s["data-testid"];
|
|
1335
|
+
return y ? /* @__PURE__ */ Te(Ee, { open: a, onOpenChange: v, children: [
|
|
1336
|
+
/* @__PURE__ */ k(Ee.Trigger, { children: /* @__PURE__ */ k(
|
|
1337
|
+
et,
|
|
1338
|
+
{
|
|
1339
|
+
...s,
|
|
1340
|
+
startAdornment: /* @__PURE__ */ k(tt, { size: "sm" }),
|
|
1341
|
+
id: $,
|
|
1342
|
+
value: P,
|
|
1343
|
+
onChange: K,
|
|
1344
|
+
"data-testid": _
|
|
1345
|
+
}
|
|
1346
|
+
) }),
|
|
1347
|
+
/* @__PURE__ */ k(
|
|
1348
|
+
Ee.Content,
|
|
1349
|
+
{
|
|
1350
|
+
"data-testid": _ && `${_}-calendar`,
|
|
1351
|
+
fitToContent: !0,
|
|
1352
|
+
...t,
|
|
1353
|
+
zIndex: o,
|
|
1354
|
+
children: /* @__PURE__ */ k(
|
|
1355
|
+
ke,
|
|
1356
|
+
{
|
|
1357
|
+
showOutsideDays: !0,
|
|
1358
|
+
...e,
|
|
1359
|
+
mode: "single",
|
|
1360
|
+
selected: P,
|
|
1361
|
+
onSelect: K
|
|
1362
|
+
}
|
|
1363
|
+
)
|
|
1364
|
+
}
|
|
1365
|
+
)
|
|
1366
|
+
] }) : /* @__PURE__ */ Te("div", { ref: i, children: [
|
|
1367
|
+
/* @__PURE__ */ k("div", { ...h(), ref: E.setReference, children: /* @__PURE__ */ k(
|
|
1368
|
+
et,
|
|
1369
|
+
{
|
|
1370
|
+
...s,
|
|
1371
|
+
startAdornment: /* @__PURE__ */ k(tt, { size: "sm" }),
|
|
1372
|
+
id: $,
|
|
1373
|
+
value: P,
|
|
1374
|
+
onChange: K,
|
|
1375
|
+
"data-testid": _
|
|
1376
|
+
}
|
|
1377
|
+
) }),
|
|
1378
|
+
u && !s.readOnly && /* @__PURE__ */ k(zt, { children: /* @__PURE__ */ k(
|
|
1379
|
+
Yt,
|
|
1380
|
+
{
|
|
1381
|
+
context: g,
|
|
1382
|
+
modal: !1,
|
|
1383
|
+
order: ["reference", "floating", "content"],
|
|
1384
|
+
children: /* @__PURE__ */ k(
|
|
1385
|
+
"div",
|
|
1386
|
+
{
|
|
1387
|
+
"data-testid": _ && `${_}-calendar`,
|
|
1388
|
+
className: en("date-picker-calendar-container"),
|
|
1389
|
+
ref: E.setFloating,
|
|
1390
|
+
style: { ...m, zIndex: o },
|
|
1391
|
+
...b(),
|
|
1392
|
+
children: /* @__PURE__ */ k(
|
|
1393
|
+
ke,
|
|
1394
|
+
{
|
|
1395
|
+
showOutsideDays: !0,
|
|
1396
|
+
...e,
|
|
1397
|
+
mode: "single",
|
|
1398
|
+
selected: P,
|
|
1399
|
+
onSelect: K,
|
|
1400
|
+
firstElementRef: A
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
}
|
|
1404
|
+
)
|
|
1405
|
+
}
|
|
1406
|
+
) })
|
|
1407
|
+
] });
|
|
1408
|
+
}, br = ({
|
|
1409
|
+
calendarProps: e,
|
|
1410
|
+
drawerContentProps: t,
|
|
1411
|
+
fromValue: n,
|
|
1412
|
+
toValue: r,
|
|
1413
|
+
onFromChange: o,
|
|
1414
|
+
onToChange: i,
|
|
1415
|
+
overlayZIndex: s,
|
|
1416
|
+
forwardedRef: u,
|
|
1417
|
+
...l
|
|
1418
|
+
}) => {
|
|
1419
|
+
const [a, v] = me(!1), [y, A] = me(!1), g = tn(), E = fe(null), m = fe(null), C = fe(null), T = fe("from"), b = fe(!1), h = fe(!1), [P, H] = me(null), K = () => {
|
|
1420
|
+
const c = b.current, D = h.current;
|
|
1421
|
+
b.current = !1, h.current = !1;
|
|
1422
|
+
let w;
|
|
1423
|
+
c && !D ? w = "from" : D && !c ? w = "to" : w = T.current, requestAnimationFrame(() => {
|
|
1424
|
+
(w === "from" ? m.current : C.current)?.focus();
|
|
1425
|
+
});
|
|
1426
|
+
}, { context: $, refs: _, floatingStyles: j } = Qt({
|
|
1427
|
+
open: a,
|
|
1428
|
+
onOpenChange: (c) => {
|
|
1429
|
+
l.readOnly || (v(c), c || K());
|
|
1430
|
+
},
|
|
1431
|
+
placement: "bottom-start",
|
|
1432
|
+
middleware: [
|
|
1433
|
+
Ft({
|
|
1434
|
+
mainAxis: 10,
|
|
1435
|
+
crossAxis: -32
|
|
1436
|
+
}),
|
|
1437
|
+
kt()
|
|
1438
|
+
],
|
|
1439
|
+
whileElementsMounted: At
|
|
1440
|
+
}), te = Xt($, { enabled: !l.disabled && !l.readOnly }), U = Jt($), { getFloatingProps: ve, getReferenceProps: ne } = Zt([te, U]), p = (c, D) => c || D ? { from: c, to: D } : void 0, [f, W] = me(() => p(n, r)), B = fe(f);
|
|
1441
|
+
xt(() => {
|
|
1442
|
+
const c = p(n, r);
|
|
1443
|
+
W(c), B.current = c;
|
|
1444
|
+
}, [n, r]);
|
|
1445
|
+
const R = (c, D) => {
|
|
1446
|
+
const w = f?.from, M = f?.to, O = c?.from, q = c?.to;
|
|
1447
|
+
W(c), B.current = c, w?.getTime() !== O?.getTime() && (b.current = !0, o?.(O)), M?.getTime() !== q?.getTime() && (h.current = !0, i?.(q)), D === "calendar" && O && q && (v(!1), A(!1), H(null), K());
|
|
1448
|
+
}, L = (c) => {
|
|
1449
|
+
const D = T.current === "from", w = B.current;
|
|
1450
|
+
let M, O;
|
|
1451
|
+
D ? (M = c, O = w?.to) : (M = w?.from, O = c), M && O && M.getTime() > O.getTime() && ([M, O] = [O, M]), T.current = D ? "to" : "from", R({ from: M, to: O }, "calendar");
|
|
1452
|
+
}, V = (c) => {
|
|
1453
|
+
const D = c && f?.to && c.getTime() > f.to.getTime() ? c : f?.to;
|
|
1454
|
+
R(p(c, D), "input");
|
|
1455
|
+
}, Y = (c) => {
|
|
1456
|
+
const D = c && f?.from && c.getTime() < f.from.getTime() ? c : f?.from;
|
|
1457
|
+
R(p(D, c), "input");
|
|
1458
|
+
}, Q = l["data-testid"], S = f?.from && !f?.to ? f.from : f?.to && !f?.from ? f.to : null, G = (() => {
|
|
1459
|
+
if (!S || !P || dn(S, P)) return;
|
|
1460
|
+
const c = S < P, D = nt(c ? S : P, 1), w = nt(c ? P : S, -1), M = D <= w;
|
|
1461
|
+
return {
|
|
1462
|
+
// Anchor gradient (selected range color)
|
|
1463
|
+
...c ? { range_preview_start: S } : { range_preview_end: S },
|
|
1464
|
+
// Hovered date gradient (hover color) + button styling
|
|
1465
|
+
range_preview_hovered: P,
|
|
1466
|
+
...c ? { range_preview_hovered_end: P } : { range_preview_hovered_start: P },
|
|
1467
|
+
// Flat background on dates between anchor and hovered
|
|
1468
|
+
...M && {
|
|
1469
|
+
range_preview: { from: D, to: w }
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
})(), N = G ? {
|
|
1473
|
+
range_preview: "purpur-calendar-range-preview",
|
|
1474
|
+
range_preview_start: "purpur-calendar-range-preview-start",
|
|
1475
|
+
range_preview_end: "purpur-calendar-range-preview-end",
|
|
1476
|
+
range_preview_hovered: "purpur-calendar-range-preview-hovered",
|
|
1477
|
+
range_preview_hovered_start: "purpur-calendar-range-preview-hovered-start",
|
|
1478
|
+
range_preview_hovered_end: "purpur-calendar-range-preview-hovered-end"
|
|
1479
|
+
} : void 0, z = S ? (c) => H(c) : void 0, re = () => {
|
|
1480
|
+
T.current = "from";
|
|
1481
|
+
}, Ce = () => {
|
|
1482
|
+
T.current = "to";
|
|
1483
|
+
}, se = l.fromInputRef, oe = l.toInputRef, be = Ze(
|
|
1484
|
+
(c) => {
|
|
1485
|
+
m.current = c, typeof se == "function" ? se(c) : se && (se.current = c);
|
|
1486
|
+
},
|
|
1487
|
+
[se]
|
|
1488
|
+
), x = Ze(
|
|
1489
|
+
(c) => {
|
|
1490
|
+
C.current = c, typeof oe == "function" ? oe(c) : oe && (oe.current = c);
|
|
1491
|
+
},
|
|
1492
|
+
[oe]
|
|
1493
|
+
), F = /* @__PURE__ */ k(
|
|
1494
|
+
mn,
|
|
1495
|
+
{
|
|
1496
|
+
...l,
|
|
1497
|
+
fromInputRef: be,
|
|
1498
|
+
toInputRef: x,
|
|
1499
|
+
fromFieldProps: {
|
|
1500
|
+
...l.fromFieldProps,
|
|
1501
|
+
onFocus: (c) => {
|
|
1502
|
+
re(), l.fromFieldProps?.onFocus?.(c);
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
toFieldProps: {
|
|
1506
|
+
...l.toFieldProps,
|
|
1507
|
+
// When the calendar is open and was triggered from the "from" input,
|
|
1508
|
+
// take the "to" input out of the tab order so forward-Tab from "from"
|
|
1509
|
+
// lands inside the calendar (handled by Floating UI's focus guards)
|
|
1510
|
+
// instead of jumping to "to". Opening from the "to" input, or
|
|
1511
|
+
// closing the calendar, leaves the natural tab order intact.
|
|
1512
|
+
tabIndex: a && T.current === "from" ? -1 : l.toFieldProps?.tabIndex,
|
|
1513
|
+
onFocus: (c) => {
|
|
1514
|
+
Ce(), l.toFieldProps?.onFocus?.(c);
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
fromValue: f?.from,
|
|
1518
|
+
toValue: f?.to,
|
|
1519
|
+
onFromChange: V,
|
|
1520
|
+
onToChange: Y
|
|
1521
|
+
}
|
|
1522
|
+
), I = T.current === "to" ? f?.to ?? f?.from : f?.from ?? f?.to;
|
|
1523
|
+
return g ? /* @__PURE__ */ Te(
|
|
1524
|
+
Ee,
|
|
1525
|
+
{
|
|
1526
|
+
open: y,
|
|
1527
|
+
onOpenChange: (c) => {
|
|
1528
|
+
A(c), c || K();
|
|
1529
|
+
},
|
|
1530
|
+
children: [
|
|
1531
|
+
/* @__PURE__ */ k(Ee.Trigger, { children: /* @__PURE__ */ k("div", { children: F }) }),
|
|
1532
|
+
/* @__PURE__ */ k(
|
|
1533
|
+
Ee.Content,
|
|
1534
|
+
{
|
|
1535
|
+
"data-testid": Q && `${Q}-calendar`,
|
|
1536
|
+
fitToContent: !0,
|
|
1537
|
+
...t,
|
|
1538
|
+
zIndex: s,
|
|
1539
|
+
children: /* @__PURE__ */ k(
|
|
1540
|
+
ke,
|
|
1541
|
+
{
|
|
1542
|
+
showOutsideDays: !0,
|
|
1543
|
+
defaultMonth: I,
|
|
1544
|
+
...e,
|
|
1545
|
+
mode: "range",
|
|
1546
|
+
selected: f,
|
|
1547
|
+
onSelect: () => {
|
|
1548
|
+
},
|
|
1549
|
+
onDayClick: L,
|
|
1550
|
+
modifiers: G,
|
|
1551
|
+
modifiersClassNames: N,
|
|
1552
|
+
onDayMouseEnter: z
|
|
1553
|
+
}
|
|
1554
|
+
)
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
) : /* @__PURE__ */ Te("div", { ref: u, children: [
|
|
1560
|
+
/* @__PURE__ */ k("div", { ...ne(), ref: _.setReference, children: F }),
|
|
1561
|
+
a && !l.readOnly && /* @__PURE__ */ k(zt, { children: /* @__PURE__ */ k(
|
|
1562
|
+
Yt,
|
|
1563
|
+
{
|
|
1564
|
+
context: $,
|
|
1565
|
+
modal: !1,
|
|
1566
|
+
order: ["reference", "floating", "content"],
|
|
1567
|
+
children: /* @__PURE__ */ k(
|
|
1568
|
+
"div",
|
|
1569
|
+
{
|
|
1570
|
+
"data-testid": Q && `${Q}-calendar`,
|
|
1571
|
+
className: en("date-picker-calendar-container"),
|
|
1572
|
+
ref: _.setFloating,
|
|
1573
|
+
style: { ...j, zIndex: s },
|
|
1574
|
+
...ve(),
|
|
1575
|
+
children: /* @__PURE__ */ k(
|
|
1576
|
+
ke,
|
|
1577
|
+
{
|
|
1578
|
+
showOutsideDays: !0,
|
|
1579
|
+
defaultMonth: I,
|
|
1580
|
+
...e,
|
|
1581
|
+
mode: "range",
|
|
1582
|
+
selected: f,
|
|
1583
|
+
onSelect: () => {
|
|
1584
|
+
},
|
|
1585
|
+
onDayClick: L,
|
|
1586
|
+
modifiers: G,
|
|
1587
|
+
modifiersClassNames: N,
|
|
1588
|
+
onDayMouseEnter: z,
|
|
1589
|
+
firstElementRef: E
|
|
1590
|
+
}
|
|
1591
|
+
)
|
|
1592
|
+
}
|
|
1593
|
+
)
|
|
1594
|
+
}
|
|
1595
|
+
) })
|
|
1596
|
+
] });
|
|
1597
|
+
}, tn = () => {
|
|
1598
|
+
const [e, t] = me(!1);
|
|
1599
|
+
return Ct(() => {
|
|
1600
|
+
const n = () => {
|
|
1601
|
+
t(window.innerWidth < 600);
|
|
1602
|
+
};
|
|
1603
|
+
return n(), window.addEventListener("resize", n), () => {
|
|
1604
|
+
window.removeEventListener("resize", n);
|
|
1605
|
+
};
|
|
1606
|
+
}, []), e;
|
|
1607
|
+
};
|
|
1608
|
+
export {
|
|
1609
|
+
vr as D
|
|
1610
|
+
};
|
|
1611
|
+
//# sourceMappingURL=date-picker-CzxhZxsw.mjs.map
|