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.

415 lines
7.7 KiB

  1. /*
  2. * # Semantic - Checkbox
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2014 Contributor
  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: @checkboxCheckTop;
  75. left: @checkboxCheckLeft;
  76. line-height: @checkboxSize;
  77. width: @checkboxSize;
  78. height: @checkboxSize;
  79. text-align: center;
  80. opacity: 0;
  81. color: @checkboxColor;
  82. transition: all 0.1s ease;
  83. }
  84. /*--------------
  85. Label
  86. ---------------*/
  87. /* Inside */
  88. .ui.checkbox label,
  89. .ui.checkbox + label {
  90. cursor: pointer;
  91. color: @labelColor;
  92. transition: color 0.2s ease;
  93. user-select: none;
  94. }
  95. /* Outside */
  96. .ui.checkbox + label {
  97. vertical-align: middle;
  98. }
  99. /*******************************
  100. States
  101. *******************************/
  102. /*--------------
  103. Hover
  104. ---------------*/
  105. .ui.checkbox .box:hover::before,
  106. .ui.checkbox label:hover::before {
  107. background: @checkboxHoverBackground;
  108. border: @checkboxHoverBorder;
  109. }
  110. .ui.checkbox label:hover,
  111. .ui.checkbox + label:hover {
  112. color: @labelHoverColor;
  113. }
  114. /*--------------
  115. Down
  116. ---------------*/
  117. .ui.checkbox .box:active::before,
  118. .ui.checkbox label:active::before {
  119. background: @checkboxSelectedBackground;
  120. border: 1px solid @checkboxSelectedBorder;
  121. }
  122. .ui.checkbox input:active ~ label {
  123. color: @labelSelectedColor;
  124. }
  125. /*--------------
  126. Focus
  127. ---------------*/
  128. .ui.checkbox input:focus ~ .box:before,
  129. .ui.checkbox input:focus ~ label:before {
  130. background: @checkboxSelectedBackground;
  131. border: 1px solid @checkboxSelectedBorder;
  132. }
  133. .ui.checkbox input:focus ~ label {
  134. color: @labelSelectedColor;
  135. }
  136. /*--------------
  137. Active
  138. ---------------*/
  139. .ui.checkbox input:checked ~ .box:after,
  140. .ui.checkbox input:checked ~ label:after {
  141. opacity: 1;
  142. }
  143. /*--------------
  144. Disabled
  145. ---------------*/
  146. .ui.disabled.checkbox .box:after,
  147. .ui.disabled.checkbox label,
  148. .ui.checkbox input[disabled] ~ .box:after,
  149. .ui.checkbox input[disabled] ~ label {
  150. opacity: @disabledCheckboxOpacity;
  151. color: @disabledCheckboxLabelColor;
  152. }
  153. /*******************************
  154. Types
  155. *******************************/
  156. /*--------------
  157. Radio
  158. ---------------*/
  159. .ui.radio.checkbox {
  160. height: @checkboxRadioSize;
  161. }
  162. /* Box */
  163. .ui.radio.checkbox .box:before,
  164. .ui.radio.checkbox label:before {
  165. width: @checkboxRadioSize;
  166. height: @checkboxRadioSize;
  167. border-radius: @circularRadius;
  168. transform: none;
  169. }
  170. /* Circle */
  171. .ui.radio.checkbox .box:after,
  172. .ui.radio.checkbox label:after {
  173. border: none;
  174. width: @checkboxRadioSize;
  175. height: @checkboxRadioSize;
  176. line-height: @checkboxRadioSize;
  177. top: @checkboxRadioTop;
  178. left: @checkboxRadioLeft;
  179. font-size: @checkboxRadioCircleSize;
  180. }
  181. /*--------------
  182. Slider
  183. ---------------*/
  184. .ui.slider.checkbox {
  185. cursor: pointer;
  186. height: @sliderSize;
  187. }
  188. .ui.slider.checkbox .box,
  189. .ui.slider.checkbox label {
  190. padding-left: @sliderLabelDistance;
  191. line-height: @sliderLabelLineHeight;
  192. color: @sliderOffLabelColor;
  193. }
  194. /* Line */
  195. .ui.slider.checkbox .box:before,
  196. .ui.slider.checkbox label:before {
  197. cursor: pointer;
  198. display: block;
  199. position: absolute;
  200. content: '';
  201. top: @sliderLineVerticalOffset;
  202. left: 0em;
  203. z-index: 1;
  204. border: none !important;
  205. background-color: @sliderLineColor;
  206. width: @sliderLineWidth;
  207. height: @sliderLineHeight;
  208. transform: none;
  209. border-radius: @sliderLineRadius;
  210. transition:
  211. background 0.3s ease
  212. ;
  213. }
  214. /* Handle */
  215. .ui.slider.checkbox .box:after,
  216. .ui.slider.checkbox label:after {
  217. background: @handleBackground;
  218. position: absolute;
  219. content: '';
  220. opacity: 1;
  221. z-index: 2;
  222. border: none;
  223. box-shadow: @handleBoxShadow;
  224. width: @sliderHandleSize;
  225. height: @sliderHandleSize;
  226. top: @sliderHandleOffset;
  227. left: 0em;
  228. transform: none;
  229. border-radius: @circularRadius;
  230. transition:
  231. left 0.3s ease 0s
  232. ;
  233. }
  234. /* Focus */
  235. .ui.slider.checkbox input:focus ~ .box:before,
  236. .ui.slider.checkbox input:focus ~ label:before {
  237. background-color: @toggleFocusColor;
  238. border: none;
  239. }
  240. /* Hover */
  241. .ui.slider.checkbox .box:hover,
  242. .ui.slider.checkbox label:hover {
  243. color: @sliderHoverLabelColor;
  244. }
  245. .ui.slider.checkbox .box:hover::before,
  246. .ui.slider.checkbox label:hover::before {
  247. background: @sliderHoverLaneBackground;
  248. }
  249. /* Active */
  250. .ui.slider.checkbox input:checked ~ .box,
  251. .ui.slider.checkbox input:checked ~ label {
  252. color: @sliderOnLabelColor;
  253. }
  254. .ui.slider.checkbox input:checked ~ .box:before,
  255. .ui.slider.checkbox input:checked ~ label:before {
  256. background-color: @sliderOnLineColor;
  257. }
  258. .ui.slider.checkbox input:checked ~ .box:after,
  259. .ui.slider.checkbox input:checked ~ label:after {
  260. left: @sliderTravelDistance;
  261. }
  262. /*--------------
  263. Toggle
  264. ---------------*/
  265. .ui.toggle.checkbox {
  266. cursor: pointer;
  267. height: @toggleSize;
  268. }
  269. .ui.toggle.checkbox .box,
  270. .ui.toggle.checkbox label {
  271. height: @toggleSize;
  272. padding-left: @toggleLabelDistance;
  273. line-height: @toggleLabelLineHeight;
  274. color: @toggleOffLabelColor;
  275. }
  276. /* Switch */
  277. .ui.toggle.checkbox .box:before,
  278. .ui.toggle.checkbox label:before {
  279. cursor: pointer;
  280. display: block;
  281. position: absolute;
  282. content: '';
  283. top: @toggleLaneVerticalOffset;
  284. z-index: 1;
  285. border: none;
  286. background-color: @neutralCheckbox;
  287. width: @toggleLaneWidth;
  288. height: @toggleLaneHeight;
  289. border-radius: @toggleHandleRadius;
  290. }
  291. /* Handle */
  292. .ui.toggle.checkbox .box:after,
  293. .ui.toggle.checkbox label:after {
  294. background: @handleBackground;
  295. position: absolute;
  296. content: '';
  297. opacity: 1;
  298. z-index: 2;
  299. border: none;
  300. box-shadow: @handleBoxShadow;
  301. width: @toggleHandleSize;
  302. height: @toggleHandleSize;
  303. top: @toggleHandleOffset;
  304. left: 0em;
  305. border-radius: @circularRadius;
  306. transition:
  307. background 0.3s ease 0s,
  308. left 0.3s ease 0s
  309. ;
  310. }
  311. .ui.toggle.checkbox input ~ .box:after,
  312. .ui.toggle.checkbox input ~ label:after {
  313. left: @toggleOffOffset;
  314. }
  315. /* Focus */
  316. .ui.toggle.checkbox input:focus ~ .box:before,
  317. .ui.toggle.checkbox input:focus ~ label:before {
  318. background-color: @toggleFocusColor;
  319. border: none;
  320. }
  321. /* Hover */
  322. .ui.toggle.checkbox .box:hover::before,
  323. .ui.toggle.checkbox label:hover::before {
  324. background-color: @toggleHoverColor;
  325. border: none;
  326. }
  327. /* Active */
  328. .ui.toggle.checkbox input:checked ~ .box,
  329. .ui.toggle.checkbox input:checked ~ label {
  330. color: @toggleOnLabelColor;
  331. }
  332. .ui.toggle.checkbox input:checked ~ .box:before,
  333. .ui.toggle.checkbox input:checked ~ label:before {
  334. background-color: @toggleOnLaneColor;
  335. }
  336. .ui.toggle.checkbox input:checked ~ .box:after,
  337. .ui.toggle.checkbox input:checked ~ label:after {
  338. left: @toggleOnOffset;
  339. }
  340. .loadUIOverrides();