2017-10-02 23:34:56 -04:00
|
|
|
// stylelint-disable selector-no-qualifying-type
|
|
|
|
|
2015-04-18 14:38:47 -04:00
|
|
|
//
|
2013-07-27 21:56:31 -04:00
|
|
|
// Base styles
|
2015-04-18 14:38:47 -04:00
|
|
|
//
|
|
|
|
|
2013-07-27 21:56:31 -04:00
|
|
|
.input-group {
|
2015-04-27 04:43:30 -04:00
|
|
|
position: relative;
|
2016-12-21 23:26:17 -05:00
|
|
|
display: flex;
|
2017-12-22 18:29:49 -05:00
|
|
|
flex-wrap: wrap; // For form validation feedback
|
2017-10-02 13:13:09 -04:00
|
|
|
align-items: stretch;
|
2015-12-09 03:40:32 -05:00
|
|
|
width: 100%;
|
2015-04-27 04:43:30 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.form-control,
|
|
|
|
.custom-select,
|
|
|
|
.custom-file {
|
|
|
|
position: relative; // For focus state's z-index
|
2016-12-21 23:26:17 -05:00
|
|
|
flex: 1 1 auto;
|
|
|
|
// Add width 1% and flex-basis auto to ensure that button will not wrap out
|
2016-12-22 16:25:41 -05:00
|
|
|
// the column. Applies to IE Edge+ and Firefox. Chrome does not require this.
|
2016-12-21 23:26:17 -05:00
|
|
|
width: 1%;
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Bring the "active" form control to the top of surrounding elements
|
|
|
|
&:focus {
|
|
|
|
z-index: 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ .form-control {
|
|
|
|
margin-left: -$input-border-width;
|
2015-11-15 17:09:12 -05:00
|
|
|
}
|
2013-07-27 21:56:31 -04:00
|
|
|
}
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.form-control,
|
|
|
|
.custom-select {
|
|
|
|
&:not(:first-child):not(:last-of-type) { @include border-radius(0); }
|
|
|
|
&:first-child { @include border-right-radius(0); }
|
|
|
|
&:last-of-type:not(:first-child) { @include border-left-radius(0); }
|
|
|
|
}
|
2017-10-19 16:04:39 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Custom file inputs have more complex markup, thus requiring different
|
|
|
|
// border-radius overrides.
|
|
|
|
.custom-file {
|
2017-12-22 19:49:57 -05:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
&:not(:first-child):not(:last-of-type) .custom-file-control,
|
|
|
|
&:not(:first-child):not(:last-of-type) .custom-file-control::before { @include border-radius(0); }
|
|
|
|
&:first-child .custom-file-control,
|
|
|
|
&:first-child .custom-file-control::before { @include border-right-radius(0); }
|
|
|
|
&:last-of-type:not(:first-child) .custom-file-control,
|
|
|
|
&:last-of-type:not(:first-child) .custom-file-control::before { @include border-left-radius(0); }
|
2015-04-18 14:38:47 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
|
|
|
|
// Prepend and append
|
|
|
|
//
|
|
|
|
// While it requires one extra layer of HTML for each, dedicated prepend and
|
|
|
|
// append elements allow us to 1) be less clever, 2) simplify our selectors, and
|
|
|
|
// 3) support HTML5 form validation.
|
|
|
|
|
|
|
|
.input-group-prepend,
|
|
|
|
.input-group-append {
|
2017-10-19 16:04:39 -04:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Ensure buttons are always above inputs for more visually pleasing borders.
|
|
|
|
// This isn't needed for `.input-group-text` since it shares the same border-color
|
|
|
|
// as our inputs.
|
|
|
|
.btn {
|
|
|
|
position: relative;
|
|
|
|
z-index: 2;
|
|
|
|
}
|
2017-10-19 16:04:39 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.btn + .btn,
|
|
|
|
.btn + .input-group-text,
|
|
|
|
.input-group-text + .input-group-text,
|
|
|
|
.input-group-text + .btn {
|
|
|
|
margin-left: -$input-border-width;
|
|
|
|
}
|
2015-04-18 14:38:47 -04:00
|
|
|
}
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.input-group-prepend { margin-right: -$input-border-width; }
|
|
|
|
.input-group-append { margin-left: -$input-border-width; }
|
2013-08-12 17:03:57 -04:00
|
|
|
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Textual addons
|
2015-04-18 14:38:47 -04:00
|
|
|
//
|
2017-12-22 18:29:49 -05:00
|
|
|
// Serves as a catch-all element for any text or radio/checkbox input you wish
|
|
|
|
// to prepend or append to an input.
|
2015-04-18 14:38:47 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.input-group-text {
|
2017-10-19 03:05:07 -04:00
|
|
|
padding: $input-padding-y $input-padding-x;
|
2016-01-23 06:30:21 -05:00
|
|
|
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom
|
2017-01-03 16:51:06 -05:00
|
|
|
font-size: $font-size-base; // Match inputs
|
2016-10-19 15:41:27 -04:00
|
|
|
font-weight: $font-weight-normal;
|
2017-10-19 03:05:07 -04:00
|
|
|
line-height: $input-line-height;
|
2017-07-13 14:11:37 -04:00
|
|
|
color: $input-group-addon-color;
|
2013-07-27 21:56:31 -04:00
|
|
|
text-align: center;
|
2017-12-22 18:29:49 -05:00
|
|
|
white-space: nowrap;
|
2014-12-02 17:02:35 -05:00
|
|
|
background-color: $input-group-addon-bg;
|
2017-10-19 03:05:07 -04:00
|
|
|
border: $input-border-width solid $input-group-addon-border-color;
|
2016-07-28 00:12:44 -04:00
|
|
|
@include border-radius($input-border-radius);
|
2013-07-27 21:56:31 -04:00
|
|
|
|
|
|
|
// Nuke default margins from checkboxes and radios to vertically center within.
|
|
|
|
input[type="radio"],
|
|
|
|
input[type="checkbox"] {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-18 14:38:47 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Sizing
|
2015-04-18 14:38:47 -04:00
|
|
|
//
|
2017-12-22 18:29:49 -05:00
|
|
|
// Remix the default form control sizing classes into new ones for easier
|
|
|
|
// manipulation.
|
2017-10-19 16:04:39 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.input-group-lg > .form-control,
|
|
|
|
.input-group-lg > .input-group-prepend > .input-group-text,
|
|
|
|
.input-group-lg > .input-group-append > .input-group-text,
|
|
|
|
.input-group-lg > .input-group-prepend > .btn,
|
|
|
|
.input-group-lg > .input-group-append > .btn {
|
|
|
|
@extend .form-control-lg;
|
2013-07-27 21:56:31 -04:00
|
|
|
}
|
2017-10-19 16:04:39 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.input-group-sm > .form-control,
|
|
|
|
.input-group-sm > .input-group-prepend > .input-group-text,
|
|
|
|
.input-group-sm > .input-group-append > .input-group-text,
|
|
|
|
.input-group-sm > .input-group-prepend > .btn,
|
|
|
|
.input-group-sm > .input-group-append > .btn {
|
|
|
|
@extend .form-control-sm;
|
2013-07-27 21:56:31 -04:00
|
|
|
}
|
2017-10-19 16:04:39 -04:00
|
|
|
|
2013-07-27 21:56:31 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// Prepend and append rounded corners
|
2015-04-18 14:38:47 -04:00
|
|
|
//
|
2017-12-22 18:29:49 -05:00
|
|
|
// These rulesets must come after the sizing ones to properly override sm and lg
|
|
|
|
// border-radius values when extending. They're more specific than we'd like
|
|
|
|
// with the `.input-group >` part, but without it, we cannot override the sizing.
|
2016-10-27 16:40:55 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.input-group > .input-group-prepend > .btn,
|
|
|
|
.input-group > .input-group-prepend > .input-group-text {
|
|
|
|
// All prepended buttons have no right border-radius
|
|
|
|
@include border-right-radius(0);
|
2016-10-27 16:40:55 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
+ .btn,
|
|
|
|
+ .input-group-text {
|
|
|
|
@include border-left-radius(0);
|
2013-07-27 21:56:31 -04:00
|
|
|
}
|
2017-12-22 18:29:49 -05:00
|
|
|
}
|
2013-09-06 12:50:38 -04:00
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
// We separate out the button and input resets here because `.input-group-text`
|
|
|
|
// can be any HTML element, but buttons are always inputs, buttons, or anchors.
|
|
|
|
.input-group > .input-group-append {
|
|
|
|
// Everything but the last one have no rounded corners
|
|
|
|
.btn:not(:last-of-type),
|
|
|
|
.input-group-text:not(:last-child) {
|
|
|
|
@include border-radius(0);
|
2017-05-02 14:03:14 -04:00
|
|
|
}
|
|
|
|
|
2017-12-22 18:29:49 -05:00
|
|
|
.btn:last-of-type,
|
|
|
|
.input-group-text:last-child {
|
|
|
|
@include border-left-radius(0);
|
2013-09-06 12:50:38 -04:00
|
|
|
}
|
2013-07-27 21:56:31 -04:00
|
|
|
}
|