@pnx-mixtape/mxds 0.0.15 → 0.0.17
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/dist/build/accordion.css +113 -1
- package/dist/build/accordion.entry.js +83 -1
- package/dist/build/accordion.entry.js.map +1 -0
- package/dist/build/base.css +1012 -1
- package/dist/build/breadcrumb.css +55 -1
- package/dist/build/button.css +127 -1
- package/dist/build/callout.css +11 -1
- package/dist/build/card.css +160 -1
- package/dist/build/carousel.css +125 -1
- package/dist/build/chunks/Accordion-O-huO4At.js +61 -0
- package/dist/build/chunks/Accordion-O-huO4At.js.map +1 -0
- package/dist/build/chunks/disclosure-widget-CtNx0f8p.js +124 -0
- package/dist/build/chunks/disclosure-widget-CtNx0f8p.js.map +1 -0
- package/dist/build/chunks/drop-menu.entry-BEhZ_Je3.js +132 -0
- package/dist/build/chunks/drop-menu.entry-BEhZ_Je3.js.map +1 -0
- package/dist/build/chunks/keyboard-C73DHu0c.js +101 -0
- package/dist/build/chunks/keyboard-C73DHu0c.js.map +1 -0
- package/dist/build/chunks/polyfills-DoxMZOqh.js +806 -0
- package/dist/build/chunks/polyfills-DoxMZOqh.js.map +1 -0
- package/dist/build/chunks/popover-DzUcnIlX.js +797 -0
- package/dist/build/chunks/popover-DzUcnIlX.js.map +1 -0
- package/dist/build/chunks/utilities-DXELy_An.js +245 -0
- package/dist/build/chunks/utilities-DXELy_An.js.map +1 -0
- package/dist/build/constants.css +151 -1
- package/dist/build/container-grid.css +186 -1
- package/dist/build/content-block.css +36 -1
- package/dist/build/dialog.css +116 -1
- package/dist/build/dialog.entry.js +93 -1
- package/dist/build/dialog.entry.js.map +1 -0
- package/dist/build/drop-menu.css +89 -1
- package/dist/build/drop-menu.entry.js +2 -1
- package/dist/build/drop-menu.entry.js.map +1 -0
- package/dist/build/drupal.css +70 -1
- package/dist/build/filters.css +117 -1
- package/dist/build/filters.entry.js +138 -1
- package/dist/build/filters.entry.js.map +1 -0
- package/dist/build/footer.css +141 -1
- package/dist/build/form.css +505 -1
- package/dist/build/global-alert.css +60 -1
- package/dist/build/global-alert.entry.js +68 -1
- package/dist/build/global-alert.entry.js.map +1 -0
- package/dist/build/grid.css +201 -1
- package/dist/build/header.css +161 -1
- package/dist/build/header.entry.js +103 -1
- package/dist/build/header.entry.js.map +1 -0
- package/dist/build/hero-banner.css +67 -1
- package/dist/build/icon.css +399 -1
- package/dist/build/in-page-alert.css +93 -1
- package/dist/build/in-page-navigation.css +17 -1
- package/dist/build/in-page-navigation.entry.js +99 -1
- package/dist/build/in-page-navigation.entry.js.map +1 -0
- package/dist/build/link-list.css +45 -1
- package/dist/build/list-item.css +29 -1
- package/dist/build/masthead.css +53 -1
- package/dist/build/navigation.css +391 -1
- package/dist/build/navigation.entry.js +124 -1
- package/dist/build/navigation.entry.js.map +1 -0
- package/dist/build/page.css +65 -1
- package/dist/build/pagination.css +117 -1
- package/dist/build/results-bar.css +21 -1
- package/dist/build/section.css +147 -1
- package/dist/build/side-navigation.css +85 -1
- package/dist/build/sidebar.css +53 -1
- package/dist/build/social-links.css +20 -1
- package/dist/build/steps.css +118 -1
- package/dist/build/sticky.css +47 -1
- package/dist/build/sticky.entry.js +60 -1
- package/dist/build/sticky.entry.js.map +1 -0
- package/dist/build/tabs.css +108 -1
- package/dist/build/tabs.entry.js +202 -1
- package/dist/build/tabs.entry.js.map +1 -0
- package/dist/build/tag.css +70 -1
- package/dist/build/utilities.css +178 -1
- package/package.json +11 -4
- package/src/Component/Card/Card.stories.ts +1 -1
- package/src/Component/Carousel/Carousel.stories.ts +1 -1
- package/src/Component/DropMenu/drop-menu.css +1 -1
- package/src/Component/ListItem/ListItem.stories.ts +1 -1
- package/src/Component/Tag/Tag.stories.ts +3 -3
- package/src/Component/Tag/tags.twig +2 -2
- package/src/Layout/Section/Section.stories.ts +2 -1
- package/src/Layout/Section/section.twig +3 -1
- package/dist/build/chunks/Accordion-RtUfbsTy.js +0 -1
- package/dist/build/chunks/disclosure-widget-CPdkUWkq.js +0 -1
- package/dist/build/chunks/drop-menu.entry-BqBzLfVC.js +0 -1
- package/dist/build/chunks/keyboard-Cs0cduxq.js +0 -1
- package/dist/build/chunks/polyfills-5KNOJw2W.js +0 -1
- package/dist/build/chunks/popover-CiVl-0jk.js +0 -1
- package/dist/build/chunks/utilities-CE6xwgqF.js +0 -2
|
@@ -0,0 +1,797 @@
|
|
|
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
|