_forms.scss 5.5 KB

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