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,81 @@
1
+ .paper-shadow {
2
+ position: absolute;
3
+ top: 0;
4
+ left: 0;
5
+ bottom: 0;
6
+ right: 0;
7
+ border-radius: inherit;
8
+ pointer-events: none;
9
+ }
10
+
11
+ .paper-shadow-animated.paper-shadow {
12
+ transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
13
+ }
14
+
15
+ .paper-shadow-top-z-1 {
16
+ box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.16);
17
+ }
18
+
19
+ .paper-shadow-bottom-z-1 {
20
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
21
+ }
22
+
23
+ .paper-shadow-top-z-2 {
24
+ box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.19);
25
+ }
26
+
27
+ .paper-shadow-bottom-z-2 {
28
+ box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);
29
+ }
30
+
31
+ .paper-shadow-top-z-3 {
32
+ box-shadow: 0 17px 50px 0 rgba(0, 0, 0, 0.19);
33
+ }
34
+
35
+ .paper-shadow-bottom-z-3 {
36
+ box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24);
37
+ }
38
+
39
+ .paper-shadow-top-z-4 {
40
+ box-shadow: 0 25px 55px 0 rgba(0, 0, 0, 0.21);
41
+ }
42
+
43
+ .paper-shadow-bottom-z-4 {
44
+ box-shadow: 0 16px 28px 0 rgba(0, 0, 0, 0.22);
45
+ }
46
+
47
+ .paper-shadow-top-z-5 {
48
+ box-shadow: 0 40px 77px 0 rgba(0, 0, 0, 0.22);
49
+ }
50
+
51
+ .paper-shadow-bottom-z-5 {
52
+ box-shadow: 0 27px 24px 0 rgba(0, 0, 0, 0.2);
53
+ }
54
+
55
+ .paper-shadow-animate-z-1-z-2.paper-shadow-top {
56
+ -webkit-transition: none;
57
+ -webkit-animation: animate-shadow-top-z-1-z-2 0.7s infinite alternate;
58
+ }
59
+
60
+ .paper-shadow-animate-z-1-z-2 .paper-shadow-bottom {
61
+ -webkit-transition: none;
62
+ -webkit-animation: animate-shadow-bottom-z-1-z-2 0.7s infinite alternate;
63
+ }
64
+
65
+ @-webkit-keyframes animate-shadow-top-z-1-z-2 {
66
+ 0% {
67
+ box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.16);
68
+ }
69
+ 100% {
70
+ box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.19);
71
+ }
72
+ }
73
+
74
+ @-webkit-keyframes animate-shadow-bottom-z-1-z-2 {
75
+ 0% {
76
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
77
+ }
78
+ 100% {
79
+ box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2);
80
+ }
81
+ }
@@ -0,0 +1,212 @@
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
+ The `paper-shadow` element is a helper to add shadows to elements.
12
+ Paper shadows are composed of two shadows on top of each other. We
13
+ mimic this effect by using two elements on top of each other, each with a
14
+ different drop shadow. You can apply the shadow to an element by assigning
15
+ it as the target. If you do not specify a target, the shadow is applied to
16
+ the `paper-shadow` element's parent element or shadow host element if its
17
+ parent is a shadow root. Alternatively, you can use the CSS classes included
18
+ by this element directly.
19
+
20
+ Example:
21
+
22
+ <div id="myCard" class="card"></div>
23
+ <paper-shadow id="myShadow" z="1"></div>
24
+
25
+ // Assign a target explicitly
26
+ myShadow.target = document.getElementById('myCard');
27
+
28
+ // Auto-assign the target.
29
+ <div class="card">
30
+ <paper-shadow z="1"></paper-shadow>
31
+ </div>
32
+
33
+ // Use the classes directly
34
+ <div class="card paper-shadow-top paper-shadow-top-z-1">
35
+ <div class="card-inner paper-shadow-bottom paper-shadow-bottom-z-1"></div>
36
+ </div>
37
+
38
+ If you assign a target to a `paper-shadow` element, it creates two nodes and inserts
39
+ them as the first children of the target, or the first children of the target's shadow
40
+ root if there is one. This implies:
41
+
42
+ 1. If the primary node that drops the shadow has styling that affects its shape,
43
+ the same styling must be applied to elements with class `paper-shadow`.
44
+ `border-radius` is a very common property and is inherited automatically.
45
+
46
+ 2. The target's overflow property will be set to `overflow: visible` because the
47
+ shadow is rendered beyond the bounds of its container. Position the shadow as a
48
+ separate layer and use a different child element for clipping if needed.
49
+
50
+ @group Paper Elements
51
+ @class paper-shadow
52
+ -->
53
+
54
+
55
+ <polymer-element name="paper-shadow">
56
+
57
+ <template>
58
+
59
+ <%= stylesheet_link_tag 'paper-shadow/paper-shadow', 'no-shim' => true %>
60
+
61
+ </template>
62
+
63
+ <script>
64
+ Polymer('paper-shadow', {
65
+
66
+ publish: {
67
+ /**
68
+ * If set, the shadow is applied to this node.
69
+ *
70
+ * @attribute target
71
+ * @type Element
72
+ * @default null
73
+ */
74
+ target: {value: null, reflect: true},
75
+
76
+ /**
77
+ * The z-depth of this shadow, from 0-5.
78
+ *
79
+ * @attribute z
80
+ * @type number
81
+ * @default 1
82
+ */
83
+ z: {value: 1, reflect: true},
84
+
85
+ /**
86
+ * If true, the shadow animates between z-depth changes.
87
+ *
88
+ * @attribute animated
89
+ * @type boolean
90
+ * @default false
91
+ */
92
+ animated: {value: false, reflect: true},
93
+
94
+ /**
95
+ * Workaround: getComputedStyle is wrong sometimes so `paper-shadow`
96
+ * may overwrite the `position` CSS property. Set this property to
97
+ * true to prevent this.
98
+ *
99
+ * @attribute hasPosition
100
+ * @type boolean
101
+ * @default false
102
+ */
103
+ hasPosition: {value: false}
104
+ },
105
+
106
+ // NOTE: include template so that styles are loaded, but remove
107
+ // so that we can decide dynamically what part to include
108
+ registerCallback: function(polymerElement) {
109
+ var template = polymerElement.querySelector('template');
110
+ this._style = template.content.querySelector('style');
111
+ this._style.removeAttribute('no-shim');
112
+ },
113
+
114
+ fetchTemplate: function() {
115
+ return null;
116
+ },
117
+
118
+ attached: function() {
119
+ this.installScopeStyle(this._style);
120
+
121
+ // If no target is bound at attach, default the target to the parent
122
+ // element or shadow host.
123
+ if (!this.target) {
124
+ if (!this.parentElement && this.parentNode.host) {
125
+ this.target = this.parentNode.host;
126
+ } else if (this.parentElement && (window.ShadowDOMPolyfill ? this.parentElement !== wrap(document.body) : this.parentElement !== document.body)) {
127
+ this.target = this.parentElement;
128
+ }
129
+ }
130
+ },
131
+
132
+ targetChanged: function(old) {
133
+ if (old) {
134
+ this.removeShadow(old);
135
+ }
136
+ if (this.target) {
137
+ this.addShadow(this.target);
138
+ }
139
+ },
140
+
141
+ zChanged: function(old) {
142
+ if (this.target && this.target._paperShadow) {
143
+ var shadow = this.target._paperShadow;
144
+ ['top', 'bottom'].forEach(function(s) {
145
+ shadow[s].classList.remove('paper-shadow-' + s + '-z-' + old);
146
+ shadow[s].classList.add('paper-shadow-' + s + '-z-' + this.z);
147
+ }.bind(this));
148
+ }
149
+ },
150
+
151
+ animatedChanged: function() {
152
+ if (this.target && this.target._paperShadow) {
153
+ var shadow = this.target._paperShadow;
154
+ ['top', 'bottom'].forEach(function(s) {
155
+ if (this.animated) {
156
+ shadow[s].classList.add('paper-shadow-animated');
157
+ } else {
158
+ shadow[s].classList.remove('paper-shadow-animated');
159
+ }
160
+ }.bind(this));
161
+ }
162
+ },
163
+
164
+ addShadow: function(node) {
165
+ if (node._paperShadow) {
166
+ return;
167
+ }
168
+
169
+ var computed = getComputedStyle(node);
170
+ if (!this.hasPosition && computed.position === 'static') {
171
+ node.style.position = 'relative';
172
+ }
173
+ node.style.overflow = 'visible';
174
+
175
+ // Both the top and bottom shadows are children of the target, so
176
+ // it does not affect the classes and CSS properties of the target.
177
+ ['top', 'bottom'].forEach(function(s) {
178
+ var inner = (node._paperShadow && node._paperShadow[s]) || document.createElement('div');
179
+ inner.classList.add('paper-shadow');
180
+ inner.classList.add('paper-shadow-' + s + '-z-' + this.z);
181
+ if (this.animated) {
182
+ inner.classList.add('paper-shadow-animated');
183
+ }
184
+
185
+ if (node.shadowRoot) {
186
+ node.shadowRoot.insertBefore(inner, node.shadowRoot.firstChild);
187
+ } else {
188
+ node.insertBefore(inner, node.firstChild);
189
+ }
190
+
191
+ node._paperShadow = node._paperShadow || {};
192
+ node._paperShadow[s] = inner;
193
+ }.bind(this));
194
+
195
+ },
196
+
197
+ removeShadow: function(node) {
198
+ if (!node._paperShadow) {
199
+ return;
200
+ }
201
+
202
+ ['top', 'bottom'].forEach(function(s) {
203
+ node._paperShadow[s].remove();
204
+ });
205
+ node._paperShadow = null;
206
+
207
+ node.style.position = null;
208
+ }
209
+
210
+ });
211
+ </script>
212
+ </polymer-element>
@@ -0,0 +1,193 @@
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
+ width: 200px;
13
+ cursor: default;
14
+ }
15
+
16
+ #sliderContainer {
17
+ position: relative;
18
+ width: calc(100% - 32px);
19
+ height: 32px;
20
+ }
21
+
22
+ :host([editable]) #sliderContainer {
23
+ float: left;
24
+ width: calc(100% - 72px);
25
+ }
26
+
27
+ #sliderBar {
28
+ position: absolute;
29
+ top: 15px;
30
+ left: 16px;
31
+ height: 2px;
32
+ width: 100%;
33
+ padding: 8px 0;
34
+ margin: -8px 0;
35
+ }
36
+
37
+ .slider-markers {
38
+ position: absolute;
39
+ top: 15px;
40
+ left: 15px;
41
+ height: 2px;
42
+ width: calc(100% + 2px);
43
+ box-sizing: border-box;
44
+ pointer-events: none;
45
+ /* background-image: -webkit-linear-gradient(0deg, #ccc, #ccc 1px, transparent 1px, transparent);
46
+ background-size: 10%; */
47
+ }
48
+
49
+ .slider-markers::after, .slider-marker::after {
50
+ content: "";
51
+ display: block;
52
+ width: 2px;
53
+ height: 2px;
54
+ border-radius: 50%;
55
+ background-color: black;
56
+ }
57
+
58
+ #sliderBar::shadow #activeProgress {
59
+ background-color: #3f51b5;
60
+ }
61
+
62
+ #sliderKnob {
63
+ position: absolute;
64
+ left: 0;
65
+ top: 0;
66
+ width: 32px;
67
+ height: 32px;
68
+ }
69
+
70
+ #sliderKnob.transiting {
71
+ transition: left 0.08s ease;
72
+ }
73
+
74
+ #sliderKnob:focus {
75
+ outline: none;
76
+ }
77
+
78
+ #sliderKnob.dragging {
79
+ transition: none;
80
+ }
81
+
82
+ #sliderKnob.snaps.dragging {
83
+ transition: -webkit-transform 0.08s ease;
84
+ transition: transform 0.08s ease;
85
+ }
86
+
87
+ #sliderKnobInner {
88
+ width: 12px;
89
+ height: 12px;
90
+ box-sizing: border-box;
91
+ -moz-box-sizing: border-box;
92
+ border-radius: 50%;
93
+ background-color: #3f51b5;
94
+ /* FIXME(ffu): can't use the following. https://github.com/Polymer/platform/issues/53 */
95
+ /* transition-property: height, width, background-color, border;
96
+ transition-duration: 0.1s;
97
+ transition-timing-function: ease; */
98
+ transition: height 0.18s ease, width 0.18s ease, background-color 0.28s ease, border 0.18s ease;
99
+ }
100
+
101
+ #sliderKnob.expand:not(.pin) > #sliderKnobInner {
102
+ width: 100%;
103
+ height: 100%;
104
+ -webkit-transform: translateZ(0);
105
+ transform: translateZ(0);
106
+ }
107
+
108
+ #sliderKnob.ring > #sliderKnobInner {
109
+ background-color: #fff;
110
+ border: 2px solid #c8c8c8;
111
+ }
112
+
113
+ #sliderKnobInner::before {
114
+ background-color: #3f51b5;
115
+ }
116
+
117
+ #sliderKnob.pin > #sliderKnobInner::before {
118
+ content: "";
119
+ position: absolute;
120
+ top: 0;
121
+ left: 0;
122
+ width: 26px;
123
+ height: 26px;
124
+ margin-left: 3px;
125
+ border-radius: 50% 50% 50% 0;
126
+ -webkit-transform: rotate(-45deg) scale(0) translate(0);
127
+ transform: rotate(-45deg) scale(0) translate(0);
128
+ }
129
+
130
+ #sliderKnobInner::before, #sliderKnobInner::after {
131
+ transition: -webkit-transform .2s ease, background-color .18s ease;
132
+ transition: transform .2s ease, background-color .18s ease;
133
+ }
134
+
135
+ #sliderKnob.pin.ring > #sliderKnobInner::before {
136
+ background-color: #c8c8c8;
137
+ }
138
+
139
+ #sliderKnob.pin.expand > #sliderKnobInner::before {
140
+ -webkit-transform: rotate(-45deg) scale(1) translate(17px, -17px);
141
+ transform: rotate(-45deg) scale(1) translate(17px, -17px);
142
+ }
143
+
144
+ #sliderKnob.pin > #sliderKnobInner::after {
145
+ /* FIXME(ffu): add dummy quotes to workaround https://github.com/Polymer/platform/issues/57 */
146
+ content: attr(value) "";
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ width: 32px;
151
+ height: 26px;
152
+ text-align: center;
153
+ color: #fff;
154
+ font-size: 10px;
155
+ -webkit-transform: scale(0) translate(0);
156
+ transform: scale(0) translate(0);
157
+ }
158
+
159
+ #sliderKnob.pin.expand > #sliderKnobInner::after {
160
+ -webkit-transform: scale(1) translate(0, -17px);
161
+ transform: scale(1) translate(0, -17px);
162
+ }
163
+
164
+ .slider-input {
165
+ width: 40px;
166
+ height: 32px;
167
+ float: right;
168
+ }
169
+
170
+ .slider-input::shadow input {
171
+ /* FIXME(ffu): should one be able set text-align directly on paper-input? */
172
+ text-align: center;
173
+ }
174
+
175
+ /* disabled state */
176
+ :host([disabled]) #sliderContainer {
177
+ pointer-events: none;
178
+ }
179
+
180
+ :host([disabled]) {
181
+ pointer-events: none;
182
+ }
183
+
184
+ :host([disabled]) #sliderKnob > #sliderKnobInner {
185
+ width: 12px;
186
+ height: 12px;
187
+ background-color: #c8c8c8;
188
+ border: 2px solid #fff;
189
+ }
190
+
191
+ :host([disabled]) #sliderContainer > #sliderBar::shadow #activeProgress {
192
+ background-color: #c8c8c8;
193
+ }