polymer-paper-elements-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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,20 @@
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
+ <circle cx="110" cy="61" r="4"/>
13
+ <rect x="61" y="60" width="49" height="2"/>
14
+ <rect x="110" y="60" width="53" height="2"/>
15
+ <g id="ic_x5F_add_x0D_">
16
+ </g>
17
+ </g>
18
+ <g id="Guides">
19
+ </g>
20
+ </svg>
@@ -0,0 +1,252 @@
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
5
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS
6
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
9
+ */
10
+
11
+ :host {
12
+ display: inline-block;
13
+ width: 200px;
14
+ cursor: default;
15
+ -webkit-user-select: none;
16
+ -moz-user-select: none;
17
+ -ms-user-select: none;
18
+ user-select: none;
19
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
20
+ }
21
+
22
+ :host(:not([disabled])) #sliderBar::shadow #activeProgress {
23
+ background-color: var(--paper-slider-active-color, --google-blue-700);
24
+ }
25
+
26
+ :host(:not([disabled])) #sliderBar::shadow #secondaryProgress {
27
+ background-color: var(--paper-slider-secondary-color, --google-blue-300);
28
+ }
29
+
30
+ :host([disabled]) #sliderBar::shadow #activeProgress {
31
+ background-color: var(--paper-slider-disabled-active-color, --google-grey-500);
32
+ }
33
+
34
+ :host([disabled]) #sliderBar::shadow #secondaryProgress {
35
+ background-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
36
+ }
37
+
38
+ :host(:focus) {
39
+ outline: none;
40
+ }
41
+
42
+ #sliderContainer {
43
+ position: relative;
44
+ width: calc(100% - 32px);
45
+ height: 32px;
46
+ }
47
+
48
+ #sliderContainer.editable {
49
+ float: left;
50
+ width: calc(100% - 72px);
51
+ margin: 12px 0;
52
+ }
53
+
54
+ .bar-container {
55
+ position: absolute;
56
+ top: 0;
57
+ left: 16px;
58
+ height: 100%;
59
+ width: 100%;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .ring > .bar-container {
64
+ left: 20px;
65
+ width: calc(100% - 4px);
66
+ transition: left 0.18s ease, width 0.18s ease;
67
+ }
68
+
69
+ .ring.expand:not(.pin) > .bar-container {
70
+ left: 30px;
71
+ width: calc(100% - 14px);
72
+ }
73
+
74
+ .ring.expand.dragging > .bar-container {
75
+ transition: none;
76
+ }
77
+
78
+ #sliderBar {
79
+ position: absolute;
80
+ top: 15px;
81
+ left: 0;
82
+ height: 2px;
83
+ width: 100%;
84
+ padding: 8px 0;
85
+ margin: -8px 0;
86
+ }
87
+
88
+ .ring #sliderBar {
89
+ left: -4px;
90
+ width: calc(100% + 4px);
91
+ }
92
+
93
+ .ring.expand:not(.pin) #sliderBar {
94
+ left: -14px;
95
+ width: calc(100% + 14px);
96
+ }
97
+
98
+ .slider-markers {
99
+ position: absolute;
100
+ top: 15px;
101
+ left: 15px;
102
+ height: 2px;
103
+ width: calc(100% + 2px);
104
+ box-sizing: border-box;
105
+ pointer-events: none;
106
+ }
107
+
108
+ .slider-markers::after,
109
+ .slider-marker::after {
110
+ content: "";
111
+ display: block;
112
+ width: 2px;
113
+ height: 2px;
114
+ border-radius: 50%;
115
+ background-color: black;
116
+ }
117
+
118
+ .transiting #sliderBar::shadow #activeProgress {
119
+ transition: -webkit-transform 0.08s ease;
120
+ transition: transform 0.08s ease;
121
+ }
122
+
123
+ #sliderKnob {
124
+ @apply(--layout-center-justified);
125
+ @apply(--layout-center);
126
+ @apply(--layout-horizontal);
127
+
128
+ position: absolute;
129
+ left: 0;
130
+ top: 0;
131
+ width: 32px;
132
+ height: 32px;
133
+ }
134
+
135
+ .transiting > #sliderKnob {
136
+ transition: left 0.08s ease;
137
+ }
138
+
139
+ #sliderKnob:focus {
140
+ outline: none;
141
+ }
142
+
143
+ #sliderKnob.dragging {
144
+ transition: none;
145
+ }
146
+
147
+ .snaps > #sliderKnob.dragging {
148
+ transition: -webkit-transform 0.08s ease;
149
+ transition: transform 0.08s ease;
150
+ }
151
+
152
+ #sliderKnobInner {
153
+ width: 12px;
154
+ height: 12px;
155
+ box-sizing: border-box;
156
+ -moz-box-sizing: border-box;
157
+ border-radius: 50%;
158
+ background-color: var(--paper-slider-knob-color, --google-blue-700);
159
+ transition-property: height, width, background-color, border;
160
+ transition-duration: 0.1s;
161
+ transition-timing-function: ease;
162
+ }
163
+
164
+ .expand:not(.pin) > #sliderKnob > #sliderKnobInner {
165
+ width: 100%;
166
+ height: 100%;
167
+ -webkit-transform: translateZ(0);
168
+ transform: translateZ(0);
169
+ }
170
+
171
+ .ring > #sliderKnob > #sliderKnobInner {
172
+ background-color: transparent;
173
+ border: 2px solid #c8c8c8;
174
+ }
175
+
176
+ #sliderKnobInner::before {
177
+ background-color: var(--paper-slider-pin-color, --google-blue-700);
178
+ }
179
+
180
+ .pin > #sliderKnob > #sliderKnobInner::before {
181
+ content: "";
182
+ position: absolute;
183
+ top: 0;
184
+ left: 0;
185
+ width: 26px;
186
+ height: 26px;
187
+ margin-left: 3px;
188
+ border-radius: 50% 50% 50% 0;
189
+ -webkit-transform: rotate(-45deg) scale(0) translate(0);
190
+ transform: rotate(-45deg) scale(0) translate(0);
191
+ }
192
+
193
+ #sliderKnobInner::before,
194
+ #sliderKnobInner::after {
195
+ transition: -webkit-transform .2s ease, background-color .18s ease;
196
+ transition: transform .2s ease, background-color .18s ease;
197
+ }
198
+
199
+ .pin.ring > #sliderKnob > #sliderKnobInner::before {
200
+ background-color: #c8c8c8;
201
+ }
202
+
203
+ .pin.expand > #sliderKnob > #sliderKnobInner::before {
204
+ -webkit-transform: rotate(-45deg) scale(1) translate(17px, -17px);
205
+ transform: rotate(-45deg) scale(1) translate(17px, -17px);
206
+ }
207
+
208
+ .pin > #sliderKnob > #sliderKnobInner::after {
209
+ content: attr(value);
210
+ position: absolute;
211
+ top: 0;
212
+ left: 0;
213
+ width: 32px;
214
+ height: 26px;
215
+ text-align: center;
216
+ color: var(--paper-slider-font-color, #fff);
217
+ font-size: 10px;
218
+ -webkit-transform: scale(0) translate(0);
219
+ transform: scale(0) translate(0);
220
+ }
221
+
222
+ .pin.expand > #sliderKnob > #sliderKnobInner::after {
223
+ -webkit-transform: scale(1) translate(0, -17px);
224
+ transform: scale(1) translate(0, -17px);
225
+ }
226
+
227
+ /* editable: paper-input */
228
+ .slider-input {
229
+ width: 40px;
230
+ float: right;
231
+ overflow: hidden;
232
+ }
233
+
234
+ .slider-input::shadow input {
235
+ /* FIXME(ffu): should one be able set text-align directly on paper-input? */
236
+ text-align: center;
237
+ }
238
+
239
+ /* disabled state */
240
+ #sliderContainer.disabled {
241
+ pointer-events: none;
242
+ }
243
+
244
+ .disabled > #sliderKnob > #sliderKnobInner {
245
+ width: 8px;
246
+ height: 8px;
247
+ background-color: var(--paper-slider-disabled-knob-color, --google-grey-500);
248
+ }
249
+
250
+ .disabled.ring > #sliderKnob > #sliderKnobInner {
251
+ background-color: transparent;
252
+ }
@@ -0,0 +1,449 @@
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
5
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS
6
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
9
+ -->
10
+
11
+ <link rel="import" href="../paper-styles/paper-styles.html">
12
+ <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
13
+ <link rel="import" href="../iron-behaviors/iron-control-state.html">
14
+ <link rel="import" href="../paper-progress/paper-progress.html">
15
+ <link rel="import" href="../paper-input/paper-input.html">
16
+
17
+ <!--
18
+ `paper-slider` allows user to select a value from a range of values by
19
+ moving the slider thumb. The interactive nature of the slider makes it a
20
+ great choice for settings that reflect intensity levels, such as volume,
21
+ brightness, or color saturation.
22
+
23
+ Example:
24
+
25
+ <paper-slider></paper-slider>
26
+
27
+ Use `min` and `max` to specify the slider range. Default is 0 to 100.
28
+
29
+ Example:
30
+
31
+ <paper-slider min="10" max="200" value="110"></paper-slider>
32
+
33
+ Styling slider:
34
+
35
+ To change the slider progress bar color:
36
+
37
+ paper-slider {
38
+ --paper-slider-active-color: #0f9d58;
39
+ }
40
+
41
+ To change the slider knob color:
42
+
43
+ paper-slider {
44
+ --paper-slider-knob-color: #0f9d58;
45
+ }
46
+
47
+ To change the slider pin color:
48
+
49
+ paper-slider {
50
+ --paper-slider-pin-color: #0f9d58;
51
+ }
52
+
53
+ To change the slider pin's font color:
54
+
55
+ paper-slider {
56
+ --paper-slider-pin-font-color: #0f9d58;
57
+ }
58
+
59
+ To change the slider secondary progress bar color:
60
+
61
+ paper-slider {
62
+ --paper-slider-secondary-color: #0f9d58;
63
+ }
64
+
65
+ To change the slider disabled active color:
66
+
67
+ paper-slider {
68
+ --paper-slider-disabled-active-color: #ccc;
69
+ }
70
+
71
+ To change the slider disabled secondary progress bar color:
72
+
73
+ paper-slider {
74
+ --paper-slider-disabled-secondary-color: #ccc;
75
+ }
76
+
77
+ @group Paper Elements
78
+ @element paper-slider
79
+ @demo demo/index.html
80
+ @hero hero.svg
81
+ -->
82
+
83
+ <dom-module id="paper-slider">
84
+ <link rel="import" type="css" href="paper-slider.css">
85
+ <template>
86
+ <template is="dom-if" if="{{!disabled}}">
87
+ </template>
88
+
89
+ <div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
90
+ <div class="bar-container">
91
+ <paper-progress id="sliderBar" aria-hidden="true" min="[[min]]" max="[[max]]" value="[[immediateValue]]" secondary-progress="[[secondaryProgress]]"
92
+ on-down="_bardown" on-up="_resetKnob" on-track="_onTrack"></paper-progress>
93
+ </div>
94
+
95
+ <template is="dom-if" if="[[snaps]]">
96
+ <div class="slider-markers horizontal layout">
97
+ <template is="dom-repeat" items="[[markers]]">
98
+ <div class="slider-marker flex"></div>
99
+ </template>
100
+ </div>
101
+ </template>
102
+
103
+ <div id="sliderKnob" on-down="_knobdown" on-up="_resetKnob"
104
+ on-track="_onTrack"
105
+ on-transitionend="_knobTransitionEnd"
106
+ center-justified center horizontal layout>
107
+
108
+ <div id="sliderKnobInner" value$="[[immediateValue]]"></div>
109
+ </div>
110
+ </div>
111
+
112
+ <template is="dom-if" if="[[editable]]">
113
+ <paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange"></paper-input>
114
+ </template>
115
+
116
+ </template>
117
+ </dom-module>
118
+
119
+ <script>
120
+ /**
121
+ * Fired when the slider's value changes.
122
+ *
123
+ * @event value-change
124
+ */
125
+
126
+ /**
127
+ * Fired when the slider's immediateValue changes.
128
+ *
129
+ * @event immediate-value-change
130
+ */
131
+
132
+ /**
133
+ * Fired when the slider's value changes due to user interaction.
134
+ *
135
+ * Changes to the slider's value due to changes in an underlying
136
+ * bound variable will not trigger this event.
137
+ *
138
+ * @event change
139
+ */
140
+
141
+ Polymer({
142
+ is: 'paper-slider',
143
+
144
+ behaviors: [
145
+ Polymer.IronRangeBehavior,
146
+ Polymer.IronControlState
147
+ ],
148
+
149
+ properties: {
150
+
151
+ /**
152
+ * If true, the slider thumb snaps to tick marks evenly spaced based
153
+ * on the `step` property value.
154
+ */
155
+ snaps: {
156
+ type: Boolean,
157
+ value: false,
158
+ notify: true
159
+ },
160
+
161
+ /**
162
+ * If true, a pin with numeric value label is shown when the slider thumb
163
+ * is pressed. Use for settings for which users need to know the exact
164
+ * value of the setting.
165
+ */
166
+ pin: {
167
+ type: Boolean,
168
+ value: false,
169
+ notify: true
170
+ },
171
+
172
+ /**
173
+ * The number that represents the current secondary progress.
174
+ */
175
+ secondaryProgress: {
176
+ type: Number,
177
+ value: 0,
178
+ notify: true,
179
+ observer: '_secondaryProgressChanged'
180
+ },
181
+
182
+ /**
183
+ * If true, an input is shown and user can use it to set the slider value.
184
+ */
185
+ editable: {
186
+ type: Boolean,
187
+ value: false
188
+ },
189
+
190
+ /**
191
+ * The immediate value of the slider. This value is updated while the user
192
+ * is dragging the slider.
193
+ */
194
+ immediateValue: {
195
+ type: Number,
196
+ value: 0,
197
+ readOnly: true
198
+ },
199
+
200
+ /**
201
+ * The maximum number of markers
202
+ */
203
+ maxMarkers: {
204
+ type: Number,
205
+ value: 0,
206
+ notify: true,
207
+ observer: '_maxMarkersChanged'
208
+ },
209
+
210
+ /**
211
+ * If true, the knob is expanded
212
+ */
213
+ expand: {
214
+ type: Boolean,
215
+ value: false,
216
+ readOnly: true
217
+ },
218
+
219
+ /**
220
+ * True when the user is dragging the slider.
221
+ */
222
+ dragging: {
223
+ type: Boolean,
224
+ value: false,
225
+ readOnly: true
226
+ },
227
+
228
+ transiting: {
229
+ type: Boolean,
230
+ value: false,
231
+ readOnly: true
232
+ },
233
+
234
+ markers: {
235
+ readOnly: true,
236
+ value: []
237
+ },
238
+ },
239
+
240
+ observers: [
241
+ '_updateKnob(value, min, max, snaps, step)',
242
+ '_minChanged(min)',
243
+ '_maxChanged(max)',
244
+ '_valueChanged(value)',
245
+ '_immediateValueChanged(immediateValue)'
246
+ ],
247
+
248
+ ready: function() {
249
+ // issue polymer/polymer#1305
250
+ this.async(function() {
251
+ this._updateKnob(this.value);
252
+ this._updateInputValue();
253
+ }, 1);
254
+ },
255
+
256
+ /**
257
+ * Increases value by `step` but not above `max`.
258
+ * @method increment
259
+ */
260
+ increment: function() {
261
+ this.value = this._clampValue(this.value + this.step);
262
+ },
263
+
264
+ /**
265
+ * Decreases value by `step` but not below `min`.
266
+ * @method decrement
267
+ */
268
+ decrement: function() {
269
+ this.value = this._clampValue(this.value - this.step);
270
+ },
271
+
272
+ _updateKnob: function(value) {
273
+ this._positionKnob(this._calcRatio(value));
274
+ },
275
+
276
+ _minChanged: function() {
277
+ this.setAttribute('aria-valuemin', this.min);
278
+ },
279
+
280
+ _maxChanged: function() {
281
+ this.setAttribute('aria-valuemax', this.max);
282
+ },
283
+
284
+ _valueChanged: function() {
285
+ this.setAttribute('aria-valuenow', this.value);
286
+ this.fire('value-change');
287
+ },
288
+
289
+ _immediateValueChanged: function() {
290
+ if (!this.dragging) {
291
+ this.value = this.immediateValue;
292
+ }
293
+ this._updateInputValue();
294
+ this.fire('immediate-value-change');
295
+ },
296
+
297
+ _secondaryProgressChanged: function() {
298
+ this.secondaryProgress = this._clampValue(this.secondaryProgress);
299
+ },
300
+
301
+ _updateInputValue: function() {
302
+ if (this.editable) {
303
+ this.$$('#input').value = this.immediateValue;
304
+ }
305
+ },
306
+
307
+ _expandKnob: function() {
308
+ this._setExpand(true);
309
+ },
310
+
311
+ _resetKnob: function() {
312
+ this._expandJob && this._expandJob.stop();
313
+ this._setExpand(false);
314
+ },
315
+
316
+ _positionKnob: function(ratio) {
317
+ this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)) || 0);
318
+ this._setRatio(this.snaps ? this._calcRatio(this.immediateValue) : ratio);
319
+ this.$.sliderKnob.style.left = this.ratio * 100 + '%';
320
+ },
321
+
322
+ _inputChange: function() {
323
+ this.value = this.$$('#input').value;
324
+ this.fire('change');
325
+ },
326
+
327
+ _calcKnobPosition: function(ratio) {
328
+ return (this.max - this.min) * ratio + this.min;
329
+ },
330
+
331
+ _onTrack: function(e) {
332
+ switch (event.detail.state) {
333
+ case 'end':
334
+ this._trackEnd(event);
335
+ break;
336
+ case 'track':
337
+ this._trackX(event);
338
+ break;
339
+ case 'start':
340
+ this._trackStart(event);
341
+ break;
342
+ }
343
+ },
344
+
345
+ _trackStart: function(e) {
346
+ this._w = this.$.sliderBar.offsetWidth;
347
+ this._x = this.ratio * this._w;
348
+ this._startx = this._x || 0;
349
+ this._minx = - this._startx;
350
+ this._maxx = this._w - this._startx;
351
+ this.$.sliderKnob.classList.add('dragging');
352
+ this._setDragging(true);
353
+ e.preventDefault();
354
+ },
355
+
356
+ _trackX: function(e) {
357
+ if (!this.dragging) {
358
+ this._trackStart(e);
359
+ }
360
+ var x = Math.min(this._maxx, Math.max(this._minx, e.detail.dx));
361
+ this._x = this._startx + x;
362
+ this._setImmediateValue(this._calcStep(
363
+ this._calcKnobPosition(this._x / this._w)) || 0);
364
+ var s = this.$.sliderKnob.style;
365
+ s.transform = s.webkitTransform = 'translate3d(' + (this.snaps ?
366
+ (this._calcRatio(this.immediateValue) * this._w) - this._startx : x) + 'px, 0, 0)';
367
+ },
368
+
369
+ _trackEnd: function() {
370
+ var s = this.$.sliderKnob.style;
371
+ s.transform = s.webkitTransform = '';
372
+ this.$.sliderKnob.classList.remove('dragging');
373
+ this._setDragging(false);
374
+ this._resetKnob();
375
+ this.value = this.immediateValue;
376
+ this.fire('change');
377
+ },
378
+
379
+ _knobdown: function(e) {
380
+ e.preventDefault();
381
+ this._expandKnob();
382
+ },
383
+
384
+ _bardown: function(e) {
385
+ e.preventDefault();
386
+ this._setTransiting(true);
387
+ this._w = this.$.sliderBar.offsetWidth;
388
+ var rect = this.$.sliderBar.getBoundingClientRect();
389
+ var ratio = (e.detail.x - rect.left) / this._w;
390
+ this._positionKnob(ratio);
391
+ this._expandJob = this.debounce(this._expandJob, this._expandKnob, 60);
392
+
393
+ this.async(function() {
394
+ this.fire('change');
395
+ });
396
+ },
397
+
398
+ _knobTransitionEnd: function(e) {
399
+ if (e.target === this.$.sliderKnob) {
400
+ this._setTransiting(false);
401
+ }
402
+ },
403
+
404
+ _maxMarkersChanged: function(maxMarkers) {
405
+ var l = (this.max - this.min) / this.step;
406
+ if (!this.snaps && l > maxMarkers) {
407
+ this._setMarkers([]);
408
+ } else {
409
+ this._setMarkers(new Array(l));
410
+ }
411
+ },
412
+
413
+ _getClassNames: function() {
414
+ var classes = {};
415
+
416
+ classes['disabled'] = this.disabled;
417
+ classes['pin'] = this.pin;
418
+ classes['snaps'] = this.snaps;
419
+ classes['ring'] = this.immediateValue <= this.min;
420
+ classes['expand'] = this.expand;
421
+ classes['dragging'] = this.dragging;
422
+ classes['transiting'] = this.transiting;
423
+ classes['editable'] = this.editable;
424
+
425
+ return Object.keys(classes).filter(
426
+ function(className) {
427
+ return classes[className];
428
+ }).join(' ');
429
+ },
430
+
431
+ _incrementKey: function(ev, keys) {
432
+ if (keys.key === 'end') {
433
+ this.value = this.max;
434
+ } else {
435
+ this.increment();
436
+ }
437
+ this.fire('change');
438
+ },
439
+
440
+ _decrementKey: function(ev, keys) {
441
+ if (keys.key === 'home') {
442
+ this.value = this.min;
443
+ } else {
444
+ this.decrement();
445
+ }
446
+ this.fire('change');
447
+ }
448
+ })
449
+ </script>