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

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

Issue 2113853002: Run bower update (Closed) Base URL: https://github.com/catapult-project/catapult@polymer10-migration
Patch Set: Created 4 years, 5 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
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
11 <link rel="import" href="../polymer/polymer.html"> 11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
13 <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
12 <link rel="import" href="../paper-material/paper-material.html"> 14 <link rel="import" href="../paper-material/paper-material.html">
13 <link rel="import" href="../paper-ripple/paper-ripple.html">
14 <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
15 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
16 15
17 <!-- 16 <!--
18 Material design: [Buttons](https://www.google.com/design/spec/components/buttons .html) 17 Material design: [Buttons](https://www.google.com/design/spec/components/buttons .html)
19 18
20 `paper-button` is a button. When the user touches the button, a ripple effect em anates 19 `paper-button` is a button. When the user touches the button, a ripple effect em anates
21 from the point of contact. It may be flat or raised. A raised button is styled w ith a 20 from the point of contact. It may be flat or raised. A raised button is styled w ith a
22 shadow. 21 shadow.
23 22
24 Example: 23 Example:
25 24
26 <paper-button>Flat button</paper-button> 25 <paper-button>Flat button</paper-button>
27 <paper-button raised>Raised button</paper-button> 26 <paper-button raised>Raised button</paper-button>
28 <paper-button noink>No ripple effect</paper-button> 27 <paper-button noink>No ripple effect</paper-button>
29 <paper-button toggles>Toggle-able button</paper-button> 28 <paper-button toggles>Toggle-able button</paper-button>
30 29
31 A button that has `toggles` true will remain `active` after being clicked (and 30 A button that has `toggles` true will remain `active` after being clicked (and
32 will have an `active` attribute set). For more information, see the `Polymer.Iro nButtonState` 31 will have an `active` attribute set). For more information, see the `Polymer.Iro nButtonState`
33 behavior. 32 behavior.
34 33
35 You may use custom DOM in the button body to create a variety of buttons. For ex ample, to 34 You may use custom DOM in the button body to create a variety of buttons. For ex ample, to
36 create a button with an icon and some text: 35 create a button with an icon and some text:
37 36
38 <paper-button> 37 <paper-button>
39 <iron-icon icon="favorite"></iron-icon> 38 <iron-icon icon="favorite"></iron-icon>
40 custom button content 39 custom button content
41 </paper-button> 40 </paper-button>
42 41
42 To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` will already
43 receive focus, you may want to prevent the anchor tag from receiving focus as we ll by setting
44 its tabindex to -1.
45
46 <a href="https://www.polymer-project.org/" tabindex="-1">
47 <paper-button raised>Polymer Project</paper-button>
48 </a>
49
43 ### Styling 50 ### Styling
44 51
45 Style the button with CSS as you would a normal DOM element. 52 Style the button with CSS as you would a normal DOM element.
46 53
47 paper-button.fancy { 54 paper-button.fancy {
48 background: green; 55 background: green;
49 color: yellow; 56 color: yellow;
50 } 57 }
51 58
52 paper-button.fancy:hover { 59 paper-button.fancy:hover {
(...skipping 16 matching lines...) Expand all
69 `--paper-button` | Mixin applied to the button | `{}` 76 `--paper-button` | Mixin applied to the button | `{}`
70 `--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` 77 `--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}`
71 `--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` 78 `--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}`
72 `--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` 79 `--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}`
73 80
74 @demo demo/index.html 81 @demo demo/index.html
75 --> 82 -->
76 83
77 <dom-module id="paper-button"> 84 <dom-module id="paper-button">
78 <template strip-whitespace> 85 <template strip-whitespace>
79
80 <style include="paper-material"> 86 <style include="paper-material">
81 :host { 87 :host {
82 display: inline-block; 88 @apply(--layout-inline);
89 @apply(--layout-center-center);
83 position: relative; 90 position: relative;
84 box-sizing: border-box; 91 box-sizing: border-box;
85 min-width: 5.14em; 92 min-width: 5.14em;
86 margin: 0 0.29em; 93 margin: 0 0.29em;
87 background: transparent; 94 background: transparent;
88 text-align: center; 95 -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
96 -webkit-tap-highlight-color: transparent;
89 font: inherit; 97 font: inherit;
90 text-transform: uppercase; 98 text-transform: uppercase;
91 outline-width: 0; 99 outline-width: 0;
92 border-radius: 3px; 100 border-radius: 3px;
93 -moz-user-select: none; 101 -moz-user-select: none;
94 -ms-user-select: none; 102 -ms-user-select: none;
95 -webkit-user-select: none; 103 -webkit-user-select: none;
96 user-select: none; 104 user-select: none;
97 cursor: pointer; 105 cursor: pointer;
98 z-index: 0; 106 z-index: 0;
99 padding: 0.7em 0.57em; 107 padding: 0.7em 0.57em;
100 108
109 @apply(--paper-font-common-base);
101 @apply(--paper-button); 110 @apply(--paper-button);
102 } 111 }
103 112
104 :host([raised].keyboard-focus) { 113 :host([raised].keyboard-focus) {
105 font-weight: bold; 114 font-weight: bold;
106 @apply(--paper-button-raised-keyboard-focus); 115 @apply(--paper-button-raised-keyboard-focus);
107 } 116 }
108 117
109 :host(:not([raised]).keyboard-focus) { 118 :host(:not([raised]).keyboard-focus) {
110 font-weight: bold; 119 font-weight: bold;
111 @apply(--paper-button-flat-keyboard-focus); 120 @apply(--paper-button-flat-keyboard-focus);
112 } 121 }
113 122
114 :host([disabled]) { 123 :host([disabled]) {
115 background: #eaeaea; 124 background: #eaeaea;
116 color: #a8a8a8; 125 color: #a8a8a8;
117 cursor: auto; 126 cursor: auto;
118 pointer-events: none; 127 pointer-events: none;
119 128
120 @apply(--paper-button-disabled); 129 @apply(--paper-button-disabled);
121 } 130 }
122 131
123 paper-ripple { 132 paper-ripple {
124 color: var(--paper-button-ink-color); 133 color: var(--paper-button-ink-color);
125 } 134 }
135 </style>
126 136
127 :host > ::content * {
128 text-transform: inherit;
129 }
130 </style>
131 <content></content> 137 <content></content>
132 </template> 138 </template>
139
140 <script>
141 Polymer({
142 is: 'paper-button',
143
144 behaviors: [
145 Polymer.PaperButtonBehavior
146 ],
147
148 properties: {
149 /**
150 * If true, the button should be styled with a shadow.
151 */
152 raised: {
153 type: Boolean,
154 reflectToAttribute: true,
155 value: false,
156 observer: '_calculateElevation'
157 }
158 },
159
160 _calculateElevation: function() {
161 if (!this.raised) {
162 this._setElevation(0);
163 } else {
164 Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
165 }
166 }
167
168 /**
169 Fired when the animation finishes.
170 This is useful if you want to wait until
171 the ripple animation finishes to perform some action.
172
173 @event transitionend
174 Event param: {{node: Object}} detail Contains the animated node.
175 */
176 });
177 </script>
133 </dom-module> 178 </dom-module>
134
135 <script>
136 Polymer({
137 is: 'paper-button',
138
139 behaviors: [
140 Polymer.PaperButtonBehavior
141 ],
142
143 properties: {
144 /**
145 * If true, the button should be styled with a shadow.
146 */
147 raised: {
148 type: Boolean,
149 reflectToAttribute: true,
150 value: false,
151 observer: '_calculateElevation'
152 }
153 },
154
155 _calculateElevation: function() {
156 if (!this.raised) {
157 this._setElevation(0);
158 } else {
159 Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
160 }
161 }
162 /**
163
164 Fired when the animation finishes.
165 This is useful if you want to wait until
166 the ripple animation finishes to perform some action.
167
168 @event transitionend
169 @param {{node: Object}} detail Contains the animated node.
170 */
171 });
172 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698