Graphs and tables for your Spotify account.
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.

147 lines
3.4 KiB

  1. // Form control focus state
  2. //
  3. // Generate a customized focus state and for any input with the specified color,
  4. // which defaults to the `$input-focus-border-color` variable.
  5. //
  6. // We highly encourage you to not customize the default value, but instead use
  7. // this to tweak colors on an as-needed basis. This aesthetic change is based on
  8. // WebKit's default styles, but applicable to a wider range of browsers. Its
  9. // usability and accessibility should be taken into account with any change.
  10. //
  11. // Example usage: change the default blue border and shadow to white for better
  12. // contrast against a dark gray background.
  13. @mixin form-control-focus() {
  14. &:focus {
  15. color: $input-focus-color;
  16. background-color: $input-focus-bg;
  17. border-color: $input-focus-border-color;
  18. outline: 0;
  19. // Avoid using mixin so we can pass custom focus shadow properly
  20. @if $enable-shadows {
  21. box-shadow: $input-box-shadow, $input-focus-box-shadow;
  22. } @else {
  23. box-shadow: $input-focus-box-shadow;
  24. }
  25. }
  26. }
  27. @mixin form-validation-state($state, $color) {
  28. .#{$state}-feedback {
  29. display: none;
  30. width: 100%;
  31. margin-top: $form-feedback-margin-top;
  32. font-size: $form-feedback-font-size;
  33. color: $color;
  34. }
  35. .#{$state}-tooltip {
  36. position: absolute;
  37. top: 100%;
  38. z-index: 5;
  39. display: none;
  40. max-width: 100%; // Contain to parent when possible
  41. padding: $tooltip-padding-y $tooltip-padding-x;
  42. margin-top: .1rem;
  43. font-size: $tooltip-font-size;
  44. line-height: $line-height-base;
  45. color: color-yiq($color);
  46. background-color: rgba($color, $tooltip-opacity);
  47. @include border-radius($tooltip-border-radius);
  48. }
  49. .form-control,
  50. .custom-select {
  51. .was-validated &:#{$state},
  52. &.is-#{$state} {
  53. border-color: $color;
  54. &:focus {
  55. border-color: $color;
  56. box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
  57. }
  58. ~ .#{$state}-feedback,
  59. ~ .#{$state}-tooltip {
  60. display: block;
  61. }
  62. }
  63. }
  64. .form-control-file {
  65. .was-validated &:#{$state},
  66. &.is-#{$state} {
  67. ~ .#{$state}-feedback,
  68. ~ .#{$state}-tooltip {
  69. display: block;
  70. }
  71. }
  72. }
  73. .form-check-input {
  74. .was-validated &:#{$state},
  75. &.is-#{$state} {
  76. ~ .form-check-label {
  77. color: $color;
  78. }
  79. ~ .#{$state}-feedback,
  80. ~ .#{$state}-tooltip {
  81. display: block;
  82. }
  83. }
  84. }
  85. .custom-control-input {
  86. .was-validated &:#{$state},
  87. &.is-#{$state} {
  88. ~ .custom-control-label {
  89. color: $color;
  90. &::before {
  91. background-color: lighten($color, 25%);
  92. }
  93. }
  94. ~ .#{$state}-feedback,
  95. ~ .#{$state}-tooltip {
  96. display: block;
  97. }
  98. &:checked {
  99. ~ .custom-control-label::before {
  100. @include gradient-bg(lighten($color, 10%));
  101. }
  102. }
  103. &:focus {
  104. ~ .custom-control-label::before {
  105. box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-focus-width rgba($color, .25);
  106. }
  107. }
  108. }
  109. }
  110. // custom file
  111. .custom-file-input {
  112. .was-validated &:#{$state},
  113. &.is-#{$state} {
  114. ~ .custom-file-label {
  115. border-color: $color;
  116. &::after { border-color: inherit; }
  117. }
  118. ~ .#{$state}-feedback,
  119. ~ .#{$state}-tooltip {
  120. display: block;
  121. }
  122. &:focus {
  123. ~ .custom-file-label {
  124. box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
  125. }
  126. }
  127. }
  128. }
  129. }