| OLD | NEW |
| (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 --><html><head><link rel="import" href="../polymer/polymer.html"> | |
| 10 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html
"> | |
| 11 <link rel="import" href="../iron-behaviors/iron-button-state.html"> | |
| 12 <link rel="import" href="../iron-behaviors/iron-control-state.html"> | |
| 13 <link rel="import" href="../iron-form-element-behavior/iron-form-element-behavio
r.html"> | |
| 14 <link rel="import" href="../iron-icon/iron-icon.html"> | |
| 15 <link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.
html"> | |
| 16 <link rel="import" href="../paper-input/paper-input.html"> | |
| 17 <link rel="import" href="../paper-menu-button/paper-menu-button.html"> | |
| 18 <link rel="import" href="../paper-ripple/paper-ripple.html"> | |
| 19 <link rel="import" href="../paper-styles/default-theme.html"> | |
| 20 | |
| 21 <link rel="import" href="paper-dropdown-menu-icons.html"> | |
| 22 <link rel="import" href="paper-dropdown-menu-shared-styles.html"> | |
| 23 | |
| 24 <!-- | |
| 25 Material design: [Dropdown menus](https://www.google.com/design/spec/components/
buttons.html#buttons-dropdown-buttons) | |
| 26 | |
| 27 `paper-dropdown-menu` is similar to a native browser select element. | |
| 28 `paper-dropdown-menu` works with selectable content. The currently selected | |
| 29 item is displayed in the control. If no item is selected, the `label` is | |
| 30 displayed instead. | |
| 31 | |
| 32 Example: | |
| 33 | |
| 34 <paper-dropdown-menu label="Your favourite pastry"> | |
| 35 <paper-listbox class="dropdown-content"> | |
| 36 <paper-item>Croissant</paper-item> | |
| 37 <paper-item>Donut</paper-item> | |
| 38 <paper-item>Financier</paper-item> | |
| 39 <paper-item>Madeleine</paper-item> | |
| 40 </paper-listbox> | |
| 41 </paper-dropdown-menu> | |
| 42 | |
| 43 This example renders a dropdown menu with 4 options. | |
| 44 | |
| 45 The child element with the class `dropdown-content` is used as the dropdown | |
| 46 menu. This can be a [`paper-listbox`](paper-listbox), or any other or | |
| 47 element that acts like an [`iron-selector`](iron-selector). | |
| 48 | |
| 49 Specifically, the menu child must fire an | |
| 50 [`iron-select`](iron-selector#event-iron-select) event when one of its | |
| 51 children is selected, and an [`iron-deselect`](iron-selector#event-iron-deselect
) | |
| 52 event when a child is deselected. The selected or deselected item must | |
| 53 be passed as the event's `detail.item` property. | |
| 54 | |
| 55 Applications can listen for the `iron-select` and `iron-deselect` events | |
| 56 to react when options are selected and deselected. | |
| 57 | |
| 58 ### Styling | |
| 59 | |
| 60 The following custom properties and mixins are also available for styling: | |
| 61 | |
| 62 Custom property | Description | Default | |
| 63 ----------------|-------------|---------- | |
| 64 `--paper-dropdown-menu` | A mixin that is applied to the element host | `{}` | |
| 65 `--paper-dropdown-menu-disabled` | A mixin that is applied to the element host w
hen disabled | `{}` | |
| 66 `--paper-dropdown-menu-ripple` | A mixin that is applied to the internal ripple
| `{}` | |
| 67 `--paper-dropdown-menu-button` | A mixin that is applied to the internal menu bu
tton | `{}` | |
| 68 `--paper-dropdown-menu-input` | A mixin that is applied to the internal paper in
put | `{}` | |
| 69 `--paper-dropdown-menu-icon` | A mixin that is applied to the internal icon | `{
}` | |
| 70 | |
| 71 You can also use any of the `paper-input-container` and `paper-menu-button` | |
| 72 style mixins and custom properties to style the internal input and menu button | |
| 73 respectively. | |
| 74 | |
| 75 @group Paper Elements | |
| 76 @element paper-dropdown-menu | |
| 77 @hero hero.svg | |
| 78 @demo demo/index.html | |
| 79 --> | |
| 80 | |
| 81 </head><body><dom-module id="paper-dropdown-menu"> | |
| 82 <template> | |
| 83 <style include="paper-dropdown-menu-shared-styles"></style> | |
| 84 | |
| 85 <!-- this div fulfills an a11y requirement for combobox, do not remove --> | |
| 86 <span role="button"></span> | |
| 87 <paper-menu-button id="menuButton" vertical-align="[[verticalAlign]]" horizo
ntal-align="[[horizontalAlign]]" dynamic-align="[[dynamicAlign]]" vertical-offse
t="[[_computeMenuVerticalOffset(noLabelFloat)]]" disabled="[[disabled]]" no-anim
ations="[[noAnimations]]" on-iron-select="_onIronSelect" on-iron-deselect="_onIr
onDeselect" opened="{{opened}}" close-on-activate="" allow-outside-scroll="[[all
owOutsideScroll]]"> | |
| 88 <div class="dropdown-trigger"> | |
| 89 <paper-ripple></paper-ripple> | |
| 90 <!-- paper-input has type="text" for a11y, do not remove --> | |
| 91 <paper-input type="text" invalid="[[invalid]]" readonly="" disabled="[[d
isabled]]" value="[[selectedItemLabel]]" placeholder="[[placeholder]]" error-mes
sage="[[errorMessage]]" always-float-label="[[alwaysFloatLabel]]" no-label-float
="[[noLabelFloat]]" label="[[label]]"> | |
| 92 <iron-icon icon="paper-dropdown-menu:arrow-drop-down" suffix=""></iron
-icon> | |
| 93 </paper-input> | |
| 94 </div> | |
| 95 <content id="content" select=".dropdown-content"></content> | |
| 96 </paper-menu-button> | |
| 97 </template> | |
| 98 | |
| 99 </dom-module> | |
| 100 <script src="paper-dropdown-menu-extracted.js"></script></body></html> | |
| OLD | NEW |