-
Notifications
You must be signed in to change notification settings - Fork 83
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
experiment: add LitElement based version of tabs #7379
Merged
Merged
Changes from 1 commit
Commits
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 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 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 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,6 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
export * from './vaadin-tab.js'; |
This file contains 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,58 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { html, LitElement } from 'lit'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js'; | ||
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { TabMixin } from './vaadin-tab-mixin.js'; | ||
import { tabStyles } from './vaadin-tab-styles.js'; | ||
|
||
/** | ||
* LitElement based version of `<vaadin-tab>` web component. | ||
* | ||
* ## Disclaimer | ||
* | ||
* This component is an experiment and not yet a part of Vaadin platform. | ||
* There is no ETA regarding specific Vaadin version where it'll land. | ||
* Feel free to try this code in your apps as per Apache 2.0 license. | ||
* | ||
* @extends HTMLElement | ||
* @mixes ElementMixin | ||
* @mixes TabMixin | ||
* @mixes ThemableMixin | ||
* @protected | ||
*/ | ||
class Tab extends TabMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) { | ||
static get is() { | ||
return 'vaadin-tab'; | ||
} | ||
|
||
static get styles() { | ||
return [tabStyles]; | ||
} | ||
|
||
/** @protected */ | ||
render() { | ||
return html` | ||
<slot></slot> | ||
<slot name="tooltip"></slot> | ||
`; | ||
} | ||
|
||
/** @protected */ | ||
ready() { | ||
super.ready(); | ||
|
||
this._tooltipController = new TooltipController(this); | ||
this.addController(this._tooltipController); | ||
} | ||
} | ||
|
||
defineCustomElement(Tab); | ||
|
||
export { Tab }; |
This file contains 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,6 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
export * from './vaadin-tabs.js'; |
This file contains 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,54 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import './vaadin-lit-tab.js'; | ||
import { html, LitElement } from 'lit'; | ||
import { defineCustomElement } from '@vaadin/component-base/src/define.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { TabsMixin } from './vaadin-tabs-mixin.js'; | ||
import { tabsStyles } from './vaadin-tabs-styles.js'; | ||
|
||
/** | ||
* LitElement based version of `<vaadin-tabs>` web component. | ||
* | ||
* ## Disclaimer | ||
* | ||
* This component is an experiment and not yet a part of Vaadin platform. | ||
* There is no ETA regarding specific Vaadin version where it'll land. | ||
* Feel free to try this code in your apps as per Apache 2.0 license. | ||
* | ||
* @extends HTMLElement | ||
* @mixes ElementMixin | ||
* @mixes TabsMixin | ||
* @mixes ThemableMixin | ||
*/ | ||
class Tabs extends TabsMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) { | ||
static get is() { | ||
return 'vaadin-tabs'; | ||
} | ||
|
||
static get styles() { | ||
return [tabsStyles]; | ||
} | ||
|
||
/** @protected */ | ||
render() { | ||
return html` | ||
<div @click="${this._scrollBack}" part="back-button" aria-hidden="true"></div> | ||
|
||
<div id="scroll" part="tabs"> | ||
<slot></slot> | ||
</div> | ||
|
||
<div @click="${this._scrollForward}" part="forward-button" aria-hidden="true"></div> | ||
`; | ||
} | ||
} | ||
|
||
defineCustomElement(Tabs); | ||
|
||
export { Tabs }; |
This file contains 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 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,3 @@ | ||
import './not-animated-styles.js'; | ||
import '../theme/lumo/vaadin-lit-tabs.js'; | ||
import './scroll.common.js'; |
This file contains 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,3 @@ | ||
import './not-animated-styles.js'; | ||
import '../vaadin-tabs.js'; | ||
import './scroll.common.js'; |
2 changes: 0 additions & 2 deletions
2
packages/tabs/test/scroll.test.js → packages/tabs/test/scroll.common.js
This file contains 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 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,2 @@ | ||
import '../src/vaadin-lit-tab.js'; | ||
import './tab.common.js'; |
This file contains 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,2 @@ | ||
import '../src/vaadin-tab.js'; | ||
import './tab.common.js'; |
6 changes: 3 additions & 3 deletions
6
packages/tabs/test/tab.test.js → packages/tabs/test/tab.common.js
This file contains 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 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,2 @@ | ||
import '../theme/lumo/vaadin-lit-tabs.js'; | ||
import './tabs.common.js'; |
This file contains 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,2 @@ | ||
import '../vaadin-tabs.js'; | ||
import './tabs.common.js'; |
This file contains 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 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,2 @@ | ||
import './vaadin-tab-styles.js'; | ||
import '../../src/vaadin-lit-tab.js'; |
This file contains 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,3 @@ | ||
import './vaadin-lit-tab.js'; | ||
import './vaadin-tabs-styles.js'; | ||
import '../../src/vaadin-lit-tabs.js'; |
This file contains 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,2 @@ | ||
import './vaadin-tab-styles.js'; | ||
import '../../src/vaadin-lit-tab.js'; |
This file contains 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,3 @@ | ||
import './vaadin-lit-tab.js'; | ||
import './vaadin-tabs-styles.js'; | ||
import '../../src/vaadin-lit-tabs.js'; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably an accidental change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.