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

Side by Side Diff: polymer_1.2.3/bower_components/paper-icon-button/paper-icon-button.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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.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
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
9 -->
10
11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../iron-icon/iron-icon.html">
13 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
14 <link rel="import" href="../paper-styles/default-theme.html">
15 <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
16 <link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html">
17 <link rel="import" href="../paper-ripple/paper-ripple.html">
18
19 <!--
20 Material design: [Icon toggles](https://www.google.com/design/spec/components/bu ttons.html#buttons-toggle-buttons)
21
22 `paper-icon-button` is a button with an image placed at the center. When the use r touches
23 the button, a ripple effect emanates from the center of the button.
24
25 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic on
26 from the icon set to use.
27
28 <paper-icon-button icon="menu"></paper-icon-button>
29
30 See [`iron-iconset`](#iron-iconset) for more information about
31 how to use a custom icon set.
32
33 Example:
34
35 <link href="path/to/iron-icons/iron-icons.html" rel="import">
36
37 <paper-icon-button icon="favorite"></paper-icon-button>
38 <paper-icon-button src="star.png"></paper-icon-button>
39
40 ### Styling
41
42 Style the button with CSS as you would a normal DOM element. If you are using th e icons
43 provided by `iron-icons`, they will inherit the foreground color of the button.
44
45 /* make a red "favorite" button */
46 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button>
47
48 By default, the ripple is the same color as the foreground at 25% opacity. You m ay
49 customize the color using the `--paper-icon-button-ink-color` custom property.
50
51 The following custom properties and mixins are available for styling:
52
53 Custom property | Description | Default
54 ----------------|-------------|----------
55 `--paper-icon-button-disabled-text` | The color of the disabled button | `--disa bled-text-color`
56 `--paper-icon-button-ink-color` | Selected/focus ripple color | `--primary-text- color`
57 `--paper-icon-button` | Mixin for a button | `{}`
58 `--paper-icon-button-disabled` | Mixin for a disabled button | `{}`
59 `--paper-icon-button-hover` | Mixin for button on hover | `{}`
60
61 @group Paper Elements
62 @element paper-icon-button
63 @demo demo/index.html
64 -->
65
66 <dom-module id="paper-icon-button">
67 <template strip-whitespace>
68 <style>
69 :host {
70 display: inline-block;
71 position: relative;
72 padding: 8px;
73 outline: none;
74 -webkit-tap-highlight-color: rgba(0,0,0,0);
75 -webkit-user-select: none;
76 -moz-user-select: none;
77 -ms-user-select: none;
78 user-select: none;
79 cursor: pointer;
80 z-index: 0;
81 line-height: 1;
82
83 width: 40px;
84 height: 40px;
85
86 /* Because of polymer/2558, this style has lower specificity than * */
87 box-sizing: border-box !important;
88 @apply(--paper-icon-button);
89 }
90
91 :host #ink {
92 color: var(--paper-icon-button-ink-color, --primary-text-color);
93 opacity: 0.6;
94 }
95
96 :host([disabled]) {
97 color: var(--paper-icon-button-disabled-text, --disabled-text-color);
98 pointer-events: none;
99 cursor: auto;
100 @apply(--paper-icon-button-disabled);
101 }
102
103 :host(:hover) {
104 @apply(--paper-icon-button-hover);
105 }
106
107 iron-icon {
108 --iron-icon-width: 100%;
109 --iron-icon-height: 100%;
110 }
111 </style>
112 <iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-ico n>
113 </template>
114
115 <script>
116 Polymer({
117 is: 'paper-icon-button',
118
119 hostAttributes: {
120 role: 'button',
121 tabindex: '0'
122 },
123
124 behaviors: [
125 Polymer.PaperInkyFocusBehavior
126 ],
127
128 properties: {
129 /**
130 * The URL of an image for the icon. If the src property is specified,
131 * the icon property should not be.
132 */
133 src: {
134 type: String
135 },
136
137 /**
138 * Specifies the icon name or index in the set of icons available in
139 * the icon's icon set. If the icon property is specified,
140 * the src property should not be.
141 */
142 icon: {
143 type: String
144 },
145
146 /**
147 * Specifies the alternate text for the button, for accessibility.
148 */
149 alt: {
150 type: String,
151 observer: "_altChanged"
152 }
153 },
154
155 _altChanged: function(newValue, oldValue) {
156 var label = this.getAttribute('aria-label');
157
158 // Don't stomp over a user-set aria-label.
159 if (!label || oldValue == label) {
160 this.setAttribute('aria-label', newValue);
161 }
162 }
163 });
164 </script>
165 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698