vrembem 1.42.0 → 1.42.1
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/dev/scripts.esm.js +43 -30
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +43 -30
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +35 -22
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +43 -30
- package/dev/scripts.umd.js.map +1 -1
- package/dist/scripts.esm.js +1 -1
- package/dist/scripts.esm.js.map +1 -1
- package/dist/scripts.js +1 -1
- package/dist/scripts.js.map +1 -1
- package/dist/scripts.modern.js +1 -1
- package/dist/scripts.modern.js.map +1 -1
- package/dist/scripts.umd.js +1 -1
- package/dist/scripts.umd.js.map +1 -1
- package/package.json +3 -3
package/dev/scripts.umd.js
CHANGED
|
@@ -1027,6 +1027,7 @@
|
|
|
1027
1027
|
dataClose: 'modal-close',
|
|
1028
1028
|
dataFocus: 'modal-focus',
|
|
1029
1029
|
dataRequired: 'modal-required',
|
|
1030
|
+
dataConfig: 'modal-config',
|
|
1030
1031
|
// State classes
|
|
1031
1032
|
stateOpened: 'is-opened',
|
|
1032
1033
|
stateOpening: 'is-opening',
|
|
@@ -1046,6 +1047,36 @@
|
|
|
1046
1047
|
transition: true
|
|
1047
1048
|
};
|
|
1048
1049
|
|
|
1050
|
+
function getModalConfig(modal) {
|
|
1051
|
+
var json = modal.getAttribute("data-" + this.settings.dataConfig);
|
|
1052
|
+
|
|
1053
|
+
if (json) {
|
|
1054
|
+
var config = JSON.parse(json);
|
|
1055
|
+
return _extends({}, this.settings, config);
|
|
1056
|
+
} else {
|
|
1057
|
+
return this.settings;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function getModal(modalKey) {
|
|
1061
|
+
if (typeof modalKey !== 'string') return modalKey;
|
|
1062
|
+
return document.querySelector("[data-" + this.settings.dataModal + "=\"" + modalKey + "\"]");
|
|
1063
|
+
}
|
|
1064
|
+
function modalNotFound(key) {
|
|
1065
|
+
return Promise.reject(new Error("Did not find modal with key: \"" + key + "\""));
|
|
1066
|
+
}
|
|
1067
|
+
function moveModals(type, ref) {
|
|
1068
|
+
if (type === void 0) {
|
|
1069
|
+
type = this.settings.moveModals.type;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
if (ref === void 0) {
|
|
1073
|
+
ref = this.settings.moveModals.ref;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
var modals = document.querySelectorAll("[data-" + this.settings.dataModal + "]");
|
|
1077
|
+
if (modals.length) moveElement(modals, type, ref);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1049
1080
|
var close$1 = function close(returnFocus) {
|
|
1050
1081
|
if (returnFocus === void 0) {
|
|
1051
1082
|
returnFocus = true;
|
|
@@ -1058,14 +1089,15 @@
|
|
|
1058
1089
|
|
|
1059
1090
|
if (modal) {
|
|
1060
1091
|
_this2.working = true;
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1092
|
+
var config = getModalConfig.call(_this2, modal);
|
|
1093
|
+
setInert(false, config.selectorInert);
|
|
1094
|
+
setOverflowHidden(false, config.selectorOverflow);
|
|
1095
|
+
return Promise.resolve(closeTransition(modal, config)).then(function () {
|
|
1064
1096
|
if (returnFocus) focusTrigger(_this2);
|
|
1065
1097
|
|
|
1066
1098
|
_this2.focusTrap.destroy();
|
|
1067
1099
|
|
|
1068
|
-
modal.dispatchEvent(new CustomEvent(
|
|
1100
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
|
|
1069
1101
|
detail: _this2,
|
|
1070
1102
|
bubbles: true
|
|
1071
1103
|
}));
|
|
@@ -1141,26 +1173,6 @@
|
|
|
1141
1173
|
}
|
|
1142
1174
|
}
|
|
1143
1175
|
|
|
1144
|
-
function getModal(modalKey) {
|
|
1145
|
-
if (typeof modalKey !== 'string') return modalKey;
|
|
1146
|
-
return document.querySelector("[data-" + this.settings.dataModal + "=\"" + modalKey + "\"]");
|
|
1147
|
-
}
|
|
1148
|
-
function modalNotFound(key) {
|
|
1149
|
-
return Promise.reject(new Error("Did not find modal with key: \"" + key + "\""));
|
|
1150
|
-
}
|
|
1151
|
-
function moveModals(type, ref) {
|
|
1152
|
-
if (type === void 0) {
|
|
1153
|
-
type = this.settings.moveModals.type;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
if (ref === void 0) {
|
|
1157
|
-
ref = this.settings.moveModals.ref;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
var modals = document.querySelectorAll("[data-" + this.settings.dataModal + "]");
|
|
1161
|
-
if (modals.length) moveElement(modals, type, ref);
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
1176
|
function setInitialState() {
|
|
1165
1177
|
var _this = this;
|
|
1166
1178
|
|
|
@@ -1187,16 +1199,17 @@
|
|
|
1187
1199
|
|
|
1188
1200
|
var modal = getModal.call(_this2, modalKey);
|
|
1189
1201
|
if (!modal) return Promise.resolve(modalNotFound(modalKey));
|
|
1202
|
+
var config = getModalConfig.call(_this2, modal);
|
|
1190
1203
|
|
|
1191
|
-
if (hasClass(modal,
|
|
1204
|
+
if (hasClass(modal, config.stateClosed)) {
|
|
1192
1205
|
_this2.working = true;
|
|
1193
|
-
setOverflowHidden(true,
|
|
1194
|
-
return Promise.resolve(openTransition(modal,
|
|
1206
|
+
setOverflowHidden(true, config.selectorOverflow);
|
|
1207
|
+
return Promise.resolve(openTransition(modal, config)).then(function () {
|
|
1195
1208
|
_this2.focusTrap.init(modal);
|
|
1196
1209
|
|
|
1197
|
-
focusTarget(modal,
|
|
1198
|
-
setInert(true,
|
|
1199
|
-
modal.dispatchEvent(new CustomEvent(
|
|
1210
|
+
focusTarget(modal, config);
|
|
1211
|
+
setInert(true, config.selectorInert);
|
|
1212
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
|
|
1200
1213
|
detail: _this2,
|
|
1201
1214
|
bubbles: true
|
|
1202
1215
|
}));
|