260 lines
6.0 KiB
SCSS
260 lines
6.0 KiB
SCSS
.#{$ns}Tooltip {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
font-family: inherit;
|
|
border-radius: $borderRadius;
|
|
min-width: $Tooltip-minWidth;
|
|
max-width: $Tooltip-maxWidth;
|
|
text-align: left;
|
|
white-space: normal;
|
|
z-index: $zindex-tooltip;
|
|
word-wrap: break-word;
|
|
background: $Tooltip-bg;
|
|
border: $Tooltip-borderWidth solid $Tooltip-borderColor;
|
|
box-shadow: $Tooltip-boxShadow;
|
|
|
|
&-arrow {
|
|
position: absolute;
|
|
display: block;
|
|
width: $Tooltip-arrow-width;
|
|
height: $Tooltip-arrow-height;
|
|
margin-left: -$Tooltip-arrow-width/2;
|
|
left: 50%;
|
|
|
|
&::before,
|
|
&::after {
|
|
position: absolute;
|
|
display: block;
|
|
content: '';
|
|
border-color: transparent;
|
|
border-style: solid;
|
|
}
|
|
}
|
|
|
|
&--top {
|
|
margin-top: -$Tooltip-arrow-height - px2rem(2px);
|
|
|
|
.#{$ns}Tooltip-arrow {
|
|
bottom: ($Tooltip-arrow-height + $Tooltip-borderWidth) * -1;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before,
|
|
.#{$ns}Tooltip-arrow::after {
|
|
border-width: $Tooltip-arrow-height ($Tooltip-arrow-width / 2) 0;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before {
|
|
bottom: 0;
|
|
border-top-color: $Tooltip-arrow-outerColor;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::after {
|
|
bottom: $Tooltip-borderWidth;
|
|
border-top-color: $Tooltip-arrow-color;
|
|
}
|
|
}
|
|
|
|
&--right {
|
|
margin-left: $Tooltip-arrow-height + px2rem(2px);
|
|
|
|
.#{$ns}Tooltip-arrow {
|
|
left: ($Tooltip-borderWidth) * -1;
|
|
width: $Tooltip-arrow-height;
|
|
height: $Tooltip-arrow-width;
|
|
margin-top: -$Tooltip-arrow-width/2;
|
|
top: 50%;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before,
|
|
.#{$ns}Tooltip-arrow::after {
|
|
border-width: ($Tooltip-arrow-width / 2) $Tooltip-arrow-height
|
|
($Tooltip-arrow-width / 2) 0;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before {
|
|
left: 0;
|
|
border-right-color: $Tooltip-arrow-outerColor;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::after {
|
|
left: $Tooltip-borderWidth;
|
|
border-right-color: $Tooltip-arrow-color;
|
|
}
|
|
}
|
|
|
|
&--bottom {
|
|
margin-top: $Tooltip-arrow-height + px2rem(2px);
|
|
|
|
.#{$ns}Tooltip-arrow {
|
|
top: ($Tooltip-arrow-height + $Tooltip-borderWidth) * -1;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before,
|
|
.#{$ns}Tooltip-arrow::after {
|
|
border-width: 0 ($Tooltip-arrow-width / 2) $Tooltip-arrow-height
|
|
($Tooltip-arrow-width / 2);
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before {
|
|
top: 0;
|
|
border-bottom-color: $Tooltip-arrow-outerColor;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::after {
|
|
top: $Tooltip-borderWidth;
|
|
border-bottom-color: $Tooltip-arrow-color;
|
|
}
|
|
|
|
// This will remove the popover-header's border just below the arrow
|
|
.#{$ns}Tooltip-title::before {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 50%;
|
|
display: block;
|
|
width: $Tooltip-arrow-width;
|
|
margin-left: ($Tooltip-arrow-width / -2);
|
|
content: '';
|
|
border-bottom: $Tooltip-borderWidth solid $Tooltip-title-bg;
|
|
}
|
|
}
|
|
|
|
&--left {
|
|
margin-left: -$Tooltip-arrow-height - px2rem(2px);
|
|
|
|
.#{$ns}Tooltip-arrow {
|
|
left: auto;
|
|
right: ($Tooltip-arrow-height + $Tooltip-borderWidth) * -1;
|
|
width: $Tooltip-arrow-height;
|
|
height: $Tooltip-arrow-width;
|
|
margin-top: -$Tooltip-arrow-width/2;
|
|
top: 50%;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before,
|
|
.#{$ns}Tooltip-arrow::after {
|
|
border-width: ($Tooltip-arrow-width / 2) 0 ($Tooltip-arrow-width / 2)
|
|
$Tooltip-arrow-height;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::before {
|
|
right: 0;
|
|
border-left-color: $Tooltip-arrow-outerColor;
|
|
}
|
|
|
|
.#{$ns}Tooltip-arrow::after {
|
|
right: $Tooltip-borderWidth;
|
|
border-left-color: $Tooltip-arrow-color;
|
|
}
|
|
}
|
|
|
|
&-title {
|
|
padding: $Tooltip-title-paddingY $Tooltip-title-paddingX;
|
|
margin-bottom: 0; // Reset the default from Reboot
|
|
font-size: $fontSizeBase;
|
|
color: $Tooltip-title-color;
|
|
background-color: $Tooltip-title-bg;
|
|
border-bottom: $Tooltip-borderWidth solid darken($Tooltip-title-bg, 5%);
|
|
border-top-left-radius: $Tooltip-borderRadius - $Tooltip-borderWidth;
|
|
border-top-right-radius: $Tooltip-borderRadius - $Tooltip-borderWidth;
|
|
|
|
&:empty {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
&-body {
|
|
color: $Tooltip-body-color;
|
|
padding: $Tooltip-body-paddingY $Tooltip-body-paddingX;
|
|
}
|
|
}
|
|
|
|
@keyframes tooltipIn {
|
|
from {
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
}
|
|
|
|
[data-tooltip] {
|
|
position: relative;
|
|
|
|
&:after {
|
|
pointer-events: none;
|
|
left: 0;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
position: absolute;
|
|
content: attr(data-tooltip);
|
|
font-size: $Tooltip--attr-fontSize;
|
|
line-height: $Tooltip--attr-lineHeigt;
|
|
text-align: left;
|
|
white-space: normal;
|
|
width: max-content;
|
|
box-sizing: content-box;
|
|
max-width: 300px;
|
|
background: $Tooltip--attr-bg;
|
|
border: $Tooltip--attr-borderWidth solid $Tooltip--attr-borderColor;
|
|
border-radius: $Tooltip--attr-borderRadius;
|
|
box-shadow: $Tooltip--attr-boxShadow;
|
|
left: 100%;
|
|
color: $Tooltip--attr-color;
|
|
padding: $Tooltip--attr-paddingY $Tooltip--attr-paddingX;
|
|
display: none;
|
|
animation-duration: 0.2s;
|
|
animation-fill-mode: both;
|
|
|
|
@media screen and (min-width: 0\0) {
|
|
white-space: nowrap;
|
|
max-width: unset;
|
|
}
|
|
}
|
|
|
|
&:not(.is-disabled):hover:after {
|
|
display: inline-block;
|
|
animation-name: tooltipIn;
|
|
|
|
opacity: 1;
|
|
z-index: $zindex-tooltip;
|
|
margin: 0 0 0 $Tooltip--attr-gap;
|
|
opacity: 1;
|
|
}
|
|
|
|
&[data-position='bottom']:after {
|
|
left: 50%;
|
|
top: 100%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
&[data-position='bottom']:hover:after {
|
|
margin: $Tooltip--attr-gap 0 0 0;
|
|
}
|
|
|
|
&[data-position='left']:after {
|
|
top: 50%;
|
|
right: 100%;
|
|
left: auto;
|
|
transform: translateY(-50%);
|
|
}
|
|
|
|
&[data-position='left']:hover:after {
|
|
margin: 0 $Tooltip--attr-gap 0 0;
|
|
}
|
|
|
|
&[data-position='top']:after {
|
|
left: 50%;
|
|
top: auto;
|
|
bottom: 100%;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
&[data-position='top']:hover:after {
|
|
margin: -$Tooltip--attr-gap 0 0 0;
|
|
}
|
|
|
|
&:hover:active:after {
|
|
content: '';
|
|
display: none !important;
|
|
}
|
|
}
|