@pnx-mixtape/mxds 0.1.0-rc.2 → 0.1.0-rc.3

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.
Files changed (189) hide show
  1. package/.storybook/{preview.ts → preview.tsx} +4 -0
  2. package/.storybook/src/docs.tsx +29 -0
  3. package/dist/build/accordion.entry.js +1 -1
  4. package/dist/build/autocomplete.css +1 -1
  5. package/dist/build/autocomplete.entry.js +1 -1
  6. package/dist/build/base.css +1 -1
  7. package/dist/build/breadcrumb.css +1 -1
  8. package/dist/build/button.css +1 -1
  9. package/dist/build/card.css +1 -1
  10. package/dist/build/chunks/{Accordion-z-dH6nFH.js → Accordion-GN0sME4W.js} +1 -1
  11. package/dist/build/chunks/{AccordionMobile-BYPPNyf5.js → AccordionMobile-DG5jSe8Q.js} +1 -1
  12. package/dist/build/chunks/{Autocomplete-2L6tLLuh.js → Autocomplete-B4RtkAyh.js} +1 -1
  13. package/dist/build/chunks/{ClosableAlert-DdXbF1J2.js → ClosableAlert-DEhj8Nxm.js} +1 -1
  14. package/dist/build/chunks/{Dialog-Ds8gzhri.js → Dialog-Haahn-Yn.js} +1 -1
  15. package/dist/build/chunks/Gallery-D8NGXy2Q.js +1 -0
  16. package/dist/build/chunks/GlobalToggle-B52fdBQu.js +1 -0
  17. package/dist/build/chunks/{InPageNavigation-CVieEl9u.js → InPageNavigation-Dyn2TR-N.js} +1 -1
  18. package/dist/build/chunks/Navigation-hOrfLq7h.js +1 -0
  19. package/dist/build/chunks/{Sticky-cWUVSOXN.js → Sticky-BGCuuEJK.js} +1 -1
  20. package/dist/build/chunks/{Tabs-DA_Ez8pv.js → Tabs-DYy1YTdU.js} +1 -1
  21. package/dist/build/chunks/enums-DLV_1NAf.js +1 -0
  22. package/dist/build/chunks/utilities-_Bq3TxAQ.js +1 -0
  23. package/dist/build/cookie-consent.css +1 -1
  24. package/dist/build/dialog.entry.js +1 -1
  25. package/dist/build/elements.js +1 -1
  26. package/dist/build/filters.css +1 -1
  27. package/dist/build/filters.entry.js +1 -1
  28. package/dist/build/form.css +1 -1
  29. package/dist/build/gallery.entry.js +1 -1
  30. package/dist/build/global-alert.entry.js +1 -1
  31. package/dist/build/header.entry.js +1 -1
  32. package/dist/build/icon.css +1 -1
  33. package/dist/build/in-page-navigation.entry.js +1 -1
  34. package/dist/build/list-item.css +1 -1
  35. package/dist/build/navigation.entry.js +1 -1
  36. package/dist/build/one-time-code.css +1 -0
  37. package/dist/build/popover.css +1 -1
  38. package/dist/build/print.css +1 -1
  39. package/dist/build/react.js +1 -1
  40. package/dist/build/steps.css +1 -1
  41. package/dist/build/sticky.entry.js +1 -1
  42. package/dist/build/tabs.css +1 -1
  43. package/dist/build/tabs.entry.js +1 -1
  44. package/dist/build/utilities.css +1 -1
  45. package/dist/types/Atom/Link/Link.d.ts.map +1 -1
  46. package/dist/types/Component/Accordion/Accordion.d.ts.map +1 -1
  47. package/dist/types/Component/Dialog/Dialog.d.ts.map +1 -1
  48. package/dist/types/Component/Filters/Elements/Filters.d.ts +20 -1
  49. package/dist/types/Component/Filters/Elements/Filters.d.ts.map +1 -1
  50. package/dist/types/Component/Filters/Filters.d.ts +7 -2
  51. package/dist/types/Component/Filters/Filters.d.ts.map +1 -1
  52. package/dist/types/Component/Gallery/Gallery.d.ts.map +1 -1
  53. package/dist/types/Component/Pagination/Components/PaginationContext.d.ts.map +1 -1
  54. package/dist/types/Component/Tabs/Tabs.d.ts.map +1 -1
  55. package/dist/types/Form/Autocomplete/Autocomplete.d.ts +2 -2
  56. package/dist/types/Form/Autocomplete/Autocomplete.d.ts.map +1 -1
  57. package/dist/types/Form/Autocomplete/Elements/Autocomplete.d.ts +10 -0
  58. package/dist/types/Form/Autocomplete/Elements/Autocomplete.d.ts.map +1 -1
  59. package/dist/types/Form/OneTimeCode/OneTimeCode.d.ts +12 -0
  60. package/dist/types/Form/OneTimeCode/OneTimeCode.d.ts.map +1 -0
  61. package/dist/types/Utility/Hooks/useIsomorphicLayoutEffect.d.ts +4 -0
  62. package/dist/types/Utility/Hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
  63. package/dist/types/enums.d.ts +4 -0
  64. package/dist/types/enums.d.ts.map +1 -1
  65. package/dist/types/react.d.ts +1 -0
  66. package/dist/types/react.d.ts.map +1 -1
  67. package/package.json +3 -3
  68. package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +2 -3
  69. package/src/Atom/Button/_buttons.css +16 -0
  70. package/src/Atom/Button/button.twig +4 -1
  71. package/src/Atom/DefinitionList/DefinitionList.stories.ts +3 -0
  72. package/src/Atom/Icon/_icon.css +3 -0
  73. package/src/Atom/Link/Link.tsx +16 -3
  74. package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +7 -12
  75. package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +1 -1
  76. package/src/Atom/Link/_links.css +9 -0
  77. package/src/Atom/Link/link.twig +8 -2
  78. package/src/Atom/LinkedImage/linked-image.twig +1 -2
  79. package/src/Component/Accordion/Accordion.stories.ts +31 -0
  80. package/src/Component/Accordion/Accordion.tsx +3 -2
  81. package/src/Component/Accordion/AccordionItem.stories.ts +27 -0
  82. package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +36 -0
  83. package/src/Component/Accordion/__snapshots__/AccordionItem.stories.ts.snap +16 -0
  84. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +3 -6
  85. package/src/Component/Breadcrumb/breadcrumb.css +4 -0
  86. package/src/Component/Card/__snapshots__/Card.stories.ts.snap +11 -22
  87. package/src/Component/Card/card.css +2 -2
  88. package/src/Component/Carousel/Carousel.stories.ts +55 -0
  89. package/src/Component/Carousel/Carousel.stories.tsx +74 -0
  90. package/src/Component/Carousel/__snapshots__/Carousel.stories.ts.snap +273 -88
  91. package/src/Component/Carousel/__snapshots__/Carousel.stories.tsx.snap +5 -3
  92. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +12 -24
  93. package/src/Component/CookieConsent/cookie-consent.css +3 -1
  94. package/src/Component/Dialog/Dialog.stories.ts +33 -0
  95. package/src/Component/Dialog/Dialog.stories.tsx +25 -0
  96. package/src/Component/Dialog/Dialog.tsx +2 -2
  97. package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +33 -2
  98. package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +2 -0
  99. package/src/Component/DropMenu/DropMenu.stories.ts +39 -1
  100. package/src/Component/DropMenu/DropMenu.stories.tsx +29 -0
  101. package/src/Component/DropMenu/DropMenu.tsx +1 -1
  102. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +14 -0
  103. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +3 -1
  104. package/src/Component/Filters/Elements/Filters.ts +71 -1
  105. package/src/Component/Filters/FilterItem.stories.ts +2 -1
  106. package/src/Component/Filters/FilterItem.tsx +1 -1
  107. package/src/Component/Filters/Filters.figma.ts +1 -1
  108. package/src/Component/Filters/Filters.stories.ts +95 -3
  109. package/src/Component/Filters/Filters.stories.tsx +246 -17
  110. package/src/Component/Filters/Filters.tsx +145 -29
  111. package/src/Component/Filters/README.md +102 -37
  112. package/src/Component/Filters/__snapshots__/FilterItem.stories.tsx.snap +3 -3
  113. package/src/Component/Filters/__snapshots__/Filters.stories.ts.snap +82 -4
  114. package/src/Component/Filters/__snapshots__/Filters.stories.tsx.snap +9 -3
  115. package/src/Component/Filters/filters.css +11 -0
  116. package/src/Component/Gallery/Gallery.tsx +2 -2
  117. package/src/Component/HeroBanner/HeroBanner.stories.ts +1 -1
  118. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +4 -8
  119. package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +5 -10
  120. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +6 -12
  121. package/src/Component/InPageNavigation/InPageNavigation.stories.ts +50 -0
  122. package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +78 -0
  123. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +35 -1
  124. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +2 -0
  125. package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +6 -12
  126. package/src/Component/ListItem/__snapshots__/ListItem.stories.ts.snap +7 -14
  127. package/src/Component/ListItem/list-item.css +1 -1
  128. package/src/Component/Navigation/Dropdown.stories.tsx +46 -0
  129. package/src/Component/Navigation/Navigation.stories.ts +56 -0
  130. package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +2 -0
  131. package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +57 -0
  132. package/src/Component/Pagination/Components/PaginationContext.tsx +2 -1
  133. package/src/Component/Pagination/Components/PaginationItem.tsx +1 -1
  134. package/src/Component/Pagination/Pagination.stories.ts +36 -0
  135. package/src/Component/Pagination/Pagination.stories.tsx +31 -0
  136. package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +69 -12
  137. package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +3 -1
  138. package/src/Component/Pagination/pagination-item.twig +1 -1
  139. package/src/Component/Popover/__snapshots__/Popover.stories.ts.snap +13 -26
  140. package/src/Component/Popover/popover.css +1 -1
  141. package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +1 -2
  142. package/src/Component/SocialLinks/__snapshots__/SocialLinks.stories.ts.snap +6 -9
  143. package/src/Component/Steps/Steps.stories.ts +1 -1
  144. package/src/Component/Steps/steps.css +13 -0
  145. package/src/Component/Tabs/Tabs.stories.ts +22 -0
  146. package/src/Component/Tabs/Tabs.stories.tsx +24 -0
  147. package/src/Component/Tabs/Tabs.tsx +2 -2
  148. package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +18 -0
  149. package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +3 -1
  150. package/src/Component/Tabs/tabs.css +2 -0
  151. package/src/Form/Autocomplete/Autocomplete.stories.ts +81 -4
  152. package/src/Form/Autocomplete/Autocomplete.stories.tsx +85 -1
  153. package/src/Form/Autocomplete/Autocomplete.tsx +19 -6
  154. package/src/Form/Autocomplete/Elements/Autocomplete.ts +24 -1
  155. package/src/Form/Autocomplete/__snapshots__/Autocomplete.stories.ts.snap +38 -4
  156. package/src/Form/Autocomplete/__snapshots__/Autocomplete.stories.tsx.snap +8 -4
  157. package/src/Form/Autocomplete/autocomplete.css +12 -1
  158. package/src/Form/Autocomplete/autocomplete.twig +1 -1
  159. package/src/Form/OneTimeCode/OneTimeCode.stories.ts +20 -0
  160. package/src/Form/OneTimeCode/OneTimeCode.stories.tsx +18 -0
  161. package/src/Form/OneTimeCode/OneTimeCode.tsx +56 -0
  162. package/src/Form/OneTimeCode/README.md +83 -0
  163. package/src/Form/OneTimeCode/__snapshots__/OneTimeCode.stories.ts.snap +7 -0
  164. package/src/Form/OneTimeCode/__snapshots__/OneTimeCode.stories.tsx.snap +3 -0
  165. package/src/Form/OneTimeCode/one-time-code.css +13 -0
  166. package/src/Form/OneTimeCode/one-time-code.twig +31 -0
  167. package/src/Form/__snapshots__/Validation.stories.ts.snap +1 -1
  168. package/src/Form/form.css +90 -32
  169. package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +18 -33
  170. package/src/Layout/Header/Header.stories.ts +33 -0
  171. package/src/Layout/Header/Header.stories.tsx +31 -0
  172. package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +50 -0
  173. package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -0
  174. package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +8 -16
  175. package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +2 -4
  176. package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +4 -8
  177. package/src/Utility/Hooks/useIsomorphicLayoutEffect.ts +8 -0
  178. package/src/Utility/_mixins.css +24 -0
  179. package/src/Utility/print.css +1 -1
  180. package/src/Utility/utilities.css +20 -0
  181. package/src/_custom-media.css +1 -0
  182. package/src/enums.ts +5 -0
  183. package/src/react.ts +1 -0
  184. package/tools/test-utils/screen-reader.ts +33 -0
  185. package/dist/build/chunks/Gallery-BT3cxS5m.js +0 -1
  186. package/dist/build/chunks/GlobalToggle-DQHho97V.js +0 -1
  187. package/dist/build/chunks/Navigation-B9Wug-ok.js +0 -1
  188. package/dist/build/chunks/disclosure-widget-BETzOHLO.js +0 -1
  189. package/dist/build/chunks/utilities-C5dAO2YA.js +0 -1
