@graupl/graupl 1.0.0-beta.45 → 1.0.0-beta.47
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/component/carousel.css +1 -1
- package/dist/css/component/carousel.css.map +1 -1
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +1 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/js/breadcrumb.js +30 -30
- package/dist/js/breadcrumb.js.map +1 -1
- package/dist/js/carousel.js +266 -145
- package/dist/js/carousel.js.map +1 -1
- package/dist/js/component/breadcrumb.cjs.js +22 -22
- package/dist/js/component/breadcrumb.cjs.js.map +1 -1
- package/dist/js/component/breadcrumb.es.js +22 -22
- package/dist/js/component/breadcrumb.es.js.map +1 -1
- package/dist/js/component/breadcrumb.iife.js +24 -24
- package/dist/js/component/breadcrumb.iife.js.map +1 -1
- package/dist/js/component/carousel.cjs.js +246 -125
- package/dist/js/component/carousel.cjs.js.map +1 -1
- package/dist/js/component/carousel.es.js +246 -125
- package/dist/js/component/carousel.es.js.map +1 -1
- package/dist/js/component/carousel.iife.js +243 -122
- package/dist/js/component/carousel.iife.js.map +1 -1
- package/dist/js/component/disclosure.cjs.js +1 -1
- package/dist/js/component/disclosure.cjs.js.map +1 -1
- package/dist/js/component/disclosure.es.js +1 -1
- package/dist/js/component/disclosure.es.js.map +1 -1
- package/dist/js/component/disclosure.iife.js +1 -1
- package/dist/js/component/disclosure.iife.js.map +1 -1
- package/dist/js/disclosure.js +12 -12
- package/dist/js/disclosure.js.map +1 -1
- package/dist/js/generator/breadcrumb.cjs.js +24 -24
- package/dist/js/generator/breadcrumb.cjs.js.map +1 -1
- package/dist/js/generator/breadcrumb.es.js +40 -40
- package/dist/js/generator/breadcrumb.es.js.map +1 -1
- package/dist/js/generator/breadcrumb.iife.js +46 -46
- package/dist/js/generator/breadcrumb.iife.js.map +1 -1
- package/dist/js/generator/carousel.cjs.js +262 -141
- package/dist/js/generator/carousel.cjs.js.map +1 -1
- package/dist/js/generator/carousel.es.js +262 -141
- package/dist/js/generator/carousel.es.js.map +1 -1
- package/dist/js/generator/carousel.iife.js +263 -142
- package/dist/js/generator/carousel.iife.js.map +1 -1
- package/dist/js/generator/disclosure.cjs.js +13 -13
- package/dist/js/generator/disclosure.cjs.js.map +1 -1
- package/dist/js/generator/disclosure.es.js +13 -13
- package/dist/js/generator/disclosure.es.js.map +1 -1
- package/dist/js/generator/disclosure.iife.js +12 -12
- package/dist/js/generator/disclosure.iife.js.map +1 -1
- package/dist/js/graupl.js +565 -444
- package/dist/js/graupl.js.map +1 -1
- package/package.json +1 -1
package/dist/js/graupl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
function k(t, e, { shouldThrow:
|
|
3
|
-
const
|
|
2
|
+
function k(t, e, { shouldThrow: i = !0 } = {}) {
|
|
3
|
+
const s = {
|
|
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
|
+
s.status = !1, s.errors.push(r);
|
|
16
16
|
}
|
|
17
17
|
} catch (o) {
|
|
18
|
-
|
|
18
|
+
s.status = !1, s.errors.push(o);
|
|
19
19
|
}
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
20
|
+
if (i && !s.status) throw s.errors[0];
|
|
21
|
+
return s;
|
|
22
22
|
}
|
|
23
|
-
function n(t, e, { shouldThrow:
|
|
24
|
-
const
|
|
23
|
+
function n(t, e, { shouldThrow: i = !0 } = {}) {
|
|
24
|
+
const s = {
|
|
25
25
|
status: !0,
|
|
26
26
|
errors: []
|
|
27
27
|
};
|
|
@@ -31,112 +31,112 @@
|
|
|
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
|
+
s.status = !1, s.errors.push(r);
|
|
35
35
|
}
|
|
36
36
|
} catch (o) {
|
|
37
|
-
|
|
37
|
+
s.status = !1, s.errors.push(o);
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
39
|
+
if (i && !s.status) throw s.errors[0];
|
|
40
|
+
return s;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
42
|
+
function H(t, { shouldThrow: e = !0 } = {}) {
|
|
43
|
+
const i = {
|
|
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 s in t) try {
|
|
50
50
|
try {
|
|
51
|
-
if (t[
|
|
52
|
-
document.querySelector(t[
|
|
51
|
+
if (t[s] === null) throw new Error();
|
|
52
|
+
document.querySelector(t[s]);
|
|
53
53
|
} catch {
|
|
54
|
-
throw new TypeError(`${
|
|
54
|
+
throw new TypeError(`${s} must be a valid query selector. "${t[s]}" given.`);
|
|
55
55
|
}
|
|
56
56
|
} catch (o) {
|
|
57
|
-
|
|
57
|
+
i.status = !1, i.errors.push(o);
|
|
58
58
|
}
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
59
|
+
} catch (s) {
|
|
60
|
+
i.status = !1, i.errors.push(s);
|
|
61
61
|
}
|
|
62
|
-
if (e && !
|
|
63
|
-
return
|
|
62
|
+
if (e && !i.status) throw i.errors[0];
|
|
63
|
+
return i;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const
|
|
65
|
+
function m(t, { shouldThrow: e = !0 } = {}) {
|
|
66
|
+
const i = {
|
|
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 s in t) try {
|
|
73
|
+
const o = typeof t[s];
|
|
74
|
+
if (o !== "string") if (Array.isArray(t[s])) t[s].forEach((r) => {
|
|
75
|
+
if (typeof r != "string") throw new TypeError(`${s} 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(`${s} must be a string or an array of strings. "${o}" given.`);
|
|
78
78
|
else {
|
|
79
79
|
const r = {};
|
|
80
|
-
r[
|
|
80
|
+
r[s] = t[s], H(r);
|
|
81
81
|
}
|
|
82
82
|
} catch (o) {
|
|
83
|
-
|
|
83
|
+
i.status = !1, i.errors.push(o);
|
|
84
84
|
}
|
|
85
|
-
} catch (
|
|
86
|
-
|
|
85
|
+
} catch (s) {
|
|
86
|
+
i.status = !1, i.errors.push(s);
|
|
87
87
|
}
|
|
88
|
-
if (e && !
|
|
89
|
-
return
|
|
88
|
+
if (e && !i.status) throw i.errors[0];
|
|
89
|
+
return i;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
91
|
+
function U(t, { shouldThrow: e = !0 } = {}) {
|
|
92
|
+
const i = {
|
|
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 s = [
|
|
99
99
|
"none",
|
|
100
100
|
"self",
|
|
101
101
|
"child"
|
|
102
102
|
];
|
|
103
103
|
for (const o in t) try {
|
|
104
|
-
if (!
|
|
104
|
+
if (!s.includes(t[o])) throw new TypeError(`${o} must be one of the following values: ${s.join(", ")}. "${t[o]}" given.`);
|
|
105
105
|
} catch (r) {
|
|
106
|
-
|
|
106
|
+
i.status = !1, i.errors.push(r);
|
|
107
107
|
}
|
|
108
|
-
} catch (
|
|
109
|
-
|
|
108
|
+
} catch (s) {
|
|
109
|
+
i.status = !1, i.errors.push(s);
|
|
110
110
|
}
|
|
111
|
-
if (e && !
|
|
112
|
-
return
|
|
111
|
+
if (e && !i.status) throw i.errors[0];
|
|
112
|
+
return i;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
114
|
+
function Z(t, { shouldThrow: e = !0 } = {}) {
|
|
115
|
+
const i = {
|
|
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 s = [
|
|
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 (!s.includes(t[o])) throw new TypeError(`${o} must be one of the following values: ${s.join(", ")}. "${t[o]}" given.`);
|
|
129
129
|
} catch (r) {
|
|
130
|
-
|
|
130
|
+
i.status = !1, i.errors.push(r);
|
|
131
131
|
}
|
|
132
|
-
} catch (
|
|
133
|
-
|
|
132
|
+
} catch (s) {
|
|
133
|
+
i.status = !1, i.errors.push(s);
|
|
134
134
|
}
|
|
135
|
-
if (e && !
|
|
136
|
-
return
|
|
135
|
+
if (e && !i.status) throw i.errors[0];
|
|
136
|
+
return i;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
138
|
+
function B(t, e, { shouldThrow: i = !0 } = {}) {
|
|
139
|
+
const s = {
|
|
140
140
|
status: !0,
|
|
141
141
|
errors: []
|
|
142
142
|
};
|
|
@@ -145,49 +145,49 @@
|
|
|
145
145
|
const o = t.toLowerCase();
|
|
146
146
|
for (const r in e) try {
|
|
147
147
|
if (e[r].tagName.toLowerCase() !== o) throw new TypeError(`${r} must be a <${o}> element. <${e[r].tagName.toLowerCase()}> given.`);
|
|
148
|
-
} catch (
|
|
149
|
-
|
|
148
|
+
} catch (l) {
|
|
149
|
+
s.status = !1, s.errors.push(l);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
} catch (o) {
|
|
153
|
-
|
|
153
|
+
s.status = !1, s.errors.push(o);
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
156
|
-
return
|
|
155
|
+
if (i && !s.status) throw s.errors[0];
|
|
156
|
+
return s;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
158
|
+
function W(t, e, { shouldThrow: i = !0 } = {}) {
|
|
159
|
+
const s = {
|
|
160
160
|
status: !0,
|
|
161
161
|
errors: []
|
|
162
162
|
};
|
|
163
163
|
try {
|
|
164
164
|
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
165
|
} catch (o) {
|
|
166
|
-
|
|
166
|
+
s.status = !1, s.errors.push(o);
|
|
167
167
|
}
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
168
|
+
if (i && !s.status) throw s.errors[0];
|
|
169
|
+
return s;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
171
|
+
function X(t, { shouldThrow: e = !0 } = {}) {
|
|
172
|
+
const i = {
|
|
173
173
|
status: !0,
|
|
174
174
|
errors: []
|
|
175
175
|
};
|
|
176
176
|
try {
|
|
177
177
|
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
|
-
|
|
178
|
+
} catch (s) {
|
|
179
|
+
i.status = !1, i.errors.push(s);
|
|
180
180
|
}
|
|
181
|
-
if (e && !
|
|
182
|
-
return
|
|
181
|
+
if (e && !i.status) throw i.errors[0];
|
|
182
|
+
return i;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function h(t, e) {
|
|
185
185
|
t === "" || t.length === 0 || (typeof t == "string" ? e.classList.add(t) : e.classList.add(...t));
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function c(t, e) {
|
|
188
188
|
t === "" || t.length === 0 || (typeof t == "string" ? e.classList.remove(t) : e.classList.remove(...t));
|
|
189
189
|
}
|
|
190
|
-
var
|
|
190
|
+
var D = class {
|
|
191
191
|
_equals = Object.is;
|
|
192
192
|
_current;
|
|
193
193
|
_committed;
|
|
@@ -215,17 +215,17 @@
|
|
|
215
215
|
update(t) {
|
|
216
216
|
return this._current = t(this._current), this;
|
|
217
217
|
}
|
|
218
|
-
}, j = class
|
|
218
|
+
}, j = class J {
|
|
219
219
|
_scope;
|
|
220
220
|
_type = "_default";
|
|
221
221
|
_storage = {};
|
|
222
222
|
_crush = !1;
|
|
223
|
-
constructor({ scope: e, type:
|
|
224
|
-
this._scope = e, this._type =
|
|
223
|
+
constructor({ scope: e, type: i = null, crush: s = !1, initialize: o = !0 } = {}) {
|
|
224
|
+
this._scope = e, this._type = i || "_default", this._crush = s, o && this.initialize();
|
|
225
225
|
}
|
|
226
226
|
initialize() {
|
|
227
227
|
try {
|
|
228
|
-
!this._crush && typeof window[this.scope] < "u" && (k(
|
|
228
|
+
!this._crush && typeof window[this.scope] < "u" && (k(J, { 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
229
|
} catch {} finally {
|
|
230
230
|
window[this.scope] = this;
|
|
231
231
|
}
|
|
@@ -242,40 +242,40 @@
|
|
|
242
242
|
get storage() {
|
|
243
243
|
return this._storage;
|
|
244
244
|
}
|
|
245
|
-
get({ type: e = this.type, key:
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
245
|
+
get({ type: e = this.type, key: i = null } = {}) {
|
|
246
|
+
const s = n("string", { type: e });
|
|
247
|
+
if (!s.status) throw new Error(`StorageManager (${this.scope}): ${s.message}`);
|
|
248
248
|
if (!this.storage[e]) throw new Error(`StorageManager (${this.scope}): Type "${e}" is not initialized.`);
|
|
249
|
-
if (
|
|
250
|
-
const o = n("string", { key:
|
|
249
|
+
if (i !== null) {
|
|
250
|
+
const o = n("string", { key: i });
|
|
251
251
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
252
|
-
return this.storage[e][
|
|
252
|
+
return this.storage[e][i];
|
|
253
253
|
}
|
|
254
254
|
return this.storage[e];
|
|
255
255
|
}
|
|
256
|
-
set({ type: e = this.type, key:
|
|
257
|
-
const o = n("string", { type: e }), r = n("object", { data:
|
|
256
|
+
set({ type: e = this.type, key: i = null, data: s = {} } = {}) {
|
|
257
|
+
const o = n("string", { type: e }), r = n("object", { data: s });
|
|
258
258
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
259
259
|
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:
|
|
260
|
+
if (i !== null) {
|
|
261
|
+
const l = n("string", { key: i });
|
|
262
|
+
if (!l.status) throw new Error(`StorageManager (${this.scope}): ${l.message}`);
|
|
263
|
+
this._storage[e] || (this._storage[e] = {}), this._storage[e][i] = s;
|
|
264
|
+
} else this._storage[e] = s;
|
|
265
|
+
}
|
|
266
|
+
clear({ type: e = this.type, key: i = null } = {}) {
|
|
267
|
+
const s = n("string", { type: e });
|
|
268
|
+
if (!s.status) throw new Error(`StorageManager (${this.scope}): ${s.message}`);
|
|
269
|
+
if (i !== null) {
|
|
270
|
+
const o = n("string", { key: i });
|
|
271
271
|
if (!o.status) throw new Error(`StorageManager (${this.scope}): ${o.message}`);
|
|
272
|
-
delete this.storage[e][
|
|
272
|
+
delete this.storage[e][i];
|
|
273
273
|
} else delete this.storage[e];
|
|
274
274
|
}
|
|
275
275
|
dispose() {
|
|
276
276
|
delete this._storage, delete this;
|
|
277
277
|
}
|
|
278
|
-
},
|
|
278
|
+
}, O = class {
|
|
279
279
|
_dom = {};
|
|
280
280
|
_rootDOMElement = "";
|
|
281
281
|
_protectedDOMElements = [];
|
|
@@ -312,15 +312,15 @@
|
|
|
312
312
|
_valid = !0;
|
|
313
313
|
_initialized = !1;
|
|
314
314
|
_errors = [];
|
|
315
|
-
constructor({ prefix: t = "graupl-", key: e = null, initializeClass:
|
|
316
|
-
this._classes.initialize =
|
|
315
|
+
constructor({ prefix: t = "graupl-", key: e = null, initializeClass: i = "initializing" } = {}) {
|
|
316
|
+
this._classes.initialize = i || "", this._prefix = t || "", this._key = e || "";
|
|
317
317
|
}
|
|
318
318
|
initialize() {
|
|
319
319
|
try {
|
|
320
320
|
if (!this._validate()) throw new Error(`Graupl ${this.name}: Cannot initialize component. The following errors have been found:
|
|
321
321
|
- ${this.errors.map((t) => t.message).join(`
|
|
322
322
|
- `)}`);
|
|
323
|
-
|
|
323
|
+
h(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(), c(this.initializeClass, this.rootDOMElement), this._initialized = !0, this._dispatchEvent("postinitialize", this.rootDOMElement);
|
|
324
324
|
} catch (t) {
|
|
325
325
|
console.error(t);
|
|
326
326
|
}
|
|
@@ -365,19 +365,19 @@
|
|
|
365
365
|
return this._classes.initialize;
|
|
366
366
|
}
|
|
367
367
|
set initializeClass(t) {
|
|
368
|
-
|
|
368
|
+
m({ initializeClass: t }), this._classes.initialize !== t && (this._classes.initialize = t);
|
|
369
369
|
}
|
|
370
370
|
get focusState() {
|
|
371
371
|
return this._focusState;
|
|
372
372
|
}
|
|
373
373
|
set focusState(t) {
|
|
374
|
-
|
|
374
|
+
U({ focusState: t }), this._focusState !== t && (this._focusState = t);
|
|
375
375
|
}
|
|
376
376
|
get currentEvent() {
|
|
377
377
|
return this._currentEvent;
|
|
378
378
|
}
|
|
379
379
|
set currentEvent(t) {
|
|
380
|
-
|
|
380
|
+
Z({ currentEvent: t }), this._currentEvent !== t && (this._currentEvent = t);
|
|
381
381
|
}
|
|
382
382
|
get shouldFocus() {
|
|
383
383
|
let t = !1;
|
|
@@ -418,37 +418,37 @@
|
|
|
418
418
|
}
|
|
419
419
|
_validate() {
|
|
420
420
|
this._dispatchEvent("prevalidate", this.rootDOMElement);
|
|
421
|
-
const t =
|
|
421
|
+
const t = X(this, { shouldThrow: !1 });
|
|
422
422
|
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 = k(HTMLElement,
|
|
423
|
+
const s = {};
|
|
424
|
+
for (const r of Object.keys(this._dom)) Array.isArray(this._dom[r]) ? this._dom[r].forEach((l, u) => {
|
|
425
|
+
s[`${r}Element[${u}]`] = l;
|
|
426
|
+
}) : this._dom[r] !== null && (s[`${r}Element`] = this._dom[r]);
|
|
427
|
+
const o = k(HTMLElement, s, { shouldThrow: !1 });
|
|
428
428
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
429
429
|
}
|
|
430
430
|
if (Object.keys(this._selectors).length > 0) {
|
|
431
|
-
const
|
|
432
|
-
for (const r of Object.keys(this._selectors))
|
|
433
|
-
const o =
|
|
431
|
+
const s = {};
|
|
432
|
+
for (const r of Object.keys(this._selectors)) s[`${r}Selector`] = this._selectors[r];
|
|
433
|
+
const o = H(s, { shouldThrow: !1 });
|
|
434
434
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
435
435
|
}
|
|
436
436
|
if (Object.keys(this._classes).length > 0) {
|
|
437
|
-
const
|
|
438
|
-
for (const r of Object.keys(this._classes)) this._classes[r] !== "" && (
|
|
439
|
-
const o =
|
|
437
|
+
const s = {};
|
|
438
|
+
for (const r of Object.keys(this._classes)) this._classes[r] !== "" && (s[`${r}Class`] = this._classes[r]);
|
|
439
|
+
const o = m(s, { shouldThrow: !1 });
|
|
440
440
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
441
441
|
}
|
|
442
442
|
if (Object.keys(this._durations).length > 0) {
|
|
443
|
-
const
|
|
444
|
-
for (const r of Object.keys(this._durations))
|
|
445
|
-
const o = n("number",
|
|
443
|
+
const s = {};
|
|
444
|
+
for (const r of Object.keys(this._durations)) s[`${r}Duration`] = this._durations[r];
|
|
445
|
+
const o = n("number", s, { shouldThrow: !1 });
|
|
446
446
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
447
447
|
}
|
|
448
448
|
if (Object.keys(this.delays).length > 0) {
|
|
449
|
-
const
|
|
450
|
-
for (const r of Object.keys(this.delays))
|
|
451
|
-
const o = n("number",
|
|
449
|
+
const s = {};
|
|
450
|
+
for (const r of Object.keys(this.delays)) s[`${r}Delay`] = this.delays[r];
|
|
451
|
+
const o = n("number", s, { shouldThrow: !1 });
|
|
452
452
|
o.status || (this._errors = [...this._errors, ...o.errors], this._valid = !1);
|
|
453
453
|
}
|
|
454
454
|
const e = {
|
|
@@ -458,11 +458,11 @@
|
|
|
458
458
|
mediaQuery: this._mediaQueryString,
|
|
459
459
|
breakpoint: this._breakpoint
|
|
460
460
|
};
|
|
461
|
-
this._protectedDOMElements.forEach((
|
|
462
|
-
e[`_protectedDOMElementType[${
|
|
461
|
+
this._protectedDOMElements.forEach((s) => {
|
|
462
|
+
e[`_protectedDOMElementType[${s}]`] = s;
|
|
463
463
|
});
|
|
464
|
-
const
|
|
465
|
-
return
|
|
464
|
+
const i = n("string", e, { shouldThrow: !1 });
|
|
465
|
+
return i.status || (this._errors = [...this._errors, ...i.errors], this._valid = !1), this._dispatchEvent("validate", this.rootDOMElement), this._dispatchEvent("postvalidate", this.rootDOMElement), this._valid;
|
|
466
466
|
}
|
|
467
467
|
_generateKey(t = !1) {
|
|
468
468
|
(this._key === "" || t) && (this._key = Math.random().toString(36).replace(/[^a-z]+/g, "").substring(0, 10));
|
|
@@ -470,12 +470,12 @@
|
|
|
470
470
|
_setIds() {}
|
|
471
471
|
_setAriaAttributes() {}
|
|
472
472
|
_setCustomProps() {}
|
|
473
|
-
_setDOMElementType(t, { context: e, overwrite:
|
|
473
|
+
_setDOMElementType(t, { context: e, overwrite: i = !0, strict: s = !1 } = {}) {
|
|
474
474
|
if (typeof this.selectors[t] != "string") throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);
|
|
475
475
|
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
476
|
k(HTMLElement, { context: e });
|
|
477
|
-
const o = Array.from(e.querySelectorAll(this.selectors[t])).filter((r) =>
|
|
478
|
-
Array.isArray(this._dom[t]) ?
|
|
477
|
+
const o = Array.from(e.querySelectorAll(this.selectors[t])).filter((r) => s ? r.parentElement === e : !0);
|
|
478
|
+
Array.isArray(this._dom[t]) ? i ? this._dom[t] = o : this._dom[t] = [...this._dom[t], ...o] : this._dom[t] = o[0] || null;
|
|
479
479
|
}
|
|
480
480
|
_resetDOMElementType(t) {
|
|
481
481
|
if (typeof this.selectors[t] != "string") throw new Error(`Graupl ${this.name}: "${t}" is not a valid element type.`);
|
|
@@ -505,8 +505,8 @@
|
|
|
505
505
|
type: this._storageKey
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
|
-
_setInterval(t, e,
|
|
509
|
-
this._clearInterval(
|
|
508
|
+
_setInterval(t, e, i = "_default") {
|
|
509
|
+
this._clearInterval(i), this._intervals[i] = setInterval(t, e);
|
|
510
510
|
}
|
|
511
511
|
_clearInterval(t = "_default") {
|
|
512
512
|
clearInterval(this._intervals[t]);
|
|
@@ -514,8 +514,8 @@
|
|
|
514
514
|
_clearIntervals() {
|
|
515
515
|
for (const t of Object.keys(this._intervals)) this._clearInterval(t);
|
|
516
516
|
}
|
|
517
|
-
_setTimeout(t, e,
|
|
518
|
-
this._clearTimeout(
|
|
517
|
+
_setTimeout(t, e, i = "_default") {
|
|
518
|
+
this._clearTimeout(i), this._timeouts[i] = setTimeout(t, e);
|
|
519
519
|
}
|
|
520
520
|
_clearTimeout(t = "_default") {
|
|
521
521
|
clearTimeout(this._timeouts[t]);
|
|
@@ -523,38 +523,38 @@
|
|
|
523
523
|
_clearTimeouts() {
|
|
524
524
|
for (const t of Object.keys(this._timeouts)) this._clearTimeout(t);
|
|
525
525
|
}
|
|
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(
|
|
526
|
+
_registerEvent(t, { bubbles: e = !0, detail: i = {} } = {}) {
|
|
527
|
+
n("string", { name: t }), n("boolean", { bubbles: e }), n("object", { detail: i });
|
|
528
|
+
const s = `graupl${this.name}${t.charAt(0).toUpperCase()}${t.slice(1)}`;
|
|
529
|
+
this._events[t] = new CustomEvent(s, {
|
|
530
530
|
bubbles: e,
|
|
531
531
|
detail: {
|
|
532
532
|
component: this,
|
|
533
|
-
...
|
|
533
|
+
...i
|
|
534
534
|
}
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
_dispatchEvent(t, e) {
|
|
538
|
-
|
|
538
|
+
W(t, this), k(HTMLElement, { element: e }), e.dispatchEvent(this.events[t]);
|
|
539
539
|
}
|
|
540
|
-
_addEventListener(t, e,
|
|
541
|
-
e.addEventListener(t,
|
|
540
|
+
_addEventListener(t, e, i, s = {}) {
|
|
541
|
+
e.addEventListener(t, i, s), this._listeners.push({
|
|
542
542
|
type: t,
|
|
543
543
|
element: e,
|
|
544
|
-
listener:
|
|
545
|
-
options:
|
|
544
|
+
listener: i,
|
|
545
|
+
options: s
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
_removeEventListener(t, e,
|
|
549
|
-
e.removeEventListener(t,
|
|
548
|
+
_removeEventListener(t, e, i, s = {}) {
|
|
549
|
+
e.removeEventListener(t, i, s);
|
|
550
550
|
let o = -1;
|
|
551
|
-
this._listeners.forEach((r,
|
|
552
|
-
r.type === t && r.element === e && r.listener ===
|
|
551
|
+
this._listeners.forEach((r, l) => {
|
|
552
|
+
r.type === t && r.element === e && r.listener === i && JSON.stringify(r.options) === JSON.stringify(s) && (o = l);
|
|
553
553
|
}), o !== -1 && this._listeners.splice(o, 1);
|
|
554
554
|
}
|
|
555
555
|
_removeEventListeners({ type: t = null, element: e = null } = {}) {
|
|
556
|
-
[...this._listeners].forEach((
|
|
557
|
-
t !== null &&
|
|
556
|
+
[...this._listeners].forEach((i) => {
|
|
557
|
+
t !== null && i.type !== t || e !== null && i.element !== e || this._removeEventListener(i.type, i.element, i.listener, i.options);
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
focus() {
|
|
@@ -566,23 +566,23 @@
|
|
|
566
566
|
dispose() {
|
|
567
567
|
this._clearIntervals(), this._clearTimeouts(), this._removeEventListeners(), this._unstore(), delete this;
|
|
568
568
|
}
|
|
569
|
-
},
|
|
569
|
+
}, Y = class extends O {
|
|
570
570
|
_rootDOMElement = "item";
|
|
571
571
|
_protectedDOMElements = [
|
|
572
572
|
"toggle",
|
|
573
573
|
"header",
|
|
574
574
|
"content"
|
|
575
575
|
];
|
|
576
|
-
_open = new
|
|
577
|
-
_locked = new
|
|
576
|
+
_open = new D(!1);
|
|
577
|
+
_locked = new D(!1);
|
|
578
578
|
_name = "AccordionItem";
|
|
579
579
|
_storageKey = "accordionItems";
|
|
580
580
|
_shouldStore = !1;
|
|
581
|
-
constructor({ accordionItemElement: t, accordionItemToggleElement: e, accordionItemHeaderElement:
|
|
581
|
+
constructor({ accordionItemElement: t, accordionItemToggleElement: e, accordionItemHeaderElement: i, accordionItemContentElement: s, parentAccordion: o = null }) {
|
|
582
582
|
super({
|
|
583
583
|
prefix: o.prefix,
|
|
584
584
|
key: o.key
|
|
585
|
-
}), this._dom.item = t, this._dom.toggle = e, this._dom.header =
|
|
585
|
+
}), this._dom.item = t, this._dom.toggle = e, this._dom.header = i, this._dom.content = s, this._elements.parent = o, this._registerEvent("expand", { detail: { item: this } }), this._registerEvent("collapse", { detail: { item: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
586
586
|
this.dom.toggle.getAttribute("aria-expanded") === "true" ? this.show({
|
|
587
587
|
force: !0,
|
|
588
588
|
emit: !1,
|
|
@@ -605,42 +605,42 @@
|
|
|
605
605
|
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
606
|
}
|
|
607
607
|
_setAriaAttributes() {
|
|
608
|
-
|
|
608
|
+
B("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), B("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
609
|
}
|
|
610
610
|
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
611
|
-
const { closeClass:
|
|
612
|
-
this.dom.toggle.setAttribute("aria-expanded", "true"), e && o !== "" ? (
|
|
613
|
-
|
|
614
|
-
|
|
611
|
+
const { closeClass: i, openClass: s, transitionClass: o, openDuration: r } = this.elements.parent;
|
|
612
|
+
this.dom.toggle.setAttribute("aria-expanded", "true"), e && o !== "" ? (h(o, this.dom.item), requestAnimationFrame(() => {
|
|
613
|
+
c(i, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
614
|
+
h(s, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height + this.dom.content.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
615
615
|
this._setTimeout(() => {
|
|
616
|
-
|
|
616
|
+
c(o, this.dom.item), this.dom.item.style.height = "";
|
|
617
617
|
}, r);
|
|
618
618
|
});
|
|
619
619
|
});
|
|
620
|
-
})) : (
|
|
620
|
+
})) : (h(s, this.dom.item), c(i, this.dom.item)), this.dom.content.removeAttribute("inert"), t && this._dispatchEvent("expand", this.dom.item);
|
|
621
621
|
}
|
|
622
622
|
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
623
|
-
const { closeClass:
|
|
624
|
-
this.dom.toggle.setAttribute("aria-expanded", "false"), e && o !== "" ? (
|
|
625
|
-
|
|
626
|
-
|
|
623
|
+
const { closeClass: i, openClass: s, transitionClass: o, closeDuration: r } = this.elements.parent;
|
|
624
|
+
this.dom.toggle.setAttribute("aria-expanded", "false"), e && o !== "" ? (h(o, this.dom.item), this.dom.item.style.height = `${this.dom.item.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
625
|
+
c(s, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
626
|
+
h(i, this.dom.item), requestAnimationFrame(() => {
|
|
627
627
|
this._setTimeout(() => {
|
|
628
|
-
|
|
628
|
+
c(o, this.dom.item), this.dom.item.style.height = "";
|
|
629
629
|
}, r);
|
|
630
630
|
});
|
|
631
631
|
});
|
|
632
|
-
})) : (
|
|
632
|
+
})) : (h(i, this.dom.item), c(s, this.dom.item)), this.dom.content.setAttribute("inert", "true"), t && this._dispatchEvent("collapse", this.dom.item);
|
|
633
633
|
}
|
|
634
|
-
show({ force: t = !1, preserveState: e = !1, emit:
|
|
634
|
+
show({ force: t = !1, preserveState: e = !1, emit: i = !0, transition: s = !0 } = {}) {
|
|
635
635
|
this.isOpen && !t || (this._reveal({
|
|
636
|
-
emit:
|
|
637
|
-
transition:
|
|
636
|
+
emit: i,
|
|
637
|
+
transition: s
|
|
638
638
|
}), 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
639
|
}
|
|
640
|
-
hide({ force: t = !1, preserveState: e = !1, emit:
|
|
640
|
+
hide({ force: t = !1, preserveState: e = !1, emit: i = !0, transition: s = !0 } = {}) {
|
|
641
641
|
!this.isOpen && !t || !this.elements.parent.allowCollapseAll && this.elements.parent.openAccordionItems.length <= 1 || (this._conceal({
|
|
642
|
-
emit:
|
|
643
|
-
transition:
|
|
642
|
+
emit: i,
|
|
643
|
+
transition: s
|
|
644
644
|
}), 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
645
|
}
|
|
646
646
|
toggle() {
|
|
@@ -669,9 +669,9 @@
|
|
|
669
669
|
});
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
|
-
function
|
|
672
|
+
function d(t) {
|
|
673
673
|
try {
|
|
674
|
-
const e = t.key || t.keyCode,
|
|
674
|
+
const e = t.key || t.keyCode, i = {
|
|
675
675
|
Enter: e === "Enter" || e === 13,
|
|
676
676
|
Space: e === " " || e === "Spacebar" || e === 32,
|
|
677
677
|
Escape: e === "Escape" || e === "Esc" || e === 27,
|
|
@@ -685,15 +685,15 @@
|
|
|
685
685
|
Tab: e === "Tab" || e === 9,
|
|
686
686
|
Asterisk: e === "*" || e === 56
|
|
687
687
|
};
|
|
688
|
-
return Object.keys(
|
|
688
|
+
return Object.keys(i).find((s) => i[s] === !0) || "";
|
|
689
689
|
} catch {
|
|
690
690
|
return "";
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function a(t) {
|
|
694
694
|
t.preventDefault(), t.stopPropagation();
|
|
695
695
|
}
|
|
696
|
-
var
|
|
696
|
+
var tt = class extends O {
|
|
697
697
|
_rootDOMElement = "accordion";
|
|
698
698
|
_optionalKeySupport = !0;
|
|
699
699
|
_expandMultiple = !0;
|
|
@@ -701,44 +701,44 @@
|
|
|
701
701
|
_currentChild = 0;
|
|
702
702
|
_storageKey = "accordions";
|
|
703
703
|
_name = "Accordion";
|
|
704
|
-
constructor({ accordionElement: t, accordionItemsSelector: e = ".accordion-item", accordionItemTogglesSelector:
|
|
704
|
+
constructor({ accordionElement: t, accordionItemsSelector: e = ".accordion-item", accordionItemTogglesSelector: i = ".accordion-item-toggle", accordionItemHeadersSelector: s = ".accordion-item-header", accordionItemContentsSelector: o = ".accordion-item-content", accordionControlContainerSelector: r = ".accordion-control-container", accordionControlsSelector: l = ".accordion-control", expandControllerSelector: u = ".expand-all", collapseControllerSelector: f = ".collapse-all", openClass: C = "show", closeClass: E = "hide", transitionClass: b = "transitioning", transitionDuration: I = 300, openDuration: g = -1, closeDuration: y = -1, optionalKeySupport: w = !1, allowExpandMultiple: T = !0, allowCollapseAll: v = !0, automaticActivation: A = !1, prefix: x = "graupl-", key: $ = null, initializeClass: M = "initializing", initialize: S = !1 }) {
|
|
705
705
|
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
|
-
|
|
706
|
+
prefix: x,
|
|
707
|
+
key: $,
|
|
708
|
+
initializeClass: M
|
|
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 = i, this._selectors.accordionItemHeaders = s, this._selectors.accordionItemContents = o, this._selectors.accordionControlContainer = r, this._selectors.accordionControls = l, this._selectors.expandController = u, this._selectors.collapseController = f, this._elements.accordionItems = [], this._classes.open = C || "", this._classes.close = E || "", this._classes.transition = b || "", this._durations.transition = I, this._durations.open = g, this._durations.close = y, this._automatic = A, this._optionalKeySupport = w, this._expandMultiple = T, this._collapseAll = v, this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
710
|
+
this.dom.expandController.length > 0 && !this.allowExpandMultiple && this.dom.expandController.forEach((p) => {
|
|
711
|
+
p.setAttribute("disabled", "disabled");
|
|
712
|
+
}), this.dom.collapseController.length > 0 && !this.allowCollapseAll && this.dom.collapseController.forEach((p) => {
|
|
713
|
+
p.setAttribute("disabled", "disabled");
|
|
714
714
|
});
|
|
715
715
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
716
|
-
const
|
|
716
|
+
const p = n("boolean", {
|
|
717
717
|
automaticActivation: this._automatic,
|
|
718
718
|
optionalKeySupport: this._optionalKeySupport,
|
|
719
719
|
allowExpandMultiple: this._expandMultiple,
|
|
720
720
|
allowCollapseAll: this._collapseAll
|
|
721
721
|
});
|
|
722
|
-
|
|
723
|
-
}),
|
|
722
|
+
p.status || (this._errors = [...this._errors, ...p.errors], this._valid = !1);
|
|
723
|
+
}), S && this.initialize();
|
|
724
724
|
}
|
|
725
725
|
get openClass() {
|
|
726
726
|
return this._classes.open;
|
|
727
727
|
}
|
|
728
728
|
set openClass(t) {
|
|
729
|
-
|
|
729
|
+
m({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
730
730
|
}
|
|
731
731
|
get closeClass() {
|
|
732
732
|
return this._classes.close;
|
|
733
733
|
}
|
|
734
734
|
set closeClass(t) {
|
|
735
|
-
|
|
735
|
+
m({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
736
736
|
}
|
|
737
737
|
get transitionClass() {
|
|
738
738
|
return this._classes.transition;
|
|
739
739
|
}
|
|
740
740
|
set transitionClass(t) {
|
|
741
|
-
|
|
741
|
+
m({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
742
742
|
}
|
|
743
743
|
get transitionDuration() {
|
|
744
744
|
return this._durations.transition;
|
|
@@ -821,14 +821,14 @@
|
|
|
821
821
|
}
|
|
822
822
|
_createChildElements() {
|
|
823
823
|
this.dom.accordionItems.forEach((t, e) => {
|
|
824
|
-
const
|
|
824
|
+
const i = new Y({
|
|
825
825
|
accordionItemElement: t,
|
|
826
826
|
accordionItemToggleElement: this.dom.accordionItemToggles[e],
|
|
827
827
|
accordionItemHeaderElement: this.dom.accordionItemHeaders[e],
|
|
828
828
|
accordionItemContentElement: this.dom.accordionItemContents[e],
|
|
829
829
|
parentAccordion: this
|
|
830
830
|
});
|
|
831
|
-
|
|
831
|
+
i.initialize(), this.elements.accordionItems.push(i);
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
_handleFocus() {
|
|
@@ -856,58 +856,58 @@
|
|
|
856
856
|
_handleKeydown() {
|
|
857
857
|
this.dom.accordionItemToggles.forEach((t) => {
|
|
858
858
|
this._addEventListener("keydown", t, (e) => {
|
|
859
|
-
const
|
|
860
|
-
["Space", "Enter"].includes(
|
|
859
|
+
const i = d(e);
|
|
860
|
+
["Space", "Enter"].includes(i) ? (a(e), this.currentEvent = "keyboard") : this.optionalKeySupport && [
|
|
861
861
|
"ArrowDown",
|
|
862
862
|
"ArrowUp",
|
|
863
863
|
"Home",
|
|
864
864
|
"End"
|
|
865
|
-
].includes(
|
|
865
|
+
].includes(i) && (a(e), this.currentEvent = "keyboard");
|
|
866
866
|
});
|
|
867
867
|
}), this.dom.accordionControls.forEach((t) => {
|
|
868
868
|
this._addEventListener("keydown", t, (e) => {
|
|
869
|
-
const
|
|
870
|
-
["Space", "Enter"].includes(
|
|
869
|
+
const i = d(e);
|
|
870
|
+
["Space", "Enter"].includes(i) && (a(e), this.currentEvent = "keyboard");
|
|
871
871
|
});
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
874
|
_handleKeyup() {
|
|
875
875
|
this.dom.accordionItemToggles.forEach((t) => {
|
|
876
876
|
this._addEventListener("keyup", t, (e) => {
|
|
877
|
-
const
|
|
878
|
-
switch (
|
|
877
|
+
const i = d(e);
|
|
878
|
+
switch (i) {
|
|
879
879
|
case "Space":
|
|
880
880
|
case "Enter":
|
|
881
|
-
|
|
881
|
+
a(e), this.currentEvent = "keyboard", this.currentAccordionItem.toggle();
|
|
882
882
|
break;
|
|
883
883
|
}
|
|
884
|
-
if (this.optionalKeySupport) switch (
|
|
884
|
+
if (this.optionalKeySupport) switch (i) {
|
|
885
885
|
case "Home":
|
|
886
|
-
|
|
886
|
+
a(e), this.focusFirstChild();
|
|
887
887
|
break;
|
|
888
888
|
case "End":
|
|
889
|
-
|
|
889
|
+
a(e), this.focusLastChild();
|
|
890
890
|
break;
|
|
891
891
|
case "ArrowDown":
|
|
892
|
-
|
|
892
|
+
a(e), this.focusNextChild();
|
|
893
893
|
break;
|
|
894
894
|
case "ArrowUp":
|
|
895
|
-
|
|
895
|
+
a(e), this.focusPreviousChild();
|
|
896
896
|
break;
|
|
897
897
|
}
|
|
898
898
|
});
|
|
899
899
|
}), this.dom.expandController.forEach((t) => {
|
|
900
900
|
this._addEventListener("keyup", t, (e) => {
|
|
901
|
-
switch (
|
|
901
|
+
switch (d(e)) {
|
|
902
902
|
case "Space":
|
|
903
|
-
case "Enter":
|
|
903
|
+
case "Enter": a(e), this.currentEvent = "keyboard", this.allowExpandMultiple && this.openChildren();
|
|
904
904
|
}
|
|
905
905
|
});
|
|
906
906
|
}), this.dom.collapseController.forEach((t) => {
|
|
907
907
|
this._addEventListener("keyup", t, (e) => {
|
|
908
|
-
switch (
|
|
908
|
+
switch (d(e)) {
|
|
909
909
|
case "Space":
|
|
910
|
-
case "Enter":
|
|
910
|
+
case "Enter": a(e), this.currentEvent = "keyboard", this.allowCollapseAll && this.closeChildren();
|
|
911
911
|
}
|
|
912
912
|
});
|
|
913
913
|
});
|
|
@@ -940,68 +940,68 @@
|
|
|
940
940
|
this.elements.accordionItems.forEach((t) => t.hide());
|
|
941
941
|
}
|
|
942
942
|
};
|
|
943
|
-
const
|
|
944
|
-
function q(t, e,
|
|
945
|
-
return t[`${e}Attribute`](K,
|
|
943
|
+
const N = /[\11\12\14\15\40]+/, K = "data-once", et = document;
|
|
944
|
+
function q(t, e, i) {
|
|
945
|
+
return t[`${e}Attribute`](K, i);
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function L(t) {
|
|
948
948
|
if (typeof t != "string") throw new TypeError("once ID must be a string");
|
|
949
|
-
if (t === "" ||
|
|
949
|
+
if (t === "" || N.test(t)) throw new RangeError("once ID must not be empty or contain spaces");
|
|
950
950
|
return `[${K}~="${t}"]`;
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function st(t) {
|
|
953
953
|
if (!(t instanceof Element)) throw new TypeError("The element must be an instance of Element");
|
|
954
954
|
return !0;
|
|
955
955
|
}
|
|
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" ?
|
|
956
|
+
function z(t, e = et) {
|
|
957
|
+
let i = t;
|
|
958
|
+
if (t === null) i = [];
|
|
959
|
+
else if (t) if (e instanceof Document || e instanceof DocumentFragment || e instanceof Element) typeof t == "string" ? i = e.querySelectorAll(t) : t instanceof Element && (i = [t]);
|
|
960
960
|
else throw new TypeError("Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".");
|
|
961
961
|
else throw new TypeError("Selector must not be empty");
|
|
962
|
-
return Array.prototype.slice.call(
|
|
962
|
+
return Array.prototype.slice.call(i);
|
|
963
963
|
}
|
|
964
|
-
function Q(t, e,
|
|
965
|
-
return e.filter((
|
|
966
|
-
const o =
|
|
967
|
-
return o &&
|
|
964
|
+
function Q(t, e, i) {
|
|
965
|
+
return e.filter((s) => {
|
|
966
|
+
const o = st(s) && s.matches(t);
|
|
967
|
+
return o && i && i(s), o;
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
|
-
function
|
|
971
|
-
const
|
|
972
|
-
q(t, "has") && q(t, "get").trim().split(
|
|
973
|
-
|
|
974
|
-
}), e &&
|
|
975
|
-
const o =
|
|
970
|
+
function G(t, { add: e, remove: i }) {
|
|
971
|
+
const s = [];
|
|
972
|
+
q(t, "has") && q(t, "get").trim().split(N).forEach((r) => {
|
|
973
|
+
s.indexOf(r) < 0 && r !== i && s.push(r);
|
|
974
|
+
}), e && s.push(e);
|
|
975
|
+
const o = s.join(" ");
|
|
976
976
|
q(t, o === "" ? "remove" : "set", o);
|
|
977
977
|
}
|
|
978
|
-
function
|
|
979
|
-
return Q(`:not(${
|
|
978
|
+
function _(t, e, i) {
|
|
979
|
+
return Q(`:not(${L(t)})`, z(e, i), (s) => G(s, { add: t }));
|
|
980
980
|
}
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
const o =
|
|
985
|
-
new
|
|
986
|
-
accordionElement:
|
|
981
|
+
_.remove = (t, e, i) => Q(L(t), z(e, i), (s) => G(s, { remove: t })), _.filter = (t, e, i) => Q(L(t), z(e, i)), _.find = (t, e) => z(t ? L(t) : `[${K}]`, e);
|
|
982
|
+
const it = (t = {}, e = document, i = ".accordion") => {
|
|
983
|
+
_("graupl-accordion-generator", i, e).forEach((s) => {
|
|
984
|
+
const o = s.dataset.grauplAccordionOptions ? JSON.parse(s.dataset.grauplAccordionOptions.replace(/'/g, "\"")) || {} : {};
|
|
985
|
+
new tt({
|
|
986
|
+
accordionElement: s,
|
|
987
987
|
initialize: !0,
|
|
988
988
|
...t,
|
|
989
989
|
...o
|
|
990
990
|
});
|
|
991
991
|
});
|
|
992
992
|
};
|
|
993
|
-
var
|
|
993
|
+
var ot = class extends O {
|
|
994
994
|
_rootDOMElement = "alert";
|
|
995
995
|
_protectedDOMElements = ["controller"];
|
|
996
|
-
_hidden = new
|
|
996
|
+
_hidden = new D(!1);
|
|
997
997
|
_storageKey = "alerts";
|
|
998
998
|
_name = "Alert";
|
|
999
|
-
constructor({ alertElement: t, controllerElement: e = null, showClass:
|
|
999
|
+
constructor({ alertElement: t, controllerElement: e = null, showClass: i = "show", hideClass: s = "hide", transitionClass: o = "transitioning", transitionDuration: r = 150, showDuration: l = -1, hideDuration: u = -1, isHidden: f = !1, prefix: C = "graupl-", key: E = null, initializeClass: b = "initializing", initialize: I = !1 } = {}) {
|
|
1000
1000
|
super({
|
|
1001
1001
|
prefix: C,
|
|
1002
1002
|
key: E,
|
|
1003
|
-
initializeClass:
|
|
1004
|
-
}), this._dom.alert = t, this._dom.controller = e, this._classes.show =
|
|
1003
|
+
initializeClass: b
|
|
1004
|
+
}), this._dom.alert = t, this._dom.controller = e, this._classes.show = i || "", this._classes.hide = s || "", this._classes.transition = o || "", this._durations.transition = r, this._durations.show = l, this._durations.hide = u, this._hidden.value = f, this._hidden.commit(), this._registerEvent("show", { detail: { alert: this } }), this._registerEvent("hide", { detail: { alert: this } }), this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1005
1005
|
this.isHidden && this._conceal({
|
|
1006
1006
|
emit: !1,
|
|
1007
1007
|
transition: !1
|
|
@@ -1009,25 +1009,25 @@
|
|
|
1009
1009
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1010
1010
|
const g = n("boolean", { isHidden: this._hidden.value }, { shouldThrow: !1 });
|
|
1011
1011
|
g.status || (this._errors = [...this._errors, ...g.errors], this._valid = !1);
|
|
1012
|
-
}),
|
|
1012
|
+
}), I && this.initialize();
|
|
1013
1013
|
}
|
|
1014
1014
|
get showClass() {
|
|
1015
1015
|
return this._classes.show;
|
|
1016
1016
|
}
|
|
1017
1017
|
set showClass(t) {
|
|
1018
|
-
|
|
1018
|
+
m({ showClass: t }), this._classes.show !== t && (this._classes.show = t);
|
|
1019
1019
|
}
|
|
1020
1020
|
get hideClass() {
|
|
1021
1021
|
return this._classes.hide;
|
|
1022
1022
|
}
|
|
1023
1023
|
set hideClass(t) {
|
|
1024
|
-
|
|
1024
|
+
m({ hideClass: t }), this._classes.hide !== t && (this._classes.hide = t);
|
|
1025
1025
|
}
|
|
1026
1026
|
get transitionClass() {
|
|
1027
1027
|
return this._classes.transition;
|
|
1028
1028
|
}
|
|
1029
1029
|
set transitionClass(t) {
|
|
1030
|
-
|
|
1030
|
+
m({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1031
1031
|
}
|
|
1032
1032
|
get transitionDuration() {
|
|
1033
1033
|
return this._durations.transition;
|
|
@@ -1054,22 +1054,22 @@
|
|
|
1054
1054
|
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
1055
|
}
|
|
1056
1056
|
_reveal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
1057
|
-
e && this.transitionClass !== "" ? (
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
this._setTimeout(() =>
|
|
1057
|
+
e && this.transitionClass !== "" ? (h(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1058
|
+
c(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1059
|
+
h(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1060
|
+
this._setTimeout(() => c(this.transitionClass, this.dom.alert), this.showDuration);
|
|
1061
1061
|
});
|
|
1062
1062
|
});
|
|
1063
|
-
})) : (
|
|
1063
|
+
})) : (h(this.showClass, this.dom.alert), c(this.hideClass, this.dom.alert)), this.dom.alert.removeAttribute("inert"), t && this._dispatchEvent("show", this.dom.alert);
|
|
1064
1064
|
}
|
|
1065
1065
|
_conceal({ emit: t = !0, transition: e = !0 } = {}) {
|
|
1066
|
-
e && this.transitionClass !== "" ? (
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this._setTimeout(() =>
|
|
1066
|
+
e && this.transitionClass !== "" ? (h(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1067
|
+
c(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1068
|
+
h(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
1069
|
+
this._setTimeout(() => c(this.transitionClass, this.dom.alert), this.hideDuration);
|
|
1070
1070
|
});
|
|
1071
1071
|
});
|
|
1072
|
-
})) : (
|
|
1072
|
+
})) : (h(this.hideClass, this.dom.alert), c(this.showClass, this.dom.alert)), this.dom.alert.setAttribute("inert", "true"), t && this._dispatchEvent("hide", this.dom.alert);
|
|
1073
1073
|
}
|
|
1074
1074
|
_setCustomProps() {
|
|
1075
1075
|
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`);
|
|
@@ -1079,13 +1079,13 @@
|
|
|
1079
1079
|
}
|
|
1080
1080
|
_handleKeydown() {
|
|
1081
1081
|
this.dom.controller !== null && this._addEventListener("keydown", this.dom.controller, (t) => {
|
|
1082
|
-
const e =
|
|
1083
|
-
(e === "Space" || e === "Enter") &&
|
|
1082
|
+
const e = d(t);
|
|
1083
|
+
(e === "Space" || e === "Enter") && a(t);
|
|
1084
1084
|
});
|
|
1085
1085
|
}
|
|
1086
1086
|
_handleKeyup() {
|
|
1087
1087
|
this.dom.controller !== null && this._addEventListener("keyup", this.dom.controller, (t) => {
|
|
1088
|
-
const e =
|
|
1088
|
+
const e = d(t);
|
|
1089
1089
|
(e === "Space" || e === "Enter") && this.hide();
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
@@ -1096,89 +1096,108 @@
|
|
|
1096
1096
|
this.isHidden && !t || (this.focusState = "none", this._conceal(), this._hidden.value = !0, e || this._hidden.commit());
|
|
1097
1097
|
}
|
|
1098
1098
|
};
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
const o =
|
|
1102
|
-
new
|
|
1103
|
-
alertElement:
|
|
1104
|
-
controllerElement:
|
|
1099
|
+
const rt = (t = {}, e = document, i = ".alert") => {
|
|
1100
|
+
_("graupl-alert-generator", i, e).forEach((s) => {
|
|
1101
|
+
const o = s.dataset.grauplAlertOptions ? JSON.parse(s.dataset.grauplAlertOptions.replace(/'/g, "\"")) || {} : {};
|
|
1102
|
+
new ot({
|
|
1103
|
+
alertElement: s,
|
|
1104
|
+
controllerElement: s.querySelector(".alert-dismisser") || null,
|
|
1105
1105
|
initialize: !0,
|
|
1106
1106
|
...t,
|
|
1107
1107
|
...o
|
|
1108
1108
|
});
|
|
1109
1109
|
});
|
|
1110
1110
|
};
|
|
1111
|
-
var
|
|
1111
|
+
var V = class extends O {
|
|
1112
|
+
_rootDOMElement = "carouselItem";
|
|
1113
|
+
_shouldStore = !1;
|
|
1114
|
+
_storageKey = "carouselItems";
|
|
1115
|
+
_name = "CarouselItem";
|
|
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 }) {
|
|
1118
|
+
super({
|
|
1119
|
+
prefix: o,
|
|
1120
|
+
key: r,
|
|
1121
|
+
initializeClass: l
|
|
1122
|
+
}), this._dom.carouselItem = t, this._dom.tab = e, this._elements.clone = i ?? null, this._elements.parent = s, u && this.initialize();
|
|
1123
|
+
}
|
|
1124
|
+
activate({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1125
|
+
requestAnimationFrame(() => {
|
|
1126
|
+
h(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.removeAttribute("inert"), t && this.elements.parent.dom.carouselItemContainer.scrollTo({
|
|
1127
|
+
left: this.dom.carouselItem.offsetLeft,
|
|
1128
|
+
top: this.dom.carouselItem.offsetTop,
|
|
1129
|
+
behavior: "smooth",
|
|
1130
|
+
...e
|
|
1131
|
+
}), this.dom.tab && requestAnimationFrame(() => {
|
|
1132
|
+
h(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !0);
|
|
1133
|
+
});
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
deactivate() {
|
|
1137
|
+
requestAnimationFrame(() => {
|
|
1138
|
+
c(this.elements.parent.activeClass, this.dom.carouselItem), this.dom.carouselItem.setAttribute("inert", !0), requestAnimationFrame(() => {
|
|
1139
|
+
this.dom.tab && (c(this.elements.parent.activeClass, this.dom.tab), this.dom.tab.setAttribute("aria-selected", !1));
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
}, nt = class extends O {
|
|
1112
1144
|
_rootDOMElement = "carousel";
|
|
1113
1145
|
_currentItem = 0;
|
|
1114
1146
|
_autoplay = !0;
|
|
1115
1147
|
_playText = "Play";
|
|
1116
1148
|
_pauseText = "Pause";
|
|
1117
|
-
_currentAction = "next";
|
|
1118
1149
|
_storageKey = "carousels";
|
|
1119
1150
|
_name = "Carousel";
|
|
1120
|
-
|
|
1151
|
+
_itemsPerPage = 1;
|
|
1152
|
+
_loop = !0;
|
|
1153
|
+
constructor({ carouselElement: t, carouselItemsSelector: e = ".carousel-item", carouselItemContainerSelector: i = ".carousel-item-container", carouselControlsSelector: s = ".carousel-control", carouselControlContainerSelector: o = ".carousel-control-container", carouselTabsSelector: r = ".carousel-tab", carouselTabContainerSelector: l = ".carousel-tab-container", autoplaySelector: u = ".autoplay", nextSelector: f = ".next", previousSelector: C = ".previous", activeClass: E = "active", playClass: b = "play", pauseClass: I = "pause", autoplay: g = !0, transitionDelay: y = 1e4, playText: w = "Play", pauseText: T = "Pause", itemsPerPage: v = 1, loop: A = !0, prefix: x = "graupl-", key: $ = null, initializeClass: M = "initializing", initialize: S = !1 }) {
|
|
1121
1154
|
super({
|
|
1122
|
-
prefix:
|
|
1123
|
-
key:
|
|
1124
|
-
initializeClass:
|
|
1125
|
-
}), 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 =
|
|
1126
|
-
this._handleAutoplay(), this.
|
|
1127
|
-
A.setAttribute("inert", "true");
|
|
1128
|
-
}), this.activateFirstItem();
|
|
1155
|
+
prefix: x,
|
|
1156
|
+
key: $,
|
|
1157
|
+
initializeClass: M
|
|
1158
|
+
}), 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 = i, this._selectors.carouselControls = s, this._selectors.carouselControlContainer = o, this._selectors.carouselTabs = r, this._selectors.carouselTabContainer = l, this._selectors.autoplay = u, this._selectors.next = f, this._selectors.previous = C, this._elements.carouselItems = [], this._classes.active = E || "", this._classes.play = b || "", this._classes.pause = I || "", this._autoplay = g, this._itemsPerPage = v, this._loop = A, this._delays.transition = y, this._playText = w || "", this._pauseText = T || "", this._addEventListener("grauplComponentInitialize", this.rootDOMElement, () => {
|
|
1159
|
+
this._handleAutoplay(), this.loop && this._handleLoop(), this._handleIntersection(), this.activateFirstItem({ scrollOptions: { behavior: "instant" } });
|
|
1129
1160
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1161
|
+
const p = n("boolean", {
|
|
1162
|
+
autoplay: this._autoplay,
|
|
1163
|
+
loop: this._loop
|
|
1164
|
+
}, { shouldThrow: !1 });
|
|
1165
|
+
p.status || (this._errors = [...this._errors, ...p.errors], this._valid = !1);
|
|
1132
1166
|
const P = n("string", {
|
|
1133
1167
|
playText: this._playText,
|
|
1134
1168
|
pauseText: this._pauseText
|
|
1135
1169
|
}, { shouldThrow: !1 });
|
|
1136
1170
|
P.status || (this._errors = [...this._errors, ...P.errors], this._valid = !1);
|
|
1137
|
-
|
|
1171
|
+
const F = n("number", { itemsPerPage: this._itemsPerPage }, { shouldThrow: !1 });
|
|
1172
|
+
F.status || (this._errors = [...this._errors, ...F.errors], this._valid = !1);
|
|
1173
|
+
}), S && this.initialize();
|
|
1138
1174
|
}
|
|
1139
1175
|
get activeClass() {
|
|
1140
1176
|
return this._classes.active;
|
|
1141
1177
|
}
|
|
1142
1178
|
set activeClass(t) {
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1145
|
-
get previousClass() {
|
|
1146
|
-
return this._classes.previous;
|
|
1147
|
-
}
|
|
1148
|
-
set previousClass(t) {
|
|
1149
|
-
d({ previousClass: t }), this._classes.previous !== t && (this._classes.previous = t);
|
|
1150
|
-
}
|
|
1151
|
-
get nextClass() {
|
|
1152
|
-
return this._classes.next;
|
|
1153
|
-
}
|
|
1154
|
-
set nextClass(t) {
|
|
1155
|
-
d({ nextClass: t }), this._classes.next !== t && (this._classes.next = t);
|
|
1179
|
+
m({ activeClass: t }), this._classes.active !== t && (this._classes.active = t);
|
|
1156
1180
|
}
|
|
1157
1181
|
get playClass() {
|
|
1158
1182
|
return this._classes.play;
|
|
1159
1183
|
}
|
|
1160
1184
|
set playClass(t) {
|
|
1161
|
-
|
|
1185
|
+
m({ playClass: t }), this._classes.play !== t && (this._classes.play = t);
|
|
1162
1186
|
}
|
|
1163
1187
|
get pauseClass() {
|
|
1164
1188
|
return this._classes.pause;
|
|
1165
1189
|
}
|
|
1166
1190
|
set pauseClass(t) {
|
|
1167
|
-
|
|
1191
|
+
m({ pauseClass: t }), this._classes.pause !== t && (this._classes.pause = t);
|
|
1168
1192
|
}
|
|
1169
1193
|
get currentItem() {
|
|
1170
1194
|
return this._currentItem;
|
|
1171
1195
|
}
|
|
1172
1196
|
set currentItem(t) {
|
|
1173
|
-
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
|
|
1174
|
-
e.setAttribute("aria-selected", s === this._currentItem);
|
|
1175
|
-
}));
|
|
1197
|
+
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);
|
|
1176
1198
|
}
|
|
1177
1199
|
get currentCarouselItem() {
|
|
1178
|
-
return this.
|
|
1179
|
-
}
|
|
1180
|
-
get currentCarouselTab() {
|
|
1181
|
-
return this.dom.carouselTabs[this.currentItem];
|
|
1200
|
+
return this.elements.carouselItems[this.currentItem];
|
|
1182
1201
|
}
|
|
1183
1202
|
get autoplay() {
|
|
1184
1203
|
return this._autoplay;
|
|
@@ -1186,18 +1205,18 @@
|
|
|
1186
1205
|
set autoplay(t) {
|
|
1187
1206
|
n("boolean", { autoplay: t }), this._autoplay !== t && (this._autoplay = t);
|
|
1188
1207
|
}
|
|
1208
|
+
get itemsPerPage() {
|
|
1209
|
+
return this._itemsPerPage;
|
|
1210
|
+
}
|
|
1211
|
+
get loop() {
|
|
1212
|
+
return this._loop;
|
|
1213
|
+
}
|
|
1189
1214
|
get transitionDelay() {
|
|
1190
1215
|
return this._delays.transition;
|
|
1191
1216
|
}
|
|
1192
1217
|
set transitionDelay(t) {
|
|
1193
1218
|
n("number", { transitionDelay: t }), t !== this.transitionDelay && t >= 0 && (this._delays.transition = t);
|
|
1194
1219
|
}
|
|
1195
|
-
get transitionDuration() {
|
|
1196
|
-
return this._durations.transition;
|
|
1197
|
-
}
|
|
1198
|
-
set transitionDuration(t) {
|
|
1199
|
-
n("number", { transitionDuration: t }), this._durations.transition !== t && t >= 0 && (this._durations.transition = t, this._setTransitionDuration());
|
|
1200
|
-
}
|
|
1201
1220
|
get playText() {
|
|
1202
1221
|
return this._playText;
|
|
1203
1222
|
}
|
|
@@ -1210,12 +1229,22 @@
|
|
|
1210
1229
|
set pauseText(t) {
|
|
1211
1230
|
n("string", { pauseText: t }), this._pauseText !== t && (this._pauseText = t);
|
|
1212
1231
|
}
|
|
1213
|
-
get currentAction() {
|
|
1214
|
-
return this._currentAction;
|
|
1215
|
-
}
|
|
1216
1232
|
_setDOMElements() {
|
|
1217
1233
|
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 });
|
|
1218
1234
|
}
|
|
1235
|
+
_createChildElements() {
|
|
1236
|
+
this.dom.carouselItems.forEach((t, e) => {
|
|
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
|
+
});
|
|
1247
|
+
}
|
|
1219
1248
|
_setIds() {
|
|
1220
1249
|
this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`, this.dom.carouselItems.forEach((t, e) => {
|
|
1221
1250
|
t.id = t.id || `carousel-item-${this.key}-${e}`;
|
|
@@ -1224,15 +1253,36 @@
|
|
|
1224
1253
|
}), this._id = this.dom.carousel.id;
|
|
1225
1254
|
}
|
|
1226
1255
|
_setAriaAttributes() {
|
|
1227
|
-
!
|
|
1228
|
-
|
|
1256
|
+
!B("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) => {
|
|
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);
|
|
1229
1260
|
});
|
|
1230
1261
|
}
|
|
1231
|
-
_setCustomProps() {
|
|
1232
|
-
this.dom.carousel.style.setProperty(`--${this.prefix}carousel-transition-duration`, `${this.transitionDuration}ms`);
|
|
1233
|
-
}
|
|
1234
1262
|
_handleAutoplay() {
|
|
1235
|
-
this.autoplay ? (
|
|
1263
|
+
this.autoplay ? (h(this.pauseClass, this.dom.autoplay), c(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)) : (h(this.playClass, this.dom.autoplay), c(this.pauseClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.playText), this.dom.carousel.setAttribute("aria-live", "polite"), this._clearInterval());
|
|
1264
|
+
}
|
|
1265
|
+
_handleIntersection() {
|
|
1266
|
+
const t = {
|
|
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
|
+
});
|
|
1236
1286
|
}
|
|
1237
1287
|
_handleFocus() {
|
|
1238
1288
|
this._addEventListener("focusin", this.dom.carousel, () => {
|
|
@@ -1242,15 +1292,15 @@
|
|
|
1242
1292
|
});
|
|
1243
1293
|
}
|
|
1244
1294
|
_handleClick() {
|
|
1245
|
-
this._addEventListener("click", this.dom.next, () => {
|
|
1246
|
-
this.activateNextItem();
|
|
1247
|
-
}), this._addEventListener("click", this.dom.previous, () => {
|
|
1248
|
-
this.activatePreviousItem();
|
|
1249
|
-
}), this._addEventListener("click", this.dom.autoplay, () => {
|
|
1250
|
-
this.toggleAutoplay();
|
|
1251
|
-
}), this.
|
|
1252
|
-
this._addEventListener("click", t, () => {
|
|
1253
|
-
|
|
1295
|
+
this._addEventListener("click", this.dom.next, (t) => {
|
|
1296
|
+
t.button === 0 && (a(t), this.currentEvent = "mouse", this.activateNextItem());
|
|
1297
|
+
}), this._addEventListener("click", this.dom.previous, (t) => {
|
|
1298
|
+
t.button === 0 && (a(t), this.currentEvent = "mouse", this.activatePreviousItem());
|
|
1299
|
+
}), this._addEventListener("click", this.dom.autoplay, (t) => {
|
|
1300
|
+
t.button === 0 && (a(t), this.currentEvent = "mouse", this.toggleAutoplay());
|
|
1301
|
+
}), this.elements.carouselItems.forEach((t) => {
|
|
1302
|
+
t.dom.tab && this._addEventListener("click", t.dom.tab, (e) => {
|
|
1303
|
+
e.button === 0 && (a(e), this.currentEvent = "mouse", this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)));
|
|
1254
1304
|
});
|
|
1255
1305
|
});
|
|
1256
1306
|
}
|
|
@@ -1264,19 +1314,19 @@
|
|
|
1264
1314
|
_handleKeydown() {
|
|
1265
1315
|
this.dom.carouselControls.forEach((t) => {
|
|
1266
1316
|
this._addEventListener("keydown", t, (e) => {
|
|
1267
|
-
switch (
|
|
1317
|
+
switch (d(e)) {
|
|
1268
1318
|
case "Space":
|
|
1269
1319
|
case "Enter":
|
|
1270
|
-
|
|
1320
|
+
a(e);
|
|
1271
1321
|
break;
|
|
1272
1322
|
}
|
|
1273
1323
|
});
|
|
1274
|
-
}), this.
|
|
1275
|
-
this._addEventListener("keydown", t, (e) => {
|
|
1276
|
-
switch (
|
|
1324
|
+
}), this.elements.carouselItems.forEach((t) => {
|
|
1325
|
+
t.dom.tab && this._addEventListener("keydown", t.dom.tab, (e) => {
|
|
1326
|
+
switch (d(e)) {
|
|
1277
1327
|
case "Space":
|
|
1278
1328
|
case "Enter":
|
|
1279
|
-
|
|
1329
|
+
a(e);
|
|
1280
1330
|
break;
|
|
1281
1331
|
}
|
|
1282
1332
|
});
|
|
@@ -1284,105 +1334,176 @@
|
|
|
1284
1334
|
}
|
|
1285
1335
|
_handleKeyup() {
|
|
1286
1336
|
this._addEventListener("keyup", this.dom.next, (t) => {
|
|
1287
|
-
switch (
|
|
1337
|
+
switch (d(t)) {
|
|
1288
1338
|
case "Space":
|
|
1289
1339
|
case "Enter":
|
|
1290
|
-
this.activateNextItem(),
|
|
1340
|
+
this.activateNextItem(), a(t);
|
|
1291
1341
|
break;
|
|
1292
1342
|
}
|
|
1293
1343
|
}), this._addEventListener("keyup", this.dom.previous, (t) => {
|
|
1294
|
-
switch (
|
|
1344
|
+
switch (d(t)) {
|
|
1295
1345
|
case "Space":
|
|
1296
1346
|
case "Enter":
|
|
1297
|
-
this.activatePreviousItem(),
|
|
1347
|
+
this.activatePreviousItem(), a(t);
|
|
1298
1348
|
break;
|
|
1299
1349
|
}
|
|
1300
1350
|
}), this._addEventListener("keyup", this.dom.autoplay, (t) => {
|
|
1301
|
-
switch (
|
|
1351
|
+
switch (d(t)) {
|
|
1302
1352
|
case "Space":
|
|
1303
1353
|
case "Enter":
|
|
1304
|
-
this.toggleAutoplay(),
|
|
1354
|
+
this.toggleAutoplay(), a(t);
|
|
1305
1355
|
break;
|
|
1306
1356
|
}
|
|
1307
|
-
}), this.
|
|
1308
|
-
this._addEventListener("keyup", t, (
|
|
1309
|
-
switch (
|
|
1357
|
+
}), this.elements.carouselItems.forEach((t) => {
|
|
1358
|
+
t.dom.tab && this._addEventListener("keyup", t.dom.tab, (e) => {
|
|
1359
|
+
switch (d(e)) {
|
|
1310
1360
|
case "Space":
|
|
1311
1361
|
case "Enter":
|
|
1312
|
-
this.activateItem(
|
|
1362
|
+
this.activateItem(this.dom.carouselItems.indexOf(t.dom.carouselItem)), a(e);
|
|
1313
1363
|
break;
|
|
1314
1364
|
}
|
|
1315
1365
|
});
|
|
1316
1366
|
});
|
|
1317
1367
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
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);
|
|
1396
|
+
});
|
|
1320
1397
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1398
|
+
activateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1399
|
+
this.currentCarouselItem.activate({
|
|
1400
|
+
scroll: t,
|
|
1401
|
+
scrollOptions: e
|
|
1402
|
+
});
|
|
1323
1403
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1404
|
+
deactivateCurrentItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1405
|
+
this.currentCarouselItem.deactivate({
|
|
1406
|
+
scroll: t,
|
|
1407
|
+
scrollOptions: e
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
activateItem(t, { scroll: e = !0, scrollOptions: i = {} } = {}) {
|
|
1411
|
+
this.autoplay && this._clearInterval(), this.deactivateCurrentItem({
|
|
1412
|
+
scroll: e,
|
|
1413
|
+
scrollOptions: i
|
|
1414
|
+
}), this.currentItem = t, this.activateCurrentItem({
|
|
1415
|
+
scroll: e,
|
|
1416
|
+
scrollOptions: i
|
|
1332
1417
|
}), this.autoplay && this._setInterval(() => this.activateNextItem(), this.transitionDelay);
|
|
1333
1418
|
}
|
|
1334
|
-
activateFirstItem() {
|
|
1335
|
-
this.
|
|
1419
|
+
activateFirstItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1420
|
+
this.loop ? this.currentItem === this.dom.carouselItems.length - this.itemsPerPage - 1 ? this.activateNextItem({
|
|
1421
|
+
scroll: t,
|
|
1422
|
+
scrollOptions: e
|
|
1423
|
+
}) : this.activateItem(this.itemsPerPage, {
|
|
1424
|
+
scroll: t,
|
|
1425
|
+
scrollOptions: e
|
|
1426
|
+
}) : this.activateItem(0, {
|
|
1427
|
+
scroll: t,
|
|
1428
|
+
scrollOptions: e
|
|
1429
|
+
});
|
|
1336
1430
|
}
|
|
1337
|
-
activateLastItem() {
|
|
1338
|
-
this.
|
|
1431
|
+
activateLastItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1432
|
+
this.loop ? this.currentItem === this.itemsPerPage ? this.activatePreviousItem({
|
|
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
|
+
});
|
|
1339
1442
|
}
|
|
1340
|
-
activateNextItem() {
|
|
1341
|
-
this.
|
|
1443
|
+
activateNextItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1444
|
+
this.loop ? this.activateItem(this.currentItem + 1, {
|
|
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
|
+
});
|
|
1342
1454
|
}
|
|
1343
|
-
activatePreviousItem() {
|
|
1344
|
-
this.
|
|
1455
|
+
activatePreviousItem({ scroll: t = !0, scrollOptions: e = {} } = {}) {
|
|
1456
|
+
this.loop ? this.activateItem(this.currentItem - 1, {
|
|
1457
|
+
scroll: t,
|
|
1458
|
+
scrollOptions: e
|
|
1459
|
+
}) : this.currentItem - 1 < 0 || this.loop && this.currentItem - 1 < this.itemsPerPage ? this.activateLastItem({
|
|
1460
|
+
scroll: t,
|
|
1461
|
+
scrollOptions: e
|
|
1462
|
+
}) : this.activateItem(this.currentItem - 1, {
|
|
1463
|
+
scroll: t,
|
|
1464
|
+
scrollOptions: e
|
|
1465
|
+
});
|
|
1345
1466
|
}
|
|
1346
1467
|
toggleAutoplay() {
|
|
1347
1468
|
this.autoplay = !this.autoplay, this._handleAutoplay();
|
|
1348
1469
|
}
|
|
1349
1470
|
};
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
const o =
|
|
1353
|
-
new
|
|
1354
|
-
carouselElement:
|
|
1471
|
+
const at = (t = {}, e = document, i = ".carousel") => {
|
|
1472
|
+
_("graupl-carousel-generator", i, e).forEach((s) => {
|
|
1473
|
+
const o = s.dataset.grauplCarouselOptions ? JSON.parse(s.dataset.grauplCarouselOptions.replace(/'/g, "\"")) || {} : {};
|
|
1474
|
+
new nt({
|
|
1475
|
+
carouselElement: s,
|
|
1355
1476
|
initialize: !0,
|
|
1356
1477
|
...t,
|
|
1357
1478
|
...o
|
|
1358
1479
|
});
|
|
1359
1480
|
});
|
|
1360
|
-
},
|
|
1361
|
-
|
|
1362
|
-
const o =
|
|
1481
|
+
}, lt = (t = {}, e = document, i = ".navigation") => {
|
|
1482
|
+
_("graupl-navigation-generator", i, e).forEach((s) => {
|
|
1483
|
+
const o = s.dataset.grauplMenuType || DisclosureMenu;
|
|
1363
1484
|
if (window[o] === void 0) {
|
|
1364
1485
|
console.warn(`Graupl navigation requires accessible-menu's ${o}. Please make sure to include it on this page.`);
|
|
1365
1486
|
return;
|
|
1366
1487
|
}
|
|
1367
|
-
const r =
|
|
1488
|
+
const r = s.dataset.grauplMenuOptions ? JSON.parse(s.dataset.grauplMenuOptions.replace(/'/g, "\"")) || {} : {}, l = s.querySelector(".menu"), u = s.querySelector(".navigation-toggle") || null, f = u ? s : null;
|
|
1368
1489
|
new window[o]({
|
|
1369
|
-
menuElement:
|
|
1490
|
+
menuElement: l,
|
|
1370
1491
|
menuItemSelector: ".menu-item",
|
|
1371
1492
|
menuLinkSelector: ".menu-link",
|
|
1372
1493
|
submenuItemSelector: ".submenu-item",
|
|
1373
1494
|
submenuToggleSelector: ".submenu-toggle",
|
|
1374
|
-
controllerElement:
|
|
1495
|
+
controllerElement: u,
|
|
1375
1496
|
containerElement: f,
|
|
1376
1497
|
...t,
|
|
1377
1498
|
...r
|
|
1378
1499
|
});
|
|
1379
1500
|
});
|
|
1380
1501
|
};
|
|
1381
|
-
var
|
|
1502
|
+
var ht = class extends O {
|
|
1382
1503
|
_rootDOMElement = "disclosure";
|
|
1383
1504
|
_protectedDOMElements = ["controller"];
|
|
1384
|
-
_open = new
|
|
1385
|
-
_locked = new
|
|
1505
|
+
_open = new D(!1);
|
|
1506
|
+
_locked = new D(!1);
|
|
1386
1507
|
_openInsideBreakpoint = !1;
|
|
1387
1508
|
_openOutsideBreakpoint = !1;
|
|
1388
1509
|
_closeInsideBreakpoint = !1;
|
|
@@ -1398,17 +1519,17 @@
|
|
|
1398
1519
|
_mediaQueryListEventCallback = (t) => {
|
|
1399
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());
|
|
1400
1521
|
};
|
|
1401
|
-
constructor({ disclosureElement: t, controllerElement: e, disclosureContentSelector:
|
|
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 } = {}) {
|
|
1402
1523
|
super({
|
|
1403
|
-
prefix:
|
|
1404
|
-
key:
|
|
1405
|
-
initializeClass:
|
|
1406
|
-
}), this._dom.disclosure = t, this._dom.controller = e, this._selectors.content =
|
|
1524
|
+
prefix: dt,
|
|
1525
|
+
key: ut,
|
|
1526
|
+
initializeClass: mt
|
|
1527
|
+
}), this._dom.disclosure = t, this._dom.controller = e, this._selectors.content = i, this._classes.locked = s || "", this._classes.unlocked = o || "", this._classes.open = r || "", this._classes.close = l || "", this._classes.transition = u || "", this._durations.transition = f, this._durations.open = C, this._durations.close = E, this._openOnFocus = b, this._closeOnBlur = I, g !== "" && (console.warn("`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead."), y === "" && (y = g)), w && y !== "" && (console.warn("`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead."), v = w, A = w), this._breakpoint = y || "", this._openInsideBreakpoint = T, this._openOutsideBreakpoint = v, this._closeInsideBreakpoint = A, this._closeOutsideBreakpoint = x, this._lockInsideBreakpoint = $, this._lockOutsideBreakpoint = M, this._unlockInsideBreakpoint = S, this._unlockOutsideBreakpoint = p, this._mediaQueryString = F || "", this._locked.value = P, 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, () => {
|
|
1407
1528
|
requestAnimationFrame(() => {
|
|
1408
|
-
this.dom.controller.getAttribute("aria-expanded") === "true" || this.openOutsideBreakpoint && !window.matchMedia(this.mediaQuery).matches || this.openInsideBreakpoint && window.matchMedia(this.mediaQuery).matches ? this.open() : this.close(),
|
|
1529
|
+
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 });
|
|
1409
1530
|
});
|
|
1410
1531
|
}), this._addEventListener("grauplComponentValidate", this.rootDOMElement, () => {
|
|
1411
|
-
const
|
|
1532
|
+
const R = n("boolean", {
|
|
1412
1533
|
openOnFocus: this._openOnFocus,
|
|
1413
1534
|
closeOnBlur: this._closeOnBlur,
|
|
1414
1535
|
openInsideBreakpoint: this._openInsideBreakpoint,
|
|
@@ -1421,38 +1542,38 @@
|
|
|
1421
1542
|
unlockOutsideBreakpoint: this._unlockOutsideBreakpoint,
|
|
1422
1543
|
locked: this._locked.value
|
|
1423
1544
|
}, { shouldThrow: !1 });
|
|
1424
|
-
|
|
1425
|
-
}),
|
|
1545
|
+
R.status || (this._errors = [...this._errors, ...R.errors], this._valid = !1);
|
|
1546
|
+
}), pt && this.initialize();
|
|
1426
1547
|
}
|
|
1427
1548
|
get lockedClass() {
|
|
1428
1549
|
return this._classes.locked;
|
|
1429
1550
|
}
|
|
1430
1551
|
set lockedClass(t) {
|
|
1431
|
-
|
|
1552
|
+
m({ lockedClass: t }), this._classes.locked !== t && (this._classes.locked = t);
|
|
1432
1553
|
}
|
|
1433
1554
|
get unlockedClass() {
|
|
1434
1555
|
return this._classes.unlocked;
|
|
1435
1556
|
}
|
|
1436
1557
|
set unlockedClass(t) {
|
|
1437
|
-
|
|
1558
|
+
m({ unlockedClass: t }), this._classes.unlocked !== t && (this._classes.unlocked = t);
|
|
1438
1559
|
}
|
|
1439
1560
|
get openClass() {
|
|
1440
1561
|
return this._classes.open;
|
|
1441
1562
|
}
|
|
1442
1563
|
set openClass(t) {
|
|
1443
|
-
|
|
1564
|
+
m({ openClass: t }), this._classes.open !== t && (this._classes.open = t);
|
|
1444
1565
|
}
|
|
1445
1566
|
get closeClass() {
|
|
1446
1567
|
return this._classes.close;
|
|
1447
1568
|
}
|
|
1448
1569
|
set closeClass(t) {
|
|
1449
|
-
|
|
1570
|
+
m({ closeClass: t }), this._classes.close !== t && (this._classes.close = t);
|
|
1450
1571
|
}
|
|
1451
1572
|
get transitionClass() {
|
|
1452
1573
|
return this._classes.transition;
|
|
1453
1574
|
}
|
|
1454
1575
|
set transitionClass(t) {
|
|
1455
|
-
|
|
1576
|
+
m({ transitionClass: t }), this._classes.transition !== t && (this._classes.transition = t);
|
|
1456
1577
|
}
|
|
1457
1578
|
get transitionDuration() {
|
|
1458
1579
|
return this._durations.transition;
|
|
@@ -1536,7 +1657,7 @@
|
|
|
1536
1657
|
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;
|
|
1537
1658
|
}
|
|
1538
1659
|
_setAriaAttributes() {
|
|
1539
|
-
this.dom.controller.getAttribute("aria-expanded") !== "true" && this.dom.controller.setAttribute("aria-expanded", "false"), this.dom.controller.setAttribute("aria-controls", this.dom.disclosure.id),
|
|
1660
|
+
this.dom.controller.getAttribute("aria-expanded") !== "true" && this.dom.controller.setAttribute("aria-expanded", "false"), this.dom.controller.setAttribute("aria-controls", this.dom.disclosure.id), B("button", { controller: this.dom.controller }, { shouldThrow: !1 }).status || this.dom.controller.setAttribute("role", "button");
|
|
1540
1661
|
}
|
|
1541
1662
|
_setCustomProps() {
|
|
1542
1663
|
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`);
|
|
@@ -1545,32 +1666,32 @@
|
|
|
1545
1666
|
this._resetDOMElementType("content"), this._setDOMElementType("content", { context: this.dom.disclosure });
|
|
1546
1667
|
}
|
|
1547
1668
|
_reveal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
1548
|
-
this.dom.controller.setAttribute("aria-expanded", "true"), e && this.transitionlass !== "" ? (
|
|
1549
|
-
|
|
1550
|
-
|
|
1669
|
+
this.dom.controller.setAttribute("aria-expanded", "true"), e && this.transitionlass !== "" ? (h(this.transitionClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1670
|
+
c(this.closeClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1671
|
+
h(this.openClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1551
1672
|
setTimeout(() => {
|
|
1552
|
-
|
|
1673
|
+
c(this.transitionClass, this.dom.disclosure);
|
|
1553
1674
|
}, this.openDuration);
|
|
1554
1675
|
});
|
|
1555
1676
|
});
|
|
1556
|
-
})) : (
|
|
1677
|
+
})) : (h(this.openClass, this.dom.disclosure), c(this.closeClass, this.dom.disclosure)), this.dom.content.removeAttribute("inert"), t && this._dispatchEvent("expand", this.dom.controller);
|
|
1557
1678
|
}
|
|
1558
1679
|
_conceal({ emit: t = this.isInitialized, transition: e = this.isInitialized } = {}) {
|
|
1559
|
-
this.dom.controller.setAttribute("aria-expanded", "false"), e && this.transitionClass !== "" ? (
|
|
1560
|
-
|
|
1561
|
-
|
|
1680
|
+
this.dom.controller.setAttribute("aria-expanded", "false"), e && this.transitionClass !== "" ? (h(this.transitionClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1681
|
+
c(this.openClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1682
|
+
h(this.closeClass, this.dom.disclosure), requestAnimationFrame(() => {
|
|
1562
1683
|
setTimeout(() => {
|
|
1563
|
-
|
|
1684
|
+
c(this.transitionClass, this.dom.disclosure), this.dom.content.innert = !0;
|
|
1564
1685
|
}, this.closeDuration);
|
|
1565
1686
|
});
|
|
1566
1687
|
});
|
|
1567
|
-
})) : (
|
|
1688
|
+
})) : (h(this.closeClass, this.dom.disclosure), c(this.openClass, this.dom.disclosure)), this.dom.content.setAttribute("inert", "true"), t && this._dispatchEvent("collapse", this.dom.controller);
|
|
1568
1689
|
}
|
|
1569
1690
|
_lock({ emit: t = this.isInitialized } = {}) {
|
|
1570
|
-
|
|
1691
|
+
h(this.lockedClass, this.dom.disclosure), c(this.unlockedClass, this.dom.disclosure), this.dom.controller.setAttribute("disabled", "true"), t && this._dispatchEvent("lock", this.dom.disclosure);
|
|
1571
1692
|
}
|
|
1572
1693
|
_unlock({ emit: t = this.isInitialized } = {}) {
|
|
1573
|
-
|
|
1694
|
+
h(this.unlockedClass, this.dom.disclosure), c(this.lockedClass, this.dom.disclosure), this.dom.controller.removeAttribute("disabled"), t && this._dispatchEvent("unlock", this.dom.disclosure);
|
|
1574
1695
|
}
|
|
1575
1696
|
_handleFocus() {
|
|
1576
1697
|
this._addEventListener("focusout", this.dom.disclosure, (t) => {
|
|
@@ -1581,97 +1702,97 @@
|
|
|
1581
1702
|
}
|
|
1582
1703
|
_handleClick() {
|
|
1583
1704
|
this._addEventListener("click", this.dom.controller, (t) => {
|
|
1584
|
-
this.currentEvent = "mouse", t.button === 0 && (
|
|
1705
|
+
this.currentEvent = "mouse", t.button === 0 && (a(t), this.toggle());
|
|
1585
1706
|
}), this._addEventListener("click", document, (t) => {
|
|
1586
1707
|
this.focusState !== "self" || !this.closeOnBlur || (this.currentEvent = "mouse", !this.dom.disclosure.contains(t.target) && this.dom.controller !== t.target && this.close());
|
|
1587
1708
|
});
|
|
1588
1709
|
}
|
|
1589
1710
|
_handleKeydown() {
|
|
1590
1711
|
this._addEventListener("keydown", this.dom.controller, (t) => {
|
|
1591
|
-
switch (this.currentEvent = "keyboard",
|
|
1712
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1592
1713
|
case "Space":
|
|
1593
1714
|
case "Enter":
|
|
1594
|
-
|
|
1715
|
+
a(t);
|
|
1595
1716
|
break;
|
|
1596
1717
|
}
|
|
1597
1718
|
}), this._addEventListener("keydown", this.dom.disclosure, (t) => {
|
|
1598
|
-
this.currentEvent = "keyboard",
|
|
1719
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && a(t);
|
|
1599
1720
|
});
|
|
1600
1721
|
}
|
|
1601
1722
|
_handleKeyup() {
|
|
1602
1723
|
this._addEventListener("keyup", this.dom.controller, (t) => {
|
|
1603
|
-
switch (this.currentEvent = "keyboard",
|
|
1724
|
+
switch (this.currentEvent = "keyboard", d(t)) {
|
|
1604
1725
|
case "Space":
|
|
1605
1726
|
case "Enter":
|
|
1606
|
-
this.toggle(),
|
|
1727
|
+
this.toggle(), a(t);
|
|
1607
1728
|
break;
|
|
1608
1729
|
case "Tab":
|
|
1609
|
-
this.openOnFocus && (
|
|
1730
|
+
this.openOnFocus && (a(t), this.open());
|
|
1610
1731
|
break;
|
|
1611
1732
|
}
|
|
1612
1733
|
}), this._addEventListener("keyup", this.dom.disclosure, (t) => {
|
|
1613
|
-
this.currentEvent = "keyboard",
|
|
1734
|
+
this.currentEvent = "keyboard", d(t) === "Escape" && (this.close(), a(t));
|
|
1614
1735
|
});
|
|
1615
1736
|
}
|
|
1616
|
-
open({ force: t = !1, emit: e = this.isInitialized, transition:
|
|
1737
|
+
open({ force: t = !1, emit: e = this.isInitialized, transition: i = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1617
1738
|
this.isOpen && !t || this.isLocked && !t || (this.focusState = "self", this._reveal({
|
|
1618
1739
|
emit: e,
|
|
1619
|
-
transition:
|
|
1620
|
-
}), this._open.value = !0,
|
|
1740
|
+
transition: i
|
|
1741
|
+
}), this._open.value = !0, s || this._open.commit());
|
|
1621
1742
|
}
|
|
1622
|
-
preview({ force: t = !1, emit: e = this.isInitialized, transition:
|
|
1743
|
+
preview({ force: t = !1, emit: e = this.isInitialized, transition: i = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1623
1744
|
this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._reveal({
|
|
1624
1745
|
emit: e,
|
|
1625
|
-
transition:
|
|
1626
|
-
}), this._open.value = !0,
|
|
1746
|
+
transition: i
|
|
1747
|
+
}), this._open.value = !0, s || this._open.commit());
|
|
1627
1748
|
}
|
|
1628
|
-
close({ force: t = !1, emit: e = this.isInitialized, transition:
|
|
1749
|
+
close({ force: t = !1, emit: e = this.isInitialized, transition: i = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1629
1750
|
!this.isOpen && !t || this.isLocked && !t || (this.focusState = "none", this._conceal({
|
|
1630
1751
|
emit: e,
|
|
1631
|
-
transition:
|
|
1632
|
-
}), this._open.value = !1,
|
|
1752
|
+
transition: i
|
|
1753
|
+
}), this._open.value = !1, s || this._open.commit());
|
|
1633
1754
|
}
|
|
1634
|
-
toggle({ force: t = !1, emit: e = this.isInitialized, transition:
|
|
1755
|
+
toggle({ force: t = !1, emit: e = this.isInitialized, transition: i = this.isInitialized, preserveState: s = !1 } = {}) {
|
|
1635
1756
|
this.isOpen ? this.close({
|
|
1636
1757
|
force: t,
|
|
1637
1758
|
emit: e,
|
|
1638
|
-
transition:
|
|
1639
|
-
preserveState:
|
|
1759
|
+
transition: i,
|
|
1760
|
+
preserveState: s
|
|
1640
1761
|
}) : this.open({
|
|
1641
1762
|
force: t,
|
|
1642
1763
|
emit: e,
|
|
1643
|
-
transition:
|
|
1644
|
-
preserveState:
|
|
1764
|
+
transition: i,
|
|
1765
|
+
preserveState: s
|
|
1645
1766
|
});
|
|
1646
1767
|
}
|
|
1647
|
-
lock({ force: t = !1, emit: e = this.isInitialized, preserveState:
|
|
1648
|
-
this.isLocked && !t || (this._locked.value = !0, this._lock({ emit: e }),
|
|
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());
|
|
1649
1770
|
}
|
|
1650
|
-
unlock({ force: t = !1, emit: e = this.isInitialized, preserveState:
|
|
1651
|
-
!this.isLocked && !t || (this._locked.value = !1, this._unlock({ emit: e }),
|
|
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());
|
|
1652
1773
|
}
|
|
1653
|
-
toggleLock({ force: t = !1, emit: e = this.isInitialized, preserveState:
|
|
1774
|
+
toggleLock({ force: t = !1, emit: e = this.isInitialized, preserveState: i = !1 } = {}) {
|
|
1654
1775
|
this.isLocked ? this.unlock({
|
|
1655
1776
|
force: t,
|
|
1656
1777
|
emit: e,
|
|
1657
|
-
preserveState:
|
|
1778
|
+
preserveState: i
|
|
1658
1779
|
}) : this.lock({
|
|
1659
1780
|
force: t,
|
|
1660
1781
|
emit: e,
|
|
1661
|
-
preserveState:
|
|
1782
|
+
preserveState: i
|
|
1662
1783
|
});
|
|
1663
1784
|
}
|
|
1664
1785
|
};
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
const r = o.dataset.grauplDisclosureOptions ? JSON.parse(o.dataset.grauplDisclosureOptions.replace(/'/g, "\"")) || {} : {},
|
|
1668
|
-
if (!
|
|
1669
|
-
console.warn(`No controller found for disclosure with ID "${o.id}". Please ensure there is an element with the selector "${
|
|
1786
|
+
const ct = ({ options: t = {}, context: e = document, disclosureSelector: i = ".disclosure", controllerSelector: s = ".disclosure-toggle" } = {}) => {
|
|
1787
|
+
_("graupl-disclosure-generator", i, e).forEach((o) => {
|
|
1788
|
+
const r = o.dataset.grauplDisclosureOptions ? JSON.parse(o.dataset.grauplDisclosureOptions.replace(/'/g, "\"")) || {} : {}, l = `${s}[data-graupl-disclosure-target="${o.id}"]`, [u] = _("graupl-disclosure-generator", l, e);
|
|
1789
|
+
if (!u) {
|
|
1790
|
+
console.warn(`No controller found for disclosure with ID "${o.id}". Please ensure there is an element with the selector "${l}".`), _.remove("graupl-disclosure-generator", o);
|
|
1670
1791
|
return;
|
|
1671
1792
|
}
|
|
1672
|
-
new
|
|
1793
|
+
new ht({
|
|
1673
1794
|
disclosureElement: o,
|
|
1674
|
-
controllerElement:
|
|
1795
|
+
controllerElement: u,
|
|
1675
1796
|
initialize: !0,
|
|
1676
1797
|
...t,
|
|
1677
1798
|
...r
|
|
@@ -1679,7 +1800,7 @@
|
|
|
1679
1800
|
});
|
|
1680
1801
|
};
|
|
1681
1802
|
document.addEventListener("DOMContentLoaded", () => {
|
|
1682
|
-
|
|
1803
|
+
it(), rt(), at(), lt(), ct();
|
|
1683
1804
|
});
|
|
1684
1805
|
})();
|
|
1685
1806
|
|