-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Migrate tab-group to webawesome #26951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d30a9d6
Migrate tab-group to webawesome
wendevlin 150335d
Fix scroll with mouse
wendevlin e4c78ed
fix yarn lock
wendevlin b8ac433
remove unused ts-ignore
wendevlin 7eb6d90
Merge branch 'dev' of github.com:home-assistant/frontend into migrate…
wendevlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import Tab from "@home-assistant/webawesome/dist/components/tab/tab"; | ||
| import { css, type CSSResultGroup } from "lit"; | ||
| import { customElement } from "lit/decorators"; | ||
|
|
||
| @customElement("ha-tab-group-tab") | ||
| // @ts-ignore | ||
| export class HaTabGroupTab extends Tab { | ||
| static get styles(): CSSResultGroup { | ||
| return [ | ||
| Tab.styles, | ||
| css` | ||
| :host { | ||
| font-size: var(--ha-font-size-m); | ||
| --wa-color-brand-on-quiet: var( | ||
| --ha-tab-active-text-color, | ||
| var(--primary-color) | ||
| ); | ||
| 2 | ||
| --wa-color-neutral-on-quiet: var(--wa-color-brand-on-quiet); | ||
| opacity: 0.8; | ||
|
|
||
| color: inherit; | ||
| } | ||
|
|
||
| :host([active]:not([disabled])) { | ||
| opacity: 1; | ||
| } | ||
|
|
||
| @media (hover: hover) { | ||
| :host(:hover:not([disabled]):not([active])) .tab { | ||
| color: var(--wa-color-brand-on-quiet); | ||
| } | ||
| } | ||
| `, | ||
| ]; | ||
| } | ||
| } | ||
|
|
||
| declare global { | ||
| interface HTMLElementTagNameMap { | ||
| // @ts-ignore | ||
wendevlin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "ha-tab-group-tab": HaTabGroupTab; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import TabGroup from "@home-assistant/webawesome/dist/components/tab-group/tab-group"; | ||
| import { css, type CSSResultGroup } from "lit"; | ||
| import { customElement, property } from "lit/decorators"; | ||
| import { DragScrollController } from "../common/controllers/drag-scroll-controller"; | ||
|
|
||
| @customElement("ha-tab-group") | ||
| export class HaTabGroup extends TabGroup { | ||
| private _dragScrollController = new DragScrollController(this, { | ||
| selector: ".nav", | ||
| }); | ||
|
|
||
| @property({ attribute: "tab-tag" }) override tabTag = "ha-tab-group-tab"; | ||
|
|
||
| @property({ attribute: "tab-only", type: Boolean }) tabOnly = true; | ||
|
|
||
| protected override handleClick(event: MouseEvent) { | ||
| if (this._dragScrollController.scrolled) { | ||
| return; | ||
| } | ||
| super.handleClick(event); | ||
| } | ||
|
|
||
| static get styles(): CSSResultGroup { | ||
| return [ | ||
| TabGroup.styles, | ||
| css` | ||
| :host { | ||
| --track-width: 2px; | ||
| --track-color: var(--ha-tab-track-color, var(--divider-color)); | ||
| --indicator-color: var( | ||
| --ha-tab-indicator-color, | ||
| var(--primary-color) | ||
| ); | ||
| --wa-color-neutral-on-quiet: var(--indicator-color); | ||
| } | ||
|
|
||
| .tab-group-top ::slotted(ha-tab-group-tab[active]) { | ||
| border-block-end: solid var(--track-width) var(--indicator-color); | ||
| margin-block-end: calc(-1 * var(--track-width)); | ||
| } | ||
|
|
||
| .tab-group-start ::slotted(ha-tab-group-tab[active]) { | ||
| border-inline-end: solid var(--track-width) var(--indicator-color); | ||
| margin-inline-end: calc(-1 * var(--track-width)); | ||
| } | ||
|
|
||
| .tab-group-end ::slotted(ha-tab-group-tab[active]) { | ||
| border-inline-start: solid var(--track-width) var(--indicator-color); | ||
| margin-inline-start: calc(-1 * var(--track-width)); | ||
| } | ||
|
|
||
| .scroll-button::part(base):hover { | ||
| background-color: transparent; | ||
| } | ||
| `, | ||
| ]; | ||
| } | ||
| } | ||
|
|
||
| declare global { | ||
| interface HTMLElementTagNameMap { | ||
| // @ts-ignore | ||
wendevlin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "ha-tab-group": HaTabGroup; | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.