Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components / paper-spinner / paper-spinner.html
blob5a1f9edc8b6f861a738dbf71d870147151c9739c
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.github.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/CONTRIBUTORS.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/PATENTS.txt
9 -->
11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../paper-styles/color.html">
13 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
15 <!--
16 Element providing material design circular spinner.
18 <paper-spinner active></paper-spinner>
20 The default spinner cycles between four layers of colors; by default they are
21 blue, red, yellow and green. It can be customized so that it uses one color only
22 by setting all the layer colors to the same value.
24 ### Accessibility
26 Alt attribute should be set to provide adequate context for accessibility. If not provided,
27 it defaults to 'loading'.
28 Empty alt can be provided to mark the element as decorative if alternative content is provided
29 in another form (e.g. a text block following the spinner).
31 <paper-spinner alt="Loading contacts list" active></paper-spinner>
33 ### Styling
35 The following custom properties and mixins are available for styling:
37 Custom property | Description | Default
38 ----------------|-------------|----------
39 `--paper-spinner-layer-1-color` | Color of the first spinner rotation | `--google-blue-500`
40 `--paper-spinner-layer-2-color` | Color of the second spinner rotation | `--google-red-500`
41 `--paper-spinner-layer-3-color` | Color of the third spinner rotation | `--google-yellow-500`
42 `--paper-spinner-layer-4-color` | Color of the fourth spinner rotation | `--google-green-500`
44 @group Paper Elements
45 @element paper-spinner
46 @hero hero.svg
47 @demo demo/index.html
48 -->
50 <dom-module id="paper-spinner">
52 <link rel="import" type="css" href="paper-spinner.css">
54 <template>
56 <div id="spinnerContainer" class-name="[[_spinnerContainerClassName]]">
57 <div class="spinner-layer layer-1">
58 <div class="circle-clipper left">
59 <div class="circle"></div>
60 </div><div class="gap-patch">
61 <div class="circle"></div>
62 </div><div class="circle-clipper right">
63 <div class="circle"></div>
64 </div>
65 </div>
67 <div class="spinner-layer layer-2">
68 <div class="circle-clipper left">
69 <div class="circle"></div>
70 </div><div class="gap-patch">
71 <div class="circle"></div>
72 </div><div class="circle-clipper right">
73 <div class="circle"></div>
74 </div>
75 </div>
77 <div class="spinner-layer layer-3">
78 <div class="circle-clipper left">
79 <div class="circle"></div>
80 </div><div class="gap-patch">
81 <div class="circle"></div>
82 </div><div class="circle-clipper right">
83 <div class="circle"></div>
84 </div>
85 </div>
87 <div class="spinner-layer layer-4">
88 <div class="circle-clipper left">
89 <div class="circle"></div>
90 </div><div class="gap-patch">
91 <div class="circle"></div>
92 </div><div class="circle-clipper right">
93 <div class="circle"></div>
94 </div>
95 </div>
96 </div>
98 </template>
100 <script>
102 Polymer({
104 is: 'paper-spinner',
106 listeners: {
107 'animationend': 'reset',
108 'webkitAnimationEnd': 'reset'
111 properties: {
114 * Displays the spinner.
116 * @attribute active
117 * @type boolean
118 * @default false
120 active: {
121 type: Boolean,
122 value: false,
123 reflectToAttribute: true,
124 observer: '_activeChanged'
128 * Alternative text content for accessibility support.
129 * If alt is present, it will add an aria-label whose content matches alt when active.
130 * If alt is not present, it will default to 'loading' as the alt value.
132 * @attribute alt
133 * @type string
134 * @default 'loading'
136 alt: {
137 type: String,
138 value: 'loading',
139 observer: '_altChanged'
143 * True when the spinner is going from active to inactive. This is represented by a fade
144 * to 0% opacity to the user.
146 _coolingDown: {
147 type: Boolean,
148 value: false
151 _spinnerContainerClassName: {
152 type: String,
153 computed: '_computeSpinnerContainerClassName(active, _coolingDown)'
158 _computeSpinnerContainerClassName: function(active, coolingDown) {
159 return [
160 active || coolingDown ? 'active' : '',
161 coolingDown ? 'cooldown' : ''
162 ].join(' ');
165 _activeChanged: function(active, old) {
166 this._setAriaHidden(!active);
167 if (!active && old) {
168 this._coolingDown = true;
172 _altChanged: function(alt) {
173 // user-provided `aria-label` takes precedence over prototype default
174 if (alt === this.getPropertyInfo('alt').value) {
175 this.alt = this.getAttribute('aria-label') || alt;
176 } else {
177 this._setAriaHidden(alt==='');
178 this.setAttribute('aria-label', alt);
182 _setAriaHidden: function(hidden) {
183 var attr = 'aria-hidden';
184 if (hidden) {
185 this.setAttribute(attr, 'true');
186 } else {
187 this.removeAttribute(attr);
191 reset: function() {
192 this.active = false;
193 this._coolingDown = false;
198 </script>
200 </dom-module>