| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2015 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 <link rel="import" href="../polymer/polymer.html"> | 10 <link rel="import" href="../polymer/polymer.html"> |
| 11 <link rel="import" href="../paper-ripple/paper-ripple.html"> | 11 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 12 <link rel="import" href="../paper-styles/default-theme.html"> | 12 <link rel="import" href="../paper-styles/default-theme.html"> |
| 13 <link rel="import" href="../paper-behaviors/paper-radio-button-behavior.html"> | 13 <link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html"> |
| 14 | 14 |
| 15 <!-- | 15 <!-- |
| 16 `paper-radio-button` is a button that can be either checked or unchecked. | 16 `paper-radio-button` is a button that can be either checked or unchecked. |
| 17 User can tap the radio button to check it. But it cannot be unchecked by | 17 User can tap the radio button to check it. But it cannot be unchecked by |
| 18 tapping once checked. | 18 tapping once checked. |
| 19 | 19 |
| 20 Use `paper-radio-group` to group a set of radio buttons. When radio buttons | 20 Use `paper-radio-group` to group a set of radio buttons. When radio buttons |
| 21 are inside a radio group, only one radio button in the group can be checked. | 21 are inside a radio group, only one radio button in the group can be checked. |
| 22 | 22 |
| 23 Example: | 23 Example: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 `--paper-radio-button-checked-color` | Radio button color when the input is chec
ked | `--default-primary-color` | 35 `--paper-radio-button-checked-color` | Radio button color when the input is chec
ked | `--default-primary-color` |
| 36 `--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the
input is checked | `--default-primary-color` | 36 `--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the
input is checked | `--default-primary-color` |
| 37 `--paper-radio-button-label-color` | Label color | `--primary-text-color` | 37 `--paper-radio-button-label-color` | Label color | `--primary-text-color` |
| 38 | 38 |
| 39 @group Paper Elements | 39 @group Paper Elements |
| 40 @element paper-radio-button | 40 @element paper-radio-button |
| 41 @hero hero.svg | 41 @hero hero.svg |
| 42 @demo demo/index.html | 42 @demo demo/index.html |
| 43 --> | 43 --> |
| 44 | 44 |
| 45 <style is="custom-style"> | |
| 46 :root { | |
| 47 --paper-radio-button-unchecked-color: var(--primary-text-color); | |
| 48 --paper-radio-button-unchecked-ink-color: var(--primary-text-color); | |
| 49 | |
| 50 --paper-radio-button-checked-color: var(--default-primary-color); | |
| 51 --paper-radio-button-checked-ink-color: var(--default-primary-color); | |
| 52 | |
| 53 --paper-radio-button-label-color: var(--primary-text-color); | |
| 54 } | |
| 55 </style> | |
| 56 | |
| 57 <dom-module id="paper-radio-button"> | 45 <dom-module id="paper-radio-button"> |
| 58 | 46 |
| 59 <link rel="import" type="css" href="paper-radio-button.css"> | 47 <link rel="import" type="css" href="paper-radio-button.css"> |
| 60 | 48 |
| 61 <template> | 49 <template> |
| 62 | 50 |
| 63 <div id="radioContainer"> | 51 <div id="radioContainer"> |
| 64 <div id="offRadio"></div> | 52 <div id="offRadio"></div> |
| 65 <div id="onRadio"></div> | 53 <div id="onRadio"></div> |
| 66 <paper-ripple id="ink" class="circle" center checked$="[[checked]]"></pape
r-ripple> | 54 <paper-ripple id="ink" class="circle" center checked$="[[checked]]"></pape
r-ripple> |
| 67 </div> | 55 </div> |
| 68 | 56 |
| 69 <div id="radioLabel" aria-hidden="true"><content></content></div> | 57 <div id="radioLabel" aria-hidden="true"><content></content></div> |
| 70 | 58 |
| 71 </template> | 59 </template> |
| 72 | 60 |
| 73 <script> | 61 <script> |
| 74 Polymer({ | 62 Polymer({ |
| 75 is: 'paper-radio-button', | 63 is: 'paper-radio-button', |
| 76 | 64 |
| 77 behaviors: [ | 65 behaviors: [ |
| 78 Polymer.PaperRadioButtonBehavior | 66 Polymer.PaperInkyFocusBehavior |
| 79 ], | 67 ], |
| 80 | 68 |
| 81 hostAttributes: { | 69 hostAttributes: { |
| 82 role: 'radio', | 70 role: 'radio', |
| 83 'aria-checked': false, | 71 'aria-checked': false, |
| 84 tabindex: 0 | 72 tabindex: 0 |
| 85 }, | 73 }, |
| 86 | 74 |
| 87 properties: { | 75 properties: { |
| 88 /** | 76 /** |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 127 |
| 140 _checkedChanged: function() { | 128 _checkedChanged: function() { |
| 141 this.setAttribute('aria-checked', this.checked ? 'true' : 'false'); | 129 this.setAttribute('aria-checked', this.checked ? 'true' : 'false'); |
| 142 this.active = this.checked; | 130 this.active = this.checked; |
| 143 this.fire('iron-change'); | 131 this.fire('iron-change'); |
| 144 } | 132 } |
| 145 }) | 133 }) |
| 146 </script> | 134 </script> |
| 147 | 135 |
| 148 </dom-module> | 136 </dom-module> |
| OLD | NEW |