amis2/scss/components/_tabs.scss

326 lines
7.6 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Tabs {
2019-12-06 09:58:08 +08:00
&-links {
margin: 0;
padding: 0;
border-bottom: var(--Tabs-borderWidth) solid var(--Tabs-borderColor);
2019-12-06 09:58:08 +08:00
list-style: none;
2020-05-11 14:16:54 +08:00
user-select: none;
2019-12-06 09:58:08 +08:00
2020-07-28 13:14:33 +08:00
@include clearfix();
2019-12-06 09:58:08 +08:00
> .#{$ns}Tabs-link {
margin-bottom: calc(var(--Tabs-borderWidth) * -1);
2019-12-06 09:58:08 +08:00
display: inline-block;
position: relative;
> a:first-child {
font-size: var(--Tabs-linkFontSize);
2019-12-06 09:58:08 +08:00
outline: none;
border: var(--Tabs-borderWidth) solid transparent;
border-top-left-radius: var(--Tabs-borderRadius);
border-top-right-radius: var(--Tabs-borderRadius);
color: var(--Tabs-color);
margin: var(--Tabs-linkMargin);
padding: var(--Tabs-linkPadding);
2019-12-06 09:58:08 +08:00
text-decoration: none;
cursor: pointer;
display: block;
}
> .#{$ns}Combo-toolbarBtn {
position: absolute;
right: -10px;
top: -10px;
z-index: 10;
display: none;
}
&:hover > .#{$ns}Combo-toolbarBtn {
display: block;
}
&:hover > a:first-child,
> a:first-child:focus {
border-color: var(--Tabs-onHover-borderColor);
2019-12-06 09:58:08 +08:00
text-decoration: none;
}
2020-05-12 20:03:23 +08:00
&.disabled,
&.is-disabled {
cursor: not-allowed;
> a:first-child {
color: var(--Tabs-onDisabled-color);
background: transparent;
2020-05-12 20:03:23 +08:00
border-color: transparent;
pointer-events: none;
}
2019-12-06 09:58:08 +08:00
}
&.active > a:first-child,
&.is-active > a:first-child {
color: var(--Tabs-onActive-color);
background: var(--Tabs-onActive-bg);
border-color: var(--Tabs-onActive-borderColor);
2019-12-06 09:58:08 +08:00
border-bottom-color: transparent;
}
}
}
&-content {
background: var(--Tabs-content-bg);
2019-12-06 09:58:08 +08:00
border-style: solid;
border-width: 0 var(--Tabs-borderWidth) var(--Tabs-borderWidth);
border-color: var(--Tabs-borderColor);
2019-12-06 09:58:08 +08:00
}
&-pane {
display: none;
padding: var(--gap-base);
2019-12-06 09:58:08 +08:00
opacity: 0;
transition: opacity var(--animation-duration) linear;
2019-12-06 09:58:08 +08:00
&.is-active {
display: block;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&.in {
opacity: 1;
2019-08-13 11:12:42 +08:00
}
2019-12-06 09:58:08 +08:00
}
&--line {
> .#{$ns}Tabs-links {
border-bottom-color: var(--Tabs--line-borderColor);
2019-12-06 09:58:08 +08:00
> li {
> a:first-child {
border-width: 0 0 var(--Tabs--line-borderWidth) 0;
padding: var(--Tabs--line-linkPadding);
margin: var(--Tabs--line-linkMargin);
2019-12-06 09:58:08 +08:00
&:hover,
&:focus {
color: #666;
background: transparent;
2019-12-06 09:58:08 +08:00
border-color: transparent;
}
}
2019-08-07 15:36:05 +08:00
2019-12-06 09:58:08 +08:00
&:last-child {
> a {
margin: 0;
}
}
2019-09-09 00:53:39 +08:00
2019-08-13 11:12:42 +08:00
&.is-active {
2019-12-06 09:58:08 +08:00
> a:first-child,
> a:first-child:hover,
> a:first-child:focus {
border-color: var(--Tabs--line-onHover-borderColor);
color: var(--Tabs--line-onHover-color);
background: transparent;
2019-12-06 09:58:08 +08:00
}
2019-08-07 15:36:05 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
2019-09-09 00:53:39 +08:00
2019-12-06 09:58:08 +08:00
> .#{$ns}Tabs-content {
border-width: 0;
padding: var(--Tabs--line-content-padding);
background: var(--Tabs--line-content-bg);
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&--card {
> .#{$ns}Tabs-links {
padding: var(--Tabs--card-padding);
background: var(--Tabs--card-bg);
border-top: px2rem(1px) solid var(--Tabs--card-borderTopColor);
2019-09-25 17:06:08 +08:00
2019-12-06 09:58:08 +08:00
> li {
&.is-active {
> a:first-child,
> a:first-child:hover,
> a:first-child:focus {
border-color: var(--Tabs--card-onActive-borderColor);
color: var(--primary);
border-bottom-color: var(--Tabs--card-onActive-bg);
background: var(--Tabs--card-onActive-bg);
2019-12-06 09:58:08 +08:00
}
2019-09-25 17:06:08 +08:00
}
2019-12-06 09:58:08 +08:00
> a:first-child {
padding: var(--Tabs--card-linkPadding);
margin: var(--Tabs--card-linkMargin);
2019-09-25 17:06:08 +08:00
2019-12-06 09:58:08 +08:00
&:hover,
&:focus {
color: #666;
background: var(--Tabs--card-onActive-bg);
2019-12-06 09:58:08 +08:00
border-bottom-color: transparent;
}
2019-09-25 17:06:08 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
> .#{$ns}Tabs-content {
border-width: 0;
}
}
&--radio {
> .#{$ns}Tabs-links {
border: 0;
margin-bottom: px2rem(10px);
> li {
margin: 0;
> a:first-child {
border-width: px2rem(1px);
border-color: var(--Tabs-borderColor);
font-size: var(--fontSizeSm);
2019-12-06 09:58:08 +08:00
text-align: center;
margin: 0;
padding: 0 px2rem(10px);
min-width: 68px;
height: px2rem(30px);
line-height: px2rem(30px);
border-radius: 0;
background: var(--Tabs--radio-bg);
2019-12-06 09:58:08 +08:00
&:hover,
&:focus {
color: var(--primary);
2019-12-06 09:58:08 +08:00
}
2019-10-29 12:37:20 +08:00
}
2019-12-06 09:58:08 +08:00
&.is-active {
> a:first-child,
> a:first-child:hover,
> a:first-child:focus {
color: var(--Tabs--radio-bg);
background: var(--primary);
border-color: var(--primary);
2019-12-06 09:58:08 +08:00
position: relative;
z-index: 1;
}
2019-10-29 12:37:20 +08:00
}
2019-12-06 09:58:08 +08:00
}
> li + li {
margin-left: -1px;
}
2019-10-29 12:37:20 +08:00
}
2019-12-06 09:58:08 +08:00
> .#{$ns}Tabs-content {
border-top: var(--Tabs-borderWidth) solid var(--Tabs-borderColor);
2019-12-06 09:58:08 +08:00
}
}
2020-12-17 12:27:21 +08:00
// todo 第一个选中,有一像素的空隙待修复。
// 不带眼镜应该看不出来。
&--tiled {
> .#{$ns}Tabs-links {
width: 100%;
display: flex;
flex-direction: row;
padding-left: var(--Tabs-borderWidth);
2020-12-17 12:27:21 +08:00
border-bottom: 0;
> li {
flex-grow: 1;
text-align: center;
margin: 0 0 0 calc(var(--Tabs-borderWidth) * -1);
2020-12-17 12:27:21 +08:00
> a:first-child {
margin: 0;
border-radius: 0;
border-style: solid;
border-color: var(--Tabs-borderColor);
border-width: var(--Tabs-borderWidth);
2020-12-17 12:27:21 +08:00
&:hover,
&:focus {
position: relative;
z-index: 1;
border-color: var(--Tabs-onActive-borderColor);
color: var(--primary);
2020-12-17 12:27:21 +08:00
}
}
&.is-active {
> a:first-child,
> a:first-child:hover,
> a:first-child:focus {
cursor: default;
color: var(--primary);
border-color: var(--Tabs-borderColor);
border-top-color: var(--primary);
2020-12-17 12:27:21 +08:00
border-bottom-color: transparent;
}
}
}
}
}
2019-12-06 09:58:08 +08:00
&--vertical {
display: flex;
min-height: px2rem(200px);
border: var(--Tabs-borderWidth) solid var(--Tabs-borderColor);
2019-12-06 09:58:08 +08:00
border-radius: 0;
> .#{$ns}Tabs-links {
width: var(--Tabs--vertical-width);
background: var(--Tabs--vertical-onActive-container-bg);
2019-12-06 09:58:08 +08:00
border: none;
border-right: var(--Tabs--vertical-onActive-container-borderRight);
2019-12-06 09:58:08 +08:00
padding-bottom: px2rem(60px);
> li {
margin: 0 0 0 -1px;
display: block;
> a:first-child {
border-color: transparent;
border-radius: 0;
border-width: var(--Tabs--vertical-onActive-borderWidth);
2019-12-06 09:58:08 +08:00
margin: 0;
&:hover,
&:focus {
color: var(--primary);
2019-12-06 09:58:08 +08:00
border-color: transparent;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&.is-active {
> a:first-child,
> a:first-child:hover,
> a:first-child:focus {
color: var(--Tabs--vertical-onActive-color);
background: var(--Tabs--vertical-onActive-bg);
border-color: var(--Tabs--vertical-onActive-border);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
> .#{$ns}Tabs-content {
border: none;
flex-grow: 1;
2020-10-13 11:28:31 +08:00
> .#{$ns}Tabs-pane {
height: 100%;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2020-01-13 20:27:38 +08:00
&-toolbar {
2020-05-11 14:16:54 +08:00
display: inline-block;
float: right;
padding-top: var(--gap-xs);
2020-01-13 20:27:38 +08:00
}
2019-12-06 09:58:08 +08:00
}