@pnx-mixtape/mxds 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/.storybook/decorators.ts +1 -1
  2. package/.storybook/main.ts +9 -1
  3. package/.storybook/preview.ts +1 -0
  4. package/.storybook/theme-demo.css +17 -13
  5. package/.storybook/vitest.setup.ts +17 -0
  6. package/dist/build/accordion.css +76 -86
  7. package/dist/build/accordion.entry.js +46 -72
  8. package/dist/build/base.css +1 -993
  9. package/dist/build/breadcrumb.css +1 -55
  10. package/dist/build/button.css +1 -126
  11. package/dist/build/callout.css +1 -11
  12. package/dist/build/card.css +1 -161
  13. package/dist/build/carousel.css +1 -125
  14. package/dist/build/chunks/Accordion-Dwh42fp7.js +42 -0
  15. package/dist/build/chunks/DropMenu-plGsgySm.js +43 -0
  16. package/dist/build/chunks/Popover-Bws25suh.js +27 -0
  17. package/dist/build/chunks/polyfills-Du4RTZDf.js +511 -0
  18. package/dist/build/chunks/popover-Bd5oQ1Ic.js +407 -0
  19. package/dist/build/chunks/utilities-DepaJdUg.js +242 -0
  20. package/dist/build/constants.css +91 -123
  21. package/dist/build/container-grid.css +1 -186
  22. package/dist/build/content-block.css +1 -36
  23. package/dist/build/dialog.css +1 -108
  24. package/dist/build/dialog.entry.js +45 -85
  25. package/dist/build/drop-menu.css +1 -89
  26. package/dist/build/drop-menu.entry.js +2 -2
  27. package/dist/build/drupal.css +1 -66
  28. package/dist/build/filters.css +1 -117
  29. package/dist/build/filters.entry.js +113 -142
  30. package/dist/build/footer.css +1 -141
  31. package/dist/build/form.css +1 -491
  32. package/dist/build/global-alert.css +1 -60
  33. package/dist/build/global-alert.entry.js +51 -75
  34. package/dist/build/grid.css +1 -195
  35. package/dist/build/header.css +1 -149
  36. package/dist/build/header.entry.js +598 -1180
  37. package/dist/build/hero-banner.css +1 -73
  38. package/dist/build/icon.css +1 -399
  39. package/dist/build/in-page-alert.css +1 -93
  40. package/dist/build/in-page-navigation.css +1 -17
  41. package/dist/build/in-page-navigation.entry.js +67 -103
  42. package/dist/build/link-list.css +1 -45
  43. package/dist/build/list-item.css +1 -29
  44. package/dist/build/masthead.css +1 -53
  45. package/dist/build/navigation.css +1 -356
  46. package/dist/build/navigation.entry.js +79 -222
  47. package/dist/build/page.css +1 -65
  48. package/dist/build/pagination.css +1 -111
  49. package/dist/build/popover.css +1 -119
  50. package/dist/build/popover.entry.js +1 -2
  51. package/dist/build/results-bar.css +1 -21
  52. package/dist/build/section.css +1 -147
  53. package/dist/build/side-navigation.css +1 -85
  54. package/dist/build/sidebar.css +1 -53
  55. package/dist/build/social-links.css +1 -20
  56. package/dist/build/steps.css +1 -118
  57. package/dist/build/sticky.css +1 -47
  58. package/dist/build/sticky.entry.js +48 -59
  59. package/dist/build/tabs.css +1 -108
  60. package/dist/build/tabs.entry.js +130 -209
  61. package/dist/build/tag.css +1 -70
  62. package/dist/build/utilities.css +1 -186
  63. package/dist/build/utility-list.css +1 -43
  64. package/dist/build/utility-list.entry.js +52 -80
  65. package/package.json +40 -52
  66. package/src/Atom/Background/__snapshots__/Background.stories.ts.snap +61 -216
  67. package/src/Atom/Background/_background.css +2 -1
  68. package/src/Atom/Button/Button.stories.tsx +2 -0
  69. package/src/Atom/Button/__snapshots__/Button.stories.ts.snap +77 -97
  70. package/src/Atom/Button/__snapshots__/Button.stories.tsx.snap +3 -15
  71. package/src/Atom/DefinitionList/DefinitionList.stories.tsx +2 -1
  72. package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.ts.snap +13 -26
  73. package/src/Atom/DefinitionList/__snapshots__/DefinitionList.stories.tsx.snap +2 -29
  74. package/src/Atom/Heading/Heading.stories.tsx +2 -1
  75. package/src/Atom/Heading/__snapshots__/Heading.stories.ts.snap +9 -13
  76. package/src/Atom/Heading/__snapshots__/Heading.stories.tsx.snap +2 -8
  77. package/src/Atom/Icon/Icon.stories.tsx +2 -1
  78. package/src/Atom/Icon/__snapshots__/Icon.stories.ts.snap +21 -28
  79. package/src/Atom/Icon/__snapshots__/Icon.stories.tsx.snap +4 -15
  80. package/src/Atom/Icon/_icon.css +7 -6
  81. package/src/Atom/Image/__snapshots__/Image.stories.ts.snap +6 -9
  82. package/src/Atom/Link/Link.stories.tsx +2 -1
  83. package/src/Atom/Link/__snapshots__/Link.stories.ts.snap +47 -56
  84. package/src/Atom/Link/__snapshots__/Link.stories.tsx.snap +4 -22
  85. package/src/Atom/Media/Media.stories.ts +1 -1
  86. package/src/Atom/Media/Media.stories.tsx +2 -1
  87. package/src/Atom/Media/__snapshots__/Media.stories.ts.snap +27 -12
  88. package/src/Atom/Media/__snapshots__/Media.stories.tsx.snap +3 -16
  89. package/src/Atom/Spacing/__snapshots__/Spacing.stories.ts.snap +5 -8
  90. package/src/Atom/Table/TableResponsive.stories.ts +0 -1
  91. package/src/Atom/Table/__snapshots__/Table.stories.ts.snap +129 -261
  92. package/src/Atom/Table/__snapshots__/TableResponsive.stories.ts.snap +34 -67
  93. package/src/Atom/Text/Text.stories.tsx +2 -1
  94. package/src/Atom/Text/__snapshots__/Text.stories.ts.snap +32 -46
  95. package/src/Atom/Text/__snapshots__/Text.stories.tsx.snap +2 -6
  96. package/src/Atom/Video/__snapshots__/Video.stories.ts.snap +6 -11
  97. package/src/Atom/_flow.css +16 -1
  98. package/src/Component/Accordion/Accordion.stories.tsx +2 -0
  99. package/src/Component/Accordion/__snapshots__/Accordion.stories.ts.snap +106 -140
  100. package/src/Component/Accordion/__snapshots__/Accordion.stories.tsx.snap +3 -49
  101. package/src/Component/Accordion/__snapshots__/AccordionItem.stories.ts.snap +52 -81
  102. package/src/Component/Breadcrumb/Breadcrumb.stories.tsx +2 -0
  103. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.ts.snap +29 -33
  104. package/src/Component/Breadcrumb/__snapshots__/Breadcrumb.stories.tsx.snap +3 -62
  105. package/src/Component/Callout/__snapshots__/Callout.stories.ts.snap +9 -11
  106. package/src/Component/Card/Card.stories.tsx +2 -0
  107. package/src/Component/Card/__snapshots__/Card.stories.ts.snap +237 -272
  108. package/src/Component/Card/__snapshots__/Card.stories.tsx.snap +4 -85
  109. package/src/Component/Carousel/Elements/Carousel.ts +10 -7
  110. package/src/Component/Carousel/__snapshots__/Carousel.stories.ts.snap +992 -1187
  111. package/src/Component/ContentBlock/ContentBlock.stories.tsx +2 -0
  112. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.ts.snap +161 -155
  113. package/src/Component/ContentBlock/__snapshots__/ContentBlock.stories.tsx.snap +2 -25
  114. package/src/Component/Dialog/Dialog.stories.tsx +2 -0
  115. package/src/Component/Dialog/__snapshots__/Dialog.stories.ts.snap +92 -110
  116. package/src/Component/Dialog/__snapshots__/Dialog.stories.tsx.snap +2 -31
  117. package/src/Component/DropMenu/DropMenu.stories.tsx +2 -0
  118. package/src/Component/DropMenu/DropMenu.tsx +1 -3
  119. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.ts.snap +25 -72
  120. package/src/Component/DropMenu/__snapshots__/DropMenu.stories.tsx.snap +2 -46
  121. package/src/Component/Filters/__snapshots__/FilterItem.stories.ts.snap +80 -121
  122. package/src/Component/Filters/__snapshots__/Filters.stories.ts.snap +323 -424
  123. package/src/Component/GlobalAlert/GlobalAlert.stories.tsx +2 -0
  124. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.ts.snap +25 -37
  125. package/src/Component/GlobalAlert/__snapshots__/GlobalAlert.stories.tsx.snap +3 -46
  126. package/src/Component/HeroBanner/HeroBanner.stories.tsx +2 -0
  127. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.ts.snap +105 -106
  128. package/src/Component/HeroBanner/__snapshots__/HeroBanner.stories.tsx.snap +3 -34
  129. package/src/Component/HeroSearch/HeroSearch.stories.tsx +2 -0
  130. package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.ts.snap +121 -158
  131. package/src/Component/HeroSearch/__snapshots__/HeroSearch.stories.tsx.snap +3 -34
  132. package/src/Component/InPageAlert/InPageAlert.stories.tsx +2 -0
  133. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.ts.snap +87 -70
  134. package/src/Component/InPageAlert/__snapshots__/InPageAlert.stories.tsx.snap +5 -65
  135. package/src/Component/InPageNavigation/InPageNavigation.stories.ts +1 -0
  136. package/src/Component/InPageNavigation/InPageNavigation.stories.tsx +2 -0
  137. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.ts.snap +88 -208
  138. package/src/Component/InPageNavigation/__snapshots__/InPageNavigation.stories.tsx.snap +2 -148
  139. package/src/Component/InPageNavigation/in-page-navigation.css +5 -0
  140. package/src/Component/LinkList/LinkList.stories.tsx +2 -1
  141. package/src/Component/LinkList/__snapshots__/LinkList.stories.ts.snap +67 -66
  142. package/src/Component/LinkList/__snapshots__/LinkList.stories.tsx.snap +2 -32
  143. package/src/Component/ListItem/ListItem.stories.tsx +2 -1
  144. package/src/Component/ListItem/__snapshots__/ListItem.stories.ts.snap +153 -167
  145. package/src/Component/ListItem/__snapshots__/ListItem.stories.tsx.snap +2 -25
  146. package/src/Component/Navigation/Dropdown.stories.tsx +2 -0
  147. package/src/Component/Navigation/Elements/Navigation.ts +5 -5
  148. package/src/Component/Navigation/Navigation.stories.tsx +2 -0
  149. package/src/Component/Navigation/__snapshots__/Dropdown.stories.tsx.snap +2 -38
  150. package/src/Component/Navigation/__snapshots__/Navigation.stories.ts.snap +204 -279
  151. package/src/Component/Navigation/__snapshots__/Navigation.stories.tsx.snap +3 -59
  152. package/src/Component/Navigation/_navigation.css +2 -2
  153. package/src/Component/Pagination/Pagination.stories.tsx +2 -0
  154. package/src/Component/Pagination/__snapshots__/Pagination.stories.ts.snap +70 -60
  155. package/src/Component/Pagination/__snapshots__/Pagination.stories.tsx.snap +2 -62
  156. package/src/Component/Popover/Elements/Popover.ts +5 -1
  157. package/src/Component/Popover/__snapshots__/Popover.stories.ts.snap +366 -496
  158. package/src/Component/Popover/popover.css +3 -4
  159. package/src/Component/ResultsBar/ResultsBar.stories.tsx +2 -0
  160. package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.ts.snap +25 -46
  161. package/src/Component/ResultsBar/__snapshots__/ResultsBar.stories.tsx.snap +4 -50
  162. package/src/Component/SideNavigation/__snapshots__/SideNavigation.stories.ts.snap +76 -81
  163. package/src/Component/SocialLinks/__snapshots__/SocialLinks.stories.ts.snap +35 -32
  164. package/src/Component/SocialShare/SocialShare.stories.tsx +2 -1
  165. package/src/Component/SocialShare/__snapshots__/SocialShare.stories.ts.snap +11 -27
  166. package/src/Component/SocialShare/__snapshots__/SocialShare.stories.tsx.snap +4 -22
  167. package/src/Component/SocialShare/social-share.twig +1 -0
  168. package/src/Component/Steps/__snapshots__/StepItem.stories.ts.snap +11 -23
  169. package/src/Component/Steps/__snapshots__/Steps.stories.ts.snap +142 -173
  170. package/src/Component/Sticky/Sticky.stories.tsx +2 -0
  171. package/src/Component/Sticky/__snapshots__/Sticky.stories.ts.snap +6 -12
  172. package/src/Component/Sticky/__snapshots__/Sticky.stories.tsx.snap +2 -10
  173. package/src/Component/Tabs/Tabs.stories.tsx +2 -0
  174. package/src/Component/Tabs/__snapshots__/TabItem.stories.ts.snap +5 -9
  175. package/src/Component/Tabs/__snapshots__/Tabs.stories.ts.snap +37 -210
  176. package/src/Component/Tabs/__snapshots__/Tabs.stories.tsx.snap +2 -116
  177. package/src/Component/Tag/Tag.stories.tsx +2 -0
  178. package/src/Component/Tag/__snapshots__/Tag.stories.ts.snap +37 -61
  179. package/src/Component/Tag/__snapshots__/Tag.stories.tsx.snap +2 -6
  180. package/src/Component/Tag/tags.twig +6 -6
  181. package/src/Component/UtilityList/__snapshots__/UtilityList.stories.ts.snap +122 -245
  182. package/src/Component/UtilityList/utility-list.css +4 -0
  183. package/src/Component/UtilityList/utility-list.twig +2 -1
  184. package/src/Form/Checkbox/FormCheckbox.stories.tsx +2 -2
  185. package/src/Form/Checkbox/__snapshots__/Checkbox.stories.ts.snap +13 -26
  186. package/src/Form/Checkbox/__snapshots__/FormCheckbox.stories.tsx.snap +5 -0
  187. package/src/Form/Description/FormDescription.stories.tsx +2 -1
  188. package/src/Form/Description/__snapshots__/Description.stories.ts.snap +5 -9
  189. package/src/Form/Description/__snapshots__/FormDescription.stories.tsx.snap +2 -9
  190. package/src/Form/Description/__snapshots__/FormStatus.stories.ts.snap +9 -17
  191. package/src/Form/Form/Form.stories.tsx +2 -1
  192. package/src/Form/Form/FormTitle.stories.tsx +2 -1
  193. package/src/Form/Form/__snapshots__/Form.stories.tsx.snap +2 -5
  194. package/src/Form/Form/__snapshots__/FormTitle.stories.tsx.snap +2 -8
  195. package/src/Form/FormItem/FormItem.stories.tsx +8 -5
  196. package/src/Form/FormItem/__snapshots__/FormItem.stories.ts.snap +88 -129
  197. package/src/Form/Label/FormLabel.stories.tsx +2 -1
  198. package/src/Form/Label/__snapshots__/FormLabel.stories.tsx.snap +3 -18
  199. package/src/Form/Label/__snapshots__/Label.stories.ts.snap +13 -25
  200. package/src/Form/Radio/FormRadio.stories.tsx +2 -14
  201. package/src/Form/Radio/__snapshots__/FormRadio.stories.tsx.snap +3 -0
  202. package/src/Form/Radio/__snapshots__/Radio.stories.ts.snap +42 -57
  203. package/src/Form/Search/__snapshots__/Search.stories.ts.snap +11 -26
  204. package/src/Form/Select/FormSelect.stories.tsx +2 -1
  205. package/src/Form/Select/__snapshots__/FormSelect.stories.tsx.snap +2 -22
  206. package/src/Form/Select/__snapshots__/Select.stories.ts.snap +8 -19
  207. package/src/Form/TextInput/FormText.stories.tsx +2 -1
  208. package/src/Form/TextInput/__snapshots__/FormText.stories.tsx.snap +2 -12
  209. package/src/Form/TextInput/__snapshots__/InputDivider.stories.ts.snap +11 -26
  210. package/src/Form/TextInput/__snapshots__/TextInput.stories.ts.snap +11 -25
  211. package/src/Form/Textarea/FormTextarea.stories.tsx +2 -1
  212. package/src/Form/Textarea/__snapshots__/FormTextarea.stories.tsx.snap +2 -11
  213. package/src/Form/Textarea/__snapshots__/Textarea.stories.ts.snap +5 -11
  214. package/src/Layout/Footer/Footer.stories.ts +18 -1
  215. package/src/Layout/Footer/Footer.stories.tsx +2 -0
  216. package/src/Layout/Footer/__snapshots__/Footer.stories.ts.snap +360 -301
  217. package/src/Layout/Footer/__snapshots__/Footer.stories.tsx.snap +3 -62
  218. package/src/Layout/Footer/footer.css +16 -35
  219. package/src/Layout/Footer/footer.twig +6 -6
  220. package/src/Layout/Grid/Grid.stories.tsx +2 -0
  221. package/src/Layout/Grid/__snapshots__/Grid.stories.ts.snap +72 -66
  222. package/src/Layout/Grid/__snapshots__/Grid.stories.tsx.snap +6 -62
  223. package/src/Layout/Grid/__snapshots__/GridItem.stories.ts.snap +9 -13
  224. package/src/Layout/Header/Header.stories.tsx +2 -1
  225. package/src/Layout/Header/__snapshots__/Header.stories.ts.snap +315 -466
  226. package/src/Layout/Header/__snapshots__/Header.stories.tsx.snap +2 -58
  227. package/src/Layout/Masthead/__snapshots__/Masthead.stories.ts.snap +86 -87
  228. package/src/Layout/Page/Page.stories.tsx +2 -0
  229. package/src/Layout/Page/__snapshots__/Page.stories.tsx.snap +2 -81
  230. package/src/Layout/Section/__snapshots__/Background.stories.ts.snap +51 -61
  231. package/src/Layout/Section/__snapshots__/Breakouts.stories.ts.snap +34 -78
  232. package/src/Layout/Section/__snapshots__/Flow.stories.ts.snap +54 -89
  233. package/src/Layout/Section/__snapshots__/Section.stories.ts.snap +89 -99
  234. package/src/Layout/Section/__snapshots__/Section.stories.tsx.snap +4 -34
  235. package/src/Layout/Section/__snapshots__/SectionGrid.stories.tsx.snap +3 -35
  236. package/src/Layout/Section/section.twig +2 -2
  237. package/src/Layout/Sidebar/Sidebar.stories.tsx +1 -1
  238. package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.ts.snap +49 -40
  239. package/src/Layout/Sidebar/__snapshots__/Sidebar.stories.tsx.snap +4 -44
  240. package/src/Layout/Sidebar/sidebar.css +2 -2
  241. package/src/Layout/Sidebar/sidebar.twig +8 -5
  242. package/src/Utility/_layout-utils.css +9 -1
  243. package/src/constants.css +2 -2
  244. package/src/tokens.js +2 -2
  245. package/.storybook/test-runner.ts +0 -77
  246. package/dist/build/accordion.entry.js.map +0 -1
  247. package/dist/build/chunks/Accordion-D1HQ0FDq.js +0 -63
  248. package/dist/build/chunks/Accordion-D1HQ0FDq.js.map +0 -1
  249. package/dist/build/chunks/disclosure-widget-CdjCdx7t.js +0 -129
  250. package/dist/build/chunks/disclosure-widget-CdjCdx7t.js.map +0 -1
  251. package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js +0 -70
  252. package/dist/build/chunks/drop-menu.entry-fzV-_VFl.js.map +0 -1
  253. package/dist/build/chunks/polyfills-DnrsypYs.js +0 -812
  254. package/dist/build/chunks/polyfills-DnrsypYs.js.map +0 -1
  255. package/dist/build/chunks/popover-DzUcnIlX.js +0 -797
  256. package/dist/build/chunks/popover-DzUcnIlX.js.map +0 -1
  257. package/dist/build/chunks/popover.entry-BQvyR0d5.js +0 -38
  258. package/dist/build/chunks/popover.entry-BQvyR0d5.js.map +0 -1
  259. package/dist/build/chunks/utilities-Ci7wwNeg.js +0 -148
  260. package/dist/build/chunks/utilities-Ci7wwNeg.js.map +0 -1
  261. package/dist/build/dialog.entry.js.map +0 -1
  262. package/dist/build/drop-menu.entry.js.map +0 -1
  263. package/dist/build/filters.entry.js.map +0 -1
  264. package/dist/build/global-alert.entry.js.map +0 -1
  265. package/dist/build/header.entry.js.map +0 -1
  266. package/dist/build/in-page-navigation.entry.js.map +0 -1
  267. package/dist/build/navigation.entry.js.map +0 -1
  268. package/dist/build/popover.entry.js.map +0 -1
  269. package/dist/build/sticky.entry.js.map +0 -1
  270. package/dist/build/tabs.entry.js.map +0 -1
  271. package/dist/build/utility-list.entry.js.map +0 -1
  272. package/src/Form/FormItem/__snapshots__/FormItem.stories.tsx.snap +0 -110
