791 views
1@supports (-webkit-appearance: none) or (-moz-appearance: none) { 2 .checkbox-wrapper-13 input[type=checkbox] { 3 --active: #275EFE; 4 --active-inner: #fff; 5 --focus: 2px rgba(39, 94, 254, .3); 6 --border: #BBC1E1; 7 --border-hover: #275EFE; 8 --background: #fff; 9 --disabled: #F6F8FF; 10 --disabled-inner: #E1E6F9; 11 -webkit-appearance: none; 12 -moz-appearance: none; 13 height: 21px; 14 outline: none; 15 display: inline-block; 16 vertical-align: top; 17 position: relative; 18 margin: 0; 19 cursor: pointer; 20 border: 1px solid var(--bc, var(--border)); 21 background: var(--b, var(--background)); 22 transition: background 0.3s, border-color 0.3s, box-shadow 0.2s; 23 } 24 25 .checkbox-wrapper-13 input[type=checkbox]:after { 26 content: ""; 27 display: block; 28 left: 0; 29 top: 0; 30 position: absolute; 31 transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s); 32 } 33 34 .checkbox-wrapper-13 input[type=checkbox]:checked { 35 --b: var(--active); 36 --bc: var(--active); 37 --d-o: .3s; 38 --d-t: .6s; 39 --d-t-e: cubic-bezier(.2, .85, .32, 1.2); 40 } 41 42 .checkbox-wrapper-13 input[type=checkbox]:disabled { 43 --b: var(--disabled); 44 cursor: not-allowed; 45 opacity: 0.9; 46 } 47 48 .checkbox-wrapper-13 input[type=checkbox]:disabled:checked { 49 --b: var(--disabled-inner); 50 --bc: var(--border); 51 } 52 53 .checkbox-wrapper-13 input[type=checkbox]:disabled + label { 54 cursor: not-allowed; 55 } 56 57 .checkbox-wrapper-13 input[type=checkbox]:hover:not(:checked):not(:disabled) { 58 --bc: var(--border-hover); 59 } 60 61 .checkbox-wrapper-13 input[type=checkbox]:focus { 62 box-shadow: 0 0 0 var(--focus); 63 } 64 65 .checkbox-wrapper-13 input[type=checkbox]:not(.switch) { 66 width: 21px; 67 } 68 69 .checkbox-wrapper-13 input[type=checkbox]:not(.switch):after { 70 opacity: var(--o, 0); 71 } 72 73 .checkbox-wrapper-13 input[type=checkbox]:not(.switch):checked { 74 --o: 1; 75 } 76 77 .checkbox-wrapper-13 input[type=checkbox] + label { 78 display: inline-block; 79 vertical-align: middle; 80 cursor: pointer; 81 margin-left: 4px; 82 } 83 84 .checkbox-wrapper-13 input[type=checkbox]:not(.switch) { 85 border-radius: 7px; 86 } 87 88 .checkbox-wrapper-13 input[type=checkbox]:not(.switch):after { 89 width: 5px; 90 height: 9px; 91 border: 2px solid var(--active-inner); 92 border-top: 0; 93 border-left: 0; 94 left: 7px; 95 top: 4px; 96 transform: rotate(var(--r, 20deg)); 97 } 98 99 .checkbox-wrapper-13 input[type=checkbox]:not(.switch):checked { 100 --r: 43deg; 101 } 102} 103 104.checkbox-wrapper-13 * { 105 box-sizing: inherit; 106} 107 108.checkbox-wrapper-13 *:before, 109 .checkbox-wrapper-13 *:after { 110 box-sizing: inherit; 111} 112 113
guilhermeyohan
Guilherme Yohan
MIT License