| OLD | NEW |
| 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 | 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 | 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 | 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 | 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 | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS |
| 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-icon/iron-icon.html"> | 12 <link rel="import" href="../iron-icon/iron-icon.html"> |
| 13 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> | 13 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
| 14 <link rel="import" href="../paper-styles/default-theme.html"> | 14 <link rel="import" href="../paper-styles/default-theme.html"> |
| 15 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> | 15 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> |
| 16 <link rel="import" href="../paper-behaviors/paper-radio-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"> | 17 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 18 | 18 |
| 19 <style is="custom-style"> | |
| 20 :root { | |
| 21 --paper-icon-button-disabled-text: var(--disabled-text-color); | |
| 22 } | |
| 23 </style> | |
| 24 | |
| 25 <!-- | 19 <!-- |
| 26 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Buttons</a> | 20 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Buttons</a> |
| 27 | 21 |
| 28 `paper-icon-button` is a button with an image placed at the center. When the use
r touches | 22 `paper-icon-button` is a button with an image placed at the center. When the use
r touches |
| 29 the button, a ripple effect emanates from the center of the button. | 23 the button, a ripple effect emanates from the center of the button. |
| 30 | 24 |
| 31 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic
on | 25 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic
on |
| 32 from the icon set to use. | 26 from the icon set to use. |
| 33 | 27 |
| 34 <paper-icon-button icon="menu"></paper-icon-button> | 28 <paper-icon-button icon="menu"></paper-icon-button> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 86 |
| 93 @apply(--paper-icon-button); | 87 @apply(--paper-icon-button); |
| 94 } | 88 } |
| 95 | 89 |
| 96 :host #ink { | 90 :host #ink { |
| 97 color: var(--paper-icon-button-ink-color, --primary-text-color); | 91 color: var(--paper-icon-button-ink-color, --primary-text-color); |
| 98 opacity: 0.6; | 92 opacity: 0.6; |
| 99 } | 93 } |
| 100 | 94 |
| 101 :host([disabled]) { | 95 :host([disabled]) { |
| 102 color: var(--paper-icon-button-disabled-text, #fff); | 96 color: var(--paper-icon-button-disabled-text, --disabled-text-color); |
| 103 pointer-events: none; | 97 pointer-events: none; |
| 104 cursor: auto; | 98 cursor: auto; |
| 105 @apply(--paper-icon-button-disabled); | 99 @apply(--paper-icon-button-disabled); |
| 106 } | 100 } |
| 107 </style> | 101 </style> |
| 108 <template> | 102 <template> |
| 109 <paper-ripple id="ink" class="circle" center></paper-ripple> | 103 <paper-ripple id="ink" class="circle" center></paper-ripple> |
| 110 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> | 104 <iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-ico
n> |
| 111 </template> | 105 </template> |
| 112 </dom-module> | 106 </dom-module> |
| 113 <script> | 107 <script> |
| 114 Polymer({ | 108 Polymer({ |
| 115 is: 'paper-icon-button', | 109 is: 'paper-icon-button', |
| 116 | 110 |
| 111 hostAttributes: { |
| 112 role: 'button', |
| 113 tabindex: '0' |
| 114 }, |
| 115 |
| 117 behaviors: [ | 116 behaviors: [ |
| 118 Polymer.PaperButtonBehavior, | 117 Polymer.PaperInkyFocusBehavior |
| 119 Polymer.PaperRadioButtonBehavior | |
| 120 ], | 118 ], |
| 121 | 119 |
| 122 properties: { | 120 properties: { |
| 123 /** | 121 /** |
| 124 * The URL of an image for the icon. If the src property is specified, | 122 * The URL of an image for the icon. If the src property is specified, |
| 125 * the icon property should not be. | 123 * the icon property should not be. |
| 126 */ | 124 */ |
| 127 src: { | 125 src: { |
| 128 type: String | 126 type: String |
| 129 }, | 127 }, |
| 130 | 128 |
| 131 /** | 129 /** |
| 132 * Specifies the icon name or index in the set of icons available in | 130 * Specifies the icon name or index in the set of icons available in |
| 133 * the icon's icon set. If the icon property is specified, | 131 * the icon's icon set. If the icon property is specified, |
| 134 * the src property should not be. | 132 * the src property should not be. |
| 135 */ | 133 */ |
| 136 icon: { | 134 icon: { |
| 137 type: String | 135 type: String |
| 136 }, |
| 137 |
| 138 /** |
| 139 * Specifies the alternate text for the button, for accessibility. |
| 140 */ |
| 141 alt: { |
| 142 type: String, |
| 143 observer: "_altChanged" |
| 144 } |
| 145 }, |
| 146 |
| 147 _altChanged: function(newValue, oldValue) { |
| 148 var label = this.getAttribute('aria-label'); |
| 149 |
| 150 // Don't stomp over a user-set aria-label. |
| 151 if (!label || oldValue == label) { |
| 152 this.setAttribute('aria-label', newValue); |
| 138 } | 153 } |
| 139 } | 154 } |
| 140 }); | 155 }); |
| 141 </script> | 156 </script> |
| OLD | NEW |