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