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

Side by Side Diff: third_party/polymer/v0_8/components/paper-radio-button/paper-radio-button.html

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh 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-radio-button-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 <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">
58
59 <link rel="import" type="css" href="paper-radio-button.css">
60
61 <template>
62
63 <div id="radioContainer">
64 <div id="offRadio"></div>
65 <div id="onRadio"></div>
66 <paper-ripple id="ink" class="circle" center checked$="[[checked]]"></pape r-ripple>
67 </div>
68
69 <div id="radioLabel" aria-hidden="true"><content></content></div>
70
71 </template>
72
73 <script>
74 Polymer({
75 is: 'paper-radio-button',
76
77 behaviors: [
78 Polymer.PaperRadioButtonBehavior
79 ],
80
81 hostAttributes: {
82 role: 'radio',
83 'aria-checked': false,
84 tabindex: 0
85 },
86
87 properties: {
88 /**
89 * Fired when the checked state changes due to user interaction.
90 *
91 * @event change
92 */
93
94 /**
95 * Fired when the checked state changes.
96 *
97 * @event iron-change
98 */
99
100 /**
101 * Gets or sets the state, `true` is checked and `false` is unchecked.
102 */
103 checked: {
104 type: Boolean,
105 value: false,
106 reflectToAttribute: true,
107 notify: true,
108 observer: '_checkedChanged'
109 },
110
111 /**
112 * If true, the button toggles the active state with each tap or press
113 * of the spacebar.
114 */
115 toggles: {
116 type: Boolean,
117 value: true,
118 reflectToAttribute: true
119 }
120 },
121
122 ready: function() {
123 if (Polymer.dom(this).textContent == '') {
124 this.$.radioLabel.hidden = true;
125 } else {
126 this.setAttribute('aria-label', Polymer.dom(this).textContent);
127 }
128 this._isReady = true;
129 },
130
131 _buttonStateChanged: function() {
132 if (this.disabled) {
133 return;
134 }
135 if (this._isReady) {
136 this.checked = this.active;
137 }
138 },
139
140 _checkedChanged: function() {
141 this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
142 this.active = this.checked;
143 this.fire('iron-change');
144 }
145 })
146 </script>
147
148 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698