-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdropdown.html
272 lines (246 loc) · 12.1 KB
/
dropdown.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>dropdown</title>
<script type="module" src="https://js.arcgis.com/calcite-components/1.0.0-beta.91/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/1.0.0-beta.91/calcite.css" />
<style>
h1,
calcite-dropdown {
margin-bottom: 5rem;
}
h2 {
margin-bottom: 3rem;
}
body {
font-family: var(--calcite-sans-family);
font-size: var(--calcite-font-size-0);
color: var(--calcite-ui-text-1);
max-width: 1024px;
min-width: 280px;
width: 70vw;
padding: 0 var(--calcite-spacing-double);
margin: 0 auto;
background-color: var(--calcite-ui-background);
}
/* Theme Switcher */
#theme-label {
position: fixed;
top: 20px;
right: 20px;
z-index: 2;
background-color: var(--calcite-ui-background);
border: 1px solid;
border-color: var(--calcite-ui-border-1);
border-radius: var(--calcite-border-radius);
margin: 0;
padding: 10px;
}
#theme-label label {
margin: 0;
}
</style>
</head>
<body>
<main>
<!-- calcite-switch -->
<div id="theme-label">
<calcite-label layout="inline">
Toggle theme
<calcite-switch id="theme-switch"></calcite-switch>
</calcite-label>
</div>
<h1><code>dropdown</code></h1>
<h2>Test 1. Dropdown scale</h2>
<calcite-label>Small scale:</calcite-label>
<calcite-dropdown scale="s" width="s">
<calcite-button icon-end="hamburger" appearance="outline" slot="dropdown-trigger">Scale: small</calcite-button>
<calcite-dropdown-group group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<br>
<calcite-label>Medium scale:</calcite-label>
<calcite-dropdown scale="m" width="s">
<calcite-button icon-end="hamburger" appearance="outline" slot="dropdown-trigger">Scale: medium</calcite-button>
<calcite-dropdown-group group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<br>
<calcite-label>Large scale:</calcite-label>
<calcite-dropdown scale="l" width="s">
<calcite-button icon-end="hamburger" appearance="outline" slot="dropdown-trigger">Scale: large</calcite-button>
<calcite-dropdown-group group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h2>Test 2. Dropdown with disable close on select</h2>
<ol>
<li>Open the dropdown and select an item in the list.</li>
<li>Once an item is selected the dropdown will remain open, and additional selections can take place.</li>
</ol>
<br>
<calcite-dropdown disable-close-on-select>
<calcite-button icon-end="hamburger" appearance="outline" slot="dropdown-trigger">Disable close on select</calcite-button>
<calcite-dropdown-group selection-mode="multi" group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h2>Test 3. Disabled Dropdown</h2>
<calcite-dropdown disabled>
<calcite-button icon-end="hamburger" appearance="outline" slot="dropdown-trigger">Disabled</calcite-button>
<calcite-dropdown-group group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h2>Test 4. Dropdown with Max Items of 3 shown (remaining items are scrollable)</h2>
<calcite-dropdown max-items="3">
<calcite-button slot="dropdown-trigger" icon-end="hamburger">Max Items Shown</calcite-button>
<calcite-dropdown-group selection-mode="single" group-title="Location terrain">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h2>Test 5. Dropdown Selection Type</h2>
<h3>Single select dropdown</h3>
<calcite-dropdown>
<calcite-button slot="dropdown-trigger" icon-end="hamburger">Single select dropdown</calcite-button>
<calcite-dropdown-group selection-mode="single" group-title="Selection Mode: Single">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h3>Multi-select dropdown</h3>
<calcite-dropdown>
<calcite-button slot="dropdown-trigger" icon-end="hamburger">Multi-select dropdown</calcite-button>
<calcite-dropdown-group selection-mode="multi" group-title="Selection Mode: Multi">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item active>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h3>No select dropdown</h3>
<calcite-dropdown>
<calcite-button slot="dropdown-trigger" icon-end="hamburger">No select dropdown</calcite-button>
<calcite-dropdown-group selection-mode="none" group-title="Selection Mode: None">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h2>Test 6. Dropdown Triggers</h2>
<h3>Button triggered dropdown</h3>
<calcite-dropdown>
<calcite-button slot="dropdown-trigger">Button trigger</calcite-button>
<calcite-dropdown-group group-title="Button trigger">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h3>Action triggered dropdown</h3>
<calcite-dropdown>
<calcite-action slot="dropdown-trigger" text-enabled text="Action Trigger"></calcite-action>
<calcite-dropdown-group group-title="Action trigger">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h3>Link triggered dropdown</h3>
<calcite-dropdown>
<calcite-link slot="dropdown-trigger" appearance="solid">Link Trigger</calcite-link>
<calcite-dropdown-group group-title="Link trigger">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
<h3>Div triggered dropdown</h3>
<calcite-dropdown>
<div slot="dropdown-trigger" appearance="solid" tabindex="0">Div Trigger</div>
<calcite-dropdown-group group-title="Div trigger">
<calcite-dropdown-item>Grassland</calcite-dropdown-item>
<calcite-dropdown-item active>Forest</calcite-dropdown-item>
<calcite-dropdown-item>Trail</calcite-dropdown-item>
<calcite-dropdown-item>Park</calcite-dropdown-item>
<calcite-dropdown-item>Lake</calcite-dropdown-item>
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
<calcite-dropdown-item>River</calcite-dropdown-item>
</calcite-dropdown-group>
</calcite-dropdown>
</main>
</body>
<script>
window.onload = () => {
// Theme Switcher
const themeSwitch = document.getElementById("theme-switch");
themeSwitch.addEventListener("calciteSwitchChange", () => {
document.body.classList.toggle("calcite-theme-dark");
});
};
</script>
</html>