2017-10-03 11:34:56 +08:00
|
|
|
// stylelint-disable selector-no-qualifying-type
|
|
|
|
|
2015-04-19 02:38:47 +08:00
|
|
|
//
|
2013-07-28 09:56:31 +08:00
|
|
|
// Base styles
|
2015-04-19 02:38:47 +08:00
|
|
|
//
|
|
|
|
|
2013-07-28 09:56:31 +08:00
|
|
|
.input-group {
|
2015-04-27 16:43:30 +08:00
|
|
|
position: relative;
|
2016-12-22 12:26:17 +08:00
|
|
|
display: flex;
|
2017-12-23 07:29:49 +08:00
|
|
|
flex-wrap: wrap; // For form validation feedback
|
2017-10-03 01:13:09 +08:00
|
|
|
align-items: stretch;
|
2015-12-09 16:40:32 +08:00
|
|
|
width: 100%;
|
2015-04-27 16:43:30 +08:00
|
|
|
|
2018-01-13 15:40:55 +08:00
|
|
|
> .form-control,
|
2018-10-23 10:53:38 +08:00
|
|
|
> .form-control-plaintext,
|
2018-01-13 15:40:55 +08:00
|
|
|
> .custom-select,
|
|
|
|
> .custom-file {
|
2017-12-23 07:29:49 +08:00
|
|
|
position: relative; // For focus state's z-index
|
2016-12-22 12:26:17 +08:00
|
|
|
flex: 1 1 auto;
|
|
|
|
// Add width 1% and flex-basis auto to ensure that button will not wrap out
|
2016-12-23 05:25:41 +08:00
|
|
|
// the column. Applies to IE Edge+ and Firefox. Chrome does not require this.
|
2016-12-22 12:26:17 +08:00
|
|
|
width: 1%;
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
2018-01-03 03:20:09 +08:00
|
|
|
+ .form-control,
|
|
|
|
+ .custom-select,
|
|
|
|
+ .custom-file {
|
2017-12-23 07:29:49 +08:00
|
|
|
margin-left: -$input-border-width;
|
2015-11-16 06:09:12 +08:00
|
|
|
}
|
2013-07-28 09:56:31 +08:00
|
|
|
}
|
|
|
|
|
2018-05-07 16:30:43 +08:00
|
|
|
// Bring the "active" form control to the top of surrounding elements
|
|
|
|
> .form-control:focus,
|
|
|
|
> .custom-select:focus,
|
|
|
|
> .custom-file .custom-file-input:focus ~ .custom-file-label {
|
|
|
|
z-index: 3;
|
|
|
|
}
|
|
|
|
|
2018-07-18 23:37:32 +08:00
|
|
|
// Bring the custom file input above the label
|
|
|
|
> .custom-file .custom-file-input:focus {
|
|
|
|
z-index: 4;
|
|
|
|
}
|
|
|
|
|
2018-01-13 15:40:55 +08:00
|
|
|
> .form-control,
|
|
|
|
> .custom-select {
|
2017-12-27 06:23:07 +08:00
|
|
|
&:not(:last-child) { @include border-right-radius(0); }
|
|
|
|
&:not(:first-child) { @include border-left-radius(0); }
|
2017-12-23 07:29:49 +08:00
|
|
|
}
|
2017-10-20 04:04:39 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
// Custom file inputs have more complex markup, thus requiring different
|
|
|
|
// border-radius overrides.
|
2018-01-13 15:40:55 +08:00
|
|
|
> .custom-file {
|
2017-12-23 08:49:57 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
2017-12-29 13:10:29 +08:00
|
|
|
&:not(:last-child) .custom-file-label,
|
2018-02-12 07:09:05 +08:00
|
|
|
&:not(:last-child) .custom-file-label::after { @include border-right-radius(0); }
|
2018-04-24 12:55:10 +08:00
|
|
|
&:not(:first-child) .custom-file-label { @include border-left-radius(0); }
|
2015-04-19 02:38:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-23 07:29:49 +08: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-20 04:04:39 +08:00
|
|
|
display: flex;
|
|
|
|
|
2017-12-23 07:29:49 +08: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;
|
2018-09-18 20:29:02 +08:00
|
|
|
|
|
|
|
&:focus {
|
|
|
|
z-index: 3;
|
|
|
|
}
|
2017-12-23 07:29:49 +08:00
|
|
|
}
|
2017-10-20 04:04:39 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.btn + .btn,
|
|
|
|
.btn + .input-group-text,
|
|
|
|
.input-group-text + .input-group-text,
|
|
|
|
.input-group-text + .btn {
|
|
|
|
margin-left: -$input-border-width;
|
|
|
|
}
|
2015-04-19 02:38:47 +08:00
|
|
|
}
|
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.input-group-prepend { margin-right: -$input-border-width; }
|
|
|
|
.input-group-append { margin-left: -$input-border-width; }
|
2013-08-13 05:03:57 +08:00
|
|
|
|
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
// Textual addons
|
2015-04-19 02:38:47 +08:00
|
|
|
//
|
2017-12-23 07:29:49 +08: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-19 02:38:47 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.input-group-text {
|
2017-12-31 22:38:29 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2017-10-19 15:05:07 +08:00
|
|
|
padding: $input-padding-y $input-padding-x;
|
2016-01-23 19:30:21 +08:00
|
|
|
margin-bottom: 0; // Allow use of <label> elements by overriding our default margin-bottom
|
2017-01-04 05:51:06 +08:00
|
|
|
font-size: $font-size-base; // Match inputs
|
2016-10-20 03:41:27 +08:00
|
|
|
font-weight: $font-weight-normal;
|
2017-10-19 15:05:07 +08:00
|
|
|
line-height: $input-line-height;
|
2017-07-14 02:11:37 +08:00
|
|
|
color: $input-group-addon-color;
|
2013-07-28 09:56:31 +08:00
|
|
|
text-align: center;
|
2017-12-23 07:29:49 +08:00
|
|
|
white-space: nowrap;
|
2014-12-03 06:02:35 +08:00
|
|
|
background-color: $input-group-addon-bg;
|
2017-10-19 15:05:07 +08:00
|
|
|
border: $input-border-width solid $input-group-addon-border-color;
|
2016-07-28 12:12:44 +08:00
|
|
|
@include border-radius($input-border-radius);
|
2013-07-28 09:56:31 +08:00
|
|
|
|
|
|
|
// Nuke default margins from checkboxes and radios to vertically center within.
|
|
|
|
input[type="radio"],
|
|
|
|
input[type="checkbox"] {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-19 02:38:47 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
// Sizing
|
2015-04-19 02:38:47 +08:00
|
|
|
//
|
2017-12-23 07:29:49 +08:00
|
|
|
// Remix the default form control sizing classes into new ones for easier
|
|
|
|
// manipulation.
|
2017-10-20 04:04:39 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.input-group-lg > .form-control,
|
2018-11-17 20:10:38 +08:00
|
|
|
.input-group-lg > .custom-select,
|
2017-12-23 07:29:49 +08:00
|
|
|
.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 {
|
2018-07-16 05:00:23 +08:00
|
|
|
height: $input-height-lg;
|
|
|
|
padding: $input-padding-y-lg $input-padding-x-lg;
|
2018-11-14 04:11:59 +08:00
|
|
|
font-size: $input-font-size-lg;
|
2018-07-16 05:00:23 +08:00
|
|
|
line-height: $input-line-height-lg;
|
|
|
|
@include border-radius($input-border-radius-lg);
|
2013-07-28 09:56:31 +08:00
|
|
|
}
|
2017-10-20 04:04:39 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.input-group-sm > .form-control,
|
2018-11-17 20:10:38 +08:00
|
|
|
.input-group-sm > .custom-select,
|
2017-12-23 07:29:49 +08:00
|
|
|
.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 {
|
2018-07-16 05:00:23 +08:00
|
|
|
height: $input-height-sm;
|
|
|
|
padding: $input-padding-y-sm $input-padding-x-sm;
|
2018-11-14 04:11:59 +08:00
|
|
|
font-size: $input-font-size-sm;
|
2018-07-16 05:00:23 +08:00
|
|
|
line-height: $input-line-height-sm;
|
|
|
|
@include border-radius($input-border-radius-sm);
|
2013-07-28 09:56:31 +08:00
|
|
|
}
|
2017-10-20 04:04:39 +08:00
|
|
|
|
2018-11-17 20:10:38 +08:00
|
|
|
.input-group-lg > .custom-select,
|
|
|
|
.input-group-sm > .custom-select {
|
|
|
|
padding-right: ($custom-select-padding-x + $custom-select-indicator-padding);
|
|
|
|
}
|
|
|
|
|
2013-07-28 09:56:31 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
// Prepend and append rounded corners
|
2015-04-19 02:38:47 +08:00
|
|
|
//
|
2017-12-23 07:29:49 +08: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-28 04:40:55 +08:00
|
|
|
|
2017-12-27 06:23:07 +08:00
|
|
|
|
2017-12-23 07:29:49 +08:00
|
|
|
.input-group > .input-group-prepend > .btn,
|
2017-12-27 06:23:07 +08:00
|
|
|
.input-group > .input-group-prepend > .input-group-text,
|
|
|
|
.input-group > .input-group-append:not(:last-child) > .btn,
|
|
|
|
.input-group > .input-group-append:not(:last-child) > .input-group-text,
|
|
|
|
.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle),
|
|
|
|
.input-group > .input-group-append:last-child > .input-group-text:not(:last-child) {
|
2017-12-23 07:29:49 +08:00
|
|
|
@include border-right-radius(0);
|
|
|
|
}
|
2013-09-07 00:50:38 +08:00
|
|
|
|
2017-12-27 06:23:07 +08:00
|
|
|
.input-group > .input-group-append > .btn,
|
|
|
|
.input-group > .input-group-append > .input-group-text,
|
|
|
|
.input-group > .input-group-prepend:not(:first-child) > .btn,
|
|
|
|
.input-group > .input-group-prepend:not(:first-child) > .input-group-text,
|
|
|
|
.input-group > .input-group-prepend:first-child > .btn:not(:first-child),
|
|
|
|
.input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) {
|
|
|
|
@include border-left-radius(0);
|
2013-07-28 09:56:31 +08:00
|
|
|
}
|