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 +1 -1
- package/dev/scripts.esm.js +44 -43
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +44 -43
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.js +46 -43
- package/dev/scripts.modern.js.map +1 -1
- package/dev/scripts.umd.js +44 -43
- 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.modern.js
CHANGED
|
@@ -34,10 +34,9 @@ const setTabindex = selector => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Adds a class or classes to
|
|
38
|
-
*
|
|
39
|
-
* @param
|
|
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
|
const addClass = (el, ...cl) => {
|
|
43
42
|
el = el.forEach ? el : [el];
|
|
@@ -47,10 +46,9 @@ const addClass = (el, ...cl) => {
|
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
/**
|
|
50
|
-
* Takes a hyphen cased string and converts it to camel case
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
53
|
-
* @returns {Boolean} - returns a camel cased string
|
|
49
|
+
* Takes a hyphen cased string and converts it to camel case.
|
|
50
|
+
* @param {String } str - the string to convert to camel case.
|
|
51
|
+
* @returns {Boolean} - returns a camel cased string.
|
|
54
52
|
*/
|
|
55
53
|
const camelCase = str => {
|
|
56
54
|
return str.replace(/-([a-z])/g, function (g) {
|
|
@@ -169,23 +167,21 @@ class FocusTrap {
|
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
/**
|
|
172
|
-
* Get an element(s) from a selector or return value if not a string
|
|
173
|
-
*
|
|
174
|
-
* @param {
|
|
175
|
-
* @param {Boolean} single - Whether to return a single or all matches
|
|
170
|
+
* Get an element(s) from a selector or return value if not a string.
|
|
171
|
+
* @param {String} selector - Selector to query.
|
|
172
|
+
* @param {Boolean} single - Whether to return a single or all matches.
|
|
176
173
|
*/
|
|
177
174
|
const getElement = function getElement(selector, single = 0) {
|
|
178
|
-
if (typeof selector
|
|
175
|
+
if (typeof selector !== 'string') return selector;
|
|
179
176
|
return single ? document.querySelector(selector) : document.querySelectorAll(selector);
|
|
180
177
|
};
|
|
181
178
|
|
|
182
179
|
/**
|
|
183
|
-
* Checks an element or NodeList whether they contain a class or classes
|
|
180
|
+
* Checks an element or NodeList whether they contain a class or classes.
|
|
184
181
|
* Ref: https://davidwalsh.name/nodelist-array
|
|
185
|
-
*
|
|
186
|
-
* @param {
|
|
187
|
-
* @
|
|
188
|
-
* @returns {Boolean} - Returns true if class exists, otherwise false
|
|
182
|
+
* @param {Node} el - Element(s) to check class(es) on.
|
|
183
|
+
* @param {String || Array} c - Class(es) to check.
|
|
184
|
+
* @returns {Boolean} - Returns true if class exists, otherwise false.
|
|
189
185
|
*/
|
|
190
186
|
const hasClass = (el, ...cl) => {
|
|
191
187
|
el = el.forEach ? el : [el];
|
|
@@ -198,10 +194,9 @@ const hasClass = (el, ...cl) => {
|
|
|
198
194
|
};
|
|
199
195
|
|
|
200
196
|
/**
|
|
201
|
-
* Takes a camel cased string and converts it to hyphen case
|
|
202
|
-
*
|
|
203
|
-
* @
|
|
204
|
-
* @returns {Boolean} - returns a hyphen cased string
|
|
197
|
+
* Takes a camel cased string and converts it to hyphen case.
|
|
198
|
+
* @param {String } str - the string to convert to hyphen case.
|
|
199
|
+
* @returns {Boolean} - returns a hyphen cased string.
|
|
205
200
|
*/
|
|
206
201
|
const hyphenCase = str => {
|
|
207
202
|
return str.replace(/([a-z][A-Z])/g, function (g) {
|
|
@@ -210,11 +205,10 @@ const hyphenCase = str => {
|
|
|
210
205
|
};
|
|
211
206
|
|
|
212
207
|
/**
|
|
213
|
-
* Moves element(s) in the DOM based on a reference and move type
|
|
214
|
-
*
|
|
215
|
-
* @param {String}
|
|
216
|
-
* @param {String}
|
|
217
|
-
* @param {String} reference - The reference element the move is relative to
|
|
208
|
+
* Moves element(s) in the DOM based on a reference and move type.
|
|
209
|
+
* @param {String} target - The element(s) to move.
|
|
210
|
+
* @param {String} type - Move type can be 'after', 'before', 'append' or 'prepend'.
|
|
211
|
+
* @param {String} reference - The reference element the move is relative to.
|
|
218
212
|
*/
|
|
219
213
|
|
|
220
214
|
function moveElement(target, type, reference = false) {
|
|
@@ -265,10 +259,9 @@ function moveElement(target, type, reference = false) {
|
|
|
265
259
|
}
|
|
266
260
|
|
|
267
261
|
/**
|
|
268
|
-
* Remove a class or classes from an element or NodeList
|
|
269
|
-
*
|
|
270
|
-
* @param {
|
|
271
|
-
* @param {String || Array} cl - Class(es) to remove
|
|
262
|
+
* Remove a class or classes from an element or NodeList.
|
|
263
|
+
* @param {Node || NodeList} el - Element(s) to remove class(es) from.
|
|
264
|
+
* @param {String || Array} cl - Class(es) to remove.
|
|
272
265
|
*/
|
|
273
266
|
const removeClass = (el, ...cl) => {
|
|
274
267
|
el = el.forEach ? el : [el];
|
|
@@ -278,10 +271,9 @@ const removeClass = (el, ...cl) => {
|
|
|
278
271
|
};
|
|
279
272
|
|
|
280
273
|
/**
|
|
281
|
-
* Toggle a class or classes on an element or NodeList
|
|
282
|
-
*
|
|
283
|
-
* @param {
|
|
284
|
-
* @param {String || Array} cl - Class(es) to toggle
|
|
274
|
+
* Toggle a class or classes on an element or NodeList.
|
|
275
|
+
* @param {Node || NodeList} el - Element(s) to toggle class(es) on.
|
|
276
|
+
* @param {String || Array} cl - Class(es) to toggle.
|
|
285
277
|
*/
|
|
286
278
|
const toggleClass = (el, ...cl) => {
|
|
287
279
|
el = el.forEach ? el : [el];
|
|
@@ -367,13 +359,15 @@ function _extends() {
|
|
|
367
359
|
return _extends.apply(this, arguments);
|
|
368
360
|
}
|
|
369
361
|
|
|
362
|
+
var defaults$3 = {
|
|
363
|
+
autoInit: false,
|
|
364
|
+
stateAttr: 'aria-checked',
|
|
365
|
+
stateValue: 'mixed'
|
|
366
|
+
};
|
|
367
|
+
|
|
370
368
|
class Checkbox {
|
|
371
369
|
constructor(options) {
|
|
372
|
-
this.defaults =
|
|
373
|
-
autoInit: false,
|
|
374
|
-
stateAttr: 'aria-checked',
|
|
375
|
-
stateValue: 'mixed'
|
|
376
|
-
};
|
|
370
|
+
this.defaults = defaults$3;
|
|
377
371
|
this.settings = _extends({}, this.defaults, options);
|
|
378
372
|
this.__handlerClick = this.handlerClick.bind(this);
|
|
379
373
|
if (this.settings.autoInit) this.init();
|
|
@@ -467,12 +461,21 @@ class Breakpoint {
|
|
|
467
461
|
init() {
|
|
468
462
|
const drawers = document.querySelectorAll(`[data-${this.parent.settings.dataBreakpoint}]`);
|
|
469
463
|
drawers.forEach(drawer => {
|
|
464
|
+
// Setup mediaQueryList object
|
|
470
465
|
const id = drawer.getAttribute(`data-${this.parent.settings.dataDrawer}`);
|
|
471
466
|
const key = drawer.getAttribute(`data-${this.parent.settings.dataBreakpoint}`);
|
|
472
467
|
const bp = this.getBreakpoint(key);
|
|
473
|
-
const mql = window.matchMedia('(min-width:' + bp + ')');
|
|
474
|
-
|
|
475
|
-
|
|
468
|
+
const mql = window.matchMedia('(min-width:' + bp + ')'); // Run match check
|
|
469
|
+
|
|
470
|
+
this.match(mql, drawer); // Conditionally use addListner() for IE11 support
|
|
471
|
+
|
|
472
|
+
if (typeof mql.addEventListener === 'function') {
|
|
473
|
+
mql.addEventListener('change', this.__check);
|
|
474
|
+
} else {
|
|
475
|
+
mql.addListener(this.__check);
|
|
476
|
+
} // Push to mediaQueryLists array along with drawer ID
|
|
477
|
+
|
|
478
|
+
|
|
476
479
|
this.mediaQueryLists.push({
|
|
477
480
|
'mql': mql,
|
|
478
481
|
'drawer': id
|