_forms.scss 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. //
  2. // Component: Forms
  3. //
  4. .form-group {
  5. &.has-icon {
  6. position: relative;
  7. .form-control {
  8. padding-right: 35px;
  9. }
  10. .form-icon {
  11. background-color: transparent;
  12. border: 0;
  13. cursor: pointer;
  14. font-size: 1rem;
  15. // margin-top: -3px;
  16. padding: $input-btn-padding-y $input-btn-padding-x;
  17. position: absolute;
  18. right: 3px;
  19. top: 0;
  20. }
  21. }
  22. }
  23. // Button groups
  24. .btn-group-vertical {
  25. .btn {
  26. &.btn-flat:first-of-type,
  27. &.btn-flat:last-of-type {
  28. @include border-radius(0);
  29. }
  30. }
  31. }
  32. // Support icons in form-control
  33. .form-control-feedback {
  34. &.fa,
  35. &.fas,
  36. &.far,
  37. &.fab,
  38. &.ion {
  39. line-height: $input-height;
  40. }
  41. }
  42. .input-lg + .form-control-feedback,
  43. .input-group-lg + .form-control-feedback {
  44. &.fa,
  45. &.fas,
  46. &.far,
  47. &.fab,
  48. &.ion {
  49. line-height: $input-height-lg;
  50. }
  51. }
  52. .form-group-lg {
  53. .form-control + .form-control-feedback {
  54. &.fa,
  55. &.fas,
  56. &.far,
  57. &.fab,
  58. &.ion {
  59. line-height: $input-height-lg;
  60. }
  61. }
  62. }
  63. .input-sm + .form-control-feedback,
  64. .input-group-sm + .form-control-feedback {
  65. &.fa,
  66. &.fas,
  67. &.far,
  68. &.fab,
  69. &.ion {
  70. line-height: $input-height-sm;
  71. }
  72. }
  73. .form-group-sm {
  74. .form-control + .form-control-feedback {
  75. &.fa,
  76. &.fas,
  77. &.far,
  78. &.fab,
  79. &.ion {
  80. line-height: $input-height-sm;
  81. }
  82. }
  83. }
  84. label:not(.form-check-label):not(.custom-file-label) {
  85. font-weight: $font-weight-bold;
  86. }
  87. .warning-feedback {
  88. @include font-size($form-feedback-font-size);
  89. color: theme-color("warning");
  90. display: none;
  91. margin-top: $form-feedback-margin-top;
  92. width: 100%;
  93. }
  94. .warning-tooltip {
  95. @include border-radius($form-feedback-tooltip-border-radius);
  96. @include font-size($form-feedback-tooltip-font-size);
  97. background-color: rgba(theme-color("warning"), $form-feedback-tooltip-opacity);
  98. color: color-yiq(theme-color("warning"));
  99. display: none;
  100. line-height: $form-feedback-tooltip-line-height;
  101. margin-top: .1rem;
  102. max-width: 100%; // Contain to parent when possible
  103. padding: $form-feedback-tooltip-padding-y $form-feedback-tooltip-padding-x;
  104. position: absolute;
  105. top: 100%;
  106. z-index: 5;
  107. }
  108. .form-control {
  109. &.is-warning {
  110. border-color: theme-color("warning");
  111. @if $enable-validation-icons {
  112. // padding-right: $input-height-inner;
  113. // background-image: none;
  114. // background-repeat: no-repeat;
  115. // background-position: center right $input-height-inner-quarter;
  116. // background-size: $input-height-inner-half $input-height-inner-half;
  117. }
  118. &:focus {
  119. border-color: theme-color("warning");
  120. box-shadow: 0 0 0 $input-focus-width rgba(theme-color("warning"), .25);
  121. }
  122. ~ .warning-feedback,
  123. ~ .warning-tooltip {
  124. display: block;
  125. }
  126. }
  127. }
  128. // stylelint-disable-next-line selector-no-qualifying-type
  129. textarea.form-control {
  130. &.is-warning {
  131. @if $enable-validation-icons {
  132. padding-right: $input-height-inner;
  133. background-position: top $input-height-inner-quarter right $input-height-inner-quarter;
  134. }
  135. }
  136. }
  137. .custom-select {
  138. &.is-warning {
  139. border-color: theme-color("warning");
  140. @if $enable-validation-icons {
  141. // padding-right: $custom-select-feedback-icon-padding-right;
  142. // background: $custom-select-background, none $custom-select-bg no-repeat $custom-select-feedback-icon-position / $custom-select-feedback-icon-size;
  143. }
  144. &:focus {
  145. border-color: theme-color("warning");
  146. box-shadow: 0 0 0 $input-focus-width rgba(theme-color("warning"), .25);
  147. }
  148. ~ .warning-feedback,
  149. ~ .warning-tooltip {
  150. display: block;
  151. }
  152. }
  153. }
  154. .form-control-file {
  155. &.is-warning {
  156. ~ .warning-feedback,
  157. ~ .warning-tooltip {
  158. display: block;
  159. }
  160. }
  161. }
  162. .form-check-input {
  163. &.is-warning {
  164. ~ .form-check-label {
  165. color: theme-color("warning");
  166. }
  167. ~ .warning-feedback,
  168. ~ .warning-tooltip {
  169. display: block;
  170. }
  171. }
  172. }
  173. .custom-control-input.is-warning {
  174. ~ .custom-control-label {
  175. color: theme-color("warning");
  176. &::before {
  177. border-color: theme-color("warning");
  178. }
  179. }
  180. ~ .warning-feedback,
  181. ~ .warning-tooltip {
  182. display: block;
  183. }
  184. &:checked {
  185. ~ .custom-control-label::before {
  186. @include gradient-bg(lighten(theme-color("warning"), 10%));
  187. border-color: lighten(theme-color("warning"), 10%);
  188. }
  189. }
  190. &:focus {
  191. ~ .custom-control-label::before {
  192. box-shadow: 0 0 0 $input-focus-width rgba(theme-color("warning"), .25);
  193. }
  194. &:not(:checked) ~ .custom-control-label::before {
  195. border-color: theme-color("warning");
  196. }
  197. }
  198. }
  199. // custom file
  200. .custom-file-input {
  201. &.is-warning {
  202. ~ .custom-file-label {
  203. border-color: theme-color("warning");
  204. }
  205. ~ .warning-feedback,
  206. ~ .warning-tooltip {
  207. display: block;
  208. }
  209. &:focus {
  210. ~ .custom-file-label {
  211. border-color: theme-color("warning");
  212. box-shadow: 0 0 0 $input-focus-width rgba(theme-color("warning"), .25);
  213. }
  214. }
  215. }
  216. }
  217. // custom switch color variations
  218. .custom-switch {
  219. @each $name, $color in $theme-colors {
  220. @include custom-switch-variant($name, $color);
  221. }
  222. @each $name, $color in $colors {
  223. @include custom-switch-variant($name, $color);
  224. }
  225. }
  226. // custom range color variations
  227. .custom-range {
  228. @each $name, $color in $theme-colors {
  229. @include custom-range-variant($name, $color);
  230. }
  231. @each $name, $color in $colors {
  232. @include custom-range-variant($name, $color);
  233. }
  234. }