igniteui-webcomponents 5.4.0 → 6.0.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/CHANGELOG.md +63 -0
- package/components/checkbox/checkbox-base.d.ts +0 -2
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/common/controllers/resize-observer.d.ts +37 -0
- package/components/common/controllers/resize-observer.js +37 -0
- package/components/common/controllers/resize-observer.js.map +1 -0
- package/components/common/definitions/defineAllComponents.js +0 -2
- package/components/common/definitions/defineAllComponents.js.map +1 -1
- package/components/common/util.d.ts +1 -17
- package/components/common/util.js +13 -10
- package/components/common/util.js.map +1 -1
- package/components/popover/popover.js +1 -1
- package/components/popover/popover.js.map +1 -1
- package/components/popover/themes/light/popover.base.css.js +1 -1
- package/components/popover/themes/light/popover.base.css.js.map +1 -1
- package/components/radio/radio.d.ts +0 -2
- package/components/radio/radio.js.map +1 -1
- package/components/slider/range-slider.d.ts +0 -2
- package/components/slider/range-slider.js.map +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +3 -2
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.common.d.ts +0 -4
- package/components/stepper/stepper.common.js.map +1 -1
- package/components/stepper/stepper.d.ts +2 -2
- package/components/stepper/stepper.js +2 -9
- package/components/stepper/stepper.js.map +1 -1
- package/components/tabs/tab-dom.d.ts +66 -0
- package/components/tabs/tab-dom.js +93 -0
- package/components/tabs/tab-dom.js.map +1 -0
- package/components/tabs/tab.d.ts +14 -15
- package/components/tabs/tab.js +27 -22
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.d.ts +42 -49
- package/components/tabs/tabs.js +178 -231
- package/components/tabs/tabs.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.bootstrap.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.bootstrap.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.common.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.common.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.fluent.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.fluent.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.indigo.css.js +1 -1
- package/components/tabs/themes/shared/tab/tab.indigo.css.js.map +1 -1
- package/components/tabs/themes/shared/tab/tab.material.css.js +3 -0
- package/components/tabs/themes/shared/tab/tab.material.css.js.map +1 -0
- package/components/tabs/themes/shared/tabs/tabs.bootstrap.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.bootstrap.css.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.common.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.common.css.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.fluent.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.fluent.css.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.indigo.css.js +1 -1
- package/components/tabs/themes/shared/tabs/tabs.indigo.css.js.map +1 -1
- package/components/tabs/themes/shared/tabs/tabs.material.css.d.ts +1 -0
- package/components/tabs/themes/shared/tabs/tabs.material.css.js +3 -0
- package/components/tabs/themes/shared/tabs/tabs.material.css.js.map +1 -0
- package/components/tabs/themes/tab-themes.js +7 -0
- package/components/tabs/themes/tab-themes.js.map +1 -1
- package/components/tabs/themes/tab.base.css.js +1 -1
- package/components/tabs/themes/tab.base.css.js.map +1 -1
- package/components/tabs/themes/tabs-themes.js +3 -2
- package/components/tabs/themes/tabs-themes.js.map +1 -1
- package/components/tabs/themes/tabs.base.css.js +1 -1
- package/components/tabs/themes/tabs.base.css.js.map +1 -1
- package/components/tabs/themes/tabs.common.css.d.ts +1 -0
- package/components/tabs/themes/tabs.common.css.js +3 -0
- package/components/tabs/themes/tabs.common.css.js.map +1 -0
- package/components/textarea/textarea.d.ts +2 -2
- package/components/textarea/textarea.js.map +1 -1
- package/components/tooltip/tooltip.js +1 -1
- package/components/tooltip/tooltip.js.map +1 -1
- package/components/types.d.ts +1 -1
- package/components/types.js.map +1 -1
- package/custom-elements.json +390 -360
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +0 -5
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/package.json +4 -3
- package/web-types.json +2 -2
- package/components/tabs/tab-panel.d.ts +0 -21
- package/components/tabs/tab-panel.js +0 -26
- package/components/tabs/tab-panel.js.map +0 -1
- package/components/tabs/themes/tab-panel.base.css.js +0 -3
- package/components/tabs/themes/tab-panel.base.css.js.map +0 -1
- /package/components/tabs/themes/{tab-panel.base.css.d.ts → shared/tab/tab.material.css.d.ts} +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { isLTR } from '../common/util.js';
|
|
2
|
+
class TabsHelpers {
|
|
3
|
+
get container() {
|
|
4
|
+
return this._container.value;
|
|
5
|
+
}
|
|
6
|
+
get indicator() {
|
|
7
|
+
return this._indicator.value;
|
|
8
|
+
}
|
|
9
|
+
get styleProperties() {
|
|
10
|
+
return this._styleProperties;
|
|
11
|
+
}
|
|
12
|
+
get hasScrollButtons() {
|
|
13
|
+
return this._hasScrollButtons;
|
|
14
|
+
}
|
|
15
|
+
get scrollButtonsDisabled() {
|
|
16
|
+
return this._scrollButtonsDisabled;
|
|
17
|
+
}
|
|
18
|
+
get isLeftToRightChanged() {
|
|
19
|
+
const isLeftToRight = isLTR(this._host);
|
|
20
|
+
if (this._isLeftToRight !== isLeftToRight) {
|
|
21
|
+
this._isLeftToRight = isLeftToRight;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
constructor(host, container, indicator) {
|
|
27
|
+
this._styleProperties = {
|
|
28
|
+
'--_tabs-count': '',
|
|
29
|
+
'--_ig-tabs-width': '',
|
|
30
|
+
};
|
|
31
|
+
this._hasScrollButtons = false;
|
|
32
|
+
this._scrollButtonsDisabled = { start: true, end: false };
|
|
33
|
+
this._isLeftToRight = false;
|
|
34
|
+
this._host = host;
|
|
35
|
+
this._container = container;
|
|
36
|
+
this._indicator = indicator;
|
|
37
|
+
}
|
|
38
|
+
setStyleProperties() {
|
|
39
|
+
this._styleProperties = {
|
|
40
|
+
'--_tabs-count': this._host.tabs.length.toString(),
|
|
41
|
+
'--_ig-tabs-width': `${this.container.getBoundingClientRect().width}px`,
|
|
42
|
+
};
|
|
43
|
+
this._host.requestUpdate();
|
|
44
|
+
}
|
|
45
|
+
setScrollSnap(type) {
|
|
46
|
+
this.container.style.setProperty('--_ig-tab-snap', type || 'unset');
|
|
47
|
+
}
|
|
48
|
+
scrollTabs(direction) {
|
|
49
|
+
const factor = isLTR(this._host) ? 1 : -1;
|
|
50
|
+
const amount = direction === 'start'
|
|
51
|
+
? -TabsHelpers.SCROLL_AMOUNT
|
|
52
|
+
: TabsHelpers.SCROLL_AMOUNT;
|
|
53
|
+
this.setScrollSnap(direction);
|
|
54
|
+
this.container.scrollBy({ left: factor * amount, behavior: 'smooth' });
|
|
55
|
+
}
|
|
56
|
+
setScrollButtonState() {
|
|
57
|
+
const { scrollLeft, scrollWidth, clientWidth } = this.container;
|
|
58
|
+
this._hasScrollButtons = scrollWidth > clientWidth;
|
|
59
|
+
this._scrollButtonsDisabled = {
|
|
60
|
+
start: scrollLeft === 0,
|
|
61
|
+
end: Math.abs(Math.abs(scrollLeft) + clientWidth - scrollWidth) <= 1,
|
|
62
|
+
};
|
|
63
|
+
this._host.requestUpdate();
|
|
64
|
+
}
|
|
65
|
+
async setIndicator(active) {
|
|
66
|
+
const styles = {
|
|
67
|
+
visibility: active ? 'visible' : 'hidden',
|
|
68
|
+
};
|
|
69
|
+
await this._host.updateComplete;
|
|
70
|
+
if (active) {
|
|
71
|
+
const tabHeader = getTabHeader(active);
|
|
72
|
+
const { width } = tabHeader.getBoundingClientRect();
|
|
73
|
+
const offset = this._isLeftToRight
|
|
74
|
+
? tabHeader.offsetLeft - this.container.offsetLeft
|
|
75
|
+
: width +
|
|
76
|
+
tabHeader.offsetLeft -
|
|
77
|
+
this.container.getBoundingClientRect().width;
|
|
78
|
+
Object.assign(styles, {
|
|
79
|
+
width: `${width}px`,
|
|
80
|
+
transform: `translateX(${offset}px)`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
Object.assign(this.indicator.style, styles);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
TabsHelpers.SCROLL_AMOUNT = 180;
|
|
87
|
+
export function createTabHelpers(host, container, indicator) {
|
|
88
|
+
return new TabsHelpers(host, container, indicator);
|
|
89
|
+
}
|
|
90
|
+
export function getTabHeader(tab) {
|
|
91
|
+
return tab.renderRoot.querySelector('[part~="tab-header"]');
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=tab-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-dom.js","sourceRoot":"","sources":["../../../src/components/tabs/tab-dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,MAAM,WAAW;IAmBf,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC;IAChC,CAAC;IAKD,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAM,CAAC;IAChC,CAAC;IAKD,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAKD,IAAW,gBAAgB;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAKD,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED,IAAW,oBAAoB;QAC7B,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,cAAc,KAAK,aAAa,EAAE,CAAC;YAC1C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;YACpC,OAAO,IAAI,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rC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;;AAnJuB,yBAAa,GAAG,GAAG,AAAN,CAAO;AAsJ9C,MAAM,UAAU,gBAAgB,CAC9B,IAAsB,EACtB,SAA2B,EAC3B,SAA2B;IAE3B,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAoB;IAC/C,OAAO,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAE,CAAC;AAC/D,CAAC","sourcesContent":["import type { Ref } from 'lit/directives/ref.js';\nimport { isLTR } from '../common/util.js';\nimport type IgcTabComponent from './tab.js';\nimport type IgcTabsComponent from './tabs.js';\n\nclass TabsHelpers {\n private static readonly SCROLL_AMOUNT = 180;\n private readonly _host: IgcTabsComponent;\n private readonly _container: Ref<HTMLElement>;\n private readonly _indicator: Ref<HTMLElement>;\n\n private _styleProperties = {\n '--_tabs-count': '',\n '--_ig-tabs-width': '',\n };\n\n private _hasScrollButtons = false;\n private _scrollButtonsDisabled = { start: true, end: false };\n\n private _isLeftToRight = false;\n\n /**\n * Returns the DOM container holding the tabs headers.\n */\n public get container(): HTMLElement {\n return this._container.value!;\n }\n\n /**\n * Returns the selected indicator DOM element.\n */\n public get indicator(): HTMLElement {\n return this._indicator.value!;\n }\n\n /**\n * Returns the internal CSS variables used for the layout of the tabs component.\n */\n public get styleProperties() {\n return this._styleProperties;\n }\n\n /**\n * Whether the scroll buttons of the tabs header strip should be shown.\n */\n public get hasScrollButtons(): boolean {\n return this._hasScrollButtons;\n }\n\n /**\n * Returns the disabled state of the tabs header strip scroll buttons.\n */\n public get scrollButtonsDisabled() {\n return this._scrollButtonsDisabled;\n }\n\n public get isLeftToRightChanged(): boolean {\n const isLeftToRight = isLTR(this._host);\n\n if (this._isLeftToRight !== isLeftToRight) {\n this._isLeftToRight = isLeftToRight;\n return true;\n }\n\n return false;\n }\n\n constructor(\n host: IgcTabsComponent,\n container: Ref<HTMLElement>,\n indicator: Ref<HTMLElement>\n ) {\n this._host = host;\n this._container = container;\n this._indicator = indicator;\n }\n\n /**\n * Sets the internal CSS variables used for the layout of the tabs component.\n * Triggers an update cycle (rerender) of the `igc-tabs` component.\n */\n public setStyleProperties(): void {\n this._styleProperties = {\n '--_tabs-count': this._host.tabs.length.toString(),\n '--_ig-tabs-width': `${this.container.getBoundingClientRect().width}px`,\n };\n this._host.requestUpdate();\n }\n\n /**\n * Sets the type of the `scroll-snap-align` CSS property for the tabs header strip.\n */\n public setScrollSnap(type?: 'start' | 'end'): void {\n this.container.style.setProperty('--_ig-tab-snap', type || 'unset');\n }\n\n /**\n * Scrolls the tabs header strip in the given direction with `scroll-snap-align` set.\n */\n public scrollTabs(direction: 'start' | 'end'): void {\n const factor = isLTR(this._host) ? 1 : -1;\n const amount =\n direction === 'start'\n ? -TabsHelpers.SCROLL_AMOUNT\n : TabsHelpers.SCROLL_AMOUNT;\n\n this.setScrollSnap(direction);\n this.container.scrollBy({ left: factor * amount, behavior: 'smooth' });\n }\n\n /**\n * Updates the state of the tabs header strip scroll buttons - visibility and active state.\n * Triggers an update cycle (rerender) of the `igc-tabs` component.\n */\n public setScrollButtonState(): void {\n const { scrollLeft, scrollWidth, clientWidth } = this.container;\n\n this._hasScrollButtons = scrollWidth > clientWidth;\n this._scrollButtonsDisabled = {\n start: scrollLeft === 0,\n end: Math.abs(Math.abs(scrollLeft) + clientWidth - scrollWidth) <= 1,\n };\n\n this._host.requestUpdate();\n }\n\n /**\n * Updates the indicator DOM element styles based on the current \"active\" tab.\n */\n public async setIndicator(active?: IgcTabComponent): Promise<void> {\n const styles = {\n visibility: active ? 'visible' : 'hidden',\n } satisfies Partial<CSSStyleDeclaration>;\n\n await this._host.updateComplete;\n\n if (active) {\n const tabHeader = getTabHeader(active);\n const { width } = tabHeader.getBoundingClientRect();\n\n const offset = this._isLeftToRight\n ? tabHeader.offsetLeft - this.container.offsetLeft\n : width +\n tabHeader.offsetLeft -\n this.container.getBoundingClientRect().width;\n\n Object.assign(styles, {\n width: `${width}px`,\n transform: `translateX(${offset}px)`,\n });\n }\n\n Object.assign(this.indicator.style, styles);\n }\n}\n\nexport function createTabHelpers(\n host: IgcTabsComponent,\n container: Ref<HTMLElement>,\n indicator: Ref<HTMLElement>\n) {\n return new TabsHelpers(host, container, indicator);\n}\n\nexport function getTabHeader(tab: IgcTabComponent): HTMLElement {\n return tab.renderRoot.querySelector('[part~=\"tab-header\"]')!;\n}\n"]}
|
package/components/tabs/tab.d.ts
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* A tab element slotted into an `igc-tabs` container.
|
|
4
4
|
*
|
|
5
5
|
* @element igc-tab
|
|
6
6
|
*
|
|
7
|
-
* @slot
|
|
8
|
-
* @slot - Renders the tab header
|
|
9
|
-
* @slot
|
|
7
|
+
* @slot - Renders the tab's content.
|
|
8
|
+
* @slot label - Renders the tab header's label.
|
|
9
|
+
* @slot prefix - Renders the tab header's prefix.
|
|
10
|
+
* @slot suffix - Renders the tab header's suffix.
|
|
10
11
|
*
|
|
11
|
-
* @csspart
|
|
12
|
-
* @csspart prefix -
|
|
13
|
-
* @csspart
|
|
12
|
+
* @csspart tab-header - The header of a single tab.
|
|
13
|
+
* @csspart prefix - Tab header's label prefix.
|
|
14
|
+
* @csspart content - Tab header's label slot container.
|
|
15
|
+
* @csspart suffix - Tab header's label suffix.
|
|
16
|
+
* @csspart tab-body - Holds the body content of a single tab, only the body of the selected tab is visible.
|
|
14
17
|
*/
|
|
15
18
|
export default class IgcTabComponent extends LitElement {
|
|
16
19
|
static readonly tagName = "igc-tab";
|
|
17
20
|
static styles: import("lit").CSSResult[];
|
|
18
21
|
static register(): void;
|
|
19
|
-
private static
|
|
20
|
-
private tab;
|
|
22
|
+
private static increment;
|
|
21
23
|
/**
|
|
22
|
-
* The
|
|
24
|
+
* The tab item label.
|
|
23
25
|
* @attr
|
|
24
26
|
*/
|
|
25
|
-
|
|
27
|
+
label: string;
|
|
26
28
|
/**
|
|
27
29
|
* Determines whether the tab is selected.
|
|
28
30
|
* @attr
|
|
@@ -33,11 +35,8 @@ export default class IgcTabComponent extends LitElement {
|
|
|
33
35
|
* @attr
|
|
34
36
|
*/
|
|
35
37
|
disabled: boolean;
|
|
38
|
+
/** @internal */
|
|
36
39
|
connectedCallback(): void;
|
|
37
|
-
/** Sets focus to the tab. */
|
|
38
|
-
focus(options?: FocusOptions): void;
|
|
39
|
-
/** Removes focus from the tab. */
|
|
40
|
-
blur(): void;
|
|
41
40
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
42
41
|
}
|
|
43
42
|
declare global {
|
package/components/tabs/tab.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var IgcTabComponent_1;
|
|
8
8
|
import { LitElement, html } from 'lit';
|
|
9
|
-
import { property
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { themes } from '../../theming/theming-decorator.js';
|
|
11
11
|
import { registerComponent } from '../common/definitions/register.js';
|
|
12
12
|
import { createCounter } from '../common/util.js';
|
|
@@ -16,7 +16,7 @@ import { styles } from './themes/tab.base.css.js';
|
|
|
16
16
|
let IgcTabComponent = IgcTabComponent_1 = class IgcTabComponent extends LitElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
this.
|
|
19
|
+
this.label = '';
|
|
20
20
|
this.selected = false;
|
|
21
21
|
this.disabled = false;
|
|
22
22
|
}
|
|
@@ -25,29 +25,37 @@ let IgcTabComponent = IgcTabComponent_1 = class IgcTabComponent extends LitEleme
|
|
|
25
25
|
}
|
|
26
26
|
connectedCallback() {
|
|
27
27
|
super.connectedCallback();
|
|
28
|
-
this.id =
|
|
29
|
-
this.getAttribute('id') || `igc-tab-${IgcTabComponent_1.increment()}`;
|
|
30
|
-
}
|
|
31
|
-
focus(options) {
|
|
32
|
-
this.tab.focus(options);
|
|
33
|
-
}
|
|
34
|
-
blur() {
|
|
35
|
-
this.tab.blur();
|
|
28
|
+
this.id = this.id || `igc-tab-${IgcTabComponent_1.increment()}`;
|
|
36
29
|
}
|
|
37
30
|
render() {
|
|
31
|
+
const headerId = `${this.id}-header`;
|
|
32
|
+
const contentId = `${this.id}-content`;
|
|
38
33
|
return html `
|
|
39
34
|
<div
|
|
40
|
-
part="
|
|
35
|
+
part="tab-header"
|
|
41
36
|
role="tab"
|
|
42
|
-
|
|
43
|
-
aria-
|
|
44
|
-
|
|
37
|
+
id=${headerId}
|
|
38
|
+
aria-disabled=${this.disabled}
|
|
39
|
+
aria-selected=${this.selected}
|
|
40
|
+
aria-controls=${contentId}
|
|
41
|
+
tabindex=${this.selected ? 0 : -1}
|
|
45
42
|
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
<
|
|
43
|
+
<div part="base">
|
|
44
|
+
<slot name="prefix" part="prefix"></slot>
|
|
45
|
+
<div part="content">
|
|
46
|
+
<slot name="label">${this.label}</slot>
|
|
47
|
+
</div>
|
|
48
|
+
<slot name="suffix" part="suffix"></slot>
|
|
49
49
|
</div>
|
|
50
|
-
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
part="tab-body"
|
|
53
|
+
role="tabpanel"
|
|
54
|
+
id=${contentId}
|
|
55
|
+
aria-labelledby=${headerId}
|
|
56
|
+
.inert=${!this.selected}
|
|
57
|
+
>
|
|
58
|
+
<slot></slot>
|
|
51
59
|
</div>
|
|
52
60
|
`;
|
|
53
61
|
}
|
|
@@ -55,12 +63,9 @@ let IgcTabComponent = IgcTabComponent_1 = class IgcTabComponent extends LitEleme
|
|
|
55
63
|
IgcTabComponent.tagName = 'igc-tab';
|
|
56
64
|
IgcTabComponent.styles = [styles, shared];
|
|
57
65
|
IgcTabComponent.increment = createCounter();
|
|
58
|
-
__decorate([
|
|
59
|
-
query('[part="base"]', true)
|
|
60
|
-
], IgcTabComponent.prototype, "tab", void 0);
|
|
61
66
|
__decorate([
|
|
62
67
|
property()
|
|
63
|
-
], IgcTabComponent.prototype, "
|
|
68
|
+
], IgcTabComponent.prototype, "label", void 0);
|
|
64
69
|
__decorate([
|
|
65
70
|
property({ type: Boolean, reflect: true })
|
|
66
71
|
], IgcTabComponent.prototype, "selected", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.js","sourceRoot":"","sources":["../../../src/components/tabs/tab.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"tab.js","sourceRoot":"","sources":["../../../src/components/tabs/tab.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAoBnC,IAAM,eAAe,uBAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAgBN,UAAK,GAAG,EAAE,CAAC;QAOX,aAAQ,GAAG,KAAK,CAAC;QAOjB,aAAQ,GAAG,KAAK,CAAC;IAyC1B,CAAC;IAlEQ,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,iBAAe,CAAC,CAAC;IACrC,CAAC;IA0Be,iBAAiB;QAC/B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,WAAW,iBAAe,CAAC,SAAS,EAAE,EAAE,CAAC;IAChE,CAAC;IAEkB,MAAM;QACvB,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,EAAE,SAAS,CAAC;QACrC,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,EAAE,UAAU,CAAC;QAEvC,OAAO,IAAI,CAAA;;;;aAIF,QAAQ;wBACG,IAAI,CAAC,QAAQ;wBACb,IAAI,CAAC,QAAQ;wBACb,SAAS;mBACd,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;iCAKR,IAAI,CAAC,KAAK;;;;;;;;aAQ9B,SAAS;0BACI,QAAQ;iBACjB,CAAC,IAAI,CAAC,QAAQ;;;;KAI1B,CAAC;IACJ,CAAC;;AArEsB,uBAAO,GAAG,SAAS,AAAZ,CAAa;AACpB,sBAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnB,CAAoB;AAOlC,yBAAS,GAAG,aAAa,EAAE,AAAlB,CAAmB;AAOpC;IADN,QAAQ,EAAE;8CACO;AAOX;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACnB;AAOjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACnB;AA9BL,eAAe;IADnC,MAAM,CAAC,GAAG,CAAC;GACS,eAAe,CAuEnC;eAvEoB,eAAe","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { themes } from '../../theming/theming-decorator.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport { createCounter } from '../common/util.js';\nimport { styles as shared } from './themes/shared/tab/tab.common.css.js';\nimport { all } from './themes/tab-themes.js';\nimport { styles } from './themes/tab.base.css.js';\n\n/**\n * A tab element slotted into an `igc-tabs` container.\n *\n * @element igc-tab\n *\n * @slot - Renders the tab's content.\n * @slot label - Renders the tab header's label.\n * @slot prefix - Renders the tab header's prefix.\n * @slot suffix - Renders the tab header's suffix.\n *\n * @csspart tab-header - The header of a single tab.\n * @csspart prefix - Tab header's label prefix.\n * @csspart content - Tab header's label slot container.\n * @csspart suffix - Tab header's label suffix.\n * @csspart tab-body - Holds the body content of a single tab, only the body of the selected tab is visible.\n */\n\n@themes(all)\nexport default class IgcTabComponent extends LitElement {\n public static readonly tagName = 'igc-tab';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcTabComponent);\n }\n\n private static increment = createCounter();\n\n /**\n * The tab item label.\n * @attr\n */\n @property()\n public label = '';\n\n /**\n * Determines whether the tab is selected.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n /**\n * Determines whether the tab is disabled.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.id = this.id || `igc-tab-${IgcTabComponent.increment()}`;\n }\n\n protected override render() {\n const headerId = `${this.id}-header`;\n const contentId = `${this.id}-content`;\n\n return html`\n <div\n part=\"tab-header\"\n role=\"tab\"\n id=${headerId}\n aria-disabled=${this.disabled}\n aria-selected=${this.selected}\n aria-controls=${contentId}\n tabindex=${this.selected ? 0 : -1}\n >\n <div part=\"base\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <div part=\"content\">\n <slot name=\"label\">${this.label}</slot>\n </div>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </div>\n </div>\n <div\n part=\"tab-body\"\n role=\"tabpanel\"\n id=${contentId}\n aria-labelledby=${headerId}\n .inert=${!this.selected}\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tab': IgcTabComponent;\n }\n}\n"]}
|
|
@@ -1,53 +1,40 @@
|
|
|
1
|
-
import { LitElement
|
|
2
|
-
import { type Ref } from 'lit/directives/ref.js';
|
|
1
|
+
import { LitElement } from 'lit';
|
|
3
2
|
import type { Constructor } from '../common/mixins/constructor.js';
|
|
4
3
|
import type { TabsActivation, TabsAlignment } from '../types.js';
|
|
5
|
-
import IgcTabPanelComponent from './tab-panel.js';
|
|
6
4
|
import IgcTabComponent from './tab.js';
|
|
7
5
|
export interface IgcTabsComponentEventMap {
|
|
8
6
|
igcChange: CustomEvent<IgcTabComponent>;
|
|
9
7
|
}
|
|
10
8
|
declare const IgcTabsComponent_base: Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcTabsComponentEventMap>> & Constructor<LitElement>;
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* Tabs organize and allow navigation between groups of content that are related and at the same level of hierarchy.
|
|
11
|
+
*
|
|
12
|
+
* The `<igc-tabs>` component allows the user to navigate between multiple `<igc-tab>` elements.
|
|
13
|
+
* It supports keyboard navigation and provides API methods to control the selected tab.
|
|
13
14
|
*
|
|
14
15
|
* @element igc-tabs
|
|
15
16
|
*
|
|
16
17
|
* @fires igcChange - Emitted when the selected tab changes.
|
|
17
18
|
*
|
|
18
|
-
* @slot - Renders the
|
|
19
|
-
* @slot panel - Renders the tab content.
|
|
19
|
+
* @slot - Renders the `IgcTabComponents` inside default slot.
|
|
20
20
|
*
|
|
21
|
-
* @csspart headers - The wrapper of the tabs including the headers content and the scroll buttons.
|
|
22
|
-
* @csspart headers-content - The container for the tab headers.
|
|
23
|
-
* @csspart headers-wrapper - The wrapper for the tab headers and the selected indicator.
|
|
24
|
-
* @csspart headers-scroll - The container for the headers.
|
|
25
|
-
* @csspart selected-indicator - The selected indicator.
|
|
26
21
|
* @csspart start-scroll-button - The start scroll button displayed when the tabs overflow.
|
|
27
22
|
* @csspart end-scroll-button - The end scroll button displayed when the tabs overflow.
|
|
28
|
-
* @csspart
|
|
23
|
+
* @csspart selected-indicator - The indicator that shows which tab is selected.
|
|
29
24
|
*/
|
|
30
25
|
export default class IgcTabsComponent extends IgcTabsComponent_base {
|
|
31
26
|
static readonly tagName = "igc-tabs";
|
|
32
27
|
static styles: import("lit").CSSResult[];
|
|
33
28
|
static register(): void;
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
protected
|
|
42
|
-
|
|
43
|
-
protected disableEndScrollButton: boolean;
|
|
44
|
-
protected activeTab?: IgcTabComponent;
|
|
45
|
-
protected resizeObserver: ResizeObserver;
|
|
46
|
-
private get _closestActiveTabIndex();
|
|
47
|
-
private _mutationCallback;
|
|
48
|
-
protected get enabledTabs(): IgcTabComponent[];
|
|
49
|
-
/** Returns the currently selected tab. */
|
|
50
|
-
get selected(): string;
|
|
29
|
+
private readonly _resizeController;
|
|
30
|
+
/** The tabs container reference holding the tab headers. */
|
|
31
|
+
private readonly _headerRef;
|
|
32
|
+
/** The selected tab indicator reference. */
|
|
33
|
+
private readonly _indicatorRef;
|
|
34
|
+
private readonly _domHelpers;
|
|
35
|
+
private _tabs;
|
|
36
|
+
protected get _enabledTabs(): IgcTabComponent[];
|
|
37
|
+
private _activeTab?;
|
|
51
38
|
/**
|
|
52
39
|
* Sets the alignment for the tab headers
|
|
53
40
|
* @attr
|
|
@@ -61,29 +48,35 @@ export default class IgcTabsComponent extends IgcTabsComponent_base {
|
|
|
61
48
|
* @attr
|
|
62
49
|
*/
|
|
63
50
|
activation: TabsActivation;
|
|
64
|
-
|
|
51
|
+
/** Returns the direct `igc-tab` elements that are children of this element. */
|
|
52
|
+
get tabs(): IgcTabComponent[];
|
|
53
|
+
/** Returns the currently selected tab label or IDREF if no label property is set. */
|
|
54
|
+
get selected(): string;
|
|
55
|
+
protected _alignmentChanged(): void;
|
|
65
56
|
constructor();
|
|
66
57
|
protected firstUpdated(): Promise<void>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
protected
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
private
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
private
|
|
77
|
-
private
|
|
78
|
-
private
|
|
79
|
-
private
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
protected
|
|
58
|
+
/** @internal */
|
|
59
|
+
connectedCallback(): void;
|
|
60
|
+
protected updated(): void;
|
|
61
|
+
private _resizeCallback;
|
|
62
|
+
private _mutationCallback;
|
|
63
|
+
private _selectedAttributeChanged;
|
|
64
|
+
private _handleTabsAdded;
|
|
65
|
+
private _handleTabsRemoved;
|
|
66
|
+
private _getClosestActiveTabIndex;
|
|
67
|
+
private _setSelectedTab;
|
|
68
|
+
private _keyboardActivateTab;
|
|
69
|
+
private _skipKeyboard;
|
|
70
|
+
private _isEventFromTabHeader;
|
|
71
|
+
protected _handleArrowKeys(delta: -1 | 1): void;
|
|
72
|
+
protected _handleHomeKey(): void;
|
|
73
|
+
protected _handleEndKey(): void;
|
|
74
|
+
protected _handleActivationKeys(): void;
|
|
75
|
+
protected _handleClick(event: PointerEvent): void;
|
|
76
|
+
protected _handleScroll(): void;
|
|
84
77
|
/** Selects the specified tab and displays the corresponding panel. */
|
|
85
|
-
select(
|
|
86
|
-
protected
|
|
78
|
+
select(ref: IgcTabComponent | string): void;
|
|
79
|
+
protected _renderScrollButton(direction: 'start' | 'end'): import("lit-html").TemplateResult<1>;
|
|
87
80
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
88
81
|
}
|
|
89
82
|
declare global {
|