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 `paper-dropdown-menu` works together with `paper-dropdown` and `core-menu` to |
| 11 implement a drop-down menu. The currently selected item is displayed in the |
| 12 control. If no item is selected, the `label` is displayed instead. |
| 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. You should |
| 16 also provide a `core-selector` or other selector element, such as `core-menu`, |
| 17 in the drop-down. You should apply the class `menu` to the selector element. |
| 18 |
| 19 Example: |
| 20 |
| 21 <paper-dropdown-menu label="Your favorite pastry"> |
| 22 <paper-dropdown class="dropdown"> |
| 23 <core-menu class="menu"> |
| 24 <paper-item>Croissant</paper-item> |
| 25 <paper-item>Donut</paper-item> |
| 26 <paper-item>Financier</paper-item> |
| 27 <paper-item>Madeleine</paper-item> |
| 28 </core-menu> |
| 29 </paper-dropdown> |
| 30 </paper-dropdown-menu> |
| 31 |
| 32 This example renders a drop-down menu with 4 options. |
| 33 |
| 34 @group Paper Elements |
| 35 @element paper-dropdown-menu |
| 36 @extends core-dropdown-base |
| 37 @status unstable |
| 38 @homepage github.io |
| 39 --><!-- |
| 40 Fired when an item's selection state is changed. This event is fired both |
| 41 when an item is selected or deselected. The `isSelected` detail property |
| 42 contains the selection state. |
| 43 |
| 44 @event core-select |
| 45 @param {Object} detail |
| 46 @param {boolean} detail.isSelected true for selection and false for deselectio
n |
| 47 @param {Object} detail.item the item element |
| 48 --><html><head><link href="../polymer/polymer.html" rel="import"> |
| 49 |
| 50 <link href="../core-a11y-keys/core-a11y-keys.html" rel="import"> |
| 51 <link href="../core-dropdown/core-dropdown-base.html" rel="import"> |
| 52 <link href="../core-focusable/core-focusable.html" rel="import"> |
| 53 <link href="../core-icon/core-icon.html" rel="import"> |
| 54 <link href="../core-icons/core-icons.html" rel="import"> |
| 55 <link href="../paper-shadow/paper-shadow.html" rel="import"> |
| 56 |
| 57 <style shim-shadowdom=""> |
| 58 html /deep/ #paper-dropdown-menu-dropdown { |
| 59 margin: 12px; |
| 60 overflow: visible; |
| 61 } |
| 62 |
| 63 html /deep/ #paper-dropdown-menu-dropdown #menu { |
| 64 padding: 8px 0; |
| 65 margin: 0; |
| 66 } |
| 67 |
| 68 html /deep/ #paper-dropdown-menu-dropdown .menu-container { |
| 69 overflow: auto; |
| 70 max-height: 100%; |
| 71 max-width: 100%; |
| 72 } |
| 73 </style> |
| 74 |
| 75 </head><body><polymer-element name="paper-dropdown-menu" extends="core-dropdown-
base" relative="" layout="" inline="" horizontal="" center="" tabindex="0" asset
path=""> |
| 76 <template> |
| 77 |
| 78 <style> |
| 79 :host { |
| 80 -moz-user-select: none; |
| 81 -ms-user-select: none; |
| 82 -webkit-user-select: none; |
| 83 user-select: none; |
| 84 cursor: pointer; |
| 85 padding: 0.5em 0 0.25em; |
| 86 margin: 0.75em 0; |
| 87 border-bottom: 1px solid #757575; |
| 88 outline: none; |
| 89 } |
| 90 |
| 91 #label, #arrow { |
| 92 color: #757575; |
| 93 } |
| 94 |
| 95 #label { |
| 96 overflow: hidden; |
| 97 white-space: nowrap; |
| 98 text-overflow: ellipsis; |
| 99 } |
| 100 </style> |
| 101 |
| 102 <core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOver
lay}}"></core-a11y-keys> |
| 103 |
| 104 <div flex="" auto="" id="label">{{selectedItemLabel || label}}</div> |
| 105 <core-icon id="arrow" icon="{{opened ? openedIcon : closedIcon}}"></core-icon> |
| 106 |
| 107 <content></content> |
| 108 |
| 109 </template> |
| 110 |
| 111 </polymer-element> |
| 112 <script charset="utf-8" src="paper-dropdown-menu-extracted.js"></script></body><
/html> |
OLD | NEW |