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