naive-ui/styles/Cascader.scss

185 lines
5.3 KiB
SCSS
Raw Normal View History

2019-08-01 14:47:53 +08:00
@import './mixins/mixins.scss';
2020-02-11 14:44:29 +08:00
2020-03-02 13:31:20 +08:00
@mixin cascader-size-mixin ($size) {
@include b(cascader-menu) {
@include m($size + '-size') {
@include b(cascader-submenu) {
height: map-get($--n-height, $size) * 6.6;
@include b(cascader-option) {
height: map-get($--n-height, $size);
line-height: map-get($--n-height, $size);
font-size: map-get($--n-font-size, $size);
}
}
2019-12-04 18:43:55 +08:00
}
}
2020-03-02 13:31:20 +08:00
}
@include cascader-size-mixin('small');
@include cascader-size-mixin('medium');
@include cascader-size-mixin('large');
@include b(cascader) {
width: 100%;
}
@include themes-mixin {
2019-10-23 16:51:29 +08:00
@include b(cascader-menu) {
2019-12-04 18:43:55 +08:00
@include once {
@include fade-in-scale-up-transition(cascader-menu, inherit, .2s);
2020-02-24 18:17:51 +08:00
transform: $--n-transform-debounce-scale;
position: relative;
margin: 4px 0;
2020-01-10 19:57:24 +08:00
display: flex;
flex-wrap: nowrap;
2020-02-28 22:57:10 +08:00
border-radius: $--n-cascader-border-radius;
overflow: hidden;
/**
* if width not set, cascader select menu's inner scroll area's width is
* not correct, which won't change after select menu width is set
*/
@include b(scrollbar) {
width: 100%;
}
2019-10-23 16:51:29 +08:00
}
2020-01-10 19:57:24 +08:00
box-shadow: $--cascader-menu-box-shadow;
@include b(cascader-submenu) {
2019-12-04 18:43:55 +08:00
@include once {
2020-01-10 19:57:24 +08:00
position: relative;
overflow: hidden;
min-width: 182px;
@include b(scrollbar-content) {
2019-10-23 16:51:29 +08:00
position: relative;
}
2020-01-10 19:57:24 +08:00
&:first-child {
2020-02-28 22:57:10 +08:00
border-top-left-radius: $--n-cascader-border-radius;
border-bottom-left-radius: $--n-cascader-border-radius;
2020-01-10 19:57:24 +08:00
}
&:last-child {
2020-02-28 22:57:10 +08:00
border-top-right-radius: $--n-cascader-border-radius;
border-bottom-right-radius: $--n-cascader-border-radius;
2019-10-23 16:51:29 +08:00
}
2019-08-01 15:15:25 +08:00
}
2020-01-10 19:57:24 +08:00
&:not(:first-child) {
border-left: 1px solid $--cascader-menu-border-color;
}
background-color: $--cascader-menu-background-color;
2019-10-23 16:51:29 +08:00
}
@include b(cascader-option) {
2019-12-04 18:43:55 +08:00
@include once {
box-sizing: border-box;
min-width: 182px;
background-color: transparent;
2020-02-21 16:48:45 +08:00
transition:
background-color .2s $--n-ease-in-out-cubic-bezier,
color 0.2s $--n-ease-in-out-cubic-bezier;
2019-12-04 18:43:55 +08:00
display: flex;
padding: 0px 24px 0 33px;
white-space: nowrap;
position: relative;
cursor: pointer;
}
2019-10-23 16:51:29 +08:00
color: map-get($--cascader-option-text-color, 'default');
@include not-m(not-leaf) {
&::after {
@include once {
content: '';
height: 6px;
width: 3px;
position: absolute;
right: 14px;
transform: rotate(45deg) scale(.5);
top: calc(50% - 4px);
opacity: 0;
transition: transform .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier;
2019-10-23 16:51:29 +08:00
}
2019-12-04 18:43:55 +08:00
border-right: 1px solid $--cascader-item-check-mark-color;
border-bottom: 1px solid $--cascader-item-check-mark-color;
2019-10-23 16:51:29 +08:00
}
}
2019-12-04 18:43:55 +08:00
@include once {
@include m(single-type) {
padding: 0px 24px 0 18px;
}
@include e(checkbox) {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 10px;
display: block;
}
@include e(radio) {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 10px;
display: block;
}
@include e(loading) {
2020-02-21 16:48:45 +08:00
@include fade-in-scale-up-transition(
cascader-option-loading,
$original-transform: translateY(-50%)
);
2019-12-04 18:43:55 +08:00
position: absolute;
width: 14px;
height: 14px;
right: 10px;
top: 50%;
transform: translateY(-50%);
display: block;
}
2019-10-23 16:51:29 +08:00
}
@include m(selected) {
color: map-get($--cascader-option-text-color, 'active');
2019-12-04 18:43:55 +08:00
@include once {
&::after {
transform: rotate(45deg) scale(1);
opacity: 1;
}
2019-10-23 16:51:29 +08:00
}
}
@include m(active) {
color: map-get($--cascader-option-text-color, 'active');
}
2019-10-23 16:51:29 +08:00
@include m(disabled) {
color: map-get($--cascader-option-text-color, 'disabled');
2019-12-04 18:43:55 +08:00
@include once {
cursor: not-allowed;
}
}
2019-10-23 16:51:29 +08:00
@include m(tracked) {
2020-02-24 18:17:51 +08:00
background-color: $--cascader-menu-tracking-rect-background-color;
2019-10-23 16:51:29 +08:00
}
@include m(not-leaf) {
&::after {
2019-12-04 18:43:55 +08:00
@include once {
content: '';
position: absolute;
width: 5px;
height: 5px;
transform: rotate(45deg) translateY(-50%);
right: 18px;
top: 50%;
opacity: 1;
transition: opacity .3s $--n-ease-in-out-cubic-bezier;
2019-12-04 18:43:55 +08:00
}
2019-10-23 16:51:29 +08:00
border-top: 2px solid $--cascader-option-arrow-background-color;
border-right: 2px solid $--cascader-option-arrow-background-color;
}
}
2019-12-04 18:43:55 +08:00
@include once {
@include m(loading) {
@include m(not-leaf) {
&::after {
opacity: 0;
}
2019-10-23 16:51:29 +08:00
}
}
}
2019-08-01 12:01:04 +08:00
}
2020-02-24 18:17:51 +08:00
@include b(base-tracking-rect) {
@include e(body) {
background-color: $--cascader-menu-tracking-rect-background-color !important;
2019-10-23 16:51:29 +08:00
}
2020-01-10 19:57:24 +08:00
}
2019-08-01 12:01:04 +08:00
}
2019-08-24 01:31:36 +08:00
}