Home | History | Annotate | Download | only in paper-spinner
      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 -->
     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="../paper-styles/color.html">
     14 <link rel="import" href="paper-spinner-behavior.html">
     15 <link rel="import" href="paper-spinner-styles.html">
     16 
     17 <!--
     18 Material design: [Progress & activity](https://www.google.com/design/spec/components/progress-activity.html)
     19 
     20 Element providing a multiple color material design circular spinner.
     21 
     22     <paper-spinner active></paper-spinner>
     23 
     24 The default spinner cycles between four layers of colors; by default they are
     25 blue, red, yellow and green. It can be customized to cycle between four different
     26 colors. Use <paper-spinner-lite> for single color spinners.
     27 
     28 ### Accessibility
     29 
     30 Alt attribute should be set to provide adequate context for accessibility. If not provided,
     31 it defaults to 'loading'.
     32 Empty alt can be provided to mark the element as decorative if alternative content is provided
     33 in another form (e.g. a text block following the spinner).
     34 
     35     <paper-spinner alt="Loading contacts list" active></paper-spinner>
     36 
     37 ### Styling
     38 
     39 The following custom properties and mixins are available for styling:
     40 
     41 Custom property | Description | Default
     42 ----------------|-------------|----------
     43 `--paper-spinner-layer-1-color` | Color of the first spinner rotation | `--google-blue-500`
     44 `--paper-spinner-layer-2-color` | Color of the second spinner rotation | `--google-red-500`
     45 `--paper-spinner-layer-3-color` | Color of the third spinner rotation | `--google-yellow-500`
     46 `--paper-spinner-layer-4-color` | Color of the fourth spinner rotation | `--google-green-500`
     47 `--paper-spinner-stroke-width` | The width of the spinner stroke | 3px
     48 
     49 @group Paper Elements
     50 @element paper-spinner
     51 @hero hero.svg
     52 @demo demo/index.html
     53 -->
     54 
     55 <dom-module id="paper-spinner">
     56   <template strip-whitespace>
     57     <style include="paper-spinner-styles"></style>
     58 
     59     <div id="spinnerContainer" class-name="[[__computeContainerClasses(active, __coolingDown)]]">
     60       <div class="spinner-layer layer-1">
     61         <div class="circle-clipper left"></div>
     62         <div class="circle-clipper right"></div>
     63       </div>
     64 
     65       <div class="spinner-layer layer-2">
     66         <div class="circle-clipper left"></div>
     67         <div class="circle-clipper right"></div>
     68       </div>
     69 
     70       <div class="spinner-layer layer-3">
     71         <div class="circle-clipper left"></div>
     72         <div class="circle-clipper right"></div>
     73       </div>
     74 
     75       <div class="spinner-layer layer-4">
     76         <div class="circle-clipper left"></div>
     77         <div class="circle-clipper right"></div>
     78       </div>
     79     </div>
     80   </template>
     81 
     82   <script>
     83     Polymer({
     84       is: 'paper-spinner',
     85 
     86       behaviors: [
     87         Polymer.PaperSpinnerBehavior
     88       ]
     89     });
     90   </script>
     91 </dom-module>
     92