diff options
| author | Mark Otto <[email protected]> | 2017-12-26 22:28:14 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2017-12-26 22:28:14 -0800 |
| commit | cf5e99e1726aeff5686aad5ab5ceda98d6b302c2 (patch) | |
| tree | b10baca28c68e208d1df35c8622bc80895e05860 /scss | |
| parent | 6fd11a6169a851bd8357a2a5036a959163ea37e9 (diff) | |
| parent | b01e81ed36493fc687250643395e2d5c55b07e28 (diff) | |
| download | bootstrap-cf5e99e1726aeff5686aad5ab5ceda98d6b302c2.tar.xz bootstrap-cf5e99e1726aeff5686aad5ab5ceda98d6b302c2.zip | |
Merge branch 'v4-dev' of https://github.com/twbs/bootstrap into v4-dev
Diffstat (limited to 'scss')
| -rw-r--r-- | scss/_button-group.scss | 70 | ||||
| -rw-r--r-- | scss/_custom-forms.scss | 42 | ||||
| -rw-r--r-- | scss/_input-group.scss | 48 | ||||
| -rw-r--r-- | scss/_variables.scss | 7 | ||||
| -rw-r--r-- | scss/mixins/_forms.scss | 17 |
5 files changed, 66 insertions, 118 deletions
diff --git a/scss/_button-group.scss b/scss/_button-group.scss index 83234f948..c1b826536 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -44,46 +44,18 @@ } .btn-group { - > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { - border-radius: 0; - } - - // Set corners individual because sometimes a single button can be in a .btn-group - // and we need :first-child and :last-child to both match > .btn:first-child { margin-left: 0; - - &:not(:last-child):not(.dropdown-toggle) { - @include border-right-radius(0); - } - } - - - // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu - // immediately after it - > .btn:last-child:not(:first-child), - > .dropdown-toggle:not(:first-child) { - @include border-left-radius(0); - } - - // Custom edits for including btn-groups within btn-groups (useful for including - // dropdown buttons within a btn-group) - > .btn-group { - float: left; - } - - > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; } - > .btn-group:first-child:not(:last-child) { - > .btn:last-child, - > .dropdown-toggle { - @include border-right-radius(0); - } + // Reset rounded corners + > .btn:not(:last-child):not(.dropdown-toggle), + > .btn-group:not(:last-child) > .btn { + @include border-right-radius(0); } - > .btn-group:last-child:not(:first-child) > .btn:first-child { + > .btn:not(:first-child), + > .btn-group:not(:first-child) > .btn { @include border-left-radius(0); } } @@ -154,32 +126,14 @@ margin-left: 0; } - > .btn { - &:not(:first-child):not(:last-child) { - border-radius: 0; - } - - &:first-child:not(:last-child) { - @include border-bottom-radius(0); - } - - &:last-child:not(:first-child) { - @include border-top-radius(0); - } - } - - > .btn-group:not(:first-child):not(:last-child) > .btn { - border-radius: 0; - } - - > .btn-group:first-child:not(:last-child) { - > .btn:last-child, - > .dropdown-toggle { - @include border-bottom-radius(0); - } + // Reset rounded corners + > .btn:not(:last-child):not(.dropdown-toggle), + > .btn-group:not(:last-child) > .btn { + @include border-bottom-radius(0); } - > .btn-group:last-child:not(:first-child) > .btn:first-child { + > .btn:not(:first-child), + > .btn-group:not(:first-child) > .btn { @include border-top-radius(0); } } diff --git a/scss/_custom-forms.scss b/scss/_custom-forms.scss index 56093bc48..d99a86dc7 100644 --- a/scss/_custom-forms.scss +++ b/scss/_custom-forms.scss @@ -225,7 +225,9 @@ } .custom-file-input { - max-width: 100%; + position: relative; + z-index: 2; + width: 100%; height: $custom-file-height; margin: 0; opacity: 0; @@ -238,49 +240,43 @@ border-color: $custom-file-focus-border-color; } } + + @each $lang, $value in $custom-file-text { + &:lang(#{$lang}) ~ .custom-file-label::after { + content: $value; + } + } } -.custom-file-control { +.custom-file-label { position: absolute; top: 0; right: 0; left: 0; + z-index: 1; height: $custom-file-height; padding: $custom-file-padding-y $custom-file-padding-x; line-height: $custom-file-line-height; color: $custom-file-color; - pointer-events: none; - user-select: none; background-color: $custom-file-bg; border: $custom-file-border-width solid $custom-file-border-color; @include border-radius($custom-file-border-radius); @include box-shadow($custom-file-box-shadow); - @each $lang, $text in map-get($custom-file-text, placeholder) { - &:lang(#{$lang}):empty::after { - content: $text; - } - } - - &::before { + &::after { position: absolute; - top: -$custom-file-border-width; - right: -$custom-file-border-width; - bottom: -$custom-file-border-width; - z-index: 1; + top: 0; + right: 0; + bottom: 0; + z-index: 3; display: block; - height: $custom-file-height; + height: calc(#{$custom-file-height} - #{$custom-file-border-width} * 2); padding: $custom-file-padding-y $custom-file-padding-x; line-height: $custom-file-line-height; color: $custom-file-button-color; + content: "Browse"; @include gradient-bg($custom-file-button-bg); - border: $custom-file-border-width solid $custom-file-border-color; + border-left: $custom-file-border-width solid $custom-file-border-color; @include border-radius(0 $custom-file-border-radius $custom-file-border-radius 0); } - - @each $lang, $text in map-get($custom-file-text, button-label) { - &:lang(#{$lang})::before { - content: $text; - } - } } diff --git a/scss/_input-group.scss b/scss/_input-group.scss index f1d3c9dea..7ef0267cc 100644 --- a/scss/_input-group.scss +++ b/scss/_input-group.scss @@ -33,9 +33,8 @@ .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); } + &:not(:last-child) { @include border-right-radius(0); } + &:not(:first-child) { @include border-left-radius(0); } } // Custom file inputs have more complex markup, thus requiring different @@ -44,12 +43,10 @@ display: flex; align-items: center; - &: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); } + &:not(:last-child) .custom-file-control, + &:not(:last-child) .custom-file-control::before { @include border-right-radius(0); } + &:not(:first-child) .custom-file-control, + &:not(:first-child) .custom-file-control::before { @include border-left-radius(0); } } } @@ -139,28 +136,21 @@ // 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. + .input-group > .input-group-prepend > .btn, -.input-group > .input-group-prepend > .input-group-text { - // All prepended buttons have no right border-radius +.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) { @include border-right-radius(0); - - + .btn, - + .input-group-text { - @include border-left-radius(0); - } } -// 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); - } - - .btn:last-of-type, - .input-group-text:last-child { - @include border-left-radius(0); - } +.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); } diff --git a/scss/_variables.scss b/scss/_variables.scss index b9d963e74..1c6ca3abb 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -509,12 +509,7 @@ $custom-file-box-shadow: $input-box-shadow !default; $custom-file-button-color: $custom-file-color !default; $custom-file-button-bg: $input-group-addon-bg !default; $custom-file-text: ( - placeholder: ( - en: "Choose file..." - ), - button-label: ( - en: "Browse" - ) + en: "Browse" ) !default; diff --git a/scss/mixins/_forms.scss b/scss/mixins/_forms.scss index ba1b16d6a..d25df182d 100644 --- a/scss/mixins/_forms.scss +++ b/scss/mixins/_forms.scss @@ -88,11 +88,18 @@ background-color: lighten($color, 25%); } } + + ~ .#{$state}-feedback, + ~ .#{$state}-tooltip { + display: block; + } + &:checked { ~ .custom-control-label::before { @include gradient-bg(lighten($color, 10%)); } } + &:focus { ~ .custom-control-label::before { box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-focus-width rgba($color, .25); @@ -105,13 +112,19 @@ .custom-file-input { .was-validated &:#{$state}, &.is-#{$state} { - ~ .custom-file-control { + ~ .custom-file-label { border-color: $color; &::before { border-color: inherit; } } + + ~ .#{$state}-feedback, + ~ .#{$state}-tooltip { + display: block; + } + &:focus { - ~ .custom-file-control { + ~ .custom-file-label { box-shadow: 0 0 0 $input-focus-width rgba($color, .25); } } |
