@haiilo/catalyst 5.2.2 → 5.3.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.
Files changed (70) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/p-ba081831.entry.js +10 -0
  4. package/dist/catalyst/p-ba081831.entry.js.map +1 -0
  5. package/dist/catalyst/scss/_snippets/_form-label.scss +2 -1
  6. package/dist/cjs/{cat-alert_24.cjs.entry.js → cat-alert_25.cjs.entry.js} +170 -28
  7. package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -0
  8. package/dist/cjs/catalyst.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +1 -0
  11. package/dist/collection/components/cat-button/cat-button.css +20 -2
  12. package/dist/collection/components/cat-button/cat-button.js +21 -1
  13. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  14. package/dist/collection/components/cat-button-group/cat-button-group.css +15 -0
  15. package/dist/collection/components/cat-button-group/cat-button-group.js +51 -0
  16. package/dist/collection/components/cat-button-group/cat-button-group.js.map +1 -0
  17. package/dist/collection/components/cat-dropdown/cat-dropdown.js +14 -2
  18. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  19. package/dist/collection/components/cat-form-group/cat-form-group.js +28 -0
  20. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  21. package/dist/collection/components/cat-input/cat-input.css +8 -4
  22. package/dist/collection/components/cat-label/cat-label.js +19 -0
  23. package/dist/collection/components/cat-label/cat-label.js.map +1 -1
  24. package/dist/collection/components/cat-select/cat-select.css +90 -0
  25. package/dist/collection/components/cat-select/cat-select.js +27 -2
  26. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  27. package/dist/collection/components/cat-textarea/cat-textarea.css +8 -4
  28. package/dist/collection/components/cat-tooltip/cat-tooltip.css +0 -7
  29. package/dist/collection/components/cat-tooltip/cat-tooltip.js +22 -18
  30. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  31. package/dist/collection/scss/_snippets/_form-label.scss +2 -1
  32. package/dist/components/cat-button-group.d.ts +11 -0
  33. package/dist/components/cat-button-group.js +46 -0
  34. package/dist/components/cat-button-group.js.map +1 -0
  35. package/dist/components/cat-button2.js +6 -2
  36. package/dist/components/cat-button2.js.map +1 -1
  37. package/dist/components/cat-dropdown2.js +475 -3
  38. package/dist/components/cat-dropdown2.js.map +1 -1
  39. package/dist/components/cat-form-group.js +10 -1
  40. package/dist/components/cat-form-group.js.map +1 -1
  41. package/dist/components/cat-input.js +1 -1
  42. package/dist/components/cat-input.js.map +1 -1
  43. package/dist/components/cat-label.js +2 -0
  44. package/dist/components/cat-label.js.map +1 -1
  45. package/dist/components/cat-select2.js +11 -3
  46. package/dist/components/cat-select2.js.map +1 -1
  47. package/dist/components/cat-textarea.js +1 -1
  48. package/dist/components/cat-textarea.js.map +1 -1
  49. package/dist/components/cat-tooltip.js +24 -20
  50. package/dist/components/cat-tooltip.js.map +1 -1
  51. package/dist/components/floating-ui.dom.esm.js +85 -1
  52. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  53. package/dist/esm/{cat-alert_24.entry.js → cat-alert_25.entry.js} +170 -29
  54. package/dist/esm/cat-alert_25.entry.js.map +1 -0
  55. package/dist/esm/catalyst.js +1 -1
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/types/components/cat-button/cat-button.d.ts +4 -0
  58. package/dist/types/components/cat-button-group/cat-button-group.d.ts +11 -0
  59. package/dist/types/components/cat-form-group/cat-form-group.d.ts +5 -0
  60. package/dist/types/components/cat-label/cat-label.d.ts +4 -0
  61. package/dist/types/components/cat-select/cat-select.d.ts +4 -0
  62. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +2 -2
  63. package/dist/types/components.d.ts +53 -0
  64. package/package.json +2 -2
  65. package/dist/catalyst/p-d135d677.entry.js +0 -10
  66. package/dist/catalyst/p-d135d677.entry.js.map +0 -1
  67. package/dist/cjs/cat-alert_24.cjs.entry.js.map +0 -1
  68. package/dist/components/first-tabbable.js +0 -464
  69. package/dist/components/first-tabbable.js.map +0 -1
  70. package/dist/esm/cat-alert_24.entry.js.map +0 -1
