| OLD | NEW |
| (Empty) |
| 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.g
ithub.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/CONTRI
BUTORS.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/PATEN
TS.txt | |
| 8 --><!-- | |
| 9 `paper-toast` provides lightweight feedback about an operation in a small popup | |
| 10 at the base of the screen on mobile and at the lower left on desktop. Toasts are
| |
| 11 above all other elements on screen, including the FAB. | |
| 12 | |
| 13 Toasts automatically disappear after a timeout or after user interaction | |
| 14 elsewhere on the screen, whichever comes first. Toasts can be swiped off | |
| 15 screen. There can be only one on the screen at a time. | |
| 16 | |
| 17 Example: | |
| 18 | |
| 19 <paper-toast text="Your draft has been discarded." onclick="discardDraft(el)
"></paper-toast> | |
| 20 | |
| 21 <script> | |
| 22 function discardDraft(el) { | |
| 23 el.show(); | |
| 24 } | |
| 25 </script> | |
| 26 | |
| 27 An action button can be presented in the toast. | |
| 28 | |
| 29 Example (using Polymer's data-binding features): | |
| 30 | |
| 31 <paper-toast id="toast2" text="Connection timed out. Showing limited message
s."> | |
| 32 <div style="color: blue;" on-tap="{{retry}}">Retry</div> | |
| 33 </paper-toast> | |
| 34 | |
| 35 Positioning toast: | |
| 36 | |
| 37 A standard toast appears near the lower left of the screen. You can change the | |
| 38 position by overriding bottom and left positions. | |
| 39 | |
| 40 paper-toast { | |
| 41 bottom: 40px; | |
| 42 left: 10px; | |
| 43 } | |
| 44 | |
| 45 To position the toast to the right: | |
| 46 | |
| 47 paper-toast { | |
| 48 right: 10px; | |
| 49 left: auto; | |
| 50 } | |
| 51 | |
| 52 To make it fit at the bottom of the screen: | |
| 53 | |
| 54 paper-toast { | |
| 55 bottom: 0; | |
| 56 left: 0; | |
| 57 width: 100%; | |
| 58 } | |
| 59 | |
| 60 When the screen size is smaller than the `responsiveWidth` (default to 480px), | |
| 61 the toast will automatically fits at the bottom of the screen. | |
| 62 | |
| 63 @group Paper Elements | |
| 64 @element paper-toast | |
| 65 @homepage github.io | |
| 66 --><!-- | |
| 67 Fired when the `paper-toast`'s `opened` property changes. | |
| 68 | |
| 69 @event core-overlay-open | |
| 70 @param {boolean} detail the opened state | |
| 71 --><!-- | |
| 72 Fired when the `paper-toast` has completely opened. | |
| 73 | |
| 74 @event core-overlay-open-completed | |
| 75 --><!-- | |
| 76 Fired when the `paper-toast` has completely closed. | |
| 77 | |
| 78 @event core-overlay-close-completed | |
| 79 --><html><head><link rel="import" href="../core-overlay/core-overlay.html"> | |
| 80 <link rel="import" href="../core-transition/core-transition-css.html"> | |
| 81 <link rel="import" href="../core-media-query/core-media-query.html"> | |
| 82 | |
| 83 </head><body><polymer-element name="paper-toast" attributes="text duration opene
d responsiveWidth swipeDisabled autoCloseDisabled" role="status" assetpath=""> | |
| 84 | |
| 85 <template> | |
| 86 | |
| 87 <link rel="stylesheet" href="paper-toast.css"> | |
| 88 | |
| 89 <core-overlay id="overlay" autofocusdisabled="" autoclosedisabled="{{autoClose
Disabled}}" opened="{{opened}}" target="{{}}" transition="core-transition-bottom
"></core-overlay> | |
| 90 | |
| 91 <div class="toast-container" horizontal="" layout=""> | |
| 92 | |
| 93 <div class="toast-text" flex="">{{text}}</div> | |
| 94 | |
| 95 <div class="toast-text toast-action" on-tap="{{dismiss}}"> | |
| 96 <content></content> | |
| 97 </div> | |
| 98 | |
| 99 </div> | |
| 100 | |
| 101 <core-media-query query="max-width: {{responsiveWidth}}" querymatches="{{narro
wMode}}"></core-media-query> | |
| 102 | |
| 103 </template> | |
| 104 | |
| 105 </polymer-element> | |
| 106 <script charset="utf-8" src="paper-toast-extracted.js"></script></body></html> | |
| OLD | NEW |