_forms.scss 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @mixin form-control-validation($color) {
  2. // Color the label and help text
  3. .text-help,
  4. .form-control-label,
  5. .radio,
  6. .checkbox,
  7. .radio-inline,
  8. .checkbox-inline,
  9. &.radio label,
  10. &.checkbox label,
  11. &.radio-inline label,
  12. &.checkbox-inline label,
  13. .custom-control {
  14. color: $color;
  15. }
  16. .form-control {
  17. border-color: $color;
  18. }
  19. // Set validation states also for addons
  20. .input-group-addon {
  21. color: $color;
  22. border-color: $color;
  23. background-color: lighten($color, 40%);
  24. }
  25. // Optional feedback icon
  26. .form-control-feedback {
  27. color: $color;
  28. }
  29. }
  30. @mixin form-control-focus() {
  31. &:focus {
  32. border-color: $input-border-focus;
  33. outline: none;
  34. $shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 5px $input-box-shadow-focus;
  35. @include box-shadow($shadow);
  36. }
  37. }
  38. // Form control sizing
  39. //
  40. // Relative text size, padding, and border-radii changes for form controls. For
  41. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  42. // element gets special love because it's special, and that's a fact!
  43. @mixin input-size($parent, $input-height, $padding-y, $padding-x, $font-size, $line-height, $border-radius) {
  44. #{$parent} {
  45. height: $input-height;
  46. padding: $padding-y $padding-x;
  47. font-size: $font-size;
  48. line-height: $line-height;
  49. @include border-radius($border-radius);
  50. }
  51. select#{$parent} {
  52. height: $input-height;
  53. line-height: $input-height;
  54. }
  55. textarea#{$parent},
  56. select[multiple]#{$parent} {
  57. height: auto;
  58. }
  59. }