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.
- checksums.yaml +7 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/app/assets/components/core/animation/web-animations.html.erb +1 -0
- data/app/assets/components/core/animation/web-animations.js +5666 -0
- data/app/assets/components/core/icon/core-icon.css +25 -0
- data/app/assets/components/core/icon/core-icon.html.erb +126 -0
- data/app/assets/components/core/iconset/core-iconset.html.erb +236 -0
- data/app/assets/components/core/input/core-input.css +35 -0
- data/app/assets/components/core/input/core-input.html.erb +385 -0
- data/app/assets/components/core/list/core-list.css +20 -0
- data/app/assets/components/core/list/core-list.html.erb +403 -0
- data/app/assets/components/core/media-query/core-media-query.html +86 -0
- data/app/assets/components/core/menu/core-menu.css +18 -0
- data/app/assets/components/core/menu/core-menu.html.erb +62 -0
- data/app/assets/components/core/menu/core-submenu.css +29 -0
- data/app/assets/components/core/menu/core-submenu.html.erb +106 -0
- data/app/assets/components/core/meta/core-meta.html +143 -0
- data/app/assets/components/core/overlay/core-key-helper.html +17 -0
- data/app/assets/components/core/overlay/core-overlay-layer.html +112 -0
- data/app/assets/components/core/overlay/core-overlay.html.erb +661 -0
- data/app/assets/components/core/range/core-range.html +106 -0
- data/app/assets/components/core/selection/core-selection.html +148 -0
- data/app/assets/components/core/selector/core-selector.html.erb +423 -0
- data/app/assets/components/core/style/core-style.html +386 -0
- data/app/assets/components/core/transition/core-transition-css.html.erb +76 -0
- data/app/assets/components/core/transition/core-transition-overlay.css +46 -0
- data/app/assets/components/core/transition/core-transition.html.erb +44 -0
- data/app/assets/components/paper-button/paper-button.css +115 -0
- data/app/assets/components/paper-button/paper-button.html.erb +210 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.css +262 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.html.erb +104 -0
- data/app/assets/components/paper-dialog/paper-dialog-transition.css +59 -0
- data/app/assets/components/paper-dialog/paper-dialog-transition.html.erb +27 -0
- data/app/assets/components/paper-dialog/paper-dialog.css +0 -0
- data/app/assets/components/paper-dialog/paper-dialog.html.erb +176 -0
- data/app/assets/components/paper-fab/paper-fab.css +27 -0
- data/app/assets/components/paper-fab/paper-fab.html.erb +55 -0
- data/app/assets/components/paper-focusable/paper-focusable.html +144 -0
- data/app/assets/components/paper-icon-button/paper-icon-button.css +17 -0
- data/app/assets/components/paper-icon-button/paper-icon-button.html.erb +87 -0
- data/app/assets/components/paper-input/error-100.png +0 -0
- data/app/assets/components/paper-input/error-200.png +0 -0
- data/app/assets/components/paper-input/paper-input.html.erb +398 -0
- data/app/assets/components/paper-input/paper-input.scss +203 -0
- data/app/assets/components/paper-item/paper-item.css +30 -0
- data/app/assets/components/paper-item/paper-item.html.erb +103 -0
- data/app/assets/components/paper-menu-button/paper-menu-button-overlay.html.erb +86 -0
- data/app/assets/components/paper-menu-button/paper-menu-button-transition.css +19 -0
- data/app/assets/components/paper-menu-button/paper-menu-button-transition.html.erb +118 -0
- data/app/assets/components/paper-menu-button/paper-menu-button.css +86 -0
- data/app/assets/components/paper-menu-button/paper-menu-button.html.erb +128 -0
- data/app/assets/components/paper-progress/paper-progress.css +35 -0
- data/app/assets/components/paper-progress/paper-progress.html.erb +98 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.css +98 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.html.erb +148 -0
- data/app/assets/components/paper-radio-group/paper-radio-group.html.erb +68 -0
- data/app/assets/components/paper-ripple/paper-ripple.html +426 -0
- data/app/assets/components/paper-shadow/paper-shadow.css +81 -0
- data/app/assets/components/paper-shadow/paper-shadow.html.erb +212 -0
- data/app/assets/components/paper-slider/paper-slider.css +193 -0
- data/app/assets/components/paper-slider/paper-slider.html.erb +310 -0
- data/app/assets/components/paper-tabs/paper-tab.css +49 -0
- data/app/assets/components/paper-tabs/paper-tab.html.erb +66 -0
- data/app/assets/components/paper-tabs/paper-tabs.css +57 -0
- data/app/assets/components/paper-tabs/paper-tabs.html.erb +127 -0
- data/app/assets/components/paper-toast/paper-toast.css +0 -0
- data/app/assets/components/paper-toast/paper-toast.html.erb +258 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.css +61 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.html.erb +125 -0
- data/lib/polymer-paper-rails/engine.rb +4 -0
- data/lib/polymer-paper-rails/version.rb +3 -0
- data/lib/polymer-paper-rails.rb +2 -0
- metadata +158 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
outline: none;
|
|
4
|
+
text-align: inherit;
|
|
5
|
+
color: #757575;
|
|
6
|
+
}
|
|
7
|
+
:host(:hover) {
|
|
8
|
+
cursor: text;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#container {
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#inputClone,
|
|
16
|
+
#minInputHeight,
|
|
17
|
+
#maxInputHeight {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
visibility: hidden;
|
|
22
|
+
padding: 0.5em 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host /deep/ input,
|
|
26
|
+
:host /deep/ textarea {
|
|
27
|
+
font: inherit;
|
|
28
|
+
color: #000;
|
|
29
|
+
padding: 0;
|
|
30
|
+
/* Important to use margin here so the margin remains visible
|
|
31
|
+
* when textarea scrolls internally. */
|
|
32
|
+
margin: 0.5em 0;
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
border: none;
|
|
35
|
+
outline: none;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.host /deep/ textarea {
|
|
40
|
+
resize: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#floatedLabel {
|
|
44
|
+
font-size: 0.75em;
|
|
45
|
+
background: transparent;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
#floatedLabel.hidden {
|
|
49
|
+
visibility: hidden;
|
|
50
|
+
}
|
|
51
|
+
#floatedLabel.focused {
|
|
52
|
+
visibility: visible;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#label {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 0;
|
|
58
|
+
left: 0;
|
|
59
|
+
right: 0;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
width: 100%;
|
|
62
|
+
padding: 0.5em 0;
|
|
63
|
+
background: transparent;
|
|
64
|
+
-webkit-transform-origin: 0% 0%;
|
|
65
|
+
transform-origin: 0% 0%;
|
|
66
|
+
}
|
|
67
|
+
#label.hidden {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
#label.animating {
|
|
71
|
+
/* TODO: transforms are unprefixed in M36/ Remove when stable. */
|
|
72
|
+
-webkit-transition: -webkit-transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
73
|
+
transition: transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#labelSpan {
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
text-overflow: ellipsis;
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
display: inline-block;
|
|
81
|
+
max-width: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#errorContainer {
|
|
85
|
+
visibility: hidden;
|
|
86
|
+
display: -webkit-flex;
|
|
87
|
+
display: flex;
|
|
88
|
+
-webkit-align-items: center;
|
|
89
|
+
align-items: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host(.invalid) #errorContainer {
|
|
93
|
+
visibility: visible;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#error {
|
|
97
|
+
-webkit-flex: 1;
|
|
98
|
+
flex: 1;
|
|
99
|
+
font-size: 0.75em;
|
|
100
|
+
padding: 0.5em 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
#errorIcon {
|
|
104
|
+
background-image: image-url('paper-input/error-100.png');
|
|
105
|
+
background-size: 24px 24px;
|
|
106
|
+
height: 24px;
|
|
107
|
+
width: 24px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@media (min-resolution: 2dppx) {
|
|
112
|
+
#errorIcon {
|
|
113
|
+
background-image: image-url('paper-input/error-200.png');
|
|
114
|
+
background-size: 24px 24px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#underlineContainer {
|
|
119
|
+
position: absolute;
|
|
120
|
+
left: 0;
|
|
121
|
+
right: 0;
|
|
122
|
+
bottom: -1px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([multiline]) #underlineContainer {
|
|
126
|
+
bottom: auto;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([multiline]) #underlineContainer.animating {
|
|
130
|
+
-webkit-transition: top 0.2s ease-in;
|
|
131
|
+
transition: top 0.2s ease-in;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#underline {
|
|
135
|
+
height: 1px;
|
|
136
|
+
background: #757575;
|
|
137
|
+
border-bottom-color: #757575;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:host([disabled]) #underline {
|
|
141
|
+
border-bottom: 1px dashed;
|
|
142
|
+
height: 0px;
|
|
143
|
+
background: transparent;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#underlineHighlight {
|
|
147
|
+
position: absolute;
|
|
148
|
+
left: 0;
|
|
149
|
+
right: 0;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
height: 2px;
|
|
152
|
+
-webkit-transform: scale(0,2);
|
|
153
|
+
transform: scale(0,2);
|
|
154
|
+
}
|
|
155
|
+
#underlineHighlight.pressed {
|
|
156
|
+
-webkit-transform: scale(0.1,2);
|
|
157
|
+
transform: scale(0.1,2);
|
|
158
|
+
/* TODO: transforms are unprefixed in M36/ Remove when stable. */
|
|
159
|
+
-webkit-transition: -webkit-transform 0.1s cubic-bezier(0.2, 0, 0.03, 1);
|
|
160
|
+
transition: transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
161
|
+
}
|
|
162
|
+
#underlineHighlight.animating {
|
|
163
|
+
/* TODO: transforms are unprefixed in M36/ Remove when stable. */
|
|
164
|
+
-webkit-transition: -webkit-transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
165
|
+
transition: transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
166
|
+
}
|
|
167
|
+
#underlineHighlight.focused {
|
|
168
|
+
-webkit-transform: scale(1);
|
|
169
|
+
transform: scale(1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#caret {
|
|
173
|
+
display: none;
|
|
174
|
+
position: absolute;
|
|
175
|
+
top: 0;
|
|
176
|
+
left: 0;
|
|
177
|
+
right: 0;
|
|
178
|
+
bottom: 0;
|
|
179
|
+
opacity: 0;
|
|
180
|
+
-webkit-transform-origin-x: 0%;
|
|
181
|
+
transform-origin-x: 0%;
|
|
182
|
+
-webkit-transform: scaleX(1) translateX(10%);
|
|
183
|
+
transform: scaleX(1) translateX(10%);
|
|
184
|
+
}
|
|
185
|
+
#caret.animating {
|
|
186
|
+
display: block;
|
|
187
|
+
/* TODO: transforms are unprefixed in M36/ Remove when stable. */
|
|
188
|
+
-webkit-transition: -webkit-transform 0.2s ease-out, opacity 0.2s ease-out;
|
|
189
|
+
transition: transform 0.3s cubic-bezier(0.2, 0, 0.03, 1);
|
|
190
|
+
}
|
|
191
|
+
#caret.focused {
|
|
192
|
+
display: block;
|
|
193
|
+
opacity: 0.75;
|
|
194
|
+
-webkit-transform: scaleX(0) translateX(0);
|
|
195
|
+
transform: scaleX(0) translateX(0);
|
|
196
|
+
}
|
|
197
|
+
#caretInner {
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 0.6em;
|
|
200
|
+
left: 0;
|
|
201
|
+
height: 1.2em;
|
|
202
|
+
width: 25%;
|
|
203
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
html /deep/ paper-item {
|
|
2
|
+
display: block;
|
|
3
|
+
position: relative;
|
|
4
|
+
-webkit-user-select: none;
|
|
5
|
+
user-select: none;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
height: 36px;
|
|
8
|
+
padding: 0 12px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
html /deep/ paper-item::shadow #ripple {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
html /deep/ paper-item::shadow #icon {
|
|
21
|
+
margin-right: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
html /deep/ paper-item::shadow ::content > a {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
@group Paper Elements
|
|
12
|
+
|
|
13
|
+
`paper-item` is a list-item object for use in menus. It may contain and icon and/or
|
|
14
|
+
a text label.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
|
|
18
|
+
<core-menu>
|
|
19
|
+
<paper-item icon="refresh" label="Refresh"></paper-item>
|
|
20
|
+
<paper-item label="Help"></paper-item>
|
|
21
|
+
<paper-item label="Sign Out"></paper-item>
|
|
22
|
+
</core-menu>
|
|
23
|
+
|
|
24
|
+
To use as a link, put an `<a>` element in the item.
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
|
|
28
|
+
<paper-item icon="home" label="Home">
|
|
29
|
+
<a href="http://www.polymer-project.org"></a>
|
|
30
|
+
</paper-item>
|
|
31
|
+
|
|
32
|
+
@class paper-item
|
|
33
|
+
-->
|
|
34
|
+
|
|
35
|
+
<%= html_import_tag "core/icon/core-icon" %>
|
|
36
|
+
<%= html_import_tag "paper-ripple/paper-ripple" %>
|
|
37
|
+
|
|
38
|
+
<%= stylesheet_link_tag "paper-item/paper-item", "shim-shadowdom" => true %>
|
|
39
|
+
|
|
40
|
+
<polymer-element name="paper-item" attributes="label iconSrc icon" center horizontal layout>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
|
|
44
|
+
<paper-ripple id="ripple"></paper-ripple>
|
|
45
|
+
|
|
46
|
+
<core-icon id="icon" hidden?="{{!iconSrc && !icon}}" src="{{iconSrc}}" icon="{{icon}}"></core-icon>
|
|
47
|
+
{{label}}
|
|
48
|
+
<content></content>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
Polymer('paper-item', {
|
|
53
|
+
|
|
54
|
+
publish: {
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The label for the item.
|
|
58
|
+
*
|
|
59
|
+
* @attribute label
|
|
60
|
+
* @type string
|
|
61
|
+
* @default ''
|
|
62
|
+
*/
|
|
63
|
+
label: '',
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* (optional) The URL of an image for an icon to use in the button.
|
|
67
|
+
* Should not use `icon` property if you are using this property.
|
|
68
|
+
*
|
|
69
|
+
* @attribute iconSrc
|
|
70
|
+
* @type string
|
|
71
|
+
* @default ''
|
|
72
|
+
*/
|
|
73
|
+
iconSrc: {value: ''},
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* (optional) Specifies the icon name or index in the set of icons
|
|
77
|
+
* available in the icon set. If using this property, load the icon
|
|
78
|
+
* set separately where the icon is used. Should not use `src`
|
|
79
|
+
* if you are using this property.
|
|
80
|
+
*
|
|
81
|
+
* @attribute icon
|
|
82
|
+
* @type string
|
|
83
|
+
* @default ''
|
|
84
|
+
*/
|
|
85
|
+
icon: {value: ''}
|
|
86
|
+
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
eventDelegates: {
|
|
90
|
+
'down': 'downAction',
|
|
91
|
+
'up': 'upAction'
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
downAction: function(e) {
|
|
95
|
+
this.$.ripple.downAction(e);
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
upAction: function(e) {
|
|
99
|
+
this.$.ripple.upAction(e);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
</script>
|
|
103
|
+
</polymer-element>
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
<%= html_import_tag "core/overlay/core-overlay" %>
|
|
11
|
+
|
|
12
|
+
<!--
|
|
13
|
+
|
|
14
|
+
`paper-menu-button-overlay` is a helper class to position an overlay relative to another
|
|
15
|
+
element, e.g. the button with a pulldown menu.
|
|
16
|
+
|
|
17
|
+
@group Paper Elements
|
|
18
|
+
@element paper-menu-button-overlay
|
|
19
|
+
@extends core-overlay
|
|
20
|
+
@homepage github.io
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
<polymer-element name="paper-menu-button-overlay" extends="core-overlay" attributes="relatedTarget halign valign">
|
|
24
|
+
<script>
|
|
25
|
+
Polymer('paper-menu-button-overlay', {
|
|
26
|
+
|
|
27
|
+
publish: {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The `relatedTarget` is an element used to position the overlay, for example a
|
|
31
|
+
* button the user taps to show a menu.
|
|
32
|
+
*
|
|
33
|
+
* @attribute relatedTarget
|
|
34
|
+
* @type Element
|
|
35
|
+
*/
|
|
36
|
+
relatedTarget: null,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The horizontal alignment of the overlay relative to the `relatedTarget`.
|
|
40
|
+
*
|
|
41
|
+
* @attribute halign
|
|
42
|
+
* @type 'left'|'right'|'center'
|
|
43
|
+
* @default 'left'
|
|
44
|
+
*/
|
|
45
|
+
halign: 'left'
|
|
46
|
+
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
updateTargetDimensions: function() {
|
|
50
|
+
this.super();
|
|
51
|
+
|
|
52
|
+
var t = this.target;
|
|
53
|
+
this.target.cachedSize = t.getBoundingClientRect();
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
positionTarget: function() {
|
|
57
|
+
if (this.relatedTarget) {
|
|
58
|
+
|
|
59
|
+
var rect = this.relatedTarget.getBoundingClientRect();
|
|
60
|
+
|
|
61
|
+
if (this.halign === 'left') {
|
|
62
|
+
this.target.style.left = rect.left + 'px';
|
|
63
|
+
} else if (this.halign === 'right') {
|
|
64
|
+
this.target.style.right = (window.innerWidth - rect.right) + 'px';
|
|
65
|
+
} else {
|
|
66
|
+
this.target.style.left = (rect.left - (rect.width - this.target.cachedSize.width) / 2) + 'px';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (this.valign === 'top') {
|
|
70
|
+
this.target.style.top = rect.top + 'px';
|
|
71
|
+
} else if (this.valign === 'bottom') {
|
|
72
|
+
this.target.style.top = rect.bottom + 'px';
|
|
73
|
+
} else {
|
|
74
|
+
this.target.style.top = rect.top + 'px';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// this.target.style.top = rect.top + 'px';
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
this.super();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
86
|
+
</polymer-element>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
|
2
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
3
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
4
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
5
|
+
Code distributed by Google as part of the polymer project is also
|
|
6
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */
|
|
7
|
+
|
|
8
|
+
:host(.paper-menu-button-transition) {
|
|
9
|
+
outline: none;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
transition: transform 0.2s ease-in-out, opacity 0.2s ease-in;
|
|
12
|
+
-webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(.paper-menu-button-transition.paper-menu-button-opened) {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
transform: none;
|
|
18
|
+
-webkit-transform: none;
|
|
19
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
@group Paper Elements
|
|
11
|
+
@class paper-menu-button-transition
|
|
12
|
+
@extends core-transition-css
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
<%= html_import_tag "core/transition/core-transition-css" %>
|
|
16
|
+
<%= html_import_tag "core/animation/web-animations" %>
|
|
17
|
+
|
|
18
|
+
<polymer-element name="paper-menu-button-transition" extends="core-transition-css" attributes="duration transformOrigin">
|
|
19
|
+
<template>
|
|
20
|
+
<%= stylesheet_link_tag "paper-menu-button/paper-menu-button-transition" %>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
Polymer('paper-menu-button-transition', {
|
|
24
|
+
|
|
25
|
+
baseClass: 'paper-menu-button-transition',
|
|
26
|
+
revealedClass: 'paper-menu-button-revealed',
|
|
27
|
+
openedClass: 'paper-menu-button-opened',
|
|
28
|
+
closedClass: 'paper-menu-button-closed',
|
|
29
|
+
|
|
30
|
+
duration: 500,
|
|
31
|
+
|
|
32
|
+
setup: function(node) {
|
|
33
|
+
this.super(arguments);
|
|
34
|
+
|
|
35
|
+
var bg = node.querySelector('.paper-menu-button-overlay-bg');
|
|
36
|
+
bg.style.transformOrigin = this.transformOrigin;
|
|
37
|
+
bg.style.webkitTransformOrigin = this.transformOrigin;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
transitionOpened: function(node, opened) {
|
|
41
|
+
this.super(arguments);
|
|
42
|
+
|
|
43
|
+
if (opened) {
|
|
44
|
+
if (this.player) {
|
|
45
|
+
this.player.cancel();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var anims = [];
|
|
49
|
+
|
|
50
|
+
var ink = node.querySelector('.paper-menu-button-overlay-ink');
|
|
51
|
+
var offset = 40 / Math.max(node.cachedSize.width, node.cachedSize.height);
|
|
52
|
+
anims.push(new Animation(ink, [{
|
|
53
|
+
'opacity': 0.9,
|
|
54
|
+
'transform': 'scale(0)',
|
|
55
|
+
}, {
|
|
56
|
+
'opacity': 0.9,
|
|
57
|
+
'transform': 'scale(1)'
|
|
58
|
+
}], {
|
|
59
|
+
duration: this.duration * offset
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
var bg = node.querySelector('.paper-menu-button-overlay-bg');
|
|
63
|
+
anims.push(new Animation(bg, [{
|
|
64
|
+
'opacity': 0.9,
|
|
65
|
+
'transform': 'scale(' + 40 / node.cachedSize.width + ',' + 40 / node.cachedSize.height + ')',
|
|
66
|
+
}, {
|
|
67
|
+
'opacity': 1,
|
|
68
|
+
'transform': 'scale(0.95, 0.5)'
|
|
69
|
+
}, {
|
|
70
|
+
'opacity': 1,
|
|
71
|
+
'transform': 'scale(1, 1)'
|
|
72
|
+
}], {
|
|
73
|
+
delay: this.duration * offset,
|
|
74
|
+
duration: this.duration * (1 - offset),
|
|
75
|
+
fill: 'forwards'
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
var nodes = window.ShadowDOMPolyfill ? Platform.queryAllShadows(node.querySelector('core-menu'), 'content').getDistributedNodes() : node.querySelector('core-menu::shadow content').getDistributedNodes().array();
|
|
79
|
+
var items = nodes.filter(function(n) {
|
|
80
|
+
return n.nodeType === Node.ELEMENT_NODE;
|
|
81
|
+
});
|
|
82
|
+
var itemDelay = offset + (1 - offset) / 2;
|
|
83
|
+
var itemDuration = this.duration * (1 - itemDelay) / (items.length - 1);
|
|
84
|
+
items.forEach(function(item, i) {
|
|
85
|
+
anims.push(new Animation(item, [{
|
|
86
|
+
'opacity': 0
|
|
87
|
+
}, {
|
|
88
|
+
'opacity': 1
|
|
89
|
+
}], {
|
|
90
|
+
delay: this.duration * itemDelay + itemDuration * i,
|
|
91
|
+
duration: itemDuration,
|
|
92
|
+
fill: 'both'
|
|
93
|
+
}));
|
|
94
|
+
}.bind(this));
|
|
95
|
+
|
|
96
|
+
var shadow = node.querySelector('paper-shadow');
|
|
97
|
+
anims.push(new Animation(shadow, function(t, target) {
|
|
98
|
+
if (t > offset * 2 && shadow.z === 0) {
|
|
99
|
+
shadow.z = 1
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
duration: this.duration
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
var group = new AnimationGroup(anims, {
|
|
106
|
+
easing: 'cubic-bezier(0.4, 0, 0.2, 1)'
|
|
107
|
+
});
|
|
108
|
+
this.player = document.timeline.play(group);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
});
|
|
113
|
+
</script>
|
|
114
|
+
</polymer-element>
|
|
115
|
+
|
|
116
|
+
<paper-menu-button-transition id="paper-menu-button-transition-top-left" transformOrigin="0% 0%"></paper-menu-button-transition>
|
|
117
|
+
<paper-menu-button-transition id="paper-menu-button-transition-top-right" transformOrigin="100% 0%"></paper-menu-button-transition>
|
|
118
|
+
<paper-menu-button-transition id="paper-menu-button-transition-top-right-slow" transformOrigin="100% 0%" duration="10000"></paper-menu-button-transition>
|