@@ -1,797 +0,0 @@
1
- var ToggleEvent = class extends Event {
2
- oldState;
3
- newState;
4
- constructor(type, { oldState = "", newState = "", ...init } = {}) {
5
- super(type, init);
6
- this.oldState = String(oldState || "");
7
- this.newState = String(newState || "");
8
- }
9
- };
10
- var popoverToggleTaskQueue = /* @__PURE__ */ new WeakMap();
11
- function queuePopoverToggleEventTask(element, oldState, newState) {
12
- popoverToggleTaskQueue.set(
13
- element,
14
- setTimeout(() => {
15
- if (!popoverToggleTaskQueue.has(element)) return;
16
- element.dispatchEvent(
17
- new ToggleEvent("toggle", {
18
- cancelable: false,
19
- oldState,
20
- newState
21
- })
22
- );
23
- }, 0)
24
- );
25
- }
26
- var ShadowRoot = globalThis.ShadowRoot || function() {
27
- };
28
- var HTMLDialogElement = globalThis.HTMLDialogElement || function() {
29
- };
30
- var topLayerElements = /* @__PURE__ */ new WeakMap();
31
- var autoPopoverList = /* @__PURE__ */ new WeakMap();
32
- var hintPopoverList = /* @__PURE__ */ new WeakMap();
33
- var visibilityState = /* @__PURE__ */ new WeakMap();
34
- function getPopoverVisibilityState(popover) {
35
- return visibilityState.get(popover) || "hidden";
36
- }
37
- var popoverInvoker = /* @__PURE__ */ new WeakMap();
38
- function lastSetElement(set) {
39
- return [...set].pop();
40
- }
41
- function popoverTargetAttributeActivationBehavior(element) {
42
- const popover = element.popoverTargetElement;
43
- if (!(popover instanceof HTMLElement)) {
44
- return;
45
- }
46
- const visibility = getPopoverVisibilityState(popover);
47
- if (element.popoverTargetAction === "show" && visibility === "showing") {
48
- return;
49
- }
50
- if (element.popoverTargetAction === "hide" && visibility === "hidden") return;
51
- if (visibility === "showing") {
52
- hidePopover(popover, true, true);
53
- } else if (checkPopoverValidity(popover, false)) {
54
- popoverInvoker.set(popover, element);
55
- showPopover(popover);
56
- }
57
- }
58
- function checkPopoverValidity(element, expectedToBeShowing) {
59
- if (element.popover !== "auto" && element.popover !== "manual" && element.popover !== "hint") {
60
- return false;
61
- }
62
- if (!element.isConnected) return false;
63
- if (expectedToBeShowing && getPopoverVisibilityState(element) !== "showing") {
64
- return false;
65
- }
66
- if (!expectedToBeShowing && getPopoverVisibilityState(element) !== "hidden") {
67
- return false;
68
- }
69
- if (element instanceof HTMLDialogElement && element.hasAttribute("open")) {
70
- return false;
71
- }
72
- if (document.fullscreenElement === element) return false;
73
- return true;
74
- }
75
- function getStackPosition(popover) {
76
- if (!popover) return 0;
77
- const autoPopovers = autoPopoverList.get(document) || /* @__PURE__ */ new Set();
78
- const hintPopovers = hintPopoverList.get(document) || /* @__PURE__ */ new Set();
79
- if (hintPopovers.has(popover)) {
80
- return [...hintPopovers].indexOf(popover) + autoPopovers.size + 1;
81
- }
82
- if (autoPopovers.has(popover)) {
83
- return [...autoPopovers].indexOf(popover) + 1;
84
- }
85
- return 0;
86
- }
87
- function topMostClickedPopover(target) {
88
- const clickedPopover = nearestInclusiveOpenPopover(target);
89
- const invokerPopover = nearestInclusiveTargetPopoverForInvoker(target);
90
- if (getStackPosition(clickedPopover) > getStackPosition(invokerPopover)) {
91
- return clickedPopover;
92
- }
93
- return invokerPopover;
94
- }
95
- function topmostAutoOrHintPopover(document2) {
96
- let topmostPopover;
97
- const hintPopovers = hintPopoverList.get(document2) || /* @__PURE__ */ new Set();
98
- const autoPopovers = autoPopoverList.get(document2) || /* @__PURE__ */ new Set();
99
- const usedStack = hintPopovers.size > 0 ? hintPopovers : autoPopovers.size > 0 ? autoPopovers : null;
100
- if (usedStack) {
101
- topmostPopover = lastSetElement(usedStack);
102
- if (!topmostPopover.isConnected) {
103
- usedStack.delete(topmostPopover);
104
- return topmostAutoOrHintPopover(document2);
105
- }
106
- return topmostPopover;
107
- }
108
- return null;
109
- }
110
- function topMostPopoverInList(list) {
111
- for (const popover of list || []) {
112
- if (!popover.isConnected) {
113
- list.delete(popover);
114
- } else {
115
- return popover;
116
- }
117
- }
118
- return null;
119
- }
120
- function getRootNode(node) {
121
- if (typeof node.getRootNode === "function") {
122
- return node.getRootNode();
123
- }
124
- if (node.parentNode) return getRootNode(node.parentNode);
125
- return node;
126
- }
127
- function nearestInclusiveOpenPopover(node) {
128
- while (node) {
129
- if (node instanceof HTMLElement && node.popover === "auto" && visibilityState.get(node) === "showing") {
130
- return node;
131
- }
132
- node = node instanceof Element && node.assignedSlot || node.parentElement || getRootNode(node);
133
- if (node instanceof ShadowRoot) node = node.host;
134
- if (node instanceof Document) return;
135
- }
136
- }
137
- function nearestInclusiveTargetPopoverForInvoker(node) {
138
- while (node) {
139
- const nodePopover = node.popoverTargetElement;
140
- if (nodePopover instanceof HTMLElement) return nodePopover;
141
- node = node.parentElement || getRootNode(node);
142
- if (node instanceof ShadowRoot) node = node.host;
143
- if (node instanceof Document) return;
144
- }
145
- }
146
- function topMostPopoverAncestor(newPopover, list) {
147
- const popoverPositions = /* @__PURE__ */ new Map();
148
- let i = 0;
149
- for (const popover of list || []) {
150
- popoverPositions.set(popover, i);
151
- i += 1;
152
- }
153
- popoverPositions.set(newPopover, i);
154
- i += 1;
155
- let topMostPopoverAncestor2 = null;
156
- function checkAncestor(candidate) {
157
- if (!candidate) return;
158
- let okNesting = false;
159
- let candidateAncestor = null;
160
- let candidatePosition = null;
161
- while (!okNesting) {
162
- candidateAncestor = nearestInclusiveOpenPopover(candidate) || null;
163
- if (candidateAncestor === null) return;
164
- if (!popoverPositions.has(candidateAncestor)) return;
165
- if (newPopover.popover === "hint" || candidateAncestor.popover === "auto") {
166
- okNesting = true;
167
- }
168
- if (!okNesting) {
169
- candidate = candidateAncestor.parentElement;
170
- }
171
- }
172
- candidatePosition = popoverPositions.get(candidateAncestor);
173
- if (topMostPopoverAncestor2 === null || popoverPositions.get(topMostPopoverAncestor2) < candidatePosition) {
174
- topMostPopoverAncestor2 = candidateAncestor;
175
- }
176
- }
177
- checkAncestor(newPopover.parentElement || getRootNode(newPopover));
178
- return topMostPopoverAncestor2;
179
- }
180
- function isFocusable(focusTarget) {
181
- if (focusTarget.hidden || focusTarget instanceof ShadowRoot) return false;
182
- if (focusTarget instanceof HTMLButtonElement || focusTarget instanceof HTMLInputElement || focusTarget instanceof HTMLSelectElement || focusTarget instanceof HTMLTextAreaElement || focusTarget instanceof HTMLOptGroupElement || focusTarget instanceof HTMLOptionElement || focusTarget instanceof HTMLFieldSetElement) {
183
- if (focusTarget.disabled) return false;
184
- }
185
- if (focusTarget instanceof HTMLInputElement && focusTarget.type === "hidden") {
186
- return false;
187
- }
188
- if (focusTarget instanceof HTMLAnchorElement && focusTarget.href === "") {
189
- return false;
190
- }
191
- return typeof focusTarget.tabIndex === "number" && focusTarget.tabIndex !== -1;
192
- }
193
- function focusDelegate(focusTarget) {
194
- if (focusTarget.shadowRoot && focusTarget.shadowRoot.delegatesFocus !== true) {
195
- return null;
196
- }
197
- let whereToLook = focusTarget;
198
- if (whereToLook.shadowRoot) {
199
- whereToLook = whereToLook.shadowRoot;
200
- }
201
- let autoFocusDelegate = whereToLook.querySelector("[autofocus]");
202
- if (autoFocusDelegate) {
203
- return autoFocusDelegate;
204
- } else {
205
- const slots = whereToLook.querySelectorAll("slot");
206
- for (const slot of slots) {
207
- const assignedElements = slot.assignedElements({ flatten: true });
208
- for (const el of assignedElements) {
209
- if (el.hasAttribute("autofocus")) {
210
- return el;
211
- } else {
212
- autoFocusDelegate = el.querySelector("[autofocus]");
213
- if (autoFocusDelegate) {
214
- return autoFocusDelegate;
215
- }
216
- }
217
- }
218
- }
219
- }
220
- const walker = focusTarget.ownerDocument.createTreeWalker(
221
- whereToLook,
222
- NodeFilter.SHOW_ELEMENT
223
- );
224
- let descendant = walker.currentNode;
225
- while (descendant) {
226
- if (isFocusable(descendant)) {
227
- return descendant;
228
- }
229
- descendant = walker.nextNode();
230
- }
231
- }
232
- function popoverFocusingSteps(subject) {
233
- var _a;
234
- (_a = focusDelegate(subject)) == null ? void 0 : _a.focus();
235
- }
236
- var previouslyFocusedElements = /* @__PURE__ */ new WeakMap();
237
- function showPopover(element) {
238
- if (!checkPopoverValidity(element, false)) {
239
- return;
240
- }
241
- const document2 = element.ownerDocument;
242
- if (!element.dispatchEvent(
243
- new ToggleEvent("beforetoggle", {
244
- cancelable: true,
245
- oldState: "closed",
246
- newState: "open"
247
- })
248
- )) {
249
- return;
250
- }
251
- if (!checkPopoverValidity(element, false)) {
252
- return;
253
- }
254
- let shouldRestoreFocus = false;
255
- const originalType = element.popover;
256
- let stackToAppendTo = null;
257
- const autoAncestor = topMostPopoverAncestor(
258
- element,
259
- autoPopoverList.get(document2) || /* @__PURE__ */ new Set()
260
- );
261
- const hintAncestor = topMostPopoverAncestor(
262
- element,
263
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set()
264
- );
265
- if (originalType === "auto") {
266
- closeAllOpenPopoversInList(
267
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
268
- shouldRestoreFocus,
269
- true
270
- );
271
- const ancestor = autoAncestor || document2;
272
- hideAllPopoversUntil(ancestor, shouldRestoreFocus, true);
273
- stackToAppendTo = "auto";
274
- }
275
- if (originalType === "hint") {
276
- if (hintAncestor) {
277
- hideAllPopoversUntil(hintAncestor, shouldRestoreFocus, true);
278
- stackToAppendTo = "hint";
279
- } else {
280
- closeAllOpenPopoversInList(
281
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
282
- shouldRestoreFocus,
283
- true
284
- );
285
- if (autoAncestor) {
286
- hideAllPopoversUntil(autoAncestor, shouldRestoreFocus, true);
287
- stackToAppendTo = "auto";
288
- } else {
289
- stackToAppendTo = "hint";
290
- }
291
- }
292
- }
293
- if (originalType === "auto" || originalType === "hint") {
294
- if (originalType !== element.popover || !checkPopoverValidity(element, false)) {
295
- return;
296
- }
297
- if (!topmostAutoOrHintPopover(document2)) {
298
- shouldRestoreFocus = true;
299
- }
300
- if (stackToAppendTo === "auto") {
301
- if (!autoPopoverList.has(document2)) {
302
- autoPopoverList.set(document2, /* @__PURE__ */ new Set());
303
- }
304
- autoPopoverList.get(document2).add(element);
305
- } else if (stackToAppendTo === "hint") {
306
- if (!hintPopoverList.has(document2)) {
307
- hintPopoverList.set(document2, /* @__PURE__ */ new Set());
308
- }
309
- hintPopoverList.get(document2).add(element);
310
- }
311
- }
312
- previouslyFocusedElements.delete(element);
313
- const originallyFocusedElement = document2.activeElement;
314
- element.classList.add(":popover-open");
315
- visibilityState.set(element, "showing");
316
- if (!topLayerElements.has(document2)) {
317
- topLayerElements.set(document2, /* @__PURE__ */ new Set());
318
- }
319
- topLayerElements.get(document2).add(element);
320
- setInvokerAriaExpanded(popoverInvoker.get(element), true);
321
- popoverFocusingSteps(element);
322
- if (shouldRestoreFocus && originallyFocusedElement && element.popover === "auto") {
323
- previouslyFocusedElements.set(element, originallyFocusedElement);
324
- }
325
- queuePopoverToggleEventTask(element, "closed", "open");
326
- }
327
- function hidePopover(element, focusPreviousElement = false, fireEvents = false) {
328
- var _a, _b;
329
- if (!checkPopoverValidity(element, true)) {
330
- return;
331
- }
332
- const document2 = element.ownerDocument;
333
- if (["auto", "hint"].includes(element.popover)) {
334
- hideAllPopoversUntil(element, focusPreviousElement, fireEvents);
335
- if (!checkPopoverValidity(element, true)) {
336
- return;
337
- }
338
- }
339
- const autoList = autoPopoverList.get(document2) || /* @__PURE__ */ new Set();
340
- const autoPopoverListContainsElement = autoList.has(element) && lastSetElement(autoList) === element;
341
- setInvokerAriaExpanded(popoverInvoker.get(element), false);
342
- popoverInvoker.delete(element);
343
- if (fireEvents) {
344
- element.dispatchEvent(
345
- new ToggleEvent("beforetoggle", {
346
- oldState: "open",
347
- newState: "closed"
348
- })
349
- );
350
- if (autoPopoverListContainsElement && lastSetElement(autoList) !== element) {
351
- hideAllPopoversUntil(element, focusPreviousElement, fireEvents);
352
- }
353
- if (!checkPopoverValidity(element, true)) {
354
- return;
355
- }
356
- }
357
- (_a = topLayerElements.get(document2)) == null ? void 0 : _a.delete(element);
358
- autoList.delete(element);
359
- (_b = hintPopoverList.get(document2)) == null ? void 0 : _b.delete(element);
360
- element.classList.remove(":popover-open");
361
- visibilityState.set(element, "hidden");
362
- if (fireEvents) {
363
- queuePopoverToggleEventTask(element, "open", "closed");
364
- }
365
- const previouslyFocusedElement = previouslyFocusedElements.get(element);
366
- if (previouslyFocusedElement) {
367
- previouslyFocusedElements.delete(element);
368
- if (focusPreviousElement) {
369
- previouslyFocusedElement.focus();
370
- }
371
- }
372
- }
373
- function closeAllOpenPopovers(document2, focusPreviousElement = false, fireEvents = false) {
374
- let popover = topmostAutoOrHintPopover(document2);
375
- while (popover) {
376
- hidePopover(popover, focusPreviousElement, fireEvents);
377
- popover = topmostAutoOrHintPopover(document2);
378
- }
379
- }
380
- function closeAllOpenPopoversInList(list, focusPreviousElement = false, fireEvents = false) {
381
- let popover = topMostPopoverInList(list);
382
- while (popover) {
383
- hidePopover(popover, focusPreviousElement, fireEvents);
384
- popover = topMostPopoverInList(list);
385
- }
386
- }
387
- function hidePopoverStackUntil(endpoint, set, focusPreviousElement, fireEvents) {
388
- let repeatingHide = false;
389
- let hasRunOnce = false;
390
- while (repeatingHide || !hasRunOnce) {
391
- hasRunOnce = true;
392
- let lastToHide = null;
393
- let foundEndpoint = false;
394
- for (const popover of set) {
395
- if (popover === endpoint) {
396
- foundEndpoint = true;
397
- } else if (foundEndpoint) {
398
- lastToHide = popover;
399
- break;
400
- }
401
- }
402
- if (!lastToHide) return;
403
- while (getPopoverVisibilityState(lastToHide) === "showing" && set.size) {
404
- hidePopover(lastSetElement(set), focusPreviousElement, fireEvents);
405
- }
406
- if (set.has(endpoint) && lastSetElement(set) !== endpoint) {
407
- repeatingHide = true;
408
- }
409
- if (repeatingHide) {
410
- fireEvents = false;
411
- }
412
- }
413
- }
414
- function hideAllPopoversUntil(endpoint, focusPreviousElement, fireEvents) {
415
- var _a, _b;
416
- const document2 = endpoint.ownerDocument || endpoint;
417
- if (endpoint instanceof Document) {
418
- return closeAllOpenPopovers(document2, focusPreviousElement, fireEvents);
419
- }
420
- if ((_a = hintPopoverList.get(document2)) == null ? void 0 : _a.has(endpoint)) {
421
- hidePopoverStackUntil(
422
- endpoint,
423
- hintPopoverList.get(document2),
424
- focusPreviousElement,
425
- fireEvents
426
- );
427
- return;
428
- }
429
- closeAllOpenPopoversInList(
430
- hintPopoverList.get(document2) || /* @__PURE__ */ new Set(),
431
- focusPreviousElement,
432
- fireEvents
433
- );
434
- if (!((_b = autoPopoverList.get(document2)) == null ? void 0 : _b.has(endpoint))) {
435
- return;
436
- }
437
- hidePopoverStackUntil(
438
- endpoint,
439
- autoPopoverList.get(document2),
440
- focusPreviousElement,
441
- fireEvents
442
- );
443
- }
444
- var popoverPointerDownTargets = /* @__PURE__ */ new WeakMap();
445
- function lightDismissOpenPopovers(event) {
446
- if (!event.isTrusted) return;
447
- const target = event.composedPath()[0];
448
- if (!target) return;
449
- const document2 = target.ownerDocument;
450
- const topMostPopover = topmostAutoOrHintPopover(document2);
451
- if (!topMostPopover) return;
452
- const ancestor = topMostClickedPopover(target);
453
- if (ancestor && event.type === "pointerdown") {
454
- popoverPointerDownTargets.set(document2, ancestor);
455
- } else if (event.type === "pointerup") {
456
- const sameTarget = popoverPointerDownTargets.get(document2) === ancestor;
457
- popoverPointerDownTargets.delete(document2);
458
- if (sameTarget) {
459
- hideAllPopoversUntil(ancestor || document2, false, true);
460
- }
461
- }
462
- }
463
- var initialAriaExpandedValue = /* @__PURE__ */ new WeakMap();
464
- function setInvokerAriaExpanded(el, force = false) {
465
- if (!el) return;
466
- if (!initialAriaExpandedValue.has(el)) {
467
- initialAriaExpandedValue.set(el, el.getAttribute("aria-expanded"));
468
- }
469
- const popover = el.popoverTargetElement;
470
- if (popover instanceof HTMLElement && popover.popover === "auto") {
471
- el.setAttribute("aria-expanded", String(force));
472
- } else {
473
- const initialValue = initialAriaExpandedValue.get(el);
474
- if (!initialValue) {
475
- el.removeAttribute("aria-expanded");
476
- } else {
477
- el.setAttribute("aria-expanded", initialValue);
478
- }
479
- }
480
- }
481
- var ShadowRoot2 = globalThis.ShadowRoot || function() {
482
- };
483
- function isSupported() {
484
- return typeof HTMLElement !== "undefined" && typeof HTMLElement.prototype === "object" && "popover" in HTMLElement.prototype;
485
- }
486
- function patchSelectorFn(object, name, mapper) {
487
- const original = object[name];
488
- Object.defineProperty(object, name, {
489
- value(selector) {
490
- return original.call(this, mapper(selector));
491
- }
492
- });
493
- }
494
- var nonEscapedPopoverSelector = /(^|[^\\]):popover-open\b/g;
495
- function hasLayerSupport() {
496
- return typeof globalThis.CSSLayerBlockRule === "function";
497
- }
498
- function getStyles() {
499
- const useLayer = hasLayerSupport();
500
- return `
501
- ${useLayer ? "@layer popover-polyfill {" : ""}
502
- :where([popover]) {
503
- position: fixed;
504
- z-index: 2147483647;
505
- inset: 0;
506
- padding: 0.25em;
507
- width: fit-content;
508
- height: fit-content;
509
- border-width: initial;
510
- border-color: initial;
511
- border-image: initial;
512
- border-style: solid;
513
- background-color: canvas;
514
- color: canvastext;
515
- overflow: auto;
516
- margin: auto;
517
- }
518
-
519
- :where([popover]:not(.\\:popover-open)) {
520
- display: none;
521
- }
522
-
523
- :where(dialog[popover].\\:popover-open) {
524
- display: block;
525
- }
526
-
527
- :where(dialog[popover][open]) {
528
- display: revert;
529
- }
530
-
531
- :where([anchor].\\:popover-open) {
532
- inset: auto;
533
- }
534
-
535
- :where([anchor]:popover-open) {
536
- inset: auto;
537
- }
538
-
539
- @supports not (background-color: canvas) {
540
- :where([popover]) {
541
- background-color: white;
542
- color: black;
543
- }
544
- }
545
-
546
- @supports (width: -moz-fit-content) {
547
- :where([popover]) {
548
- width: -moz-fit-content;
549
- height: -moz-fit-content;
550
- }
551
- }
552
-
553
- @supports not (inset: 0) {
554
- :where([popover]) {
555
- top: 0;
556
- left: 0;
557
- right: 0;
558
- bottom: 0;
559
- }
560
- }
561
- ${useLayer ? "}" : ""}
562
- `;
563
- }
564
- var popoverStyleSheet = null;
565
- function injectStyles(root) {
566
- const styles = getStyles();
567
- if (popoverStyleSheet === null) {
568
- try {
569
- popoverStyleSheet = new CSSStyleSheet();
570
- popoverStyleSheet.replaceSync(styles);
571
- } catch {
572
- popoverStyleSheet = false;
573
- }
574
- }
575
- if (popoverStyleSheet === false) {
576
- const sheet = document.createElement("style");
577
- sheet.textContent = styles;
578
- if (root instanceof Document) {
579
- root.head.prepend(sheet);
580
- } else {
581
- root.prepend(sheet);
582
- }
583
- } else {
584
- root.adoptedStyleSheets = [popoverStyleSheet, ...root.adoptedStyleSheets];
585
- }
586
- }
587
- function apply() {
588
- if (typeof window === "undefined") return;
589
- window.ToggleEvent = window.ToggleEvent || ToggleEvent;
590
- function rewriteSelector(selector) {
591
- if (selector == null ? void 0 : selector.includes(":popover-open")) {
592
- selector = selector.replace(
593
- nonEscapedPopoverSelector,
594
- "$1.\\:popover-open"
595
- );
596
- }
597
- return selector;
598
- }
599
- patchSelectorFn(Document.prototype, "querySelector", rewriteSelector);
600
- patchSelectorFn(Document.prototype, "querySelectorAll", rewriteSelector);
601
- patchSelectorFn(Element.prototype, "querySelector", rewriteSelector);
602
- patchSelectorFn(Element.prototype, "querySelectorAll", rewriteSelector);
603
- patchSelectorFn(Element.prototype, "matches", rewriteSelector);
604
- patchSelectorFn(Element.prototype, "closest", rewriteSelector);
605
- patchSelectorFn(
606
- DocumentFragment.prototype,
607
- "querySelectorAll",
608
- rewriteSelector
609
- );
610
- Object.defineProperties(HTMLElement.prototype, {
611
- popover: {
612
- enumerable: true,
613
- configurable: true,
614
- get() {
615
- if (!this.hasAttribute("popover")) return null;
616
- const value = (this.getAttribute("popover") || "").toLowerCase();
617
- if (value === "" || value == "auto") return "auto";
618
- if (value == "hint") return "hint";
619
- return "manual";
620
- },
621
- set(value) {
622
- if (value === null) {
623
- this.removeAttribute("popover");
624
- } else {
625
- this.setAttribute("popover", value);
626
- }
627
- }
628
- },
629
- showPopover: {
630
- enumerable: true,
631
- configurable: true,
632
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
633
- value(options = {}) {
634
- showPopover(this);
635
- }
636
- },
637
- hidePopover: {
638
- enumerable: true,
639
- configurable: true,
640
- value() {
641
- hidePopover(this, true, true);
642
- }
643
- },
644
- togglePopover: {
645
- enumerable: true,
646
- configurable: true,
647
- value(options = {}) {
648
- if (typeof options === "boolean") {
649
- options = { force: options };
650
- }
651
- if (visibilityState.get(this) === "showing" && options.force === void 0 || options.force === false) {
652
- hidePopover(this, true, true);
653
- } else if (options.force === void 0 || options.force === true) {
654
- showPopover(this);
655
- }
656
- return visibilityState.get(this) === "showing";
657
- }
658
- }
659
- });
660
- const originalAttachShadow = Element.prototype.attachShadow;
661
- if (originalAttachShadow) {
662
- Object.defineProperties(Element.prototype, {
663
- attachShadow: {
664
- enumerable: true,
665
- configurable: true,
666
- writable: true,
667
- value(options) {
668
- const shadowRoot = originalAttachShadow.call(this, options);
669
- injectStyles(shadowRoot);
670
- return shadowRoot;
671
- }
672
- }
673
- });
674
- }
675
- const originalAttachInternals = HTMLElement.prototype.attachInternals;
676
- if (originalAttachInternals) {
677
- Object.defineProperties(HTMLElement.prototype, {
678
- attachInternals: {
679
- enumerable: true,
680
- configurable: true,
681
- writable: true,
682
- value() {
683
- const internals = originalAttachInternals.call(this);
684
- if (internals.shadowRoot) {
685
- injectStyles(internals.shadowRoot);
686
- }
687
- return internals;
688
- }
689
- }
690
- });
691
- }
692
- const popoverTargetAssociatedElements = /* @__PURE__ */ new WeakMap();
693
- function applyPopoverInvokerElementMixin(ElementClass) {
694
- Object.defineProperties(ElementClass.prototype, {
695
- popoverTargetElement: {
696
- enumerable: true,
697
- configurable: true,
698
- set(targetElement) {
699
- if (targetElement === null) {
700
- this.removeAttribute("popovertarget");
701
- popoverTargetAssociatedElements.delete(this);
702
- } else if (!(targetElement instanceof Element)) {
703
- throw new TypeError(
704
- `popoverTargetElement must be an element or null`
705
- );
706
- } else {
707
- this.setAttribute("popovertarget", "");
708
- popoverTargetAssociatedElements.set(this, targetElement);
709
- }
710
- },
711
- get() {
712
- if (this.localName !== "button" && this.localName !== "input") {
713
- return null;
714
- }
715
- if (this.localName === "input" && this.type !== "reset" && this.type !== "image" && this.type !== "button") {
716
- return null;
717
- }
718
- if (this.disabled) {
719
- return null;
720
- }
721
- if (this.form && this.type === "submit") {
722
- return null;
723
- }
724
- const targetElement = popoverTargetAssociatedElements.get(this);
725
- if (targetElement && targetElement.isConnected) {
726
- return targetElement;
727
- } else if (targetElement && !targetElement.isConnected) {
728
- popoverTargetAssociatedElements.delete(this);
729
- return null;
730
- }
731
- const root = getRootNode(this);
732
- const idref = this.getAttribute("popovertarget");
733
- if ((root instanceof Document || root instanceof ShadowRoot2) && idref) {
734
- return root.getElementById(idref) || null;
735
- }
736
- return null;
737
- }
738
- },
739
- popoverTargetAction: {
740
- enumerable: true,
741
- configurable: true,
742
- get() {
743
- const value = (this.getAttribute("popovertargetaction") || "").toLowerCase();
744
- if (value === "show" || value === "hide") return value;
745
- return "toggle";
746
- },
747
- set(value) {
748
- this.setAttribute("popovertargetaction", value);
749
- }
750
- }
751
- });
752
- }
753
- applyPopoverInvokerElementMixin(HTMLButtonElement);
754
- applyPopoverInvokerElementMixin(HTMLInputElement);
755
- const handleInvokerActivation = (event) => {
756
- if (event.defaultPrevented) {
757
- return;
758
- }
759
- const composedPath = event.composedPath();
760
- const target = composedPath[0];
761
- if (!(target instanceof Element) || (target == null ? void 0 : target.shadowRoot)) {
762
- return;
763
- }
764
- const root = getRootNode(target);
765
- if (!(root instanceof ShadowRoot2 || root instanceof Document)) {
766
- return;
767
- }
768
- const invoker = composedPath.find(
769
- (el) => {
770
- var _a;
771
- return (_a = el.matches) == null ? void 0 : _a.call(el, "[popovertargetaction],[popovertarget]");
772
- }
773
- );
774
- if (invoker) {
775
- popoverTargetAttributeActivationBehavior(invoker);
776
- event.preventDefault();
777
- return;
778
- }
779
- };
780
- const onKeydown = (event) => {
781
- const key = event.key;
782
- const target = event.target;
783
- if (!event.defaultPrevented && target && (key === "Escape" || key === "Esc")) {
784
- hideAllPopoversUntil(target.ownerDocument, true, true);
785
- }
786
- };
787
- const addEventListeners = (root) => {
788
- root.addEventListener("click", handleInvokerActivation);
789
- root.addEventListener("keydown", onKeydown);
790
- root.addEventListener("pointerdown", lightDismissOpenPopovers);
791
- root.addEventListener("pointerup", lightDismissOpenPopovers);
792
- };
793
- addEventListeners(document);
794
- injectStyles(document);
795
- }
796
- if (!isSupported()) apply();
797
- //# sourceMappingURL=popover-DzUcnIlX.js.map