| OLD | NEW |
| 1 Polymer({ | 1 Polymer({ |
| 2 is: 'paper-checkbox', | 2 is: 'paper-checkbox', |
| 3 | 3 |
| 4 behaviors: [ | 4 behaviors: [ |
| 5 Polymer.PaperCheckedElementBehavior | 5 Polymer.PaperCheckedElementBehavior |
| 6 ], | 6 ], |
| 7 | 7 |
| 8 hostAttributes: { | 8 hostAttributes: { |
| 9 role: 'checkbox', | 9 role: 'checkbox', |
| 10 'aria-checked': false, | 10 'aria-checked': false, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * Fired when the checked state changes. | 22 * Fired when the checked state changes. |
| 23 * | 23 * |
| 24 * @event iron-change | 24 * @event iron-change |
| 25 */ | 25 */ |
| 26 ariaActiveAttribute: { | 26 ariaActiveAttribute: { |
| 27 type: String, | 27 type: String, |
| 28 value: 'aria-checked' | 28 value: 'aria-checked' |
| 29 } | 29 } |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 attached: function() { |
| 33 var inkSize = this.getComputedStyleValue('--calculated-paper-checkbox-in
k-size'); |
| 34 // If unset, compute and set the default `--paper-checkbox-ink-size`. |
| 35 if (inkSize === '-1px') { |
| 36 var checkboxSize = parseFloat(this.getComputedStyleValue('--calculated
-paper-checkbox-size')); |
| 37 var defaultInkSize = Math.floor((8 / 3) * checkboxSize); |
| 38 |
| 39 // The checkbox and ripple need to have the same parity so that their |
| 40 // centers align. |
| 41 if (defaultInkSize % 2 !== checkboxSize % 2) { |
| 42 defaultInkSize++; |
| 43 } |
| 44 |
| 45 this.customStyle['--paper-checkbox-ink-size'] = defaultInkSize + 'px'; |
| 46 this.updateStyles(); |
| 47 } |
| 48 }, |
| 49 |
| 32 _computeCheckboxClass: function(checked, invalid) { | 50 _computeCheckboxClass: function(checked, invalid) { |
| 33 var className = ''; | 51 var className = ''; |
| 34 if (checked) { | 52 if (checked) { |
| 35 className += 'checked '; | 53 className += 'checked '; |
| 36 } | 54 } |
| 37 if (invalid) { | 55 if (invalid) { |
| 38 className += 'invalid'; | 56 className += 'invalid'; |
| 39 } | 57 } |
| 40 return className; | 58 return className; |
| 41 }, | 59 }, |
| 42 | 60 |
| 43 _computeCheckmarkClass: function(checked) { | 61 _computeCheckmarkClass: function(checked) { |
| 44 return checked ? '' : 'hidden'; | 62 return checked ? '' : 'hidden'; |
| 45 }, | 63 }, |
| 46 | 64 |
| 47 // create ripple inside the checkboxContainer | 65 // create ripple inside the checkboxContainer |
| 48 _createRipple: function() { | 66 _createRipple: function() { |
| 49 this._rippleContainer = this.$.checkboxContainer; | 67 this._rippleContainer = this.$.checkboxContainer; |
| 50 return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this); | 68 return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this); |
| 51 } | 69 } |
| 52 | 70 |
| 53 }); | 71 }); |
| OLD | NEW |