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

Side by Side Diff: polymer_1.2.3/bower_components/paper-toolbar/paper-toolbar.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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
(Empty)
1 <!--
2 Copyright (c) 2015 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 <link rel="import" href="../polymer/polymer.html">
11 <link rel="import" href="../paper-styles/default-theme.html">
12 <link rel="import" href="../paper-styles/typography.html">
13 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
14
15 <!--
16 Material design: [Toolbars](https://www.google.com/design/spec/components/toolba rs.html)
17
18 `paper-toolbar` is a horizontal bar containing items that can be used for
19 label, navigation, search and actions. The items placed inside the
20 `paper-toolbar` are projected into a `class="horizontal center layout"` containe r inside of
21 `paper-toolbar`'s Shadow DOM. You can use flex attributes to control the items'
22 sizing.
23
24 Example:
25
26 ```html
27 <paper-toolbar>
28 <paper-icon-button icon="menu" on-tap="menuAction"></paper-icon-button>
29 <div class="title">Title</div>
30 <paper-icon-button icon="more-vert" on-tap="moreAction"></paper-icon-button>
31 </paper-toolbar>
32 ```
33
34 `paper-toolbar` has a standard height, but can made be taller by setting `tall`
35 class on the `paper-toolbar`. This will make the toolbar 3x the normal height.
36
37 ```html
38 <paper-toolbar class="tall">
39 <paper-icon-button icon="menu"></paper-icon-button>
40 </paper-toolbar>
41 ```
42
43 Apply `medium-tall` class to make the toolbar medium tall. This will make the
44 toolbar 2x the normal height.
45
46 ```html
47 <paper-toolbar class="medium-tall">
48 <paper-icon-button icon="menu"></paper-icon-button>
49 </paper-toolbar>
50 ```
51
52 When `tall`, items can pin to either the top (default), middle or bottom. Use
53 `middle` class for middle content and `bottom` class for bottom content.
54
55 ```html
56 <paper-toolbar class="tall">
57 <paper-icon-button icon="menu"></paper-icon-button>
58 <div class="middle title">Middle Title</div>
59 <div class="bottom title">Bottom Title</div>
60 </paper-toolbar>
61 ```
62
63 For `medium-tall` toolbar, the middle and bottom contents overlap and are
64 pinned to the bottom. But `middleJustify` and `bottomJustify` attributes are
65 still honored separately.
66
67 To make an element completely fit at the bottom of the toolbar, use `fit` along
68 with `bottom`.
69
70 ```html
71 <paper-toolbar class="tall">
72 <div id="progressBar" class="bottom fit"></div>
73 </paper-toolbar>
74 ```
75
76 ### Styling
77
78 The following custom properties and mixins are available for styling:
79
80 Custom property | Description | Default
81 ----------------|-------------|----------
82 `--paper-toolbar-title` | Mixin applied to the title of the toolbar | `{}`
83 `--paper-toolbar-background` | Toolbar background color | `--default-primary -color`
84 `--paper-toolbar-color` | Toolbar foreground color | `--text-primary-co lor`
85 `--paper-toolbar-height` | Custom height for toolbar | `64px`
86 `--paper-toolbar-sm-height` | Custom height for small screen toolbar | `56px`
87 `--paper-toolbar` | Mixin applied to the toolbar | `{}`
88 `--paper-toolbar-content` | Mixin applied to the content section of the toolb ar | `{}`
89 `--paper-toolbar-medium` | Mixin applied to medium height toolbar | `{}`
90 `--paper-toolbar-tall` | Mixin applied to tall height toolbar | `{}`
91
92 ### Accessibility
93
94 `<paper-toolbar>` has `role="toolbar"` by default. Any elements with the class ` title` will
95 be used as the label of the toolbar via `aria-labelledby`.
96
97 @demo demo/index.html
98 -->
99
100 <dom-module id="paper-toolbar">
101 <template>
102 <style>
103 :host {
104 /* technical */
105 display: block;
106 position: relative;
107 box-sizing: border-box;
108 -moz-box-sizing: border-box;
109
110 /* size */
111 height: var(--paper-toolbar-height, 64px);
112
113 background: var(--paper-toolbar-background, --default-primary-color);
114 color: var(--paper-toolbar-color, --text-primary-color);
115
116 @apply(--paper-toolbar);
117 }
118
119 :host(.animate) {
120 /* transition */
121 transition: height 0.18s ease-in;
122 }
123
124 :host(.medium-tall) {
125 height: calc(var(--paper-toolbar-height, 64px) * 2);
126 @apply(--paper-toolbar-medium);
127 }
128
129 :host(.tall) {
130 height: calc(var(--paper-toolbar-height, 64px) * 3);
131 @apply(--paper-toolbar-tall);
132 }
133
134 .toolbar-tools {
135 position: relative;
136 height: var(--paper-toolbar-height, 64px);
137 padding: 0 16px;
138 pointer-events: none;
139 @apply(--layout-horizontal);
140 @apply(--layout-center);
141 @apply(--paper-toolbar-content);
142 }
143
144 /*
145 * TODO: Where should media query breakpoints live so they can be shared b etween elements?
146 */
147
148 @media (max-width: 600px) {
149 :host {
150 height: var(--paper-toolbar-sm-height, 56px);
151 }
152
153 :host(.medium-tall) {
154 height: calc(var(--paper-toolbar-sm-height, 56px) * 2);
155 }
156
157 :host(.tall) {
158 height: calc(var(--paper-toolbar-sm-height, 56px) * 3);
159 }
160
161 .toolbar-tools {
162 height: var(--paper-toolbar-sm-height, 56px);
163 }
164 }
165
166 #topBar {
167 position: relative;
168 }
169
170 /* middle bar */
171 #middleBar {
172 position: absolute;
173 top: 0;
174 right: 0;
175 left: 0;
176 }
177
178 :host(.tall) #middleBar,
179 :host(.medium-tall) #middleBar {
180 -webkit-transform: translateY(100%);
181 transform: translateY(100%);
182 }
183
184 /* bottom bar */
185 #bottomBar {
186 position: absolute;
187 right: 0;
188 bottom: 0;
189 left: 0;
190 }
191
192 /*
193 * make elements (e.g. buttons) respond to mouse/touch events
194 *
195 * `.toolbar-tools` disables touch events so multiple toolbars can stack a nd not
196 * absorb events. All children must have pointer events re-enabled to work as
197 * expected.
198 */
199 .toolbar-tools > ::content > *:not([disabled]) {
200 pointer-events: auto;
201 }
202
203 .toolbar-tools > ::content .title {
204 @apply(--paper-font-common-base);
205
206 white-space: nowrap;
207 overflow: hidden;
208 text-overflow: ellipsis;
209 font-size: 20px;
210 font-weight: 400;
211 line-height: 1;
212 pointer-events: none;
213
214 @apply(--layout-flex);
215 @apply(--paper-toolbar-title);
216 }
217
218 /**
219 * TODO: Refactor these selectors
220 * Work in progress.
221 */
222 .toolbar-tools > ::content paper-icon-button[icon=menu] {
223 margin-right: 24px;
224 }
225
226 .toolbar-tools > ::content > .title,
227 .toolbar-tools > ::content[select=".middle"] > .title,
228 .toolbar-tools > ::content[select=".bottom"] > .title {
229 margin-left: 56px;
230 }
231
232 .toolbar-tools > ::content > paper-icon-button + .title,
233 .toolbar-tools > ::content[select=".middle"] paper-icon-button + .title,
234 .toolbar-tools > ::content[select=".bottom"] paper-icon-button + .title {
235 margin-left: 0;
236 }
237
238 .toolbar-tools > ::content > .fit {
239 position: absolute;
240 top: auto;
241 right: 0;
242 bottom: 0;
243 left: 0;
244 width: auto;
245 margin: 0;
246 }
247
248 /* TODO(noms): Until we have a better solution for classes that don't use
249 * /deep/ create our own.
250 */
251 .start-justified {
252 @apply(--layout-start-justified);
253 }
254
255 .center-justified {
256 @apply(--layout-center-justified);
257 }
258
259 .end-justified {
260 @apply(--layout-end-justified);
261 }
262
263 .around-justified {
264 @apply(--layout-around-justified);
265 }
266
267 .justified {
268 @apply(--layout-justified);
269 }
270 </style>
271
272 <div id="topBar" class$="toolbar-tools [[_computeBarExtraClasses(justify)]]" >
273 <content select=":not(.middle):not(.bottom)"></content>
274 </div>
275
276 <div id="middleBar" class$="toolbar-tools [[_computeBarExtraClasses(middleJu stify)]]">
277 <content select=".middle"></content>
278 </div>
279
280 <div id="bottomBar" class$="toolbar-tools [[_computeBarExtraClasses(bottomJu stify)]]">
281 <content select=".bottom"></content>
282 </div>
283 </template>
284
285 <script>
286 Polymer({
287 is: 'paper-toolbar',
288
289 hostAttributes: {
290 'role': 'toolbar'
291 },
292
293 properties: {
294 /**
295 * Controls how the items are aligned horizontally when they are placed
296 * at the bottom.
297 * Options are `start`, `center`, `end`, `justified` and `around`.
298 */
299 bottomJustify: {
300 type: String,
301 value: ''
302 },
303
304 /**
305 * Controls how the items are aligned horizontally.
306 * Options are `start`, `center`, `end`, `justified` and `around`.
307 */
308 justify: {
309 type: String,
310 value: ''
311 },
312
313 /**
314 * Controls how the items are aligned horizontally when they are placed
315 * in the middle.
316 * Options are `start`, `center`, `end`, `justified` and `around`.
317 */
318 middleJustify: {
319 type: String,
320 value: ''
321 }
322
323 },
324
325 attached: function() {
326 this._observer = this._observe(this);
327 this._updateAriaLabelledBy();
328 },
329
330 detached: function() {
331 if (this._observer) {
332 this._observer.disconnect();
333 }
334 },
335
336 _observe: function(node) {
337 var observer = new MutationObserver(function() {
338 this._updateAriaLabelledBy();
339 }.bind(this));
340 observer.observe(node, {
341 childList: true,
342 subtree: true
343 });
344 return observer;
345 },
346
347 _updateAriaLabelledBy: function() {
348 var labelledBy = [];
349 var contents = Polymer.dom(this.root).querySelectorAll('content');
350 for (var content, index = 0; content = contents[index]; index++) {
351 var nodes = Polymer.dom(content).getDistributedNodes();
352 for (var node, jndex = 0; node = nodes[jndex]; jndex++) {
353 if (node.classList && node.classList.contains('title')) {
354 if (node.id) {
355 labelledBy.push(node.id);
356 } else {
357 var id = 'paper-toolbar-label-' + Math.floor(Math.random() * 100 00);
358 node.id = id;
359 labelledBy.push(id);
360 }
361 }
362 }
363 }
364 if (labelledBy.length > 0) {
365 this.setAttribute('aria-labelledby', labelledBy.join(' '));
366 }
367 },
368
369 _computeBarExtraClasses: function(barJustify) {
370 if (!barJustify) return '';
371
372 return barJustify + (barJustify === 'justified' ? '' : '-justified');
373 }
374 });
375 </script>
376 </dom-module>
OLDNEW
« no previous file with comments | « polymer_1.2.3/bower_components/paper-toolbar/index.html ('k') | polymer_1.2.3/bower_components/paper-toolbar/test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698