_forms.scss 5.5 KB

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