0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-23 20:54:22 +01:00
Bootstrap/scss/forms/_form-select.scss
Mark Otto 7915584fa4 lol
2024-07-29 22:04:11 -07:00

89 lines
3.1 KiB
SCSS

@use "../functions";
@use "../mixins/border-radius";
@use "../mixins/box-shadow";
@use "../mixins/color-mode";
@use "../mixins/transition";
@use "../variables";
@use "../vendor/rfs";
// Select
//
// Replaces the browser default select with a custom one, mostly pulled from
// https://primer.github.io/.
.form-select {
--#{variables.$prefix}form-select-bg-img: #{functions.escape-svg(variables.$form-select-indicator)};
display: block;
width: 100%;
padding: variables.$form-select-padding-y variables.$form-select-indicator-padding variables.$form-select-padding-y variables.$form-select-padding-x;
font-family: variables.$form-select-font-family;
@include rfs.font-size(variables.$form-select-font-size);
font-weight: variables.$form-select-font-weight;
line-height: variables.$form-select-line-height;
color: variables.$form-select-color;
appearance: none;
background-color: variables.$form-select-bg;
background-image: var(--#{variables.$prefix}form-select-bg-img), var(--#{variables.$prefix}form-select-bg-icon, none);
background-repeat: no-repeat;
background-position: variables.$form-select-bg-position;
background-size: variables.$form-select-bg-size;
border: variables.$form-select-border-width solid variables.$form-select-border-color;
@include border-radius.border-radius(variables.$form-select-border-radius, 0);
@include box-shadow.box-shadow(variables.$form-select-box-shadow);
@include transition.transition(variables.$form-select-transition);
&:focus {
border-color: variables.$form-select-focus-border-color;
outline: 0;
@if variables.$enable-shadows {
@include box-shadow.box-shadow(variables.$form-select-box-shadow, variables.$form-select-focus-box-shadow);
} @else {
// Avoid using mixin so we can pass custom focus shadow properly
box-shadow: variables.$form-select-focus-box-shadow;
}
}
&[multiple],
&[size]:not([size="1"]) {
padding-right: variables.$form-select-padding-x;
background-image: none;
}
&:disabled {
color: variables.$form-select-disabled-color;
background-color: variables.$form-select-disabled-bg;
border-color: variables.$form-select-disabled-border-color;
}
// Remove outline from select box in FF
&:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 variables.$form-select-color;
}
}
.form-select-sm {
padding-top: variables.$form-select-padding-y-sm;
padding-bottom: variables.$form-select-padding-y-sm;
padding-left: variables.$form-select-padding-x-sm;
@include rfs.font-size(variables.$form-select-font-size-sm);
@include border-radius.border-radius(variables.$form-select-border-radius-sm);
}
.form-select-lg {
padding-top: variables.$form-select-padding-y-lg;
padding-bottom: variables.$form-select-padding-y-lg;
padding-left: variables.$form-select-padding-x-lg;
@include rfs.font-size(variables.$form-select-font-size-lg);
@include border-radius.border-radius(variables.$form-select-border-radius-lg);
}
@if variables.$enable-dark-mode {
@include color-mode.color-mode(dark) {
.form-select {
--#{variables.$prefix}form-select-bg-img: #{functions.escape-svg($form-select-indicator-dark)};
}
}
}