UNPKG

@shoelace-style/shoelace

Version:

A forward-thinking library of web components.

64 lines (61 loc) 1.53 kB
import { tab_panel_styles_default } from "./chunk.BQSEJD7X.js"; import { watch } from "./chunk.CCJUT23E.js"; import { component_styles_default } from "./chunk.TUVJKY7S.js"; import { ShoelaceElement } from "./chunk.UYAO2JRR.js"; import { __decorateClass } from "./chunk.B3BW2AY6.js"; // src/components/tab-panel/tab-panel.component.ts import { classMap } from "lit/directives/class-map.js"; import { html } from "lit"; import { property } from "lit/decorators.js"; var id = 0; var SlTabPanel = class extends ShoelaceElement { constructor() { super(...arguments); this.attrId = ++id; this.componentId = `sl-tab-panel-${this.attrId}`; this.name = ""; this.active = false; } connectedCallback() { super.connectedCallback(); this.id = this.id.length > 0 ? this.id : this.componentId; this.setAttribute("role", "tabpanel"); } handleActiveChange() { this.setAttribute("aria-hidden", this.active ? "false" : "true"); } render() { return html` <slot part="base" class=${classMap({ "tab-panel": true, "tab-panel--active": this.active })} ></slot> `; } }; SlTabPanel.styles = [component_styles_default, tab_panel_styles_default]; __decorateClass([ property({ reflect: true }) ], SlTabPanel.prototype, "name", 2); __decorateClass([ property({ type: Boolean, reflect: true }) ], SlTabPanel.prototype, "active", 2); __decorateClass([ watch("active") ], SlTabPanel.prototype, "handleActiveChange", 1); export { SlTabPanel };