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.esm.js
CHANGED
|
@@ -1022,6 +1022,7 @@ var defaults$1 = {
|
|
|
1022
1022
|
dataClose: 'modal-close',
|
|
1023
1023
|
dataFocus: 'modal-focus',
|
|
1024
1024
|
dataRequired: 'modal-required',
|
|
1025
|
+
dataConfig: 'modal-config',
|
|
1025
1026
|
// State classes
|
|
1026
1027
|
stateOpened: 'is-opened',
|
|
1027
1028
|
stateOpening: 'is-opening',
|
|
@@ -1041,6 +1042,36 @@ var defaults$1 = {
|
|
|
1041
1042
|
transition: true
|
|
1042
1043
|
};
|
|
1043
1044
|
|
|
1045
|
+
function getModalConfig(modal) {
|
|
1046
|
+
var json = modal.getAttribute("data-" + this.settings.dataConfig);
|
|
1047
|
+
|
|
1048
|
+
if (json) {
|
|
1049
|
+
var config = JSON.parse(json);
|
|
1050
|
+
return _extends({}, this.settings, config);
|
|
1051
|
+
} else {
|
|
1052
|
+
return this.settings;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
function getModal(modalKey) {
|
|
1056
|
+
if (typeof modalKey !== 'string') return modalKey;
|
|
1057
|
+
return document.querySelector("[data-" + this.settings.dataModal + "=\"" + modalKey + "\"]");
|
|
1058
|
+
}
|
|
1059
|
+
function modalNotFound(key) {
|
|
1060
|
+
return Promise.reject(new Error("Did not find modal with key: \"" + key + "\""));
|
|
1061
|
+
}
|
|
1062
|
+
function moveModals(type, ref) {
|
|
1063
|
+
if (type === void 0) {
|
|
1064
|
+
type = this.settings.moveModals.type;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
if (ref === void 0) {
|
|
1068
|
+
ref = this.settings.moveModals.ref;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
var modals = document.querySelectorAll("[data-" + this.settings.dataModal + "]");
|
|
1072
|
+
if (modals.length) moveElement(modals, type, ref);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1044
1075
|
var close$1 = function close(returnFocus) {
|
|
1045
1076
|
if (returnFocus === void 0) {
|
|
1046
1077
|
returnFocus = true;
|
|
@@ -1053,14 +1084,15 @@ var close$1 = function close(returnFocus) {
|
|
|
1053
1084
|
|
|
1054
1085
|
if (modal) {
|
|
1055
1086
|
_this2.working = true;
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1087
|
+
var config = getModalConfig.call(_this2, modal);
|
|
1088
|
+
setInert(false, config.selectorInert);
|
|
1089
|
+
setOverflowHidden(false, config.selectorOverflow);
|
|
1090
|
+
return Promise.resolve(closeTransition(modal, config)).then(function () {
|
|
1059
1091
|
if (returnFocus) focusTrigger(_this2);
|
|
1060
1092
|
|
|
1061
1093
|
_this2.focusTrap.destroy();
|
|
1062
1094
|
|
|
1063
|
-
modal.dispatchEvent(new CustomEvent(
|
|
1095
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
|
|
1064
1096
|
detail: _this2,
|
|
1065
1097
|
bubbles: true
|
|
1066
1098
|
}));
|
|
@@ -1136,26 +1168,6 @@ function handlerKeydown$1(event) {
|
|
|
1136
1168
|
}
|
|
1137
1169
|
}
|
|
1138
1170
|
|
|
1139
|
-
function getModal(modalKey) {
|
|
1140
|
-
if (typeof modalKey !== 'string') return modalKey;
|
|
1141
|
-
return document.querySelector("[data-" + this.settings.dataModal + "=\"" + modalKey + "\"]");
|
|
1142
|
-
}
|
|
1143
|
-
function modalNotFound(key) {
|
|
1144
|
-
return Promise.reject(new Error("Did not find modal with key: \"" + key + "\""));
|
|
1145
|
-
}
|
|
1146
|
-
function moveModals(type, ref) {
|
|
1147
|
-
if (type === void 0) {
|
|
1148
|
-
type = this.settings.moveModals.type;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
if (ref === void 0) {
|
|
1152
|
-
ref = this.settings.moveModals.ref;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
var modals = document.querySelectorAll("[data-" + this.settings.dataModal + "]");
|
|
1156
|
-
if (modals.length) moveElement(modals, type, ref);
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
1171
|
function setInitialState() {
|
|
1160
1172
|
var _this = this;
|
|
1161
1173
|
|
|
@@ -1182,16 +1194,17 @@ var open$1 = function open(modalKey) {
|
|
|
1182
1194
|
|
|
1183
1195
|
var modal = getModal.call(_this2, modalKey);
|
|
1184
1196
|
if (!modal) return Promise.resolve(modalNotFound(modalKey));
|
|
1197
|
+
var config = getModalConfig.call(_this2, modal);
|
|
1185
1198
|
|
|
1186
|
-
if (hasClass(modal,
|
|
1199
|
+
if (hasClass(modal, config.stateClosed)) {
|
|
1187
1200
|
_this2.working = true;
|
|
1188
|
-
setOverflowHidden(true,
|
|
1189
|
-
return Promise.resolve(openTransition(modal,
|
|
1201
|
+
setOverflowHidden(true, config.selectorOverflow);
|
|
1202
|
+
return Promise.resolve(openTransition(modal, config)).then(function () {
|
|
1190
1203
|
_this2.focusTrap.init(modal);
|
|
1191
1204
|
|
|
1192
|
-
focusTarget(modal,
|
|
1193
|
-
setInert(true,
|
|
1194
|
-
modal.dispatchEvent(new CustomEvent(
|
|
1205
|
+
focusTarget(modal, config);
|
|
1206
|
+
setInert(true, config.selectorInert);
|
|
1207
|
+
modal.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
|
|
1195
1208
|
detail: _this2,
|
|
1196
1209
|
bubbles: true
|
|
1197
1210
|
}));
|