naive-ui/styles/Popover.scss

241 lines
6.2 KiB
SCSS
Raw Normal View History

2019-07-11 19:51:59 +08:00
@import "./mixins/mixins.scss";
@import "./themes/vars.scss";
2019-07-11 19:51:59 +08:00
2019-12-09 15:12:53 +08:00
@mixin popover-content-transition {
&#{&}-transition-enter-to, &#{&}-transition-leave {
2019-09-27 22:27:01 +08:00
transform: scaleX(.999999); // scale is set to 99999 to get rid of a ridiculous render bug of chrome
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 {
transition: opacity .15s $fast-in-cubic-bezier, transform .15s $fast-in-cubic-bezier;
2019-08-30 00:07:38 +08:00
}
2019-12-09 15:12:53 +08:00
&#{&}-transition-leave-active {
transition: opacity .15s $slow-out-cubic-bezier, transform .15s $slow-out-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;
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;
transform: scale(.99999);
position: relative;
border-radius: 6px;
2019-12-09 15:12:53 +08:00
font-size: 13px;
@include b(popover-arrow) {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:12:53 +08:00
border-width: 6px;
pointer-events: none;
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
2019-09-27 22:27:01 +08:00
@include m(without-arrow) {
&[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
}
2019-09-27 22:27:01 +08:00
}
2019-08-30 00:07:38 +08:00
&[n-placement$="top-start"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-bottom: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
bottom: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
left: 10px;
}
border-top-color: $--popover-background-color;
}
}
2019-08-30 00:07:38 +08:00
&[n-placement$="top"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-bottom: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
bottom: -2 * $--popover-arrow-width;
transform: translateX(-$--popover-arrow-width);
2019-09-27 22:27:01 +08:00
left: 50%;
}
border-top-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="top-end"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-bottom: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
bottom: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
right: 10px;
}
border-top-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="bottom-start"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-top: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
top: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
left: 10px;
}
border-bottom-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="bottom"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-top: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
top: -2 * $--popover-arrow-width;
transform: translateX(-$--popover-arrow-width);
2019-09-27 22:27:01 +08:00
left: 50%;
}
border-bottom-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="bottom-end"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-top: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
top: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
right: 10px;
}
border-bottom-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="left-start"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-right: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
right: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
top: 10px;
}
border-left-color: $--popover-background-color;
}
2019-09-28 13:47:54 +08:00
}
&[n-placement$="left"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-right: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
right: -2 * $--popover-arrow-width;
transform: translateY(-$--popover-arrow-width);
2019-09-27 22:27:01 +08:00
top: 50%;
}
border-left-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="left-end"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-right: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
right: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
bottom: 10px;
}
border-left-color: $--popover-background-color;
}
}
2019-08-30 00:07:38 +08:00
&[n-placement$="right-start"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-left: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
left: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
top: 10px;
}
border-right-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="right"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-left: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
left: -2 * $--popover-arrow-width;
transform: translateY(-$--popover-arrow-width);
2019-09-27 22:27:01 +08:00
top: 50%;
}
border-right-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
&[n-placement$="right-end"] {
2019-09-27 22:27:01 +08:00
@include once {
margin-left: 10px;
}
@include b(popover-arrow) {
@include once {
2019-12-09 15:12:53 +08:00
left: -2 * $--popover-arrow-width;
2019-09-27 22:27:01 +08:00
bottom: 10px;
}
border-right-color: $--popover-background-color;
}
2019-08-30 00:07:38 +08:00
}
2019-09-27 22:27:01 +08:00
background-color: $--popover-background-color;
color: $--popover-color;
2019-12-03 13:53:44 +08:00
@include not-m(without-shadow) {
box-shadow: $--popover-box-shadow;
}
2019-12-09 15:12:53 +08:00
@include m(fix-width) {
white-space: normal;
width: max-content;
box-sizing: border-box;
word-break: break-all;
2019-08-30 00:07:38 +08:00
}
2019-07-11 19:51:59 +08:00
}
2019-09-27 22:27:01 +08:00
}