OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2014 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 --> | 9 --> |
10 | 10 |
11 <html> | 11 <html> |
12 <head> | 12 <head> |
13 | 13 |
14 <meta charset="utf-8"> | 14 <meta charset="utf-8"> |
15 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 15 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
16 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1.0, user-scalable=yes"> | 16 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1.0, user-scalable=yes"> |
17 | 17 |
18 <title>core-dropdown-menu</title> | 18 <title>paper-dropdown-menu</title> |
19 | 19 |
20 <script src="../webcomponentsjs/webcomponents.js"></script> | 20 <script src="../webcomponentsjs/webcomponents.js"></script> |
21 | 21 |
22 <link href="../core-collapse/core-collapse.html" rel="import"> | 22 <link href="../core-collapse/core-collapse.html" rel="import"> |
23 <link href="../core-dropdown/core-dropdown.html" rel="import"> | |
24 <link href="../core-icons/core-icons.html" rel="import"> | |
25 <link href="../core-icon-button/core-icon-button.html" rel="import"> | |
26 <link href="../core-item/core-item.html" rel="import"> | |
27 <link href="../core-menu/core-menu.html" rel="import"> | 23 <link href="../core-menu/core-menu.html" rel="import"> |
| 24 <link href="../paper-dropdown/paper-dropdown.html" rel="import"> |
| 25 <link href="../paper-item/paper-item.html" rel="import"> |
28 | 26 |
29 <link href="core-dropdown-menu.html" rel="import"> | 27 <link href="paper-dropdown-menu.html" rel="import"> |
30 | 28 |
31 <style shim-shadowdom> | 29 <style shim-shadowdom> |
32 body { | 30 body { |
33 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; | 31 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; |
34 font-size: 14px; | 32 font-size: 14px; |
35 margin: 0; | 33 margin: 0; |
36 padding: 24px; | 34 padding: 24px; |
37 -webkit-tap-highlight-color: rgba(0,0,0,0); | 35 -webkit-tap-highlight-color: rgba(0,0,0,0); |
38 -webkit-touch-callout: none; | 36 -webkit-touch-callout: none; |
39 } | 37 } |
40 | 38 |
41 section { | 39 section { |
42 padding: 20px 0; | 40 padding: 20px 0; |
43 } | 41 } |
44 | 42 |
45 section > div { | 43 section > div { |
46 padding: 14px; | 44 padding: 14px; |
47 font-size: 16px; | 45 font-size: 16px; |
48 } | 46 } |
49 | 47 |
50 html /deep/ core-dropdown-menu { | 48 html /deep/ paper-dropdown-menu { |
51 box-sizing: border-box; | 49 box-sizing: border-box; |
52 width: 170px; | 50 width: 170px; |
53 } | 51 } |
54 | 52 |
55 html /deep/ core-dropdown { | 53 html /deep/ core-menu { |
56 box-sizing: border-box; | 54 box-sizing: border-box; |
57 min-width: 170px; | 55 width: 170px; |
58 background-color: #eee; | |
59 color: #000; | |
60 border: 1px solid #ccc; | |
61 border-radius: 3px; | |
62 } | 56 } |
63 | 57 |
64 core-item { | 58 paper-item { |
65 overflow: hidden; | 59 overflow: hidden; |
66 white-space: nowrap; | 60 white-space: nowrap; |
67 text-overflow: ellipsis; | 61 text-overflow: ellipsis; |
68 } | 62 } |
69 | 63 |
70 html /deep/ core-collapse { | 64 html /deep/ core-collapse { |
71 border: 1px solid #ccc; | 65 border: 1px solid #ccc; |
72 padding: 8px; | 66 padding: 8px; |
73 } | 67 } |
74 | 68 |
| 69 html /deep/ core-overlay { |
| 70 border: 1px solid #ccc; |
| 71 padding: 8px; |
| 72 background: #fff; |
| 73 } |
| 74 |
75 .constrained-height { | 75 .constrained-height { |
76 height: 150px; | 76 height: 150px; |
77 } | 77 } |
78 | 78 |
79 .colored { | 79 .colored { |
80 border: 1px solid #0f9d58; | |
81 background-color: #b7e1cd; | |
82 color: #0f9d58; | 80 color: #0f9d58; |
83 } | 81 } |
84 | 82 |
| 83 .dropdown.colored::shadow #ripple, |
| 84 .dropdown.colored::shadow #background { |
| 85 border: 1px solid #0f9d58; |
| 86 background-color: #b7e1cd; |
| 87 } |
| 88 |
85 </style> | 89 </style> |
86 | 90 |
87 </head> | 91 </head> |
88 <body> | 92 <body> |
89 | 93 |
90 <template is="auto-binding"> | 94 <template is="auto-binding"> |
91 | 95 |
92 <section> | 96 <section> |
93 | 97 |
94 <div>Absolutely positioned dropdowns</div> | 98 <div>Absolutely positioned dropdowns</div> |
95 | 99 |
96 <core-dropdown-menu label="Your favorite pastry"> | 100 <paper-dropdown-menu label="Your favorite pastry"> |
97 <core-dropdown class="dropdown"> | 101 <paper-dropdown class="dropdown"> |
98 <core-menu> | 102 <core-menu class="menu"> |
99 <template repeat="{{pastries}}"> | 103 <template repeat="{{pastries}}"> |
100 <core-item>{{}}</core-item> | 104 <paper-item>{{}}</paper-item> |
101 </template> | 105 </template> |
102 </core-menu> | 106 </core-menu> |
103 </core-dropdown> | 107 </paper-dropdown> |
104 </core-dropdown-menu> | 108 </paper-dropdown-menu> |
105 | 109 |
106 <br><br> | 110 <br><br> |
107 | 111 |
108 <core-dropdown-menu label="Disabled" disabled> | 112 <paper-dropdown-menu label="Disabled" disabled> |
109 <core-dropdown class="dropdown"> | 113 <paper-dropdown class="dropdown"> |
110 <core-menu> | 114 <core-menu class="menu"> |
111 <core-item>Should not see this</core-item> | 115 <paper-item>Should not see this</paper-item> |
112 </core-menu> | 116 </core-menu> |
113 </core-dropdown> | 117 </paper-dropdown> |
114 </core-dropdown-menu> | 118 </paper-dropdown-menu> |
115 | 119 |
116 </section> | 120 </section> |
117 | 121 |
118 <section> | 122 <section> |
119 | 123 |
120 <div>Layered dropdowns</div> | 124 <div>Layered dropdowns</div> |
121 | 125 |
| 126 <button onclick="document.getElementById('overlay').toggle()">toggle core-
overlay</button> |
| 127 |
| 128 <core-overlay id="overlay"> |
| 129 |
| 130 <paper-dropdown-menu label="Your favorite pastry"> |
| 131 <paper-dropdown layered class="dropdown"> |
| 132 <core-menu class="menu"> |
| 133 <template repeat="{{pastries}}"> |
| 134 <paper-item>{{}}</paper-item> |
| 135 </template> |
| 136 </core-menu> |
| 137 </paper-dropdown> |
| 138 </paper-dropdown-menu> |
| 139 |
| 140 </core-overlay> |
| 141 |
122 <button onclick="document.getElementById('collapse').toggle()">toggle core
-collapse</button> | 142 <button onclick="document.getElementById('collapse').toggle()">toggle core
-collapse</button> |
123 | 143 |
124 <br> | 144 <br> |
125 | 145 |
126 <core-collapse id="collapse"> | 146 <core-collapse id="collapse"> |
127 | 147 |
128 <core-dropdown-menu label="Your favorite pastry"> | 148 <paper-dropdown-menu label="Your favorite pastry"> |
129 <core-dropdown layered class="dropdown"> | 149 <paper-dropdown layered class="dropdown"> |
130 <core-menu> | 150 <core-menu class="menu"> |
131 <template repeat="{{pastries}}"> | 151 <template repeat="{{pastries}}"> |
132 <core-item>{{}}</core-item> | 152 <paper-item>{{}}</paper-item> |
133 </template> | 153 </template> |
134 </core-menu> | 154 </core-menu> |
135 </core-dropdown> | 155 </paper-dropdown> |
136 </core-dropdown-menu> | 156 </paper-dropdown-menu> |
137 | 157 |
138 </core-collapse> | 158 </core-collapse> |
139 | 159 |
140 </section> | 160 </section> |
141 | 161 |
142 <section> | 162 <section> |
143 | 163 |
144 <div>Custom styling</div> | 164 <div>Custom styling</div> |
145 | 165 |
146 <core-dropdown-menu label="Constrained height"> | 166 <paper-dropdown-menu label="Constrained height"> |
147 <core-dropdown class="dropdown constrained-height"> | 167 <paper-dropdown class="dropdown constrained-height"> |
148 <core-menu> | 168 <core-menu class="menu"> |
149 <template repeat="{{pastries}}"> | 169 <template repeat="{{pastries}}"> |
150 <core-item>{{}}</core-item> | 170 <paper-item>{{}}</paper-item> |
151 </template> | 171 </template> |
152 </core-menu> | 172 </core-menu> |
153 </core-dropdown> | 173 </paper-dropdown> |
154 </core-dropdown-menu> | 174 </paper-dropdown-menu> |
155 | 175 |
156 <br><br> | 176 <br><br> |
157 | 177 |
158 <core-dropdown-menu label="Colored"> | 178 <paper-dropdown-menu label="Colored"> |
159 <core-dropdown class="dropdown colored"> | 179 <paper-dropdown class="dropdown colored"> |
160 <core-menu> | 180 <core-menu class="menu"> |
161 <template repeat="{{pastries}}"> | 181 <template repeat="{{pastries}}"> |
162 <core-item>{{}}</core-item> | 182 <paper-item>{{}}</paper-item> |
163 </template> | 183 </template> |
164 </core-menu> | 184 </core-menu> |
165 </core-dropdown> | 185 </paper-dropdown> |
166 </core-dropdown-menu> | 186 </paper-dropdown-menu> |
167 | 187 |
168 </section> | 188 </section> |
169 | 189 |
170 </template> | 190 </template> |
171 | 191 |
172 <script> | 192 <script> |
173 | 193 |
174 scope = document.querySelector('template[is=auto-binding]'); | 194 scope = document.querySelector('template[is=auto-binding]'); |
175 | 195 |
176 scope.pastries = [ | 196 scope.pastries = [ |
177 'Apple fritter', | 197 'Apple fritter', |
178 'Croissant', | 198 'Croissant', |
179 'Donut', | 199 'Donut', |
180 'Financier', | 200 'Financier', |
181 'Jello', | 201 'Jello', |
182 'Madeleine', | 202 'Madeleine', |
183 'Pound cake', | 203 'Pound cake', |
184 'Pretzel', | 204 'Pretzel', |
185 'Sfogliatelle' | 205 'Sfogliatelle' |
186 ]; | 206 ]; |
187 | 207 |
188 </script> | 208 </script> |
189 | 209 |
190 </body> | 210 </body> |
191 </html> | 211 </html> |
OLD | NEW |