-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(go-tabs, go-tablist): separate tablist logic into go-tablist
separate tablist logic into go-tablist - go-tabs, go-tablist: add `fill` prop - go-tabs, go-tablist: change `manual` to `auto` - go-tablist with `icon` and `icon-active` slots
- Loading branch information
1 parent
8f4d80c
commit 913d42e
Showing
22 changed files
with
1,664 additions
and
1,996 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,4 +4,8 @@ go-tab { | |
&.active { | ||
display: block; | ||
} | ||
|
||
&:focus-visible { | ||
outline-offset: 0.5rem; | ||
} | ||
} |
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,205 @@ | ||
go-tablist { | ||
/** | ||
@prop --tab-padding: | ||
Padding for tabs | ||
- default: 0.75rem 1.25rem | ||
*/ | ||
--tab-padding: 0.5rem 1rem; | ||
/** | ||
@prop --tab-bg-color: | ||
Background color for tabs | ||
- default: transparent | ||
*/ | ||
--tab-bg-color: transparent; | ||
/** | ||
@prop --tab-hover-bg-color: | ||
Background color for tabs on hover | ||
- default: var(--go-color-neutral-200) | ||
*/ | ||
--tab-hover-bg-color: var(--go-color-neutral-200); | ||
|
||
/** | ||
@prop --tab-text-color: | ||
Text color for tabs | ||
- default: var(--go-color-neutral-800) | ||
*/ | ||
--tab-text-color: var(--go-color-neutral-800); | ||
|
||
/** | ||
@prop --tab-hover-text-color: | ||
Text color for tabs on hover | ||
- default: var(--go-color-neutral-900) | ||
*/ | ||
--tab-hover-text-color: var(--go-color-neutral-900); | ||
|
||
/** | ||
@prop --tab-focus-color: | ||
Focus outline color for tabs | ||
- default: var(--go-color-primary-600) | ||
*/ | ||
--tab-focus-color: var(--go-color-primary-600); | ||
/** | ||
@prop --tab-active-color: | ||
Text color for active tab | ||
- default: var(--go-color-primary-800) | ||
*/ | ||
--tab-active-color: var(--go-color-primary-600); | ||
/** | ||
@prop --tab-active-bg-color: | ||
Background color for active tab | ||
- default: transparent | ||
*/ | ||
--tab-active-bg-color: transparent; | ||
/** | ||
@prop --tab-border-width: | ||
Border width for tabs | ||
- default: 0.2em | ||
*/ | ||
--tab-border-width: 0.2em; | ||
/** | ||
@prop --tab-active-indicator-color: | ||
Color of the active tab indicator | ||
- default: var(--tab-active-color) | ||
*/ | ||
--tab-active-indicator-color: var(--tab-active-color); | ||
/** | ||
@prop --tabs-active-indicator-width: | ||
Width of the active tab indicator | ||
- default: 0 | ||
*/ | ||
--tabs-active-indicator-width: 0; | ||
|
||
/** | ||
@prop --tabs-active-indicator-height: | ||
Height of the active tab indicator | ||
- default: 0.2em | ||
*/ | ||
--tabs-active-indicator-height: 0.2em; | ||
/** | ||
@prop --tabs-active-indicator-color: | ||
Color of the active tab indicator | ||
- default: var(--tab-active-color) | ||
*/ | ||
--tabs-active-indicator-color: var(--tab-active-color); | ||
|
||
/** | ||
@prop --tab-icon-gap: | ||
Gap between tab icons | ||
- default: 0.5rem | ||
*/ | ||
--tab-icon-gap: 0.5rem; | ||
|
||
[role='tablist'] { | ||
overflow: auto; | ||
display: flex; | ||
flex-wrap: nowrap; | ||
width: 100%; | ||
position: relative; | ||
} | ||
[role='tab'] { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: var(--tab-icon-gap); | ||
@include tablet() { | ||
flex-direction: row; | ||
} | ||
|
||
padding: var(--tab-padding); | ||
border: var(--tab-border-width) solid transparent; | ||
white-space: nowrap; | ||
background: var(--tab-bg-color); | ||
color: var(--tab-text-color); | ||
font-weight: 500; | ||
@include transition(background-color, color); | ||
.go-tab-icon-slot { | ||
svg, | ||
img { | ||
display: block; | ||
} | ||
} | ||
.go-tab-icon-active { | ||
display: none; | ||
} | ||
&:hover, | ||
&:focus { | ||
color: var(--tab-hover-text-color); | ||
background: var(--tab-hover-bg-color); | ||
} | ||
&:not(.active) { | ||
cursor: pointer; | ||
} | ||
&[aria-selected='true'] { | ||
background: var(--tab-active-bg-color); | ||
color: var(--tab-active-color); | ||
text-decoration: none; | ||
&.has-active-icon { | ||
.go-tab-icon { | ||
display: none; | ||
} | ||
} | ||
.go-tab-icon-active { | ||
display: block; | ||
} | ||
} | ||
} | ||
|
||
.tabs-active-indicator-track { | ||
position: absolute; | ||
width: 100%; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
.tabs-active-indicator { | ||
@include transition(transform, width, height); | ||
|
||
transform: translateX(var(--tabs-active-indicator-left)); | ||
width: var(--tabs-active-indicator-width); | ||
height: var(--tabs-active-indicator-height); | ||
border-radius: var(--radius-round); | ||
background: var(--tabs-active-indicator-color); | ||
} | ||
} | ||
&.vertical { | ||
flex-direction: row; | ||
[role='tablist'] { | ||
flex-direction: column; | ||
.tabs-active-indicator-track { | ||
width: auto; | ||
top: 0; | ||
left: auto; | ||
.tabs-active-indicator { | ||
--tabs-active-indicator-width: 4px; | ||
|
||
transform: translateY(var(--tabs-active-indicator-top)); | ||
} | ||
} | ||
} | ||
[role='tab'] { | ||
text-align: start; | ||
white-space: normal; | ||
&:focus-visible { | ||
border-top-color: transparent; | ||
border-left-color: var(--tab-focus-color); | ||
} | ||
} | ||
} | ||
|
||
&.fill { | ||
[role='tablist'] { | ||
width: 100%; | ||
} | ||
[role='tab'] { | ||
flex: 1; | ||
} | ||
} | ||
} | ||
|
||
@include theme-dark() { | ||
go-tablist { | ||
--tab-text-color: var(--go-color-neutral-700); | ||
--tab-hover-text-color: var(--go-color-neutral-900); | ||
--tab-active-color: var(--go-color-primary-800); | ||
} | ||
} |
Oops, something went wrong.