naive-ui/styles/Popover.scss

237 lines
6.0 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-09-27 22:27:01 +08:00
@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
2019-08-30 00:07:38 +08:00
opacity: 1;
}
2019-09-27 22:27:01 +08:00
&.n-popover-fade-enter, &.n-popover-fade-leave-to {
opacity: 0;
transform: scale(.85);
}
2019-08-30 00:07:38 +08:00
&.n-popover-fade-enter-active {
transition: opacity .15s $fast-in-cubic-bezier, transform .15s $fast-in-cubic-bezier;
2019-08-30 00:07:38 +08:00
}
2019-09-27 22:27:01 +08:00
&.n-popover-fade-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) {
$popover-arrow-width: 6px;
@include once {
transition: background-color .3s $default-cubic-bezier, color .3s $default-cubic-bezier;
2019-09-27 22:27:01 +08:00
@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;
}
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 {
bottom: -2 * $popover-arrow-width;
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 {
bottom: -2 * $popover-arrow-width;
transform: translateX(-$popover-arrow-width);
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 {
bottom: -2 * $popover-arrow-width;
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 {
top: -2 * $popover-arrow-width;
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 {
top: -2 * $popover-arrow-width;
transform: translateX(-$popover-arrow-width);
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 {
top: -2 * $popover-arrow-width;
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 {
right: -2 * $popover-arrow-width;
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 {
right: -2 * $popover-arrow-width;
transform: translateY(-$popover-arrow-width);
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 {
right: -2 * $popover-arrow-width;
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 {
left: -2 * $popover-arrow-width;
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 {
left: -2 * $popover-arrow-width;
transform: translateY(-$popover-arrow-width);
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 {
left: -2 * $popover-arrow-width;
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-09-27 22:27:01 +08:00
@include b(popover-arrow) {
transition: border-color .3s $default-cubic-bezier;
2019-09-27 22:27:01 +08:00
border-width: 6px;
pointer-events: none;
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
2019-08-30 00:07:38 +08:00
}
2019-07-11 19:51:59 +08:00
}
2019-09-27 22:27:01 +08:00
}