vrembem 1.40.2 → 1.40.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Sebastian Nitu
3
+ Copyright (c) 2022 Sebastian Nitu
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -34,10 +34,9 @@ var setTabindex = function setTabindex(selector) {
34
34
  };
35
35
 
36
36
  /**
37
- * Adds a class or classes to an element or NodeList
38
- * ---
39
- * @param {Node || NodeList} el - Element(s) to add class(es) to
40
- * @param {String || Array} cl - Class(es) to add
37
+ * Adds a class or classes to a Node or NodeList.
38
+ * @param {Node || NodeList} el - Element(s) to add class(es) to.
39
+ * @param {String || Array} cl - Class(es) to add.
41
40
  */
42
41
  var addClass = function addClass(el) {
43
42
  var _arguments = arguments;
@@ -50,10 +49,9 @@ var addClass = function addClass(el) {
50
49
  };
51
50
 
52
51
  /**
53
- * Takes a hyphen cased string and converts it to camel case
54
- * ---
55
- * @param {String } str - the string to convert to camel case
56
- * @returns {Boolean} - returns a camel cased string
52
+ * Takes a hyphen cased string and converts it to camel case.
53
+ * @param {String } str - the string to convert to camel case.
54
+ * @returns {Boolean} - returns a camel cased string.
57
55
  */
58
56
  var camelCase = function camelCase(str) {
59
57
  return str.replace(/-([a-z])/g, function (g) {
@@ -179,27 +177,25 @@ var FocusTrap = /*#__PURE__*/function () {
179
177
  }();
180
178
 
181
179
  /**
182
- * Get an element(s) from a selector or return value if not a string
183
- * ---
184
- * @param {String} selector - Selector to query
185
- * @param {Boolean} single - Whether to return a single or all matches
180
+ * Get an element(s) from a selector or return value if not a string.
181
+ * @param {String} selector - Selector to query.
182
+ * @param {Boolean} single - Whether to return a single or all matches.
186
183
  */
187
184
  var getElement = function getElement(selector, single) {
188
185
  if (single === void 0) {
189
186
  single = 0;
190
187
  }
191
188
 
192
- if (typeof selector != 'string') return selector;
189
+ if (typeof selector !== 'string') return selector;
193
190
  return single ? document.querySelector(selector) : document.querySelectorAll(selector);
194
191
  };
195
192
 
196
193
  /**
197
- * Checks an element or NodeList whether they contain a class or classes
194
+ * Checks an element or NodeList whether they contain a class or classes.
198
195
  * Ref: https://davidwalsh.name/nodelist-array
199
- * ---
200
- * @param {Node} el - Element(s) to check class(es) on
201
- * @param {String || Array} c - Class(es) to check
202
- * @returns {Boolean} - Returns true if class exists, otherwise false
196
+ * @param {Node} el - Element(s) to check class(es) on.
197
+ * @param {String || Array} c - Class(es) to check.
198
+ * @returns {Boolean} - Returns true if class exists, otherwise false.
203
199
  */
204
200
  var hasClass = function hasClass(el) {
205
201
  el = el.forEach ? el : [el];
@@ -212,10 +208,9 @@ var hasClass = function hasClass(el) {
212
208
  };
213
209
 
214
210
  /**
215
- * Takes a camel cased string and converts it to hyphen case
216
- * ---
217
- * @param {String } str - the string to convert to hyphen case
218
- * @returns {Boolean} - returns a hyphen cased string
211
+ * Takes a camel cased string and converts it to hyphen case.
212
+ * @param {String } str - the string to convert to hyphen case.
213
+ * @returns {Boolean} - returns a hyphen cased string.
219
214
  */
220
215
  var hyphenCase = function hyphenCase(str) {
221
216
  return str.replace(/([a-z][A-Z])/g, function (g) {
@@ -224,11 +219,10 @@ var hyphenCase = function hyphenCase(str) {
224
219
  };
225
220
 
226
221
  /**
227
- * Moves element(s) in the DOM based on a reference and move type
228
- * ---
229
- * @param {String} target - The element(s) to move
230
- * @param {String} type - Move type can be 'after', 'before', 'append' or 'prepend'
231
- * @param {String} reference - The reference element the move is relative to
222
+ * Moves element(s) in the DOM based on a reference and move type.
223
+ * @param {String} target - The element(s) to move.
224
+ * @param {String} type - Move type can be 'after', 'before', 'append' or 'prepend'.
225
+ * @param {String} reference - The reference element the move is relative to.
232
226
  */
233
227
 
234
228
  function moveElement(target, type, reference) {
@@ -283,10 +277,9 @@ function moveElement(target, type, reference) {
283
277
  }
284
278
 
285
279
  /**
286
- * Remove a class or classes from an element or NodeList
287
- * ---
288
- * @param {Node || NodeList} el - Element(s) to remove class(es) from
289
- * @param {String || Array} cl - Class(es) to remove
280
+ * Remove a class or classes from an element or NodeList.
281
+ * @param {Node || NodeList} el - Element(s) to remove class(es) from.
282
+ * @param {String || Array} cl - Class(es) to remove.
290
283
  */
291
284
  var removeClass = function removeClass(el) {
292
285
  var _arguments = arguments;
@@ -299,10 +292,9 @@ var removeClass = function removeClass(el) {
299
292
  };
300
293
 
301
294
  /**
302
- * Toggle a class or classes on an element or NodeList
303
- * ---
304
- * @param {Node || NodeList} el - Element(s) to toggle class(es) on
305
- * @param {String || Array} cl - Class(es) to toggle
295
+ * Toggle a class or classes on an element or NodeList.
296
+ * @param {Node || NodeList} el - Element(s) to toggle class(es) on.
297
+ * @param {String || Array} cl - Class(es) to toggle.
306
298
  */
307
299
  var toggleClass = function toggleClass(el) {
308
300
  var _arguments = arguments;
@@ -389,13 +381,15 @@ function _extends() {
389
381
  return _extends.apply(this, arguments);
390
382
  }
391
383
 
384
+ var defaults$3 = {
385
+ autoInit: false,
386
+ stateAttr: 'aria-checked',
387
+ stateValue: 'mixed'
388
+ };
389
+
392
390
  var Checkbox = /*#__PURE__*/function () {
393
391
  function Checkbox(options) {
394
- this.defaults = {
395
- autoInit: false,
396
- stateAttr: 'aria-checked',
397
- stateValue: 'mixed'
398
- };
392
+ this.defaults = defaults$3;
399
393
  this.settings = _extends({}, this.defaults, options);
400
394
  this.__handlerClick = this.handlerClick.bind(this);
401
395
  if (this.settings.autoInit) this.init();
@@ -510,16 +504,23 @@ var Breakpoint = /*#__PURE__*/function () {
510
504
 
511
505
  var drawers = document.querySelectorAll("[data-" + this.parent.settings.dataBreakpoint + "]");
512
506
  drawers.forEach(function (drawer) {
507
+ // Setup mediaQueryList object
513
508
  var id = drawer.getAttribute("data-" + _this.parent.settings.dataDrawer);
514
509
  var key = drawer.getAttribute("data-" + _this.parent.settings.dataBreakpoint);
515
510
 
516
511
  var bp = _this.getBreakpoint(key);
517
512
 
518
- var mql = window.matchMedia('(min-width:' + bp + ')');
513
+ var mql = window.matchMedia('(min-width:' + bp + ')'); // Run match check
519
514
 
520
- _this.match(mql, drawer);
515
+ _this.match(mql, drawer); // Conditionally use addListner() for IE11 support
516
+
517
+
518
+ if (typeof mql.addEventListener === 'function') {
519
+ mql.addEventListener('change', _this.__check);
520
+ } else {
521
+ mql.addListener(_this.__check);
522
+ } // Push to mediaQueryLists array along with drawer ID
521
523
 
522
- mql.addEventListener('change', _this.__check);
523
524
 
524
525
  _this.mediaQueryLists.push({
525
526
  'mql': mql,