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.

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