naive-ui/styles/Popover.scss

266 lines
7.3 KiB
SCSS
Raw Normal View History

2019-07-11 19:51:59 +08:00
@import "./mixins/mixins.scss";
2020-02-11 14:44:29 +08:00
2019-12-09 15:12:53 +08:00
@mixin popover-content-transition {
&#{&}-transition-enter-to, &#{&}-transition-leave {
2020-02-29 19:28:23 +08:00
transform: $--n-transform-debounce-scale;
2019-08-30 00:07:38 +08:00
opacity: 1;
}
2019-12-09 15:12:53 +08:00
&#{&}-transition-enter, &#{&}-transition-leave-to {
2019-09-27 22:27:01 +08:00
opacity: 0;
transform: scale(.85);
}
2019-12-09 15:12:53 +08:00
&#{&}-transition-enter-active {
2020-02-11 14:44:29 +08:00
transition: opacity .15s $--n-ease-out-cubic-bezier, transform .15s $--n-ease-out-cubic-bezier;
2019-08-30 00:07:38 +08:00
}
2019-12-09 15:12:53 +08:00
&#{&}-transition-leave-active {
2020-02-11 14:44:29 +08:00
transition: opacity .15s $--n-ease-in-cubic-bezier, transform .15s $--n-ease-in-cubic-bezier;
2019-07-11 19:51:59 +08:00
}
}
2019-09-27 22:27:01 +08:00
@include themes-mixin {
@include b(popover-content) {
@include once {
2019-12-09 15:12:53 +08:00
@include popover-content-transition;
2020-02-29 19:28:23 +08:00
transition:
background-color .3s $--n-ease-in-out-cubic-bezier,
color .3s $--n-ease-in-out-cubic-bezier;
2019-09-27 22:27:01 +08:00
transform-origin: inherit;
2020-02-21 14:59:17 +08:00
transform: $--n-transform-debounce-scale;
2019-09-27 22:27:01 +08:00
position: relative;
2019-12-09 15:12:53 +08:00
font-size: 13px;
@include m(styled) {
border-radius: $--n-popover-border-radius;
padding: 8px 14px;
}
@include m(fix-width) {
white-space: normal;
width: max-content;
box-sizing: border-box;
}
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
2019-12-09 15:12:53 +08:00
position: absolute;
2020-02-29 19:28:23 +08:00
overflow: hidden;
pointer-events: none;
@include b(popover-arrow) {
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
position: absolute;
display: block;
width: $--n-popover-arrow-width * 2;
height: $--n-popover-arrow-width * 2;
box-shadow: $--n-popover-arrow-box-shadow;
transform: rotate(45deg);
}
2019-12-09 15:12:53 +08:00
}
2020-03-03 14:34:24 +08:00
@include m(no-arrow) {
2019-09-27 22:27:01 +08:00
&[n-placement$="top-start"] {
margin-bottom: 6px;
}
&[n-placement$="top"] {
margin-bottom: 6px;
}
&[n-placement$="top-end"] {
margin-bottom: 6px;
}
&[n-placement$="bottom-start"] {
margin-top: 6px;
}
&[n-placement$="bottom"] {
margin-top: 6px;
}
&[n-placement$="bottom-end"] {
margin-top: 6px;
}
&[n-placement$="left-start"] {
margin-right: 6px;
}&[n-placement$="left"] {
margin-right: 6px;
}
&[n-placement$="left-end"] {
margin-right: 6px;
}
&[n-placement$="right-start"] {
margin-left: 6px;
}
&[n-placement$="right"] {
margin-left: 6px;
}
&[n-placement$="right-end"] {
margin-left: 6px;
}
2019-12-03 13:53:44 +08:00
}
2020-02-29 19:28:23 +08:00
&[n-placement$="top-start"] {
2019-09-27 22:27:01 +08:00
margin-bottom: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
top: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
top: -$--n-popover-arrow-width;
left: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="top"] {
2019-09-27 22:27:01 +08:00
margin-bottom: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
top: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
top: -$--n-popover-arrow-width;
transform: translateX(-$--n-popover-arrow-width) rotate(45deg) ;
left: 50%;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="top-end"] {
2019-09-27 22:27:01 +08:00
margin-bottom: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
top: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
top: -$--n-popover-arrow-width;
right: 10px;
}
}
2019-09-27 22:27:01 +08:00
}
2020-02-29 19:28:23 +08:00
&[n-placement$="bottom-start"] {
2019-09-27 22:27:01 +08:00
margin-top: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
bottom: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
bottom: -$--n-popover-arrow-width;
left: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="bottom"] {
2019-09-27 22:27:01 +08:00
margin-top: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
bottom: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
bottom: -$--n-popover-arrow-width;
transform: translateX(-$--n-popover-arrow-width) rotate(45deg) ;
left: 50%;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="bottom-end"] {
2019-09-27 22:27:01 +08:00
margin-top: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
right: 0;
left: 0;
bottom: 100%;
height: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
bottom: -$--n-popover-arrow-width;
right: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="left-start"] {
2019-09-27 22:27:01 +08:00
margin-right: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
left: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
left: -$--n-popover-arrow-width;
top: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="left"] {
2019-09-27 22:27:01 +08:00
margin-right: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
left: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
left: -$--n-popover-arrow-width;
transform: translateY(-$--n-popover-arrow-width) rotate(45deg) ;
top: 50%;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="left-end"] {
2019-09-27 22:27:01 +08:00
margin-right: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
left: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
left: -$--n-popover-arrow-width;
bottom: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="right-start"] {
2019-09-27 22:27:01 +08:00
margin-left: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
right: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
right: -$--n-popover-arrow-width;
top: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="right"] {
2019-09-27 22:27:01 +08:00
margin-left: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
right: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
right: -$--n-popover-arrow-width;
transform: translateY(-$--n-popover-arrow-width) rotate(45deg) ;
top: 50%;
}
2019-09-27 22:27:01 +08:00
}
}
2020-02-29 19:28:23 +08:00
&[n-placement$="right-end"] {
2019-09-27 22:27:01 +08:00
margin-left: 10px;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
top: 0;
bottom: 0;
right: 100%;
width: $--n-popover-arrow-width * 2;
@include b(popover-arrow) {
right: -$--n-popover-arrow-width;
bottom: 10px;
}
2019-09-27 22:27:01 +08:00
}
}
2019-08-30 00:07:38 +08:00
}
@include m(styled) {
background-color: $--popover-background-color;
}
2020-02-20 13:22:48 +08:00
color: $--popover-text-color;
2020-02-29 19:28:23 +08:00
@include b(popover-arrow-wrapper) {
@include b(popover-arrow) {
background-color: $--popover-background-color;
}
}
@include m(shadow) {
2019-12-03 13:53:44 +08:00
box-shadow: $--popover-box-shadow;
}
2019-07-11 19:51:59 +08:00
}
2019-09-27 22:27:01 +08:00
}