You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
6.7 KiB

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