polymer-paper-rails 0.1.0

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 (74) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +69 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/core/animation/web-animations.html.erb +1 -0
  5. data/app/assets/components/core/animation/web-animations.js +5666 -0
  6. data/app/assets/components/core/icon/core-icon.css +25 -0
  7. data/app/assets/components/core/icon/core-icon.html.erb +126 -0
  8. data/app/assets/components/core/iconset/core-iconset.html.erb +236 -0
  9. data/app/assets/components/core/input/core-input.css +35 -0
  10. data/app/assets/components/core/input/core-input.html.erb +385 -0
  11. data/app/assets/components/core/list/core-list.css +20 -0
  12. data/app/assets/components/core/list/core-list.html.erb +403 -0
  13. data/app/assets/components/core/media-query/core-media-query.html +86 -0
  14. data/app/assets/components/core/menu/core-menu.css +18 -0
  15. data/app/assets/components/core/menu/core-menu.html.erb +62 -0
  16. data/app/assets/components/core/menu/core-submenu.css +29 -0
  17. data/app/assets/components/core/menu/core-submenu.html.erb +106 -0
  18. data/app/assets/components/core/meta/core-meta.html +143 -0
  19. data/app/assets/components/core/overlay/core-key-helper.html +17 -0
  20. data/app/assets/components/core/overlay/core-overlay-layer.html +112 -0
  21. data/app/assets/components/core/overlay/core-overlay.html.erb +661 -0
  22. data/app/assets/components/core/range/core-range.html +106 -0
  23. data/app/assets/components/core/selection/core-selection.html +148 -0
  24. data/app/assets/components/core/selector/core-selector.html.erb +423 -0
  25. data/app/assets/components/core/style/core-style.html +386 -0
  26. data/app/assets/components/core/transition/core-transition-css.html.erb +76 -0
  27. data/app/assets/components/core/transition/core-transition-overlay.css +46 -0
  28. data/app/assets/components/core/transition/core-transition.html.erb +44 -0
  29. data/app/assets/components/paper-button/paper-button.css +115 -0
  30. data/app/assets/components/paper-button/paper-button.html.erb +210 -0
  31. data/app/assets/components/paper-checkbox/paper-checkbox.css +262 -0
  32. data/app/assets/components/paper-checkbox/paper-checkbox.html.erb +104 -0
  33. data/app/assets/components/paper-dialog/paper-dialog-transition.css +59 -0
  34. data/app/assets/components/paper-dialog/paper-dialog-transition.html.erb +27 -0
  35. data/app/assets/components/paper-dialog/paper-dialog.css +0 -0
  36. data/app/assets/components/paper-dialog/paper-dialog.html.erb +176 -0
  37. data/app/assets/components/paper-fab/paper-fab.css +27 -0
  38. data/app/assets/components/paper-fab/paper-fab.html.erb +55 -0
  39. data/app/assets/components/paper-focusable/paper-focusable.html +144 -0
  40. data/app/assets/components/paper-icon-button/paper-icon-button.css +17 -0
  41. data/app/assets/components/paper-icon-button/paper-icon-button.html.erb +87 -0
  42. data/app/assets/components/paper-input/error-100.png +0 -0
  43. data/app/assets/components/paper-input/error-200.png +0 -0
  44. data/app/assets/components/paper-input/paper-input.html.erb +398 -0
  45. data/app/assets/components/paper-input/paper-input.scss +203 -0
  46. data/app/assets/components/paper-item/paper-item.css +30 -0
  47. data/app/assets/components/paper-item/paper-item.html.erb +103 -0
  48. data/app/assets/components/paper-menu-button/paper-menu-button-overlay.html.erb +86 -0
  49. data/app/assets/components/paper-menu-button/paper-menu-button-transition.css +19 -0
  50. data/app/assets/components/paper-menu-button/paper-menu-button-transition.html.erb +118 -0
  51. data/app/assets/components/paper-menu-button/paper-menu-button.css +86 -0
  52. data/app/assets/components/paper-menu-button/paper-menu-button.html.erb +128 -0
  53. data/app/assets/components/paper-progress/paper-progress.css +35 -0
  54. data/app/assets/components/paper-progress/paper-progress.html.erb +98 -0
  55. data/app/assets/components/paper-radio-button/paper-radio-button.css +98 -0
  56. data/app/assets/components/paper-radio-button/paper-radio-button.html.erb +148 -0
  57. data/app/assets/components/paper-radio-group/paper-radio-group.html.erb +68 -0
  58. data/app/assets/components/paper-ripple/paper-ripple.html +426 -0
  59. data/app/assets/components/paper-shadow/paper-shadow.css +81 -0
  60. data/app/assets/components/paper-shadow/paper-shadow.html.erb +212 -0
  61. data/app/assets/components/paper-slider/paper-slider.css +193 -0
  62. data/app/assets/components/paper-slider/paper-slider.html.erb +310 -0
  63. data/app/assets/components/paper-tabs/paper-tab.css +49 -0
  64. data/app/assets/components/paper-tabs/paper-tab.html.erb +66 -0
  65. data/app/assets/components/paper-tabs/paper-tabs.css +57 -0
  66. data/app/assets/components/paper-tabs/paper-tabs.html.erb +127 -0
  67. data/app/assets/components/paper-toast/paper-toast.css +0 -0
  68. data/app/assets/components/paper-toast/paper-toast.html.erb +258 -0
  69. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +61 -0
  70. data/app/assets/components/paper-toggle-button/paper-toggle-button.html.erb +125 -0
  71. data/lib/polymer-paper-rails/engine.rb +4 -0
  72. data/lib/polymer-paper-rails/version.rb +3 -0
  73. data/lib/polymer-paper-rails.rb +2 -0
  74. metadata +158 -0