@@ -1,12 +1,468 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { a as autoUpdate, c as computePosition, o as offset, f as flip } from './floating-ui.dom.esm.js';
3
- import { t as tabbable, f as focusable, i as isTabbable, a as isFocusable, b as firstTabbable } from './first-tabbable.js';
2
+ import { a as autoUpdate, c as computePosition, o as offset, f as flip, s as size } from './floating-ui.dom.esm.js';
4
3
 
5
4
  /**
6
5
  * Auto-generated file. Do not edit directly.
7
6
  */
8
7
  const timeTransitionS = 125;
9
8
 
9
+ /*!
10
+ * tabbable 6.0.1
11
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
12
+ */
13
+ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
14
+ var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
15
+ var NoElement = typeof Element === 'undefined';
16
+ var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
17
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
18
+ return element.getRootNode();
19
+ } : function (element) {
20
+ return element.ownerDocument;
21
+ };
22
+
23
+ /**
24
+ * @param {Element} el container to check in
25
+ * @param {boolean} includeContainer add container to check
26
+ * @param {(node: Element) => boolean} filter filter candidates
27
+ * @returns {Element[]}
28
+ */
29
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
30
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
31
+ if (includeContainer && matches.call(el, candidateSelector)) {
32
+ candidates.unshift(el);
33
+ }
34
+ candidates = candidates.filter(filter);
35
+ return candidates;
36
+ };
37
+
38
+ /**
39
+ * @callback GetShadowRoot
40
+ * @param {Element} element to check for shadow root
41
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
42
+ */
43
+
44
+ /**
45
+ * @callback ShadowRootFilter
46
+ * @param {Element} shadowHostNode the element which contains shadow content
47
+ * @returns {boolean} true if a shadow root could potentially contain valid candidates.
48
+ */
49
+
50
+ /**
51
+ * @typedef {Object} CandidateScope
52
+ * @property {Element} scopeParent contains inner candidates
53
+ * @property {Element[]} candidates list of candidates found in the scope parent
54
+ */
55
+
56
+ /**
57
+ * @typedef {Object} IterativeOptions
58
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
59
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
60
+ * or a boolean stating if it has an undisclosed shadow root
61
+ * @property {(node: Element) => boolean} filter filter candidates
62
+ * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
63
+ * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
64
+ */
65
+
66
+ /**
67
+ * @param {Element[]} elements list of element containers to match candidates from
68
+ * @param {boolean} includeContainer add container list to check
69
+ * @param {IterativeOptions} options
70
+ * @returns {Array.<Element|CandidateScope>}
71
+ */
72
+ var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
73
+ var candidates = [];
74
+ var elementsToCheck = Array.from(elements);
75
+ while (elementsToCheck.length) {
76
+ var element = elementsToCheck.shift();
77
+ if (element.tagName === 'SLOT') {
78
+ // add shadow dom slot scope (slot itself cannot be focusable)
79
+ var assigned = element.assignedElements();
80
+ var content = assigned.length ? assigned : element.children;
81
+ var nestedCandidates = getCandidatesIteratively(content, true, options);
82
+ if (options.flatten) {
83
+ candidates.push.apply(candidates, nestedCandidates);
84
+ } else {
85
+ candidates.push({
86
+ scopeParent: element,
87
+ candidates: nestedCandidates
88
+ });
89
+ }
90
+ } else {
91
+ // check candidate element
92
+ var validCandidate = matches.call(element, candidateSelector);
93
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
94
+ candidates.push(element);
95
+ }
96
+
97
+ // iterate over shadow content if possible
98
+ var shadowRoot = element.shadowRoot ||
99
+ // check for an undisclosed shadow
100
+ typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
101
+ var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
102
+ if (shadowRoot && validShadowRoot) {
103
+ // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
104
+ // shadow exists, so look at light dom children as fallback BUT create a scope for any
105
+ // child candidates found because they're likely slotted elements (elements that are
106
+ // children of the web component element (which has the shadow), in the light dom, but
107
+ // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
108
+ // _after_ we return from this recursive call
109
+ var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
110
+ if (options.flatten) {
111
+ candidates.push.apply(candidates, _nestedCandidates);
112
+ } else {
113
+ candidates.push({
114
+ scopeParent: element,
115
+ candidates: _nestedCandidates
116
+ });
117
+ }
118
+ } else {
119
+ // there's not shadow so just dig into the element's (light dom) children
120
+ // __without__ giving the element special scope treatment
121
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
122
+ }
123
+ }
124
+ }
125
+ return candidates;
126
+ };
127
+ var getTabindex = function getTabindex(node, isScope) {
128
+ if (node.tabIndex < 0) {
129
+ // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
130
+ // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
131
+ // yet they are still part of the regular tab order; in FF, they get a default
132
+ // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
133
+ // order, consider their tab index to be 0.
134
+ // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
135
+ // so if they don't have a tabindex attribute specifically set, assume it's 0.
136
+ //
137
+ // isScope is positive for custom element with shadow root or slot that by default
138
+ // have tabIndex -1, but need to be sorted by document order in order for their
139
+ // content to be inserted in the correct position
140
+ if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
141
+ return 0;
142
+ }
143
+ }
144
+ return node.tabIndex;
145
+ };
146
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
147
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
148
+ };
149
+ var isInput = function isInput(node) {
150
+ return node.tagName === 'INPUT';
151
+ };
152
+ var isHiddenInput = function isHiddenInput(node) {
153
+ return isInput(node) && node.type === 'hidden';
154
+ };
155
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
156
+ var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
157
+ return child.tagName === 'SUMMARY';
158
+ });
159
+ return r;
160
+ };
161
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
162
+ for (var i = 0; i < nodes.length; i++) {
163
+ if (nodes[i].checked && nodes[i].form === form) {
164
+ return nodes[i];
165
+ }
166
+ }
167
+ };
168
+ var isTabbableRadio = function isTabbableRadio(node) {
169
+ if (!node.name) {
170
+ return true;
171
+ }
172
+ var radioScope = node.form || getRootNode(node);
173
+ var queryRadios = function queryRadios(name) {
174
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
175
+ };
176
+ var radioSet;
177
+ if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
178
+ radioSet = queryRadios(window.CSS.escape(node.name));
179
+ } else {
180
+ try {
181
+ radioSet = queryRadios(node.name);
182
+ } catch (err) {
183
+ // eslint-disable-next-line no-console
184
+ console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
185
+ return false;
186
+ }
187
+ }
188
+ var checked = getCheckedRadio(radioSet, node.form);
189
+ return !checked || checked === node;
190
+ };
191
+ var isRadio = function isRadio(node) {
192
+ return isInput(node) && node.type === 'radio';
193
+ };
194
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
195
+ return isRadio(node) && !isTabbableRadio(node);
196
+ };
197
+
198
+ // determines if a node is ultimately attached to the window's document
199
+ var isNodeAttached = function isNodeAttached(node) {
200
+ var _nodeRootHost;
201
+ // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
202
+ // (but NOT _the_ document; see second 'If' comment below for more).
203
+ // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
204
+ // is attached, and the one we need to check if it's in the document or not (because the
205
+ // shadow, and all nodes it contains, is never considered in the document since shadows
206
+ // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,
207
+ // is hidden, or is not in the document itself but is detached, it will affect the shadow's
208
+ // visibility, including all the nodes it contains). The host could be any normal node,
209
+ // or a custom element (i.e. web component). Either way, that's the one that is considered
210
+ // part of the document, not the shadow root, nor any of its children (i.e. the node being
211
+ // tested).
212
+ // To further complicate things, we have to look all the way up until we find a shadow HOST
213
+ // that is attached (or find none) because the node might be in nested shadows...
214
+ // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the
215
+ // document (per the docs) and while it's a Document-type object, that document does not
216
+ // appear to be the same as the node's `ownerDocument` for some reason, so it's safer
217
+ // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
218
+ // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
219
+ // node is actually detached.
220
+ var nodeRootHost = getRootNode(node).host;
221
+ var attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && _nodeRootHost.ownerDocument.contains(nodeRootHost) || node.ownerDocument.contains(node));
222
+ while (!attached && nodeRootHost) {
223
+ var _nodeRootHost2;
224
+ // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
225
+ // which means we need to get the host's host and check if that parent host is contained
226
+ // in (i.e. attached to) the document
227
+ nodeRootHost = getRootNode(nodeRootHost).host;
228
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && _nodeRootHost2.ownerDocument.contains(nodeRootHost));
229
+ }
230
+ return attached;
231
+ };
232
+ var isZeroArea = function isZeroArea(node) {
233
+ var _node$getBoundingClie = node.getBoundingClientRect(),
234
+ width = _node$getBoundingClie.width,
235
+ height = _node$getBoundingClie.height;
236
+ return width === 0 && height === 0;
237
+ };
238
+ var isHidden = function isHidden(node, _ref) {
239
+ var displayCheck = _ref.displayCheck,
240
+ getShadowRoot = _ref.getShadowRoot;
241
+ // NOTE: visibility will be `undefined` if node is detached from the document
242
+ // (see notes about this further down), which means we will consider it visible
243
+ // (this is legacy behavior from a very long way back)
244
+ // NOTE: we check this regardless of `displayCheck="none"` because this is a
245
+ // _visibility_ check, not a _display_ check
246
+ if (getComputedStyle(node).visibility === 'hidden') {
247
+ return true;
248
+ }
249
+ var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
250
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
251
+ if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
252
+ return true;
253
+ }
254
+ if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
255
+ if (typeof getShadowRoot === 'function') {
256
+ // figure out if we should consider the node to be in an undisclosed shadow and use the
257
+ // 'non-zero-area' fallback
258
+ var originalNode = node;
259
+ while (node) {
260
+ var parentElement = node.parentElement;
261
+ var rootNode = getRootNode(node);
262
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
263
+ ) {
264
+ // node has an undisclosed shadow which means we can only treat it as a black box, so we
265
+ // fall back to a non-zero-area test
266
+ return isZeroArea(node);
267
+ } else if (node.assignedSlot) {
268
+ // iterate up slot
269
+ node = node.assignedSlot;
270
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
271
+ // cross shadow boundary
272
+ node = rootNode.host;
273
+ } else {
274
+ // iterate up normal dom
275
+ node = parentElement;
276
+ }
277
+ }
278
+ node = originalNode;
279
+ }
280
+ // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
281
+ // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
282
+ // it might be a falsy value, which means shadow DOM support is disabled
283
+
284
+ // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
285
+ // now we can just test to see if it would normally be visible or not, provided it's
286
+ // attached to the main document.
287
+ // NOTE: We must consider case where node is inside a shadow DOM and given directly to
288
+ // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
289
+
290
+ if (isNodeAttached(node)) {
291
+ // this works wherever the node is: if there's at least one client rect, it's
292
+ // somehow displayed; it also covers the CSS 'display: contents' case where the
293
+ // node itself is hidden in place of its contents; and there's no need to search
294
+ // up the hierarchy either
295
+ return !node.getClientRects().length;
296
+ }
297
+
298
+ // Else, the node isn't attached to the document, which means the `getClientRects()`
299
+ // API will __always__ return zero rects (this can happen, for example, if React
300
+ // is used to render nodes onto a detached tree, as confirmed in this thread:
301
+ // https://github.com/facebook/react/issues/9117#issuecomment-284228870)
302
+ //
303
+ // It also means that even window.getComputedStyle(node).display will return `undefined`
304
+ // because styles are only computed for nodes that are in the document.
305
+ //
306
+ // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable
307
+ // somehow. Though it was never stated officially, anyone who has ever used tabbable
308
+ // APIs on nodes in detached containers has actually implicitly used tabbable in what
309
+ // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially
310
+ // considering __everything__ to be visible because of the innability to determine styles.
311
+ //
312
+ // v6.0.0: As of this major release, the default 'full' option __no longer treats detached
313
+ // nodes as visible with the 'none' fallback.__
314
+ if (displayCheck !== 'legacy-full') {
315
+ return true; // hidden
316
+ }
317
+ // else, fallback to 'none' mode and consider the node visible
318
+ } else if (displayCheck === 'non-zero-area') {
319
+ // NOTE: Even though this tests that the node's client rect is non-zero to determine
320
+ // whether it's displayed, and that a detached node will __always__ have a zero-area
321
+ // client rect, we don't special-case for whether the node is attached or not. In
322
+ // this mode, we do want to consider nodes that have a zero area to be hidden at all
323
+ // times, and that includes attached or not.
324
+ return isZeroArea(node);
325
+ }
326
+
327
+ // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
328
+ // it's visible
329
+ return false;
330
+ };
331
+
332
+ // form fields (nested) inside a disabled fieldset are not focusable/tabbable
333
+ // unless they are in the _first_ <legend> element of the top-most disabled
334
+ // fieldset
335
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
336
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
337
+ var parentNode = node.parentElement;
338
+ // check if `node` is contained in a disabled <fieldset>
339
+ while (parentNode) {
340
+ if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
341
+ // look for the first <legend> among the children of the disabled <fieldset>
342
+ for (var i = 0; i < parentNode.children.length; i++) {
343
+ var child = parentNode.children.item(i);
344
+ // when the first <legend> (in document order) is found
345
+ if (child.tagName === 'LEGEND') {
346
+ // if its parent <fieldset> is not nested in another disabled <fieldset>,
347
+ // return whether `node` is a descendant of its first <legend>
348
+ return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
349
+ }
350
+ }
351
+ // the disabled <fieldset> containing `node` has no <legend>
352
+ return true;
353
+ }
354
+ parentNode = parentNode.parentElement;
355
+ }
356
+ }
357
+
358
+ // else, node's tabbable/focusable state should not be affected by a fieldset's
359
+ // enabled/disabled state
360
+ return false;
361
+ };
362
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
363
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
364
+ // For a details element with a summary, the summary element gets the focus
365
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
366
+ return false;
367
+ }
368
+ return true;
369
+ };
370
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
371
+ if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
372
+ return false;
373
+ }
374
+ return true;
375
+ };
376
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
377
+ var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
378
+ if (isNaN(tabIndex) || tabIndex >= 0) {
379
+ return true;
380
+ }
381
+ // If a custom element has an explicit negative tabindex,
382
+ // browsers will not allow tab targeting said element's children.
383
+ return false;
384
+ };
385
+
386
+ /**
387
+ * @param {Array.<Element|CandidateScope>} candidates
388
+ * @returns Element[]
389
+ */
390
+ var sortByOrder = function sortByOrder(candidates) {
391
+ var regularTabbables = [];
392
+ var orderedTabbables = [];
393
+ candidates.forEach(function (item, i) {
394
+ var isScope = !!item.scopeParent;
395
+ var element = isScope ? item.scopeParent : item;
396
+ var candidateTabindex = getTabindex(element, isScope);
397
+ var elements = isScope ? sortByOrder(item.candidates) : element;
398
+ if (candidateTabindex === 0) {
399
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
400
+ } else {
401
+ orderedTabbables.push({
402
+ documentOrder: i,
403
+ tabIndex: candidateTabindex,
404
+ item: item,
405
+ isScope: isScope,
406
+ content: elements
407
+ });
408
+ }
409
+ });
410
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
411
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
412
+ return acc;
413
+ }, []).concat(regularTabbables);
414
+ };
415
+ var tabbable = function tabbable(el, options) {
416
+ options = options || {};
417
+ var candidates;
418
+ if (options.getShadowRoot) {
419
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
420
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
421
+ flatten: false,
422
+ getShadowRoot: options.getShadowRoot,
423
+ shadowRootFilter: isValidShadowRootTabbable
424
+ });
425
+ } else {
426
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
427
+ }
428
+ return sortByOrder(candidates);
429
+ };
430
+ var focusable = function focusable(el, options) {
431
+ options = options || {};
432
+ var candidates;
433
+ if (options.getShadowRoot) {
434
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
435
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
436
+ flatten: true,
437
+ getShadowRoot: options.getShadowRoot
438
+ });
439
+ } else {
440
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
441
+ }
442
+ return candidates;
443
+ };
444
+ var isTabbable = function isTabbable(node, options) {
445
+ options = options || {};
446
+ if (!node) {
447
+ throw new Error('No node provided');
448
+ }
449
+ if (matches.call(node, candidateSelector) === false) {
450
+ return false;
451
+ }
452
+ return isNodeMatchingSelectorTabbable(options, node);
453
+ };
454
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
455
+ var isFocusable = function isFocusable(node, options) {
456
+ options = options || {};
457
+ if (!node) {
458
+ throw new Error('No node provided');
459
+ }
460
+ if (matches.call(node, focusableCandidateSelector) === false) {
461
+ return false;
462
+ }
463
+ return isNodeMatchingSelectorFocusable(options, node);
464
+ };
465
+
10
466
  /*!
11
467
  * focus-trap 7.2.0
12
468
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
@@ -737,6 +1193,10 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
737
1193
  return trap;
738
1194
  };
739
1195
 
1196
+ const firstTabbable = (container) => {
1197
+ return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
1198
+ };
1199
+
740
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}";
741
1201
 
742
1202
  let nextUniqueId = 0;
@@ -879,7 +1339,19 @@ const CatDropdown = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
879
1339
  computePosition(this.trigger, this.content, {
880
1340
  strategy: 'fixed',
881
1341
  placement: this.placement,
882
- middleware: [offset(CatDropdown.OFFSET), flip()]
1342
+ middleware: [
1343
+ offset(CatDropdown.OFFSET),
1344
+ flip(),
1345
+ size({
1346
+ padding: CatDropdown.OFFSET,
1347
+ apply({ availableWidth, availableHeight, elements }) {
1348
+ Object.assign(elements.floating.style, {
1349
+ maxWidth: `${availableWidth}px`,
1350
+ maxHeight: `${availableHeight}px`
1351
+ });
1352
+ }
1353
+ })
1354
+ ]
883
1355
  }).then(({ x, y, placement }) => {
884
1356
  this.content.dataset.placement = placement;
885
1357
  Object.assign(this.content.style, {