Home | History | Annotate | Download | only in demo
      1 <!doctype html>
      2 <!--
      3 @license
      4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
      5 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
      6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
      7 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
      8 Code distributed by Google as part of the polymer project is also
      9 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
     10 -->
     11 <html>
     12 <head>
     13 
     14   <meta charset="utf-8">
     15   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     16   <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
     17 
     18   <title>paper-dialog demo</title>
     19 
     20   <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
     21 
     22   <link rel="import" href="../paper-dialog.html">
     23   <link rel="import" href="../../paper-button/paper-button.html">
     24   <link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html">
     25   <link rel="import" href="../../paper-styles/color.html">
     26   <link rel="import" href="../../paper-styles/demo-pages.html">
     27   <link rel="import" href="../../neon-animation/neon-animations.html">
     28   <link rel="import" href="../../paper-dropdown-menu/paper-dropdown-menu.html">
     29   <link rel="import" href="../../paper-menu/paper-menu.html">
     30   <link rel="import" href="../../paper-item/paper-item.html">
     31 
     32   <link rel="stylesheet" href="../../paper-styles/demo.css">
     33 
     34   <style is="custom-style">
     35 
     36     section {
     37       -webkit-tap-highlight-color: rgba(0,0,0,0);
     38     }
     39     
     40     section > paper-button {
     41       background-color: var(--google-grey-300);
     42       padding: 5px;
     43     }
     44 
     45     section > paper-button:hover {
     46       background-color: var(--paper-light-blue-200);
     47       padding: 5px;
     48     }
     49 
     50     paper-dialog.colored {
     51       border: 2px solid;
     52       border-color: var(--paper-green-500);
     53       background-color: var(--paper-light-green-50);
     54       color: var(--paper-green-500);
     55     }
     56 
     57     paper-dialog.size-position {
     58       position: fixed;
     59       top: 16px;
     60       right: 16px;
     61       width: 300px;
     62       height: 300px;
     63       overflow: auto;
     64     }
     65   </style>
     66 
     67 </head>
     68 <body unresolved>
     69 
     70   <section onclick="clickHandler(event)">
     71     <h4>Dialog layouts</h4>
     72 
     73     <paper-button data-dialog="dialog">plain dialog</paper-button>
     74     <paper-button data-dialog="scrolling">scrolling dialog</paper-button>
     75     <paper-button data-dialog="actions">dialog with actions</paper-button>
     76     <paper-button data-dialog="modal">modal dialog</paper-button>
     77     <paper-button data-dialog="dropdown">dialog with dropdown</paper-button>
     78     <paper-button data-dialog="nested">dialog with nested dialog</paper-button>
     79 
     80     <paper-dialog id="dialog">
     81       <h2>Dialog Title</h2>
     82       <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     83     </paper-dialog>
     84 
     85     <paper-dialog id="scrolling">
     86       <h2>Scrolling</h2>
     87       <paper-dialog-scrollable>
     88         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     89         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     90         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     91         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     92         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     93         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     94         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     95         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
     96       </paper-dialog-scrollable>
     97       <div class="buttons">
     98         <paper-button dialog-dismiss>Cancel</paper-button>
     99         <paper-button dialog-confirm autofocus>OK</paper-button>
    100       </div>
    101     </paper-dialog>
    102 
    103     <paper-dialog id="actions">
    104       <h2>Dialog Title</h2>
    105       <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    106       <div class="buttons">
    107         <paper-button >More Info...</paper-button>
    108         <paper-button dialog-dismiss>Decline</paper-button>
    109         <paper-button dialog-confirm autofocus>Accept</paper-button>
    110       </div>
    111     </paper-dialog>
    112 
    113     <paper-dialog id="modal" modal>
    114       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    115       <div class="buttons">
    116         <paper-button dialog-confirm autofocus>Tap me to close</paper-button>
    117       </div>
    118     </paper-dialog>
    119 
    120     <paper-dialog id="dropdown">
    121     <h2>Dialog Title</h2>
    122     <paper-dropdown-menu label="Value">
    123       <paper-menu class="dropdown-content">
    124         <paper-item>1</paper-item>
    125         <paper-item>2</paper-item>
    126         <paper-item>3</paper-item>
    127         <paper-item>4</paper-item>
    128         <paper-item>5</paper-item>
    129         <paper-item>6</paper-item>
    130         <paper-item>7</paper-item>
    131         <paper-item>8</paper-item>
    132         <paper-item>9</paper-item>
    133         <paper-item>10</paper-item>
    134       </paper-menu>
    135     </paper-dropdown-menu>
    136   </paper-dialog>
    137 
    138   <paper-dialog id="nested">
    139     <h2>Dialog Title</h2>
    140     <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    141     <div class="buttons">
    142       <paper-button data-dialog="innerDialog">Open nested dialog</paper-button>
    143     </div>
    144   </paper-dialog>
    145 
    146   <paper-dialog id="innerDialog">
    147     <h2>Dialog Title</h2>
    148     <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    149   </paper-dialog>
    150 
    151   </section>
    152 
    153   <section onclick="clickHandler(event)">
    154     <h4>Custom styling</h4>
    155     <paper-button data-dialog="colors">colors</paper-button>
    156     <paper-button data-dialog="position">size &amp; position</paper-button>
    157 
    158     <paper-dialog id="colors" class="colored">
    159       <h2>Custom Colors</h2>
    160       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    161     </paper-dialog>
    162 
    163     <paper-dialog id="position" class="size-position">
    164       <h2>Custom Size &amp; Position</h2>
    165       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    166     </paper-dialog>
    167   </section>
    168 
    169   <section onclick="clickHandler(event)">
    170     <h4>Transitions</h4>
    171     <paper-button data-dialog="animated">transitions</paper-button>
    172     <paper-dialog id="animated" entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop>
    173       <h2>Dialog Title</h2>
    174       <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    175     </paper-dialog>
    176   </section>
    177 
    178   <script>
    179     function clickHandler(e) {
    180       var button = e.target;
    181       while (!button.hasAttribute('data-dialog') && button !== document.body) {
    182         button = button.parentElement;
    183       }
    184 
    185       if (!button.hasAttribute('data-dialog')) {
    186         return;
    187       }
    188 
    189       var id = button.getAttribute('data-dialog');
    190       var dialog = document.getElementById(id);
    191       if (dialog) {
    192         dialog.open();
    193       }
    194     }
    195 
    196   </script>
    197 
    198 </body>
    199 </html>
    200