@haiilo/catalyst 5.3.0 → 5.4.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/dist/catalyst/catalyst.css +56 -39
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.cdn.js +1 -0
- package/dist/catalyst/index.esm.js +2 -2
- package/dist/catalyst/index.esm.js.map +1 -1
- package/dist/catalyst/p-34e0cbba.entry.js +10 -0
- package/dist/catalyst/p-34e0cbba.entry.js.map +1 -0
- package/dist/catalyst/{p-d1fb9d96.js → p-ce6a1db2.js} +1 -1
- package/dist/catalyst/p-ce6a1db2.js.map +1 -0
- package/dist/catalyst/p-cf32399c.js +2 -0
- package/dist/catalyst/p-cf32399c.js.map +1 -0
- package/dist/catalyst/scss/_snippets/_checkbox-hint.scss +20 -0
- package/dist/catalyst/scss/utils/_border.scss +14 -0
- package/dist/catalyst/scss/utils/_media.mixins.scss +0 -1
- package/dist/catalyst/scss/utils/_typography.mixins.scss +1 -0
- package/dist/cjs/{cat-alert_25.cjs.entry.js → cat-alert_27.cjs.entry.js} +3628 -185
- package/dist/cjs/cat-alert_27.cjs.entry.js.map +1 -0
- package/dist/cjs/{cat-icon-registry-671af264.js → cat-icon-registry-228164a1.js} +43 -2
- package/dist/cjs/cat-icon-registry-228164a1.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +3 -3
- package/dist/cjs/catalyst.cjs.js.map +1 -1
- package/dist/cjs/{index-01312a2e.js → index-4258b31e.js} +8 -1
- package/dist/{catalyst/p-d1fb9d96.js.map → cjs/index-4258b31e.js.map} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +4 -2
- package/dist/collection/components/cat-alert/cat-alert.js +5 -5
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +7 -7
- package/dist/collection/components/cat-button/cat-button.js +6 -24
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +24 -1
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +8 -4
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
- package/dist/collection/components/cat-datepicker/cat-datepicker.css +381 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +873 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -0
- package/dist/collection/components/cat-datepicker/datepicker-type.js +8 -0
- package/dist/collection/components/cat-datepicker/datepicker-type.js.map +1 -0
- package/dist/collection/components/cat-datepicker/dayjs.config.js +8 -0
- package/dist/collection/components/cat-datepicker/dayjs.config.js.map +1 -0
- package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +46 -0
- package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +1 -0
- package/dist/collection/components/cat-dropdown/cat-dropdown.css +1 -0
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +12 -5
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js +29 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +384 -11
- package/dist/collection/components/cat-input/cat-input.js +8 -4
- package/dist/collection/components/cat-input/cat-input.js.map +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js +1 -1
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.js +28 -6
- package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
- package/dist/collection/components/cat-radio/cat-radio.css +24 -1
- package/dist/collection/components/cat-radio/cat-radio.js +8 -4
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +7 -3
- package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.css +1 -4
- package/dist/collection/components/cat-select/cat-select.css +8 -11
- package/dist/collection/components/cat-select/cat-select.js +43 -18
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.css +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +9 -12
- package/dist/collection/components/cat-textarea/cat-textarea.js +8 -4
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
- package/dist/collection/components/cat-timepicker/cat-timepicker.css +5 -0
- package/dist/collection/components/cat-timepicker/cat-timepicker.js +668 -0
- package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +1 -0
- package/dist/collection/components/cat-toggle/cat-toggle.css +24 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +8 -4
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +1 -1
- package/dist/collection/index.cdn.js +1 -0
- package/dist/collection/scss/_snippets/_checkbox-hint.scss +20 -0
- package/dist/collection/scss/utils/_border.scss +14 -0
- package/dist/collection/scss/utils/_media.mixins.scss +0 -1
- package/dist/collection/scss/utils/_typography.mixins.scss +1 -0
- package/dist/components/cat-alert.js +5 -5
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-button2.js +7 -9
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox2.js +2 -2
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-datepicker.d.ts +11 -0
- package/dist/components/cat-datepicker.js +3210 -0
- package/dist/components/cat-datepicker.js.map +1 -0
- package/dist/components/cat-dropdown2.js +182 -57
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.js +1 -1
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-icon-registry.js +42 -1
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-input.js +1 -226
- package/dist/components/cat-input.js.map +1 -1
- package/dist/components/cat-input2.js +230 -0
- package/dist/components/cat-input2.js.map +1 -0
- package/dist/components/cat-pagination.js +10 -5
- package/dist/components/cat-pagination.js.map +1 -1
- package/dist/components/cat-radio-group.js.map +1 -1
- package/dist/components/cat-radio.js +2 -2
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable2.js +7 -5
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js +2 -2
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +37 -16
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-skeleton2.js +1 -1
- package/dist/components/cat-skeleton2.js.map +1 -1
- package/dist/components/cat-textarea.js +3 -3
- package/dist/components/cat-textarea.js.map +1 -1
- package/dist/components/cat-timepicker.d.ts +11 -0
- package/dist/components/cat-timepicker.js +258 -0
- package/dist/components/cat-timepicker.js.map +1 -0
- package/dist/components/cat-toggle.js +2 -2
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +1 -1
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +64 -62
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{cat-alert_25.entry.js → cat-alert_27.entry.js} +3627 -186
- package/dist/esm/cat-alert_27.entry.js.map +1 -0
- package/dist/esm/{cat-icon-registry-d6b80490.js → cat-icon-registry-4bd597f4.js} +43 -2
- package/dist/esm/cat-icon-registry-4bd597f4.js.map +1 -0
- package/dist/esm/catalyst.js +4 -4
- package/dist/esm/catalyst.js.map +1 -1
- package/dist/esm/{index-fc2f91a4.js → index-636ce8d6.js} +8 -1
- package/dist/esm/index-636ce8d6.js.map +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/types/components/cat-button/cat-button.d.ts +0 -5
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
- package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +187 -0
- package/dist/types/components/cat-datepicker/datepicker-type.d.ts +7 -0
- package/dist/types/components/cat-datepicker/datepicker.d.ts +1 -0
- package/dist/types/components/cat-datepicker/dayjs.config.d.ts +3 -0
- package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +4 -0
- package/dist/types/components/cat-input/cat-input.d.ts +1 -1
- package/dist/types/components/cat-pagination/cat-pagination.d.ts +6 -0
- package/dist/types/components/cat-radio/cat-radio.d.ts +1 -1
- package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +1 -1
- package/dist/types/components/cat-select/cat-select.d.ts +6 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +1 -1
- package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +158 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
- package/dist/types/components.d.ts +532 -17
- package/package.json +22 -18
- package/dist/catalyst/p-ba081831.entry.js +0 -10
- package/dist/catalyst/p-ba081831.entry.js.map +0 -1
- package/dist/catalyst/p-ccfebe33.js +0 -2
- package/dist/catalyst/p-ccfebe33.js.map +0 -1
- package/dist/cjs/cat-alert_25.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-671af264.js.map +0 -1
- package/dist/cjs/index-01312a2e.js.map +0 -1
- package/dist/esm/cat-alert_25.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-d6b80490.js.map +0 -1
- package/dist/esm/index-fc2f91a4.js.map +0 -1
|
@@ -7,17 +7,66 @@ 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.1.2
|
|
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
|
|
14
|
+
// `:not([inert], [inert] *)` (Feb 2023)
|
|
15
|
+
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
|
|
16
|
+
// the entire query to fail, resulting in no nodes found, which will break a lot
|
|
17
|
+
// of things... so we have to rely on JS to identify nodes inside an inert container
|
|
18
|
+
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
|
|
14
19
|
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
15
20
|
var NoElement = typeof Element === 'undefined';
|
|
16
21
|
var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
17
22
|
var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
|
|
18
|
-
|
|
23
|
+
var _element$getRootNode;
|
|
24
|
+
return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
|
|
19
25
|
} : function (element) {
|
|
20
|
-
return element.ownerDocument;
|
|
26
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Determines if a node is inert or in an inert ancestor.
|
|
31
|
+
* @param {Element} [node]
|
|
32
|
+
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
|
|
33
|
+
* see if any of them are inert. If false, only `node` itself is considered.
|
|
34
|
+
* @returns {boolean} True if inert itself or by way of being in an inert ancestor.
|
|
35
|
+
* False if `node` is falsy.
|
|
36
|
+
*/
|
|
37
|
+
var isInert = function isInert(node, lookUp) {
|
|
38
|
+
var _node$getAttribute;
|
|
39
|
+
if (lookUp === void 0) {
|
|
40
|
+
lookUp = true;
|
|
41
|
+
}
|
|
42
|
+
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
|
|
43
|
+
// JS API property; we have to check the attribute, which can either be empty or 'true';
|
|
44
|
+
// if it's `null` (not specified) or 'false', it's an active element
|
|
45
|
+
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
|
|
46
|
+
var inert = inertAtt === '' || inertAtt === 'true';
|
|
47
|
+
|
|
48
|
+
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
|
|
49
|
+
// if it weren't for `matches()` not being a function on shadow roots; the following
|
|
50
|
+
// code works for any kind of node
|
|
51
|
+
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
|
|
52
|
+
// so it likely would not support `:is([inert] *)` either...
|
|
53
|
+
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
|
|
54
|
+
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Determines if a node's content is editable.
|
|
60
|
+
* @param {Element} [node]
|
|
61
|
+
* @returns True if it's content-editable; false if it's not or `node` is falsy.
|
|
62
|
+
*/
|
|
63
|
+
var isContentEditable = function isContentEditable(node) {
|
|
64
|
+
var _node$getAttribute2;
|
|
65
|
+
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
|
|
66
|
+
// to use the attribute directly to check for this, which can either be empty or 'true';
|
|
67
|
+
// if it's `null` (not specified) or 'false', it's a non-editable element
|
|
68
|
+
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
|
|
69
|
+
return attValue === '' || attValue === 'true';
|
|
21
70
|
};
|
|
22
71
|
|
|
23
72
|
/**
|
|
@@ -27,6 +76,11 @@ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (elemen
|
|
|
27
76
|
* @returns {Element[]}
|
|
28
77
|
*/
|
|
29
78
|
var getCandidates = function getCandidates(el, includeContainer, filter) {
|
|
79
|
+
// even if `includeContainer=false`, we still have to check it for inertness because
|
|
80
|
+
// if it's inert, all its children are inert
|
|
81
|
+
if (isInert(el)) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
30
84
|
var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
|
31
85
|
if (includeContainer && matches.call(el, candidateSelector)) {
|
|
32
86
|
candidates.unshift(el);
|
|
@@ -74,6 +128,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
74
128
|
var elementsToCheck = Array.from(elements);
|
|
75
129
|
while (elementsToCheck.length) {
|
|
76
130
|
var element = elementsToCheck.shift();
|
|
131
|
+
if (isInert(element, false)) {
|
|
132
|
+
// no need to look up since we're drilling down
|
|
133
|
+
// anything inside this container will also be inert
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
77
136
|
if (element.tagName === 'SLOT') {
|
|
78
137
|
// add shadow dom slot scope (slot itself cannot be focusable)
|
|
79
138
|
var assigned = element.assignedElements();
|
|
@@ -98,7 +157,11 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
98
157
|
var shadowRoot = element.shadowRoot ||
|
|
99
158
|
// check for an undisclosed shadow
|
|
100
159
|
typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
|
|
101
|
-
|
|
160
|
+
|
|
161
|
+
// no inert look up because we're already drilling down and checking for inertness
|
|
162
|
+
// on the way down, so all containers to this root node should have already been
|
|
163
|
+
// vetted as non-inert
|
|
164
|
+
var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
102
165
|
if (shadowRoot && validShadowRoot) {
|
|
103
166
|
// add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
|
|
104
167
|
// shadow exists, so look at light dom children as fallback BUT create a scope for any
|
|
@@ -137,7 +200,7 @@ var getTabindex = function getTabindex(node, isScope) {
|
|
|
137
200
|
// isScope is positive for custom element with shadow root or slot that by default
|
|
138
201
|
// have tabIndex -1, but need to be sorted by document order in order for their
|
|
139
202
|
// content to be inserted in the correct position
|
|
140
|
-
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node
|
|
203
|
+
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
|
|
141
204
|
return 0;
|
|
142
205
|
}
|
|
143
206
|
}
|
|
@@ -197,7 +260,7 @@ var isNonTabbableRadio = function isNonTabbableRadio(node) {
|
|
|
197
260
|
|
|
198
261
|
// determines if a node is ultimately attached to the window's document
|
|
199
262
|
var isNodeAttached = function isNodeAttached(node) {
|
|
200
|
-
var
|
|
263
|
+
var _nodeRoot;
|
|
201
264
|
// The root node is the shadow root if the node is in a shadow DOM; some document otherwise
|
|
202
265
|
// (but NOT _the_ document; see second 'If' comment below for more).
|
|
203
266
|
// If rootNode is shadow root, it'll have a host, which is the element to which the shadow
|
|
@@ -217,15 +280,28 @@ var isNodeAttached = function isNodeAttached(node) {
|
|
|
217
280
|
// to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
|
|
218
281
|
// using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
|
|
219
282
|
// node is actually detached.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
283
|
+
// NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
|
|
284
|
+
// if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
|
|
285
|
+
// from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
|
|
286
|
+
// `ownerDocument` will be `null`, hence the optional chaining on it.
|
|
287
|
+
var nodeRoot = node && getRootNode(node);
|
|
288
|
+
var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
|
|
289
|
+
|
|
290
|
+
// in some cases, a detached node will return itself as the root instead of a document or
|
|
291
|
+
// shadow root object, in which case, we shouldn't try to look further up the host chain
|
|
292
|
+
var attached = false;
|
|
293
|
+
if (nodeRoot && nodeRoot !== node) {
|
|
294
|
+
var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
|
|
295
|
+
attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
|
|
296
|
+
while (!attached && nodeRootHost) {
|
|
297
|
+
var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
|
|
298
|
+
// since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
|
|
299
|
+
// which means we need to get the host's host and check if that parent host is contained
|
|
300
|
+
// in (i.e. attached to) the document
|
|
301
|
+
nodeRoot = getRootNode(nodeRootHost);
|
|
302
|
+
nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
|
|
303
|
+
attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
|
|
304
|
+
}
|
|
229
305
|
}
|
|
230
306
|
return attached;
|
|
231
307
|
};
|
|
@@ -360,7 +436,11 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
|
|
|
360
436
|
return false;
|
|
361
437
|
};
|
|
362
438
|
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
|
|
363
|
-
if (node.disabled ||
|
|
439
|
+
if (node.disabled ||
|
|
440
|
+
// we must do an inert look up to filter out any elements inside an inert ancestor
|
|
441
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
442
|
+
// note related to `candidateSelectors`)
|
|
443
|
+
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
|
|
364
444
|
// For a details element with a summary, the summary element gets the focus
|
|
365
445
|
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
366
446
|
return false;
|
|
@@ -464,7 +544,7 @@ var isFocusable = function isFocusable(node, options) {
|
|
|
464
544
|
};
|
|
465
545
|
|
|
466
546
|
/*!
|
|
467
|
-
* focus-trap 7.
|
|
547
|
+
* focus-trap 7.4.3
|
|
468
548
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
469
549
|
*/
|
|
470
550
|
|
|
@@ -673,23 +753,24 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
673
753
|
/**
|
|
674
754
|
* Finds the index of the container that contains the element.
|
|
675
755
|
* @param {HTMLElement} element
|
|
756
|
+
* @param {Event} [event]
|
|
676
757
|
* @returns {number} Index of the container in either `state.containers` or
|
|
677
758
|
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
678
759
|
* if the element isn't found.
|
|
679
760
|
*/
|
|
680
|
-
var findContainerIndex = function findContainerIndex(element) {
|
|
761
|
+
var findContainerIndex = function findContainerIndex(element, event) {
|
|
762
|
+
var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
|
|
681
763
|
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
682
764
|
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
683
765
|
// and we still need to find the element in there
|
|
684
766
|
return state.containerGroups.findIndex(function (_ref) {
|
|
685
767
|
var container = _ref.container,
|
|
686
768
|
tabbableNodes = _ref.tabbableNodes;
|
|
687
|
-
return container.contains(element) ||
|
|
688
|
-
// fall back to explicit tabbable search which will take into consideration any
|
|
769
|
+
return container.contains(element) || ( // fall back to explicit tabbable search which will take into consideration any
|
|
689
770
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
690
771
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
691
772
|
// look inside web components even if open)
|
|
692
|
-
tabbableNodes.find(function (node) {
|
|
773
|
+
composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
|
|
693
774
|
return node === element;
|
|
694
775
|
});
|
|
695
776
|
});
|
|
@@ -745,8 +826,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
745
826
|
if (node === false) {
|
|
746
827
|
return false;
|
|
747
828
|
}
|
|
748
|
-
if (node === undefined) {
|
|
749
|
-
// option not specified: use fallback options
|
|
829
|
+
if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
|
|
830
|
+
// option not specified nor focusable: use fallback options
|
|
750
831
|
if (findContainerIndex(doc.activeElement) >= 0) {
|
|
751
832
|
node = doc.activeElement;
|
|
752
833
|
} else {
|
|
@@ -850,25 +931,20 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
850
931
|
// so that it precedes the focus event.
|
|
851
932
|
var checkPointerDown = function checkPointerDown(e) {
|
|
852
933
|
var target = getActualTarget(e);
|
|
853
|
-
if (findContainerIndex(target) >= 0) {
|
|
934
|
+
if (findContainerIndex(target, e) >= 0) {
|
|
854
935
|
// allow the click since it ocurred inside the trap
|
|
855
936
|
return;
|
|
856
937
|
}
|
|
857
938
|
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
858
939
|
// immediately deactivate the trap
|
|
859
940
|
trap.deactivate({
|
|
860
|
-
// if, on deactivation, we should return focus to the node originally-focused
|
|
861
|
-
// when the trap was activated (or the configured `setReturnFocus` node),
|
|
862
|
-
// then assume it's also OK to return focus to the outside node that was
|
|
863
|
-
// just clicked, causing deactivation, as long as that node is focusable;
|
|
864
|
-
// if it isn't focusable, then return focus to the original node focused
|
|
865
|
-
// on activation (or the configured `setReturnFocus` node)
|
|
866
941
|
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
867
942
|
// which will result in the outside click setting focus to the node
|
|
868
|
-
// that was clicked
|
|
943
|
+
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
869
944
|
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
870
|
-
// on activation (or the configured `setReturnFocus` node)
|
|
871
|
-
|
|
945
|
+
// on activation (or the configured `setReturnFocus` node), whether the
|
|
946
|
+
// outside click was on a focusable node or not
|
|
947
|
+
returnFocus: config.returnFocusOnDeactivate
|
|
872
948
|
});
|
|
873
949
|
return;
|
|
874
950
|
}
|
|
@@ -888,7 +964,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
888
964
|
// In case focus escapes the trap for some strange reason, pull it back in.
|
|
889
965
|
var checkFocusIn = function checkFocusIn(e) {
|
|
890
966
|
var target = getActualTarget(e);
|
|
891
|
-
var targetContained = findContainerIndex(target) >= 0;
|
|
967
|
+
var targetContained = findContainerIndex(target, e) >= 0;
|
|
892
968
|
|
|
893
969
|
// In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
894
970
|
if (targetContained || target instanceof Document) {
|
|
@@ -915,7 +991,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
915
991
|
// make sure the target is actually contained in a group
|
|
916
992
|
// NOTE: the target may also be the container itself if it's focusable
|
|
917
993
|
// with tabIndex='-1' and was given initial focus
|
|
918
|
-
var containerIndex = findContainerIndex(target);
|
|
994
|
+
var containerIndex = findContainerIndex(target, event);
|
|
919
995
|
var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
|
|
920
996
|
if (containerIndex < 0) {
|
|
921
997
|
// target not found in any group: quite possible focus has escaped the trap,
|
|
@@ -1016,7 +1092,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1016
1092
|
};
|
|
1017
1093
|
var checkClick = function checkClick(e) {
|
|
1018
1094
|
var target = getActualTarget(e);
|
|
1019
|
-
if (findContainerIndex(target) >= 0) {
|
|
1095
|
+
if (findContainerIndex(target, e) >= 0) {
|
|
1020
1096
|
return;
|
|
1021
1097
|
}
|
|
1022
1098
|
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
|
@@ -1077,6 +1153,43 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1077
1153
|
return trap;
|
|
1078
1154
|
};
|
|
1079
1155
|
|
|
1156
|
+
//
|
|
1157
|
+
// MUTATION OBSERVER
|
|
1158
|
+
//
|
|
1159
|
+
|
|
1160
|
+
var checkDomRemoval = function checkDomRemoval(mutations) {
|
|
1161
|
+
var isFocusedNodeRemoved = mutations.some(function (mutation) {
|
|
1162
|
+
var removedNodes = Array.from(mutation.removedNodes);
|
|
1163
|
+
return removedNodes.some(function (node) {
|
|
1164
|
+
return node === state.mostRecentlyFocusedNode;
|
|
1165
|
+
});
|
|
1166
|
+
});
|
|
1167
|
+
|
|
1168
|
+
// If the currently focused is removed then browsers will move focus to the
|
|
1169
|
+
// <body> element. If this happens, try to move focus back into the trap.
|
|
1170
|
+
if (isFocusedNodeRemoved) {
|
|
1171
|
+
tryFocus(getInitialFocusNode());
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
// Use MutationObserver - if supported - to detect if focused node is removed
|
|
1176
|
+
// from the DOM.
|
|
1177
|
+
var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
|
|
1178
|
+
var updateObservedNodes = function updateObservedNodes() {
|
|
1179
|
+
if (!mutationObserver) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
mutationObserver.disconnect();
|
|
1183
|
+
if (state.active && !state.paused) {
|
|
1184
|
+
state.containers.map(function (container) {
|
|
1185
|
+
mutationObserver.observe(container, {
|
|
1186
|
+
subtree: true,
|
|
1187
|
+
childList: true
|
|
1188
|
+
});
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1080
1193
|
//
|
|
1081
1194
|
// TRAP DEFINITION
|
|
1082
1195
|
//
|
|
@@ -1101,17 +1214,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1101
1214
|
state.active = true;
|
|
1102
1215
|
state.paused = false;
|
|
1103
1216
|
state.nodeFocusedBeforeActivation = doc.activeElement;
|
|
1104
|
-
|
|
1105
|
-
onActivate();
|
|
1106
|
-
}
|
|
1217
|
+
onActivate === null || onActivate === void 0 ? void 0 : onActivate();
|
|
1107
1218
|
var finishActivation = function finishActivation() {
|
|
1108
1219
|
if (checkCanFocusTrap) {
|
|
1109
1220
|
updateTabbableNodes();
|
|
1110
1221
|
}
|
|
1111
1222
|
addListeners();
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}
|
|
1223
|
+
updateObservedNodes();
|
|
1224
|
+
onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
|
|
1115
1225
|
};
|
|
1116
1226
|
if (checkCanFocusTrap) {
|
|
1117
1227
|
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
|
@@ -1134,22 +1244,19 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1134
1244
|
removeListeners();
|
|
1135
1245
|
state.active = false;
|
|
1136
1246
|
state.paused = false;
|
|
1247
|
+
updateObservedNodes();
|
|
1137
1248
|
activeFocusTraps.deactivateTrap(trapStack, trap);
|
|
1138
1249
|
var onDeactivate = getOption(options, 'onDeactivate');
|
|
1139
1250
|
var onPostDeactivate = getOption(options, 'onPostDeactivate');
|
|
1140
1251
|
var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
|
|
1141
1252
|
var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
|
|
1142
|
-
|
|
1143
|
-
onDeactivate();
|
|
1144
|
-
}
|
|
1253
|
+
onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
|
|
1145
1254
|
var finishDeactivation = function finishDeactivation() {
|
|
1146
1255
|
delay(function () {
|
|
1147
1256
|
if (returnFocus) {
|
|
1148
1257
|
tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
1149
1258
|
}
|
|
1150
|
-
|
|
1151
|
-
onPostDeactivate();
|
|
1152
|
-
}
|
|
1259
|
+
onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
|
|
1153
1260
|
});
|
|
1154
1261
|
};
|
|
1155
1262
|
if (returnFocus && checkCanReturnFocus) {
|
|
@@ -1159,21 +1266,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1159
1266
|
finishDeactivation();
|
|
1160
1267
|
return this;
|
|
1161
1268
|
},
|
|
1162
|
-
pause: function pause() {
|
|
1269
|
+
pause: function pause(pauseOptions) {
|
|
1163
1270
|
if (state.paused || !state.active) {
|
|
1164
1271
|
return this;
|
|
1165
1272
|
}
|
|
1273
|
+
var onPause = getOption(pauseOptions, 'onPause');
|
|
1274
|
+
var onPostPause = getOption(pauseOptions, 'onPostPause');
|
|
1166
1275
|
state.paused = true;
|
|
1276
|
+
onPause === null || onPause === void 0 ? void 0 : onPause();
|
|
1167
1277
|
removeListeners();
|
|
1278
|
+
updateObservedNodes();
|
|
1279
|
+
onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
|
|
1168
1280
|
return this;
|
|
1169
1281
|
},
|
|
1170
|
-
unpause: function unpause() {
|
|
1282
|
+
unpause: function unpause(unpauseOptions) {
|
|
1171
1283
|
if (!state.paused || !state.active) {
|
|
1172
1284
|
return this;
|
|
1173
1285
|
}
|
|
1286
|
+
var onUnpause = getOption(unpauseOptions, 'onUnpause');
|
|
1287
|
+
var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
|
|
1174
1288
|
state.paused = false;
|
|
1289
|
+
onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
|
|
1175
1290
|
updateTabbableNodes();
|
|
1176
1291
|
addListeners();
|
|
1292
|
+
updateObservedNodes();
|
|
1293
|
+
onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
|
|
1177
1294
|
return this;
|
|
1178
1295
|
},
|
|
1179
1296
|
updateContainerElements: function updateContainerElements(containerElements) {
|
|
@@ -1184,6 +1301,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1184
1301
|
if (state.active) {
|
|
1185
1302
|
updateTabbableNodes();
|
|
1186
1303
|
}
|
|
1304
|
+
updateObservedNodes();
|
|
1187
1305
|
return this;
|
|
1188
1306
|
}
|
|
1189
1307
|
};
|
|
@@ -1197,7 +1315,7 @@ const firstTabbable = (container) => {
|
|
|
1197
1315
|
return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
|
|
1198
1316
|
};
|
|
1199
1317
|
|
|
1200
|
-
const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding-top:0.5rem;padding-bottom:0.5rem;min-width:8rem;max-width:16rem}.content{position:fixed;background:white;display:none;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);z-index:100;opacity:0;transition:transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform:translateY(1rem)}.content[data-placement^=left]{transform:translateX(1rem)}.content[data-placement^=right]{transform:translateX(-1rem)}.content[data-placement^=bottom]{transform:translateY(-1rem)}.content.show{opacity:1;transform:translateX(0);transform:translateY(0);transition:transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
|
|
1318
|
+
const catDropdownCss = ":host{display:contents}:host([hidden]){display:none}::slotted(nav){padding-top:0.5rem;padding-bottom:0.5rem;min-width:8rem;max-width:16rem}.content{position:fixed;background:white;display:none;-webkit-overflow-scrolling:touch;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 4px 6px -2px rgba(27, 31, 38, 0.03), 0 12px 16px -4px rgba(27, 31, 38, 0.08);border-radius:var(--cat-border-radius-m, 0.25rem);border:1px solid rgb(var(--cat-border-color, 235, 236, 240));z-index:100;opacity:0;transition:transform 0.13s cubic-bezier(0.3, 0, 0.8, 0.15), opacity 0.13s cubic-bezier(0.3, 0, 0.8, 0.15)}.content[data-placement^=top]{transform:translateY(1rem)}.content[data-placement^=left]{transform:translateX(1rem)}.content[data-placement^=right]{transform:translateX(-1rem)}.content[data-placement^=bottom]{transform:translateY(-1rem)}.content.show{opacity:1;transform:translateX(0);transform:translateY(0);transition:transform 0.5s cubic-bezier(0.05, 0.7, 0.1, 1), opacity 0.5s cubic-bezier(0.05, 0.7, 0.1, 1)}.content.overflow-auto{overflow:auto}";
|
|
1201
1319
|
|
|
1202
1320
|
let nextUniqueId = 0;
|
|
1203
1321
|
const CatDropdown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -1221,8 +1339,9 @@ const CatDropdown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1221
1339
|
this.initTrigger();
|
|
1222
1340
|
this.toggle();
|
|
1223
1341
|
}
|
|
1342
|
+
const button = event.target;
|
|
1224
1343
|
// hide dropdown on button click
|
|
1225
|
-
if (!this.noAutoClose && event.composedPath().includes(this.content)) {
|
|
1344
|
+
if (!this.noAutoClose && event.composedPath().includes(this.content) && button.slot !== 'trigger') {
|
|
1226
1345
|
this.close();
|
|
1227
1346
|
}
|
|
1228
1347
|
}
|
|
@@ -1255,9 +1374,15 @@ const CatDropdown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1255
1374
|
getShadowRoot: true
|
|
1256
1375
|
},
|
|
1257
1376
|
allowOutsideClick: true,
|
|
1258
|
-
clickOutsideDeactivates: event =>
|
|
1259
|
-
!
|
|
1260
|
-
|
|
1377
|
+
clickOutsideDeactivates: event => {
|
|
1378
|
+
const shouldClose = !this.noAutoClose &&
|
|
1379
|
+
!event.composedPath().includes(this.content) &&
|
|
1380
|
+
(!this.trigger || !event.composedPath().includes(this.trigger));
|
|
1381
|
+
if (shouldClose) {
|
|
1382
|
+
this.close();
|
|
1383
|
+
}
|
|
1384
|
+
return shouldClose;
|
|
1385
|
+
},
|
|
1261
1386
|
onPostDeactivate: () => this.close()
|
|
1262
1387
|
});
|
|
1263
1388
|
this.trap.activate();
|
|
@@ -1267,7 +1392,7 @@ const CatDropdown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
1267
1392
|
* Closes the dropdown.
|
|
1268
1393
|
*/
|
|
1269
1394
|
async close() {
|
|
1270
|
-
if (this.isOpen === null) {
|
|
1395
|
+
if (this.isOpen === null || !this.isOpen) {
|
|
1271
1396
|
return; // busy
|
|
1272
1397
|
}
|
|
1273
1398
|
this.isOpen = null;
|