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

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

Issue 1162963002: Revert "Rename polymer and cr_elements v0_8 to v1_0" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 @license
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
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS
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
9 -->
10
11 <link rel="import" href="../polymer/polymer.html">
12 <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
16 <!--
17
18 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h tml">Buttons</a>
19
20 `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
22 shadow.
23
24 Example:
25
26 <paper-button>flat button</paper-button>
27 <paper-button raised>raised button</paper-button>
28 <paper-button noink>No ripple effect</paper-button>
29
30 You may use custom DOM in the button body to create a variety of buttons. For ex ample, to
31 create a button with an icon and some text:
32
33 <paper-button>
34 <core-icon icon="favorite"></core-icon>
35 custom button content
36 </paper-button>
37
38 ### Styling
39
40 Style the button with CSS as you would a normal DOM element.
41
42 /* make #my-button green with yellow text */
43 #my-button {
44 background: green;
45 color: yellow;
46 }
47
48 By default, the ripple is the same color as the foreground at 25% opacity. You m ay
49 customize the color using this selector:
50
51 /* make #my-button use a blue ripple instead of foreground color */
52 #my-button::shadow paper-ripple {
53 color: blue;
54 }
55
56 The opacity of the ripple is not customizable via CSS.
57
58 The following custom properties and mixins are also available for styling:
59
60 Custom property | Description | Default
61 ----------------|-------------|----------
62 `--paper-button-flat-focus-color` | Background color of a focused flat button | `--paper-grey-200`
63 `--paper-button` | Mixin applied to the button | `{}`
64 `--paper-button-disabled` | Mixin applied to the disabled button | `{}`
65
66 @demo demo/index.html
67 -->
68
69 <dom-module id="paper-button">
70
71 <style>
72
73 :host {
74 display: inline-block;
75 position: relative;
76 box-sizing: border-box;
77 min-width: 5.14em;
78 margin: 0 0.29em;
79 background: transparent;
80 text-align: center;
81 font: inherit;
82 text-transform: uppercase;
83 outline: none;
84 border-radius: 3px;
85 -moz-user-select: none;
86 -ms-user-select: none;
87 -webkit-user-select: none;
88 user-select: none;
89 cursor: pointer;
90 z-index: 0;
91
92 @apply(--paper-button);
93 }
94
95 .keyboard-focus {
96 font-weight: bold;
97 }
98
99 :host([disabled]) {
100 background: #eaeaea;
101 color: #a8a8a8;
102 cursor: auto;
103 pointer-events: none;
104
105 @apply(--paper-button-disabled);
106 }
107
108 :host([noink]) paper-ripple {
109 display: none;
110 }
111
112 paper-material {
113 border-radius: inherit;
114 }
115
116 .content > ::content * {
117 text-transform: inherit;
118 }
119
120 .content {
121 padding: 0.7em 0.57em
122 }
123 </style>
124
125 <template>
126
127 <paper-ripple></paper-ripple>
128
129 <paper-material class$="[[_computeContentClass(receivedFocusFromKeyboard)]]" elevation="[[_elevation]]" animated>
130 <content></content>
131 </paper-material>
132
133 </template>
134
135 </dom-module>
136
137 <script>
138
139 Polymer({
140
141 is: 'paper-button',
142
143 behaviors: [
144 Polymer.PaperButtonBehavior
145 ],
146
147 properties: {
148
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._elevation = 0;
163 } else {
164 Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
165 }
166 },
167
168 _computeContentClass: function(receivedFocusFromKeyboard) {
169 var className = 'content ';
170 if (receivedFocusFromKeyboard) {
171 className += ' keyboard-focus';
172 }
173 return className;
174 }
175 });
176
177 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698