_forms.scss 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. // Set the border and box shadow on specific inputs to match
  17. .form-control {
  18. border-color: $color;
  19. // @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
  20. &:focus {
  21. // border-color: darken($border-color, 10%);
  22. // $shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten($border-color, 20%);
  23. // @include box-shadow($shadow);
  24. }
  25. }
  26. // Set validation states also for addons
  27. .input-group-addon {
  28. color: $color;
  29. border-color: $color;
  30. background-color: lighten($color, 40%);
  31. }
  32. // Optional feedback icon
  33. .form-control-feedback {
  34. color: $color;
  35. }
  36. }
  37. @mixin form-control-focus() {
  38. &:focus {
  39. border-color: $input-border-focus;
  40. outline: none;
  41. $shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px $input-box-shadow-focus;
  42. @include box-shadow($shadow);
  43. }
  44. }
  45. // Form control sizing
  46. //
  47. // Relative text size, padding, and border-radii changes for form controls. For
  48. // horizontal sizing, wrap controls in the predefined grid classes. `<select>`
  49. // element gets special love because it's special, and that's a fact!
  50. @mixin input-size($parent, $input-height, $padding-y, $padding-x, $font-size, $line-height, $border-radius) {
  51. #{$parent} {
  52. height: $input-height;
  53. padding: $padding-y $padding-x;
  54. font-size: $font-size;
  55. line-height: $line-height;
  56. @include border-radius($border-radius);
  57. }
  58. select#{$parent} {
  59. height: $input-height;
  60. line-height: $input-height;
  61. }
  62. textarea#{$parent},
  63. select[multiple]#{$parent} {
  64. height: auto;
  65. }
  66. }