vrembem 1.39.0 → 1.40.0
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 +32 -4
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +32 -4
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +30 -4
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +32 -4
- 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.js
CHANGED
|
@@ -1268,7 +1268,12 @@ function hide$2(popover, obj) {
|
|
|
1268
1268
|
var index = obj.collection.findIndex(function (item) {
|
|
1269
1269
|
return item.target === popover.target;
|
|
1270
1270
|
});
|
|
1271
|
-
obj.collection[index].state = 'hide'; //
|
|
1271
|
+
obj.collection[index].state = 'hide'; // Clear the memory if popover trigger matches the ones saved in memory
|
|
1272
|
+
|
|
1273
|
+
if (popover.trigger === obj.memory.trigger) {
|
|
1274
|
+
obj.memory.trigger = null;
|
|
1275
|
+
} // Return the popover
|
|
1276
|
+
|
|
1272
1277
|
|
|
1273
1278
|
return popover;
|
|
1274
1279
|
}
|
|
@@ -1282,7 +1287,9 @@ function hideAll(obj) {
|
|
|
1282
1287
|
return obj.collection;
|
|
1283
1288
|
}
|
|
1284
1289
|
function hideCheck(popover, obj) {
|
|
1285
|
-
//
|
|
1290
|
+
// Only run hideCheck if provided popover is currently open
|
|
1291
|
+
if (popover.state != 'show') return; // Needed to correctly check which element is currently being focused
|
|
1292
|
+
|
|
1286
1293
|
setTimeout(function () {
|
|
1287
1294
|
// Check if trigger or target are being hovered
|
|
1288
1295
|
var isHovered = popover.target.closest(':hover') === popover.target || popover.trigger.closest(':hover') === popover.trigger; // Check if trigger or target are being focused
|
|
@@ -1452,13 +1459,31 @@ function handlerClick(popover) {
|
|
|
1452
1459
|
if (popover.target.classList.contains(this.settings.stateActive)) {
|
|
1453
1460
|
hide$2(popover, this);
|
|
1454
1461
|
} else {
|
|
1462
|
+
this.memory.trigger = popover.trigger;
|
|
1455
1463
|
show(popover, this);
|
|
1456
1464
|
documentClick(popover, this);
|
|
1457
1465
|
}
|
|
1458
1466
|
}
|
|
1459
1467
|
function handlerKeydown(event) {
|
|
1460
|
-
|
|
1461
|
-
|
|
1468
|
+
var _this = this;
|
|
1469
|
+
|
|
1470
|
+
switch (event.key) {
|
|
1471
|
+
case 'Escape':
|
|
1472
|
+
if (this.memory.trigger) {
|
|
1473
|
+
this.memory.trigger.focus();
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
hideAll(this);
|
|
1477
|
+
return;
|
|
1478
|
+
|
|
1479
|
+
case 'Tab':
|
|
1480
|
+
this.collection.forEach(function (popover) {
|
|
1481
|
+
hideCheck(popover, _this);
|
|
1482
|
+
});
|
|
1483
|
+
return;
|
|
1484
|
+
|
|
1485
|
+
default:
|
|
1486
|
+
return;
|
|
1462
1487
|
}
|
|
1463
1488
|
}
|
|
1464
1489
|
function documentClick(popover, obj) {
|
|
@@ -3426,6 +3451,9 @@ var Popover = /*#__PURE__*/function () {
|
|
|
3426
3451
|
this.defaults = defaults;
|
|
3427
3452
|
this.settings = _extends({}, this.defaults, options);
|
|
3428
3453
|
this.collection = [];
|
|
3454
|
+
this.memory = {
|
|
3455
|
+
trigger: null
|
|
3456
|
+
};
|
|
3429
3457
|
this.__handlerKeydown = handlerKeydown.bind(this);
|
|
3430
3458
|
if (this.settings.autoInit) this.init();
|
|
3431
3459
|
}
|