polymer-paper-rails 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -18
- data/app/assets/components/core-a11y-keys/core-a11y-keys.html +4 -4
- data/app/assets/components/core-animation/web-animations.html +1 -1
- data/app/assets/components/core-collapse/core-collapse.html +1 -1
- data/app/assets/components/core-drawer-panel/core-drawer-panel.css +14 -6
- data/app/assets/components/core-drawer-panel/core-drawer-panel.html +32 -8
- data/app/assets/components/core-dropdown/core-dropdown.html +8 -2
- data/app/assets/components/core-icon/core-icon.html +0 -2
- data/app/assets/components/core-icons/av-icons.html +2 -9
- data/app/assets/components/core-icons/communication-icons.html +39 -42
- data/app/assets/components/core-icons/core-icons.html +231 -235
- data/app/assets/components/core-icons/device-icons.html +75 -90
- data/app/assets/components/core-icons/editor-icons.html +52 -52
- data/app/assets/components/core-icons/hardware-icons.html +40 -41
- data/app/assets/components/core-icons/image-icons.html +133 -137
- data/app/assets/components/core-icons/maps-icons.html +55 -57
- data/app/assets/components/core-icons/notification-icons.html +34 -34
- data/app/assets/components/core-icons/social-icons.html +23 -37
- data/app/assets/components/core-menu/core-menu.html +8 -3
- data/app/assets/components/core-menu/core-submenu.html +2 -2
- data/app/assets/components/core-overlay/core-key-helper.html +3 -0
- data/app/assets/components/core-overlay/core-overlay-layer.html +3 -0
- data/app/assets/components/core-overlay/core-overlay.html +20 -4
- data/app/assets/components/core-resizable/core-resizable.html +248 -0
- data/app/assets/components/core-scroll-header-panel/core-scroll-header-panel.html +14 -3
- data/app/assets/components/core-selection/core-selection.html +1 -1
- data/app/assets/components/core-selector/core-selector.html +26 -26
- data/app/assets/components/core-style/core-style.html +1 -1
- data/app/assets/components/core-toolbar/core-toolbar.html +1 -1
- data/app/assets/components/paper-button/paper-button-base.html +56 -12
- data/app/assets/components/paper-button/paper-button.html +22 -5
- data/app/assets/components/paper-checkbox/paper-checkbox.css +65 -184
- data/app/assets/components/paper-checkbox/paper-checkbox.html +47 -55
- data/app/assets/components/paper-dialog/paper-action-dialog.html +3 -3
- data/app/assets/components/paper-dialog/paper-dialog.html +2 -2
- data/app/assets/components/paper-dropdown-menu/paper-dropdown-menu.html +4 -1
- data/app/assets/components/{core-elements → paper-elements}/metadata.html +0 -0
- data/app/assets/components/{core-elements → paper-elements}/paper-elements.html +1 -0
- data/app/assets/components/paper-fab/paper-fab.html +2 -2
- data/app/assets/components/paper-input/paper-autogrow-textarea.html +8 -3
- data/app/assets/components/paper-input/paper-char-counter.html +121 -0
- data/app/assets/components/paper-input/paper-input-decorator.css +1 -21
- data/app/assets/components/paper-input/paper-input-decorator.html +130 -51
- data/app/assets/components/paper-input/paper-input.html +31 -5
- data/app/assets/components/paper-item/paper-item.html +1 -2
- data/app/assets/components/paper-progress/paper-progress.html +1 -1
- data/app/assets/components/paper-radio-button/paper-radio-button.css +16 -12
- data/app/assets/components/paper-radio-button/paper-radio-button.html +9 -3
- data/app/assets/components/paper-ripple/paper-ripple.html +2 -1
- data/app/assets/components/paper-shadow/paper-shadow.css +10 -10
- data/app/assets/components/paper-shadow/paper-shadow.html +8 -1
- data/app/assets/components/paper-slider/paper-slider.html +28 -4
- data/app/assets/components/paper-spinner/paper-spinner.css +35 -23
- data/app/assets/components/paper-spinner/paper-spinner.html +46 -5
- data/app/assets/components/paper-tabs/paper-tabs.css +5 -0
- data/app/assets/components/paper-tabs/paper-tabs.html +32 -7
- data/app/assets/components/paper-toggle-button/paper-toggle-button.css +58 -30
- data/app/assets/components/paper-toggle-button/paper-toggle-button.html +69 -44
- data/app/assets/components/sampler-scaffold/sampler-scaffold.css +1 -1
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +634 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +764 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4277 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +13 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +1728 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +11 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +6114 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +14 -0
- data/lib/polymer-paper-rails/version.rb +1 -1
- metadata +20 -71
- data/app/assets/components/core-dropdown/metadata.html +0 -62
- data/app/assets/components/core-icons/png-icons.html +0 -19
- data/app/assets/components/core-label/core-label.html +0 -124
- data/app/assets/components/core-overlay/tests/html/core-overlay-basic.html +0 -127
- data/app/assets/components/core-overlay/tests/html/core-overlay-positioning-margin.html +0 -153
- data/app/assets/components/core-overlay/tests/html/core-overlay-positioning.html +0 -167
- data/app/assets/components/core-overlay/tests/html/core-overlay-scroll.html +0 -130
- data/app/assets/components/core-overlay/tests/js/htmltests.js +0 -6
- data/app/assets/components/core-overlay/tests/runner.html +0 -14
- data/app/assets/components/core-overlay/tests/tests.json +0 -6
- data/app/assets/components/core-popup-menu/core-popup-menu.css +0 -28
- data/app/assets/components/core-popup-menu/core-popup-menu.html +0 -198
- data/app/assets/components/core-popup-menu/core-popup-overlay.html +0 -111
- data/app/assets/components/core-popup-menu/metadata.html +0 -62
- data/app/assets/components/paper-focusable/paper-focusable.html +0 -146
- data/app/assets/components/platform/platform.js +0 -16
- data/app/assets/components/web-animations-js/web-animations.js +0 -5529
- data/app/assets/components/web-animations-next/Gruntfile.js +0 -279
- data/app/assets/components/web-animations-next/History.md +0 -76
- data/app/assets/components/web-animations-next/package.json +0 -33
- data/app/assets/components/web-animations-next/src/animation-constructor.js +0 -139
- data/app/assets/components/web-animations-next/src/animation-node.js +0 -31
- data/app/assets/components/web-animations-next/src/animation.js +0 -65
- data/app/assets/components/web-animations-next/src/apply-preserving-inline-style.js +0 -192
- data/app/assets/components/web-animations-next/src/apply.js +0 -25
- data/app/assets/components/web-animations-next/src/box-handler.js +0 -57
- data/app/assets/components/web-animations-next/src/color-handler.js +0 -62
- data/app/assets/components/web-animations-next/src/deprecation.js +0 -42
- data/app/assets/components/web-animations-next/src/dev.js +0 -16
- data/app/assets/components/web-animations-next/src/dimension-handler.js +0 -167
- data/app/assets/components/web-animations-next/src/effect-callback.js +0 -86
- data/app/assets/components/web-animations-next/src/effect.js +0 -110
- data/app/assets/components/web-animations-next/src/element-animatable.js +0 -19
- data/app/assets/components/web-animations-next/src/font-weight-handler.js +0 -42
- data/app/assets/components/web-animations-next/src/group-constructors.js +0 -81
- data/app/assets/components/web-animations-next/src/handler-utils.js +0 -177
- data/app/assets/components/web-animations-next/src/interpolation.js +0 -49
- data/app/assets/components/web-animations-next/src/matrix-decomposition.js +0 -452
- data/app/assets/components/web-animations-next/src/matrix-interpolation.js +0 -130
- data/app/assets/components/web-animations-next/src/maxifill-player.js +0 -162
- data/app/assets/components/web-animations-next/src/normalize-keyframes.js +0 -259
- data/app/assets/components/web-animations-next/src/number-handler.js +0 -72
- data/app/assets/components/web-animations-next/src/player.js +0 -193
- data/app/assets/components/web-animations-next/src/position-handler.js +0 -117
- data/app/assets/components/web-animations-next/src/property-interpolation.js +0 -62
- data/app/assets/components/web-animations-next/src/property-names.js +0 -35
- data/app/assets/components/web-animations-next/src/scope.js +0 -20
- data/app/assets/components/web-animations-next/src/shadow-handler.js +0 -108
- data/app/assets/components/web-animations-next/src/shape-handler.js +0 -85
- data/app/assets/components/web-animations-next/src/tick.js +0 -148
- data/app/assets/components/web-animations-next/src/timeline.js +0 -77
- data/app/assets/components/web-animations-next/src/timing-utilities.js +0 -242
- data/app/assets/components/web-animations-next/src/transform-handler.js +0 -262
- data/app/assets/components/web-animations-next/src/visibility-handler.js +0 -29
- data/app/assets/components/web-animations-next/target-config.js +0 -124
- data/app/assets/components/web-animations-next/target-loader.js +0 -13
- data/app/assets/components/web-animations-next/templates/boilerplate +0 -13
- data/app/assets/components/web-animations-next/templates/runner.html +0 -26
- data/app/assets/components/web-animations-next/templates/web-animations.html +0 -18
- data/app/assets/components/web-animations-next/templates/web-animations.js +0 -21
- data/app/assets/components/web-animations-next/web-animations-next-lite.dev.html +0 -44
- data/app/assets/components/web-animations-next/web-animations-next-lite.dev.js +0 -21
- data/app/assets/components/web-animations-next/web-animations-next.dev.html +0 -49
- data/app/assets/components/web-animations-next/web-animations-next.dev.js +0 -21
- data/app/assets/components/web-animations-next/web-animations.dev.html +0 -44
- data/app/assets/components/web-animations-next/web-animations.dev.js +0 -21
- data/app/assets/components/web-animations-next/web-animations.html +0 -50
@@ -29,14 +29,21 @@ that it uses one color only.
|
|
29
29
|
|
30
30
|
<paper-spinner class="blue" active></paper-spinner>
|
31
31
|
|
32
|
+
Alt attribute should be set to provide adequate context for accessibility. If not provided,
|
33
|
+
it defaults to 'loading'.
|
34
|
+
Empty alt can be provided to mark the element as decorative if alternative content is provided
|
35
|
+
in another form (e.g. a text block following the spinner).
|
36
|
+
|
37
|
+
##### Example
|
38
|
+
<paper-spinner alt="Loading contacts list" active></paper-spinner>
|
39
|
+
|
32
40
|
@element paper-spinner
|
33
41
|
@blurb Element providing material design circular spinner.
|
34
42
|
@status alpha
|
35
43
|
@homepage http://polymerlabs.github.io/paper-spinner
|
36
44
|
-->
|
37
45
|
|
38
|
-
<polymer-element name="paper-spinner" attributes="active">
|
39
|
-
|
46
|
+
<polymer-element name="paper-spinner" attributes="active alt" role="progressbar">
|
40
47
|
<template>
|
41
48
|
<link rel="stylesheet" href="paper-spinner.css">
|
42
49
|
|
@@ -97,19 +104,53 @@ that it uses one color only.
|
|
97
104
|
* @type boolean
|
98
105
|
* @default false
|
99
106
|
*/
|
100
|
-
active: {value: false, reflect: true}
|
107
|
+
active: {value: false, reflect: true},
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Alternative text content for accessibility support.
|
111
|
+
* If alt is present, it will add an aria-label whose content matches alt when active.
|
112
|
+
* If alt is not present, it will default to 'loading' as the alt value.
|
113
|
+
* @attribute alt
|
114
|
+
* @type string
|
115
|
+
* @default 'loading'
|
116
|
+
*/
|
117
|
+
alt: {value: 'loading', reflect: true}
|
118
|
+
},
|
119
|
+
|
120
|
+
ready: function() {
|
121
|
+
// Allow user-provided `aria-label` take preference to any other text alternative.
|
122
|
+
if (this.hasAttribute('aria-label')) {
|
123
|
+
this.alt = this.getAttribute('aria-label');
|
124
|
+
} else {
|
125
|
+
this.setAttribute('aria-label', this.alt);
|
126
|
+
}
|
127
|
+
if (!this.active) {
|
128
|
+
this.setAttribute('aria-hidden', 'true');
|
129
|
+
}
|
101
130
|
},
|
102
131
|
|
103
132
|
activeChanged: function() {
|
104
133
|
if (this.active) {
|
134
|
+
this.$.spinnerContainer.classList.remove('cooldown');
|
105
135
|
this.$.spinnerContainer.classList.add('active');
|
136
|
+
this.removeAttribute('aria-hidden');
|
137
|
+
} else {
|
138
|
+
this.$.spinnerContainer.classList.add('cooldown');
|
139
|
+
this.setAttribute('aria-hidden', 'true');
|
140
|
+
}
|
141
|
+
},
|
142
|
+
|
143
|
+
altChanged: function() {
|
144
|
+
if (this.alt === '') {
|
145
|
+
this.setAttribute('aria-hidden', 'true');
|
106
146
|
} else {
|
107
|
-
this
|
147
|
+
this.removeAttribute('aria-hidden');
|
108
148
|
}
|
149
|
+
this.setAttribute('aria-label', this.alt);
|
109
150
|
},
|
110
151
|
|
111
152
|
reset: function() {
|
112
|
-
this.$.spinnerContainer.classList.remove('active', '
|
153
|
+
this.$.spinnerContainer.classList.remove('active', 'cooldown');
|
113
154
|
}
|
114
155
|
});
|
115
156
|
</script>
|
@@ -59,6 +59,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
59
59
|
transition: width, left;
|
60
60
|
}
|
61
61
|
|
62
|
+
#selectionBar.alignBottom {
|
63
|
+
top: 0;
|
64
|
+
bottom: auto;
|
65
|
+
}
|
66
|
+
|
62
67
|
#selectionBar.expand {
|
63
68
|
transition-duration: 0.15s;
|
64
69
|
transition-timing-function: cubic-bezier(0.4, 0.0, 1, 1);
|
@@ -34,7 +34,7 @@ between different views.
|
|
34
34
|
<paper-tab>Tab 3</paper-tab>
|
35
35
|
</paper-tabs>
|
36
36
|
|
37
|
-
<core-pages selected="{{selected}}>
|
37
|
+
<core-pages selected="{{selected}}">
|
38
38
|
<div>Page 1</div>
|
39
39
|
<div>Page 2</div>
|
40
40
|
<div>Page 3</div>
|
@@ -77,14 +77,16 @@ To change the ink ripple color:
|
|
77
77
|
@group Paper Elements
|
78
78
|
@element paper-tabs
|
79
79
|
@extends core-selector
|
80
|
+
@mixins Polymer.CoreResizable https://github.com/polymer/core-resizable
|
80
81
|
@homepage github.io
|
81
82
|
-->
|
82
83
|
|
83
84
|
<link rel="import" href="../core-selector/core-selector.html">
|
84
85
|
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
|
86
|
+
<link rel="import" href="../core-resizable/core-resizable.html">
|
85
87
|
<link rel="import" href="paper-tab.html">
|
86
88
|
|
87
|
-
<polymer-element name="paper-tabs" extends="core-selector" attributes="noink nobar noslide scrollable hideScrollButton" role="tablist" horizontal center layout>
|
89
|
+
<polymer-element name="paper-tabs" extends="core-selector" attributes="noink nobar noslide scrollable hideScrollButton alignBottom" role="tablist" horizontal center layout>
|
88
90
|
<template>
|
89
91
|
|
90
92
|
<link rel="stylesheet" href="paper-tabs.css">
|
@@ -97,7 +99,7 @@ To change the ink ripple color:
|
|
97
99
|
|
98
100
|
<div id="tabsContent" horizontal layout?="{{!scrollable}}">
|
99
101
|
<shadow></shadow>
|
100
|
-
<div id="selectionBar" hidden?="{{nobar}}" on-transitionend="{{barTransitionEnd}}"></div>
|
102
|
+
<div id="selectionBar" hidden?="{{nobar}}" class="{{ {alignBottom: alignBottom} | tokenList }}" on-transitionend="{{barTransitionEnd}}"></div>
|
101
103
|
</div>
|
102
104
|
|
103
105
|
</div>
|
@@ -109,7 +111,7 @@ To change the ink ripple color:
|
|
109
111
|
</template>
|
110
112
|
<script>
|
111
113
|
|
112
|
-
Polymer(
|
114
|
+
Polymer(Polymer.mixin({
|
113
115
|
|
114
116
|
/**
|
115
117
|
* If true, ink ripple effect is disabled.
|
@@ -165,6 +167,19 @@ To change the ink ripple color:
|
|
165
167
|
*/
|
166
168
|
hideScrollButton: false,
|
167
169
|
|
170
|
+
/**
|
171
|
+
* If true, the tabs are aligned to bottom (the selection bar appears at the top).
|
172
|
+
*
|
173
|
+
@attribute alignBottom
|
174
|
+
@type boolean
|
175
|
+
@default false
|
176
|
+
*/
|
177
|
+
alignBottom: false,
|
178
|
+
|
179
|
+
eventDelegates: {
|
180
|
+
'core-resize': 'resizeHandler'
|
181
|
+
},
|
182
|
+
|
168
183
|
activateEvent: 'tap',
|
169
184
|
|
170
185
|
step: 10,
|
@@ -179,13 +194,18 @@ To change the ink ripple color:
|
|
179
194
|
},
|
180
195
|
|
181
196
|
domReady: function() {
|
182
|
-
this.async('
|
197
|
+
this.async('resizeHandler');
|
183
198
|
this._tabsObserver.observe(this, {childList: true, subtree: true, characterData: true});
|
184
199
|
},
|
200
|
+
|
201
|
+
attached: function() {
|
202
|
+
this.resizableAttachedHandler();
|
203
|
+
},
|
185
204
|
|
186
205
|
detached: function() {
|
187
206
|
Polymer.removeEventListener(this.$.tabsContainer, 'trackx', this._trackxHandler);
|
188
207
|
this._tabsObserver.disconnect();
|
208
|
+
this.resizableDetachedHandler();
|
189
209
|
},
|
190
210
|
|
191
211
|
trackStart: function(e) {
|
@@ -207,6 +227,11 @@ To change the ink ripple color:
|
|
207
227
|
this.$.tabsContainer.scrollLeft = this._startx - e.dx;
|
208
228
|
},
|
209
229
|
|
230
|
+
resizeHandler: function() {
|
231
|
+
this.scroll();
|
232
|
+
this.updateBar();
|
233
|
+
},
|
234
|
+
|
210
235
|
scroll: function() {
|
211
236
|
if (!this.scrollable) {
|
212
237
|
return;
|
@@ -214,7 +239,7 @@ To change the ink ripple color:
|
|
214
239
|
var tc = this.$.tabsContainer;
|
215
240
|
var l = tc.scrollLeft;
|
216
241
|
this.leftHidden = l === 0;
|
217
|
-
this.rightHidden = l === (tc.scrollWidth - tc.clientWidth);
|
242
|
+
this.rightHidden = l === Math.max(0, (tc.scrollWidth - tc.clientWidth));
|
218
243
|
},
|
219
244
|
|
220
245
|
holdLeft: function() {
|
@@ -322,7 +347,7 @@ To change the ink ripple color:
|
|
322
347
|
}
|
323
348
|
}
|
324
349
|
|
325
|
-
});
|
350
|
+
}, Polymer.CoreResizable));
|
326
351
|
|
327
352
|
</script>
|
328
353
|
</polymer-element>
|
@@ -15,53 +15,81 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
15
15
|
outline: none;
|
16
16
|
}
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
/* Class selectors can be overridden by users. */
|
19
|
+
|
20
|
+
.toggle-bar {
|
21
|
+
background-color: #000000;
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
top: 8px;
|
27
|
-
left: 16px;
|
28
|
-
height: 1px;
|
29
|
-
width: 32px;
|
30
|
-
background-color: #5a5a5a;
|
31
|
-
pointer-events: none;
|
24
|
+
.toggle-button {
|
25
|
+
background-color: #f1f1f1;
|
32
26
|
}
|
33
27
|
|
34
|
-
|
28
|
+
[checked] .toggle {
|
35
29
|
background-color: #0f9d58;
|
36
30
|
}
|
37
31
|
|
38
|
-
|
39
|
-
|
32
|
+
.toggle-ink {
|
33
|
+
color: #bbb;
|
34
|
+
}
|
35
|
+
|
36
|
+
[checked] .toggle-ink {
|
37
|
+
color: #0f9d58;
|
38
|
+
}
|
39
|
+
|
40
|
+
/* ID selectors should not be overriden by users. */
|
41
|
+
|
42
|
+
#toggleContainer {
|
43
|
+
position: relative;
|
44
|
+
width: 36px;
|
45
|
+
height: 14px;
|
46
|
+
}
|
47
|
+
|
48
|
+
#toggleContainer[disabled] {
|
49
|
+
opacity: 0.3;
|
50
|
+
pointer-events: none;
|
40
51
|
}
|
41
52
|
|
42
|
-
#
|
53
|
+
#toggleBar {
|
43
54
|
position: absolute;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
55
|
+
height: 100%;
|
56
|
+
width: 100%;
|
57
|
+
border-radius: 8px;
|
58
|
+
pointer-events: none;
|
59
|
+
opacity: 0.26;
|
60
|
+
transition: background-color linear .08s;
|
49
61
|
}
|
50
62
|
|
51
|
-
|
52
|
-
|
53
|
-
transform: translate(48px, 0);
|
54
|
-
padding: 8px 0 8px 48px;
|
55
|
-
margin: -8px 0 -8px -48px;
|
63
|
+
[checked] #toggleBar {
|
64
|
+
opacity: 0.5;
|
56
65
|
}
|
57
66
|
|
58
|
-
#
|
67
|
+
#toggleButton {
|
68
|
+
position: absolute;
|
69
|
+
top: -3px;
|
70
|
+
height: 20px;
|
71
|
+
width: 20px;
|
72
|
+
border-radius: 50%;
|
73
|
+
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.4);
|
74
|
+
transition: -webkit-transform linear .08s, background-color linear .08s;
|
75
|
+
transition: transform linear .08s, background-color linear .08s;
|
76
|
+
}
|
77
|
+
|
78
|
+
#toggleButton.dragging {
|
59
79
|
-webkit-transition: none;
|
60
80
|
transition: none;
|
61
81
|
}
|
62
82
|
|
63
|
-
|
64
|
-
|
65
|
-
|
83
|
+
[checked] #toggleButton {
|
84
|
+
-webkit-transform: translate(16px, 0);
|
85
|
+
transform: translate(16px, 0);
|
86
|
+
}
|
87
|
+
|
88
|
+
#ink {
|
89
|
+
position: absolute;
|
90
|
+
top: -14px;
|
91
|
+
left: -14px;
|
92
|
+
width: 48px;
|
93
|
+
height: 48px;
|
66
94
|
pointer-events: none;
|
67
95
|
}
|
@@ -17,40 +17,38 @@ Example:
|
|
17
17
|
|
18
18
|
Styling toggle button:
|
19
19
|
|
20
|
-
To change the
|
20
|
+
To change the toggle color:
|
21
21
|
|
22
|
-
paper-toggle-button::shadow
|
23
|
-
color: #
|
22
|
+
paper-toggle-button::shadow .toggle {
|
23
|
+
background-color: #9c27b0;
|
24
24
|
}
|
25
|
+
|
26
|
+
To change the ink color:
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
paper-toggle-button::shadow paper-radio-button::shadow #onRadio {
|
29
|
-
background-color: #4285f4;
|
28
|
+
paper-toggle-button::shadow .toggle-ink {
|
29
|
+
color: #009688;
|
30
30
|
}
|
31
|
-
|
32
|
-
To change the bar color for checked state:
|
33
31
|
|
34
|
-
|
32
|
+
To change the checked toggle color:
|
33
|
+
|
34
|
+
paper-toggle-button::shadow [checked] .toggle {
|
35
35
|
background-color: #4285f4;
|
36
36
|
}
|
37
|
-
|
38
|
-
To change the ink color for unchecked state:
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
To change the radio unchecked color:
|
45
|
-
|
46
|
-
paper-toggle-button::shadow paper-radio-button::shadow #offRadio {
|
47
|
-
border-color: #b5b5b5;
|
38
|
+
To change the checked ink color:
|
39
|
+
|
40
|
+
paper-toggle-button::shadow [checked] .toggle-ink {
|
41
|
+
color: #4285f4;
|
48
42
|
}
|
49
43
|
|
50
|
-
To change the bar
|
44
|
+
To change the toggle bar and toggle button colors separately:
|
51
45
|
|
52
|
-
paper-toggle-button::shadow
|
53
|
-
background-color:
|
46
|
+
paper-toggle-button::shadow .toggle-bar {
|
47
|
+
background-color: #5677fc;
|
48
|
+
}
|
49
|
+
|
50
|
+
paper-toggle-button::shadow .toggle-button {
|
51
|
+
background-color: #9c27b0;
|
54
52
|
}
|
55
53
|
|
56
54
|
@group Paper Elements
|
@@ -59,19 +57,23 @@ To change the bar color for unchecked state:
|
|
59
57
|
-->
|
60
58
|
|
61
59
|
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
|
60
|
+
<link rel="import" href="../core-a11y-keys/core-a11y-keys.html">
|
62
61
|
|
63
62
|
<polymer-element name="paper-toggle-button" attributes="checked disabled" role="button" aria-pressed="false" tabindex="0">
|
64
63
|
<template>
|
65
64
|
|
66
65
|
<link rel="stylesheet" href="paper-toggle-button.css">
|
67
66
|
|
68
|
-
<
|
69
|
-
|
70
|
-
|
67
|
+
<core-a11y-keys target="{{}}" keys="space" on-keys-pressed="{{tap}}"></core-a11y-keys>
|
68
|
+
|
69
|
+
<div id="toggleContainer" checked?="{{checked}}" disabled?="{{disabled}}">
|
71
70
|
|
72
|
-
<
|
73
|
-
|
74
|
-
|
71
|
+
<div id="toggleBar" class="toggle toggle-bar"></div>
|
72
|
+
|
73
|
+
<div id="toggleButton" class="toggle toggle-button">
|
74
|
+
<paper-ripple id="ink" class="toggle-ink circle"></paper-ripple>
|
75
|
+
</div>
|
76
|
+
|
75
77
|
</div>
|
76
78
|
|
77
79
|
</template>
|
@@ -99,7 +101,7 @@ To change the bar color for unchecked state:
|
|
99
101
|
* @default false
|
100
102
|
*/
|
101
103
|
checked: false,
|
102
|
-
|
104
|
+
|
103
105
|
/**
|
104
106
|
* If true, the toggle button is disabled. A disabled toggle button cannot
|
105
107
|
* be tapped or dragged to change the checked state.
|
@@ -110,23 +112,55 @@ To change the bar color for unchecked state:
|
|
110
112
|
*/
|
111
113
|
disabled: false,
|
112
114
|
|
115
|
+
eventDelegates: {
|
116
|
+
down: 'downAction',
|
117
|
+
up: 'upAction',
|
118
|
+
tap: 'tap',
|
119
|
+
trackstart: 'trackStart',
|
120
|
+
trackx: 'trackx',
|
121
|
+
trackend: 'trackEnd'
|
122
|
+
},
|
123
|
+
|
124
|
+
downAction: function(e) {
|
125
|
+
var rect = this.$.ink.getBoundingClientRect();
|
126
|
+
this.$.ink.downAction({
|
127
|
+
x: rect.left + rect.width / 2,
|
128
|
+
y: rect.top + rect.height / 2
|
129
|
+
});
|
130
|
+
},
|
131
|
+
|
132
|
+
upAction: function(e) {
|
133
|
+
this.$.ink.upAction();
|
134
|
+
},
|
135
|
+
|
136
|
+
tap: function() {
|
137
|
+
if (this.disabled) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
this.checked = !this.checked;
|
141
|
+
this.fire('change');
|
142
|
+
},
|
143
|
+
|
113
144
|
trackStart: function(e) {
|
114
|
-
|
145
|
+
if (this.disabled) {
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
this._w = this.$.toggleBar.offsetWidth / 2;
|
115
149
|
e.preventTap();
|
116
150
|
},
|
117
151
|
|
118
152
|
trackx: function(e) {
|
119
153
|
this._x = Math.min(this._w,
|
120
154
|
Math.max(0, this.checked ? this._w + e.dx : e.dx));
|
121
|
-
this.$.
|
122
|
-
var s = this.$.
|
155
|
+
this.$.toggleButton.classList.add('dragging');
|
156
|
+
var s = this.$.toggleButton.style;
|
123
157
|
s.webkitTransform = s.transform = 'translate3d(' + this._x + 'px,0,0)';
|
124
158
|
},
|
125
159
|
|
126
160
|
trackEnd: function() {
|
127
|
-
var s = this.$.
|
161
|
+
var s = this.$.toggleButton.style;
|
128
162
|
s.transform = s.webkitTransform = '';
|
129
|
-
this.$.
|
163
|
+
this.$.toggleButton.classList.remove('dragging');
|
130
164
|
var old = this.checked;
|
131
165
|
this.checked = Math.abs(this._x) > this._w / 2;
|
132
166
|
if (this.checked !== old) {
|
@@ -137,15 +171,6 @@ To change the bar color for unchecked state:
|
|
137
171
|
checkedChanged: function() {
|
138
172
|
this.setAttribute('aria-pressed', Boolean(this.checked));
|
139
173
|
this.fire('core-change');
|
140
|
-
},
|
141
|
-
|
142
|
-
changeAction: function(e) {
|
143
|
-
e.stopPropagation();
|
144
|
-
this.fire('change');
|
145
|
-
},
|
146
|
-
|
147
|
-
stopPropagation: function(e) {
|
148
|
-
e.stopPropagation();
|
149
174
|
}
|
150
175
|
|
151
176
|
});
|