import { LitElement, html, customElement, property, CSSResult, TemplateResult, css } from "lit-element"; import { ifDefined } from "lit-html/directives/if-defined"; // @ts-ignore import TabsStyle from "@patternfly/patternfly/components/Tabs/tabs.css"; // @ts-ignore import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; // @ts-ignore import AKGlobal from "../authentik.css"; import { CURRENT_CLASS } from "../constants"; import { gettext } from "django"; @customElement("ak-tabs") export class Tabs extends LitElement { @property() currentPage?: string; @property({type: Boolean}) vertical = false; static get styles(): CSSResult[] { return [GlobalsStyle, TabsStyle, AKGlobal, css` ::slotted(*) { height: 100%; flex-grow: 2; } :host([vertical]) { display: flex; } :host([vertical]) .pf-c-tabs__list { height: 100%; } `]; } renderTab(page: Element): TemplateResult { const slot = page.attributes.getNamedItem("slot")?.value; return html`
  • `; } render(): TemplateResult { const pages = Array.from(this.querySelectorAll("[slot^='page-']")); if (!this.currentPage) { if (pages.length < 1) { return html`

    ${gettext("no tabs defined")}

    `; } this.currentPage = pages[0].attributes.getNamedItem("slot")?.value; } return html`
    `; } }