| 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.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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 <paper-fab mini icon="favorite"></paper-fab> | 35 <paper-fab mini icon="favorite"></paper-fab> |
| 36 <paper-fab src="star.png"></paper-fab> | 36 <paper-fab src="star.png"></paper-fab> |
| 37 | 37 |
| 38 | 38 |
| 39 ### Styling | 39 ### Styling |
| 40 | 40 |
| 41 The following custom properties and mixins are available for styling: | 41 The following custom properties and mixins are available for styling: |
| 42 | 42 |
| 43 Custom property | Description | Default | 43 Custom property | Description | Default |
| 44 ----------------|-------------|---------- | 44 ----------------|-------------|---------- |
| 45 `--paper-fab-background` | The background color of the button | `--paper-indigo-
500` | 45 `--paper-fab-background` | The background color of the button | `--accent-color` |
| 46 `--paper-fab-keyboard-focus-background` | The background color of the button whe
n focused | `--paper-pink-900` |
| 46 `--paper-fab-disabled-background` | The background color of the button when it's
disabled | `--paper-grey-300` | 47 `--paper-fab-disabled-background` | The background color of the button when it's
disabled | `--paper-grey-300` |
| 47 `--paper-fab-disabled-text` | The text color of the button when it's disabled |
`--paper-grey-500` | 48 `--paper-fab-disabled-text` | The text color of the button when it's disabled |
`--paper-grey-500` |
| 48 `--paper-fab` | Mixin applied to the button | `{}` | 49 `--paper-fab` | Mixin applied to the button | `{}` |
| 49 `--paper-fab-mini` | Mixin applied to a mini button | `{}` | 50 `--paper-fab-mini` | Mixin applied to a mini button | `{}` |
| 50 `--paper-fab-disabled` | Mixin applied to a disabled button | `{}` | 51 `--paper-fab-disabled` | Mixin applied to a disabled button | `{}` |
| 51 | 52 |
| 52 @group Paper Elements | 53 @group Paper Elements |
| 53 @demo demo/index.html | 54 @demo demo/index.html |
| 54 | 55 |
| 55 --> | 56 --> |
| 56 | 57 |
| 57 <dom-module id="paper-fab"> | 58 <dom-module id="paper-fab"> |
| 58 <style> | 59 <style> |
| 59 | 60 |
| 60 :host { | 61 :host { |
| 61 display: inline-block; | 62 display: inline-block; |
| 62 position: relative; | 63 position: relative; |
| 63 outline: none; | 64 outline: none; |
| 64 -moz-user-select: none; | 65 -moz-user-select: none; |
| 65 -ms-user-select: none; | 66 -ms-user-select: none; |
| 66 -webkit-user-select: none; | 67 -webkit-user-select: none; |
| 67 user-select: none; | 68 user-select: none; |
| 68 cursor: pointer; | 69 cursor: pointer; |
| 69 | 70 |
| 70 box-sizing: border-box; | 71 box-sizing: border-box; |
| 71 min-width: 0; | 72 min-width: 0; |
| 72 width: 56px; | 73 width: 56px; |
| 73 height: 56px; | 74 height: 56px; |
| 74 background: var(--paper-fab-background, --paper-indigo-500); | 75 background: var(--paper-fab-background, --accent-color); |
| 75 color: var(--text-primary-color); | 76 color: var(--text-primary-color); |
| 76 border-radius: 50%; | 77 border-radius: 50%; |
| 77 padding: 16px; | 78 padding: 16px; |
| 78 | 79 |
| 79 z-index: 0; | 80 z-index: 0; |
| 80 | 81 |
| 81 @apply(--paper-fab); | 82 @apply(--paper-fab); |
| 82 } | 83 } |
| 83 | 84 |
| 84 :host([mini]) { | 85 :host([mini]) { |
| 85 width: 40px; | 86 width: 40px; |
| 86 height: 40px; | 87 height: 40px; |
| 87 padding: 8px; | 88 padding: 8px; |
| 88 | 89 |
| 89 @apply(--paper-fab-mini); | 90 @apply(--paper-fab-mini); |
| 90 } | 91 } |
| 91 | 92 |
| 92 :host([disabled]) { | 93 :host([disabled]) { |
| 93 color: var(--paper-fab-disabled-text, --paper-grey-500); | 94 color: var(--paper-fab-disabled-text, --paper-grey-500); |
| 94 background: var(--paper-fab-disabled-background, --paper-grey-300); | 95 background: var(--paper-fab-disabled-background, --paper-grey-300); |
| 95 @apply(--paper-fab-disabled); | 96 @apply(--paper-fab-disabled); |
| 96 } | 97 } |
| 97 | 98 |
| 98 paper-material { | 99 paper-material { |
| 99 border-radius: inherit; | 100 border-radius: inherit; |
| 101 @apply(--layout-fit); |
| 102 @apply(--layout-vertical); |
| 103 @apply(--layout-center-center); |
| 104 } |
| 105 |
| 106 .keyboard-focus { |
| 107 background: var(--paper-fab-keyboard-focus-background, --paper-pink-900); |
| 100 } | 108 } |
| 101 </style> | 109 </style> |
| 102 <template> | 110 <template> |
| 103 <paper-ripple></paper-ripple> | 111 <paper-ripple></paper-ripple> |
| 104 <paper-material class="content fit flex layout vertical center-center" eleva
tion="[[elevation]]" animated> | 112 <paper-material class$="[[_computeContentClass(receivedFocusFromKeyboard)]]"
elevation="[[_elevation]]" animated> |
| 105 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> | 113 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> |
| 106 </paper-material> | 114 </paper-material> |
| 107 </template> | 115 </template> |
| 108 </dom-module> | 116 </dom-module> |
| 109 <script> | 117 <script> |
| 110 Polymer({ | 118 Polymer({ |
| 111 is: 'paper-fab', | 119 is: 'paper-fab', |
| 112 | 120 |
| 113 behaviors: [ | 121 behaviors: [ |
| 114 Polymer.PaperButtonBehavior | 122 Polymer.PaperButtonBehavior |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 * Set this to true to style this is a "mini" FAB. | 154 * Set this to true to style this is a "mini" FAB. |
| 147 * | 155 * |
| 148 * @attribute mini | 156 * @attribute mini |
| 149 * @type boolean | 157 * @type boolean |
| 150 * @default false | 158 * @default false |
| 151 */ | 159 */ |
| 152 mini: { | 160 mini: { |
| 153 type: Boolean, | 161 type: Boolean, |
| 154 value: false | 162 value: false |
| 155 } | 163 } |
| 164 }, |
| 165 |
| 166 _computeContentClass: function(receivedFocusFromKeyboard) { |
| 167 var className = 'content'; |
| 168 if (receivedFocusFromKeyboard) { |
| 169 className += ' keyboard-focus'; |
| 170 } |
| 171 return className; |
| 156 } | 172 } |
| 157 | 173 |
| 158 }); | 174 }); |
| 159 </script> | 175 </script> |
| OLD | NEW |