@pnx-mixtape/mxds 0.0.8 → 0.0.9
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/package.json +1 -1
- package/src/Atom/Button/button.twig +1 -1
- package/src/Atom/Image/image.twig +3 -3
- package/src/Atom/Link/link.twig +1 -1
- package/src/Atom/Media/media.twig +2 -2
- package/src/Atom/Video/video.twig +1 -1
- package/src/Component/Accordion/accordion-item.twig +1 -1
- package/src/Component/Accordion/accordion.twig +1 -1
- package/src/Component/Card/Card.stories.ts +26 -14
- package/src/Component/Card/__snapshots__/Card.stories.ts.snap +18 -12
- package/src/Component/Card/card.twig +5 -5
- package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +9 -45
- package/src/Component/ContentBlock/content-block.twig +2 -2
- package/src/Component/DropMenu/drop-menu.twig +1 -1
- package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.ts.snap +1 -3
- package/src/Component/GlobalAlert/global-alert.twig +3 -3
- package/src/Component/HeroBanner/HeroBanner.stories.ts +25 -11
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +18 -12
- package/src/Component/HeroBanner/hero-banner.twig +3 -3
- package/src/Component/LinkList/LinkList.stories.ts +20 -6
- package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +18 -12
- package/src/Component/LinkList/link-list.css +7 -35
- package/src/Component/LinkList/link-list.twig +1 -5
- package/src/Component/ListItem/list-item.twig +4 -4
- package/src/Component/Navigation/menu.twig +4 -4
- package/src/Component/Navigation/navigation.twig +1 -1
- package/src/Component/Pagination/pagination-item.twig +1 -1
- package/src/Component/Pagination/pagination.twig +2 -2
- package/src/Component/SideNavigation/side-navigation.twig +4 -4
- package/src/Component/Tabs/tabs.twig +1 -1
- package/src/Component/Tag/tag.css +4 -0
- package/src/Form/Checkbox/input-checkbox.twig +1 -1
- package/src/Form/Form/form.twig +2 -2
- package/src/Form/FormItem/form-item.twig +1 -1
- package/src/Form/Select/input-select.twig +1 -1
- package/src/Form/TextInput/input-text.twig +1 -1
- package/src/Form/Textarea/input-textarea.twig +1 -1
- package/src/Layout/Footer/Footer.stories.ts +0 -1
- package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +20 -40
- package/src/Layout/Footer/footer.twig +3 -3
- package/src/Layout/Header/Header.stories.ts +0 -1
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +5 -5
- package/src/Layout/Header/header-stacked.twig +13 -11
- package/src/Layout/Header/header.twig +12 -10
- package/src/Layout/Header/twig/logo.twig +1 -3
- package/src/Layout/Masthead/Masthead.stories.ts +10 -0
- package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +51 -3
- package/src/Layout/Masthead/masthead.css +23 -0
- package/src/Layout/Masthead/masthead.twig +9 -5
- package/src/Layout/Section/section.twig +1 -1
- package/src/Layout/Sidebar/sidebar.twig +5 -5
- package/dist/build/accordion.css +0 -108
- package/dist/build/accordion.entry.js +0 -139
- package/dist/build/accordion.entry.js.map +0 -1
- package/dist/build/base.css +0 -996
- package/dist/build/breadcrumb.css +0 -51
- package/dist/build/button.css +0 -132
- package/dist/build/callout.css +0 -11
- package/dist/build/card.css +0 -149
- package/dist/build/chunks/disclosure-widget-CQLPJ8Ta.js +0 -124
- package/dist/build/chunks/disclosure-widget-CQLPJ8Ta.js.map +0 -1
- package/dist/build/chunks/drop-menu.entry-BC6x9vst.js +0 -132
- package/dist/build/chunks/drop-menu.entry-BC6x9vst.js.map +0 -1
- package/dist/build/chunks/keyboard-C73DHu0c.js +0 -101
- package/dist/build/chunks/keyboard-C73DHu0c.js.map +0 -1
- package/dist/build/chunks/polyfills-CJ5uTmUJ.js +0 -749
- package/dist/build/chunks/polyfills-CJ5uTmUJ.js.map +0 -1
- package/dist/build/chunks/popover-wbPSyFRj.js +0 -654
- package/dist/build/chunks/popover-wbPSyFRj.js.map +0 -1
- package/dist/build/chunks/utilities-B4YZb689.js +0 -243
- package/dist/build/chunks/utilities-B4YZb689.js.map +0 -1
- package/dist/build/constants.css +0 -120
- package/dist/build/container-grid.css +0 -208
- package/dist/build/content-block.css +0 -36
- package/dist/build/dialog.css +0 -98
- package/dist/build/dialog.entry.js +0 -113
- package/dist/build/dialog.entry.js.map +0 -1
- package/dist/build/drop-menu.css +0 -78
- package/dist/build/drop-menu.entry.js +0 -2
- package/dist/build/drop-menu.entry.js.map +0 -1
- package/dist/build/drupal.css +0 -74
- package/dist/build/footer.css +0 -151
- package/dist/build/form.css +0 -517
- package/dist/build/global-alert.css +0 -60
- package/dist/build/global-alert.entry.js +0 -68
- package/dist/build/global-alert.entry.js.map +0 -1
- package/dist/build/grid.css +0 -200
- package/dist/build/header.css +0 -138
- package/dist/build/header.entry.js +0 -103
- package/dist/build/header.entry.js.map +0 -1
- package/dist/build/hero-banner.css +0 -62
- package/dist/build/icon.css +0 -399
- package/dist/build/in-page-alert.css +0 -94
- package/dist/build/in-page-navigation.css +0 -17
- package/dist/build/in-page-navigation.entry.js +0 -89
- package/dist/build/in-page-navigation.entry.js.map +0 -1
- package/dist/build/link-list.css +0 -72
- package/dist/build/list-item.css +0 -114
- package/dist/build/masthead.css +0 -30
- package/dist/build/navigation.css +0 -392
- package/dist/build/navigation.entry.js +0 -124
- package/dist/build/navigation.entry.js.map +0 -1
- package/dist/build/page.css +0 -80
- package/dist/build/pagination.css +0 -130
- package/dist/build/section.css +0 -163
- package/dist/build/side-navigation.css +0 -88
- package/dist/build/sidebar.css +0 -105
- package/dist/build/social-links.css +0 -20
- package/dist/build/steps.css +0 -118
- package/dist/build/steps.entry.js +0 -2
- package/dist/build/steps.entry.js.map +0 -1
- package/dist/build/sticky.css +0 -47
- package/dist/build/sticky.entry.js +0 -60
- package/dist/build/sticky.entry.js.map +0 -1
- package/dist/build/tabs.css +0 -109
- package/dist/build/tabs.entry.js +0 -202
- package/dist/build/tabs.entry.js.map +0 -1
- package/dist/build/tag.css +0 -67
- package/dist/build/tiles.css +0 -61
- package/dist/build/utilities.css +0 -178
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
class Keyboard {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.attachPopup = (id, closefn) => {
|
|
4
|
-
window.Mixtape.Popups.push({
|
|
5
|
-
id,
|
|
6
|
-
closefn
|
|
7
|
-
});
|
|
8
|
-
};
|
|
9
|
-
this.detachPopup = (id) => {
|
|
10
|
-
window.Mixtape.Popups = window.Mixtape.Popups.filter((item) => item.id !== id);
|
|
11
|
-
};
|
|
12
|
-
this.attachMenu = (context, items) => {
|
|
13
|
-
window.Mixtape.Menu = {
|
|
14
|
-
context,
|
|
15
|
-
items
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
this.detachMenu = () => {
|
|
19
|
-
window.Mixtape.Menu = null;
|
|
20
|
-
};
|
|
21
|
-
this.getNextFocusableMenuItem = (active, back = false) => {
|
|
22
|
-
if (!back) {
|
|
23
|
-
return window.Mixtape.Menu.items.length > active + 1 ? active + 1 : 0;
|
|
24
|
-
}
|
|
25
|
-
return active === 0 ? window.Mixtape.Menu.items.length - 1 : active - 1;
|
|
26
|
-
};
|
|
27
|
-
this.moveFocus = (target, back = false) => {
|
|
28
|
-
if (!window.Mixtape.Menu.items) return;
|
|
29
|
-
let active = 0;
|
|
30
|
-
window.Mixtape.Menu.items.forEach((element, index) => {
|
|
31
|
-
if (element === target) {
|
|
32
|
-
active = index;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
let focus = this.getNextFocusableMenuItem(active, back);
|
|
36
|
-
let tabbable = window.Mixtape.Menu.items[focus].getAttribute("tabindex");
|
|
37
|
-
if (tabbable !== "-1") {
|
|
38
|
-
window.Mixtape.Menu.items[focus].focus();
|
|
39
|
-
} else {
|
|
40
|
-
while (tabbable === "-1") {
|
|
41
|
-
focus = this.getNextFocusableMenuItem(focus, back);
|
|
42
|
-
tabbable = window.Mixtape.Menu.items[focus].getAttribute("tabindex");
|
|
43
|
-
}
|
|
44
|
-
window.Mixtape.Menu.items[focus].focus();
|
|
45
|
-
}
|
|
46
|
-
window.Mixtape.Menu.active = focus;
|
|
47
|
-
};
|
|
48
|
-
this.handleGlobalClick = ({ target }) => {
|
|
49
|
-
const activePopup = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null;
|
|
50
|
-
if (!activePopup) return;
|
|
51
|
-
if (activePopup.id) {
|
|
52
|
-
const popupEl = document.querySelector(
|
|
53
|
-
`#${activePopup.id}`
|
|
54
|
-
).parentElement;
|
|
55
|
-
if (popupEl && (target === popupEl || popupEl?.contains(target)))
|
|
56
|
-
return;
|
|
57
|
-
activePopup.closefn();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
this.handleGlobalKeydown = (event) => {
|
|
61
|
-
const activePopup = window.Mixtape.Popups ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1] : null;
|
|
62
|
-
const target = event.target;
|
|
63
|
-
switch (event.key) {
|
|
64
|
-
case "Escape":
|
|
65
|
-
if (activePopup) {
|
|
66
|
-
activePopup.closefn();
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
case "ArrowDown":
|
|
70
|
-
case "ArrowRight":
|
|
71
|
-
if (window.Mixtape.Menu?.items) {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
this.moveFocus(target);
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
case "ArrowUp":
|
|
77
|
-
case "ArrowLeft":
|
|
78
|
-
if (window.Mixtape.Menu?.items) {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
this.moveFocus(target, true);
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
this.attachEventListeners = (signal) => {
|
|
86
|
-
window.addEventListener("click", this.handleGlobalClick, {
|
|
87
|
-
signal
|
|
88
|
-
});
|
|
89
|
-
window.addEventListener("keydown", this.handleGlobalKeydown, {
|
|
90
|
-
signal
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
window.Mixtape = window.Mixtape || {};
|
|
94
|
-
window.Mixtape.Popups = window.Mixtape.Popups || [];
|
|
95
|
-
window.Mixtape.Menu = window.Mixtape.Menu || {};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
Keyboard as K
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=keyboard-C73DHu0c.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-C73DHu0c.js","sources":["../../../src/Utility/Elements/keyboard.ts"],"sourcesContent":["/**\n * Class for Keyboard navigation helper.\n */\n\nexport default class Keyboard {\n constructor() {\n window.Mixtape = window.Mixtape || {}\n window.Mixtape.Popups = window.Mixtape.Popups || []\n window.Mixtape.Menu = window.Mixtape.Menu || {}\n }\n\n attachPopup = (id: string, closefn: () => void): void => {\n window.Mixtape.Popups.push({\n id,\n closefn,\n })\n }\n\n detachPopup = (id: string): void => {\n window.Mixtape.Popups = window.Mixtape.Popups.filter(item => item.id !== id)\n }\n\n attachMenu = (\n context: HTMLElement,\n items: NodeListOf<HTMLAnchorElement | HTMLButtonElement>,\n ): void => {\n window.Mixtape.Menu = {\n context,\n items,\n }\n }\n\n detachMenu = (): void => {\n window.Mixtape.Menu = null\n }\n\n getNextFocusableMenuItem = (\n active: number,\n back: boolean = false,\n ): number => {\n if (!back) {\n // If moving forward, it's the active index + 1, or 0 if we are at the\n // end of the menu.\n return window.Mixtape.Menu.items.length > active + 1 ? active + 1 : 0\n }\n // If moving back, it's the active index - 1, or the menu length if we\n // are at the start of the menu.\n return active === 0 ? window.Mixtape.Menu.items.length - 1 : active - 1\n }\n\n moveFocus = (target: HTMLElement, back: boolean = false): void => {\n if (!window.Mixtape.Menu.items) return\n let active: number = 0\n // Retrieve the active menu item by looping through the list of menu links.\n window.Mixtape.Menu.items.forEach((element, index): void => {\n if (element === target) {\n active = index\n }\n })\n let focus: number = this.getNextFocusableMenuItem(active, back)\n\n // Check if item is tabbable.\n // Some menus, like the secondary nav have hidden items that require a\n // toggle to be clicked before the items are tabbable. This allows invisible\n // menu items to be skipped when moving focus with the this.\n // Make sure tabbable.\n let tabbable: string =\n window.Mixtape.Menu.items[focus].getAttribute(\"tabindex\")\n if (tabbable !== \"-1\") {\n window.Mixtape.Menu.items[focus].focus()\n } else {\n // Loop through items until we find a visible one.\n while (tabbable === \"-1\") {\n focus = this.getNextFocusableMenuItem(focus, back)\n tabbable = window.Mixtape.Menu.items[focus].getAttribute(\"tabindex\")\n }\n window.Mixtape.Menu.items[focus].focus()\n }\n\n window.Mixtape.Menu.active = focus\n }\n\n handleGlobalClick = ({ target }: MouseEvent): void => {\n const activePopup = window.Mixtape.Popups\n ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1]\n : null\n if (!activePopup) return\n\n // Click away from a popup to close it.\n // It's up to the popup class to preventDefault on it's contents to\n // stop this from being triggered.\n if (activePopup.id) {\n const popupEl: HTMLElement = document.querySelector(\n `#${activePopup.id}`,\n ).parentElement\n if (\n popupEl &&\n (target === popupEl || popupEl?.contains(target as HTMLElement))\n )\n return\n activePopup.closefn()\n }\n }\n\n handleGlobalKeydown = (event: KeyboardEvent): void => {\n const activePopup = window.Mixtape.Popups\n ? window.Mixtape.Popups[window.Mixtape.Popups.length - 1]\n : null\n const target = event.target as HTMLElement\n\n switch (event.key) {\n // Escape always closes an open popup followed by any open popups.\n case \"Escape\":\n if (activePopup) {\n activePopup.closefn()\n }\n break\n\n // Down/Right arrows navigate focus forward, with wrapping.\n case \"ArrowDown\":\n case \"ArrowRight\":\n if (window.Mixtape.Menu?.items) {\n event.preventDefault()\n this.moveFocus(target)\n }\n break\n\n // Up/Left arrows navigate focus backwards, with wrapping.\n case \"ArrowUp\":\n case \"ArrowLeft\":\n if (window.Mixtape.Menu?.items) {\n event.preventDefault()\n this.moveFocus(target, true)\n }\n break\n\n default:\n break\n }\n }\n\n attachEventListeners = (signal: AbortSignal): void => {\n window.addEventListener(\"click\", this.handleGlobalClick, {\n signal,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