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.
74 lines • 2.75 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;
};
var IgcTabComponent_1;
import { LitElement, html } from 'lit';
import { property, query } from 'lit/decorators.js';
import { themes } from '../../theming/theming-decorator.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 { all } from './themes/tab-themes.js';
import { styles } from './themes/tab.base.css.js';
let IgcTabComponent = IgcTabComponent_1 = class IgcTabComponent extends LitElement {
constructor() {
super(...arguments);
this.panel = '';
this.selected = false;
this.disabled = false;
}
static register() {
registerComponent(IgcTabComponent_1);
}
connectedCallback() {
super.connectedCallback();
this.id =
this.getAttribute('id') || `igc-tab-${IgcTabComponent_1.increment()}`;
}
focus(options) {
this.tab.focus(options);
}
blur() {
this.tab.blur();
}
render() {
return html `
<div
part="base"
role="tab"
aria-disabled=${this.disabled ? 'true' : 'false'}
aria-selected=${this.selected ? 'true' : 'false'}
tabindex=${this.disabled || !this.selected ? -1 : 0}
>
<slot name="prefix" part="prefix"></slot>
<div part="content">
<slot></slot>
</div>
<slot name="suffix" part="suffix"></slot>
</div>
`;
}
};
IgcTabComponent.tagName = 'igc-tab';
IgcTabComponent.styles = [styles, shared];
IgcTabComponent.increment = createCounter();
__decorate([
query('[part="base"]', true)
], IgcTabComponent.prototype, "tab", void 0);
__decorate([
property()
], IgcTabComponent.prototype, "panel", void 0);
__decorate([
property({ type: Boolean, reflect: true })
], IgcTabComponent.prototype, "selected", void 0);
__decorate([
property({ type: Boolean, reflect: true })
], IgcTabComponent.prototype, "disabled", void 0);
IgcTabComponent = IgcTabComponent_1 = __decorate([
themes(all)
], IgcTabComponent);
export default IgcTabComponent;
//# sourceMappingURL=tab.js.map