@pnx-mixtape/mxds 0.1.0-rc.4 → 0.1.0-rc.6
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/.claude/skills/create-mxds-component/SKILL.md +77 -0
- package/DESIGN.md +595 -0
- package/README.md +2 -3
- package/dist/build/accordion.entry.js +2 -1
- package/dist/build/autocomplete.entry.js +1 -1
- package/dist/build/back-to-top.css +1 -0
- package/dist/build/back-to-top.entry.js +1 -0
- package/dist/build/base.css +1 -1
- package/dist/build/button.css +1 -1
- package/dist/build/card.css +1 -1
- package/dist/build/chunks/Accordion-Bqe8vTNR.js +44 -0
- package/dist/build/chunks/AccordionGroup-BYtoAFxg.js +47 -0
- package/dist/build/chunks/AccordionMobile-D517oXYZ.js +26 -0
- package/dist/build/chunks/Autocomplete-kRo8RNbC.js +135 -0
- package/dist/build/chunks/BackToTop-4M-Wl7z3.js +64 -0
- package/dist/build/chunks/ClosableAlert-CZ114JsL.js +55 -0
- package/dist/build/chunks/CookieConsent-wd8gQ2Oe.js +18 -0
- package/dist/build/chunks/Dialog-DoYcGqhW.js +48 -0
- package/dist/build/chunks/DropMenu-CSTZq0Zt.js +68 -0
- package/dist/build/chunks/FeedbackForm-BsL7fv8s.js +64 -0
- package/dist/build/chunks/Gallery-DqJPujX5.js +165 -0
- package/dist/build/chunks/GlobalToggle-7H3F1Wvc.js +82 -0
- package/dist/build/chunks/InPageNavigation-D7m3IN89.js +86 -0
- package/dist/build/chunks/Navigation-CRModT40.js +142 -0
- package/dist/build/chunks/Popover-CiTAftNU.js +30 -0
- package/dist/build/chunks/Sticky-C1H8MNqK.js +51 -0
- package/dist/build/chunks/Tabs-BJD3kABL.js +160 -0
- package/dist/build/chunks/Translate-yAgySwet.js +46 -0
- package/dist/build/chunks/cookie-compliance-CG6x-TcV.js +119 -0
- package/dist/build/chunks/enums-BrHxPZZ_.js +36 -0
- package/dist/build/chunks/polyfills-D-qh1a_2.js +33 -0
- package/dist/build/chunks/utilities-B9mNRs7V.js +255 -0
- package/dist/build/content-block.css +1 -1
- package/dist/build/cookie-consent.entry.js +1 -1
- package/dist/build/dialog.entry.js +1 -1
- package/dist/build/drop-menu.entry.js +1 -1
- package/dist/build/elements.js +147 -1
- package/dist/build/feedback-form.css +1 -0
- package/dist/build/feedback-form.entry.js +1 -0
- package/dist/build/filters.entry.js +145 -1
- package/dist/build/form.css +1 -1
- package/dist/build/gallery.entry.js +1 -1
- package/dist/build/global-alert.entry.js +1 -1
- package/dist/build/header.css +1 -1
- package/dist/build/header.entry.js +1 -1
- package/dist/build/icon.css +1 -1
- package/dist/build/in-page-navigation.entry.js +1 -1
- package/dist/build/navigation.css +1 -1
- package/dist/build/navigation.entry.js +1 -1
- package/dist/build/pagination.css +1 -1
- package/dist/build/popover.entry.js +1 -1
- package/dist/build/react.js +2291 -1
- package/dist/build/side-navigation.css +1 -1
- package/dist/build/sidebar.css +1 -1
- package/dist/build/sticky.entry.js +1 -1
- package/dist/build/tabs.entry.js +1 -1
- package/dist/build/translate.css +1 -0
- package/dist/build/translate.entry.js +1 -0
- package/dist/build/utility-list.entry.js +53 -1
- package/dist/types/Component/BackToTop/BackToTop.d.ts +20 -0
- package/dist/types/Component/BackToTop/BackToTop.d.ts.map +1 -0
- package/dist/types/Component/BackToTop/Elements/BackToTop.d.ts +27 -0
- package/dist/types/Component/BackToTop/Elements/BackToTop.d.ts.map +1 -0
- package/dist/types/Component/BackToTop/back-to-top.entry.d.ts +2 -0
- package/dist/types/Component/BackToTop/back-to-top.entry.d.ts.map +1 -0
- package/dist/types/Component/DropMenu/DropMenu.d.ts +2 -1
- package/dist/types/Component/DropMenu/DropMenu.d.ts.map +1 -1
- package/dist/types/Component/Navigation/Elements/Navigation.d.ts +2 -3
- package/dist/types/Component/Navigation/Elements/Navigation.d.ts.map +1 -1
- package/dist/types/Component/SideNavigation/Components/SideNavigationTree.d.ts +3 -3
- package/dist/types/Component/SideNavigation/Components/SideNavigationTree.d.ts.map +1 -1
- package/dist/types/Component/SideNavigation/SideNavigation.d.ts +3 -1
- package/dist/types/Component/SideNavigation/SideNavigation.d.ts.map +1 -1
- package/dist/types/Component/Tabs/Components/TabDropMenu.d.ts.map +1 -1
- package/dist/types/Component/Tabs/Elements/Tabs.d.ts.map +1 -1
- package/dist/types/Component/Translate/Elements/Translate.d.ts +23 -0
- package/dist/types/Component/Translate/Elements/Translate.d.ts.map +1 -0
- package/dist/types/Component/Translate/Translate.d.ts +37 -0
- package/dist/types/Component/Translate/Translate.d.ts.map +1 -0
- package/dist/types/Component/Translate/languages.d.ts +11 -0
- package/dist/types/Component/Translate/languages.d.ts.map +1 -0
- package/dist/types/Component/Translate/translate.entry.d.ts +2 -0
- package/dist/types/Component/Translate/translate.entry.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/Elements/FeedbackForm.d.ts +37 -0
- package/dist/types/Form/FeedbackForm/Elements/FeedbackForm.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/FeedbackForm.d.ts +36 -0
- package/dist/types/Form/FeedbackForm/FeedbackForm.d.ts.map +1 -0
- package/dist/types/Form/FeedbackForm/feedback-form.entry.d.ts +2 -0
- package/dist/types/Form/FeedbackForm/feedback-form.entry.d.ts.map +1 -0
- package/dist/types/Utility/Elements/google-translate-widget.d.ts +91 -0
- package/dist/types/Utility/Elements/google-translate-widget.d.ts.map +1 -0
- package/dist/types/Utility/utilities.d.ts +2 -0
- package/dist/types/Utility/utilities.d.ts.map +1 -1
- package/dist/types/elements.d.ts +3 -0
- package/dist/types/elements.d.ts.map +1 -1
- package/dist/types/enums.d.ts +3 -1
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/react.d.ts +3 -0
- package/dist/types/react.d.ts.map +1 -1
- package/dist/types/tokens.d.ts +1 -0
- package/dist/types/tokens.d.ts.map +1 -1
- package/docs/API.md +1215 -0
- package/docs/CSSGuidelines.md +893 -0
- package/docs/CodeQuality.md +940 -0
- package/docs/ComponentArchitecture.md +714 -0
- package/docs/Contributing.md +626 -0
- package/docs/MemoryManagement.md +598 -0
- package/docs/Migrations.md +6 -0
- package/docs/README.md +100 -0
- package/docs/Security.md +444 -0
- package/docs/Testing.md +739 -0
- package/docs/Troubleshooting.md +674 -0
- package/package.json +9 -6
- package/src/Atom/Button/Button.tsx +1 -1
- package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +2 -2
- package/src/Atom/Button/_buttons.css +1 -0
- package/src/Atom/Icon/README.md +1 -1
- package/src/Atom/Icon/_icon.css +1 -0
- package/src/Atom/Icon/images/thumb.svg +1 -0
- package/src/Atom/Link/_links.css +1 -0
- package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +4 -9
- package/src/Atom/Media/media.twig +4 -5
- package/src/Component/BackToTop/BackToTop.stories.ts +127 -0
- package/src/Component/BackToTop/BackToTop.stories.tsx +53 -0
- package/src/Component/BackToTop/BackToTop.tsx +120 -0
- package/src/Component/BackToTop/Elements/BackToTop.ts +119 -0
- package/src/Component/BackToTop/README.md +164 -0
- package/src/Component/BackToTop/__snapshots__/BackToTop.stories.ts.snap +24 -0
- package/src/Component/BackToTop/__snapshots__/BackToTop.stories.tsx.snap +3 -0
- package/src/Component/BackToTop/back-to-top.css +70 -0
- package/src/Component/BackToTop/back-to-top.entry.js +1 -0
- package/src/Component/BackToTop/back-to-top.twig +26 -0
- package/src/Component/Card/Components/CardContent.tsx +1 -1
- package/src/Component/Card/Components/CardMedia.tsx +1 -1
- package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +3 -3
- package/src/Component/Card/card.css +1 -1
- package/src/Component/Carousel/Carousel.stories.ts +66 -36
- package/src/Component/Carousel/__snapshots__/Carousel.stories.tsx.snap +5 -5
- package/src/Component/ContentBlock/Components/ContentBlockMedia.tsx +1 -1
- package/src/Component/ContentBlock/content-block.css +1 -1
- package/src/Component/DropMenu/DropMenu.stories.ts +21 -2
- package/src/Component/DropMenu/DropMenu.tsx +14 -4
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +3 -3
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +2 -2
- package/src/Component/DropMenu/drop-menu.twig +7 -1
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.tsx.snap +1 -1
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +48 -13
- package/src/Component/InPageNavigation/in-page-navigation.twig +4 -6
- package/src/Component/ListItem/Components/ListItemMedia.tsx +1 -1
- package/src/Component/Navigation/Elements/Navigation.ts +25 -29
- package/src/Component/Navigation/README.md +11 -10
- package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +8 -8
- package/src/Component/Navigation/_navigation-dropdown.css +9 -11
- package/src/Component/Navigation/_navigation-mega.css +5 -11
- package/src/Component/Navigation/_navigation.css +5 -3
- package/src/Component/Navigation/menu.twig +1 -1
- package/src/Component/Navigation/navigation.twig +0 -1
- package/src/Component/Pagination/Pagination.stories.ts +57 -27
- package/src/Component/Pagination/pagination.css +16 -7
- package/src/Component/Popover/__snapshots__/Popover.stories.tsx.snap +3 -3
- package/src/Component/SideNavigation/Components/SideNavigationTree.tsx +68 -24
- package/src/Component/SideNavigation/README.md +78 -32
- package/src/Component/SideNavigation/SideNavigation.stories.ts +41 -2
- package/src/Component/SideNavigation/SideNavigation.stories.tsx +31 -0
- package/src/Component/SideNavigation/SideNavigation.tsx +13 -3
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +87 -3
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.tsx.snap +2 -0
- package/src/Component/SideNavigation/side-navigation.css +3 -3
- package/src/Component/SideNavigation/side-navigation.twig +10 -3
- package/src/Component/Tabs/Components/TabDropMenu.tsx +7 -1
- package/src/Component/Tabs/Elements/Tabs.ts +13 -3
- package/src/Component/Tabs/Tabs.stories.ts +33 -12
- package/src/Component/Tabs/Tabs.stories.tsx +28 -14
- package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +3 -3
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -2
- package/src/Component/Translate/Elements/Translate.ts +76 -0
- package/src/Component/Translate/README.md +285 -0
- package/src/Component/Translate/Translate.stories.ts +87 -0
- package/src/Component/Translate/Translate.stories.tsx +77 -0
- package/src/Component/Translate/Translate.tsx +213 -0
- package/src/Component/Translate/__snapshots__/Translate.stories.ts.snap +18 -0
- package/src/Component/Translate/__snapshots__/Translate.stories.tsx.snap +3 -0
- package/src/Component/Translate/languages.ts +39 -0
- package/src/Component/Translate/translate.css +62 -0
- package/src/Component/Translate/translate.entry.js +1 -0
- package/src/Component/Translate/translate.twig +44 -0
- package/src/Form/Autocomplete/Autocomplete.stories.tsx +2 -1
- package/src/Form/FeedbackForm/Elements/FeedbackForm.ts +122 -0
- package/src/Form/FeedbackForm/FeedbackForm.stories.ts +99 -0
- package/src/Form/FeedbackForm/FeedbackForm.stories.tsx +73 -0
- package/src/Form/FeedbackForm/FeedbackForm.tsx +196 -0
- package/src/Form/FeedbackForm/README.md +233 -0
- package/src/Form/FeedbackForm/__snapshots__/FeedbackForm.stories.ts.snap +125 -0
- package/src/Form/FeedbackForm/__snapshots__/FeedbackForm.stories.tsx.snap +5 -0
- package/src/Form/FeedbackForm/feedback-form.css +74 -0
- package/src/Form/FeedbackForm/feedback-form.entry.js +1 -0
- package/src/Form/FeedbackForm/feedback-form.twig +80 -0
- package/src/Form/form.css +17 -19
- package/src/Introduction.mdx +1 -1
- package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +3 -3
- package/src/Layout/Header/Components/GlobalToggle.tsx +1 -1
- package/src/Layout/Header/Header.stories.ts +53 -48
- package/src/Layout/Header/Header.stories.tsx +35 -22
- package/src/Layout/Header/Header.tsx +2 -2
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +18 -14
- package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -2
- package/src/Layout/Header/_toggles.css +7 -7
- package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +1 -1
- package/src/Layout/Sidebar/sidebar.css +10 -3
- package/src/Utility/Elements/google-translate-widget.ts +293 -0
- package/src/Utility/global.d.ts +4 -0
- package/src/Utility/utilities.ts +2 -0
- package/src/_custom-media.css +2 -0
- package/src/elements.ts +3 -0
- package/src/enums.ts +2 -0
- package/src/react.ts +3 -0
- package/src/tokens.js +1 -0
- package/dist/build/chunks/Accordion-GN0sME4W.js +0 -1
- package/dist/build/chunks/AccordionGroup-Bzqp5__q.js +0 -1
- package/dist/build/chunks/AccordionMobile-DG5jSe8Q.js +0 -1
- package/dist/build/chunks/Autocomplete-B4RtkAyh.js +0 -1
- package/dist/build/chunks/ClosableAlert-DEhj8Nxm.js +0 -1
- package/dist/build/chunks/CookieConsent-BkCMRVST.js +0 -1
- package/dist/build/chunks/Dialog-Haahn-Yn.js +0 -1
- package/dist/build/chunks/DropMenu-1baQc8Yc.js +0 -1
- package/dist/build/chunks/Gallery-D8NGXy2Q.js +0 -1
- package/dist/build/chunks/GlobalToggle-B52fdBQu.js +0 -1
- package/dist/build/chunks/InPageNavigation-Dyn2TR-N.js +0 -1
- package/dist/build/chunks/Navigation-hOrfLq7h.js +0 -1
- package/dist/build/chunks/Popover-Cxg-s5Jn.js +0 -1
- package/dist/build/chunks/Sticky-BGCuuEJK.js +0 -1
- package/dist/build/chunks/Tabs-DYy1YTdU.js +0 -15
- package/dist/build/chunks/cookie-compliance-Bbm-0vpj.js +0 -1
- package/dist/build/chunks/enums-DLV_1NAf.js +0 -1
- package/dist/build/chunks/polyfills-C7pRt54M.js +0 -1
- package/dist/build/chunks/utilities-_Bq3TxAQ.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as e } from "./Popover-CiTAftNU.js";
|
|
2
|
+
//#region src/Component/DropMenu/Elements/DropMenu.ts
|
|
3
|
+
var t = class extends e {
|
|
4
|
+
controller;
|
|
5
|
+
closeOnClick;
|
|
6
|
+
constructor() {
|
|
7
|
+
super(), this.controller = new AbortController();
|
|
8
|
+
}
|
|
9
|
+
async connectedCallback() {
|
|
10
|
+
if (await super.connectedCallback(), !this.container || !this.trigger) return;
|
|
11
|
+
this.closeOnClick = this.hasAttribute("closeonclick");
|
|
12
|
+
let { signal: e } = this.controller;
|
|
13
|
+
document.addEventListener("click", (e) => {
|
|
14
|
+
let t = e.target, n = t.closest("a, button");
|
|
15
|
+
(t === this.container || [...this.items].includes(n)) && (this.handleSelect(e), e.preventDefault());
|
|
16
|
+
}, { signal: e }), document.addEventListener("keydown", (e) => {
|
|
17
|
+
let { target: t, key: n } = e, r = [...this.items];
|
|
18
|
+
if (t === this.container || r.includes(t)) switch (n) {
|
|
19
|
+
case "Enter":
|
|
20
|
+
e.preventDefault(), this.handleSelect(e);
|
|
21
|
+
break;
|
|
22
|
+
case "ArrowDown":
|
|
23
|
+
case "ArrowRight":
|
|
24
|
+
e.preventDefault(), this.moveFocus(t, 1);
|
|
25
|
+
break;
|
|
26
|
+
case "ArrowUp":
|
|
27
|
+
case "ArrowLeft":
|
|
28
|
+
e.preventDefault(), this.moveFocus(t, -1);
|
|
29
|
+
break;
|
|
30
|
+
case "Home":
|
|
31
|
+
e.preventDefault(), r[0].focus();
|
|
32
|
+
break;
|
|
33
|
+
case "End": e.preventDefault(), r.at(-1).focus();
|
|
34
|
+
}
|
|
35
|
+
}, { signal: e });
|
|
36
|
+
}
|
|
37
|
+
disconnectedCallback() {
|
|
38
|
+
this.controller.abort();
|
|
39
|
+
}
|
|
40
|
+
handleSelect = (e) => {
|
|
41
|
+
let t = e.target;
|
|
42
|
+
this.items?.forEach((e) => {
|
|
43
|
+
e instanceof HTMLButtonElement && e.setAttribute("aria-checked", String(e === t));
|
|
44
|
+
});
|
|
45
|
+
let n = new CustomEvent("drop-menu-select", {
|
|
46
|
+
bubbles: !0,
|
|
47
|
+
cancelable: !0,
|
|
48
|
+
detail: {
|
|
49
|
+
event: e,
|
|
50
|
+
target: t
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.container.dispatchEvent(n), this.closeOnClick && this.container.togglePopover();
|
|
54
|
+
};
|
|
55
|
+
moveFocus = (e, t) => {
|
|
56
|
+
let n = [...this.items], r = n.indexOf(e);
|
|
57
|
+
if (r === -1) return;
|
|
58
|
+
let i = r;
|
|
59
|
+
for (let e = 0; e < n.length && (i = (i + t + n.length) % n.length, n[i].getAttribute("tabindex") === "-1"); e += 1);
|
|
60
|
+
n[i]?.focus();
|
|
61
|
+
};
|
|
62
|
+
get items() {
|
|
63
|
+
return this.container.querySelectorAll("a, button");
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
customElements.get("mx-dropmenu") || customElements.define("mx-dropmenu", t);
|
|
67
|
+
//#endregion
|
|
68
|
+
export { t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { n as e } from "./cookie-compliance-CG6x-TcV.js";
|
|
2
|
+
import "./utilities-B9mNRs7V.js";
|
|
3
|
+
//#region src/Form/FeedbackForm/Elements/FeedbackForm.ts
|
|
4
|
+
var t = class extends HTMLElement {
|
|
5
|
+
internals_;
|
|
6
|
+
controller;
|
|
7
|
+
revealed;
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this.internals_ = this.attachInternals(), this.controller = new AbortController(), this.revealed = !1;
|
|
10
|
+
}
|
|
11
|
+
static get observedAttributes() {
|
|
12
|
+
return ["pending"];
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
let { signal: e } = this.controller;
|
|
16
|
+
this.classList.add("is-enhanced"), this.form?.setAttribute("novalidate", ""), this.querySelectorAll("input[type=\"radio\"]").forEach((t) => {
|
|
17
|
+
t.addEventListener("change", this.handleRatingChange, { signal: e });
|
|
18
|
+
}), this.form?.addEventListener("submit", this.handleSubmit, { signal: e });
|
|
19
|
+
}
|
|
20
|
+
disconnectedCallback() {
|
|
21
|
+
this.controller.abort();
|
|
22
|
+
}
|
|
23
|
+
attributeChangedCallback(e) {
|
|
24
|
+
if (e !== "pending") return;
|
|
25
|
+
let t = this.hasAttribute("pending");
|
|
26
|
+
this.internals_.states[t ? "add" : "delete"]("pending"), this.submitButton?.toggleAttribute("disabled", t), this.submitButton?.setAttribute("aria-busy", String(t));
|
|
27
|
+
}
|
|
28
|
+
handleRatingChange = () => {
|
|
29
|
+
this.revealed || (this.revealed = !0, this.comment?.focus());
|
|
30
|
+
};
|
|
31
|
+
handleSubmit = (t) => {
|
|
32
|
+
let n = this.comment;
|
|
33
|
+
if (n?.required && !e.notEmpty(n.value)) {
|
|
34
|
+
t.preventDefault(), n.setAttribute("aria-invalid", "true"), this.status?.removeAttribute("hidden"), n.focus();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
n?.removeAttribute("aria-invalid"), this.status?.setAttribute("hidden", "");
|
|
38
|
+
let r = this.querySelector("input[type=\"radio\"]:checked")?.value ?? null, i = new CustomEvent("mx-feedback-form-submit", {
|
|
39
|
+
bubbles: !0,
|
|
40
|
+
cancelable: !0,
|
|
41
|
+
detail: {
|
|
42
|
+
rating: r,
|
|
43
|
+
comment: n?.value ?? "",
|
|
44
|
+
form: this.form
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.dispatchEvent(i) || t.preventDefault();
|
|
48
|
+
};
|
|
49
|
+
get form() {
|
|
50
|
+
return this.querySelector("form");
|
|
51
|
+
}
|
|
52
|
+
get comment() {
|
|
53
|
+
return this.querySelector(".mx-feedback-form__reveal textarea");
|
|
54
|
+
}
|
|
55
|
+
get status() {
|
|
56
|
+
return this.querySelector(".mx-feedback-form__reveal [role=\"alert\"]");
|
|
57
|
+
}
|
|
58
|
+
get submitButton() {
|
|
59
|
+
return this.querySelector(".mx-form-actions button");
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
customElements.get("mx-feedback-form") || customElements.define("mx-feedback-form", t);
|
|
63
|
+
//#endregion
|
|
64
|
+
export { t };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { n as e } from "./cookie-compliance-CG6x-TcV.js";
|
|
2
|
+
import { t } from "./utilities-B9mNRs7V.js";
|
|
3
|
+
import { t as n } from "./Dialog-DoYcGqhW.js";
|
|
4
|
+
//#region src/Component/Carousel/Elements/Carousel.ts
|
|
5
|
+
var r = class extends HTMLElement {
|
|
6
|
+
internals_;
|
|
7
|
+
controller;
|
|
8
|
+
debounced;
|
|
9
|
+
loop;
|
|
10
|
+
paginationType;
|
|
11
|
+
activePage;
|
|
12
|
+
itemMap;
|
|
13
|
+
iO;
|
|
14
|
+
rO;
|
|
15
|
+
mO;
|
|
16
|
+
ioTimeout;
|
|
17
|
+
constructor() {
|
|
18
|
+
super(), this.internals_ = this.attachInternals(), this.controller = new AbortController();
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
if (!this.track) return;
|
|
22
|
+
this.buttons && (this.buttons.hidden = !1), this.activePage = 0, this.track.scrollLeft = 0, this.debounced = null, this.loop = this.hasAttribute("loop");
|
|
23
|
+
let { signal: e } = this.controller;
|
|
24
|
+
this.prev && (this.prev.disabled = !0, this.prev.addEventListener("click", () => this.handleNavigation(this.activePage - 1), { signal: e })), this.next && this.next.addEventListener("click", () => this.handleNavigation(this.activePage + 1), { signal: e }), this.track.addEventListener("scroll", this.handleScroll, { signal: e }), this.pagination && (this.paginationType = this.pagination.getAttribute("data-pagination"), this.pagination.addEventListener("click", this.handlePagination, { signal: e })), Array.from(this.track.children).forEach((e, t) => {
|
|
25
|
+
e.setAttribute("data-index", String(t));
|
|
26
|
+
});
|
|
27
|
+
let t = this.track.querySelectorAll("[data-index]");
|
|
28
|
+
this.itemMap = /* @__PURE__ */ new Map(), this.iO = new IntersectionObserver((e) => {
|
|
29
|
+
e.forEach(({ target: e, intersectionRatio: t }) => {
|
|
30
|
+
let n = e;
|
|
31
|
+
t > .5 ? (n.removeAttribute("inert"), n.setAttribute("aria-hidden", "false"), this.itemMap.set(n, !0)) : (n.setAttribute("inert", ""), n.setAttribute("aria-hidden", "true"), this.itemMap.set(n, !1));
|
|
32
|
+
});
|
|
33
|
+
}, {
|
|
34
|
+
root: this.track,
|
|
35
|
+
threshold: .5
|
|
36
|
+
}), t.forEach((e) => this.iO.observe(e)), this.rO = new ResizeObserver((e) => {
|
|
37
|
+
e.forEach(() => this.handleOverflow());
|
|
38
|
+
}), this.rO.observe(this.track), this.mO = new MutationObserver((e) => {
|
|
39
|
+
e.forEach(() => this.handleOverflow());
|
|
40
|
+
}), this.mO.observe(this.track, { childList: !0 });
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this.controller.abort(), this.mO.disconnect(), this.iO.disconnect(), this.rO.disconnect(), clearTimeout(this.debounced), clearTimeout(this.ioTimeout);
|
|
44
|
+
}
|
|
45
|
+
handleNavigation = (e, t = "arrow") => {
|
|
46
|
+
let n = e > this.activePage, r = this.loop && this.next.hasAttribute("data-restart");
|
|
47
|
+
if (e === 0 || r && n && t === "arrow") {
|
|
48
|
+
this.activePage = 0, this.items[0].scrollIntoView({
|
|
49
|
+
inline: "start",
|
|
50
|
+
block: "nearest"
|
|
51
|
+
}), this.next.removeAttribute("data-restart");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.activePage = e, this.items[this.visibleCount * e].scrollIntoView({
|
|
55
|
+
inline: "start",
|
|
56
|
+
block: "nearest"
|
|
57
|
+
}), r && !n && this.next.removeAttribute("data-restart");
|
|
58
|
+
let i = new CustomEvent("carousel-slide", {
|
|
59
|
+
bubbles: !0,
|
|
60
|
+
cancelable: !0,
|
|
61
|
+
detail: {
|
|
62
|
+
page: this.activePage,
|
|
63
|
+
type: t
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.dispatchEvent(i);
|
|
67
|
+
};
|
|
68
|
+
handleDisabled = () => {
|
|
69
|
+
let e = !1;
|
|
70
|
+
if (this.prev && (this.prev.disabled = this.track.scrollLeft < 200), (this.next || this.pagination) && (e = Math.round(this.track.scrollLeft) >= Math.round(this.track.scrollWidth - this.track.offsetWidth)), this.next && (this.loop ? e && this.next.setAttribute("data-restart", "") : this.next.disabled = e), this.pagination) {
|
|
71
|
+
let t = Math.round(this.track.offsetLeft + this.track.scrollLeft);
|
|
72
|
+
if (e) this.activePage = this.pageStartItems.length - 1;
|
|
73
|
+
else {
|
|
74
|
+
let e = 0, n = Infinity;
|
|
75
|
+
this.pageStartItems.forEach((r, i) => {
|
|
76
|
+
let a = Math.abs(Math.round(r.offsetLeft) - t);
|
|
77
|
+
a < n && (n = a, e = i);
|
|
78
|
+
}), this.activePage = e;
|
|
79
|
+
}
|
|
80
|
+
this.pagination.querySelectorAll("button").forEach((e) => {
|
|
81
|
+
let t = e.getAttribute("data-index");
|
|
82
|
+
if (!t) return;
|
|
83
|
+
let n = parseInt(t, 10) === this.activePage;
|
|
84
|
+
e.disabled = n, n ? e.setAttribute("aria-current", "page") : e.removeAttribute("aria-current");
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
handleScroll = () => {
|
|
89
|
+
clearTimeout(this.debounced), this.debounced = setTimeout(this.handleDisabled, this.pagination ? 100 : 200);
|
|
90
|
+
};
|
|
91
|
+
handleOverflow = () => {
|
|
92
|
+
let { scrollWidth: e, clientWidth: t } = this.track, n = e > t;
|
|
93
|
+
this.track.classList.toggle("overflowing", n), n ? (this.pagination && (this.ioTimeout = setTimeout(this.buildPagination, 200)), this.track.setAttribute("tabindex", "0")) : this.track.removeAttribute("tabindex");
|
|
94
|
+
};
|
|
95
|
+
buildPagination = () => {
|
|
96
|
+
if (!this.pagination.hidden) {
|
|
97
|
+
let e = this.pagination.querySelectorAll("button");
|
|
98
|
+
if (e.length === this.pageStartItems.length) return;
|
|
99
|
+
e.forEach((e) => e.remove());
|
|
100
|
+
}
|
|
101
|
+
let e = Array.from({ length: this.pageStartItems.length }).fill(null);
|
|
102
|
+
if (e.length <= 0) return;
|
|
103
|
+
e.forEach((n, r) => {
|
|
104
|
+
let i = r + 1, a = t(`<button type="button" data-index="${r}" aria-label="Page ${i}">${i}</button>`);
|
|
105
|
+
this.pagination.append(a), e[r] = a;
|
|
106
|
+
});
|
|
107
|
+
let n = e[0];
|
|
108
|
+
n.disabled = !0, n.setAttribute("aria-current", "page"), this.pagination.hidden = !1;
|
|
109
|
+
};
|
|
110
|
+
handlePagination = (t) => {
|
|
111
|
+
let n = t.target.getAttribute("data-index");
|
|
112
|
+
if (!n || !e.integer(n, 0)) return;
|
|
113
|
+
let r = parseInt(n, 10);
|
|
114
|
+
this.handleNavigation(r, "pagination");
|
|
115
|
+
};
|
|
116
|
+
get track() {
|
|
117
|
+
let e = this.querySelector("[data-track]");
|
|
118
|
+
if (!e) throw Error(`${this.localName} must contain an element with [data-track].`);
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
get buttons() {
|
|
122
|
+
return this.querySelector("[data-buttons]");
|
|
123
|
+
}
|
|
124
|
+
get prev() {
|
|
125
|
+
return this.buttons?.querySelector(".mx-carousel__prev");
|
|
126
|
+
}
|
|
127
|
+
get next() {
|
|
128
|
+
return this.buttons?.querySelector(".mx-carousel__next");
|
|
129
|
+
}
|
|
130
|
+
get pagination() {
|
|
131
|
+
return this.querySelector("[data-pagination]");
|
|
132
|
+
}
|
|
133
|
+
get items() {
|
|
134
|
+
return [...this.itemMap.keys()];
|
|
135
|
+
}
|
|
136
|
+
get visibleCount() {
|
|
137
|
+
return [...this.itemMap.values()].filter((e) => e).length;
|
|
138
|
+
}
|
|
139
|
+
get pageStartItems() {
|
|
140
|
+
return [...this.items].filter((e, t) => t % this.visibleCount === 0);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
customElements.get("mx-carousel") || customElements.define("mx-carousel", r);
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/Component/Gallery/Elements/Gallery.ts
|
|
146
|
+
var i = class extends n {
|
|
147
|
+
connectedCallback() {
|
|
148
|
+
if (super.connectedCallback(), !this.dialog) return;
|
|
149
|
+
let { signal: e } = this.controller;
|
|
150
|
+
this.openBtns?.forEach((t) => t.addEventListener("click", () => this.scrollToTrigger(t), { signal: e }));
|
|
151
|
+
}
|
|
152
|
+
scrollToTrigger = (e) => {
|
|
153
|
+
let t = e.dataset.galleryIndex ?? "0", n = this.carousel?.track?.querySelector(`[data-index="${t}"]`);
|
|
154
|
+
n && (n.removeAttribute("inert"), n.scrollIntoView({
|
|
155
|
+
inline: "start",
|
|
156
|
+
block: "nearest"
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
get carousel() {
|
|
160
|
+
return this.querySelector("mx-carousel");
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
customElements.get("mx-gallery") || customElements.define("mx-gallery", i);
|
|
164
|
+
//#endregion
|
|
165
|
+
export { r as n, i as t };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { u as e } from "./utilities-B9mNRs7V.js";
|
|
2
|
+
import { createFocusTrap as t } from "focus-trap";
|
|
3
|
+
//#region src/Layout/Header/Elements/GlobalToggle.ts
|
|
4
|
+
var n = class extends HTMLElement {
|
|
5
|
+
internals_;
|
|
6
|
+
controller;
|
|
7
|
+
widget;
|
|
8
|
+
focusTrap;
|
|
9
|
+
controls;
|
|
10
|
+
mq;
|
|
11
|
+
triggerText;
|
|
12
|
+
isOpen = !1;
|
|
13
|
+
closeIconClass = "mx-icon--close";
|
|
14
|
+
menuIconClass = "mx-icon--menu";
|
|
15
|
+
searchIconClass = "mx-icon--search";
|
|
16
|
+
backgroundClass = "mx-background--primary";
|
|
17
|
+
scrollLockClass = "body--scroll-lock";
|
|
18
|
+
isSearch;
|
|
19
|
+
hideOther = !0;
|
|
20
|
+
otherTrigger;
|
|
21
|
+
rafId;
|
|
22
|
+
focusTrapTimeout;
|
|
23
|
+
constructor() {
|
|
24
|
+
super(), this.internals_ = this.attachInternals(), this.controller = new AbortController(), this.mq = this.getAttribute("mq") || "(max-width: 720px)";
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
if (!this.trigger || !this.target) return;
|
|
28
|
+
this.trigger.getAttribute("hideOther") === "false" && (this.hideOther = !1), this.isSearch = this.controls.includes("search"), this.otherTrigger = document.querySelector(this.isSearch ? `.${this.menuIconClass}` : `.${this.searchIconClass}`), this.widget = new e(this.trigger, this.target), this.widget.init(), this.focusTrap = t(this.target, {
|
|
29
|
+
escapeDeactivates: !1,
|
|
30
|
+
setReturnFocus: this.trigger,
|
|
31
|
+
allowOutsideClick: !0,
|
|
32
|
+
onActivate: () => document.body.classList.add(this.scrollLockClass),
|
|
33
|
+
onDeactivate: () => document.body.classList.remove(this.scrollLockClass),
|
|
34
|
+
checkCanFocusTrap: ([e]) => new Promise((t) => {
|
|
35
|
+
this.focusTrapTimeout = setTimeout(() => {
|
|
36
|
+
this.rafId &&= (cancelAnimationFrame(this.rafId), null), t();
|
|
37
|
+
}, 2e3);
|
|
38
|
+
let n = () => {
|
|
39
|
+
getComputedStyle(e).visibility === "hidden" ? this.rafId = requestAnimationFrame(n) : (this.focusTrapTimeout &&= (clearTimeout(this.focusTrapTimeout), null), this.rafId = null, t());
|
|
40
|
+
};
|
|
41
|
+
this.rafId = requestAnimationFrame(n);
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
let { signal: n } = this.controller;
|
|
45
|
+
this.handleBreakpoint(this.breakpoint), this.breakpoint.addEventListener("change", this.handleBreakpoint, { signal: n }), document.addEventListener("keydown", this.handleKeyDown, { signal: n });
|
|
46
|
+
}
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
this.widget.detach(), this.controller.abort(), this.rafId &&= (cancelAnimationFrame(this.rafId), null), this.focusTrapTimeout &&= (clearTimeout(this.focusTrapTimeout), null), this.focusTrap.deactivate(), document.body.classList.remove(this.scrollLockClass);
|
|
49
|
+
}
|
|
50
|
+
handleBreakpoint = ({ matches: e }) => {
|
|
51
|
+
if (!this.trigger) return;
|
|
52
|
+
let { signal: t } = this.controller;
|
|
53
|
+
e ? (this.widget.attach(), this.target.setAttribute("inert", ""), this.trigger.addEventListener("disclosure-toggle", this.handleDisclosure, { signal: t })) : (this.widget.detach(), this.target.removeAttribute("inert"), document.body.classList.remove(this.scrollLockClass), this.trigger.removeEventListener("disclosure-toggle", this.handleDisclosure), this.focusTrap.deactivate());
|
|
54
|
+
};
|
|
55
|
+
handleDisclosure = async ({ detail: e }) => {
|
|
56
|
+
let { isOpen: t } = e, n = t ? "Open" : "Close", r = t ? "Close" : "Open";
|
|
57
|
+
if (this.trigger.textContent = this.triggerText.replace(n, r), t) try {
|
|
58
|
+
await this.focusTrap.activate();
|
|
59
|
+
} catch {}
|
|
60
|
+
else this.focusTrap.deactivate();
|
|
61
|
+
t && this.hideOther && this.otherTrigger && this.otherTrigger.getAttribute("aria-expanded") === "true" && this.otherTrigger.click(), this.trigger.classList.toggle(this.isSearch ? this.searchIconClass : this.menuIconClass), this.trigger.classList.toggle(this.closeIconClass), this.target.classList.toggle(this.backgroundClass), this.trigger.removeAttribute("no-focus"), this.isOpen = t;
|
|
62
|
+
};
|
|
63
|
+
handleKeyDown = (e) => {
|
|
64
|
+
this.isOpen && e.key === "Escape" && this.widget.handleToggle();
|
|
65
|
+
};
|
|
66
|
+
get trigger() {
|
|
67
|
+
let e = this.querySelector(":scope > button"), t = e.getAttribute("aria-controls");
|
|
68
|
+
if (!e || !t) throw Error(`${this.localName} must contain a <button aria-controls="element-to-trigger"> element.`);
|
|
69
|
+
return e.removeAttribute("disabled"), this.controls = t, this.triggerText = e.textContent, e;
|
|
70
|
+
}
|
|
71
|
+
get target() {
|
|
72
|
+
let e = document.querySelector(`div[id="${this.controls}"]`);
|
|
73
|
+
if (!e) throw Error(`${this.localName} must contain a target <div id="${this.controls}">.`);
|
|
74
|
+
return e.classList.remove("global-nav-up-only"), e;
|
|
75
|
+
}
|
|
76
|
+
get breakpoint() {
|
|
77
|
+
return window.matchMedia(this.mq);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
customElements.get("mx-global-toggle") || customElements.define("mx-global-toggle", n);
|
|
81
|
+
//#endregion
|
|
82
|
+
export { n as t };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { s as e, t } from "./utilities-B9mNRs7V.js";
|
|
2
|
+
//#region src/Component/InPageNavigation/Elements/InPageNavigation.ts
|
|
3
|
+
var n = class extends HTMLElement {
|
|
4
|
+
internals_;
|
|
5
|
+
controller;
|
|
6
|
+
headingLevels;
|
|
7
|
+
title;
|
|
8
|
+
titleClass = "is-excluded mx-heading--m";
|
|
9
|
+
items;
|
|
10
|
+
active;
|
|
11
|
+
constructor() {
|
|
12
|
+
super(), this.internals_ = this.attachInternals(), this.controller = new AbortController(), this.headingLevels = this.dataset?.levels || "h2", this.title = this.dataset?.title || "On this page", this.items = [];
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
if (!this.menu || !this.headings) return;
|
|
16
|
+
if (this.links.length) this.links.forEach((e) => {
|
|
17
|
+
let t = this.container.querySelector(e.hash);
|
|
18
|
+
t && this.items.push({
|
|
19
|
+
link: e,
|
|
20
|
+
heading: t
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
else {
|
|
24
|
+
let e = t(`<h2 class="${this.titleClass}">${this.title}</h2>`);
|
|
25
|
+
this.nav.insertBefore(e, this.menu);
|
|
26
|
+
let n = {};
|
|
27
|
+
this.headings.forEach((e) => {
|
|
28
|
+
let t = this.generateListItem(e), r = this.generateAnchor(e, n);
|
|
29
|
+
this.items.push({
|
|
30
|
+
link: r,
|
|
31
|
+
heading: e
|
|
32
|
+
}), t.appendChild(r), this.menu?.appendChild(t);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
let { signal: e } = this.controller;
|
|
36
|
+
this.menu.addEventListener("click", (e) => {
|
|
37
|
+
let { target: t } = e;
|
|
38
|
+
t instanceof HTMLAnchorElement && this.handleClick(t);
|
|
39
|
+
}, { signal: e });
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
this.menu && this.headings && (this.menu.textContent = "", this.items = [], this.controller.abort());
|
|
43
|
+
}
|
|
44
|
+
handleClick = (e) => {
|
|
45
|
+
this.active = this.items.find((t) => t.link === e), this.links && this.active && (this.links.forEach((e) => e.classList.remove("is-active")), this.active.link.classList.add("is-active"));
|
|
46
|
+
};
|
|
47
|
+
get menu() {
|
|
48
|
+
let e = this.querySelector("ul, ol");
|
|
49
|
+
if (e) return e;
|
|
50
|
+
if (!this.nav) throw Error(`${this.localName} must contain a <nav> element.`);
|
|
51
|
+
if (this.items?.length === 0 && this.headings?.length === 0) return null;
|
|
52
|
+
let t = document.createElement("ul");
|
|
53
|
+
return this.nav.appendChild(t), t;
|
|
54
|
+
}
|
|
55
|
+
get nav() {
|
|
56
|
+
return this.querySelector("nav");
|
|
57
|
+
}
|
|
58
|
+
get container() {
|
|
59
|
+
let e = this.getAttribute("data-content");
|
|
60
|
+
if (!e) throw Error(`${this.localName} must have a [data-content] attribute that contains the content selector.`);
|
|
61
|
+
return this.closest(e) || this.parentElement.querySelector(e) || document.querySelector(e);
|
|
62
|
+
}
|
|
63
|
+
get headings() {
|
|
64
|
+
return this.container?.querySelectorAll(`:is(${this.headingLevels}):not(.is-excluded)`);
|
|
65
|
+
}
|
|
66
|
+
get links() {
|
|
67
|
+
return this.menu?.querySelectorAll("a");
|
|
68
|
+
}
|
|
69
|
+
generatedId(t, n) {
|
|
70
|
+
let r = t?.textContent?.trim();
|
|
71
|
+
if (!r) return "";
|
|
72
|
+
let i = e(r), a = n[i] ?? 0;
|
|
73
|
+
return n[i] = a + 1, a > 0 ? `${i}-${a}` : i;
|
|
74
|
+
}
|
|
75
|
+
generateAnchor(e, n) {
|
|
76
|
+
let { textContent: r, id: i } = e, a = e.getAttribute("data-in-page-navigation-title") || r, o = i || this.generatedId(e, n);
|
|
77
|
+
return i || (e.id = o), t(`<a href="#${o}"><span class="mx-icon mx-icon--chevron-right"></span><span>${a}</span></a>`);
|
|
78
|
+
}
|
|
79
|
+
generateListItem(e) {
|
|
80
|
+
let { tagName: n } = e;
|
|
81
|
+
return t(`<li class="mx-in-page-navigation__level--${n.toLowerCase()}"></li>`);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
customElements.get("mx-in-page-navigation") || customElements.define("mx-in-page-navigation", n);
|
|
85
|
+
//#endregion
|
|
86
|
+
export { n as t };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { s as e, u as t } from "./utilities-B9mNRs7V.js";
|
|
2
|
+
//#region src/Utility/Elements/keyboard.ts
|
|
3
|
+
var n = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
window.Mixtape = window.Mixtape || {}, window.Mixtape.Popups = window.Mixtape.Popups || [], window.Mixtape.Menu = window.Mixtape.Menu || {};
|
|
6
|
+
}
|
|
7
|
+
attachPopup = (e, t) => {
|
|
8
|
+
window.Mixtape.Popups.push({
|
|
9
|
+
id: e,
|
|
10
|
+
closefn: t
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
detachPopup = (e) => {
|
|
14
|
+
window.Mixtape.Popups = window.Mixtape.Popups.filter((t) => t.id !== e);
|
|
15
|
+
};
|
|
16
|
+
attachMenu = (e, t) => {
|
|
17
|
+
window.Mixtape.Menu = {
|
|
18
|
+
context: e,
|
|
19
|
+
items: t
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
detachMenu = () => {
|
|
23
|
+
window.Mixtape.Menu = null;
|
|
24
|
+
};
|
|
25
|
+
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;
|
|
26
|
+
moveFocus = (e, t = !1) => {
|
|
27
|
+
if (!window.Mixtape.Menu.items) return;
|
|
28
|
+
let n = 0;
|
|
29
|
+
window.Mixtape.Menu.items.forEach((t, r) => {
|
|
30
|
+
t === e && (n = r);
|
|
31
|
+
});
|
|
32
|
+
let r = this.getNextFocusableMenuItem(n, t), i = window.Mixtape.Menu.items[r].getAttribute("tabindex");
|
|
33
|
+
if (i !== "-1") window.Mixtape.Menu.items[r].focus();
|
|
34
|
+
else {
|
|
35
|
+
for (; i === "-1";) r = this.getNextFocusableMenuItem(r, t), i = window.Mixtape.Menu.items[r].getAttribute("tabindex");
|
|
36
|
+
window.Mixtape.Menu.items[r].focus();
|
|
37
|
+
}
|
|
38
|
+
window.Mixtape.Menu.active = r;
|
|
39
|
+
};
|
|
40
|
+
handleGlobalClick = ({ target: e }) => {
|
|
41
|
+
let t = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null;
|
|
42
|
+
if (t && t.id) {
|
|
43
|
+
let n = document.querySelector(`#${t.id}`).parentElement;
|
|
44
|
+
if (n && (e === n || n?.contains(e))) return;
|
|
45
|
+
t.closefn();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
handleGlobalKeydown = (e) => {
|
|
49
|
+
let t = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null, n = e.target;
|
|
50
|
+
switch (e.key) {
|
|
51
|
+
case "Escape":
|
|
52
|
+
t && t.closefn();
|
|
53
|
+
break;
|
|
54
|
+
case "ArrowDown":
|
|
55
|
+
case "ArrowRight":
|
|
56
|
+
window.Mixtape.Menu?.items && (e.preventDefault(), this.moveFocus(n));
|
|
57
|
+
break;
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
case "ArrowLeft": window.Mixtape.Menu?.items && (e.preventDefault(), this.moveFocus(n, !0));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
attachEventListeners = (e) => {
|
|
63
|
+
window.addEventListener("click", this.handleGlobalClick, { signal: e }), window.addEventListener("keydown", this.handleGlobalKeydown, { signal: e });
|
|
64
|
+
};
|
|
65
|
+
}, r = class extends HTMLElement {
|
|
66
|
+
internals_;
|
|
67
|
+
controller;
|
|
68
|
+
keyboard;
|
|
69
|
+
subNavs;
|
|
70
|
+
flyout;
|
|
71
|
+
openActive;
|
|
72
|
+
mq;
|
|
73
|
+
constructor() {
|
|
74
|
+
super(), this.internals_ = this.attachInternals(), this.controller = new AbortController();
|
|
75
|
+
}
|
|
76
|
+
connectedCallback() {
|
|
77
|
+
this.flyout = this.hasAttribute("flyout"), this.openActive = this.hasAttribute("openActive");
|
|
78
|
+
let { signal: r } = this.controller;
|
|
79
|
+
this.keyboard = new n(), this.keyboard.attachEventListeners(r), this.addEventListener("focusin", () => {
|
|
80
|
+
this.keyboard.attachMenu(this, this.links);
|
|
81
|
+
}), this.addEventListener("focusout", () => {
|
|
82
|
+
this.keyboard.detachMenu();
|
|
83
|
+
}), this.lists.length && (this.subNavs = /* @__PURE__ */ new Map(), this.lists.forEach((n, r) => {
|
|
84
|
+
let i = n.closest("li"), a = i.querySelector(":scope > a"), o = e(`subnav-${r}-${a.textContent}`, 30), s = i.querySelector(":scope > button.mx-nav__toggle");
|
|
85
|
+
if (i && a && s) {
|
|
86
|
+
let e = `list-label-${o}`;
|
|
87
|
+
a.setAttribute("id", e), n.setAttribute("id", o), n.setAttribute("aria-labelledby", e);
|
|
88
|
+
let r = new t(s, n);
|
|
89
|
+
r.init(), this.subNavs.set(o, {
|
|
90
|
+
item: i,
|
|
91
|
+
trigger: s,
|
|
92
|
+
list: n,
|
|
93
|
+
link: a,
|
|
94
|
+
widget: r
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}), this.openActive && this.subNavs.size > 0 && this.handleOpenActive(), this.flyout && (this.mq = this.getAttribute("mq") || "(min-width: 720px)", this.handleBreakpoint(this.breakpoint), this.breakpoint.addEventListener("change", this.handleBreakpoint, { signal: r }), this.addEventListener("disclosure-toggle", this.handleDisclosure)));
|
|
98
|
+
}
|
|
99
|
+
disconnectedCallback() {
|
|
100
|
+
this.controller.abort(), this.subNavs?.forEach((e) => e.widget.detach());
|
|
101
|
+
}
|
|
102
|
+
handleDisclosure = ({ detail: e }) => {
|
|
103
|
+
let { isOpen: t, id: n } = e, { item: r } = this.subNavs.get(n);
|
|
104
|
+
r.classList.toggle("mx-nav--open"), t ? this.keyboard.attachPopup(n, this.handleCloseAny) : this.keyboard.detachPopup(n);
|
|
105
|
+
};
|
|
106
|
+
handleCloseAny = () => {
|
|
107
|
+
this.subNavs?.forEach(({ widget: e }) => {
|
|
108
|
+
e && e.isOpen && e.handleToggle();
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
handleOpenActive = () => {
|
|
112
|
+
this.subNavs?.forEach(({ widget: e, list: t, link: n }) => {
|
|
113
|
+
e && !e.isOpen && (n.hasAttribute("aria-current") || t.querySelector("[aria-current=page], .is-active")) && e.handleToggle();
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
handleFlyout = (e) => {
|
|
117
|
+
let t = e.target.closest("li");
|
|
118
|
+
if (!t) return;
|
|
119
|
+
let n = t.querySelector(":scope > ul");
|
|
120
|
+
n && this.subNavs?.forEach(({ widget: e, list: t }) => {
|
|
121
|
+
e && (e.isOpen && e.handleToggle(), t.id === n.id && e.handleToggle());
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
handleBreakpoint = ({ matches: e }) => {
|
|
125
|
+
let { signal: t } = this.controller;
|
|
126
|
+
e ? (this.addEventListener("mouseover", this.handleFlyout, { signal: t }), this.addEventListener("mouseleave", this.handleCloseAny, { signal: t })) : (this.removeEventListener("mouseover", this.handleFlyout), this.removeEventListener("mouseleave", this.handleCloseAny));
|
|
127
|
+
};
|
|
128
|
+
get links() {
|
|
129
|
+
let e = this.querySelectorAll("a");
|
|
130
|
+
if (!e.length) throw Error(`${this.localName} must contain links`);
|
|
131
|
+
return e;
|
|
132
|
+
}
|
|
133
|
+
get lists() {
|
|
134
|
+
return this.querySelectorAll("li > ul");
|
|
135
|
+
}
|
|
136
|
+
get breakpoint() {
|
|
137
|
+
return window.matchMedia(this.mq);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
customElements.get("mx-nav") || customElements.define("mx-nav", r);
|
|
141
|
+
//#endregion
|
|
142
|
+
export { n, r as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/Component/Popover/Elements/Popover.ts
|
|
2
|
+
var e = class extends HTMLElement {
|
|
3
|
+
internals_;
|
|
4
|
+
polyfills;
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.internals_ = this.attachInternals();
|
|
7
|
+
}
|
|
8
|
+
async connectedCallback() {
|
|
9
|
+
if (this.container && this.trigger && (!("anchorName" in document.documentElement.style) || !("popover" in HTMLElement.prototype))) {
|
|
10
|
+
let { default: e } = await import("./polyfills-D-qh1a_2.js");
|
|
11
|
+
this.polyfills = new e(this.container);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
this.polyfills?.destroy();
|
|
16
|
+
}
|
|
17
|
+
get container() {
|
|
18
|
+
let e = this.querySelector("[popover]");
|
|
19
|
+
if (!e) throw Error(`${this.localName} must contain a <div popover> element.`);
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
get trigger() {
|
|
23
|
+
let e = this.querySelector(`[popovertarget=${this.container?.id}]`);
|
|
24
|
+
if (!e) throw Error(`${this.localName} must contain a <button popovertarget="${this.container.id}">`);
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
customElements.get("mx-popover") || customElements.define("mx-popover", e);
|
|
29
|
+
//#endregion
|
|
30
|
+
export { e as t };
|