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