-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract tabs styles to reusable css literals (#6804)
- Loading branch information
1 parent
f36824c
commit 9edf23c
Showing
6 changed files
with
135 additions
and
98 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const tabStyles: CSSResult; |
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,27 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { css } from 'lit'; | ||
|
||
export const tabStyles = css` | ||
:host { | ||
display: block; | ||
} | ||
:host([hidden]) { | ||
display: none !important; | ||
} | ||
@media (forced-colors: active) { | ||
:host([focused]) { | ||
outline: 1px solid; | ||
outline-offset: -1px; | ||
} | ||
:host([selected]) { | ||
border-bottom: 2px solid; | ||
} | ||
} | ||
`; |
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,8 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const tabsStyles: CSSResult; |
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,84 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2017 - 2023 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { css } from 'lit'; | ||
|
||
export const tabsStyles = css` | ||
:host { | ||
display: flex; | ||
align-items: center; | ||
} | ||
:host([hidden]) { | ||
display: none !important; | ||
} | ||
:host([orientation='vertical']) { | ||
display: block; | ||
} | ||
:host([orientation='horizontal']) [part='tabs'] { | ||
flex-grow: 1; | ||
display: flex; | ||
align-self: stretch; | ||
overflow-x: auto; | ||
-webkit-overflow-scrolling: touch; | ||
} | ||
/* This seems more future-proof than \`overflow: -moz-scrollbars-none\` which is marked obsolete | ||
and is no longer guaranteed to work: | ||
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#Mozilla_Extensions */ | ||
@-moz-document url-prefix() { | ||
:host([orientation='horizontal']) [part='tabs'] { | ||
overflow: hidden; | ||
} | ||
} | ||
:host([orientation='horizontal']) [part='tabs']::-webkit-scrollbar { | ||
display: none; | ||
} | ||
:host([orientation='vertical']) [part='tabs'] { | ||
height: 100%; | ||
overflow-y: auto; | ||
-webkit-overflow-scrolling: touch; | ||
} | ||
[part='back-button'], | ||
[part='forward-button'] { | ||
pointer-events: none; | ||
opacity: 0; | ||
cursor: default; | ||
} | ||
:host([overflow~='start']) [part='back-button'], | ||
:host([overflow~='end']) [part='forward-button'] { | ||
pointer-events: auto; | ||
opacity: 1; | ||
} | ||
[part='back-button']::after { | ||
content: '\\25C0'; | ||
} | ||
[part='forward-button']::after { | ||
content: '\\25B6'; | ||
} | ||
:host([orientation='vertical']) [part='back-button'], | ||
:host([orientation='vertical']) [part='forward-button'] { | ||
display: none; | ||
} | ||
/* RTL specific styles */ | ||
:host([dir='rtl']) [part='back-button']::after { | ||
content: '\\25B6'; | ||
} | ||
:host([dir='rtl']) [part='forward-button']::after { | ||
content: '\\25C0'; | ||
} | ||
`; |
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