Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | @mixin checkbox-variant($box, $check, $label) { |
| 2 | label { |
||
| 3 | color: $label; |
||
| 4 | } |
||
| 5 | |||
| 6 | label > .box { |
||
| 7 | border-color: $box; |
||
| 8 | } |
||
| 9 | |||
| 10 | label > .check { |
||
| 11 | border-color: $check; |
||
| 12 | } |
||
| 13 | } |
||
| 14 | |||
| 15 | @mixin checkbox-label-variant($color) { |
||
| 16 | label { |
||
| 17 | color: $color; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | |||
| 22 | .md-checkbox { |
||
| 23 | position:relative; |
||
| 24 | |||
| 25 | // Inline checkbox |
||
| 26 | |||
| 27 | &.md-checkbox-inline { |
||
| 28 | display: inline-block; |
||
| 29 | } |
||
| 30 | |||
| 31 | .form-inline &.md-checkbox-inline { |
||
| 32 | margin-right: 20px; |
||
| 33 | top: 3px; |
||
| 34 | } |
||
| 35 | |||
| 36 | input[type=checkbox] { |
||
| 37 | visibility: hidden; |
||
| 38 | position: absolute; |
||
| 39 | } |
||
| 40 | |||
| 41 | label { |
||
| 42 | cursor:pointer; |
||
| 43 | padding-left: 30px; |
||
| 44 | } |
||
| 45 | |||
| 46 | label > span { |
||
| 47 | display:block; |
||
| 48 | position:absolute; |
||
| 49 | left:0; |
||
| 50 | -webkit-transition-duration:0.3s; |
||
| 51 | -moz-transition-duration:0.3s; |
||
| 52 | transition-duration:0.3s; |
||
| 53 | } |
||
| 54 | |||
| 55 | label > span.inc { |
||
| 56 | background: #fff; |
||
| 57 | left:-20px; |
||
| 58 | top:-20px; |
||
| 59 | height:60px; |
||
| 60 | width:60px; |
||
| 61 | opacity:0; |
||
| 62 | border-radius:50% !important; |
||
| 63 | -moz-border-radius:50% !important; |
||
| 64 | -webkit-border-radius:50% !important; |
||
| 65 | } |
||
| 66 | |||
| 67 | label > .box { |
||
| 68 | top:0px; |
||
| 69 | border:2px solid $input-md-checkbox-box-color; |
||
| 70 | height:20px; |
||
| 71 | width:20px; |
||
| 72 | z-index:5; |
||
| 73 | -webkit-transition-delay:0.2s; -moz-transition-delay:0.2s; transition-delay:0.2s; |
||
| 74 | } |
||
| 75 | |||
| 76 | label > .check { |
||
| 77 | top: -4px; |
||
| 78 | left: 6px; |
||
| 79 | width: 10px; |
||
| 80 | height: 20px; |
||
| 81 | border:2px solid $input-md-focus-border; |
||
| 82 | border-top: none; |
||
| 83 | border-left: none; |
||
| 84 | opacity:0; |
||
| 85 | z-index:5; |
||
| 86 | -webkit-transform:rotate(180deg); |
||
| 87 | -moz-transform:rotate(180deg); |
||
| 88 | transform:rotate(180deg); |
||
| 89 | -webkit-transition-delay:0.3s; |
||
| 90 | -moz-transition-delay:0.3s; transition-delay:0.3s; |
||
| 91 | } |
||
| 92 | |||
| 93 | /* handling click events */ |
||
| 94 | |||
| 95 | /* when checkbox is checked */ |
||
| 96 | label > span.inc { |
||
| 97 | -webkit-animation :growCircle 0.3s ease; |
||
| 98 | -moz-animation :growCircle 0.3s ease; |
||
| 99 | animation :growCircle 0.3s ease; |
||
| 100 | } |
||
| 101 | |||
| 102 | input[type=checkbox]:checked ~ label > .box { |
||
| 103 | opacity:0; |
||
| 104 | -webkit-transform :scale(0) rotate(-180deg); |
||
| 105 | -moz-transform :scale(0) rotate(-180deg); |
||
| 106 | transform :scale(0) rotate(-180deg); |
||
| 107 | } |
||
| 108 | |||
| 109 | input[type=checkbox]:checked ~ label > .check { |
||
| 110 | opacity:1; |
||
| 111 | -webkit-transform :scale(1) rotate(45deg); |
||
| 112 | -moz-transform :scale(1) rotate(45deg); |
||
| 113 | transform :scale(1) rotate(45deg); |
||
| 114 | } |
||
| 115 | |||
| 116 | // Disabled state |
||
| 117 | input[type=checkbox]:disabled ~ label, |
||
| 118 | input[type=checkbox][disabled] ~ label { |
||
| 119 | cursor: not-allowed; |
||
| 120 | @include opacity($input-md-checkbox-disabled-opacity); |
||
| 121 | } |
||
| 122 | |||
| 123 | input[type=checkbox]:disabled ~ label > .box, |
||
| 124 | input[type=checkbox][disabled] ~ label > .box { |
||
| 125 | cursor: not-allowed; |
||
| 126 | @include opacity($input-md-checkbox-disabled-opacity); |
||
| 127 | } |
||
| 128 | |||
| 129 | input[type=checkbox]:disabled:checked ~ label > .check, |
||
| 130 | input[type=checkbox][disabled]:checked ~ label > .check { |
||
| 131 | cursor: not-allowed; |
||
| 132 | @include opacity($input-md-checkbox-disabled-opacity); |
||
| 133 | } |
||
| 134 | } |
||
| 135 | |||
| 136 | // Error states |
||
| 137 | //checkbox-variant($box, $check, $label) |
||
| 138 | |||
| 139 | .has-error .md-checkbox, |
||
| 140 | .has-error.md-checkbox { |
||
| 141 | @include checkbox-variant($state-danger-text, $state-danger-text, $state-danger-text); |
||
| 142 | } |
||
| 143 | |||
| 144 | .has-success .md-checkbox, |
||
| 145 | .has-success.md-checkbox { |
||
| 146 | @include checkbox-variant($state-success-text, $state-success-text, $state-success-text); |
||
| 147 | } |
||
| 148 | |||
| 149 | .has-warning .md-checkbox, |
||
| 150 | .has-warning.md-checkbox { |
||
| 151 | @include checkbox-variant($state-warning-text, $state-warning-text, $state-warning-text); |
||
| 152 | } |
||
| 153 | |||
| 154 | .has-info .md-checkbox, |
||
| 155 | .has-info.md-checkbox { |
||
| 156 | @include checkbox-variant($state-info-text, $state-info-text, $state-info-text); |
||
| 157 | } |
||
| 158 | |||
| 159 | .form-md-checkboxes { |
||
| 160 | padding-top: 5px; |
||
| 161 | |||
| 162 | > label { |
||
| 163 | font-size: $input-md-label-font-size; |
||
| 164 | color: $input-md-label-color; |
||
| 165 | @include opacity($input-md-label-opacity); |
||
| 166 | } |
||
| 167 | |||
| 168 | &.has-error { |
||
| 169 | @if $theme-type == "material-design" { |
||
| 170 | @include checkbox-label-variant($state-danger-bg); |
||
| 171 | } @else { |
||
| 172 | @include checkbox-label-variant($brand-danger); |
||
| 173 | } |
||
| 174 | } |
||
| 175 | |||
| 176 | &.has-info { |
||
| 177 | @if $theme-type == "material-design" { |
||
| 178 | @include checkbox-label-variant($state-info-bg); |
||
| 179 | } @else { |
||
| 180 | @include checkbox-label-variant($brand-info); |
||
| 181 | } |
||
| 182 | } |
||
| 183 | |||
| 184 | &.has-success { |
||
| 185 | @if $theme-type == "material-design" { |
||
| 186 | @include checkbox-label-variant($state-success-bg); |
||
| 187 | } @else { |
||
| 188 | @include checkbox-label-variant($brand-success); |
||
| 189 | } |
||
| 190 | } |
||
| 191 | |||
| 192 | &.has-warning { |
||
| 193 | @if $theme-type == "material-design" { |
||
| 194 | @include checkbox-label-variant($state-warning-bg); |
||
| 195 | } @else { |
||
| 196 | @include checkbox-label-variant($brand-warning); |
||
| 197 | } |
||
| 198 | } |
||
| 199 | } |
||
| 200 | |||
| 201 | .md-checkbox-list { |
||
| 202 | margin: 5px 0 5px 0; |
||
| 203 | |||
| 204 | .form-horizontal & { |
||
| 205 | margin-top: 5px; |
||
| 206 | } |
||
| 207 | |||
| 208 | .md-checkbox { |
||
| 209 | display: block; |
||
| 210 | margin-bottom: 10px; |
||
| 211 | |||
| 212 | &:last-child { |
||
| 213 | margin-bottom: 0; |
||
| 214 | } |
||
| 215 | } |
||
| 216 | } |
||
| 217 | |||
| 218 | .md-checkbox-inline { |
||
| 219 | margin: 5px 0 5px 0; |
||
| 220 | |||
| 221 | .form-horizontal & { |
||
| 222 | margin-top: 7px; |
||
| 223 | } |
||
| 224 | |||
| 225 | .md-checkbox { |
||
| 226 | display: inline-block; |
||
| 227 | margin-right: 20px; |
||
| 228 | |||
| 229 | &:last-child { |
||
| 230 | margin-right: 0; |
||
| 231 | } |
||
| 232 | } |
||
| 233 | } |
||
| 234 | |||
| 235 | /* bubble animation */ |
||
| 236 | |||
| 237 | @-webkit-keyframes growCircle { |
||
| 238 | 0%, 100% { -webkit-transform:scale(0); opacity: 1} |
||
| 239 | 70% { background:#eee; -webkit-transform:scale(1.25); } |
||
| 240 | } |
||
| 241 | @-moz-keyframes growCircle { |
||
| 242 | 0%, 100% { -moz-transform:scale(0); opacity: 1} |
||
| 243 | 70% { background:#eee; -moz-transform:scale(1.25); } |
||
| 244 | } |
||
| 245 | @keyframes growCircle { |
||
| 246 | 0%, 100% { transform:scale(0); opacity: 1} |
||
| 247 | 70% { background:#eee; transform:scale(1.25); } |
||
| 248 | } |