bootstrap/scss/_close.scss

69 lines
2.4 KiB
SCSS

@use "functions";
@use "mixins/border-radius";
@use "mixins/color-mode";
@use "setup/variables";
// Transparent background and border properties included for button version.
// iOS requires the button element instead of an anchor tag.
// If you want the anchor version, it requires `href="#"`.
// See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
.btn-close {
// scss-docs-start close-css-vars
--#{variables.$prefix}btn-close-color: #{variables.$btn-close-color};
--#{variables.$prefix}btn-close-bg: #{ functions.escape-svg(variables.$btn-close-bg) };
--#{variables.$prefix}btn-close-opacity: #{variables.$btn-close-opacity};
--#{variables.$prefix}btn-close-hover-opacity: #{variables.$btn-close-hover-opacity};
--#{variables.$prefix}btn-close-focus-shadow: #{variables.$btn-close-focus-shadow};
--#{variables.$prefix}btn-close-focus-opacity: #{variables.$btn-close-focus-opacity};
--#{variables.$prefix}btn-close-disabled-opacity: #{variables.$btn-close-disabled-opacity};
--#{variables.$prefix}btn-close-white-filter: #{variables.$btn-close-white-filter};
// scss-docs-end close-css-vars
box-sizing: content-box;
width: variables.$btn-close-width;
height: variables.$btn-close-height;
padding: variables.$btn-close-padding-y variables.$btn-close-padding-x;
color: var(--#{variables.$prefix}btn-close-color);
background: transparent var(--#{variables.$prefix}btn-close-bg) center / variables.$btn-close-width auto no-repeat; // include transparent for button elements
border: 0; // for button elements
@include border-radius.border-radius();
opacity: var(--#{variables.$prefix}btn-close-opacity);
// Override <a>'s hover style
&:hover {
color: var(--#{variables.$prefix}btn-close-color);
text-decoration: none;
opacity: var(--#{variables.$prefix}btn-close-hover-opacity);
}
&:focus {
outline: 0;
box-shadow: var(--#{variables.$prefix}btn-close-focus-shadow);
opacity: var(--#{variables.$prefix}btn-close-focus-opacity);
}
&:disabled,
&.disabled {
pointer-events: none;
user-select: none;
opacity: var(--#{variables.$prefix}btn-close-disabled-opacity);
}
}
@mixin btn-close-white() {
filter: var(--#{variables.$prefix}btn-close-white-filter);
}
.btn-close-white {
@include btn-close-white();
}
@if variables.$enable-dark-mode {
@include color-mode.color-mode(dark) {
.btn-close {
@include btn-close-white();
}
}
}