@@ -0,0 +1,310 @@
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
+ `paper-slider` allows user to select a value from a range of values by
12
+ moving the slider thumb. The interactive nature of the slider makes it a
13
+ great choice for settings that reflect intensity levels, such as volume,
14
+ brightness, or color saturation.
15
+
16
+ Example:
17
+
18
+ <paper-slider></paper-slider>
19
+
20
+ Use `min` and `max` to specify the slider range. Default is 0 to 100.
21
+
22
+ Example:
23
+
24
+ <paper-slider min="10" max="200" value="110"></paper-slider>
25
+
26
+ Styling slider:
27
+
28
+ To change the slider progress bar color:
29
+
30
+ paper-slider::shadow #sliderBar::shadow #activeProgress {
31
+ background-color: #0f9d58;
32
+ }
33
+
34
+ To change the slider knob color:
35
+
36
+ paper-slider::shadow #sliderKnobInner {
37
+ background-color: #0f9d58;
38
+ }
39
+
40
+ To change the slider pin color:
41
+
42
+ paper-slider::shadow #sliderKnobInner::before {
43
+ background-color: #0f9d58;
44
+ }
45
+
46
+ To change the slider pin's value:
47
+
48
+ paper-slider::shadow #sliderKnobInner::after {
49
+ color: #0f9d58
50
+ }
51
+
52
+ To change the slider secondary progress bar color:
53
+
54
+ paper-slider::shadow #sliderBar::shadow #secondaryProgress {
55
+ background-color: #0f9d58;
56
+ }
57
+
58
+ @group Paper Elements
59
+ @element paper-slider
60
+ @extends core-range
61
+ @homepage github.io
62
+ -->
63
+
64
+ <%= html_import_tag "paper-progress/paper-progress" %>
65
+ <%= html_import_tag "paper-input/paper-input" %>
66
+
67
+ <polymer-element name="paper-slider" extends="core-range" attributes="snaps pin disabled secondaryProgress editable immediateValue">
68
+ <template>
69
+
70
+ <%= stylesheet_link_tag "paper-slider/paper-slider" %>
71
+
72
+ <div id="sliderContainer" touch-action="pan-y" on-keydown="{{keydown}}">
73
+
74
+ <paper-progress id="sliderBar" aria-hidden="true" min="{{min}}" max="{{max}}" value="{{immediateValue}}" secondaryProgress="{{secondaryProgress}}"
75
+ on-down="{{bardown}}" on-up="{{resetKnob}}"
76
+ on-trackstart="{{trackStart}}" on-track="{{track}}" on-trackend="{{trackEnd}}"></paper-progress>
77
+
78
+ <template if="{{snaps && !disabled}}">
79
+ <div class="slider-markers" horizontal layout>
80
+ <template repeat="{{markers}}">
81
+ <div flex class="slider-marker"></div>
82
+ </template>
83
+ </div>
84
+ </template>
85
+
86
+ <div id="sliderKnob" class="{{ {pin : pin, snaps : snaps} | tokenList }}"
87
+ touch-action="none" on-down="{{expandKnob}}" on-up="{{resetKnob}}"
88
+ on-trackstart="{{trackStart}}" on-track="{{track}}" on-trackend="{{trackEnd}}"
89
+ on-transitionend="{{knobTransitionEnd}}"
90
+ role="slider" aria-valuenow="{{value}}" aria-valuemin="{{min}}" aria-valuemax="{{max}}"
91
+ aria-valuetext="{{value}}" tabindex="0"
92
+ center-justified center horizontal layout>
93
+
94
+ <div id="sliderKnobInner" value="{{immediateValue}}"></div>
95
+
96
+ </div>
97
+
98
+ </div>
99
+
100
+ <template if="{{editable}}">
101
+ <paper-input id="input" class="slider-input" value="{{immediateValue}}" validate="^[-+]?[0-9]*\.?[0-9]+$" disabled?="{{disabled}}" on-change="{{inputChange}}"></paper-input>
102
+ </template>
103
+
104
+ </template>
105
+ <script>
106
+
107
+ Polymer('paper-slider', {
108
+
109
+ /**
110
+ * Fired when the slider's value changes.
111
+ *
112
+ * @event change
113
+ */
114
+
115
+ /**
116
+ * Fired when the slider's value changes due to manual interaction.
117
+ *
118
+ * Changes to the slider's value due to changes in an underlying
119
+ * bound variable will not trigger this event.
120
+ *
121
+ * @event manual-change
122
+ */
123
+
124
+ /**
125
+ * If true, the slider thumb snaps to tick marks evenly spaced based
126
+ * on the `step` property value.
127
+ *
128
+ * @attribute snaps
129
+ * @type boolean
130
+ * @default false
131
+ */
132
+ snaps: false,
133
+
134
+ /**
135
+ * If true, a pin with numeric value label is shown when the slider thumb
136
+ * is pressed. Use for settings for which users need to know the exact
137
+ * value of the setting.
138
+ *
139
+ * @attribute pin
140
+ * @type boolean
141
+ * @default false
142
+ */
143
+ pin: false,
144
+
145
+ /**
146
+ * If true, this slider is disabled. A disabled slider cannot be tapped
147
+ * or dragged to change the slider value.
148
+ *
149
+ * @attribute disabled
150
+ * @type boolean
151
+ * @default false
152
+ */
153
+ disabled: false,
154
+
155
+ /**
156
+ * The number that represents the current secondary progress.
157
+ *
158
+ * @attribute secondaryProgress
159
+ * @type number
160
+ * @default 0
161
+ */
162
+ secondaryProgress: 0,
163
+
164
+ /**
165
+ * If true, an input is shown and user can use it to set the slider value.
166
+ *
167
+ * @attribute editable
168
+ * @type boolean
169
+ * @default false
170
+ */
171
+ editable: false,
172
+
173
+ /**
174
+ * The immediate value of the slider. This value is updated while the user
175
+ * is dragging the slider.
176
+ *
177
+ * @attribute immediateValue
178
+ * @type number
179
+ * @default 0
180
+ */
181
+
182
+ observe: {
183
+ 'min max step snaps': 'update'
184
+ },
185
+
186
+ ready: function() {
187
+ this.update();
188
+ },
189
+
190
+ update: function() {
191
+ this.positionKnob(this.calcRatio(this.value));
192
+ this.updateMarkers();
193
+ },
194
+
195
+ valueChanged: function() {
196
+ this.update();
197
+ this.fire('change');
198
+ },
199
+
200
+ expandKnob: function() {
201
+ this.$.sliderKnob.classList.add('expand');
202
+ },
203
+
204
+ resetKnob: function() {
205
+ this.expandJob && this.expandJob.stop();
206
+ this.$.sliderKnob.classList.remove('expand');
207
+ },
208
+
209
+ positionKnob: function(ratio) {
210
+ this._ratio = ratio;
211
+ this.immediateValue = this.calcStep(this.calcKnobPosition()) || 0;
212
+ if (this.snaps) {
213
+ this._ratio = this.calcRatio(this.immediateValue);
214
+ }
215
+ this.$.sliderKnob.style.left = this._ratio * 100 + '%';
216
+ },
217
+
218
+ immediateValueChanged: function() {
219
+ this.$.sliderKnob.classList.toggle('ring', this.immediateValue <= this.min);
220
+ },
221
+
222
+ inputChange: function() {
223
+ this.value = this.$.input.value;
224
+ this.fire('manual-change');
225
+ },
226
+
227
+ calcKnobPosition: function() {
228
+ return (this.max - this.min) * this._ratio + this.min;
229
+ },
230
+
231
+ measureWidth: function() {
232
+ this._w = this.$.sliderBar.offsetWidth;
233
+ },
234
+
235
+ trackStart: function(e) {
236
+ this.measureWidth();
237
+ this._x = this._ratio * this._w;
238
+ this._startx = this._x || 0;
239
+ this._minx = - this._startx;
240
+ this._maxx = this._w - this._startx;
241
+ this.$.sliderKnob.classList.add('dragging');
242
+ e.preventTap();
243
+ },
244
+
245
+ track: function(e) {
246
+ var x = Math.min(this._maxx, Math.max(this._minx, e.dx));
247
+ this._x = this._startx + x;
248
+ this._ratio = this._x / this._w;
249
+ this.immediateValue = this.calcStep(this.calcKnobPosition()) || 0;
250
+ var s = this.$.sliderKnob.style;
251
+ s.transform = s.webkitTransform = 'translate3d(' + (this.snaps ?
252
+ (this.calcRatio(this.immediateValue) * this._w) - this._startx : x) + 'px, 0, 0)';
253
+ },
254
+
255
+ trackEnd: function() {
256
+ var s = this.$.sliderKnob.style;
257
+ s.transform = s.webkitTransform = '';
258
+ this.$.sliderKnob.classList.remove('dragging');
259
+ this.resetKnob();
260
+ this.value = this.immediateValue;
261
+ this.fire('manual-change');
262
+ },
263
+
264
+ bardown: function(e) {
265
+ this.measureWidth();
266
+ this.$.sliderKnob.classList.add('transiting');
267
+ var rect = this.$.sliderBar.getBoundingClientRect();
268
+ this.positionKnob((e.x - rect.left) / this._w);
269
+ this.value = this.calcStep(this.calcKnobPosition());
270
+ this.expandJob = this.job(this.expandJob, this.expandKnob, 60);
271
+ this.fire('manual-change');
272
+ },
273
+
274
+ knobTransitionEnd: function() {
275
+ this.$.sliderKnob.classList.remove('transiting');
276
+ },
277
+
278
+ updateMarkers: function() {
279
+ this.markers = [], l = (this.max - this.min) / this.step;
280
+ for (var i = 0; i < l; i++) {
281
+ this.markers.push('');
282
+ }
283
+ },
284
+
285
+ increment: function() {
286
+ this.value = this.clampValue(this.value + this.step);
287
+ },
288
+
289
+ decrement: function() {
290
+ this.value = this.clampValue(this.value - this.step);
291
+ },
292
+
293
+ keydown: function(e) {
294
+ if (this.disabled) {
295
+ return;
296
+ }
297
+ var c = e.keyCode;
298
+ if (c === 37) {
299
+ this.decrement();
300
+ this.fire('manual-change');
301
+ } else if (c === 39) {
302
+ this.increment();
303
+ this.fire('manual-change');
304
+ }
305
+ }
306
+
307
+ });
308
+
309
+ </script>
310
+ </polymer-element>
@@ -0,0 +1,49 @@
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
+ :host {
11
+ display: block;
12
+ position: relative;
13
+ overflow: hidden;
14
+ }
15
+
16
+ #tabContainer {
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ bottom: 0;
21
+ left: 0;
22
+ }
23
+
24
+ .tab-content {
25
+ transition: opacity .1s cubic-bezier(0.4, 0.0, 1, 1), color .1s cubic-bezier(0.4, 0.0, 1, 1);
26
+ cursor: default;
27
+ pointer-events: none;
28
+ }
29
+
30
+ :host(:not(.core-selected)) .tab-content {
31
+ opacity: 0.6;
32
+ }
33
+
34
+ #ink {
35
+ position: absolute;
36
+ top: 0;
37
+ right: 0;
38
+ bottom: 0;
39
+ left: 0;
40
+ color: #ffff8d;
41
+ }
42
+
43
+ :host[noink] #ink {
44
+ pointer-events: none;
45
+ }
46
+
47
+ :host-context(paper-tabs[noink]) #ink {
48
+ pointer-events: none;
49
+ }
@@ -0,0 +1,66 @@
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
+ `paper-tab` is styled to look like a tab. It should be used in conjunction with
12
+ `paper-tabs`.
13
+
14
+ Example:
15
+
16
+ <paper-tabs selected="0">
17
+ <paper-tab>TAB 1</paper-tab>
18
+ <paper-tab>TAB 2</paper-tab>
19
+ <paper-tab>TAB 3</paper-tab>
20
+ </paper-tabs>
21
+
22
+ Styling tab:
23
+
24
+ To change the ink color:
25
+
26
+ .pink paper-tab::shadow #ink {
27
+ color: #ff4081;
28
+ }
29
+
30
+ @group Paper Elements
31
+ @element paper-tab
32
+ @homepage github.io
33
+ -->
34
+
35
+ <%= html_import_tag "paper-ripple/paper-ripple" %>
36
+
37
+ <polymer-element name="paper-tab" attributes="noink" role="tab">
38
+ <template>
39
+
40
+ <%= stylesheet_link_tag "paper-tabs/paper-tab" %>
41
+
42
+ <div id="tabContainer" center-justified center horizontal layout>
43
+
44
+ <div class="tab-content"><content></content></div>
45
+ <paper-ripple id="ink" initialOpacity="0.95" opacityDecayVelocity="0.98"></paper-ripple>
46
+
47
+ </div>
48
+
49
+ </template>
50
+ <script>
51
+
52
+ Polymer('paper-tab', {
53
+
54
+ /**
55
+ * If true, ink ripple effect is disabled.
56
+ *
57
+ * @attribute noink
58
+ * @type boolean
59
+ * @default false
60
+ */
61
+ noink: false
62
+
63
+ });
64
+
65
+ </script>
66
+ </polymer-element>
@@ -0,0 +1,57 @@
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
+ :host {
11
+ display: block;
12
+ position: relative;
13
+ font-size: 14px;
14
+ font-weight: 500;
15
+ height: 48px;
16
+ overflow: hidden;
17
+ }
18
+
19
+ #tabsContainer {
20
+ position: absolute;
21
+ top: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ left: 0;
25
+ white-space: nowrap;
26
+ }
27
+
28
+ #selectionBar {
29
+ position: absolute;
30
+ height: 2px;
31
+ bottom: 0;
32
+ left: 0;
33
+ width: 0;
34
+ background-color: #ffff8d;
35
+ transition: width, left;
36
+ }
37
+
38
+ #selectionBar[hidden] {
39
+ display: hidden;
40
+ }
41
+
42
+ #selectionBar.expand {
43
+ transition-duration: 0.15s;
44
+ transition-timing-function: cubic-bezier(0.4, 0.0, 1, 1);
45
+ }
46
+
47
+ #selectionBar.contract {
48
+ transition-duration: 0.1s;
49
+ transition-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1);
50
+ }
51
+
52
+ polyfill-next-selector { content: '#tabsContainer > *:not(#selectionBar)'; }
53
+ ::content > * {
54
+ -ms-flex: 1;
55
+ -webkit-flex: 1;
56
+ flex: 1;
57
+ }