@haiilo/catalyst 6.0.2 → 6.0.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/dist/catalyst/catalyst.css +16 -4
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/index.cdn.js +0 -1
- package/dist/catalyst/{p-60298958.entry.js → p-b218a2b0.entry.js} +5 -5
- package/dist/catalyst/p-b218a2b0.entry.js.map +1 -0
- package/dist/catalyst/scss/core/_typography.scss +0 -4
- package/dist/catalyst/scss/fonts/_fonts-mixins.scss +1 -1
- package/dist/cjs/cat-alert_25.cjs.entry.js +53 -16
- package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -1
- package/dist/collection/index.cdn.js +0 -1
- package/dist/collection/scss/core/_typography.scss +0 -4
- package/dist/collection/scss/fonts/_fonts-mixins.scss +1 -1
- package/dist/components/cat-dropdown2.js +47 -15
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-scrollable2.js +6 -1
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/esm/cat-alert_25.entry.js +53 -16
- package/dist/esm/cat-alert_25.entry.js.map +1 -1
- package/package.json +3 -3
- package/dist/catalyst/p-60298958.entry.js.map +0 -1
|
@@ -7,7 +7,7 @@ import { a as autoUpdate, c as computePosition, o as offset, f as flip, s as siz
|
|
|
7
7
|
const timeTransitionS = 125;
|
|
8
8
|
|
|
9
9
|
/*!
|
|
10
|
-
* tabbable 6.
|
|
10
|
+
* tabbable 6.2.0
|
|
11
11
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
12
12
|
*/
|
|
13
13
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
@@ -187,7 +187,27 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
187
187
|
}
|
|
188
188
|
return candidates;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @private
|
|
193
|
+
* Determines if the node has an explicitly specified `tabindex` attribute.
|
|
194
|
+
* @param {HTMLElement} node
|
|
195
|
+
* @returns {boolean} True if so; false if not.
|
|
196
|
+
*/
|
|
197
|
+
var hasTabIndex = function hasTabIndex(node) {
|
|
198
|
+
return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Determine the tab index of a given node.
|
|
203
|
+
* @param {HTMLElement} node
|
|
204
|
+
* @returns {number} Tab order (negative, 0, or positive number).
|
|
205
|
+
* @throws {Error} If `node` is falsy.
|
|
206
|
+
*/
|
|
207
|
+
var getTabIndex = function getTabIndex(node) {
|
|
208
|
+
if (!node) {
|
|
209
|
+
throw new Error('No node provided');
|
|
210
|
+
}
|
|
191
211
|
if (node.tabIndex < 0) {
|
|
192
212
|
// in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
193
213
|
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
@@ -196,16 +216,28 @@ var getTabindex = function getTabindex(node, isScope) {
|
|
|
196
216
|
// order, consider their tab index to be 0.
|
|
197
217
|
// Also browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
198
218
|
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
199
|
-
|
|
200
|
-
// isScope is positive for custom element with shadow root or slot that by default
|
|
201
|
-
// have tabIndex -1, but need to be sorted by document order in order for their
|
|
202
|
-
// content to be inserted in the correct position
|
|
203
|
-
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
|
|
219
|
+
if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
|
|
204
220
|
return 0;
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
223
|
return node.tabIndex;
|
|
208
224
|
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Determine the tab index of a given node __for sort order purposes__.
|
|
228
|
+
* @param {HTMLElement} node
|
|
229
|
+
* @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
|
|
230
|
+
* has tabIndex -1, but needs to be sorted by document order in order for its content to be
|
|
231
|
+
* inserted into the correct sort position.
|
|
232
|
+
* @returns {number} Tab order (negative, 0, or positive number).
|
|
233
|
+
*/
|
|
234
|
+
var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
|
|
235
|
+
var tabIndex = getTabIndex(node);
|
|
236
|
+
if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
|
|
237
|
+
return 0;
|
|
238
|
+
}
|
|
239
|
+
return tabIndex;
|
|
240
|
+
};
|
|
209
241
|
var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
|
|
210
242
|
return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
|
|
211
243
|
};
|
|
@@ -448,7 +480,7 @@ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(o
|
|
|
448
480
|
return true;
|
|
449
481
|
};
|
|
450
482
|
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
|
|
451
|
-
if (isNonTabbableRadio(node) ||
|
|
483
|
+
if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
|
|
452
484
|
return false;
|
|
453
485
|
}
|
|
454
486
|
return true;
|
|
@@ -473,7 +505,7 @@ var sortByOrder = function sortByOrder(candidates) {
|
|
|
473
505
|
candidates.forEach(function (item, i) {
|
|
474
506
|
var isScope = !!item.scopeParent;
|
|
475
507
|
var element = isScope ? item.scopeParent : item;
|
|
476
|
-
var candidateTabindex =
|
|
508
|
+
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
477
509
|
var elements = isScope ? sortByOrder(item.candidates) : element;
|
|
478
510
|
if (candidateTabindex === 0) {
|
|
479
511
|
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
@@ -492,32 +524,32 @@ var sortByOrder = function sortByOrder(candidates) {
|
|
|
492
524
|
return acc;
|
|
493
525
|
}, []).concat(regularTabbables);
|
|
494
526
|
};
|
|
495
|
-
var tabbable = function tabbable(
|
|
527
|
+
var tabbable = function tabbable(container, options) {
|
|
496
528
|
options = options || {};
|
|
497
529
|
var candidates;
|
|
498
530
|
if (options.getShadowRoot) {
|
|
499
|
-
candidates = getCandidatesIteratively([
|
|
531
|
+
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
500
532
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
501
533
|
flatten: false,
|
|
502
534
|
getShadowRoot: options.getShadowRoot,
|
|
503
535
|
shadowRootFilter: isValidShadowRootTabbable
|
|
504
536
|
});
|
|
505
537
|
} else {
|
|
506
|
-
candidates = getCandidates(
|
|
538
|
+
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
507
539
|
}
|
|
508
540
|
return sortByOrder(candidates);
|
|
509
541
|
};
|
|
510
|
-
var focusable = function focusable(
|
|
542
|
+
var focusable = function focusable(container, options) {
|
|
511
543
|
options = options || {};
|
|
512
544
|
var candidates;
|
|
513
545
|
if (options.getShadowRoot) {
|
|
514
|
-
candidates = getCandidatesIteratively([
|
|
546
|
+
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
515
547
|
filter: isNodeMatchingSelectorFocusable.bind(null, options),
|
|
516
548
|
flatten: true,
|
|
517
549
|
getShadowRoot: options.getShadowRoot
|
|
518
550
|
});
|
|
519
551
|
} else {
|
|
520
|
-
candidates = getCandidates(
|
|
552
|
+
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
|
|
521
553
|
}
|
|
522
554
|
return candidates;
|
|
523
555
|
};
|