Add ICU message format support
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-checkbox / paper-checkbox-extracted.js
blob7907d202250acd67a1bee45f8faf14b7fb8b6fe7
2     Polymer({
3       is: 'paper-checkbox',
5       behaviors: [
6         Polymer.PaperInkyFocusBehavior
7       ],
9       hostAttributes: {
10         role: 'checkbox',
11         'aria-checked': false,
12         tabindex: 0
13       },
15       properties: {
16         /**
17          * Fired when the checked state changes due to user interaction.
18          *
19          * @event change
20          */
22         /**
23          * Fired when the checked state changes.
24          *
25          * @event iron-change
26          */
28         /**
29          * Gets or sets the state, `true` is checked and `false` is unchecked.
30          */
31         checked: {
32           type: Boolean,
33           value: false,
34           reflectToAttribute: true,
35           notify: true,
36           observer: '_checkedChanged'
37         },
39         /**
40          * If true, the button toggles the active state with each tap or press
41          * of the spacebar.
42          */
43         toggles: {
44           type: Boolean,
45           value: true,
46           reflectToAttribute: true
47         }
48       },
50       ready: function() {
51         if (Polymer.dom(this).textContent == '') {
52           this.$.checkboxLabel.hidden = true;
53         } else {
54           this.setAttribute('aria-label', Polymer.dom(this).textContent);
55         }
56         this._isReady = true;
57       },
59       // button-behavior hook
60       _buttonStateChanged: function() {
61         if (this.disabled) {
62           return;
63         }
64         if (this._isReady) {
65           this.checked = this.active;
66         }
67       },
69       _checkedChanged: function(checked) {
70         this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
71         this.active = this.checked;
72         this.fire('iron-change');
73       },
75       _computeCheckboxClass: function(checked) {
76         if (checked) {
77           return 'checked';
78         }
79         return '';
80       },
82       _computeCheckmarkClass: function(checked) {
83         if (!checked) {
84           return 'hidden';
85         }
86         return '';
87       }
88     })
89