Home | History | Annotate | Download | only in paper-radio-button
      1 
      2 
      3   Polymer('paper-radio-button', {
      4     
      5     /**
      6      * Fired when the checked state changes.
      7      *
      8      * @event change
      9      */
     10     
     11     publish: {
     12       /**
     13        * Gets or sets the state, `true` is checked and `false` is unchecked.
     14        *
     15        * @attribute checked
     16        * @type boolean
     17        * @default false
     18        */
     19       checked: {value: false, reflect: true},
     20       
     21       /**
     22        * The label for the radio button.
     23        *
     24        * @attribute label
     25        * @type string
     26        * @default ''
     27        */
     28       label: '',
     29       
     30       /**
     31        * Normally the user cannot uncheck the radio button by tapping once
     32        * checked.  Setting this property to `true` makes the radio button
     33        * toggleable from checked to unchecked.
     34        *
     35        * @attribute toggles
     36        * @type boolean
     37        * @default false
     38        */
     39       toggles: false,
     40       
     41       /**
     42        * If true, the user cannot interact with this element.
     43        *
     44        * @attribute disabled
     45        * @type boolean
     46        * @default false
     47        */
     48       disabled: {value: false, reflect: true}
     49     },
     50     
     51     eventDelegates: {
     52       tap: 'tap'
     53     },
     54     
     55     tap: function() {
     56       this.toggle();
     57       this.fire('paper-radio-button-activate');
     58     },
     59     
     60     toggle: function() {
     61       this.checked = !this.toggles || !this.checked;
     62     },
     63     
     64     checkedChanged: function() {
     65       this.$.onRadio.classList.toggle('fill', this.checked);
     66       this.setAttribute('aria-checked', this.checked ? 'true': 'false');
     67       this.fire('change');
     68     },
     69     
     70     labelChanged: function() {
     71       this.setAttribute('aria-label', this.label);
     72     }
     73     
     74   });
     75   
     76