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

Side by Side Diff: polymer_1.2.3/bower_components/paper-progress/paper-progress.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 @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 -->
10
11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
13 <link rel="import" href="../iron-range-behavior/iron-range-behavior.html">
14 <link rel="import" href="../paper-styles/color.html">
15
16 <!--
17 Material design: [Progress & activity](https://www.google.com/design/spec/compon ents/progress-activity.html)
18
19 The progress bars are for situations where the percentage completed can be
20 determined. They give users a quick sense of how much longer an operation
21 will take.
22
23 Example:
24
25 <paper-progress value="10"></paper-progress>
26
27 There is also a secondary progress which is useful for displaying intermediate
28 progress, such as the buffer level during a streaming playback progress bar.
29
30 Example:
31
32 <paper-progress value="10" secondary-progress="30"></paper-progress>
33
34 ### Styling progress bar:
35
36 To change the active progress bar color:
37
38 paper-progress {
39 --paper-progress-active-color: #e91e63;
40 }
41
42 To change the secondary progress bar color:
43
44 paper-progress {
45 --paper-progress-secondary-color: #f8bbd0;
46 }
47
48 To change the progress bar background color:
49
50 paper-progress {
51 --paper-progress-container-color: #64ffda;
52 }
53
54 Add the class `transiting` to a paper-progress to animate the progress bar when
55 the value changed. You can also customize the transition:
56
57 paper-progress {
58 --paper-progress-transition-duration: 0.08s;
59 --paper-progress-transition-timing-function: ease;
60 --paper-progress-transition-transition-delay: 0s;
61 }
62
63 The following mixins are available for styling:
64
65 Custom property | Description | Default
66 ----------------------------------------------|--------------------------------- ------------|--------------
67 `--paper-progress-container-color` | Mixin applied to container | `--google-grey-300`
68 `--paper-progress-transition-duration` | Duration of the transition | `0.008s`
69 `--paper-progress-transition-timing-function` | The timing function for the tran sition | `ease`
70 `--paper-progress-transition-delay` | delay for the transition | `0s`
71 `--paper-progress-active-color` | The color of the active bar | `--google-green-500`
72 `--paper-progress-secondary-color` | The color of the secondary bar | `--google-green-100`
73 `--paper-progress-disabled-active-color` | The color of the active bar if d isabled | `--google-grey-500`
74 `--paper-progress-disabled-secondary-color` | The color of the secondary bar i f disabled | `--google-grey-300`
75 `--paper-progress-height` | The height of the progress bar | `4px`
76
77 @group Paper Elements
78 @element paper-progress
79 @hero hero.svg
80 @demo demo/index.html
81 -->
82
83 <dom-module id="paper-progress">
84 <template>
85 <style>
86 :host {
87 display: block;
88 width: 200px;
89 position: relative;
90 overflow: hidden;
91 }
92
93 #progressContainer {
94 position: relative;
95 }
96
97 #progressContainer,
98 /* the stripe for the indeterminate animation*/
99 .indeterminate::after {
100 height: var(--paper-progress-height, 4px);
101 }
102
103 #primaryProgress,
104 #secondaryProgress,
105 .indeterminate::after {
106 @apply(--layout-fit);
107 }
108
109 #progressContainer,
110 .indeterminate::after {
111 background-color: var(--paper-progress-container-color, --google-grey-30 0);
112 }
113
114 :host(.transiting) #primaryProgress,
115 :host(.transiting) #secondaryProgress {
116 -webkit-transition-property: -webkit-transform;
117 transition-property: transform;
118
119 /* Duration */
120 -webkit-transition-duration: var(--paper-progress-transition-duration, 0 .08s);
121 transition-duration: var(--paper-progress-transition-duration, 0.08s);
122
123 /* Timing function */
124 -webkit-transition-timing-function: var(--paper-progress-transition-timi ng-function, ease);
125 transition-timing-function: var(--paper-progress-transition-timing-funct ion, ease);
126
127 /* Delay */
128 -webkit-transition-delay: var(--paper-progress-transition-delay, 0s);
129 transition-delay: var(--paper-progress-transition-delay, 0s);
130 }
131
132 #primaryProgress,
133 #secondaryProgress {
134 @apply(--layout-fit);
135 -webkit-transform-origin: left center;
136 transform-origin: left center;
137 -webkit-transform: scaleX(0);
138 transform: scaleX(0);
139 will-change: transform;
140 }
141
142 #primaryProgress {
143 background-color: var(--paper-progress-active-color, --google-green-500) ;
144 }
145
146 #secondaryProgress {
147 position: relative;
148 background-color: var(--paper-progress-secondary-color, --google-green-1 00);
149 }
150
151 :host([disabled]) #primaryProgress {
152 background-color: var(--paper-progress-disabled-active-color, --google-g rey-500);
153 }
154
155 :host([disabled]) #secondaryProgress {
156 background-color: var(--paper-progress-disabled-secondary-color, --googl e-grey-300);
157 }
158
159 :host(:not([disabled])) #primaryProgress.indeterminate {
160 -webkit-transform-origin: right center;
161 transform-origin: right center;
162 -webkit-animation: indeterminate-bar 2s linear infinite;
163 animation: indeterminate-bar 2s linear infinite;
164 }
165
166 :host(:not([disabled])) #primaryProgress.indeterminate::after {
167 content: "";
168 -webkit-transform-origin: center center;
169 transform-origin: center center;
170
171 -webkit-animation: indeterminate-splitter 2s linear infinite;
172 animation: indeterminate-splitter 2s linear infinite;
173 }
174
175 @-webkit-keyframes indeterminate-bar {
176 0% {
177 -webkit-transform: scaleX(1) translateX(-100%);
178 }
179 50% {
180 -webkit-transform: scaleX(1) translateX(0%);
181 }
182 75% {
183 -webkit-transform: scaleX(1) translateX(0%);
184 -webkit-animation-timing-function: cubic-bezier(.28,.62,.37,.91);
185 }
186 100% {
187 -webkit-transform: scaleX(0) translateX(0%);
188 }
189 }
190
191 @-webkit-keyframes indeterminate-splitter {
192 0% {
193 -webkit-transform: scaleX(.75) translateX(-125%);
194 }
195 30% {
196 -webkit-transform: scaleX(.75) translateX(-125%);
197 -webkit-animation-timing-function: cubic-bezier(.42,0,.6,.8);
198 }
199 90% {
200 -webkit-transform: scaleX(.75) translateX(125%);
201 }
202 100% {
203 -webkit-transform: scaleX(.75) translateX(125%);
204 }
205 }
206
207 @keyframes indeterminate-bar {
208 0% {
209 transform: scaleX(1) translateX(-100%);
210 }
211 50% {
212 transform: scaleX(1) translateX(0%);
213 }
214 75% {
215 transform: scaleX(1) translateX(0%);
216 animation-timing-function: cubic-bezier(.28,.62,.37,.91);
217 }
218 100% {
219 transform: scaleX(0) translateX(0%);
220 }
221 }
222
223 @keyframes indeterminate-splitter {
224 0% {
225 transform: scaleX(.75) translateX(-125%);
226 }
227 30% {
228 transform: scaleX(.75) translateX(-125%);
229 animation-timing-function: cubic-bezier(.42,0,.6,.8);
230 }
231 90% {
232 transform: scaleX(.75) translateX(125%);
233 }
234 100% {
235 transform: scaleX(.75) translateX(125%);
236 }
237 }
238 </style>
239
240 <div id="progressContainer">
241 <div id="secondaryProgress" hidden$="[[_hideSecondaryProgress(secondaryRat io)]]"></div>
242 <div id="primaryProgress"></div>
243 </div>
244 </template>
245 </dom-module>
246
247 <script>
248 Polymer({
249 is: 'paper-progress',
250
251 behaviors: [
252 Polymer.IronRangeBehavior
253 ],
254
255 properties: {
256 /**
257 * The number that represents the current secondary progress.
258 */
259 secondaryProgress: {
260 type: Number,
261 value: 0
262 },
263
264 /**
265 * The secondary ratio
266 */
267 secondaryRatio: {
268 type: Number,
269 value: 0,
270 readOnly: true
271 },
272
273 /**
274 * Use an indeterminate progress indicator.
275 */
276 indeterminate: {
277 type: Boolean,
278 value: false,
279 observer: '_toggleIndeterminate'
280 },
281
282 /**
283 * True if the progress is disabled.
284 */
285 disabled: {
286 type: Boolean,
287 value: false,
288 reflectToAttribute: true,
289 observer: '_disabledChanged'
290 }
291 },
292
293 observers: [
294 '_progressChanged(secondaryProgress, value, min, max)'
295 ],
296
297 hostAttributes: {
298 role: 'progressbar'
299 },
300
301 _toggleIndeterminate: function(indeterminate) {
302 // If we use attribute/class binding, the animation sometimes doesn't tran slate properly
303 // on Safari 7.1. So instead, we toggle the class here in the update metho d.
304 this.toggleClass('indeterminate', indeterminate, this.$.primaryProgress);
305 },
306
307 _transformProgress: function(progress, ratio) {
308 var transform = 'scaleX(' + (ratio / 100) + ')';
309 progress.style.transform = progress.style.webkitTransform = transform;
310 },
311
312 _mainRatioChanged: function(ratio) {
313 this._transformProgress(this.$.primaryProgress, ratio);
314 },
315
316 _progressChanged: function(secondaryProgress, value, min, max) {
317 secondaryProgress = this._clampValue(secondaryProgress);
318 value = this._clampValue(value);
319
320 var secondaryRatio = this._calcRatio(secondaryProgress) * 100;
321 var mainRatio = this._calcRatio(value) * 100;
322
323 this._setSecondaryRatio(secondaryRatio);
324 this._transformProgress(this.$.secondaryProgress, secondaryRatio);
325 this._transformProgress(this.$.primaryProgress, mainRatio);
326
327 this.secondaryProgress = secondaryProgress;
328
329 this.setAttribute('aria-valuenow', value);
330 this.setAttribute('aria-valuemin', min);
331 this.setAttribute('aria-valuemax', max);
332 },
333
334 _disabledChanged: function(disabled) {
335 this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
336 },
337
338 _hideSecondaryProgress: function(secondaryRatio) {
339 return secondaryRatio === 0;
340 }
341 });
342 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698