228 lines
6.5 KiB
CSS
228 lines
6.5 KiB
CSS
/*
|
|
Copyright 2019 Adobe. All rights reserved.
|
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software distributed under
|
|
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
governing permissions and limitations under the License.
|
|
*/
|
|
|
|
@import "../vars/css/components/spectrum-tabs.css";
|
|
@import "../vars/css/scales/spectrum-large.css";
|
|
@import "../vars/css/scales/spectrum-medium.css";
|
|
|
|
.spectrum-Tabs {
|
|
@remapvars {
|
|
find: --spectrum-tabs-m-;
|
|
replace: --spectrum-tabs-;
|
|
}
|
|
@remapvars {
|
|
find: --spectrum-tabs-quiet-m-;
|
|
replace: --spectrum-tabs-quiet-;
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs {
|
|
--spectrum-tabs-item-height: calc(var(--spectrum-tabs-height) - var(--spectrum-tabs-rule-size));
|
|
--spectrum-tabs-compact-item-height: calc(var(--spectrum-tabs-quiet-compact-height) - var(--spectrum-tabs-rule-size));
|
|
|
|
/* todo: remove when this is added back to DNA */
|
|
--spectrum-tabs-text-size: var(--spectrum-alias-font-size-default);
|
|
}
|
|
|
|
.spectrum-Tabs {
|
|
display: flex;
|
|
|
|
/* Contain the selection indicator */
|
|
position: relative;
|
|
z-index: 0;
|
|
|
|
margin: 0;
|
|
padding-block: 0;
|
|
padding-inline: var(--spectrum-tabs-focus-ring-padding-x);
|
|
|
|
/* Friends should align to the top of the tabs */
|
|
vertical-align: top;
|
|
}
|
|
|
|
.spectrum-Tabs-item {
|
|
/* Contain the focus ring */
|
|
position: relative;
|
|
|
|
box-sizing: border-box;
|
|
|
|
block-size: var(--spectrum-tabs-item-height);
|
|
line-height: var(--spectrum-tabs-item-height);
|
|
|
|
/* Float above the tab line */
|
|
z-index: 1;
|
|
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
|
|
transition: color var(--spectrum-global-animation-duration-100) ease-out;
|
|
cursor: pointer;
|
|
outline: none;
|
|
|
|
&.is-disabled {
|
|
cursor: default;
|
|
|
|
.spectrum-Tabs-itemLabel {
|
|
cursor: default;
|
|
}
|
|
}
|
|
|
|
.spectrum-Icon {
|
|
/* Vertical centering */
|
|
block-size: var(--spectrum-tabs-item-height);
|
|
|
|
& + .spectrum-Tabs-itemLabel {
|
|
/* icons are inexplicably offset by 3px. Subtract this value from the icon-gap
|
|
to correct the gap in CSS */
|
|
margin-inline-start: calc(var(--spectrum-tabs-icon-gap) - var(--spectrum-global-dimension-size-40));
|
|
}
|
|
}
|
|
|
|
&::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset-block-start: 50%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
block-size: var(--spectrum-tabs-focus-ring-height);
|
|
margin-block-start: calc(calc(var(--spectrum-tabs-focus-ring-height) / -2) + calc(var(--spectrum-tabs-rule-size) / 2));
|
|
inset-inline-start: calc(-1 * var(--spectrum-tabs-focus-ring-padding-x));
|
|
inset-inline-end: calc(-1 * var(--spectrum-tabs-focus-ring-padding-x));
|
|
border: var(--spectrum-tabs-focus-ring-size) solid transparent;
|
|
border-radius: var(--spectrum-tabs-focus-ring-border-radius);
|
|
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs-itemLabel {
|
|
cursor: pointer;
|
|
vertical-align: top;
|
|
display: inline-block;
|
|
|
|
font-size: var(--spectrum-tabs-text-size);
|
|
font-weight: var(--spectrum-tabs-text-font-weight);
|
|
|
|
/* support links */
|
|
text-decoration: none;
|
|
|
|
&:empty {
|
|
/* Hide the tab label if it's not being used */
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs-selectionIndicator {
|
|
position: absolute;
|
|
inset-inline-start: 0;
|
|
|
|
/* Be below the tab */
|
|
z-index: 0;
|
|
|
|
transition: transform var(--spectrum-tabs-selection-indicator-animation-duration) ease-in-out;
|
|
transform-origin: top left;
|
|
|
|
border-radius: var(--spectrum-tabs-rule-border-radius);
|
|
}
|
|
|
|
.spectrum-Tabs--compact {
|
|
.spectrum-Tabs-item {
|
|
block-size: var(--spectrum-tabs-compact-item-height);
|
|
line-height: var(--spectrum-tabs-compact-item-height);
|
|
|
|
.spectrum-Icon {
|
|
/* Vertical centering */
|
|
block-size: var(--spectrum-tabs-compact-item-height);
|
|
}
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs--horizontal {
|
|
align-items: center;
|
|
|
|
border-block-end: var(--spectrum-tabs-rule-size) solid;
|
|
|
|
.spectrum-Tabs-item {
|
|
vertical-align: top;
|
|
|
|
/* Target anything since React likes to add lots of happy <div>s around all things */
|
|
& + *:not(.spectrum-Tabs-selectionIndicator) {
|
|
margin-inline-start: var(--spectrum-tabs-item-gap);
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs-selectionIndicator {
|
|
position: absolute;
|
|
inset-block-end: 0;
|
|
block-size: var(--spectrum-tabs-rule-size);
|
|
|
|
inset-block-end: calc(-1 * var(--spectrum-tabs-rule-size));
|
|
}
|
|
|
|
|
|
&.spectrum-Tabs--compact {
|
|
/* The ActionButton is taller than the tabs, so don't push tabs around */
|
|
box-sizing: content-box;
|
|
block-size: var(--spectrum-tabs-compact-item-height);
|
|
align-items: end;
|
|
}
|
|
}
|
|
|
|
/* Quiet tabs should not extend all the way across the screen as their line doesn't */
|
|
.spectrum-Tabs--quiet {
|
|
display: inline-flex;
|
|
}
|
|
|
|
.spectrum-Tabs--vertical {
|
|
display: inline-flex;
|
|
flex-direction: column;
|
|
padding: 0;
|
|
border-inline-start: var(--spectrum-tabs-vertical-rule-size) solid;
|
|
|
|
.spectrum-Tabs-item {
|
|
block-size: var(--spectrum-tabs-vertical-item-height);
|
|
padding-block: 0;
|
|
padding-inline: var(--spectrum-tabs-focus-ring-padding-x);
|
|
/* Subtract focus ring padding from margin-left since the padding value already offsets tabs-items */
|
|
margin-inline-start: calc(var(--spectrum-tabs-vertical-item-margin-left) - var(--spectrum-tabs-focus-ring-padding-x));
|
|
margin-block-end: var(--spectrum-tabs-vertical-item-gap);
|
|
|
|
&::before {
|
|
/* padding is included in click area of tab items, so only need to offset by the size of the focus ring's border */
|
|
inset-inline-start: calc(-1 * var(--spectrum-tabs-focus-ring-size));
|
|
inset-inline-end: calc(-1 * var(--spectrum-tabs-focus-ring-size));
|
|
margin-block-start: calc(calc(var(--spectrum-tabs-focus-ring-height) / -2));
|
|
}
|
|
}
|
|
|
|
&.spectrum-Tabs--compact {
|
|
.spectrum-Tabs-item {
|
|
block-size: var(--spectrum-tabs-compact-vertical-item-height);
|
|
line-height: var(--spectrum-tabs-compact-vertical-item-height);
|
|
margin-block-end: var(--spectrum-tabs-compact-vertical-item-gap);
|
|
|
|
.spectrum-Icon {
|
|
/* Vertical centering */
|
|
block-size: var(--spectrum-tabs-compact-vertical-item-height);
|
|
}
|
|
}
|
|
}
|
|
|
|
.spectrum-Tabs-selectionIndicator {
|
|
position: absolute;
|
|
inset-inline-start: 0px;
|
|
inline-size: var(--spectrum-tabs-vertical-rule-size);
|
|
|
|
inset-inline-start: calc(-1 * var(--spectrum-tabs-vertical-rule-size));
|
|
}
|
|
}
|