@pnx-mixtape/mxds 0.1.0-rc.2 → 0.1.0-rc.4
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/{preview.ts → preview.tsx} +4 -0
- package/.storybook/src/docs.tsx +29 -0
- package/dist/build/accordion.css +1 -1
- package/dist/build/accordion.entry.js +1 -1
- package/dist/build/autocomplete.css +1 -1
- package/dist/build/autocomplete.entry.js +1 -1
- package/dist/build/base.css +1 -1
- package/dist/build/breadcrumb.css +1 -1
- package/dist/build/button.css +1 -1
- package/dist/build/card.css +1 -1
- package/dist/build/carousel.css +1 -1
- package/dist/build/chunks/{Accordion-z-dH6nFH.js → Accordion-GN0sME4W.js} +1 -1
- package/dist/build/chunks/{AccordionMobile-BYPPNyf5.js → AccordionMobile-DG5jSe8Q.js} +1 -1
- package/dist/build/chunks/{Autocomplete-2L6tLLuh.js → Autocomplete-B4RtkAyh.js} +1 -1
- package/dist/build/chunks/{ClosableAlert-DdXbF1J2.js → ClosableAlert-DEhj8Nxm.js} +1 -1
- package/dist/build/chunks/{Dialog-Ds8gzhri.js → Dialog-Haahn-Yn.js} +1 -1
- package/dist/build/chunks/Gallery-D8NGXy2Q.js +1 -0
- package/dist/build/chunks/GlobalToggle-B52fdBQu.js +1 -0
- package/dist/build/chunks/{InPageNavigation-CVieEl9u.js → InPageNavigation-Dyn2TR-N.js} +1 -1
- package/dist/build/chunks/Navigation-hOrfLq7h.js +1 -0
- package/dist/build/chunks/{Sticky-cWUVSOXN.js → Sticky-BGCuuEJK.js} +1 -1
- package/dist/build/chunks/{Tabs-DA_Ez8pv.js → Tabs-DYy1YTdU.js} +1 -1
- package/dist/build/chunks/enums-DLV_1NAf.js +1 -0
- package/dist/build/chunks/utilities-_Bq3TxAQ.js +1 -0
- package/dist/build/constants.css +1 -1
- package/dist/build/cookie-consent.css +1 -1
- package/dist/build/dialog.css +1 -1
- package/dist/build/dialog.entry.js +1 -1
- package/dist/build/elements.js +1 -1
- package/dist/build/filters.css +1 -1
- package/dist/build/filters.entry.js +1 -1
- package/dist/build/form.css +1 -1
- package/dist/build/gallery.entry.js +1 -1
- package/dist/build/global-alert.css +1 -1
- package/dist/build/global-alert.entry.js +1 -1
- package/dist/build/grid.css +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/list-item.css +1 -1
- package/dist/build/navigation.css +1 -1
- package/dist/build/navigation.entry.js +1 -1
- package/dist/build/one-time-code.css +1 -0
- package/dist/build/popover.css +1 -1
- package/dist/build/print.css +1 -1
- package/dist/build/react.js +1 -1
- package/dist/build/steps.css +1 -1
- package/dist/build/sticky.entry.js +1 -1
- package/dist/build/tabs.css +1 -1
- package/dist/build/tabs.entry.js +1 -1
- package/dist/build/utilities.css +1 -1
- package/dist/types/Atom/Link/Link.d.ts.map +1 -1
- package/dist/types/Component/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/Component/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/Component/Filters/Elements/Filters.d.ts +20 -1
- package/dist/types/Component/Filters/Elements/Filters.d.ts.map +1 -1
- package/dist/types/Component/Filters/Filters.d.ts +7 -2
- package/dist/types/Component/Filters/Filters.d.ts.map +1 -1
- package/dist/types/Component/Gallery/Gallery.d.ts.map +1 -1
- package/dist/types/Component/Pagination/Components/PaginationContext.d.ts.map +1 -1
- package/dist/types/Component/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/Form/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/types/Form/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/types/Form/Autocomplete/Elements/Autocomplete.d.ts +10 -0
- package/dist/types/Form/Autocomplete/Elements/Autocomplete.d.ts.map +1 -1
- package/dist/types/Form/OneTimeCode/OneTimeCode.d.ts +12 -0
- package/dist/types/Form/OneTimeCode/OneTimeCode.d.ts.map +1 -0
- package/dist/types/Utility/Hooks/useIsomorphicLayoutEffect.d.ts +4 -0
- package/dist/types/Utility/Hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/types/enums.d.ts +4 -0
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/react.d.ts +1 -0
- package/dist/types/react.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +2 -3
- package/src/Atom/Button/_buttons.css +16 -0
- package/src/Atom/Button/button.twig +4 -1
- package/src/Atom/DefinitionList/DefinitionList.stories.ts +3 -0
- package/src/Atom/Icon/_icon.css +3 -0
- package/src/Atom/Link/Link.tsx +16 -3
- package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +7 -12
- package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +1 -1
- package/src/Atom/Link/_links.css +9 -0
- package/src/Atom/Link/link.twig +8 -2
- package/src/Atom/LinkedImage/linked-image.twig +1 -2
- package/src/Atom/_generic.css +0 -10
- package/src/Component/Accordion/Accordion.stories.ts +31 -0
- package/src/Component/Accordion/Accordion.tsx +3 -2
- package/src/Component/Accordion/AccordionItem.stories.ts +27 -0
- package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +36 -0
- package/src/Component/Accordion/__snapshots__/AccordionItem.stories.ts.snap +16 -0
- package/src/Component/Accordion/accordion.css +3 -1
- package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +3 -6
- package/src/Component/Breadcrumb/breadcrumb.css +4 -0
- package/src/Component/Card/__snapshots__/Card.stories.ts.snap +11 -22
- package/src/Component/Card/card.css +2 -2
- package/src/Component/Carousel/Carousel.stories.ts +55 -0
- package/src/Component/Carousel/Carousel.stories.tsx +74 -0
- package/src/Component/Carousel/__snapshots__/Carousel.stories.ts.snap +273 -88
- package/src/Component/Carousel/__snapshots__/Carousel.stories.tsx.snap +5 -3
- package/src/Component/Carousel/carousel.css +1 -1
- package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +12 -24
- package/src/Component/CookieConsent/cookie-consent.css +6 -1
- package/src/Component/Dialog/Dialog.stories.ts +33 -0
- package/src/Component/Dialog/Dialog.stories.tsx +25 -0
- package/src/Component/Dialog/Dialog.tsx +2 -2
- package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +33 -2
- package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +2 -0
- package/src/Component/Dialog/dialog.css +5 -2
- package/src/Component/DropMenu/DropMenu.stories.ts +39 -1
- package/src/Component/DropMenu/DropMenu.stories.tsx +29 -0
- package/src/Component/DropMenu/DropMenu.tsx +1 -1
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +14 -0
- package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +3 -1
- package/src/Component/Filters/Elements/Filters.ts +71 -1
- package/src/Component/Filters/FilterItem.stories.ts +2 -1
- package/src/Component/Filters/FilterItem.tsx +1 -1
- package/src/Component/Filters/Filters.figma.ts +1 -1
- package/src/Component/Filters/Filters.stories.ts +95 -3
- package/src/Component/Filters/Filters.stories.tsx +246 -17
- package/src/Component/Filters/Filters.tsx +145 -29
- package/src/Component/Filters/README.md +102 -37
- package/src/Component/Filters/__snapshots__/FilterItem.stories.tsx.snap +3 -3
- package/src/Component/Filters/__snapshots__/Filters.stories.ts.snap +82 -4
- package/src/Component/Filters/__snapshots__/Filters.stories.tsx.snap +9 -3
- package/src/Component/Filters/filters.css +11 -0
- package/src/Component/Gallery/Gallery.tsx +2 -2
- package/src/Component/GlobalAlert/global-alert.css +3 -0
- package/src/Component/HeroBanner/HeroBanner.stories.ts +1 -1
- package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +4 -8
- package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +5 -10
- package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +6 -12
- package/src/Component/InPageNavigation/InPageNavigation.stories.ts +50 -0
- package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +78 -0
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +35 -1
- package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +2 -0
- package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +6 -12
- package/src/Component/ListItem/__snapshots__/ListItem.stories.ts.snap +7 -14
- package/src/Component/ListItem/list-item.css +1 -1
- package/src/Component/Navigation/Dropdown.stories.tsx +46 -0
- package/src/Component/Navigation/Navigation.stories.ts +56 -0
- package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +2 -0
- package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +57 -0
- package/src/Component/Navigation/_navigation-collapsible.css +3 -1
- package/src/Component/Navigation/_navigation-dropdown.css +3 -1
- package/src/Component/Pagination/Components/PaginationContext.tsx +2 -1
- package/src/Component/Pagination/Components/PaginationItem.tsx +1 -1
- package/src/Component/Pagination/Pagination.stories.ts +36 -0
- package/src/Component/Pagination/Pagination.stories.tsx +31 -0
- package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +69 -12
- package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +3 -1
- package/src/Component/Pagination/pagination-item.twig +1 -1
- package/src/Component/Popover/__snapshots__/Popover.stories.ts.snap +13 -26
- package/src/Component/Popover/popover.css +4 -2
- package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +1 -2
- package/src/Component/SocialLinks/__snapshots__/SocialLinks.stories.ts.snap +6 -9
- package/src/Component/Steps/Steps.stories.ts +1 -1
- package/src/Component/Steps/steps.css +13 -0
- package/src/Component/Tabs/Tabs.stories.ts +22 -0
- package/src/Component/Tabs/Tabs.stories.tsx +24 -0
- package/src/Component/Tabs/Tabs.tsx +2 -2
- package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +18 -0
- package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +3 -1
- package/src/Component/Tabs/tabs.css +6 -5
- package/src/Form/Autocomplete/Autocomplete.stories.ts +81 -4
- package/src/Form/Autocomplete/Autocomplete.stories.tsx +85 -1
- package/src/Form/Autocomplete/Autocomplete.tsx +19 -6
- package/src/Form/Autocomplete/Elements/Autocomplete.ts +24 -1
- package/src/Form/Autocomplete/__snapshots__/Autocomplete.stories.ts.snap +38 -4
- package/src/Form/Autocomplete/__snapshots__/Autocomplete.stories.tsx.snap +8 -4
- package/src/Form/Autocomplete/autocomplete.css +12 -1
- package/src/Form/Autocomplete/autocomplete.twig +1 -1
- package/src/Form/OneTimeCode/OneTimeCode.stories.ts +20 -0
- package/src/Form/OneTimeCode/OneTimeCode.stories.tsx +18 -0
- package/src/Form/OneTimeCode/OneTimeCode.tsx +56 -0
- package/src/Form/OneTimeCode/README.md +83 -0
- package/src/Form/OneTimeCode/__snapshots__/OneTimeCode.stories.ts.snap +7 -0
- package/src/Form/OneTimeCode/__snapshots__/OneTimeCode.stories.tsx.snap +3 -0
- package/src/Form/OneTimeCode/one-time-code.css +13 -0
- package/src/Form/OneTimeCode/one-time-code.twig +31 -0
- package/src/Form/__snapshots__/Validation.stories.ts.snap +1 -1
- package/src/Form/form.css +95 -35
- package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +18 -33
- package/src/Layout/Grid/Grid.stories.ts +1 -0
- package/src/Layout/Grid/Grid.stories.tsx +26 -0
- package/src/Layout/Grid/__snapshots__/Grid.stories.tsx.snap +2 -0
- package/src/Layout/Grid/grid.css +12 -0
- package/src/Layout/Header/Header.stories.ts +33 -0
- package/src/Layout/Header/Header.stories.tsx +31 -0
- package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +50 -0
- package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -0
- package/src/Layout/Header/_header.css +4 -2
- package/src/Layout/Header/_toggles.css +4 -1
- package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +8 -16
- package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +2 -4
- package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +4 -8
- package/src/Utility/Hooks/useIsomorphicLayoutEffect.ts +8 -0
- package/src/Utility/_mixins.css +46 -0
- package/src/Utility/print.css +1 -1
- package/src/Utility/utilities.css +20 -0
- package/src/_custom-media.css +3 -2
- package/src/constants.css +3 -13
- package/src/enums.ts +5 -0
- package/src/react.ts +1 -0
- package/tools/test-utils/screen-reader.ts +33 -0
- package/dist/build/chunks/Gallery-BT3cxS5m.js +0 -1
- package/dist/build/chunks/GlobalToggle-DQHho97V.js +0 -1
- package/dist/build/chunks/Navigation-B9Wug-ok.js +0 -1
- package/dist/build/chunks/disclosure-widget-BETzOHLO.js +0 -1
- package/dist/build/chunks/utilities-C5dAO2YA.js +0 -1
|
@@ -5,14 +5,12 @@ exports[`Light 1`] = `
|
|
|
5
5
|
|
|
6
6
|
<a href="#content">
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Skip to content
|
|
10
9
|
</a>
|
|
11
10
|
|
|
12
11
|
<a href="#nav">
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Skip to navigation
|
|
16
14
|
</a>
|
|
17
15
|
|
|
18
16
|
</nav>
|
|
@@ -29,14 +27,12 @@ exports[`Masthead 1`] = `
|
|
|
29
27
|
|
|
30
28
|
<a href="#content">
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
Skip to content
|
|
34
31
|
</a>
|
|
35
32
|
|
|
36
33
|
<a href="#nav">
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
Skip to navigation
|
|
40
36
|
</a>
|
|
41
37
|
|
|
42
38
|
</nav>
|
|
@@ -53,14 +49,12 @@ exports[`With Links 1`] = `
|
|
|
53
49
|
|
|
54
50
|
<a href="#content">
|
|
55
51
|
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
Skip to content
|
|
58
53
|
</a>
|
|
59
54
|
|
|
60
55
|
<a href="#nav">
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
Skip to navigation
|
|
64
58
|
</a>
|
|
65
59
|
|
|
66
60
|
</nav>
|
|
@@ -73,16 +67,14 @@ exports[`With Links 1`] = `
|
|
|
73
67
|
|
|
74
68
|
<span class="mx-icon mx-icon--user"></span>
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
Create account
|
|
78
71
|
</a>
|
|
79
72
|
|
|
80
73
|
<a href="#">
|
|
81
74
|
|
|
82
75
|
<span class="mx-icon mx-icon--login"></span>
|
|
83
76
|
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
Log in
|
|
86
78
|
</a>
|
|
87
79
|
|
|
88
80
|
</nav>
|
|
@@ -17,8 +17,7 @@ exports[`Background 1`] = `
|
|
|
17
17
|
|
|
18
18
|
<a href="#" class="mx-link--more">
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
See more content
|
|
22
21
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
23
22
|
|
|
24
23
|
</a>
|
|
@@ -47,8 +46,7 @@ exports[`Dark 1`] = `
|
|
|
47
46
|
|
|
48
47
|
<a href="#" class="mx-link--more">
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
See more content
|
|
52
50
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
53
51
|
|
|
54
52
|
</a>
|
|
@@ -11,8 +11,7 @@ exports[`Background 1`] = `
|
|
|
11
11
|
|
|
12
12
|
<a href="#" class="mx-link--more">
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
See more content
|
|
16
15
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
17
16
|
|
|
18
17
|
</a>
|
|
@@ -35,8 +34,7 @@ exports[`Box 1`] = `
|
|
|
35
34
|
|
|
36
35
|
<a href="#" class="mx-link--more">
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
See more content
|
|
40
38
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
41
39
|
|
|
42
40
|
</a>
|
|
@@ -69,8 +67,7 @@ exports[`Modifiers 1`] = `
|
|
|
69
67
|
|
|
70
68
|
<a href="#" class="mx-link--more">
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
See more content
|
|
74
71
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
75
72
|
|
|
76
73
|
</a>
|
|
@@ -93,8 +90,7 @@ exports[`Section 1`] = `
|
|
|
93
90
|
|
|
94
91
|
<a href="#" class="mx-link--more">
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
See more content
|
|
98
94
|
<span class="mx-icon mx-icon--arrow-right"></span>
|
|
99
95
|
|
|
100
96
|
</a>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect } from "react"
|
|
2
|
+
|
|
3
|
+
// useLayoutEffect warns when it actually runs during server rendering (it's
|
|
4
|
+
// a no-op there) - fall back to useEffect outside the browser so
|
|
5
|
+
// server-rendered/hydrated consumers never see that warning.
|
|
6
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect
|
|
7
|
+
|
|
8
|
+
export default useIsomorphicLayoutEffect
|
package/src/Utility/_mixins.css
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* stylelint-disable no-invalid-position-declaration -- the mixin body is
|
|
2
|
+
always inlined into a rule, so the declarations do have a parent. */
|
|
3
|
+
|
|
1
4
|
@define-mixin sr-only {
|
|
2
5
|
clip-path: inset(50%);
|
|
3
6
|
inline-size: 1px;
|
|
@@ -17,3 +20,46 @@
|
|
|
17
20
|
overflow: revert;
|
|
18
21
|
white-space: revert;
|
|
19
22
|
}
|
|
23
|
+
|
|
24
|
+
@define-mixin transition {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
transition-property: var(
|
|
27
|
+
--transition-property,
|
|
28
|
+
opacity,
|
|
29
|
+
color,
|
|
30
|
+
background-color,
|
|
31
|
+
border-color,
|
|
32
|
+
transform,
|
|
33
|
+
rotate,
|
|
34
|
+
display,
|
|
35
|
+
overlay
|
|
36
|
+
);
|
|
37
|
+
transition-duration: var(--transition-duration, 0.5s);
|
|
38
|
+
transition-timing-function: var(--ease);
|
|
39
|
+
transition-behavior: allow-discrete;
|
|
40
|
+
|
|
41
|
+
@starting-style {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pseudo-elements that draw something — a masked icon, a radio dot — paint it
|
|
48
|
+
* with background-color, which forced-colors mode flattens to Canvas: the
|
|
49
|
+
* shape disappears. Opt the pseudo out and name a real system colour instead.
|
|
50
|
+
*
|
|
51
|
+
* currentcolor won't do: it inherits the parent's *computed* colour, and
|
|
52
|
+
* forcing happens later at used-value time — an opted-out pseudo would paint
|
|
53
|
+
* the brand colour and still vanish against a dark high-contrast background.
|
|
54
|
+
*
|
|
55
|
+
* --forced-colour carries the right system colour down from context; see the
|
|
56
|
+
* overrides on .mx-button, a[href] and :disabled.
|
|
57
|
+
*
|
|
58
|
+
* Add to any rule that paints a glyph via background-color.
|
|
59
|
+
*/
|
|
60
|
+
@define-mixin forced-colors-paint {
|
|
61
|
+
@media (--forced-colors) {
|
|
62
|
+
forced-color-adjust: none;
|
|
63
|
+
background-color: var(--forced-colour, CanvasText);
|
|
64
|
+
}
|
|
65
|
+
}
|
package/src/Utility/print.css
CHANGED
|
@@ -91,3 +91,23 @@
|
|
|
91
91
|
opacity: var(--opacity-low);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Pending/busy state. Any element with `aria-busy="true"` gets a trailing
|
|
97
|
+
* spinner automatically - no per-component markup or class required, so any
|
|
98
|
+
* component can adopt a pending state just by reflecting `aria-busy`. Reuses
|
|
99
|
+
* the shared `spin` keyframe from Atom/_animated.css (see `.mx-animated--spin`).
|
|
100
|
+
*/
|
|
101
|
+
@layer design-system.utilities {
|
|
102
|
+
[aria-busy="true"]::after {
|
|
103
|
+
content: "";
|
|
104
|
+
display: inline-block;
|
|
105
|
+
align-self: center;
|
|
106
|
+
inline-size: var(--spinner-size, var(--spacing-xs));
|
|
107
|
+
block-size: var(--spinner-size, var(--spacing-xs));
|
|
108
|
+
border: var(--line-width, 2px) solid var(--line-colour, var(--colour-primary));
|
|
109
|
+
border-inline-end-color: transparent;
|
|
110
|
+
border-radius: 50%;
|
|
111
|
+
animation: spin 0.6s linear infinite;
|
|
112
|
+
}
|
|
113
|
+
}
|
package/src/_custom-media.css
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
@custom-media --collapse-card-down (token("breakpoint.xxs") < width < token("breakpoint.collapsedCard"));
|
|
22
22
|
|
|
23
23
|
/* Util media queries */
|
|
24
|
-
@custom-media --touch (
|
|
25
|
-
@custom-media --mouse (
|
|
24
|
+
@custom-media --touch (pointer: fine);
|
|
25
|
+
@custom-media --mouse (pointer: coarse);
|
|
26
26
|
@custom-media --dark (prefers-color-scheme: dark);
|
|
27
27
|
@custom-media --light (prefers-color-scheme: light);
|
|
28
28
|
@custom-media --use-motion (prefers-reduced-motion: no-preference);
|
|
@@ -33,3 +33,4 @@
|
|
|
33
33
|
@custom-media --low-contrast (prefers-contrast: less);
|
|
34
34
|
@custom-media --portrait (orientation: portrait);
|
|
35
35
|
@custom-media --landscape (orientation: landscape);
|
|
36
|
+
@custom-media --forced-colors (forced-colors: active);
|
package/src/constants.css
CHANGED
|
@@ -16,27 +16,17 @@
|
|
|
16
16
|
initial-value: black;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
@property --colour-primary {
|
|
20
|
-
syntax: "<color>";
|
|
21
|
-
inherits: true;
|
|
22
|
-
initial-value: token("colour.primary.colour");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@property --colour-accent {
|
|
26
|
-
syntax: "<color>";
|
|
27
|
-
inherits: true;
|
|
28
|
-
initial-value: token("colour.accent.colour");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
19
|
@layer design-system.defaults {
|
|
32
20
|
:root {
|
|
33
21
|
/* Brand colors */
|
|
22
|
+
--colour-primary: token("colour.primary.colour");
|
|
34
23
|
--colour-primary-light: color-mix(in oklch, var(--colour-primary), white 90%);
|
|
35
24
|
--colour-primary-lighter: color-mix(in oklch, var(--colour-primary), white 20%);
|
|
36
25
|
--colour-primary-darker: color-mix(in oklch, var(--colour-primary), black 20%);
|
|
37
26
|
--colour-primary-dark: color-mix(in oklch, var(--colour-primary), black 40%);
|
|
38
27
|
--colour-primary-darkest: color-mix(in oklch, var(--colour-primary), black 50%);
|
|
39
28
|
--colour-primary-scheme: token("colour.primary.scheme");
|
|
29
|
+
--colour-accent: token("colour.accent.colour");
|
|
40
30
|
--colour-accent-light: color-mix(in oklch, var(--colour-accent), white 90%);
|
|
41
31
|
--colour-accent-lighter: color-mix(in oklch, var(--colour-accent), white 20%);
|
|
42
32
|
--colour-accent-darker: color-mix(in oklch, var(--colour-accent), black 10%);
|
|
@@ -89,7 +79,7 @@
|
|
|
89
79
|
--font-size: var(--base-font-size);
|
|
90
80
|
--font-size-xs: calc(var(--base-font-size) * pow(var(--type-ratio), -0.5));
|
|
91
81
|
--font-size-s: calc(var(--base-font-size) * pow(var(--type-ratio), -0.25));
|
|
92
|
-
--font-size-m:
|
|
82
|
+
--font-size-m: var(--base-font-size);
|
|
93
83
|
--font-size-ml: calc(var(--base-font-size) * pow(var(--type-ratio), 0.5));
|
|
94
84
|
--font-size-l: calc(var(--base-font-size) * pow(var(--type-ratio), 1));
|
|
95
85
|
--font-size-xl: calc(var(--base-font-size) * pow(var(--type-ratio), 2));
|
package/src/enums.ts
CHANGED
package/src/react.ts
CHANGED
|
@@ -93,6 +93,7 @@ export { default as FormSearch } from "./Form/Search/FormSearch"
|
|
|
93
93
|
export { default as Autocomplete } from "./Form/Autocomplete/Autocomplete"
|
|
94
94
|
export { default as CheckboxCard } from "./Form/CheckboxCard/CheckboxCard"
|
|
95
95
|
export { default as RadioCard } from "./Form/RadioCard/RadioCard"
|
|
96
|
+
export { default as OneTimeCode } from "./Form/OneTimeCode/OneTimeCode"
|
|
96
97
|
export { default as Masthead } from "./Layout/Masthead/Masthead"
|
|
97
98
|
export { default as Sidebar } from "./Layout/Sidebar/Sidebar"
|
|
98
99
|
export { default as Footer } from "./Layout/Footer/Footer"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { virtual } from "@guidepup/virtual-screen-reader"
|
|
2
|
+
|
|
3
|
+
const MAX_STEPS = 200
|
|
4
|
+
const END_OF_DOCUMENT = "end of document"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Steps a virtual screen reader through the whole page (Storybook renders one
|
|
8
|
+
* story per page, so `document.body` scopes exactly to the story under test)
|
|
9
|
+
* until it announces "end of document", returning the full spoken-phrase log.
|
|
10
|
+
*
|
|
11
|
+
* Always stops the screen reader, even if a step throws, so play functions
|
|
12
|
+
* stay isolated per this repo's "leave the DOM as you found it" convention.
|
|
13
|
+
*/
|
|
14
|
+
export const runScreenReaderWalkthrough = async (): Promise<string[]> => {
|
|
15
|
+
await virtual.start({ container: document.body })
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
let steps = 0
|
|
19
|
+
while ((await virtual.lastSpokenPhrase()) !== END_OF_DOCUMENT) {
|
|
20
|
+
if (steps >= MAX_STEPS) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Screen reader walkthrough exceeded ${MAX_STEPS} steps without reaching "${END_OF_DOCUMENT}".`,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
await virtual.next()
|
|
26
|
+
steps += 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return await virtual.spokenPhraseLog()
|
|
30
|
+
} finally {
|
|
31
|
+
await virtual.stop()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./cookie-compliance-Bbm-0vpj.js";import{t}from"./utilities-C5dAO2YA.js";import{t as n}from"./Dialog-Ds8gzhri.js";var r=class extends HTMLElement{internals_;controller;debounced;loop;paginationType;activePage;itemMap;iO;rO;mO;ioTimeout;constructor(){super(),this.internals_=this.attachInternals(),this.controller=new AbortController}connectedCallback(){if(!this.track)return;this.buttons&&(this.buttons.hidden=!1),this.activePage=0,this.track.scrollLeft=0,this.debounced=null,this.loop=this.hasAttribute(`loop`);let{signal:e}=this.controller;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)=>{e.setAttribute(`data-index`,String(t))});let t=this.track.querySelectorAll(`[data-index]`);this.itemMap=new Map,this.iO=new IntersectionObserver(e=>{e.forEach(({target:e,intersectionRatio:t})=>{let n=e;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))})},{root:this.track,threshold:.5}),t.forEach(e=>this.iO.observe(e)),this.rO=new ResizeObserver(e=>{e.forEach(()=>this.handleOverflow())}),this.rO.observe(this.track),this.mO=new MutationObserver(e=>{e.forEach(()=>this.handleOverflow())}),this.mO.observe(this.track,{childList:!0})}disconnectedCallback(){this.controller.abort(),this.mO.disconnect(),this.iO.disconnect(),this.rO.disconnect(),clearTimeout(this.debounced),clearTimeout(this.ioTimeout)}handleNavigation=(e,t=`arrow`)=>{let n=e>this.activePage,r=this.loop&&this.next.hasAttribute(`data-restart`);if(e===0||r&&n&&t===`arrow`){this.activePage=0,this.items[0].scrollIntoView({inline:`start`,block:`nearest`}),this.next.removeAttribute(`data-restart`);return}this.activePage=e,this.items[this.visibleCount*e].scrollIntoView({inline:`start`,block:`nearest`}),r&&!n&&this.next.removeAttribute(`data-restart`);let i=new CustomEvent(`carousel-slide`,{bubbles:!0,cancelable:!0,detail:{page:this.activePage,type:t}});this.dispatchEvent(i)};handleDisabled=()=>{let e=!1;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){let t=Math.round(this.track.offsetLeft+this.track.scrollLeft);if(e)this.activePage=this.pageStartItems.length-1;else{let e=0,n=1/0;this.pageStartItems.forEach((r,i)=>{let a=Math.abs(Math.round(r.offsetLeft)-t);a<n&&(n=a,e=i)}),this.activePage=e}this.pagination.querySelectorAll(`button`).forEach(e=>{let t=e.getAttribute(`data-index`);if(!t)return;let n=parseInt(t,10)===this.activePage;e.disabled=n,n?e.setAttribute(`aria-current`,`page`):e.removeAttribute(`aria-current`)})}};handleScroll=()=>{clearTimeout(this.debounced),this.debounced=setTimeout(this.handleDisabled,this.pagination?100:200)};handleOverflow=()=>{let{scrollWidth:e,clientWidth:t}=this.track,n=e>t;this.track.classList.toggle(`overflowing`,n),n?(this.pagination&&(this.ioTimeout=setTimeout(this.buildPagination,200)),this.track.setAttribute(`tabindex`,`0`)):this.track.removeAttribute(`tabindex`)};buildPagination=()=>{if(!this.pagination.hidden){let e=this.pagination.querySelectorAll(`button`);if(e.length===this.pageStartItems.length)return;e.forEach(e=>e.remove())}let e=Array.from({length:this.pageStartItems.length}).fill(null);if(e.length<=0)return;e.forEach((n,r)=>{let i=r+1,a=t(`<button type="button" data-index="${r}" aria-label="Page ${i}">${i}</button>`);this.pagination.append(a),e[r]=a});let n=e[0];n.disabled=!0,n.setAttribute(`aria-current`,`page`),this.pagination.hidden=!1};handlePagination=t=>{let n=t.target.getAttribute(`data-index`);if(!n||!e.integer(n,0))return;let r=parseInt(n,10);this.handleNavigation(r,`pagination`)};get track(){let e=this.querySelector(`[data-track]`);if(!e)throw Error(`${this.localName} must contain an element with [data-track].`);return e}get buttons(){return this.querySelector(`[data-buttons]`)}get prev(){return this.buttons?.querySelector(`.mx-carousel__prev`)}get next(){return this.buttons?.querySelector(`.mx-carousel__next`)}get pagination(){return this.querySelector(`[data-pagination]`)}get items(){return[...this.itemMap.keys()]}get visibleCount(){return[...this.itemMap.values()].filter(e=>e).length}get pageStartItems(){return[...this.items].filter((e,t)=>t%this.visibleCount===0)}};customElements.get(`mx-carousel`)||customElements.define(`mx-carousel`,r);var i=class extends n{connectedCallback(){if(super.connectedCallback(),!this.dialog)return;let{signal:e}=this.controller;this.openBtns?.forEach(t=>t.addEventListener(`click`,()=>this.scrollToTrigger(t),{signal:e}))}scrollToTrigger=e=>{let t=e.dataset.galleryIndex??`0`,n=this.carousel?.track?.querySelector(`[data-index="${t}"]`);n&&(n.removeAttribute(`inert`),n.scrollIntoView({inline:`start`,block:`nearest`}))};get carousel(){return this.querySelector(`mx-carousel`)}};customElements.get(`mx-gallery`)||customElements.define(`mx-gallery`,i);export{r as n,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./disclosure-widget-BETzOHLO.js";import"./utilities-C5dAO2YA.js";import{createFocusTrap as t}from"focus-trap";var n=class extends HTMLElement{internals_;controller;widget;focusTrap;controls;mq;triggerText;isOpen=!1;closeIconClass=`mx-icon--close`;menuIconClass=`mx-icon--menu`;searchIconClass=`mx-icon--search`;backgroundClass=`mx-background--primary`;scrollLockClass=`body--scroll-lock`;isSearch;hideOther=!0;otherTrigger;rafId;focusTrapTimeout;constructor(){super(),this.internals_=this.attachInternals(),this.controller=new AbortController,this.mq=this.getAttribute(`mq`)||`(max-width: 720px)`}connectedCallback(){if(!this.trigger||!this.target)return;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,{escapeDeactivates:!1,setReturnFocus:this.trigger,allowOutsideClick:!0,onActivate:()=>document.body.classList.add(this.scrollLockClass),onDeactivate:()=>document.body.classList.remove(this.scrollLockClass),checkCanFocusTrap:([e])=>new Promise(t=>{this.focusTrapTimeout=setTimeout(()=>{this.rafId&&=(cancelAnimationFrame(this.rafId),null),t()},2e3);let n=()=>{getComputedStyle(e).visibility===`hidden`?this.rafId=requestAnimationFrame(n):(this.focusTrapTimeout&&=(clearTimeout(this.focusTrapTimeout),null),this.rafId=null,t())};this.rafId=requestAnimationFrame(n)})});let{signal:n}=this.controller;this.handleBreakpoint(this.breakpoint),this.breakpoint.addEventListener(`change`,this.handleBreakpoint,{signal:n}),document.addEventListener(`keydown`,this.handleKeyDown,{signal:n})}disconnectedCallback(){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)}handleBreakpoint=({matches:e})=>{if(!this.trigger)return;let{signal:t}=this.controller;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())};handleDisclosure=async({detail:e})=>{let{isOpen:t}=e,n=t?`Open`:`Close`,r=t?`Close`:`Open`;if(this.trigger.textContent=this.triggerText.replace(n,r),t)try{await this.focusTrap.activate()}catch{}else this.focusTrap.deactivate();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};handleKeyDown=e=>{this.isOpen&&e.key===`Escape`&&this.widget.handleToggle()};get trigger(){let e=this.querySelector(`:scope > button`),t=e.getAttribute(`aria-controls`);if(!e||!t)throw Error(`${this.localName} must contain a <button aria-controls="element-to-trigger"> element.`);return e.removeAttribute(`disabled`),this.controls=t,this.triggerText=e.textContent,e}get target(){let e=document.querySelector(`div[id="${this.controls}"]`);if(!e)throw Error(`${this.localName} must contain a target <div id="${this.controls}">.`);return e.classList.remove(`global-nav-up-only`),e}get breakpoint(){return window.matchMedia(this.mq)}};customElements.get(`mx-global-toggle`)||customElements.define(`mx-global-toggle`,n);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./disclosure-widget-BETzOHLO.js";import{s as t}from"./utilities-C5dAO2YA.js";var n=class{constructor(){window.Mixtape=window.Mixtape||{},window.Mixtape.Popups=window.Mixtape.Popups||[],window.Mixtape.Menu=window.Mixtape.Menu||{}}attachPopup=(e,t)=>{window.Mixtape.Popups.push({id:e,closefn:t})};detachPopup=e=>{window.Mixtape.Popups=window.Mixtape.Popups.filter(t=>t.id!==e)};attachMenu=(e,t)=>{window.Mixtape.Menu={context:e,items:t}};detachMenu=()=>{window.Mixtape.Menu=null};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;moveFocus=(e,t=!1)=>{if(!window.Mixtape.Menu.items)return;let n=0;window.Mixtape.Menu.items.forEach((t,r)=>{t===e&&(n=r)});let r=this.getNextFocusableMenuItem(n,t),i=window.Mixtape.Menu.items[r].getAttribute(`tabindex`);if(i!==`-1`)window.Mixtape.Menu.items[r].focus();else{for(;i===`-1`;)r=this.getNextFocusableMenuItem(r,t),i=window.Mixtape.Menu.items[r].getAttribute(`tabindex`);window.Mixtape.Menu.items[r].focus()}window.Mixtape.Menu.active=r};handleGlobalClick=({target:e})=>{let t=window.Mixtape.Popups?window.Mixtape.Popups[window.Mixtape.Popups.length-1]:null;if(t&&t.id){let n=document.querySelector(`#${t.id}`).parentElement;if(n&&(e===n||n?.contains(e)))return;t.closefn()}};handleGlobalKeydown=e=>{let t=window.Mixtape.Popups?window.Mixtape.Popups[window.Mixtape.Popups.length-1]:null,n=e.target;switch(e.key){case`Escape`:t&&t.closefn();break;case`ArrowDown`:case`ArrowRight`:window.Mixtape.Menu?.items&&(e.preventDefault(),this.moveFocus(n));break;case`ArrowUp`:case`ArrowLeft`:window.Mixtape.Menu?.items&&(e.preventDefault(),this.moveFocus(n,!0))}};attachEventListeners=e=>{window.addEventListener(`click`,this.handleGlobalClick,{signal:e}),window.addEventListener(`keydown`,this.handleGlobalKeydown,{signal:e})}},r=class extends HTMLElement{internals_;controller;keyboard;subNavs;flyout;edgeCheck;mq;iO;constructor(){super(),this.internals_=this.attachInternals(),this.controller=new AbortController,this.flyout=this.hasAttribute(`flyout`)}connectedCallback(){let{signal:r}=this.controller;this.keyboard=new n,this.keyboard.attachEventListeners(r),this.addEventListener(`focusin`,()=>{this.keyboard.attachMenu(this,this.links)}),this.addEventListener(`focusout`,()=>{this.keyboard.detachMenu()}),this.lists.length&&(this.subNavs=new Map,this.lists.forEach((n,r)=>{let i=n.closest(`li`),a=i.querySelector(`:scope > a`),o=t(`subnav-${r}-${a.textContent}`,30),s=i.querySelector(`:scope > button.mx-nav__toggle`);if(i&&a&&s){let t=`list-label-${o}`;a.setAttribute(`id`,t),n.setAttribute(`id`,o),n.setAttribute(`aria-labelledby`,t);let r=new e(s,n);r.init(),this.subNavs.set(o,{item:i,trigger:s,list:n,link:a,widget:r})}}),this.addEventListener(`disclosure-toggle`,this.handleDisclosure),this.flyout&&(this.edgeCheck=this.hasAttribute(`edgeCheck`),this.mq=this.getAttribute(`mq`)||`(min-width: 720px)`,this.handleBreakpoint(this.breakpoint),this.breakpoint.addEventListener(`change`,this.handleBreakpoint,{signal:r})))}disconnectedCallback(){this.controller.abort(),this.subNavs?.forEach(e=>e.widget.detach()),this.iO?.disconnect()}handleDisclosure=({detail:e})=>{let{isOpen:t,id:n}=e,{item:r}=this.subNavs.get(n);r.classList.toggle(`mx-nav--open`),t?this.keyboard.attachPopup(n,this.handleCloseAny):this.keyboard.detachPopup(n)};handleCloseAny=()=>{this.subNavs?.forEach(({widget:e})=>{e&&e.isOpen&&e.handleToggle()})};handleFlyout=e=>{let t=e.target.closest(`li`);if(!t)return;let n=t.querySelector(`:scope > ul`);n&&this.subNavs?.forEach(({widget:e,list:t})=>{e&&(e.isOpen&&e.handleToggle(),t.id===n.id&&e.handleToggle())})};handleBreakpoint=({matches:e})=>{let{signal:t}=this.controller;e?(this.addEventListener(`mouseover`,this.handleFlyout,{signal:t}),this.addEventListener(`mouseleave`,this.handleCloseAny,{signal:t}),this.edgeCheck&&this.handleEdgeCheck()):(this.removeEventListener(`mouseover`,this.handleFlyout),this.removeEventListener(`mouseleave`,this.handleCloseAny))};handleEdgeCheck(){let e=window.innerWidth;this.iO=new IntersectionObserver((t,n)=>{t.forEach(({boundingClientRect:t,target:r})=>{e<t.right&&r.classList.add(`mx-nav--reverse`),n.unobserve(r)})}),this.subNavs?.forEach(({list:e})=>{this.iO.observe(e),e.querySelectorAll(`ul`)?.forEach(e=>this.iO.observe(e))})}get links(){let e=this.querySelectorAll(`a`);if(!e.length)throw Error(`${this.localName} must links`);return e}get lists(){return this.querySelectorAll(`li > ul`)}get breakpoint(){return window.matchMedia(this.mq)}};customElements.get(`mx-nav`)||customElements.define(`mx-nav`,r);export{n,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as e}from"./utilities-C5dAO2YA.js";var t=class{options;context;trigger;element;id;isOpen;attached;constructor(e,t,n,r=document){if(!e)throw Error(`toggle is required.`);if(!t)throw Error(`element is required.`);let i={attribute:`inert`,shouldPreventDefault:!0,setInitialAttribute:!0,clickEvent:`click`};this.options={...i,...n},this.context=r||document,this.trigger=e,this.element=t,this.id=this.element.id||this.generatedId()}init=()=>{if(Object.prototype.hasOwnProperty.call(this.trigger,`disclosureWidget`))return;let{attribute:e,setInitialAttribute:t}=this.options;this.trigger.disclosureWidget=this,t&&this.element.setAttribute(e,``),this.attach()};handleToggle=()=>{let{attribute:e,setInitialAttribute:t}=this.options;this.element.toggleAttribute(e);let n=this.element.hasAttribute(e);this.isOpen=t?!n:n,this.trigger.setAttribute(`aria-expanded`,String(this.isOpen));let r=new CustomEvent(`disclosure-toggle`,{bubbles:!0,cancelable:!0,detail:{isOpen:this.isOpen,id:this.id,options:this.options,target:this.element}});this.trigger.dispatchEvent(r)};handleMouse=e=>{let{currentTarget:t,type:n,relatedTarget:r}=e;if(n===`mouseover`||n===`mouseout`){let e=this.trigger.parentNode;if(e!==t||e.contains(r))return}else if(this.trigger!==t)return;let{shouldPreventDefault:i}=this.options;this.handleToggle(),i&&(e.preventDefault(),e.stopPropagation())};handleKeyboard=e=>{let{key:t,target:n}=e;if(this.trigger!==n)return;let{isOpen:r}=this,{shouldPreventDefault:i}=this.options;switch(t){case`ArrowDown`:case`Enter`:r||this.handleToggle(),i&&(e.preventDefault(),e.stopPropagation());break;case`ArrowUp`:case`Escape`:r&&this.handleToggle(),i&&(e.preventDefault(),e.stopPropagation())}};attach=()=>{if(this.attached)return;let{clickEvent:e}=this.options;if(e===`mouseover`){let e=this.trigger.parentNode;e.addEventListener(`mouseover`,this.handleMouse),e.addEventListener(`mouseout`,this.handleMouse)}else this.trigger.addEventListener(`click`,this.handleMouse);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};detach=()=>{if(!this.attached)return;this.isOpen&&this.handleToggle();let{clickEvent:e}=this.options;if(e===`mouseover`){let e=this.trigger.parentNode;e.removeEventListener(`mouseover`,this.handleMouse),e.removeEventListener(`mouseout`,this.handleMouse)}else this.trigger.removeEventListener(`click`,this.handleMouse);this.trigger.removeEventListener(`keydown`,this.handleKeyboard),this.trigger.removeAttribute(`aria-expanded`),this.attached=!1};generatedId=()=>{let t=this.trigger?.textContent?.trim();return t?e(t):``}};export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./cookie-compliance-Bbm-0vpj.js";var t=(t,n=20)=>{if(!e.notEmpty(t))return``;let r=t.toLowerCase().trim().replace(/\s+/g,`-`).replace(/[^-a-z0-9]/g,``).replace(/[\n\r]+|[\s]{2,}/g,``);return[...[,,,,,,].keys()].forEach(()=>{r.charAt(0).match(/[a-z]/g)||(r=r.substring(1))}),e.integer(n,1)&&(r=r.substring(0,n)),r},n=t=>e.notEmpty(t)?t.trim().replace(/(?:^\w|[A-Z]|\b\w|\s+)/g,(e,t)=>+e==0?``:t===0?e.toLowerCase():e.toUpperCase()).replace(/[^\w\s]/gi,``):``,r=(e,t)=>{if(typeof e!=`string`||!e||!Array.isArray(t))return!1;try{let{hostname:n}=new URL(e);return window.location.hostname===n||t.includes(n)}catch{return!1}},i=e=>{try{return new DOMParser().parseFromString(e,`text/html`).body.firstElementChild}catch{return null}},a=(e,t=!1,n=!1)=>{let r=new ResizeObserver(i=>{i.forEach(({contentBoxSize:i,borderBoxSize:a})=>{let[{inlineSize:o,blockSize:s}]=n?i:a;e.style.setProperty(`--inline-size`,`${o.toFixed(1)}px`),e.style.setProperty(`--block-size`,`${s.toFixed(1)}px`),t&&r.unobserve(e)})});r.observe(e)},o=(e,t,n,r=[])=>{let{target:i,clientY:a,clientX:o}=e,s=i instanceof HTMLOptionElement||i instanceof HTMLSelectElement;if((r?.filter(e=>e===i||e.contains(i))).length||s)return;let c=new IntersectionObserver(([{boundingClientRect:e}])=>{let{top:t,height:r,width:i,left:s}=e;t<=a&&a<=t+r&&s<=o&&o<=s+i||n(),c.disconnect()});c.observe(t)},s=(e,t)=>{let{key:n}=e;n===`Escape`&&t()},c=(e,t)=>{if(Object.hasOwn(window,`Drupal`)&&Object.hasOwn(Drupal,`behaviors`)){Drupal.behaviors[t]={attach:e};return}window.addEventListener(`DOMContentLoaded`,e.bind(document,document))};export{r as a,n as c,o as i,a as n,c as o,s as r,t as s,i as t};
|