@graupl/graupl 1.0.0-beta.55 → 1.0.0-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/base/table.css.map +1 -1
- package/dist/css/base.css.map +1 -1
- package/dist/css/graupl.css +1 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/utilities/overflow.css +2 -0
- package/dist/css/utilities/overflow.css.map +1 -0
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/graupl.js +1649 -776
- package/dist/js/graupl.js.map +1 -1
- package/package.json +6 -2
- package/scss/utilities/overflow.scss +3 -0
package/dist/js/graupl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
function
|
|
3
|
-
const
|
|
2
|
+
function L(t, e, { shouldThrow: s = !0 } = {}) {
|
|
3
|
+
const i = {
|
|
4
4
|
status: !0,
|
|
5
5
|
errors: []
|
|
6
6
|
};
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
throw new TypeError(`${o} must be an instance of ${t.name}. "${r}" given.`);
|
|
13
13
|
}
|
|
14
14
|
} catch (r) {
|
|
15
|
-
|
|
15
|
+
i.status = !1, i.errors.push(r);
|
|
16
16
|
}
|
|
17
17
|
} catch (o) {
|
|
18
|
-
|
|
18
|
+
i.status = !1, i.errors.push(o);
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
20
|
+
if (s && !i.status) throw i.errors[0];
|
|
21
|
+
return i;
|
|
22
22
|
}
|
|
23
|
-
function n(t, e, { shouldThrow:
|
|
24
|
-
const
|
|
23
|
+
function n(t, e, { shouldThrow: s = !0 } = {}) {
|
|
24
|
+
const i = {
|
|
25
25
|
status: !0,
|
|
26
26
|
errors: []
|
|
27
27
|
};
|
|
@@ -31,163 +31,186 @@
|
|
|
31
31
|
const r = typeof e[o];
|
|
32
32
|
if (r !== t) throw new TypeError(`${o} must be a ${t}. "${r}" given.`);
|
|
33
33
|
} catch (r) {
|
|
34
|
-
|
|
34
|
+
i.status = !1, i.errors.push(r);
|
|
35
35
|
}
|
|
36
36
|
} catch (o) {
|
|
37
|
-
|
|
37
|
+
i.status = !1, i.errors.push(o);
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
39
|
+
if (s && !i.status) throw i.errors[0];
|
|
40
|
+
return i;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
42
|
+
function U(t, { shouldThrow: e = !0 } = {}) {
|
|
43
|
+
const s = {
|
|
44
44
|
status: !0,
|
|
45
45
|
errors: []
|
|
46
46
|
};
|
|
47
47
|
try {
|
|
48
48
|
if (typeof t != "object") throw new TypeError(`Values given to isQuerySelector() must be inside of an object. "${typeof t}" given.`);
|
|
49
|
-
for (const
|
|
49
|
+
for (const i in t) try {
|
|
50
50
|
try {
|
|
51
|
-
if (t[
|
|
52
|
-
document.querySelector(t[
|
|
51
|
+
if (t[i] === null) throw new Error();
|
|
52
|
+
document.querySelector(t[i]);
|
|
53
53
|
} catch {
|
|
54
|
-
throw new TypeError(`${
|
|
54
|
+
throw new TypeError(`${i} must be a valid query selector. "${t[i]}" given.`);
|
|
55
55
|
}
|
|
56
56
|
} catch (o) {
|
|
57
|
-
|
|
57
|
+
s.status = !1, s.errors.push(o);
|
|
58
58
|
}
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
59
|
+
} catch (i) {
|
|
60
|
+
s.status = !1, s.errors.push(i);
|
|
61
61
|
}
|
|
62
|
-
if (e && !
|
|
63
|
-
return
|
|
62
|
+
if (e && !s.status) throw s.errors[0];
|
|
63
|
+
return s;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const
|
|
65
|
+
function u(t, { shouldThrow: e = !0 } = {}) {
|
|
66
|
+
const s = {
|
|
67
67
|
status: !0,
|
|
68
68
|
errors: []
|
|
69
69
|
};
|
|
70
70
|
try {
|
|
71
71
|
if (typeof t != "object" || Array.isArray(t)) throw new TypeError(`Values given to isValidClassList() must be inside of an object. "${typeof t}" given.`);
|
|
72
|
-
for (const
|
|
73
|
-
const o = typeof t[
|
|
74
|
-
if (o !== "string") if (Array.isArray(t[
|
|
75
|
-
if (typeof r != "string") throw new TypeError(`${
|
|
72
|
+
for (const i in t) try {
|
|
73
|
+
const o = typeof t[i];
|
|
74
|
+
if (o !== "string") if (Array.isArray(t[i])) t[i].forEach((r) => {
|
|
75
|
+
if (typeof r != "string") throw new TypeError(`${i} must be a string or an array of strings. An array containing non-strings given.`);
|
|
76
76
|
});
|
|
77
|
-
else throw new TypeError(`${
|
|
77
|
+
else throw new TypeError(`${i} must be a string or an array of strings. "${o}" given.`);
|
|
78
78
|
else {
|
|
79
79
|
const r = {};
|
|
80
|
-
r[
|
|
80
|
+
r[i] = t[i], U(r);
|
|
81
81
|
}
|
|
82
82
|
} catch (o) {
|
|
83
|
-
|
|
83
|
+
s.status = !1, s.errors.push(o);
|
|
84
84
|
}
|
|
85
|
-
} catch (
|
|
86
|
-
|
|
85
|
+
} catch (i) {
|
|
86
|
+
s.status = !1, s.errors.push(i);
|
|
87
87
|
}
|
|
88
|
-
if (e && !
|
|
89
|
-
return
|
|
88
|
+
if (e && !s.status) throw s.errors[0];
|
|
89
|
+
return s;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
91
|
+
function et(t, { shouldThrow: e = !0 } = {}) {
|
|
92
|
+
const s = {
|
|
93
93
|
status: !0,
|
|
94
94
|
errors: []
|
|
95
95
|
};
|
|
96
96
|
try {
|
|
97
97
|
if (typeof t != "object") throw new TypeError(`Values given to isValidState() must be inside of an object. "${typeof t}" given.`);
|
|
98
|
-
const
|
|
98
|
+
const i = [
|
|
99
99
|
"none",
|
|
100
100
|
"self",
|
|
101
101
|
"child"
|
|
102
102
|
];
|
|
103
103
|
for (const o in t) try {
|
|
104
|
-
if (!
|
|
104
|
+
if (!i.includes(t[o])) throw new TypeError(`${o} must be one of the following values: ${i.join(", ")}. "${t[o]}" given.`);
|
|
105
105
|
} catch (r) {
|
|
106
|
-
|
|
106
|
+
s.status = !1, s.errors.push(r);
|
|
107
107
|
}
|
|
108
|
-
} catch (
|
|
109
|
-
|
|
108
|
+
} catch (i) {
|
|
109
|
+
s.status = !1, s.errors.push(i);
|
|
110
110
|
}
|
|
111
|
-
if (e && !
|
|
112
|
-
return
|
|
111
|
+
if (e && !s.status) throw s.errors[0];
|
|
112
|
+
return s;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
114
|
+
function st(t, { shouldThrow: e = !0 } = {}) {
|
|
115
|
+
const s = {
|
|
116
116
|
status: !0,
|
|
117
117
|
errors: []
|
|
118
118
|
};
|
|
119
119
|
try {
|
|
120
120
|
if (typeof t != "object") throw new TypeError(`Values given to isValidEvent() must be inside of an object. "${typeof t}" given.`);
|
|
121
|
-
const
|
|
121
|
+
const i = [
|
|
122
122
|
"none",
|
|
123
123
|
"mouse",
|
|
124
124
|
"keyboard",
|
|
125
125
|
"character"
|
|
126
126
|
];
|
|
127
127
|
for (const o in t) try {
|
|
128
|
-
if (!
|
|
128
|
+
if (!i.includes(t[o])) throw new TypeError(`${o} must be one of the following values: ${i.join(", ")}. "${t[o]}" given.`);
|
|
129
129
|
} catch (r) {
|
|
130
|
-
|
|
130
|
+
s.status = !1, s.errors.push(r);
|
|
131
131
|
}
|
|
132
|
-
} catch (
|
|
133
|
-
|
|
132
|
+
} catch (i) {
|
|
133
|
+
s.status = !1, s.errors.push(i);
|
|
134
134
|
}
|
|
135
|
-
if (e && !
|
|
136
|
-
return
|
|
135
|
+
if (e && !s.status) throw s.errors[0];
|
|
136
|
+
return s;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Z(t, { shouldThrow: e = !0 } = {}) {
|
|
139
139
|
const s = {
|
|
140
140
|
status: !0,
|
|
141
141
|
errors: []
|
|
142
142
|
};
|
|
143
143
|
try {
|
|
144
|
-
if (
|
|
144
|
+
if (typeof t != "object") throw new TypeError(`Values given to isValidHoverType() must be inside of an object. "${typeof t}" given.`);
|
|
145
|
+
const i = [
|
|
146
|
+
"off",
|
|
147
|
+
"on",
|
|
148
|
+
"dynamic"
|
|
149
|
+
];
|
|
150
|
+
for (const o in t) try {
|
|
151
|
+
if (!i.includes(t[o])) throw new TypeError(`${o} must be one of the following values: ${i.join(", ")}. "${t[o]}" given.`);
|
|
152
|
+
} catch (r) {
|
|
153
|
+
s.status = !1, s.errors.push(r);
|
|
154
|
+
}
|
|
155
|
+
} catch (i) {
|
|
156
|
+
s.status = !1, s.errors.push(i);
|
|
157
|
+
}
|
|
158
|
+
if (e && !s.status) throw s.errors[0];
|
|
159
|
+
return s;
|
|
160
|
+
}
|
|
161
|
+
function z(t, e, { shouldThrow: s = !0 } = {}) {
|
|
162
|
+
const i = {
|
|
163
|
+
status: !0,
|
|
164
|
+
errors: []
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
if (n("string", { tagName: t }, { shouldThrow: !0 }).status && L(HTMLElement, e, { shouldThrow: !0 }).status) {
|
|
145
168
|
const o = t.toLowerCase();
|
|
146
169
|
for (const r in e) try {
|
|
147
170
|
if (e[r].tagName.toLowerCase() !== o) throw new TypeError(`${r} must be a <${o}> element. <${e[r].tagName.toLowerCase()}> given.`);
|
|
148
|
-
} catch (
|
|
149
|
-
|
|
171
|
+
} catch (c) {
|
|
172
|
+
i.status = !1, i.errors.push(c);
|
|
150
173
|
}
|
|
151
174
|
}
|
|
152
175
|
} catch (o) {
|
|
153
|
-
|
|
176
|
+
i.status = !1, i.errors.push(o);
|
|
154
177
|
}
|
|
155
|
-
if (
|
|
156
|
-
return
|
|
178
|
+
if (s && !i.status) throw i.errors[0];
|
|
179
|
+
return i;
|
|
157
180
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
181
|
+
function it(t, e, { shouldThrow: s = !0 } = {}) {
|
|
182
|
+
const i = {
|
|
160
183
|
status: !0,
|
|
161
184
|
errors: []
|
|
162
185
|
};
|
|
163
186
|
try {
|
|
164
187
|
if (!Object.prototype.hasOwnProperty.call(e.events, t)) throw new TypeError(`Event type "${t}" is not valid for ${e.constructor.name}. Valid event types are: "${Object.keys(e.events).join("\", ")}".`);
|
|
165
188
|
} catch (o) {
|
|
166
|
-
|
|
189
|
+
i.status = !1, i.errors.push(o);
|
|
167
190
|
}
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
191
|
+
if (s && !i.status) throw i.errors[0];
|
|
192
|
+
return i;
|
|
170
193
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
194
|
+
function ot(t, { shouldThrow: e = !0 } = {}) {
|
|
195
|
+
const s = {
|
|
173
196
|
status: !0,
|
|
174
197
|
errors: []
|
|
175
198
|
};
|
|
176
199
|
try {
|
|
177
200
|
if (!Object.prototype.hasOwnProperty.call(t._dom, t._rootDOMElement)) throw new Error(`The root DOM element "${t._rootDOMElement}" does not exist in the ${t.constructor.name}'s _dom property. It must be one of the following: "${Object.keys(t._dom).join("\", \"")}".`);
|
|
178
|
-
} catch (
|
|
179
|
-
|
|
201
|
+
} catch (i) {
|
|
202
|
+
s.status = !1, s.errors.push(i);
|
|
180
203
|
}
|
|
181
|
-
if (e && !
|
|
182
|
-
return
|
|
204
|
+
if (e && !s.status) throw s.errors[0];
|
|
205
|
+
return s;
|
|
183
206
|
}
|
|
184
|
-
function
|
|
207
|
+
function a(t, e) {
|
|
185
208
|
t === "" || t.length === 0 || (typeof t == "string" ? e.classList.add(t) : e.classList.add(...t));
|
|
186
209
|
}
|
|
187
|
-
function
|
|
210
|
+
function l(t, e) {
|
|
188
211
|
t === "" || t.length === 0 || (typeof t == "string" ? e.classList.remove(t) : e.classList.remove(...t));
|
|
189
212
|
}
|
|
190
|
-
var
|
|
213
|
+
var x = class {
|
|
191
214
|
_equals = Object.is;
|
|
192
215
|
_current;
|
|
193
216
|
_committed;
|
|
@@ -215,17 +238,17 @@
|
|
|
215
238
|
update(t) {
|
|
216
239
|
return this._current = t(this._current), this;
|
|
217
240
|
}
|
|
218
|
-
},
|
|
241
|
+
}, K = class tt {
|
|
219
242
|
_scope;
|
|
220
243
|
_type = "_default";
|
|
221
244
|
_storage = {};
|
|
222
245
|
_crush = !1;
|
|
223
|
-
constructor({ scope: e, type:
|
|
224
|
-
this._scope = e, this._type =
|
|
246
|
+
constructor({ scope: e, type: s = null, crush: i = !1, initialize: o = !0 } = {}) {
|
|
247
|
+
this._scope = e, this._type = s || "_default", this._crush = i, o && this.initialize();
|
|
225
248
|
}
|
|
226
249
|
initialize() {
|
|
227
250
|
try {
|
|
228
|
-
!this._crush && typeof window[this.scope] < "u" && (
|
|
251
|
+
!this._crush && typeof window[this.scope] < "u" && (L(tt, { storage: window[this.scope] }, { shouldThrow: !1 }).status || typeof window[this.scope].storage < "u" && typeof window[this.scope].scope < "u" && typeof window[this.scope].type < "u") && (this._storage = window[this.scope].storage);
|
|
229
252
|
} catch {} finally {
|
|
230
253
|
window[this.scope] = this;
|
|
231
254
|
}
|
|
@@ -242,40 +265,40 @@
|
|
|
242
265
|
get storage() {
|
|
243
266
|
return this._storage;
|
|
244
267
|
}
|
|
245
|
-
get({ type: e = this.type, key:
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
268
|
+
get({ type: e = this.type, key: s = null } = {}) {
|
|
269
|
+
const i = n("string", { type: e });
|
|
270
|
+
if (!i.status) throw new Error(`StorageManager (${this.scope}): ${i.message}`);
|
|
248
271
|
if (!this.storage[e]) throw new Error(`StorageManager (${this.scope}): Type "${e}" is not initialized.`);
|
|
249
|
-
if (
|
|
250
|
-
const o = n("string", { key:
|
|
272
|
+
if (s !== null) {
|
|
273
|
+
const o = n("string", { key: s });
|
|
251
274
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
252
|
-
return this.storage[e][
|
|
275
|
+
return this.storage[e][s];
|
|
253
276
|
}
|
|
254
277
|
return this.storage[e];
|
|
255
278
|
}
|
|
256
|
-
set({ type: e = this.type, key:
|
|
257
|
-
const o = n("string", { type: e }), r = n("object", { data:
|
|
279
|
+
set({ type: e = this.type, key: s = null, data: i = {} } = {}) {
|
|
280
|
+
const o = n("string", { type: e }), r = n("object", { data: i });
|
|
258
281
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
259
282
|
if (!r.status) throw new Error(`StorageManager (${this.scope}): ${r.message}`);
|
|
260
|
-
if (
|
|
261
|
-
const
|
|
262
|
-
if (!
|
|
263
|
-
this._storage[e] || (this._storage[e] = {}), this._storage[e][
|
|
264
|
-
} else this._storage[e] =
|
|
265
|
-
}
|
|
266
|
-
clear({ type: e = this.type, key:
|
|
267
|
-
const
|
|
268
|
-
if (!
|
|
269
|
-
if (
|
|
270
|
-
const o = n("string", { key:
|
|
283
|
+
if (s !== null) {
|
|
284
|
+
const c = n("string", { key: s });
|
|
285
|
+
if (!c.status) throw new Error(`StorageManager (${this.scope}): ${c.message}`);
|
|
286
|
+
this._storage[e] || (this._storage[e] = {}), this._storage[e][s] = i;
|
|
287
|
+
} else this._storage[e] = i;
|
|
288
|
+
}
|
|
289
|
+
clear({ type: e = this.type, key: s = null } = {}) {
|
|
290
|
+
const i = n("string", { type: e });
|
|
291
|
+
if (!i.status) throw new Error(`StorageManager (${this.scope}): ${i.message}`);
|
|
292
|
+
if (s !== null) {
|
|
293
|
+
const o = n("string", { key: s });
|
|
271
294
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
272
|
-
delete this.storage[e][
|
|
295
|
+
delete this.storage[e][s];
|
|
273
296
|
} else delete this.storage[e];
|
|
274
297
|
}
|
|
275
298
|
dispose() {
|
|
276
299
|
delete this._storage, delete this;
|
|
277
300
|
}
|
|
278
|
-
},
|
|
301
|
+
}, w = class {
|
|
279
302
|
_dom = {};
|
|
280
303
|
_rootDOMElement = "";
|
|
281
304
|
_protectedDOMElements = [];
|
|
@@ -312,15 +335,15 @@
|
|
|
312
335
|
_valid = !0;
|
|
313
336
|
_initialized = !1;
|
|
314
337
|
_errors = [];
|
|
315
|
-
constructor({ prefix: t = "graupl-", key: e = null, initializeClass:
|
|
316
|
-
this._classes.initialize =
|
|
338
|
+
constructor({ prefix: t = "graupl-", key: e = null, initializeClass: s = "initializing" } = {}) {
|
|
339
|
+
this._classes.initialize = s || "", this._prefix = t || "", this._key = e || "";
|
|
317
340
|
}
|
|
318
341
|
initialize() {
|
|
319
342
|
try {
|
|
320
343
|
if (!this._validate()) throw new Error(`Graupl ${this.name}: Cannot initialize component. The following errors have been found:
|
|
321
344
|
- ${this.errors.map((t) => t.message).join(`
|
|
322
345
|
- `)}`);
|
|
323
|
-
|
|
346
|
+
a(this.initializeClass, this.rootDOMElement), this._dispatchEvent("preinitialize", this.rootDOMElement), this._generateKey(), this._setDOMElements(), this._setIds(), this._setAriaAttributes(), this._setCustomProps(), this._createChildElements(), this._handleMediaMatch(), this._handleFocus(), this._handleHover(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), this._dispatchEvent("initialize", this.rootDOMElement), this._store(), l(this.initializeClass, this.rootDOMElement), this._initialized = !0, this._dispatchEvent("postinitialize", this.rootDOMElement);
|
|
324
347
|
} catch (t) {
|
|
325
348
|
console.error(t);
|
|
326
349
|
}
|
|
@@ -365,19 +388,19 @@
|
|
|
365
388
|
return this._classes.initialize;
|
|
366
389
|
}
|
|
367
390
|
set initializeClass(t) {
|
|
368
|
-
|
|
391
|
+
u({ initializeClass: t }), this._classes.initialize !== t && (this._classes.initialize = t);
|
|
369
392
|
}
|
|
370
393
|
get focusState() {
|
|
371
394
|
return this._focusState;
|
|
372
395
|
}
|
|
373
396
|
set focusState(t) {
|
|
374
|
-
|
|
397
|
+
et({ focusState: t }), this._focusState !== t && (this._focusState = t);
|
|
375
398
|
}
|
|
376
399
|
get currentEvent() {
|
|
377
400
|
return this._currentEvent;
|
|
378
401
|
}
|
|
379
402
|
set currentEvent(t) {
|
|
380
|
-
|
|
403
|
+
st({ currentEvent: t }), this._currentEvent !== t && (this._currentEvent = t);
|
|
381
404
|
}
|
|
382
405
|
get shouldFocus() {
|
|
383
406
|
let t = !1;
|
|
@@ -418,37 +441,37 @@
|
|
|
418
441
|
}
|
|
419
442
|
_validate() {
|
|
420
443
|
this._dispatchEvent("prevalidate", this.rootDOMElement);
|
|
421
|
-
const t =
|
|
444
|
+
const t = ot(this, { shouldThrow: !1 });
|
|
422
445
|
if (t.status || (this._errors = [...this._errors, ...t.errors], this._valid = !1), Object.keys(this._dom).length > 0) {
|
|
423
|
-
const
|
|
424
|
-
for (const r of Object.keys(this._dom)) Array.isArray(this._dom[r]) ? this._dom[r].forEach((
|
|
425
|
-
|
|
426
|
-
}) : this._dom[r] !== null && (
|
|
427
|
-
const o =
|
|
446
|
+
const i = {};
|
|
447
|
+
for (const r of Object.keys(this._dom)) Array.isArray(this._dom[r]) ? this._dom[r].forEach((c, m) => {
|
|
448
|
+
i[`${r}Element[${m}]`] = c;
|
|
449
|
+
}) : this._dom[r] !== null && (i[`${r}Element`] = this._dom[r]);
|
|
450
|
+
const o = L(HTMLElement, i, { shouldThrow: !1 });
|
|
428
451
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
429
452
|
}
|
|
430
453
|
if (Object.keys(this._selectors).length > 0) {
|
|
431
|
-
const
|
|
432
|
-
for (const r of Object.keys(this._selectors))
|
|
433
|
-
const o =
|
|
454
|
+
const i = {};
|
|
455
|
+
for (const r of Object.keys(this._selectors)) i[`${r}Selector`] = this._selectors[r];
|
|
456
|
+
const o = U(i, { shouldThrow: !1 });
|
|
434
457
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
435
458
|
}
|
|
436
459
|
if (Object.keys(this._classes).length > 0) {
|
|
437
|
-
const
|
|
438
|
-
for (const r of Object.keys(this._classes)) this._classes[r] !== "" && (
|
|
439
|
-
const o =
|
|
460
|
+
const i = {};
|
|
461
|
+
for (const r of Object.keys(this._classes)) this._classes[r] !== "" && (i[`${r}Class`] = this._classes[r]);
|
|
462
|
+
const o = u(i, { shouldThrow: !1 });
|
|
440
463
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
441
464
|
}
|
|
442
465
|
if (Object.keys(this._durations).length > 0) {
|
|
443
|
-
const
|
|
444
|
-
for (const r of Object.keys(this._durations))
|
|
445
|
-
const o = n("number",
|
|
466
|
+
const i = {};
|
|
467
|
+
for (const r of Object.keys(this._durations)) i[`${r}Duration`] = this._durations[r];
|
|
468
|
+
const o = n("number", i, { shouldThrow: !1 });
|
|
446
469
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
447
470
|
}
|
|
448
471
|
if (Object.keys(this.delays).length > 0) {
|
|
449
|
-
const
|
|
450
|
-
for (const r of Object.keys(this.delays))
|
|
451
|
-
const o = n("number",
|
|
472
|
+
const i = {};
|
|
473
|
+
for (const r of Object.keys(this.delays)) i[`${r}Delay`] = this.delays[r];
|
|
474
|
+
const o = n("number", i, { shouldThrow: !1 });
|
|
452
475
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
453
476
|
}
|
|
454
477
|
const e = {
|
|
@@ -458,11 +481,11 @@
|
|
|
458
481
|
mediaQuery: this._mediaQueryString,
|
|
459
482
|
breakpoint: this._breakpoint
|
|
460
483
|
};
|
|
461
|
-
this._protectedDOMElements.forEach((
|
|
462
|
-
e[`_protectedDOMElementType[${
|
|
484
|
+
this._protectedDOMElements.forEach((i) => {
|
|
485
|
+
e[`_protectedDOMElementType[${i}]`] = i;
|
|
463
486
|
});
|
|
464
|
-
const
|
|
465
|
-
return
|
|
487
|
+
const s = n("string", e, { shouldThrow: !1 });
|
|
488
|
+
return s.status || (this._errors = [...this._errors, ...s.errors], this._valid = !1), this._dispatchEvent("validate", this.rootDOMElement), this._dispatchEvent("postvalidate", this.rootDOMElement), this._valid;
|
|
466
489
|
}
|
|
467
490
|
_generateKey(t = !1) {
|
|
468
491
|
(this._key === "" || t) && (this._key = Math.random().toString(36).replace(/[^a-z]+/g, "").substring(0, 10));
|
|
@@ -470,12 +493,12 @@
|
|
|
470
493
|
_setIds() {}
|
|
471
494
|
_setAriaAttributes() {}
|
|
472
495
|
_setCustomProps() {}
|
|
473
|
-
_setDOMElementType(t, { context: e, overwrite:
|
|
496
|
+
_setDOMElementType(t, { context: e, overwrite: s = !0, strict: i = !1 } = {}) {
|
|
474
497
|
if (typeof this.selectors[t] != "string") throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);
|
|
475
498
|
if (this._rootDOMElement === t || this._protectedDOMElements.includes(t)) throw new Error(`Graupl ${this.name}: "${t}" element cannot be set through _setDOMElementType because it is a protected element.`);
|
|
476
|
-
|
|
477
|
-
const o = Array.from(e.querySelectorAll(this.selectors[t])).filter((r) =>
|
|
478
|
-
Array.isArray(this._dom[t]) ?
|
|
499
|
+
L(HTMLElement, { context: e });
|
|
500
|
+
const o = Array.from(e.querySelectorAll(this.selectors[t])).filter((r) => i ? r.parentElement === e : !0);
|
|
501
|
+
Array.isArray(this._dom[t]) ? s ? this._dom[t] = o : this._dom[t] = [...this._dom[t], ...o] : this._dom[t] = o[0] || null;
|
|
479
502
|
}
|
|
480
503
|
_resetDOMElementType(t) {
|
|
481
504
|
if (typeof this.selectors[t] != "string") throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);
|
|
@@ -493,20 +516,20 @@
|
|
|
493
516
|
_handleKeydown() {}
|
|
494
517
|
_handleKeyup() {}
|
|
495
518
|
_store() {
|
|
496
|
-
this._shouldStore && (
|
|
519
|
+
this._shouldStore && (L(K, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status || new K({ scope: "GrauplStorage" }), window.GrauplStorage.set({
|
|
497
520
|
key: this.id !== "" ? this.id : this.key,
|
|
498
521
|
type: this._storageKey,
|
|
499
522
|
data: this
|
|
500
523
|
}));
|
|
501
524
|
}
|
|
502
525
|
_unstore() {
|
|
503
|
-
this._shouldStore &&
|
|
526
|
+
this._shouldStore && L(K, { storage: window.GrauplStorage }, { shouldThrow: !1 }).status && window.GrauplStorage.clear({
|
|
504
527
|
key: this.id !== "" ? this.id : this.key,
|
|
505
528
|
type: this._storageKey
|
|
506
529
|
});
|
|
507
530
|
}
|
|
508
|
-
_setInterval(t, e,
|
|
509
|
-
this._clearInterval(
|
|
531
|
+
_setInterval(t, e, s = "_default") {
|
|
532
|
+
this._clearInterval(s), this._intervals[s] = setInterval(t, e);
|
|
510
533
|
}
|
|
511
534
|
_clearInterval(t = "_default") {
|
|
512
535
|
clearInterval(this._intervals[t]);
|
|
@@ -514,8 +537,8 @@
|
|
|
514
537
|
_clearIntervals() {
|
|
515
538
|
for (const t of Object.keys(this._intervals)) this._clearInterval(t);
|
|
516
539
|
}
|
|
517
|
-
_setTimeout(t, e,
|
|
518
|
-
this._clearTimeout(
|
|
540
|
+
_setTimeout(t, e, s = "_default") {
|
|
541
|
+
this._clearTimeout(s), this._timeouts[s] = setTimeout(t, e);
|
|
519
542
|
}
|
|
520
543
|
_clearTimeout(t = "_default") {
|
|
521
544
|
clearTimeout(this._timeouts[t]);
|
|
@@ -523,38 +546,38 @@
|
|
|
523
546
|
_clearTimeouts() {
|
|
524
547
|
for (const t of Object.keys(this._timeouts)) this._clearTimeout(t);
|
|
525
548
|
}
|
|
526
|
-
_registerEvent(t, { bubbles: e = !0, detail:
|
|
527
|
-
n("string", { name: t }), n("boolean", { bubbles: e }), n("object", { detail:
|
|
528
|
-
const
|
|
529
|
-
this._events[t] = new CustomEvent(
|
|
549
|
+
_registerEvent(t, { bubbles: e = !0, detail: s = {} } = {}) {
|
|
550
|
+
n("string", { name: t }), n("boolean", { bubbles: e }), n("object", { detail: s });
|
|
551
|
+
const i = `graupl${this.name}${t.charAt(0).toUpperCase()}${t.slice(1)}`;
|
|
552
|
+
this._events[t] = new CustomEvent(i, {
|
|
530
553
|
bubbles: e,
|
|
531
554
|
detail: {
|
|
532
555
|
component: this,
|
|
533
|
-
...
|
|
556
|
+
...s
|
|
534
557
|
}
|
|
535
558
|
});
|
|
536
559
|
}
|
|
537
560
|
_dispatchEvent(t, e) {
|
|
538
|
-
|
|
561
|
+
it(t, this), L(HTMLElement, { element: e }), e.dispatchEvent(this.events[t]);
|
|
539
562
|
}
|
|
540
|
-
_addEventListener(t, e,
|
|
541
|
-
e.addEventListener(t,
|
|
563
|
+
_addEventListener(t, e, s, i = {}) {
|
|
564
|
+
e.addEventListener(t, s, i), this._listeners.push({
|
|
542
565
|
type: t,
|
|
543
566
|
element: e,
|
|
544
|
-
listener:
|
|
545
|
-
options:
|
|
567
|
+
listener: s,
|
|
568
|
+
options: i
|
|
546
569
|
});
|
|
547
570
|
}
|
|
548
|
-
_removeEventListener(t, e,
|
|
549
|
-
e.removeEventListener(t,
|
|
571
|
+
_removeEventListener(t, e, s, i = {}) {
|
|
572
|
+
e.removeEventListener(t, s, i);
|
|
550
573
|
let o = -1;
|
|
551
|
-
this._listeners.forEach((r,
|
|
552
|
-
r.type === t && r.element === e && r.listener ===
|
|
574
|
+
this._listeners.forEach((r, c) => {
|
|
575
|
+
r.type === t && r.element === e && r.listener === s && JSON.stringify(r.options) === JSON.stringify(i) && (o = c);
|
|
553
576
|
}), o !== -1 && this._listeners.splice(o, 1);
|
|
554
577
|
}
|
|
555
578
|
_removeEventListeners({ type: t = null, element: e = null } = {}) {
|
|
556
|
-
[...this._listeners].forEach((
|
|
557
|
-
t !== null &&
|
|
579
|
+
[...this._listeners].forEach((s) => {
|
|
580
|
+
t !== null && s.type !== t || e !== null && s.element !== e || this._removeEventListener(s.type, s.element, s.listener, s.options);
|
|
558
581
|
});
|
|
559
582
|
}
|
|
560
583
|
focus() {
|
|
@@ -566,23 +589,23 @@
|
|
|
566
589
|
dispose() {
|
|
567
590
|
this._clearIntervals(), this._clearTimeouts(), this._removeEventListeners(), this._unstore(), delete this;
|
|
568
591
|
}
|
|
569
|
-
},
|
|
592
|
+
}, rt = class extends w {
|
|
570
593
|
_rootDOMElement = "item";
|
|
571
594
|
_protectedDOMElements = [
|
|
572
595
|
"toggle",
|
|
573
596
|
"header",
|
|
574
597
|
"content"
|
|
575
598
|
];
|
|
576
|
-
_open = new
|
|
577
|
-
_locked = new
|
|
599
|
+
_open = new x(!1);
|
|
600
|
+
_locked = new x(!1);
|
|
578
601
|
_name = "AccordionItem";
|
|
579
602
|
_storageKey = "accordionItems";
|
|
580
603
|
_shouldStore = !1;
|
|
581
|
-
constructor({ accordionItemElement: t, accordionItemToggleElement: e, accordionItemHeaderElement:
|
|
604
|
+
constructor({ accordionItemElement: t, accordionItemToggleElement: e, accordionItemHeaderElement: s, accordionItemContentElement: i, parentAccordion: o = null }) {
|
|
582
605
|
super({
|
|
583
606
|
prefix: o.prefix,
|
|
584
607
|
key: o.key
|
|
585
|
-
}), this._dom.item = t, this._dom.toggle = e, this._dom.header =
|
|
608
|
+
}), this._dom.item = t, this._dom.toggle = e, this._dom.header = s, this._dom.content = i, this._elements.parent = o, this._registerEvent("expand", { detail: { item: this } }), this._registerEvent("collapse", { detail: { item: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
586
609
|
this.dom.toggle.getAttribute("aria-expanded") === "true" ? this.show({
|
|
587
610
|
force: !0,
|
|
588
611
|
emit: !1,
|
|
@@ -605,42 +628,42 @@
|
|
|
605
628
|
this.dom.item.id = this.dom.item.id || `accordion-item-${t}-${e}`, this.dom.toggle.id = this.dom.toggle.id || `accordion-item-toggle-${t}-${e}`, this.dom.header.id = this.dom.header.id || `accordion-item-header-${t}-${e}`, this.dom.content.id = this.dom.content.id || `accordion-item-content-${t}-${e}`;
|
|
606
629
|
}
|
|
607
630
|
_setAriaAttributes() {
|
|
608
|
-
|
|
631
|
+
z("button", { toggle: this.dom.toggle }, { shouldThrow: !1 }).status || this.dom.toggle.setAttribute("role", "button"), this.dom.toggle.getAttribute("aria-expanded") !== "true" && this.dom.toggle.setAttribute("aria-expanded", "false"), this.dom.toggle.setAttribute("aria-controls", this.dom.content.id), z("section", { content: this.dom.content }, { shouldThrow: !1 }).status || this.dom.content.setAttribute("role", "region"), this.dom.content.setAttribute("aria-labelledby", this.dom.toggle.id);
|
|
609
632
|
}
|
|
610
633
|
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
611
|
-
const { closeClass:
|
|
612
|
-
this.dom.toggle.setAttribute("aria-expanded", "true"), e && o !== "" ? (
|
|
613
|
-
|
|
614
|
-
|
|
634
|
+
const { closeClass: s, openClass: i, transitionClass: o, openDuration: r } = this.elements.parent;
|
|
635
|
+
this.dom.toggle.setAttribute("aria-expanded", "true"), e && o !== "" ? (a(o, this.dom.item), requestAnimationFrame(() => {
|
|
636
|
+
l(s, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
637
|
+
a(i, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height + this.dom.content.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
615
638
|
this._setTimeout(() => {
|
|
616
|
-
|
|
639
|
+
l(o, this.dom.item), this.dom.item.style.height = "";
|
|
617
640
|
}, r);
|
|
618
641
|
});
|
|
619
642
|
});
|
|
620
|
-
})) : (
|
|
643
|
+
})) : (a(i, this.dom.item), l(s, this.dom.item)), this.dom.content.removeAttribute("inert"), t && this._dispatchEvent("expand", this.dom.item);
|
|
621
644
|
}
|
|
622
645
|
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
623
|
-
const { closeClass:
|
|
624
|
-
this.dom.toggle.setAttribute("aria-expanded", "false"), e && o !== "" ? (
|
|
625
|
-
|
|
626
|
-
|
|
646
|
+
const { closeClass: s, openClass: i, transitionClass: o, closeDuration: r } = this.elements.parent;
|
|
647
|
+
this.dom.toggle.setAttribute("aria-expanded", "false"), e && o !== "" ? (a(o, this.dom.item), this.dom.item.style.height = `${this.dom.item.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
648
|
+
l(i, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
649
|
+
a(s, this.dom.item), requestAnimationFrame(() => {
|
|
627
650
|
this._setTimeout(() => {
|
|
628
|
-
|
|
651
|
+
l(o, this.dom.item), this.dom.item.style.height = "";
|
|
629
652
|
}, r);
|
|
630
653
|
});
|
|
631
654
|
});
|
|
632
|
-
})) : (
|
|
655
|
+
})) : (a(s, this.dom.item), l(i, this.dom.item)), this.dom.content.setAttribute("inert", "true"), t && this._dispatchEvent("collapse", this.dom.item);
|
|
633
656
|
}
|
|
634
|
-
show({ force: t = !1, preserveState: e = !1, emit:
|
|
657
|
+
show({ force: t = !1, preserveState: e = !1, emit: s = !0, transition: i = !0 } = {}) {
|
|
635
658
|
this.isOpen && !t || (this._reveal({
|
|
636
|
-
emit:
|
|
637
|
-
transition:
|
|
659
|
+
emit: s,
|
|
660
|
+
transition: i
|
|
638
661
|
}), this._open.value = !0, e || this._open.commit(), this.elements.parent.allowExpandMultiple || (this.unlockSiblings(), this.closeSiblings()), this.elements.parent.allowCollapseAll || (this.elements.parent.openAccordionItems.length <= 1 ? this.lock() : this.unlockSiblings()));
|
|
639
662
|
}
|
|
640
|
-
hide({ force: t = !1, preserveState: e = !1, emit:
|
|
663
|
+
hide({ force: t = !1, preserveState: e = !1, emit: s = !0, transition: i = !0 } = {}) {
|
|
641
664
|
!this.isOpen && !t || !this.elements.parent.allowCollapseAll && this.elements.parent.openAccordionItems.length <= 1 || (this._conceal({
|
|
642
|
-
emit:
|
|
643
|
-
transition:
|
|
665
|
+
emit: s,
|
|
666
|
+
transition: i
|
|
644
667
|
}), this._open.value = !1, e || this._open.commit(), !this.elements.parent.allowCollapseAll && this.elements.parent.openAccordionItems.length === 1 && this.elements.parent.openAccordionItems[0].lock());
|
|
645
668
|
}
|
|
646
669
|
toggle() {
|
|
@@ -671,7 +694,7 @@
|
|
|
671
694
|
};
|
|
672
695
|
function d(t) {
|
|
673
696
|
try {
|
|
674
|
-
const e = t.key || t.keyCode,
|
|
697
|
+
const e = t.key || t.keyCode, s = {
|
|
675
698
|
Enter: e === "Enter" || e === 13,
|
|
676
699
|
Space: e === " " || e === "Spacebar" || e === 32,
|
|
677
700
|
Escape: e === "Escape" || e === "Esc" || e === 27,
|
|
@@ -685,15 +708,15 @@
|
|
|
685
708
|
Tab: e === "Tab" || e === 9,
|
|
686
709
|
Asterisk: e === "*" || e === 56
|
|
687
710
|
};
|
|
688
|
-
return Object.keys(
|
|
711
|
+
return Object.keys(s).find((i) => s[i] === !0) || "";
|
|
689
712
|
} catch {
|
|
690
713
|
return "";
|
|
691
714
|
}
|
|
692
715
|
}
|
|
693
|
-
function
|
|
716
|
+
function h(t) {
|
|
694
717
|
t.preventDefault(), t.stopPropagation();
|
|
695
718
|
}
|
|
696
|
-
var
|
|
719
|
+
var nt = class extends w {
|
|
697
720
|
_rootDOMElement = "accordion";
|
|
698
721
|
_optionalKeySupport = !0;
|
|
699
722
|
_expandMultiple = !0;
|
|
@@ -701,44 +724,44 @@
|
|
|
701
724
|
_currentChild = 0;
|
|
702
725
|
_storageKey = "accordions";
|
|
703
726
|
_name = "Accordion";
|
|
704
|
-
constructor({ accordionElement: t, accordionItemsSelector: e = ".accordion-item", accordionItemTogglesSelector:
|
|
727
|
+
constructor({ accordionElement: t, accordionItemsSelector: e = ".accordion-item", accordionItemTogglesSelector: s = ".accordion-item-toggle", accordionItemHeadersSelector: i = ".accordion-item-header", accordionItemContentsSelector: o = ".accordion-item-content", accordionControlContainerSelector: r = ".accordion-control-container", accordionControlsSelector: c = ".accordion-control", expandControllerSelector: m = ".expand-all", collapseControllerSelector: _ = ".collapse-all", openClass: k = "show", closeClass: C = "hide", transitionClass: y = "transitioning", transitionDuration: E = 300, openDuration: f = -1, closeDuration: g = -1, optionalKeySupport: p = !1, allowExpandMultiple: O = !0, allowCollapseAll: D = !0, automaticActivation: T = !1, prefix: v = "graupl-", key: A = null, initializeClass: B = "initializing", initialize: $ = !1 }) {
|
|
705
728
|
super({
|
|
706
|
-
prefix:
|
|
707
|
-
key:
|
|
708
|
-
initializeClass:
|
|
709
|
-
}), this._dom.accordion = t, this._dom.accordionItems = [], this._dom.accordionItemToggles = [], this._dom.accordionItemHeaders = [], this._dom.accordionItemContents = [], this._dom.accordionControlContainer = null, this._dom.accordionControls = [], this._dom.expandController = [], this._dom.collapseController = [], this._selectors.accordionItems = e, this._selectors.accordionItemToggles =
|
|
710
|
-
this.dom.expandController.length > 0 && !this.allowExpandMultiple && this.dom.expandController.forEach((
|
|
711
|
-
|
|
712
|
-
}), this.dom.collapseController.length > 0 && !this.allowCollapseAll && this.dom.collapseController.forEach((
|
|
713
|
-
|
|
729
|
+
prefix: v,
|
|
730
|
+
key: A,
|
|
731
|
+
initializeClass: B
|
|
732
|
+
}), this._dom.accordion = t, this._dom.accordionItems = [], this._dom.accordionItemToggles = [], this._dom.accordionItemHeaders = [], this._dom.accordionItemContents = [], this._dom.accordionControlContainer = null, this._dom.accordionControls = [], this._dom.expandController = [], this._dom.collapseController = [], this._selectors.accordionItems = e, this._selectors.accordionItemToggles = s, this._selectors.accordionItemHeaders = i, this._selectors.accordionItemContents = o, this._selectors.accordionControlContainer = r, this._selectors.accordionControls = c, this._selectors.expandController = m, this._selectors.collapseController = _, this._elements.accordionItems = [], this._classes.open = k || "", this._classes.close = C || "", this._classes.transition = y || "", this._durations.transition = E, this._durations.open = f, this._durations.close = g, this._automatic = T, this._optionalKeySupport = p, this._expandMultiple = O, this._collapseAll = D, this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
733
|
+
this.dom.expandController.length > 0 && !this.allowExpandMultiple && this.dom.expandController.forEach((I) => {
|
|
734
|
+
I.setAttribute("disabled", "disabled");
|
|
735
|
+
}), this.dom.collapseController.length > 0 && !this.allowCollapseAll && this.dom.collapseController.forEach((I) => {
|
|
736
|
+
I.setAttribute("disabled", "disabled");
|
|
714
737
|
});
|
|
715
738
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
716
|
-
const
|
|
739
|
+
const I = n("boolean", {
|
|
717
740
|
automaticActivation: this._automatic,
|
|
718
741
|
optionalKeySupport: this._optionalKeySupport,
|
|
719
742
|
allowExpandMultiple: this._expandMultiple,
|
|
720
743
|
allowCollapseAll: this._collapseAll
|
|
721
744
|
});
|
|
722
|
-
|
|
723
|
-
}),
|
|
745
|
+
I.status || (this._errors = [...this._errors, ...I.errors], this._valid = !1);
|
|
746
|
+
}), $ && this.initialize();
|
|
724
747
|
}
|
|
725
748
|
get openClass() {
|
|
726
749
|
return this._classes.open;
|
|
727
750
|
}
|
|
728
751
|
set openClass(t) {
|
|
729
|
-
|
|
752
|
+
u({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
730
753
|
}
|
|
731
754
|
get closeClass() {
|
|
732
755
|
return this._classes.close;
|
|
733
756
|
}
|
|
734
757
|
set closeClass(t) {
|
|
735
|
-
|
|
758
|
+
u({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
736
759
|
}
|
|
737
760
|
get transitionClass() {
|
|
738
761
|
return this._classes.transition;
|
|
739
762
|
}
|
|
740
763
|
set transitionClass(t) {
|
|
741
|
-
|
|
764
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
742
765
|
}
|
|
743
766
|
get transitionDuration() {
|
|
744
767
|
return this._durations.transition;
|
|
@@ -821,14 +844,14 @@
|
|
|
821
844
|
}
|
|
822
845
|
_createChildElements() {
|
|
823
846
|
this.dom.accordionItems.forEach((t, e) => {
|
|
824
|
-
const
|
|
847
|
+
const s = new rt({
|
|
825
848
|
accordionItemElement: t,
|
|
826
849
|
accordionItemToggleElement: this.dom.accordionItemToggles[e],
|
|
827
850
|
accordionItemHeaderElement: this.dom.accordionItemHeaders[e],
|
|
828
851
|
accordionItemContentElement: this.dom.accordionItemContents[e],
|
|
829
852
|
parentAccordion: this
|
|
830
853
|
});
|
|
831
|
-
|
|
854
|
+
s.initialize(), this.elements.accordionItems.push(s);
|
|
832
855
|
});
|
|
833
856
|
}
|
|
834
857
|
_handleFocus() {
|
|
@@ -856,43 +879,43 @@
|
|
|
856
879
|
_handleKeydown() {
|
|
857
880
|
this.dom.accordionItemToggles.forEach((t) => {
|
|
858
881
|
this._addEventListener("keydown", t, (e) => {
|
|
859
|
-
const
|
|
860
|
-
["Space", "Enter"].includes(
|
|
882
|
+
const s = d(e);
|
|
883
|
+
["Space", "Enter"].includes(s) ? (h(e), this.currentEvent = "keyboard") : this.optionalKeySupport && [
|
|
861
884
|
"ArrowDown",
|
|
862
885
|
"ArrowUp",
|
|
863
886
|
"Home",
|
|
864
887
|
"End"
|
|
865
|
-
].includes(
|
|
888
|
+
].includes(s) && (h(e), this.currentEvent = "keyboard");
|
|
866
889
|
});
|
|
867
890
|
}), this.dom.accordionControls.forEach((t) => {
|
|
868
891
|
this._addEventListener("keydown", t, (e) => {
|
|
869
|
-
const
|
|
870
|
-
["Space", "Enter"].includes(
|
|
892
|
+
const s = d(e);
|
|
893
|
+
["Space", "Enter"].includes(s) && (h(e), this.currentEvent = "keyboard");
|
|
871
894
|
});
|
|
872
895
|
});
|
|
873
896
|
}
|
|
874
897
|
_handleKeyup() {
|
|
875
898
|
this.dom.accordionItemToggles.forEach((t) => {
|
|
876
899
|
this._addEventListener("keyup", t, (e) => {
|
|
877
|
-
const
|
|
878
|
-
switch (
|
|
900
|
+
const s = d(e);
|
|
901
|
+
switch (s) {
|
|
879
902
|
case "Space":
|
|
880
903
|
case "Enter":
|
|
881
|
-
|
|
904
|
+
h(e), this.currentEvent = "keyboard", this.currentAccordionItem.toggle();
|
|
882
905
|
break;
|
|
883
906
|
}
|
|
884
|
-
if (this.optionalKeySupport) switch (
|
|
907
|
+
if (this.optionalKeySupport) switch (s) {
|
|
885
908
|
case "Home":
|
|
886
|
-
|
|
909
|
+
h(e), this.focusFirstChild();
|
|
887
910
|
break;
|
|
888
911
|
case "End":
|
|
889
|
-
|
|
912
|
+
h(e), this.focusLastChild();
|
|
890
913
|
break;
|
|
891
914
|
case "ArrowDown":
|
|
892
|
-
|
|
915
|
+
h(e), this.focusNextChild();
|
|
893
916
|
break;
|
|
894
917
|
case "ArrowUp":
|
|
895
|
-
|
|
918
|
+
h(e), this.focusPreviousChild();
|
|
896
919
|
break;
|
|
897
920
|
}
|
|
898
921
|
});
|
|
@@ -900,14 +923,14 @@
|
|
|
900
923
|
this._addEventListener("keyup", t, (e) => {
|
|
901
924
|
switch (d(e)) {
|
|
902
925
|
case "Space":
|
|
903
|
-
case "Enter":
|
|
926
|
+
case "Enter": h(e), this.currentEvent = "keyboard", this.allowExpandMultiple && this.openChildren();
|
|
904
927
|
}
|
|
905
928
|
});
|
|
906
929
|
}), this.dom.collapseController.forEach((t) => {
|
|
907
930
|
this._addEventListener("keyup", t, (e) => {
|
|
908
931
|
switch (d(e)) {
|
|
909
932
|
case "Space":
|
|
910
|
-
case "Enter":
|
|
933
|
+
case "Enter": h(e), this.currentEvent = "keyboard", this.allowCollapseAll && this.closeChildren();
|
|
911
934
|
}
|
|
912
935
|
});
|
|
913
936
|
});
|
|
@@ -940,94 +963,94 @@
|
|
|
940
963
|
this.elements.accordionItems.forEach((t) => t.hide());
|
|
941
964
|
}
|
|
942
965
|
};
|
|
943
|
-
const
|
|
944
|
-
function
|
|
945
|
-
return t[`${e}Attribute`](
|
|
966
|
+
const W = /[\11\12\14\15\40]+/, j = "data-once", at = document;
|
|
967
|
+
function Q(t, e, s) {
|
|
968
|
+
return t[`${e}Attribute`](j, s);
|
|
946
969
|
}
|
|
947
|
-
function
|
|
970
|
+
function F(t) {
|
|
948
971
|
if (typeof t != "string") throw new TypeError("once ID must be a string");
|
|
949
|
-
if (t === "" ||
|
|
950
|
-
return `[${
|
|
972
|
+
if (t === "" || W.test(t)) throw new RangeError("once ID must not be empty or contain spaces");
|
|
973
|
+
return `[${j}~="${t}"]`;
|
|
951
974
|
}
|
|
952
|
-
function
|
|
975
|
+
function lt(t) {
|
|
953
976
|
if (!(t instanceof Element)) throw new TypeError("The element must be an instance of Element");
|
|
954
977
|
return !0;
|
|
955
978
|
}
|
|
956
|
-
function
|
|
957
|
-
let
|
|
958
|
-
if (t === null)
|
|
959
|
-
else if (t) if (e instanceof Document || e instanceof DocumentFragment || e instanceof Element) typeof t == "string" ?
|
|
979
|
+
function P(t, e = at) {
|
|
980
|
+
let s = t;
|
|
981
|
+
if (t === null) s = [];
|
|
982
|
+
else if (t) if (e instanceof Document || e instanceof DocumentFragment || e instanceof Element) typeof t == "string" ? s = e.querySelectorAll(t) : t instanceof Element && (s = [t]);
|
|
960
983
|
else throw new TypeError("Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".");
|
|
961
984
|
else throw new TypeError("Selector must not be empty");
|
|
962
|
-
return Array.prototype.slice.call(
|
|
985
|
+
return Array.prototype.slice.call(s);
|
|
963
986
|
}
|
|
964
|
-
function
|
|
965
|
-
return e.filter((
|
|
966
|
-
const o =
|
|
967
|
-
return o &&
|
|
987
|
+
function V(t, e, s) {
|
|
988
|
+
return e.filter((i) => {
|
|
989
|
+
const o = lt(i) && i.matches(t);
|
|
990
|
+
return o && s && s(i), o;
|
|
968
991
|
});
|
|
969
992
|
}
|
|
970
|
-
function
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}), e &&
|
|
975
|
-
const o =
|
|
976
|
-
|
|
993
|
+
function X(t, { add: e, remove: s }) {
|
|
994
|
+
const i = [];
|
|
995
|
+
Q(t, "has") && Q(t, "get").trim().split(W).forEach((r) => {
|
|
996
|
+
i.indexOf(r) < 0 && r !== s && i.push(r);
|
|
997
|
+
}), e && i.push(e);
|
|
998
|
+
const o = i.join(" ");
|
|
999
|
+
Q(t, o === "" ? "remove" : "set", o);
|
|
977
1000
|
}
|
|
978
|
-
function
|
|
979
|
-
return
|
|
1001
|
+
function b(t, e, s) {
|
|
1002
|
+
return V(`:not(${F(t)})`, P(e, s), (i) => X(i, { add: t }));
|
|
980
1003
|
}
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
const o =
|
|
985
|
-
new
|
|
986
|
-
accordionElement:
|
|
1004
|
+
b.remove = (t, e, s) => V(F(t), P(e, s), (i) => X(i, { remove: t })), b.filter = (t, e, s) => V(F(t), P(e, s)), b.find = (t, e) => P(t ? F(t) : `[${j}]`, e);
|
|
1005
|
+
const ht = (t = {}, e = document, s = ".accordion") => {
|
|
1006
|
+
b("graupl-accordion-generator", s, e).forEach((i) => {
|
|
1007
|
+
const o = i.dataset.grauplAccordionOptions ? JSON.parse(i.dataset.grauplAccordionOptions.replace(/'/g, "\"")) || {} : {};
|
|
1008
|
+
new nt({
|
|
1009
|
+
accordionElement: i,
|
|
987
1010
|
initialize: !0,
|
|
988
1011
|
...t,
|
|
989
1012
|
...o
|
|
990
1013
|
});
|
|
991
1014
|
});
|
|
992
1015
|
};
|
|
993
|
-
var
|
|
1016
|
+
var ct = class extends w {
|
|
994
1017
|
_rootDOMElement = "alert";
|
|
995
1018
|
_protectedDOMElements = ["controller"];
|
|
996
|
-
_hidden = new
|
|
1019
|
+
_hidden = new x(!1);
|
|
997
1020
|
_storageKey = "alerts";
|
|
998
1021
|
_name = "Alert";
|
|
999
|
-
constructor({ alertElement: t, controllerElement: e = null, showClass:
|
|
1022
|
+
constructor({ alertElement: t, controllerElement: e = null, showClass: s = "show", hideClass: i = "hide", transitionClass: o = "transitioning", transitionDuration: r = 150, showDuration: c = -1, hideDuration: m = -1, isHidden: _ = !1, prefix: k = "graupl-", key: C = null, initializeClass: y = "initializing", initialize: E = !1 } = {}) {
|
|
1000
1023
|
super({
|
|
1001
|
-
prefix:
|
|
1002
|
-
key:
|
|
1003
|
-
initializeClass:
|
|
1004
|
-
}), this._dom.alert = t, this._dom.controller = e, this._classes.show =
|
|
1024
|
+
prefix: k,
|
|
1025
|
+
key: C,
|
|
1026
|
+
initializeClass: y
|
|
1027
|
+
}), this._dom.alert = t, this._dom.controller = e, this._classes.show = s || "", this._classes.hide = i || "", this._classes.transition = o || "", this._durations.transition = r, this._durations.show = c, this._durations.hide = m, this._hidden.value = _, this._hidden.commit(), this._registerEvent("show", { detail: { alert: this } }), this._registerEvent("hide", { detail: { alert: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1005
1028
|
this.isHidden && this._conceal({
|
|
1006
1029
|
emit: !1,
|
|
1007
1030
|
transition: !1
|
|
1008
1031
|
});
|
|
1009
1032
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
}),
|
|
1033
|
+
const f = n("boolean", { isHidden: this._hidden.value }, { shouldThrow: !1 });
|
|
1034
|
+
f.status || (this._errors = [...this._errors, ...f.errors], this._valid = !1);
|
|
1035
|
+
}), E && this.initialize();
|
|
1013
1036
|
}
|
|
1014
1037
|
get showClass() {
|
|
1015
1038
|
return this._classes.show;
|
|
1016
1039
|
}
|
|
1017
1040
|
set showClass(t) {
|
|
1018
|
-
|
|
1041
|
+
u({ showClass: t }), this._classes.show !== t && (this._classes.show = t);
|
|
1019
1042
|
}
|
|
1020
1043
|
get hideClass() {
|
|
1021
1044
|
return this._classes.hide;
|
|
1022
1045
|
}
|
|
1023
1046
|
set hideClass(t) {
|
|
1024
|
-
|
|
1047
|
+
u({ hideClass: t }), this._classes.hide !== t && (this._classes.hide = t);
|
|
1025
1048
|
}
|
|
1026
1049
|
get transitionClass() {
|
|
1027
1050
|
return this._classes.transition;
|
|
1028
1051
|
}
|
|
1029
1052
|
set transitionClass(t) {
|
|
1030
|
-
|
|
1053
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1031
1054
|
}
|
|
1032
1055
|
get transitionDuration() {
|
|
1033
1056
|
return this._durations.transition;
|
|
@@ -1054,22 +1077,22 @@
|
|
|
1054
1077
|
this.dom.alert.id = this.dom.alert.id || `alert-${this.key}`, this.dom.controller.id = this.dom.controller.id || `alert-controller-${this.key}`, this._id = this.dom.alert.id;
|
|
1055
1078
|
}
|
|
1056
1079
|
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
1057
|
-
e && this.transitionClass !== "" ? (
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
this._setTimeout(() =>
|
|
1080
|
+
e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1081
|
+
l(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1082
|
+
a(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1083
|
+
this._setTimeout(() => l(this.transitionClass, this.dom.alert), this.showDuration);
|
|
1061
1084
|
});
|
|
1062
1085
|
});
|
|
1063
|
-
})) : (
|
|
1086
|
+
})) : (a(this.showClass, this.dom.alert), l(this.hideClass, this.dom.alert)), this.dom.alert.removeAttribute("inert"), t && this._dispatchEvent("show", this.dom.alert);
|
|
1064
1087
|
}
|
|
1065
1088
|
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
1066
|
-
e && this.transitionClass !== "" ? (
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this._setTimeout(() =>
|
|
1089
|
+
e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1090
|
+
l(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1091
|
+
a(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1092
|
+
this._setTimeout(() => l(this.transitionClass, this.dom.alert), this.hideDuration);
|
|
1070
1093
|
});
|
|
1071
1094
|
});
|
|
1072
|
-
})) : (
|
|
1095
|
+
})) : (a(this.hideClass, this.dom.alert), l(this.showClass, this.dom.alert)), this.dom.alert.setAttribute("inert", "true"), t && this._dispatchEvent("hide", this.dom.alert);
|
|
1073
1096
|
}
|
|
1074
1097
|
_setCustomProps() {
|
|
1075
1098
|
this.dom.alert.style.setProperty(`--${this.prefix}alert-transition-duration`, `${this.transitionDuration}ms`), this.dom.alert.style.setProperty(`--${this.prefix}alert-show-transition-duration`, `${this.showDuration}ms`), this.dom.alert.style.setProperty(`--${this.prefix}alert-hide-transition-duration`, `${this.hideDuration}ms`);
|
|
@@ -1080,7 +1103,7 @@
|
|
|
1080
1103
|
_handleKeydown() {
|
|
1081
1104
|
this.dom.controller !== null && this._addEventListener("keydown", this.dom.controller, (t) => {
|
|
1082
1105
|
const e = d(t);
|
|
1083
|
-
(e === "Space" || e === "Enter") &&
|
|
1106
|
+
(e === "Space" || e === "Enter") && h(t);
|
|
1084
1107
|
});
|
|
1085
1108
|
}
|
|
1086
1109
|
_handleKeyup() {
|
|
@@ -1096,711 +1119,1561 @@
|
|
|
1096
1119
|
this.isHidden && !t || (this.focusState = "none", this._conceal(), this._hidden.value = !0, e || this._hidden.commit());
|
|
1097
1120
|
}
|
|
1098
1121
|
};
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
const o =
|
|
1102
|
-
new
|
|
1103
|
-
alertElement:
|
|
1104
|
-
controllerElement:
|
|
1122
|
+
const dt = (t = {}, e = document, s = ".alert") => {
|
|
1123
|
+
b("graupl-alert-generator", s, e).forEach((i) => {
|
|
1124
|
+
const o = i.dataset.grauplAlertOptions ? JSON.parse(i.dataset.grauplAlertOptions.replace(/'/g, "\"")) || {} : {};
|
|
1125
|
+
new ct({
|
|
1126
|
+
alertElement: i,
|
|
1127
|
+
controllerElement: i.querySelector(".alert-dismisser") || null,
|
|
1105
1128
|
initialize: !0,
|
|
1106
1129
|
...t,
|
|
1107
1130
|
...o
|
|
1108
1131
|
});
|
|
1109
1132
|
});
|
|
1110
1133
|
};
|
|
1111
|
-
var
|
|
1112
|
-
_rootDOMElement = "
|
|
1134
|
+
var ut = class extends w {
|
|
1135
|
+
_rootDOMElement = "item";
|
|
1136
|
+
_protectedDOMElements = ["link"];
|
|
1137
|
+
_storageKey = "breadcrumbItems";
|
|
1113
1138
|
_shouldStore = !1;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
_busy = !1;
|
|
1117
|
-
constructor({ carouselItemElement: t, tabElement: e = null, clone: i = null, parent: s, prefix: o = "graupl-", key: r = null, initializeClass: l = "initializing", initialize: u = !1 }) {
|
|
1139
|
+
_toggle = !1;
|
|
1140
|
+
constructor({ breadcrumbItemElement: t, breadcrumbLinkElement: e = null, parentBreadcrumb: s, isToggle: i = !1, prefix: o = "graupl-", key: r = null, initializeClass: c = "initializing" }) {
|
|
1118
1141
|
super({
|
|
1119
1142
|
prefix: o,
|
|
1120
1143
|
key: r,
|
|
1121
|
-
initializeClass:
|
|
1122
|
-
}), this._dom.
|
|
1144
|
+
initializeClass: c
|
|
1145
|
+
}), this._dom.item = t, this._dom.link = e || null, this._elements.parent = s, this._toggle = i;
|
|
1123
1146
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
...e
|
|
1131
|
-
}), this.dom.tab && requestAnimationFrame(() => {
|
|
1132
|
-
h(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !0);
|
|
1133
|
-
});
|
|
1147
|
+
get isToggle() {
|
|
1148
|
+
return this._toggle;
|
|
1149
|
+
}
|
|
1150
|
+
focus() {
|
|
1151
|
+
this.elements.parent.shouldFocus && this.dom.link && requestAnimationFrame(() => {
|
|
1152
|
+
this.dom.link.focus();
|
|
1134
1153
|
});
|
|
1135
1154
|
}
|
|
1136
|
-
|
|
1137
|
-
requestAnimationFrame(() => {
|
|
1138
|
-
|
|
1139
|
-
this.dom.tab && (c(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !1));
|
|
1140
|
-
});
|
|
1155
|
+
blur() {
|
|
1156
|
+
this.elements.parent.shouldFocus && this.dom.link && requestAnimationFrame(() => {
|
|
1157
|
+
this.dom.link.blur();
|
|
1141
1158
|
});
|
|
1142
1159
|
}
|
|
1143
|
-
},
|
|
1144
|
-
_rootDOMElement = "
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1160
|
+
}, mt = class extends w {
|
|
1161
|
+
_rootDOMElement = "breadcrumb";
|
|
1162
|
+
_currentChild = 0;
|
|
1163
|
+
_open = new x(!1);
|
|
1164
|
+
_locked = new x(!1);
|
|
1165
|
+
_openInsideBreakpoint = !1;
|
|
1166
|
+
_openOutsideBreakpoint = !0;
|
|
1167
|
+
_closeInsideBreakpoint = !0;
|
|
1168
|
+
_closeOutsideBreakpoint = !1;
|
|
1169
|
+
_lockInsideBreakpoint = !1;
|
|
1170
|
+
_lockOutsideBreakpoint = !0;
|
|
1171
|
+
_unlockInsideBreakpoint = !1;
|
|
1172
|
+
_unlockOutsideBreakpoint = !1;
|
|
1173
|
+
_openOnFocus = !1;
|
|
1174
|
+
_closeOnBlur = !1;
|
|
1175
|
+
_storageKey = "breadcrumbs";
|
|
1176
|
+
_name = "Breadcrumb";
|
|
1177
|
+
_mediaQueryListEventCallback = (t) => {
|
|
1178
|
+
t.matches ? (this.unlockInsideBreakpoint && this.unlock(), this.isOpen && this.closeInsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openInsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockInsideBreakpoint && this.lock()) : (this.unlockOutsideBreakpoint && this.unlock(), this.isOpen && this.closeOutsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openOutsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockOutsideBreakpoint && this.lock());
|
|
1179
|
+
};
|
|
1180
|
+
constructor({ breadcrumbElement: t, breadcrumbItemsSelector: e = ".breadcrumb-item", breadcrumbLinksSelector: s = ".breadcrumb-link", breadcrumbToggleSelector: i = ".breadcrumb-toggle", lockedClass: o = "locked", unlockedClass: r = "unlocked", openClass: c = "show", closeClass: m = "hide", transitionClass: _ = "transition", transitionDuration: k = 250, openDuration: C = -1, closeDuration: y = -1, openOnFocus: E = !1, closeOnBlur: f = !1, minWidth: g = "", breakpoint: p = "856px", autoOpen: O = !1, openInsideBreakpoint: D = !1, openOutsideBreakpoint: T = !0, closeInsideBreakpoint: v = !0, closeOutsideBreakpoint: A = !1, lockInsideBreakpoint: B = !1, lockOutsideBreakpoint: $ = !0, unlockInsideBreakpoint: I = !0, unlockOutsideBreakpoint: M = !1, locked: S = !1, mediaQuery: H = "", prefix: R = "graupl-", key: G = null, initializeClass: J = "initializing", initialize: q = !1 }) {
|
|
1154
1181
|
super({
|
|
1155
|
-
prefix:
|
|
1156
|
-
key:
|
|
1157
|
-
initializeClass:
|
|
1158
|
-
}), this._dom.
|
|
1159
|
-
|
|
1182
|
+
prefix: R,
|
|
1183
|
+
key: G,
|
|
1184
|
+
initializeClass: J
|
|
1185
|
+
}), this._dom.breadcrumb = t, this._dom.breadcrumbItems = [], this._dom.breadcrumbLinks = [], this._dom.breadcrumbToggle = null, this._selectors.breadcrumbItems = e, this._selectors.breadcrumbLinks = s, this._selectors.breadcrumbToggle = i, this._elements.breadcrumbItems = [], this._classes.locked = o || "", this._classes.unlocked = r || "", this._classes.open = c || "", this._classes.close = m || "", this._classes.transition = _ || "", this._durations.transition = k, this._durations.open = C, this._durations.close = y, this._openOnFocus = E, this._closeOnBlur = f, g !== "" && (console.warn("`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead."), p === "" && (p = g)), O && p !== "" && (console.warn("`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead."), T = O, v = O), this._breakpoint = p || "", this._openInsideBreakpoint = D, this._openOutsideBreakpoint = T, this._closeInsideBreakpoint = v, this._closeOutsideBreakpoint = A, this._lockInsideBreakpoint = B, this._lockOutsideBreakpoint = $, this._unlockInsideBreakpoint = I, this._unlockOutsideBreakpoint = M, this._mediaQueryString = H || "", this._locked.value = S, this._locked.commit(), this._registerEvent("expand", { detail: { breadcrumb: this } }), this._registerEvent("collapse", { detail: { breadcrumb: this } }), this._registerEvent("lock", { detail: { breadcrumb: this } }), this._registerEvent("unlock", { detail: { breadcrumb: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1186
|
+
requestAnimationFrame(() => {
|
|
1187
|
+
this.dom.breadcrumbToggle && (this.dom.breadcrumbToggle.getAttribute("aria-expanded") === "true" || this.openOutsideBreakpoint && !window.matchMedia(this.mediaQuery).matches || this.openInsideBreakpoint && window.matchMedia(this.mediaQuery).matches ? this.open({ force: !0 }) : this.close({ force: !0 })), this.isLocked || this.lockInsideBreakpoint && window.matchMedia(this.mediaQuery).matches || this.lockOutsideBreakpoint && !window.matchMedia(this.mediaQuery).matches ? this.lock({ force: !0 }) : this.unlock({ force: !0 });
|
|
1188
|
+
});
|
|
1160
1189
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1190
|
+
const Y = n("boolean", {
|
|
1191
|
+
openOnFocus: this._openOnFocus,
|
|
1192
|
+
closeOnBlur: this._closeOnBlur,
|
|
1193
|
+
openInsideBreakpoint: this._openInsideBreakpoint,
|
|
1194
|
+
openOutsideBreakpoint: this._openOutsideBreakpoint,
|
|
1195
|
+
closeInsideBreakpoint: this._closeInsideBreakpoint,
|
|
1196
|
+
closeOutsideBreakpoint: this._closeOutsideBreakpoint,
|
|
1197
|
+
lockInsideBreakpoint: this._lockInsideBreakpoint,
|
|
1198
|
+
lockOutsideBreakpoint: this._lockOutsideBreakpoint,
|
|
1199
|
+
unlockInsideBreakpoint: this._unlockInsideBreakpoint,
|
|
1200
|
+
unlockOutsideBreakpoint: this._unlockOutsideBreakpoint,
|
|
1201
|
+
locked: this._locked.value
|
|
1169
1202
|
}, { shouldThrow: !1 });
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
F.status || (this._errors = [...this._errors, ...F.errors], this._valid = !1);
|
|
1173
|
-
}), S && this.initialize();
|
|
1203
|
+
Y.status || (this._errors = [...this._errors, ...Y.errors], this._valid = !1);
|
|
1204
|
+
}), q && this.initialize();
|
|
1174
1205
|
}
|
|
1175
|
-
get
|
|
1176
|
-
return this._classes.
|
|
1206
|
+
get lockedClass() {
|
|
1207
|
+
return this._classes.locked;
|
|
1177
1208
|
}
|
|
1178
|
-
set
|
|
1179
|
-
|
|
1209
|
+
set lockedClass(t) {
|
|
1210
|
+
u({ lockedClass: t }), this._classes.locked !== t && (this._classes.locked = t);
|
|
1180
1211
|
}
|
|
1181
|
-
get
|
|
1182
|
-
return this._classes.
|
|
1212
|
+
get unlockedClass() {
|
|
1213
|
+
return this._classes.unlocked;
|
|
1183
1214
|
}
|
|
1184
|
-
set
|
|
1185
|
-
|
|
1215
|
+
set unlockedClass(t) {
|
|
1216
|
+
u({ unlockedClass: t }), this._classes.unlocked !== t && (this._classes.unlocked = t);
|
|
1186
1217
|
}
|
|
1187
|
-
get
|
|
1188
|
-
return this._classes.
|
|
1218
|
+
get openClass() {
|
|
1219
|
+
return this._classes.open;
|
|
1189
1220
|
}
|
|
1190
|
-
set
|
|
1191
|
-
|
|
1221
|
+
set openClass(t) {
|
|
1222
|
+
u({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
1192
1223
|
}
|
|
1193
|
-
get
|
|
1194
|
-
return this.
|
|
1224
|
+
get closeClass() {
|
|
1225
|
+
return this._classes.close;
|
|
1195
1226
|
}
|
|
1196
|
-
set
|
|
1197
|
-
|
|
1227
|
+
set closeClass(t) {
|
|
1228
|
+
u({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
1198
1229
|
}
|
|
1199
|
-
get
|
|
1200
|
-
return this.
|
|
1230
|
+
get transitionClass() {
|
|
1231
|
+
return this._classes.transition;
|
|
1201
1232
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1233
|
+
set transitionClass(t) {
|
|
1234
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1204
1235
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1236
|
+
get transitionDuration() {
|
|
1237
|
+
return this._durations.transition;
|
|
1207
1238
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1239
|
+
set transitionDuration(t) {
|
|
1240
|
+
n("number", { transitionDuration: t }), this._durations.transition !== t && (this._durations.transition = t, this._setCustomProps());
|
|
1210
1241
|
}
|
|
1211
|
-
get
|
|
1212
|
-
return this.
|
|
1242
|
+
get openDuration() {
|
|
1243
|
+
return this._durations.open === -1 ? this.transitionDuration : this._durations.open;
|
|
1213
1244
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1245
|
+
set openDuration(t) {
|
|
1246
|
+
n("number", { openDuration: t }), this._durations.open !== t && (this._durations.open = t, this._setCustomProps());
|
|
1216
1247
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1248
|
+
get closeDuration() {
|
|
1249
|
+
return this._durations.close === -1 ? this.transitionDuration : this._durations.close;
|
|
1219
1250
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1251
|
+
set closeDuration(t) {
|
|
1252
|
+
n("number", { closeDuration: t }), this._durations.close !== t && (this._durations.close = t, this._setCustomProps());
|
|
1222
1253
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1254
|
+
get openOnFocus() {
|
|
1255
|
+
return this._openOnFocus;
|
|
1225
1256
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1257
|
+
set openOnFocus(t) {
|
|
1258
|
+
n("boolean", { openOnFocus: t }), this._openOnFocus !== t && (this._openOnFocus = t);
|
|
1228
1259
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1260
|
+
get closeOnBlur() {
|
|
1261
|
+
return this._closeOnBlur;
|
|
1231
1262
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1263
|
+
set closeOnBlur(t) {
|
|
1264
|
+
n("boolean", { closeOnBlur: t }), this._closeOnBlur !== t && (this._closeOnBlur = t);
|
|
1234
1265
|
}
|
|
1235
|
-
|
|
1236
|
-
this.
|
|
1237
|
-
const i = new V({
|
|
1238
|
-
carouselItemElement: t,
|
|
1239
|
-
tabElement: this.dom.carouselTabs ? this.dom.carouselTabs[e] : null,
|
|
1240
|
-
parent: this,
|
|
1241
|
-
prefix: this.prefix,
|
|
1242
|
-
initializeClass: this.classes.initialize,
|
|
1243
|
-
initialize: !0
|
|
1244
|
-
});
|
|
1245
|
-
this._elements.carouselItems.push(i);
|
|
1246
|
-
});
|
|
1266
|
+
get isOpen() {
|
|
1267
|
+
return this._open.value;
|
|
1247
1268
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
t.id = t.id || `carousel-item-${this.key}-${e}`;
|
|
1251
|
-
}), this.dom.carouselTabs.forEach((t, e) => {
|
|
1252
|
-
t.id = t.id || `carousel-tab-${this.key}-${e}`;
|
|
1253
|
-
}), this._id = this.dom.carousel.id;
|
|
1269
|
+
get hasOpened() {
|
|
1270
|
+
return this._open.committed;
|
|
1254
1271
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
t.setAttribute("inert", "true");
|
|
1258
|
-
}), this.dom.carouselItemContainer && this.dom.carouselItemContainer.setAttribute("tabindex", "-1"), this._dom.carousel.setAttribute("aria-roledescription", "carousel"), this.dom.carouselTabContainer && this.dom.carouselTabContainer.setAttribute("role", "tablist"), this.dom.carouselTabs.forEach((t, e) => {
|
|
1259
|
-
t.setAttribute("role", "tab"), t.setAttribute("aria-selected", e === 0), t.setAttribute("aria-controls", this.dom.carouselItems[e].id);
|
|
1260
|
-
});
|
|
1272
|
+
get openInsideBreakpoint() {
|
|
1273
|
+
return this._openInsideBreakpoint;
|
|
1261
1274
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1275
|
+
set openInsideBreakpoint(t) {
|
|
1276
|
+
n("boolean", { openInsideBreakpoint: t }), this._openInsideBreakpoint !== t && (this._openInsideBreakpoint = t);
|
|
1264
1277
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
root: this.dom.carouselItemContainer,
|
|
1268
|
-
rootMargin: "1px",
|
|
1269
|
-
scrollMargin: "1px",
|
|
1270
|
-
threshold: 1
|
|
1271
|
-
}, e = new IntersectionObserver((i) => {
|
|
1272
|
-
this.isInitialized && i.forEach((s) => {
|
|
1273
|
-
if (!s.isIntersecting) return;
|
|
1274
|
-
const o = this.dom.carouselItems.indexOf(s.target);
|
|
1275
|
-
let r = o;
|
|
1276
|
-
this.elements.carouselItems[o].elements.clone !== null && (r = this.dom.carouselItems.indexOf(this.elements.carouselItems[o].elements.clone.dom.carouselItem), (o === 0 || o === this.dom.carouselItems.length - 1) && this.dom.carouselItemContainer.scrollTo({
|
|
1277
|
-
left: this.elements.carouselItems[o].elements.clone.dom.carouselItem.offsetLeft,
|
|
1278
|
-
top: this.elements.carouselItems[o].elements.clone.dom.carouselItem.offsetTop,
|
|
1279
|
-
behavior: "instant"
|
|
1280
|
-
})), this.currentItem !== r && this.activateItem(r, { scroll: !1 });
|
|
1281
|
-
});
|
|
1282
|
-
}, t);
|
|
1283
|
-
this.dom.carouselItems.forEach((i) => {
|
|
1284
|
-
e.observe(i);
|
|
1285
|
-
});
|
|
1278
|
+
get openOutsideBreakpoint() {
|
|
1279
|
+
return this._openOutsideBreakpoint;
|
|
1286
1280
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
this.autoplay && this._clearInterval();
|
|
1290
|
-
}), this._addEventListener("focusout", this.dom.carousel, () => {
|
|
1291
|
-
this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1292
|
-
});
|
|
1281
|
+
set openOutsideBreakpoint(t) {
|
|
1282
|
+
n("boolean", { openOutsideBreakpoint: t }), this._openOutsideBreakpoint !== t && (this._openOutsideBreakpoint = t);
|
|
1293
1283
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1284
|
+
get closeInsideBreakpoint() {
|
|
1285
|
+
return this._closeInsideBreakpoint;
|
|
1286
|
+
}
|
|
1287
|
+
set closeInsideBreakpoint(t) {
|
|
1288
|
+
n("boolean", { closeInsideBreakpoint: t }), this._closeInsideBreakpoint !== t && (this._closeInsideBreakpoint = t);
|
|
1289
|
+
}
|
|
1290
|
+
get closeOutsideBreakpoint() {
|
|
1291
|
+
return this._closeOutsideBreakpoint;
|
|
1292
|
+
}
|
|
1293
|
+
set closeOutsideBreakpoint(t) {
|
|
1294
|
+
n("boolean", { closeOutsideBreakpoint: t }), this._closeOutsideBreakpoint !== t && (this._closeOutsideBreakpoint = t);
|
|
1295
|
+
}
|
|
1296
|
+
get lockInsideBreakpoint() {
|
|
1297
|
+
return this._lockInsideBreakpoint;
|
|
1298
|
+
}
|
|
1299
|
+
set lockInsideBreakpoint(t) {
|
|
1300
|
+
n("boolean", { lockInsideBreakpoint: t }), this._lockInsideBreakpoint !== t && (this._lockInsideBreakpoint = t);
|
|
1301
|
+
}
|
|
1302
|
+
get lockOutsideBreakpoint() {
|
|
1303
|
+
return this._lockOutsideBreakpoint;
|
|
1304
|
+
}
|
|
1305
|
+
set lockOutsideBreakpoint(t) {
|
|
1306
|
+
n("boolean", { lockOutsideBreakpoint: t }), this._lockOutsideBreakpoint !== t && (this._lockOutsideBreakpoint = t);
|
|
1307
|
+
}
|
|
1308
|
+
get isLocked() {
|
|
1309
|
+
return this._locked.value;
|
|
1310
|
+
}
|
|
1311
|
+
get shouldBeLocked() {
|
|
1312
|
+
return this._locked.committed;
|
|
1313
|
+
}
|
|
1314
|
+
get currentChild() {
|
|
1315
|
+
return this._currentChild;
|
|
1316
|
+
}
|
|
1317
|
+
set currentChild(t) {
|
|
1318
|
+
n("number", { currentChild: t }), this._currentChild !== t && t >= 0 && t < this.elements.breadcrumbItems.length && (this._currentChild = t);
|
|
1319
|
+
}
|
|
1320
|
+
get currentBreadcrumbItem() {
|
|
1321
|
+
return this.elements.breadcrumbItems[this.currentChild];
|
|
1322
|
+
}
|
|
1323
|
+
_setIds() {
|
|
1324
|
+
this.dom.breadcrumb.id = this.dom.breadcrumb.id || `breadcrumb-${this.key}`, this.dom.breadcrumbToggle && (this.dom.breadcrumbToggle.id = this.dom.breadcrumbToggle.id || `breadcrumb-toggle-${this.key}`), this._id = this.dom.breadcrumb.id;
|
|
1325
|
+
}
|
|
1326
|
+
_setAriaAttributes() {
|
|
1327
|
+
this.dom.breadcrumbToggle && (this.dom.breadcrumbToggle.getAttribute("aria-expanded") !== "true" && this.dom.breadcrumbToggle.setAttribute("aria-expanded", "false"), this.dom.breadcrumbToggle.setAttribute("aria-controls", this.dom.breadcrumb.id), z("button", { toggle: this.dom.breadcrumbToggle }, { shouldThrow: !1 }).status || this.dom.breadcrumbToggle.setAttribute("role", "button"));
|
|
1328
|
+
}
|
|
1329
|
+
_setCustomProps() {
|
|
1330
|
+
this.dom.breadcrumb.style.setProperty(`--${this.prefix}breadcrumb-transition-duration`, `${this.transitionDuration}ms`), this.dom.breadcrumb.style.setProperty(`--${this.prefix}breadcrumb-open-transition-duration`, `${this.openDuration}ms`), this.dom.breadcrumb.style.setProperty(`--${this.prefix}breadcrumb-close-transition-duration`, `${this.closeDuration}ms`);
|
|
1331
|
+
}
|
|
1332
|
+
_setDOMElements() {
|
|
1333
|
+
this._resetDOMElementType("breadcrumbItems"), this._setDOMElementType("breadcrumbItems", { context: this.dom.breadcrumb }), this._resetDOMElementType("breadcrumbLinks"), this._setDOMElementType("breadcrumbLinks", { context: this.dom.breadcrumb }), this._resetDOMElementType("breadcrumbToggle"), this._setDOMElementType("breadcrumbToggle", { context: this.dom.breadcrumb });
|
|
1334
|
+
}
|
|
1335
|
+
_createChildElements() {
|
|
1336
|
+
this.dom.breadcrumbItems.forEach((t) => {
|
|
1337
|
+
const e = t.querySelector(this.selectors.breadcrumbLinks), s = t.querySelector(this.selectors.breadcrumbToggle) !== null, i = new ut({
|
|
1338
|
+
breadcrumbItemElement: t,
|
|
1339
|
+
breadcrumbLinkElement: e,
|
|
1340
|
+
parentBreadcrumb: this,
|
|
1341
|
+
isToggle: s
|
|
1342
|
+
});
|
|
1343
|
+
this.elements.breadcrumbItems.push(i), s && (this._elements.breadcrumbToggle = i);
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
_reveal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
1347
|
+
this.dom.breadcrumbToggle && this.dom.breadcrumbToggle.setAttribute("aria-expanded", "true"), e && this.transitionlass !== "" ? (a(this.transitionClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1348
|
+
l(this.closeClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1349
|
+
a(this.openClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1350
|
+
setTimeout(() => {
|
|
1351
|
+
l(this.transitionClass, this.dom.breadcrumb);
|
|
1352
|
+
}, this.openDuration);
|
|
1353
|
+
});
|
|
1354
|
+
});
|
|
1355
|
+
})) : (a(this.openClass, this.dom.breadcrumb), l(this.closeClass, this.dom.breadcrumb)), t && (this.dom.breadcrumbToggle ? this._dispatchEvent("expand", this.dom.breadcrumbToggle) : this._dispatchEvent("expand", this.dom.breadcrumb));
|
|
1356
|
+
}
|
|
1357
|
+
_conceal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
1358
|
+
this.dom.breadcrumbToggle && this.dom.breadcrumbToggle.setAttribute("aria-expanded", "false"), e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1359
|
+
l(this.openClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1360
|
+
a(this.closeClass, this.dom.breadcrumb), requestAnimationFrame(() => {
|
|
1361
|
+
setTimeout(() => {
|
|
1362
|
+
l(this.transitionClass, this.dom.breadcrumb);
|
|
1363
|
+
}, this.closeDuration);
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
})) : (a(this.closeClass, this.dom.breadcrumb), l(this.openClass, this.dom.breadcrumb)), t && (this.dom.breadcrumbToggle ? this._dispatchEvent("collapse", this.dom.breadcrumbToggle) : this._dispatchEvent("collapse", this.dom.breadcrumb));
|
|
1367
|
+
}
|
|
1368
|
+
_lock({ emit: t = this.isInitialized } = {}) {
|
|
1369
|
+
a(this.lockedClass, this.dom.breadcrumb), l(this.unlockedClass, this.dom.breadcrumb), this.dom.breadcrumbToggle && this.dom.breadcrumbToggle.setAttribute("disabled", "true"), t && (this.dom.breadcrumbToggle ? this._dispatchEvent("lock", this.dom.breadcrumbToggle) : this._dispatchEvent("lock", this.dom.breadcrumb));
|
|
1370
|
+
}
|
|
1371
|
+
_unlock({ emit: t = this.isInitialized } = {}) {
|
|
1372
|
+
a(this.unlockedClass, this.dom.breadcrumb), l(this.lockedClass, this.dom.breadcrumb), this.dom.breadcrumbToggle && this.dom.breadcrumbToggle.removeAttribute("disabled"), t && (this.dom.breadcrumbToggle ? this._dispatchEvent("unlock", this.dom.breadcrumbToggle) : this._dispatchEvent("unlock", this.dom.breadcrumb));
|
|
1373
|
+
}
|
|
1374
|
+
_handleFocus() {
|
|
1375
|
+
this.elements.breadcrumbItems.forEach((t, e) => {
|
|
1376
|
+
t.dom.link && this._addEventListener("focus", t.dom.link, () => {
|
|
1377
|
+
this.focusState = "self", this.currentChild = e;
|
|
1378
|
+
});
|
|
1379
|
+
}), this._addEventListener("focusout", this.dom.breadcrumb, (t) => {
|
|
1380
|
+
!this.closeOnBlur || this.currentEvent !== "keyboard" || t.relatedTarget === null || this.dom.breadcrumb.contains(t.relatedTarget) || this.dom.breadcrumbToggle === t.relatedTarget || this.close();
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
_handleClick() {
|
|
1384
|
+
this._addEventListener("click", document, (t) => {
|
|
1385
|
+
this.focusState !== "self" || !this.closeOnBlur || (this.currentEvent = "mouse", !this.dom.breadcrumb.contains(t.target) && this.dom.breadcrumbToggle !== t.target && this.close());
|
|
1386
|
+
}), this.dom.breadcrumbToggle && this._addEventListener("click", this.dom.breadcrumbToggle, (t) => {
|
|
1387
|
+
this.currentEvent = "mouse", t.button === 0 && (h(t), this.toggle());
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
_handleKeydown() {
|
|
1391
|
+
this._addEventListener("keydown", this.dom.breadcrumb, (t) => {
|
|
1392
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && h(t);
|
|
1393
|
+
}), this.dom.breadcrumbToggle && this._addEventListener("keydown", this.dom.breadcrumbToggle, (t) => {
|
|
1394
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1395
|
+
case "Space":
|
|
1396
|
+
case "Enter":
|
|
1397
|
+
h(t);
|
|
1398
|
+
break;
|
|
1399
|
+
}
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
_handleKeyup() {
|
|
1403
|
+
this._addEventListener("keyup", this.dom.breadcrumb, (t) => {
|
|
1404
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && (h(t), this.close(), this.currentChild > this.elements.breadcrumbItems.indexOf(this.elements.breadcrumbToggle) && requestAnimationFrame(() => {
|
|
1405
|
+
this.focusToggle();
|
|
1406
|
+
}));
|
|
1407
|
+
}), this.dom.breadcrumbToggle && this._addEventListener("keyup", this.dom.breadcrumbToggle, (t) => {
|
|
1408
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1409
|
+
case "Space":
|
|
1410
|
+
case "Enter":
|
|
1411
|
+
h(t), this.toggle(), this.isOpen ? requestAnimationFrame(() => {
|
|
1412
|
+
this.focusNextChild();
|
|
1413
|
+
}) : this.focusFirstChild();
|
|
1414
|
+
break;
|
|
1415
|
+
case "Tab":
|
|
1416
|
+
this.openOnFocus && (h(t), this.open(), requestAnimationFrame(() => {
|
|
1417
|
+
this.focusNextChild();
|
|
1418
|
+
}));
|
|
1419
|
+
break;
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
open({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1424
|
+
this.isOpen && !t || this.isLocked && !t || (this.focusState = "self", this._reveal({
|
|
1425
|
+
emit: e,
|
|
1426
|
+
transition: s
|
|
1427
|
+
}), this._open.value = !0, i || this._open.commit());
|
|
1428
|
+
}
|
|
1429
|
+
preview({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1430
|
+
this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._reveal({
|
|
1431
|
+
emit: e,
|
|
1432
|
+
transition: s
|
|
1433
|
+
}), this._open.value = !0, i || this._open.commit());
|
|
1434
|
+
}
|
|
1435
|
+
close({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1436
|
+
!this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._conceal({
|
|
1437
|
+
emit: e,
|
|
1438
|
+
transition: s
|
|
1439
|
+
}), this._open.value = !1, i || this._open.commit());
|
|
1440
|
+
}
|
|
1441
|
+
toggle({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1442
|
+
this.isOpen ? this.close({
|
|
1443
|
+
force: t,
|
|
1444
|
+
emit: e,
|
|
1445
|
+
transition: s,
|
|
1446
|
+
preserveState: i
|
|
1447
|
+
}) : this.open({
|
|
1448
|
+
force: t,
|
|
1449
|
+
emit: e,
|
|
1450
|
+
transition: s,
|
|
1451
|
+
preserveState: i
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
lock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1455
|
+
this.isLocked && !t || (this._locked.value = !0, this._lock({ emit: e }), s || this._locked.commit());
|
|
1456
|
+
}
|
|
1457
|
+
unlock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1458
|
+
!this.isLocked && !t || (this._locked.value = !1, this._unlock({ emit: e }), s || this._locked.commit());
|
|
1459
|
+
}
|
|
1460
|
+
toggleLock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1461
|
+
this.isLocked ? this.unlock({
|
|
1462
|
+
force: t,
|
|
1463
|
+
emit: e,
|
|
1464
|
+
preserveState: s
|
|
1465
|
+
}) : this.lock({
|
|
1466
|
+
force: t,
|
|
1467
|
+
emit: e,
|
|
1468
|
+
preserveState: s
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
focusCurrentChild() {
|
|
1472
|
+
this.focusState = "self", this.currentChild !== -1 && this.currentBreadcrumbItem.focus();
|
|
1473
|
+
}
|
|
1474
|
+
focusChild(t) {
|
|
1475
|
+
this.blurCurrentChild(), this.currentChild = t, this.focusCurrentChild();
|
|
1476
|
+
}
|
|
1477
|
+
focusFirstChild() {
|
|
1478
|
+
this.focusChild(0);
|
|
1479
|
+
}
|
|
1480
|
+
focusLastChild() {
|
|
1481
|
+
this.focusChild(this.elements.breadcrumbItems.length - 1);
|
|
1482
|
+
}
|
|
1483
|
+
focusNextChild() {
|
|
1484
|
+
this.currentChild < this.elements.breadcrumbItems.length - 1 ? this.focusChild(this.currentChild + 1) : this.focusCurrentChild();
|
|
1485
|
+
}
|
|
1486
|
+
focusPreviousChild() {
|
|
1487
|
+
this.currentChild > 0 ? this.focusChild(this.currentChild - 1) : this.focusCurrentChild();
|
|
1488
|
+
}
|
|
1489
|
+
blurCurrentChild() {
|
|
1490
|
+
this.focusState = "none", this.currentChild !== -1 && this.currentBreadcrumbItem.blur();
|
|
1491
|
+
}
|
|
1492
|
+
focusToggle() {
|
|
1493
|
+
this.focusState = "self", this.elements.breadcrumbToggle !== null && (this.currentChild = this.elements.breadcrumbItems.indexOf(this.elements.breadcrumbToggle) || 0, this.elements.breadcrumbToggle.focus());
|
|
1494
|
+
}
|
|
1495
|
+
};
|
|
1496
|
+
const pt = ({ options: t = {}, context: e = document, selector: s = ".breadcrumb" } = {}) => {
|
|
1497
|
+
b("graupl-breadcrumb-generator", s, e).forEach((i) => {
|
|
1498
|
+
const o = i.dataset.grauplBreadcrumbOptions ? JSON.parse(i.dataset.grauplBreadcrumbOptions.replace(/'/g, "\"")) || {} : {};
|
|
1499
|
+
new mt({
|
|
1500
|
+
breadcrumbElement: i,
|
|
1501
|
+
initialize: !0,
|
|
1502
|
+
...t,
|
|
1503
|
+
...o
|
|
1504
|
+
});
|
|
1505
|
+
});
|
|
1506
|
+
};
|
|
1507
|
+
var N = class extends w {
|
|
1508
|
+
_rootDOMElement = "carouselItem";
|
|
1509
|
+
_shouldStore = !1;
|
|
1510
|
+
_storageKey = "carouselItems";
|
|
1511
|
+
_name = "CarouselItem";
|
|
1512
|
+
_busy = !1;
|
|
1513
|
+
constructor({ carouselItemElement: t, tabElement: e = null, clone: s = null, parent: i, prefix: o = "graupl-", key: r = null, initializeClass: c = "initializing", initialize: m = !1 }) {
|
|
1514
|
+
super({
|
|
1515
|
+
prefix: o,
|
|
1516
|
+
key: r,
|
|
1517
|
+
initializeClass: c
|
|
1518
|
+
}), this._dom.carouselItem = t, this._dom.tab = e, this._elements.clone = s ?? null, this._elements.parent = i, m && this.initialize();
|
|
1519
|
+
}
|
|
1520
|
+
activate({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1521
|
+
requestAnimationFrame(() => {
|
|
1522
|
+
a(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.removeAttribute("inert"), t && this.elements.parent.dom.carouselItemContainer.scrollTo({
|
|
1523
|
+
left: this.dom.carouselItem.offsetLeft,
|
|
1524
|
+
top: this.dom.carouselItem.offsetTop,
|
|
1525
|
+
behavior: "smooth",
|
|
1526
|
+
...e
|
|
1527
|
+
}), this.dom.tab && requestAnimationFrame(() => {
|
|
1528
|
+
a(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !0);
|
|
1529
|
+
});
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
deactivate() {
|
|
1533
|
+
requestAnimationFrame(() => {
|
|
1534
|
+
l(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.setAttribute("inert", !0), requestAnimationFrame(() => {
|
|
1535
|
+
this.dom.tab && (l(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !1));
|
|
1536
|
+
});
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
}, _t = class extends w {
|
|
1540
|
+
_rootDOMElement = "carousel";
|
|
1541
|
+
_currentItem = 0;
|
|
1542
|
+
_autoplay = !0;
|
|
1543
|
+
_playText = "Play";
|
|
1544
|
+
_pauseText = "Pause";
|
|
1545
|
+
_storageKey = "carousels";
|
|
1546
|
+
_name = "Carousel";
|
|
1547
|
+
_itemsPerPage = 1;
|
|
1548
|
+
_loop = !0;
|
|
1549
|
+
constructor({ carouselElement: t, carouselItemsSelector: e = ".carousel-item", carouselItemContainerSelector: s = ".carousel-item-container", carouselControlsSelector: i = ".carousel-control", carouselControlContainerSelector: o = ".carousel-control-container", carouselTabsSelector: r = ".carousel-tab", carouselTabContainerSelector: c = ".carousel-tab-container", autoplaySelector: m = ".autoplay", nextSelector: _ = ".next", previousSelector: k = ".previous", activeClass: C = "active", playClass: y = "play", pauseClass: E = "pause", autoplay: f = !0, transitionDelay: g = 1e4, playText: p = "Play", pauseText: O = "Pause", itemsPerPage: D = 1, loop: T = !0, prefix: v = "graupl-", key: A = null, initializeClass: B = "initializing", initialize: $ = !1 }) {
|
|
1550
|
+
super({
|
|
1551
|
+
prefix: v,
|
|
1552
|
+
key: A,
|
|
1553
|
+
initializeClass: B
|
|
1554
|
+
}), this._dom.carousel = t, this._dom.carouselItems = [], this._dom.carouselItemContainer = null, this._dom.carouselControls = [], this._dom.carouselControlContainer = null, this._dom.carouselTabs = [], this._dom.carouselTabContainer = null, this._dom.autoplay = null, this._dom.next = null, this._dom.previous = null, this._selectors.carouselItems = e, this._selectors.carouselItemContainer = s, this._selectors.carouselControls = i, this._selectors.carouselControlContainer = o, this._selectors.carouselTabs = r, this._selectors.carouselTabContainer = c, this._selectors.autoplay = m, this._selectors.next = _, this._selectors.previous = k, this._elements.carouselItems = [], this._classes.active = C || "", this._classes.play = y || "", this._classes.pause = E || "", this._autoplay = f, this._itemsPerPage = D, this._loop = T, this._delays.transition = g, this._playText = p || "", this._pauseText = O || "", this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1555
|
+
this._handleAutoplay(), this.loop && this._handleLoop(), this._handleIntersection(), this.activateFirstItem({ scrollOptions: { behavior: "instant" } });
|
|
1556
|
+
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1557
|
+
const I = n("boolean", {
|
|
1558
|
+
autoplay: this._autoplay,
|
|
1559
|
+
loop: this._loop
|
|
1560
|
+
}, { shouldThrow: !1 });
|
|
1561
|
+
I.status || (this._errors = [...this._errors, ...I.errors], this._valid = !1);
|
|
1562
|
+
const M = n("string", {
|
|
1563
|
+
playText: this._playText,
|
|
1564
|
+
pauseText: this._pauseText
|
|
1565
|
+
}, { shouldThrow: !1 });
|
|
1566
|
+
M.status || (this._errors = [...this._errors, ...M.errors], this._valid = !1);
|
|
1567
|
+
const S = n("number", { itemsPerPage: this._itemsPerPage }, { shouldThrow: !1 });
|
|
1568
|
+
S.status || (this._errors = [...this._errors, ...S.errors], this._valid = !1);
|
|
1569
|
+
}), $ && this.initialize();
|
|
1570
|
+
}
|
|
1571
|
+
get activeClass() {
|
|
1572
|
+
return this._classes.active;
|
|
1573
|
+
}
|
|
1574
|
+
set activeClass(t) {
|
|
1575
|
+
u({ activeClass: t }), this._classes.active !== t && (this._classes.active = t);
|
|
1576
|
+
}
|
|
1577
|
+
get playClass() {
|
|
1578
|
+
return this._classes.play;
|
|
1579
|
+
}
|
|
1580
|
+
set playClass(t) {
|
|
1581
|
+
u({ playClass: t }), this._classes.play !== t && (this._classes.play = t);
|
|
1582
|
+
}
|
|
1583
|
+
get pauseClass() {
|
|
1584
|
+
return this._classes.pause;
|
|
1585
|
+
}
|
|
1586
|
+
set pauseClass(t) {
|
|
1587
|
+
u({ pauseClass: t }), this._classes.pause !== t && (this._classes.pause = t);
|
|
1588
|
+
}
|
|
1589
|
+
get currentItem() {
|
|
1590
|
+
return this._currentItem;
|
|
1591
|
+
}
|
|
1592
|
+
set currentItem(t) {
|
|
1593
|
+
n("number", { currentItem: t }), t !== this.currentItem && (t < 0 ? this._currentItem = 0 : t >= this.dom.carouselItems.length ? this._currentItem = this.dom.carouselItems.length - 1 : this._currentItem = t);
|
|
1594
|
+
}
|
|
1595
|
+
get currentCarouselItem() {
|
|
1596
|
+
return this.elements.carouselItems[this.currentItem];
|
|
1597
|
+
}
|
|
1598
|
+
get autoplay() {
|
|
1599
|
+
return this._autoplay;
|
|
1600
|
+
}
|
|
1601
|
+
set autoplay(t) {
|
|
1602
|
+
n("boolean", { autoplay: t }), this._autoplay !== t && (this._autoplay = t);
|
|
1603
|
+
}
|
|
1604
|
+
get itemsPerPage() {
|
|
1605
|
+
return this._itemsPerPage;
|
|
1606
|
+
}
|
|
1607
|
+
get loop() {
|
|
1608
|
+
return this._loop;
|
|
1609
|
+
}
|
|
1610
|
+
get transitionDelay() {
|
|
1611
|
+
return this._delays.transition;
|
|
1612
|
+
}
|
|
1613
|
+
set transitionDelay(t) {
|
|
1614
|
+
n("number", { transitionDelay: t }), t !== this.transitionDelay && t >= 0 && (this._delays.transition = t);
|
|
1615
|
+
}
|
|
1616
|
+
get playText() {
|
|
1617
|
+
return this._playText;
|
|
1618
|
+
}
|
|
1619
|
+
set playText(t) {
|
|
1620
|
+
n("string", { playText: t }), this._playText !== t && (this._playText = t);
|
|
1621
|
+
}
|
|
1622
|
+
get pauseText() {
|
|
1623
|
+
return this._pauseText;
|
|
1624
|
+
}
|
|
1625
|
+
set pauseText(t) {
|
|
1626
|
+
n("string", { pauseText: t }), this._pauseText !== t && (this._pauseText = t);
|
|
1627
|
+
}
|
|
1628
|
+
_setDOMElements() {
|
|
1629
|
+
this._setDOMElementType("carouselItemContainer", { context: this.dom.carousel }), this._setDOMElementType("carouselControlContainer", { context: this.dom.carousel }), this._setDOMElementType("carouselTabContainer", { context: this.dom.carousel }), this.dom.carouselItemContainer && this._setDOMElementType("carouselItems", { context: this.dom.carouselItemContainer }), this.dom.carouselControlContainer && (this._setDOMElementType("carouselControls", { context: this.dom.carouselControlContainer }), this._setDOMElementType("autoplay", { context: this.dom.carouselControlContainer }), this._setDOMElementType("next", { context: this.dom.carouselControlContainer }), this._setDOMElementType("previous", { context: this.dom.carouselControlContainer })), this._dom.carouselTabContainer && this._setDOMElementType("carouselTabs", { context: this.dom.carouselTabContainer });
|
|
1630
|
+
}
|
|
1631
|
+
_createChildElements() {
|
|
1632
|
+
this.dom.carouselItems.forEach((t, e) => {
|
|
1633
|
+
const s = new N({
|
|
1634
|
+
carouselItemElement: t,
|
|
1635
|
+
tabElement: this.dom.carouselTabs ? this.dom.carouselTabs[e] : null,
|
|
1636
|
+
parent: this,
|
|
1637
|
+
prefix: this.prefix,
|
|
1638
|
+
initializeClass: this.classes.initialize,
|
|
1639
|
+
initialize: !0
|
|
1640
|
+
});
|
|
1641
|
+
this._elements.carouselItems.push(s);
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
_setIds() {
|
|
1645
|
+
this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`, this.dom.carouselItems.forEach((t, e) => {
|
|
1646
|
+
t.id = t.id || `carousel-item-${this.key}-${e}`;
|
|
1647
|
+
}), this.dom.carouselTabs.forEach((t, e) => {
|
|
1648
|
+
t.id = t.id || `carousel-tab-${this.key}-${e}`;
|
|
1649
|
+
}), this._id = this.dom.carousel.id;
|
|
1650
|
+
}
|
|
1651
|
+
_setAriaAttributes() {
|
|
1652
|
+
!z("section", { carousel: this.dom.carousel }, { shouldThrow: !1 }).status && !this.dom.carousel.getAttribute("role") !== "region" && this.dom.carousel.setAttribute("role", "group"), this.dom.carouselItems.forEach((t) => {
|
|
1653
|
+
t.setAttribute("inert", "true");
|
|
1654
|
+
}), this.dom.carouselItemContainer && this.dom.carouselItemContainer.setAttribute("tabindex", "-1"), this._dom.carousel.setAttribute("aria-roledescription", "carousel"), this.dom.carouselTabContainer && this.dom.carouselTabContainer.setAttribute("role", "tablist"), this.dom.carouselTabs.forEach((t, e) => {
|
|
1655
|
+
t.setAttribute("role", "tab"), t.setAttribute("aria-selected", e === 0), t.setAttribute("aria-controls", this.dom.carouselItems[e].id);
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
_handleAutoplay() {
|
|
1659
|
+
this.autoplay ? (a(this.pauseClass, this.dom.autoplay), l(this.playClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.pauseText), this.dom.carousel.setAttribute("aria-live", "off"), this._setInterval(() => this.activateNextItem(), this.transitionDelay)) : (a(this.playClass, this.dom.autoplay), l(this.pauseClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.playText), this.dom.carousel.setAttribute("aria-live", "polite"), this._clearInterval());
|
|
1660
|
+
}
|
|
1661
|
+
_handleIntersection() {
|
|
1662
|
+
const t = {
|
|
1663
|
+
root: this.dom.carouselItemContainer,
|
|
1664
|
+
rootMargin: "1px",
|
|
1665
|
+
scrollMargin: "1px",
|
|
1666
|
+
threshold: 1
|
|
1667
|
+
}, e = new IntersectionObserver((s) => {
|
|
1668
|
+
this.isInitialized && s.forEach((i) => {
|
|
1669
|
+
if (!i.isIntersecting) return;
|
|
1670
|
+
const o = this.dom.carouselItems.indexOf(i.target);
|
|
1671
|
+
let r = o;
|
|
1672
|
+
this.elements.carouselItems[o].elements.clone !== null && (r = this.dom.carouselItems.indexOf(this.elements.carouselItems[o].elements.clone.dom.carouselItem), (o === 0 || o === this.dom.carouselItems.length - 1) && this.dom.carouselItemContainer.scrollTo({
|
|
1673
|
+
left: this.elements.carouselItems[o].elements.clone.dom.carouselItem.offsetLeft,
|
|
1674
|
+
top: this.elements.carouselItems[o].elements.clone.dom.carouselItem.offsetTop,
|
|
1675
|
+
behavior: "instant"
|
|
1676
|
+
})), this.currentItem !== r && this.activateItem(r, { scroll: !1 });
|
|
1677
|
+
});
|
|
1678
|
+
}, t);
|
|
1679
|
+
this.dom.carouselItems.forEach((s) => {
|
|
1680
|
+
e.observe(s);
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
_handleFocus() {
|
|
1684
|
+
this._addEventListener("focusin", this.dom.carousel, () => {
|
|
1685
|
+
this.autoplay && this._clearInterval();
|
|
1686
|
+
}), this._addEventListener("focusout", this.dom.carousel, () => {
|
|
1687
|
+
this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
_handleClick() {
|
|
1691
|
+
this._addEventListener("click", this.dom.next, (t) => {
|
|
1692
|
+
t.button === 0 && (h(t), this.currentEvent = "mouse", this.activateNextItem());
|
|
1693
|
+
}), this._addEventListener("click", this.dom.previous, (t) => {
|
|
1694
|
+
t.button === 0 && (h(t), this.currentEvent = "mouse", this.activatePreviousItem());
|
|
1695
|
+
}), this._addEventListener("click", this.dom.autoplay, (t) => {
|
|
1696
|
+
t.button === 0 && (h(t), this.currentEvent = "mouse", this.toggleAutoplay());
|
|
1697
|
+
}), this.elements.carouselItems.forEach((t) => {
|
|
1698
|
+
t.dom.tab && this._addEventListener("click", t.dom.tab, (e) => {
|
|
1699
|
+
e.button === 0 && (h(e), this.currentEvent = "mouse", this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)));
|
|
1700
|
+
});
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
_handleHover() {
|
|
1704
|
+
this._addEventListener("pointerover", this.dom.carousel, () => {
|
|
1705
|
+
this.autoplay && this._clearInterval();
|
|
1706
|
+
}), this._addEventListener("pointerleave", this.dom.carousel, () => {
|
|
1707
|
+
this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
_handleKeydown() {
|
|
1711
|
+
this.dom.carouselControls.forEach((t) => {
|
|
1712
|
+
this._addEventListener("keydown", t, (e) => {
|
|
1713
|
+
switch (d(e)) {
|
|
1714
|
+
case "Space":
|
|
1715
|
+
case "Enter":
|
|
1716
|
+
h(e);
|
|
1717
|
+
break;
|
|
1718
|
+
}
|
|
1719
|
+
});
|
|
1301
1720
|
}), this.elements.carouselItems.forEach((t) => {
|
|
1302
|
-
t.dom.tab && this._addEventListener("
|
|
1303
|
-
|
|
1721
|
+
t.dom.tab && this._addEventListener("keydown", t.dom.tab, (e) => {
|
|
1722
|
+
switch (d(e)) {
|
|
1723
|
+
case "Space":
|
|
1724
|
+
case "Enter":
|
|
1725
|
+
h(e);
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
_handleKeyup() {
|
|
1732
|
+
this._addEventListener("keyup", this.dom.next, (t) => {
|
|
1733
|
+
switch (d(t)) {
|
|
1734
|
+
case "Space":
|
|
1735
|
+
case "Enter":
|
|
1736
|
+
this.activateNextItem(), h(t);
|
|
1737
|
+
break;
|
|
1738
|
+
}
|
|
1739
|
+
}), this._addEventListener("keyup", this.dom.previous, (t) => {
|
|
1740
|
+
switch (d(t)) {
|
|
1741
|
+
case "Space":
|
|
1742
|
+
case "Enter":
|
|
1743
|
+
this.activatePreviousItem(), h(t);
|
|
1744
|
+
break;
|
|
1745
|
+
}
|
|
1746
|
+
}), this._addEventListener("keyup", this.dom.autoplay, (t) => {
|
|
1747
|
+
switch (d(t)) {
|
|
1748
|
+
case "Space":
|
|
1749
|
+
case "Enter":
|
|
1750
|
+
this.toggleAutoplay(), h(t);
|
|
1751
|
+
break;
|
|
1752
|
+
}
|
|
1753
|
+
}), this.elements.carouselItems.forEach((t) => {
|
|
1754
|
+
t.dom.tab && this._addEventListener("keyup", t.dom.tab, (e) => {
|
|
1755
|
+
switch (d(e)) {
|
|
1756
|
+
case "Space":
|
|
1757
|
+
case "Enter":
|
|
1758
|
+
this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)), h(e);
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1764
|
+
_handleLoop() {
|
|
1765
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), s = this.dom.carouselItemContainer;
|
|
1766
|
+
for (let i = 0; i < this.itemsPerPage; i++) t.set(this.dom.carouselItems[i], this.dom.carouselItems.indexOf(this.dom.carouselItems[i]));
|
|
1767
|
+
for (let i = this.dom.carouselItems.length - this.itemsPerPage; i < this.dom.carouselItems.length; i++) e.set(this.dom.carouselItems[i], this.dom.carouselItems.indexOf(this.dom.carouselItems[i]));
|
|
1768
|
+
t.forEach((i, o) => {
|
|
1769
|
+
const r = o.cloneNode(!0);
|
|
1770
|
+
r.setAttribute("aria-hidden", "true"), r.setAttribute("inert", "true"), r.setAttribute("id", `${o.id}-clone`), s.appendChild(r);
|
|
1771
|
+
const c = new N({
|
|
1772
|
+
carouselItemElement: r,
|
|
1773
|
+
clone: this._elements.carouselItems[i],
|
|
1774
|
+
parent: this,
|
|
1775
|
+
prefix: this.prefix,
|
|
1776
|
+
initializeClass: this.classes.initialize,
|
|
1777
|
+
initialize: !0
|
|
1778
|
+
});
|
|
1779
|
+
this.dom.carouselItems.push(r), this._elements.carouselItems.push(c);
|
|
1780
|
+
}), e.forEach((i, o) => {
|
|
1781
|
+
const r = o.cloneNode(!0);
|
|
1782
|
+
r.setAttribute("aria-hidden", "true"), r.setAttribute("inert", "true"), r.setAttribute("id", `${o.id}-clone`), s.insertBefore(r, s.firstChild);
|
|
1783
|
+
const c = new N({
|
|
1784
|
+
carouselItemElement: r,
|
|
1785
|
+
clone: this._elements.carouselItems[i],
|
|
1786
|
+
parent: this,
|
|
1787
|
+
prefix: this.prefix,
|
|
1788
|
+
initializeClass: this.classes.initialize,
|
|
1789
|
+
initialize: !0
|
|
1304
1790
|
});
|
|
1791
|
+
this.dom.carouselItems.unshift(r), this._elements.carouselItems.unshift(c);
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
activateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1795
|
+
this.currentCarouselItem.activate({
|
|
1796
|
+
scroll: t,
|
|
1797
|
+
scrollOptions: e
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
deactivateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1801
|
+
this.currentCarouselItem.deactivate({
|
|
1802
|
+
scroll: t,
|
|
1803
|
+
scrollOptions: e
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
activateItem(t, { scroll: e = !0, scrollOptions: s = {} } = {}) {
|
|
1807
|
+
this.autoplay && this._clearInterval(), this.deactivateCurrentItem({
|
|
1808
|
+
scroll: e,
|
|
1809
|
+
scrollOptions: s
|
|
1810
|
+
}), this.currentItem = t, this.activateCurrentItem({
|
|
1811
|
+
scroll: e,
|
|
1812
|
+
scrollOptions: s
|
|
1813
|
+
}), this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1814
|
+
}
|
|
1815
|
+
activateFirstItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1816
|
+
this.loop ? this.currentItem === this.dom.carouselItems.length - this.itemsPerPage - 1 ? this.activateNextItem({
|
|
1817
|
+
scroll: t,
|
|
1818
|
+
scrollOptions: e
|
|
1819
|
+
}) : this.activateItem(this.itemsPerPage, {
|
|
1820
|
+
scroll: t,
|
|
1821
|
+
scrollOptions: e
|
|
1822
|
+
}) : this.activateItem(0, {
|
|
1823
|
+
scroll: t,
|
|
1824
|
+
scrollOptions: e
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
activateLastItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1828
|
+
this.loop ? this.currentItem === this.itemsPerPage ? this.activatePreviousItem({
|
|
1829
|
+
scroll: t,
|
|
1830
|
+
scrollOptions: e
|
|
1831
|
+
}) : this.activateItem(this.dom.carouselItems.length - this.itemsPerPage - 1, {
|
|
1832
|
+
scroll: t,
|
|
1833
|
+
scrollOptions: e
|
|
1834
|
+
}) : this.activateItem(this.dom.carouselItems.length - 1, {
|
|
1835
|
+
scroll: t,
|
|
1836
|
+
scrollOptions: e
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
activateNextItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1840
|
+
this.loop ? this.activateItem(this.currentItem + 1, {
|
|
1841
|
+
scroll: t,
|
|
1842
|
+
scrollOptions: e
|
|
1843
|
+
}) : this.currentItem + 1 >= this.dom.carouselItems.length ? this.activateFirstItem({
|
|
1844
|
+
scroll: t,
|
|
1845
|
+
scrollOptions: e
|
|
1846
|
+
}) : this.activateItem(this.currentItem + 1, {
|
|
1847
|
+
scroll: t,
|
|
1848
|
+
scrollOptions: e
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
activatePreviousItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1852
|
+
this.loop ? this.activateItem(this.currentItem - 1, {
|
|
1853
|
+
scroll: t,
|
|
1854
|
+
scrollOptions: e
|
|
1855
|
+
}) : this.currentItem - 1 < 0 || this.loop && this.currentItem - 1 < this.itemsPerPage ? this.activateLastItem({
|
|
1856
|
+
scroll: t,
|
|
1857
|
+
scrollOptions: e
|
|
1858
|
+
}) : this.activateItem(this.currentItem - 1, {
|
|
1859
|
+
scroll: t,
|
|
1860
|
+
scrollOptions: e
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
toggleAutoplay() {
|
|
1864
|
+
this.autoplay = !this.autoplay, this._handleAutoplay();
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
const ft = (t = {}, e = document, s = ".carousel") => {
|
|
1868
|
+
b("graupl-carousel-generator", s, e).forEach((i) => {
|
|
1869
|
+
const o = i.dataset.grauplCarouselOptions ? JSON.parse(i.dataset.grauplCarouselOptions.replace(/'/g, "\"")) || {} : {};
|
|
1870
|
+
new _t({
|
|
1871
|
+
carouselElement: i,
|
|
1872
|
+
initialize: !0,
|
|
1873
|
+
...t,
|
|
1874
|
+
...o
|
|
1305
1875
|
});
|
|
1876
|
+
});
|
|
1877
|
+
};
|
|
1878
|
+
var gt = class extends w {
|
|
1879
|
+
_rootDOMElement = "disclosure";
|
|
1880
|
+
_protectedDOMElements = ["controller"];
|
|
1881
|
+
_open = new x(!1);
|
|
1882
|
+
_locked = new x(!1);
|
|
1883
|
+
_openInsideBreakpoint = !1;
|
|
1884
|
+
_openOutsideBreakpoint = !1;
|
|
1885
|
+
_closeInsideBreakpoint = !1;
|
|
1886
|
+
_closeOutsideBreakpoint = !1;
|
|
1887
|
+
_lockInsideBreakpoint = !1;
|
|
1888
|
+
_lockOutsideBreakpoint = !1;
|
|
1889
|
+
_unlockInsideBreakpoint = !1;
|
|
1890
|
+
_unlockOutsideBreakpoint = !1;
|
|
1891
|
+
_openOnFocus = !1;
|
|
1892
|
+
_closeOnBlur = !1;
|
|
1893
|
+
_storageKey = "disclosures";
|
|
1894
|
+
_name = "Disclosure";
|
|
1895
|
+
_mediaQueryListEventCallback = (t) => {
|
|
1896
|
+
t.matches ? (this.unlockInsideBreakpoint && this.unlock(), this.isOpen && this.closeInsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openInsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockInsideBreakpoint && this.lock()) : (this.unlockOutsideBreakpoint && this.unlock(), this.isOpen && this.closeOutsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openOutsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockOutsideBreakpoint && this.lock());
|
|
1897
|
+
};
|
|
1898
|
+
constructor({ disclosureElement: t, controllerElement: e, disclosureContentSelector: s = ".disclosure-content", lockedClass: i = "locked", unlockedClass: o = "unlocked", openClass: r = "show", closeClass: c = "hide", transitionClass: m = "transitioning", transitionDuration: _ = 250, openDuration: k = -1, closeDuration: C = -1, openOnFocus: y = !1, closeOnBlur: E = !1, minWidth: f = "", breakpoint: g = "", autoOpen: p = !1, openInsideBreakpoint: O = !1, openOutsideBreakpoint: D = !1, closeInsideBreakpoint: T = !1, closeOutsideBreakpoint: v = !1, lockInsideBreakpoint: A = !1, lockOutsideBreakpoint: B = !1, unlockInsideBreakpoint: $ = !1, unlockOutsideBreakpoint: I = !1, locked: M = !1, mediaQuery: S = "", prefix: H = "graupl-", key: R = null, initializeClass: G = "initializing", initialize: J = !1 } = {}) {
|
|
1899
|
+
super({
|
|
1900
|
+
prefix: H,
|
|
1901
|
+
key: R,
|
|
1902
|
+
initializeClass: G
|
|
1903
|
+
}), this._dom.disclosure = t, this._dom.controller = e, this._selectors.content = s, this._classes.locked = i || "", this._classes.unlocked = o || "", this._classes.open = r || "", this._classes.close = c || "", this._classes.transition = m || "", this._durations.transition = _, this._durations.open = k, this._durations.close = C, this._openOnFocus = y, this._closeOnBlur = E, f !== "" && (console.warn("`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead."), g === "" && (g = f)), p && g !== "" && (console.warn("`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead."), D = p, T = p), this._breakpoint = g || "", this._openInsideBreakpoint = O, this._openOutsideBreakpoint = D, this._closeInsideBreakpoint = T, this._closeOutsideBreakpoint = v, this._lockInsideBreakpoint = A, this._lockOutsideBreakpoint = B, this._unlockInsideBreakpoint = $, this._unlockOutsideBreakpoint = I, this._mediaQueryString = S || "", this._locked.value = M, this._locked.commit(), this._registerEvent("expand", { detail: { disclosure: this } }), this._registerEvent("collapse", { detail: { disclosure: this } }), this._registerEvent("lock", { detail: { disclosure: this } }), this._registerEvent("unlock", { detail: { disclosure: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1904
|
+
requestAnimationFrame(() => {
|
|
1905
|
+
this.dom.controller.getAttribute("aria-expanded") === "true" || this.openOutsideBreakpoint && !window.matchMedia(this.mediaQuery).matches || this.openInsideBreakpoint && window.matchMedia(this.mediaQuery).matches ? this.open({ force: !0 }) : this.close({ force: !0 }), this.isLocked || this.lockInsideBreakpoint && window.matchMedia(this.mediaQuery).matches || this.lockOutsideBreakpoint && !window.matchMedia(this.mediaQuery).matches ? this.lock({ force: !0 }) : this.unlock({ force: !0 });
|
|
1906
|
+
});
|
|
1907
|
+
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1908
|
+
const q = n("boolean", {
|
|
1909
|
+
openOnFocus: this._openOnFocus,
|
|
1910
|
+
closeOnBlur: this._closeOnBlur,
|
|
1911
|
+
openInsideBreakpoint: this._openInsideBreakpoint,
|
|
1912
|
+
openOutsideBreakpoint: this._openOutsideBreakpoint,
|
|
1913
|
+
closeInsideBreakpoint: this._closeInsideBreakpoint,
|
|
1914
|
+
closeOutsideBreakpoint: this._closeOutsideBreakpoint,
|
|
1915
|
+
lockInsideBreakpoint: this._lockInsideBreakpoint,
|
|
1916
|
+
lockOutsideBreakpoint: this._lockOutsideBreakpoint,
|
|
1917
|
+
unlockInsideBreakpoint: this._unlockInsideBreakpoint,
|
|
1918
|
+
unlockOutsideBreakpoint: this._unlockOutsideBreakpoint,
|
|
1919
|
+
locked: this._locked.value
|
|
1920
|
+
}, { shouldThrow: !1 });
|
|
1921
|
+
q.status || (this._errors = [...this._errors, ...q.errors], this._valid = !1);
|
|
1922
|
+
}), J && this.initialize();
|
|
1923
|
+
}
|
|
1924
|
+
get lockedClass() {
|
|
1925
|
+
return this._classes.locked;
|
|
1926
|
+
}
|
|
1927
|
+
set lockedClass(t) {
|
|
1928
|
+
u({ lockedClass: t }), this._classes.locked !== t && (this._classes.locked = t);
|
|
1929
|
+
}
|
|
1930
|
+
get unlockedClass() {
|
|
1931
|
+
return this._classes.unlocked;
|
|
1932
|
+
}
|
|
1933
|
+
set unlockedClass(t) {
|
|
1934
|
+
u({ unlockedClass: t }), this._classes.unlocked !== t && (this._classes.unlocked = t);
|
|
1935
|
+
}
|
|
1936
|
+
get openClass() {
|
|
1937
|
+
return this._classes.open;
|
|
1938
|
+
}
|
|
1939
|
+
set openClass(t) {
|
|
1940
|
+
u({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
1941
|
+
}
|
|
1942
|
+
get closeClass() {
|
|
1943
|
+
return this._classes.close;
|
|
1944
|
+
}
|
|
1945
|
+
set closeClass(t) {
|
|
1946
|
+
u({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
1947
|
+
}
|
|
1948
|
+
get transitionClass() {
|
|
1949
|
+
return this._classes.transition;
|
|
1950
|
+
}
|
|
1951
|
+
set transitionClass(t) {
|
|
1952
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1953
|
+
}
|
|
1954
|
+
get transitionDuration() {
|
|
1955
|
+
return this._durations.transition;
|
|
1956
|
+
}
|
|
1957
|
+
set transitionDuration(t) {
|
|
1958
|
+
n("number", { transitionDuration: t }), this._durations.transition !== t && (this._durations.transition = t, this._setCustomProps());
|
|
1959
|
+
}
|
|
1960
|
+
get openDuration() {
|
|
1961
|
+
return this._durations.open === -1 ? this.transitionDuration : this._durations.open;
|
|
1962
|
+
}
|
|
1963
|
+
set openDuration(t) {
|
|
1964
|
+
n("number", { openDuration: t }), this._durations.open !== t && (this._durations.open = t, this._setCustomProps());
|
|
1965
|
+
}
|
|
1966
|
+
get closeDuration() {
|
|
1967
|
+
return this._durations.close === -1 ? this.transitionDuration : this._durations.close;
|
|
1968
|
+
}
|
|
1969
|
+
set closeDuration(t) {
|
|
1970
|
+
n("number", { closeDuration: t }), this._durations.close !== t && (this._durations.close = t, this._setCustomProps());
|
|
1971
|
+
}
|
|
1972
|
+
get openOnFocus() {
|
|
1973
|
+
return this._openOnFocus;
|
|
1974
|
+
}
|
|
1975
|
+
set openOnFocus(t) {
|
|
1976
|
+
n("boolean", { openOnFocus: t }), this._openOnFocus !== t && (this._openOnFocus = t);
|
|
1977
|
+
}
|
|
1978
|
+
get closeOnBlur() {
|
|
1979
|
+
return this._closeOnBlur;
|
|
1980
|
+
}
|
|
1981
|
+
set closeOnBlur(t) {
|
|
1982
|
+
n("boolean", { closeOnBlur: t }), this._closeOnBlur !== t && (this._closeOnBlur = t);
|
|
1983
|
+
}
|
|
1984
|
+
get isOpen() {
|
|
1985
|
+
return this._open.value;
|
|
1986
|
+
}
|
|
1987
|
+
get hasOpened() {
|
|
1988
|
+
return this._open.committed;
|
|
1989
|
+
}
|
|
1990
|
+
get openInsideBreakpoint() {
|
|
1991
|
+
return this._openInsideBreakpoint;
|
|
1992
|
+
}
|
|
1993
|
+
set openInsideBreakpoint(t) {
|
|
1994
|
+
n("boolean", { openInsideBreakpoint: t }), this._openInsideBreakpoint !== t && (this._openInsideBreakpoint = t);
|
|
1995
|
+
}
|
|
1996
|
+
get openOutsideBreakpoint() {
|
|
1997
|
+
return this._openOutsideBreakpoint;
|
|
1998
|
+
}
|
|
1999
|
+
set openOutsideBreakpoint(t) {
|
|
2000
|
+
n("boolean", { openOutsideBreakpoint: t }), this._openOutsideBreakpoint !== t && (this._openOutsideBreakpoint = t);
|
|
2001
|
+
}
|
|
2002
|
+
get closeInsideBreakpoint() {
|
|
2003
|
+
return this._closeInsideBreakpoint;
|
|
2004
|
+
}
|
|
2005
|
+
set closeInsideBreakpoint(t) {
|
|
2006
|
+
n("boolean", { closeInsideBreakpoint: t }), this._closeInsideBreakpoint !== t && (this._closeInsideBreakpoint = t);
|
|
2007
|
+
}
|
|
2008
|
+
get closeOutsideBreakpoint() {
|
|
2009
|
+
return this._closeOutsideBreakpoint;
|
|
2010
|
+
}
|
|
2011
|
+
set closeOutsideBreakpoint(t) {
|
|
2012
|
+
n("boolean", { closeOutsideBreakpoint: t }), this._closeOutsideBreakpoint !== t && (this._closeOutsideBreakpoint = t);
|
|
2013
|
+
}
|
|
2014
|
+
get lockInsideBreakpoint() {
|
|
2015
|
+
return this._lockInsideBreakpoint;
|
|
2016
|
+
}
|
|
2017
|
+
set lockInsideBreakpoint(t) {
|
|
2018
|
+
n("boolean", { lockInsideBreakpoint: t }), this._lockInsideBreakpoint !== t && (this._lockInsideBreakpoint = t);
|
|
2019
|
+
}
|
|
2020
|
+
get lockOutsideBreakpoint() {
|
|
2021
|
+
return this._lockOutsideBreakpoint;
|
|
1306
2022
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
this.autoplay && this._clearInterval();
|
|
1310
|
-
}), this._addEventListener("pointerleave", this.dom.carousel, () => {
|
|
1311
|
-
this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1312
|
-
});
|
|
2023
|
+
set lockOutsideBreakpoint(t) {
|
|
2024
|
+
n("boolean", { lockOutsideBreakpoint: t }), this._lockOutsideBreakpoint !== t && (this._lockOutsideBreakpoint = t);
|
|
1313
2025
|
}
|
|
1314
|
-
|
|
1315
|
-
this.
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
2026
|
+
get isLocked() {
|
|
2027
|
+
return this._locked.value;
|
|
2028
|
+
}
|
|
2029
|
+
get shouldBeLocked() {
|
|
2030
|
+
return this._locked.committed;
|
|
2031
|
+
}
|
|
2032
|
+
_setIds() {
|
|
2033
|
+
this.dom.disclosure.id = this.dom.disclosure.id || `disclosure-${this.key}`, this.dom.controller.id = this.dom.controller.id || `disclosure-controller-${this.key}`, this._id = this.dom.disclosure.id;
|
|
2034
|
+
}
|
|
2035
|
+
_setAriaAttributes() {
|
|
2036
|
+
this.dom.controller.getAttribute("aria-expanded") !== "true" && this.dom.controller.setAttribute("aria-expanded", "false"), this.dom.controller.setAttribute("aria-controls", this.dom.disclosure.id), z("button", { controller: this.dom.controller }, { shouldThrow: !1 }).status || this.dom.controller.setAttribute("role", "button");
|
|
2037
|
+
}
|
|
2038
|
+
_setCustomProps() {
|
|
2039
|
+
this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-transition-duration`, `${this.transitionDuration}ms`), this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-open-transition-duration`, `${this.openDuration}ms`), this.dom.disclosure.style.setProperty(`--${this.prefix}disclosure-close-transition-duration`, `${this.closeDuration}ms`);
|
|
2040
|
+
}
|
|
2041
|
+
_setDOMElements() {
|
|
2042
|
+
this._resetDOMElementType("content"), this._setDOMElementType("content", { context: this.dom.disclosure });
|
|
2043
|
+
}
|
|
2044
|
+
_reveal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
2045
|
+
this.dom.controller.setAttribute("aria-expanded", "true"), e && this.transitionlass !== "" ? (a(this.transitionClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2046
|
+
l(this.closeClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2047
|
+
a(this.openClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2048
|
+
setTimeout(() => {
|
|
2049
|
+
l(this.transitionClass, this.dom.disclosure);
|
|
2050
|
+
}, this.openDuration);
|
|
2051
|
+
});
|
|
1323
2052
|
});
|
|
1324
|
-
}), this.
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
2053
|
+
})) : (a(this.openClass, this.dom.disclosure), l(this.closeClass, this.dom.disclosure)), this.dom.content.removeAttribute("inert"), t && this._dispatchEvent("expand", this.dom.controller);
|
|
2054
|
+
}
|
|
2055
|
+
_conceal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
2056
|
+
this.dom.controller.setAttribute("aria-expanded", "false"), e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2057
|
+
l(this.openClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2058
|
+
a(this.closeClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
2059
|
+
setTimeout(() => {
|
|
2060
|
+
l(this.transitionClass, this.dom.disclosure), this.dom.content.innert = !0;
|
|
2061
|
+
}, this.closeDuration);
|
|
2062
|
+
});
|
|
1332
2063
|
});
|
|
2064
|
+
})) : (a(this.closeClass, this.dom.disclosure), l(this.openClass, this.dom.disclosure)), this.dom.content.setAttribute("inert", "true"), t && this._dispatchEvent("collapse", this.dom.controller);
|
|
2065
|
+
}
|
|
2066
|
+
_lock({ emit: t = this.isInitialized } = {}) {
|
|
2067
|
+
a(this.lockedClass, this.dom.disclosure), l(this.unlockedClass, this.dom.disclosure), this.dom.controller.setAttribute("disabled", "true"), t && this._dispatchEvent("lock", this.dom.disclosure);
|
|
2068
|
+
}
|
|
2069
|
+
_unlock({ emit: t = this.isInitialized } = {}) {
|
|
2070
|
+
a(this.unlockedClass, this.dom.disclosure), l(this.lockedClass, this.dom.disclosure), this.dom.controller.removeAttribute("disabled"), t && this._dispatchEvent("unlock", this.dom.disclosure);
|
|
2071
|
+
}
|
|
2072
|
+
_handleFocus() {
|
|
2073
|
+
this._addEventListener("focusout", this.dom.disclosure, (t) => {
|
|
2074
|
+
!this.closeOnBlur || this.currentEvent !== "keyboard" || t.relatedTarget === null || this.dom.disclosure.contains(t.relatedTarget) || this.dom.controller.contains(t.relatedTarget) || this.dom.controller === t.relatedTarget || this.dom.disclosure === t.relatedTarget || this.close();
|
|
2075
|
+
}), this._addEventListener("focusout", this.dom.controller, (t) => {
|
|
2076
|
+
!this.closeOnBlur || this.currentEvent !== "keyboard" || t.relatedTarget === null || this.dom.disclosure.contains(t.relatedTarget) || this.dom.controller.contains(t.relatedTarget) || this.dom.controller === t.relatedTarget || this.dom.disclosure === t.relatedTarget || this.close();
|
|
1333
2077
|
});
|
|
1334
2078
|
}
|
|
1335
|
-
|
|
1336
|
-
this._addEventListener("
|
|
1337
|
-
|
|
2079
|
+
_handleClick() {
|
|
2080
|
+
this._addEventListener("click", this.dom.controller, (t) => {
|
|
2081
|
+
this.currentEvent = "mouse", t.button === 0 && (h(t), this.toggle());
|
|
2082
|
+
}), this._addEventListener("click", document, (t) => {
|
|
2083
|
+
this.focusState !== "self" || !this.closeOnBlur || (this.currentEvent = "mouse", !this.dom.disclosure.contains(t.target) && this.dom.controller !== t.target && this.close());
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
_handleKeydown() {
|
|
2087
|
+
this._addEventListener("keydown", this.dom.controller, (t) => {
|
|
2088
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1338
2089
|
case "Space":
|
|
1339
2090
|
case "Enter":
|
|
1340
|
-
|
|
2091
|
+
h(t);
|
|
1341
2092
|
break;
|
|
1342
2093
|
}
|
|
1343
|
-
}), this._addEventListener("
|
|
1344
|
-
|
|
2094
|
+
}), this._addEventListener("keydown", this.dom.disclosure, (t) => {
|
|
2095
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && h(t);
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
_handleKeyup() {
|
|
2099
|
+
this._addEventListener("keyup", this.dom.controller, (t) => {
|
|
2100
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1345
2101
|
case "Space":
|
|
1346
2102
|
case "Enter":
|
|
1347
|
-
this.
|
|
2103
|
+
this.toggle(), h(t);
|
|
1348
2104
|
break;
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
switch (d(t)) {
|
|
1352
|
-
case "Space":
|
|
1353
|
-
case "Enter":
|
|
1354
|
-
this.toggleAutoplay(), a(t);
|
|
2105
|
+
case "Tab":
|
|
2106
|
+
this.openOnFocus && (h(t), this.open());
|
|
1355
2107
|
break;
|
|
1356
2108
|
}
|
|
1357
|
-
}), this.
|
|
1358
|
-
|
|
1359
|
-
switch (d(e)) {
|
|
1360
|
-
case "Space":
|
|
1361
|
-
case "Enter":
|
|
1362
|
-
this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)), a(e);
|
|
1363
|
-
break;
|
|
1364
|
-
}
|
|
1365
|
-
});
|
|
1366
|
-
});
|
|
1367
|
-
}
|
|
1368
|
-
_handleLoop() {
|
|
1369
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = this.dom.carouselItemContainer;
|
|
1370
|
-
for (let s = 0; s < this.itemsPerPage; s++) t.set(this.dom.carouselItems[s], this.dom.carouselItems.indexOf(this.dom.carouselItems[s]));
|
|
1371
|
-
for (let s = this.dom.carouselItems.length - this.itemsPerPage; s < this.dom.carouselItems.length; s++) e.set(this.dom.carouselItems[s], this.dom.carouselItems.indexOf(this.dom.carouselItems[s]));
|
|
1372
|
-
t.forEach((s, o) => {
|
|
1373
|
-
const r = o.cloneNode(!0);
|
|
1374
|
-
r.setAttribute("aria-hidden", "true"), r.setAttribute("inert", "true"), r.setAttribute("id", `${o.id}-clone`), i.appendChild(r);
|
|
1375
|
-
const l = new V({
|
|
1376
|
-
carouselItemElement: r,
|
|
1377
|
-
clone: this._elements.carouselItems[s],
|
|
1378
|
-
parent: this,
|
|
1379
|
-
prefix: this.prefix,
|
|
1380
|
-
initializeClass: this.classes.initialize,
|
|
1381
|
-
initialize: !0
|
|
1382
|
-
});
|
|
1383
|
-
this.dom.carouselItems.push(r), this._elements.carouselItems.push(l);
|
|
1384
|
-
}), e.forEach((s, o) => {
|
|
1385
|
-
const r = o.cloneNode(!0);
|
|
1386
|
-
r.setAttribute("aria-hidden", "true"), r.setAttribute("inert", "true"), r.setAttribute("id", `${o.id}-clone`), i.insertBefore(r, i.firstChild);
|
|
1387
|
-
const l = new V({
|
|
1388
|
-
carouselItemElement: r,
|
|
1389
|
-
clone: this._elements.carouselItems[s],
|
|
1390
|
-
parent: this,
|
|
1391
|
-
prefix: this.prefix,
|
|
1392
|
-
initializeClass: this.classes.initialize,
|
|
1393
|
-
initialize: !0
|
|
1394
|
-
});
|
|
1395
|
-
this.dom.carouselItems.unshift(r), this._elements.carouselItems.unshift(l);
|
|
2109
|
+
}), this._addEventListener("keyup", this.dom.disclosure, (t) => {
|
|
2110
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && (this.close(), h(t));
|
|
1396
2111
|
});
|
|
1397
2112
|
}
|
|
1398
|
-
|
|
1399
|
-
this.
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
});
|
|
2113
|
+
open({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
2114
|
+
this.isOpen && !t || this.isLocked && !t || (this.focusState = "self", this._reveal({
|
|
2115
|
+
emit: e,
|
|
2116
|
+
transition: s
|
|
2117
|
+
}), this._open.value = !0, i || this._open.commit());
|
|
1403
2118
|
}
|
|
1404
|
-
|
|
1405
|
-
this.
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
});
|
|
2119
|
+
preview({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
2120
|
+
this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._reveal({
|
|
2121
|
+
emit: e,
|
|
2122
|
+
transition: s
|
|
2123
|
+
}), this._open.value = !0, i || this._open.commit());
|
|
1409
2124
|
}
|
|
1410
|
-
|
|
1411
|
-
this.
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
}), this.
|
|
1415
|
-
scroll: e,
|
|
1416
|
-
scrollOptions: i
|
|
1417
|
-
}), this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
2125
|
+
close({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
2126
|
+
!this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._conceal({
|
|
2127
|
+
emit: e,
|
|
2128
|
+
transition: s
|
|
2129
|
+
}), this._open.value = !1, i || this._open.commit());
|
|
1418
2130
|
}
|
|
1419
|
-
|
|
1420
|
-
this.
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
2131
|
+
toggle({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
2132
|
+
this.isOpen ? this.close({
|
|
2133
|
+
force: t,
|
|
2134
|
+
emit: e,
|
|
2135
|
+
transition: s,
|
|
2136
|
+
preserveState: i
|
|
2137
|
+
}) : this.open({
|
|
2138
|
+
force: t,
|
|
2139
|
+
emit: e,
|
|
2140
|
+
transition: s,
|
|
2141
|
+
preserveState: i
|
|
1429
2142
|
});
|
|
1430
2143
|
}
|
|
1431
|
-
|
|
1432
|
-
this.
|
|
1433
|
-
scroll: t,
|
|
1434
|
-
scrollOptions: e
|
|
1435
|
-
}) : this.activateItem(this.dom.carouselItems.length - this.itemsPerPage - 1, {
|
|
1436
|
-
scroll: t,
|
|
1437
|
-
scrollOptions: e
|
|
1438
|
-
}) : this.activateItem(this.dom.carouselItems.length - 1, {
|
|
1439
|
-
scroll: t,
|
|
1440
|
-
scrollOptions: e
|
|
1441
|
-
});
|
|
2144
|
+
lock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
2145
|
+
this.isLocked && !t || (this._locked.value = !0, this._lock({ emit: e }), s || this._locked.commit());
|
|
1442
2146
|
}
|
|
1443
|
-
|
|
1444
|
-
this.
|
|
1445
|
-
scroll: t,
|
|
1446
|
-
scrollOptions: e
|
|
1447
|
-
}) : this.currentItem + 1 >= this.dom.carouselItems.length ? this.activateFirstItem({
|
|
1448
|
-
scroll: t,
|
|
1449
|
-
scrollOptions: e
|
|
1450
|
-
}) : this.activateItem(this.currentItem + 1, {
|
|
1451
|
-
scroll: t,
|
|
1452
|
-
scrollOptions: e
|
|
1453
|
-
});
|
|
2147
|
+
unlock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
2148
|
+
!this.isLocked && !t || (this._locked.value = !1, this._unlock({ emit: e }), s || this._locked.commit());
|
|
1454
2149
|
}
|
|
1455
|
-
|
|
1456
|
-
this.
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
scrollOptions: e
|
|
2150
|
+
toggleLock({ force: t = !1, emit: e = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
2151
|
+
this.isLocked ? this.unlock({
|
|
2152
|
+
force: t,
|
|
2153
|
+
emit: e,
|
|
2154
|
+
preserveState: s
|
|
2155
|
+
}) : this.lock({
|
|
2156
|
+
force: t,
|
|
2157
|
+
emit: e,
|
|
2158
|
+
preserveState: s
|
|
1465
2159
|
});
|
|
1466
2160
|
}
|
|
1467
|
-
toggleAutoplay() {
|
|
1468
|
-
this.autoplay = !this.autoplay, this._handleAutoplay();
|
|
1469
|
-
}
|
|
1470
2161
|
};
|
|
1471
|
-
const
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
|
|
2162
|
+
const bt = ({ options: t = {}, context: e = document, disclosureSelector: s = ".disclosure", controllerSelector: i = ".disclosure-toggle" } = {}) => {
|
|
2163
|
+
b("graupl-disclosure-generator", s, e).forEach((o) => {
|
|
2164
|
+
const r = o.dataset.grauplDisclosureOptions ? JSON.parse(o.dataset.grauplDisclosureOptions.replace(/'/g, "\"")) || {} : {}, c = `${i}[data-graupl-disclosure-target="${o.id}"]`, [m] = b("graupl-disclosure-generator", c, e);
|
|
2165
|
+
if (!m) {
|
|
2166
|
+
console.warn(`No controller found for disclosure with ID "${o.id}". Please ensure there is an element with the selector "${c}".`), b.remove("graupl-disclosure-generator", o);
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
new gt({
|
|
2170
|
+
disclosureElement: o,
|
|
2171
|
+
controllerElement: m,
|
|
1476
2172
|
initialize: !0,
|
|
1477
2173
|
...t,
|
|
1478
|
-
...
|
|
2174
|
+
...r
|
|
1479
2175
|
});
|
|
1480
2176
|
});
|
|
1481
|
-
},
|
|
1482
|
-
|
|
1483
|
-
const o =
|
|
2177
|
+
}, kt = (t = {}, e = document, s = ".navigation") => {
|
|
2178
|
+
b("graupl-navigation-generator", s, e).forEach((i) => {
|
|
2179
|
+
const o = i.dataset.grauplMenuType || DisclosureMenu;
|
|
1484
2180
|
if (window[o] === void 0) {
|
|
1485
2181
|
console.warn(`Graupl navigation requires accessible-menu's ${o}. Please make sure to include it on this page.`);
|
|
1486
2182
|
return;
|
|
1487
2183
|
}
|
|
1488
|
-
const r =
|
|
2184
|
+
const r = i.dataset.grauplMenuOptions ? JSON.parse(i.dataset.grauplMenuOptions.replace(/'/g, "\"")) || {} : {}, c = i.querySelector(".menu"), m = i.querySelector(".navigation-toggle") || null, _ = m ? i : null;
|
|
1489
2185
|
new window[o]({
|
|
1490
|
-
menuElement:
|
|
2186
|
+
menuElement: c,
|
|
1491
2187
|
menuItemSelector: ".menu-item",
|
|
1492
2188
|
menuLinkSelector: ".menu-link",
|
|
1493
2189
|
submenuItemSelector: ".submenu-item",
|
|
1494
2190
|
submenuToggleSelector: ".submenu-toggle",
|
|
1495
|
-
controllerElement:
|
|
1496
|
-
containerElement:
|
|
2191
|
+
controllerElement: m,
|
|
2192
|
+
containerElement: _,
|
|
1497
2193
|
...t,
|
|
1498
2194
|
...r
|
|
1499
2195
|
});
|
|
1500
2196
|
});
|
|
1501
2197
|
};
|
|
1502
|
-
var
|
|
1503
|
-
_rootDOMElement = "
|
|
1504
|
-
_protectedDOMElements = ["
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
_closeInsideBreakpoint = !1;
|
|
1510
|
-
_closeOutsideBreakpoint = !1;
|
|
1511
|
-
_lockInsideBreakpoint = !1;
|
|
1512
|
-
_lockOutsideBreakpoint = !1;
|
|
1513
|
-
_unlockInsideBreakpoint = !1;
|
|
1514
|
-
_unlockOutsideBreakpoint = !1;
|
|
1515
|
-
_openOnFocus = !1;
|
|
1516
|
-
_closeOnBlur = !1;
|
|
1517
|
-
_storageKey = "disclosures";
|
|
1518
|
-
_name = "Disclosure";
|
|
1519
|
-
_mediaQueryListEventCallback = (t) => {
|
|
1520
|
-
t.matches ? (this.unlockInsideBreakpoint && this.unlock(), this.isOpen && this.closeInsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openInsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockInsideBreakpoint && this.lock()) : (this.unlockOutsideBreakpoint && this.unlock(), this.isOpen && this.closeOutsideBreakpoint ? (this.isLocked && this.unlock(), this.close({ preserveState: !0 })) : !this.isOpen && this.openOutsideBreakpoint && (this.isLocked && this.unlock(), this.open()), this.lockOutsideBreakpoint && this.lock());
|
|
1521
|
-
};
|
|
1522
|
-
constructor({ disclosureElement: t, controllerElement: e, disclosureContentSelector: i = ".disclosure-content", lockedClass: s = "locked", unlockedClass: o = "unlocked", openClass: r = "show", closeClass: l = "hide", transitionClass: u = "transitioning", transitionDuration: f = 250, openDuration: C = -1, closeDuration: E = -1, openOnFocus: b = !1, closeOnBlur: I = !1, minWidth: g = "", breakpoint: y = "", autoOpen: w = !1, openInsideBreakpoint: T = !1, openOutsideBreakpoint: v = !1, closeInsideBreakpoint: A = !1, closeOutsideBreakpoint: x = !1, lockInsideBreakpoint: $ = !1, lockOutsideBreakpoint: M = !1, unlockInsideBreakpoint: S = !1, unlockOutsideBreakpoint: p = !1, locked: P = !1, mediaQuery: F = "", prefix: dt = "graupl-", key: ut = null, initializeClass: mt = "initializing", initialize: pt = !1 } = {}) {
|
|
2198
|
+
var Ct = class extends w {
|
|
2199
|
+
_rootDOMElement = "toggle";
|
|
2200
|
+
_protectedDOMElements = ["content"];
|
|
2201
|
+
_storageKey = "tabToggles";
|
|
2202
|
+
_shouldStore = !1;
|
|
2203
|
+
_active = new x(!1);
|
|
2204
|
+
constructor({ toggleElement: t, contentElement: e, parentTab: s } = {}) {
|
|
1523
2205
|
super({
|
|
1524
|
-
prefix:
|
|
1525
|
-
key:
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
2206
|
+
prefix: s.prefix,
|
|
2207
|
+
key: s.key
|
|
2208
|
+
}), this._dom.toggle = t, this._dom.content = e, this._elements.parent = s, this._registerEvent("activate", { detail: { toggle: this } }), this._registerEvent("deactivate", { detail: { toggle: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
2209
|
+
this.dom.toggle.getAttribute("aria-selected") === "true" ? this.show({
|
|
2210
|
+
force: !0,
|
|
2211
|
+
emit: !1,
|
|
2212
|
+
transition: !1
|
|
2213
|
+
}) : this.hide({
|
|
2214
|
+
force: !0,
|
|
2215
|
+
emit: !1,
|
|
2216
|
+
transition: !1
|
|
1530
2217
|
});
|
|
1531
|
-
})
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
get isActive() {
|
|
2221
|
+
return this._active.value;
|
|
2222
|
+
}
|
|
2223
|
+
_setIds() {
|
|
2224
|
+
const { key: t } = this.elements.parent, e = this.elements.parent.dom.tabToggles.indexOf(this.dom.toggle);
|
|
2225
|
+
this.dom.toggle.id = this.dom.toggle.id || `tab-toggle-${t}-${e}`, this.dom.content.id = this.dom.content.id || `tab-content-${t}-${e}`, this._id = this.dom.toggle.id;
|
|
2226
|
+
}
|
|
2227
|
+
_setAriaAttributes() {
|
|
2228
|
+
this.dom.toggle.setAttribute("role", "tab"), this.dom.toggle.getAttribute("aria-selected") !== "true" && this.dom.toggle.setAttribute("aria-selected", "false"), this.dom.toggle.setAttribute("aria-controls", this.dom.content.id), this.dom.content.setAttribute("role", "tabpanel");
|
|
2229
|
+
}
|
|
2230
|
+
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
2231
|
+
const { closeClass: s, openClass: i, transitionClass: o, openDuration: r } = this.elements.parent;
|
|
2232
|
+
this.dom.toggle.setAttribute("aria-selected", "true"), e && o !== "" ? (a(o, this.dom.content), requestAnimationFrame(() => {
|
|
2233
|
+
l(s, this.dom.content), requestAnimationFrame(() => {
|
|
2234
|
+
a(i, this.dom.content), requestAnimationFrame(() => {
|
|
2235
|
+
this._setTimeout(() => l(o, this.dom.content), r);
|
|
2236
|
+
});
|
|
2237
|
+
});
|
|
2238
|
+
})) : (a(i, this.dom.content), l(s, this.dom.content)), t && this._dispatchEvent("activate", this.dom.toggle);
|
|
2239
|
+
}
|
|
2240
|
+
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
2241
|
+
const { closeClass: s, openClass: i, transitionClass: o, closeDuration: r } = this.elements.parent;
|
|
2242
|
+
this.dom.toggle.setAttribute("aria-selected", "false"), e && o !== "" ? (a(o, this.dom.content), requestAnimationFrame(() => {
|
|
2243
|
+
l(i, this.dom.content), requestAnimationFrame(() => {
|
|
2244
|
+
a(s, this.dom.content), requestAnimationFrame(() => {
|
|
2245
|
+
this._setTimeout(() => l(o, this.dom.content), r);
|
|
2246
|
+
});
|
|
2247
|
+
});
|
|
2248
|
+
})) : (a(s, this.dom.content), l(i, this.dom.content)), t && this._dispatchEvent("deactivate", this.dom.toggle);
|
|
1547
2249
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
2250
|
+
show({ force: t = !1, preserveState: e = !1, emit: s = !0, transition: i = !0 } = {}) {
|
|
2251
|
+
this.isActive && !t || (this.elements.parent.focusState = "self", this._reveal({
|
|
2252
|
+
emit: s,
|
|
2253
|
+
transition: i
|
|
2254
|
+
}), this._active.value = !0, e || this._active.commit(), this.dom.toggle.setAttribute("tabindex", "0"), this.hideSiblings());
|
|
1550
2255
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
2256
|
+
hide({ force: t = !1, preserveState: e = !1, emit: s = !0, transition: i = !0 } = {}) {
|
|
2257
|
+
!this.isActive && !t || (this.elements.parent.focusState = "none", this._conceal({
|
|
2258
|
+
emit: s,
|
|
2259
|
+
transition: i
|
|
2260
|
+
}), this._active.value = !1, e || this._active.commit(), this.dom.toggle.setAttribute("tabindex", "-1"));
|
|
1553
2261
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
2262
|
+
focus() {
|
|
2263
|
+
this.dom.toggle.focus();
|
|
1556
2264
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
2265
|
+
blur() {
|
|
2266
|
+
this.dom.toggle.blur();
|
|
2267
|
+
}
|
|
2268
|
+
hideSiblings() {
|
|
2269
|
+
this.elements.parent && this.elements.parent.elements.tabToggles.forEach((t) => {
|
|
2270
|
+
t !== this && t.hide();
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
}, yt = class extends w {
|
|
2274
|
+
_rootDOMElement = "tabs";
|
|
2275
|
+
_automatic = !1;
|
|
2276
|
+
_currentChild = 0;
|
|
2277
|
+
_storageKey = "tabs";
|
|
2278
|
+
constructor({ tabsElement: t, tabListSelector: e = ".tab-list", tabTogglesSelector: s = ".tab-toggle", tabContentsSelector: i = ".tab-content", openClass: o = "show", closeClass: r = "hide", transitionClass: c = null, transitionDuration: m = 300, openDuration: _ = -1, closeDuration: k = -1, automaticActivation: C = !1, prefix: y = "graupl-", key: E = null, initializeClass: f = "initializing", initialize: g = !1 }) {
|
|
2279
|
+
super({
|
|
2280
|
+
prefix: y,
|
|
2281
|
+
key: E,
|
|
2282
|
+
initializeClass: f
|
|
2283
|
+
}), this._dom.tabs = t, this._dom.tabList = null, this._dom.tabToggles = [], this._dom.tabContents = [], this._selectors.tabList = e, this._selectors.tabToggles = s, this._selectors.tabContents = i, this._elements.tabToggles = [], this._classes.open = o || "", this._classes.close = r || "", this._classes.transition = c || "", this._durations.transition = m, this._durations.open = _, this._durations.close = k, this._automatic = C, this._addEventListener("grauplComponentInitialize", this.dom.tabs, () => {
|
|
2284
|
+
this.elements.tabToggles.filter((p) => p.isActive).length === 0 && this.elements.tabToggles[0].show();
|
|
2285
|
+
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
2286
|
+
const p = n("boolean", { automaticActivation: this._automatic }, { shouldThrow: !1 });
|
|
2287
|
+
p.status || (this._errors = [...this._errors, ...p.errors], this._valid = !1);
|
|
2288
|
+
}), g && this.initialize();
|
|
1559
2289
|
}
|
|
1560
2290
|
get openClass() {
|
|
1561
2291
|
return this._classes.open;
|
|
1562
2292
|
}
|
|
1563
2293
|
set openClass(t) {
|
|
1564
|
-
|
|
2294
|
+
u({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
1565
2295
|
}
|
|
1566
2296
|
get closeClass() {
|
|
1567
2297
|
return this._classes.close;
|
|
1568
2298
|
}
|
|
1569
2299
|
set closeClass(t) {
|
|
1570
|
-
|
|
2300
|
+
u({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
1571
2301
|
}
|
|
1572
2302
|
get transitionClass() {
|
|
1573
2303
|
return this._classes.transition;
|
|
1574
2304
|
}
|
|
1575
2305
|
set transitionClass(t) {
|
|
1576
|
-
|
|
2306
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1577
2307
|
}
|
|
1578
2308
|
get transitionDuration() {
|
|
1579
2309
|
return this._durations.transition;
|
|
1580
2310
|
}
|
|
1581
2311
|
set transitionDuration(t) {
|
|
1582
|
-
n("number", { transitionDuration: t }), this._durations.transition !== t && (this._durations.transition = t, this.
|
|
2312
|
+
n("number", { transitionDuration: t }), this._durations.transition !== t && (this._durations.transition = t, this._setTransitionDurations());
|
|
1583
2313
|
}
|
|
1584
2314
|
get openDuration() {
|
|
1585
2315
|
return this._durations.open === -1 ? this.transitionDuration : this._durations.open;
|
|
1586
2316
|
}
|
|
1587
2317
|
set openDuration(t) {
|
|
1588
|
-
n("number", { openDuration: t }), this._durations.open !== t && (this._durations.open = t, this.
|
|
2318
|
+
n("number", { openDuration: t }), this._durations.open !== t && (this._durations.open = t, this._setTransitionDurations());
|
|
1589
2319
|
}
|
|
1590
2320
|
get closeDuration() {
|
|
1591
2321
|
return this._durations.close === -1 ? this.transitionDuration : this._durations.close;
|
|
1592
2322
|
}
|
|
1593
2323
|
set closeDuration(t) {
|
|
1594
|
-
n("number", { closeDuration: t }), this._durations.close !== t && (this._durations.close = t, this.
|
|
2324
|
+
n("number", { closeDuration: t }), this._durations.close !== t && (this._durations.close = t, this._setTransitionDurations());
|
|
1595
2325
|
}
|
|
1596
|
-
get
|
|
1597
|
-
return this.
|
|
2326
|
+
get isAutomatic() {
|
|
2327
|
+
return this._automatic;
|
|
1598
2328
|
}
|
|
1599
|
-
set
|
|
1600
|
-
n("boolean", {
|
|
2329
|
+
set isAutomatic(t) {
|
|
2330
|
+
n("boolean", { isAutomatic: t }), this._automatic !== t && (this._automatic = t);
|
|
1601
2331
|
}
|
|
1602
|
-
get
|
|
1603
|
-
return this.
|
|
2332
|
+
get currentChild() {
|
|
2333
|
+
return this._currentChild;
|
|
1604
2334
|
}
|
|
1605
|
-
set
|
|
1606
|
-
n("
|
|
2335
|
+
set currentChild(t) {
|
|
2336
|
+
n("number", { currentChild: t }), this._currentChild !== t && t >= 0 && t < this.elements.tabToggles.length && (this._currentChild = t);
|
|
1607
2337
|
}
|
|
1608
|
-
get
|
|
1609
|
-
return this.
|
|
2338
|
+
get currentTabToggle() {
|
|
2339
|
+
return this.elements.tabToggles[this.currentChild];
|
|
1610
2340
|
}
|
|
1611
|
-
|
|
1612
|
-
|
|
2341
|
+
_setIds() {
|
|
2342
|
+
this.dom.tabs.id = this.dom.tabs.id || `tabs-${this.key}`, this.dom.tabList.id = this.dom.tabList.id || `tab-list-${this.key}`, this._id = this.dom.tabs.id;
|
|
1613
2343
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
2344
|
+
_setAriaAttributes() {
|
|
2345
|
+
this.dom.tabList.setAttribute("role", "tablist");
|
|
1616
2346
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
2347
|
+
_setCustomProps() {
|
|
2348
|
+
this.dom.tabs.style.setProperty(`--${this.prefix}tabs-transition-duration`, `${this.transitionDuration}ms`), this.dom.tabs.style.setProperty(`--${this.prefix}tabs-open-transition-duration`, `${this.openDuration}ms`), this.dom.tabs.style.setProperty(`--${this.prefix}tabs-close-transition-duration`, `${this.closeDuration}ms`);
|
|
1619
2349
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
2350
|
+
_setDOMElements() {
|
|
2351
|
+
this._resetDOMElementType("tabList"), this._setDOMElementType("tabList", { context: this.dom.tabs }), this.dom.tabList && (this._resetDOMElementType("tabToggles"), this._setDOMElementType("tabToggles", { context: this.dom.tabList })), this._resetDOMElementType("tabContents"), this._setDOMElementType("tabContents", { context: this.dom.tabs });
|
|
1622
2352
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
2353
|
+
_createChildElements() {
|
|
2354
|
+
this.dom.tabToggles.forEach((t, e) => {
|
|
2355
|
+
const s = new Ct({
|
|
2356
|
+
toggleElement: t,
|
|
2357
|
+
contentElement: this.dom.tabContents[e],
|
|
2358
|
+
parentTab: this
|
|
2359
|
+
});
|
|
2360
|
+
s.initialize(), this._elements.tabToggles.push(s);
|
|
2361
|
+
});
|
|
1625
2362
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
2363
|
+
_handleFocus() {
|
|
2364
|
+
this.elements.tabToggles.forEach((t, e) => {
|
|
2365
|
+
this._addEventListener("focus", t.dom.toggle, () => {
|
|
2366
|
+
this.currentChild = e, this.isAutomatic && this.currentTabToggle.show();
|
|
2367
|
+
});
|
|
2368
|
+
});
|
|
1628
2369
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
2370
|
+
_handleClick() {
|
|
2371
|
+
this.elements.tabToggles.forEach((t, e) => {
|
|
2372
|
+
this._addEventListener("click", t.dom.toggle, () => {
|
|
2373
|
+
this.currentChild = e, t.show();
|
|
2374
|
+
});
|
|
2375
|
+
});
|
|
1631
2376
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
2377
|
+
_handleKeydown() {
|
|
2378
|
+
this.dom.tabToggles.forEach((t) => {
|
|
2379
|
+
this._addEventListener("keydown", t, (e) => {
|
|
2380
|
+
const s = d(e);
|
|
2381
|
+
[
|
|
2382
|
+
"Space",
|
|
2383
|
+
"Enter",
|
|
2384
|
+
"ArrowRight",
|
|
2385
|
+
"ArrowLeft",
|
|
2386
|
+
"Home",
|
|
2387
|
+
"End"
|
|
2388
|
+
].includes(s) && h(e);
|
|
2389
|
+
});
|
|
2390
|
+
});
|
|
1634
2391
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
2392
|
+
_handleKeyup() {
|
|
2393
|
+
this.dom.tabToggles.forEach((t) => {
|
|
2394
|
+
this._addEventListener("keyup", t, (e) => {
|
|
2395
|
+
switch (d(e)) {
|
|
2396
|
+
case "Space":
|
|
2397
|
+
case "Enter":
|
|
2398
|
+
h(e), this.currentTabToggle.show();
|
|
2399
|
+
break;
|
|
2400
|
+
case "Home":
|
|
2401
|
+
h(e), this.focusFirstChild();
|
|
2402
|
+
break;
|
|
2403
|
+
case "End":
|
|
2404
|
+
h(e), this.focusLastChild();
|
|
2405
|
+
break;
|
|
2406
|
+
case "ArrowRight":
|
|
2407
|
+
h(e), this.focusNextChild();
|
|
2408
|
+
break;
|
|
2409
|
+
case "ArrowLeft":
|
|
2410
|
+
h(e), this.focusPreviousChild();
|
|
2411
|
+
break;
|
|
2412
|
+
}
|
|
2413
|
+
});
|
|
2414
|
+
});
|
|
1637
2415
|
}
|
|
1638
|
-
|
|
1639
|
-
|
|
2416
|
+
focusCurrentChild() {
|
|
2417
|
+
this.currentChild !== -1 && this.currentTabToggle.focus();
|
|
1640
2418
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
2419
|
+
focusChild(t) {
|
|
2420
|
+
this.blurCurrentChild(), this.currentChild = t, this.focusCurrentChild();
|
|
1643
2421
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
2422
|
+
focusFirstChild() {
|
|
2423
|
+
this.focusChild(0);
|
|
1646
2424
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
2425
|
+
focusLastChild() {
|
|
2426
|
+
this.focusChild(this.elements.tabToggles.length - 1);
|
|
1649
2427
|
}
|
|
1650
|
-
|
|
1651
|
-
|
|
2428
|
+
focusNextChild() {
|
|
2429
|
+
this.currentChild < this.elements.tabToggles.length - 1 ? this.focusChild(this.currentChild + 1) : this.focusFirstChild();
|
|
1652
2430
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
2431
|
+
focusPreviousChild() {
|
|
2432
|
+
this.currentChild > 0 ? this.focusChild(this.currentChild - 1) : this.focusLastChild();
|
|
1655
2433
|
}
|
|
1656
|
-
|
|
1657
|
-
this.
|
|
2434
|
+
blurCurrentChild() {
|
|
2435
|
+
this.currentChild !== -1 && this.currentTabToggle.blur();
|
|
1658
2436
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
2437
|
+
};
|
|
2438
|
+
const Et = ({ options: t = {}, context: e = document, selector: s = ".tabs" } = {}) => {
|
|
2439
|
+
b("graupl-tabs-generator", s, e).forEach((i) => {
|
|
2440
|
+
const o = i.dataset.grauplTabsOptions ? JSON.parse(i.dataset.grauplTabsOptions.replace(/'/g, "\"")) || {} : {};
|
|
2441
|
+
new yt({
|
|
2442
|
+
tabsElement: i,
|
|
2443
|
+
initialize: !0,
|
|
2444
|
+
...t,
|
|
2445
|
+
...o
|
|
2446
|
+
});
|
|
2447
|
+
});
|
|
2448
|
+
};
|
|
2449
|
+
var It = class extends w {
|
|
2450
|
+
_rootDOMElement = "tooltip";
|
|
2451
|
+
_softLocked = !1;
|
|
2452
|
+
_hoverType = "off";
|
|
2453
|
+
_open = !1;
|
|
2454
|
+
_storageKey = "tooltips";
|
|
2455
|
+
_openOnFocus = !1;
|
|
2456
|
+
_closeOnBlur = !0;
|
|
2457
|
+
_name = "Tooltip";
|
|
2458
|
+
constructor({ tooltipElement: t, tooltipToggleElement: e, tooltipDescriptionElement: s, showClass: i = "show", hideClass: o = "hide", transitionClass: r = "transitioning", transitionDelay: c = 250, transitionDuration: m = 150, showDuration: _ = -1, hideDuration: k = -1, openOnFocus: C = !1, closeOnBlur: y = !0, hoverType: E = "off", hoverDelay: f = 250, enterDelay: g = -1, leaveDelay: p = -1, prefix: O = "graupl-", key: D = null, initializeClass: T = "initializing", initialize: v = !1 } = {}) {
|
|
2459
|
+
super({
|
|
2460
|
+
prefix: O,
|
|
2461
|
+
key: D,
|
|
2462
|
+
initializeClass: T
|
|
2463
|
+
}), this._dom.tooltip = t, this._dom.tooltipToggle = e, this._dom.tooltipDescription = s, this._classes.show = i || "", this._classes.hide = o || "", this._classes.transition = r || "", this._durations.transition = m, this._durations.transitionDelay = c, this._durations.show = _, this._durations.hide = k, this._openOnFocus = C, this._closeOnBlur = y, this._hoverType = E, this._delays.hover = f, this._delays.enter = g, this._delays.leave = p, this._registerEvent("show", { detail: { tooltip: this } }), this._registerEvent("hide", { detail: { tooltip: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
2464
|
+
this.hide({ force: !0 });
|
|
2465
|
+
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
2466
|
+
const A = n("boolean", { isOpen: this._open }, { shouldThrow: !1 });
|
|
2467
|
+
A.status || (this._errors = [...this._errors, ...A.errors], this._valid = !1);
|
|
2468
|
+
const B = Z({ hoverType: this._hoverType }, { shouldThrow: !1 });
|
|
2469
|
+
B.status || (this._errors = [...this._errors, ...B.errors], this._valid = !1);
|
|
2470
|
+
}), v && this.initialize();
|
|
1661
2471
|
}
|
|
1662
|
-
|
|
1663
|
-
|
|
2472
|
+
get showClass() {
|
|
2473
|
+
return this._classes.show;
|
|
1664
2474
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
2475
|
+
set showClass(t) {
|
|
2476
|
+
u({ showClass: t }), this._classes.show !== t && (this._classes.show = t);
|
|
1667
2477
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
2478
|
+
get hideClass() {
|
|
2479
|
+
return this._classes.hide;
|
|
2480
|
+
}
|
|
2481
|
+
set hideClass(t) {
|
|
2482
|
+
u({ hideClass: t }), this._classes.hide !== t && (this._classes.hide = t);
|
|
2483
|
+
}
|
|
2484
|
+
get transitionClass() {
|
|
2485
|
+
return this._classes.transition;
|
|
2486
|
+
}
|
|
2487
|
+
set transitionClass(t) {
|
|
2488
|
+
u({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
2489
|
+
}
|
|
2490
|
+
get transitionDuration() {
|
|
2491
|
+
return this._durations.transition;
|
|
2492
|
+
}
|
|
2493
|
+
set transitionDuration(t) {
|
|
2494
|
+
n("number", { transitionDuration: t }), this._durations.transition !== t && (this._durations.transition = t, this._setCustomProps());
|
|
2495
|
+
}
|
|
2496
|
+
get showDuration() {
|
|
2497
|
+
return this._durations.show === -1 ? this.transitionDuration : this._durations.show;
|
|
2498
|
+
}
|
|
2499
|
+
set showDuration(t) {
|
|
2500
|
+
n("number", { showDuration: t }), this._durations.show !== t && (this._durations.show = t, this._setCustomProps());
|
|
2501
|
+
}
|
|
2502
|
+
get hideDuration() {
|
|
2503
|
+
return this._durations.hide === -1 ? this.transitionDuration : this._durations.hide;
|
|
2504
|
+
}
|
|
2505
|
+
set hideDuration(t) {
|
|
2506
|
+
n("number", { hideDuration: t }), this._durations.hide !== t && (this._durations.hide = t, this._setCustomProps());
|
|
2507
|
+
}
|
|
2508
|
+
get isOpen() {
|
|
2509
|
+
return this._open;
|
|
2510
|
+
}
|
|
2511
|
+
_setIds() {
|
|
2512
|
+
this.dom.tooltip.id = this.dom.tooltip.id || `tooltip-${this.key}`, this.dom.tooltipToggle.id = this.dom.tooltipToggle.id || `tooltip-toggle-${this.key}`, this.dom.tooltipDescription.id = this.dom.tooltipDescription.id || `tooltip-description-${this.key}`, this._id = this.dom.tooltip.id;
|
|
2513
|
+
}
|
|
2514
|
+
_setAriaAttributes() {
|
|
2515
|
+
this.dom.tooltipToggle && (this.dom.tooltip.setAttribute("role", "tooltip"), this.dom.tooltipToggle.setAttribute("role", "button"), this.dom.tooltipToggle && this.dom.tooltipToggle.setAttribute("aria-describedby", this.dom.tooltipDescription.id));
|
|
2516
|
+
}
|
|
2517
|
+
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
2518
|
+
e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2519
|
+
l(this.hideClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2520
|
+
a(this.showClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2521
|
+
this._setTimeout(() => l(this.transitionClass, this.dom.tooltipDescription), this.showDuration);
|
|
1675
2522
|
});
|
|
1676
2523
|
});
|
|
1677
|
-
})) : (
|
|
2524
|
+
})) : (a(this.showClass, this.dom.tooltipDescription), l(this.hideClass, this.dom.tooltipDescription)), t && this._dispatchEvent("show", this.dom.tooltipDescription);
|
|
1678
2525
|
}
|
|
1679
|
-
_conceal({ emit: t =
|
|
1680
|
-
this.
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
c(this.transitionClass, this.dom.disclosure), this.dom.content.innert = !0;
|
|
1685
|
-
}, this.closeDuration);
|
|
2526
|
+
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
2527
|
+
this.isSoftLocked = !1, e && this.transitionClass !== "" ? (a(this.transitionClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2528
|
+
l(this.showClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2529
|
+
a(this.hideClass, this.dom.tooltipDescription), requestAnimationFrame(() => {
|
|
2530
|
+
this._setTimeout(() => l(this.transitionClass, this.dom.tooltipDescription), this.hideDuration);
|
|
1686
2531
|
});
|
|
1687
2532
|
});
|
|
1688
|
-
})) : (
|
|
2533
|
+
})) : (a(this.hideClass, this.dom.tooltipDescription), l(this.showClass, this.dom.tooltipDescription)), t && this._dispatchEvent("hide", this.dom.tooltipDescription);
|
|
1689
2534
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
2535
|
+
get hoverType() {
|
|
2536
|
+
return this._hoverType;
|
|
1692
2537
|
}
|
|
1693
|
-
|
|
1694
|
-
|
|
2538
|
+
set hoverType(t) {
|
|
2539
|
+
Z({ hoverType: t }), this._hoverType !== t && (this._hoverType = t);
|
|
1695
2540
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
2541
|
+
get hoverDelay() {
|
|
2542
|
+
return this._delays.hover;
|
|
2543
|
+
}
|
|
2544
|
+
set hoverDelay(t) {
|
|
2545
|
+
n("number", { hoverDelay: t }), this._delays.hover !== t && (this._delays.hover = t);
|
|
2546
|
+
}
|
|
2547
|
+
get enterDelay() {
|
|
2548
|
+
return this._delays.enter === -1 ? this.hoverDelay : this._delays.enter;
|
|
2549
|
+
}
|
|
2550
|
+
set enterDelay(t) {
|
|
2551
|
+
n("number", { enterDelay: t }), this._delays.enter !== t && (this._delays.enter = t);
|
|
2552
|
+
}
|
|
2553
|
+
get leaveDelay() {
|
|
2554
|
+
return this._delays.leave === -1 ? this.hoverDelay : this._delays.leave;
|
|
2555
|
+
}
|
|
2556
|
+
set leaveDelay(t) {
|
|
2557
|
+
n("number", { leaveDelay: t }), this._delays.leave !== t && (this._delays.leave = t);
|
|
2558
|
+
}
|
|
2559
|
+
get isSoftLocked() {
|
|
2560
|
+
return this._softLocked;
|
|
2561
|
+
}
|
|
2562
|
+
set isSoftLocked(t) {
|
|
2563
|
+
n("boolean", { isSoftLocked: t }), this._softLocked !== t && (this._softLocked = t);
|
|
2564
|
+
}
|
|
2565
|
+
get openOnFocus() {
|
|
2566
|
+
return this._openOnFocus;
|
|
2567
|
+
}
|
|
2568
|
+
set openOnFocus(t) {
|
|
2569
|
+
n("boolean", { openOnFocus: t }), this._openOnFocus !== t && (this._openOnFocus = t);
|
|
2570
|
+
}
|
|
2571
|
+
get closeOnBlur() {
|
|
2572
|
+
return this._closeOnBlur;
|
|
2573
|
+
}
|
|
2574
|
+
set closeOnBlur(t) {
|
|
2575
|
+
n("boolean", { closeOnBlur: t }), this._closeOnBlur !== t && (this._closeOnBlur = t);
|
|
2576
|
+
}
|
|
2577
|
+
_setCustomProps() {
|
|
2578
|
+
this.dom.tooltip.style.setProperty(`--${this.prefix}tooltip-transition-duration`, `${this.transitionDuration}ms`), this.dom.tooltip.style.setProperty(`--${this.prefix}tooltip-show-transition-duration`, `${this.showDuration}ms`), this.dom.tooltip.style.setProperty(`--${this.prefix}tooltip-hide-transition-duration`, `${this.hideDuration}ms`);
|
|
1702
2579
|
}
|
|
1703
2580
|
_handleClick() {
|
|
1704
|
-
this._addEventListener("click", this.dom.
|
|
1705
|
-
this.currentEvent = "mouse", t.button === 0 && (
|
|
2581
|
+
this._addEventListener("click", this.dom.tooltipToggle, (t) => {
|
|
2582
|
+
this.currentEvent = "mouse", t.button === 0 && (h(t), this.isSoftLocked = !0, this.toggle());
|
|
2583
|
+
}), this._addEventListener("click", this.dom.tooltipDescription, (t) => {
|
|
2584
|
+
this.currentEvent = "mouse", t.button === 0 && (this.focusState = "self");
|
|
1706
2585
|
}), this._addEventListener("click", document, (t) => {
|
|
1707
|
-
this.focusState
|
|
2586
|
+
this.focusState === "self" && this.closeOnBlur && (this.dom.tooltip === t.target || this.dom.tooltip.contains(t.target) || (this.currentEvent = "mouse", this.hide()));
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
_handleFocus() {
|
|
2590
|
+
this._addEventListener("focus", this.dom.tooltip, () => {
|
|
2591
|
+
this.focusState = "self";
|
|
2592
|
+
}), this._addEventListener("focusout", this.dom.tooltip, (t) => {
|
|
2593
|
+
!this.closeOnBlur || this.currentEvent !== "keyboard" || t.relatedTarget === null || this.dom.tooltip.contains(t.relatedTarget) || this.hide();
|
|
1708
2594
|
});
|
|
1709
2595
|
}
|
|
1710
2596
|
_handleKeydown() {
|
|
1711
|
-
this._addEventListener("keydown", this.dom.
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
1718
|
-
}), this._addEventListener("keydown", this.dom.disclosure, (t) => {
|
|
1719
|
-
this.currentEvent = "keyboard", d(t) === "Escape" && a(t);
|
|
2597
|
+
this._addEventListener("keydown", this.dom.tooltipToggle, (t) => {
|
|
2598
|
+
this.currentEvent = "keyboard";
|
|
2599
|
+
const e = d(t);
|
|
2600
|
+
(e === "Space" || e === "Enter") && h(t);
|
|
2601
|
+
}), this._addEventListener("keydown", this.dom.tooltip, (t) => {
|
|
2602
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && h(t);
|
|
1720
2603
|
});
|
|
1721
2604
|
}
|
|
1722
2605
|
_handleKeyup() {
|
|
1723
|
-
this._addEventListener("keyup", this.dom.
|
|
2606
|
+
this._addEventListener("keyup", this.dom.tooltipToggle, (t) => {
|
|
1724
2607
|
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1725
2608
|
case "Space":
|
|
1726
2609
|
case "Enter":
|
|
1727
|
-
|
|
2610
|
+
h(t), this.toggle();
|
|
1728
2611
|
break;
|
|
1729
2612
|
case "Tab":
|
|
1730
|
-
this.openOnFocus && (
|
|
2613
|
+
this.openOnFocus && (h(t), this.show());
|
|
2614
|
+
break;
|
|
2615
|
+
}
|
|
2616
|
+
}), this._addEventListener("keyup", this.dom.tooltip, (t) => {
|
|
2617
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && (h(t), this.hide());
|
|
2618
|
+
}), this._addEventListener("keyup", document, (t) => {
|
|
2619
|
+
switch (d(t)) {
|
|
2620
|
+
case "Escape":
|
|
2621
|
+
if (this.hoverType !== "on" && this.focusState !== "self") return;
|
|
2622
|
+
this.currentEvent = "keyboard", this.hide();
|
|
1731
2623
|
break;
|
|
1732
2624
|
}
|
|
1733
|
-
}), this._addEventListener("keyup", this.dom.disclosure, (t) => {
|
|
1734
|
-
this.currentEvent = "keyboard", d(t) === "Escape" && (this.close(), a(t));
|
|
1735
2625
|
});
|
|
1736
2626
|
}
|
|
1737
|
-
|
|
1738
|
-
this.
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}), this._open.value = !0, s || this._open.commit());
|
|
2627
|
+
_handleHover() {
|
|
2628
|
+
this._addEventListener("pointerenter", this.dom.tooltip, (t) => {
|
|
2629
|
+
t.pointerType === "pen" || t.pointerType === "touch" || this.hoverType !== "off" && (this.currentEvent = "mouse", this.enterDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => {
|
|
2630
|
+
this.show();
|
|
2631
|
+
}, this.enterDelay)) : this.show());
|
|
2632
|
+
}), this._addEventListener("pointerleave", this.dom.tooltip, (t) => {
|
|
2633
|
+
t.pointerType === "pen" || t.pointerType === "touch" || this.hoverType != "off" && (this.isSoftLocked || (this.currentEvent = "mouse", this.leaveDelay > 0 ? (this._clearTimeout(), this._setTimeout(() => {
|
|
2634
|
+
this.hide();
|
|
2635
|
+
}, this.leaveDelay)) : this.hide()));
|
|
2636
|
+
});
|
|
1748
2637
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
2638
|
+
show({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized } = {}) {
|
|
2639
|
+
this.isOpen && !t || (this.focusState = "self", this._reveal({
|
|
1751
2640
|
emit: e,
|
|
1752
|
-
transition:
|
|
1753
|
-
}), this._open
|
|
2641
|
+
transition: s
|
|
2642
|
+
}), this._open = !0);
|
|
1754
2643
|
}
|
|
1755
|
-
|
|
1756
|
-
this.isOpen
|
|
1757
|
-
force: t,
|
|
1758
|
-
emit: e,
|
|
1759
|
-
transition: i,
|
|
1760
|
-
preserveState: s
|
|
1761
|
-
}) : this.open({
|
|
1762
|
-
force: t,
|
|
2644
|
+
hide({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized } = {}) {
|
|
2645
|
+
!this.isOpen && !t || (this.focusState = "none", this._conceal({
|
|
1763
2646
|
emit: e,
|
|
1764
|
-
transition:
|
|
1765
|
-
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
lock({ force: t = !1, emit: e = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1769
|
-
this.isLocked && !t || (this._locked.value = !0, this._lock({ emit: e }), i || this._locked.commit());
|
|
1770
|
-
}
|
|
1771
|
-
unlock({ force: t = !1, emit: e = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1772
|
-
!this.isLocked && !t || (this._locked.value = !1, this._unlock({ emit: e }), i || this._locked.commit());
|
|
2647
|
+
transition: s
|
|
2648
|
+
}), this._open = !1);
|
|
1773
2649
|
}
|
|
1774
|
-
|
|
1775
|
-
this.
|
|
2650
|
+
toggle({ force: t = !1, emit: e = this.isInitialized, transition: s = this.isInitialized } = {}) {
|
|
2651
|
+
this.isOpen ? this.hide({
|
|
1776
2652
|
force: t,
|
|
1777
2653
|
emit: e,
|
|
1778
|
-
|
|
1779
|
-
}) : this.
|
|
2654
|
+
transition: s
|
|
2655
|
+
}) : this.show({
|
|
1780
2656
|
force: t,
|
|
1781
2657
|
emit: e,
|
|
1782
|
-
|
|
2658
|
+
transition: s
|
|
1783
2659
|
});
|
|
1784
2660
|
}
|
|
1785
2661
|
};
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
new ht({
|
|
1794
|
-
disclosureElement: o,
|
|
1795
|
-
controllerElement: u,
|
|
2662
|
+
const wt = (t = {}, e = document, s = ".tooltip", i = ".tooltip-description", o = ".tooltip-toggle") => {
|
|
2663
|
+
b("graupl-tooltip-generator", s, e).forEach((r) => {
|
|
2664
|
+
const c = r.dataset.grauplTooltipOptions ? JSON.parse(r.dataset.grauplTooltipOptions.replace(/'/g, "\"")) || {} : {};
|
|
2665
|
+
new It({
|
|
2666
|
+
tooltipElement: r,
|
|
2667
|
+
tooltipToggleElement: r.querySelector(o) || null,
|
|
2668
|
+
tooltipDescriptionElement: r.querySelector(i) || null,
|
|
1796
2669
|
initialize: !0,
|
|
1797
2670
|
...t,
|
|
1798
|
-
...
|
|
2671
|
+
...c
|
|
1799
2672
|
});
|
|
1800
2673
|
});
|
|
1801
2674
|
};
|
|
1802
2675
|
document.addEventListener("DOMContentLoaded", () => {
|
|
1803
|
-
|
|
2676
|
+
ht(), dt(), pt(), ft(), bt(), kt(), Et(), wt();
|
|
1804
2677
|
});
|
|
1805
2678
|
})();
|
|
1806
2679
|
|