ant-design/components/menu/style/index.less

571 lines
12 KiB
Plaintext
Raw Normal View History

@import "../../style/themes/default";
@import "../../style/mixins/index";
@menu-prefix-cls: ~"@{ant-prefix}-menu";
2015-08-06 16:49:54 +08:00
2015-11-12 14:57:54 +08:00
// default theme
2015-08-20 16:55:42 +08:00
.@{menu-prefix-cls} {
.reset-component;
2015-08-06 16:49:54 +08:00
outline: none;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
2016-03-28 16:01:37 +08:00
z-index: @zindex-dropdown;
2015-12-02 11:53:37 +08:00
box-shadow: @box-shadow-base;
background: @component-background;
2015-11-14 20:41:10 +08:00
line-height: 46px;
2017-09-06 13:46:45 +08:00
transition: background .3s, width .2s;
2015-08-06 16:49:54 +08:00
ul,
ol {
list-style: none;
margin: 0;
padding: 0;
}
2015-11-04 23:14:49 +08:00
&-hidden {
display: none;
}
2015-08-06 16:49:54 +08:00
&-item-group-list {
margin: 0;
padding: 0;
}
&-item-group-title {
color: @text-color-secondary;
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
line-height: @line-height-base;
2015-12-11 16:55:30 +08:00
padding: 8px 16px;
transition: all .3s;
2015-08-06 16:49:54 +08:00
}
2015-11-14 16:37:42 +08:00
&-item,
2016-03-22 20:43:57 +08:00
&-submenu,
2015-11-14 16:37:42 +08:00
&-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;
}
2016-03-22 20:43:57 +08:00
&-submenu &-sub {
cursor: initial;
transition: background .3s @ease-in-out, padding .3s @ease-in-out;
2016-03-22 20:43:57 +08:00
}
2016-01-14 11:54:46 +08:00
&-item > a {
display: block;
color: @text-color;
&:hover {
2016-12-05 16:15:22 +08:00
color: @primary-color;
2016-01-14 11:54:46 +08:00
}
&:focus {
text-decoration: none;
}
2016-06-25 15:09:23 +08:00
&:before {
position: absolute;
background-color: transparent;
width: 100%;
height: 100%;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: '';
}
2016-01-14 11:54:46 +08:00
}
&-item-divider {
height: 1px;
overflow: hidden;
background-color: @border-color-split;
line-height: 0;
}
2016-06-25 15:09:23 +08:00
&-item:hover,
2015-11-14 16:37:42 +08:00
&-item-active,
2017-02-22 14:47:01 +08:00
&:not(&-inline) &-submenu-open,
2016-04-05 17:42:32 +08:00
&-submenu-active,
2015-11-14 16:37:42 +08:00
&-submenu-title:hover {
2016-12-04 19:26:11 +08:00
color: @primary-color;
2015-08-06 16:49:54 +08:00
}
2017-02-22 18:30:50 +08:00
&:not(&-inline) &-submenu-open {
z-index: @zindex-dropdown;
}
2015-11-14 20:41:10 +08:00
&-horizontal &-item,
&-horizontal &-submenu {
margin-top: -1px;
}
2016-06-25 15:09:23 +08:00
&-horizontal > &-item:hover,
2015-11-14 16:37:42 +08:00
&-horizontal > &-item-active,
&-horizontal > &-submenu &-submenu-title:hover {
background-color: transparent;
2015-08-06 16:49:54 +08:00
}
2015-11-14 16:37:42 +08:00
&-item-selected {
color: @primary-color;
2016-04-13 14:46:08 +08:00
> a,
> a:hover {
color: @primary-color;
}
2015-11-14 16:37:42 +08:00
}
2015-11-05 19:26:53 +08:00
2016-12-04 19:26:11 +08:00
&:not(&-horizontal) &-item-selected {
background-color: @item-active-bg;
2016-12-04 19:26:11 +08:00
}
&-horizontal,
&-inline,
&-vertical {
z-index: auto;
}
2015-11-14 16:37:42 +08:00
&-inline,
&-vertical {
border-right: @border-width-base @border-style-base @border-color-split;
2015-11-12 14:57:54 +08:00
.@{menu-prefix-cls}-item {
2015-11-05 19:26:53 +08:00
margin-left: -1px;
2015-11-12 14:57:54 +08:00
left: 1px;
position: relative;
2016-05-10 15:44:24 +08:00
z-index: 1;
2017-04-02 14:43:34 +08:00
&: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;
2017-04-02 14:43:34 +08:00
}
2015-11-12 14:57:54 +08:00
}
2015-11-14 15:33:29 +08:00
}
&-vertical&-sub {
2016-04-27 15:25:57 +08:00
border-right: 0;
.@{menu-prefix-cls}-item {
border-right: 0;
margin-left: 0;
left: 0;
2017-04-02 14:43:34 +08:00
&:after {
border-right: 0;
}
}
> .@{menu-prefix-cls}-item:first-child {
border-radius: @border-radius-base @border-radius-base 0 0;
}
> .@{menu-prefix-cls}-item:last-child,
> .@{menu-prefix-cls}-item-group:last-child > .@{menu-prefix-cls}-item-group-list:last-child > .@{menu-prefix-cls}-item:last-child {
border-radius: 0 0 @border-radius-base @border-radius-base;
2016-04-27 15:25:57 +08:00
}
2017-07-12 16:43:40 +08:00
> .@{menu-prefix-cls}-item:only-child {
border-radius: @border-radius-base;
}
2016-04-27 15:25:57 +08:00
}
2015-11-14 15:33:29 +08:00
&-inline {
2017-06-30 18:08:30 +08:00
width: 100%;
2015-11-12 14:57:54 +08:00
.@{menu-prefix-cls}-selected,
2015-11-12 23:09:35 +08:00
.@{menu-prefix-cls}-item-selected {
2017-04-02 14:43:34 +08:00
&:after {
transition: transform .15s @ease-in-out, opacity .15s @ease-in-out;
opacity: 1;
2017-04-02 14:43:34 +08:00
transform: scaleY(1);
}
2015-11-12 23:09:35 +08:00
}
2015-11-05 19:26:53 +08:00
}
2015-11-14 17:51:09 +08:00
&-submenu-horizontal > & {
2015-08-06 16:49:54 +08:00
top: 100%;
left: 0;
2015-08-10 17:57:28 +08:00
position: absolute;
min-width: 100%;
margin-top: 7px;
2016-03-28 16:01:37 +08:00
z-index: @zindex-dropdown;
2015-08-06 16:49:54 +08:00
}
2016-04-21 12:15:22 +08:00
&-submenu-vertical {
z-index: 1;
}
2015-11-14 17:51:09 +08:00
&-submenu-vertical > & {
2015-08-06 16:49:54 +08:00
top: 0;
left: 100%;
2015-08-10 17:57:28 +08:00
position: absolute;
min-width: 160px;
2015-08-06 16:49:54 +08:00
margin-left: 4px;
2016-03-28 16:01:37 +08:00
z-index: @zindex-dropdown;
2015-08-06 16:49:54 +08:00
}
2015-11-14 17:51:09 +08:00
&-item,
&-submenu-title {
2015-08-06 16:49:54 +08:00
margin: 0;
2016-05-07 16:03:51 +08:00
padding: 0 20px;
2015-08-06 16:49:54 +08:00
position: relative;
display: block;
white-space: nowrap;
.@{iconfont-css-prefix} {
2016-05-16 14:35:24 +08:00
min-width: 14px;
2016-05-07 16:03:51 +08:00
margin-right: 8px;
transition: font-size .15s @ease-out, margin .3s @ease-in-out;
2017-06-30 21:07:01 +08:00
+ span {
transition: opacity .3s @ease-in-out, width .3s @ease-in-out;
2017-07-25 10:30:36 +08:00
opacity: 1;
2017-06-30 21:07:01 +08:00
}
2016-05-07 16:03:51 +08:00
}
2015-08-06 16:49:54 +08:00
}
2016-04-05 17:42:32 +08:00
2015-08-06 16:49:54 +08:00
& > &-item-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
padding: 0;
line-height: 0;
2017-03-25 20:31:24 +08:00
background-color: @border-color-split;
2015-08-06 16:49:54 +08:00
}
&-submenu {
position: relative;
2015-08-20 16:55:42 +08:00
> .@{menu-prefix-cls} {
background-color: @component-background;
2017-03-25 20:31:24 +08:00
border-radius: @border-radius-base;
&-submenu-title:after {
transition: transform .3s @ease-in-out;
}
2015-08-06 16:49:54 +08:00
}
&-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;
2017-09-21 20:43:13 +08:00
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);
}
}
2015-08-13 17:31:09 +08:00
}
2015-08-14 13:09:53 +08:00
&-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);
}
2015-08-13 17:31:09 +08:00
}
2015-08-06 16:49:54 +08:00
}
}
2016-07-22 18:41:59 +08:00
&-vertical &-submenu-selected {
color: @primary-color;
> a {
2016-07-22 18:41:59 +08:00
color: @primary-color;
}
2015-08-06 16:49:54 +08:00
}
&-horizontal {
2015-11-26 19:32:55 +08:00
border: 0;
border-bottom: @border-width-base @border-style-base @border-color-split;
2015-08-06 16:49:54 +08:00
box-shadow: none;
z-index: 0;
2015-08-06 16:49:54 +08:00
2015-11-14 17:29:48 +08:00
> .@{menu-prefix-cls}-item,
> .@{menu-prefix-cls}-submenu {
position: relative;
top: 1px;
2015-11-14 17:29:48 +08:00
float: left;
border-bottom: 2px solid transparent;
2016-06-25 15:09:23 +08:00
&:hover,
2015-11-14 17:29:48 +08:00
&-active,
&-open,
2015-11-14 17:29:48 +08:00
&-selected {
border-bottom: 2px solid @primary-color;
color: @primary-color;
2015-11-05 19:25:22 +08:00
}
2015-11-14 17:29:48 +08:00
2015-08-17 17:28:48 +08:00
> a {
display: block;
2015-08-18 22:51:01 +08:00
color: @text-color;
&:hover {
color: @primary-color;
}
2015-08-17 17:28:48 +08:00
}
2015-08-06 16:49:54 +08:00
}
&:after {
content: "\20";
display: block;
height: 0;
clear: both;
}
}
2015-11-26 19:32:55 +08:00
&-vertical,
2017-02-16 21:24:17 +08:00
&-inline {
.@{menu-prefix-cls}-item,
.@{menu-prefix-cls}-submenu-title {
2017-02-16 17:56:15 +08:00
padding: 0 16px;
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
line-height: 42px;
height: 42px;
overflow: hidden;
text-overflow: ellipsis;
2015-08-06 16:49:54 +08:00
}
}
2015-08-10 17:57:28 +08:00
2017-08-22 18:37:08 +08:00
&-inline-collapsed {
width: @menu-collapsed-width;
2017-08-22 18:37:08 +08:00
> .@{menu-prefix-cls}-item,
> .@{menu-prefix-cls}-item-group > .@{menu-prefix-cls}-item-group-list > .@{menu-prefix-cls}-item,
2017-08-22 18:37:08 +08:00
> .@{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 {
2017-08-22 18:37:08 +08:00
display: none;
}
.@{iconfont-css-prefix} {
font-size: 16px;
line-height: 42px;
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;
}
2017-08-22 18:37:08 +08:00
}
2017-02-16 17:56:15 +08:00
&-item-group-list {
2017-02-16 21:24:17 +08:00
.@{menu-prefix-cls}-item,
.@{menu-prefix-cls}-submenu-title {
2017-02-16 17:56:15 +08:00
padding: 0 16px 0 28px;
}
}
2015-08-10 17:57:28 +08:00
&-vertical&-sub {
padding: 0;
2015-08-24 18:18:46 +08:00
transform-origin: 0 0;
2015-11-26 19:32:55 +08:00
& > .@{menu-prefix-cls}-item,
& > .@{menu-prefix-cls}-submenu {
2015-08-24 18:18:46 +08:00
transform-origin: 0 0;
}
2015-08-10 17:57:28 +08:00
}
&-root&-vertical,
2015-08-13 17:31:09 +08:00
&-root&-inline {
box-shadow: none;
2015-08-13 17:31:09 +08:00
}
2015-08-10 17:57:28 +08:00
&-sub&-inline {
padding: 0;
2015-11-26 19:32:55 +08:00
border: 0;
2015-08-10 17:57:28 +08:00
box-shadow: none;
2015-11-14 16:37:42 +08:00
border-radius: 0;
2015-11-26 19:32:55 +08:00
& > .@{menu-prefix-cls}-item,
& > .@{menu-prefix-cls}-submenu > .@{menu-prefix-cls}-submenu-title {
2015-11-14 17:29:48 +08:00
line-height: 42px;
height: 42px;
list-style-type: disc;
list-style-position: inside;
2015-08-10 17:57:28 +08:00
}
2015-12-11 16:55:30 +08:00
& .@{menu-prefix-cls}-item-group-title {
padding-left: 32px;
}
2015-08-10 17:57:28 +08:00
}
// 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;
}
}
2015-08-10 17:57:28 +08:00
}
2015-11-14 17:29:48 +08:00
// 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 {
&:after,
&:before {
background: @menu-dark-bg;
background-image: linear-gradient(to right, @text-color-secondary-dark, @text-color-secondary-dark);
}
}
2015-11-14 17:29:48 +08:00
}
&-dark &-inline&-sub {
background: @menu-dark-submenu-bg;
2015-11-14 17:29:48 +08:00
}
&-dark&-horizontal {
border-bottom-color: @menu-dark-bg;
2015-11-14 17:29:48 +08:00
}
&-dark&-horizontal > &-item,
&-dark&-horizontal > &-submenu {
border-color: @menu-dark-bg;
2016-04-10 16:01:03 +08:00
border-bottom: 0;
2015-11-14 17:29:48 +08:00
}
&-dark &-item,
&-dark &-item-group-title,
2015-11-14 17:29:48 +08:00
&-dark &-item > a {
color: @text-color-secondary-dark;
2015-11-14 17:29:48 +08:00
}
&-dark&-inline,
&-dark&-vertical {
border-right: 0;
}
&-dark&-inline &-item,
&-dark&-vertical &-item {
border-right: 0;
margin-left: 0;
left: 0;
2017-04-02 14:43:34 +08:00
&:after {
border-right: 0;
}
2015-11-14 17:29:48 +08:00
}
&-dark &-item:hover,
&-dark &-item-active,
&-dark &-submenu-active,
2017-02-22 14:47:01 +08:00
&-dark:not(&-inline) &-submenu-open,
2016-07-22 18:41:59 +08:00
&-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 {
&:after,
&:before {
background-image: linear-gradient(to right, #fff, #fff);
}
}
}
}
&-dark &-item-selected {
2015-11-14 17:29:48 +08:00
border-right: 0;
color: #fff;
2017-04-02 14:43:34 +08:00
&:after {
border-right: 0;
}
2016-04-13 14:46:08 +08:00
> a,
> a:hover {
color: #fff;
2016-04-13 14:46:08 +08:00
}
2015-11-14 17:29:48 +08:00
}
&&-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;
}
}
2015-08-06 16:49:54 +08:00
}