-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathindex.min.js
More file actions
1057 lines (912 loc) · 31.7 KB
/
index.min.js
File metadata and controls
1057 lines (912 loc) · 31.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 251:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.refresh = refresh;
exports.trap = trap;
exports.untrap = untrap;
var _makeupFocusables = _interopRequireDefault(__webpack_require__(6257));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const _observer = typeof window !== "undefined" ? new MutationObserver(refresh) : null;
// for the element that will be trapped
let trappedEl;
// for the trap boundary/bumper elements
let topTrap;
let outerTrapBefore;
let innerTrapBefore;
let innerTrapAfter;
let outerTrapAfter;
let botTrap;
// for the first and last focusable element inside the trap
let firstFocusableElement;
let lastFocusableElement;
function createTrapBoundary() {
const trapBoundary = document.createElement("div");
trapBoundary.setAttribute("aria-hidden", "true");
trapBoundary.setAttribute("tabindex", "0");
trapBoundary.className = "keyboard-trap-boundary";
return trapBoundary;
}
function setFocusToFirstFocusableElement() {
firstFocusableElement.focus();
}
function setFocusToLastFocusableElement() {
lastFocusableElement.focus();
}
function createTraps() {
topTrap = createTrapBoundary();
outerTrapBefore = topTrap.cloneNode();
innerTrapBefore = topTrap.cloneNode();
innerTrapAfter = topTrap.cloneNode();
outerTrapAfter = topTrap.cloneNode();
botTrap = topTrap.cloneNode();
topTrap.addEventListener("focus", setFocusToFirstFocusableElement);
outerTrapBefore.addEventListener("focus", setFocusToFirstFocusableElement);
innerTrapBefore.addEventListener("focus", setFocusToLastFocusableElement);
innerTrapAfter.addEventListener("focus", setFocusToFirstFocusableElement);
outerTrapAfter.addEventListener("focus", setFocusToLastFocusableElement);
botTrap.addEventListener("focus", setFocusToLastFocusableElement);
}
function untrap() {
if (trappedEl) {
topTrap = safeDetach(topTrap);
outerTrapBefore = safeDetach(outerTrapBefore);
innerTrapBefore = safeDetach(innerTrapBefore);
innerTrapAfter = safeDetach(innerTrapAfter);
outerTrapAfter = safeDetach(outerTrapAfter);
botTrap = safeDetach(botTrap);
trappedEl.classList.remove("keyboard-trap--active");
// let observers know the keyboard is no longer trapped
trappedEl.dispatchEvent(new CustomEvent("keyboardUntrap", {
bubbles: true
}));
trappedEl = null;
_observer?.disconnect();
}
return trappedEl;
}
function safeDetach(el) {
const parent = el.parentNode;
return parent ? parent.removeChild(el) : el;
}
function trap(el) {
if (!topTrap) {
createTraps();
} else {
untrap();
}
trappedEl = el;
// when bundled up with isomorphic components on the server, this code is run,
// so we must check if 'document' is defined.
const body = typeof document === "undefined" ? null : document.body;
const focusableElements = (0, _makeupFocusables.default)(trappedEl, true);
firstFocusableElement = focusableElements[0];
lastFocusableElement = focusableElements[focusableElements.length - 1];
body.insertBefore(topTrap, body.childNodes[0]);
trappedEl.parentNode.insertBefore(outerTrapBefore, trappedEl);
trappedEl.insertBefore(innerTrapBefore, trappedEl.childNodes[0]);
trappedEl.appendChild(innerTrapAfter);
trappedEl.parentNode.insertBefore(outerTrapAfter, trappedEl.nextElementSibling);
body.appendChild(botTrap);
// let observers know the keyboard is now trapped
trappedEl.dispatchEvent(new CustomEvent("keyboardTrap", {
bubbles: true
}));
trappedEl.classList.add("keyboard-trap--active");
_observer?.observe(el, {
childList: true,
subtree: true
});
return trappedEl;
}
function refresh() {
if (topTrap && trappedEl) {
let focusableElements = (0, _makeupFocusables.default)(trappedEl, true);
focusableElements = focusableElements.filter(function (el) {
return !el.classList.contains("keyboard-trap-boundary");
});
firstFocusableElement = focusableElements[0];
lastFocusableElement = focusableElements[focusableElements.length - 1];
}
}
/***/ }),
/***/ 296:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(6939);
/***/ }),
/***/ 1381:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 1553:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.modal = modal;
exports.unmodal = unmodal;
var keyboardTrap = _interopRequireWildcard(__webpack_require__(251));
var screenreaderTrap = _interopRequireWildcard(__webpack_require__(3893));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const defaultOptions = {
hoist: false,
useHiddenProperty: false,
wrap: false
};
const tags = {
SCRIPT: "script",
LINK: "link"
};
let modalEl;
let hoistedPlaceholderEl;
let inertContentEl;
let originalPositionIndexes = [];
function isRootLevel(el) {
return el.parentNode.tagName.toLowerCase() === "body";
}
function unhoist() {
if (hoistedPlaceholderEl) {
hoistedPlaceholderEl.replaceWith(modalEl);
hoistedPlaceholderEl = null;
}
}
function hoist() {
if (!hoistedPlaceholderEl && !isRootLevel(modalEl)) {
hoistedPlaceholderEl = document.createElement("div");
hoistedPlaceholderEl.setAttribute("data-makeup-modal", "placeholder");
modalEl.parentElement.insertBefore(hoistedPlaceholderEl, modalEl);
document.body.appendChild(modalEl);
}
}
function wrap() {
if (!inertContentEl && isRootLevel(modalEl)) {
inertContentEl = document.createElement("div");
inertContentEl.setAttribute("data-makeup-modal", "inert");
[...document.body.children].forEach((child, index) => {
// checking for the script and link tags is necessary because moving them could cause issues.
// for example, moving a script to the top of the body could freeze the page while the script loads.
if (!(child === modalEl || child.tagName.toLowerCase() === tags.SCRIPT || child.tagName === tags.LINK)) {
inertContentEl.appendChild(child);
originalPositionIndexes.push(index);
}
});
document.body.prepend(inertContentEl);
}
}
function unwrap() {
if (inertContentEl) {
[...inertContentEl.children].forEach(child => {
if (!(child.tagName.toLowerCase() === tags.SCRIPT || child.tagName === tags.LINK)) {
const index = originalPositionIndexes.shift();
if (index > document.body.children.length) {
document.body.appendChild(child);
} else {
document.body.insertBefore(child, document.body.children[index + 1]);
}
}
});
inertContentEl.remove();
inertContentEl = null;
originalPositionIndexes = [];
}
}
function unmodal() {
if (modalEl) {
keyboardTrap.untrap(modalEl);
screenreaderTrap.untrap(modalEl);
unwrap();
unhoist();
document.body.removeAttribute("data-makeup-modal");
modalEl.removeAttribute("data-makeup-modal");
modalEl.dispatchEvent(new CustomEvent("makeup-unmodal", {
bubbles: false
}));
modalEl = null;
}
return modalEl;
}
function modal(el, options) {
const _options = Object.assign({}, defaultOptions, options);
unmodal();
modalEl = el;
if (_options.hoist) {
hoist();
}
if (_options.wrap) {
wrap();
}
screenreaderTrap.trap(modalEl, options);
// no need to create keyboard traps when inert content is using hidden property
if (!_options.useHiddenProperty) {
keyboardTrap.trap(modalEl);
}
document.body.setAttribute("data-makeup-modal", "true");
modalEl.setAttribute("data-makeup-modal", "widget");
modalEl.dispatchEvent(new CustomEvent("makeup-modal", {
bubbles: false
}));
return modalEl;
}
/***/ }),
/***/ 2002:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 2261:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getAncestors = getAncestors;
exports.getSiblings = getSiblings;
exports.getSiblingsOfAncestors = getSiblingsOfAncestors;
// filter function for ancestor elements
const filterAncestor = item => item.nodeType === 1 && item.tagName.toLowerCase() !== "body" && item.tagName.toLowerCase() !== "html";
// filter function for sibling elements
const filterSibling = item => item.nodeType === 1 && item.tagName.toLowerCase() !== "script";
// reducer to flatten arrays
const flattenArrays = (a, b) => a.concat(b);
// recursive function to get previous sibling nodes of given element
function getPreviousSiblings(el) {
let siblings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
const previousSibling = el.previousSibling;
if (!previousSibling) {
return siblings;
}
siblings.push(previousSibling);
return getPreviousSiblings(previousSibling, siblings);
}
// recursive function to get next sibling nodes of given element
function getNextSiblings(el) {
let siblings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
const nextSibling = el.nextSibling;
if (!nextSibling) {
return siblings;
}
siblings.push(nextSibling);
return getNextSiblings(nextSibling, siblings);
}
// returns all sibling element nodes of given element
function getSiblings(el) {
const allSiblings = getPreviousSiblings(el).concat(getNextSiblings(el));
return allSiblings.filter(filterSibling);
}
// recursive function to get all ancestor nodes of given element
function getAllAncestors(el) {
let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
const nextAncestor = el.parentNode;
if (!nextAncestor) {
return ancestors;
}
ancestors.push(nextAncestor);
return getAllAncestors(nextAncestor, ancestors);
}
// get ancestor nodes of given element
function getAncestors(el) {
return getAllAncestors(el).filter(filterAncestor);
}
// get siblings of ancestors (i.e. aunts and uncles) of given el
function getSiblingsOfAncestors(el) {
return getAncestors(el).map(item => getSiblings(item)).reduce(flattenArrays, []);
}
/***/ }),
/***/ 2583:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _makeupDialog = _interopRequireDefault(__webpack_require__(9893));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const defaultLightboxOptions = {
baseClass: "lightbox-dialog",
baseClassModifier: "",
quickDismiss: true,
closeButtonSelector: ".lightbox-dialog__close",
windowSelector: ".lightbox-dialog__window"
};
class _default extends _makeupDialog.default {
constructor(el) {
let selectedOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
super(el, Object.assign({}, defaultLightboxOptions, selectedOptions, {
modal: true
}));
}
_observeEvents() {
super._observeEvents();
this._onClickListener = _onClick.bind(this);
this._el.addEventListener("click", this._onClickListener);
}
_unobserveEvents() {
super._unobserveEvents();
this._el.removeEventListener("click", this._onClickListener);
}
destroy() {
super.destroy();
this._onClickListener = null;
}
}
exports["default"] = _default;
function _onClick(e) {
if (this._options.quickDismiss === true && e.target === this._el) {
this.close();
}
}
/***/ }),
/***/ 3540:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(2002);
/***/ }),
/***/ 3866:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _makeupLightboxDialog = _interopRequireDefault(__webpack_require__(2583));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const defaultAlertOptions = {
baseClass: "alert-dialog",
baseClassModifier: "alert",
quickDismiss: false,
acknowledgeButtonSelector: ".alert-dialog__acknowledge",
windowSelector: ".alert-dialog__window"
};
class _default extends _makeupLightboxDialog.default {
constructor(el) {
let selectedOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
super(el, Object.assign({}, defaultAlertOptions, selectedOptions));
}
_observeEvents() {
super._observeEvents();
this._acknowledgeButtonEl = this._el.querySelector(this._options.acknowledgeButtonSelector);
this._onAcknowledgeButtonClickListener = _onAcknowledgeButtonClick.bind(this);
this._acknowledgeButtonEl.addEventListener("click", this._onAcknowledgeButtonClickListener);
}
_unobserveEvents() {
super._unobserveEvents();
this._acknowledgeButtonEl.removeEventListener("click", this._onAcknowledgeButtonClickListener);
}
acknowledge() {
this._hide();
this._el.dispatchEvent(new CustomEvent("dialog-acknowledge"));
}
destroy() {
super.destroy();
this._onAcknowledgeButtonClickListener = null;
}
}
exports["default"] = _default;
function _onAcknowledgeButtonClick() {
this.acknowledge();
}
/***/ }),
/***/ 3893:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.trap = trap;
exports.untrap = untrap;
var util = _interopRequireWildcard(__webpack_require__(2261));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
// the main landmark
let mainEl;
// the element that will be trapped
let trappedEl;
// collection of elements that get 'dirtied' with aria-hidden attr or hidden prop
let dirtyObjects;
// filter function for svg elements
const filterSvg = item => item.tagName.toLowerCase() !== "svg";
function showElementPrep(el, useHiddenProperty) {
let preparedElement;
if (useHiddenProperty === false) {
preparedElement = prepareElement(el, "aria-hidden", "false");
} else {
preparedElement = prepareElement(el, "hidden", false);
}
return preparedElement;
}
function hideElementPrep(el, useHiddenProperty) {
let preparedElement;
if (useHiddenProperty === false) {
preparedElement = prepareElement(el, "aria-hidden", "true");
} else {
preparedElement = prepareElement(el, "hidden", true);
}
return preparedElement;
}
function prepareElement(el, attributeName, dirtyValue) {
const isProperty = typeof dirtyValue === "boolean";
return {
el,
attributeName,
cleanValue: isProperty ? el[attributeName] : el.getAttribute(attributeName),
dirtyValue,
isProperty
};
}
function dirtyElement(preparedObj) {
if (preparedObj.isProperty === true) {
preparedObj.el[preparedObj.attributeName] = preparedObj.dirtyValue;
} else {
preparedObj.el.setAttribute(preparedObj.attributeName, preparedObj.dirtyValue);
}
}
function cleanElement(preparedObj) {
if (preparedObj.cleanValue) {
if (preparedObj.isProperty === true) {
preparedObj.el[preparedObj.attributeName] = preparedObj.cleanValue;
} else {
preparedObj.el.setAttribute(preparedObj.attributeName, preparedObj.cleanValue);
}
} else {
preparedObj.el.removeAttribute(preparedObj.attributeName);
}
}
function untrap() {
if (trappedEl) {
// restore 'dirtied' elements to their original state
dirtyObjects.forEach(item => cleanElement(item));
dirtyObjects = [];
// 're-enable' the main landmark
if (mainEl) {
mainEl.setAttribute("role", "main");
}
// let observers know the screenreader is now untrapped
trappedEl.dispatchEvent(new CustomEvent("screenreaderUntrap", {
bubbles: true
}));
trappedEl = null;
}
}
const defaultOptions = {
useHiddenProperty: false
};
function trap(el, selectedOptions) {
// ensure current trap is deactivated
untrap();
const options = Object.assign({}, defaultOptions, selectedOptions);
// update the trapped el reference
trappedEl = el;
// update the main landmark reference
mainEl = document.querySelector('main, [role="main"]');
// we must remove the main landmark to avoid issues on voiceover iOS
if (mainEl) {
mainEl.setAttribute("role", "presentation");
}
// cache all ancestors, siblings & siblings of ancestors for trappedEl
const ancestors = util.getAncestors(trappedEl);
let siblings = util.getSiblings(trappedEl);
let siblingsOfAncestors = util.getSiblingsOfAncestors(trappedEl);
// if using hidden property, filter out SVG elements as they do not support this property
if (options.useHiddenProperty === true) {
siblings = siblings.filter(filterSvg);
siblingsOfAncestors = siblingsOfAncestors.filter(filterSvg);
}
// prepare elements
dirtyObjects = [showElementPrep(trappedEl, options.useHiddenProperty)].concat(ancestors.map(item => showElementPrep(item, options.useHiddenProperty))).concat(siblings.map(item => hideElementPrep(item, options.useHiddenProperty))).concat(siblingsOfAncestors.map(item => hideElementPrep(item, options.useHiddenProperty)));
// update DOM
dirtyObjects.forEach(item => dirtyElement(item));
// let observers know the screenreader is now trapped
trappedEl.dispatchEvent(new CustomEvent("screenreaderTrap", {
bubbles: true
}));
}
/***/ }),
/***/ 4658:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(8481);
__webpack_require__(3540);
/***/ }),
/***/ 5015:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(1381);
/***/ }),
/***/ 5625:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(6117);
/***/ }),
/***/ 5957:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 6117:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 6257:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
const focusableElList = ["a[href]", "area[href]", "button:not([disabled])", "embed", "iframe", "input:not([disabled])", "object", "select:not([disabled])", "textarea:not([disabled])", "*[tabindex]", "*[contenteditable]"];
const focusableElSelector = focusableElList.join();
function _default(el) {
let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
let callback = arguments.length > 2 ? arguments[2] : undefined;
if (callback) {
const request = requestAnimationFrame(() => {
callback(getFocusables(el, keyboardOnly));
});
return () => {
cancelAnimationFrame(request);
};
}
return getFocusables(el, keyboardOnly);
}
function getFocusables(el) {
let keyboardOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
let focusableEls = Array.prototype.slice.call(el.querySelectorAll(focusableElSelector));
// filter out elements with display: none or nested in a display: none parent
focusableEls = focusableEls.filter(function (focusableEl) {
return !!(focusableEl.offsetWidth || focusableEl.offsetHeight || focusableEl.getClientRects().length);
});
if (keyboardOnly === true) {
focusableEls = focusableEls.filter(function (focusableEl) {
return focusableEl.getAttribute("tabindex") !== "-1";
});
}
return focusableEls;
}
/***/ }),
/***/ 6558:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = transition;
/**
* Author: Mr D.Piercey
*/
const TRANSITION_END = "transitionend";
const IMMEDIATE_TRANSITION_REG = /0m?s(?:, )?/g;
/**
* Applies a primer `-init` class before starting a transition
* to make transitioning properties that are not animatable easier.
*
* **Order**
* 1. Add class: "$name-init"
* 2. Wait one frame.
* 3. Remove class "$name-init".
* 4. Add class "$name".
* 5. Wait for animation to finish.
* 6. Remove class "$name".
*
* @param {HTMLElement} el The root element that contains the animation.
* @param {string} name The base className to use for the transition.
* @param {Function} cb A callback called after the transition as ended.
*/
function transition(el, baseClass, cb) {
let ended;
let pending;
let ran = 0;
const classList = el.classList;
const initClass = "".concat(baseClass, "-init");
let cancelFrame = nextFrame(function () {
el.addEventListener(TRANSITION_END, listener, true);
classList.add(baseClass);
classList.remove(initClass);
pending = getTransitionCount(el);
cancelFrame = undefined;
if (pending === 0) {
cancel();
}
});
classList.add(initClass);
return cancel;
/**
* Cancels the current transition and resets the className.
*/
function cancel() {
if (ended) {
return;
}
ended = true;
el.removeEventListener(TRANSITION_END, listener, true);
if (cancelFrame) {
cancelFrame();
classList.remove(initClass);
} else {
classList.remove(baseClass);
}
}
/**
* Handles a single transition end event.
* Once all child transitions have ended the overall animation is completed.
*/
function listener() {
if (++ran === pending) {
ended = true;
el.removeEventListener(TRANSITION_END, listener, true);
classList.remove(baseClass);
if (cb) {
cb();
}
}
}
}
/**
* Walks the tree of an element and counts how many transitions have been applied.
*
* @param {HTMLElement} el
* @return {number}
*/
function getTransitionCount(el) {
let count = window.getComputedStyle(el).transitionDuration.replace(IMMEDIATE_TRANSITION_REG, "") ? 1 : 0;
let child = el.firstElementChild;
while (child) {
count += getTransitionCount(child);
child = child.nextElementSibling;
}
return count;
}
/**
* Runs a function during the next animation frame.
*
* @param {function} fn a function to run on the next animation frame.
* @return {function} a function to cancel the callback.
*/
function nextFrame(fn) {
let frame;
let cancelFrame;
if (window.requestAnimationFrame) {
frame = requestAnimationFrame(function () {
frame = requestAnimationFrame(fn);
});
cancelFrame = cancelAnimationFrame;
} else {
frame = setTimeout(fn, 26); // 16ms to simulate RAF, 10ms to ensure called after the frame.
cancelFrame = clearTimeout;
}
return function () {
if (frame) {
cancelFrame(frame);
frame = undefined;
}
};
}
/***/ }),
/***/ 6939:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 8481:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(9357);
/***/ }),
/***/ 9357:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ }),
/***/ 9893:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var Modal = _interopRequireWildcard(__webpack_require__(1553));
var _makeupFocusables = _interopRequireDefault(__webpack_require__(6257));
var _transition = _interopRequireDefault(__webpack_require__(6558));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const defaultDialogOptions = {
baseClass: "dialog",
closeButtonSelector: ".dialog__close",
focusManagementIndex: 0,
modal: false,
quickDismiss: true,
transitionsModifier: "mask-fade"
};
class _default {
constructor(widgetEl, selectedOptions) {
this._options = Object.assign({}, defaultDialogOptions, selectedOptions);
this._el = widgetEl;
if (this._options.modal === true) {
this._el.setAttribute("aria-modal", "true");
}
this._windowEl = this._el.querySelector(this._options.windowSelector);
this._closeButtonEl = this._el.querySelector(this._options.closeButtonSelector);
this._hasTransitions = this._el.classList.contains(`${this._options.baseClass}--${this._options.transitionsModifier}`);
this._onCloseButtonClickListener = _onCloseButtonClick.bind(this);
this._onKeyDownListener = _onKeyDown.bind(this);
this._onOpenTransitionEndCallback = _onOpenTransitionEnd.bind(this);
this._onCloseTransitionEndCallback = _onCloseTransitionEnd.bind(this);
this._el.classList.add(`${this._options.baseClass}--js`);
if (!this.hidden) {
if (this.modal) {
_doModalFocusManagement(this);
}
this._observeEvents();
}
}
get focusables() {
return (0, _makeupFocusables.default)(this._windowEl);
}
get modal() {
return this._el.getAttribute("aria-modal") === "true";
}
get hidden() {
return this._el.hidden;
}
open() {
this._show();
this._el.dispatchEvent(new CustomEvent("dialog-open"));
}
close() {
this._hide();
this._el.dispatchEvent(new CustomEvent("dialog-close"));
}
_show() {
if (this._hasTransitions) {
if (this._cancelTransition) {
this._cancelTransition();
}
this._cancelTransition = (0, _transition.default)(this._el, `${this._options.baseClass}--show`, this._onOpenTransitionEndCallback);
} else {
if (this.modal) {
setTimeout(() => _doModalFocusManagement(this), 50);
}
this._el.hidden = false;
}
this._observeEvents();
}
_hide() {
if (this._hasTransitions) {
if (this._cancelTransition) {
this._cancelTransition();
}
this._cancelTransition = (0, _transition.default)(this._el, `${this._options.baseClass}--hide`, this._onCloseTransitionEndCallback);
} else {
if (this.modal) {
Modal.unmodal();
}
this._el.hidden = true;
}
this._autoDismissTimeout = null;
this._unobserveEvents();
}
_observeEvents() {
document.addEventListener("keydown", this._onKeyDownListener);
if (this._closeButtonEl) {
this._closeButtonEl.addEventListener("click", this._onCloseButtonClickListener);
}
}
_unobserveEvents() {
this._el.removeEventListener("click", this._onCloseButtonClickListener);
document.removeEventListener("keydown", this._onKeyDownListener);
if (this._closeButtonEl) {
this._closeButtonEl.addEventListener("click", this._onCloseButtonClickListener);
}
}
destroy() {
this._destroyed = true;
this._unobserveEvents();
this._onCloseButtonClickListener = null;
this._onKeyDownListener = null;
this._onOpenTransitionEndCallback = null;
this._onCloseTransitionEndCallback = null;
this._autoDismissTimeout = null;
}
}
exports["default"] = _default;
function _doModalFocusManagement(dialogWidget) {
const autoFocusEl = dialogWidget._el.querySelector("[autofocus]");
if (autoFocusEl) {
autoFocusEl.focus();
} else {
dialogWidget.focusables[dialogWidget._options.focusManagementIndex].focus();
}
Modal.modal(dialogWidget._el);
}
function _onOpenTransitionEnd() {
this._el.hidden = false;
this._cancelTransition = undefined;
if (this.modal) {
_doModalFocusManagement(this);
}
}
function _onCloseTransitionEnd() {
if (this.modal) {
Modal.unmodal();
}
this._el.hidden = true;
this._cancelTransition = undefined;
}
function _onKeyDown(e) {
if (this._options.quickDismiss === true && e.keyCode === 27) {
this.close();
}
}
function _onCloseButtonClick() {
this.close();
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }