Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: third_party/polymer/components/paper-dropdown-menu/paper-dropdown-menu.html

Issue 864173009: Add paper-dropdown and paper-dropdown-menu and run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 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 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 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 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 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 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 --> 8 -->
9 9
10 <!-- 10 <!--
11 11
12 `core-dropdown-menu` works together with `core-dropdown` and `core-selector` to 12 `paper-dropdown-menu` works together with `paper-dropdown` and `core-menu` to
13 implement a drop-down menu. The currently selected item is displayed in the 13 implement a drop-down menu. The currently selected item is displayed in the
14 control. If no item is selected, the `label` is displayed instead. 14 control. If no item is selected, the `label` is displayed instead.
15 15
16 The child element with the class `dropdown` will be used as the drop-down 16 The child element with the class `dropdown` will be used as the drop-down
17 menu. It should be a `core-dropdown` or other overlay element. You should 17 menu. It should be a `paper-dropdown` or other overlay element. You should
18 also provide a `core-selector` or other selector element, such as `core-menu`, 18 also provide a `core-selector` or other selector element, such as `core-menu`,
19 in the drop-down. 19 in the drop-down. You should apply the class `menu` to the selector element.
20 20
21 Example: 21 Example:
22 22
23 <core-dropdown-menu label="Choose a pastry"> 23 <paper-dropdown-menu label="Your favorite pastry">
24 <core-dropdown class="dropdown"> 24 <paper-dropdown class="dropdown">
25 <core-selector> 25 <core-menu class="menu">
26 <core-item label="Croissant"></core-item> 26 <paper-item>Croissant</paper-item>
27 <core-item label="Donut"></core-item> 27 <paper-item>Donut</paper-item>
28 <core-item label="Financier"></core-item> 28 <paper-item>Financier</paper-item>
29 <core-item label="Madeleine"></core-item> 29 <paper-item>Madeleine</paper-item>
30 </core-selector> 30 </core-menu>
31 </core-dropdown> 31 </paper-dropdown>
32 </core-dropdown-menu> 32 </paper-dropdown-menu>
33 33
34 @group Polymer Core Elements 34 This example renders a drop-down menu with 4 options.
35 @element core-dropdown-menu 35
36 @group Paper Elements
37 @element paper-dropdown-menu
36 @extends core-dropdown-base 38 @extends core-dropdown-base
37 @status unstable 39 @status unstable
38 @homepage github.io 40 @homepage github.io
39 --> 41 -->
40 42
43 <!--
44 Fired when an item's selection state is changed. This event is fired both
45 when an item is selected or deselected. The `isSelected` detail property
46 contains the selection state.
47
48 @event core-select
49 @param {Object} detail
50 @param {boolean} detail.isSelected true for selection and false for deselectio n
51 @param {Object} detail.item the item element
52 -->
41 <link href="../polymer/polymer.html" rel="import"> 53 <link href="../polymer/polymer.html" rel="import">
54
42 <link href="../core-a11y-keys/core-a11y-keys.html" rel="import"> 55 <link href="../core-a11y-keys/core-a11y-keys.html" rel="import">
43 <link href="../core-dropdown/core-dropdown-base.html" rel="import"> 56 <link href="../core-dropdown/core-dropdown-base.html" rel="import">
44 <link href="../core-focusable/core-focusable.html" rel="import"> 57 <link href="../core-focusable/core-focusable.html" rel="import">
45 <link href="../core-icon/core-icon.html" rel="import"> 58 <link href="../core-icon/core-icon.html" rel="import">
46 <link href="../core-icons/core-icons.html" rel="import"> 59 <link href="../core-icons/core-icons.html" rel="import">
60 <link href="../paper-shadow/paper-shadow.html" rel="import">
47 61
48 <polymer-element name="core-dropdown-menu" extends="core-dropdown-base" relative layout inline horizontal center tabindex="0"> 62 <style shim-shadowdom>
63 html /deep/ #paper-dropdown-menu-dropdown {
64 margin: 12px;
65 overflow: visible;
66 }
67
68 html /deep/ #paper-dropdown-menu-dropdown #menu {
69 padding: 8px 0;
70 margin: 0;
71 }
72
73 html /deep/ #paper-dropdown-menu-dropdown .menu-container {
74 overflow: auto;
75 max-height: 100%;
76 max-width: 100%;
77 }
78 </style>
79
80 <polymer-element name="paper-dropdown-menu" extends="core-dropdown-base" relativ e layout inline horizontal center tabindex="0">
49 <template> 81 <template>
50 82
51 <style> 83 <style>
52 :host { 84 :host {
53 background-color: #fff; 85 -moz-user-select: none;
86 -ms-user-select: none;
87 -webkit-user-select: none;
88 user-select: none;
89 cursor: pointer;
90 padding: 0.5em 0 0.25em;
91 margin: 0.75em 0;
92 border-bottom: 1px solid #757575;
93 outline: none;
54 } 94 }
55 95
56 :host([disabled]) { 96 #label, #arrow {
57 color: #a8a8a8; 97 color: #757575;
58 } 98 }
59 99
60 #label { 100 #label {
61 overflow: hidden; 101 overflow: hidden;
62 white-space: nowrap; 102 white-space: nowrap;
63 text-overflow: ellipsis; 103 text-overflow: ellipsis;
64 } 104 }
65 </style> 105 </style>
66 106
67 <core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOver lay}}"></core-a11y-keys> 107 <core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOver lay}}"></core-a11y-keys>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 172
133 }; 173 };
134 174
135 Polymer.mixin2(p, Polymer.CoreFocusable); 175 Polymer.mixin2(p, Polymer.CoreFocusable);
136 Polymer(p); 176 Polymer(p);
137 177
138 })(); 178 })();
139 179
140 </script> 180 </script>
141 </polymer-element> 181 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698