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