polymer-paper-elements-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
  5. data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
  6. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  7. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  8. data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
  9. data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
  10. data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
  11. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  12. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  13. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  14. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  15. data/app/assets/components/iron-icon/hero.svg +19 -0
  16. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  17. data/app/assets/components/iron-icons/av-icons.html +73 -0
  18. data/app/assets/components/iron-icons/communication-icons.html +59 -0
  19. data/app/assets/components/iron-icons/device-icons.html +94 -0
  20. data/app/assets/components/iron-icons/editor-icons.html +70 -0
  21. data/app/assets/components/iron-icons/hardware-icons.html +61 -0
  22. data/app/assets/components/iron-icons/hero.svg +35 -0
  23. data/app/assets/components/iron-icons/image-icons.html +164 -0
  24. data/app/assets/components/iron-icons/iron-icons.html +303 -0
  25. data/app/assets/components/iron-icons/maps-icons.html +71 -0
  26. data/app/assets/components/iron-icons/notification-icons.html +62 -0
  27. data/app/assets/components/iron-icons/social-icons.html +40 -0
  28. data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
  29. data/app/assets/components/iron-input/hero.svg +19 -0
  30. data/app/assets/components/iron-input/iron-input.html +235 -0
  31. data/app/assets/components/iron-media-query/hero.svg +29 -0
  32. data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
  33. data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
  34. data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
  35. data/app/assets/components/iron-meta/hero.svg +33 -0
  36. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  37. data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
  38. data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
  39. data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
  40. data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
  41. data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
  42. data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
  43. data/app/assets/components/iron-selector/iron-selectable.html +307 -0
  44. data/app/assets/components/iron-selector/iron-selection.html +115 -0
  45. data/app/assets/components/iron-selector/iron-selector.html +71 -0
  46. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
  47. data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
  48. data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
  49. data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
  50. data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
  51. data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
  52. data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
  53. data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
  54. data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
  55. data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
  56. data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
  57. data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
  58. data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
  59. data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
  60. data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
  61. data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
  62. data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
  63. data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
  64. data/app/assets/components/neon-animation/neon-animatable.html +54 -0
  65. data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
  66. data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
  67. data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
  68. data/app/assets/components/neon-animation/neon-animation.html +17 -0
  69. data/app/assets/components/neon-animation/neon-animations.html +25 -0
  70. data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
  71. data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
  72. data/app/assets/components/neon-animation/web-animations.html +11 -0
  73. data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
  74. data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
  75. data/app/assets/components/paper-button/paper-button.html +177 -0
  76. data/app/assets/components/paper-checkbox/metadata.html +17 -0
  77. data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
  78. data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
  79. data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
  80. data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
  81. data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
  82. data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
  83. data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
  84. data/app/assets/components/paper-dialog/hero.svg +58 -0
  85. data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
  86. data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
  87. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
  88. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
  89. data/app/assets/components/paper-fab/paper-fab.html +159 -0
  90. data/app/assets/components/paper-header-panel/hero.svg +38 -0
  91. data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
  92. data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
  93. data/app/assets/components/paper-input/all-imports.html +12 -0
  94. data/app/assets/components/paper-input/hero.svg +19 -0
  95. data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
  96. data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
  97. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  98. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  99. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  100. data/app/assets/components/paper-input/paper-input.html +126 -0
  101. data/app/assets/components/paper-input/paper-textarea.html +100 -0
  102. data/app/assets/components/paper-item/all-imports.html +13 -0
  103. data/app/assets/components/paper-item/paper-icon-item.html +86 -0
  104. data/app/assets/components/paper-item/paper-item-body.html +93 -0
  105. data/app/assets/components/paper-item/paper-item-shared.css +19 -0
  106. data/app/assets/components/paper-item/paper-item.html +95 -0
  107. data/app/assets/components/paper-material/paper-material.html +98 -0
  108. data/app/assets/components/paper-menu/hero.svg +35 -0
  109. data/app/assets/components/paper-menu/paper-menu.html +133 -0
  110. data/app/assets/components/paper-progress/hero.svg +21 -0
  111. data/app/assets/components/paper-progress/paper-progress.html +199 -0
  112. data/app/assets/components/paper-radio-button/hero.svg +22 -0
  113. data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
  114. data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
  115. data/app/assets/components/paper-radio-group/hero.svg +25 -0
  116. data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
  117. data/app/assets/components/paper-ripple/hero.svg +30 -0
  118. data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
  119. data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
  120. data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
  121. data/app/assets/components/paper-slider/hero.svg +20 -0
  122. data/app/assets/components/paper-slider/paper-slider.css +252 -0
  123. data/app/assets/components/paper-slider/paper-slider.html +449 -0
  124. data/app/assets/components/paper-spinner/hero.svg +27 -0
  125. data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
  126. data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
  127. data/app/assets/components/paper-styles/classes/global.html +96 -0
  128. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  129. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  130. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  131. data/app/assets/components/paper-styles/color.html +333 -0
  132. data/app/assets/components/paper-styles/default-theme.html +39 -0
  133. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  134. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  135. data/app/assets/components/paper-styles/shadow.html +61 -0
  136. data/app/assets/components/paper-styles/typography.html +240 -0
  137. data/app/assets/components/paper-tabs/hero.svg +23 -0
  138. data/app/assets/components/paper-tabs/paper-tab.html +158 -0
  139. data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
  140. data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
  141. data/app/assets/components/paper-toast/hero.svg +20 -0
  142. data/app/assets/components/paper-toast/paper-toast.html +164 -0
  143. data/app/assets/components/paper-toggle-button/hero.svg +22 -0
  144. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
  145. data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
  146. data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
  147. data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
  148. data/app/assets/components/polymer-gestures/banner.txt +9 -0
  149. data/app/assets/components/polymer-gestures/build.json +17 -0
  150. data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
  151. data/app/assets/components/polymer-gestures/package.json +20 -0
  152. data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
  153. data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
  154. data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
  155. data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
  156. data/app/assets/components/polymer-gestures/src/hold.js +129 -0
  157. data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
  158. data/app/assets/components/polymer-gestures/src/ms.js +80 -0
  159. data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
  160. data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
  161. data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
  162. data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
  163. data/app/assets/components/polymer-gestures/src/scope.js +10 -0
  164. data/app/assets/components/polymer-gestures/src/tap.js +103 -0
  165. data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
  166. data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
  167. data/app/assets/components/polymer-gestures/src/touch.js +341 -0
  168. data/app/assets/components/polymer-gestures/src/track.js +230 -0
  169. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  170. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  171. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  172. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  173. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  174. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  175. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  176. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  177. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  178. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  179. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  180. data/app/assets/components/webcomponentsjs/package.json +31 -0
  181. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  182. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  183. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  184. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  185. data/lib/polymer-paper-elements-rails.rb +2 -0
  186. data/lib/polymer-paper-elements-rails/engine.rb +4 -0
  187. data/lib/polymer-paper-elements-rails/version.rb +3 -0
  188. metadata +272 -0
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
6
+ <g id="background" display="none">
7
+ <rect display="inline" fill="#B0BEC5" width="225" height="126"/>
8
+ </g>
9
+ <g id="label">
10
+ </g>
11
+ <g id="art">
12
+ <path d="M175,102H61V24h114V102z M63,100h110V26H63V100z"/>
13
+ <path d="M91,102H61V24h30V102z M63,100h26V26H63V100z"/>
14
+ <circle cx="123" cy="63" r="4"/>
15
+ <rect x="90" y="62" width="33" height="2"/>
16
+ <g id="ic_x5F_add_x0D_">
17
+ </g>
18
+ </g>
19
+ <g id="Guides">
20
+ </g>
21
+ </svg>
@@ -0,0 +1,142 @@
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
+ :host {
12
+ display: block;
13
+ position: absolute;
14
+ top: 0;
15
+ left: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ overflow: hidden;
19
+ }
20
+
21
+ iron-selector > #drawer {
22
+ position: absolute;
23
+ top: 0;
24
+ left: 0;
25
+ height: 100%;
26
+ background-color: white;
27
+ will-change: transform;
28
+ box-sizing: border-box;
29
+ -moz-box-sizing: border-box;
30
+
31
+ @apply(--paper-drawer-panel-drawer-container);
32
+ }
33
+
34
+ .transition > #drawer {
35
+ transition: -webkit-transform ease-in-out 0.3s, width ease-in-out 0.3s;
36
+ transition: transform ease-in-out 0.3s, width ease-in-out 0.3s;
37
+ }
38
+
39
+ .left-drawer > #drawer {
40
+ @apply(--paper-drawer-panel-left-drawer-container);
41
+ }
42
+
43
+ .right-drawer > #drawer {
44
+ left: auto;
45
+ right: 0;
46
+
47
+ @apply(--paper-drawer-panel-right-drawer-container);
48
+ }
49
+
50
+ iron-selector > #main {
51
+ position: absolute;
52
+ top: 0;
53
+ right: 0;
54
+ bottom: 0;
55
+
56
+ @apply(--paper-drawer-panel-main-container);
57
+ }
58
+
59
+ .transition > #main {
60
+ transition: left ease-in-out 0.3s, padding ease-in-out 0.3s;
61
+ }
62
+
63
+ .right-drawer > #main {
64
+ left: 0;
65
+ }
66
+
67
+ .right-drawer.transition > #main {
68
+ transition: right ease-in-out 0.3s, padding ease-in-out 0.3s;
69
+ }
70
+
71
+ #main > ::content > [main] {
72
+ height: 100%;
73
+ }
74
+
75
+ #drawer > ::content > [drawer] {
76
+ height: 100%;
77
+ }
78
+
79
+ #scrim {
80
+ position: absolute;
81
+ top: 0;
82
+ right: 0;
83
+ bottom: 0;
84
+ left: 0;
85
+ visibility: hidden;
86
+ opacity: 0;
87
+ transition: opacity ease-in-out 0.38s, visibility ease-in-out 0.38s;
88
+ background-color: rgba(0, 0, 0, 0.3);
89
+ }
90
+
91
+ .narrow-layout > #drawer.iron-selected {
92
+ box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
93
+ }
94
+
95
+ .right-drawer.narrow-layout > #drawer.iron-selected {
96
+ box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.15);
97
+ }
98
+
99
+ .narrow-layout > #drawer > ::content > [drawer] {
100
+ border: 0;
101
+ }
102
+
103
+ .left-drawer.narrow-layout > #drawer:not(.iron-selected) {
104
+ -webkit-transform: translateX(-100%);
105
+ transform: translateX(-100%);
106
+ }
107
+
108
+ .right-drawer.narrow-layout > #drawer:not(.iron-selected) {
109
+ left: auto;
110
+ -webkit-transform: translateX(100%);
111
+ transform: translateX(100%);
112
+ }
113
+
114
+ .narrow-layout > #main {
115
+ left: 0 !important;
116
+ padding: 0;
117
+ }
118
+
119
+ .right-drawer.narrow-layout > #main {
120
+ left: 0;
121
+ right: 0;
122
+ padding: 0;
123
+ }
124
+
125
+ .narrow-layout > #main:not(.iron-selected) > #scrim,
126
+ .dragging > #main > #scrim {
127
+ visibility: visible;
128
+ opacity: var(--paper-drawer-panel-scrim-opacity, 1);
129
+ }
130
+
131
+ .narrow-layout > #main > * {
132
+ margin: 0;
133
+ min-height: 100%;
134
+ left: 0;
135
+ right: 0;
136
+ box-sizing: border-box;
137
+ -moz-box-sizing: border-box;
138
+ }
139
+
140
+ iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
141
+ display: none;
142
+ }
@@ -0,0 +1,585 @@
1
+ <!--
2
+ Copyright (c) 2015 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
+ <link rel="import" href="../polymer/polymer.html">
11
+ <link rel="import" href="../iron-media-query/iron-media-query.html">
12
+ <link rel="import" href="../iron-selector/iron-selector.html">
13
+
14
+ <!--
15
+ `paper-drawer-panel` contains a drawer panel and a main panel. The drawer
16
+ and the main panel are side-by-side with drawer on the left. When the browser
17
+ window size is smaller than the `responsiveWidth`, `paper-drawer-panel`
18
+ changes to narrow layout. In narrow layout, the drawer will be stacked on top
19
+ of the main panel. The drawer will slide in/out to hide/reveal the main
20
+ panel.
21
+
22
+ Use the attribute `drawer` to indicate that the element is the drawer panel and
23
+ `main` to indicate that the element is the main panel.
24
+
25
+ Example:
26
+
27
+ <paper-drawer-panel>
28
+ <div drawer> Drawer panel... </div>
29
+ <div main> Main panel... </div>
30
+ </paper-drawer-panel>
31
+
32
+ The drawer and the main panels are not scrollable. You can set CSS overflow
33
+ property on the elements to make them scrollable or use `paper-header-panel`.
34
+
35
+ Example:
36
+
37
+ <paper-drawer-panel>
38
+ <paper-header-panel drawer>
39
+ <paper-toolbar></paper-toolbar>
40
+ <div> Drawer content... </div>
41
+ </paper-header-panel>
42
+ <paper-header-panel main>
43
+ <paper-toolbar></paper-toolbar>
44
+ <div> Main content... </div>
45
+ </paper-header-panel>
46
+ </paper-drawer-panel>
47
+
48
+ An element that should toggle the drawer will automatically do so if it's
49
+ given the `paper-drawer-toggle` attribute. Also this element will automatically
50
+ be hidden in wide layout.
51
+
52
+ Example:
53
+
54
+ <paper-drawer-panel>
55
+ <paper-header-panel drawer>
56
+ <paper-toolbar>
57
+ <div>Application</div>
58
+ </paper-toolbar>
59
+ <div> Drawer content... </div>
60
+ </paper-header-panel>
61
+ <paper-header-panel main>
62
+ <paper-toolbar>
63
+ <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
64
+ <div>Title</div>
65
+ </paper-toolbar>
66
+ <div> Main content... </div>
67
+ </paper-header-panel>
68
+ </paper-drawer-panel>
69
+
70
+ To position the drawer to the right, add `right-drawer` attribute.
71
+
72
+ <paper-drawer-panel right-drawer>
73
+ <div drawer> Drawer panel... </div>
74
+ <div main> Main panel... </div>
75
+ </paper-drawer-panel>
76
+
77
+ Styling paper-drawer-panel:
78
+
79
+ To change the main container:
80
+ paper-drawer-panel {
81
+ --paper-drawer-panel-main-container: {
82
+ background-color: gray;
83
+ };
84
+ }
85
+
86
+ To change the drawer container when it's in the left side:
87
+ paper-drawer-panel {
88
+ --paper-drawer-panel-left-drawer-container: {
89
+ background-color: white;
90
+ };
91
+ }
92
+
93
+ To change the drawer container when it's in the right side:
94
+
95
+ paper-drawer-panel {
96
+ --paper-drawer-panel-right-drawer-container: {
97
+ background-color: white;
98
+ };
99
+ }
100
+
101
+ @group Paper elements
102
+ @element paper-drawer-panel
103
+ @demo demo/index.html
104
+ @hero hero.svg
105
+ -->
106
+
107
+ <dom-module id="paper-drawer-panel">
108
+ <link rel="import" type="css" href="paper-drawer-panel.css">
109
+
110
+ <template>
111
+ <iron-media-query
112
+ id="mq"
113
+ on-query-matches-changed="_onQueryMatchesChanged"
114
+ query="[[_computeMediaQuery(forceNarrow, responsiveWidth)]]">
115
+ </iron-media-query>
116
+
117
+ <iron-selector
118
+ attr-for-selected="id"
119
+ class$="[[_computeIronSelectorClass(narrow, transition, dragging, rightDrawer)]]"
120
+ activate-event=""
121
+ selected="[[selected]]">
122
+
123
+ <div id="main" style$="[[_computeMainStyle(narrow, rightDrawer, drawerWidth)]]">
124
+ <content select="[main]"></content>
125
+ <div id="scrim" on-tap="closeDrawer"></div>
126
+ </div>
127
+
128
+ <div id="drawer" style$="[[_computeDrawerStyle(drawerWidth)]]">
129
+ <content select="[drawer]"></content>
130
+ </div>
131
+
132
+ </iron-selector>
133
+ </template>
134
+
135
+ </dom-module>
136
+
137
+ <script>
138
+
139
+ (function() {
140
+
141
+ 'use strict';
142
+
143
+ // this would be the only `paper-drawer-panel` in
144
+ // the whole app that can be in `dragging` state
145
+ var sharedPanel = null;
146
+
147
+ function classNames(obj) {
148
+ var classes = [];
149
+ for (var key in obj) {
150
+ if (obj.hasOwnProperty(key) && obj[key]) {
151
+ classes.push(key);
152
+ }
153
+ }
154
+
155
+ return classes.join(' ');
156
+ }
157
+
158
+ Polymer({
159
+
160
+ is: 'paper-drawer-panel',
161
+
162
+ /**
163
+ * Fired when the narrow layout changes.
164
+ *
165
+ * @event paper-responsive-change {{narrow: boolean}} detail -
166
+ * narrow: true if the panel is in narrow layout.
167
+ */
168
+
169
+ /**
170
+ * Fired when the selected panel changes.
171
+ *
172
+ * Listening for this event is an alternative to observing changes in the `selected` attribute.
173
+ * This event is fired both when a panel is selected and deselected.
174
+ * The `isSelected` detail property contains the selection state.
175
+ *
176
+ * @event paper-select {{isSelected: boolean, item: Object}} detail -
177
+ * isSelected: True for selection and false for deselection.
178
+ * item: The panel that the event refers to.
179
+ */
180
+
181
+ properties: {
182
+
183
+ /**
184
+ * The panel to be selected when `paper-drawer-panel` changes to narrow
185
+ * layout.
186
+ */
187
+ defaultSelected: {
188
+ type: String,
189
+ value: 'main'
190
+ },
191
+
192
+ /**
193
+ * If true, swipe from the edge is disable.
194
+ */
195
+ disableEdgeSwipe: {
196
+ type: Boolean,
197
+ value: false
198
+ },
199
+
200
+ /**
201
+ * If true, swipe to open/close the drawer is disabled.
202
+ */
203
+ disableSwipe: {
204
+ type: Boolean,
205
+ value: false
206
+ },
207
+
208
+ /**
209
+ * Whether the user is dragging the drawer interactively.
210
+ */
211
+ dragging: {
212
+ type: Boolean,
213
+ value: false
214
+ },
215
+
216
+ /**
217
+ * Width of the drawer panel.
218
+ */
219
+ drawerWidth: {
220
+ type: String,
221
+ value: '256px'
222
+ },
223
+
224
+ /**
225
+ * How many pixels on the side of the screen are sensitive to edge
226
+ * swipes and peek.
227
+ */
228
+ edgeSwipeSensitivity: {
229
+ type: Number,
230
+ value: 30
231
+ },
232
+
233
+ /**
234
+ * If true, ignore `responsiveWidth` setting and force the narrow layout.
235
+ */
236
+ forceNarrow: {
237
+ type: Boolean,
238
+ value: false
239
+ },
240
+
241
+ /**
242
+ * Whether the browser has support for the transform CSS property.
243
+ */
244
+ hasTransform: {
245
+ type: Boolean,
246
+ value: function() {
247
+ return 'transform' in this.style;
248
+ }
249
+ },
250
+
251
+ /**
252
+ * Whether the browser has support for the will-change CSS property.
253
+ */
254
+ hasWillChange: {
255
+ type: Boolean,
256
+ value: function() {
257
+ return 'willChange' in this.style;
258
+ }
259
+ },
260
+
261
+ /**
262
+ * Returns true if the panel is in narrow layout. This is useful if you
263
+ * need to show/hide elements based on the layout.
264
+ */
265
+ narrow: {
266
+ reflectToAttribute: true,
267
+ type: Boolean,
268
+ value: false,
269
+ notify: true
270
+ },
271
+
272
+ /**
273
+ * Whether the drawer is peeking out from the edge.
274
+ */
275
+ peeking: {
276
+ type: Boolean,
277
+ value: false
278
+ },
279
+
280
+ /**
281
+ * Max-width when the panel changes to narrow layout.
282
+ */
283
+ responsiveWidth: {
284
+ type: String,
285
+ value: '640px'
286
+ },
287
+
288
+ /**
289
+ * If true, position the drawer to the right.
290
+ */
291
+ rightDrawer: {
292
+ type: Boolean,
293
+ value: false
294
+ },
295
+
296
+ /**
297
+ * The panel that is being selected. `drawer` for the drawer panel and
298
+ * `main` for the main panel.
299
+ */
300
+ selected: {
301
+ reflectToAttribute: true,
302
+ type: String,
303
+ value: null
304
+ },
305
+
306
+ /**
307
+ * The attribute on elements that should toggle the drawer on tap, also elements will
308
+ * automatically be hidden in wide layout.
309
+ */
310
+ drawerToggleAttribute: {
311
+ type: String,
312
+ value: 'paper-drawer-toggle'
313
+ },
314
+
315
+ /**
316
+ * Whether the transition is enabled.
317
+ */
318
+ transition: {
319
+ type: Boolean,
320
+ value: false
321
+ },
322
+
323
+ },
324
+
325
+ listeners: {
326
+ tap: '_onTap',
327
+ track: '_onTrack',
328
+ down: '_downHandler',
329
+ up: '_upHandler'
330
+ },
331
+
332
+ observers: [
333
+ '_forceNarrowChanged(forceNarrow, defaultSelected)'
334
+ ],
335
+
336
+ /**
337
+ * Toggles the panel open and closed.
338
+ *
339
+ * @method togglePanel
340
+ */
341
+ togglePanel: function() {
342
+ if (this._isMainSelected()) {
343
+ this.openDrawer();
344
+ } else {
345
+ this.closeDrawer();
346
+ }
347
+ },
348
+
349
+ /**
350
+ * Opens the drawer.
351
+ *
352
+ * @method openDrawer
353
+ */
354
+ openDrawer: function() {
355
+ this.selected = 'drawer';
356
+ },
357
+
358
+ /**
359
+ * Closes the drawer.
360
+ *
361
+ * @method closeDrawer
362
+ */
363
+ closeDrawer: function() {
364
+ this.selected = 'main';
365
+ },
366
+
367
+ ready: function() {
368
+ // Avoid transition at the beginning e.g. page loads and enable
369
+ // transitions only after the element is rendered and ready.
370
+ this.transition = true;
371
+ },
372
+
373
+ _computeIronSelectorClass: function(narrow, transition, dragging, rightDrawer) {
374
+ return classNames({
375
+ dragging: dragging,
376
+ 'narrow-layout': narrow,
377
+ 'right-drawer': rightDrawer,
378
+ 'left-drawer': !rightDrawer,
379
+ transition: transition
380
+ });
381
+ },
382
+
383
+ _computeDrawerStyle: function(drawerWidth) {
384
+ return 'width:' + drawerWidth + ';';
385
+ },
386
+
387
+ _computeMainStyle: function(narrow, rightDrawer, drawerWidth) {
388
+ var style = '';
389
+
390
+ style += 'left:' + ((narrow || rightDrawer) ? '0' : drawerWidth) + ';';
391
+
392
+ if (rightDrawer) {
393
+ style += 'right:' + (narrow ? '' : drawerWidth) + ';';
394
+ } else {
395
+ style += 'right:;';
396
+ }
397
+
398
+ return style;
399
+ },
400
+
401
+ _computeMediaQuery: function(forceNarrow, responsiveWidth) {
402
+ return forceNarrow ? '' : '(max-width: ' + responsiveWidth + ')';
403
+ },
404
+
405
+ _computeSwipeOverlayHidden: function(narrow, disableEdgeSwipe) {
406
+ return !narrow || disableEdgeSwipe;
407
+ },
408
+
409
+ _onTrack: function(e) {
410
+ if (sharedPanel && this !== sharedPanel) {
411
+ return;
412
+ }
413
+ switch (e.detail.state) {
414
+ case 'start':
415
+ this._trackStart(e);
416
+ break;
417
+ case 'track':
418
+ this._trackX(e);
419
+ break;
420
+ case 'end':
421
+ this._trackEnd(e);
422
+ break;
423
+ }
424
+
425
+ },
426
+
427
+ _responsiveChange: function(narrow) {
428
+ this.narrow = narrow;
429
+
430
+ if (this.narrow) {
431
+ this.selected = this.defaultSelected;
432
+ }
433
+
434
+ this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all');
435
+ this.fire('paper-responsive-change', {narrow: this.narrow});
436
+ },
437
+
438
+ _onQueryMatchesChanged: function(e) {
439
+ this._responsiveChange(e.detail.value);
440
+ },
441
+
442
+ _forceNarrowChanged: function() {
443
+ // set the narrow mode only if we reached the `responsiveWidth`
444
+ this._responsiveChange(this.forceNarrow || this.$.mq.queryMatches);
445
+ },
446
+
447
+ _swipeAllowed: function() {
448
+ return this.narrow && !this.disableSwipe;
449
+ },
450
+
451
+ _isMainSelected: function() {
452
+ return this.selected === 'main';
453
+ },
454
+
455
+ _startEdgePeek: function() {
456
+ this.width = this.$.drawer.offsetWidth;
457
+ this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ?
458
+ -this.edgeSwipeSensitivity : this.edgeSwipeSensitivity));
459
+ this.peeking = true;
460
+ },
461
+
462
+ _stopEdgePeek: function() {
463
+ if (this.peeking) {
464
+ this.peeking = false;
465
+ this._moveDrawer(null);
466
+ }
467
+ },
468
+
469
+ _downHandler: function(e) {
470
+ if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(e) && !sharedPanel) {
471
+ this._startEdgePeek();
472
+ // grab this panel
473
+ sharedPanel = this;
474
+ }
475
+ },
476
+
477
+ _upHandler: function() {
478
+ this._stopEdgePeek();
479
+ // release the panel
480
+ sharedPanel = null;
481
+ },
482
+
483
+ _onTap: function(e) {
484
+ var targetElement = Polymer.dom(e).localTarget;
485
+ var isTargetToggleElement = targetElement &&
486
+ this.drawerToggleAttribute &&
487
+ targetElement.hasAttribute(this.drawerToggleAttribute);
488
+
489
+ if (isTargetToggleElement) {
490
+ this.togglePanel();
491
+ }
492
+ },
493
+
494
+ _isEdgeTouch: function(e) {
495
+ var x = e.detail.x;
496
+
497
+ return !this.disableEdgeSwipe && this._swipeAllowed() &&
498
+ (this.rightDrawer ?
499
+ x >= this.offsetWidth - this.edgeSwipeSensitivity :
500
+ x <= this.edgeSwipeSensitivity);
501
+ },
502
+
503
+ _trackStart: function() {
504
+ if (this._swipeAllowed()) {
505
+ sharedPanel = this;
506
+ this.dragging = true;
507
+
508
+ if (this._isMainSelected()) {
509
+ this.dragging = this.peeking || this._isEdgeTouch(event);
510
+ }
511
+
512
+ if (this.dragging) {
513
+ this.width = this.$.drawer.offsetWidth;
514
+ this.transition = false;
515
+ }
516
+ }
517
+ },
518
+
519
+ _translateXForDeltaX: function(deltaX) {
520
+ var isMain = this._isMainSelected();
521
+
522
+ if (this.rightDrawer) {
523
+ return Math.max(0, isMain ? this.width + deltaX : deltaX);
524
+ } else {
525
+ return Math.min(0, isMain ? deltaX - this.width : deltaX);
526
+ }
527
+ },
528
+
529
+ _trackX: function(e) {
530
+ if (this.dragging) {
531
+ var dx = e.detail.dx;
532
+
533
+ if (this.peeking) {
534
+ if (Math.abs(dx) <= this.edgeSwipeSensitivity) {
535
+ // Ignore trackx until we move past the edge peek.
536
+ return;
537
+ }
538
+ this.peeking = false;
539
+ }
540
+
541
+ this._moveDrawer(this._translateXForDeltaX(dx));
542
+ }
543
+ },
544
+
545
+ _trackEnd: function(e) {
546
+ if (this.dragging) {
547
+ var xDirection = e.detail.dx > 0;
548
+
549
+ this.dragging = false;
550
+ this.transition = true;
551
+ sharedPanel = null;
552
+ this._moveDrawer(null);
553
+
554
+ if (this.rightDrawer) {
555
+ this[xDirection ? 'closeDrawer' : 'openDrawer']();
556
+ } else {
557
+ this[xDirection ? 'openDrawer' : 'closeDrawer']();
558
+ }
559
+ }
560
+ },
561
+
562
+ _transformForTranslateX: function(translateX) {
563
+ if (translateX === null) {
564
+ return '';
565
+ }
566
+
567
+ return this.hasWillChange ? 'translateX(' + translateX + 'px)' :
568
+ 'translate3d(' + translateX + 'px, 0, 0)';
569
+ },
570
+
571
+ _moveDrawer: function(translateX) {
572
+ var s = this.$.drawer.style;
573
+
574
+ if (this.hasTransform) {
575
+ s.transform = this._transformForTranslateX(translateX);
576
+ } else {
577
+ s.webkitTransform = this._transformForTranslateX(translateX);
578
+ }
579
+ }
580
+
581
+ });
582
+
583
+ }());
584
+
585
+ </script>