siyuan/app/src/assets/scss/_tooltips.scss

187 lines
3.2 KiB
SCSS

.tooltip {
pointer-events: none;
position: fixed;
z-index: 1000000;
padding: 4px 8px;
font-size: 12px;
font-weight: normal;
-webkit-font-smoothing: subpixel-antialiased;
color: #fff;
word-wrap: break-word;
background: var(--b3-tooltips-color);
border-radius: 4px;
line-height: 17px;
max-width: 320px;
animation-duration: 150ms;
animation-fill-mode: both;
animation-name: zoomIn;
&--error {
background: var(--b3-theme-error);
}
}
.b3-tooltips {
position: relative;
cursor: pointer;
overflow: hidden;
&::after {
z-index: 1000000;
padding: 4px 8px;
font-size: 12px;
font-weight: normal;
-webkit-font-smoothing: subpixel-antialiased;
color: #fff;
word-wrap: break-word;
white-space: pre;
content: attr(aria-label);
background: var(--b3-tooltips-color);
border-radius: 4px;
line-height: 17px;
transform: scale(0.8);
max-width: 60vw;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box;
}
&::before {
z-index: 1000001;
width: 0;
height: 0;
color: var(--b3-tooltips-color);
content: "";
border: 5px solid transparent;
transform: scale(1.54);
}
&::after,
&::before {
pointer-events: none;
position: absolute;
opacity: 0;
transition: opacity 150ms 0ms cubic-bezier(0, 0, 0.2, 1), transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1);
}
&:hover,
&:focus-within {
overflow: initial;
}
&:hover::before,
&:hover::after {
display: inline-block;
opacity: 1;
transform: scale(1);
}
&__s::after,
&__se::after,
&__sw::after {
top: 100%;
right: 50%;
margin-top: 5px
}
&__s::before,
&__se::before,
&__sw::before {
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: var(--b3-tooltips-color)
}
&__se::after {
right: auto;
left: 50%;
margin-left: -15px
}
&__sw::after {
margin-right: -15px
}
&__n::after,
&__ne::after,
&__nw::after {
right: 50%;
bottom: 100%;
margin-bottom: 5px
}
&__n::before,
&__ne::before,
&__nw::before {
top: -5px;
right: 50%;
bottom: auto;
margin-right: -5px;
border-top-color: var(--b3-tooltips-color)
}
&__ne::after {
right: auto;
left: 50%;
margin-left: -15px
}
&__nw::after {
margin-right: -15px
}
&__s::after,
&__n::after {
transform: translateX(50%) scale(.8);
}
&__s:hover::after,
&__n:hover::after {
transform: translateX(50%) scale(1);
}
&__w::after {
right: 100%;
bottom: 50%;
margin-right: 5px;
transform: translateY(50%) scale(.8);
}
&__w::before {
top: 50%;
bottom: 50%;
left: -5px;
margin-top: -5px;
border-left-color: var(--b3-tooltips-color);
}
&__e::after {
bottom: 50%;
left: 100%;
margin-left: 5px;
transform: translateY(50%) scale(.8);
}
&__e:hover::after,
&__w:hover::after {
transform: translateY(50%) scale(1);
}
&__e::before {
top: 50%;
right: -5px;
bottom: 50%;
margin-top: -5px;
border-right-color: var(--b3-tooltips-color);
}
}
@media screen and (max-width: 520px) {
.b3-tooltips:before,
.b3-tooltips:after {
content: none;
}
}