OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> |
| 9 <!-- |
| 10 |
| 11 `paper-menu-button` works together with a button and a `paper-dropdown` to |
| 12 implement a button that displays a drop-down when tapped on. |
| 13 |
| 14 The child element with the class `dropdown` will be used as the drop-down |
| 15 menu. It should be a `paper-dropdown` or other overlay element. |
| 16 |
| 17 Example: |
| 18 |
| 19 <paper-menu-button> |
| 20 <paper-icon-button icon="menu" noink></paper-icon-button> |
| 21 <paper-dropdown class="dropdown"> |
| 22 <core-menu class="menu"> |
| 23 <paper-item>Share</paper-item> |
| 24 <paper-item>Settings</paper-item> |
| 25 <paper-item>Help</paper-item> |
| 26 </core-menu> |
| 27 </paper-dropdown> |
| 28 </paper-menu-button> |
| 29 |
| 30 @group Paper Elements |
| 31 @element paper-menu-button |
| 32 @extends core-dropdown-base |
| 33 @status unstable |
| 34 --> |
| 35 <link href="../polymer/polymer.html" rel="import"> |
| 36 <link href="../core-a11y-keys/core-a11y-keys.html" rel="import"> |
| 37 <link href="../core-dropdown/core-dropdown-base.html" rel="import"> |
| 38 |
| 39 <polymer-element name="paper-menu-button" extends="core-dropdown-base" relative> |
| 40 <template> |
| 41 |
| 42 <style> |
| 43 :host { |
| 44 display: inline-block; |
| 45 } |
| 46 |
| 47 :host([disabled]) { |
| 48 pointer-events: none; |
| 49 color: #a8a8a8; |
| 50 } |
| 51 |
| 52 polyfill-next-selector { content: ':host([disabled]) *'; } |
| 53 :host([disabled]) ::content * { |
| 54 pointer-events: none; |
| 55 } |
| 56 </style> |
| 57 |
| 58 <core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOver
lay}}"></core-a11y-keys> |
| 59 |
| 60 <content></content> |
| 61 |
| 62 </template> |
| 63 <script> |
| 64 |
| 65 Polymer({ |
| 66 |
| 67 overlayListeners: { |
| 68 'core-overlay-open': 'openAction', |
| 69 'core-activate': 'activateAction' |
| 70 }, |
| 71 |
| 72 activateAction: function() { |
| 73 this.opened = false; |
| 74 } |
| 75 |
| 76 }); |
| 77 |
| 78 </script> |
| 79 </polymer-element> |
OLD | NEW |