naive-ui/styles/Popover.scss
songwanli2025@163.com fdf2af8eb5 merge
2020-02-24 16:25:02 +08:00

240 lines
6.3 KiB
SCSS

@import "./mixins/mixins.scss";
@mixin popover-content-transition {
&#{&}-transition-enter-to, &#{&}-transition-leave {
transform: $--n-transform-debounce-scale; // 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 $--n-ease-out-cubic-bezier, transform .15s $--n-ease-out-cubic-bezier;
}
&#{&}-transition-leave-active {
transition: opacity .15s $--n-ease-in-cubic-bezier, transform .15s $--n-ease-in-cubic-bezier;
}
}
@include themes-mixin {
@include b(popover-content) {
@include once {
@include popover-content-transition;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier;
transform-origin: inherit;
transform: $--n-transform-debounce-scale;
position: relative;
border-radius: 6px;
font-size: 13px;
@include b(popover-arrow) {
transition: border-color .3s $--n-ease-in-out-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 * $--n-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 * $--n-popover-arrow-width;
transform: translateX(-$--n-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 * $--n-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 * $--n-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 * $--n-popover-arrow-width;
transform: translateX(-$--n-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 * $--n-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 * $--n-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 * $--n-popover-arrow-width;
transform: translateY(-$--n-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 * $--n-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 * $--n-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 * $--n-popover-arrow-width;
transform: translateY(-$--n-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 * $--n-popover-arrow-width;
bottom: 10px;
}
border-right-color: $--popover-background-color;
}
}
background-color: $--popover-background-color;
color: $--popover-text-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;
}
}
}