This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
demo.html
109 lines (84 loc) · 2.15 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!doctype html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>core-focusable</title>
<script src="../webcomponentsjs/webcomponents.js"></script>
<link href="core-focusable.html" rel="import">
<style shim-shadowdom>
body {
font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
font-size: 14px;
margin: 0;
padding: 24px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
section {
padding: 20px 0;
}
section > div {
padding: 14px;
font-size: 16px;
}
focusable-button {
display: inline-block;
padding: 0.5em 1em;
border-radius: 3px;
outline: none;
}
focusable-button[disabled] {
background: #e0e0e0;
}
focusable-button[active] {
background: #000;
color: #fff;
}
focusable-button[pressed] {
background: #ffb74d;
color: #000;
}
focusable-button[focused] {
border: 1px solid #4fc3f7;
}
</style>
</head>
<body unresolved>
<polymer-element name="focusable-button" tabindex="0">
<script>
(function() {
var p = {
eventDelegates: {
down: 'downAction',
up: 'upAction'
},
downAction: function() {
// call overriden event delegate
this._downAction();
console.log('down');
},
upAction: function() {
// call overriden event delegate
this._upAction();
console.log('up');
}
};
Polymer.mixin2(p, Polymer.CoreFocusable);
Polymer(p);
})();
</script>
</polymer-element>
<section>
<focusable-button>button</focusable-button>
<focusable-button toggle>toggle</focusable-button>
<focusable-button disabled>disabled</focusable-button>
</section>
</body>
</html>