diff --git a/frontend/src/components/ui/tab-group/tab-group.ts b/frontend/src/components/ui/tab-group/tab-group.ts index ae4e724f..076218b3 100644 --- a/frontend/src/components/ui/tab-group/tab-group.ts +++ b/frontend/src/components/ui/tab-group/tab-group.ts @@ -1,3 +1,4 @@ +import clsx from "clsx"; import { html, type PropertyValues } from "lit"; import { customElement, @@ -9,9 +10,18 @@ import type { TabClickDetail, TabGroupTab } from "./tab"; import { type TabGroupPanel } from "./tab-panel"; import { TailwindElement } from "@/classes/TailwindElement"; +import { tw } from "@/utils/tailwind"; /** - * TODO consolidate with btrix-tab-list + * @example Usage: + * ```ts + * + * First + * Second + * First tab content + * First tab content + * + * ``` */ @customElement("btrix-tab-group") export class TabGroup extends TailwindElement { @@ -19,6 +29,10 @@ export class TabGroup extends TailwindElement { @property({ type: String, reflect: false }) active = ""; + /* Nav placement */ + @property({ type: String }) + placement: "top" | "start" = "top"; + @property({ type: String, noAccessor: true, reflect: true }) role = "tablist"; @@ -48,10 +62,27 @@ export class TabGroup extends TailwindElement { render() { return html` -
- +
+
+ +
+
+ +
- `; } diff --git a/frontend/src/components/ui/tab-group/tab-panel.ts b/frontend/src/components/ui/tab-group/tab-panel.ts index 6badefde..d939fb6f 100644 --- a/frontend/src/components/ui/tab-group/tab-panel.ts +++ b/frontend/src/components/ui/tab-group/tab-panel.ts @@ -3,9 +3,6 @@ import { customElement, property } from "lit/decorators.js"; import { TailwindElement } from "@/classes/TailwindElement"; -/** - * TODO consolidate with btrix-tab-list btrix-tab-panel - */ @customElement("btrix-tab-group-panel") export class TabGroupPanel extends TailwindElement { @property({ type: String }) diff --git a/frontend/src/components/ui/tab-group/tab.ts b/frontend/src/components/ui/tab-group/tab.ts index f32edfe0..d093e6f5 100644 --- a/frontend/src/components/ui/tab-group/tab.ts +++ b/frontend/src/components/ui/tab-group/tab.ts @@ -6,8 +6,6 @@ import { NavigationButton } from "@/components/ui/navigation/navigation-button"; export type TabClickDetail = { panel: string }; /** - * TODO consolidate with btrix-tab-list btrix-tab - * * @fires btrix-select-tab */ @customElement("btrix-tab-group-tab") diff --git a/frontend/src/components/ui/tab-list.ts b/frontend/src/components/ui/tab-list.ts index 39aaaa41..0ee03401 100644 --- a/frontend/src/components/ui/tab-list.ts +++ b/frontend/src/components/ui/tab-list.ts @@ -9,6 +9,8 @@ const DEFAULT_PANEL_ID = "default-panel"; export const TWO_COL_SCREEN_MIN_CSS = css`64.5rem`; /** + * @deprecated Use `btrix-tab-group` + * * Tab list * * Usage example: @@ -45,6 +47,9 @@ export class TabPanel extends TailwindElement { } } +/** + * @deprecated Use `btrix-tab-group` + */ @customElement("btrix-tab") export class Tab extends TailwindElement { // ID of panel the tab labels/controls @@ -76,6 +81,9 @@ export class Tab extends TailwindElement { type TabElement = Tab & HTMLElement; type TabPanelElement = TabPanel & HTMLElement; +/** + * @deprecated Use `btrix-tab-group` + */ @customElement("btrix-tab-list") export class TabList extends TailwindElement { static styles = css` diff --git a/frontend/src/pages/account-settings.ts b/frontend/src/pages/account-settings.ts index 83432d01..3145a002 100644 --- a/frontend/src/pages/account-settings.ts +++ b/frontend/src/pages/account-settings.ts @@ -149,25 +149,15 @@ export class AccountSettings extends BtrixElement { classNames: tw`mb-3 lg:mb-5`, })} - -
- ${choose( - this.activeTab, - [ - [Tab.Profile, () => html`

${msg("Display Name")}

`], - [Tab.Security, () => html`

${msg("Password")}

`], - ], - () => html`

${this.tabLabels[this.activeTab]}

`, - )} -
+ ${this.renderTab(Tab.Profile)} ${this.renderTab(Tab.Security)} - + ${this.renderProfile()} - - + + ${this.renderSecurity()} - -
+ + `; } @@ -175,6 +165,7 @@ export class AccountSettings extends BtrixElement { if (!this.userInfo) return; return html` +

${msg("Display Name")}

@@ -257,6 +248,7 @@ export class AccountSettings extends BtrixElement { private renderSecurity() { return html` +

${msg("Password")}

${choose(name, [ @@ -325,7 +314,7 @@ export class AccountSettings extends BtrixElement { ], ])} ${this.tabLabels[name]} - + `; } diff --git a/frontend/src/pages/org/archived-item-detail/archived-item-detail.ts b/frontend/src/pages/org/archived-item-detail/archived-item-detail.ts index aaf3d151..5f64d806 100644 --- a/frontend/src/pages/org/archived-item-detail/archived-item-detail.ts +++ b/frontend/src/pages/org/archived-item-detail/archived-item-detail.ts @@ -543,7 +543,7 @@ export class ArchivedItemDetail extends BtrixElement { }; return html`