Home | History | Annotate | Download | only in paper-dialog
      1 <!--
      2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
      3 This code may only be used under the BSD style license found at http://polymer.github.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/CONTRIBUTORS.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/PATENTS.txt
      8 -->
      9 
     10 <!--
     11 
     12 Material Design: <a href="http://www.google.com/design/spec/components/dialogs.html">Dialogs</a>
     13 
     14 `paper-dialog-base` is a base class used to implement Material Design styled
     15 dialogs.
     16 
     17 @group Paper Elements
     18 @element paper-dialog-base
     19 @extends core-overlay
     20 @homepage github.io
     21 @status unstable
     22 -->
     23 <link href="../polymer/polymer.html" rel="import">
     24 <link href="../core-overlay/core-overlay.html" rel="import">
     25 <link href="../core-transition/core-transition-css.html" rel="import">
     26 
     27 <polymer-element name="paper-dialog-base" extends="core-overlay" role="dialog" on-core-overlay-open="{{openAction}}">
     28 
     29 <script>
     30 
     31   Polymer({
     32 
     33     publish: {
     34 
     35       /**
     36        * The title of the dialog.
     37        *
     38        * @attribute heading
     39        * @type string
     40        * @default ''
     41        */
     42       heading: '',
     43 
     44       /**
     45        * @attribute transition
     46        * @type string
     47        * @default ''
     48        */
     49       transition: '',
     50 
     51       /**
     52        * @attribute layered
     53        * @type boolean
     54        * @default true
     55        */
     56       layered: true
     57     },
     58 
     59     ready: function() {
     60       this.super();
     61       this.sizingTarget = this.$.scroller;
     62     },
     63 
     64     headingChanged: function(old) {
     65       var label = this.getAttribute('aria-label');
     66       if (!label || label === old) {
     67         this.setAttribute('aria-label', this.heading);
     68       }
     69     },
     70 
     71     openAction: function() {
     72       if (this.$.scroller.scrollTop) {
     73         this.$.scroller.scrollTop = 0;
     74       }
     75     }
     76 
     77   });
     78 
     79 </script>
     80 
     81 </polymer-element>
     82