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.

371 lines
6.6 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: @checkboxSize;
  28. line-height: @checkboxHeight;
  29. backface-visibility: hidden;
  30. outline: none;
  31. vertical-align: middle;
  32. }
  33. .ui.checkbox input {
  34. position: absolute;
  35. top: 0px;
  36. left: 0px;
  37. opacity: 0;
  38. outline: none;
  39. z-index: -1;
  40. }
  41. /*--------------
  42. Box
  43. ---------------*/
  44. .ui.checkbox .box,
  45. .ui.checkbox label {
  46. cursor: pointer;
  47. padding-left: @labelPadding;
  48. outline: none;
  49. }
  50. .ui.checkbox .box:before,
  51. .ui.checkbox label:before {
  52. position: absolute;
  53. line-height: 1;
  54. width: @checkboxSize;
  55. height: @checkboxSize;
  56. top: 0em;
  57. left: 0em;
  58. content: '';
  59. background: @checkboxBackground;
  60. border-radius: @checkboxBorderRadius;
  61. transition: @checkboxTransition;
  62. border: @checkboxBorder;
  63. }
  64. /*--------------
  65. Checkmark
  66. ---------------*/
  67. .ui.checkbox .box:after,
  68. .ui.checkbox label:after {
  69. position: absolute;
  70. top: @checkboxCheckOffset;
  71. left: 0px;
  72. width: @checkboxSize;
  73. text-align: center;
  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. background: @checkboxHoverBackground;
  102. border: @checkboxHoverBorder;
  103. }
  104. .ui.checkbox label:hover,
  105. .ui.checkbox + label:hover {
  106. color: @labelHoverColor;
  107. }
  108. /*--------------
  109. Down
  110. ---------------*/
  111. .ui.checkbox .box:active::before,
  112. .ui.checkbox label:active::before {
  113. background: @checkboxSelectedBackground;
  114. border: 1px solid @checkboxSelectedBorder;
  115. }
  116. .ui.checkbox input:active ~ label {
  117. color: @labelSelectedColor;
  118. }
  119. /*--------------
  120. Focus
  121. ---------------*/
  122. .ui.checkbox input:focus ~ .box:before,
  123. .ui.checkbox input:focus ~ label:before {
  124. background: @checkboxSelectedBackground;
  125. border: 1px solid @checkboxSelectedBorder;
  126. }
  127. .ui.checkbox input:focus ~ label {
  128. color: @labelSelectedColor;
  129. }
  130. /*--------------
  131. Active
  132. ---------------*/
  133. .ui.checkbox input:checked ~ .box:after,
  134. .ui.checkbox input:checked ~ label:after {
  135. opacity: 1;
  136. }
  137. /*--------------
  138. Disabled
  139. ---------------*/
  140. .ui.disabled.checkbox .box:after,
  141. .ui.disabled.checkbox label,
  142. .ui.checkbox input[disabled] ~ .box:after,
  143. .ui.checkbox input[disabled] ~ label {
  144. opacity: @disabledCheckboxOpacity;
  145. color: @disabledCheckboxLabelColor;
  146. }
  147. /*******************************
  148. Types
  149. *******************************/
  150. /*--------------
  151. Radio
  152. ---------------*/
  153. /* Box */
  154. .ui.radio.checkbox .box:before,
  155. .ui.radio.checkbox label:before {
  156. border-radius: @circularRadius;
  157. transform: none;
  158. }
  159. /* Circle */
  160. .ui.radio.checkbox .box:after,
  161. .ui.radio.checkbox label:after {
  162. border: none;
  163. top: @checkboxRadioOffset;
  164. left: 0em;
  165. font-size: @checkboxRadioCircleSize;
  166. }
  167. /*--------------
  168. Slider
  169. ---------------*/
  170. .ui.slider.checkbox {
  171. cursor: pointer;
  172. }
  173. .ui.slider.checkbox .box,
  174. .ui.slider.checkbox label {
  175. padding-left: @sliderLabelDistance;
  176. }
  177. /* Line */
  178. .ui.slider.checkbox .box:before,
  179. .ui.slider.checkbox label:before {
  180. cursor: pointer;
  181. display: block;
  182. position: absolute;
  183. content: '';
  184. top: @sliderLineVerticalOffset;
  185. left: 0em;
  186. z-index: 1;
  187. border: none !important;
  188. background-color: @neutralCheckbox;
  189. width: @sliderLineWidth;
  190. height: @sliderLineHeight;
  191. transform: none;
  192. border-radius: @circularRadius;
  193. transition:
  194. background 0.3s ease
  195. ;
  196. }
  197. /* Handle */
  198. .ui.slider.checkbox .box:after,
  199. .ui.slider.checkbox label:after {
  200. background: @handleBackground;
  201. position: absolute;
  202. content: '';
  203. opacity: 1;
  204. z-index: 2;
  205. border: none;
  206. box-shadow: @handleBoxShadow;
  207. width: @handleSize;
  208. height: @handleSize;
  209. top: @sliderHandleOffset;
  210. left: 0em;
  211. border-radius: @circularRadius;
  212. transition:
  213. left 0.3s ease 0s
  214. ;
  215. }
  216. /* Focus */
  217. .ui.slider.checkbox input:focus ~ .box:before,
  218. .ui.slider.checkbox input:focus ~ label:before {
  219. background-color: @toggleFocusColor;
  220. border: none;
  221. }
  222. /* Active */
  223. .ui.slider.checkbox input:checked ~ .box:before,
  224. .ui.slider.checkbox input:checked ~ label:before {
  225. background-color: @positiveCheckbox;
  226. }
  227. .ui.slider.checkbox input:checked ~ .box:after,
  228. .ui.slider.checkbox input:checked ~ label:after {
  229. left: @sliderTravelDistance;
  230. }
  231. /*--------------
  232. Toggle
  233. ---------------*/
  234. .ui.toggle.checkbox {
  235. cursor: pointer;
  236. }
  237. .ui.toggle.checkbox .box,
  238. .ui.toggle.checkbox label {
  239. padding-left: 3em;
  240. }
  241. /* Switch */
  242. .ui.toggle.checkbox .box:before,
  243. .ui.toggle.checkbox label:before {
  244. cursor: pointer;
  245. display: block;
  246. position: absolute;
  247. content: '';
  248. top: @toggleSwitchVerticalOffset;
  249. z-index: 1;
  250. border: none;
  251. background-color: @neutralCheckbox;
  252. width: @toggleSwitchWidth;
  253. height: @toggleSwitchHeight;
  254. border-radius: @circularRadius;
  255. }
  256. /* Handle */
  257. .ui.toggle.checkbox .box:after,
  258. .ui.toggle.checkbox label:after {
  259. background: @handleBackground;
  260. position: absolute;
  261. content: '';
  262. opacity: 1;
  263. z-index: 2;
  264. border: none;
  265. box-shadow: @handleBoxShadow;
  266. width: @handleSize;
  267. height: @handleSize;
  268. top: @sliderHandleOffset;
  269. left: 0em;
  270. border-radius: @circularRadius;
  271. transition:
  272. background 0.3s ease 0s,
  273. left 0.3s ease 0s
  274. ;
  275. }
  276. .ui.toggle.checkbox input ~ .box:after,
  277. .ui.toggle.checkbox input ~ label:after {
  278. left: @toggleOffOffset;
  279. }
  280. /* Focus */
  281. .ui.toggle.checkbox input:focus ~ .box:before,
  282. .ui.toggle.checkbox input:focus ~ label:before {
  283. background-color: @toggleFocusColor;
  284. border: none;
  285. }
  286. /* Active */
  287. .ui.toggle.checkbox input:checked ~ .box,
  288. .ui.toggle.checkbox input:checked ~ label {
  289. color: @positiveCheckbox;
  290. }
  291. .ui.toggle.checkbox input:checked ~ .box:before,
  292. .ui.toggle.checkbox input:checked ~ label:before {
  293. background-color: @positiveCheckbox;
  294. }
  295. .ui.toggle.checkbox input:checked ~ .box:after,
  296. .ui.toggle.checkbox input:checked ~ label:after {
  297. left: @toggleOnOffset;
  298. }
  299. .loadUIOverrides();