| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also | 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> | 8 --> |
| 9 | 9 |
| 10 <!-- | 10 <!-- |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 To change the ink color for checked state: | 25 To change the ink color for checked state: |
| 26 | 26 |
| 27 paper-checkbox::shadow #ink[checked] { | 27 paper-checkbox::shadow #ink[checked] { |
| 28 color: #4285f4; | 28 color: #4285f4; |
| 29 } | 29 } |
| 30 | 30 |
| 31 To change the checkbox checked color: | 31 To change the checkbox checked color: |
| 32 | 32 |
| 33 paper-checkbox::shadow #checkbox.checked { | 33 paper-checkbox::shadow #checkbox.checked { |
| 34 background-color: #4285f4; |
| 34 border-color: #4285f4; | 35 border-color: #4285f4; |
| 35 } | 36 } |
| 36 | 37 |
| 37 To change the ink color for unchecked state: | 38 To change the ink color for unchecked state: |
| 38 | 39 |
| 39 paper-checkbox::shadow #ink { | 40 paper-checkbox::shadow #ink { |
| 40 color: #b5b5b5; | 41 color: #b5b5b5; |
| 41 } | 42 } |
| 42 | 43 |
| 43 To change the checbox unchecked color: | 44 To change the checbox unchecked color: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 | 57 |
| 57 <polymer-element name="paper-checkbox" extends="paper-radio-button" role="checkb
ox"> | 58 <polymer-element name="paper-checkbox" extends="paper-radio-button" role="checkb
ox"> |
| 58 <template> | 59 <template> |
| 59 | 60 |
| 60 <link rel="stylesheet" href="paper-checkbox.css"> | 61 <link rel="stylesheet" href="paper-checkbox.css"> |
| 61 | 62 |
| 62 <div id="checkboxContainer" class="{{ {labeled: label} | tokenList }}" > | 63 <div id="checkboxContainer" class="{{ {labeled: label} | tokenList }}" > |
| 63 | 64 |
| 64 <paper-ripple id="ink" class="circle recenteringTouch" checked?="{{!checked}
}"></paper-ripple> | 65 <paper-ripple id="ink" class="circle recenteringTouch" checked?="{{!checked}
}"></paper-ripple> |
| 65 | 66 |
| 66 <div id="checkbox" on-animationend="{{checkboxAnimationEnd}}" on-webkitAnima
tionEnd="{{checkboxAnimationEnd}}"></div> | 67 <div id="checkbox"> |
| 68 <div id="checkmark" on-animationend="{{checkboxAnimationEnd}}" on-webkitAn
imationEnd="{{checkboxAnimationEnd}}"></div> |
| 69 </div> |
| 67 | 70 |
| 68 </div> | 71 </div> |
| 69 | 72 |
| 70 <div id="checkboxLabel" hidden?="{{!label}}">{{label}}<content></content></div
> | 73 <div id="checkboxLabel" hidden?="{{!label}}">{{label}}<content></content></div
> |
| 71 | 74 |
| 72 </template> | 75 </template> |
| 73 <script> | 76 <script> |
| 74 | 77 |
| 75 Polymer('paper-checkbox', { | 78 Polymer('paper-checkbox', { |
| 76 | 79 |
| 77 /** | 80 /** |
| 78 * Fired when the checked state changes due to user interaction. | 81 * Fired when the checked state changes due to user interaction. |
| 79 * | 82 * |
| 80 * @event change | 83 * @event change |
| 81 */ | 84 */ |
| 82 | 85 |
| 83 /** | 86 /** |
| 84 * Fired when the checked state changes. | 87 * Fired when the checked state changes. |
| 85 * | 88 * |
| 86 * @event core-change | 89 * @event core-change |
| 87 */ | 90 */ |
| 88 | 91 |
| 89 toggles: true, | 92 toggles: true, |
| 90 | 93 |
| 91 checkedChanged: function() { | 94 checkedChanged: function() { |
| 92 var cl = this.$.checkbox.classList; | 95 this.$.checkbox.classList.toggle('checked', this.checked); |
| 93 cl.toggle('checked', this.checked); | |
| 94 cl.toggle('unchecked', !this.checked); | |
| 95 cl.toggle('checkmark', !this.checked); | |
| 96 cl.toggle('box', this.checked); | |
| 97 this.setAttribute('aria-checked', this.checked ? 'true': 'false'); | 96 this.setAttribute('aria-checked', this.checked ? 'true': 'false'); |
| 97 this.$.checkmark.classList.toggle('hidden', !this.checked); |
| 98 this.fire('core-change'); | 98 this.fire('core-change'); |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 checkboxAnimationEnd: function() { | 101 checkboxAnimationEnd: function() { |
| 102 var cl = this.$.checkbox.classList; | 102 var cl = this.$.checkmark.classList; |
| 103 cl.toggle('checkmark', this.checked && !cl.contains('checkmark')); | 103 cl.toggle('hidden', !this.checked && cl.contains('hidden')); |
| 104 cl.toggle('box', !this.checked && !cl.contains('box')); | |
| 105 } | 104 } |
| 106 | 105 |
| 107 }); | 106 }); |
| 108 | 107 |
| 109 </script> | 108 </script> |
| 110 </polymer-element> | 109 </polymer-element> |
| OLD | NEW |