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.

370 lines
6.2 KiB

  1. /*
  2. * # Semantic - Checkbox
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. /*******************************
  12. Theme
  13. *******************************/
  14. @type : 'module';
  15. @element : 'checkbox';
  16. @import '../../semantic.config';
  17. /*******************************
  18. Checkbox
  19. *******************************/
  20. /*--------------
  21. Content
  22. ---------------*/
  23. .ui.checkbox {
  24. position: relative;
  25. display: inline-block;
  26. height: @checkboxHeight;
  27. min-width: 1em;
  28. line-height: 1em;
  29. outline: none;
  30. vertical-align: middle;
  31. }
  32. .ui.checkbox input {
  33. position: absolute;
  34. top: 0px;
  35. left: 0px;
  36. opacity: 0;
  37. outline: none;
  38. }
  39. /*--------------
  40. Box
  41. ---------------*/
  42. .ui.checkbox .box,
  43. .ui.checkbox label {
  44. cursor: pointer;
  45. padding-left: @labelPadding;
  46. outline: none;
  47. }
  48. .ui.checkbox .box:before,
  49. .ui.checkbox label:before {
  50. position: absolute;
  51. line-height: 1;
  52. width: 1.25em;
  53. height: 1.25em;
  54. top: @boxOffset;
  55. left: @boxOffset;
  56. content: '';
  57. background: #FFFFFF;
  58. border-radius: 0.25em;
  59. transition:
  60. background-color 0.3s ease,
  61. border 0.3s ease,
  62. box-shadow 0.3s ease
  63. ;
  64. border: @checkboxBorder;
  65. }
  66. /*--------------
  67. Checkmark
  68. ---------------*/
  69. .ui.checkbox .box:after,
  70. .ui.checkbox label:after {
  71. position: absolute;
  72. top: 0em;
  73. left: 0em;
  74. opacity: 0;
  75. color: @checkboxColor;
  76. transition: opacity 0.1s ease;
  77. }
  78. /*--------------
  79. Label
  80. ---------------*/
  81. /* Inside */
  82. .ui.checkbox label,
  83. .ui.checkbox + label {
  84. cursor: pointer;
  85. color: @labelColor;
  86. transition: color 0.2s ease;
  87. user-select: none;
  88. }
  89. /* Outside */
  90. .ui.checkbox + label {
  91. vertical-align: middle;
  92. }
  93. /*******************************
  94. States
  95. *******************************/
  96. /*--------------
  97. Hover
  98. ---------------*/
  99. .ui.checkbox .box:hover::before,
  100. .ui.checkbox label:hover::before {
  101. border: 1px solid @selectedBorderColor;
  102. }
  103. .ui.checkbox label:hover,
  104. .ui.checkbox + label:hover {
  105. color: @labelHoverColor;
  106. }
  107. /*--------------
  108. Down
  109. ---------------*/
  110. .ui.checkbox .box:active::before,
  111. .ui.checkbox label:active::before {
  112. background-color: #F5F5F5;
  113. }
  114. /*--------------
  115. Focus
  116. ---------------*/
  117. .ui.checkbox input:focus + .box:before,
  118. .ui.checkbox input:focus + label:before {
  119. border: 1px solid @selectedBorderColor;
  120. }
  121. .ui.checkbox input:focus + label {
  122. color: @labelSelectedColor;
  123. }
  124. /*--------------
  125. Active
  126. ---------------*/
  127. .ui.checkbox input:checked + .box:after,
  128. .ui.checkbox input:checked + label:after {
  129. opacity: 1;
  130. }
  131. /*--------------
  132. Disabled
  133. ---------------*/
  134. .ui.disabled.checkbox + .box:after,
  135. .ui.checkbox input[disabled] + .box:after,
  136. .ui.disabled.checkbox label,
  137. .ui.checkbox input[disabled] + label {
  138. opacity: 0.4;
  139. color: rgba(0, 0, 0, 0.3);
  140. }
  141. /*******************************
  142. Variations
  143. *******************************/
  144. /*--------------
  145. Radio
  146. ---------------*/
  147. /* Box */
  148. .ui.radio.checkbox .box:before,
  149. .ui.radio.checkbox label:before {
  150. border-radius: @circularRadius;
  151. transform: none;
  152. }
  153. /* Circle */
  154. .ui.radio.checkbox .box:after,
  155. .ui.radio.checkbox label:after {
  156. border: none;
  157. }
  158. /*--------------
  159. Slider
  160. ---------------*/
  161. .ui.slider.checkbox {
  162. cursor: pointer;
  163. }
  164. .ui.slider.checkbox .box,
  165. .ui.slider.checkbox label {
  166. padding-left: @sliderLabelDistance;
  167. }
  168. /* Line */
  169. .ui.slider.checkbox .box:before,
  170. .ui.slider.checkbox label:before {
  171. cursor: pointer;
  172. display: block;
  173. position: absolute;
  174. content: '';
  175. top: @sliderLineVerticalOffset;
  176. left: 0em;
  177. z-index: 1;
  178. border: none !important;
  179. background-color: @neutralCheckbox;
  180. width: @sliderLineWidth;
  181. height: @sliderLineHeight;
  182. transform: none;
  183. border-radius: @circularRadius;
  184. transition:
  185. background 0.3s ease
  186. ;
  187. }
  188. /* Handle */
  189. .ui.slider.checkbox .box:after,
  190. .ui.slider.checkbox label:after {
  191. background: @handleBackground;
  192. position: absolute;
  193. content: '';
  194. opacity: 1;
  195. z-index: 2;
  196. border: none;
  197. box-shadow: @handleBoxShadow;
  198. width: @handleSize;
  199. height: @handleSize;
  200. top: @sliderHandleOffset;
  201. left: 0em;
  202. border-radius: @circularRadius;
  203. transition:
  204. left 0.3s ease 0s
  205. ;
  206. }
  207. /* Focus */
  208. .ui.slider.checkbox input:focus + .box:before,
  209. .ui.slider.checkbox input:focus + label:before {
  210. background-color: @toggleFocusColor;
  211. border: none;
  212. }
  213. /* Active */
  214. .ui.slider.checkbox input:checked + .box:before,
  215. .ui.slider.checkbox input:checked + label:before {
  216. background-color: @positiveCheckbox;
  217. }
  218. .ui.slider.checkbox input:checked + .box:after,
  219. .ui.slider.checkbox input:checked + label:after {
  220. left: @sliderTravelDistance;
  221. }
  222. /*--------------
  223. Toggle
  224. ---------------*/
  225. .ui.toggle.checkbox {
  226. cursor: pointer;
  227. }
  228. .ui.toggle.checkbox .box,
  229. .ui.toggle.checkbox label {
  230. padding-left: 3em;
  231. }
  232. /* Switch */
  233. .ui.toggle.checkbox .box:before,
  234. .ui.toggle.checkbox label:before {
  235. cursor: pointer;
  236. display: block;
  237. position: absolute;
  238. content: '';
  239. top: @toggleSwitchVerticalOffset;
  240. left: 0em;
  241. z-index: 1;
  242. border: none;
  243. background-color: @neutralCheckbox;
  244. width: @toggleSwitchWidth;
  245. height: @toggleSwitchHeight;
  246. border-radius: @circularRadius;
  247. }
  248. /* Handle */
  249. .ui.toggle.checkbox .box:after,
  250. .ui.toggle.checkbox label:after {
  251. background: @handleBackground;
  252. position: absolute;
  253. content: '';
  254. opacity: 1;
  255. z-index: 2;
  256. border: none;
  257. box-shadow: @handleBoxShadow;
  258. width: @handleSize;
  259. height: @handleSize;
  260. top: @sliderHandleOffset;
  261. left: 0em;
  262. border-radius: @circularRadius;
  263. transition:
  264. background 0.3s ease 0s,
  265. left 0.3s ease 0s
  266. ;
  267. }
  268. /* Focus */
  269. .ui.toggle.checkbox input:focus + .box:before,
  270. .ui.toggle.checkbox input:focus + label:before {
  271. background-color: @toggleFocusColor;
  272. border: none;
  273. }
  274. /* Active */
  275. .ui.toggle.checkbox input:checked + .box:before,
  276. .ui.toggle.checkbox input:checked + label:before {
  277. background-color: @positiveCheckbox;
  278. }
  279. .ui.toggle.checkbox input:checked + .box:after,
  280. .ui.toggle.checkbox input:checked + label:after {
  281. left: 1em;
  282. }
  283. /*--------------
  284. Sizes
  285. ---------------*/
  286. .ui.checkbox {
  287. font-size: 1em;
  288. }
  289. .ui.large.checkbox {
  290. font-size: 1.25em;
  291. }
  292. .ui.huge.checkbox {
  293. font-size: 1.5em;
  294. }
  295. .loadUIOverrides();