vrembem 4.0.0-next.12 → 4.0.0-next.13
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/dev/index.js +2218 -1572
- package/dev/index.js.map +1 -1
- package/dev/index.umd.cjs +2220 -1574
- package/dev/index.umd.cjs.map +1 -1
- package/dist/index.js +913 -1251
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +22 -24
package/dev/index.umd.cjs
CHANGED
|
@@ -1,291 +1,136 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vrembem = {}));
|
|
3
3
|
})(this, function(exports2) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
"use strict";var __typeError = (msg) => {
|
|
5
|
+
throw TypeError(msg);
|
|
6
|
+
};
|
|
7
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
+
|
|
12
|
+
var _handler, _focusable, _handleFocusTrap, _handleFocusLock, _handleClick, _handleKeydown, _handleClick2, _handleKeydown2, _handleKeydown3;
|
|
13
|
+
class Breakpoint {
|
|
14
|
+
constructor(value, handler) {
|
|
15
|
+
__privateAdd(this, _handler);
|
|
16
|
+
this.value = value;
|
|
17
|
+
__privateSet(this, _handler, handler);
|
|
18
|
+
this.mql = null;
|
|
15
19
|
}
|
|
16
20
|
get handler() {
|
|
17
|
-
return
|
|
21
|
+
return __privateGet(this, _handler);
|
|
18
22
|
}
|
|
19
23
|
// Unmount existing handler before setting a new one.
|
|
20
|
-
set handler(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
mount(e, n) {
|
|
24
|
-
return e && (this.value = e), n && a$1(this, l$1, n), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), this.mql.addEventListener("change", o$2(this, l$1)), o$2(this, l$1).call(this, this.mql), this) : this;
|
|
25
|
-
}
|
|
26
|
-
unmount() {
|
|
27
|
-
return this.mql ? (this.mql.removeEventListener("change", o$2(this, l$1)), this.value = null, a$1(this, l$1, null), this.mql = null, this) : this;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
l$1 = /* @__PURE__ */ new WeakMap();
|
|
31
|
-
let S$3 = class S {
|
|
32
|
-
constructor() {
|
|
33
|
-
this.collection = [];
|
|
34
|
-
}
|
|
35
|
-
async register(e) {
|
|
36
|
-
return await this.deregister(e), this.collection.push(e), this.collection;
|
|
37
|
-
}
|
|
38
|
-
async deregister(e) {
|
|
39
|
-
const n = this.collection.findIndex((i) => i === e);
|
|
40
|
-
if (n >= 0) {
|
|
41
|
-
const i = this.collection[n];
|
|
42
|
-
Object.getOwnPropertyNames(i).forEach((r) => {
|
|
43
|
-
delete i[r];
|
|
44
|
-
}), this.collection.splice(n, 1);
|
|
24
|
+
set handler(func) {
|
|
25
|
+
if (this.mql) {
|
|
26
|
+
this.mql.removeEventListener("change", __privateGet(this, _handler));
|
|
45
27
|
}
|
|
46
|
-
|
|
28
|
+
__privateSet(this, _handler, func);
|
|
47
29
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return this.collection;
|
|
57
|
-
}
|
|
58
|
-
get(e, n = "id") {
|
|
59
|
-
return this.collection.find((i) => i[n] === e);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const s = {
|
|
63
|
-
inert: ":not([inert]):not([inert] *)",
|
|
64
|
-
negTabIndex: ':not([tabindex^="-"])',
|
|
65
|
-
disabled: ":not(:disabled)"
|
|
66
|
-
}, $$2 = [
|
|
67
|
-
`a[href]${s.inert}${s.negTabIndex}`,
|
|
68
|
-
`area[href]${s.inert}${s.negTabIndex}`,
|
|
69
|
-
`input:not([type="hidden"]):not([type="radio"])${s.inert}${s.negTabIndex}${s.disabled}`,
|
|
70
|
-
`input[type="radio"]${s.inert}${s.negTabIndex}${s.disabled}`,
|
|
71
|
-
`select${s.inert}${s.negTabIndex}${s.disabled}`,
|
|
72
|
-
`textarea${s.inert}${s.negTabIndex}${s.disabled}`,
|
|
73
|
-
`button${s.inert}${s.negTabIndex}${s.disabled}`,
|
|
74
|
-
`details${s.inert} > summary:first-of-type${s.negTabIndex}`,
|
|
75
|
-
// Discard until Firefox supports `:has()`
|
|
76
|
-
// See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
|
|
77
|
-
// `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
|
|
78
|
-
`iframe${s.inert}${s.negTabIndex}`,
|
|
79
|
-
`audio[controls]${s.inert}${s.negTabIndex}`,
|
|
80
|
-
`video[controls]${s.inert}${s.negTabIndex}`,
|
|
81
|
-
`[contenteditable]${s.inert}${s.negTabIndex}`,
|
|
82
|
-
`[tabindex]${s.inert}${s.negTabIndex}`
|
|
83
|
-
];
|
|
84
|
-
var f$2, u$1, d$2;
|
|
85
|
-
let q$2 = class q {
|
|
86
|
-
constructor(e = null, n = "[data-focus]") {
|
|
87
|
-
m$2(this, f$2);
|
|
88
|
-
m$2(this, u$1);
|
|
89
|
-
m$2(this, d$2);
|
|
90
|
-
this.el = e, this.selectorFocus = n, a$1(this, u$1, v$2.bind(this)), a$1(this, d$2, y$2.bind(this));
|
|
91
|
-
}
|
|
92
|
-
get focusable() {
|
|
93
|
-
return o$2(this, f$2);
|
|
94
|
-
}
|
|
95
|
-
set focusable(e) {
|
|
96
|
-
a$1(this, f$2, e), o$2(this, f$2).length ? (document.removeEventListener("keydown", o$2(this, d$2)), document.addEventListener("keydown", o$2(this, u$1))) : (document.removeEventListener("keydown", o$2(this, u$1)), document.addEventListener("keydown", o$2(this, d$2)));
|
|
97
|
-
}
|
|
98
|
-
get focusableFirst() {
|
|
99
|
-
return this.focusable[0];
|
|
100
|
-
}
|
|
101
|
-
get focusableLast() {
|
|
102
|
-
return this.focusable[this.focusable.length - 1];
|
|
103
|
-
}
|
|
104
|
-
mount(e, n) {
|
|
105
|
-
e && (this.el = e), n && (this.selectorFocus = n), this.focusable = this.getFocusable(), this.focus();
|
|
30
|
+
mount(value, handler) {
|
|
31
|
+
if (value) this.value = value;
|
|
32
|
+
if (handler) __privateSet(this, _handler, handler);
|
|
33
|
+
if (!this.value) return this;
|
|
34
|
+
this.mql = window.matchMedia(`(min-width: ${this.value})`);
|
|
35
|
+
this.mql.addEventListener("change", __privateGet(this, _handler));
|
|
36
|
+
__privateGet(this, _handler).call(this, this.mql);
|
|
37
|
+
return this;
|
|
106
38
|
}
|
|
107
39
|
unmount() {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const n = [], i = document.activeElement, r = e.scrollTop;
|
|
115
|
-
return e.querySelectorAll($$2.join(",")).forEach((h2) => {
|
|
116
|
-
h2.focus(), document.activeElement === h2 && n.push(h2);
|
|
117
|
-
}), e.scrollTop = r, i.focus(), n;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
f$2 = /* @__PURE__ */ new WeakMap(), u$1 = /* @__PURE__ */ new WeakMap(), d$2 = /* @__PURE__ */ new WeakMap();
|
|
121
|
-
function v$2(t) {
|
|
122
|
-
(t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
|
|
123
|
-
}
|
|
124
|
-
function y$2(t) {
|
|
125
|
-
(t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
|
|
126
|
-
}
|
|
127
|
-
function T$2() {
|
|
128
|
-
return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
|
|
129
|
-
}
|
|
130
|
-
function E$2(t, e = document.body) {
|
|
131
|
-
if (t.slice(0, 2) !== "--") {
|
|
132
|
-
const i = T$2();
|
|
133
|
-
i && (t = `${i}${t}`), t = `--${t}`;
|
|
40
|
+
if (!this.mql) return this;
|
|
41
|
+
this.mql.removeEventListener("change", __privateGet(this, _handler));
|
|
42
|
+
this.value = null;
|
|
43
|
+
__privateSet(this, _handler, null);
|
|
44
|
+
this.mql = null;
|
|
45
|
+
return this;
|
|
134
46
|
}
|
|
135
|
-
const n = getComputedStyle(e).getPropertyValue(t).trim();
|
|
136
|
-
if (n)
|
|
137
|
-
return n;
|
|
138
|
-
throw new Error(`CSS variable "${t}" was not found!`);
|
|
139
|
-
}
|
|
140
|
-
function F$3(t, e) {
|
|
141
|
-
const i = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
|
|
142
|
-
return i ? JSON.parse(i) : {};
|
|
143
|
-
}
|
|
144
|
-
function k$3(t, e = true) {
|
|
145
|
-
const n = localStorage.getItem(t), i = n ? JSON.parse(n) : {};
|
|
146
|
-
return {
|
|
147
|
-
get(r) {
|
|
148
|
-
return r ? i[r] : i;
|
|
149
|
-
},
|
|
150
|
-
set(r, c2) {
|
|
151
|
-
return c2 ? i[r] = c2 : delete i[r], e && localStorage.setItem(t, JSON.stringify(i)), i;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function w$2(t, e, n) {
|
|
156
|
-
const i = e.nodeType === Node.COMMENT_NODE, r = e.nodeType === Node.ELEMENT_NODE;
|
|
157
|
-
if (e = i || r ? e : document.querySelector(e), i && (n = "after"), !e) throw new Error(`Not a valid teleport reference: '${e}'`);
|
|
158
|
-
if (typeof e[n] != "function") throw new Error(`Not a valid teleport method: '${n}'`);
|
|
159
|
-
let c2 = null;
|
|
160
|
-
return i || (c2 = document.createComment("teleported #" + t.id), t.before(c2)), e[n](t), i && e.remove(), c2;
|
|
161
|
-
}
|
|
162
|
-
function C$2(t, e, n, i = "transition-duration") {
|
|
163
|
-
return new Promise((r) => {
|
|
164
|
-
if (typeof i == "string") {
|
|
165
|
-
const c2 = E$2(i, t), h2 = !!c2.includes("ms");
|
|
166
|
-
i = parseFloat(c2) * (h2 ? 1 : 1e3);
|
|
167
|
-
}
|
|
168
|
-
t.classList.remove(e.finish), t.classList.add(n.start), setTimeout(() => {
|
|
169
|
-
t.classList.add(n.finish), t.classList.remove(n.start), r(t);
|
|
170
|
-
}, i);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function p$2(t, e) {
|
|
174
|
-
e && document.querySelectorAll(e).forEach((i) => {
|
|
175
|
-
t ? i.style.overflow = "hidden" : i.style.removeProperty("overflow");
|
|
176
|
-
});
|
|
177
47
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
t ? (i.inert = true, i.setAttribute("aria-hidden", true)) : (i.inert = null, i.removeAttribute("aria-hidden"));
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
function N$3(t, e) {
|
|
184
|
-
x$2(!!t, e.selectorInert), p$2(!!t, e.selectorOverflow);
|
|
185
|
-
}
|
|
186
|
-
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
187
|
-
__proto__: null,
|
|
188
|
-
Breakpoint: L$2,
|
|
189
|
-
Collection: S$3,
|
|
190
|
-
FocusTrap: q$2,
|
|
191
|
-
cssVar: E$2,
|
|
192
|
-
getConfig: F$3,
|
|
193
|
-
getPrefix: T$2,
|
|
194
|
-
localStore: k$3,
|
|
195
|
-
teleport: w$2,
|
|
196
|
-
transition: C$2,
|
|
197
|
-
updateGlobalState: N$3
|
|
198
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
199
|
-
var I$1 = (t) => {
|
|
200
|
-
throw TypeError(t);
|
|
201
|
-
};
|
|
202
|
-
var O$1 = (t, s2, e) => s2.has(t) || I$1("Cannot " + e);
|
|
203
|
-
var w$1 = (t, s2, e) => (O$1(t, s2, "read from private field"), e ? e.call(t) : s2.get(t)), S$2 = (t, s2, e) => s2.has(t) ? I$1("Cannot add the same private member more than once") : s2 instanceof WeakSet ? s2.add(t) : s2.set(t, e), k$2 = (t, s2, e, i) => (O$1(t, s2, "write to private field"), s2.set(t, e), e);
|
|
204
|
-
var M$2 = (t) => {
|
|
205
|
-
throw TypeError(t);
|
|
206
|
-
}, y$1 = (t, s2, e) => s2.has(t) || M$2("Cannot " + e), l = (t, s2, e) => (y$1(t, s2, "read from private field"), e ? e.call(t) : s2.get(t)), $$1 = (t, s2, e) => s2.has(t) ? M$2("Cannot add the same private member more than once") : s2 instanceof WeakSet ? s2.add(t) : s2.set(t, e), h$1 = (t, s2, e, i) => (y$1(t, s2, "write to private field"), s2.set(t, e), e), d$1;
|
|
207
|
-
let B$2 = class B {
|
|
208
|
-
constructor(s2, e) {
|
|
209
|
-
$$1(this, d$1), this.value = s2, h$1(this, d$1, e), this.mql = null;
|
|
210
|
-
}
|
|
211
|
-
get handler() {
|
|
212
|
-
return l(this, d$1);
|
|
213
|
-
}
|
|
214
|
-
// Unmount existing handler before setting a new one.
|
|
215
|
-
set handler(s2) {
|
|
216
|
-
this.mql && this.mql.removeEventListener("change", l(this, d$1)), h$1(this, d$1, s2);
|
|
217
|
-
}
|
|
218
|
-
mount(s2, e) {
|
|
219
|
-
return s2 && (this.value = s2), e && h$1(this, d$1, e), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), this.mql.addEventListener("change", l(this, d$1)), l(this, d$1).call(this, this.mql), this) : this;
|
|
220
|
-
}
|
|
221
|
-
unmount() {
|
|
222
|
-
return this.mql ? (this.mql.removeEventListener("change", l(this, d$1)), this.value = null, h$1(this, d$1, null), this.mql = null, this) : this;
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
d$1 = /* @__PURE__ */ new WeakMap();
|
|
226
|
-
let j$1 = class j {
|
|
48
|
+
_handler = new WeakMap();
|
|
49
|
+
class Collection {
|
|
227
50
|
constructor() {
|
|
228
51
|
this.collection = [];
|
|
229
52
|
}
|
|
230
|
-
async register(
|
|
231
|
-
|
|
53
|
+
async register(item) {
|
|
54
|
+
await this.deregister(item);
|
|
55
|
+
this.collection.push(item);
|
|
56
|
+
return this.collection;
|
|
232
57
|
}
|
|
233
|
-
async deregister(
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
58
|
+
async deregister(ref) {
|
|
59
|
+
const index2 = this.collection.findIndex((entry) => {
|
|
60
|
+
return entry === ref;
|
|
61
|
+
});
|
|
62
|
+
if (index2 >= 0) {
|
|
63
|
+
const entry = this.collection[index2];
|
|
64
|
+
Object.getOwnPropertyNames(entry).forEach((prop) => {
|
|
65
|
+
delete entry[prop];
|
|
66
|
+
});
|
|
67
|
+
this.collection.splice(index2, 1);
|
|
240
68
|
}
|
|
241
69
|
return this.collection;
|
|
242
70
|
}
|
|
243
|
-
async registerCollection(
|
|
244
|
-
|
|
245
|
-
this.register(
|
|
246
|
-
}))
|
|
71
|
+
async registerCollection(items) {
|
|
72
|
+
await Promise.all(Array.from(items, (item) => {
|
|
73
|
+
this.register(item);
|
|
74
|
+
}));
|
|
75
|
+
return this.collection;
|
|
247
76
|
}
|
|
248
77
|
async deregisterCollection() {
|
|
249
|
-
|
|
78
|
+
while (this.collection.length > 0) {
|
|
250
79
|
await this.deregister(this.collection[0]);
|
|
80
|
+
}
|
|
251
81
|
return this.collection;
|
|
252
82
|
}
|
|
253
|
-
get(
|
|
254
|
-
return this.collection.find((
|
|
83
|
+
get(value, key = "id") {
|
|
84
|
+
return this.collection.find((item) => {
|
|
85
|
+
return item[key] === value;
|
|
86
|
+
});
|
|
255
87
|
}
|
|
256
|
-
}
|
|
257
|
-
const
|
|
88
|
+
}
|
|
89
|
+
const not = {
|
|
258
90
|
inert: ":not([inert]):not([inert] *)",
|
|
259
91
|
negTabIndex: ':not([tabindex^="-"])',
|
|
260
92
|
disabled: ":not(:disabled)"
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
`
|
|
264
|
-
`
|
|
265
|
-
`input[type="radio"]${
|
|
266
|
-
`
|
|
267
|
-
`
|
|
268
|
-
`
|
|
269
|
-
`
|
|
93
|
+
};
|
|
94
|
+
const focusableSelectors = [
|
|
95
|
+
`a[href]${not.inert}${not.negTabIndex}`,
|
|
96
|
+
`area[href]${not.inert}${not.negTabIndex}`,
|
|
97
|
+
`input:not([type="hidden"]):not([type="radio"])${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
98
|
+
`input[type="radio"]${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
99
|
+
`select${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
100
|
+
`textarea${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
101
|
+
`button${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
102
|
+
`details${not.inert} > summary:first-of-type${not.negTabIndex}`,
|
|
270
103
|
// Discard until Firefox supports `:has()`
|
|
271
104
|
// See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
|
|
272
105
|
// `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
|
|
273
|
-
`iframe${
|
|
274
|
-
`audio[controls]${
|
|
275
|
-
`video[controls]${
|
|
276
|
-
`[contenteditable]${
|
|
277
|
-
`[tabindex]${
|
|
106
|
+
`iframe${not.inert}${not.negTabIndex}`,
|
|
107
|
+
`audio[controls]${not.inert}${not.negTabIndex}`,
|
|
108
|
+
`video[controls]${not.inert}${not.negTabIndex}`,
|
|
109
|
+
`[contenteditable]${not.inert}${not.negTabIndex}`,
|
|
110
|
+
`[tabindex]${not.inert}${not.negTabIndex}`
|
|
278
111
|
];
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
112
|
+
class FocusTrap {
|
|
113
|
+
constructor(el = null, selectorFocus = "[data-focus]") {
|
|
114
|
+
__privateAdd(this, _focusable);
|
|
115
|
+
__privateAdd(this, _handleFocusTrap);
|
|
116
|
+
__privateAdd(this, _handleFocusLock);
|
|
117
|
+
this.el = el;
|
|
118
|
+
this.selectorFocus = selectorFocus;
|
|
119
|
+
__privateSet(this, _handleFocusTrap, handleFocusTrap.bind(this));
|
|
120
|
+
__privateSet(this, _handleFocusLock, handleFocusLock.bind(this));
|
|
283
121
|
}
|
|
284
122
|
get focusable() {
|
|
285
|
-
return
|
|
286
|
-
}
|
|
287
|
-
set focusable(
|
|
288
|
-
|
|
123
|
+
return __privateGet(this, _focusable);
|
|
124
|
+
}
|
|
125
|
+
set focusable(value) {
|
|
126
|
+
__privateSet(this, _focusable, value);
|
|
127
|
+
if (__privateGet(this, _focusable).length) {
|
|
128
|
+
document.removeEventListener("keydown", __privateGet(this, _handleFocusLock));
|
|
129
|
+
document.addEventListener("keydown", __privateGet(this, _handleFocusTrap));
|
|
130
|
+
} else {
|
|
131
|
+
document.removeEventListener("keydown", __privateGet(this, _handleFocusTrap));
|
|
132
|
+
document.addEventListener("keydown", __privateGet(this, _handleFocusLock));
|
|
133
|
+
}
|
|
289
134
|
}
|
|
290
135
|
get focusableFirst() {
|
|
291
136
|
return this.focusable[0];
|
|
@@ -293,82 +138,179 @@
|
|
|
293
138
|
get focusableLast() {
|
|
294
139
|
return this.focusable[this.focusable.length - 1];
|
|
295
140
|
}
|
|
296
|
-
mount(
|
|
297
|
-
|
|
141
|
+
mount(el, selectorFocus) {
|
|
142
|
+
if (el) this.el = el;
|
|
143
|
+
if (selectorFocus) this.selectorFocus = selectorFocus;
|
|
144
|
+
this.focusable = this.getFocusable();
|
|
145
|
+
this.focus();
|
|
298
146
|
}
|
|
299
147
|
unmount() {
|
|
300
|
-
this.el = null
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
148
|
+
this.el = null;
|
|
149
|
+
this.focusable = [];
|
|
150
|
+
document.removeEventListener("keydown", __privateGet(this, _handleFocusTrap));
|
|
151
|
+
document.removeEventListener("keydown", __privateGet(this, _handleFocusLock));
|
|
152
|
+
}
|
|
153
|
+
focus(el = this.el, selectorFocus = this.selectorFocus) {
|
|
154
|
+
const result = el.querySelector(selectorFocus) || el;
|
|
155
|
+
result.focus();
|
|
156
|
+
}
|
|
157
|
+
getFocusable(el = this.el) {
|
|
158
|
+
const focusable = [];
|
|
159
|
+
const initFocus = document.activeElement;
|
|
160
|
+
const initScrollTop = el.scrollTop;
|
|
161
|
+
const els = el.querySelectorAll(focusableSelectors.join(","));
|
|
162
|
+
els.forEach((el2) => {
|
|
163
|
+
el2.focus();
|
|
164
|
+
if (document.activeElement === el2) {
|
|
165
|
+
focusable.push(el2);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
el.scrollTop = initScrollTop;
|
|
169
|
+
initFocus.focus();
|
|
170
|
+
return focusable;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_focusable = new WeakMap();
|
|
174
|
+
_handleFocusTrap = new WeakMap();
|
|
175
|
+
_handleFocusLock = new WeakMap();
|
|
176
|
+
function handleFocusTrap(event) {
|
|
177
|
+
const isTab = event.key === "Tab" || event.keyCode === 9;
|
|
178
|
+
if (!isTab) return;
|
|
179
|
+
if (event.shiftKey) {
|
|
180
|
+
if (document.activeElement === this.focusableFirst || document.activeElement === this.el) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
this.focusableLast.focus();
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
if (document.activeElement === this.focusableLast || document.activeElement === this.el) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
this.focusableFirst.focus();
|
|
188
|
+
}
|
|
310
189
|
}
|
|
311
|
-
};
|
|
312
|
-
v$1 = /* @__PURE__ */ new WeakMap(), g$1 = /* @__PURE__ */ new WeakMap(), f$1 = /* @__PURE__ */ new WeakMap();
|
|
313
|
-
function K$2(t) {
|
|
314
|
-
(t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
|
|
315
190
|
}
|
|
316
|
-
function
|
|
317
|
-
|
|
191
|
+
function handleFocusLock(event) {
|
|
192
|
+
const isTab = event.key === "Tab" || event.keyCode === 9;
|
|
193
|
+
if (isTab) event.preventDefault();
|
|
318
194
|
}
|
|
319
|
-
function
|
|
195
|
+
function getPrefix() {
|
|
320
196
|
return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
|
|
321
197
|
}
|
|
322
|
-
function
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
|
|
198
|
+
function cssVar(property, el = document.body) {
|
|
199
|
+
if (property.slice(0, 2) !== "--") {
|
|
200
|
+
const prefixValue = getPrefix();
|
|
201
|
+
if (prefixValue) {
|
|
202
|
+
property = `${prefixValue}${property}`;
|
|
203
|
+
}
|
|
204
|
+
property = `--${property}`;
|
|
205
|
+
}
|
|
206
|
+
const cssValue = getComputedStyle(el).getPropertyValue(property).trim();
|
|
207
|
+
if (cssValue) {
|
|
208
|
+
return cssValue;
|
|
209
|
+
} else {
|
|
210
|
+
throw new Error(`CSS variable "${property}" was not found!`);
|
|
326
211
|
}
|
|
327
|
-
const e = getComputedStyle(s2).getPropertyValue(t).trim();
|
|
328
|
-
if (e)
|
|
329
|
-
return e;
|
|
330
|
-
throw new Error(`CSS variable "${t}" was not found!`);
|
|
331
212
|
}
|
|
332
|
-
function
|
|
333
|
-
const
|
|
334
|
-
|
|
213
|
+
function getConfig$1(el, dataConfig) {
|
|
214
|
+
const string = el.getAttribute(`data-${dataConfig}`) || "";
|
|
215
|
+
const json = string.replace(/'/g, '"');
|
|
216
|
+
return json ? JSON.parse(json) : {};
|
|
335
217
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
218
|
+
function localStore(key, enable = true) {
|
|
219
|
+
const local = localStorage.getItem(key);
|
|
220
|
+
const store = local ? JSON.parse(local) : {};
|
|
338
221
|
return {
|
|
339
|
-
get(
|
|
340
|
-
return
|
|
222
|
+
get(prop) {
|
|
223
|
+
return prop ? store[prop] : store;
|
|
341
224
|
},
|
|
342
|
-
set(
|
|
343
|
-
|
|
225
|
+
set(prop, value) {
|
|
226
|
+
if (value) {
|
|
227
|
+
store[prop] = value;
|
|
228
|
+
} else {
|
|
229
|
+
delete store[prop];
|
|
230
|
+
}
|
|
231
|
+
if (enable) localStorage.setItem(key, JSON.stringify(store));
|
|
232
|
+
return store;
|
|
344
233
|
}
|
|
345
234
|
};
|
|
346
235
|
}
|
|
347
|
-
function
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
236
|
+
function teleport(what, where, how) {
|
|
237
|
+
const isComment = where.nodeType === Node.COMMENT_NODE;
|
|
238
|
+
const isElement2 = where.nodeType === Node.ELEMENT_NODE;
|
|
239
|
+
where = isComment || isElement2 ? where : document.querySelector(where);
|
|
240
|
+
if (isComment) how = "after";
|
|
241
|
+
if (!where) throw new Error(`Not a valid teleport reference: '${where}'`);
|
|
242
|
+
if (typeof where[how] != "function") throw new Error(`Not a valid teleport method: '${how}'`);
|
|
243
|
+
let returnRef = null;
|
|
244
|
+
if (!isComment) {
|
|
245
|
+
returnRef = document.createComment("teleported #" + what.id);
|
|
246
|
+
what.before(returnRef);
|
|
247
|
+
}
|
|
248
|
+
where[how](what);
|
|
249
|
+
if (isComment) {
|
|
250
|
+
where.remove();
|
|
251
|
+
}
|
|
252
|
+
return returnRef;
|
|
253
|
+
}
|
|
254
|
+
function transition(el, from, to, duration = "transition-duration") {
|
|
255
|
+
return new Promise((resolve) => {
|
|
256
|
+
if (typeof duration === "string") {
|
|
257
|
+
const cssValue = cssVar(duration, el);
|
|
258
|
+
const ms = cssValue.includes("ms") ? true : false;
|
|
259
|
+
duration = parseFloat(cssValue) * (ms ? 1 : 1e3);
|
|
352
260
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
261
|
+
el.classList.remove(from.finish);
|
|
262
|
+
el.classList.add(to.start);
|
|
263
|
+
setTimeout(() => {
|
|
264
|
+
el.classList.add(to.finish);
|
|
265
|
+
el.classList.remove(to.start);
|
|
266
|
+
resolve(el);
|
|
267
|
+
}, duration);
|
|
356
268
|
});
|
|
357
269
|
}
|
|
358
|
-
function
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
270
|
+
function setOverflowHidden(state, selector) {
|
|
271
|
+
if (selector) {
|
|
272
|
+
const els = document.querySelectorAll(selector);
|
|
273
|
+
els.forEach((el) => {
|
|
274
|
+
if (state) {
|
|
275
|
+
el.style.overflow = "hidden";
|
|
276
|
+
} else {
|
|
277
|
+
el.style.removeProperty("overflow");
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
362
281
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
282
|
+
function setInert(state, selector) {
|
|
283
|
+
if (selector) {
|
|
284
|
+
const els = document.querySelectorAll(selector);
|
|
285
|
+
els.forEach((el) => {
|
|
286
|
+
if (state) {
|
|
287
|
+
el.inert = true;
|
|
288
|
+
el.setAttribute("aria-hidden", true);
|
|
289
|
+
} else {
|
|
290
|
+
el.inert = null;
|
|
291
|
+
el.removeAttribute("aria-hidden");
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
367
295
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
296
|
+
function updateGlobalState(state, config) {
|
|
297
|
+
setInert(!!state, config.selectorInert);
|
|
298
|
+
setOverflowHidden(!!state, config.selectorOverflow);
|
|
370
299
|
}
|
|
371
|
-
const
|
|
300
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
301
|
+
__proto__: null,
|
|
302
|
+
Breakpoint,
|
|
303
|
+
Collection,
|
|
304
|
+
FocusTrap,
|
|
305
|
+
cssVar,
|
|
306
|
+
getConfig: getConfig$1,
|
|
307
|
+
getPrefix,
|
|
308
|
+
localStore,
|
|
309
|
+
teleport,
|
|
310
|
+
transition,
|
|
311
|
+
updateGlobalState
|
|
312
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
313
|
+
const defaults$2 = {
|
|
372
314
|
autoMount: false,
|
|
373
315
|
// Data attributes
|
|
374
316
|
dataOpen: "drawer-open",
|
|
@@ -400,372 +342,397 @@
|
|
|
400
342
|
transition: true,
|
|
401
343
|
transitionDuration: "drawer-transition-duration"
|
|
402
344
|
};
|
|
403
|
-
function
|
|
404
|
-
|
|
345
|
+
function applyInitialState(entry) {
|
|
346
|
+
if (entry.store === "opened") {
|
|
347
|
+
entry.open(false, false);
|
|
348
|
+
} else if (entry.store === "closed") {
|
|
349
|
+
entry.close(false, false);
|
|
350
|
+
} else if (entry.store === "indeterminate") {
|
|
351
|
+
entry.state = "indeterminate";
|
|
352
|
+
} else {
|
|
353
|
+
if (entry.el.classList.contains(entry.getSetting("stateOpened"))) {
|
|
354
|
+
entry.open(false, false);
|
|
355
|
+
} else if (entry.el.classList.contains(entry.getSetting("stateClosed"))) {
|
|
356
|
+
entry.close(false, false);
|
|
357
|
+
} else {
|
|
358
|
+
entry.state = "indeterminate";
|
|
359
|
+
}
|
|
360
|
+
}
|
|
405
361
|
}
|
|
406
|
-
async function
|
|
407
|
-
|
|
362
|
+
async function applyInlineState(entry) {
|
|
363
|
+
if (entry.store === "opened") {
|
|
364
|
+
await entry.open(false, false);
|
|
365
|
+
} else if (entry.store === "closed") {
|
|
366
|
+
await entry.close(false, false);
|
|
367
|
+
} else if (entry.store === "indeterminate") {
|
|
368
|
+
if (entry.state != "indeterminate") {
|
|
369
|
+
entry.state = "indeterminate";
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
if (entry.state != entry.inlineState) {
|
|
373
|
+
entry.state = entry.inlineState;
|
|
374
|
+
}
|
|
375
|
+
if (entry.inlineState === "opened") {
|
|
376
|
+
await entry.open(false, false);
|
|
377
|
+
} else if (entry.inlineState === "closed") {
|
|
378
|
+
await entry.close(false, false);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
408
381
|
}
|
|
409
|
-
function
|
|
410
|
-
const
|
|
411
|
-
|
|
382
|
+
function getBreakpoint(drawer) {
|
|
383
|
+
const prefix = getPrefix();
|
|
384
|
+
const bp = drawer.getAttribute(`data-${this.settings.dataBreakpoint}`);
|
|
385
|
+
if (this.settings.breakpoints && this.settings.breakpoints[bp]) {
|
|
386
|
+
return this.settings.breakpoints[bp];
|
|
387
|
+
} else if (getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim()) {
|
|
388
|
+
return getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim();
|
|
389
|
+
} else {
|
|
390
|
+
return bp;
|
|
391
|
+
}
|
|
412
392
|
}
|
|
413
|
-
function
|
|
414
|
-
const
|
|
415
|
-
if (
|
|
416
|
-
return
|
|
417
|
-
|
|
393
|
+
function getDrawer(query) {
|
|
394
|
+
const entry = typeof query === "string" ? this.get(query) : this.get(query.id);
|
|
395
|
+
if (entry) {
|
|
396
|
+
return entry;
|
|
397
|
+
} else {
|
|
398
|
+
throw new Error(`Drawer not found in collection with id of "${query.id || query}".`);
|
|
399
|
+
}
|
|
418
400
|
}
|
|
419
|
-
function
|
|
420
|
-
|
|
401
|
+
function updateFocusState$1(entry) {
|
|
402
|
+
if (entry.state === "opened") {
|
|
403
|
+
if (entry.mode === "modal") {
|
|
404
|
+
this.focusTrap.mount(entry.dialog, this.settings.selectorFocus);
|
|
405
|
+
} else {
|
|
406
|
+
this.focusTrap.focus(entry.dialog, this.settings.selectorFocus);
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
if (entry.trigger) {
|
|
410
|
+
entry.trigger.focus();
|
|
411
|
+
entry.trigger = null;
|
|
412
|
+
}
|
|
413
|
+
this.focusTrap.unmount();
|
|
414
|
+
}
|
|
421
415
|
}
|
|
422
|
-
async function
|
|
423
|
-
const
|
|
416
|
+
async function handleClick$2(event) {
|
|
417
|
+
const trigger = event.target.closest(`
|
|
424
418
|
[data-${this.settings.dataOpen}],
|
|
425
419
|
[data-${this.settings.dataToggle}],
|
|
426
420
|
[data-${this.settings.dataClose}]
|
|
427
421
|
`);
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
422
|
+
if (trigger) {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
if (trigger.matches(`[data-${this.settings.dataToggle}]`)) {
|
|
425
|
+
const selectors = trigger.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ");
|
|
426
|
+
selectors.forEach((selector) => {
|
|
427
|
+
const entry = getDrawer.call(this, selector);
|
|
428
|
+
entry.trigger = trigger;
|
|
429
|
+
return entry.toggle();
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (trigger.matches(`[data-${this.settings.dataOpen}]`)) {
|
|
433
|
+
const selectors = trigger.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ");
|
|
434
|
+
selectors.forEach((selector) => {
|
|
435
|
+
const entry = getDrawer.call(this, selector);
|
|
436
|
+
entry.trigger = trigger;
|
|
437
|
+
return entry.open();
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
if (trigger.matches(`[data-${this.settings.dataClose}]`)) {
|
|
441
|
+
const selectors = trigger.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ");
|
|
442
|
+
selectors.forEach((selector) => {
|
|
443
|
+
if (selector) {
|
|
444
|
+
const entry = getDrawer.call(this, selector);
|
|
445
|
+
entry.trigger = trigger;
|
|
446
|
+
return entry.close();
|
|
447
|
+
} else {
|
|
448
|
+
const parent = event.target.closest(this.settings.selectorDrawer);
|
|
449
|
+
if (parent) return this.close(parent);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
444
453
|
return;
|
|
445
454
|
}
|
|
446
|
-
if (this.activeModal &&
|
|
455
|
+
if (this.activeModal && event.target.matches(this.settings.selectorScreen)) {
|
|
447
456
|
return this.close(this.activeModal.id);
|
|
457
|
+
}
|
|
448
458
|
}
|
|
449
|
-
function
|
|
450
|
-
if (
|
|
451
|
-
return this.close(this.activeModal);
|
|
459
|
+
function handleKeydown$2(event) {
|
|
460
|
+
if (event.key === "Escape") {
|
|
461
|
+
if (this.activeModal) return this.close(this.activeModal);
|
|
462
|
+
}
|
|
452
463
|
}
|
|
453
|
-
async function
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
464
|
+
async function deregister$2(obj, close2 = true) {
|
|
465
|
+
const index2 = this.collection.findIndex((entry) => {
|
|
466
|
+
return entry.id === obj.id;
|
|
467
|
+
});
|
|
468
|
+
if (index2 >= 0) {
|
|
469
|
+
const entry = this.collection[index2];
|
|
470
|
+
if (close2 && entry.state === "opened") {
|
|
471
|
+
await entry.close(false);
|
|
472
|
+
}
|
|
473
|
+
this.store.set(entry.id);
|
|
474
|
+
entry.unmountBreakpoint();
|
|
475
|
+
Object.getOwnPropertyNames(entry).forEach((prop) => {
|
|
476
|
+
delete entry[prop];
|
|
477
|
+
});
|
|
478
|
+
this.collection.splice(index2, 1);
|
|
460
479
|
}
|
|
461
480
|
return this.collection;
|
|
462
481
|
}
|
|
463
|
-
async function
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
482
|
+
async function open$2(query, enableTransition, focus = true) {
|
|
483
|
+
const entry = getDrawer.call(this, query);
|
|
484
|
+
const config = { ...this.settings, ...entry.settings };
|
|
485
|
+
if (enableTransition !== void 0) config.transition = enableTransition;
|
|
486
|
+
if (entry.state === "closed" || entry.state === "indeterminate") {
|
|
487
|
+
entry.state = "opening";
|
|
488
|
+
if (config.transition) {
|
|
489
|
+
await transition(entry.el, {
|
|
490
|
+
start: config.stateClosing,
|
|
491
|
+
finish: config.stateClosed
|
|
492
|
+
}, {
|
|
493
|
+
start: config.stateOpening,
|
|
494
|
+
finish: config.stateOpened
|
|
495
|
+
}, config.transitionDuration);
|
|
496
|
+
} else {
|
|
497
|
+
entry.el.classList.add(config.stateOpened);
|
|
498
|
+
entry.el.classList.remove(config.stateClosed);
|
|
499
|
+
}
|
|
500
|
+
entry.state = "opened";
|
|
501
|
+
if (entry.mode === "modal") updateGlobalState(true, config);
|
|
502
|
+
if (focus) {
|
|
503
|
+
updateFocusState$1.call(this, entry);
|
|
504
|
+
}
|
|
505
|
+
entry.el.dispatchEvent(new CustomEvent(config.customEventPrefix + "opened", {
|
|
506
|
+
detail: this,
|
|
507
|
+
bubbles: true
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
return entry;
|
|
511
|
+
}
|
|
512
|
+
async function close$2(query, enableTransition, focus = true) {
|
|
513
|
+
const entry = getDrawer.call(this, query);
|
|
514
|
+
const config = { ...this.settings, ...entry.settings };
|
|
515
|
+
if (enableTransition !== void 0) config.transition = enableTransition;
|
|
516
|
+
if (entry.state === "opened" || entry.state === "indeterminate") {
|
|
517
|
+
entry.state = "closing";
|
|
518
|
+
document.activeElement.blur();
|
|
519
|
+
if (config.transition) {
|
|
520
|
+
await transition(entry.el, {
|
|
521
|
+
start: config.stateOpening,
|
|
522
|
+
finish: config.stateOpened
|
|
523
|
+
}, {
|
|
524
|
+
start: config.stateClosing,
|
|
525
|
+
finish: config.stateClosed
|
|
526
|
+
}, config.transitionDuration);
|
|
527
|
+
} else {
|
|
528
|
+
entry.el.classList.add(config.stateClosed);
|
|
529
|
+
entry.el.classList.remove(config.stateOpened);
|
|
530
|
+
}
|
|
531
|
+
entry.state = "closed";
|
|
532
|
+
if (entry.mode === "modal") updateGlobalState(false, config);
|
|
533
|
+
if (focus) {
|
|
534
|
+
updateFocusState$1.call(this, entry);
|
|
535
|
+
}
|
|
536
|
+
entry.el.dispatchEvent(new CustomEvent(config.customEventPrefix + "closed", {
|
|
537
|
+
detail: this,
|
|
538
|
+
bubbles: true
|
|
539
|
+
}));
|
|
540
|
+
}
|
|
541
|
+
return entry;
|
|
488
542
|
}
|
|
489
|
-
async function
|
|
490
|
-
const
|
|
491
|
-
|
|
543
|
+
async function toggle(query, transition2, focus) {
|
|
544
|
+
const entry = getDrawer.call(this, query);
|
|
545
|
+
if (entry.state === "closed") {
|
|
546
|
+
return open$2.call(this, entry, transition2, focus);
|
|
547
|
+
} else {
|
|
548
|
+
return close$2.call(this, entry, transition2, focus);
|
|
549
|
+
}
|
|
492
550
|
}
|
|
493
|
-
function
|
|
494
|
-
switch (
|
|
551
|
+
function switchMode(entry) {
|
|
552
|
+
switch (entry.mode) {
|
|
495
553
|
case "inline":
|
|
496
|
-
return
|
|
554
|
+
return toInline.call(this, entry);
|
|
497
555
|
case "modal":
|
|
498
|
-
return
|
|
556
|
+
return toModal.call(this, entry);
|
|
499
557
|
default:
|
|
500
|
-
throw new Error(`"${
|
|
558
|
+
throw new Error(`"${entry.mode}" is not a valid drawer mode.`);
|
|
501
559
|
}
|
|
502
560
|
}
|
|
503
|
-
async function
|
|
504
|
-
|
|
561
|
+
async function toInline(entry) {
|
|
562
|
+
entry.el.classList.remove(entry.getSetting("classModal"));
|
|
563
|
+
entry.dialog.removeAttribute("aria-modal");
|
|
564
|
+
updateGlobalState(false, { ...this.settings, ...entry.settings });
|
|
565
|
+
this.focusTrap.unmount();
|
|
566
|
+
await applyInlineState(entry);
|
|
567
|
+
entry.el.dispatchEvent(new CustomEvent(entry.getSetting("customEventPrefix") + "switchMode", {
|
|
505
568
|
detail: this,
|
|
506
569
|
bubbles: true
|
|
507
|
-
}))
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
570
|
+
}));
|
|
571
|
+
return entry;
|
|
572
|
+
}
|
|
573
|
+
async function toModal(entry) {
|
|
574
|
+
entry.el.classList.add(entry.getSetting("classModal"));
|
|
575
|
+
entry.dialog.setAttribute("aria-modal", "true");
|
|
576
|
+
await close$2.call(this, entry, false, false);
|
|
577
|
+
entry.el.dispatchEvent(new CustomEvent(entry.getSetting("customEventPrefix") + "switchMode", {
|
|
511
578
|
detail: this,
|
|
512
579
|
bubbles: true
|
|
513
|
-
}))
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
580
|
+
}));
|
|
581
|
+
return entry;
|
|
582
|
+
}
|
|
583
|
+
async function register$2(el, config = {}) {
|
|
584
|
+
await deregister$2.call(this, el, false);
|
|
585
|
+
const root = this;
|
|
586
|
+
const breakpoint = new Breakpoint();
|
|
587
|
+
let _mode, _state = "indeterminate";
|
|
588
|
+
const entry = {
|
|
589
|
+
id: el.id,
|
|
590
|
+
el,
|
|
522
591
|
dialog: null,
|
|
523
592
|
trigger: null,
|
|
524
|
-
settings: { ...
|
|
593
|
+
settings: { ...getConfig$1(el, this.settings.dataConfig), ...config },
|
|
525
594
|
inlineState: "indeterminate",
|
|
526
595
|
get breakpoint() {
|
|
527
|
-
return
|
|
596
|
+
return getBreakpoint.call(root, el);
|
|
528
597
|
},
|
|
529
598
|
get store() {
|
|
530
|
-
return
|
|
599
|
+
return root.store.get(this.id);
|
|
531
600
|
},
|
|
532
601
|
get mode() {
|
|
533
|
-
return
|
|
602
|
+
return _mode;
|
|
534
603
|
},
|
|
535
|
-
set mode(
|
|
536
|
-
|
|
604
|
+
set mode(value) {
|
|
605
|
+
_mode = value;
|
|
606
|
+
switchMode.call(root, this);
|
|
537
607
|
},
|
|
538
608
|
get state() {
|
|
539
|
-
return
|
|
609
|
+
return _state;
|
|
540
610
|
},
|
|
541
|
-
set state(
|
|
542
|
-
|
|
611
|
+
set state(value) {
|
|
612
|
+
_state = value;
|
|
613
|
+
if (this.mode === "inline" && value != "opening" && value != "closing") {
|
|
614
|
+
this.inlineState = value;
|
|
615
|
+
if (this.getSetting("store")) {
|
|
616
|
+
root.store.set(this.id, value);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (value === "indeterminate") {
|
|
620
|
+
this.el.classList.remove(this.getSetting("stateOpened"));
|
|
621
|
+
this.el.classList.remove(this.getSetting("stateOpening"));
|
|
622
|
+
this.el.classList.remove(this.getSetting("stateClosed"));
|
|
623
|
+
this.el.classList.remove(this.getSetting("stateClosing"));
|
|
624
|
+
}
|
|
543
625
|
},
|
|
544
|
-
open(
|
|
545
|
-
return
|
|
626
|
+
open(transition2, focus) {
|
|
627
|
+
return open$2.call(root, this, transition2, focus);
|
|
546
628
|
},
|
|
547
|
-
close(
|
|
548
|
-
return
|
|
629
|
+
close(transition2, focus) {
|
|
630
|
+
return close$2.call(root, this, transition2, focus);
|
|
549
631
|
},
|
|
550
|
-
toggle(
|
|
551
|
-
return
|
|
632
|
+
toggle(transition2, focus) {
|
|
633
|
+
return toggle.call(root, this, transition2, focus);
|
|
552
634
|
},
|
|
553
635
|
deregister() {
|
|
554
|
-
return
|
|
636
|
+
return deregister$2.call(root, this);
|
|
555
637
|
},
|
|
556
638
|
mountBreakpoint() {
|
|
557
|
-
const
|
|
558
|
-
|
|
639
|
+
const value = this.breakpoint;
|
|
640
|
+
const handler = this.handleBreakpoint.bind(this);
|
|
641
|
+
breakpoint.mount(value, handler);
|
|
642
|
+
return this;
|
|
559
643
|
},
|
|
560
644
|
unmountBreakpoint() {
|
|
561
|
-
|
|
645
|
+
breakpoint.unmount();
|
|
646
|
+
return this;
|
|
562
647
|
},
|
|
563
|
-
handleBreakpoint(
|
|
564
|
-
const
|
|
565
|
-
|
|
648
|
+
handleBreakpoint(event) {
|
|
649
|
+
const bpMode = event.matches ? "inline" : "modal";
|
|
650
|
+
if (this.mode != bpMode) {
|
|
651
|
+
this.mode = bpMode;
|
|
652
|
+
}
|
|
653
|
+
return this;
|
|
566
654
|
},
|
|
567
|
-
getSetting(
|
|
568
|
-
return
|
|
655
|
+
getSetting(key) {
|
|
656
|
+
return key in this.settings ? this.settings[key] : root.settings[key];
|
|
569
657
|
}
|
|
570
658
|
};
|
|
571
|
-
this.collection.push(
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
659
|
+
this.collection.push(entry);
|
|
660
|
+
const dialog = el.querySelector(entry.getSetting("selectorDialog"));
|
|
661
|
+
entry.dialog = dialog ? dialog : el;
|
|
662
|
+
if (entry.getSetting("setTabindex")) {
|
|
663
|
+
entry.dialog.setAttribute("tabindex", "-1");
|
|
664
|
+
}
|
|
665
|
+
await applyInitialState(entry);
|
|
666
|
+
entry.inlineState = entry.state;
|
|
667
|
+
entry.mode = el.classList.contains(entry.getSetting("classModal")) ? "modal" : "inline";
|
|
668
|
+
if (entry.breakpoint) {
|
|
669
|
+
entry.mountBreakpoint();
|
|
670
|
+
}
|
|
671
|
+
return entry;
|
|
672
|
+
}
|
|
673
|
+
class Drawer extends Collection {
|
|
674
|
+
constructor(options) {
|
|
578
675
|
super();
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
this.defaults =
|
|
676
|
+
__privateAdd(this, _handleClick);
|
|
677
|
+
__privateAdd(this, _handleKeydown);
|
|
678
|
+
this.defaults = defaults$2;
|
|
679
|
+
this.settings = { ...this.defaults, ...options };
|
|
680
|
+
this.focusTrap = new FocusTrap();
|
|
681
|
+
this.store = localStore(this.settings.storeKey, this.settings.store);
|
|
682
|
+
__privateSet(this, _handleClick, handleClick$2.bind(this));
|
|
683
|
+
__privateSet(this, _handleKeydown, handleKeydown$2.bind(this));
|
|
684
|
+
if (this.settings.autoMount) this.mount();
|
|
582
685
|
}
|
|
583
686
|
get activeModal() {
|
|
584
|
-
return this.collection.find((
|
|
687
|
+
return this.collection.find((entry) => {
|
|
688
|
+
return entry.state === "opened" && entry.mode === "modal";
|
|
689
|
+
});
|
|
585
690
|
}
|
|
586
|
-
async mount(
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
|
|
691
|
+
async mount(options = null) {
|
|
692
|
+
if (options) this.settings = { ...this.settings, ...options };
|
|
693
|
+
const drawers = document.querySelectorAll(this.settings.selectorDrawer);
|
|
694
|
+
await this.registerCollection(drawers);
|
|
695
|
+
if (this.settings.eventListeners) {
|
|
696
|
+
this.mountEventListeners();
|
|
697
|
+
}
|
|
698
|
+
return this;
|
|
590
699
|
}
|
|
591
700
|
async unmount() {
|
|
592
|
-
|
|
701
|
+
await this.deregisterCollection();
|
|
702
|
+
if (this.settings.eventListeners) {
|
|
703
|
+
this.unmountEventListeners();
|
|
704
|
+
}
|
|
705
|
+
return this;
|
|
593
706
|
}
|
|
594
707
|
mountEventListeners() {
|
|
595
|
-
document.addEventListener("click",
|
|
708
|
+
document.addEventListener("click", __privateGet(this, _handleClick), false);
|
|
709
|
+
document.addEventListener("keydown", __privateGet(this, _handleKeydown), false);
|
|
596
710
|
}
|
|
597
711
|
unmountEventListeners() {
|
|
598
|
-
document.removeEventListener("click",
|
|
599
|
-
|
|
600
|
-
register(e, i = {}) {
|
|
601
|
-
let n = typeof e == "string" ? document.getElementById(e) : e;
|
|
602
|
-
return n ? st$1.call(this, n, i) : Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${e.id || e}".`));
|
|
603
|
-
}
|
|
604
|
-
deregister(e) {
|
|
605
|
-
let i = this.get(e.id || e);
|
|
606
|
-
return i ? L$1.call(this, i) : Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${e.id || e}".`));
|
|
607
|
-
}
|
|
608
|
-
open(e, i, n) {
|
|
609
|
-
return x$1.call(this, e, i, n);
|
|
610
|
-
}
|
|
611
|
-
close(e, i, n) {
|
|
612
|
-
return E$1.call(this, e, i, n);
|
|
613
|
-
}
|
|
614
|
-
toggle(e, i, n) {
|
|
615
|
-
return A$1.call(this, e, i, n);
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
p$1 = /* @__PURE__ */ new WeakMap(), b$1 = /* @__PURE__ */ new WeakMap();
|
|
619
|
-
var L = (i) => {
|
|
620
|
-
throw TypeError(i);
|
|
621
|
-
};
|
|
622
|
-
var I = (i, e, t) => e.has(i) || L("Cannot " + t);
|
|
623
|
-
var f = (i, e, t) => (I(i, e, "read from private field"), t ? t.call(i) : e.get(i)), v = (i, e, t) => e.has(i) ? L("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, s2) => (I(i, e, "write to private field"), e.set(i, t), t);
|
|
624
|
-
var S$1 = (i) => {
|
|
625
|
-
throw TypeError(i);
|
|
626
|
-
}, k$1 = (i, e, t) => e.has(i) || S$1("Cannot " + t), a = (i, e, t) => (k$1(i, e, "read from private field"), t ? t.call(i) : e.get(i)), y = (i, e, t) => e.has(i) ? S$1("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), w = (i, e, t, s2) => (k$1(i, e, "write to private field"), e.set(i, t), t);
|
|
627
|
-
class A {
|
|
628
|
-
constructor() {
|
|
629
|
-
this.collection = [];
|
|
630
|
-
}
|
|
631
|
-
async register(e) {
|
|
632
|
-
return await this.deregister(e), this.collection.push(e), this.collection;
|
|
633
|
-
}
|
|
634
|
-
async deregister(e) {
|
|
635
|
-
const t = this.collection.findIndex((s2) => s2 === e);
|
|
636
|
-
if (t >= 0) {
|
|
637
|
-
const s2 = this.collection[t];
|
|
638
|
-
Object.getOwnPropertyNames(s2).forEach((n) => {
|
|
639
|
-
delete s2[n];
|
|
640
|
-
}), this.collection.splice(t, 1);
|
|
641
|
-
}
|
|
642
|
-
return this.collection;
|
|
643
|
-
}
|
|
644
|
-
async registerCollection(e) {
|
|
645
|
-
return await Promise.all(Array.from(e, (t) => {
|
|
646
|
-
this.register(t);
|
|
647
|
-
})), this.collection;
|
|
648
|
-
}
|
|
649
|
-
async deregisterCollection() {
|
|
650
|
-
for (; this.collection.length > 0; )
|
|
651
|
-
await this.deregister(this.collection[0]);
|
|
652
|
-
return this.collection;
|
|
653
|
-
}
|
|
654
|
-
get(e, t = "id") {
|
|
655
|
-
return this.collection.find((s2) => s2[t] === e);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
const o = {
|
|
659
|
-
inert: ":not([inert]):not([inert] *)",
|
|
660
|
-
negTabIndex: ':not([tabindex^="-"])',
|
|
661
|
-
disabled: ":not(:disabled)"
|
|
662
|
-
}, F$1 = [
|
|
663
|
-
`a[href]${o.inert}${o.negTabIndex}`,
|
|
664
|
-
`area[href]${o.inert}${o.negTabIndex}`,
|
|
665
|
-
`input:not([type="hidden"]):not([type="radio"])${o.inert}${o.negTabIndex}${o.disabled}`,
|
|
666
|
-
`input[type="radio"]${o.inert}${o.negTabIndex}${o.disabled}`,
|
|
667
|
-
`select${o.inert}${o.negTabIndex}${o.disabled}`,
|
|
668
|
-
`textarea${o.inert}${o.negTabIndex}${o.disabled}`,
|
|
669
|
-
`button${o.inert}${o.negTabIndex}${o.disabled}`,
|
|
670
|
-
`details${o.inert} > summary:first-of-type${o.negTabIndex}`,
|
|
671
|
-
// Discard until Firefox supports `:has()`
|
|
672
|
-
// See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
|
|
673
|
-
// `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
|
|
674
|
-
`iframe${o.inert}${o.negTabIndex}`,
|
|
675
|
-
`audio[controls]${o.inert}${o.negTabIndex}`,
|
|
676
|
-
`video[controls]${o.inert}${o.negTabIndex}`,
|
|
677
|
-
`[contenteditable]${o.inert}${o.negTabIndex}`,
|
|
678
|
-
`[tabindex]${o.inert}${o.negTabIndex}`
|
|
679
|
-
];
|
|
680
|
-
var g, c, d;
|
|
681
|
-
class P {
|
|
682
|
-
constructor(e = null, t = "[data-focus]") {
|
|
683
|
-
y(this, g), y(this, c), y(this, d), this.el = e, this.selectorFocus = t, w(this, c, R.bind(this)), w(this, d, D$1.bind(this));
|
|
712
|
+
document.removeEventListener("click", __privateGet(this, _handleClick), false);
|
|
713
|
+
document.removeEventListener("keydown", __privateGet(this, _handleKeydown), false);
|
|
684
714
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
set focusable(e) {
|
|
689
|
-
w(this, g, e), a(this, g).length ? (document.removeEventListener("keydown", a(this, d)), document.addEventListener("keydown", a(this, c))) : (document.removeEventListener("keydown", a(this, c)), document.addEventListener("keydown", a(this, d)));
|
|
690
|
-
}
|
|
691
|
-
get focusableFirst() {
|
|
692
|
-
return this.focusable[0];
|
|
693
|
-
}
|
|
694
|
-
get focusableLast() {
|
|
695
|
-
return this.focusable[this.focusable.length - 1];
|
|
715
|
+
register(query, config = {}) {
|
|
716
|
+
let el = typeof query == "string" ? document.getElementById(query) : query;
|
|
717
|
+
return el ? register$2.call(this, el, config) : Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${query.id || query}".`));
|
|
696
718
|
}
|
|
697
|
-
|
|
698
|
-
|
|
719
|
+
deregister(query) {
|
|
720
|
+
let obj = this.get(query.id || query);
|
|
721
|
+
return obj ? deregister$2.call(this, obj) : Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${query.id || query}".`));
|
|
699
722
|
}
|
|
700
|
-
|
|
701
|
-
|
|
723
|
+
open(id, transition2, focus) {
|
|
724
|
+
return open$2.call(this, id, transition2, focus);
|
|
702
725
|
}
|
|
703
|
-
|
|
704
|
-
|
|
726
|
+
close(id, transition2, focus) {
|
|
727
|
+
return close$2.call(this, id, transition2, focus);
|
|
705
728
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
return e.querySelectorAll(F$1.join(",")).forEach((r) => {
|
|
709
|
-
r.focus(), document.activeElement === r && t.push(r);
|
|
710
|
-
}), e.scrollTop = n, s2.focus(), t;
|
|
729
|
+
toggle(id, transition2, focus) {
|
|
730
|
+
return toggle.call(this, id, transition2, focus);
|
|
711
731
|
}
|
|
712
732
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
function D$1(i) {
|
|
718
|
-
(i.key === "Tab" || i.keyCode === 9) && i.preventDefault();
|
|
719
|
-
}
|
|
720
|
-
function N$1() {
|
|
721
|
-
return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
|
|
722
|
-
}
|
|
723
|
-
function z(i, e = document.body) {
|
|
724
|
-
if (i.slice(0, 2) !== "--") {
|
|
725
|
-
const s2 = N$1();
|
|
726
|
-
s2 && (i = `${s2}${i}`), i = `--${i}`;
|
|
727
|
-
}
|
|
728
|
-
const t = getComputedStyle(e).getPropertyValue(i).trim();
|
|
729
|
-
if (t)
|
|
730
|
-
return t;
|
|
731
|
-
throw new Error(`CSS variable "${i}" was not found!`);
|
|
732
|
-
}
|
|
733
|
-
function j(i, e) {
|
|
734
|
-
const t = (i.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
|
|
735
|
-
return t ? JSON.parse(t) : {};
|
|
736
|
-
}
|
|
737
|
-
function T$1(i, e, t) {
|
|
738
|
-
const s2 = e.nodeType === Node.COMMENT_NODE, n = e.nodeType === Node.ELEMENT_NODE;
|
|
739
|
-
if (e = s2 || n ? e : document.querySelector(e), s2 && (t = "after"), !e) throw new Error(`Not a valid teleport reference: '${e}'`);
|
|
740
|
-
if (typeof e[t] != "function") throw new Error(`Not a valid teleport method: '${t}'`);
|
|
741
|
-
let r = null;
|
|
742
|
-
return s2 || (r = document.createComment("teleported #" + i.id), i.before(r)), e[t](i), s2 && e.remove(), r;
|
|
743
|
-
}
|
|
744
|
-
function O(i, e, t, s2 = "transition-duration") {
|
|
745
|
-
return new Promise((n) => {
|
|
746
|
-
if (typeof s2 == "string") {
|
|
747
|
-
const r = z(s2, i), l2 = !!r.includes("ms");
|
|
748
|
-
s2 = parseFloat(r) * (l2 ? 1 : 1e3);
|
|
749
|
-
}
|
|
750
|
-
i.classList.remove(e.finish), i.classList.add(t.start), setTimeout(() => {
|
|
751
|
-
i.classList.add(t.finish), i.classList.remove(t.start), n(i);
|
|
752
|
-
}, s2);
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
function W(i, e) {
|
|
756
|
-
e && document.querySelectorAll(e).forEach((t) => {
|
|
757
|
-
i ? t.style.overflow = "hidden" : t.style.removeProperty("overflow");
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
function _$1(i, e) {
|
|
761
|
-
e && document.querySelectorAll(e).forEach((t) => {
|
|
762
|
-
i ? (t.inert = true, t.setAttribute("aria-hidden", true)) : (t.inert = null, t.removeAttribute("aria-hidden"));
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
function G(i, e) {
|
|
766
|
-
_$1(!!i, e.selectorInert), W(!!i, e.selectorOverflow);
|
|
767
|
-
}
|
|
768
|
-
const K$1 = {
|
|
733
|
+
_handleClick = new WeakMap();
|
|
734
|
+
_handleKeydown = new WeakMap();
|
|
735
|
+
const defaults$1 = {
|
|
769
736
|
autoMount: false,
|
|
770
737
|
// Data attributes
|
|
771
738
|
dataOpen: "modal-open",
|
|
@@ -794,252 +761,361 @@
|
|
|
794
761
|
transition: true,
|
|
795
762
|
transitionDuration: "modal-transition-duration"
|
|
796
763
|
};
|
|
797
|
-
function
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
return
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
764
|
+
function getModal(query) {
|
|
765
|
+
const entry = typeof query === "string" ? this.get(query) : this.get(query.id);
|
|
766
|
+
if (entry) {
|
|
767
|
+
return entry;
|
|
768
|
+
} else {
|
|
769
|
+
throw new Error(`Modal not found in collection with id of "${query.id || query}".`);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
function updateFocusState() {
|
|
773
|
+
if (this.active) {
|
|
774
|
+
this.focusTrap.mount(this.active.dialog, this.settings.selectorFocus);
|
|
775
|
+
} else {
|
|
776
|
+
if (this.trigger) {
|
|
777
|
+
this.trigger.focus();
|
|
778
|
+
this.trigger = null;
|
|
779
|
+
}
|
|
780
|
+
this.focusTrap.unmount();
|
|
781
|
+
}
|
|
805
782
|
}
|
|
806
|
-
async function
|
|
807
|
-
const
|
|
783
|
+
async function handleClick$1(event) {
|
|
784
|
+
const trigger = event.target.closest(`
|
|
808
785
|
[data-${this.settings.dataOpen}],
|
|
809
786
|
[data-${this.settings.dataReplace}],
|
|
810
787
|
[data-${this.settings.dataClose}]
|
|
811
788
|
`);
|
|
812
|
-
if (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
789
|
+
if (trigger) {
|
|
790
|
+
event.preventDefault();
|
|
791
|
+
if (trigger.matches(`[data-${this.settings.dataOpen}]`)) {
|
|
792
|
+
const selector = trigger.getAttribute(`data-${this.settings.dataOpen}`).trim();
|
|
793
|
+
const entry = getModal.call(this, selector);
|
|
794
|
+
const fromModal = event.target.closest(this.settings.selectorModal);
|
|
795
|
+
if (!fromModal) this.trigger = trigger;
|
|
796
|
+
return entry.open();
|
|
816
797
|
}
|
|
817
|
-
if (
|
|
818
|
-
const
|
|
819
|
-
|
|
798
|
+
if (trigger.matches(`[data-${this.settings.dataReplace}]`)) {
|
|
799
|
+
const selector = trigger.getAttribute(`data-${this.settings.dataReplace}`).trim();
|
|
800
|
+
const entry = getModal.call(this, selector);
|
|
801
|
+
const fromModal = event.target.closest(this.settings.selectorModal);
|
|
802
|
+
if (!fromModal) this.trigger = trigger;
|
|
803
|
+
return entry.replace();
|
|
820
804
|
}
|
|
821
|
-
if (
|
|
822
|
-
const
|
|
823
|
-
return
|
|
805
|
+
if (trigger.matches(`[data-${this.settings.dataClose}]`)) {
|
|
806
|
+
const selector = trigger.getAttribute(`data-${this.settings.dataClose}`).trim();
|
|
807
|
+
return selector === "*" ? this.closeAll() : this.close(selector);
|
|
824
808
|
}
|
|
825
809
|
}
|
|
826
|
-
if (this.active &&
|
|
810
|
+
if (this.active && event.target.matches(this.settings.selectorScreen) && !this.active.required) {
|
|
827
811
|
return this.close(this.active.id);
|
|
812
|
+
}
|
|
828
813
|
}
|
|
829
|
-
function
|
|
830
|
-
if (
|
|
831
|
-
|
|
814
|
+
function handleKeydown$1(event) {
|
|
815
|
+
if (event.key === "Escape") {
|
|
816
|
+
if (this.active && !this.active.dialog.matches(this.settings.selectorRequired)) {
|
|
817
|
+
return this.close();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
832
820
|
}
|
|
833
|
-
async function
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
821
|
+
async function deregister$1(obj, close2 = true) {
|
|
822
|
+
const index2 = this.collection.findIndex((entry) => {
|
|
823
|
+
return entry.id === obj.id;
|
|
824
|
+
});
|
|
825
|
+
if (index2 >= 0) {
|
|
826
|
+
const entry = this.collection[index2];
|
|
827
|
+
if (close2 && entry.state === "opened") {
|
|
828
|
+
await entry.close(false);
|
|
829
|
+
} else {
|
|
830
|
+
this.stack.remove(entry);
|
|
831
|
+
}
|
|
832
|
+
if (entry.getSetting("teleport")) {
|
|
833
|
+
entry.teleportReturn();
|
|
834
|
+
}
|
|
835
|
+
Object.getOwnPropertyNames(entry).forEach((prop) => {
|
|
836
|
+
delete entry[prop];
|
|
837
|
+
});
|
|
838
|
+
this.collection.splice(index2, 1);
|
|
840
839
|
}
|
|
841
840
|
return this.collection;
|
|
842
841
|
}
|
|
843
|
-
async function
|
|
844
|
-
const
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
842
|
+
async function open$1(query, enableTransition, focus = true) {
|
|
843
|
+
const entry = getModal.call(this, query);
|
|
844
|
+
const config = { ...this.settings, ...entry.settings };
|
|
845
|
+
if (enableTransition !== void 0) config.transition = enableTransition;
|
|
846
|
+
this.stack.moveToTop(entry);
|
|
847
|
+
if (entry.state === "closed") {
|
|
848
|
+
entry.state = "opening";
|
|
849
|
+
this.stack.add(entry);
|
|
850
|
+
if (config.transition) {
|
|
851
|
+
await transition(entry.el, {
|
|
852
|
+
start: config.stateClosing,
|
|
853
|
+
finish: config.stateClosed
|
|
854
|
+
}, {
|
|
855
|
+
start: config.stateOpening,
|
|
856
|
+
finish: config.stateOpened
|
|
857
|
+
}, config.transitionDuration);
|
|
858
|
+
} else {
|
|
859
|
+
entry.el.classList.add(config.stateOpened);
|
|
860
|
+
entry.el.classList.remove(config.stateClosed);
|
|
861
|
+
}
|
|
862
|
+
entry.state = "opened";
|
|
863
|
+
}
|
|
864
|
+
if (focus) {
|
|
865
|
+
updateFocusState.call(this);
|
|
866
|
+
}
|
|
867
|
+
entry.el.dispatchEvent(new CustomEvent(config.customEventPrefix + "opened", {
|
|
852
868
|
detail: this,
|
|
853
869
|
bubbles: true
|
|
854
|
-
}))
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
870
|
+
}));
|
|
871
|
+
return entry;
|
|
872
|
+
}
|
|
873
|
+
async function close$1(query, enableTransition, focus = true) {
|
|
874
|
+
const entry = query ? getModal.call(this, query) : this.active;
|
|
875
|
+
if (entry && entry.state === "opened") {
|
|
876
|
+
entry.state = "closing";
|
|
877
|
+
const config = { ...this.settings, ...entry.settings };
|
|
878
|
+
if (enableTransition !== void 0) config.transition = enableTransition;
|
|
879
|
+
document.activeElement.blur();
|
|
880
|
+
if (config.transition) {
|
|
881
|
+
await transition(entry.el, {
|
|
882
|
+
start: config.stateOpening,
|
|
883
|
+
finish: config.stateOpened
|
|
884
|
+
}, {
|
|
885
|
+
start: config.stateClosing,
|
|
886
|
+
finish: config.stateClosed
|
|
887
|
+
}, config.transitionDuration);
|
|
888
|
+
} else {
|
|
889
|
+
entry.el.classList.add(config.stateClosed);
|
|
890
|
+
entry.el.classList.remove(config.stateOpened);
|
|
891
|
+
}
|
|
892
|
+
this.stack.remove(entry);
|
|
893
|
+
entry.state = "closed";
|
|
894
|
+
if (focus) {
|
|
895
|
+
updateFocusState.call(this);
|
|
896
|
+
}
|
|
897
|
+
entry.el.dispatchEvent(new CustomEvent(config.customEventPrefix + "closed", {
|
|
868
898
|
detail: this,
|
|
869
899
|
bubbles: true
|
|
870
900
|
}));
|
|
871
901
|
}
|
|
872
|
-
return
|
|
873
|
-
}
|
|
874
|
-
async function $(i, e) {
|
|
875
|
-
const t = [];
|
|
876
|
-
return await Promise.all(this.stack.value.map(async (s2) => {
|
|
877
|
-
i && i === s2.id ? Promise.resolve() : t.push(await C.call(this, s2, e, false)), s2.trigger = null;
|
|
878
|
-
})), t;
|
|
902
|
+
return entry;
|
|
879
903
|
}
|
|
880
|
-
async function
|
|
881
|
-
const
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
904
|
+
async function closeAll$1(exclude, transition2) {
|
|
905
|
+
const result = [];
|
|
906
|
+
await Promise.all(this.stack.value.map(async (modal) => {
|
|
907
|
+
if (exclude && exclude === modal.id) {
|
|
908
|
+
Promise.resolve();
|
|
909
|
+
} else {
|
|
910
|
+
result.push(await close$1.call(this, modal, transition2, false));
|
|
911
|
+
}
|
|
912
|
+
modal.trigger = null;
|
|
913
|
+
}));
|
|
914
|
+
return result;
|
|
915
|
+
}
|
|
916
|
+
async function replace(query, transition2, focus = true) {
|
|
917
|
+
const entry = getModal.call(this, query);
|
|
918
|
+
let resultOpened, resultClosed;
|
|
919
|
+
if (entry.state === "opened") {
|
|
920
|
+
resultOpened = entry;
|
|
921
|
+
resultClosed = await closeAll$1.call(this, entry.id, transition2);
|
|
922
|
+
} else {
|
|
923
|
+
resultClosed = closeAll$1.call(this, false, transition2);
|
|
924
|
+
resultOpened = open$1.call(this, entry, transition2, false);
|
|
925
|
+
await Promise.all([resultOpened, resultClosed]);
|
|
926
|
+
}
|
|
927
|
+
if (focus) {
|
|
928
|
+
updateFocusState.call(this);
|
|
929
|
+
}
|
|
930
|
+
return { opened: resultOpened, closed: resultClosed };
|
|
931
|
+
}
|
|
932
|
+
async function register$1(el, config = {}) {
|
|
933
|
+
await deregister$1.call(this, el, false);
|
|
934
|
+
const root = this;
|
|
935
|
+
const entry = {
|
|
936
|
+
id: el.id,
|
|
889
937
|
state: "closed",
|
|
890
|
-
el
|
|
938
|
+
el,
|
|
891
939
|
dialog: null,
|
|
892
940
|
get required() {
|
|
893
941
|
return this.dialog.matches(this.getSetting("selectorRequired"));
|
|
894
942
|
},
|
|
895
943
|
returnRef: null,
|
|
896
|
-
settings: { ...
|
|
897
|
-
open(
|
|
898
|
-
return
|
|
944
|
+
settings: { ...getConfig$1(el, this.settings.dataConfig), ...config },
|
|
945
|
+
open(transition2, focus) {
|
|
946
|
+
return open$1.call(root, this, transition2, focus);
|
|
899
947
|
},
|
|
900
|
-
close(
|
|
901
|
-
return
|
|
948
|
+
close(transition2, focus) {
|
|
949
|
+
return close$1.call(root, this, transition2, focus);
|
|
902
950
|
},
|
|
903
|
-
replace(
|
|
904
|
-
return
|
|
951
|
+
replace(transition2, focus) {
|
|
952
|
+
return replace.call(root, this, transition2, focus);
|
|
905
953
|
},
|
|
906
954
|
deregister() {
|
|
907
|
-
return
|
|
955
|
+
return deregister$1.call(root, this);
|
|
908
956
|
},
|
|
909
|
-
teleport(
|
|
910
|
-
|
|
957
|
+
teleport(ref = this.getSetting("teleport"), method = this.getSetting("teleportMethod")) {
|
|
958
|
+
if (!this.returnRef) {
|
|
959
|
+
this.returnRef = teleport(this.el, ref, method);
|
|
960
|
+
return this.el;
|
|
961
|
+
} else {
|
|
962
|
+
console.error("Element has already been teleported:", this.el);
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
911
965
|
},
|
|
912
966
|
teleportReturn() {
|
|
913
|
-
|
|
967
|
+
if (this.returnRef) {
|
|
968
|
+
this.returnRef = teleport(this.el, this.returnRef);
|
|
969
|
+
return this.el;
|
|
970
|
+
} else {
|
|
971
|
+
console.error("No return reference found:", this.el);
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
914
974
|
},
|
|
915
|
-
getSetting(
|
|
916
|
-
return
|
|
975
|
+
getSetting(key) {
|
|
976
|
+
return key in this.settings ? this.settings[key] : root.settings[key];
|
|
917
977
|
}
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
978
|
+
};
|
|
979
|
+
const dialog = el.querySelector(entry.getSetting("selectorDialog"));
|
|
980
|
+
entry.dialog = dialog ? dialog : el;
|
|
981
|
+
entry.dialog.setAttribute("aria-modal", "true");
|
|
982
|
+
if (!entry.dialog.hasAttribute("role")) {
|
|
983
|
+
entry.dialog.setAttribute("role", "dialog");
|
|
984
|
+
}
|
|
985
|
+
if (entry.getSetting("setTabindex")) {
|
|
986
|
+
entry.dialog.setAttribute("tabindex", "-1");
|
|
987
|
+
}
|
|
988
|
+
if (entry.getSetting("teleport")) {
|
|
989
|
+
entry.teleport();
|
|
990
|
+
}
|
|
991
|
+
this.collection.push(entry);
|
|
992
|
+
if (entry.el.classList.contains(this.settings.stateOpened)) {
|
|
993
|
+
await entry.open(false);
|
|
994
|
+
} else {
|
|
995
|
+
entry.el.classList.remove(this.settings.stateOpening);
|
|
996
|
+
entry.el.classList.remove(this.settings.stateClosing);
|
|
997
|
+
entry.el.classList.add(this.settings.stateClosed);
|
|
998
|
+
}
|
|
999
|
+
return entry;
|
|
1000
|
+
}
|
|
1001
|
+
function stack(settings) {
|
|
1002
|
+
const stackArray = [];
|
|
923
1003
|
return {
|
|
924
1004
|
get value() {
|
|
925
|
-
return [...
|
|
1005
|
+
return [...stackArray];
|
|
926
1006
|
},
|
|
927
1007
|
get top() {
|
|
928
|
-
return
|
|
1008
|
+
return stackArray[stackArray.length - 1];
|
|
929
1009
|
},
|
|
930
1010
|
updateIndex() {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
|
|
1011
|
+
stackArray.forEach((entry, index2) => {
|
|
1012
|
+
entry.el.style.zIndex = null;
|
|
1013
|
+
const value = getComputedStyle(entry.el)["z-index"];
|
|
1014
|
+
entry.el.style.zIndex = parseInt(value) + index2 + 1;
|
|
935
1015
|
});
|
|
936
1016
|
},
|
|
937
1017
|
updateGlobalState() {
|
|
938
|
-
|
|
1018
|
+
updateGlobalState(this.top, settings);
|
|
1019
|
+
this.updateIndex();
|
|
939
1020
|
},
|
|
940
|
-
add(
|
|
941
|
-
|
|
942
|
-
const
|
|
943
|
-
|
|
1021
|
+
add(entry) {
|
|
1022
|
+
entry.el.style.zIndex = null;
|
|
1023
|
+
const value = getComputedStyle(entry.el)["z-index"];
|
|
1024
|
+
entry.el.style.zIndex = parseInt(value) + stackArray.length + 1;
|
|
1025
|
+
stackArray.push(entry);
|
|
1026
|
+
this.updateGlobalState();
|
|
944
1027
|
},
|
|
945
|
-
remove(
|
|
946
|
-
const
|
|
947
|
-
|
|
1028
|
+
remove(entry) {
|
|
1029
|
+
const index2 = stackArray.findIndex((item) => {
|
|
1030
|
+
return item.id === entry.id;
|
|
1031
|
+
});
|
|
1032
|
+
if (index2 >= 0) {
|
|
1033
|
+
entry.el.style.zIndex = null;
|
|
1034
|
+
stackArray.splice(index2, 1);
|
|
1035
|
+
this.updateGlobalState();
|
|
1036
|
+
}
|
|
948
1037
|
},
|
|
949
|
-
moveToTop(
|
|
950
|
-
const
|
|
951
|
-
|
|
1038
|
+
moveToTop(entry) {
|
|
1039
|
+
const index2 = stackArray.findIndex((item) => {
|
|
1040
|
+
return item.id === entry.id;
|
|
1041
|
+
});
|
|
1042
|
+
if (index2 >= 0) {
|
|
1043
|
+
stackArray.splice(index2, 1);
|
|
1044
|
+
this.add(entry);
|
|
1045
|
+
}
|
|
952
1046
|
}
|
|
953
1047
|
};
|
|
954
1048
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
constructor(t) {
|
|
1049
|
+
class Modal extends Collection {
|
|
1050
|
+
constructor(options) {
|
|
958
1051
|
super();
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
this.defaults =
|
|
1052
|
+
__privateAdd(this, _handleClick2);
|
|
1053
|
+
__privateAdd(this, _handleKeydown2);
|
|
1054
|
+
this.defaults = defaults$1;
|
|
1055
|
+
this.settings = { ...this.defaults, ...options };
|
|
1056
|
+
this.trigger = null;
|
|
1057
|
+
this.focusTrap = new FocusTrap();
|
|
1058
|
+
this.stack = stack(this.settings);
|
|
1059
|
+
__privateSet(this, _handleClick2, handleClick$1.bind(this));
|
|
1060
|
+
__privateSet(this, _handleKeydown2, handleKeydown$1.bind(this));
|
|
1061
|
+
if (this.settings.autoMount) this.mount();
|
|
962
1062
|
}
|
|
963
1063
|
get active() {
|
|
964
1064
|
return this.stack.top;
|
|
965
1065
|
}
|
|
966
|
-
async mount(
|
|
967
|
-
|
|
968
|
-
const
|
|
969
|
-
|
|
1066
|
+
async mount(options) {
|
|
1067
|
+
if (options) this.settings = { ...this.settings, ...options };
|
|
1068
|
+
const modals = document.querySelectorAll(this.settings.selectorModal);
|
|
1069
|
+
await this.registerCollection(modals);
|
|
1070
|
+
if (this.settings.eventListeners) {
|
|
1071
|
+
this.mountEventListeners();
|
|
1072
|
+
}
|
|
1073
|
+
return this;
|
|
970
1074
|
}
|
|
971
1075
|
async unmount() {
|
|
972
|
-
|
|
1076
|
+
this.trigger = null;
|
|
1077
|
+
await this.deregisterCollection();
|
|
1078
|
+
if (this.settings.eventListeners) {
|
|
1079
|
+
this.unmountEventListeners();
|
|
1080
|
+
}
|
|
1081
|
+
return this;
|
|
973
1082
|
}
|
|
974
1083
|
mountEventListeners() {
|
|
975
|
-
document.addEventListener("click",
|
|
1084
|
+
document.addEventListener("click", __privateGet(this, _handleClick2), false);
|
|
1085
|
+
document.addEventListener("keydown", __privateGet(this, _handleKeydown2), false);
|
|
976
1086
|
}
|
|
977
1087
|
unmountEventListeners() {
|
|
978
|
-
document.removeEventListener("click",
|
|
979
|
-
|
|
980
|
-
register(t, s2 = {}) {
|
|
981
|
-
let n = typeof t == "string" ? document.getElementById(t) : t;
|
|
982
|
-
return n ? B$1.call(this, n, s2) : Promise.reject(new Error(`Failed to register; modal not found with ID of: "${t.id || t}".`));
|
|
1088
|
+
document.removeEventListener("click", __privateGet(this, _handleClick2), false);
|
|
1089
|
+
document.removeEventListener("keydown", __privateGet(this, _handleKeydown2), false);
|
|
983
1090
|
}
|
|
984
|
-
|
|
985
|
-
let
|
|
986
|
-
return
|
|
1091
|
+
register(query, config = {}) {
|
|
1092
|
+
let el = typeof query == "string" ? document.getElementById(query) : query;
|
|
1093
|
+
return el ? register$1.call(this, el, config) : Promise.reject(new Error(`Failed to register; modal not found with ID of: "${query.id || query}".`));
|
|
987
1094
|
}
|
|
988
|
-
|
|
989
|
-
|
|
1095
|
+
deregister(query) {
|
|
1096
|
+
let obj = this.get(query.id || query);
|
|
1097
|
+
return obj ? deregister$1.call(this, obj) : Promise.reject(new Error(`Failed to deregister; modal does not exist in collection with ID of: "${query.id || query}".`));
|
|
990
1098
|
}
|
|
991
|
-
|
|
992
|
-
return
|
|
1099
|
+
open(id, transition2, focus) {
|
|
1100
|
+
return open$1.call(this, id, transition2, focus);
|
|
993
1101
|
}
|
|
994
|
-
|
|
995
|
-
return
|
|
1102
|
+
close(id, transition2, focus) {
|
|
1103
|
+
return close$1.call(this, id, transition2, focus);
|
|
996
1104
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
return n && p.call(this), r;
|
|
1105
|
+
replace(id, transition2, focus) {
|
|
1106
|
+
return replace.call(this, id, transition2, focus);
|
|
1000
1107
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
};
|
|
1006
|
-
var _e = (e, t, r) => t.has(e) || Ue("Cannot " + r);
|
|
1007
|
-
var Ae = (e, t, r) => (_e(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Ke = (e, t, r) => t.has(e) ? Ue("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), Ge = (e, t, r, i) => (_e(e, t, "write to private field"), t.set(e, r), r);
|
|
1008
|
-
class Ct {
|
|
1009
|
-
constructor() {
|
|
1010
|
-
this.collection = [];
|
|
1011
|
-
}
|
|
1012
|
-
async register(t) {
|
|
1013
|
-
return await this.deregister(t), this.collection.push(t), this.collection;
|
|
1014
|
-
}
|
|
1015
|
-
async deregister(t) {
|
|
1016
|
-
const r = this.collection.findIndex((i) => i === t);
|
|
1017
|
-
if (r >= 0) {
|
|
1018
|
-
const i = this.collection[r];
|
|
1019
|
-
Object.getOwnPropertyNames(i).forEach((n) => {
|
|
1020
|
-
delete i[n];
|
|
1021
|
-
}), this.collection.splice(r, 1);
|
|
1108
|
+
async closeAll(exclude = false, transition2, focus = true) {
|
|
1109
|
+
const result = await closeAll$1.call(this, exclude, transition2);
|
|
1110
|
+
if (focus) {
|
|
1111
|
+
updateFocusState.call(this);
|
|
1022
1112
|
}
|
|
1023
|
-
return
|
|
1024
|
-
}
|
|
1025
|
-
async registerCollection(t) {
|
|
1026
|
-
return await Promise.all(Array.from(t, (r) => {
|
|
1027
|
-
this.register(r);
|
|
1028
|
-
})), this.collection;
|
|
1029
|
-
}
|
|
1030
|
-
async deregisterCollection() {
|
|
1031
|
-
for (; this.collection.length > 0; )
|
|
1032
|
-
await this.deregister(this.collection[0]);
|
|
1033
|
-
return this.collection;
|
|
1034
|
-
}
|
|
1035
|
-
get(t, r = "id") {
|
|
1036
|
-
return this.collection.find((i) => i[r] === t);
|
|
1113
|
+
return result;
|
|
1037
1114
|
}
|
|
1038
1115
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const Dt = {
|
|
1116
|
+
_handleClick2 = new WeakMap();
|
|
1117
|
+
_handleKeydown2 = new WeakMap();
|
|
1118
|
+
const defaults = {
|
|
1043
1119
|
autoMount: false,
|
|
1044
1120
|
// Selectors
|
|
1045
1121
|
selectorPopover: ".popover",
|
|
@@ -1051,192 +1127,294 @@
|
|
|
1051
1127
|
eventType: "click",
|
|
1052
1128
|
placement: "bottom"
|
|
1053
1129
|
};
|
|
1054
|
-
function
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1130
|
+
function getConfig(el, settings) {
|
|
1131
|
+
const styles = getComputedStyle(el);
|
|
1132
|
+
const config = {
|
|
1133
|
+
"placement": settings.placement,
|
|
1134
|
+
"event": settings.eventType,
|
|
1135
|
+
"offset": 0,
|
|
1059
1136
|
"overflow-padding": 0,
|
|
1060
1137
|
"flip-padding": 0,
|
|
1061
|
-
"arrow-element":
|
|
1138
|
+
"arrow-element": settings.selectorArrow,
|
|
1062
1139
|
"arrow-padding": 0
|
|
1063
1140
|
};
|
|
1064
|
-
for (const
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1141
|
+
for (const prop in config) {
|
|
1142
|
+
const prefix = getPrefix();
|
|
1143
|
+
const value = styles.getPropertyValue(`--${prefix}popover-${prop}`).trim();
|
|
1144
|
+
if (value) {
|
|
1145
|
+
config[prop] = value;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
return config;
|
|
1149
|
+
}
|
|
1150
|
+
function getPadding(value) {
|
|
1151
|
+
let padding;
|
|
1152
|
+
const array = typeof value === "string" ? value.trim().split(" ") : [value];
|
|
1153
|
+
array.forEach(function(item, index2) {
|
|
1154
|
+
array[index2] = parseInt(item, 10);
|
|
1155
|
+
});
|
|
1156
|
+
switch (array.length) {
|
|
1076
1157
|
case 1:
|
|
1077
|
-
|
|
1158
|
+
padding = array[0];
|
|
1078
1159
|
break;
|
|
1079
1160
|
case 2:
|
|
1080
|
-
|
|
1081
|
-
top:
|
|
1082
|
-
right:
|
|
1083
|
-
bottom:
|
|
1084
|
-
left:
|
|
1161
|
+
padding = {
|
|
1162
|
+
top: array[0],
|
|
1163
|
+
right: array[1],
|
|
1164
|
+
bottom: array[0],
|
|
1165
|
+
left: array[1]
|
|
1085
1166
|
};
|
|
1086
1167
|
break;
|
|
1087
1168
|
case 3:
|
|
1088
|
-
|
|
1089
|
-
top:
|
|
1090
|
-
right:
|
|
1091
|
-
bottom:
|
|
1092
|
-
left:
|
|
1169
|
+
padding = {
|
|
1170
|
+
top: array[0],
|
|
1171
|
+
right: array[1],
|
|
1172
|
+
bottom: array[2],
|
|
1173
|
+
left: array[1]
|
|
1093
1174
|
};
|
|
1094
1175
|
break;
|
|
1095
1176
|
case 4:
|
|
1096
|
-
|
|
1097
|
-
top:
|
|
1098
|
-
right:
|
|
1099
|
-
bottom:
|
|
1100
|
-
left:
|
|
1177
|
+
padding = {
|
|
1178
|
+
top: array[0],
|
|
1179
|
+
right: array[1],
|
|
1180
|
+
bottom: array[2],
|
|
1181
|
+
left: array[3]
|
|
1101
1182
|
};
|
|
1102
1183
|
break;
|
|
1103
1184
|
default:
|
|
1104
|
-
|
|
1185
|
+
padding = false;
|
|
1105
1186
|
break;
|
|
1106
1187
|
}
|
|
1107
|
-
return
|
|
1188
|
+
return padding;
|
|
1108
1189
|
}
|
|
1109
|
-
function
|
|
1190
|
+
function getModifiers(options) {
|
|
1110
1191
|
return [{
|
|
1111
1192
|
name: "offset",
|
|
1112
1193
|
options: {
|
|
1113
|
-
offset: [0, parseInt(
|
|
1194
|
+
offset: [0, parseInt(options["offset"], 10)]
|
|
1114
1195
|
}
|
|
1115
1196
|
}, {
|
|
1116
1197
|
name: "preventOverflow",
|
|
1117
1198
|
options: {
|
|
1118
|
-
padding:
|
|
1199
|
+
padding: getPadding(options["overflow-padding"])
|
|
1119
1200
|
}
|
|
1120
1201
|
}, {
|
|
1121
1202
|
name: "flip",
|
|
1122
1203
|
options: {
|
|
1123
|
-
padding:
|
|
1204
|
+
padding: getPadding(options["flip-padding"])
|
|
1124
1205
|
}
|
|
1125
1206
|
}, {
|
|
1126
1207
|
name: "arrow",
|
|
1127
1208
|
options: {
|
|
1128
|
-
element:
|
|
1129
|
-
padding:
|
|
1209
|
+
element: options["arrow-element"],
|
|
1210
|
+
padding: getPadding(options["arrow-padding"])
|
|
1130
1211
|
}
|
|
1131
1212
|
}];
|
|
1132
1213
|
}
|
|
1133
|
-
function
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
1136
|
-
return
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1214
|
+
function getPopover(query) {
|
|
1215
|
+
const entry = typeof query === "string" ? this.get(query) : this.get(query.id);
|
|
1216
|
+
if (entry) {
|
|
1217
|
+
return entry;
|
|
1218
|
+
} else {
|
|
1219
|
+
throw new Error(`Popover not found in collection with id of "${query}".`);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
function getPopoverID(obj) {
|
|
1223
|
+
if (typeof obj === "string") {
|
|
1224
|
+
return obj;
|
|
1225
|
+
} else if (typeof obj.hasAttribute === "function") {
|
|
1226
|
+
if (obj.closest(this.settings.selectorPopover)) {
|
|
1227
|
+
obj = obj.closest(this.settings.selectorPopover);
|
|
1228
|
+
return obj.id;
|
|
1229
|
+
} else if (obj.hasAttribute("aria-controls")) {
|
|
1230
|
+
return obj.getAttribute("aria-controls");
|
|
1231
|
+
} else if (obj.hasAttribute("aria-describedby")) {
|
|
1232
|
+
return obj.getAttribute("aria-describedby");
|
|
1233
|
+
} else return false;
|
|
1234
|
+
} else return false;
|
|
1235
|
+
}
|
|
1236
|
+
function getPopoverElements(query) {
|
|
1237
|
+
const id = getPopoverID.call(this, query);
|
|
1238
|
+
if (id) {
|
|
1239
|
+
const popover = document.querySelector(`#${id}`);
|
|
1240
|
+
const trigger = document.querySelector(`[aria-controls="${id}"]`) || document.querySelector(`[aria-describedby="${id}"]`);
|
|
1241
|
+
if (!trigger && !popover) {
|
|
1242
|
+
return { error: new Error(`No popover elements found using the ID: "${id}".`) };
|
|
1243
|
+
} else if (!trigger) {
|
|
1244
|
+
return { error: new Error("No popover trigger associated with the provided popover.") };
|
|
1245
|
+
} else if (!popover) {
|
|
1246
|
+
return { error: new Error("No popover associated with the provided popover trigger.") };
|
|
1247
|
+
} else {
|
|
1248
|
+
return { popover, trigger };
|
|
1249
|
+
}
|
|
1250
|
+
} else {
|
|
1148
1251
|
return { error: new Error("Could not resolve the popover ID.") };
|
|
1252
|
+
}
|
|
1149
1253
|
}
|
|
1150
|
-
async function
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1254
|
+
async function close(query) {
|
|
1255
|
+
const popover = query ? getPopover.call(this, query) : await closeAll.call(this);
|
|
1256
|
+
if (popover && popover.state === "opened") {
|
|
1257
|
+
popover.el.classList.remove(this.settings.stateActive);
|
|
1258
|
+
if (popover.trigger.hasAttribute("aria-controls")) {
|
|
1259
|
+
popover.trigger.setAttribute("aria-expanded", "false");
|
|
1260
|
+
}
|
|
1261
|
+
popover.popper.setOptions({
|
|
1262
|
+
modifiers: [{ name: "eventListeners", enabled: false }]
|
|
1263
|
+
});
|
|
1264
|
+
popover.state = "closed";
|
|
1265
|
+
if (popover.trigger === this.trigger) {
|
|
1266
|
+
this.trigger = null;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
return popover;
|
|
1270
|
+
}
|
|
1271
|
+
async function closeAll() {
|
|
1272
|
+
const result = [];
|
|
1273
|
+
await Promise.all(this.collection.map(async (popover) => {
|
|
1274
|
+
if (popover.state === "opened") {
|
|
1275
|
+
result.push(await close.call(this, popover));
|
|
1276
|
+
}
|
|
1277
|
+
}));
|
|
1278
|
+
return result;
|
|
1279
|
+
}
|
|
1280
|
+
function closeCheck(popover) {
|
|
1281
|
+
if (popover.state != "opened") return;
|
|
1282
|
+
setTimeout(() => {
|
|
1283
|
+
const isHovered = popover.el.closest(":hover") === popover.el || popover.trigger.closest(":hover") === popover.trigger;
|
|
1284
|
+
const isFocused = document.activeElement.closest(
|
|
1285
|
+
`#${popover.id}, [aria-controls="${popover.id}"], [aria-describedby="${popover.id}"]`
|
|
1166
1286
|
);
|
|
1167
|
-
|
|
1287
|
+
if (!isHovered && !isFocused) {
|
|
1288
|
+
popover.close();
|
|
1289
|
+
}
|
|
1290
|
+
return popover;
|
|
1168
1291
|
}, 1);
|
|
1169
1292
|
}
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1293
|
+
function handleClick(popover) {
|
|
1294
|
+
if (popover.state === "opened") {
|
|
1295
|
+
popover.close();
|
|
1296
|
+
} else {
|
|
1297
|
+
this.trigger = popover.trigger;
|
|
1298
|
+
popover.open();
|
|
1299
|
+
handleDocumentClick.call(this, popover);
|
|
1300
|
+
}
|
|
1172
1301
|
}
|
|
1173
|
-
function
|
|
1174
|
-
switch (
|
|
1302
|
+
function handleKeydown(event) {
|
|
1303
|
+
switch (event.key) {
|
|
1175
1304
|
case "Escape":
|
|
1176
|
-
|
|
1305
|
+
if (this.trigger) {
|
|
1306
|
+
this.trigger.focus();
|
|
1307
|
+
}
|
|
1308
|
+
closeAll.call(this);
|
|
1177
1309
|
return;
|
|
1178
1310
|
case "Tab":
|
|
1179
|
-
this.collection.forEach((
|
|
1180
|
-
|
|
1311
|
+
this.collection.forEach((popover) => {
|
|
1312
|
+
closeCheck.call(this, popover);
|
|
1181
1313
|
});
|
|
1182
1314
|
return;
|
|
1183
1315
|
default:
|
|
1184
1316
|
return;
|
|
1185
1317
|
}
|
|
1186
1318
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const
|
|
1189
|
-
document.addEventListener("click", function
|
|
1190
|
-
|
|
1191
|
-
`#${
|
|
1192
|
-
)
|
|
1319
|
+
function handleDocumentClick(popover) {
|
|
1320
|
+
const root = this;
|
|
1321
|
+
document.addEventListener("click", function _f(event) {
|
|
1322
|
+
const wasClicked = event.target.closest(
|
|
1323
|
+
`#${popover.id}, [aria-controls="${popover.id}"], [aria-describedby="${popover.id}"]`
|
|
1324
|
+
);
|
|
1325
|
+
if (wasClicked) {
|
|
1326
|
+
if (popover.el && !popover.el.classList.contains(root.settings.stateActive)) {
|
|
1327
|
+
this.removeEventListener("click", _f);
|
|
1328
|
+
}
|
|
1329
|
+
} else {
|
|
1330
|
+
if (popover.el && popover.el.classList.contains(root.settings.stateActive)) {
|
|
1331
|
+
popover.close();
|
|
1332
|
+
}
|
|
1333
|
+
this.removeEventListener("click", _f);
|
|
1334
|
+
}
|
|
1193
1335
|
});
|
|
1194
1336
|
}
|
|
1195
|
-
var
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1337
|
+
var top = "top";
|
|
1338
|
+
var bottom = "bottom";
|
|
1339
|
+
var right = "right";
|
|
1340
|
+
var left = "left";
|
|
1341
|
+
var auto = "auto";
|
|
1342
|
+
var basePlacements = [top, bottom, right, left];
|
|
1343
|
+
var start = "start";
|
|
1344
|
+
var end = "end";
|
|
1345
|
+
var clippingParents = "clippingParents";
|
|
1346
|
+
var viewport = "viewport";
|
|
1347
|
+
var popper = "popper";
|
|
1348
|
+
var reference = "reference";
|
|
1349
|
+
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
|
|
1350
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
1351
|
+
}, []);
|
|
1352
|
+
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
|
1353
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
1354
|
+
}, []);
|
|
1355
|
+
var beforeRead = "beforeRead";
|
|
1356
|
+
var read = "read";
|
|
1357
|
+
var afterRead = "afterRead";
|
|
1358
|
+
var beforeMain = "beforeMain";
|
|
1359
|
+
var main = "main";
|
|
1360
|
+
var afterMain = "afterMain";
|
|
1361
|
+
var beforeWrite = "beforeWrite";
|
|
1362
|
+
var write = "write";
|
|
1363
|
+
var afterWrite = "afterWrite";
|
|
1364
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
1365
|
+
function getNodeName(element) {
|
|
1366
|
+
return element ? (element.nodeName || "").toLowerCase() : null;
|
|
1367
|
+
}
|
|
1368
|
+
function getWindow(node) {
|
|
1369
|
+
if (node == null) {
|
|
1205
1370
|
return window;
|
|
1206
|
-
if (e.toString() !== "[object Window]") {
|
|
1207
|
-
var t = e.ownerDocument;
|
|
1208
|
-
return t && t.defaultView || window;
|
|
1209
1371
|
}
|
|
1210
|
-
|
|
1372
|
+
if (node.toString() !== "[object Window]") {
|
|
1373
|
+
var ownerDocument = node.ownerDocument;
|
|
1374
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
1375
|
+
}
|
|
1376
|
+
return node;
|
|
1211
1377
|
}
|
|
1212
|
-
function
|
|
1213
|
-
var
|
|
1214
|
-
return
|
|
1378
|
+
function isElement(node) {
|
|
1379
|
+
var OwnElement = getWindow(node).Element;
|
|
1380
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
1215
1381
|
}
|
|
1216
|
-
function
|
|
1217
|
-
var
|
|
1218
|
-
return
|
|
1382
|
+
function isHTMLElement(node) {
|
|
1383
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
1384
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
1219
1385
|
}
|
|
1220
|
-
function
|
|
1221
|
-
if (typeof ShadowRoot
|
|
1386
|
+
function isShadowRoot(node) {
|
|
1387
|
+
if (typeof ShadowRoot === "undefined") {
|
|
1222
1388
|
return false;
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1389
|
+
}
|
|
1390
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
1391
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
1392
|
+
}
|
|
1393
|
+
function applyStyles(_ref) {
|
|
1394
|
+
var state = _ref.state;
|
|
1395
|
+
Object.keys(state.elements).forEach(function(name) {
|
|
1396
|
+
var style = state.styles[name] || {};
|
|
1397
|
+
var attributes = state.attributes[name] || {};
|
|
1398
|
+
var element = state.elements[name];
|
|
1399
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
Object.assign(element.style, style);
|
|
1403
|
+
Object.keys(attributes).forEach(function(name2) {
|
|
1404
|
+
var value = attributes[name2];
|
|
1405
|
+
if (value === false) {
|
|
1406
|
+
element.removeAttribute(name2);
|
|
1407
|
+
} else {
|
|
1408
|
+
element.setAttribute(name2, value === true ? "" : value);
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1234
1411
|
});
|
|
1235
1412
|
}
|
|
1236
|
-
function
|
|
1237
|
-
var
|
|
1413
|
+
function effect$2(_ref2) {
|
|
1414
|
+
var state = _ref2.state;
|
|
1415
|
+
var initialStyles = {
|
|
1238
1416
|
popper: {
|
|
1239
|
-
position:
|
|
1417
|
+
position: state.options.strategy,
|
|
1240
1418
|
left: "0",
|
|
1241
1419
|
top: "0",
|
|
1242
1420
|
margin: "0"
|
|
@@ -1246,137 +1424,198 @@
|
|
|
1246
1424
|
},
|
|
1247
1425
|
reference: {}
|
|
1248
1426
|
};
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1427
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
1428
|
+
state.styles = initialStyles;
|
|
1429
|
+
if (state.elements.arrow) {
|
|
1430
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
1431
|
+
}
|
|
1432
|
+
return function() {
|
|
1433
|
+
Object.keys(state.elements).forEach(function(name) {
|
|
1434
|
+
var element = state.elements[name];
|
|
1435
|
+
var attributes = state.attributes[name] || {};
|
|
1436
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
|
1437
|
+
var style = styleProperties.reduce(function(style2, property) {
|
|
1438
|
+
style2[property] = "";
|
|
1439
|
+
return style2;
|
|
1253
1440
|
}, {});
|
|
1254
|
-
!
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1441
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
Object.assign(element.style, style);
|
|
1445
|
+
Object.keys(attributes).forEach(function(attribute) {
|
|
1446
|
+
element.removeAttribute(attribute);
|
|
1447
|
+
});
|
|
1257
1448
|
});
|
|
1258
1449
|
};
|
|
1259
1450
|
}
|
|
1260
|
-
const
|
|
1451
|
+
const applyStyles$1 = {
|
|
1261
1452
|
name: "applyStyles",
|
|
1262
1453
|
enabled: true,
|
|
1263
1454
|
phase: "write",
|
|
1264
|
-
fn:
|
|
1265
|
-
effect:
|
|
1455
|
+
fn: applyStyles,
|
|
1456
|
+
effect: effect$2,
|
|
1266
1457
|
requires: ["computeStyles"]
|
|
1267
1458
|
};
|
|
1268
|
-
function
|
|
1269
|
-
return
|
|
1270
|
-
}
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1459
|
+
function getBasePlacement(placement) {
|
|
1460
|
+
return placement.split("-")[0];
|
|
1461
|
+
}
|
|
1462
|
+
var max = Math.max;
|
|
1463
|
+
var min = Math.min;
|
|
1464
|
+
var round = Math.round;
|
|
1465
|
+
function getUAString() {
|
|
1466
|
+
var uaData = navigator.userAgentData;
|
|
1467
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
1468
|
+
return uaData.brands.map(function(item) {
|
|
1469
|
+
return item.brand + "/" + item.version;
|
|
1470
|
+
}).join(" ");
|
|
1471
|
+
}
|
|
1472
|
+
return navigator.userAgent;
|
|
1473
|
+
}
|
|
1474
|
+
function isLayoutViewport() {
|
|
1475
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
1476
|
+
}
|
|
1477
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
1478
|
+
if (includeScale === void 0) {
|
|
1479
|
+
includeScale = false;
|
|
1480
|
+
}
|
|
1481
|
+
if (isFixedStrategy === void 0) {
|
|
1482
|
+
isFixedStrategy = false;
|
|
1483
|
+
}
|
|
1484
|
+
var clientRect = element.getBoundingClientRect();
|
|
1485
|
+
var scaleX = 1;
|
|
1486
|
+
var scaleY = 1;
|
|
1487
|
+
if (includeScale && isHTMLElement(element)) {
|
|
1488
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
1489
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
1490
|
+
}
|
|
1491
|
+
var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
|
|
1492
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
1493
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
1494
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
1495
|
+
var width = clientRect.width / scaleX;
|
|
1496
|
+
var height = clientRect.height / scaleY;
|
|
1286
1497
|
return {
|
|
1287
|
-
width
|
|
1288
|
-
height
|
|
1289
|
-
top:
|
|
1290
|
-
right:
|
|
1291
|
-
bottom:
|
|
1292
|
-
left:
|
|
1293
|
-
x
|
|
1294
|
-
y
|
|
1498
|
+
width,
|
|
1499
|
+
height,
|
|
1500
|
+
top: y,
|
|
1501
|
+
right: x + width,
|
|
1502
|
+
bottom: y + height,
|
|
1503
|
+
left: x,
|
|
1504
|
+
x,
|
|
1505
|
+
y
|
|
1295
1506
|
};
|
|
1296
1507
|
}
|
|
1297
|
-
function
|
|
1298
|
-
var
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
width
|
|
1303
|
-
|
|
1508
|
+
function getLayoutRect(element) {
|
|
1509
|
+
var clientRect = getBoundingClientRect(element);
|
|
1510
|
+
var width = element.offsetWidth;
|
|
1511
|
+
var height = element.offsetHeight;
|
|
1512
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
|
1513
|
+
width = clientRect.width;
|
|
1514
|
+
}
|
|
1515
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
|
1516
|
+
height = clientRect.height;
|
|
1517
|
+
}
|
|
1518
|
+
return {
|
|
1519
|
+
x: element.offsetLeft,
|
|
1520
|
+
y: element.offsetTop,
|
|
1521
|
+
width,
|
|
1522
|
+
height
|
|
1304
1523
|
};
|
|
1305
1524
|
}
|
|
1306
|
-
function
|
|
1307
|
-
var
|
|
1308
|
-
if (
|
|
1525
|
+
function contains(parent, child) {
|
|
1526
|
+
var rootNode = child.getRootNode && child.getRootNode();
|
|
1527
|
+
if (parent.contains(child)) {
|
|
1309
1528
|
return true;
|
|
1310
|
-
if (
|
|
1311
|
-
var
|
|
1529
|
+
} else if (rootNode && isShadowRoot(rootNode)) {
|
|
1530
|
+
var next = child;
|
|
1312
1531
|
do {
|
|
1313
|
-
if (
|
|
1532
|
+
if (next && parent.isSameNode(next)) {
|
|
1314
1533
|
return true;
|
|
1315
|
-
|
|
1316
|
-
|
|
1534
|
+
}
|
|
1535
|
+
next = next.parentNode || next.host;
|
|
1536
|
+
} while (next);
|
|
1317
1537
|
}
|
|
1318
1538
|
return false;
|
|
1319
1539
|
}
|
|
1320
|
-
function
|
|
1321
|
-
return
|
|
1540
|
+
function getComputedStyle$1(element) {
|
|
1541
|
+
return getWindow(element).getComputedStyle(element);
|
|
1322
1542
|
}
|
|
1323
|
-
function
|
|
1324
|
-
return ["table", "td", "th"].indexOf(
|
|
1543
|
+
function isTableElement(element) {
|
|
1544
|
+
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
|
1325
1545
|
}
|
|
1326
|
-
function
|
|
1327
|
-
return ((
|
|
1546
|
+
function getDocumentElement(element) {
|
|
1547
|
+
return ((isElement(element) ? element.ownerDocument : (
|
|
1328
1548
|
// $FlowFixMe[prop-missing]
|
|
1329
|
-
|
|
1549
|
+
element.document
|
|
1330
1550
|
)) || window.document).documentElement;
|
|
1331
1551
|
}
|
|
1332
|
-
function
|
|
1333
|
-
|
|
1552
|
+
function getParentNode(element) {
|
|
1553
|
+
if (getNodeName(element) === "html") {
|
|
1554
|
+
return element;
|
|
1555
|
+
}
|
|
1556
|
+
return (
|
|
1334
1557
|
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
1335
1558
|
// $FlowFixMe[incompatible-return]
|
|
1336
1559
|
// $FlowFixMe[prop-missing]
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
(
|
|
1560
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
1561
|
+
element.parentNode || // DOM Element detected
|
|
1562
|
+
(isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
1340
1563
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
1341
|
-
|
|
1564
|
+
getDocumentElement(element)
|
|
1342
1565
|
);
|
|
1343
1566
|
}
|
|
1344
|
-
function
|
|
1345
|
-
|
|
1346
|
-
|
|
1567
|
+
function getTrueOffsetParent(element) {
|
|
1568
|
+
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
1569
|
+
getComputedStyle$1(element).position === "fixed") {
|
|
1570
|
+
return null;
|
|
1571
|
+
}
|
|
1572
|
+
return element.offsetParent;
|
|
1347
1573
|
}
|
|
1348
|
-
function
|
|
1349
|
-
var
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1574
|
+
function getContainingBlock(element) {
|
|
1575
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
1576
|
+
var isIE = /Trident/i.test(getUAString());
|
|
1577
|
+
if (isIE && isHTMLElement(element)) {
|
|
1578
|
+
var elementCss = getComputedStyle$1(element);
|
|
1579
|
+
if (elementCss.position === "fixed") {
|
|
1353
1580
|
return null;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
var currentNode = getParentNode(element);
|
|
1584
|
+
if (isShadowRoot(currentNode)) {
|
|
1585
|
+
currentNode = currentNode.host;
|
|
1354
1586
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1587
|
+
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
1588
|
+
var css = getComputedStyle$1(currentNode);
|
|
1589
|
+
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
|
1590
|
+
return currentNode;
|
|
1591
|
+
} else {
|
|
1592
|
+
currentNode = currentNode.parentNode;
|
|
1593
|
+
}
|
|
1361
1594
|
}
|
|
1362
1595
|
return null;
|
|
1363
1596
|
}
|
|
1364
|
-
function
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1597
|
+
function getOffsetParent(element) {
|
|
1598
|
+
var window2 = getWindow(element);
|
|
1599
|
+
var offsetParent = getTrueOffsetParent(element);
|
|
1600
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
|
|
1601
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1602
|
+
}
|
|
1603
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
|
|
1604
|
+
return window2;
|
|
1605
|
+
}
|
|
1606
|
+
return offsetParent || getContainingBlock(element) || window2;
|
|
1368
1607
|
}
|
|
1369
|
-
function
|
|
1370
|
-
return ["top", "bottom"].indexOf(
|
|
1608
|
+
function getMainAxisFromPlacement(placement) {
|
|
1609
|
+
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
|
1371
1610
|
}
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1611
|
+
function within(min$1, value, max$1) {
|
|
1612
|
+
return max(min$1, min(value, max$1));
|
|
1374
1613
|
}
|
|
1375
|
-
function
|
|
1376
|
-
var
|
|
1377
|
-
return
|
|
1614
|
+
function withinMaxClamp(min2, value, max2) {
|
|
1615
|
+
var v = within(min2, value, max2);
|
|
1616
|
+
return v > max2 ? max2 : v;
|
|
1378
1617
|
}
|
|
1379
|
-
function
|
|
1618
|
+
function getFreshSideObject() {
|
|
1380
1619
|
return {
|
|
1381
1620
|
top: 0,
|
|
1382
1621
|
right: 0,
|
|
@@ -1384,838 +1623,1245 @@
|
|
|
1384
1623
|
left: 0
|
|
1385
1624
|
};
|
|
1386
1625
|
}
|
|
1387
|
-
function
|
|
1388
|
-
return Object.assign({},
|
|
1626
|
+
function mergePaddingObject(paddingObject) {
|
|
1627
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
1389
1628
|
}
|
|
1390
|
-
function
|
|
1391
|
-
return
|
|
1392
|
-
|
|
1629
|
+
function expandToHashMap(value, keys) {
|
|
1630
|
+
return keys.reduce(function(hashMap, key) {
|
|
1631
|
+
hashMap[key] = value;
|
|
1632
|
+
return hashMap;
|
|
1393
1633
|
}, {});
|
|
1394
1634
|
}
|
|
1395
|
-
var
|
|
1396
|
-
|
|
1397
|
-
placement:
|
|
1398
|
-
})) :
|
|
1635
|
+
var toPaddingObject = function toPaddingObject2(padding, state) {
|
|
1636
|
+
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
|
|
1637
|
+
placement: state.placement
|
|
1638
|
+
})) : padding;
|
|
1639
|
+
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
1399
1640
|
};
|
|
1400
|
-
function
|
|
1401
|
-
var
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1641
|
+
function arrow(_ref) {
|
|
1642
|
+
var _state$modifiersData$;
|
|
1643
|
+
var state = _ref.state, name = _ref.name, options = _ref.options;
|
|
1644
|
+
var arrowElement = state.elements.arrow;
|
|
1645
|
+
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
1646
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
1647
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
|
1648
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
1649
|
+
var len = isVertical ? "height" : "width";
|
|
1650
|
+
if (!arrowElement || !popperOffsets2) {
|
|
1651
|
+
return;
|
|
1405
1652
|
}
|
|
1653
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
|
1654
|
+
var arrowRect = getLayoutRect(arrowElement);
|
|
1655
|
+
var minProp = axis === "y" ? top : left;
|
|
1656
|
+
var maxProp = axis === "y" ? bottom : right;
|
|
1657
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
|
|
1658
|
+
var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
|
|
1659
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
1660
|
+
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
1661
|
+
var centerToReference = endDiff / 2 - startDiff / 2;
|
|
1662
|
+
var min2 = paddingObject[minProp];
|
|
1663
|
+
var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
1664
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
1665
|
+
var offset2 = within(min2, center, max2);
|
|
1666
|
+
var axisProp = axis;
|
|
1667
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
|
|
1668
|
+
}
|
|
1669
|
+
function effect$1(_ref2) {
|
|
1670
|
+
var state = _ref2.state, options = _ref2.options;
|
|
1671
|
+
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
|
|
1672
|
+
if (arrowElement == null) {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
if (typeof arrowElement === "string") {
|
|
1676
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
1677
|
+
if (!arrowElement) {
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
state.elements.arrow = arrowElement;
|
|
1406
1685
|
}
|
|
1407
|
-
|
|
1408
|
-
var t = e.state, r = e.options, i = r.element, n = i === void 0 ? "[data-popper-arrow]" : i;
|
|
1409
|
-
n != null && (typeof n == "string" && (n = t.elements.popper.querySelector(n), !n) || vt(t.elements.popper, n) && (t.elements.arrow = n));
|
|
1410
|
-
}
|
|
1411
|
-
const ir = {
|
|
1686
|
+
const arrow$1 = {
|
|
1412
1687
|
name: "arrow",
|
|
1413
1688
|
enabled: true,
|
|
1414
1689
|
phase: "main",
|
|
1415
|
-
fn:
|
|
1416
|
-
effect:
|
|
1690
|
+
fn: arrow,
|
|
1691
|
+
effect: effect$1,
|
|
1417
1692
|
requires: ["popperOffsets"],
|
|
1418
1693
|
requiresIfExists: ["preventOverflow"]
|
|
1419
1694
|
};
|
|
1420
|
-
function
|
|
1421
|
-
return
|
|
1695
|
+
function getVariation(placement) {
|
|
1696
|
+
return placement.split("-")[1];
|
|
1422
1697
|
}
|
|
1423
|
-
var
|
|
1698
|
+
var unsetSides = {
|
|
1424
1699
|
top: "auto",
|
|
1425
1700
|
right: "auto",
|
|
1426
1701
|
bottom: "auto",
|
|
1427
1702
|
left: "auto"
|
|
1428
1703
|
};
|
|
1429
|
-
function
|
|
1430
|
-
var
|
|
1704
|
+
function roundOffsetsByDPR(_ref, win) {
|
|
1705
|
+
var x = _ref.x, y = _ref.y;
|
|
1706
|
+
var dpr = win.devicePixelRatio || 1;
|
|
1431
1707
|
return {
|
|
1432
|
-
x:
|
|
1433
|
-
y:
|
|
1708
|
+
x: round(x * dpr) / dpr || 0,
|
|
1709
|
+
y: round(y * dpr) / dpr || 0
|
|
1434
1710
|
};
|
|
1435
1711
|
}
|
|
1436
|
-
function
|
|
1437
|
-
var
|
|
1438
|
-
|
|
1439
|
-
|
|
1712
|
+
function mapToStyles(_ref2) {
|
|
1713
|
+
var _Object$assign2;
|
|
1714
|
+
var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
|
1715
|
+
var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
1716
|
+
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
|
|
1717
|
+
x,
|
|
1718
|
+
y
|
|
1440
1719
|
}) : {
|
|
1441
|
-
x
|
|
1442
|
-
y
|
|
1720
|
+
x,
|
|
1721
|
+
y
|
|
1443
1722
|
};
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1723
|
+
x = _ref3.x;
|
|
1724
|
+
y = _ref3.y;
|
|
1725
|
+
var hasX = offsets.hasOwnProperty("x");
|
|
1726
|
+
var hasY = offsets.hasOwnProperty("y");
|
|
1727
|
+
var sideX = left;
|
|
1728
|
+
var sideY = top;
|
|
1729
|
+
var win = window;
|
|
1730
|
+
if (adaptive) {
|
|
1731
|
+
var offsetParent = getOffsetParent(popper2);
|
|
1732
|
+
var heightProp = "clientHeight";
|
|
1733
|
+
var widthProp = "clientWidth";
|
|
1734
|
+
if (offsetParent === getWindow(popper2)) {
|
|
1735
|
+
offsetParent = getDocumentElement(popper2);
|
|
1736
|
+
if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
|
|
1737
|
+
heightProp = "scrollHeight";
|
|
1738
|
+
widthProp = "scrollWidth";
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
offsetParent = offsetParent;
|
|
1742
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
1743
|
+
sideY = bottom;
|
|
1744
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
|
|
1451
1745
|
// $FlowFixMe[prop-missing]
|
|
1452
|
-
|
|
1746
|
+
offsetParent[heightProp]
|
|
1453
1747
|
);
|
|
1454
|
-
|
|
1748
|
+
y -= offsetY - popperRect.height;
|
|
1749
|
+
y *= gpuAcceleration ? 1 : -1;
|
|
1455
1750
|
}
|
|
1456
|
-
if (
|
|
1457
|
-
|
|
1458
|
-
var
|
|
1751
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
1752
|
+
sideX = right;
|
|
1753
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
|
|
1459
1754
|
// $FlowFixMe[prop-missing]
|
|
1460
|
-
|
|
1755
|
+
offsetParent[widthProp]
|
|
1461
1756
|
);
|
|
1462
|
-
|
|
1757
|
+
x -= offsetX - popperRect.width;
|
|
1758
|
+
x *= gpuAcceleration ? 1 : -1;
|
|
1463
1759
|
}
|
|
1464
1760
|
}
|
|
1465
|
-
var
|
|
1466
|
-
position
|
|
1467
|
-
},
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1761
|
+
var commonStyles = Object.assign({
|
|
1762
|
+
position
|
|
1763
|
+
}, adaptive && unsetSides);
|
|
1764
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
1765
|
+
x,
|
|
1766
|
+
y
|
|
1767
|
+
}, getWindow(popper2)) : {
|
|
1768
|
+
x,
|
|
1769
|
+
y
|
|
1473
1770
|
};
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1771
|
+
x = _ref4.x;
|
|
1772
|
+
y = _ref4.y;
|
|
1773
|
+
if (gpuAcceleration) {
|
|
1774
|
+
var _Object$assign;
|
|
1775
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
1776
|
+
}
|
|
1777
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
|
1778
|
+
}
|
|
1779
|
+
function computeStyles(_ref5) {
|
|
1780
|
+
var state = _ref5.state, options = _ref5.options;
|
|
1781
|
+
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
1782
|
+
var commonStyles = {
|
|
1783
|
+
placement: getBasePlacement(state.placement),
|
|
1784
|
+
variation: getVariation(state.placement),
|
|
1785
|
+
popper: state.elements.popper,
|
|
1786
|
+
popperRect: state.rects.popper,
|
|
1787
|
+
gpuAcceleration,
|
|
1788
|
+
isFixed: state.options.strategy === "fixed"
|
|
1488
1789
|
};
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1790
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
1791
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
1792
|
+
offsets: state.modifiersData.popperOffsets,
|
|
1793
|
+
position: state.options.strategy,
|
|
1794
|
+
adaptive,
|
|
1795
|
+
roundOffsets
|
|
1796
|
+
})));
|
|
1797
|
+
}
|
|
1798
|
+
if (state.modifiersData.arrow != null) {
|
|
1799
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
1800
|
+
offsets: state.modifiersData.arrow,
|
|
1801
|
+
position: "absolute",
|
|
1802
|
+
adaptive: false,
|
|
1803
|
+
roundOffsets
|
|
1804
|
+
})));
|
|
1805
|
+
}
|
|
1806
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
1807
|
+
"data-popper-placement": state.placement
|
|
1501
1808
|
});
|
|
1502
1809
|
}
|
|
1503
|
-
const
|
|
1810
|
+
const computeStyles$1 = {
|
|
1504
1811
|
name: "computeStyles",
|
|
1505
1812
|
enabled: true,
|
|
1506
1813
|
phase: "beforeWrite",
|
|
1507
|
-
fn:
|
|
1814
|
+
fn: computeStyles,
|
|
1508
1815
|
data: {}
|
|
1509
1816
|
};
|
|
1510
|
-
var
|
|
1817
|
+
var passive = {
|
|
1511
1818
|
passive: true
|
|
1512
1819
|
};
|
|
1513
|
-
function
|
|
1514
|
-
var
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1820
|
+
function effect(_ref) {
|
|
1821
|
+
var state = _ref.state, instance = _ref.instance, options = _ref.options;
|
|
1822
|
+
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
|
1823
|
+
var window2 = getWindow(state.elements.popper);
|
|
1824
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
1825
|
+
if (scroll) {
|
|
1826
|
+
scrollParents.forEach(function(scrollParent) {
|
|
1827
|
+
scrollParent.addEventListener("scroll", instance.update, passive);
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
if (resize) {
|
|
1831
|
+
window2.addEventListener("resize", instance.update, passive);
|
|
1832
|
+
}
|
|
1833
|
+
return function() {
|
|
1834
|
+
if (scroll) {
|
|
1835
|
+
scrollParents.forEach(function(scrollParent) {
|
|
1836
|
+
scrollParent.removeEventListener("scroll", instance.update, passive);
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
if (resize) {
|
|
1840
|
+
window2.removeEventListener("resize", instance.update, passive);
|
|
1841
|
+
}
|
|
1521
1842
|
};
|
|
1522
1843
|
}
|
|
1523
|
-
const
|
|
1844
|
+
const eventListeners = {
|
|
1524
1845
|
name: "eventListeners",
|
|
1525
1846
|
enabled: true,
|
|
1526
1847
|
phase: "write",
|
|
1527
|
-
fn: function() {
|
|
1848
|
+
fn: function fn() {
|
|
1528
1849
|
},
|
|
1529
|
-
effect
|
|
1850
|
+
effect,
|
|
1530
1851
|
data: {}
|
|
1531
1852
|
};
|
|
1532
|
-
var
|
|
1853
|
+
var hash$1 = {
|
|
1533
1854
|
left: "right",
|
|
1534
1855
|
right: "left",
|
|
1535
1856
|
bottom: "top",
|
|
1536
1857
|
top: "bottom"
|
|
1537
1858
|
};
|
|
1538
|
-
function
|
|
1539
|
-
return
|
|
1540
|
-
return
|
|
1859
|
+
function getOppositePlacement(placement) {
|
|
1860
|
+
return placement.replace(/left|right|bottom|top/g, function(matched) {
|
|
1861
|
+
return hash$1[matched];
|
|
1541
1862
|
});
|
|
1542
1863
|
}
|
|
1543
|
-
var
|
|
1864
|
+
var hash = {
|
|
1544
1865
|
start: "end",
|
|
1545
1866
|
end: "start"
|
|
1546
1867
|
};
|
|
1547
|
-
function
|
|
1548
|
-
return
|
|
1549
|
-
return
|
|
1868
|
+
function getOppositeVariationPlacement(placement) {
|
|
1869
|
+
return placement.replace(/start|end/g, function(matched) {
|
|
1870
|
+
return hash[matched];
|
|
1550
1871
|
});
|
|
1551
1872
|
}
|
|
1552
|
-
function
|
|
1553
|
-
var
|
|
1873
|
+
function getWindowScroll(node) {
|
|
1874
|
+
var win = getWindow(node);
|
|
1875
|
+
var scrollLeft = win.pageXOffset;
|
|
1876
|
+
var scrollTop = win.pageYOffset;
|
|
1554
1877
|
return {
|
|
1555
|
-
scrollLeft
|
|
1556
|
-
scrollTop
|
|
1878
|
+
scrollLeft,
|
|
1879
|
+
scrollTop
|
|
1557
1880
|
};
|
|
1558
1881
|
}
|
|
1559
|
-
function
|
|
1560
|
-
return
|
|
1561
|
-
}
|
|
1562
|
-
function
|
|
1563
|
-
var
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1882
|
+
function getWindowScrollBarX(element) {
|
|
1883
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
1884
|
+
}
|
|
1885
|
+
function getViewportRect(element, strategy) {
|
|
1886
|
+
var win = getWindow(element);
|
|
1887
|
+
var html = getDocumentElement(element);
|
|
1888
|
+
var visualViewport = win.visualViewport;
|
|
1889
|
+
var width = html.clientWidth;
|
|
1890
|
+
var height = html.clientHeight;
|
|
1891
|
+
var x = 0;
|
|
1892
|
+
var y = 0;
|
|
1893
|
+
if (visualViewport) {
|
|
1894
|
+
width = visualViewport.width;
|
|
1895
|
+
height = visualViewport.height;
|
|
1896
|
+
var layoutViewport = isLayoutViewport();
|
|
1897
|
+
if (layoutViewport || !layoutViewport && strategy === "fixed") {
|
|
1898
|
+
x = visualViewport.offsetLeft;
|
|
1899
|
+
y = visualViewport.offsetTop;
|
|
1900
|
+
}
|
|
1568
1901
|
}
|
|
1569
1902
|
return {
|
|
1570
|
-
width
|
|
1571
|
-
height
|
|
1572
|
-
x:
|
|
1573
|
-
y
|
|
1903
|
+
width,
|
|
1904
|
+
height,
|
|
1905
|
+
x: x + getWindowScrollBarX(element),
|
|
1906
|
+
y
|
|
1574
1907
|
};
|
|
1575
1908
|
}
|
|
1576
|
-
function
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1909
|
+
function getDocumentRect(element) {
|
|
1910
|
+
var _element$ownerDocumen;
|
|
1911
|
+
var html = getDocumentElement(element);
|
|
1912
|
+
var winScroll = getWindowScroll(element);
|
|
1913
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
1914
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
1915
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
1916
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
1917
|
+
var y = -winScroll.scrollTop;
|
|
1918
|
+
if (getComputedStyle$1(body || html).direction === "rtl") {
|
|
1919
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
1920
|
+
}
|
|
1921
|
+
return {
|
|
1922
|
+
width,
|
|
1923
|
+
height,
|
|
1924
|
+
x,
|
|
1925
|
+
y
|
|
1583
1926
|
};
|
|
1584
1927
|
}
|
|
1585
|
-
function
|
|
1586
|
-
var
|
|
1587
|
-
return /auto|scroll|overlay|hidden/.test(
|
|
1928
|
+
function isScrollParent(element) {
|
|
1929
|
+
var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
|
1930
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
1588
1931
|
}
|
|
1589
|
-
function
|
|
1590
|
-
|
|
1932
|
+
function getScrollParent(node) {
|
|
1933
|
+
if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
|
|
1934
|
+
return node.ownerDocument.body;
|
|
1935
|
+
}
|
|
1936
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
1937
|
+
return node;
|
|
1938
|
+
}
|
|
1939
|
+
return getScrollParent(getParentNode(node));
|
|
1591
1940
|
}
|
|
1592
|
-
function
|
|
1593
|
-
var
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1941
|
+
function listScrollParents(element, list) {
|
|
1942
|
+
var _element$ownerDocumen;
|
|
1943
|
+
if (list === void 0) {
|
|
1944
|
+
list = [];
|
|
1945
|
+
}
|
|
1946
|
+
var scrollParent = getScrollParent(element);
|
|
1947
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
1948
|
+
var win = getWindow(scrollParent);
|
|
1949
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
1950
|
+
var updatedList = list.concat(target);
|
|
1951
|
+
return isBody ? updatedList : (
|
|
1597
1952
|
// $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
1598
|
-
|
|
1953
|
+
updatedList.concat(listScrollParents(getParentNode(target)))
|
|
1599
1954
|
);
|
|
1600
1955
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return Object.assign({},
|
|
1603
|
-
left:
|
|
1604
|
-
top:
|
|
1605
|
-
right:
|
|
1606
|
-
bottom:
|
|
1956
|
+
function rectToClientRect(rect) {
|
|
1957
|
+
return Object.assign({}, rect, {
|
|
1958
|
+
left: rect.x,
|
|
1959
|
+
top: rect.y,
|
|
1960
|
+
right: rect.x + rect.width,
|
|
1961
|
+
bottom: rect.y + rect.height
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1965
|
+
var rect = getBoundingClientRect(element, false, strategy === "fixed");
|
|
1966
|
+
rect.top = rect.top + element.clientTop;
|
|
1967
|
+
rect.left = rect.left + element.clientLeft;
|
|
1968
|
+
rect.bottom = rect.top + element.clientHeight;
|
|
1969
|
+
rect.right = rect.left + element.clientWidth;
|
|
1970
|
+
rect.width = element.clientWidth;
|
|
1971
|
+
rect.height = element.clientHeight;
|
|
1972
|
+
rect.x = rect.left;
|
|
1973
|
+
rect.y = rect.top;
|
|
1974
|
+
return rect;
|
|
1975
|
+
}
|
|
1976
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
1977
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
1978
|
+
}
|
|
1979
|
+
function getClippingParents(element) {
|
|
1980
|
+
var clippingParents2 = listScrollParents(getParentNode(element));
|
|
1981
|
+
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
|
|
1982
|
+
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
1983
|
+
if (!isElement(clipperElement)) {
|
|
1984
|
+
return [];
|
|
1985
|
+
}
|
|
1986
|
+
return clippingParents2.filter(function(clippingParent) {
|
|
1987
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
|
|
1607
1988
|
});
|
|
1608
1989
|
}
|
|
1609
|
-
function
|
|
1610
|
-
var
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
return
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
var
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1990
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
1991
|
+
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
|
|
1992
|
+
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
|
|
1993
|
+
var firstClippingParent = clippingParents2[0];
|
|
1994
|
+
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
|
|
1995
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
1996
|
+
accRect.top = max(rect.top, accRect.top);
|
|
1997
|
+
accRect.right = min(rect.right, accRect.right);
|
|
1998
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1999
|
+
accRect.left = max(rect.left, accRect.left);
|
|
2000
|
+
return accRect;
|
|
2001
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
2002
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
2003
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
2004
|
+
clippingRect.x = clippingRect.left;
|
|
2005
|
+
clippingRect.y = clippingRect.top;
|
|
2006
|
+
return clippingRect;
|
|
2007
|
+
}
|
|
2008
|
+
function computeOffsets(_ref) {
|
|
2009
|
+
var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
|
|
2010
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
2011
|
+
var variation = placement ? getVariation(placement) : null;
|
|
2012
|
+
var commonX = reference2.x + reference2.width / 2 - element.width / 2;
|
|
2013
|
+
var commonY = reference2.y + reference2.height / 2 - element.height / 2;
|
|
2014
|
+
var offsets;
|
|
2015
|
+
switch (basePlacement) {
|
|
2016
|
+
case top:
|
|
2017
|
+
offsets = {
|
|
2018
|
+
x: commonX,
|
|
2019
|
+
y: reference2.y - element.height
|
|
1636
2020
|
};
|
|
1637
2021
|
break;
|
|
1638
|
-
case
|
|
1639
|
-
|
|
1640
|
-
x:
|
|
1641
|
-
y:
|
|
2022
|
+
case bottom:
|
|
2023
|
+
offsets = {
|
|
2024
|
+
x: commonX,
|
|
2025
|
+
y: reference2.y + reference2.height
|
|
1642
2026
|
};
|
|
1643
2027
|
break;
|
|
1644
|
-
case
|
|
1645
|
-
|
|
1646
|
-
x:
|
|
1647
|
-
y:
|
|
2028
|
+
case right:
|
|
2029
|
+
offsets = {
|
|
2030
|
+
x: reference2.x + reference2.width,
|
|
2031
|
+
y: commonY
|
|
1648
2032
|
};
|
|
1649
2033
|
break;
|
|
1650
|
-
case
|
|
1651
|
-
|
|
1652
|
-
x:
|
|
1653
|
-
y:
|
|
2034
|
+
case left:
|
|
2035
|
+
offsets = {
|
|
2036
|
+
x: reference2.x - element.width,
|
|
2037
|
+
y: commonY
|
|
1654
2038
|
};
|
|
1655
2039
|
break;
|
|
1656
2040
|
default:
|
|
1657
|
-
|
|
1658
|
-
x:
|
|
1659
|
-
y:
|
|
2041
|
+
offsets = {
|
|
2042
|
+
x: reference2.x,
|
|
2043
|
+
y: reference2.y
|
|
1660
2044
|
};
|
|
1661
2045
|
}
|
|
1662
|
-
var
|
|
1663
|
-
if (
|
|
1664
|
-
var
|
|
1665
|
-
switch (
|
|
1666
|
-
case
|
|
1667
|
-
|
|
2046
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
2047
|
+
if (mainAxis != null) {
|
|
2048
|
+
var len = mainAxis === "y" ? "height" : "width";
|
|
2049
|
+
switch (variation) {
|
|
2050
|
+
case start:
|
|
2051
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
|
|
1668
2052
|
break;
|
|
1669
|
-
case
|
|
1670
|
-
|
|
2053
|
+
case end:
|
|
2054
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
|
|
1671
2055
|
break;
|
|
1672
2056
|
}
|
|
1673
2057
|
}
|
|
1674
|
-
return
|
|
1675
|
-
}
|
|
1676
|
-
function
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
2058
|
+
return offsets;
|
|
2059
|
+
}
|
|
2060
|
+
function detectOverflow(state, options) {
|
|
2061
|
+
if (options === void 0) {
|
|
2062
|
+
options = {};
|
|
2063
|
+
}
|
|
2064
|
+
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
2065
|
+
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
2066
|
+
var altContext = elementContext === popper ? reference : popper;
|
|
2067
|
+
var popperRect = state.rects.popper;
|
|
2068
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
2069
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
2070
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
2071
|
+
var popperOffsets2 = computeOffsets({
|
|
2072
|
+
reference: referenceClientRect,
|
|
2073
|
+
element: popperRect,
|
|
1681
2074
|
strategy: "absolute",
|
|
1682
|
-
placement
|
|
1683
|
-
})
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
2075
|
+
placement
|
|
2076
|
+
});
|
|
2077
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
|
|
2078
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
|
2079
|
+
var overflowOffsets = {
|
|
2080
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
2081
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
2082
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
2083
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
2084
|
+
};
|
|
2085
|
+
var offsetData = state.modifiersData.offset;
|
|
2086
|
+
if (elementContext === popper && offsetData) {
|
|
2087
|
+
var offset2 = offsetData[placement];
|
|
2088
|
+
Object.keys(overflowOffsets).forEach(function(key) {
|
|
2089
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
2090
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
|
|
2091
|
+
overflowOffsets[key] += offset2[axis] * multiply;
|
|
1694
2092
|
});
|
|
1695
2093
|
}
|
|
1696
|
-
return
|
|
2094
|
+
return overflowOffsets;
|
|
1697
2095
|
}
|
|
1698
|
-
function
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
2096
|
+
function computeAutoPlacement(state, options) {
|
|
2097
|
+
if (options === void 0) {
|
|
2098
|
+
options = {};
|
|
2099
|
+
}
|
|
2100
|
+
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
2101
|
+
var variation = getVariation(placement);
|
|
2102
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
|
2103
|
+
return getVariation(placement2) === variation;
|
|
2104
|
+
}) : basePlacements;
|
|
2105
|
+
var allowedPlacements = placements$1.filter(function(placement2) {
|
|
2106
|
+
return allowedAutoPlacements.indexOf(placement2) >= 0;
|
|
1704
2107
|
});
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
2108
|
+
if (allowedPlacements.length === 0) {
|
|
2109
|
+
allowedPlacements = placements$1;
|
|
2110
|
+
}
|
|
2111
|
+
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
|
2112
|
+
acc[placement2] = detectOverflow(state, {
|
|
2113
|
+
placement: placement2,
|
|
2114
|
+
boundary,
|
|
2115
|
+
rootBoundary,
|
|
2116
|
+
padding
|
|
2117
|
+
})[getBasePlacement(placement2)];
|
|
2118
|
+
return acc;
|
|
1713
2119
|
}, {});
|
|
1714
|
-
return Object.keys(
|
|
1715
|
-
return
|
|
2120
|
+
return Object.keys(overflows).sort(function(a, b) {
|
|
2121
|
+
return overflows[a] - overflows[b];
|
|
1716
2122
|
});
|
|
1717
2123
|
}
|
|
1718
|
-
function
|
|
1719
|
-
if (
|
|
2124
|
+
function getExpandedFallbackPlacements(placement) {
|
|
2125
|
+
if (getBasePlacement(placement) === auto) {
|
|
1720
2126
|
return [];
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
2127
|
+
}
|
|
2128
|
+
var oppositePlacement = getOppositePlacement(placement);
|
|
2129
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
2130
|
+
}
|
|
2131
|
+
function flip(_ref) {
|
|
2132
|
+
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
2133
|
+
if (state.modifiersData[name]._skip) {
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
|
|
2137
|
+
var preferredPlacement = state.options.placement;
|
|
2138
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
|
2139
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
|
2140
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
2141
|
+
var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
|
|
2142
|
+
return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
|
|
2143
|
+
placement: placement2,
|
|
2144
|
+
boundary,
|
|
2145
|
+
rootBoundary,
|
|
2146
|
+
padding,
|
|
2147
|
+
flipVariations,
|
|
2148
|
+
allowedAutoPlacements
|
|
2149
|
+
}) : placement2);
|
|
2150
|
+
}, []);
|
|
2151
|
+
var referenceRect = state.rects.reference;
|
|
2152
|
+
var popperRect = state.rects.popper;
|
|
2153
|
+
var checksMap = /* @__PURE__ */ new Map();
|
|
2154
|
+
var makeFallbackChecks = true;
|
|
2155
|
+
var firstFittingPlacement = placements2[0];
|
|
2156
|
+
for (var i = 0; i < placements2.length; i++) {
|
|
2157
|
+
var placement = placements2[i];
|
|
2158
|
+
var _basePlacement = getBasePlacement(placement);
|
|
2159
|
+
var isStartVariation = getVariation(placement) === start;
|
|
2160
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
2161
|
+
var len = isVertical ? "width" : "height";
|
|
2162
|
+
var overflow = detectOverflow(state, {
|
|
2163
|
+
placement,
|
|
2164
|
+
boundary,
|
|
2165
|
+
rootBoundary,
|
|
2166
|
+
altBoundary,
|
|
2167
|
+
padding
|
|
2168
|
+
});
|
|
2169
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
2170
|
+
if (referenceRect[len] > popperRect[len]) {
|
|
2171
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
2172
|
+
}
|
|
2173
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
2174
|
+
var checks = [];
|
|
2175
|
+
if (checkMainAxis) {
|
|
2176
|
+
checks.push(overflow[_basePlacement] <= 0);
|
|
2177
|
+
}
|
|
2178
|
+
if (checkAltAxis) {
|
|
2179
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
2180
|
+
}
|
|
2181
|
+
if (checks.every(function(check) {
|
|
2182
|
+
return check;
|
|
2183
|
+
})) {
|
|
2184
|
+
firstFittingPlacement = placement;
|
|
2185
|
+
makeFallbackChecks = false;
|
|
2186
|
+
break;
|
|
2187
|
+
}
|
|
2188
|
+
checksMap.set(placement, checks);
|
|
2189
|
+
}
|
|
2190
|
+
if (makeFallbackChecks) {
|
|
2191
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
|
2192
|
+
var _loop = function _loop2(_i2) {
|
|
2193
|
+
var fittingPlacement = placements2.find(function(placement2) {
|
|
2194
|
+
var checks2 = checksMap.get(placement2);
|
|
2195
|
+
if (checks2) {
|
|
2196
|
+
return checks2.slice(0, _i2).every(function(check) {
|
|
2197
|
+
return check;
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2200
|
+
});
|
|
2201
|
+
if (fittingPlacement) {
|
|
2202
|
+
firstFittingPlacement = fittingPlacement;
|
|
2203
|
+
return "break";
|
|
1768
2204
|
}
|
|
1769
|
-
|
|
2205
|
+
};
|
|
2206
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
2207
|
+
var _ret = _loop(_i);
|
|
2208
|
+
if (_ret === "break") break;
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
if (state.placement !== firstFittingPlacement) {
|
|
2212
|
+
state.modifiersData[name]._skip = true;
|
|
2213
|
+
state.placement = firstFittingPlacement;
|
|
2214
|
+
state.reset = true;
|
|
1770
2215
|
}
|
|
1771
2216
|
}
|
|
1772
|
-
const
|
|
2217
|
+
const flip$1 = {
|
|
1773
2218
|
name: "flip",
|
|
1774
2219
|
enabled: true,
|
|
1775
2220
|
phase: "main",
|
|
1776
|
-
fn:
|
|
2221
|
+
fn: flip,
|
|
1777
2222
|
requiresIfExists: ["offset"],
|
|
1778
2223
|
data: {
|
|
1779
2224
|
_skip: false
|
|
1780
2225
|
}
|
|
1781
2226
|
};
|
|
1782
|
-
function
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
2227
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
2228
|
+
if (preventedOffsets === void 0) {
|
|
2229
|
+
preventedOffsets = {
|
|
2230
|
+
x: 0,
|
|
2231
|
+
y: 0
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
return {
|
|
2235
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
|
2236
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
|
2237
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
2238
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
|
1791
2239
|
};
|
|
1792
2240
|
}
|
|
1793
|
-
function
|
|
1794
|
-
return [
|
|
1795
|
-
return
|
|
2241
|
+
function isAnySideFullyClipped(overflow) {
|
|
2242
|
+
return [top, right, bottom, left].some(function(side) {
|
|
2243
|
+
return overflow[side] >= 0;
|
|
1796
2244
|
});
|
|
1797
2245
|
}
|
|
1798
|
-
function
|
|
1799
|
-
var
|
|
2246
|
+
function hide(_ref) {
|
|
2247
|
+
var state = _ref.state, name = _ref.name;
|
|
2248
|
+
var referenceRect = state.rects.reference;
|
|
2249
|
+
var popperRect = state.rects.popper;
|
|
2250
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
2251
|
+
var referenceOverflow = detectOverflow(state, {
|
|
1800
2252
|
elementContext: "reference"
|
|
1801
|
-
})
|
|
2253
|
+
});
|
|
2254
|
+
var popperAltOverflow = detectOverflow(state, {
|
|
1802
2255
|
altBoundary: true
|
|
1803
|
-
})
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
2256
|
+
});
|
|
2257
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
2258
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
2259
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
2260
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
2261
|
+
state.modifiersData[name] = {
|
|
2262
|
+
referenceClippingOffsets,
|
|
2263
|
+
popperEscapeOffsets,
|
|
2264
|
+
isReferenceHidden,
|
|
2265
|
+
hasPopperEscaped
|
|
2266
|
+
};
|
|
2267
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
2268
|
+
"data-popper-reference-hidden": isReferenceHidden,
|
|
2269
|
+
"data-popper-escaped": hasPopperEscaped
|
|
1812
2270
|
});
|
|
1813
2271
|
}
|
|
1814
|
-
const
|
|
2272
|
+
const hide$1 = {
|
|
1815
2273
|
name: "hide",
|
|
1816
2274
|
enabled: true,
|
|
1817
2275
|
phase: "main",
|
|
1818
2276
|
requiresIfExists: ["preventOverflow"],
|
|
1819
|
-
fn:
|
|
2277
|
+
fn: hide
|
|
1820
2278
|
};
|
|
1821
|
-
function
|
|
1822
|
-
var
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2279
|
+
function distanceAndSkiddingToXY(placement, rects, offset2) {
|
|
2280
|
+
var basePlacement = getBasePlacement(placement);
|
|
2281
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
2282
|
+
var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
|
|
2283
|
+
placement
|
|
2284
|
+
})) : offset2, skidding = _ref[0], distance = _ref[1];
|
|
2285
|
+
skidding = skidding || 0;
|
|
2286
|
+
distance = (distance || 0) * invertDistance;
|
|
2287
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
2288
|
+
x: distance,
|
|
2289
|
+
y: skidding
|
|
1828
2290
|
} : {
|
|
1829
|
-
x:
|
|
1830
|
-
y:
|
|
2291
|
+
x: skidding,
|
|
2292
|
+
y: distance
|
|
1831
2293
|
};
|
|
1832
2294
|
}
|
|
1833
|
-
function
|
|
1834
|
-
var
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
2295
|
+
function offset(_ref2) {
|
|
2296
|
+
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
|
|
2297
|
+
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
2298
|
+
var data = placements.reduce(function(acc, placement) {
|
|
2299
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
|
2300
|
+
return acc;
|
|
2301
|
+
}, {});
|
|
2302
|
+
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
|
|
2303
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
2304
|
+
state.modifiersData.popperOffsets.x += x;
|
|
2305
|
+
state.modifiersData.popperOffsets.y += y;
|
|
2306
|
+
}
|
|
2307
|
+
state.modifiersData[name] = data;
|
|
1838
2308
|
}
|
|
1839
|
-
const
|
|
2309
|
+
const offset$1 = {
|
|
1840
2310
|
name: "offset",
|
|
1841
2311
|
enabled: true,
|
|
1842
2312
|
phase: "main",
|
|
1843
2313
|
requires: ["popperOffsets"],
|
|
1844
|
-
fn:
|
|
2314
|
+
fn: offset
|
|
1845
2315
|
};
|
|
1846
|
-
function
|
|
1847
|
-
var
|
|
1848
|
-
|
|
1849
|
-
reference:
|
|
1850
|
-
element:
|
|
2316
|
+
function popperOffsets(_ref) {
|
|
2317
|
+
var state = _ref.state, name = _ref.name;
|
|
2318
|
+
state.modifiersData[name] = computeOffsets({
|
|
2319
|
+
reference: state.rects.reference,
|
|
2320
|
+
element: state.rects.popper,
|
|
1851
2321
|
strategy: "absolute",
|
|
1852
|
-
placement:
|
|
2322
|
+
placement: state.placement
|
|
1853
2323
|
});
|
|
1854
2324
|
}
|
|
1855
|
-
const $
|
|
2325
|
+
const popperOffsets$1 = {
|
|
1856
2326
|
name: "popperOffsets",
|
|
1857
2327
|
enabled: true,
|
|
1858
2328
|
phase: "read",
|
|
1859
|
-
fn:
|
|
2329
|
+
fn: popperOffsets,
|
|
1860
2330
|
data: {}
|
|
1861
2331
|
};
|
|
1862
|
-
function
|
|
1863
|
-
return
|
|
1864
|
-
}
|
|
1865
|
-
function
|
|
1866
|
-
var
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
})
|
|
1874
|
-
|
|
1875
|
-
|
|
2332
|
+
function getAltAxis(axis) {
|
|
2333
|
+
return axis === "x" ? "y" : "x";
|
|
2334
|
+
}
|
|
2335
|
+
function preventOverflow(_ref) {
|
|
2336
|
+
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
2337
|
+
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
2338
|
+
var overflow = detectOverflow(state, {
|
|
2339
|
+
boundary,
|
|
2340
|
+
rootBoundary,
|
|
2341
|
+
padding,
|
|
2342
|
+
altBoundary
|
|
2343
|
+
});
|
|
2344
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
2345
|
+
var variation = getVariation(state.placement);
|
|
2346
|
+
var isBasePlacement = !variation;
|
|
2347
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
2348
|
+
var altAxis = getAltAxis(mainAxis);
|
|
2349
|
+
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
2350
|
+
var referenceRect = state.rects.reference;
|
|
2351
|
+
var popperRect = state.rects.popper;
|
|
2352
|
+
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
|
|
2353
|
+
placement: state.placement
|
|
2354
|
+
})) : tetherOffset;
|
|
2355
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
|
|
2356
|
+
mainAxis: tetherOffsetValue,
|
|
2357
|
+
altAxis: tetherOffsetValue
|
|
1876
2358
|
} : Object.assign({
|
|
1877
2359
|
mainAxis: 0,
|
|
1878
2360
|
altAxis: 0
|
|
1879
|
-
},
|
|
2361
|
+
}, tetherOffsetValue);
|
|
2362
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
2363
|
+
var data = {
|
|
1880
2364
|
x: 0,
|
|
1881
2365
|
y: 0
|
|
1882
2366
|
};
|
|
1883
|
-
if (
|
|
1884
|
-
|
|
1885
|
-
var C2, X2 = p2 === "y" ? k : D, Y2 = p2 === "y" ? S : M, R2 = p2 === "y" ? "height" : "width", W2 = m2[p2], ue = W2 + d2[X2], q2 = W2 - d2[Y2], pe = u2 ? -L2[R2] / 2 : 0, be = O2 === Q ? x2[R2] : L2[R2], re = O2 === Q ? -L2[R2] : -x2[R2], de = t.elements.arrow, G2 = u2 && de ? Be(de) : {
|
|
1886
|
-
width: 0,
|
|
1887
|
-
height: 0
|
|
1888
|
-
}, I2 = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ht(), ie = I2[X2], ve = I2[Y2], z2 = oe(0, x2[R2], G2[R2]), xe = E2 ? x2[R2] / 2 - pe - z2 - ie - A2.mainAxis : be - z2 - ie - A2.mainAxis, Ot = E2 ? -x2[R2] / 2 + pe + z2 + ve + A2.mainAxis : re + z2 + ve + A2.mainAxis, Oe = t.elements.arrow && fe(t.elements.arrow), Et = Oe ? p2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, He = (C2 = $2 == null ? void 0 : $2[p2]) != null ? C2 : 0, At = W2 + xe - He - Et, Pt = W2 + Ot - He, Ne = oe(u2 ? ye(ue, At) : ue, W2, u2 ? _(q2, Pt) : q2);
|
|
1889
|
-
m2[p2] = Ne, j2[p2] = Ne - W2;
|
|
1890
|
-
}
|
|
1891
|
-
if (s2) {
|
|
1892
|
-
var Ve, Lt = p2 === "x" ? k : D, $t = p2 === "x" ? S : M, U2 = m2[g2], he = g2 === "y" ? "height" : "width", Ie = U2 + d2[Lt], Fe = U2 - d2[$t], Ee = [k, D].indexOf(w2) !== -1, Xe = (Ve = $2 == null ? void 0 : $2[g2]) != null ? Ve : 0, Ye = Ee ? Ie : U2 - x2[he] - L2[he] - Xe + A2.altAxis, qe = Ee ? U2 + x2[he] + L2[he] - Xe - A2.altAxis : Fe, ze = u2 && Ee ? Zt(Ye, U2, qe) : oe(u2 ? Ye : Ie, U2, u2 ? qe : Fe);
|
|
1893
|
-
m2[g2] = ze, j2[g2] = ze - U2;
|
|
1894
|
-
}
|
|
1895
|
-
t.modifiersData[i] = j2;
|
|
2367
|
+
if (!popperOffsets2) {
|
|
2368
|
+
return;
|
|
1896
2369
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
2370
|
+
if (checkMainAxis) {
|
|
2371
|
+
var _offsetModifierState$;
|
|
2372
|
+
var mainSide = mainAxis === "y" ? top : left;
|
|
2373
|
+
var altSide = mainAxis === "y" ? bottom : right;
|
|
2374
|
+
var len = mainAxis === "y" ? "height" : "width";
|
|
2375
|
+
var offset2 = popperOffsets2[mainAxis];
|
|
2376
|
+
var min$1 = offset2 + overflow[mainSide];
|
|
2377
|
+
var max$1 = offset2 - overflow[altSide];
|
|
2378
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
2379
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
2380
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
|
2381
|
+
var arrowElement = state.elements.arrow;
|
|
2382
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
2383
|
+
width: 0,
|
|
2384
|
+
height: 0
|
|
2385
|
+
};
|
|
2386
|
+
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
|
|
2387
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
2388
|
+
var arrowPaddingMax = arrowPaddingObject[altSide];
|
|
2389
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
2390
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
2391
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
2392
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
2393
|
+
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
2394
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
2395
|
+
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
|
|
2396
|
+
var tetherMax = offset2 + maxOffset - offsetModifierValue;
|
|
2397
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
|
|
2398
|
+
popperOffsets2[mainAxis] = preventedOffset;
|
|
2399
|
+
data[mainAxis] = preventedOffset - offset2;
|
|
2400
|
+
}
|
|
2401
|
+
if (checkAltAxis) {
|
|
2402
|
+
var _offsetModifierState$2;
|
|
2403
|
+
var _mainSide = mainAxis === "x" ? top : left;
|
|
2404
|
+
var _altSide = mainAxis === "x" ? bottom : right;
|
|
2405
|
+
var _offset = popperOffsets2[altAxis];
|
|
2406
|
+
var _len = altAxis === "y" ? "height" : "width";
|
|
2407
|
+
var _min = _offset + overflow[_mainSide];
|
|
2408
|
+
var _max = _offset - overflow[_altSide];
|
|
2409
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
2410
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
2411
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
2412
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
2413
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
2414
|
+
popperOffsets2[altAxis] = _preventedOffset;
|
|
2415
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
2416
|
+
}
|
|
2417
|
+
state.modifiersData[name] = data;
|
|
2418
|
+
}
|
|
2419
|
+
const preventOverflow$1 = {
|
|
1899
2420
|
name: "preventOverflow",
|
|
1900
2421
|
enabled: true,
|
|
1901
2422
|
phase: "main",
|
|
1902
|
-
fn:
|
|
2423
|
+
fn: preventOverflow,
|
|
1903
2424
|
requiresIfExists: ["offset"]
|
|
1904
2425
|
};
|
|
1905
|
-
function
|
|
2426
|
+
function getHTMLElementScroll(element) {
|
|
1906
2427
|
return {
|
|
1907
|
-
scrollLeft:
|
|
1908
|
-
scrollTop:
|
|
2428
|
+
scrollLeft: element.scrollLeft,
|
|
2429
|
+
scrollTop: element.scrollTop
|
|
1909
2430
|
};
|
|
1910
2431
|
}
|
|
1911
|
-
function
|
|
1912
|
-
|
|
2432
|
+
function getNodeScroll(node) {
|
|
2433
|
+
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
2434
|
+
return getWindowScroll(node);
|
|
2435
|
+
} else {
|
|
2436
|
+
return getHTMLElementScroll(node);
|
|
2437
|
+
}
|
|
1913
2438
|
}
|
|
1914
|
-
function
|
|
1915
|
-
var
|
|
1916
|
-
|
|
2439
|
+
function isElementScaled(element) {
|
|
2440
|
+
var rect = element.getBoundingClientRect();
|
|
2441
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
2442
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
2443
|
+
return scaleX !== 1 || scaleY !== 1;
|
|
1917
2444
|
}
|
|
1918
|
-
function
|
|
1919
|
-
|
|
1920
|
-
|
|
2445
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
2446
|
+
if (isFixed === void 0) {
|
|
2447
|
+
isFixed = false;
|
|
2448
|
+
}
|
|
2449
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2450
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
2451
|
+
var documentElement = getDocumentElement(offsetParent);
|
|
2452
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
2453
|
+
var scroll = {
|
|
1921
2454
|
scrollLeft: 0,
|
|
1922
2455
|
scrollTop: 0
|
|
1923
|
-
}
|
|
2456
|
+
};
|
|
2457
|
+
var offsets = {
|
|
1924
2458
|
x: 0,
|
|
1925
2459
|
y: 0
|
|
1926
2460
|
};
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2461
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2462
|
+
if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
|
|
2463
|
+
isScrollParent(documentElement)) {
|
|
2464
|
+
scroll = getNodeScroll(offsetParent);
|
|
2465
|
+
}
|
|
2466
|
+
if (isHTMLElement(offsetParent)) {
|
|
2467
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
2468
|
+
offsets.x += offsetParent.clientLeft;
|
|
2469
|
+
offsets.y += offsetParent.clientTop;
|
|
2470
|
+
} else if (documentElement) {
|
|
2471
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
return {
|
|
2475
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
2476
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
2477
|
+
width: rect.width,
|
|
2478
|
+
height: rect.height
|
|
1933
2479
|
};
|
|
1934
2480
|
}
|
|
1935
|
-
function
|
|
1936
|
-
var
|
|
1937
|
-
|
|
1938
|
-
|
|
2481
|
+
function order(modifiers) {
|
|
2482
|
+
var map = /* @__PURE__ */ new Map();
|
|
2483
|
+
var visited = /* @__PURE__ */ new Set();
|
|
2484
|
+
var result = [];
|
|
2485
|
+
modifiers.forEach(function(modifier) {
|
|
2486
|
+
map.set(modifier.name, modifier);
|
|
1939
2487
|
});
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1942
|
-
var
|
|
1943
|
-
|
|
1944
|
-
if (!
|
|
1945
|
-
var
|
|
1946
|
-
|
|
2488
|
+
function sort(modifier) {
|
|
2489
|
+
visited.add(modifier.name);
|
|
2490
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
2491
|
+
requires.forEach(function(dep) {
|
|
2492
|
+
if (!visited.has(dep)) {
|
|
2493
|
+
var depModifier = map.get(dep);
|
|
2494
|
+
if (depModifier) {
|
|
2495
|
+
sort(depModifier);
|
|
2496
|
+
}
|
|
1947
2497
|
}
|
|
1948
|
-
})
|
|
2498
|
+
});
|
|
2499
|
+
result.push(modifier);
|
|
1949
2500
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2501
|
+
modifiers.forEach(function(modifier) {
|
|
2502
|
+
if (!visited.has(modifier.name)) {
|
|
2503
|
+
sort(modifier);
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2506
|
+
return result;
|
|
1953
2507
|
}
|
|
1954
|
-
function
|
|
1955
|
-
var
|
|
1956
|
-
return
|
|
1957
|
-
return
|
|
1958
|
-
return
|
|
2508
|
+
function orderModifiers(modifiers) {
|
|
2509
|
+
var orderedModifiers = order(modifiers);
|
|
2510
|
+
return modifierPhases.reduce(function(acc, phase) {
|
|
2511
|
+
return acc.concat(orderedModifiers.filter(function(modifier) {
|
|
2512
|
+
return modifier.phase === phase;
|
|
1959
2513
|
}));
|
|
1960
2514
|
}, []);
|
|
1961
2515
|
}
|
|
1962
|
-
function
|
|
1963
|
-
var
|
|
2516
|
+
function debounce(fn) {
|
|
2517
|
+
var pending;
|
|
1964
2518
|
return function() {
|
|
1965
|
-
|
|
1966
|
-
Promise
|
|
1967
|
-
|
|
2519
|
+
if (!pending) {
|
|
2520
|
+
pending = new Promise(function(resolve) {
|
|
2521
|
+
Promise.resolve().then(function() {
|
|
2522
|
+
pending = void 0;
|
|
2523
|
+
resolve(fn());
|
|
2524
|
+
});
|
|
1968
2525
|
});
|
|
1969
|
-
}
|
|
2526
|
+
}
|
|
2527
|
+
return pending;
|
|
1970
2528
|
};
|
|
1971
2529
|
}
|
|
1972
|
-
function
|
|
1973
|
-
var
|
|
1974
|
-
var
|
|
1975
|
-
|
|
1976
|
-
options: Object.assign({},
|
|
1977
|
-
data: Object.assign({},
|
|
1978
|
-
}) :
|
|
2530
|
+
function mergeByName(modifiers) {
|
|
2531
|
+
var merged = modifiers.reduce(function(merged2, current) {
|
|
2532
|
+
var existing = merged2[current.name];
|
|
2533
|
+
merged2[current.name] = existing ? Object.assign({}, existing, current, {
|
|
2534
|
+
options: Object.assign({}, existing.options, current.options),
|
|
2535
|
+
data: Object.assign({}, existing.data, current.data)
|
|
2536
|
+
}) : current;
|
|
2537
|
+
return merged2;
|
|
1979
2538
|
}, {});
|
|
1980
|
-
return Object.keys(
|
|
1981
|
-
return
|
|
2539
|
+
return Object.keys(merged).map(function(key) {
|
|
2540
|
+
return merged[key];
|
|
1982
2541
|
});
|
|
1983
2542
|
}
|
|
1984
|
-
var
|
|
2543
|
+
var DEFAULT_OPTIONS = {
|
|
1985
2544
|
placement: "bottom",
|
|
1986
2545
|
modifiers: [],
|
|
1987
2546
|
strategy: "absolute"
|
|
1988
2547
|
};
|
|
1989
|
-
function
|
|
1990
|
-
for (var
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2548
|
+
function areValidElements() {
|
|
2549
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2550
|
+
args[_key] = arguments[_key];
|
|
2551
|
+
}
|
|
2552
|
+
return !args.some(function(element) {
|
|
2553
|
+
return !(element && typeof element.getBoundingClientRect === "function");
|
|
1994
2554
|
});
|
|
1995
2555
|
}
|
|
1996
|
-
function
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2556
|
+
function popperGenerator(generatorOptions) {
|
|
2557
|
+
if (generatorOptions === void 0) {
|
|
2558
|
+
generatorOptions = {};
|
|
2559
|
+
}
|
|
2560
|
+
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
2561
|
+
return function createPopper2(reference2, popper2, options) {
|
|
2562
|
+
if (options === void 0) {
|
|
2563
|
+
options = defaultOptions;
|
|
2564
|
+
}
|
|
2565
|
+
var state = {
|
|
2002
2566
|
placement: "bottom",
|
|
2003
2567
|
orderedModifiers: [],
|
|
2004
|
-
options: Object.assign({},
|
|
2568
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
2005
2569
|
modifiersData: {},
|
|
2006
2570
|
elements: {
|
|
2007
|
-
reference:
|
|
2008
|
-
popper:
|
|
2571
|
+
reference: reference2,
|
|
2572
|
+
popper: popper2
|
|
2009
2573
|
},
|
|
2010
2574
|
attributes: {},
|
|
2011
2575
|
styles: {}
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2576
|
+
};
|
|
2577
|
+
var effectCleanupFns = [];
|
|
2578
|
+
var isDestroyed = false;
|
|
2579
|
+
var instance = {
|
|
2580
|
+
state,
|
|
2581
|
+
setOptions: function setOptions(setOptionsAction) {
|
|
2582
|
+
var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
|
2583
|
+
cleanupModifierEffects();
|
|
2584
|
+
state.options = Object.assign({}, defaultOptions, state.options, options2);
|
|
2585
|
+
state.scrollParents = {
|
|
2586
|
+
reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
|
2587
|
+
popper: listScrollParents(popper2)
|
|
2019
2588
|
};
|
|
2020
|
-
var
|
|
2021
|
-
|
|
2022
|
-
return
|
|
2023
|
-
})
|
|
2589
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
|
2590
|
+
state.orderedModifiers = orderedModifiers.filter(function(m) {
|
|
2591
|
+
return m.enabled;
|
|
2592
|
+
});
|
|
2593
|
+
runModifierEffects();
|
|
2594
|
+
return instance.update();
|
|
2024
2595
|
},
|
|
2025
2596
|
// Sync update – it will always be executed, even if not necessary. This
|
|
2026
2597
|
// is useful for low frequency updates where sync behavior simplifies the
|
|
2027
2598
|
// logic.
|
|
2028
2599
|
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
2029
2600
|
// prefer the async Popper#update method
|
|
2030
|
-
forceUpdate: function() {
|
|
2031
|
-
if (
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2601
|
+
forceUpdate: function forceUpdate() {
|
|
2602
|
+
if (isDestroyed) {
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
|
|
2606
|
+
if (!areValidElements(reference3, popper3)) {
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
state.rects = {
|
|
2610
|
+
reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
|
|
2611
|
+
popper: getLayoutRect(popper3)
|
|
2612
|
+
};
|
|
2613
|
+
state.reset = false;
|
|
2614
|
+
state.placement = state.options.placement;
|
|
2615
|
+
state.orderedModifiers.forEach(function(modifier) {
|
|
2616
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
2617
|
+
});
|
|
2618
|
+
for (var index2 = 0; index2 < state.orderedModifiers.length; index2++) {
|
|
2619
|
+
if (state.reset === true) {
|
|
2620
|
+
state.reset = false;
|
|
2621
|
+
index2 = -1;
|
|
2622
|
+
continue;
|
|
2623
|
+
}
|
|
2624
|
+
var _state$orderedModifie = state.orderedModifiers[index2], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
|
|
2625
|
+
if (typeof fn === "function") {
|
|
2626
|
+
state = fn({
|
|
2627
|
+
state,
|
|
2628
|
+
options: _options,
|
|
2629
|
+
name,
|
|
2630
|
+
instance
|
|
2631
|
+
}) || state;
|
|
2053
2632
|
}
|
|
2054
2633
|
}
|
|
2055
2634
|
},
|
|
2056
2635
|
// Async and optimistically optimized update – it will not be executed if
|
|
2057
2636
|
// not necessary (debounced to run at most once-per-tick)
|
|
2058
|
-
update:
|
|
2059
|
-
return new Promise(function(
|
|
2060
|
-
|
|
2637
|
+
update: debounce(function() {
|
|
2638
|
+
return new Promise(function(resolve) {
|
|
2639
|
+
instance.forceUpdate();
|
|
2640
|
+
resolve(state);
|
|
2061
2641
|
});
|
|
2062
2642
|
}),
|
|
2063
|
-
destroy: function() {
|
|
2064
|
-
|
|
2643
|
+
destroy: function destroy() {
|
|
2644
|
+
cleanupModifierEffects();
|
|
2645
|
+
isDestroyed = true;
|
|
2065
2646
|
}
|
|
2066
2647
|
};
|
|
2067
|
-
if (!
|
|
2068
|
-
return
|
|
2069
|
-
|
|
2070
|
-
|
|
2648
|
+
if (!areValidElements(reference2, popper2)) {
|
|
2649
|
+
return instance;
|
|
2650
|
+
}
|
|
2651
|
+
instance.setOptions(options).then(function(state2) {
|
|
2652
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
|
2653
|
+
options.onFirstUpdate(state2);
|
|
2654
|
+
}
|
|
2071
2655
|
});
|
|
2072
|
-
function
|
|
2073
|
-
|
|
2074
|
-
var
|
|
2075
|
-
if (typeof
|
|
2076
|
-
var
|
|
2077
|
-
state
|
|
2078
|
-
name
|
|
2079
|
-
instance
|
|
2080
|
-
options:
|
|
2081
|
-
})
|
|
2656
|
+
function runModifierEffects() {
|
|
2657
|
+
state.orderedModifiers.forEach(function(_ref) {
|
|
2658
|
+
var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
|
|
2659
|
+
if (typeof effect2 === "function") {
|
|
2660
|
+
var cleanupFn = effect2({
|
|
2661
|
+
state,
|
|
2662
|
+
name,
|
|
2663
|
+
instance,
|
|
2664
|
+
options: options2
|
|
2665
|
+
});
|
|
2666
|
+
var noopFn = function noopFn2() {
|
|
2082
2667
|
};
|
|
2083
|
-
|
|
2668
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
|
2084
2669
|
}
|
|
2085
2670
|
});
|
|
2086
2671
|
}
|
|
2087
|
-
function
|
|
2088
|
-
|
|
2089
|
-
return
|
|
2090
|
-
})
|
|
2672
|
+
function cleanupModifierEffects() {
|
|
2673
|
+
effectCleanupFns.forEach(function(fn) {
|
|
2674
|
+
return fn();
|
|
2675
|
+
});
|
|
2676
|
+
effectCleanupFns = [];
|
|
2091
2677
|
}
|
|
2092
|
-
return
|
|
2678
|
+
return instance;
|
|
2093
2679
|
};
|
|
2094
2680
|
}
|
|
2095
|
-
var
|
|
2096
|
-
|
|
2681
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
2682
|
+
var createPopper = /* @__PURE__ */ popperGenerator({
|
|
2683
|
+
defaultModifiers
|
|
2097
2684
|
});
|
|
2098
|
-
async function
|
|
2099
|
-
const
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2685
|
+
async function deregister(obj) {
|
|
2686
|
+
const index2 = this.collection.findIndex((entry) => {
|
|
2687
|
+
return entry.id === obj.id;
|
|
2688
|
+
});
|
|
2689
|
+
if (index2 >= 0) {
|
|
2690
|
+
const entry = this.collection[index2];
|
|
2691
|
+
if (entry.state === "opened") {
|
|
2692
|
+
entry.close();
|
|
2693
|
+
}
|
|
2694
|
+
entry.popper.destroy();
|
|
2695
|
+
deregisterEventListeners(entry);
|
|
2696
|
+
Object.getOwnPropertyNames(entry).forEach((prop) => {
|
|
2697
|
+
delete entry[prop];
|
|
2698
|
+
});
|
|
2699
|
+
this.collection.splice(index2, 1);
|
|
2105
2700
|
}
|
|
2106
2701
|
return this.collection;
|
|
2107
2702
|
}
|
|
2108
|
-
function
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2703
|
+
function deregisterEventListeners(entry) {
|
|
2704
|
+
if (entry.__eventListeners) {
|
|
2705
|
+
entry.__eventListeners.forEach((evObj) => {
|
|
2706
|
+
evObj.el.forEach((el) => {
|
|
2707
|
+
evObj.type.forEach((type) => {
|
|
2708
|
+
entry[el].removeEventListener(type, evObj.listener, false);
|
|
2709
|
+
});
|
|
2113
2710
|
});
|
|
2114
2711
|
});
|
|
2115
|
-
|
|
2712
|
+
delete entry.__eventListeners;
|
|
2713
|
+
}
|
|
2714
|
+
return entry;
|
|
2116
2715
|
}
|
|
2117
|
-
async function
|
|
2118
|
-
const
|
|
2119
|
-
|
|
2120
|
-
|
|
2716
|
+
async function open(query) {
|
|
2717
|
+
const popover = getPopover.call(this, query);
|
|
2718
|
+
popover.el.classList.add(this.settings.stateActive);
|
|
2719
|
+
if (popover.trigger.hasAttribute("aria-controls")) {
|
|
2720
|
+
popover.trigger.setAttribute("aria-expanded", "true");
|
|
2721
|
+
}
|
|
2722
|
+
popover.config = getConfig(popover.el, this.settings);
|
|
2723
|
+
popover.popper.setOptions({
|
|
2724
|
+
placement: popover.config["placement"],
|
|
2121
2725
|
modifiers: [
|
|
2122
2726
|
{ name: "eventListeners", enabled: true },
|
|
2123
|
-
...
|
|
2727
|
+
...getModifiers(popover.config)
|
|
2124
2728
|
]
|
|
2125
|
-
})
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2729
|
+
});
|
|
2730
|
+
popover.popper.update();
|
|
2731
|
+
popover.state = "opened";
|
|
2732
|
+
return popover;
|
|
2733
|
+
}
|
|
2734
|
+
async function register(el, trigger) {
|
|
2735
|
+
deregister.call(this, el);
|
|
2736
|
+
const root = this;
|
|
2737
|
+
const entry = {
|
|
2738
|
+
id: el.id,
|
|
2131
2739
|
state: "closed",
|
|
2132
|
-
el
|
|
2133
|
-
trigger
|
|
2134
|
-
popper:
|
|
2135
|
-
config:
|
|
2740
|
+
el,
|
|
2741
|
+
trigger,
|
|
2742
|
+
popper: createPopper(trigger, el),
|
|
2743
|
+
config: getConfig(el, this.settings),
|
|
2136
2744
|
open() {
|
|
2137
|
-
return
|
|
2745
|
+
return open.call(root, this);
|
|
2138
2746
|
},
|
|
2139
2747
|
close() {
|
|
2140
|
-
return
|
|
2748
|
+
return close.call(root, this);
|
|
2141
2749
|
},
|
|
2142
2750
|
deregister() {
|
|
2143
|
-
return
|
|
2751
|
+
return deregister.call(root, this);
|
|
2144
2752
|
}
|
|
2145
2753
|
};
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2754
|
+
if (entry.trigger.hasAttribute("aria-controls")) {
|
|
2755
|
+
entry.trigger.setAttribute("aria-expanded", "false");
|
|
2756
|
+
}
|
|
2757
|
+
registerEventListeners.call(this, entry);
|
|
2758
|
+
this.collection.push(entry);
|
|
2759
|
+
if (entry.el.classList.contains(this.settings.stateActive)) {
|
|
2760
|
+
await entry.open();
|
|
2761
|
+
handleDocumentClick.call(this, entry);
|
|
2762
|
+
}
|
|
2763
|
+
return entry;
|
|
2764
|
+
}
|
|
2765
|
+
function registerEventListeners(entry) {
|
|
2766
|
+
if (!entry.__eventListeners) {
|
|
2767
|
+
const eventType = entry.config["event"];
|
|
2768
|
+
if (eventType === "hover") {
|
|
2769
|
+
entry.__eventListeners = [{
|
|
2770
|
+
el: ["trigger"],
|
|
2771
|
+
type: ["mouseenter", "focus"],
|
|
2772
|
+
listener: open.bind(this, entry)
|
|
2773
|
+
}, {
|
|
2774
|
+
el: ["el", "trigger"],
|
|
2775
|
+
type: ["mouseleave", "focusout"],
|
|
2776
|
+
listener: closeCheck.bind(this, entry)
|
|
2777
|
+
}];
|
|
2778
|
+
entry.__eventListeners.forEach((evObj) => {
|
|
2779
|
+
evObj.el.forEach((el) => {
|
|
2780
|
+
evObj.type.forEach((type) => {
|
|
2781
|
+
entry[el].addEventListener(type, evObj.listener, false);
|
|
2782
|
+
});
|
|
2783
|
+
});
|
|
2161
2784
|
});
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2785
|
+
} else {
|
|
2786
|
+
entry.__eventListeners = [{
|
|
2787
|
+
el: ["trigger"],
|
|
2788
|
+
type: ["click"],
|
|
2789
|
+
listener: handleClick.bind(this, entry)
|
|
2790
|
+
}];
|
|
2791
|
+
entry.__eventListeners.forEach((evObj) => {
|
|
2792
|
+
evObj.el.forEach((el) => {
|
|
2793
|
+
evObj.type.forEach((type) => {
|
|
2794
|
+
entry[el].addEventListener(type, evObj.listener, false);
|
|
2795
|
+
});
|
|
2796
|
+
});
|
|
2171
2797
|
});
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
return entry;
|
|
2174
2801
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
constructor(r) {
|
|
2802
|
+
class Popover extends Collection {
|
|
2803
|
+
constructor(options) {
|
|
2178
2804
|
super();
|
|
2179
|
-
|
|
2180
|
-
this.defaults =
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2805
|
+
__privateAdd(this, _handleKeydown3);
|
|
2806
|
+
this.defaults = defaults;
|
|
2807
|
+
this.settings = { ...this.defaults, ...options };
|
|
2808
|
+
this.trigger = null;
|
|
2809
|
+
__privateSet(this, _handleKeydown3, handleKeydown.bind(this));
|
|
2810
|
+
if (this.settings.autoMount) this.mount();
|
|
2811
|
+
}
|
|
2812
|
+
async mount(options) {
|
|
2813
|
+
if (options) this.settings = { ...this.settings, ...options };
|
|
2814
|
+
const popovers = document.querySelectorAll(this.settings.selectorPopover);
|
|
2815
|
+
await this.registerCollection(popovers);
|
|
2816
|
+
if (this.settings.eventListeners) {
|
|
2817
|
+
this.mountEventListeners(false);
|
|
2818
|
+
}
|
|
2819
|
+
return this;
|
|
2186
2820
|
}
|
|
2187
2821
|
async unmount() {
|
|
2188
|
-
|
|
2822
|
+
this.trigger = null;
|
|
2823
|
+
await this.deregisterCollection();
|
|
2824
|
+
if (this.settings.eventListeners) {
|
|
2825
|
+
this.unmountEventListeners(false);
|
|
2826
|
+
}
|
|
2827
|
+
return this;
|
|
2189
2828
|
}
|
|
2190
|
-
mountEventListeners(
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2829
|
+
mountEventListeners(processCollection = true) {
|
|
2830
|
+
if (processCollection) {
|
|
2831
|
+
this.collection.forEach((popover) => {
|
|
2832
|
+
registerEventListeners.call(this, popover);
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
document.addEventListener("keydown", __privateGet(this, _handleKeydown3), false);
|
|
2194
2836
|
}
|
|
2195
|
-
unmountEventListeners(
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2837
|
+
unmountEventListeners(processCollection = true) {
|
|
2838
|
+
if (processCollection) {
|
|
2839
|
+
this.collection.forEach((popover) => {
|
|
2840
|
+
deregisterEventListeners(popover);
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
document.removeEventListener("keydown", __privateGet(this, _handleKeydown3), false);
|
|
2199
2844
|
}
|
|
2200
|
-
register(
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2845
|
+
register(query) {
|
|
2846
|
+
const els = getPopoverElements.call(this, query);
|
|
2847
|
+
if (els.error) return Promise.reject(els.error);
|
|
2848
|
+
return register.call(this, els.popover, els.trigger);
|
|
2203
2849
|
}
|
|
2204
|
-
deregister(
|
|
2205
|
-
let
|
|
2206
|
-
return
|
|
2850
|
+
deregister(query) {
|
|
2851
|
+
let obj = this.get(query.id || query);
|
|
2852
|
+
return obj ? deregister.call(this, obj) : Promise.reject(new Error(`Failed to deregister; popover does not exist in collection with ID of: "${query.id || query}".`));
|
|
2207
2853
|
}
|
|
2208
|
-
open(
|
|
2209
|
-
return
|
|
2854
|
+
open(id) {
|
|
2855
|
+
return open.call(this, id);
|
|
2210
2856
|
}
|
|
2211
|
-
close(
|
|
2212
|
-
return
|
|
2857
|
+
close(id) {
|
|
2858
|
+
return close.call(this, id);
|
|
2213
2859
|
}
|
|
2214
2860
|
}
|
|
2215
|
-
|
|
2216
|
-
exports2.Drawer =
|
|
2217
|
-
exports2.Modal =
|
|
2218
|
-
exports2.Popover =
|
|
2861
|
+
_handleKeydown3 = new WeakMap();
|
|
2862
|
+
exports2.Drawer = Drawer;
|
|
2863
|
+
exports2.Modal = Modal;
|
|
2864
|
+
exports2.Popover = Popover;
|
|
2219
2865
|
exports2.core = index;
|
|
2220
2866
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
2221
2867
|
});
|