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
@@ -46,10 +46,12 @@ that represents a header by adding a `core-header` class to it.
|
|
46
46
|
|
47
47
|
@group Polymer Core Elements
|
48
48
|
@element core-scroll-header-panel
|
49
|
+
@mixins Polymer.CoreResizable https://github.com/polymer/core-resizable
|
49
50
|
@homepage github.io
|
50
51
|
-->
|
51
52
|
|
52
53
|
<link rel="import" href="../polymer/polymer.html">
|
54
|
+
<link rel="import" href="../core-resizable/core-resizable.html">
|
53
55
|
|
54
56
|
<polymer-element name="core-scroll-header-panel">
|
55
57
|
<template>
|
@@ -77,7 +79,7 @@ that represents a header by adding a `core-header` class to it.
|
|
77
79
|
<script>
|
78
80
|
(function() {
|
79
81
|
|
80
|
-
Polymer(
|
82
|
+
Polymer(Polymer.mixin({
|
81
83
|
|
82
84
|
/**
|
83
85
|
* Fired when the content has been scrolled.
|
@@ -184,7 +186,15 @@ that represents a header by adding a `core-header` class to it.
|
|
184
186
|
observe: {
|
185
187
|
'headerMargin fixed': 'setup'
|
186
188
|
},
|
187
|
-
|
189
|
+
|
190
|
+
eventDelegates: {
|
191
|
+
'core-resize': 'measureHeaderHeight'
|
192
|
+
},
|
193
|
+
|
194
|
+
attached: function() {
|
195
|
+
this.resizableAttachedHandler();
|
196
|
+
},
|
197
|
+
|
188
198
|
ready: function() {
|
189
199
|
this._scrollHandler = this.scroll.bind(this);
|
190
200
|
this.scroller.addEventListener('scroll', this._scrollHandler);
|
@@ -192,6 +202,7 @@ that represents a header by adding a `core-header` class to it.
|
|
192
202
|
|
193
203
|
detached: function() {
|
194
204
|
this.scroller.removeEventListener('scroll', this._scrollHandler);
|
205
|
+
this.resizableDetachedHandler();
|
195
206
|
},
|
196
207
|
|
197
208
|
domReady: function() {
|
@@ -330,7 +341,7 @@ that represents a header by adding a `core-header` class to it.
|
|
330
341
|
}
|
331
342
|
}
|
332
343
|
|
333
|
-
});
|
344
|
+
}, Polymer.CoreResizable));
|
334
345
|
|
335
346
|
//determine proper transform mechanizm
|
336
347
|
if (document.documentElement.style.transform !== undefined) {
|
@@ -12,7 +12,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
12
12
|
The `<core-selection>` element is used to manage selection state. It has no
|
13
13
|
visual appearance and is typically used in conjunction with another element.
|
14
14
|
For example, [core-selector](#core-selector)
|
15
|
-
|
15
|
+
uses a `<core-selection>` to manage selection.
|
16
16
|
|
17
17
|
To mark an item as selected, call the `select(item)` method on
|
18
18
|
`<core-selection>`. The item itself is an argument to this method.
|
@@ -130,7 +130,7 @@ Fired when an item element is tapped.
|
|
130
130
|
|
131
131
|
/**
|
132
132
|
* Specifies the CSS class to be used to add to the selected element.
|
133
|
-
*
|
133
|
+
*
|
134
134
|
* @attribute selectedClass
|
135
135
|
* @type string
|
136
136
|
* @default 'core-selected'
|
@@ -162,7 +162,7 @@ Fired when an item element is tapped.
|
|
162
162
|
* an array of selected elements.
|
163
163
|
* Note that you should not use this to set the selection. Instead use
|
164
164
|
* `selected`.
|
165
|
-
*
|
165
|
+
*
|
166
166
|
* @attribute selectedItem
|
167
167
|
* @type Object
|
168
168
|
* @default null
|
@@ -172,9 +172,9 @@ Fired when an item element is tapped.
|
|
172
172
|
/**
|
173
173
|
* In single selection, this returns the model associated with the
|
174
174
|
* selected element.
|
175
|
-
* Note that you should not use this to set the selection. Instead use
|
175
|
+
* Note that you should not use this to set the selection. Instead use
|
176
176
|
* `selected`.
|
177
|
-
*
|
177
|
+
*
|
178
178
|
* @attribute selectedModel
|
179
179
|
* @type Object
|
180
180
|
* @default null
|
@@ -193,7 +193,7 @@ Fired when an item element is tapped.
|
|
193
193
|
selectedIndex: -1,
|
194
194
|
|
195
195
|
/**
|
196
|
-
* Nodes with local name that are in the list will not be included
|
196
|
+
* Nodes with local name that are in the list will not be included
|
197
197
|
* in the selection items. In the following example, `items` returns four
|
198
198
|
* `core-item`'s and doesn't include `h3` and `hr`.
|
199
199
|
*
|
@@ -213,9 +213,9 @@ Fired when an item element is tapped.
|
|
213
213
|
excludedLocalNames: '',
|
214
214
|
|
215
215
|
/**
|
216
|
-
* The target element that contains items. If this is not set
|
216
|
+
* The target element that contains items. If this is not set
|
217
217
|
* core-selector is the container.
|
218
|
-
*
|
218
|
+
*
|
219
219
|
* @attribute target
|
220
220
|
* @type Object
|
221
221
|
* @default null
|
@@ -223,7 +223,7 @@ Fired when an item element is tapped.
|
|
223
223
|
target: null,
|
224
224
|
|
225
225
|
/**
|
226
|
-
* This can be used to query nodes from the target node to be used for
|
226
|
+
* This can be used to query nodes from the target node to be used for
|
227
227
|
* selection items. Note this only works if `target` is set
|
228
228
|
* and is not `core-selector` itself.
|
229
229
|
*
|
@@ -236,7 +236,7 @@ Fired when an item element is tapped.
|
|
236
236
|
* <label><input type="radio" name="color" value="blue"> Blue</label> <br>
|
237
237
|
* <p>color = {{color}}</p>
|
238
238
|
* </form>
|
239
|
-
*
|
239
|
+
*
|
240
240
|
* @attribute itemsSelector
|
241
241
|
* @type string
|
242
242
|
* @default ''
|
@@ -264,7 +264,7 @@ Fired when an item element is tapped.
|
|
264
264
|
notap: false,
|
265
265
|
|
266
266
|
defaultExcludedLocalNames: 'template',
|
267
|
-
|
267
|
+
|
268
268
|
observe: {
|
269
269
|
'selected multi': 'selectedChanged'
|
270
270
|
},
|
@@ -288,8 +288,8 @@ Fired when an item element is tapped.
|
|
288
288
|
if (!this.target) {
|
289
289
|
return [];
|
290
290
|
}
|
291
|
-
var nodes = this.target !== this ? (this.itemsSelector ?
|
292
|
-
this.target.querySelectorAll(this.itemsSelector) :
|
291
|
+
var nodes = this.target !== this ? (this.itemsSelector ?
|
292
|
+
this.target.querySelectorAll(this.itemsSelector) :
|
293
293
|
this.target.children) : this.$.items.getDistributedNodes();
|
294
294
|
return Array.prototype.filter.call(nodes, this.itemFilter);
|
295
295
|
},
|
@@ -332,7 +332,7 @@ Fired when an item element is tapped.
|
|
332
332
|
|
333
333
|
/**
|
334
334
|
* Returns the selected item(s). If the `multi` property is true,
|
335
|
-
* this will return an array, otherwise it will return
|
335
|
+
* this will return an array, otherwise it will return
|
336
336
|
* the selected item or undefined if there is no selection.
|
337
337
|
*/
|
338
338
|
get selection() {
|
@@ -348,7 +348,7 @@ Fired when an item element is tapped.
|
|
348
348
|
this.updateSelected();
|
349
349
|
}
|
350
350
|
},
|
351
|
-
|
351
|
+
|
352
352
|
updateSelected: function() {
|
353
353
|
this.validateSelected();
|
354
354
|
if (this.multi) {
|
@@ -363,7 +363,7 @@ Fired when an item element is tapped.
|
|
363
363
|
|
364
364
|
validateSelected: function() {
|
365
365
|
// convert to an array for multi-selection
|
366
|
-
if (this.multi && !Array.isArray(this.selected) &&
|
366
|
+
if (this.multi && !Array.isArray(this.selected) &&
|
367
367
|
this.selected != null) {
|
368
368
|
this.selected = [this.selected];
|
369
369
|
// use the first selected in the array for single-selection
|
@@ -373,7 +373,7 @@ Fired when an item element is tapped.
|
|
373
373
|
this.selected = s;
|
374
374
|
}
|
375
375
|
},
|
376
|
-
|
376
|
+
|
377
377
|
processSplices: function(splices) {
|
378
378
|
for (var i = 0, splice; splice = splices[i]; i++) {
|
379
379
|
for (var j = 0; j < splice.removed.length; j++) {
|
@@ -398,7 +398,7 @@ Fired when an item element is tapped.
|
|
398
398
|
var item = this.valueToItem(value);
|
399
399
|
this.$.selection.select(item);
|
400
400
|
},
|
401
|
-
|
401
|
+
|
402
402
|
setValueSelected: function(value, isSelected) {
|
403
403
|
var item = this.valueToItem(value);
|
404
404
|
if (isSelected ^ this.$.selection.isSelected(item)) {
|
@@ -417,12 +417,12 @@ Fired when an item element is tapped.
|
|
417
417
|
} else {
|
418
418
|
this.selectedModel = null;
|
419
419
|
}
|
420
|
-
this.selectedIndex = this.selectedItem ?
|
420
|
+
this.selectedIndex = this.selectedItem ?
|
421
421
|
parseInt(this.valueToIndex(this.selected)) : -1;
|
422
422
|
},
|
423
|
-
|
423
|
+
|
424
424
|
valueToItem: function(value) {
|
425
|
-
return (value === null || value === undefined) ?
|
425
|
+
return (value === null || value === undefined) ?
|
426
426
|
null : this.items[this.valueToIndex(value)];
|
427
427
|
},
|
428
428
|
|
@@ -506,7 +506,7 @@ Fired when an item element is tapped.
|
|
506
506
|
target = target.parentNode;
|
507
507
|
}
|
508
508
|
},
|
509
|
-
|
509
|
+
|
510
510
|
selectIndex: function(index) {
|
511
511
|
var item = this.items[index];
|
512
512
|
if (item) {
|
@@ -514,7 +514,7 @@ Fired when an item element is tapped.
|
|
514
514
|
return item;
|
515
515
|
}
|
516
516
|
},
|
517
|
-
|
517
|
+
|
518
518
|
/**
|
519
519
|
* Selects the previous item. This should be used in single selection only.
|
520
520
|
*
|
@@ -524,11 +524,11 @@ Fired when an item element is tapped.
|
|
524
524
|
* @returns the previous item or undefined if there is none
|
525
525
|
*/
|
526
526
|
selectPrevious: function(wrapped) {
|
527
|
-
var i = wrapped && !this.selectedIndex ?
|
527
|
+
var i = wrapped && !this.selectedIndex ?
|
528
528
|
this.items.length - 1 : this.selectedIndex - 1;
|
529
529
|
return this.selectIndex(i);
|
530
530
|
},
|
531
|
-
|
531
|
+
|
532
532
|
/**
|
533
533
|
* Selects the next item. This should be used in single selection only.
|
534
534
|
*
|
@@ -538,11 +538,11 @@ Fired when an item element is tapped.
|
|
538
538
|
* @returns the next item or undefined if there is none
|
539
539
|
*/
|
540
540
|
selectNext: function(wrapped) {
|
541
|
-
var i = wrapped && this.selectedIndex >= this.items.length - 1 ?
|
541
|
+
var i = wrapped && this.selectedIndex >= this.items.length - 1 ?
|
542
542
|
0 : this.selectedIndex + 1;
|
543
543
|
return this.selectIndex(i);
|
544
544
|
}
|
545
|
-
|
545
|
+
|
546
546
|
});
|
547
547
|
</script>
|
548
548
|
</polymer-element>
|
@@ -13,12 +13,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
13
13
|
`paper-button-base` is the base class for button-like elements with ripple and optional shadow.
|
14
14
|
|
15
15
|
@element paper-button-base
|
16
|
-
@mixins Polymer.CoreFocusable
|
16
|
+
@mixins Polymer.CoreFocusable https://github.com/polymer/core-focusable
|
17
17
|
@status unstable
|
18
18
|
-->
|
19
19
|
|
20
20
|
<link href="../polymer/polymer.html" rel="import">
|
21
21
|
<link href="../core-focusable/core-focusable.html" rel="import">
|
22
|
+
<link href="../paper-ripple/paper-ripple.html" rel="import">
|
22
23
|
|
23
24
|
<polymer-element name="paper-button-base" tabindex="0">
|
24
25
|
|
@@ -29,22 +30,48 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
29
30
|
var p = {
|
30
31
|
|
31
32
|
eventDelegates: {
|
32
|
-
down: 'downAction'
|
33
|
+
down: 'downAction',
|
34
|
+
up: 'upAction'
|
35
|
+
},
|
36
|
+
|
37
|
+
toggleBackground: function() {
|
38
|
+
if (this.active) {
|
39
|
+
|
40
|
+
if (!this.$.bg) {
|
41
|
+
var bg = document.createElement('div');
|
42
|
+
bg.setAttribute('id', 'bg');
|
43
|
+
bg.setAttribute('fit', '');
|
44
|
+
bg.style.opacity = 0.25;
|
45
|
+
this.$.bg = bg;
|
46
|
+
this.shadowRoot.insertBefore(bg, this.shadowRoot.firstChild);
|
47
|
+
}
|
48
|
+
this.$.bg.style.backgroundColor = getComputedStyle(this).color;
|
49
|
+
|
50
|
+
} else {
|
51
|
+
|
52
|
+
if (this.$.bg) {
|
53
|
+
this.$.bg.style.backgroundColor = '';
|
54
|
+
}
|
55
|
+
}
|
33
56
|
},
|
34
57
|
|
35
58
|
activeChanged: function() {
|
36
59
|
this.super();
|
37
60
|
|
38
|
-
if (this
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
61
|
+
if (this.toggle && (!this.lastEvent || this.matches(':host-context([noink])'))) {
|
62
|
+
this.toggleBackground();
|
63
|
+
}
|
64
|
+
},
|
65
|
+
|
66
|
+
pressedChanged: function() {
|
67
|
+
this.super();
|
68
|
+
|
69
|
+
if (!this.lastEvent) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
|
73
|
+
if (this.$.ripple && !this.hasAttribute('noink')) {
|
74
|
+
if (this.pressed) {
|
48
75
|
this.$.ripple.downAction(this.lastEvent);
|
49
76
|
} else {
|
50
77
|
this.$.ripple.upAction();
|
@@ -54,6 +81,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
54
81
|
this.adjustZ();
|
55
82
|
},
|
56
83
|
|
84
|
+
focusedChanged: function() {
|
85
|
+
this.adjustZ();
|
86
|
+
},
|
87
|
+
|
57
88
|
disabledChanged: function() {
|
58
89
|
this._disabledChanged();
|
59
90
|
this.adjustZ();
|
@@ -79,6 +110,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
79
110
|
this.$.shadow.setZ(2);
|
80
111
|
} else if (this.disabled) {
|
81
112
|
this.$.shadow.setZ(0);
|
113
|
+
} else if (this.focused) {
|
114
|
+
this.$.shadow.setZ(3);
|
82
115
|
} else {
|
83
116
|
this.$.shadow.setZ(1);
|
84
117
|
}
|
@@ -107,6 +140,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|
107
140
|
// No need to forward the event to the ripple because the ripple
|
108
141
|
// is triggered in activeChanged
|
109
142
|
}
|
143
|
+
},
|
144
|
+
|
145
|
+
upAction: function() {
|
146
|
+
this._upAction();
|
147
|
+
|
148
|
+
if (this.toggle) {
|
149
|
+
this.toggleBackground();
|
150
|
+
if (this.$.ripple) {
|
151
|
+
this.$.ripple.cancel();
|
152
|
+
}
|
153
|
+
}
|
110
154
|
}
|
111
155
|
|
112
156
|
};
|
@@ -30,8 +30,7 @@ create a button with an icon and some text:
|
|
30
30
|
custom button content
|
31
31
|
</paper-button>
|
32
32
|
|
33
|
-
Styling
|
34
|
-
-------
|
33
|
+
## Styling
|
35
34
|
|
36
35
|
Style the button with CSS as you would a normal DOM element.
|
37
36
|
|
@@ -57,8 +56,8 @@ The opacity of the ripple is not customizable via CSS.
|
|
57
56
|
-->
|
58
57
|
|
59
58
|
<link href="../polymer/polymer.html" rel="import">
|
60
|
-
<link href="../paper-ripple/paper-ripple.html" rel="import">
|
61
59
|
<link href="../paper-shadow/paper-shadow.html" rel="import">
|
60
|
+
<link href="../core-a11y-keys/core-a11y-keys.html" rel="import">
|
62
61
|
|
63
62
|
<link href="paper-button-base.html" rel="import">
|
64
63
|
|
@@ -100,7 +99,7 @@ role="button">
|
|
100
99
|
text-transform: inherit;
|
101
100
|
}
|
102
101
|
|
103
|
-
#shadow {
|
102
|
+
#bg, #shadow {
|
104
103
|
border-radius: inherit;
|
105
104
|
}
|
106
105
|
|
@@ -117,6 +116,7 @@ role="button">
|
|
117
116
|
::content > a {
|
118
117
|
height: 100%;
|
119
118
|
padding: 0.7em 0.57em;
|
119
|
+
margin: -0.7em -0.57em;
|
120
120
|
/* flex */
|
121
121
|
-ms-flex: 1 1 0.000000001px;
|
122
122
|
-webkit-flex: 1;
|
@@ -134,9 +134,10 @@ role="button">
|
|
134
134
|
<!-- this div is needed to position the ripple behind text content -->
|
135
135
|
<div class="button-content" relative layout horizontal center-center>
|
136
136
|
<content></content>
|
137
|
-
{{label}}
|
138
137
|
</div>
|
139
138
|
|
139
|
+
<core-a11y-keys keys="space enter" target="{{}}" on-keys-pressed="{{_activate}}"></core-a11y-keys>
|
140
|
+
|
140
141
|
</template>
|
141
142
|
|
142
143
|
<script>
|
@@ -173,6 +174,22 @@ role="button">
|
|
173
174
|
*/
|
174
175
|
fill: true
|
175
176
|
|
177
|
+
},
|
178
|
+
|
179
|
+
_activate: function() {
|
180
|
+
this.click();
|
181
|
+
this.fire('tap');
|
182
|
+
if (!this.pressed) {
|
183
|
+
var bcr = this.getBoundingClientRect();
|
184
|
+
var x = bcr.left + (bcr.width / 2);
|
185
|
+
var y = bcr.top + (bcr.height / 2);
|
186
|
+
this.downAction({x: x, y: y});
|
187
|
+
var fn = function fn() {
|
188
|
+
this.upAction();
|
189
|
+
this.removeEventListener('keyup', fn);
|
190
|
+
}.bind(this);
|
191
|
+
this.addEventListener('keyup', fn);
|
192
|
+
}
|
176
193
|
}
|
177
194
|
|
178
195
|
});
|