Add ICU message format support
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-progress / paper-progress-extracted.js
blob3c41f1143ce505bdda342671a7f110c165c25181
2   Polymer({
4     is: 'paper-progress',
6     behaviors: [
7       Polymer.IronRangeBehavior
8     ],
10     properties: {
12       /**
13        * The number that represents the current secondary progress.
14        */
15       secondaryProgress: {
16         type: Number,
17         value: 0,
18         notify: true
19       },
21       /**
22        * The secondary ratio
23        */
24       secondaryRatio: {
25         type: Number,
26         value: 0,
27         readOnly: true,
28         observer: '_secondaryRatioChanged'
29       },
31       /**
32        * Use an indeterminate progress indicator.
33        */
34       indeterminate: {
35         type: Boolean,
36         value: false,
37         notify: true,
38         observer: '_toggleIndeterminate'
39       }
40     },
42     observers: [
43       '_ratioChanged(ratio)',
44       '_secondaryProgressChanged(secondaryProgress, min, max)'
45     ],
47     _toggleIndeterminate: function() {
48       // If we use attribute/class binding, the animation sometimes doesn't translate properly
49       // on Safari 7.1. So instead, we toggle the class here in the update method.
50       this.toggleClass('indeterminate', this.indeterminate, this.$.activeProgress);
51       this.toggleClass('indeterminate', this.indeterminate, this.$.indeterminateSplitter);
52     },
54     _transformProgress: function(progress, ratio) {
55       var transform = 'scaleX(' + (ratio / 100) + ')';
56       progress.style.transform = progress.style.webkitTransform = transform;
57     },
59     _ratioChanged: function(ratio) {
60       this._transformProgress(this.$.activeProgress, ratio);
61     },
63     _secondaryRatioChanged: function(secondaryRatio) {
64       this._transformProgress(this.$.secondaryProgress, secondaryRatio);
65     },
67     _secondaryProgressChanged: function() {
68       this.secondaryProgress = this._clampValue(this.secondaryProgress);
69       this._setSecondaryRatio(this._calcRatio(this.secondaryProgress) * 100);
70     }
72   });