No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_forms.scss 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. @mixin form-control-focus() {
  2. &:focus {
  3. color: $input-focus-color;
  4. background-color: $input-focus-bg;
  5. border-color: $input-focus-border-color;
  6. outline: 0;
  7. // Avoid using mixin so we can pass custom focus shadow properly
  8. @if $enable-shadows {
  9. box-shadow: $input-box-shadow, $input-focus-box-shadow;
  10. } @else {
  11. box-shadow: $input-focus-box-shadow;
  12. }
  13. }
  14. }
  15. @mixin form-validation-state($state, $color) {
  16. .#{$state}-feedback {
  17. display: none;
  18. width: 100%;
  19. margin-top: $form-feedback-margin-top;
  20. font-size: $form-feedback-font-size;
  21. color: $color;
  22. }
  23. .#{$state}-tooltip {
  24. position: absolute;
  25. top: 100%;
  26. z-index: 5;
  27. display: none;
  28. max-width: 100%; // Contain to parent when possible
  29. padding: .5rem;
  30. margin-top: .1rem;
  31. font-size: .875rem;
  32. line-height: 1;
  33. color: #fff;
  34. background-color: rgba($color, .8);
  35. border-radius: .2rem;
  36. }
  37. .form-control,
  38. .custom-select {
  39. .was-validated &:#{$state},
  40. &.is-#{$state} {
  41. border-color: $color;
  42. &:focus {
  43. border-color: $color;
  44. //box-shadow: 0 1px $input-focus-width 0 rgba($color, .75);
  45. }
  46. ~ .#{$state}-feedback,
  47. ~ .#{$state}-tooltip {
  48. display: block;
  49. }
  50. }
  51. }
  52. .form-check-input {
  53. .was-validated &:#{$state},
  54. &.is-#{$state} {
  55. ~ .form-check-label {
  56. color: $color;
  57. }
  58. ~ .#{$state}-feedback,
  59. ~ .#{$state}-tooltip {
  60. display: block;
  61. }
  62. }
  63. }
  64. .custom-control-input {
  65. .was-validated &:#{$state},
  66. &.is-#{$state} {
  67. ~ .custom-control-label {
  68. color: $color;
  69. &::before {
  70. background-color: lighten($color, 25%);
  71. border-color: lighten($color, 25%);
  72. }
  73. }
  74. ~ .#{$state}-feedback,
  75. ~ .#{$state}-tooltip {
  76. display: block;
  77. }
  78. &:checked {
  79. ~ .custom-control-label::before {
  80. @include gradient-bg(lighten($color, 10%));
  81. border-color: lighten($color, 25%);
  82. }
  83. }
  84. &:focus {
  85. ~ .custom-control-label::before {
  86. box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-focus-width rgba($color, .25);
  87. }
  88. }
  89. }
  90. }
  91. // custom file
  92. .custom-file-input {
  93. .was-validated &:#{$state},
  94. &.is-#{$state} {
  95. ~ .custom-file-label {
  96. border-color: $color;
  97. &::before { border-color: inherit; }
  98. }
  99. ~ .#{$state}-feedback,
  100. ~ .#{$state}-tooltip {
  101. display: block;
  102. }
  103. &:focus {
  104. ~ .custom-file-label {
  105. box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
  106. }
  107. }
  108. }
  109. }
  110. }