0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-23 20:54:22 +01:00
Bootstrap/scss/_popover.scss

203 lines
7.9 KiB
SCSS
Raw Normal View History

2024-07-29 22:04:11 -07:00
@use "mixins/border-radius";
@use "mixins/box-shadow";
@use "mixins/reset-text";
@use "variables";
@use "vendor/rfs";
2014-12-02 14:02:35 -08:00
.popover {
2021-09-08 20:18:22 -07:00
// scss-docs-start popover-css-vars
2024-07-29 22:04:11 -07:00
--#{variables.$prefix}popover-zindex: #{variables.$zindex-popover};
--#{variables.$prefix}popover-max-width: #{variables.$popover-max-width};
@include rfs.rfs(variables.$popover-font-size, --#{variables.$prefix}popover-font-size);
--#{variables.$prefix}popover-bg: #{variables.$popover-bg};
--#{variables.$prefix}popover-border-width: #{variables.$popover-border-width};
--#{variables.$prefix}popover-border-color: #{variables.$popover-border-color};
--#{variables.$prefix}popover-border-radius: #{variables.$popover-border-radius};
--#{variables.$prefix}popover-inner-border-radius: #{variables.$popover-inner-border-radius};
--#{variables.$prefix}popover-box-shadow: #{variables.$popover-box-shadow};
--#{variables.$prefix}popover-header-padding-x: #{variables.$popover-header-padding-x};
--#{variables.$prefix}popover-header-padding-y: #{variables.$popover-header-padding-y};
@include rfs.rfs(variables.$popover-header-font-size, --#{variables.$prefix}popover-header-font-size);
--#{variables.$prefix}popover-header-color: #{variables.$popover-header-color};
--#{variables.$prefix}popover-header-bg: #{variables.$popover-header-bg};
--#{variables.$prefix}popover-body-padding-x: #{variables.$popover-body-padding-x};
--#{variables.$prefix}popover-body-padding-y: #{variables.$popover-body-padding-y};
--#{variables.$prefix}popover-body-color: #{variables.$popover-body-color};
--#{variables.$prefix}popover-arrow-width: #{variables.$popover-arrow-width};
--#{variables.$prefix}popover-arrow-height: #{variables.$popover-arrow-height};
--#{variables.$prefix}popover-arrow-border: var(--#{variables.$prefix}popover-border-color);
2021-09-08 20:18:22 -07:00
// scss-docs-end popover-css-vars
2024-07-29 22:04:11 -07:00
z-index: var(--#{variables.$prefix}popover-zindex);
2015-05-12 14:28:11 -07:00
display: block;
2024-07-29 22:04:11 -07:00
max-width: var(--#{variables.$prefix}popover-max-width);
2015-06-18 23:56:43 -07:00
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
2024-07-29 22:04:11 -07:00
@include reset-text.reset-text();
@include rfs.font-size(var(--#{variables.$prefix}popover-font-size));
// Allow breaking very long words so they don't overflow the popover's bounds
word-wrap: break-word;
2024-07-29 22:04:11 -07:00
background-color: var(--#{variables.$prefix}popover-bg);
2014-12-02 14:02:35 -08:00
background-clip: padding-box;
2024-07-29 22:04:11 -07:00
border: var(--#{variables.$prefix}popover-border-width) solid var(--#{variables.$prefix}popover-border-color);
@include border-radius.border-radius(var(--#{variables.$prefix}popover-border-radius));
@include box-shadow.box-shadow(var(--#{variables.$prefix}popover-box-shadow));
2015-05-12 14:28:11 -07:00
2019-02-11 11:27:14 +01:00
.popover-arrow {
2017-05-23 14:17:07 +02:00
display: block;
2024-07-29 22:04:11 -07:00
width: var(--#{variables.$prefix}popover-arrow-width);
height: var(--#{variables.$prefix}popover-arrow-height);
2017-12-26 21:58:57 -08:00
&::before,
&::after {
position: absolute;
display: block;
content: "";
border-color: transparent;
border-style: solid;
2021-09-08 20:18:22 -07:00
border-width: 0;
2017-12-26 21:58:57 -08:00
}
}
}
.bs-popover-top {
2019-02-11 11:27:14 +01:00
> .popover-arrow {
2024-07-29 22:04:11 -07:00
bottom: calc(-1 * (var(--#{variables.$prefix}popover-arrow-height)) - var(--#{variables.$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
&::before,
&::after {
2024-07-29 22:04:11 -07:00
border-width: var(--#{variables.$prefix}popover-arrow-height) calc(var(--#{variables.$prefix}popover-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
}
2019-01-14 01:29:37 +01:00
&::before {
bottom: 0;
2024-07-29 22:04:11 -07:00
border-top-color: var(--#{variables.$prefix}popover-arrow-border);
2019-01-14 01:29:37 +01:00
}
2017-05-23 14:17:07 +02:00
2019-01-14 01:29:37 +01:00
&::after {
2024-07-29 22:04:11 -07:00
bottom: var(--#{variables.$prefix}popover-border-width);
border-top-color: var(--#{variables.$prefix}popover-bg);
2019-01-14 01:29:37 +01:00
}
2017-12-26 21:58:57 -08:00
}
}
2022-02-28 17:04:29 +01:00
/* rtl:begin:ignore */
.bs-popover-end {
2019-02-11 11:27:14 +01:00
> .popover-arrow {
2024-07-29 22:04:11 -07:00
left: calc(-1 * (var(--#{variables.$prefix}popover-arrow-height)) - var(--#{variables.$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
width: var(--#{variables.$prefix}popover-arrow-height);
height: var(--#{variables.$prefix}popover-arrow-width);
2021-09-08 20:18:22 -07:00
&::before,
&::after {
2024-07-29 22:04:11 -07:00
border-width: calc(var(--#{variables.$prefix}popover-arrow-width) * .5) var(--#{variables.$prefix}popover-arrow-height) calc(var(--#{variables.$prefix}popover-arrow-width) * .5) 0; // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
}
2015-05-12 14:28:11 -07:00
2019-01-14 01:29:37 +01:00
&::before {
2020-12-04 17:55:50 +02:00
left: 0;
2024-07-29 22:04:11 -07:00
border-right-color: var(--#{variables.$prefix}popover-arrow-border);
2019-01-14 01:29:37 +01:00
}
2017-05-23 14:17:07 +02:00
2019-01-14 01:29:37 +01:00
&::after {
2024-07-29 22:04:11 -07:00
left: var(--#{variables.$prefix}popover-border-width);
border-right-color: var(--#{variables.$prefix}popover-bg);
2019-01-14 01:29:37 +01:00
}
2017-12-26 21:58:57 -08:00
}
}
2022-02-28 17:04:29 +01:00
/* rtl:end:ignore */
2017-12-26 21:58:57 -08:00
.bs-popover-bottom {
2019-02-11 11:27:14 +01:00
> .popover-arrow {
2024-07-29 22:04:11 -07:00
top: calc(-1 * (var(--#{variables.$prefix}popover-arrow-height)) - var(--#{variables.$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
&::before,
&::after {
2024-07-29 22:04:11 -07:00
border-width: 0 calc(var(--#{variables.$prefix}popover-arrow-width) * .5) var(--#{variables.$prefix}popover-arrow-height); // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
}
2015-05-12 14:28:11 -07:00
2019-01-14 01:29:37 +01:00
&::before {
top: 0;
2024-07-29 22:04:11 -07:00
border-bottom-color: var(--#{variables.$prefix}popover-arrow-border);
2019-01-14 01:29:37 +01:00
}
2017-05-23 14:17:07 +02:00
2019-01-14 01:29:37 +01:00
&::after {
2024-07-29 22:04:11 -07:00
top: var(--#{variables.$prefix}popover-border-width);
border-bottom-color: var(--#{variables.$prefix}popover-bg);
2019-01-14 01:29:37 +01:00
}
2017-12-26 21:58:57 -08:00
}
2017-12-26 21:58:57 -08:00
// This will remove the popover-header's border just below the arrow
.popover-header::before {
position: absolute;
top: 0;
left: 50%;
display: block;
2024-07-29 22:04:11 -07:00
width: var(--#{variables.$prefix}popover-arrow-width);
margin-left: calc(-.5 * var(--#{variables.$prefix}popover-arrow-width)); // stylelint-disable-line function-disallowed-list
2017-12-26 21:58:57 -08:00
content: "";
2024-07-29 22:04:11 -07:00
border-bottom: var(--#{variables.$prefix}popover-border-width) solid var(--#{variables.$prefix}popover-header-bg);
2017-12-26 21:58:57 -08:00
}
}
2022-02-28 17:04:29 +01:00
/* rtl:begin:ignore */
.bs-popover-start {
2019-02-11 11:27:14 +01:00
> .popover-arrow {
2024-07-29 22:04:11 -07:00
right: calc(-1 * (var(--#{variables.$prefix}popover-arrow-height)) - var(--#{variables.$prefix}popover-border-width)); // stylelint-disable-line function-disallowed-list
width: var(--#{variables.$prefix}popover-arrow-height);
height: var(--#{variables.$prefix}popover-arrow-width);
2021-09-08 20:18:22 -07:00
&::before,
&::after {
2024-07-29 22:04:11 -07:00
border-width: calc(var(--#{variables.$prefix}popover-arrow-width) * .5) 0 calc(var(--#{variables.$prefix}popover-arrow-width) * .5) var(--#{variables.$prefix}popover-arrow-height); // stylelint-disable-line function-disallowed-list
2021-09-08 20:18:22 -07:00
}
2017-05-23 14:17:07 +02:00
2019-01-14 01:29:37 +01:00
&::before {
2020-12-04 17:55:50 +02:00
right: 0;
2024-07-29 22:04:11 -07:00
border-left-color: var(--#{variables.$prefix}popover-arrow-border);
2019-01-14 01:29:37 +01:00
}
2019-01-14 01:29:37 +01:00
&::after {
2024-07-29 22:04:11 -07:00
right: var(--#{variables.$prefix}popover-border-width);
border-left-color: var(--#{variables.$prefix}popover-bg);
2019-01-14 01:29:37 +01:00
}
2017-12-26 21:58:57 -08:00
}
}
2022-02-28 17:04:29 +01:00
/* rtl:end:ignore */
2017-12-26 21:58:57 -08:00
.bs-popover-auto {
2020-06-19 11:17:01 +03:00
&[data-popper-placement^="top"] {
2017-12-26 21:58:57 -08:00
@extend .bs-popover-top;
}
2020-06-19 11:17:01 +03:00
&[data-popper-placement^="right"] {
@extend .bs-popover-end;
2017-12-26 21:58:57 -08:00
}
2020-06-19 11:17:01 +03:00
&[data-popper-placement^="bottom"] {
2017-12-26 21:58:57 -08:00
@extend .bs-popover-bottom;
}
2020-06-19 11:17:01 +03:00
&[data-popper-placement^="left"] {
@extend .bs-popover-start;
2017-05-24 14:09:36 +02:00
}
2014-12-02 14:02:35 -08:00
}
2015-05-12 14:28:11 -07:00
// Offset the popover to account for the popover arrow
.popover-header {
2024-07-29 22:04:11 -07:00
padding: var(--#{variables.$prefix}popover-header-padding-y) var(--#{variables.$prefix}popover-header-padding-x);
margin-bottom: 0; // Reset the default from Reboot
2024-07-29 22:04:11 -07:00
@include rfs.font-size(var(--#{variables.$prefix}popover-header-font-size));
color: var(--#{variables.$prefix}popover-header-color);
background-color: var(--#{variables.$prefix}popover-header-bg);
border-bottom: var(--#{variables.$prefix}popover-border-width) solid var(--#{variables.$prefix}popover-border-color);
@include border-radius.border-top-radius(var(--#{variables.$prefix}popover-inner-border-radius));
&:empty {
display: none;
}
2014-12-02 14:02:35 -08:00
}
.popover-body {
2024-07-29 22:04:11 -07:00
padding: var(--#{variables.$prefix}popover-body-padding-y) var(--#{variables.$prefix}popover-body-padding-x);
color: var(--#{variables.$prefix}popover-body-color);
2014-12-02 14:02:35 -08:00
}