_checkbox-radio.scss 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* Checkboxes and Radios */
  2. .form-check {
  3. position: relative;
  4. display: block;
  5. margin-top: 15px;
  6. margin-bottom: 10px;
  7. padding-left: 0;
  8. .form-check-label {
  9. display: block;
  10. margin-left: 1.75rem;
  11. font-size: $default-font-size;
  12. line-height: 1.5;
  13. .rtl & {
  14. margin-left: 0;
  15. margin-right: 1.75rem;
  16. }
  17. input {
  18. position: absolute;
  19. top: 0;
  20. left: 0;
  21. .rtl & {
  22. left: auto;
  23. right: 0;
  24. }
  25. margin-left: 0;
  26. margin-top: 0;
  27. z-index: 1;
  28. cursor: pointer;
  29. opacity: 0;
  30. filter: alpha(opacity=0);
  31. }
  32. input[type="checkbox"] {
  33. + .input-helper {
  34. &:before,
  35. &:after {
  36. position: absolute;
  37. top: 0;
  38. left: 0;
  39. .rtl & {
  40. left: auto;
  41. right: 0;
  42. }
  43. }
  44. &:before {
  45. content: "";
  46. width: 18px;
  47. height: 18px;
  48. border-radius: 2px;
  49. border: solid theme-color(primary);
  50. border-width: 2px;
  51. @include transition(all);
  52. transition-duration: 0s;
  53. -webkit-transition-duration: 250ms;
  54. transition-duration: 250ms;
  55. }
  56. &:after {
  57. @include transition(all);
  58. transition-duration: 0s;
  59. -webkit-transition-duration: 250ms;
  60. transition-duration: 250ms;
  61. font-family: Material Design Icons;
  62. opacity: 0;
  63. filter: alpha(opacity=0);
  64. -webkit-transform: scale(0);
  65. -ms-transform: scale(0);
  66. -o-transform: scale(0);
  67. transform: scale(0);
  68. content: '\F12C';
  69. font-size: .9375rem;
  70. font-weight: bold;
  71. color: $white;
  72. }
  73. }
  74. &:checked {
  75. +.input-helper {
  76. &:before {
  77. background: theme-gradient-color(primary);
  78. border-width: 0;
  79. }
  80. &:after {
  81. width: 18px;
  82. opacity: 1;
  83. line-height: 18px;
  84. filter: alpha(opacity=100);
  85. -webkit-transform: scale(1);
  86. -ms-transform: scale(1);
  87. -o-transform: scale(1);
  88. transform: scale(1);
  89. }
  90. }
  91. }
  92. &:disabled {
  93. + .input-helper {
  94. &:before {
  95. border-color: $border-color;
  96. }
  97. }
  98. &:checked {
  99. + .input-helper {
  100. &:after {
  101. background: $border-color;
  102. color: $white;
  103. }
  104. }
  105. }
  106. }
  107. }
  108. input[type="radio"] {
  109. +.input-helper {
  110. &:before {
  111. position: absolute;
  112. content: "";
  113. top: 0;
  114. left: 0;
  115. .rtl & {
  116. left: auto;
  117. right: 0;
  118. }
  119. border: solid theme-color(primary);
  120. border-width: 2px;
  121. width: 20px;
  122. height: 20px;
  123. border-radius: 50%;
  124. @include transition(all);
  125. transition-duration: 0s;
  126. -webkit-transition-duration: 250ms;
  127. transition-duration: 250ms;
  128. }
  129. &:after {
  130. content: "";
  131. width: 8px;
  132. height: 8px;
  133. background: $white;
  134. border-radius: 50%;
  135. top: 6px;
  136. left: 6px;
  137. .rtl & {
  138. left: auto;
  139. right: 6px;
  140. }
  141. -webkit-transition: all;
  142. -o-transition: all;
  143. transition: all;
  144. transition-duration: 0s;
  145. -webkit-transition-duration: 250ms;
  146. transition-duration: 250ms;
  147. opacity: 0;
  148. filter: alpha(opacity=0);
  149. -webkit-transform: scale(0);
  150. -ms-transform: scale(0);
  151. -o-transform: scale(0);
  152. transform: scale(0);
  153. position: absolute;
  154. }
  155. }
  156. &:checked {
  157. +.input-helper {
  158. &:before {
  159. background: theme-gradient-color(primary);
  160. border-width: 0;
  161. }
  162. &:after {
  163. opacity: 1;
  164. line-height: 1.5;
  165. filter: alpha(opacity=100);
  166. -webkit-transform: scale(1);
  167. -ms-transform: scale(1);
  168. -o-transform: scale(1);
  169. transform: scale(1);
  170. }
  171. }
  172. }
  173. &:disabled {
  174. + .input-helper {
  175. &:before {
  176. border-color: $border-color;
  177. }
  178. }
  179. &:checked {
  180. + .input-helper {
  181. &:before {
  182. background: $border-color;
  183. }
  184. &:after {
  185. background: $white;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. @each $color, $value in $theme-gradient-colors {
  194. .form-check-#{$color} {
  195. &.form-check {
  196. label {
  197. input[type="checkbox"],
  198. input[type="radio"] {
  199. +.input-helper {
  200. &:before {
  201. border-color: theme-color($color);
  202. }
  203. }
  204. &:checked {
  205. +.input-helper {
  206. &:before {
  207. background: $value;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. @media (min-width: 576px) {
  217. .form-inline .form-check {
  218. }
  219. }