-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
171 lines (158 loc) · 5.84 KB
/
index.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="combobox.css"/>
<style>
* {font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;}
main {font-weight: 300;}
.text-sm{font-size:10pt;}
.gray50 {color: #888;}
</style>
</head>
<body>
<h1>Combo Box</h1>
<main>
This is a standard combo-box widget written in _hyperscript.
Like the rest of the widgets in this library, special attention has been paid to accessibility issues, so you should be able to
navigate it using only your keyboard.
<br><br>
Native Select Widget:<br>
<select>
<option>All</option>
<option>Work</option>
<option>And</option>
<option>No</option>
<option>Play</option>
<option>Makes</option>
<option>Jack</option>
<option>A</option>
<option>Dull</option>
<option>Boy</option>
</select>
<span class="text-sm gray50">(for comparison)</span>
<br><br>
Combo Box Widget:<br>
<div script="install combobox" class="combobox" style="width:500px;">
<input type="text" name="someValue" value="Work">
<div class="open-button"><span style="transform:rotate(180deg) translateY(-2px); display:inline-block;">△</span></div>
<div role="menu" hidden="true">
<div>All</div>
<div>Work</div>
<div>And</div>
<div>No</div>
<div>Play</div>
<div>Makes</div>
<div>Jack</div>
<div>A</div>
<div>Dull</div>
<div>Boy</div>
<div>All</div>
<div>Work</div>
<div>And</div>
<div>No</div>
<div>Play</div>
<div>Makes</div>
<div>Jack</div>
<div>A</div>
<div>Dull</div>
<div>Boy</div>
<div>All</div>
<div>Work</div>
<div>And</div>
<div>No</div>
<div>Play</div>
<div>Makes</div>
<div>Jack</div>
<div>A</div>
<div>Dull</div>
<div>Boy</div>
<div>All</div>
<div>Work</div>
<div>And</div>
<div>No</div>
<div>Play</div>
<div>Makes</div>
<div>Jack</div>
<div>A</div>
<div>Dull</div>
<div>Boy</div>
</div>
</div>
<br><br>
Combo Box with Rich Values:<br>
<div script="install combobox" class="combobox" style="width:500px;">
<input type="text" name="someValue" value="Work">
<div class="open-button"><span style="display:inline-block;">⬇️</span></div>
<div role="menu" hidden="true">
<div value="Flamingo" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1497206365907-f5e630693df0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Flamingo</b></div>
<div class="text-sm gray50">Weird pink birds that stand on one foot.</div>
</div>
</div>
<div value="Panda" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1525382455947-f319bc05fb35?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Panda</b></div>
<div class="text-sm gray50">Destroy racism. Be like the Panda. He's Black. He's White. He's Asian.</div>
</div>
</div>
<div value="Cheetah" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1576222901803-c062b57925b4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Cheetah</b></div>
<div class="text-sm gray50">Spotted runner cats with crying eyes.</div>
</div>
</div>
<div value="Horse" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1573751056139-2ab65b6b03be?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Horse</b></div>
<div class="text-sm gray50">Just like a unicorn except no horn.</div>
</div>
</div>
<div value="Fox" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1604429868519-8a64cb3b010b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Fox</b></div>
<div class="text-sm gray50">Listen closely and you can hear what he says: "Hatti, hatti, hatti-ho."</div>
</div>
</div>
<div value="Zebra" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1501706362039-c06b2d715385?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Zeebra</b></div>
<div class="text-sm gray50">In Canada, they pronounce it "zed-bruh."</div>
</div>
</div>
<div value="Frog" style="display:flex; flex-direction:row;">
<div style="padding-right:10px">
<img src="https://images.unsplash.com/photo-1553558888-6440b4097908?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=150&q=80" style="height:75px; float:left;">
</div>
<div>
<div><b>Frog</b></div>
<div class="text-sm gray50">That's it. Just a frog.</div>
</div>
</div>
</div>
</div>
<br><br>
Another Input:<br>
<input> <span class="text-sm gray50">(to show tabs work)</span>
<script src="combobox._hs" type="text/hyperscript"></script>
<script src="https://unpkg.com/hyperscript.org"></script>
</body>
</html>