diff options
| author | Mark Otto <[email protected]> | 2015-08-08 14:15:09 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2015-08-08 14:15:09 -0700 |
| commit | 7c3f5b6d59a3479c92cd85b2a1f72a3c6a346743 (patch) | |
| tree | 10731da83d2407efc7131c1e41bc19ddcd5e1ee4 /scss/_forms.scss | |
| parent | 14d8c295964857f14ad3d5bb98f24f8274296a05 (diff) | |
| download | bootstrap-7c3f5b6d59a3479c92cd85b2a1f72a3c6a346743.tar.xz bootstrap-7c3f5b6d59a3479c92cd85b2a1f72a3c6a346743.zip | |
rewrite some forms docs, use new validation styles and icons
Diffstat (limited to 'scss/_forms.scss')
| -rw-r--r-- | scss/_forms.scss | 150 |
1 files changed, 104 insertions, 46 deletions
diff --git a/scss/_forms.scss b/scss/_forms.scss index c2cd7733a..79ca97c3f 100644 --- a/scss/_forms.scss +++ b/scss/_forms.scss @@ -267,64 +267,122 @@ input[type="checkbox"] { // // Apply contextual and semantic states to individual form controls. -.has-feedback { - // Enable absolute positioning - position: relative; - - // Ensure icons don't overlap text - .form-control { - padding-right: ($input-height * 1.25); - } -} -// Feedback icon -.form-control-feedback { - position: absolute; - top: 0; - right: 0; - z-index: 2; // Ensure icon is above input groups - display: block; - width: $input-height; - height: $input-height; - line-height: $input-height; - text-align: center; - pointer-events: none; -} -.input-lg + .form-control-feedback, -.input-group-lg + .form-control-feedback { - width: $input-height-lg; - height: $input-height-lg; - line-height: $input-height-lg; -} -.input-sm + .form-control-feedback, -.input-group-sm + .form-control-feedback { - width: $input-height-sm; - height: $input-height-sm; - line-height: $input-height-sm; +$form-icon-success: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkNoZWNrIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsa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, +.form-control-error { + padding-right: ($padding-x * 3); + background-position: center right ($input-height * .25); + background-size: ($input-height * .65) ($input-height * .65); + background-repeat: no-repeat; } // Form validation states .has-success { - @include form-control-validation($state-success-text, $state-success-text, $state-success-bg); + @include form-control-validation(success, $brand-success); + + .form-control-success { + background-image: url($form-icon-success); + } } + .has-warning { - @include form-control-validation($state-warning-text, $state-warning-text, $state-warning-bg); + @include form-control-validation(warning, $brand-warning); + + .form-control-warning { + background-image: url($form-icon-warning); + } } + .has-error { - @include form-control-validation($state-danger-text, $state-danger-text, $state-danger-bg); + @include form-control-validation(error, $brand-danger); + + .form-control-error { + background-image: url($form-icon-error); + } } -// Reposition feedback icon if input has visible label above -.has-feedback label { - ~ .form-control-feedback { - // TODO: redo this since we nuked the `$line-height-computed` - top: 0; // Height of the `label` and its margin - } - &.sr-only ~ .form-control-feedback { - top: 0; - } -} + +// .form-control-success { +// background-image: url("#{$form-icon-success}"); +// border-color: $brand-success; +// } +// +// .form-control-warning { +// background-image: url("#{$form-icon-warning}"); +// border-color: $brand-warning; +// } +// +// .form-control-error { +// background-image: url("#{$form-icon-danger}"); +// border-color: $brand-danger; +// } + + +// .has-feedback { +// // Enable absolute positioning +// position: relative; +// +// // Ensure icons don't overlap text +// .form-control { +// padding-right: ($input-height * 1.25); +// } +// } +// // Feedback icon +// .form-control-feedback { +// position: absolute; +// top: 0; +// right: 0; +// z-index: 2; // Ensure icon is above input groups +// display: block; +// width: $input-height; +// height: $input-height; +// line-height: $input-height; +// text-align: center; +// pointer-events: none; +// } +// .input-lg + .form-control-feedback, +// .input-group-lg + .form-control-feedback { +// width: $input-height-lg; +// height: $input-height-lg; +// line-height: $input-height-lg; +// } +// .input-sm + .form-control-feedback, +// .input-group-sm + .form-control-feedback { +// width: $input-height-sm; +// height: $input-height-sm; +// line-height: $input-height-sm; +// } +// +// // Form validation states +// .has-success { +// @include form-control-validation($state-success-text, $state-success-text, $state-success-bg); +// } +// .has-warning { +// @include form-control-validation($state-warning-text, $state-warning-text, $state-warning-bg); +// } +// .has-error { +// @include form-control-validation($state-danger-text, $state-danger-text, $state-danger-bg); +// } +// +// // Reposition feedback icon if input has visible label above +// .has-feedback label { +// +// ~ .form-control-feedback { +// // TODO: redo this since we nuked the `$line-height-computed` +// top: 0; // Height of the `label` and its margin +// } +// +// &.sr-only ~ .form-control-feedback { +// top: 0; +// } +// } // Help text |
