You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/menu/style/index.less

462 lines
10 KiB

7 years ago
@import "../../style/themes/default";
@import "../../style/mixins/index";
@menu-prefix-cls: ~"@{ant-prefix}-menu";
7 years ago
7 years ago
// default theme
.@{menu-prefix-cls} {
.reset-component;
7 years ago
outline: none;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
7 years ago
box-shadow: @box-shadow-base;
7 years ago
color: @menu-item-color;
background: @menu-bg;
7 years ago
line-height: 0; // Fix display inline-block gap
transition: background .3s, width .2s;
.clearfix;
ul,
ol {
list-style: none;
margin: 0;
padding: 0;
}
7 years ago
&-hidden {
display: none;
}
7 years ago
&-item-group-title {
7 years ago
color: @menu-item-group-title-color;
7 years ago
font-size: @font-size-base;
line-height: @line-height-base;
padding: 8px 16px;
transition: all .3s;
7 years ago
}
7 years ago
&-submenu,
&-submenu-inline {
transition: border-color .3s @ease-in-out, background .3s @ease-in-out, padding .15s @ease-in-out;
7 years ago
}
7 years ago
&-item:active,
&-submenu-title:active {
7 years ago
background: @menu-item-active-bg;
7 years ago
}
7 years ago
&-submenu &-sub {
cursor: initial;
transition: background .3s @ease-in-out, padding .3s @ease-in-out;
}
&-item > a {
display: block;
7 years ago
color: @menu-item-color;
7 years ago
&:hover {
7 years ago
color: @menu-highlight-color;
7 years ago
}
&: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,
7 years ago
&-item-active,
7 years ago
&:not(&-inline) &-submenu-open,
&-submenu-active,
&-submenu-title:hover {
7 years ago
color: @menu-highlight-color;
7 years ago
}
&-horizontal &-item,
&-horizontal &-submenu {
margin-top: -1px;
}
&-horizontal > &-item:hover,
&-horizontal > &-item-active,
&-horizontal > &-submenu &-submenu-title:hover {
background-color: transparent;
7 years ago
}
&-item-selected {
7 years ago
color: @menu-highlight-color;
7 years ago
> a,
> a:hover {
7 years ago
color: @menu-highlight-color;
7 years ago
}
}
&:not(&-horizontal) &-item-selected {
7 years ago
background-color: @menu-item-active-bg;
7 years ago
}
7 years ago
&-inline,
&-vertical,
&-vertical-left {
border-right: @border-width-base @border-style-base @border-color-split;
}
&-vertical-right {
border-left: @border-width-base @border-style-base @border-color-split;
7 years ago
}
7 years ago
&-vertical&-sub,
&-vertical-left&-sub,
&-vertical-right&-sub {
border-right: 0;
7 years ago
padding: 0;
7 years ago
transform-origin: 0 0;
.@{menu-prefix-cls}-item {
border-right: 0;
margin-left: 0;
left: 0;
&:after {
border-right: 0;
}
}
> .@{menu-prefix-cls}-item,
> .@{menu-prefix-cls}-submenu {
transform-origin: 0 0;
}
7 years ago
}
&-horizontal&-sub,
&-vertical&-sub,
&-vertical-left&-sub,
&-vertical-right&-sub {
min-width: 160px;
}
7 years ago
&-item,
&-submenu-title {
cursor: pointer;
7 years ago
margin: 0;
7 years ago
padding: 0 20px;
7 years ago
position: relative;
display: block;
white-space: nowrap;
7 years ago
transition: color .3s @ease-in-out, border-color .3s @ease-in-out, background .3s @ease-in-out, padding .15s @ease-in-out;
.@{iconfont-css-prefix} {
min-width: 14px;
margin-right: 10px;
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;
}
7 years ago
}
}
7 years ago
7 years ago
& > &-item-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
padding: 0;
line-height: 0;
7 years ago
background-color: @border-color-split;
7 years ago
}
&-submenu {
&-popup {
position: absolute;
7 years ago
border-radius: @border-radius-base;
z-index: @zindex-dropdown;
7 years ago
}
7 years ago
> .@{menu-prefix-cls} {
7 years ago
background-color: @menu-bg;
7 years ago
border-radius: @border-radius-base;
&-submenu-title:after {
transition: transform .3s @ease-in-out;
}
}
&-vertical,
&-vertical-left,
&-vertical-right,
&-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;
&:before,
&:after {
content: '';
position: absolute;
vertical-align: baseline;
background: #fff;
7 years ago
background-image: linear-gradient(to right, @menu-item-color, @menu-item-color);
7 years ago
width: 6px;
height: 1.5px;
border-radius: 2px;
transition: background .3s @ease-in-out, transform .3s @ease-in-out, top .3s @ease-in-out;
}
&:before {
transform: rotate(45deg) translateY(-2px);
}
&:after {
transform: rotate(-45deg) translateY(2px);
}
}
> .@{menu-prefix-cls}-submenu-title:hover .@{menu-prefix-cls}-submenu-arrow {
&:after,
&:before {
7 years ago
background: linear-gradient(to right, @menu-highlight-color, @menu-highlight-color);
7 years ago
}
}
}
&-inline > .@{menu-prefix-cls}-submenu-title .@{menu-prefix-cls}-submenu-arrow {
&:before {
transform: rotate(-45deg) translateX(2px);
}
&:after {
transform: rotate(45deg) translateX(-2px);
}
}
&-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);
}
}
7 years ago
}
}
7 years ago
&-vertical &-submenu-selected,
&-vertical-left &-submenu-selected,
&-vertical-right &-submenu-selected {
7 years ago
color: @menu-highlight-color;
7 years ago
> a {
7 years ago
color: @menu-highlight-color;
7 years ago
}
}
&-horizontal {
7 years ago
border: 0;
border-bottom: @border-width-base @border-style-base @border-color-split;
7 years ago
box-shadow: none;
7 years ago
line-height: 46px;
7 years ago
7 years ago
> .@{menu-prefix-cls}-item,
> .@{menu-prefix-cls}-submenu {
position: relative;
top: 1px;
7 years ago
float: left;
border-bottom: 2px solid transparent;
7 years ago
&:hover,
&-active,
&-open,
&-selected {
7 years ago
border-bottom: 2px solid @menu-highlight-color;
color: @menu-highlight-color;
7 years ago
}
> a {
display: block;
7 years ago
color: @menu-item-color;
7 years ago
&:hover {
7 years ago
color: @menu-highlight-color;
7 years ago
}
7 years ago
}
}
&:after {
content: "\20";
display: block;
height: 0;
clear: both;
}
}
7 years ago
7 years ago
&-vertical,
&-vertical-left,
&-vertical-right,
&-inline {
7 years ago
.@{menu-prefix-cls}-item {
position: relative;
&:after {
content: "";
position: absolute;
right: 0;
top: 0;
bottom: 0;
7 years ago
border-right: 3px solid @menu-highlight-color;
7 years ago
transform: scaleY(.0001);
opacity: 0;
transition: transform .15s @ease-out, opacity .15s @ease-out;
7 years ago
}
}
7 years ago
.@{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;
overflow: hidden;
text-overflow: ellipsis;
7 years ago
}
7 years ago
// disable margin collapsed
.@{menu-prefix-cls}-submenu {
padding-bottom: 0.01px;
}
7 years ago
7 years ago
.@{menu-prefix-cls}-item:not(:last-child) {
margin-bottom: 8px;
7 years ago
}
7 years ago
> .@{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;
7 years ago
}
7 years ago
}
7 years ago
7 years ago
&-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);
}
7 years ago
}
7 years ago
.@{menu-prefix-cls}-item,
.@{menu-prefix-cls}-submenu-title {
width: ~"calc(100% + 1px)";
7 years ago
}
7 years ago
.@{menu-prefix-cls}-submenu-title {
padding-right: 34px;
}
7 years ago
}
7 years ago
7 years ago
&-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;
7 years ago
}
7 years ago
.@{iconfont-css-prefix} {
font-size: 16px;
line-height: @menu-item-height;
margin: 0;
+ span {
max-width: 0;
display: inline-block;
opacity: 0;
}
7 years ago
}
}
7 years ago
&-tooltip {
pointer-events: none;
.@{iconfont-css-prefix} {
display: none;
7 years ago
}
7 years ago
a {
color: @text-color-dark;
7 years ago
}
}
7 years ago
.@{menu-prefix-cls}-item-group-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-left: 4px;
padding-right: 4px;
7 years ago
}
7 years ago
}
7 years ago
7 years ago
&-item-group-list {
margin: 0;
padding: 0;
.@{menu-prefix-cls}-item,
.@{menu-prefix-cls}-submenu-title {
padding: 0 16px 0 28px;
7 years ago
}
7 years ago
}
7 years ago
7 years ago
&-root&-vertical,
&-root&-vertical-left,
&-root&-vertical-right,
&-root&-inline {
box-shadow: none;
}
7 years ago
7 years ago
&-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;
7 years ago
}
7 years ago
& .@{menu-prefix-cls}-item-group-title {
padding-left: 32px;
7 years ago
}
7 years ago
}
7 years ago
7 years ago
// 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;
7 years ago
}
}
}
7 years ago
@import './dark';