@stihl-design-system/components 1.0.0-RC.25 → 1.0.0-RC.27
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/{accordion.Dw3qTPN8.js → accordion.CBaDU14g.js} +2 -2
- package/{actionbutton.wYg4A5a2.js → actionbutton.DEJsLxnQ.js} +2 -2
- package/{actionlink.BoWrs0Mo.js → actionlink.Cs6BTCA3.js} +2 -2
- package/{arialiveregions.DVsA5OTR.js → arialiveregions.Fgcshs5k.js} +1 -1
- package/assets/ActionButton.Ewi0i1hW.css +1 -0
- package/assets/ActionLink.BdPEvuGm.css +1 -0
- package/assets/CustomReactSelect.B9f_KYFg.css +1 -0
- package/assets/Icon.QeJ7TxZs.css +1 -0
- package/assets/InputFile.Dqjz53mb.css +1 -0
- package/assets/InputPassword.BuVQ9dRy.css +1 -0
- package/assets/InputSearch.Dwtb3Mhw.css +1 -0
- package/assets/InputStepper.CBt99L83.css +1 -0
- package/assets/Popover.BDTDsPAt.css +1 -0
- package/assets/Select.CghDnBUQ.css +1 -0
- package/assets/Textarea.BgtH-TTe.css +1 -0
- package/assets/banner.D9EiZqqR.css +1 -0
- package/assets/input.DFwunFjw.css +1 -0
- package/assets/radio.BCB51D_y.css +1 -0
- package/assets/scroller.Hszs1Yq4.css +1 -0
- package/banner.CgQdUb_c.js +55 -0
- package/banner.d.ts +2 -0
- package/{breadcrumb.C07HDyGp.js → breadcrumb.x78HJy5P.js} +3 -3
- package/{button.BBqDvwVm.js → button.BD_04tIG.js} +3 -3
- package/{buttonround.Vy1EygFm.js → buttonround.BT3OfowK.js} +2 -2
- package/{checkbox.CvWI1Jrx.js → checkbox.BktYXQmJ.js} +3 -3
- package/{checkboxgroup.BLpSLo9t.js → checkboxgroup.YK8H0YoX.js} +2 -2
- package/{chip.BsDriMfL.js → chip.BKtNbt4y.js} +2 -2
- package/chipgroup.BWpqUzXF.js +209 -0
- package/chunks/{Accordion.Cjc_1Bu1.js → Accordion.eVOD7J_8.js} +2 -2
- package/chunks/ActionButton.Ck1rGqgm.js +165 -0
- package/chunks/ActionLink.DnUNjoAT.js +138 -0
- package/chunks/{AriaLiveRegions.utils.zSFFD3SF.js → AriaLiveRegions.utils.Cb327d_2.js} +1 -1
- package/chunks/{Breadcrumb.QhD6byzd.js → Breadcrumb.B7g30dIO.js} +3 -3
- package/chunks/{Button.DZNUuPKC.js → Button.CC0qEsuR.js} +4 -4
- package/chunks/{Checkbox.Ch8DBzws.js → Checkbox.BIQAKBVy.js} +3 -3
- package/chunks/{CheckboxGroup.C8D6tjVI.js → CheckboxGroup.DHzpgOWp.js} +3 -3
- package/chunks/{Chip.CHy8cZJz.js → Chip.DifLxHH7.js} +3 -3
- package/chunks/{CustomReactSelect.hdDSE0ON.js → CustomReactSelect.BPnzhvw1.js} +1356 -1593
- package/chunks/{Dialog.DPeGj8-T.js → Dialog.BuEEJ199.js} +2 -2
- package/chunks/{Drawer.BMibxANc.js → Drawer.BXUGmpJI.js} +2 -2
- package/chunks/{Fieldset.DHccz6TP.js → Fieldset.BX46NuLh.js} +2 -2
- package/chunks/Header.Djs1adPW.js +361 -0
- package/chunks/{Icon.CAXZUNWo.js → Icon.C0161Glk.js} +70 -67
- package/chunks/{Input.utils.CCYTBWD_.js → Input.utils.Cnnzvuk4.js} +1 -1
- package/chunks/{InputFile.fltVIulD.js → InputFile.vkkg5Pab.js} +32 -32
- package/chunks/InputPassword.D42uUEGy.js +136 -0
- package/chunks/InputSearch.aIbUXVQU.js +174 -0
- package/chunks/InputStepper.DFEdUWm7.js +263 -0
- package/chunks/{LinkButton.DyTU9sfN.js → LinkButton.DmXVHeyZ.js} +3 -3
- package/chunks/{NavigationTabList.D2NVVTjK.js → NavigationTabList.IQM074Vb.js} +1 -1
- package/chunks/{NavigationTabs.TfdsA8GX.js → NavigationTabs.BofhX8bD.js} +2 -2
- package/chunks/{Notification.BRg1qlng.js → Notification.B-3dPVUE.js} +2 -2
- package/chunks/Popover.hXQTvwwd.js +1685 -0
- package/chunks/{RadioGroup.D9mECdMK.js → RadioGroup.c7YYJdUe.js} +3 -3
- package/chunks/{Select.DCxMPsCm.js → Select.B_EHpk22.js} +25 -25
- package/chunks/{Slider.Cljc14kS.js → Slider.DMSwmGwD.js} +2 -2
- package/chunks/{Tabs.GvcCCCFT.js → Tabs.Bl4K3Kjn.js} +2 -2
- package/chunks/{Text.TS4XdA9e.js → Text.DGWeWF1y.js} +1 -1
- package/chunks/{Textarea.Bs4-nzu8.js → Textarea.Ce26v6ht.js} +54 -54
- package/chunks/{Toast.DawJ9OSY.js → Toast.BHz0vlGz.js} +2 -2
- package/chunks/floating-ui.dom.C9TD1WpB.js +950 -0
- package/chunks/helpers.BbWkXTr3.js +37 -0
- package/chunks/is-animation-disabled.CUl4N3LI.js +20 -0
- package/{combobox.DW_ey38o.js → combobox.AaK6QjRl.js} +1 -1
- package/components/ActionButton/ActionButton.d.ts +9 -5
- package/components/ActionButton/ActionButton.utils.d.ts +4 -2
- package/components/ActionLink/ActionLink.d.ts +9 -5
- package/components/ActionLink/ActionLink.utils.d.ts +4 -2
- package/components/Banner/Banner.d.ts +32 -0
- package/components/Banner/Banner.utils.d.ts +2 -0
- package/components/Button/Button.utils.d.ts +1 -1
- package/components/Header/Header.utils.d.ts +0 -2
- package/components/Icon/Icon.d.ts +1 -1
- package/components/Icon/Icon.utils.d.ts +1 -1
- package/components/Popover/Popover.d.ts +40 -0
- package/components/Popover/Popover.test.d.ts +1 -0
- package/components/Popover/Popover.utils.d.ts +53 -0
- package/components/Popover/Popover.utils.test.d.ts +1 -0
- package/components/Scroller/Scroller.d.ts +20 -0
- package/components/Scroller/Scroller.utils.d.ts +3 -0
- package/components/Tabs/TabList/TabList.d.ts +1 -1
- package/components/Tabs/TabList/TabList.utils.d.ts +0 -4
- package/connected-icon.svg +1 -0
- package/{customreactselect.DcH7h1mb.js → customreactselect.Bu1i8wkh.js} +4 -4
- package/{dialog.D6d_WXOM.js → dialog.CGsUCqhR.js} +2 -2
- package/{drawer.BmQWFOuF.js → drawer.BcAo4TO0.js} +2 -2
- package/{fieldset.D6q9YXrO.js → fieldset.DM9ELUJa.js} +2 -2
- package/{filelist.Dnd5nOdw.js → filelist.Cj9U-Jx8.js} +3 -3
- package/{flag.BR312AU-.js → flag.BHaAfp6B.js} +1 -1
- package/{floatingactionbutton.Do6eNSHq.js → floatingactionbutton.DSZXUHB_.js} +2 -2
- package/{header.5iwPmK5V.js → header.WhQHSuB1.js} +2 -2
- package/{icon.HkVs68n_.js → icon.DwfGhFCd.js} +1 -1
- package/icon.svg +1 -1
- package/imow-icon.svg +1 -0
- package/index.d.ts +6 -0
- package/index.es.js +201 -188
- package/{input.mPceLGnf.js → input.DhxUW3zc.js} +37 -37
- package/{inputfile.CIpE9i-3.js → inputfile.Cmkxf4Vq.js} +6 -6
- package/{inputpassword.DkiyI-yo.js → inputpassword.CaJBCMA0.js} +3 -3
- package/{inputsearch.DcOp_VUd.js → inputsearch.B06DhYzo.js} +4 -4
- package/{inputstepper.D7TpDXst.js → inputstepper.DNY7nzP8.js} +4 -4
- package/{link.B5NZ1QKr.js → link.DGuYGfh2.js} +2 -2
- package/{linkbutton.CMVcQVxI.js → linkbutton.B3q0B_yb.js} +3 -3
- package/{logo.B9taqlZR.js → logo.C96KaG1P.js} +1 -1
- package/mystihl-icon.svg +1 -0
- package/{navigationtablist.BMJTC9qo.js → navigationtablist.CS9yEGdP.js} +2 -2
- package/{navigationtabs.BQeKKIFy.js → navigationtabs.DQ1kE-h4.js} +2 -2
- package/{notification.Bzli8Qlq.js → notification.D8BDaU5x.js} +3 -3
- package/{optioncheckbox.DYKRBTy0.js → optioncheckbox.CEEPAq0u.js} +1 -1
- package/package.json +4 -2
- package/partials/assets.const.js +2 -0
- package/partials/copyAssets.js +4 -2
- package/partials/index.js +109 -81
- package/partials/lib/partials.d.ts +1 -1
- package/popover.BFx99cHg.js +10 -0
- package/popover.d.ts +2 -0
- package/radio.Be4pFOLf.js +134 -0
- package/{radiogroup.BnMkpjvV.js → radiogroup.BRjwP01C.js} +3 -3
- package/scroller.CCA6kFR6.js +123 -0
- package/scroller.d.ts +2 -0
- package/{select.BSvjDIVC.js → select.3zE96eWc.js} +3 -3
- package/{skiptocontent.CQ4aARqd.js → skiptocontent.D1UkPmhD.js} +2 -2
- package/{slider.LRlFFlYL.js → slider.CTCf7Xdm.js} +2 -2
- package/{spinner.t5FHjIEK.js → spinner.CeGt8DxU.js} +1 -1
- package/{switch.QUUSE9ZF.js → switch.CtULjgZq.js} +2 -2
- package/{systemfeedback.BpKZEv4U.js → systemfeedback.CLQCbTF6.js} +1 -1
- package/tablist.Dzwe0_J4.js +256 -0
- package/{tabs.CXkSN2kd.js → tabs.yudjJk9d.js} +2 -2
- package/{text.CPwbk8Gy.js → text.ZOUuesnU.js} +2 -2
- package/{textarea.D0ADOdR6.js → textarea.B_3fPtmd.js} +3 -3
- package/{toast.CYYvK4DJ.js → toast.Bhpwj1NF.js} +3 -3
- package/{toastmanager.k9iGb7MN.js → toastmanager.BHk65ynQ.js} +3 -3
- package/topbar.2b8fjmA4.js +11 -0
- package/utils/get-rect.d.ts +4 -0
- package/utils/get-rect.test.d.ts +1 -0
- package/utils/helpers.d.ts +10 -0
- package/utils/index.d.ts +2 -1
- package/utils/is-animation-disabled.d.ts +14 -0
- package/utils/is-animation-disabled.test.d.ts +1 -0
- package/assets/ActionButton.DZVAnm-p.css +0 -1
- package/assets/ActionLink.DuklSL3c.css +0 -1
- package/assets/CustomReactSelect.B8l6al4B.css +0 -1
- package/assets/Icon.ZNrKuqgu.css +0 -1
- package/assets/InputFile.Dx_CULYq.css +0 -1
- package/assets/InputPassword.CkHF5zCh.css +0 -1
- package/assets/InputSearch.BV8Q2EUL.css +0 -1
- package/assets/InputStepper.DzzrAdma.css +0 -1
- package/assets/Select.e1fTfWmm.css +0 -1
- package/assets/Textarea.BGV7Z0Z9.css +0 -1
- package/assets/input.Cj4tF_F7.css +0 -1
- package/assets/radio.CqaNn1Gz.css +0 -1
- package/chipgroup.D1Km301k.js +0 -186
- package/chunks/ActionButton.DFI8P9-f.js +0 -159
- package/chunks/ActionLink.CLQ1yQZF.js +0 -132
- package/chunks/Header.DPafHEKw.js +0 -384
- package/chunks/InputPassword.C4QhwijC.js +0 -136
- package/chunks/InputSearch.DdWBmEmu.js +0 -174
- package/chunks/InputStepper.BRzbuEho.js +0 -263
- package/chunks/helpers.CcqWV-wZ.js +0 -8
- package/radio.Dm9bDBzM.js +0 -134
- package/tablist.DGGeFOi1.js +0 -266
- package/topbar.BPSDyH0N.js +0 -10
- package/utils/isAnimationDisabled.d.ts +0 -1
- /package/components/{Tabs/TabList/TabList.utils.test.d.ts → Banner/Banner.test.d.ts} +0 -0
|
@@ -0,0 +1,1685 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as Et, jsx as J, Fragment as Gt } from "react/jsx-runtime";
|
|
3
|
+
import { d as Oe } from "./index.CgTHIF3K.js";
|
|
4
|
+
import * as l from "react";
|
|
5
|
+
import { useLayoutEffect as yt, isValidElement as xt, useState as Yt, createContext as Xt, forwardRef as wt, cloneElement as zt, useContext as Zt } from "react";
|
|
6
|
+
import { i as Jt, b as se, f as Qt, c as en, o as tn, s as nn, d as z, g as St, e as Fe, h as rn, j as on, k as Le, l as sn, a as an } from "./floating-ui.dom.C9TD1WpB.js";
|
|
7
|
+
import * as Ct from "react-dom";
|
|
8
|
+
import { c as un } from "./index.CEyLAtio.js";
|
|
9
|
+
import { g as Ce, c as Je } from "./helpers.BbWkXTr3.js";
|
|
10
|
+
import '../assets/Popover.BDTDsPAt.css';const ln = "ds-popover_popover_zyqhl_5", cn = {
|
|
11
|
+
popover: ln
|
|
12
|
+
};
|
|
13
|
+
/*!
|
|
14
|
+
* tabbable 6.2.0
|
|
15
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
16
|
+
*/
|
|
17
|
+
var fn = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Te = /* @__PURE__ */ fn.join(","), Tt = typeof Element > "u", ve = Tt ? function() {
|
|
18
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Ie = !Tt && Element.prototype.getRootNode ? function(t) {
|
|
19
|
+
var e;
|
|
20
|
+
return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
|
|
21
|
+
} : function(t) {
|
|
22
|
+
return t == null ? void 0 : t.ownerDocument;
|
|
23
|
+
}, Pe = function t(e, n) {
|
|
24
|
+
var r;
|
|
25
|
+
n === void 0 && (n = !0);
|
|
26
|
+
var o = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), s = o === "" || o === "true", i = s || n && e && t(e.parentNode);
|
|
27
|
+
return i;
|
|
28
|
+
}, dn = function(e) {
|
|
29
|
+
var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
|
|
30
|
+
return r === "" || r === "true";
|
|
31
|
+
}, It = function(e, n, r) {
|
|
32
|
+
if (Pe(e))
|
|
33
|
+
return [];
|
|
34
|
+
var o = Array.prototype.slice.apply(e.querySelectorAll(Te));
|
|
35
|
+
return n && ve.call(e, Te) && o.unshift(e), o = o.filter(r), o;
|
|
36
|
+
}, Pt = function t(e, n, r) {
|
|
37
|
+
for (var o = [], s = Array.from(e); s.length; ) {
|
|
38
|
+
var i = s.shift();
|
|
39
|
+
if (!Pe(i, !1))
|
|
40
|
+
if (i.tagName === "SLOT") {
|
|
41
|
+
var a = i.assignedElements(), u = a.length ? a : i.children, c = t(u, !0, r);
|
|
42
|
+
r.flatten ? o.push.apply(o, c) : o.push({
|
|
43
|
+
scopeParent: i,
|
|
44
|
+
candidates: c
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
var p = ve.call(i, Te);
|
|
48
|
+
p && r.filter(i) && (n || !e.includes(i)) && o.push(i);
|
|
49
|
+
var g = i.shadowRoot || // check for an undisclosed shadow
|
|
50
|
+
typeof r.getShadowRoot == "function" && r.getShadowRoot(i), h = !Pe(g, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
|
|
51
|
+
if (g && h) {
|
|
52
|
+
var d = t(g === !0 ? i.children : g.children, !0, r);
|
|
53
|
+
r.flatten ? o.push.apply(o, d) : o.push({
|
|
54
|
+
scopeParent: i,
|
|
55
|
+
candidates: d
|
|
56
|
+
});
|
|
57
|
+
} else
|
|
58
|
+
s.unshift.apply(s, i.children);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return o;
|
|
62
|
+
}, At = function(e) {
|
|
63
|
+
return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
|
|
64
|
+
}, Dt = function(e) {
|
|
65
|
+
if (!e)
|
|
66
|
+
throw new Error("No node provided");
|
|
67
|
+
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || dn(e)) && !At(e) ? 0 : e.tabIndex;
|
|
68
|
+
}, pn = function(e, n) {
|
|
69
|
+
var r = Dt(e);
|
|
70
|
+
return r < 0 && n && !At(e) ? 0 : r;
|
|
71
|
+
}, vn = function(e, n) {
|
|
72
|
+
return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
|
|
73
|
+
}, Ot = function(e) {
|
|
74
|
+
return e.tagName === "INPUT";
|
|
75
|
+
}, mn = function(e) {
|
|
76
|
+
return Ot(e) && e.type === "hidden";
|
|
77
|
+
}, gn = function(e) {
|
|
78
|
+
var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
|
|
79
|
+
return r.tagName === "SUMMARY";
|
|
80
|
+
});
|
|
81
|
+
return n;
|
|
82
|
+
}, bn = function(e, n) {
|
|
83
|
+
for (var r = 0; r < e.length; r++)
|
|
84
|
+
if (e[r].checked && e[r].form === n)
|
|
85
|
+
return e[r];
|
|
86
|
+
}, hn = function(e) {
|
|
87
|
+
if (!e.name)
|
|
88
|
+
return !0;
|
|
89
|
+
var n = e.form || Ie(e), r = function(a) {
|
|
90
|
+
return n.querySelectorAll('input[type="radio"][name="' + a + '"]');
|
|
91
|
+
}, o;
|
|
92
|
+
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
93
|
+
o = r(window.CSS.escape(e.name));
|
|
94
|
+
else
|
|
95
|
+
try {
|
|
96
|
+
o = r(e.name);
|
|
97
|
+
} catch (i) {
|
|
98
|
+
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", i.message), !1;
|
|
99
|
+
}
|
|
100
|
+
var s = bn(o, e.form);
|
|
101
|
+
return !s || s === e;
|
|
102
|
+
}, Rn = function(e) {
|
|
103
|
+
return Ot(e) && e.type === "radio";
|
|
104
|
+
}, En = function(e) {
|
|
105
|
+
return Rn(e) && !hn(e);
|
|
106
|
+
}, yn = function(e) {
|
|
107
|
+
var n, r = e && Ie(e), o = (n = r) === null || n === void 0 ? void 0 : n.host, s = !1;
|
|
108
|
+
if (r && r !== e) {
|
|
109
|
+
var i, a, u;
|
|
110
|
+
for (s = !!((i = o) !== null && i !== void 0 && (a = i.ownerDocument) !== null && a !== void 0 && a.contains(o) || e != null && (u = e.ownerDocument) !== null && u !== void 0 && u.contains(e)); !s && o; ) {
|
|
111
|
+
var c, p, g;
|
|
112
|
+
r = Ie(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, s = !!((p = o) !== null && p !== void 0 && (g = p.ownerDocument) !== null && g !== void 0 && g.contains(o));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return s;
|
|
116
|
+
}, Qe = function(e) {
|
|
117
|
+
var n = e.getBoundingClientRect(), r = n.width, o = n.height;
|
|
118
|
+
return r === 0 && o === 0;
|
|
119
|
+
}, xn = function(e, n) {
|
|
120
|
+
var r = n.displayCheck, o = n.getShadowRoot;
|
|
121
|
+
if (getComputedStyle(e).visibility === "hidden")
|
|
122
|
+
return !0;
|
|
123
|
+
var s = ve.call(e, "details>summary:first-of-type"), i = s ? e.parentElement : e;
|
|
124
|
+
if (ve.call(i, "details:not([open]) *"))
|
|
125
|
+
return !0;
|
|
126
|
+
if (!r || r === "full" || r === "legacy-full") {
|
|
127
|
+
if (typeof o == "function") {
|
|
128
|
+
for (var a = e; e; ) {
|
|
129
|
+
var u = e.parentElement, c = Ie(e);
|
|
130
|
+
if (u && !u.shadowRoot && o(u) === !0)
|
|
131
|
+
return Qe(e);
|
|
132
|
+
e.assignedSlot ? e = e.assignedSlot : !u && c !== e.ownerDocument ? e = c.host : e = u;
|
|
133
|
+
}
|
|
134
|
+
e = a;
|
|
135
|
+
}
|
|
136
|
+
if (yn(e))
|
|
137
|
+
return !e.getClientRects().length;
|
|
138
|
+
if (r !== "legacy-full")
|
|
139
|
+
return !0;
|
|
140
|
+
} else if (r === "non-zero-area")
|
|
141
|
+
return Qe(e);
|
|
142
|
+
return !1;
|
|
143
|
+
}, wn = function(e) {
|
|
144
|
+
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
|
|
145
|
+
for (var n = e.parentElement; n; ) {
|
|
146
|
+
if (n.tagName === "FIELDSET" && n.disabled) {
|
|
147
|
+
for (var r = 0; r < n.children.length; r++) {
|
|
148
|
+
var o = n.children.item(r);
|
|
149
|
+
if (o.tagName === "LEGEND")
|
|
150
|
+
return ve.call(n, "fieldset[disabled] *") ? !0 : !o.contains(e);
|
|
151
|
+
}
|
|
152
|
+
return !0;
|
|
153
|
+
}
|
|
154
|
+
n = n.parentElement;
|
|
155
|
+
}
|
|
156
|
+
return !1;
|
|
157
|
+
}, qe = function(e, n) {
|
|
158
|
+
return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
|
|
159
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
160
|
+
// note related to `candidateSelectors`)
|
|
161
|
+
Pe(n) || mn(n) || xn(n, e) || // For a details element with a summary, the summary element gets the focus
|
|
162
|
+
gn(n) || wn(n));
|
|
163
|
+
}, Ue = function(e, n) {
|
|
164
|
+
return !(En(n) || Dt(n) < 0 || !qe(e, n));
|
|
165
|
+
}, Sn = function(e) {
|
|
166
|
+
var n = parseInt(e.getAttribute("tabindex"), 10);
|
|
167
|
+
return !!(isNaN(n) || n >= 0);
|
|
168
|
+
}, Cn = function t(e) {
|
|
169
|
+
var n = [], r = [];
|
|
170
|
+
return e.forEach(function(o, s) {
|
|
171
|
+
var i = !!o.scopeParent, a = i ? o.scopeParent : o, u = pn(a, i), c = i ? t(o.candidates) : a;
|
|
172
|
+
u === 0 ? i ? n.push.apply(n, c) : n.push(a) : r.push({
|
|
173
|
+
documentOrder: s,
|
|
174
|
+
tabIndex: u,
|
|
175
|
+
item: o,
|
|
176
|
+
isScope: i,
|
|
177
|
+
content: c
|
|
178
|
+
});
|
|
179
|
+
}), r.sort(vn).reduce(function(o, s) {
|
|
180
|
+
return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
|
|
181
|
+
}, []).concat(n);
|
|
182
|
+
}, ke = function(e, n) {
|
|
183
|
+
n = n || {};
|
|
184
|
+
var r;
|
|
185
|
+
return n.getShadowRoot ? r = Pt([e], n.includeContainer, {
|
|
186
|
+
filter: Ue.bind(null, n),
|
|
187
|
+
flatten: !1,
|
|
188
|
+
getShadowRoot: n.getShadowRoot,
|
|
189
|
+
shadowRootFilter: Sn
|
|
190
|
+
}) : r = It(e, n.includeContainer, Ue.bind(null, n)), Cn(r);
|
|
191
|
+
}, Tn = function(e, n) {
|
|
192
|
+
n = n || {};
|
|
193
|
+
var r;
|
|
194
|
+
return n.getShadowRoot ? r = Pt([e], n.includeContainer, {
|
|
195
|
+
filter: qe.bind(null, n),
|
|
196
|
+
flatten: !0,
|
|
197
|
+
getShadowRoot: n.getShadowRoot
|
|
198
|
+
}) : r = It(e, n.includeContainer, qe.bind(null, n)), r;
|
|
199
|
+
}, kt = function(e, n) {
|
|
200
|
+
if (n = n || {}, !e)
|
|
201
|
+
throw new Error("No node provided");
|
|
202
|
+
return ve.call(e, Te) === !1 ? !1 : Ue(n, e);
|
|
203
|
+
};
|
|
204
|
+
function In() {
|
|
205
|
+
const t = navigator.userAgentData;
|
|
206
|
+
return t != null && t.platform ? t.platform : navigator.platform;
|
|
207
|
+
}
|
|
208
|
+
function Mt() {
|
|
209
|
+
const t = navigator.userAgentData;
|
|
210
|
+
return t && Array.isArray(t.brands) ? t.brands.map((e) => {
|
|
211
|
+
let {
|
|
212
|
+
brand: n,
|
|
213
|
+
version: r
|
|
214
|
+
} = e;
|
|
215
|
+
return n + "/" + r;
|
|
216
|
+
}).join(" ") : navigator.userAgent;
|
|
217
|
+
}
|
|
218
|
+
function Pn() {
|
|
219
|
+
return /apple/i.test(navigator.vendor);
|
|
220
|
+
}
|
|
221
|
+
function je() {
|
|
222
|
+
const t = /android/i;
|
|
223
|
+
return t.test(In()) || t.test(Mt());
|
|
224
|
+
}
|
|
225
|
+
function An() {
|
|
226
|
+
return Mt().includes("jsdom/");
|
|
227
|
+
}
|
|
228
|
+
const et = "data-floating-ui-focusable", Dn = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
229
|
+
function de(t) {
|
|
230
|
+
let e = t.activeElement;
|
|
231
|
+
for (; ((n = e) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
|
|
232
|
+
var n;
|
|
233
|
+
e = e.shadowRoot.activeElement;
|
|
234
|
+
}
|
|
235
|
+
return e;
|
|
236
|
+
}
|
|
237
|
+
function Y(t, e) {
|
|
238
|
+
if (!t || !e)
|
|
239
|
+
return !1;
|
|
240
|
+
const n = e.getRootNode == null ? void 0 : e.getRootNode();
|
|
241
|
+
if (t.contains(e))
|
|
242
|
+
return !0;
|
|
243
|
+
if (n && Jt(n)) {
|
|
244
|
+
let r = e;
|
|
245
|
+
for (; r; ) {
|
|
246
|
+
if (t === r)
|
|
247
|
+
return !0;
|
|
248
|
+
r = r.parentNode || r.host;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return !1;
|
|
252
|
+
}
|
|
253
|
+
function ue(t) {
|
|
254
|
+
return "composedPath" in t ? t.composedPath()[0] : t.target;
|
|
255
|
+
}
|
|
256
|
+
function _e(t, e) {
|
|
257
|
+
if (e == null)
|
|
258
|
+
return !1;
|
|
259
|
+
if ("composedPath" in t)
|
|
260
|
+
return t.composedPath().includes(e);
|
|
261
|
+
const n = t;
|
|
262
|
+
return n.target != null && e.contains(n.target);
|
|
263
|
+
}
|
|
264
|
+
function On(t) {
|
|
265
|
+
return t.matches("html,body");
|
|
266
|
+
}
|
|
267
|
+
function ee(t) {
|
|
268
|
+
return (t == null ? void 0 : t.ownerDocument) || document;
|
|
269
|
+
}
|
|
270
|
+
function Nt(t) {
|
|
271
|
+
return se(t) && t.matches(Dn);
|
|
272
|
+
}
|
|
273
|
+
function tt(t) {
|
|
274
|
+
return t ? t.getAttribute("role") === "combobox" && Nt(t) : !1;
|
|
275
|
+
}
|
|
276
|
+
function He(t) {
|
|
277
|
+
return t ? t.hasAttribute(et) ? t : t.querySelector("[" + et + "]") || t : null;
|
|
278
|
+
}
|
|
279
|
+
function ge(t, e) {
|
|
280
|
+
let n = t.filter((o) => {
|
|
281
|
+
var s;
|
|
282
|
+
return o.parentId === e && ((s = o.context) == null ? void 0 : s.open);
|
|
283
|
+
}), r = n;
|
|
284
|
+
for (; r.length; )
|
|
285
|
+
r = t.filter((o) => {
|
|
286
|
+
var s;
|
|
287
|
+
return (s = r) == null ? void 0 : s.some((i) => {
|
|
288
|
+
var a;
|
|
289
|
+
return o.parentId === i.id && ((a = o.context) == null ? void 0 : a.open);
|
|
290
|
+
});
|
|
291
|
+
}), n = n.concat(r);
|
|
292
|
+
return n;
|
|
293
|
+
}
|
|
294
|
+
function nt(t, e) {
|
|
295
|
+
var n;
|
|
296
|
+
let r = [], o = (n = t.find((s) => s.id === e)) == null ? void 0 : n.parentId;
|
|
297
|
+
for (; o; ) {
|
|
298
|
+
const s = t.find((i) => i.id === o);
|
|
299
|
+
o = s == null ? void 0 : s.parentId, s && (r = r.concat(s));
|
|
300
|
+
}
|
|
301
|
+
return r;
|
|
302
|
+
}
|
|
303
|
+
function $e(t) {
|
|
304
|
+
t.preventDefault(), t.stopPropagation();
|
|
305
|
+
}
|
|
306
|
+
function kn(t) {
|
|
307
|
+
return "nativeEvent" in t;
|
|
308
|
+
}
|
|
309
|
+
function Mn(t) {
|
|
310
|
+
return t.mozInputSource === 0 && t.isTrusted ? !0 : je() && t.pointerType ? t.type === "click" && t.buttons === 1 : t.detail === 0 && !t.pointerType;
|
|
311
|
+
}
|
|
312
|
+
function Nn(t) {
|
|
313
|
+
return An() ? !1 : !je() && t.width === 0 && t.height === 0 || je() && t.width === 1 && t.height === 1 && t.pressure === 0 && t.detail === 0 && t.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
|
|
314
|
+
t.width < 1 && t.height < 1 && t.pressure === 0 && t.detail === 0 && t.pointerType === "touch";
|
|
315
|
+
}
|
|
316
|
+
function rt(t, e) {
|
|
317
|
+
return ["mouse", "pen"].includes(t);
|
|
318
|
+
}
|
|
319
|
+
var Fn = typeof document < "u", Ln = function() {
|
|
320
|
+
}, Z = Fn ? yt : Ln;
|
|
321
|
+
const _n = {
|
|
322
|
+
...l
|
|
323
|
+
};
|
|
324
|
+
function Be(t) {
|
|
325
|
+
const e = l.useRef(t);
|
|
326
|
+
return Z(() => {
|
|
327
|
+
e.current = t;
|
|
328
|
+
}), e;
|
|
329
|
+
}
|
|
330
|
+
const $n = _n.useInsertionEffect, Bn = $n || ((t) => t());
|
|
331
|
+
function re(t) {
|
|
332
|
+
const e = l.useRef(() => {
|
|
333
|
+
if (process.env.NODE_ENV !== "production")
|
|
334
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
335
|
+
});
|
|
336
|
+
return Bn(() => {
|
|
337
|
+
e.current = t;
|
|
338
|
+
}), l.useCallback(function() {
|
|
339
|
+
for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
|
|
340
|
+
r[o] = arguments[o];
|
|
341
|
+
return e.current == null ? void 0 : e.current(...r);
|
|
342
|
+
}, []);
|
|
343
|
+
}
|
|
344
|
+
const Re = () => ({
|
|
345
|
+
getShadowRoot: !0,
|
|
346
|
+
displayCheck: (
|
|
347
|
+
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
348
|
+
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
349
|
+
// determines if the current environment is JSDOM-like.
|
|
350
|
+
typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
|
|
351
|
+
)
|
|
352
|
+
});
|
|
353
|
+
function Ft(t, e) {
|
|
354
|
+
const n = ke(t, Re()), r = n.length;
|
|
355
|
+
if (r === 0) return;
|
|
356
|
+
const o = de(ee(t)), s = n.indexOf(o), i = s === -1 ? e === 1 ? 0 : r - 1 : s + e;
|
|
357
|
+
return n[i];
|
|
358
|
+
}
|
|
359
|
+
function Lt(t) {
|
|
360
|
+
return Ft(ee(t).body, 1) || t;
|
|
361
|
+
}
|
|
362
|
+
function _t(t) {
|
|
363
|
+
return Ft(ee(t).body, -1) || t;
|
|
364
|
+
}
|
|
365
|
+
function be(t, e) {
|
|
366
|
+
const n = e || t.currentTarget, r = t.relatedTarget;
|
|
367
|
+
return !r || !Y(n, r);
|
|
368
|
+
}
|
|
369
|
+
function Vn(t) {
|
|
370
|
+
ke(t, Re()).forEach((n) => {
|
|
371
|
+
n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function ot(t) {
|
|
375
|
+
t.querySelectorAll("[data-tabindex]").forEach((n) => {
|
|
376
|
+
const r = n.dataset.tabindex;
|
|
377
|
+
delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
var Kn = typeof document < "u", Wn = function() {
|
|
381
|
+
}, Se = Kn ? yt : Wn;
|
|
382
|
+
function Ae(t, e) {
|
|
383
|
+
if (t === e)
|
|
384
|
+
return !0;
|
|
385
|
+
if (typeof t != typeof e)
|
|
386
|
+
return !1;
|
|
387
|
+
if (typeof t == "function" && t.toString() === e.toString())
|
|
388
|
+
return !0;
|
|
389
|
+
let n, r, o;
|
|
390
|
+
if (t && e && typeof t == "object") {
|
|
391
|
+
if (Array.isArray(t)) {
|
|
392
|
+
if (n = t.length, n !== e.length) return !1;
|
|
393
|
+
for (r = n; r-- !== 0; )
|
|
394
|
+
if (!Ae(t[r], e[r]))
|
|
395
|
+
return !1;
|
|
396
|
+
return !0;
|
|
397
|
+
}
|
|
398
|
+
if (o = Object.keys(t), n = o.length, n !== Object.keys(e).length)
|
|
399
|
+
return !1;
|
|
400
|
+
for (r = n; r-- !== 0; )
|
|
401
|
+
if (!{}.hasOwnProperty.call(e, o[r]))
|
|
402
|
+
return !1;
|
|
403
|
+
for (r = n; r-- !== 0; ) {
|
|
404
|
+
const s = o[r];
|
|
405
|
+
if (!(s === "_owner" && t.$$typeof) && !Ae(t[s], e[s]))
|
|
406
|
+
return !1;
|
|
407
|
+
}
|
|
408
|
+
return !0;
|
|
409
|
+
}
|
|
410
|
+
return t !== t && e !== e;
|
|
411
|
+
}
|
|
412
|
+
function $t(t) {
|
|
413
|
+
return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
|
|
414
|
+
}
|
|
415
|
+
function st(t, e) {
|
|
416
|
+
const n = $t(t);
|
|
417
|
+
return Math.round(e * n) / n;
|
|
418
|
+
}
|
|
419
|
+
function Ve(t) {
|
|
420
|
+
const e = l.useRef(t);
|
|
421
|
+
return Se(() => {
|
|
422
|
+
e.current = t;
|
|
423
|
+
}), e;
|
|
424
|
+
}
|
|
425
|
+
function qn(t) {
|
|
426
|
+
t === void 0 && (t = {});
|
|
427
|
+
const {
|
|
428
|
+
placement: e = "bottom",
|
|
429
|
+
strategy: n = "absolute",
|
|
430
|
+
middleware: r = [],
|
|
431
|
+
platform: o,
|
|
432
|
+
elements: {
|
|
433
|
+
reference: s,
|
|
434
|
+
floating: i
|
|
435
|
+
} = {},
|
|
436
|
+
transform: a = !0,
|
|
437
|
+
whileElementsMounted: u,
|
|
438
|
+
open: c
|
|
439
|
+
} = t, [p, g] = l.useState({
|
|
440
|
+
x: 0,
|
|
441
|
+
y: 0,
|
|
442
|
+
strategy: n,
|
|
443
|
+
placement: e,
|
|
444
|
+
middlewareData: {},
|
|
445
|
+
isPositioned: !1
|
|
446
|
+
}), [h, d] = l.useState(r);
|
|
447
|
+
Ae(h, r) || d(r);
|
|
448
|
+
const [b, f] = l.useState(null), [E, y] = l.useState(null), m = l.useCallback((x) => {
|
|
449
|
+
x !== L.current && (L.current = x, f(x));
|
|
450
|
+
}, []), R = l.useCallback((x) => {
|
|
451
|
+
x !== O.current && (O.current = x, y(x));
|
|
452
|
+
}, []), P = s || b, M = i || E, L = l.useRef(null), O = l.useRef(null), G = l.useRef(p), B = u != null, j = Ve(u), N = Ve(o), X = Ve(c), V = l.useCallback(() => {
|
|
453
|
+
if (!L.current || !O.current)
|
|
454
|
+
return;
|
|
455
|
+
const x = {
|
|
456
|
+
placement: e,
|
|
457
|
+
strategy: n,
|
|
458
|
+
middleware: h
|
|
459
|
+
};
|
|
460
|
+
N.current && (x.platform = N.current), en(L.current, O.current, x).then((w) => {
|
|
461
|
+
const k = {
|
|
462
|
+
...w,
|
|
463
|
+
// The floating element's position may be recomputed while it's closed
|
|
464
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
465
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
466
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
467
|
+
isPositioned: X.current !== !1
|
|
468
|
+
};
|
|
469
|
+
$.current && !Ae(G.current, k) && (G.current = k, Ct.flushSync(() => {
|
|
470
|
+
g(k);
|
|
471
|
+
}));
|
|
472
|
+
});
|
|
473
|
+
}, [h, e, n, N, X]);
|
|
474
|
+
Se(() => {
|
|
475
|
+
c === !1 && G.current.isPositioned && (G.current.isPositioned = !1, g((x) => ({
|
|
476
|
+
...x,
|
|
477
|
+
isPositioned: !1
|
|
478
|
+
})));
|
|
479
|
+
}, [c]);
|
|
480
|
+
const $ = l.useRef(!1);
|
|
481
|
+
Se(() => ($.current = !0, () => {
|
|
482
|
+
$.current = !1;
|
|
483
|
+
}), []), Se(() => {
|
|
484
|
+
if (P && (L.current = P), M && (O.current = M), P && M) {
|
|
485
|
+
if (j.current)
|
|
486
|
+
return j.current(P, M, V);
|
|
487
|
+
V();
|
|
488
|
+
}
|
|
489
|
+
}, [P, M, V, j, B]);
|
|
490
|
+
const v = l.useMemo(() => ({
|
|
491
|
+
reference: L,
|
|
492
|
+
floating: O,
|
|
493
|
+
setReference: m,
|
|
494
|
+
setFloating: R
|
|
495
|
+
}), [m, R]), D = l.useMemo(() => ({
|
|
496
|
+
reference: P,
|
|
497
|
+
floating: M
|
|
498
|
+
}), [P, M]), K = l.useMemo(() => {
|
|
499
|
+
const x = {
|
|
500
|
+
position: n,
|
|
501
|
+
left: 0,
|
|
502
|
+
top: 0
|
|
503
|
+
};
|
|
504
|
+
if (!D.floating)
|
|
505
|
+
return x;
|
|
506
|
+
const w = st(D.floating, p.x), k = st(D.floating, p.y);
|
|
507
|
+
return a ? {
|
|
508
|
+
...x,
|
|
509
|
+
transform: "translate(" + w + "px, " + k + "px)",
|
|
510
|
+
...$t(D.floating) >= 1.5 && {
|
|
511
|
+
willChange: "transform"
|
|
512
|
+
}
|
|
513
|
+
} : {
|
|
514
|
+
position: n,
|
|
515
|
+
left: w,
|
|
516
|
+
top: k
|
|
517
|
+
};
|
|
518
|
+
}, [n, a, D.floating, p.x, p.y]);
|
|
519
|
+
return l.useMemo(() => ({
|
|
520
|
+
...p,
|
|
521
|
+
update: V,
|
|
522
|
+
refs: v,
|
|
523
|
+
elements: D,
|
|
524
|
+
floatingStyles: K
|
|
525
|
+
}), [p, V, v, D, K]);
|
|
526
|
+
}
|
|
527
|
+
const Un = (t, e) => ({
|
|
528
|
+
...tn(t),
|
|
529
|
+
options: [t, e]
|
|
530
|
+
}), jn = (t, e) => ({
|
|
531
|
+
...nn(t),
|
|
532
|
+
options: [t, e]
|
|
533
|
+
}), Hn = (t, e) => ({
|
|
534
|
+
...Qt(t),
|
|
535
|
+
options: [t, e]
|
|
536
|
+
});
|
|
537
|
+
function Bt(t) {
|
|
538
|
+
const e = l.useRef(void 0), n = l.useCallback((r) => {
|
|
539
|
+
const o = t.map((s) => {
|
|
540
|
+
if (s != null) {
|
|
541
|
+
if (typeof s == "function") {
|
|
542
|
+
const i = s, a = i(r);
|
|
543
|
+
return typeof a == "function" ? a : () => {
|
|
544
|
+
i(null);
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
return s.current = r, () => {
|
|
548
|
+
s.current = null;
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
return () => {
|
|
553
|
+
o.forEach((s) => s == null ? void 0 : s());
|
|
554
|
+
};
|
|
555
|
+
}, t);
|
|
556
|
+
return l.useMemo(() => t.every((r) => r == null) ? null : (r) => {
|
|
557
|
+
e.current && (e.current(), e.current = void 0), r != null && (e.current = n(r));
|
|
558
|
+
}, t);
|
|
559
|
+
}
|
|
560
|
+
const Gn = "data-floating-ui-focusable", it = "active", at = "selected", Yn = {
|
|
561
|
+
...l
|
|
562
|
+
};
|
|
563
|
+
let ut = !1, Xn = 0;
|
|
564
|
+
const lt = () => (
|
|
565
|
+
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
566
|
+
// on <React 18
|
|
567
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + Xn++
|
|
568
|
+
);
|
|
569
|
+
function zn() {
|
|
570
|
+
const [t, e] = l.useState(() => ut ? lt() : void 0);
|
|
571
|
+
return Z(() => {
|
|
572
|
+
t == null && e(lt());
|
|
573
|
+
}, []), l.useEffect(() => {
|
|
574
|
+
ut = !0;
|
|
575
|
+
}, []), t;
|
|
576
|
+
}
|
|
577
|
+
const Zn = Yn.useId, Ye = Zn || zn;
|
|
578
|
+
let Ge;
|
|
579
|
+
process.env.NODE_ENV !== "production" && (Ge = /* @__PURE__ */ new Set());
|
|
580
|
+
function Jn() {
|
|
581
|
+
for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
|
|
582
|
+
n[r] = arguments[r];
|
|
583
|
+
const o = "Floating UI: " + n.join(" ");
|
|
584
|
+
if (!((t = Ge) != null && t.has(o))) {
|
|
585
|
+
var s;
|
|
586
|
+
(s = Ge) == null || s.add(o), console.error(o);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function Qn() {
|
|
590
|
+
const t = /* @__PURE__ */ new Map();
|
|
591
|
+
return {
|
|
592
|
+
emit(e, n) {
|
|
593
|
+
var r;
|
|
594
|
+
(r = t.get(e)) == null || r.forEach((o) => o(n));
|
|
595
|
+
},
|
|
596
|
+
on(e, n) {
|
|
597
|
+
t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
|
|
598
|
+
},
|
|
599
|
+
off(e, n) {
|
|
600
|
+
var r;
|
|
601
|
+
(r = t.get(e)) == null || r.delete(n);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
const er = /* @__PURE__ */ l.createContext(null), tr = /* @__PURE__ */ l.createContext(null), Vt = () => {
|
|
606
|
+
var t;
|
|
607
|
+
return ((t = l.useContext(er)) == null ? void 0 : t.id) || null;
|
|
608
|
+
}, Xe = () => l.useContext(tr);
|
|
609
|
+
function he(t) {
|
|
610
|
+
return "data-floating-ui-" + t;
|
|
611
|
+
}
|
|
612
|
+
function nr(t) {
|
|
613
|
+
t.current !== -1 && (clearTimeout(t.current), t.current = -1);
|
|
614
|
+
}
|
|
615
|
+
let ct = 0;
|
|
616
|
+
function fe(t, e) {
|
|
617
|
+
e === void 0 && (e = {});
|
|
618
|
+
const {
|
|
619
|
+
preventScroll: n = !1,
|
|
620
|
+
cancelPrevious: r = !0,
|
|
621
|
+
sync: o = !1
|
|
622
|
+
} = e;
|
|
623
|
+
r && cancelAnimationFrame(ct);
|
|
624
|
+
const s = () => t == null ? void 0 : t.focus({
|
|
625
|
+
preventScroll: n
|
|
626
|
+
});
|
|
627
|
+
o ? s() : ct = requestAnimationFrame(s);
|
|
628
|
+
}
|
|
629
|
+
function rr(t) {
|
|
630
|
+
return (t == null ? void 0 : t.ownerDocument) || document;
|
|
631
|
+
}
|
|
632
|
+
const pe = {
|
|
633
|
+
inert: /* @__PURE__ */ new WeakMap(),
|
|
634
|
+
"aria-hidden": /* @__PURE__ */ new WeakMap(),
|
|
635
|
+
none: /* @__PURE__ */ new WeakMap()
|
|
636
|
+
};
|
|
637
|
+
function ft(t) {
|
|
638
|
+
return t === "inert" ? pe.inert : t === "aria-hidden" ? pe["aria-hidden"] : pe.none;
|
|
639
|
+
}
|
|
640
|
+
let xe = /* @__PURE__ */ new WeakSet(), we = {}, Ke = 0;
|
|
641
|
+
const or = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, Kt = (t) => t && (t.host || Kt(t.parentNode)), sr = (t, e) => e.map((n) => {
|
|
642
|
+
if (t.contains(n))
|
|
643
|
+
return n;
|
|
644
|
+
const r = Kt(n);
|
|
645
|
+
return t.contains(r) ? r : null;
|
|
646
|
+
}).filter((n) => n != null);
|
|
647
|
+
function ir(t, e, n, r) {
|
|
648
|
+
const o = "data-floating-ui-inert", s = r ? "inert" : n ? "aria-hidden" : null, i = sr(e, t), a = /* @__PURE__ */ new Set(), u = new Set(i), c = [];
|
|
649
|
+
we[o] || (we[o] = /* @__PURE__ */ new WeakMap());
|
|
650
|
+
const p = we[o];
|
|
651
|
+
i.forEach(g), h(e), a.clear();
|
|
652
|
+
function g(d) {
|
|
653
|
+
!d || a.has(d) || (a.add(d), d.parentNode && g(d.parentNode));
|
|
654
|
+
}
|
|
655
|
+
function h(d) {
|
|
656
|
+
!d || u.has(d) || [].forEach.call(d.children, (b) => {
|
|
657
|
+
if (St(b) !== "script")
|
|
658
|
+
if (a.has(b))
|
|
659
|
+
h(b);
|
|
660
|
+
else {
|
|
661
|
+
const f = s ? b.getAttribute(s) : null, E = f !== null && f !== "false", y = ft(s), m = (y.get(b) || 0) + 1, R = (p.get(b) || 0) + 1;
|
|
662
|
+
y.set(b, m), p.set(b, R), c.push(b), m === 1 && E && xe.add(b), R === 1 && b.setAttribute(o, ""), !E && s && b.setAttribute(s, s === "inert" ? "" : "true");
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
return Ke++, () => {
|
|
667
|
+
c.forEach((d) => {
|
|
668
|
+
const b = ft(s), E = (b.get(d) || 0) - 1, y = (p.get(d) || 0) - 1;
|
|
669
|
+
b.set(d, E), p.set(d, y), E || (!xe.has(d) && s && d.removeAttribute(s), xe.delete(d)), y || d.removeAttribute(o);
|
|
670
|
+
}), Ke--, Ke || (pe.inert = /* @__PURE__ */ new WeakMap(), pe["aria-hidden"] = /* @__PURE__ */ new WeakMap(), pe.none = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakSet(), we = {});
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function dt(t, e, n) {
|
|
674
|
+
e === void 0 && (e = !1), n === void 0 && (n = !1);
|
|
675
|
+
const r = rr(t[0]).body;
|
|
676
|
+
return ir(t.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, e, n);
|
|
677
|
+
}
|
|
678
|
+
const Me = {
|
|
679
|
+
border: 0,
|
|
680
|
+
clip: "rect(0 0 0 0)",
|
|
681
|
+
height: "1px",
|
|
682
|
+
margin: "-1px",
|
|
683
|
+
overflow: "hidden",
|
|
684
|
+
padding: 0,
|
|
685
|
+
position: "fixed",
|
|
686
|
+
whiteSpace: "nowrap",
|
|
687
|
+
width: "1px",
|
|
688
|
+
top: 0,
|
|
689
|
+
left: 0
|
|
690
|
+
}, De = /* @__PURE__ */ l.forwardRef(function(e, n) {
|
|
691
|
+
const [r, o] = l.useState();
|
|
692
|
+
Z(() => {
|
|
693
|
+
Pn() && o("button");
|
|
694
|
+
}, []);
|
|
695
|
+
const s = {
|
|
696
|
+
ref: n,
|
|
697
|
+
tabIndex: 0,
|
|
698
|
+
// Role is only for VoiceOver
|
|
699
|
+
role: r,
|
|
700
|
+
"aria-hidden": r ? void 0 : !0,
|
|
701
|
+
[he("focus-guard")]: "",
|
|
702
|
+
style: Me
|
|
703
|
+
};
|
|
704
|
+
return /* @__PURE__ */ J("span", {
|
|
705
|
+
...e,
|
|
706
|
+
...s
|
|
707
|
+
});
|
|
708
|
+
}), Wt = /* @__PURE__ */ l.createContext(null), pt = /* @__PURE__ */ he("portal");
|
|
709
|
+
function ar(t) {
|
|
710
|
+
t === void 0 && (t = {});
|
|
711
|
+
const {
|
|
712
|
+
id: e,
|
|
713
|
+
root: n
|
|
714
|
+
} = t, r = Ye(), o = qt(), [s, i] = l.useState(null), a = l.useRef(null);
|
|
715
|
+
return Z(() => () => {
|
|
716
|
+
s == null || s.remove(), queueMicrotask(() => {
|
|
717
|
+
a.current = null;
|
|
718
|
+
});
|
|
719
|
+
}, [s]), Z(() => {
|
|
720
|
+
if (!r || a.current) return;
|
|
721
|
+
const u = e ? document.getElementById(e) : null;
|
|
722
|
+
if (!u) return;
|
|
723
|
+
const c = document.createElement("div");
|
|
724
|
+
c.id = r, c.setAttribute(pt, ""), u.appendChild(c), a.current = c, i(c);
|
|
725
|
+
}, [e, r]), Z(() => {
|
|
726
|
+
if (n === null || !r || a.current) return;
|
|
727
|
+
let u = n || (o == null ? void 0 : o.portalNode);
|
|
728
|
+
u && !z(u) && (u = u.current), u = u || document.body;
|
|
729
|
+
let c = null;
|
|
730
|
+
e && (c = document.createElement("div"), c.id = e, u.appendChild(c));
|
|
731
|
+
const p = document.createElement("div");
|
|
732
|
+
p.id = r, p.setAttribute(pt, ""), u = c || u, u.appendChild(p), a.current = p, i(p);
|
|
733
|
+
}, [e, n, r, o]), s;
|
|
734
|
+
}
|
|
735
|
+
function ur(t) {
|
|
736
|
+
const {
|
|
737
|
+
children: e,
|
|
738
|
+
id: n,
|
|
739
|
+
root: r,
|
|
740
|
+
preserveTabOrder: o = !0
|
|
741
|
+
} = t, s = ar({
|
|
742
|
+
id: n,
|
|
743
|
+
root: r
|
|
744
|
+
}), [i, a] = l.useState(null), u = l.useRef(null), c = l.useRef(null), p = l.useRef(null), g = l.useRef(null), h = i == null ? void 0 : i.modal, d = i == null ? void 0 : i.open, b = (
|
|
745
|
+
// The FocusManager and therefore floating element are currently open/
|
|
746
|
+
// rendered.
|
|
747
|
+
!!i && // Guards are only for non-modal focus management.
|
|
748
|
+
!i.modal && // Don't render if unmount is transitioning.
|
|
749
|
+
i.open && o && !!(r || s)
|
|
750
|
+
);
|
|
751
|
+
return l.useEffect(() => {
|
|
752
|
+
if (!s || !o || h)
|
|
753
|
+
return;
|
|
754
|
+
function f(E) {
|
|
755
|
+
s && be(E) && (E.type === "focusin" ? ot : Vn)(s);
|
|
756
|
+
}
|
|
757
|
+
return s.addEventListener("focusin", f, !0), s.addEventListener("focusout", f, !0), () => {
|
|
758
|
+
s.removeEventListener("focusin", f, !0), s.removeEventListener("focusout", f, !0);
|
|
759
|
+
};
|
|
760
|
+
}, [s, o, h]), l.useEffect(() => {
|
|
761
|
+
s && (d || ot(s));
|
|
762
|
+
}, [d, s]), /* @__PURE__ */ Et(Wt.Provider, {
|
|
763
|
+
value: l.useMemo(() => ({
|
|
764
|
+
preserveTabOrder: o,
|
|
765
|
+
beforeOutsideRef: u,
|
|
766
|
+
afterOutsideRef: c,
|
|
767
|
+
beforeInsideRef: p,
|
|
768
|
+
afterInsideRef: g,
|
|
769
|
+
portalNode: s,
|
|
770
|
+
setFocusManagerState: a
|
|
771
|
+
}), [o, s]),
|
|
772
|
+
children: [b && s && /* @__PURE__ */ J(De, {
|
|
773
|
+
"data-type": "outside",
|
|
774
|
+
ref: u,
|
|
775
|
+
onFocus: (f) => {
|
|
776
|
+
if (be(f, s)) {
|
|
777
|
+
var E;
|
|
778
|
+
(E = p.current) == null || E.focus();
|
|
779
|
+
} else {
|
|
780
|
+
const y = i ? i.domReference : null, m = _t(y);
|
|
781
|
+
m == null || m.focus();
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}), b && s && /* @__PURE__ */ J("span", {
|
|
785
|
+
"aria-owns": s.id,
|
|
786
|
+
style: Me
|
|
787
|
+
}), s && /* @__PURE__ */ Ct.createPortal(e, s), b && s && /* @__PURE__ */ J(De, {
|
|
788
|
+
"data-type": "outside",
|
|
789
|
+
ref: c,
|
|
790
|
+
onFocus: (f) => {
|
|
791
|
+
if (be(f, s)) {
|
|
792
|
+
var E;
|
|
793
|
+
(E = g.current) == null || E.focus();
|
|
794
|
+
} else {
|
|
795
|
+
const y = i ? i.domReference : null, m = Lt(y);
|
|
796
|
+
m == null || m.focus(), i != null && i.closeOnFocusOut && (i == null || i.onOpenChange(!1, f.nativeEvent, "focus-out"));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
})]
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
const qt = () => l.useContext(Wt);
|
|
803
|
+
function vt(t) {
|
|
804
|
+
return l.useMemo(() => (e) => {
|
|
805
|
+
t.forEach((n) => {
|
|
806
|
+
n && (n.current = e);
|
|
807
|
+
});
|
|
808
|
+
}, t);
|
|
809
|
+
}
|
|
810
|
+
const lr = 20;
|
|
811
|
+
let ce = [];
|
|
812
|
+
function cr(t) {
|
|
813
|
+
ce = ce.filter((e) => e.isConnected), t && St(t) !== "body" && (ce.push(t), ce.length > lr && (ce = ce.slice(-20)));
|
|
814
|
+
}
|
|
815
|
+
function mt() {
|
|
816
|
+
return ce.slice().reverse().find((t) => t.isConnected);
|
|
817
|
+
}
|
|
818
|
+
function fr(t) {
|
|
819
|
+
const e = Re();
|
|
820
|
+
return kt(t, e) ? t : ke(t, e)[0] || t;
|
|
821
|
+
}
|
|
822
|
+
function gt(t, e) {
|
|
823
|
+
var n;
|
|
824
|
+
if (!e.current.includes("floating") && !((n = t.getAttribute("role")) != null && n.includes("dialog")))
|
|
825
|
+
return;
|
|
826
|
+
const r = Re(), s = Tn(t, r).filter((a) => {
|
|
827
|
+
const u = a.getAttribute("data-tabindex") || "";
|
|
828
|
+
return kt(a, r) || a.hasAttribute("data-tabindex") && !u.startsWith("-");
|
|
829
|
+
}), i = t.getAttribute("tabindex");
|
|
830
|
+
e.current.includes("floating") || s.length === 0 ? i !== "0" && t.setAttribute("tabindex", "0") : (i !== "-1" || t.hasAttribute("data-tabindex") && t.getAttribute("data-tabindex") !== "-1") && (t.setAttribute("tabindex", "-1"), t.setAttribute("data-tabindex", "-1"));
|
|
831
|
+
}
|
|
832
|
+
const dr = /* @__PURE__ */ l.forwardRef(function(e, n) {
|
|
833
|
+
return /* @__PURE__ */ J("button", {
|
|
834
|
+
...e,
|
|
835
|
+
type: "button",
|
|
836
|
+
ref: n,
|
|
837
|
+
tabIndex: -1,
|
|
838
|
+
style: Me
|
|
839
|
+
});
|
|
840
|
+
});
|
|
841
|
+
function pr(t) {
|
|
842
|
+
const {
|
|
843
|
+
context: e,
|
|
844
|
+
children: n,
|
|
845
|
+
disabled: r = !1,
|
|
846
|
+
order: o = ["content"],
|
|
847
|
+
guards: s = !0,
|
|
848
|
+
initialFocus: i = 0,
|
|
849
|
+
returnFocus: a = !0,
|
|
850
|
+
restoreFocus: u = !1,
|
|
851
|
+
modal: c = !0,
|
|
852
|
+
visuallyHiddenDismiss: p = !1,
|
|
853
|
+
closeOnFocusOut: g = !0,
|
|
854
|
+
outsideElementsInert: h = !1,
|
|
855
|
+
getInsideElements: d = () => []
|
|
856
|
+
} = t, {
|
|
857
|
+
open: b,
|
|
858
|
+
onOpenChange: f,
|
|
859
|
+
events: E,
|
|
860
|
+
dataRef: y,
|
|
861
|
+
elements: {
|
|
862
|
+
domReference: m,
|
|
863
|
+
floating: R
|
|
864
|
+
}
|
|
865
|
+
} = e, P = re(() => {
|
|
866
|
+
var C;
|
|
867
|
+
return (C = y.current.floatingContext) == null ? void 0 : C.nodeId;
|
|
868
|
+
}), M = re(d), L = typeof i == "number" && i < 0, O = tt(m) && L, G = or(), B = G ? s : !0, j = !B || G && h, N = Be(o), X = Be(i), V = Be(a), $ = Xe(), v = qt(), D = l.useRef(null), K = l.useRef(null), x = l.useRef(!1), w = l.useRef(!1), k = l.useRef(-1), W = v != null, S = He(R), te = re(function(C) {
|
|
869
|
+
return C === void 0 && (C = S), C ? ke(C, Re()) : [];
|
|
870
|
+
}), ie = re((C) => {
|
|
871
|
+
const A = te(C);
|
|
872
|
+
return N.current.map((T) => m && T === "reference" ? m : S && T === "floating" ? S : A).filter(Boolean).flat();
|
|
873
|
+
});
|
|
874
|
+
l.useEffect(() => {
|
|
875
|
+
if (r || !c) return;
|
|
876
|
+
function C(T) {
|
|
877
|
+
if (T.key === "Tab") {
|
|
878
|
+
Y(S, de(ee(S))) && te().length === 0 && !O && $e(T);
|
|
879
|
+
const I = ie(), q = ue(T);
|
|
880
|
+
N.current[0] === "reference" && q === m && ($e(T), T.shiftKey ? fe(I[I.length - 1]) : fe(I[1])), N.current[1] === "floating" && q === S && T.shiftKey && ($e(T), fe(I[0]));
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const A = ee(S);
|
|
884
|
+
return A.addEventListener("keydown", C), () => {
|
|
885
|
+
A.removeEventListener("keydown", C);
|
|
886
|
+
};
|
|
887
|
+
}, [r, m, S, c, N, O, te, ie]), l.useEffect(() => {
|
|
888
|
+
if (r || !R) return;
|
|
889
|
+
function C(A) {
|
|
890
|
+
const T = ue(A), q = te().indexOf(T);
|
|
891
|
+
q !== -1 && (k.current = q);
|
|
892
|
+
}
|
|
893
|
+
return R.addEventListener("focusin", C), () => {
|
|
894
|
+
R.removeEventListener("focusin", C);
|
|
895
|
+
};
|
|
896
|
+
}, [r, R, te]), l.useEffect(() => {
|
|
897
|
+
if (r || !g) return;
|
|
898
|
+
function C() {
|
|
899
|
+
w.current = !0, setTimeout(() => {
|
|
900
|
+
w.current = !1;
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
function A(T) {
|
|
904
|
+
const I = T.relatedTarget, q = T.currentTarget, U = ue(T);
|
|
905
|
+
queueMicrotask(() => {
|
|
906
|
+
const ne = P(), oe = !(Y(m, I) || Y(R, I) || Y(I, R) || Y(v == null ? void 0 : v.portalNode, I) || I != null && I.hasAttribute(he("focus-guard")) || $ && (ge($.nodesRef.current, ne).find((F) => {
|
|
907
|
+
var _, ae;
|
|
908
|
+
return Y((_ = F.context) == null ? void 0 : _.elements.floating, I) || Y((ae = F.context) == null ? void 0 : ae.elements.domReference, I);
|
|
909
|
+
}) || nt($.nodesRef.current, ne).find((F) => {
|
|
910
|
+
var _, ae, Ze;
|
|
911
|
+
return [(_ = F.context) == null ? void 0 : _.elements.floating, He((ae = F.context) == null ? void 0 : ae.elements.floating)].includes(I) || ((Ze = F.context) == null ? void 0 : Ze.elements.domReference) === I;
|
|
912
|
+
})));
|
|
913
|
+
if (q === m && S && gt(S, N), u && q !== m && !(U != null && U.isConnected) && de(ee(S)) === ee(S).body) {
|
|
914
|
+
se(S) && S.focus();
|
|
915
|
+
const F = k.current, _ = te(), ae = _[F] || _[_.length - 1] || S;
|
|
916
|
+
se(ae) && ae.focus();
|
|
917
|
+
}
|
|
918
|
+
if (y.current.insideReactTree) {
|
|
919
|
+
y.current.insideReactTree = !1;
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
(O || !c) && I && oe && !w.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
923
|
+
I !== mt() && (x.current = !0, f(!1, T, "focus-out"));
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
if (R && se(m))
|
|
927
|
+
return m.addEventListener("focusout", A), m.addEventListener("pointerdown", C), R.addEventListener("focusout", A), () => {
|
|
928
|
+
m.removeEventListener("focusout", A), m.removeEventListener("pointerdown", C), R.removeEventListener("focusout", A);
|
|
929
|
+
};
|
|
930
|
+
}, [r, m, R, S, c, $, v, f, g, u, te, O, P, N, y]);
|
|
931
|
+
const me = l.useRef(null), H = l.useRef(null), Q = vt([me, v == null ? void 0 : v.beforeInsideRef]), le = vt([H, v == null ? void 0 : v.afterInsideRef]);
|
|
932
|
+
l.useEffect(() => {
|
|
933
|
+
var C, A;
|
|
934
|
+
if (r || !R) return;
|
|
935
|
+
const T = Array.from((v == null || (C = v.portalNode) == null ? void 0 : C.querySelectorAll("[" + he("portal") + "]")) || []), I = $ ? nt($.nodesRef.current, P()) : [], q = $ && !c ? I.map((F) => {
|
|
936
|
+
var _;
|
|
937
|
+
return (_ = F.context) == null ? void 0 : _.elements.floating;
|
|
938
|
+
}) : [], U = (A = I.find((F) => {
|
|
939
|
+
var _;
|
|
940
|
+
return tt(((_ = F.context) == null ? void 0 : _.elements.domReference) || null);
|
|
941
|
+
})) == null || (A = A.context) == null ? void 0 : A.elements.domReference, ne = [R, U, ...T, ...q, ...M(), D.current, K.current, me.current, H.current, v == null ? void 0 : v.beforeOutsideRef.current, v == null ? void 0 : v.afterOutsideRef.current, N.current.includes("reference") || O ? m : null].filter((F) => F != null), oe = c || O ? dt(ne, !j, j) : dt(ne);
|
|
942
|
+
return () => {
|
|
943
|
+
oe();
|
|
944
|
+
};
|
|
945
|
+
}, [r, m, R, c, N, v, O, B, j, $, P, M]), Z(() => {
|
|
946
|
+
if (r || !se(S)) return;
|
|
947
|
+
const C = ee(S), A = de(C);
|
|
948
|
+
queueMicrotask(() => {
|
|
949
|
+
const T = ie(S), I = X.current, q = (typeof I == "number" ? T[I] : I.current) || S, U = Y(S, A);
|
|
950
|
+
!L && !U && b && fe(q, {
|
|
951
|
+
preventScroll: q === S
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
}, [r, b, S, L, ie, X]), Z(() => {
|
|
955
|
+
if (r || !S) return;
|
|
956
|
+
const C = ee(S), A = de(C);
|
|
957
|
+
cr(A);
|
|
958
|
+
function T(U) {
|
|
959
|
+
let {
|
|
960
|
+
reason: ne,
|
|
961
|
+
event: oe,
|
|
962
|
+
nested: F
|
|
963
|
+
} = U;
|
|
964
|
+
if (["hover", "safe-polygon"].includes(ne) && oe.type === "mouseleave" && (x.current = !0), ne === "outside-press")
|
|
965
|
+
if (F)
|
|
966
|
+
x.current = !1;
|
|
967
|
+
else if (Mn(oe) || Nn(oe))
|
|
968
|
+
x.current = !1;
|
|
969
|
+
else {
|
|
970
|
+
let _ = !1;
|
|
971
|
+
document.createElement("div").focus({
|
|
972
|
+
get preventScroll() {
|
|
973
|
+
return _ = !0, !1;
|
|
974
|
+
}
|
|
975
|
+
}), _ ? x.current = !1 : x.current = !0;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
E.on("openchange", T);
|
|
979
|
+
const I = C.createElement("span");
|
|
980
|
+
I.setAttribute("tabindex", "-1"), I.setAttribute("aria-hidden", "true"), Object.assign(I.style, Me), W && m && m.insertAdjacentElement("afterend", I);
|
|
981
|
+
function q() {
|
|
982
|
+
if (typeof V.current == "boolean") {
|
|
983
|
+
const U = m || mt();
|
|
984
|
+
return U && U.isConnected ? U : I;
|
|
985
|
+
}
|
|
986
|
+
return V.current.current || I;
|
|
987
|
+
}
|
|
988
|
+
return () => {
|
|
989
|
+
E.off("openchange", T);
|
|
990
|
+
const U = de(C), ne = Y(R, U) || $ && ge($.nodesRef.current, P()).some((F) => {
|
|
991
|
+
var _;
|
|
992
|
+
return Y((_ = F.context) == null ? void 0 : _.elements.floating, U);
|
|
993
|
+
}), oe = q();
|
|
994
|
+
queueMicrotask(() => {
|
|
995
|
+
const F = fr(oe);
|
|
996
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
997
|
+
V.current && !x.current && se(F) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
998
|
+
// since it likely entered a different element which should be
|
|
999
|
+
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
1000
|
+
(!(F !== U && U !== C.body) || ne) && F.focus({
|
|
1001
|
+
preventScroll: !0
|
|
1002
|
+
}), I.remove();
|
|
1003
|
+
});
|
|
1004
|
+
};
|
|
1005
|
+
}, [r, R, S, V, y, E, $, W, m, P]), l.useEffect(() => {
|
|
1006
|
+
queueMicrotask(() => {
|
|
1007
|
+
x.current = !1;
|
|
1008
|
+
});
|
|
1009
|
+
}, [r]), Z(() => {
|
|
1010
|
+
if (!r && v)
|
|
1011
|
+
return v.setFocusManagerState({
|
|
1012
|
+
modal: c,
|
|
1013
|
+
closeOnFocusOut: g,
|
|
1014
|
+
open: b,
|
|
1015
|
+
onOpenChange: f,
|
|
1016
|
+
domReference: m
|
|
1017
|
+
}), () => {
|
|
1018
|
+
v.setFocusManagerState(null);
|
|
1019
|
+
};
|
|
1020
|
+
}, [r, v, c, b, f, g, m]), Z(() => {
|
|
1021
|
+
r || S && gt(S, N);
|
|
1022
|
+
}, [r, S, N]);
|
|
1023
|
+
function Ee(C) {
|
|
1024
|
+
return r || !p || !c ? null : /* @__PURE__ */ J(dr, {
|
|
1025
|
+
ref: C === "start" ? D : K,
|
|
1026
|
+
onClick: (A) => f(!1, A.nativeEvent),
|
|
1027
|
+
children: typeof p == "string" ? p : "Dismiss"
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
const ye = !r && B && (c ? !O : !0) && (W || c);
|
|
1031
|
+
return /* @__PURE__ */ Et(Gt, {
|
|
1032
|
+
children: [ye && /* @__PURE__ */ J(De, {
|
|
1033
|
+
"data-type": "inside",
|
|
1034
|
+
ref: Q,
|
|
1035
|
+
onFocus: (C) => {
|
|
1036
|
+
if (c) {
|
|
1037
|
+
const T = ie();
|
|
1038
|
+
fe(o[0] === "reference" ? T[0] : T[T.length - 1]);
|
|
1039
|
+
} else if (v != null && v.preserveTabOrder && v.portalNode)
|
|
1040
|
+
if (x.current = !1, be(C, v.portalNode)) {
|
|
1041
|
+
const T = Lt(m);
|
|
1042
|
+
T == null || T.focus();
|
|
1043
|
+
} else {
|
|
1044
|
+
var A;
|
|
1045
|
+
(A = v.beforeOutsideRef.current) == null || A.focus();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}), !O && Ee("start"), n, Ee("end"), ye && /* @__PURE__ */ J(De, {
|
|
1049
|
+
"data-type": "inside",
|
|
1050
|
+
ref: le,
|
|
1051
|
+
onFocus: (C) => {
|
|
1052
|
+
if (c)
|
|
1053
|
+
fe(ie()[0]);
|
|
1054
|
+
else if (v != null && v.preserveTabOrder && v.portalNode)
|
|
1055
|
+
if (g && (x.current = !0), be(C, v.portalNode)) {
|
|
1056
|
+
const T = _t(m);
|
|
1057
|
+
T == null || T.focus();
|
|
1058
|
+
} else {
|
|
1059
|
+
var A;
|
|
1060
|
+
(A = v.afterOutsideRef.current) == null || A.focus();
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
})]
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function bt(t) {
|
|
1067
|
+
return se(t.target) && t.target.tagName === "BUTTON";
|
|
1068
|
+
}
|
|
1069
|
+
function vr(t) {
|
|
1070
|
+
return se(t.target) && t.target.tagName === "A";
|
|
1071
|
+
}
|
|
1072
|
+
function ht(t) {
|
|
1073
|
+
return Nt(t);
|
|
1074
|
+
}
|
|
1075
|
+
function mr(t, e) {
|
|
1076
|
+
e === void 0 && (e = {});
|
|
1077
|
+
const {
|
|
1078
|
+
open: n,
|
|
1079
|
+
onOpenChange: r,
|
|
1080
|
+
dataRef: o,
|
|
1081
|
+
elements: {
|
|
1082
|
+
domReference: s
|
|
1083
|
+
}
|
|
1084
|
+
} = t, {
|
|
1085
|
+
enabled: i = !0,
|
|
1086
|
+
event: a = "click",
|
|
1087
|
+
toggle: u = !0,
|
|
1088
|
+
ignoreMouse: c = !1,
|
|
1089
|
+
keyboardHandlers: p = !0,
|
|
1090
|
+
stickIfOpen: g = !0
|
|
1091
|
+
} = e, h = l.useRef(), d = l.useRef(!1), b = l.useMemo(() => ({
|
|
1092
|
+
onPointerDown(f) {
|
|
1093
|
+
h.current = f.pointerType;
|
|
1094
|
+
},
|
|
1095
|
+
onMouseDown(f) {
|
|
1096
|
+
const E = h.current;
|
|
1097
|
+
f.button === 0 && a !== "click" && (rt(E) && c || (n && u && (!(o.current.openEvent && g) || o.current.openEvent.type === "mousedown") ? r(!1, f.nativeEvent, "click") : (f.preventDefault(), r(!0, f.nativeEvent, "click"))));
|
|
1098
|
+
},
|
|
1099
|
+
onClick(f) {
|
|
1100
|
+
const E = h.current;
|
|
1101
|
+
if (a === "mousedown" && h.current) {
|
|
1102
|
+
h.current = void 0;
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
rt(E) && c || (n && u && (!(o.current.openEvent && g) || o.current.openEvent.type === "click") ? r(!1, f.nativeEvent, "click") : r(!0, f.nativeEvent, "click"));
|
|
1106
|
+
},
|
|
1107
|
+
onKeyDown(f) {
|
|
1108
|
+
h.current = void 0, !(f.defaultPrevented || !p || bt(f)) && (f.key === " " && !ht(s) && (f.preventDefault(), d.current = !0), !vr(f) && f.key === "Enter" && r(!(n && u), f.nativeEvent, "click"));
|
|
1109
|
+
},
|
|
1110
|
+
onKeyUp(f) {
|
|
1111
|
+
f.defaultPrevented || !p || bt(f) || ht(s) || f.key === " " && d.current && (d.current = !1, r(!(n && u), f.nativeEvent, "click"));
|
|
1112
|
+
}
|
|
1113
|
+
}), [o, s, a, c, p, r, n, g, u]);
|
|
1114
|
+
return l.useMemo(() => i ? {
|
|
1115
|
+
reference: b
|
|
1116
|
+
} : {}, [i, b]);
|
|
1117
|
+
}
|
|
1118
|
+
const gr = {
|
|
1119
|
+
pointerdown: "onPointerDown",
|
|
1120
|
+
mousedown: "onMouseDown",
|
|
1121
|
+
click: "onClick"
|
|
1122
|
+
}, br = {
|
|
1123
|
+
pointerdown: "onPointerDownCapture",
|
|
1124
|
+
mousedown: "onMouseDownCapture",
|
|
1125
|
+
click: "onClickCapture"
|
|
1126
|
+
}, Rt = (t) => {
|
|
1127
|
+
var e, n;
|
|
1128
|
+
return {
|
|
1129
|
+
escapeKey: typeof t == "boolean" ? t : (e = t == null ? void 0 : t.escapeKey) != null ? e : !1,
|
|
1130
|
+
outsidePress: typeof t == "boolean" ? t : (n = t == null ? void 0 : t.outsidePress) != null ? n : !0
|
|
1131
|
+
};
|
|
1132
|
+
};
|
|
1133
|
+
function hr(t, e) {
|
|
1134
|
+
e === void 0 && (e = {});
|
|
1135
|
+
const {
|
|
1136
|
+
open: n,
|
|
1137
|
+
onOpenChange: r,
|
|
1138
|
+
elements: o,
|
|
1139
|
+
dataRef: s
|
|
1140
|
+
} = t, {
|
|
1141
|
+
enabled: i = !0,
|
|
1142
|
+
escapeKey: a = !0,
|
|
1143
|
+
outsidePress: u = !0,
|
|
1144
|
+
outsidePressEvent: c = "pointerdown",
|
|
1145
|
+
referencePress: p = !1,
|
|
1146
|
+
referencePressEvent: g = "pointerdown",
|
|
1147
|
+
ancestorScroll: h = !1,
|
|
1148
|
+
bubbles: d,
|
|
1149
|
+
capture: b
|
|
1150
|
+
} = e, f = Xe(), E = re(typeof u == "function" ? u : () => !1), y = typeof u == "function" ? E : u, m = l.useRef(!1), {
|
|
1151
|
+
escapeKey: R,
|
|
1152
|
+
outsidePress: P
|
|
1153
|
+
} = Rt(d), {
|
|
1154
|
+
escapeKey: M,
|
|
1155
|
+
outsidePress: L
|
|
1156
|
+
} = Rt(b), O = l.useRef(!1), G = l.useRef(-1), B = re((v) => {
|
|
1157
|
+
var D;
|
|
1158
|
+
if (!n || !i || !a || v.key !== "Escape" || O.current)
|
|
1159
|
+
return;
|
|
1160
|
+
const K = (D = s.current.floatingContext) == null ? void 0 : D.nodeId, x = f ? ge(f.nodesRef.current, K) : [];
|
|
1161
|
+
if (!R && (v.stopPropagation(), x.length > 0)) {
|
|
1162
|
+
let w = !0;
|
|
1163
|
+
if (x.forEach((k) => {
|
|
1164
|
+
var W;
|
|
1165
|
+
if ((W = k.context) != null && W.open && !k.context.dataRef.current.__escapeKeyBubbles) {
|
|
1166
|
+
w = !1;
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
}), !w)
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
r(!1, kn(v) ? v.nativeEvent : v, "escape-key");
|
|
1173
|
+
}), j = re((v) => {
|
|
1174
|
+
var D;
|
|
1175
|
+
const K = () => {
|
|
1176
|
+
var x;
|
|
1177
|
+
B(v), (x = ue(v)) == null || x.removeEventListener("keydown", K);
|
|
1178
|
+
};
|
|
1179
|
+
(D = ue(v)) == null || D.addEventListener("keydown", K);
|
|
1180
|
+
}), N = re((v) => {
|
|
1181
|
+
var D;
|
|
1182
|
+
const K = s.current.insideReactTree;
|
|
1183
|
+
s.current.insideReactTree = !1;
|
|
1184
|
+
const x = m.current;
|
|
1185
|
+
if (m.current = !1, c === "click" && x || K || typeof y == "function" && !y(v))
|
|
1186
|
+
return;
|
|
1187
|
+
const w = ue(v), k = "[" + he("inert") + "]", W = ee(o.floating).querySelectorAll(k);
|
|
1188
|
+
let S = z(w) ? w : null;
|
|
1189
|
+
for (; S && !Fe(S); ) {
|
|
1190
|
+
const H = rn(S);
|
|
1191
|
+
if (Fe(H) || !z(H))
|
|
1192
|
+
break;
|
|
1193
|
+
S = H;
|
|
1194
|
+
}
|
|
1195
|
+
if (W.length && z(w) && !On(w) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
1196
|
+
!Y(w, o.floating) && // If the target root element contains none of the markers, then the
|
|
1197
|
+
// element was injected after the floating element rendered.
|
|
1198
|
+
Array.from(W).every((H) => !Y(S, H)))
|
|
1199
|
+
return;
|
|
1200
|
+
if (se(w) && $) {
|
|
1201
|
+
const H = Fe(w), Q = on(w), le = /auto|scroll/, Ee = H || le.test(Q.overflowX), ye = H || le.test(Q.overflowY), C = Ee && w.clientWidth > 0 && w.scrollWidth > w.clientWidth, A = ye && w.clientHeight > 0 && w.scrollHeight > w.clientHeight, T = Q.direction === "rtl", I = A && (T ? v.offsetX <= w.offsetWidth - w.clientWidth : v.offsetX > w.clientWidth), q = C && v.offsetY > w.clientHeight;
|
|
1202
|
+
if (I || q)
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
const te = (D = s.current.floatingContext) == null ? void 0 : D.nodeId, ie = f && ge(f.nodesRef.current, te).some((H) => {
|
|
1206
|
+
var Q;
|
|
1207
|
+
return _e(v, (Q = H.context) == null ? void 0 : Q.elements.floating);
|
|
1208
|
+
});
|
|
1209
|
+
if (_e(v, o.floating) || _e(v, o.domReference) || ie)
|
|
1210
|
+
return;
|
|
1211
|
+
const me = f ? ge(f.nodesRef.current, te) : [];
|
|
1212
|
+
if (me.length > 0) {
|
|
1213
|
+
let H = !0;
|
|
1214
|
+
if (me.forEach((Q) => {
|
|
1215
|
+
var le;
|
|
1216
|
+
if ((le = Q.context) != null && le.open && !Q.context.dataRef.current.__outsidePressBubbles) {
|
|
1217
|
+
H = !1;
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
}), !H)
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
r(!1, v, "outside-press");
|
|
1224
|
+
}), X = re((v) => {
|
|
1225
|
+
var D;
|
|
1226
|
+
const K = () => {
|
|
1227
|
+
var x;
|
|
1228
|
+
N(v), (x = ue(v)) == null || x.removeEventListener(c, K);
|
|
1229
|
+
};
|
|
1230
|
+
(D = ue(v)) == null || D.addEventListener(c, K);
|
|
1231
|
+
});
|
|
1232
|
+
l.useEffect(() => {
|
|
1233
|
+
if (!n || !i)
|
|
1234
|
+
return;
|
|
1235
|
+
s.current.__escapeKeyBubbles = R, s.current.__outsidePressBubbles = P;
|
|
1236
|
+
let v = -1;
|
|
1237
|
+
function D(W) {
|
|
1238
|
+
r(!1, W, "ancestor-scroll");
|
|
1239
|
+
}
|
|
1240
|
+
function K() {
|
|
1241
|
+
window.clearTimeout(v), O.current = !0;
|
|
1242
|
+
}
|
|
1243
|
+
function x() {
|
|
1244
|
+
v = window.setTimeout(
|
|
1245
|
+
() => {
|
|
1246
|
+
O.current = !1;
|
|
1247
|
+
},
|
|
1248
|
+
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
1249
|
+
// Only apply to WebKit for the test to remain 0ms.
|
|
1250
|
+
sn() ? 5 : 0
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
const w = ee(o.floating);
|
|
1254
|
+
a && (w.addEventListener("keydown", M ? j : B, M), w.addEventListener("compositionstart", K), w.addEventListener("compositionend", x)), y && w.addEventListener(c, L ? X : N, L);
|
|
1255
|
+
let k = [];
|
|
1256
|
+
return h && (z(o.domReference) && (k = Le(o.domReference)), z(o.floating) && (k = k.concat(Le(o.floating))), !z(o.reference) && o.reference && o.reference.contextElement && (k = k.concat(Le(o.reference.contextElement)))), k = k.filter((W) => {
|
|
1257
|
+
var S;
|
|
1258
|
+
return W !== ((S = w.defaultView) == null ? void 0 : S.visualViewport);
|
|
1259
|
+
}), k.forEach((W) => {
|
|
1260
|
+
W.addEventListener("scroll", D, {
|
|
1261
|
+
passive: !0
|
|
1262
|
+
});
|
|
1263
|
+
}), () => {
|
|
1264
|
+
a && (w.removeEventListener("keydown", M ? j : B, M), w.removeEventListener("compositionstart", K), w.removeEventListener("compositionend", x)), y && w.removeEventListener(c, L ? X : N, L), k.forEach((W) => {
|
|
1265
|
+
W.removeEventListener("scroll", D);
|
|
1266
|
+
}), window.clearTimeout(v);
|
|
1267
|
+
};
|
|
1268
|
+
}, [s, o, a, y, c, n, r, h, i, R, P, B, M, j, N, L, X]), l.useEffect(() => {
|
|
1269
|
+
s.current.insideReactTree = !1;
|
|
1270
|
+
}, [s, y, c]);
|
|
1271
|
+
const V = l.useMemo(() => ({
|
|
1272
|
+
onKeyDown: B,
|
|
1273
|
+
...p && {
|
|
1274
|
+
[gr[g]]: (v) => {
|
|
1275
|
+
r(!1, v.nativeEvent, "reference-press");
|
|
1276
|
+
},
|
|
1277
|
+
...g !== "click" && {
|
|
1278
|
+
onClick(v) {
|
|
1279
|
+
r(!1, v.nativeEvent, "reference-press");
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}), [B, r, p, g]), $ = l.useMemo(() => ({
|
|
1284
|
+
onKeyDown: B,
|
|
1285
|
+
onMouseDown() {
|
|
1286
|
+
m.current = !0;
|
|
1287
|
+
},
|
|
1288
|
+
onMouseUp() {
|
|
1289
|
+
m.current = !0;
|
|
1290
|
+
},
|
|
1291
|
+
[br[c]]: () => {
|
|
1292
|
+
s.current.insideReactTree = !0;
|
|
1293
|
+
},
|
|
1294
|
+
onBlurCapture() {
|
|
1295
|
+
f || (nr(G), s.current.insideReactTree = !0, G.current = window.setTimeout(() => {
|
|
1296
|
+
s.current.insideReactTree = !1;
|
|
1297
|
+
}));
|
|
1298
|
+
}
|
|
1299
|
+
}), [B, c, s, f]);
|
|
1300
|
+
return l.useMemo(() => i ? {
|
|
1301
|
+
reference: V,
|
|
1302
|
+
floating: $
|
|
1303
|
+
} : {}, [i, V, $]);
|
|
1304
|
+
}
|
|
1305
|
+
function Rr(t) {
|
|
1306
|
+
const {
|
|
1307
|
+
open: e = !1,
|
|
1308
|
+
onOpenChange: n,
|
|
1309
|
+
elements: r
|
|
1310
|
+
} = t, o = Ye(), s = l.useRef({}), [i] = l.useState(() => Qn()), a = Vt() != null;
|
|
1311
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1312
|
+
const d = r.reference;
|
|
1313
|
+
d && !z(d) && Jn("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
1314
|
+
}
|
|
1315
|
+
const [u, c] = l.useState(r.reference), p = re((d, b, f) => {
|
|
1316
|
+
s.current.openEvent = d ? b : void 0, i.emit("openchange", {
|
|
1317
|
+
open: d,
|
|
1318
|
+
event: b,
|
|
1319
|
+
reason: f,
|
|
1320
|
+
nested: a
|
|
1321
|
+
}), n == null || n(d, b, f);
|
|
1322
|
+
}), g = l.useMemo(() => ({
|
|
1323
|
+
setPositionReference: c
|
|
1324
|
+
}), []), h = l.useMemo(() => ({
|
|
1325
|
+
reference: u || r.reference || null,
|
|
1326
|
+
floating: r.floating || null,
|
|
1327
|
+
domReference: r.reference
|
|
1328
|
+
}), [u, r.reference, r.floating]);
|
|
1329
|
+
return l.useMemo(() => ({
|
|
1330
|
+
dataRef: s,
|
|
1331
|
+
open: e,
|
|
1332
|
+
onOpenChange: p,
|
|
1333
|
+
elements: h,
|
|
1334
|
+
events: i,
|
|
1335
|
+
floatingId: o,
|
|
1336
|
+
refs: g
|
|
1337
|
+
}), [e, p, h, i, o, g]);
|
|
1338
|
+
}
|
|
1339
|
+
function Er(t) {
|
|
1340
|
+
t === void 0 && (t = {});
|
|
1341
|
+
const {
|
|
1342
|
+
nodeId: e
|
|
1343
|
+
} = t, n = Rr({
|
|
1344
|
+
...t,
|
|
1345
|
+
elements: {
|
|
1346
|
+
reference: null,
|
|
1347
|
+
floating: null,
|
|
1348
|
+
...t.elements
|
|
1349
|
+
}
|
|
1350
|
+
}), r = t.rootContext || n, o = r.elements, [s, i] = l.useState(null), [a, u] = l.useState(null), p = (o == null ? void 0 : o.domReference) || s, g = l.useRef(null), h = Xe();
|
|
1351
|
+
Z(() => {
|
|
1352
|
+
p && (g.current = p);
|
|
1353
|
+
}, [p]);
|
|
1354
|
+
const d = qn({
|
|
1355
|
+
...t,
|
|
1356
|
+
elements: {
|
|
1357
|
+
...o,
|
|
1358
|
+
...a && {
|
|
1359
|
+
reference: a
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}), b = l.useCallback((R) => {
|
|
1363
|
+
const P = z(R) ? {
|
|
1364
|
+
getBoundingClientRect: () => R.getBoundingClientRect(),
|
|
1365
|
+
getClientRects: () => R.getClientRects(),
|
|
1366
|
+
contextElement: R
|
|
1367
|
+
} : R;
|
|
1368
|
+
u(P), d.refs.setReference(P);
|
|
1369
|
+
}, [d.refs]), f = l.useCallback((R) => {
|
|
1370
|
+
(z(R) || R === null) && (g.current = R, i(R)), (z(d.refs.reference.current) || d.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
1371
|
+
// `null` to support `positionReference` + an unstable `reference`
|
|
1372
|
+
// callback ref.
|
|
1373
|
+
R !== null && !z(R)) && d.refs.setReference(R);
|
|
1374
|
+
}, [d.refs]), E = l.useMemo(() => ({
|
|
1375
|
+
...d.refs,
|
|
1376
|
+
setReference: f,
|
|
1377
|
+
setPositionReference: b,
|
|
1378
|
+
domReference: g
|
|
1379
|
+
}), [d.refs, f, b]), y = l.useMemo(() => ({
|
|
1380
|
+
...d.elements,
|
|
1381
|
+
domReference: p
|
|
1382
|
+
}), [d.elements, p]), m = l.useMemo(() => ({
|
|
1383
|
+
...d,
|
|
1384
|
+
...r,
|
|
1385
|
+
refs: E,
|
|
1386
|
+
elements: y,
|
|
1387
|
+
nodeId: e
|
|
1388
|
+
}), [d, E, y, e, r]);
|
|
1389
|
+
return Z(() => {
|
|
1390
|
+
r.dataRef.current.floatingContext = m;
|
|
1391
|
+
const R = h == null ? void 0 : h.nodesRef.current.find((P) => P.id === e);
|
|
1392
|
+
R && (R.context = m);
|
|
1393
|
+
}), l.useMemo(() => ({
|
|
1394
|
+
...d,
|
|
1395
|
+
context: m,
|
|
1396
|
+
refs: E,
|
|
1397
|
+
elements: y
|
|
1398
|
+
}), [d, E, y, m]);
|
|
1399
|
+
}
|
|
1400
|
+
function We(t, e, n) {
|
|
1401
|
+
const r = /* @__PURE__ */ new Map(), o = n === "item";
|
|
1402
|
+
let s = t;
|
|
1403
|
+
if (o && t) {
|
|
1404
|
+
const {
|
|
1405
|
+
[it]: i,
|
|
1406
|
+
[at]: a,
|
|
1407
|
+
...u
|
|
1408
|
+
} = t;
|
|
1409
|
+
s = u;
|
|
1410
|
+
}
|
|
1411
|
+
return {
|
|
1412
|
+
...n === "floating" && {
|
|
1413
|
+
tabIndex: -1,
|
|
1414
|
+
[Gn]: ""
|
|
1415
|
+
},
|
|
1416
|
+
...s,
|
|
1417
|
+
...e.map((i) => {
|
|
1418
|
+
const a = i ? i[n] : null;
|
|
1419
|
+
return typeof a == "function" ? t ? a(t) : null : a;
|
|
1420
|
+
}).concat(t).reduce((i, a) => (a && Object.entries(a).forEach((u) => {
|
|
1421
|
+
let [c, p] = u;
|
|
1422
|
+
if (!(o && [it, at].includes(c)))
|
|
1423
|
+
if (c.indexOf("on") === 0) {
|
|
1424
|
+
if (r.has(c) || r.set(c, []), typeof p == "function") {
|
|
1425
|
+
var g;
|
|
1426
|
+
(g = r.get(c)) == null || g.push(p), i[c] = function() {
|
|
1427
|
+
for (var h, d = arguments.length, b = new Array(d), f = 0; f < d; f++)
|
|
1428
|
+
b[f] = arguments[f];
|
|
1429
|
+
return (h = r.get(c)) == null ? void 0 : h.map((E) => E(...b)).find((E) => E !== void 0);
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
} else
|
|
1433
|
+
i[c] = p;
|
|
1434
|
+
}), i), {})
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
function yr(t) {
|
|
1438
|
+
t === void 0 && (t = []);
|
|
1439
|
+
const e = t.map((a) => a == null ? void 0 : a.reference), n = t.map((a) => a == null ? void 0 : a.floating), r = t.map((a) => a == null ? void 0 : a.item), o = l.useCallback(
|
|
1440
|
+
(a) => We(a, t, "reference"),
|
|
1441
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1442
|
+
e
|
|
1443
|
+
), s = l.useCallback(
|
|
1444
|
+
(a) => We(a, t, "floating"),
|
|
1445
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1446
|
+
n
|
|
1447
|
+
), i = l.useCallback(
|
|
1448
|
+
(a) => We(a, t, "item"),
|
|
1449
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1450
|
+
r
|
|
1451
|
+
);
|
|
1452
|
+
return l.useMemo(() => ({
|
|
1453
|
+
getReferenceProps: o,
|
|
1454
|
+
getFloatingProps: s,
|
|
1455
|
+
getItemProps: i
|
|
1456
|
+
}), [o, s, i]);
|
|
1457
|
+
}
|
|
1458
|
+
const xr = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
|
|
1459
|
+
function wr(t, e) {
|
|
1460
|
+
var n, r;
|
|
1461
|
+
e === void 0 && (e = {});
|
|
1462
|
+
const {
|
|
1463
|
+
open: o,
|
|
1464
|
+
elements: s,
|
|
1465
|
+
floatingId: i
|
|
1466
|
+
} = t, {
|
|
1467
|
+
enabled: a = !0,
|
|
1468
|
+
role: u = "dialog"
|
|
1469
|
+
} = e, c = Ye(), p = ((n = s.domReference) == null ? void 0 : n.id) || c, g = l.useMemo(() => {
|
|
1470
|
+
var m;
|
|
1471
|
+
return ((m = He(s.floating)) == null ? void 0 : m.id) || i;
|
|
1472
|
+
}, [s.floating, i]), h = (r = xr.get(u)) != null ? r : u, b = Vt() != null, f = l.useMemo(() => h === "tooltip" || u === "label" ? {
|
|
1473
|
+
["aria-" + (u === "label" ? "labelledby" : "describedby")]: o ? g : void 0
|
|
1474
|
+
} : {
|
|
1475
|
+
"aria-expanded": o ? "true" : "false",
|
|
1476
|
+
"aria-haspopup": h === "alertdialog" ? "dialog" : h,
|
|
1477
|
+
"aria-controls": o ? g : void 0,
|
|
1478
|
+
...h === "listbox" && {
|
|
1479
|
+
role: "combobox"
|
|
1480
|
+
},
|
|
1481
|
+
...h === "menu" && {
|
|
1482
|
+
id: p
|
|
1483
|
+
},
|
|
1484
|
+
...h === "menu" && b && {
|
|
1485
|
+
role: "menuitem"
|
|
1486
|
+
},
|
|
1487
|
+
...u === "select" && {
|
|
1488
|
+
"aria-autocomplete": "none"
|
|
1489
|
+
},
|
|
1490
|
+
...u === "combobox" && {
|
|
1491
|
+
"aria-autocomplete": "list"
|
|
1492
|
+
}
|
|
1493
|
+
}, [h, g, b, o, p, u]), E = l.useMemo(() => {
|
|
1494
|
+
const m = {
|
|
1495
|
+
id: g,
|
|
1496
|
+
...h && {
|
|
1497
|
+
role: h
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
return h === "tooltip" || u === "label" ? m : {
|
|
1501
|
+
...m,
|
|
1502
|
+
...h === "menu" && {
|
|
1503
|
+
"aria-labelledby": p
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
}, [h, g, p, u]), y = l.useCallback((m) => {
|
|
1507
|
+
let {
|
|
1508
|
+
active: R,
|
|
1509
|
+
selected: P
|
|
1510
|
+
} = m;
|
|
1511
|
+
const M = {
|
|
1512
|
+
role: "option",
|
|
1513
|
+
...R && {
|
|
1514
|
+
id: g + "-fui-option"
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
switch (u) {
|
|
1518
|
+
case "select":
|
|
1519
|
+
return {
|
|
1520
|
+
...M,
|
|
1521
|
+
"aria-selected": R && P
|
|
1522
|
+
};
|
|
1523
|
+
case "combobox":
|
|
1524
|
+
return {
|
|
1525
|
+
...M,
|
|
1526
|
+
"aria-selected": P
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
return {};
|
|
1530
|
+
}, [g, u]);
|
|
1531
|
+
return l.useMemo(() => a ? {
|
|
1532
|
+
reference: f,
|
|
1533
|
+
floating: E,
|
|
1534
|
+
item: y
|
|
1535
|
+
} : {}, [a, f, E, y]);
|
|
1536
|
+
}
|
|
1537
|
+
const Sr = (t) => {
|
|
1538
|
+
const e = Oe.c(29);
|
|
1539
|
+
let n;
|
|
1540
|
+
e[0] !== t ? (n = t === void 0 ? {} : t, e[0] = t, e[1] = n) : n = e[1];
|
|
1541
|
+
const {
|
|
1542
|
+
initialOpen: r,
|
|
1543
|
+
placement: o,
|
|
1544
|
+
isOpen: s,
|
|
1545
|
+
popoverOffset: i,
|
|
1546
|
+
onOpenChange: a
|
|
1547
|
+
} = n, u = r === void 0 ? !1 : r, c = o === void 0 ? "bottom-start" : o, p = i === void 0 ? 6 : i, [g, h] = Yt(u), d = s ?? g, b = a ?? h;
|
|
1548
|
+
let f;
|
|
1549
|
+
e[2] !== p ? (f = Un(p), e[2] = p, e[3] = f) : f = e[3];
|
|
1550
|
+
let E;
|
|
1551
|
+
e[4] !== c || e[5] !== p ? (E = Hn({
|
|
1552
|
+
crossAxis: c.includes("-"),
|
|
1553
|
+
fallbackAxisSideDirection: "end",
|
|
1554
|
+
padding: p
|
|
1555
|
+
}), e[4] = c, e[5] = p, e[6] = E) : E = e[6];
|
|
1556
|
+
let y;
|
|
1557
|
+
e[7] !== p ? (y = jn({
|
|
1558
|
+
padding: p
|
|
1559
|
+
}), e[7] = p, e[8] = y) : y = e[8];
|
|
1560
|
+
let m;
|
|
1561
|
+
e[9] !== f || e[10] !== E || e[11] !== y ? (m = [f, E, y], e[9] = f, e[10] = E, e[11] = y, e[12] = m) : m = e[12];
|
|
1562
|
+
let R;
|
|
1563
|
+
e[13] !== d || e[14] !== c || e[15] !== b || e[16] !== m ? (R = {
|
|
1564
|
+
placement: c,
|
|
1565
|
+
open: d,
|
|
1566
|
+
onOpenChange: b,
|
|
1567
|
+
whileElementsMounted: an,
|
|
1568
|
+
middleware: m
|
|
1569
|
+
}, e[13] = d, e[14] = c, e[15] = b, e[16] = m, e[17] = R) : R = e[17];
|
|
1570
|
+
const P = Er(R), M = P.context;
|
|
1571
|
+
let L;
|
|
1572
|
+
e[18] === Symbol.for("react.memo_cache_sentinel") ? (L = {
|
|
1573
|
+
enabled: !0
|
|
1574
|
+
}, e[18] = L) : L = e[18];
|
|
1575
|
+
const O = mr(M, L), G = hr(M), B = wr(M);
|
|
1576
|
+
let j;
|
|
1577
|
+
e[19] !== O || e[20] !== G || e[21] !== B ? (j = [O, G, B], e[19] = O, e[20] = G, e[21] = B, e[22] = j) : j = e[22];
|
|
1578
|
+
const N = yr(j);
|
|
1579
|
+
let X, V;
|
|
1580
|
+
return e[23] !== P || e[24] !== N || e[25] !== d || e[26] !== p || e[27] !== b ? (V = {
|
|
1581
|
+
open: d,
|
|
1582
|
+
popoverOffset: p,
|
|
1583
|
+
setOpen: b,
|
|
1584
|
+
...N,
|
|
1585
|
+
...P
|
|
1586
|
+
}, e[23] = P, e[24] = N, e[25] = d, e[26] = p, e[27] = b, e[28] = V) : V = e[28], X = V, X;
|
|
1587
|
+
}, Cr = (t) => {
|
|
1588
|
+
if (!xt(t))
|
|
1589
|
+
throw new Error(Ce("DSPopover", "DSPopover.Anchor child must be a valid React element."));
|
|
1590
|
+
}, Tr = ({
|
|
1591
|
+
hasContent: t,
|
|
1592
|
+
hasAnchor: e
|
|
1593
|
+
}) => {
|
|
1594
|
+
if (!t)
|
|
1595
|
+
throw new Error(Ce("DSPopover", "A DSPopover must have a <DSPopover.Content> component as a child. Please add it to the children of DSPopover."));
|
|
1596
|
+
if (!e)
|
|
1597
|
+
throw new Error(Ce("DSPopover", "A DSPopover.Anchor must have a <DSPopover.Anchor> component as a child. Please add it to the children of DSPopover."));
|
|
1598
|
+
}, Ut = Xt(null), jt = () => {
|
|
1599
|
+
const t = Zt(Ut);
|
|
1600
|
+
if (t == null)
|
|
1601
|
+
throw new Error(Ce("DSPopover", "Components like DSPopover.Anchor or DSPopover.Content must be wrapped in <DSPopover />."));
|
|
1602
|
+
return t;
|
|
1603
|
+
}, Ne = (t) => {
|
|
1604
|
+
const e = Oe.c(9);
|
|
1605
|
+
let n, r;
|
|
1606
|
+
e[0] !== t ? ({
|
|
1607
|
+
children: n,
|
|
1608
|
+
...r
|
|
1609
|
+
} = t, e[0] = t, e[1] = n, e[2] = r) : (n = e[1], r = e[2]);
|
|
1610
|
+
let o;
|
|
1611
|
+
e[3] !== r ? (o = {
|
|
1612
|
+
...r
|
|
1613
|
+
}, e[3] = r, e[4] = o) : o = e[4];
|
|
1614
|
+
const s = Sr(o), i = Je(n, Ne.Content), a = Je(n, ze);
|
|
1615
|
+
process.env.NODE_ENV !== "production" && Tr({
|
|
1616
|
+
hasContent: i,
|
|
1617
|
+
hasAnchor: a
|
|
1618
|
+
});
|
|
1619
|
+
let u;
|
|
1620
|
+
return e[5] !== n || e[6] !== s || e[7] !== r ? (u = /* @__PURE__ */ J(Ut.Provider, { value: s, ...r, children: n }), e[5] = n, e[6] = s, e[7] = r, e[8] = u) : u = e[8], u;
|
|
1621
|
+
}, ze = wt((t, e) => {
|
|
1622
|
+
const n = Oe.c(12);
|
|
1623
|
+
let r, o;
|
|
1624
|
+
n[0] !== t ? ({
|
|
1625
|
+
children: r,
|
|
1626
|
+
...o
|
|
1627
|
+
} = t, n[0] = t, n[1] = r, n[2] = o) : (r = n[1], o = n[2]), process.env.NODE_ENV !== "production" && Cr(r);
|
|
1628
|
+
const s = jt(), i = r.ref;
|
|
1629
|
+
let a;
|
|
1630
|
+
n[3] !== i || n[4] !== s.refs.setReference || n[5] !== e ? (a = [s.refs.setReference, e, i], n[3] = i, n[4] = s.refs.setReference, n[5] = e, n[6] = a) : a = n[6];
|
|
1631
|
+
const u = Bt(a);
|
|
1632
|
+
if (xt(r)) {
|
|
1633
|
+
let c;
|
|
1634
|
+
return n[7] !== r || n[8] !== s || n[9] !== o || n[10] !== u ? (c = zt(r, s.getReferenceProps({
|
|
1635
|
+
ref: u,
|
|
1636
|
+
...o,
|
|
1637
|
+
...r.props,
|
|
1638
|
+
"data-state": s.open ? "open" : "closed"
|
|
1639
|
+
})), n[7] = r, n[8] = s, n[9] = o, n[10] = u, n[11] = c) : c = n[11], c;
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
ze.displayName = "DSPopover.Anchor";
|
|
1643
|
+
const Ht = wt((t, e) => {
|
|
1644
|
+
const n = Oe.c(27);
|
|
1645
|
+
let r, o, s;
|
|
1646
|
+
n[0] !== t ? ({
|
|
1647
|
+
style: s,
|
|
1648
|
+
className: r,
|
|
1649
|
+
...o
|
|
1650
|
+
} = t, n[0] = t, n[1] = r, n[2] = o, n[3] = s) : (r = n[1], o = n[2], s = n[3]);
|
|
1651
|
+
const i = jt();
|
|
1652
|
+
let a, u;
|
|
1653
|
+
n[4] !== i ? ({
|
|
1654
|
+
context: a,
|
|
1655
|
+
...u
|
|
1656
|
+
} = i, n[4] = i, n[5] = a, n[6] = u) : (a = n[5], u = n[6]);
|
|
1657
|
+
let c;
|
|
1658
|
+
n[7] !== e || n[8] !== u.refs.setFloating ? (c = [u.refs.setFloating, e], n[7] = e, n[8] = u.refs.setFloating, n[9] = c) : c = n[9];
|
|
1659
|
+
const p = Bt(c);
|
|
1660
|
+
if (!a.open)
|
|
1661
|
+
return null;
|
|
1662
|
+
let g;
|
|
1663
|
+
n[10] !== u.floatingStyles || n[11] !== s ? (g = {
|
|
1664
|
+
...u.floatingStyles,
|
|
1665
|
+
...s
|
|
1666
|
+
}, n[10] = u.floatingStyles, n[11] = s, n[12] = g) : g = n[12];
|
|
1667
|
+
let h;
|
|
1668
|
+
n[13] !== r ? (h = un(cn.popover, r), n[13] = r, n[14] = h) : h = n[14];
|
|
1669
|
+
let d;
|
|
1670
|
+
n[15] !== o || n[16] !== u ? (d = u.getFloatingProps(o), n[15] = o, n[16] = u, n[17] = d) : d = n[17];
|
|
1671
|
+
let b;
|
|
1672
|
+
n[18] !== o.children || n[19] !== p || n[20] !== g || n[21] !== h || n[22] !== d ? (b = /* @__PURE__ */ J("div", { ref: p, style: g, className: h, ...d, children: o.children }), n[18] = o.children, n[19] = p, n[20] = g, n[21] = h, n[22] = d, n[23] = b) : b = n[23];
|
|
1673
|
+
let f;
|
|
1674
|
+
return n[24] !== a || n[25] !== b ? (f = /* @__PURE__ */ J(ur, { children: /* @__PURE__ */ J(pr, { context: a, modal: !1, children: b }) }), n[24] = a, n[25] = b, n[26] = f) : f = n[26], f;
|
|
1675
|
+
});
|
|
1676
|
+
Ht.displayName = "DSPopover.Content";
|
|
1677
|
+
Ne.Anchor = ze;
|
|
1678
|
+
Ne.Content = Ht;
|
|
1679
|
+
Ne.displayName = "DSPopover";
|
|
1680
|
+
export {
|
|
1681
|
+
Ne as D,
|
|
1682
|
+
Tr as a,
|
|
1683
|
+
Sr as u,
|
|
1684
|
+
Cr as v
|
|
1685
|
+
};
|