_popover.scss 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. .popover {
  2. position: absolute;
  3. top: 0;
  4. left: 0;
  5. z-index: $zindex-popover;
  6. display: block;
  7. max-width: $popover-max-width;
  8. // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
  9. // So reset our font and text properties to avoid inheriting weird values.
  10. @include reset-text();
  11. font-size: $popover-font-size;
  12. // Allow breaking very long words so they don't overflow the popover's bounds
  13. word-wrap: break-word;
  14. background-color: $popover-bg;
  15. background-clip: padding-box;
  16. border: $popover-border-width solid $popover-border-color;
  17. @include border-radius($popover-border-radius);
  18. @include box-shadow($popover-box-shadow);
  19. .arrow {
  20. position: absolute;
  21. display: block;
  22. width: $popover-arrow-width;
  23. height: $popover-arrow-height;
  24. margin: 0 $border-radius-lg;
  25. &::before,
  26. &::after {
  27. position: absolute;
  28. display: block;
  29. content: "";
  30. border-color: transparent;
  31. border-style: solid;
  32. }
  33. }
  34. }
  35. .bs-popover-top {
  36. margin-bottom: $popover-arrow-height;
  37. .arrow {
  38. bottom: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
  39. }
  40. .arrow::before,
  41. .arrow::after {
  42. border-width: $popover-arrow-height ($popover-arrow-width / 2) 0;
  43. }
  44. .arrow::before {
  45. bottom: 0;
  46. border-top-color: $popover-arrow-outer-color;
  47. }
  48. .arrow::after {
  49. bottom: $popover-border-width;
  50. border-top-color: $popover-arrow-color;
  51. }
  52. }
  53. .bs-popover-right {
  54. margin-left: $popover-arrow-height;
  55. .arrow {
  56. left: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
  57. width: $popover-arrow-height;
  58. height: $popover-arrow-width;
  59. margin: $border-radius-lg 0; // make sure the arrow does not touch the popover's rounded corners
  60. }
  61. .arrow::before,
  62. .arrow::after {
  63. border-width: ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2) 0;
  64. }
  65. .arrow::before {
  66. left: 0;
  67. border-right-color: $popover-arrow-outer-color;
  68. }
  69. .arrow::after {
  70. left: $popover-border-width;
  71. border-right-color: $popover-arrow-color;
  72. }
  73. }
  74. .bs-popover-bottom {
  75. margin-top: $popover-arrow-height;
  76. .arrow {
  77. top: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
  78. }
  79. .arrow::before,
  80. .arrow::after {
  81. border-width: 0 ($popover-arrow-width / 2) $popover-arrow-height ($popover-arrow-width / 2);
  82. }
  83. .arrow::before {
  84. top: 0;
  85. border-bottom-color: $popover-arrow-outer-color;
  86. }
  87. .arrow::after {
  88. top: $popover-border-width;
  89. border-bottom-color: $popover-arrow-color;
  90. }
  91. // This will remove the popover-header's border just below the arrow
  92. .popover-header::before {
  93. position: absolute;
  94. top: 0;
  95. left: 50%;
  96. display: block;
  97. width: $popover-arrow-width;
  98. margin-left: ($popover-arrow-width / -2);
  99. content: "";
  100. border-bottom: $popover-border-width solid $popover-header-bg;
  101. }
  102. }
  103. .bs-popover-left {
  104. margin-right: $popover-arrow-height;
  105. .arrow {
  106. right: calc((#{$popover-arrow-height} + #{$popover-border-width}) * -1);
  107. width: $popover-arrow-height;
  108. height: $popover-arrow-width;
  109. margin: $border-radius-lg 0; // make sure the arrow does not touch the popover's rounded corners
  110. }
  111. .arrow::before,
  112. .arrow::after {
  113. border-width: ($popover-arrow-width / 2) 0 ($popover-arrow-width / 2) $popover-arrow-height;
  114. }
  115. .arrow::before {
  116. right: 0;
  117. border-left-color: $popover-arrow-outer-color;
  118. }
  119. .arrow::after {
  120. right: $popover-border-width;
  121. border-left-color: $popover-arrow-color;
  122. }
  123. }
  124. .bs-popover-auto {
  125. &[x-placement^="top"] {
  126. @extend .bs-popover-top;
  127. }
  128. &[x-placement^="right"] {
  129. @extend .bs-popover-right;
  130. }
  131. &[x-placement^="bottom"] {
  132. @extend .bs-popover-bottom;
  133. }
  134. &[x-placement^="left"] {
  135. @extend .bs-popover-left;
  136. }
  137. }
  138. // Offset the popover to account for the popover arrow
  139. .popover-header {
  140. padding: $popover-header-padding-y $popover-header-padding-x;
  141. margin-bottom: 0; // Reset the default from Reboot
  142. font-size: $font-size-base;
  143. color: $popover-header-color;
  144. background-color: $popover-header-bg;
  145. border-bottom: $popover-border-width solid darken($popover-header-bg, 5%);
  146. $offset-border-width: calc(#{$border-radius-lg} - #{$popover-border-width});
  147. @include border-top-radius($offset-border-width);
  148. &:empty {
  149. display: none;
  150. }
  151. }
  152. .popover-body {
  153. padding: $popover-body-padding-y $popover-body-padding-x;
  154. color: $popover-body-color;
  155. }