@@ -4,6 +4,7 @@ import Component from "./Header"
4
4
  import { mixtapeLogo, navigationItems } from "../../../mockups/constants"
5
5
  import "./header.css"
6
6
  import { Page } from "../../../.storybook-react/decorators"
7
+ import { runScreenReaderWalkthrough } from "../../../tools/test-utils/screen-reader"
7
8
 
8
9
  const meta: Meta<typeof Component> = {
9
10
  decorators: [Page],
@@ -45,3 +46,33 @@ export const PrimaryHeader: StoryObj<typeof meta> = {
45
46
  })
46
47
  },
47
48
  }
49
+
50
+ /**
51
+ * Steps a virtual screen reader through the page and asserts on what it announces.
52
+ */
53
+ export const ScreenReaderAnnouncements: StoryObj<typeof meta> = {
54
+ play: async () => {
55
+ const log = await runScreenReaderWalkthrough()
56
+ await expect(log).toEqual([
57
+ "document",
58
+ "banner",
59
+ "image, Mixtape",
60
+ "navigation, Primary Navigation",
61
+ "list",
62
+ "listitem, level 1, position 1, set size 3",
63
+ "link, Home",
64
+ "button, Sub-navigation, not expanded",
65
+ "end of listitem, level 1, position 1, set size 3",
66
+ "listitem, level 1, position 2, set size 3",
67
+ "link, About",
68
+ "end of listitem, level 1, position 2, set size 3",
69
+ "listitem, level 1, position 3, set size 3",
70
+ "link, Contact",
71
+ "end of listitem, level 1, position 3, set size 3",
72
+ "end of list",
73
+ "end of navigation, Primary Navigation",
74
+ "end of banner",
75
+ "end of document",
76
+ ])
77
+ },
78
+ }
@@ -72,6 +72,56 @@ exports[`Header 1`] = `
72
72
  <div id="unique-0" class="mx-header__nav mx-header__collapse-toggle">
73
73
 
74
74
 
75
+ <mx-nav flyout="">
76
+ <nav class="mx-nav mx-nav--dropdown" aria-label="Primary navigation" id="header-story">
77
+ <ul class="mx-nav__level-1">
78
+ <li>
79
+ <a href="#">
80
+ News
81
+ </a>
82
+ </li>
83
+ <li>
84
+ <a href="#">
85
+ About us
86
+ </a>
87
+ </li>
88
+ <li>
89
+ <a href="#">
90
+ Contact
91
+ </a>
92
+ </li>
93
+ <li>
94
+ <a href="#">
95
+ Resources
96
+ </a>
97
+ </li>
98
+ </ul>
99
+
100
+ </nav>
101
+ </mx-nav>
102
+
103
+ </div>
104
+
105
+ </div>
106
+ </div>
107
+ </header>
108
+ "
109
+ `;
110
+
111
+ exports[`Screen Reader Announcements 1`] = `
112
+ "<header class="mx-header mx-page mx-section--s">
113
+ <div class="mx-header__inner">
114
+ <div class="mx-header__brand">
115
+ <img alt="Mixtape" src="./mixtape-logo.png" width="120" height="">
116
+
117
+ </div>
118
+ <div class="mx-header__toggles">
119
+ <mx-global-toggle><button aria-controls="unique-0" class="mx-button mx-button--icon-only mx-icon mx-icon--menu">Open Menu</button></mx-global-toggle>
120
+ </div>
121
+ <div class="mx-header__main">
122
+ <div id="unique-0" class="mx-header__nav mx-header__collapse-toggle">
123
+
124
+
75
125
  <mx-nav flyout="">
76
126
  <nav class="mx-nav mx-nav--dropdown" aria-label="Primary navigation" id="header-story">
77
127
  <ul class="mx-nav__level-1">
@@ -1,3 +1,5 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`Primary Header 1`] = `"<header class="mx-page mx-header mx-section--s"><div class="mx-header__inner"><div class="mx-header__brand"><img alt="Mixtape" src="mixtape-logo.png"></div><div class="mx-header__main"><div id="_r_0_" class="mx-header__nav mx-header__collapse-toggle"><nav class="mx-nav mx-nav--dropdown" aria-label="Primary Navigation" id="_r_0_"><ul class="mx-nav__level-1"><li class="mx-nav__has-subnav"><a href="http://example.com/#1" class="">Home</a><button aria-controls="_r_1_" aria-expanded="false" class="mx-nav__toggle mx-icon mx-icon--only mx-icon--chevron-down" type="button">Sub-navigation</button></li><li class=""><a href="http://example.com/#2" class="">About</a></li><li class=""><a href="http://example.com/#3" class="">Contact</a></li></ul></nav></div></div></div></header>"`;
4
+
5
+ exports[`Screen Reader Announcements 1`] = `"<header class="mx-page mx-header mx-section--s"><div class="mx-header__inner"><div class="mx-header__brand"><img alt="Mixtape" src="mixtape-logo.png"></div><div class="mx-header__main"><div id="_r_7_" class="mx-header__nav mx-header__collapse-toggle"><nav class="mx-nav mx-nav--dropdown" aria-label="Primary Navigation" id="_r_7_"><ul class="mx-nav__level-1"><li class="mx-nav__has-subnav"><a href="http://example.com/#1" class="">Home</a><button aria-controls="_r_8_" aria-expanded="false" class="mx-nav__toggle mx-icon mx-icon--only mx-icon--chevron-down" type="button">Sub-navigation</button></li><li class=""><a href="http://example.com/#2" class="">About</a></li><li class=""><a href="http://example.com/#3" class="">Contact</a></li></ul></nav></div></div></div></header>"`;
@@ -5,14 +5,12 @@ exports[`Light 1`] = `
5
5
 
6
6
  <a href="#content">
7
7
 
8
- <span>Skip to content</span>
9
-
8
+ Skip to content
10
9
  </a>
11
10
 
12
11
  <a href="#nav">
13
12
 
14
- <span>Skip to navigation</span>
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
- <span>Skip to content</span>
33
-
30
+ Skip to content
34
31
  </a>
35
32
 
36
33
  <a href="#nav">
37
34
 
38
- <span>Skip to navigation</span>
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
- <span>Skip to content</span>
57
-
52
+ Skip to content
58
53
  </a>
59
54
 
60
55
  <a href="#nav">
61
56
 
62
- <span>Skip to navigation</span>
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
- <span>Create account</span>
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
- <span>Log in</span>
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
- <span>See more content</span>
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
- <span>See more content</span>
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
- <span>See more content</span>
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
- <span>See more content</span>
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
- <span>See more content</span>
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
- <span>See more content</span>
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
@@ -8,6 +8,30 @@
8
8
  white-space: nowrap;
9
9
  }
10
10
 
11
+ /**
12
+ * Pseudo-elements that draw something — a masked icon, a radio dot — paint it
13
+ * with background-color, which forced-colors mode flattens to Canvas: the
14
+ * shape disappears. Opt the pseudo out and name a real system colour instead.
15
+ *
16
+ * currentcolor won't do: it inherits the parent's *computed* colour, and
17
+ * forcing happens later at used-value time — an opted-out pseudo would paint
18
+ * the brand colour and still vanish against a dark high-contrast background.
19
+ *
20
+ * --forced-colour carries the right system colour down from context; see the
21
+ * overrides on .mx-button, a[href] and :disabled.
22
+ *
23
+ * Add to any rule that paints a glyph via background-color.
24
+ */
25
+ /* stylelint-disable no-invalid-position-declaration -- the mixin body is
26
+ always inlined into a rule, so the declarations do have a parent. */
27
+ @define-mixin forced-colors-paint {
28
+ @media (--forced-colors) {
29
+ forced-color-adjust: none;
30
+ background-color: var(--forced-colour, CanvasText);
31
+ }
32
+ }
33
+ /* stylelint-enable no-invalid-position-declaration */
34
+
11
35
  @define-mixin sr-undo {
12
36
  clip-path: none;
13
37
  position: revert !important;
@@ -261,7 +261,7 @@
261
261
  }
262
262
  }
263
263
 
264
- .mx-card--block:has(a .sr-only:only-child) a {
264
+ .mx-card--block:has(a[aria-label]) a:not(:has(.mx-icon)) {
265
265
  margin-block-start: unset;
266
266
  }
267
267
 
@@ -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
+ }
@@ -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/enums.ts CHANGED
@@ -5,6 +5,11 @@
5
5
  */
6
6
  export const EMPTY_ARRAY: never[] = []
7
7
 
8
+ /**
9
+ * Shared debounce timer.
10
+ */
11
+ export const DEBOUNCE_MS = 400
12
+
8
13
  export enum Alignment {
9
14
  LEFT = "left",
10
15
  RIGHT = "right",
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};