naive-ui/styles/Popover.scss
2019-09-28 13:47:54 +08:00

234 lines
5.9 KiB
SCSS

@import "./mixins/mixins.scss";
@import "./themes/vars.scss";
@mixin popover-transition {
&.n-popover-fade-enter-to, &.n-popover-fade-leave {
transform: scaleX(.999999); // scale is set to 99999 to get rid of a ridiculous render bug of chrome
opacity: 1;
}
&.n-popover-fade-enter, &.n-popover-fade-leave-to {
opacity: 0;
transform: scale(.85);
}
&.n-popover-fade-enter-active {
transition: opacity .15s $fast-in-cubic-bezier, transform .15s $fast-in-cubic-bezier;
}
&.n-popover-fade-leave-active {
transition: opacity .15s $slow-out-cubic-bezier, transform .15s $slow-out-cubic-bezier;
}
}
@include themes-mixin {
@include b(popover-content) {
$popover-arrow-width: 6px;
@include once {
@include popover-transition;
transform-origin: inherit;
transform: scale(.99999);
position: relative;
border-radius: 6px;
font-size: 12px;
opacity: 1;
@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;
box-shadow: $--popover-box-shadow;
@include b(popover-arrow) {
border-width: 6px;
pointer-events: none;
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
}
}