@pnx-mixtape/mxds 0.0.24 → 0.0.26
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/.storybook/decorators.ts +1 -1
- package/.storybook/main.ts +9 -1
- package/.storybook/preview.ts +1 -0
- package/.storybook/theme-demo.css +17 -13
- package/.storybook/vitest.setup.ts +17 -0
- package/dist/build/accordion.css +76 -86
- package/dist/build/accordion.entry.js +46 -72
- package/dist/build/base.css +1 -993
- package/dist/build/breadcrumb.css +1 -55
- package/dist/build/button.css +1 -126
- package/dist/build/callout.css +1 -11
- package/dist/build/card.css +1 -161
- package/dist/build/carousel.css +1 -125
- package/dist/build/chunks/Accordion-Dwh42fp7.js +42 -0
- package/dist/build/chunks/DropMenu-plGsgySm.js +43 -0
- package/dist/build/chunks/Popover-Bws25suh.js +27 -0
- package/dist/build/chunks/polyfills-Du4RTZDf.js +511 -0
- package/dist/build/chunks/popover-Bd5oQ1Ic.js +407 -0
- package/dist/build/chunks/utilities-DepaJdUg.js +242 -0
- package/dist/build/constants.css +91 -123
- package/dist/build/container-grid.css +1 -186
- package/dist/build/content-block.css +1 -36
- package/dist/build/dialog.css +1 -108
- package/dist/build/dialog.entry.js +45 -85
- package/dist/build/drop-menu.css +1 -89
- package/dist/build/drop-menu.entry.js +2 -2
- package/dist/build/drupal.css +1 -66
- package/dist/build/filters.css +1 -117
- package/dist/build/filters.entry.js +113 -142
- package/dist/build/footer.css +1 -141
- package/dist/build/form.css +1 -491
- package/dist/build/global-alert.css +1 -60
- package/dist/build/global-alert.entry.js +51 -75
- package/dist/build/grid.css +1 -195
- package/dist/build/header.css +1 -149
- package/dist/build/header.entry.js +598 -1180
- package/dist/build/hero-banner.css +1 -73
- package/dist/build/icon.css +1 -399
- package/dist/build/in-page-alert.css +1 -93
- package/dist/build/in-page-navigation.css +1 -17
- package/dist/build/in-page-navigation.entry.js +67 -103
- package/dist/build/link-list.css +1 -45
- package/dist/build/list-item.css +1 -29
- package/dist/build/masthead.css +1 -53
- package/dist/build/navigation.css +1 -356
- package/dist/build/navigation.entry.js +79 -222
- package/dist/build/page.css +1 -65
- package/dist/build/pagination.css +1 -111
- package/dist/build/popover.css +1 -119
- package/dist/build/popover.entry.js +1 -2
- package/dist/build/results-bar.css +1 -21
- package/dist/build/section.css +1 -147
- package/dist/build/side-navigation.css +1 -85
- package/dist/build/sidebar.css +1 -53
- package/dist/build/social-links.css +1 -20
- package/dist/build/steps.css +1 -118
- package/dist/build/sticky.css +1 -47
- package/dist/build/sticky.entry.js +48 -59
- package/dist/build/tabs.css +1 -108
- package/dist/build/tabs.entry.js +130 -209
- package/dist/build/tag.css +1 -70
- package/dist/build/utilities.css +1 -186
- package/dist/build/utility-list.css +1 -43
- package/dist/build/utility-list.entry.js +52 -80
- package/package.json +40 -52
- package/src/Atom/Background/__snapshots__/Background.stories.ts.snap +61 -216
- package/src/Atom/Background/_background.css +2 -1
- package/src/Atom/Button/Button.stories.tsx +2 -0
- package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +77 -97
- package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +3 -15
- package/src/Atom/DefinitionList/DefinitionList.stories.tsx +2 -1
- package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.ts.snap +13 -26
- package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.tsx.snap +2 -29
- package/src/Atom/Heading/Heading.stories.tsx +2 -1
- package/src/Atom/Heading/__snapshots__/Heading.stories.ts.snap +9 -13
- package/src/Atom/Heading/__snapshots__/Heading.stories.tsx.snap +2 -8
- package/src/Atom/Icon/Icon.stories.tsx +2 -1
- package/src/Atom/Icon/__snapshots__/Icon.stories.ts.snap +21 -28
- package/src/Atom/Icon/__snapshots__/Icon.stories.tsx.snap +4 -15
- package/src/Atom/Icon/_icon.css +7 -6
- package/src/Atom/Image/__snapshots__/Image.stories.ts.snap +6 -9
- package/src/Atom/Link/Link.stories.tsx +2 -1
- package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +47 -56
- package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +4 -22
- package/src/Atom/Media/Media.stories.ts +1 -1
- package/src/Atom/Media/Media.stories.tsx +2 -1
- package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +27 -12
- package/src/Atom/Media/__snapshots__/Media.stories.tsx.snap +3 -16
- package/src/Atom/Spacing/__snapshots__/Spacing.stories.ts.snap +5 -8
- package/src/Atom/Table/TableResponsive.stories.ts +0 -1
- package/src/Atom/Table/__snapshots__/Table.stories.ts.snap +129 -261
- package/src/Atom/Table/__snapshots__/TableResponsive.stories.ts.snap +34 -67
- package/src/Atom/Text/Text.stories.tsx +2 -1
- package/src/Atom/Text/__snapshots__/Text.stories.ts.snap +32 -46
- package/src/Atom/Text/__snapshots__/Text.stories.tsx.snap +2 -6
- package/src/Atom/Video/__snapshots__/Video.stories.ts.snap +6 -11
- package/src/Atom/_flow.css +16 -1
- package/src/Component/Accordion/Accordion.stories.tsx +2 -0
- package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +106 -140
- package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +3 -49
- package/src/Component/Accordion/__snapshots__/AccordionItem.stories.ts.snap +52 -81
- package/src/Component/Breadcrumb/Breadcrumb.stories.tsx +2 -0
- package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +29 -33
- package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.tsx.snap +3 -62
- package/src/Component/Callout/__snapshots__/Callout.stories.ts.snap +9 -11
- package/src/Component/Card/Card.stories.tsx +2 -0
- package/src/Component/Card/__snapshots__/Card.stories.ts.snap +237 -272
- package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +4 -85
- package/src/Component/Carousel/Elements/Carousel.ts +10 -7
- package/src/Component/Carousel/__snapshots__/Carousel.stories.ts.snap +992 -1187
- package/src/Component/ContentBlock/ContentBlock.stories.tsx +2 -0
- package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +161 -155
- package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.tsx.snap +2 -25
- package/src/Component/Dialog/Dialog.stories.tsx +2 -0
- package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +92 -110
- package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +2 -31
- package/src/Component/DropMenu/DropMenu.stories.tsx +2 -0
- package/src/Component/DropMenu/DropMenu.tsx +1 -3
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +25 -72
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +2 -46
- package/src/Component/Filters/__snapshots__/FilterItem.stories.ts.snap +80 -121
- package/src/Component/Filters/__snapshots__/Filters.stories.ts.snap +323 -424
- package/src/Component/GlobalAlert/GlobalAlert.stories.tsx +2 -0
- package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.ts.snap +25 -37
- package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.tsx.snap +3 -46
- package/src/Component/HeroBanner/HeroBanner.stories.tsx +2 -0
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +105 -106
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.tsx.snap +3 -34
- package/src/Component/HeroSearch/HeroSearch.stories.tsx +2 -0
- package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +121 -158
- package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.tsx.snap +3 -34
- package/src/Component/InPageAlert/InPageAlert.stories.tsx +2 -0
- package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +87 -70
- package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.tsx.snap +5 -65
- package/src/Component/InPageNavigation/InPageNavigation.stories.ts +1 -0
- package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +2 -0
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +88 -208
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +2 -148
- package/src/Component/InPageNavigation/in-page-navigation.css +5 -0
- package/src/Component/LinkList/LinkList.stories.tsx +2 -1
- package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +67 -66
- package/src/Component/LinkList/__snapshots__/LinkList.stories.tsx.snap +2 -32
- package/src/Component/ListItem/ListItem.stories.tsx +2 -1
- package/src/Component/ListItem/__snapshots__/ListItem.stories.ts.snap +153 -167
- package/src/Component/ListItem/__snapshots__/ListItem.stories.tsx.snap +2 -25
- package/src/Component/Navigation/Dropdown.stories.tsx +2 -0
- package/src/Component/Navigation/Elements/Navigation.ts +5 -5
- package/src/Component/Navigation/Navigation.stories.tsx +2 -0
- package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +2 -38
- package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +204 -279
- package/src/Component/Navigation/__snapshots__/Navigation.stories.tsx.snap +3 -59
- package/src/Component/Navigation/_navigation.css +2 -2
- package/src/Component/Pagination/Pagination.stories.tsx +2 -0
- package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +70 -60
- package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +2 -62
- package/src/Component/Popover/Elements/Popover.ts +5 -1
- package/src/Component/Popover/__snapshots__/Popover.stories.ts.snap +366 -496
- package/src/Component/Popover/popover.css +3 -4
- package/src/Component/ResultsBar/ResultsBar.stories.tsx +2 -0
- package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.ts.snap +25 -46
- package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.tsx.snap +4 -50
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +76 -81
- package/src/Component/SocialLinks/__snapshots__/SocialLinks.stories.ts.snap +35 -32
- package/src/Component/SocialShare/SocialShare.stories.tsx +2 -1
- package/src/Component/SocialShare/__snapshots__/SocialShare.stories.ts.snap +11 -27
- package/src/Component/SocialShare/__snapshots__/SocialShare.stories.tsx.snap +4 -22
- package/src/Component/SocialShare/social-share.twig +1 -0
- package/src/Component/Steps/__snapshots__/StepItem.stories.ts.snap +11 -23
- package/src/Component/Steps/__snapshots__/Steps.stories.ts.snap +142 -173
- package/src/Component/Sticky/Sticky.stories.tsx +2 -0
- package/src/Component/Sticky/__snapshots__/Sticky.stories.ts.snap +6 -12
- package/src/Component/Sticky/__snapshots__/Sticky.stories.tsx.snap +2 -10
- package/src/Component/Tabs/Tabs.stories.tsx +2 -0
- package/src/Component/Tabs/__snapshots__/TabItem.stories.ts.snap +5 -9
- package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +37 -210
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -116
- package/src/Component/Tag/Tag.stories.tsx +2 -0
- package/src/Component/Tag/__snapshots__/Tag.stories.ts.snap +37 -61
- package/src/Component/Tag/__snapshots__/Tag.stories.tsx.snap +2 -6
- package/src/Component/Tag/tags.twig +6 -6
- package/src/Component/UtilityList/__snapshots__/UtilityList.stories.ts.snap +122 -245
- package/src/Component/UtilityList/utility-list.css +4 -0
- package/src/Component/UtilityList/utility-list.twig +2 -1
- package/src/Form/Checkbox/FormCheckbox.stories.tsx +2 -2
- package/src/Form/Checkbox/__snapshots__/Checkbox.stories.ts.snap +13 -26
- package/src/Form/Checkbox/__snapshots__/FormCheckbox.stories.tsx.snap +5 -0
- package/src/Form/Description/FormDescription.stories.tsx +2 -1
- package/src/Form/Description/__snapshots__/Description.stories.ts.snap +5 -9
- package/src/Form/Description/__snapshots__/FormDescription.stories.tsx.snap +2 -9
- package/src/Form/Description/__snapshots__/FormStatus.stories.ts.snap +9 -17
- package/src/Form/Form/Form.stories.tsx +2 -1
- package/src/Form/Form/FormTitle.stories.tsx +2 -1
- package/src/Form/Form/__snapshots__/Form.stories.tsx.snap +2 -5
- package/src/Form/Form/__snapshots__/FormTitle.stories.tsx.snap +2 -8
- package/src/Form/FormItem/FormItem.stories.tsx +8 -5
- package/src/Form/FormItem/__snapshots__/FormItem.stories.ts.snap +88 -129
- package/src/Form/Label/FormLabel.stories.tsx +2 -1
- package/src/Form/Label/__snapshots__/FormLabel.stories.tsx.snap +3 -18
- package/src/Form/Label/__snapshots__/Label.stories.ts.snap +13 -25
- package/src/Form/Radio/FormRadio.stories.tsx +2 -14
- package/src/Form/Radio/__snapshots__/FormRadio.stories.tsx.snap +3 -0
- package/src/Form/Radio/__snapshots__/Radio.stories.ts.snap +42 -57
- package/src/Form/Search/__snapshots__/Search.stories.ts.snap +11 -26
- package/src/Form/Select/FormSelect.stories.tsx +2 -1
- package/src/Form/Select/__snapshots__/FormSelect.stories.tsx.snap +2 -22
- package/src/Form/Select/__snapshots__/Select.stories.ts.snap +8 -19
- package/src/Form/TextInput/FormText.stories.tsx +2 -1
- package/src/Form/TextInput/__snapshots__/FormText.stories.tsx.snap +2 -12
- package/src/Form/TextInput/__snapshots__/InputDivider.stories.ts.snap +11 -26
- package/src/Form/TextInput/__snapshots__/TextInput.stories.ts.snap +11 -25
- package/src/Form/Textarea/FormTextarea.stories.tsx +2 -1
- package/src/Form/Textarea/__snapshots__/FormTextarea.stories.tsx.snap +2 -11
- package/src/Form/Textarea/__snapshots__/Textarea.stories.ts.snap +5 -11
- package/src/Layout/Footer/Footer.stories.ts +18 -1
- package/src/Layout/Footer/Footer.stories.tsx +2 -0
- package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +360 -301
- package/src/Layout/Footer/__snapshots__/Footer.stories.tsx.snap +3 -62
- package/src/Layout/Footer/footer.css +16 -35
- package/src/Layout/Footer/footer.twig +6 -6
- package/src/Layout/Grid/Grid.stories.tsx +2 -0
- package/src/Layout/Grid/__snapshots__/Grid.stories.ts.snap +72 -66
- package/src/Layout/Grid/__snapshots__/Grid.stories.tsx.snap +6 -62
- package/src/Layout/Grid/__snapshots__/GridItem.stories.ts.snap +9 -13
- package/src/Layout/Header/Header.stories.tsx +2 -1
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +315 -466
- package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -58
- package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +86 -87
- package/src/Layout/Page/Page.stories.tsx +2 -0
- package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +2 -81
- package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +51 -61
- package/src/Layout/Section/__snapshots__/Breakouts.stories.ts.snap +34 -78
- package/src/Layout/Section/__snapshots__/Flow.stories.ts.snap +54 -89
- package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +89 -99
- package/src/Layout/Section/__snapshots__/Section.stories.tsx.snap +4 -34
- package/src/Layout/Section/__snapshots__/SectionGrid.stories.tsx.snap +3 -35
- package/src/Layout/Section/section.twig +2 -2
- package/src/Layout/Sidebar/Sidebar.stories.tsx +1 -1
- package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.ts.snap +49 -40
- package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.tsx.snap +4 -44
- package/src/Layout/Sidebar/sidebar.css +2 -2
- package/src/Layout/Sidebar/sidebar.twig +8 -5
- package/src/Utility/_layout-utils.css +9 -1
- package/src/constants.css +2 -2
- package/src/tokens.js +2 -2
- package/.storybook/test-runner.ts +0 -77
- package/dist/build/accordion.entry.js.map +0 -1
- package/dist/build/chunks/Accordion-D1HQ0FDq.js +0 -63
- package/dist/build/chunks/Accordion-D1HQ0FDq.js.map +0 -1
- package/dist/build/chunks/disclosure-widget-CdjCdx7t.js +0 -129
- package/dist/build/chunks/disclosure-widget-CdjCdx7t.js.map +0 -1
- package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js +0 -70
- package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js.map +0 -1
- package/dist/build/chunks/polyfills-DnrsypYs.js +0 -812
- package/dist/build/chunks/polyfills-DnrsypYs.js.map +0 -1
- package/dist/build/chunks/popover-DzUcnIlX.js +0 -797
- package/dist/build/chunks/popover-DzUcnIlX.js.map +0 -1
- package/dist/build/chunks/popover.entry-BQvyR0d5.js +0 -38
- package/dist/build/chunks/popover.entry-BQvyR0d5.js.map +0 -1
- package/dist/build/chunks/utilities-Ci7wwNeg.js +0 -148
- package/dist/build/chunks/utilities-Ci7wwNeg.js.map +0 -1
- package/dist/build/dialog.entry.js.map +0 -1
- package/dist/build/drop-menu.entry.js.map +0 -1
- package/dist/build/filters.entry.js.map +0 -1
- package/dist/build/global-alert.entry.js.map +0 -1
- package/dist/build/header.entry.js.map +0 -1
- package/dist/build/in-page-navigation.entry.js.map +0 -1
- package/dist/build/navigation.entry.js.map +0 -1
- package/dist/build/popover.entry.js.map +0 -1
- package/dist/build/sticky.entry.js.map +0 -1
- package/dist/build/tabs.entry.js.map +0 -1
- package/dist/build/utility-list.entry.js.map +0 -1
- package/src/Form/FormItem/__snapshots__/FormItem.stories.tsx.snap +0 -110
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
var ToggleEvent = class extends Event {
|
|
2
|
+
oldState;
|
|
3
|
+
newState;
|
|
4
|
+
constructor(s, { oldState: j = "", newState: M = "", ...N } = {}) {
|
|
5
|
+
super(s, N), this.oldState = String(j || ""), this.newState = String(M || "");
|
|
6
|
+
}
|
|
7
|
+
}, popoverToggleTaskQueue = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function queuePopoverToggleEventTask(M, N, P) {
|
|
9
|
+
popoverToggleTaskQueue.set(M, setTimeout(() => {
|
|
10
|
+
popoverToggleTaskQueue.has(M) && M.dispatchEvent(new ToggleEvent("toggle", {
|
|
11
|
+
cancelable: !1,
|
|
12
|
+
oldState: N,
|
|
13
|
+
newState: P
|
|
14
|
+
}));
|
|
15
|
+
}, 0));
|
|
16
|
+
}
|
|
17
|
+
var ShadowRoot = globalThis.ShadowRoot || function() {}, HTMLDialogElement = globalThis.HTMLDialogElement || function() {}, topLayerElements = /* @__PURE__ */ new WeakMap(), autoPopoverList = /* @__PURE__ */ new WeakMap(), hintPopoverList = /* @__PURE__ */ new WeakMap(), visibilityState = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
function getPopoverVisibilityState(s) {
|
|
19
|
+
return visibilityState.get(s) || "hidden";
|
|
20
|
+
}
|
|
21
|
+
var popoverInvoker = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
function lastSetElement(s) {
|
|
23
|
+
return [...s].pop();
|
|
24
|
+
}
|
|
25
|
+
function popoverTargetAttributeActivationBehavior(s) {
|
|
26
|
+
let j = s.popoverTargetElement;
|
|
27
|
+
if (!(j instanceof HTMLElement)) return;
|
|
28
|
+
let M = getPopoverVisibilityState(j);
|
|
29
|
+
s.popoverTargetAction === "show" && M === "showing" || s.popoverTargetAction === "hide" && M === "hidden" || (M === "showing" ? hidePopover(j, !0, !0) : checkPopoverValidity(j, !1) && (popoverInvoker.set(j, s), showPopover(j)));
|
|
30
|
+
}
|
|
31
|
+
function checkPopoverValidity(s, j) {
|
|
32
|
+
return !(s.popover !== "auto" && s.popover !== "manual" && s.popover !== "hint" || !s.isConnected || j && getPopoverVisibilityState(s) !== "showing" || !j && getPopoverVisibilityState(s) !== "hidden" || s instanceof HTMLDialogElement && s.hasAttribute("open") || document.fullscreenElement === s);
|
|
33
|
+
}
|
|
34
|
+
function getStackPosition(s) {
|
|
35
|
+
if (!s) return 0;
|
|
36
|
+
let j = autoPopoverList.get(document) || /* @__PURE__ */ new Set(), M = hintPopoverList.get(document) || /* @__PURE__ */ new Set();
|
|
37
|
+
return M.has(s) ? [...M].indexOf(s) + j.size + 1 : j.has(s) ? [...j].indexOf(s) + 1 : 0;
|
|
38
|
+
}
|
|
39
|
+
function topMostClickedPopover(s) {
|
|
40
|
+
let j = nearestInclusiveOpenPopover(s), M = nearestInclusiveTargetPopoverForInvoker(s);
|
|
41
|
+
return getStackPosition(j) > getStackPosition(M) ? j : M;
|
|
42
|
+
}
|
|
43
|
+
function topmostAutoOrHintPopover(s) {
|
|
44
|
+
let j, M = hintPopoverList.get(s) || /* @__PURE__ */ new Set(), N = autoPopoverList.get(s) || /* @__PURE__ */ new Set(), P = M.size > 0 ? M : N.size > 0 ? N : null;
|
|
45
|
+
return P ? (j = lastSetElement(P), j.isConnected ? j : (P.delete(j), topmostAutoOrHintPopover(s))) : null;
|
|
46
|
+
}
|
|
47
|
+
function topMostPopoverInList(s) {
|
|
48
|
+
for (let j of s || []) if (!j.isConnected) s.delete(j);
|
|
49
|
+
else return j;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function getRootNode(s) {
|
|
53
|
+
return typeof s.getRootNode == "function" ? s.getRootNode() : s.parentNode ? getRootNode(s.parentNode) : s;
|
|
54
|
+
}
|
|
55
|
+
function nearestInclusiveOpenPopover(s) {
|
|
56
|
+
for (; s;) {
|
|
57
|
+
if (s instanceof HTMLElement && s.popover === "auto" && visibilityState.get(s) === "showing") return s;
|
|
58
|
+
if (s = s instanceof Element && s.assignedSlot || s.parentElement || getRootNode(s), s instanceof ShadowRoot && (s = s.host), s instanceof Document) return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function nearestInclusiveTargetPopoverForInvoker(s) {
|
|
62
|
+
for (; s;) {
|
|
63
|
+
let j = s.popoverTargetElement;
|
|
64
|
+
if (j instanceof HTMLElement) return j;
|
|
65
|
+
if (s = s.parentElement || getRootNode(s), s instanceof ShadowRoot && (s = s.host), s instanceof Document) return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function topMostPopoverAncestor(s, j) {
|
|
69
|
+
let M = /* @__PURE__ */ new Map(), N = 0;
|
|
70
|
+
for (let s of j || []) M.set(s, N), N += 1;
|
|
71
|
+
M.set(s, N), N += 1;
|
|
72
|
+
let P = null;
|
|
73
|
+
function F(j) {
|
|
74
|
+
if (!j) return;
|
|
75
|
+
let N = !1, F = null, I = null;
|
|
76
|
+
for (; !N;) {
|
|
77
|
+
if (F = nearestInclusiveOpenPopover(j) || null, F === null || !M.has(F)) return;
|
|
78
|
+
(s.popover === "hint" || F.popover === "auto") && (N = !0), N || (j = F.parentElement);
|
|
79
|
+
}
|
|
80
|
+
I = M.get(F), (P === null || M.get(P) < I) && (P = F);
|
|
81
|
+
}
|
|
82
|
+
return F(s.parentElement || getRootNode(s)), P;
|
|
83
|
+
}
|
|
84
|
+
function isFocusable(s) {
|
|
85
|
+
return s.hidden || s instanceof ShadowRoot || (s instanceof HTMLButtonElement || s instanceof HTMLInputElement || s instanceof HTMLSelectElement || s instanceof HTMLTextAreaElement || s instanceof HTMLOptGroupElement || s instanceof HTMLOptionElement || s instanceof HTMLFieldSetElement) && s.disabled || s instanceof HTMLInputElement && s.type === "hidden" || s instanceof HTMLAnchorElement && s.href === "" ? !1 : typeof s.tabIndex == "number" && s.tabIndex !== -1;
|
|
86
|
+
}
|
|
87
|
+
function focusDelegate(s) {
|
|
88
|
+
if (s.shadowRoot && s.shadowRoot.delegatesFocus !== !0) return null;
|
|
89
|
+
let j = s;
|
|
90
|
+
j.shadowRoot && (j = j.shadowRoot);
|
|
91
|
+
let M = j.querySelector("[autofocus]");
|
|
92
|
+
if (M) return M;
|
|
93
|
+
{
|
|
94
|
+
let s = j.querySelectorAll("slot");
|
|
95
|
+
for (let j of s) {
|
|
96
|
+
let s = j.assignedElements({ flatten: !0 });
|
|
97
|
+
for (let j of s) if (j.hasAttribute("autofocus")) return j;
|
|
98
|
+
else if (M = j.querySelector("[autofocus]"), M) return M;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
let N = s.ownerDocument.createTreeWalker(j, NodeFilter.SHOW_ELEMENT), P = N.currentNode;
|
|
102
|
+
for (; P;) {
|
|
103
|
+
if (isFocusable(P)) return P;
|
|
104
|
+
P = N.nextNode();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function popoverFocusingSteps(s) {
|
|
108
|
+
var j;
|
|
109
|
+
(j = focusDelegate(s)) == null || j.focus();
|
|
110
|
+
}
|
|
111
|
+
var previouslyFocusedElements = /* @__PURE__ */ new WeakMap();
|
|
112
|
+
function showPopover(j) {
|
|
113
|
+
if (!checkPopoverValidity(j, !1)) return;
|
|
114
|
+
let N = j.ownerDocument;
|
|
115
|
+
if (!j.dispatchEvent(new ToggleEvent("beforetoggle", {
|
|
116
|
+
cancelable: !0,
|
|
117
|
+
oldState: "closed",
|
|
118
|
+
newState: "open"
|
|
119
|
+
})) || !checkPopoverValidity(j, !1)) return;
|
|
120
|
+
let P = !1, R = j.popover, z = null, B = topMostPopoverAncestor(j, autoPopoverList.get(N) || /* @__PURE__ */ new Set()), V = topMostPopoverAncestor(j, hintPopoverList.get(N) || /* @__PURE__ */ new Set());
|
|
121
|
+
if (R === "auto" && (closeAllOpenPopoversInList(hintPopoverList.get(N) || /* @__PURE__ */ new Set(), P, !0), hideAllPopoversUntil(B || N, P, !0), z = "auto"), R === "hint" && (V ? (hideAllPopoversUntil(V, P, !0), z = "hint") : (closeAllOpenPopoversInList(hintPopoverList.get(N) || /* @__PURE__ */ new Set(), P, !0), B ? (hideAllPopoversUntil(B, P, !0), z = "auto") : z = "hint")), R === "auto" || R === "hint") {
|
|
122
|
+
if (R !== j.popover || !checkPopoverValidity(j, !1)) return;
|
|
123
|
+
topmostAutoOrHintPopover(N) || (P = !0), z === "auto" ? (autoPopoverList.has(N) || autoPopoverList.set(N, /* @__PURE__ */ new Set()), autoPopoverList.get(N).add(j)) : z === "hint" && (hintPopoverList.has(N) || hintPopoverList.set(N, /* @__PURE__ */ new Set()), hintPopoverList.get(N).add(j));
|
|
124
|
+
}
|
|
125
|
+
previouslyFocusedElements.delete(j);
|
|
126
|
+
let H = N.activeElement;
|
|
127
|
+
j.classList.add(":popover-open"), visibilityState.set(j, "showing"), topLayerElements.has(N) || topLayerElements.set(N, /* @__PURE__ */ new Set()), topLayerElements.get(N).add(j), setInvokerAriaExpanded(popoverInvoker.get(j), !0), popoverFocusingSteps(j), P && H && j.popover === "auto" && previouslyFocusedElements.set(j, H), queuePopoverToggleEventTask(j, "closed", "open");
|
|
128
|
+
}
|
|
129
|
+
function hidePopover(j, N = !1, P = !1) {
|
|
130
|
+
var R, B;
|
|
131
|
+
if (!checkPopoverValidity(j, !0)) return;
|
|
132
|
+
let V = j.ownerDocument;
|
|
133
|
+
if (["auto", "hint"].includes(j.popover) && (hideAllPopoversUntil(j, N, P), !checkPopoverValidity(j, !0))) return;
|
|
134
|
+
let H = autoPopoverList.get(V) || /* @__PURE__ */ new Set(), U = H.has(j) && lastSetElement(H) === j;
|
|
135
|
+
if (setInvokerAriaExpanded(popoverInvoker.get(j), !1), popoverInvoker.delete(j), P && (j.dispatchEvent(new ToggleEvent("beforetoggle", {
|
|
136
|
+
oldState: "open",
|
|
137
|
+
newState: "closed"
|
|
138
|
+
})), U && lastSetElement(H) !== j && hideAllPopoversUntil(j, N, P), !checkPopoverValidity(j, !0))) return;
|
|
139
|
+
(R = topLayerElements.get(V)) == null || R.delete(j), H.delete(j), (B = hintPopoverList.get(V)) == null || B.delete(j), j.classList.remove(":popover-open"), visibilityState.set(j, "hidden"), P && queuePopoverToggleEventTask(j, "open", "closed");
|
|
140
|
+
let W = previouslyFocusedElements.get(j);
|
|
141
|
+
W && (previouslyFocusedElements.delete(j), N && W.focus());
|
|
142
|
+
}
|
|
143
|
+
function closeAllOpenPopovers(s, j = !1, M = !1) {
|
|
144
|
+
let N = topmostAutoOrHintPopover(s);
|
|
145
|
+
for (; N;) hidePopover(N, j, M), N = topmostAutoOrHintPopover(s);
|
|
146
|
+
}
|
|
147
|
+
function closeAllOpenPopoversInList(s, j = !1, M = !1) {
|
|
148
|
+
let N = topMostPopoverInList(s);
|
|
149
|
+
for (; N;) hidePopover(N, j, M), N = topMostPopoverInList(s);
|
|
150
|
+
}
|
|
151
|
+
function hidePopoverStackUntil(s, j, M, N) {
|
|
152
|
+
let P = !1, F = !1;
|
|
153
|
+
for (; P || !F;) {
|
|
154
|
+
F = !0;
|
|
155
|
+
let I = null, L = !1;
|
|
156
|
+
for (let M of j) if (M === s) L = !0;
|
|
157
|
+
else if (L) {
|
|
158
|
+
I = M;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (!I) return;
|
|
162
|
+
for (; getPopoverVisibilityState(I) === "showing" && j.size;) hidePopover(lastSetElement(j), M, N);
|
|
163
|
+
j.has(s) && lastSetElement(j) !== s && (P = !0), P && (N = !1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function hideAllPopoversUntil(s, j, M) {
|
|
167
|
+
let N = s.ownerDocument || s;
|
|
168
|
+
if (s instanceof Document) return closeAllOpenPopovers(N, j, M);
|
|
169
|
+
if (hintPopoverList.get(N)?.has(s)) {
|
|
170
|
+
hidePopoverStackUntil(s, hintPopoverList.get(N), j, M);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
closeAllOpenPopoversInList(hintPopoverList.get(N) || /* @__PURE__ */ new Set(), j, M), autoPopoverList.get(N)?.has(s) && hidePopoverStackUntil(s, autoPopoverList.get(N), j, M);
|
|
174
|
+
}
|
|
175
|
+
var popoverPointerDownTargets = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
function lightDismissOpenPopovers(s) {
|
|
177
|
+
if (!s.isTrusted) return;
|
|
178
|
+
let j = s.composedPath()[0];
|
|
179
|
+
if (!j) return;
|
|
180
|
+
let M = j.ownerDocument;
|
|
181
|
+
if (!topmostAutoOrHintPopover(M)) return;
|
|
182
|
+
let N = topMostClickedPopover(j);
|
|
183
|
+
if (N && s.type === "pointerdown") popoverPointerDownTargets.set(M, N);
|
|
184
|
+
else if (s.type === "pointerup") {
|
|
185
|
+
let s = popoverPointerDownTargets.get(M) === N;
|
|
186
|
+
popoverPointerDownTargets.delete(M), s && hideAllPopoversUntil(N || M, !1, !0);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
var initialAriaExpandedValue = /* @__PURE__ */ new WeakMap();
|
|
190
|
+
function setInvokerAriaExpanded(s, j = !1) {
|
|
191
|
+
if (!s) return;
|
|
192
|
+
initialAriaExpandedValue.has(s) || initialAriaExpandedValue.set(s, s.getAttribute("aria-expanded"));
|
|
193
|
+
let M = s.popoverTargetElement;
|
|
194
|
+
if (M instanceof HTMLElement && M.popover === "auto") s.setAttribute("aria-expanded", String(j));
|
|
195
|
+
else {
|
|
196
|
+
let j = initialAriaExpandedValue.get(s);
|
|
197
|
+
j ? s.setAttribute("aria-expanded", j) : s.removeAttribute("aria-expanded");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
var ShadowRoot2 = globalThis.ShadowRoot || function() {};
|
|
201
|
+
function isSupported() {
|
|
202
|
+
return typeof HTMLElement < "u" && typeof HTMLElement.prototype == "object" && "popover" in HTMLElement.prototype;
|
|
203
|
+
}
|
|
204
|
+
function patchSelectorFn(s, j, M) {
|
|
205
|
+
let N = s[j];
|
|
206
|
+
Object.defineProperty(s, j, { value(s) {
|
|
207
|
+
return N.call(this, M(s));
|
|
208
|
+
} });
|
|
209
|
+
}
|
|
210
|
+
var nonEscapedPopoverSelector = /(^|[^\\]):popover-open\b/g;
|
|
211
|
+
function hasLayerSupport() {
|
|
212
|
+
return typeof globalThis.CSSLayerBlockRule == "function";
|
|
213
|
+
}
|
|
214
|
+
function getStyles() {
|
|
215
|
+
let s = hasLayerSupport();
|
|
216
|
+
return `
|
|
217
|
+
${s ? "@layer popover-polyfill {" : ""}
|
|
218
|
+
:where([popover]) {
|
|
219
|
+
position: fixed;
|
|
220
|
+
z-index: 2147483647;
|
|
221
|
+
inset: 0;
|
|
222
|
+
padding: 0.25em;
|
|
223
|
+
width: fit-content;
|
|
224
|
+
height: fit-content;
|
|
225
|
+
border-width: initial;
|
|
226
|
+
border-color: initial;
|
|
227
|
+
border-image: initial;
|
|
228
|
+
border-style: solid;
|
|
229
|
+
background-color: canvas;
|
|
230
|
+
color: canvastext;
|
|
231
|
+
overflow: auto;
|
|
232
|
+
margin: auto;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:where([popover]:not(.\\:popover-open)) {
|
|
236
|
+
display: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
:where(dialog[popover].\\:popover-open) {
|
|
240
|
+
display: block;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:where(dialog[popover][open]) {
|
|
244
|
+
display: revert;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:where([anchor].\\:popover-open) {
|
|
248
|
+
inset: auto;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:where([anchor]:popover-open) {
|
|
252
|
+
inset: auto;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@supports not (background-color: canvas) {
|
|
256
|
+
:where([popover]) {
|
|
257
|
+
background-color: white;
|
|
258
|
+
color: black;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
@supports (width: -moz-fit-content) {
|
|
263
|
+
:where([popover]) {
|
|
264
|
+
width: -moz-fit-content;
|
|
265
|
+
height: -moz-fit-content;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@supports not (inset: 0) {
|
|
270
|
+
:where([popover]) {
|
|
271
|
+
top: 0;
|
|
272
|
+
left: 0;
|
|
273
|
+
right: 0;
|
|
274
|
+
bottom: 0;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
${s ? "}" : ""}
|
|
278
|
+
`;
|
|
279
|
+
}
|
|
280
|
+
var popoverStyleSheet = null;
|
|
281
|
+
function injectStyles(s) {
|
|
282
|
+
let j = getStyles();
|
|
283
|
+
if (popoverStyleSheet === null) try {
|
|
284
|
+
popoverStyleSheet = new CSSStyleSheet(), popoverStyleSheet.replaceSync(j);
|
|
285
|
+
} catch {
|
|
286
|
+
popoverStyleSheet = !1;
|
|
287
|
+
}
|
|
288
|
+
if (popoverStyleSheet === !1) {
|
|
289
|
+
let M = document.createElement("style");
|
|
290
|
+
M.textContent = j, s instanceof Document ? s.head.prepend(M) : s.prepend(M);
|
|
291
|
+
} else s.adoptedStyleSheets = [popoverStyleSheet, ...s.adoptedStyleSheets];
|
|
292
|
+
}
|
|
293
|
+
function apply() {
|
|
294
|
+
if (typeof window > "u") return;
|
|
295
|
+
window.ToggleEvent = window.ToggleEvent || ToggleEvent;
|
|
296
|
+
function j(s) {
|
|
297
|
+
return s?.includes(":popover-open") && (s = s.replace(nonEscapedPopoverSelector, "$1.\\:popover-open")), s;
|
|
298
|
+
}
|
|
299
|
+
patchSelectorFn(Document.prototype, "querySelector", j), patchSelectorFn(Document.prototype, "querySelectorAll", j), patchSelectorFn(Element.prototype, "querySelector", j), patchSelectorFn(Element.prototype, "querySelectorAll", j), patchSelectorFn(Element.prototype, "matches", j), patchSelectorFn(Element.prototype, "closest", j), patchSelectorFn(DocumentFragment.prototype, "querySelectorAll", j), Object.defineProperties(HTMLElement.prototype, {
|
|
300
|
+
popover: {
|
|
301
|
+
enumerable: !0,
|
|
302
|
+
configurable: !0,
|
|
303
|
+
get() {
|
|
304
|
+
if (!this.hasAttribute("popover")) return null;
|
|
305
|
+
let s = (this.getAttribute("popover") || "").toLowerCase();
|
|
306
|
+
return s === "" || s == "auto" ? "auto" : s == "hint" ? "hint" : "manual";
|
|
307
|
+
},
|
|
308
|
+
set(s) {
|
|
309
|
+
s === null ? this.removeAttribute("popover") : this.setAttribute("popover", s);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
showPopover: {
|
|
313
|
+
enumerable: !0,
|
|
314
|
+
configurable: !0,
|
|
315
|
+
value(s = {}) {
|
|
316
|
+
showPopover(this);
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
hidePopover: {
|
|
320
|
+
enumerable: !0,
|
|
321
|
+
configurable: !0,
|
|
322
|
+
value() {
|
|
323
|
+
hidePopover(this, !0, !0);
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
togglePopover: {
|
|
327
|
+
enumerable: !0,
|
|
328
|
+
configurable: !0,
|
|
329
|
+
value(s = {}) {
|
|
330
|
+
return typeof s == "boolean" && (s = { force: s }), visibilityState.get(this) === "showing" && s.force === void 0 || s.force === !1 ? hidePopover(this, !0, !0) : (s.force === void 0 || s.force === !0) && showPopover(this), visibilityState.get(this) === "showing";
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
let M = Element.prototype.attachShadow;
|
|
335
|
+
M && Object.defineProperties(Element.prototype, { attachShadow: {
|
|
336
|
+
enumerable: !0,
|
|
337
|
+
configurable: !0,
|
|
338
|
+
writable: !0,
|
|
339
|
+
value(s) {
|
|
340
|
+
let j = M.call(this, s);
|
|
341
|
+
return injectStyles(j), j;
|
|
342
|
+
}
|
|
343
|
+
} });
|
|
344
|
+
let N = HTMLElement.prototype.attachInternals;
|
|
345
|
+
N && Object.defineProperties(HTMLElement.prototype, { attachInternals: {
|
|
346
|
+
enumerable: !0,
|
|
347
|
+
configurable: !0,
|
|
348
|
+
writable: !0,
|
|
349
|
+
value() {
|
|
350
|
+
let s = N.call(this);
|
|
351
|
+
return s.shadowRoot && injectStyles(s.shadowRoot), s;
|
|
352
|
+
}
|
|
353
|
+
} });
|
|
354
|
+
let P = /* @__PURE__ */ new WeakMap();
|
|
355
|
+
function F(s) {
|
|
356
|
+
Object.defineProperties(s.prototype, {
|
|
357
|
+
popoverTargetElement: {
|
|
358
|
+
enumerable: !0,
|
|
359
|
+
configurable: !0,
|
|
360
|
+
set(s) {
|
|
361
|
+
if (s === null) this.removeAttribute("popovertarget"), P.delete(this);
|
|
362
|
+
else if (s instanceof Element) this.setAttribute("popovertarget", ""), P.set(this, s);
|
|
363
|
+
else throw TypeError("popoverTargetElement must be an element or null");
|
|
364
|
+
},
|
|
365
|
+
get() {
|
|
366
|
+
if (this.localName !== "button" && this.localName !== "input" || this.localName === "input" && this.type !== "reset" && this.type !== "image" && this.type !== "button" || this.disabled || this.form && this.type === "submit") return null;
|
|
367
|
+
let s = P.get(this);
|
|
368
|
+
if (s && s.isConnected) return s;
|
|
369
|
+
if (s && !s.isConnected) return P.delete(this), null;
|
|
370
|
+
let j = getRootNode(this), M = this.getAttribute("popovertarget");
|
|
371
|
+
return (j instanceof Document || j instanceof ShadowRoot2) && M && j.getElementById(M) || null;
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
popoverTargetAction: {
|
|
375
|
+
enumerable: !0,
|
|
376
|
+
configurable: !0,
|
|
377
|
+
get() {
|
|
378
|
+
let s = (this.getAttribute("popovertargetaction") || "").toLowerCase();
|
|
379
|
+
return s === "show" || s === "hide" ? s : "toggle";
|
|
380
|
+
},
|
|
381
|
+
set(s) {
|
|
382
|
+
this.setAttribute("popovertargetaction", s);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
F(HTMLButtonElement), F(HTMLInputElement);
|
|
388
|
+
let I = (s) => {
|
|
389
|
+
if (s.defaultPrevented) return;
|
|
390
|
+
let j = s.composedPath(), M = j[0];
|
|
391
|
+
if (!(M instanceof Element) || M?.shadowRoot) return;
|
|
392
|
+
let N = getRootNode(M);
|
|
393
|
+
if (!(N instanceof ShadowRoot2 || N instanceof Document)) return;
|
|
394
|
+
let P = j.find((s) => s.matches?.call(s, "[popovertargetaction],[popovertarget]"));
|
|
395
|
+
if (P) {
|
|
396
|
+
popoverTargetAttributeActivationBehavior(P), s.preventDefault();
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
}, L = (s) => {
|
|
400
|
+
let j = s.key, M = s.target;
|
|
401
|
+
!s.defaultPrevented && M && (j === "Escape" || j === "Esc") && hideAllPopoversUntil(M.ownerDocument, !0, !0);
|
|
402
|
+
};
|
|
403
|
+
((s) => {
|
|
404
|
+
s.addEventListener("click", I), s.addEventListener("keydown", L), s.addEventListener("pointerdown", lightDismissOpenPopovers), s.addEventListener("pointerup", lightDismissOpenPopovers);
|
|
405
|
+
})(document), injectStyles(document);
|
|
406
|
+
}
|
|
407
|
+
isSupported() || apply();
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
var DisclosureWidget = class {
|
|
2
|
+
options;
|
|
3
|
+
context;
|
|
4
|
+
trigger;
|
|
5
|
+
element;
|
|
6
|
+
id;
|
|
7
|
+
isOpen;
|
|
8
|
+
attached;
|
|
9
|
+
constructor(e, t, n, r = document) {
|
|
10
|
+
if (!e) throw Error("toggle is required.");
|
|
11
|
+
if (!t) throw Error("element is required.");
|
|
12
|
+
this.options = {
|
|
13
|
+
attribute: "inert",
|
|
14
|
+
shouldPreventDefault: !0,
|
|
15
|
+
setInitialAttribute: !0,
|
|
16
|
+
clickEvent: "click",
|
|
17
|
+
...n
|
|
18
|
+
}, this.context = r || document, this.trigger = e, this.element = t, this.id = this.element.id || this.generatedId();
|
|
19
|
+
}
|
|
20
|
+
init = () => {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(this.trigger, "disclosureWidget")) return;
|
|
22
|
+
let { attribute: e, setInitialAttribute: t } = this.options;
|
|
23
|
+
this.trigger.disclosureWidget = this, t && this.element.setAttribute(e, ""), this.attach();
|
|
24
|
+
};
|
|
25
|
+
handleToggle = () => {
|
|
26
|
+
let { attribute: e, setInitialAttribute: t } = this.options;
|
|
27
|
+
this.element.toggleAttribute(e);
|
|
28
|
+
let n = this.element.hasAttribute(e);
|
|
29
|
+
this.isOpen = t ? !n : n, this.trigger.setAttribute("aria-expanded", String(this.isOpen));
|
|
30
|
+
let r = new CustomEvent("disclosure-toggle", {
|
|
31
|
+
bubbles: !0,
|
|
32
|
+
cancelable: !0,
|
|
33
|
+
detail: {
|
|
34
|
+
isOpen: this.isOpen,
|
|
35
|
+
id: this.id,
|
|
36
|
+
options: this.options,
|
|
37
|
+
target: this.element
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.trigger.dispatchEvent(r);
|
|
41
|
+
};
|
|
42
|
+
handleMouse = (e) => {
|
|
43
|
+
let { currentTarget: t, type: n, relatedTarget: r } = e;
|
|
44
|
+
if (n === "mouseover" || n === "mouseout") {
|
|
45
|
+
let e = this.trigger.parentNode;
|
|
46
|
+
if (e !== t || e.contains(r)) return;
|
|
47
|
+
} else if (this.trigger !== t) return;
|
|
48
|
+
let { shouldPreventDefault: i } = this.options;
|
|
49
|
+
this.handleToggle(), i && (e.preventDefault(), e.stopPropagation());
|
|
50
|
+
};
|
|
51
|
+
handleKeyboard = (e) => {
|
|
52
|
+
let { key: t, target: n } = e;
|
|
53
|
+
if (this.trigger !== n) return;
|
|
54
|
+
let { isOpen: r } = this, { shouldPreventDefault: i } = this.options;
|
|
55
|
+
switch (t) {
|
|
56
|
+
case "ArrowDown":
|
|
57
|
+
case "Enter":
|
|
58
|
+
r || this.handleToggle(), i && e.preventDefault();
|
|
59
|
+
break;
|
|
60
|
+
case "ArrowUp":
|
|
61
|
+
case "Escape":
|
|
62
|
+
r && this.handleToggle(), i && e.preventDefault();
|
|
63
|
+
break;
|
|
64
|
+
default: break;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
attach = () => {
|
|
68
|
+
if (this.attached) return;
|
|
69
|
+
let { clickEvent: e } = this.options;
|
|
70
|
+
if (e === "mouseover") {
|
|
71
|
+
let e = this.trigger.parentNode;
|
|
72
|
+
e.addEventListener("mouseover", this.handleMouse), e.addEventListener("mouseout", this.handleMouse);
|
|
73
|
+
} else this.trigger.addEventListener("click", this.handleMouse);
|
|
74
|
+
this.trigger.addEventListener("keydown", this.handleKeyboard), this.trigger.setAttribute("aria-expanded", "false"), this.trigger.hasAttribute("aria-controls") || this.trigger.setAttribute("aria-controls", this.id), this.attached = !0;
|
|
75
|
+
};
|
|
76
|
+
detach = () => {
|
|
77
|
+
if (!this.attached) return;
|
|
78
|
+
this.isOpen && this.handleToggle();
|
|
79
|
+
let { clickEvent: e } = this.options;
|
|
80
|
+
if (e === "mouseover") {
|
|
81
|
+
let e = this.trigger.parentNode;
|
|
82
|
+
e.removeEventListener("mouseover", this.handleMouse), e.removeEventListener("mouseout", this.handleMouse);
|
|
83
|
+
} else this.trigger.removeEventListener("click", this.handleMouse);
|
|
84
|
+
this.trigger.removeEventListener("keydown", this.handleKeyboard), this.trigger.removeAttribute("aria-expanded"), this.attached = !1;
|
|
85
|
+
};
|
|
86
|
+
generatedId = () => {
|
|
87
|
+
let e = this.trigger?.textContent?.trim();
|
|
88
|
+
return e ? makeAnchor(e) : "";
|
|
89
|
+
};
|
|
90
|
+
}, Keyboard = class {
|
|
91
|
+
constructor() {
|
|
92
|
+
window.Mixtape = window.Mixtape || {}, window.Mixtape.Popups = window.Mixtape.Popups || [], window.Mixtape.Menu = window.Mixtape.Menu || {};
|
|
93
|
+
}
|
|
94
|
+
attachPopup = (e, t) => {
|
|
95
|
+
window.Mixtape.Popups.push({
|
|
96
|
+
id: e,
|
|
97
|
+
closefn: t
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
detachPopup = (e) => {
|
|
101
|
+
window.Mixtape.Popups = window.Mixtape.Popups.filter((t) => t.id !== e);
|
|
102
|
+
};
|
|
103
|
+
attachMenu = (e, t) => {
|
|
104
|
+
window.Mixtape.Menu = {
|
|
105
|
+
context: e,
|
|
106
|
+
items: t
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
detachMenu = () => {
|
|
110
|
+
window.Mixtape.Menu = null;
|
|
111
|
+
};
|
|
112
|
+
getNextFocusableMenuItem = (e, t = !1) => t ? e === 0 ? window.Mixtape.Menu.items.length - 1 : e - 1 : window.Mixtape.Menu.items.length > e + 1 ? e + 1 : 0;
|
|
113
|
+
moveFocus = (e, t = !1) => {
|
|
114
|
+
if (!window.Mixtape.Menu.items) return;
|
|
115
|
+
let n = 0;
|
|
116
|
+
window.Mixtape.Menu.items.forEach((t, r) => {
|
|
117
|
+
t === e && (n = r);
|
|
118
|
+
});
|
|
119
|
+
let r = this.getNextFocusableMenuItem(n, t), i = window.Mixtape.Menu.items[r].getAttribute("tabindex");
|
|
120
|
+
if (i !== "-1") window.Mixtape.Menu.items[r].focus();
|
|
121
|
+
else {
|
|
122
|
+
for (; i === "-1";) r = this.getNextFocusableMenuItem(r, t), i = window.Mixtape.Menu.items[r].getAttribute("tabindex");
|
|
123
|
+
window.Mixtape.Menu.items[r].focus();
|
|
124
|
+
}
|
|
125
|
+
window.Mixtape.Menu.active = r;
|
|
126
|
+
};
|
|
127
|
+
handleGlobalClick = ({ target: e }) => {
|
|
128
|
+
let t = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null;
|
|
129
|
+
if (t && t.id) {
|
|
130
|
+
let n = document.querySelector(`#${t.id}`).parentElement;
|
|
131
|
+
if (n && (e === n || n?.contains(e))) return;
|
|
132
|
+
t.closefn();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
handleGlobalKeydown = (e) => {
|
|
136
|
+
let t = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null, n = e.target;
|
|
137
|
+
switch (e.key) {
|
|
138
|
+
case "Escape":
|
|
139
|
+
t && t.closefn();
|
|
140
|
+
break;
|
|
141
|
+
case "ArrowDown":
|
|
142
|
+
case "ArrowRight":
|
|
143
|
+
window.Mixtape.Menu?.items && (e.preventDefault(), this.moveFocus(n));
|
|
144
|
+
break;
|
|
145
|
+
case "ArrowUp":
|
|
146
|
+
case "ArrowLeft":
|
|
147
|
+
window.Mixtape.Menu?.items && (e.preventDefault(), this.moveFocus(n, !0));
|
|
148
|
+
break;
|
|
149
|
+
default: break;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
attachEventListeners = (e) => {
|
|
153
|
+
window.addEventListener("click", this.handleGlobalClick, { signal: e }), window.addEventListener("keydown", this.handleGlobalKeydown, { signal: e });
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
function assign(e) {
|
|
157
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
158
|
+
var n = arguments[t];
|
|
159
|
+
for (var r in n) e[r] = n[r];
|
|
160
|
+
}
|
|
161
|
+
return e;
|
|
162
|
+
}
|
|
163
|
+
var defaultConverter = {
|
|
164
|
+
read: function(e) {
|
|
165
|
+
return e[0] === "\"" && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
166
|
+
},
|
|
167
|
+
write: function(e) {
|
|
168
|
+
return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function init(e, t) {
|
|
172
|
+
function r(r, i, a) {
|
|
173
|
+
if (!(typeof document > "u")) {
|
|
174
|
+
a = assign({}, t, a), typeof a.expires == "number" && (a.expires = new Date(Date.now() + a.expires * 864e5)), a.expires &&= a.expires.toUTCString(), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
175
|
+
var o = "";
|
|
176
|
+
for (var s in a) a[s] && (o += "; " + s, a[s] !== !0 && (o += "=" + a[s].split(";")[0]));
|
|
177
|
+
return document.cookie = r + "=" + e.write(i, r) + o;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function a(t) {
|
|
181
|
+
if (!(typeof document > "u" || arguments.length && !t)) {
|
|
182
|
+
for (var n = document.cookie ? document.cookie.split("; ") : [], r = {}, i = 0; i < n.length; i++) {
|
|
183
|
+
var a = n[i].split("="), o = a.slice(1).join("=");
|
|
184
|
+
try {
|
|
185
|
+
var s = decodeURIComponent(a[0]);
|
|
186
|
+
if (r[s] = e.read(o, s), t === s) break;
|
|
187
|
+
} catch {}
|
|
188
|
+
}
|
|
189
|
+
return t ? r[t] : r;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return Object.create({
|
|
193
|
+
set: r,
|
|
194
|
+
get: a,
|
|
195
|
+
remove: function(e, t) {
|
|
196
|
+
r(e, "", assign({}, t, { expires: -1 }));
|
|
197
|
+
},
|
|
198
|
+
withAttributes: function(e) {
|
|
199
|
+
return init(this.converter, assign({}, this.attributes, e));
|
|
200
|
+
},
|
|
201
|
+
withConverter: function(e) {
|
|
202
|
+
return init(assign({}, this.converter, e), this.attributes);
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
attributes: { value: Object.freeze(t) },
|
|
206
|
+
converter: { value: Object.freeze(e) }
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
init(defaultConverter, { path: "/" });
|
|
210
|
+
const makeAnchor = (e, t = 20) => {
|
|
211
|
+
if (typeof e != "string" || !e) return "";
|
|
212
|
+
let n = e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^-a-z0-9]/g, "").replace(/[\n\r]+|[\s]{2,}/g, "");
|
|
213
|
+
return [...[
|
|
214
|
+
,
|
|
215
|
+
,
|
|
216
|
+
,
|
|
217
|
+
,
|
|
218
|
+
,
|
|
219
|
+
,
|
|
220
|
+
].keys()].forEach(() => {
|
|
221
|
+
n.charAt(0).match(/[a-z]/g) || (n = n.substring(1));
|
|
222
|
+
}), t && (n = n.substring(0, t + 1)), n;
|
|
223
|
+
}, createElement = (e) => {
|
|
224
|
+
try {
|
|
225
|
+
let t = document.createElement("div");
|
|
226
|
+
return t.innerHTML = e, t.firstElementChild;
|
|
227
|
+
} catch (e) {
|
|
228
|
+
return console.error(e), null;
|
|
229
|
+
}
|
|
230
|
+
}, handleOutsideClick = (e, t, n, r = []) => {
|
|
231
|
+
let { target: i, clientY: a, clientX: o } = e, s = i instanceof HTMLOptionElement || i instanceof HTMLSelectElement;
|
|
232
|
+
if ((r?.filter((e) => e === i || e.contains(i))).length || s) return;
|
|
233
|
+
let c = new IntersectionObserver(([{ boundingClientRect: e }]) => {
|
|
234
|
+
let { top: t, height: r, width: i, left: s } = e;
|
|
235
|
+
t <= a && a <= t + r && s <= o && o <= s + i || n(), c.disconnect();
|
|
236
|
+
});
|
|
237
|
+
c.observe(t);
|
|
238
|
+
}, handleEscape = (e, t) => {
|
|
239
|
+
let { key: n } = e;
|
|
240
|
+
n === "Escape" && t();
|
|
241
|
+
};
|
|
242
|
+
export { Keyboard as a, makeAnchor as i, handleEscape as n, DisclosureWidget as o, handleOutsideClick as r, createElement as t };
|