polymer-paper-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,127 @@
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-tabs` is a `core-selector` styled to look like tabs. Tabs make it easy to
12
+ explore and switch between different views or functional aspects of an app, or
13
+ to browse categorized data sets.
14
+
15
+ Use `selected` property to get or set the selected tab.
16
+
17
+ Example:
18
+
19
+ <paper-tabs selected="0">
20
+ <paper-tab>TAB 1</paper-tab>
21
+ <paper-tab>TAB 2</paper-tab>
22
+ <paper-tab>TAB 3</paper-tab>
23
+ </paper-tabs>
24
+
25
+ See <a href="#paper-tab">paper-tab</a> for more information about
26
+ `paper-tab`.
27
+
28
+ Styling tabs:
29
+
30
+ To change the sliding bar color:
31
+
32
+ paper-tabs.pink::shadow #selectionBar {
33
+ background-color: #ff4081;
34
+ }
35
+
36
+ @group Paper Elements
37
+ @element paper-tabs
38
+ @extends core-selector
39
+ @homepage github.io
40
+ -->
41
+ <%= html_import_tag "core/selector/core-selector" %>
42
+ <%= html_import_tag "paper-tabs/paper-tab" %>
43
+
44
+ <polymer-element name="paper-tabs" extends="core-selector" attributes="noink nobar" role="tablist">
45
+ <template>
46
+
47
+ <%= stylesheet_link_tag "paper-tabs/paper-tabs" %>
48
+
49
+ <div id="tabsContainer" horizontal layout>
50
+
51
+ <shadow></shadow>
52
+ <div id="selectionBar" hidden?="{{nobar}}" on-transitionend="{{barTransitionEnd}}"></div>
53
+
54
+ </div>
55
+
56
+ </template>
57
+ <script>
58
+
59
+ Polymer('paper-tabs', {
60
+
61
+ /**
62
+ * If true, ink effect is disabled.
63
+ *
64
+ * @attribute noink
65
+ * @type boolean
66
+ * @default false
67
+ */
68
+ noink: false,
69
+
70
+ /**
71
+ * If true, the bottom bar to indicate the selected tab will not be shown.
72
+ *
73
+ * @attribute nobar
74
+ * @type boolean
75
+ * @default false
76
+ */
77
+ nobar: false,
78
+
79
+ activateEvent: 'down',
80
+
81
+ nostretch: false,
82
+
83
+ selectedIndexChanged: function(old) {
84
+ var s = this.$.selectionBar.style;
85
+
86
+ if (!this.selectedItem) {
87
+ s.width = 0;
88
+ s.left = 0;
89
+ return;
90
+ }
91
+
92
+ var w = 100 / this.items.length;
93
+
94
+ if (this.nostretch || old === null || old === -1) {
95
+ s.width = w + '%';
96
+ s.left = this.selectedIndex * w + '%';
97
+ return;
98
+ }
99
+
100
+ var m = 5;
101
+ this.$.selectionBar.classList.add('expand');
102
+ if (old < this.selectedIndex) {
103
+ s.width = w + w * (this.selectedIndex - old) - m + '%';
104
+ } else {
105
+ s.width = w + w * (old - this.selectedIndex) - m + '%';
106
+ s.left = this.selectedIndex * w + m + '%';
107
+ }
108
+ },
109
+
110
+ barTransitionEnd: function() {
111
+ var cl = this.$.selectionBar.classList;
112
+ if (cl.contains('expand')) {
113
+ cl.remove('expand');
114
+ cl.add('contract');
115
+ var s = this.$.selectionBar.style;
116
+ var w = 100 / this.items.length;
117
+ s.width = w + '%';
118
+ s.left = this.selectedIndex * w + '%';
119
+ } else if (cl.contains('contract')) {
120
+ cl.remove('contract');
121
+ }
122
+ }
123
+
124
+ });
125
+
126
+ </script>
127
+ </polymer-element>
File without changes
@@ -0,0 +1,258 @@
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-toast` provides lightweight feedback about an operation in a small popup
12
+ at the base of the screen on mobile and at the lower left on desktop. Toasts are
13
+ above all other elements on screen, including the FAB.
14
+
15
+ Toasts automatically disappear after a timeout or after user interaction
16
+ elsewhere on the screen, whichever comes first. Toasts can be swiped off
17
+ screen. There can be only one on the screen at a time.
18
+
19
+ Example:
20
+
21
+ <paper-toast text="Your draft has been discarded." onclick="discardDraft(el)"></paper-toast>
22
+
23
+ <script>
24
+ function discardDraft(el) {
25
+ el.show();
26
+ }
27
+ </script>
28
+
29
+ An action button can be presented in the toast.
30
+
31
+ Example (using Polymer's data-binding features):
32
+
33
+ <paper-toast id="toast2" text="Connection timed out. Showing limited messages.">
34
+ <div style="color: blue;" on-tap="{{retry}}">Retry</div>
35
+ </paper-toast>
36
+
37
+ Positioning toast:
38
+
39
+ A standard toast appears near the lower left of the screen. You can change the
40
+ position by overriding bottom and left positions.
41
+
42
+ paper-toast {
43
+ bottom: 40px;
44
+ left: 10px;
45
+ }
46
+
47
+ To make it fit at the bottom of the screen:
48
+
49
+ paper-toast {
50
+ bottom: 0;
51
+ left: 0;
52
+ width: 100%;
53
+ }
54
+
55
+ When the screen size is smaller than the `responsiveWidth` (default to 480px),
56
+ the toast will automatically fits at the bottom of the screen.
57
+
58
+ @group Paper Elements
59
+ @element paper-toast
60
+ @homepage github.io
61
+ -->
62
+
63
+ <%= html_import_tag "core/overlay/core-overlay" %>
64
+ <%= html_import_tag "core/transition/core-transition-css" %>
65
+ <%= html_import_tag "core/media-query/core-media-query" %>
66
+
67
+ <polymer-element name="paper-toast" attributes="text duration opened responsiveWidth swipeDisabled" role="status">
68
+
69
+ <template>
70
+
71
+ <%= stylesheet_link_tag "paper-toast/paper-toast" %>
72
+
73
+ <core-overlay opened="{{opened}}" target="{{}}" sizingTarget="{{$.container}}" transition="core-transition-bottom"></core-overlay>
74
+
75
+ <div class="toast-container" horizontal layout>
76
+
77
+ <div class="toast-text" flex>{{text}}</div>
78
+
79
+ <div class="toast-text toast-action" on-tap="{{dismiss}}">
80
+ <content></content>
81
+ </div>
82
+
83
+ </div>
84
+
85
+ <core-media-query query="max-width: {{responsiveWidth}}" queryMatches="{{narrowMode}}"></core-media-query>
86
+
87
+ </template>
88
+ <script>
89
+
90
+ (function() {
91
+
92
+ var currentToast;
93
+
94
+ Polymer('paper-toast', {
95
+
96
+ /**
97
+ * The text shows in a toast.
98
+ *
99
+ * @attribute text
100
+ * @type string
101
+ * @default ''
102
+ */
103
+ text: '',
104
+
105
+ /**
106
+ * The duration in milliseconds to show the toast.
107
+ *
108
+ * @attribute duration
109
+ * @type number
110
+ * @default 3000
111
+ */
112
+ duration: 3000,
113
+
114
+ /**
115
+ * Set opened to true to show the toast and to false to hide it.
116
+ *
117
+ * @attribute opened
118
+ * @type boolean
119
+ * @default false
120
+ */
121
+ opened: false,
122
+
123
+ /**
124
+ * Min-width when the toast changes to narrow layout. In narrow layout,
125
+ * the toast fits at the bottom of the screen when opened.
126
+ *
127
+ * @attribute responsiveWidth
128
+ * @type string
129
+ * @default '480px'
130
+ */
131
+ responsiveWidth: '480px',
132
+
133
+ /**
134
+ * If true, the toast can't be swiped.
135
+ *
136
+ * @attribute swipeDisabled
137
+ * @type boolean
138
+ * @default false
139
+ */
140
+ swipeDisabled: false,
141
+
142
+ eventDelegates: {
143
+ trackstart: 'trackStart',
144
+ track: 'track',
145
+ trackend: 'trackEnd',
146
+ transitionend: 'transitionEnd'
147
+ },
148
+
149
+ narrowModeChanged: function() {
150
+ this.classList.toggle('fit-bottom', this.narrowMode);
151
+ },
152
+
153
+ openedChanged: function() {
154
+ if (this.opened) {
155
+ this.dismissJob = this.job(this.dismissJob, this.dismiss, this.duration);
156
+ } else {
157
+ this.dismissJob && this.dismissJob.stop();
158
+ this.dismiss();
159
+ }
160
+ },
161
+
162
+ /**
163
+ * Toggle the opened state of the toast.
164
+ * @method toggle
165
+ */
166
+ toggle: function() {
167
+ this.opened = !this.opened;
168
+ },
169
+
170
+ /**
171
+ * Show the toast for the specified duration
172
+ * @method show
173
+ */
174
+ show: function() {
175
+ if (currentToast) {
176
+ currentToast.dismiss();
177
+ }
178
+ currentToast = this;
179
+ this.opened = true;
180
+ },
181
+
182
+ /**
183
+ * Dismiss the toast and hide it.
184
+ * @method dismiss
185
+ */
186
+ dismiss: function() {
187
+ if (this.dragging) {
188
+ this.shouldDismiss = true;
189
+ } else {
190
+ this.opened = false;
191
+ if (currentToast === this) {
192
+ currentToast = null;
193
+ }
194
+ }
195
+ },
196
+
197
+ trackStart: function(e) {
198
+ if (!this.swipeDisabled) {
199
+ e.preventTap();
200
+ this.vertical = e.yDirection;
201
+ this.w = this.offsetWidth;
202
+ this.h = this.offsetHeight;
203
+ this.dragging = true;
204
+ this.classList.add('dragging');
205
+ }
206
+ },
207
+
208
+ track: function(e) {
209
+ if (this.dragging) {
210
+ var s = this.style;
211
+ if (this.vertical) {
212
+ var y = e.dy;
213
+ s.opacity = (this.h - Math.abs(y)) / this.h;
214
+ s.webkitTransform = s.transform = 'translate3d(0, ' + y + 'px, 0)';
215
+ } else {
216
+ var x = e.dx;
217
+ s.opacity = (this.w - Math.abs(x)) / this.w;
218
+ s.webkitTransform = s.transform = 'translate3d(' + x + 'px, 0, 0)';
219
+ }
220
+ }
221
+ },
222
+
223
+ trackEnd: function(e) {
224
+ if (this.dragging) {
225
+ this.classList.remove('dragging');
226
+ this.style.opacity = null;
227
+ this.style.webkitTransform = this.style.transform = null;
228
+ var cl = this.classList;
229
+ if (this.vertical) {
230
+ cl.toggle('fade-out-down', e.yDirection === 1 && e.dy > 0);
231
+ cl.toggle('fade-out-up', e.yDirection === -1 && e.dy < 0);
232
+ } else {
233
+ cl.toggle('fade-out-right', e.xDirection === 1 && e.dx > 0);
234
+ cl.toggle('fade-out-left', e.xDirection === -1 && e.dx < 0);
235
+ }
236
+ this.dragging = false;
237
+ }
238
+ },
239
+
240
+ transitionEnd: function() {
241
+ var cl = this.classList;
242
+ if (cl.contains('fade-out-right') || cl.contains('fade-out-left') ||
243
+ cl.contains('fade-out-down') || cl.contains('fade-out-up')) {
244
+ this.dismiss();
245
+ cl.remove('fade-out-right', 'fade-out-left',
246
+ 'fade-out-down', 'fade-out-up');
247
+ } else if (this.shouldDismiss) {
248
+ this.dismiss();
249
+ }
250
+ this.shouldDismiss = false;
251
+ }
252
+
253
+ });
254
+
255
+ })();
256
+
257
+ </script>
258
+ </polymer-element>
@@ -0,0 +1,61 @@
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: inline-block;
12
+ }
13
+
14
+ :host(:focus) {
15
+ outline: none;
16
+ }
17
+
18
+ #toggleContainer {
19
+ position: relative;
20
+ width: 64px;
21
+ height: 16px;
22
+ }
23
+
24
+ #toggleBar {
25
+ position: absolute;
26
+ top: 8px;
27
+ left: 16px;
28
+ height: 1px;
29
+ width: 32px;
30
+ background-color: #5a5a5a;
31
+ pointer-events: none;
32
+ }
33
+
34
+ #toggleBar[checked] {
35
+ background-color: #0f9d58;
36
+ }
37
+
38
+ #toggleContainer[checked] #checkedBar {
39
+ width: 100%;
40
+ }
41
+
42
+ #toggleRadio {
43
+ position: absolute;
44
+ left: 0;
45
+ padding: 8px 48px 8px 0;
46
+ margin: -8px -48px -8px 0;
47
+ transition: -webkit-transform linear .08s;
48
+ transition: transform linear .08s;
49
+ }
50
+
51
+ #toggleRadio[checked] {
52
+ -webkit-transform: translate(48px, 0);
53
+ transform: translate(48px, 0);
54
+ padding: 8px 0 8px 48px;
55
+ margin: -8px 0 -8px -48px;
56
+ }
57
+
58
+ #toggleRadio.dragging {
59
+ -webkit-transition: none;
60
+ transition: none;
61
+ }