mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
585 lines
12 KiB
Plaintext
585 lines
12 KiB
Plaintext
@import "../../style/themes/default";
|
|
@import "../../style/mixins/index";
|
|
|
|
@menu-prefix-cls: ~"@{ant-prefix}-menu";
|
|
@menu-inline-toplevel-item-height: 40px;
|
|
@menu-item-height: 40px;
|
|
|
|
// default theme
|
|
.@{menu-prefix-cls} {
|
|
.reset-component;
|
|
outline: none;
|
|
margin-bottom: 0;
|
|
padding-left: 0; // Override default ul/ol
|
|
list-style: none;
|
|
z-index: @zindex-dropdown;
|
|
box-shadow: @box-shadow-base;
|
|
background: @component-background;
|
|
line-height: 0; // Fix display inline-block gap
|
|
transition: background .3s, width .2s;
|
|
.clearfix;
|
|
|
|
ul,
|
|
ol {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
&-hidden {
|
|
display: none;
|
|
}
|
|
|
|
&-item-group-list {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
&-item-group-title {
|
|
color: @text-color-secondary;
|
|
font-size: @font-size-base;
|
|
line-height: @line-height-base;
|
|
padding: 8px 16px;
|
|
transition: all .3s;
|
|
}
|
|
|
|
&-item,
|
|
&-submenu,
|
|
&-submenu-title {
|
|
cursor: pointer;
|
|
}
|
|
&-submenu, &-submenu-inline {
|
|
transition: border-color .3s @ease-in-out, background .3s @ease-in-out, padding .15s @ease-in-out;
|
|
}
|
|
&-item, &-submenu-title {
|
|
transition: color .3s @ease-in-out, border-color .3s @ease-in-out, background .3s @ease-in-out, padding .15s @ease-in-out;
|
|
}
|
|
|
|
&-item:active,
|
|
&-submenu-title:active {
|
|
background: @item-active-bg;
|
|
}
|
|
|
|
&-submenu &-sub {
|
|
cursor: initial;
|
|
transition: background .3s @ease-in-out, padding .3s @ease-in-out;
|
|
}
|
|
|
|
&-item > a {
|
|
display: block;
|
|
color: @text-color;
|
|
&:hover {
|
|
color: @primary-color;
|
|
}
|
|
&:focus {
|
|
text-decoration: none;
|
|
}
|
|
&:before {
|
|
position: absolute;
|
|
background-color: transparent;
|
|
width: 100%;
|
|
height: 100%;
|
|
top: 0;
|
|
left: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
content: '';
|
|
}
|
|
}
|
|
|
|
&-item-divider {
|
|
height: 1px;
|
|
overflow: hidden;
|
|
background-color: @border-color-split;
|
|
line-height: 0;
|
|
}
|
|
|
|
&-item:hover,
|
|
&-item-active,
|
|
&:not(&-inline) &-submenu-open,
|
|
&-submenu-active,
|
|
&-submenu-title:hover {
|
|
color: @primary-color;
|
|
}
|
|
|
|
&:not(&-inline) &-submenu-open {
|
|
z-index: @zindex-dropdown;
|
|
}
|
|
|
|
&-horizontal &-item,
|
|
&-horizontal &-submenu {
|
|
margin-top: -1px;
|
|
}
|
|
|
|
&-horizontal > &-item:hover,
|
|
&-horizontal > &-item-active,
|
|
&-horizontal > &-submenu &-submenu-title:hover {
|
|
background-color: transparent;
|
|
}
|
|
|
|
&-item-selected {
|
|
color: @primary-color;
|
|
> a,
|
|
> a:hover {
|
|
color: @primary-color;
|
|
}
|
|
}
|
|
|
|
&:not(&-horizontal) &-item-selected {
|
|
background-color: @item-active-bg;
|
|
}
|
|
|
|
&-horizontal,
|
|
&-inline,
|
|
&-vertical {
|
|
z-index: auto;
|
|
}
|
|
|
|
&-inline,
|
|
&-vertical {
|
|
border-right: @border-width-base @border-style-base @border-color-split;
|
|
.@{menu-prefix-cls}-item {
|
|
position: relative;
|
|
z-index: 1;
|
|
&:after {
|
|
content: "";
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
border-right: 3px solid @primary-color;
|
|
transform: scaleY(.0001);
|
|
opacity: 0;
|
|
transition: transform .15s @ease-out, opacity .15s @ease-out;
|
|
}
|
|
}
|
|
}
|
|
|
|
&-vertical&-sub {
|
|
border-right: 0;
|
|
.@{menu-prefix-cls}-item {
|
|
border-right: 0;
|
|
margin-left: 0;
|
|
left: 0;
|
|
&:after {
|
|
border-right: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
&-submenu-horizontal > & {
|
|
top: 100%;
|
|
left: 0;
|
|
position: absolute;
|
|
min-width: 100%;
|
|
margin-top: 7px;
|
|
z-index: @zindex-dropdown;
|
|
}
|
|
|
|
&-submenu-vertical {
|
|
z-index: 1;
|
|
}
|
|
|
|
&-submenu-vertical > & {
|
|
top: 0;
|
|
left: 100%;
|
|
position: absolute;
|
|
min-width: 160px;
|
|
margin-left: 4px;
|
|
z-index: @zindex-dropdown;
|
|
}
|
|
|
|
&-item,
|
|
&-submenu-title {
|
|
margin: 0;
|
|
padding: 0 20px;
|
|
position: relative;
|
|
display: block;
|
|
white-space: nowrap;
|
|
.@{iconfont-css-prefix} {
|
|
min-width: 14px;
|
|
margin-right: 8px;
|
|
transition: font-size .15s @ease-out, margin .3s @ease-in-out;
|
|
+ span {
|
|
transition: opacity .3s @ease-in-out, width .3s @ease-in-out;
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
& > &-item-divider {
|
|
height: 1px;
|
|
margin: 1px 0;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
line-height: 0;
|
|
background-color: @border-color-split;
|
|
}
|
|
|
|
&-submenu {
|
|
position: relative;
|
|
|
|
> .@{menu-prefix-cls} {
|
|
background-color: @component-background;
|
|
border-radius: @border-radius-base;
|
|
&-submenu-title:after {
|
|
transition: transform .3s @ease-in-out;
|
|
}
|
|
}
|
|
|
|
&-vertical > .@{menu-prefix-cls}-submenu-title,
|
|
&-inline > .@{menu-prefix-cls}-submenu-title {
|
|
.@{menu-prefix-cls}-submenu-arrow {
|
|
transition: transform .3s @ease-in-out;
|
|
position: absolute;
|
|
top: 50%;
|
|
right: 16px;
|
|
width: 10px;
|
|
|
|
&:after,
|
|
&:before {
|
|
content: '';
|
|
position: absolute;
|
|
vertical-align: baseline;
|
|
background: #fff;
|
|
background-image: linear-gradient(to right, @text-color, @text-color);
|
|
width: 6px;
|
|
height: 1.5px;
|
|
border-radius: 2px;
|
|
transition: background .3s @ease-in-out, transform .3s @ease-in-out, top .3s @ease-in-out;
|
|
}
|
|
}
|
|
}
|
|
|
|
&-vertical > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow:before {
|
|
transform: rotate(-45deg) translateY(2px);
|
|
}
|
|
&-vertical > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow:after {
|
|
transform: rotate(45deg) translateY(-2px);
|
|
}
|
|
|
|
&-inline > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow:after {
|
|
transform: rotate(45deg) translateX(-2px);
|
|
}
|
|
&-inline > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow:before {
|
|
transform: rotate(-45deg) translateX(2px);
|
|
}
|
|
|
|
&-vertical > .@{menu-prefix-cls}-submenu-title:hover,
|
|
&-inline > .@{menu-prefix-cls}-submenu-title:hover {
|
|
.@{menu-prefix-cls}-submenu-arrow {
|
|
&:after,
|
|
&:before {
|
|
background: linear-gradient(to right, @primary-color, @primary-color);
|
|
}
|
|
}
|
|
}
|
|
|
|
&-open {
|
|
&.@{menu-prefix-cls}-submenu-inline > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow {
|
|
transform: translateY(-2px);
|
|
&:after {
|
|
transform: rotate(-45deg) translateX(-2px);
|
|
}
|
|
&:before {
|
|
transform: rotate(45deg) translateX(2px);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&-vertical &-submenu-selected {
|
|
color: @primary-color;
|
|
> a {
|
|
color: @primary-color;
|
|
}
|
|
}
|
|
|
|
&-horizontal {
|
|
border: 0;
|
|
border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
box-shadow: none;
|
|
z-index: 0;
|
|
line-height: 46px;
|
|
|
|
> .@{menu-prefix-cls}-item,
|
|
> .@{menu-prefix-cls}-submenu {
|
|
position: relative;
|
|
top: 1px;
|
|
float: left;
|
|
border-bottom: 2px solid transparent;
|
|
|
|
&:hover,
|
|
&-active,
|
|
&-open,
|
|
&-selected {
|
|
border-bottom: 2px solid @primary-color;
|
|
color: @primary-color;
|
|
}
|
|
|
|
> a {
|
|
display: block;
|
|
color: @text-color;
|
|
&:hover {
|
|
color: @primary-color;
|
|
}
|
|
}
|
|
}
|
|
|
|
&:after {
|
|
content: "\20";
|
|
display: block;
|
|
height: 0;
|
|
clear: both;
|
|
}
|
|
}
|
|
|
|
&-vertical,
|
|
&-inline {
|
|
.@{menu-prefix-cls}-item,
|
|
.@{menu-prefix-cls}-submenu-title {
|
|
padding: 0 16px;
|
|
font-size: @font-size-base;
|
|
line-height: @menu-item-height;
|
|
height: @menu-item-height;
|
|
margin-top: 4px;
|
|
margin-bottom: 4px;
|
|
display: inline-block;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
> .@{menu-prefix-cls}-item,
|
|
> .@{menu-prefix-cls}-submenu > .@{menu-prefix-cls}-submenu-title {
|
|
line-height: @menu-inline-toplevel-item-height;
|
|
height: @menu-inline-toplevel-item-height;
|
|
}
|
|
}
|
|
|
|
&-inline {
|
|
width: 100%;
|
|
.@{menu-prefix-cls}-selected,
|
|
.@{menu-prefix-cls}-item-selected {
|
|
&:after {
|
|
transition: transform .15s @ease-in-out, opacity .15s @ease-in-out;
|
|
opacity: 1;
|
|
transform: scaleY(1);
|
|
}
|
|
}
|
|
|
|
.@{menu-prefix-cls}-item,
|
|
.@{menu-prefix-cls}-submenu-title {
|
|
width: ~"calc(100% + 1px)";
|
|
}
|
|
}
|
|
|
|
&-inline-collapsed {
|
|
width: @menu-collapsed-width;
|
|
|
|
> .@{menu-prefix-cls}-item,
|
|
> .@{menu-prefix-cls}-item-group > .@{menu-prefix-cls}-item-group-list > .@{menu-prefix-cls}-item,
|
|
> .@{menu-prefix-cls}-submenu > .@{menu-prefix-cls}-submenu-title {
|
|
left: 0;
|
|
text-overflow: clip;
|
|
padding: 0 (@menu-collapsed-width - 16px) / 2 !important;
|
|
.@{menu-prefix-cls}-submenu-arrow {
|
|
display: none;
|
|
}
|
|
.@{iconfont-css-prefix} {
|
|
font-size: 16px;
|
|
line-height: @menu-item-height;
|
|
margin: 0;
|
|
+ span {
|
|
max-width: 0;
|
|
display: inline-block;
|
|
opacity: 0;
|
|
}
|
|
}
|
|
}
|
|
&-tooltip {
|
|
pointer-events: none;
|
|
.@{iconfont-css-prefix} {
|
|
display: none;
|
|
}
|
|
a {
|
|
color: @text-color-dark;
|
|
}
|
|
}
|
|
|
|
.@{menu-prefix-cls}-item-group-title {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
padding-left: 4px;
|
|
padding-right: 4px;
|
|
}
|
|
}
|
|
|
|
&-item-group-list {
|
|
.@{menu-prefix-cls}-item,
|
|
.@{menu-prefix-cls}-submenu-title {
|
|
padding: 0 16px 0 28px;
|
|
}
|
|
}
|
|
|
|
&-vertical&-sub {
|
|
padding: 0;
|
|
transform-origin: 0 0;
|
|
& > .@{menu-prefix-cls}-item,
|
|
& > .@{menu-prefix-cls}-submenu {
|
|
transform-origin: 0 0;
|
|
}
|
|
}
|
|
|
|
&-root&-vertical,
|
|
&-root&-inline {
|
|
box-shadow: none;
|
|
}
|
|
|
|
&-sub&-inline {
|
|
padding: 0;
|
|
border: 0;
|
|
box-shadow: none;
|
|
border-radius: 0;
|
|
& > .@{menu-prefix-cls}-item,
|
|
& > .@{menu-prefix-cls}-submenu > .@{menu-prefix-cls}-submenu-title {
|
|
line-height: @menu-item-height;
|
|
height: @menu-item-height;
|
|
list-style-type: disc;
|
|
list-style-position: inside;
|
|
}
|
|
|
|
& .@{menu-prefix-cls}-item-group-title {
|
|
padding-left: 32px;
|
|
}
|
|
}
|
|
|
|
// Disabled state sets text to gray and nukes hover/tab effects
|
|
&-item-disabled,
|
|
&-submenu-disabled {
|
|
color: @disabled-color !important;
|
|
cursor: not-allowed;
|
|
background: none;
|
|
border-color: transparent !important;
|
|
> a {
|
|
color: @disabled-color !important;
|
|
pointer-events: none;
|
|
}
|
|
> .@{menu-prefix-cls}-submenu-title {
|
|
color: @disabled-color !important;
|
|
cursor: not-allowed;
|
|
}
|
|
}
|
|
}
|
|
|
|
// dark theme
|
|
.@{menu-prefix-cls} {
|
|
&-dark,
|
|
&-dark &-sub {
|
|
color: @text-color-secondary-dark;
|
|
background: @menu-dark-bg;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, .45) inset;
|
|
.@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow {
|
|
opacity: .45;
|
|
transition: all .3s;
|
|
&:after,
|
|
&:before {
|
|
background: #fff;
|
|
}
|
|
}
|
|
}
|
|
|
|
&-dark &-inline&-sub {
|
|
background: @menu-dark-submenu-bg;
|
|
}
|
|
|
|
&-dark&-horizontal {
|
|
border-bottom-color: @menu-dark-bg;
|
|
}
|
|
|
|
&-dark&-horizontal > &-item,
|
|
&-dark&-horizontal > &-submenu {
|
|
border-color: @menu-dark-bg;
|
|
border-bottom: 0;
|
|
}
|
|
|
|
&-dark &-item,
|
|
&-dark &-item-group-title,
|
|
&-dark &-item > a {
|
|
color: @text-color-secondary-dark;
|
|
}
|
|
|
|
&-dark&-inline,
|
|
&-dark&-vertical {
|
|
border-right: 0;
|
|
}
|
|
|
|
&-dark&-inline &-item,
|
|
&-dark&-vertical &-item {
|
|
border-right: 0;
|
|
margin-left: 0;
|
|
left: 0;
|
|
&:after {
|
|
border-right: 0;
|
|
}
|
|
}
|
|
|
|
&-dark&-inline &-item,
|
|
&-dark&-inline &-submenu-title {
|
|
width: 100%;
|
|
}
|
|
|
|
&-dark &-item:hover,
|
|
&-dark &-item-active,
|
|
&-dark &-submenu-active,
|
|
&-dark &-submenu-open,
|
|
&-dark &-submenu-selected,
|
|
&-dark &-submenu-title:hover {
|
|
background-color: transparent;
|
|
color: #fff;
|
|
> a {
|
|
color: #fff;
|
|
}
|
|
> .@{menu-prefix-cls}-submenu-title,
|
|
> .@{menu-prefix-cls}-submenu-title:hover {
|
|
> .@{menu-prefix-cls}-submenu-arrow {
|
|
opacity: 1;
|
|
&:after,
|
|
&:before {
|
|
background: #fff;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&-dark &-item-selected {
|
|
border-right: 0;
|
|
color: #fff;
|
|
&:after {
|
|
border-right: 0;
|
|
}
|
|
> a,
|
|
> a:hover {
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
&&-dark &-item-selected {
|
|
background-color: @primary-color;
|
|
}
|
|
|
|
// Disabled state sets text to dark gray and nukes hover/tab effects
|
|
&-dark &-item-disabled,
|
|
&-dark &-submenu-disabled {
|
|
&,
|
|
> a {
|
|
opacity: 0.8;
|
|
color: @disabled-color-dark !important;
|
|
}
|
|
> .@{menu-prefix-cls}-submenu-title {
|
|
color: @disabled-color-dark !important;
|
|
}
|
|
}
|
|
}
|