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.

460 lines
8.6 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  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 !important;
  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. Read-Only
  145. ---------------*/
  146. .ui.read-only.checkbox,
  147. .ui.read-only.checkbox label {
  148. cursor: default;
  149. }
  150. /*--------------
  151. Disabled
  152. ---------------*/
  153. .ui.disabled.checkbox .box:after,
  154. .ui.disabled.checkbox label,
  155. .ui.checkbox input[disabled] ~ .box:after,
  156. .ui.checkbox input[disabled] ~ label {
  157. cursor: default;
  158. opacity: @disabledCheckboxOpacity;
  159. color: @disabledCheckboxLabelColor;
  160. }
  161. /*******************************
  162. Types
  163. *******************************/
  164. /*--------------
  165. Radio
  166. ---------------*/
  167. .ui.radio.checkbox {
  168. height: @checkboxRadioSize;
  169. }
  170. /* Box */
  171. .ui.radio.checkbox .box:before,
  172. .ui.radio.checkbox label:before {
  173. width: @checkboxRadioSize;
  174. height: @checkboxRadioSize;
  175. border-radius: @circularRadius;
  176. top: @checkboxRadioTop;
  177. left: @checkboxRadioLeft;
  178. transform: none;
  179. }
  180. /* Circle */
  181. .ui.radio.checkbox .box:after,
  182. .ui.radio.checkbox label:after {
  183. border: none;
  184. width: @checkboxRadioSize;
  185. height: @checkboxRadioSize;
  186. line-height: @checkboxRadioSize;
  187. top: @checkboxRadioTop;
  188. left: @checkboxRadioLeft;
  189. font-size: @checkboxRadioCircleSize;
  190. }
  191. /* Radio Checkbox */
  192. .ui.radio.checkbox .box:after,
  193. .ui.radio.checkbox label:after {
  194. width: @checkboxRadioSize;
  195. height: @checkboxRadioSize;
  196. border-radius: @checkboxBulletRadius;
  197. transform: scale(@checkboxBulletScale);
  198. background-color: @checkboxBulletColor;
  199. }
  200. /*--------------
  201. Slider
  202. ---------------*/
  203. .ui.slider.checkbox {
  204. cursor: pointer;
  205. height: @sliderHeight;
  206. }
  207. .ui.slider.checkbox .box,
  208. .ui.slider.checkbox label {
  209. padding-left: @sliderLabelDistance;
  210. line-height: @sliderLabelLineHeight;
  211. color: @sliderOffLabelColor;
  212. }
  213. /* Line */
  214. .ui.slider.checkbox .box:before,
  215. .ui.slider.checkbox label:before {
  216. cursor: pointer;
  217. display: block;
  218. position: absolute;
  219. content: '';
  220. top: @sliderLineVerticalOffset;
  221. left: 0em;
  222. z-index: 1;
  223. border: none !important;
  224. background-color: @sliderLineColor;
  225. width: @sliderLineWidth;
  226. height: @sliderLineHeight;
  227. transform: none;
  228. border-radius: @sliderLineRadius;
  229. transition:
  230. background 0.3s ease
  231. ;
  232. }
  233. /* Handle */
  234. .ui.slider.checkbox .box:after,
  235. .ui.slider.checkbox label:after {
  236. background: @handleBackground;
  237. position: absolute;
  238. content: '';
  239. opacity: 1;
  240. z-index: 2;
  241. border: none;
  242. box-shadow: @handleBoxShadow;
  243. width: @sliderHandleSize;
  244. height: @sliderHandleSize;
  245. top: @sliderHandleOffset;
  246. left: 0em;
  247. transform: none;
  248. border-radius: @circularRadius;
  249. transition:
  250. left 0.3s ease 0s
  251. ;
  252. }
  253. /* Focus */
  254. .ui.slider.checkbox input:focus ~ .box:before,
  255. .ui.slider.checkbox input:focus ~ label:before {
  256. background-color: @toggleFocusColor;
  257. border: none;
  258. }
  259. /* Hover */
  260. .ui.slider.checkbox .box:hover,
  261. .ui.slider.checkbox label:hover {
  262. color: @sliderHoverLabelColor;
  263. }
  264. .ui.slider.checkbox .box:hover::before,
  265. .ui.slider.checkbox label:hover::before {
  266. background: @sliderHoverLaneBackground;
  267. }
  268. /* Active */
  269. .ui.slider.checkbox input:checked ~ .box,
  270. .ui.slider.checkbox input:checked ~ label {
  271. color: @sliderOnLabelColor;
  272. }
  273. .ui.slider.checkbox input:checked ~ .box:before,
  274. .ui.slider.checkbox input:checked ~ label:before {
  275. background-color: @sliderOnLineColor;
  276. }
  277. .ui.slider.checkbox input:checked ~ .box:after,
  278. .ui.slider.checkbox input:checked ~ label:after {
  279. left: @sliderTravelDistance;
  280. }
  281. /*--------------
  282. Toggle
  283. ---------------*/
  284. .ui.toggle.checkbox {
  285. cursor: pointer;
  286. height: @toggleHeight;
  287. }
  288. .ui.toggle.checkbox .box,
  289. .ui.toggle.checkbox label {
  290. height: @toggleHandleSize;
  291. padding-left: @toggleLabelDistance;
  292. line-height: @toggleLabelLineHeight;
  293. color: @toggleOffLabelColor;
  294. }
  295. /* Switch */
  296. .ui.toggle.checkbox .box:before,
  297. .ui.toggle.checkbox label:before {
  298. cursor: pointer;
  299. display: block;
  300. position: absolute;
  301. content: '';
  302. top: @toggleLaneVerticalOffset;
  303. z-index: 1;
  304. border: none;
  305. background-color: @neutralCheckbox;
  306. width: @toggleLaneWidth;
  307. height: @toggleLaneHeight;
  308. border-radius: @toggleHandleRadius;
  309. }
  310. /* Handle */
  311. .ui.toggle.checkbox .box:after,
  312. .ui.toggle.checkbox label:after {
  313. background: @handleBackground;
  314. position: absolute;
  315. content: '';
  316. opacity: 1;
  317. z-index: 2;
  318. border: none;
  319. box-shadow: @handleBoxShadow;
  320. width: @toggleHandleSize;
  321. height: @toggleHandleSize;
  322. top: @toggleHandleOffset;
  323. left: 0em;
  324. border-radius: @circularRadius;
  325. transition:
  326. background 0.3s ease 0s,
  327. left 0.3s ease 0s
  328. ;
  329. }
  330. .ui.toggle.checkbox input ~ .box:after,
  331. .ui.toggle.checkbox input ~ label:after {
  332. left: @toggleOffOffset;
  333. }
  334. /* Focus */
  335. .ui.toggle.checkbox input:focus ~ .box:before,
  336. .ui.toggle.checkbox input:focus ~ label:before {
  337. background-color: @toggleFocusColor;
  338. border: none;
  339. }
  340. /* Hover */
  341. .ui.toggle.checkbox .box:hover::before,
  342. .ui.toggle.checkbox label:hover::before {
  343. background-color: @toggleHoverColor;
  344. border: none;
  345. }
  346. /* Active */
  347. .ui.toggle.checkbox input:checked ~ .box,
  348. .ui.toggle.checkbox input:checked ~ label {
  349. color: @toggleOnLabelColor;
  350. }
  351. .ui.toggle.checkbox input:checked ~ .box:before,
  352. .ui.toggle.checkbox input:checked ~ label:before {
  353. background-color: @toggleOnLaneColor;
  354. }
  355. .ui.toggle.checkbox input:checked ~ .box:after,
  356. .ui.toggle.checkbox input:checked ~ label:after {
  357. left: @toggleOnOffset;
  358. }
  359. /*******************************
  360. Variations
  361. *******************************/
  362. /*--------------
  363. Fitted
  364. ---------------*/
  365. .ui.fitted.checkbox .box,
  366. .ui.fitted.checkbox label {
  367. padding-left: 0em !important;
  368. }
  369. .ui.fitted.toggle.checkbox,
  370. .ui.fitted.toggle.checkbox {
  371. width: @toggleWidth;
  372. }
  373. .ui.fitted.slider.checkbox,
  374. .ui.fitted.slider.checkbox {
  375. width: @sliderWidth;
  376. }
  377. .loadUIOverrides();