naive-ui/styles/Popover.scss
2019-12-09 15:12:53 +08:00

241 lines
6.2 KiB
SCSS

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