igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
76 lines • 2.78 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import { addThemingController } from '../../theming/theming-controller.js';
import { registerComponent } from '../common/definitions/register.js';
import { createCounter } from '../common/util.js';
import { styles as shared } from './themes/shared/tab/tab.common.css.js';
import { styles } from './themes/tab.base.css.js';
import { all } from './themes/tab-themes.js';
class IgcTabComponent extends LitElement {
static register() {
registerComponent(IgcTabComponent);
}
constructor() {
super();
this.label = '';
this.selected = false;
this.disabled = false;
addThemingController(this, all);
}
connectedCallback() {
super.connectedCallback();
this.id = this.id || `igc-tab-${IgcTabComponent.increment()}`;
}
render() {
const headerId = `${this.id}-header`;
const contentId = `${this.id}-content`;
return html `
<div
part="tab-header"
role="tab"
id=${headerId}
aria-disabled=${this.disabled}
aria-selected=${this.selected}
aria-controls=${contentId}
tabindex=${this.selected ? 0 : -1}
>
<div part="base">
<slot name="prefix" part="prefix"></slot>
<div part="content">
<slot name="label">${this.label}</slot>
</div>
<slot name="suffix" part="suffix"></slot>
</div>
</div>
<div
part="tab-body"
role="tabpanel"
id=${contentId}
aria-labelledby=${headerId}
.inert=${!this.selected}
>
<slot></slot>
</div>
`;
}
}
IgcTabComponent.tagName = 'igc-tab';
IgcTabComponent.styles = [styles, shared];
IgcTabComponent.increment = createCounter();
export default IgcTabComponent;
__decorate([
property()
], IgcTabComponent.prototype, "label", void 0);
__decorate([
property({ type: Boolean, reflect: true })
], IgcTabComponent.prototype, "selected", void 0);
__decorate([
property({ type: Boolean, reflect: true })
], IgcTabComponent.prototype, "disabled", void 0);
//# sourceMappingURL=tab.js.map