|
| 1 | +<!-- |
| 2 | +@license |
| 3 | +Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
| 4 | +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt |
| 5 | +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 | +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt |
| 7 | +Code distributed by Google as part of the polymer project is also |
| 8 | +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
| 9 | +--> |
| 10 | + |
| 11 | +<link rel="import" href="../bower_components/polymer/polymer.html"> |
| 12 | + |
| 13 | +<dom-module id="shop-checkbox"> |
| 14 | + <template> |
| 15 | + <style> |
| 16 | + |
| 17 | + shop-checkbox { |
| 18 | + display: inline-block; |
| 19 | + width: 14px; |
| 20 | + height: 14px; |
| 21 | + position: relative; |
| 22 | + border: 2px solid var(--app-accent-color); |
| 23 | + border-radius: 2px; |
| 24 | + } |
| 25 | + |
| 26 | + shop-checkbox > input[type=checkbox] { |
| 27 | + position: absolute; |
| 28 | + top: 0; |
| 29 | + left: 0; |
| 30 | + width: 100%; |
| 31 | + height: 100%; |
| 32 | + margin: 0; |
| 33 | + opacity: 0; |
| 34 | + } |
| 35 | + |
| 36 | + shop-checkbox > shop-md-decorator { |
| 37 | + pointer-events: none; |
| 38 | + } |
| 39 | + |
| 40 | + /* Checked state overlay */ |
| 41 | + shop-checkbox > shop-md-decorator::after { |
| 42 | + content: ''; |
| 43 | + position: absolute; |
| 44 | + top: -5px; |
| 45 | + left: -5px; |
| 46 | + right: -5px; |
| 47 | + bottom: -5px; |
| 48 | + background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23172C50%22%20d%3D%22M19%203H5c-1.11%200-2%20.9-2%202v14c0%201.1.89%202%202%202h14c1.11%200%202-.9%202-2V5c0-1.1-.89-2-2-2zm-9%2014l-5-5%201.41-1.41L10%2014.17l7.59-7.59L19%208l-9%209z%22%2F%3E%3C%2Fsvg%3E'); |
| 49 | + opacity: 0; |
| 50 | + transition: opacity 0.1s; |
| 51 | + will-change: opacity; |
| 52 | + } |
| 53 | + |
| 54 | + shop-checkbox > input[type=checkbox]:checked + shop-md-decorator::after { |
| 55 | + opacity: 1; |
| 56 | + } |
| 57 | + |
| 58 | + /* Focused state */ |
| 59 | + shop-checkbox > shop-md-decorator::before { |
| 60 | + content: ''; |
| 61 | + pointer-events: none; |
| 62 | + position: absolute; |
| 63 | + top: -13px; |
| 64 | + left: -13px; |
| 65 | + width: 40px; |
| 66 | + height: 40px; |
| 67 | + background-color: var(--app-accent-color); |
| 68 | + border-radius: 50%; |
| 69 | + opacity: 0.2; |
| 70 | + -webkit-transform: scale3d(0, 0, 0); |
| 71 | + transform: scale3d(0, 0, 0); |
| 72 | + transition: -webkit-transform 0.1s; |
| 73 | + transition: transform 0.1s; |
| 74 | + will-change: transform; |
| 75 | + } |
| 76 | + |
| 77 | + shop-checkbox > input[type=checkbox]:focus + shop-md-decorator::before { |
| 78 | + -webkit-transform: scale3d(1, 1, 1); |
| 79 | + transform: scale3d(1, 1, 1); |
| 80 | + } |
| 81 | + |
| 82 | + </style> |
| 83 | + </template> |
| 84 | +</dom-module> |
0 commit comments