|
1 | 1 | import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
| 2 | +import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils'; |
| 3 | +import type { UUIButtonElement } from '@umbraco-ui/uui-button/lib'; |
| 4 | +import type { UUIPopoverContainerElement } from '@umbraco-ui/uui-popover-container/lib'; |
2 | 5 | import { css, html, LitElement } from 'lit';
|
3 | 6 | import { property, query, queryAssignedElements } from 'lit/decorators.js';
|
4 | 7 | import { repeat } from 'lit/directives/repeat.js';
|
5 | 8 |
|
6 |
| -import type { UUIButtonElement } from '@umbraco-ui/uui-button/lib'; |
7 |
| -import '@umbraco-ui/uui-button/lib'; |
8 |
| -import '@umbraco-ui/uui-popover-container/lib'; |
9 |
| -import '@umbraco-ui/uui-symbol-more/lib'; |
10 |
| - |
11 |
| -import { UUITabElement } from './uui-tab.element'; |
12 |
| -import { UUIPopoverContainerElement } from '@umbraco-ui/uui-popover-container/lib'; |
| 9 | +import type { UUITabElement } from './uui-tab.element'; |
13 | 10 |
|
14 | 11 | /**
|
15 |
| - * @element uui-tab-group |
16 |
| - * @slot - Default slot for the tab group |
| 12 | + * @element uui-tab-group |
| 13 | + * @slot - Default slot for the tab group |
17 | 14 | * @cssprop --uui-tab-group-dropdown-tab-text - Define the tab text color in the dropdown
|
18 | 15 | * @cssprop --uui-tab-group-dropdown-tab-text-hover - Define the tab text hover color in the dropdown
|
19 | 16 | * @cssprop --uui-tab-group-dropdown-tab-text-active - Define the tab text active color in the dropdown
|
@@ -53,12 +50,15 @@ export class UUITabGroupElement extends LitElement {
|
53 | 50 |
|
54 | 51 | #visibilityBreakpoints: number[] = [];
|
55 | 52 |
|
56 |
| - #resizeObserver: ResizeObserver = new ResizeObserver( |
57 |
| - this.#onResize.bind(this) |
58 |
| - ); |
| 53 | + #resizeObserver = new ResizeObserver(this.#onResize.bind(this)); |
59 | 54 |
|
60 | 55 | connectedCallback() {
|
61 | 56 | super.connectedCallback();
|
| 57 | + |
| 58 | + demandCustomElement(this, 'uui-button'); |
| 59 | + demandCustomElement(this, 'uui-popover-container'); |
| 60 | + demandCustomElement(this, 'uui-symbol-more'); |
| 61 | + |
62 | 62 | this.#resizeObserver.observe(this);
|
63 | 63 | if (!this.hasAttribute('role')) this.setAttribute('role', 'tablist');
|
64 | 64 | }
|
@@ -205,7 +205,9 @@ export class UUITabGroupElement extends LitElement {
|
205 | 205 | }
|
206 | 206 |
|
207 | 207 | #isElementTabLike(el: any): el is UUITabElement {
|
208 |
| - return el instanceof UUITabElement || 'active' in el; |
| 208 | + return ( |
| 209 | + typeof el === 'object' && 'active' in el && typeof el.active === 'boolean' |
| 210 | + ); |
209 | 211 | }
|
210 | 212 |
|
211 | 213 | render() {
|
|
0 commit comments