| 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 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 10 <link rel="import" href="../iron-dropdown/iron-dropdown.html"> | |
| 11 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html
"> | 10 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html
"> |
| 12 <link rel="import" href="../iron-behaviors/iron-control-state.html"> | 11 <link rel="import" href="../iron-behaviors/iron-control-state.html"> |
| 13 <link rel="import" href="../paper-material/paper-material.html"> | 12 <link rel="import" href="../iron-dropdown/iron-dropdown.html"> |
| 14 <link rel="import" href="../paper-styles/default-theme.html"> | |
| 15 <link rel="import" href="../neon-animation/animations/fade-in-animation.html"> | 13 <link rel="import" href="../neon-animation/animations/fade-in-animation.html"> |
| 16 <link rel="import" href="../neon-animation/animations/fade-out-animation.html"> | 14 <link rel="import" href="../neon-animation/animations/fade-out-animation.html"> |
| 15 <link rel="import" href="../paper-styles/default-theme.html"> |
| 16 <link rel="import" href="../paper-styles/shadow.html"> |
| 17 <link rel="import" href="paper-menu-button-animations.html"> | 17 <link rel="import" href="paper-menu-button-animations.html"> |
| 18 | 18 |
| 19 <!-- | 19 <!-- |
| 20 Material design: [Dropdown buttons](https://www.google.com/design/spec/component
s/buttons.html#buttons-dropdown-buttons) | 20 Material design: [Dropdown buttons](https://www.google.com/design/spec/component
s/buttons.html#buttons-dropdown-buttons) |
| 21 | 21 |
| 22 `paper-menu-button` allows one to compose a designated "trigger" element with | 22 `paper-menu-button` allows one to compose a designated "trigger" element with |
| 23 another element that represents "content", to create a dropdown menu that | 23 another element that represents "content", to create a dropdown menu that |
| 24 displays the "content" when the "trigger" is clicked. | 24 displays the "content" when the "trigger" is clicked. |
| 25 | 25 |
| 26 The child element with the class `dropdown-trigger` will be used as the | 26 The child element with the class `dropdown-trigger` will be used as the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 <paper-item>Help</paper-item> | 41 <paper-item>Help</paper-item> |
| 42 </paper-menu> | 42 </paper-menu> |
| 43 </paper-menu-button> | 43 </paper-menu-button> |
| 44 | 44 |
| 45 ### Styling | 45 ### Styling |
| 46 | 46 |
| 47 The following custom properties and mixins are also available for styling: | 47 The following custom properties and mixins are also available for styling: |
| 48 | 48 |
| 49 Custom property | Description | Default | 49 Custom property | Description | Default |
| 50 ----------------|-------------|---------- | 50 ----------------|-------------|---------- |
| 51 `--paper-menu-button-dropdown-background` | Background color of the paper-menu-b
utton dropdown | `#fff` | 51 `--paper-menu-button-dropdown-background` | Background color of the paper-menu-b
utton dropdown | `--primary-background-color` |
| 52 `--paper-menu-button` | Mixin applied to the paper-menu-button | `{}` | 52 `--paper-menu-button` | Mixin applied to the paper-menu-button | `{}` |
| 53 `--paper-menu-button-disabled` | Mixin applied to the paper-menu-button when dis
abled | `{}` | 53 `--paper-menu-button-disabled` | Mixin applied to the paper-menu-button when dis
abled | `{}` |
| 54 `--paper-menu-button-dropdown` | Mixin applied to the paper-menu-button dropdown
| `{}` | 54 `--paper-menu-button-dropdown` | Mixin applied to the paper-menu-button dropdown
| `{}` |
| 55 `--paper-menu-button-content` | Mixin applied to the paper-menu-button content |
`{}` | 55 `--paper-menu-button-content` | Mixin applied to the paper-menu-button content |
`{}` |
| 56 | 56 |
| 57 @hero hero.svg | 57 @hero hero.svg |
| 58 @demo demo/index.html | 58 @demo demo/index.html |
| 59 --> | 59 --> |
| 60 | 60 |
| 61 </head><body><dom-module id="paper-menu-button"> | 61 </head><body><dom-module id="paper-menu-button"> |
| 62 <style> | 62 <template> |
| 63 :host { | 63 <style> |
| 64 display: inline-block; | 64 :host { |
| 65 position: relative; | 65 display: inline-block; |
| 66 padding: 8px; | 66 position: relative; |
| 67 outline: none; | 67 padding: 8px; |
| 68 outline: none; |
| 68 | 69 |
| 69 @apply(--paper-menu-button); | 70 @apply(--paper-menu-button); |
| 70 } | 71 } |
| 71 | 72 |
| 72 :host([disabled]) { | 73 :host([disabled]) { |
| 73 cursor: auto; | 74 cursor: auto; |
| 74 color: var(--disabled-text-color); | 75 color: var(--disabled-text-color); |
| 75 | 76 |
| 76 @apply(--paper-menu-button-disabled); | 77 @apply(--paper-menu-button-disabled); |
| 77 } | 78 } |
| 78 | 79 |
| 79 :host([vertical-align="top"]) paper-material { | 80 iron-dropdown { |
| 80 margin-bottom: 20px; | 81 @apply(--paper-menu-button-dropdown); |
| 81 margin-top: -10px; | 82 } |
| 82 top: 10px; | |
| 83 } | |
| 84 | 83 |
| 85 :host([vertical-align="bottom"]) paper-material { | 84 .dropdown-content { |
| 86 bottom: 10px; | 85 @apply(--shadow-elevation-2dp); |
| 87 margin-bottom: -10px; | |
| 88 margin-top: 20px; | |
| 89 } | |
| 90 | 86 |
| 91 iron-dropdown { | 87 position: relative; |
| 92 @apply(--paper-menu-button-dropdown); | 88 border-radius: 2px; |
| 93 } | 89 background-color: var(--paper-menu-button-dropdown-background, --primary
-background-color); |
| 94 | 90 |
| 95 .dropdown-content { | 91 @apply(--paper-menu-button-content); |
| 96 border-radius: 2px; | 92 } |
| 97 background-color: var(--paper-menu-button-dropdown-background, --primary-b
ackground-color); | 93 |
| 98 @apply(--paper-menu-button-content); | 94 :host([vertical-align="top"]) .dropdown-content { |
| 99 } | 95 margin-bottom: 20px; |
| 100 </style> | 96 margin-top: -10px; |
| 101 <template> | 97 top: 10px; |
| 102 <div id="trigger" on-tap="open"> | 98 } |
| 99 |
| 100 :host([vertical-align="bottom"]) .dropdown-content { |
| 101 bottom: 10px; |
| 102 margin-bottom: -10px; |
| 103 margin-top: 20px; |
| 104 } |
| 105 </style> |
| 106 |
| 107 <div id="trigger" on-tap="toggle"> |
| 103 <content select=".dropdown-trigger"></content> | 108 <content select=".dropdown-trigger"></content> |
| 104 </div> | 109 </div> |
| 105 <iron-dropdown id="dropdown" opened="{{opened}}" horizontal-align="[[horizon
talAlign]]" vertical-align="[[verticalAlign]]" horizontal-offset="[[horizontalOf
fset]]" vertical-offset="[[verticalOffset]]" open-animation-config="[[openAnimat
ionConfig]]" close-animation-config="[[closeAnimationConfig]]" no-animations="[[
noAnimations]]" focus-target="[[_dropdownContent]]"> | 110 |
| 106 <paper-material class="dropdown-content"> | 111 <iron-dropdown id="dropdown" opened="{{opened}}" horizontal-align="[[horizon
talAlign]]" vertical-align="[[verticalAlign]]" horizontal-offset="[[horizontalOf
fset]]" vertical-offset="[[verticalOffset]]" open-animation-config="[[openAnimat
ionConfig]]" close-animation-config="[[closeAnimationConfig]]" no-animations="[[
noAnimations]]" focus-target="[[_dropdownContent]]" on-iron-overlay-canceled="__
onIronOverlayCanceled"> |
| 112 <div class="dropdown-content"> |
| 107 <content id="content" select=".dropdown-content"></content> | 113 <content id="content" select=".dropdown-content"></content> |
| 108 </paper-material> | 114 </div> |
| 109 </iron-dropdown> | 115 </iron-dropdown> |
| 110 </template> | 116 </template> |
| 111 </dom-module> | 117 |
| 118 </dom-module> |
| 112 <script src="paper-menu-button-extracted.js"></script></body></html> | 119 <script src="paper-menu-button-extracted.js"></script></body></html> |
| OLD | NEW |