Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: polymer_1.0.4/bower_components/paper-radio-button/paper-radio-button.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!--
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
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
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
8 -->
9
10 <link rel="import" href="../polymer/polymer.html">
11 <link rel="import" href="../paper-ripple/paper-ripple.html">
12 <link rel="import" href="../paper-styles/default-theme.html">
13 <link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html">
14
15 <!--
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
18 tapping once checked.
19
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.
22
23 Example:
24
25 <paper-radio-button></paper-radio-button>
26
27 ### Styling
28
29 The following custom properties and mixins are available for styling:
30
31 Custom property | Description | Default
32 ----------------|-------------|----------
33 `--paper-radio-button-unchecked-color` | Radio button color when the input is no t checked | `--primary-text-color`
34 `--paper-radio-button-unchecked-ink-color` | Selected/focus ripple color when th e input is not checked | `--primary-text-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`
37 `--paper-radio-button-label-color` | Label color | `--primary-text-color`
38
39 @group Paper Elements
40 @element paper-radio-button
41 @hero hero.svg
42 @demo demo/index.html
43 -->
44
45 <dom-module id="paper-radio-button">
46
47 <link rel="import" type="css" href="paper-radio-button.css">
48
49 <template>
50
51 <div id="radioContainer">
52 <div id="offRadio"></div>
53 <div id="onRadio"></div>
54 <paper-ripple id="ink" class="circle" center checked$="[[checked]]"></pape r-ripple>
55 </div>
56
57 <div id="radioLabel" aria-hidden="true"><content></content></div>
58
59 </template>
60
61 <script>
62 Polymer({
63 is: 'paper-radio-button',
64
65 behaviors: [
66 Polymer.PaperInkyFocusBehavior
67 ],
68
69 hostAttributes: {
70 role: 'radio',
71 'aria-checked': false,
72 tabindex: 0
73 },
74
75 properties: {
76 /**
77 * Fired when the checked state changes due to user interaction.
78 *
79 * @event change
80 */
81
82 /**
83 * Fired when the checked state changes.
84 *
85 * @event iron-change
86 */
87
88 /**
89 * Gets or sets the state, `true` is checked and `false` is unchecked.
90 */
91 checked: {
92 type: Boolean,
93 value: false,
94 reflectToAttribute: true,
95 notify: true,
96 observer: '_checkedChanged'
97 },
98
99 /**
100 * If true, the button toggles the active state with each tap or press
101 * of the spacebar.
102 */
103 toggles: {
104 type: Boolean,
105 value: true,
106 reflectToAttribute: true
107 }
108 },
109
110 ready: function() {
111 if (Polymer.dom(this).textContent == '') {
112 this.$.radioLabel.hidden = true;
113 } else {
114 this.setAttribute('aria-label', Polymer.dom(this).textContent);
115 }
116 this._isReady = true;
117 },
118
119 _buttonStateChanged: function() {
120 if (this.disabled) {
121 return;
122 }
123 if (this._isReady) {
124 this.checked = this.active;
125 }
126 },
127
128 _checkedChanged: function() {
129 this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
130 this.active = this.checked;
131 this.fire('iron-change');
132 }
133 })
134 </script>
135
136 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698