govuk_publishing_components 43.4.0 → 43.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/govuk_publishing_components/components/_radio.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +2 -30
- data/app/views/govuk_publishing_components/components/docs/radio.yml +15 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/CHANGELOG.md +398 -0
- data/node_modules/accessible-autocomplete/CODEOWNERS +2 -0
- data/node_modules/accessible-autocomplete/CONTRIBUTING.md +161 -0
- data/node_modules/accessible-autocomplete/LICENSE.txt +20 -0
- data/node_modules/accessible-autocomplete/Procfile +1 -0
- data/node_modules/accessible-autocomplete/README.md +490 -0
- data/node_modules/accessible-autocomplete/accessibility-criteria.md +43 -0
- data/node_modules/accessible-autocomplete/app.json +15 -0
- data/node_modules/accessible-autocomplete/babel.config.js +29 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css +3 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.css.map +1 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/accessible-autocomplete.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.preact.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js +2 -0
- data/node_modules/accessible-autocomplete/dist/lib/accessible-autocomplete.react.min.js.map +1 -0
- data/node_modules/accessible-autocomplete/examples/ajax-source.html +300 -0
- data/node_modules/accessible-autocomplete/examples/form-single.html +381 -0
- data/node_modules/accessible-autocomplete/examples/form.html +673 -0
- data/node_modules/accessible-autocomplete/examples/index.html +693 -0
- data/node_modules/accessible-autocomplete/examples/preact/index.html +346 -0
- data/node_modules/accessible-autocomplete/examples/react/index.html +347 -0
- data/node_modules/accessible-autocomplete/examples/suggestions.json +258 -0
- data/node_modules/accessible-autocomplete/package.json +93 -0
- data/node_modules/accessible-autocomplete/postcss.config.js +16 -0
- data/node_modules/accessible-autocomplete/preact.js +1 -0
- data/node_modules/accessible-autocomplete/react.js +1 -0
- data/node_modules/accessible-autocomplete/scripts/check-staged.mjs +16 -0
- data/node_modules/accessible-autocomplete/src/autocomplete.css +167 -0
- data/node_modules/accessible-autocomplete/src/autocomplete.js +610 -0
- data/node_modules/accessible-autocomplete/src/dropdown-arrow-down.js +11 -0
- data/node_modules/accessible-autocomplete/src/status.js +125 -0
- data/node_modules/accessible-autocomplete/src/wrapper.js +60 -0
- data/node_modules/accessible-autocomplete/test/functional/dropdown-arrow-down.js +46 -0
- data/node_modules/accessible-autocomplete/test/functional/index.js +809 -0
- data/node_modules/accessible-autocomplete/test/functional/wrapper.js +339 -0
- data/node_modules/accessible-autocomplete/test/integration/index.js +309 -0
- data/node_modules/accessible-autocomplete/test/karma.config.js +46 -0
- data/node_modules/accessible-autocomplete/test/wdio.config.js +123 -0
- data/node_modules/accessible-autocomplete/webpack.config.mjs +244 -0
- metadata +57 -2
@@ -0,0 +1,693 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
<title>Accessible Autocomplete examples</title>
|
7
|
+
<style>
|
8
|
+
/* Example page specific styling. */
|
9
|
+
html {
|
10
|
+
color: #111;
|
11
|
+
background: #FFF;
|
12
|
+
font-family: -apple-system, BlinkMacSystemFont, 'avenir next', avenir, 'helvetica neue', helvetica, ubuntu, roboto, noto, 'segoe ui', arial, sans-serif;
|
13
|
+
font-size: 16px;
|
14
|
+
line-height: 1.5;
|
15
|
+
}
|
16
|
+
|
17
|
+
body {
|
18
|
+
padding-left: 1rem;
|
19
|
+
padding-right: 1rem;
|
20
|
+
}
|
21
|
+
|
22
|
+
h1, h2, h3, h4, h5, h6 {
|
23
|
+
line-height: normal;
|
24
|
+
}
|
25
|
+
|
26
|
+
label {
|
27
|
+
display: block;
|
28
|
+
margin-bottom: .5rem;
|
29
|
+
}
|
30
|
+
|
31
|
+
code {
|
32
|
+
padding-left: .5em;
|
33
|
+
padding-right: .5em;
|
34
|
+
background: #EFEFEF;
|
35
|
+
font-weight: normal;
|
36
|
+
font-family: monospace;
|
37
|
+
}
|
38
|
+
|
39
|
+
main {
|
40
|
+
max-width: 40em;
|
41
|
+
margin-left: auto;
|
42
|
+
margin-right: auto;
|
43
|
+
}
|
44
|
+
|
45
|
+
.autocomplete-wrapper {
|
46
|
+
max-width: 20em;
|
47
|
+
margin-bottom: 4rem;
|
48
|
+
}
|
49
|
+
|
50
|
+
/* Custom classes for the `XYZClasses` props with visual changes to see their effect without inspecting */
|
51
|
+
.app-input {
|
52
|
+
/* Adjust the font to check that both hint and input get the class by default,
|
53
|
+
to ensure the hint suggestion exactly aligns with the typed input text */
|
54
|
+
font-family: serif;
|
55
|
+
}
|
56
|
+
|
57
|
+
.app-hint {
|
58
|
+
box-shadow: inset 0 0 0 5px #44952e;
|
59
|
+
}
|
60
|
+
|
61
|
+
.custom-menu-class {
|
62
|
+
box-shadow: 0 3px 0 0 #fd0, 3px 3px 0 0 #fd0, -3px 3px 0 0 #fd0;
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
<link rel="stylesheet" href="../dist/accessible-autocomplete.min.css">
|
66
|
+
</head>
|
67
|
+
<body>
|
68
|
+
<main>
|
69
|
+
<h1>Accessible Autocomplete examples</h1>
|
70
|
+
|
71
|
+
<p><a href="form.html">Example in a real HTML form that you can submit</a></p>
|
72
|
+
|
73
|
+
<h2>Options</h2>
|
74
|
+
|
75
|
+
<h3><code>{ element, id, source }</code></h3>
|
76
|
+
<p>This illustrates usage with only the required arguments.</p>
|
77
|
+
<label for="autocomplete-default">Country</label>
|
78
|
+
<div id="tt-default" class="autocomplete-wrapper"></div>
|
79
|
+
|
80
|
+
<h3><code>{ minLength: 2 }</code></h3>
|
81
|
+
<p>
|
82
|
+
This option will prevent displaying suggestions if less than 2 characters are
|
83
|
+
typed in.
|
84
|
+
</p>
|
85
|
+
<label for="autocomplete-minLength">Country</label>
|
86
|
+
<div id="tt-minLength" class="autocomplete-wrapper"></div>
|
87
|
+
|
88
|
+
<h3><code>{ displayMenu: 'overlay' }</code></h3>
|
89
|
+
<p>This option will display the menu as an absolutely positioned overlay.</p>
|
90
|
+
<label for="autocomplete-overlay">Country</label>
|
91
|
+
<div id="tt-overlay" class="autocomplete-wrapper"></div>
|
92
|
+
|
93
|
+
<h3><code>{ autoselect: true }</code></h3>
|
94
|
+
<p>This option will automatically select the first suggestion.</p>
|
95
|
+
<label for="autocomplete-autoselect">Country</label>
|
96
|
+
<div id="tt-autoselect" class="autocomplete-wrapper"></div>
|
97
|
+
|
98
|
+
<h3><code>{ defaultValue: 'Germany' }</code></h3>
|
99
|
+
<p>This option will prefill the input with a value.</p>
|
100
|
+
<label for="autocomplete-defaultValue">Country</label>
|
101
|
+
<div id="tt-defaultValue" class="autocomplete-wrapper"></div>
|
102
|
+
|
103
|
+
<h3><code>{ confirmOnBlur: false }</code></h3>
|
104
|
+
<p>
|
105
|
+
This option will toggle automatically confirming a selection on blur. In the other
|
106
|
+
examples, if you select an option using the arrow keys and then click out, it will
|
107
|
+
confirm the selection.
|
108
|
+
</p>
|
109
|
+
<label for="autocomplete-confirmOnBlur">Country</label>
|
110
|
+
<div id="tt-confirmOnBlur" class="autocomplete-wrapper"></div>
|
111
|
+
|
112
|
+
<h3><code>{ placeholder: 'Search for a country' }</code></h3>
|
113
|
+
<p>This option will populate the placeholder attribute on the input element.</p>
|
114
|
+
<label for="autocomplete-placeholder">Country</label>
|
115
|
+
<div id="tt-placeholder" class="autocomplete-wrapper"></div>
|
116
|
+
|
117
|
+
<h3><code>{ showNoOptionsFound: false }</code></h3>
|
118
|
+
<p>This option will toggle displaying the "No results found" message.</p>
|
119
|
+
<label for="autocomplete-showNoOptionsFound">Country</label>
|
120
|
+
<div id="tt-showNoOptionsFound" class="autocomplete-wrapper"></div>
|
121
|
+
|
122
|
+
<h3><code>{ showAllValues: true }</code></h3>
|
123
|
+
<p>
|
124
|
+
This option will toggle showing all values when the input is clicked, like a
|
125
|
+
default dropdown.
|
126
|
+
</p>
|
127
|
+
<label for="autocomplete-showAllValues">Country</label>
|
128
|
+
<div id="tt-showAllValues" class="autocomplete-wrapper"></div>
|
129
|
+
|
130
|
+
<h3><code>{ showAllValues: true, dropdownArrow: () => '' }</code></h3>
|
131
|
+
<p>
|
132
|
+
When <code>showAllValues</code> is <code>true</code> a dropdown arrow
|
133
|
+
will be displayed. It can be customized using a function that receives a
|
134
|
+
`{ className: string }` object and returns a string or (P)React component.
|
135
|
+
</p>
|
136
|
+
<label for="autocomplete-customDropdownArrow">Country</label>
|
137
|
+
<div id="tt-customDropdownArrow" class="autocomplete-wrapper"></div>
|
138
|
+
|
139
|
+
<h3><code>{ inputClasses: 'app-input'}</code></h3>
|
140
|
+
<p>
|
141
|
+
The classes provided in <code>inputClasses</code> are added to
|
142
|
+
the component's <code><input></code>.
|
143
|
+
</p>
|
144
|
+
<label for="autocomplete-inputClasses">Country</label>
|
145
|
+
<div id="tt-inputClasses" class="autocomplete-wrapper"></div>
|
146
|
+
|
147
|
+
<h3><code>{ hintClasses: 'app-hint'}</code></h3>
|
148
|
+
<p>
|
149
|
+
The classes provided in <code>hintClasses</code> are added to
|
150
|
+
the component's hint that appears when the value matches the start of a suggestion.
|
151
|
+
</p>
|
152
|
+
<label for="autocomplete-hintClasses">Country</label>
|
153
|
+
<div id="tt-hintClasses" class="autocomplete-wrapper"></div>
|
154
|
+
|
155
|
+
<h3><code>{ menuClasses: 'custom-menu-class'}</code></h3>
|
156
|
+
<p>
|
157
|
+
The classes provided in <code>menuClasses</code> are added to
|
158
|
+
the menu displaying the suggestions.
|
159
|
+
</p>
|
160
|
+
<label for="autocomplete-menuClasses">Country</label>
|
161
|
+
<div id="tt-menuClasses" class="autocomplete-wrapper"></div>
|
162
|
+
|
163
|
+
<h2>Advanced features</h2>
|
164
|
+
|
165
|
+
<h3>Progressive enhancement</h3>
|
166
|
+
<p>
|
167
|
+
This example demonstrates how to turn a server-rendered <code><select></code> element
|
168
|
+
into a autocomplete. Turn off JavaScript to see the <code><select></code> element.
|
169
|
+
</p>
|
170
|
+
<p>Uses <code>accessibleAutocomplete.enhanceSelectElement</code>.</p>
|
171
|
+
<label for="autocomplete-progressiveEnhancement">Country</label>
|
172
|
+
<div class="autocomplete-wrapper">
|
173
|
+
<select id="autocomplete-progressiveEnhancement">
|
174
|
+
<option value="fr">France</option>
|
175
|
+
<option value="de">Germany</option>
|
176
|
+
<option value="gb" selected>United Kingdom</option>
|
177
|
+
</select>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<h3>Custom results</h3>
|
181
|
+
<p>
|
182
|
+
<p>This example demonstrates how to allow users to search for a country by either:</p>
|
183
|
+
<ul>
|
184
|
+
<li>its English name</li>
|
185
|
+
<li>the name by which a group of people refer to their country</li>
|
186
|
+
</ul>
|
187
|
+
<p>The suggestions are user-defined objects and they are displayed using a user-defined template. Confirming a suggestion will populate the input with the English country name.</p>
|
188
|
+
</p>
|
189
|
+
<p>Uses the <code>{ templates: { inputValue, suggestion } }</code> options.</p>
|
190
|
+
<label for="autocomplete-customTemplates">Country</label>
|
191
|
+
<div id="tt-customTemplates" class="autocomplete-wrapper"></div>
|
192
|
+
|
193
|
+
<h3>Translating texts</h3>
|
194
|
+
<p>
|
195
|
+
This example demonstrates how to translate the texts emitted by the component.
|
196
|
+
</p>
|
197
|
+
<p>Uses the <code>{ tStatusQueryTooShort: (minQueryLength) => '',
|
198
|
+
tStatusNoResults: () => '',
|
199
|
+
tStatusSelectedOption: (selectedOption, length) => '',
|
200
|
+
tStatusResults: () => '' }</code> options.</p>
|
201
|
+
<label for="autocomplete-i18n">Country</label>
|
202
|
+
<div id="tt-i18n" class="autocomplete-wrapper"></div>
|
203
|
+
</main>
|
204
|
+
|
205
|
+
<script type="text/javascript" src="../dist/accessible-autocomplete.min.js"></script>
|
206
|
+
<script type="text/javascript">
|
207
|
+
var countries = [
|
208
|
+
'Afghanistan',
|
209
|
+
'Akrotiri',
|
210
|
+
'Albania',
|
211
|
+
'Algeria',
|
212
|
+
'American Samoa',
|
213
|
+
'Andorra',
|
214
|
+
'Angola',
|
215
|
+
'Anguilla',
|
216
|
+
'Antarctica',
|
217
|
+
'Antigua and Barbuda',
|
218
|
+
'Argentina',
|
219
|
+
'Armenia',
|
220
|
+
'Aruba',
|
221
|
+
'Ashmore and Cartier Islands',
|
222
|
+
'Australia',
|
223
|
+
'Austria',
|
224
|
+
'Azerbaijan',
|
225
|
+
'Bahamas, The',
|
226
|
+
'Bahrain',
|
227
|
+
'Bangladesh',
|
228
|
+
'Barbados',
|
229
|
+
'Bassas da India',
|
230
|
+
'Belarus',
|
231
|
+
'Belgium',
|
232
|
+
'Belize',
|
233
|
+
'Benin',
|
234
|
+
'Bermuda',
|
235
|
+
'Bhutan',
|
236
|
+
'Bolivia',
|
237
|
+
'Bosnia and Herzegovina',
|
238
|
+
'Botswana',
|
239
|
+
'Bouvet Island',
|
240
|
+
'Brazil',
|
241
|
+
'British Indian Ocean Territory',
|
242
|
+
'British Virgin Islands',
|
243
|
+
'Brunei',
|
244
|
+
'Bulgaria',
|
245
|
+
'Burkina Faso',
|
246
|
+
'Burma',
|
247
|
+
'Burundi',
|
248
|
+
'Cambodia',
|
249
|
+
'Cameroon',
|
250
|
+
'Canada',
|
251
|
+
'Cape Verde',
|
252
|
+
'Cayman Islands',
|
253
|
+
'Central African Republic',
|
254
|
+
'Chad',
|
255
|
+
'Chile',
|
256
|
+
'China',
|
257
|
+
'Christmas Island',
|
258
|
+
'Clipperton Island',
|
259
|
+
'Cocos (Keeling) Islands',
|
260
|
+
'Colombia',
|
261
|
+
'Comoros',
|
262
|
+
'Congo',
|
263
|
+
'Cook Islands',
|
264
|
+
'Coral Sea Islands',
|
265
|
+
'Costa Rica',
|
266
|
+
'Cote d\'Ivoire',
|
267
|
+
'Croatia',
|
268
|
+
'Cuba',
|
269
|
+
'Cyprus',
|
270
|
+
'Czech Republic',
|
271
|
+
'Denmark',
|
272
|
+
'Dhekelia',
|
273
|
+
'Djibouti',
|
274
|
+
'Dominica',
|
275
|
+
'Dominican Republic',
|
276
|
+
'Ecuador',
|
277
|
+
'Egypt',
|
278
|
+
'El Salvador',
|
279
|
+
'Equatorial Guinea',
|
280
|
+
'Eritrea',
|
281
|
+
'Estonia',
|
282
|
+
'Ethiopia',
|
283
|
+
'Europa Island',
|
284
|
+
'Falkland Islands',
|
285
|
+
'Faroe Islands',
|
286
|
+
'Fiji',
|
287
|
+
'Finland',
|
288
|
+
'France',
|
289
|
+
'French Guiana',
|
290
|
+
'French Polynesia',
|
291
|
+
'French Southern and Antarctic Lands',
|
292
|
+
'Gabon',
|
293
|
+
'Gambia,',
|
294
|
+
'Gaza Strip',
|
295
|
+
'Georgia',
|
296
|
+
'Germany',
|
297
|
+
'Ghana',
|
298
|
+
'Gibraltar',
|
299
|
+
'Glorioso Islands',
|
300
|
+
'Greece',
|
301
|
+
'Greenland',
|
302
|
+
'Grenada',
|
303
|
+
'Guadeloupe',
|
304
|
+
'Guam',
|
305
|
+
'Guatemala',
|
306
|
+
'Guernsey',
|
307
|
+
'Guinea',
|
308
|
+
'Guinea-Bissau',
|
309
|
+
'Guyana',
|
310
|
+
'Haiti',
|
311
|
+
'Heard Island and McDonald Islands',
|
312
|
+
'Holy See (Vatican City)',
|
313
|
+
'Honduras',
|
314
|
+
'Hong Kong',
|
315
|
+
'Hungary',
|
316
|
+
'Iceland',
|
317
|
+
'India',
|
318
|
+
'Indonesia',
|
319
|
+
'Iran',
|
320
|
+
'Iraq',
|
321
|
+
'Ireland',
|
322
|
+
'Isle of Man',
|
323
|
+
'Israel',
|
324
|
+
'Italy',
|
325
|
+
'Jamaica',
|
326
|
+
'Jan Mayen',
|
327
|
+
'Japan',
|
328
|
+
'Jersey',
|
329
|
+
'Jordan',
|
330
|
+
'Juan de Nova Island',
|
331
|
+
'Kazakhstan',
|
332
|
+
'Kenya',
|
333
|
+
'Kiribati',
|
334
|
+
'Korea, North',
|
335
|
+
'Korea, South',
|
336
|
+
'Kuwait',
|
337
|
+
'Kyrgyzstan',
|
338
|
+
'Laos',
|
339
|
+
'Latvia',
|
340
|
+
'Lebanon',
|
341
|
+
'Lesotho',
|
342
|
+
'Liberia',
|
343
|
+
'Libya',
|
344
|
+
'Liechtenstein',
|
345
|
+
'Lithuania',
|
346
|
+
'Luxembourg',
|
347
|
+
'Macau',
|
348
|
+
'Macedonia',
|
349
|
+
'Madagascar',
|
350
|
+
'Malawi',
|
351
|
+
'Malaysia',
|
352
|
+
'Maldives',
|
353
|
+
'Mali',
|
354
|
+
'Malta',
|
355
|
+
'Marshall Islands',
|
356
|
+
'Martinique',
|
357
|
+
'Mauritania',
|
358
|
+
'Mauritius',
|
359
|
+
'Mayotte',
|
360
|
+
'Mexico',
|
361
|
+
'Micronesia, Federated States of',
|
362
|
+
'Moldova',
|
363
|
+
'Monaco',
|
364
|
+
'Mongolia',
|
365
|
+
'Montserrat',
|
366
|
+
'Morocco',
|
367
|
+
'Mozambique',
|
368
|
+
'Namibia',
|
369
|
+
'Nauru',
|
370
|
+
'Navassa Island',
|
371
|
+
'Nepal',
|
372
|
+
'Netherlands',
|
373
|
+
'Netherlands Antilles',
|
374
|
+
'New Caledonia',
|
375
|
+
'New Zealand',
|
376
|
+
'Nicaragua',
|
377
|
+
'Niger',
|
378
|
+
'Nigeria',
|
379
|
+
'Niue',
|
380
|
+
'Norfolk Island',
|
381
|
+
'Northern Mariana Islands',
|
382
|
+
'Norway',
|
383
|
+
'Oman',
|
384
|
+
'Pakistan',
|
385
|
+
'Palau',
|
386
|
+
'Panama',
|
387
|
+
'Papua New Guinea',
|
388
|
+
'Paracel Islands',
|
389
|
+
'Paraguay',
|
390
|
+
'Peru',
|
391
|
+
'Philippines',
|
392
|
+
'Pitcairn Islands',
|
393
|
+
'Poland',
|
394
|
+
'Portugal',
|
395
|
+
'Puerto Rico',
|
396
|
+
'Qatar',
|
397
|
+
'Reunion',
|
398
|
+
'Romania',
|
399
|
+
'Russia',
|
400
|
+
'Rwanda',
|
401
|
+
'Saint Helena',
|
402
|
+
'Saint Kitts and Nevis',
|
403
|
+
'Saint Lucia',
|
404
|
+
'Saint Pierre and Miquelon',
|
405
|
+
'Saint Vincent and the Grenadines',
|
406
|
+
'Samoa',
|
407
|
+
'San Marino',
|
408
|
+
'Sao Tome and Principe',
|
409
|
+
'Saudi Arabia',
|
410
|
+
'Senegal',
|
411
|
+
'Serbia and Montenegro',
|
412
|
+
'Seychelles',
|
413
|
+
'Sierra Leone',
|
414
|
+
'Singapore',
|
415
|
+
'Slovakia',
|
416
|
+
'Slovenia',
|
417
|
+
'Solomon Islands',
|
418
|
+
'Somalia',
|
419
|
+
'South Africa',
|
420
|
+
'South Georgia and the South Sandwich Islands',
|
421
|
+
'Spain',
|
422
|
+
'Spratly Islands',
|
423
|
+
'Sri Lanka',
|
424
|
+
'Sudan',
|
425
|
+
'Suriname',
|
426
|
+
'Svalbard',
|
427
|
+
'Swaziland',
|
428
|
+
'Sweden',
|
429
|
+
'Switzerland',
|
430
|
+
'Syria',
|
431
|
+
'Taiwan',
|
432
|
+
'Tajikistan',
|
433
|
+
'Tanzania',
|
434
|
+
'Thailand',
|
435
|
+
'Timor-Leste',
|
436
|
+
'Togo',
|
437
|
+
'Tokelau',
|
438
|
+
'Tonga',
|
439
|
+
'Trinidad and Tobago',
|
440
|
+
'Tromelin Island',
|
441
|
+
'Tunisia',
|
442
|
+
'Turkey',
|
443
|
+
'Turkmenistan',
|
444
|
+
'Turks and Caicos Islands',
|
445
|
+
'Tuvalu',
|
446
|
+
'Uganda',
|
447
|
+
'Ukraine',
|
448
|
+
'United Arab Emirates',
|
449
|
+
'United Kingdom',
|
450
|
+
'United States',
|
451
|
+
'Uruguay',
|
452
|
+
'Uzbekistan',
|
453
|
+
'Vanuatu',
|
454
|
+
'Venezuela',
|
455
|
+
'Vietnam',
|
456
|
+
'Virgin Islands',
|
457
|
+
'Wake Island',
|
458
|
+
'Wallis and Futuna',
|
459
|
+
'West Bank',
|
460
|
+
'Western Sahara',
|
461
|
+
'Yemen',
|
462
|
+
'Zambia',
|
463
|
+
'Zimbabwe'
|
464
|
+
]
|
465
|
+
</script>
|
466
|
+
|
467
|
+
<script type="text/javascript">
|
468
|
+
var element = document.querySelector('#tt-default')
|
469
|
+
var id = 'autocomplete-default'
|
470
|
+
accessibleAutocomplete({
|
471
|
+
element: element,
|
472
|
+
id: id,
|
473
|
+
source: countries
|
474
|
+
})
|
475
|
+
</script>
|
476
|
+
|
477
|
+
<script type="text/javascript">
|
478
|
+
element = document.querySelector('#tt-minLength')
|
479
|
+
id = 'autocomplete-minLength'
|
480
|
+
accessibleAutocomplete({
|
481
|
+
element: element,
|
482
|
+
id: id,
|
483
|
+
minLength: 2,
|
484
|
+
source: countries
|
485
|
+
})
|
486
|
+
</script>
|
487
|
+
|
488
|
+
<script type="text/javascript">
|
489
|
+
element = document.querySelector('#tt-autoselect')
|
490
|
+
id = 'autocomplete-autoselect'
|
491
|
+
accessibleAutocomplete({
|
492
|
+
autoselect: true,
|
493
|
+
element: element,
|
494
|
+
id: id,
|
495
|
+
source: countries
|
496
|
+
})
|
497
|
+
</script>
|
498
|
+
|
499
|
+
<script type="text/javascript">
|
500
|
+
element = document.querySelector('#tt-overlay')
|
501
|
+
id = 'autocomplete-overlay'
|
502
|
+
accessibleAutocomplete({
|
503
|
+
displayMenu: 'overlay',
|
504
|
+
element: element,
|
505
|
+
id: id,
|
506
|
+
source: countries
|
507
|
+
})
|
508
|
+
</script>
|
509
|
+
|
510
|
+
<script type="text/javascript">
|
511
|
+
element = document.querySelector('#tt-defaultValue')
|
512
|
+
id = 'autocomplete-defaultValue'
|
513
|
+
accessibleAutocomplete({
|
514
|
+
defaultValue: 'Germany',
|
515
|
+
element: element,
|
516
|
+
id: id,
|
517
|
+
source: countries
|
518
|
+
})
|
519
|
+
</script>
|
520
|
+
|
521
|
+
<script type="text/javascript">
|
522
|
+
element = document.querySelector('#tt-inputClasses')
|
523
|
+
id = 'autocomplete-inputClasses'
|
524
|
+
accessibleAutocomplete({
|
525
|
+
element: element,
|
526
|
+
id: id,
|
527
|
+
source: countries,
|
528
|
+
autoselect: true,
|
529
|
+
inputClasses: 'app-input'
|
530
|
+
})
|
531
|
+
</script>
|
532
|
+
|
533
|
+
<script type="text/javascript">
|
534
|
+
element = document.querySelector('#tt-hintClasses')
|
535
|
+
id = 'autocomplete-hintClasses'
|
536
|
+
accessibleAutocomplete({
|
537
|
+
element: element,
|
538
|
+
id: id,
|
539
|
+
source: countries,
|
540
|
+
autoselect: true,
|
541
|
+
hintClasses: 'app-hint'
|
542
|
+
})
|
543
|
+
</script>
|
544
|
+
|
545
|
+
<script type="text/javascript">
|
546
|
+
element = document.querySelector('#tt-menuClasses')
|
547
|
+
id = 'autocomplete-menuClasses'
|
548
|
+
accessibleAutocomplete({
|
549
|
+
element: element,
|
550
|
+
id: id,
|
551
|
+
source: countries,
|
552
|
+
autoselect: true,
|
553
|
+
menuClasses: 'custom-menu-class'
|
554
|
+
})
|
555
|
+
</script>
|
556
|
+
|
557
|
+
<script type="text/javascript">
|
558
|
+
element = document.querySelector('#autocomplete-progressiveEnhancement')
|
559
|
+
accessibleAutocomplete.enhanceSelectElement({
|
560
|
+
selectElement: element
|
561
|
+
})
|
562
|
+
</script>
|
563
|
+
|
564
|
+
<script type="text/javascript">
|
565
|
+
function customSuggest (query, syncResults) {
|
566
|
+
var results = [
|
567
|
+
{ endonymLang: 'fr', endonym: 'République Française', name: 'France' },
|
568
|
+
{ endonymLang: 'de', endonym: 'Deutschland', name: 'Germany' },
|
569
|
+
{ endonymLang: 'en', endonym: 'Great Britain', name: 'United Kingdom' }
|
570
|
+
]
|
571
|
+
syncResults(query
|
572
|
+
? results.filter(function (result) {
|
573
|
+
var resultContains = result.name.toLowerCase().indexOf(query.toLowerCase()) !== -1
|
574
|
+
var endonymContains = result.endonym.toLowerCase().indexOf(query.toLowerCase()) !== -1
|
575
|
+
return resultContains || endonymContains
|
576
|
+
})
|
577
|
+
: []
|
578
|
+
)
|
579
|
+
}
|
580
|
+
|
581
|
+
function inputValueTemplate (result) {
|
582
|
+
return result && result.name
|
583
|
+
}
|
584
|
+
|
585
|
+
function suggestionTemplate (result) {
|
586
|
+
return result && '<strong>' + result.name + '</strong>' +
|
587
|
+
' (<span lang=' + result.endonymLang + '>' + result.endonym + '</span>)'
|
588
|
+
}
|
589
|
+
|
590
|
+
element = document.querySelector('#tt-customTemplates')
|
591
|
+
id = 'autocomplete-customTemplates'
|
592
|
+
accessibleAutocomplete({
|
593
|
+
element: element,
|
594
|
+
id: id,
|
595
|
+
source: customSuggest,
|
596
|
+
templates: {
|
597
|
+
inputValue: inputValueTemplate,
|
598
|
+
suggestion: suggestionTemplate
|
599
|
+
}
|
600
|
+
})
|
601
|
+
</script>
|
602
|
+
|
603
|
+
<script type="text/javascript">
|
604
|
+
element = document.querySelector('#tt-confirmOnBlur')
|
605
|
+
id = 'autocomplete-confirmOnBlur'
|
606
|
+
accessibleAutocomplete({
|
607
|
+
element: element,
|
608
|
+
id: id,
|
609
|
+
confirmOnBlur: false,
|
610
|
+
source: countries,
|
611
|
+
})
|
612
|
+
</script>
|
613
|
+
|
614
|
+
<script type="text/javascript">
|
615
|
+
element = document.querySelector('#tt-placeholder')
|
616
|
+
id = 'autocomplete-placeholder'
|
617
|
+
accessibleAutocomplete({
|
618
|
+
element: element,
|
619
|
+
id: id,
|
620
|
+
placeholder: 'Search for a country',
|
621
|
+
source: countries,
|
622
|
+
})
|
623
|
+
</script>
|
624
|
+
|
625
|
+
<script type="text/javascript">
|
626
|
+
element = document.querySelector('#tt-showNoOptionsFound')
|
627
|
+
id = 'autocomplete-showNoOptionsFound'
|
628
|
+
accessibleAutocomplete({
|
629
|
+
element: element,
|
630
|
+
id: id,
|
631
|
+
showNoOptionsFound: false,
|
632
|
+
source: countries
|
633
|
+
})
|
634
|
+
</script>
|
635
|
+
|
636
|
+
<script type="text/javascript">
|
637
|
+
element = document.querySelector('#tt-showAllValues')
|
638
|
+
id = 'autocomplete-showAllValues'
|
639
|
+
accessibleAutocomplete({
|
640
|
+
element: element,
|
641
|
+
id: id,
|
642
|
+
showAllValues: true,
|
643
|
+
source: countries
|
644
|
+
})
|
645
|
+
</script>
|
646
|
+
|
647
|
+
<script type="text/javascript">
|
648
|
+
element = document.querySelector('#tt-i18n')
|
649
|
+
id = 'autocomplete-i18n'
|
650
|
+
accessibleAutocomplete({
|
651
|
+
element: element,
|
652
|
+
id: id,
|
653
|
+
showAllValues: false,
|
654
|
+
source: countries,
|
655
|
+
tStatusQueryTooShort: function (minQueryLength) {
|
656
|
+
return 'Tippe mindestens ' + minQueryLength + ' Zeichen ein für Resultate.'
|
657
|
+
},
|
658
|
+
tStatusNoResults: function () {
|
659
|
+
return 'Keine Resultate.'
|
660
|
+
},
|
661
|
+
tStatusSelectedOption: function (selectedOption, length) {
|
662
|
+
return selectedOption + ' (1 von ' + length + ') ist ausgewählt.'
|
663
|
+
},
|
664
|
+
tStatusResults: function (length, contentSelectedOption) {
|
665
|
+
var words = {
|
666
|
+
result: (length === 1) ? 'Resultat' : 'Resultate',
|
667
|
+
is: (length === 1) ? 'ist' : 'sind'
|
668
|
+
}
|
669
|
+
|
670
|
+
return length + ' ' + words.result + ' ' + words.is + ' verfügbar. ' + contentSelectedOption
|
671
|
+
},
|
672
|
+
tNoResults: function () {
|
673
|
+
return 'Keine Resultate'
|
674
|
+
}
|
675
|
+
})
|
676
|
+
</script>
|
677
|
+
|
678
|
+
<script type="text/javascript">
|
679
|
+
element = document.querySelector('#tt-customDropdownArrow')
|
680
|
+
id = 'autocomplete-customDropdownArrow'
|
681
|
+
accessibleAutocomplete({
|
682
|
+
element: element,
|
683
|
+
id: id,
|
684
|
+
showAllValues: true,
|
685
|
+
source: countries,
|
686
|
+
dropdownArrow: function (config) {
|
687
|
+
return '<svg class="' + config.className + '" style="top: 8px;" viewBox="0 0 512 512" ><path d="M256,298.3L256,298.3L256,298.3l174.2-167.2c4.3-4.2,11.4-4.1,15.8,0.2l30.6,29.9c4.4,4.3,4.5,11.3,0.2,15.5L264.1,380.9 c-2.2,2.2-5.2,3.2-8.1,3c-3,0.1-5.9-0.9-8.1-3L35.2,176.7c-4.3-4.2-4.2-11.2,0.2-15.5L66,131.3c4.4-4.3,11.5-4.4,15.8-0.2L256,298.3 z"/></svg>'
|
688
|
+
}
|
689
|
+
})
|
690
|
+
</script>
|
691
|
+
|
692
|
+
</body>
|
693
|
+
</html>
|