@communitiesuk/svelte-component-library 0.1.19-beta.3 → 0.1.19-beta.33
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.
- package/README.md +7 -0
- package/dist/components/content/Tag.svelte +32 -0
- package/dist/components/content/Tag.svelte.d.ts +13 -0
- package/dist/components/data-vis/Histogram.svelte +302 -0
- package/dist/components/data-vis/Histogram.svelte.d.ts +75 -0
- package/dist/components/data-vis/axis/Axis.svelte +217 -34
- package/dist/components/data-vis/axis/Axis.svelte.d.ts +38 -30
- package/dist/components/data-vis/axis/Ticks.svelte +142 -78
- package/dist/components/data-vis/axis/Ticks.svelte.d.ts +28 -31
- package/dist/components/data-vis/line-chart/LineChart.svelte +51 -21
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +14 -6
- package/dist/components/data-vis/line-chart/ValueLabel.svelte +2 -1
- package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +2 -0
- package/dist/components/data-vis/position-chart/PositionChart.svelte +278 -122
- package/dist/components/data-vis/position-chart/PositionChart.svelte.d.ts +37 -5
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte +59 -48
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte.d.ts +4 -4
- package/dist/components/layout/Footer.svelte +9 -0
- package/dist/components/layout/Footer.svelte.d.ts +1 -0
- package/dist/components/layout/PhaseBanner.svelte +10 -1
- package/dist/components/layout/PhaseBanner.svelte.d.ts +1 -0
- package/dist/components/layout/ServiceNavigation.svelte +19 -1
- package/dist/components/layout/ServiceNavigation.svelte.d.ts +2 -0
- package/dist/components/ui/BasicMultiSelect.svelte +716 -0
- package/dist/components/ui/BasicMultiSelect.svelte.d.ts +18 -0
- package/dist/components/ui/Button.svelte +1 -0
- package/dist/components/ui/Card.svelte +48 -60
- package/dist/components/ui/Card.svelte.d.ts +26 -12
- package/dist/components/ui/CardHeader.svelte +46 -0
- package/dist/components/ui/CardHeader.svelte.d.ts +21 -0
- package/dist/components/ui/ChartExporter.svelte +142 -0
- package/dist/components/ui/ChartExporter.svelte.d.ts +16 -0
- package/dist/components/ui/CheckBox.svelte +1 -0
- package/dist/components/ui/Details.svelte +47 -8
- package/dist/components/ui/Details.svelte.d.ts +8 -10
- package/dist/components/ui/Masthead.svelte +44 -6
- package/dist/components/ui/Masthead.svelte.d.ts +6 -0
- package/dist/components/ui/RelatedContent.svelte +4 -1
- package/dist/components/ui/RelatedContent.svelte.d.ts +1 -0
- package/dist/components/ui/SearchAutocomplete.svelte +69 -44
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +1 -0
- package/dist/components/ui/Select.svelte +18 -7
- package/dist/components/ui/Tabs.svelte +192 -18
- package/dist/components/ui/Tabs.svelte.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +4 -1
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { browser } from "$app/environment";
|
|
4
|
+
import IconSearch from "../../icons/IconSearch.svelte";
|
|
5
|
+
import crossIconUrl from "./../../assets/govuk_publishing_components/images/cross-icon.svg";
|
|
6
|
+
|
|
7
|
+
type Option = { id: string | number; label: string };
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
options = [],
|
|
11
|
+
selected = $bindable<(string | number)[]>([]),
|
|
12
|
+
colorArray = ["#808080"],
|
|
13
|
+
placeholder = "Search and select…",
|
|
14
|
+
label = "Choose options",
|
|
15
|
+
hint,
|
|
16
|
+
enableColors = true,
|
|
17
|
+
startsWithSearch = true,
|
|
18
|
+
resetButton = false,
|
|
19
|
+
}: {
|
|
20
|
+
options?: Option[];
|
|
21
|
+
selected?: (string | number)[];
|
|
22
|
+
colorArray?: string[];
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
hint?: string;
|
|
26
|
+
enableColors?: boolean;
|
|
27
|
+
startsWithSearch?: boolean;
|
|
28
|
+
resetButton?: boolean;
|
|
29
|
+
} = $props();
|
|
30
|
+
|
|
31
|
+
let showDropdown = $state(false);
|
|
32
|
+
let search = $state("");
|
|
33
|
+
|
|
34
|
+
// Internal color map: id → color
|
|
35
|
+
let colorMap = $state<Map<string | number, string>>(new Map());
|
|
36
|
+
|
|
37
|
+
// Stores the initial selected ids for reset support
|
|
38
|
+
let initialSelected: (string | number)[] = [];
|
|
39
|
+
|
|
40
|
+
const isAtDefault = $derived(() => {
|
|
41
|
+
if (!hasInitialSelection) return true;
|
|
42
|
+
const current = [...selected].sort().join(",");
|
|
43
|
+
const initial = [...initialSelected].sort().join(",");
|
|
44
|
+
return current === initial;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const hasInitialSelection = $derived(() => initialSelected.length > 0);
|
|
48
|
+
|
|
49
|
+
function resetToInitial() {
|
|
50
|
+
selected = [...initialSelected];
|
|
51
|
+
// Prune colorMap to only keep ids in the reset selection
|
|
52
|
+
for (const id of colorMap.keys()) {
|
|
53
|
+
if (!selected.includes(id)) colorMap.delete(id);
|
|
54
|
+
}
|
|
55
|
+
search = "";
|
|
56
|
+
queueMicrotask(() => inputEl?.focus());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Cursor used ONLY when palette is exhausted
|
|
60
|
+
let colorCursor = $state(0);
|
|
61
|
+
|
|
62
|
+
function nextColorPreferUnused(used?: Set<string>) {
|
|
63
|
+
if (!Array.isArray(colorArray) || colorArray.length === 0) return "#808080";
|
|
64
|
+
|
|
65
|
+
const usedColors = used ?? new Set(colorMap.values());
|
|
66
|
+
|
|
67
|
+
// 1) Prefer unused
|
|
68
|
+
const unused = colorArray.find((c) => !usedColors.has(c));
|
|
69
|
+
if (unused) return unused;
|
|
70
|
+
|
|
71
|
+
// 2) Otherwise cycle
|
|
72
|
+
const color = colorArray[colorCursor % colorArray.length];
|
|
73
|
+
colorCursor = (colorCursor + 1) % colorArray.length;
|
|
74
|
+
return color;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Keep colorMap in sync with selected ids
|
|
78
|
+
$effect(() => {
|
|
79
|
+
if (!enableColors) return;
|
|
80
|
+
if (!Array.isArray(selected)) return;
|
|
81
|
+
if (!Array.isArray(colorArray) || colorArray.length === 0) return;
|
|
82
|
+
|
|
83
|
+
if (colorCursor >= colorArray.length) colorCursor = 0;
|
|
84
|
+
|
|
85
|
+
const used = new Set(colorMap.values());
|
|
86
|
+
|
|
87
|
+
for (const id of selected) {
|
|
88
|
+
if (!colorMap.has(id)) {
|
|
89
|
+
const color = nextColorPreferUnused(used);
|
|
90
|
+
used.add(color);
|
|
91
|
+
colorMap.set(id, color);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Prune removed ids
|
|
96
|
+
for (const id of colorMap.keys()) {
|
|
97
|
+
if (!selected.includes(id)) colorMap.delete(id);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const filteredOptions = $derived.by(() => {
|
|
102
|
+
const q = search.trim().toLowerCase();
|
|
103
|
+
const selectedIds = new Set(selected);
|
|
104
|
+
|
|
105
|
+
// remove already-selected
|
|
106
|
+
const available = options
|
|
107
|
+
.filter((o) => !selectedIds.has(o.id))
|
|
108
|
+
.slice()
|
|
109
|
+
.sort((a, b) =>
|
|
110
|
+
a.label.localeCompare(b.label, undefined, {
|
|
111
|
+
sensitivity: "base",
|
|
112
|
+
numeric: true,
|
|
113
|
+
}),
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const matched = q
|
|
117
|
+
? available.filter((o) => {
|
|
118
|
+
const lbl = o.label.toLowerCase();
|
|
119
|
+
return startsWithSearch ? lbl.startsWith(q) : lbl.includes(q);
|
|
120
|
+
})
|
|
121
|
+
: available;
|
|
122
|
+
|
|
123
|
+
return matched;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
function selectOption(option: Option) {
|
|
127
|
+
if (enableColors) {
|
|
128
|
+
const color = nextColorPreferUnused();
|
|
129
|
+
colorMap.set(option.id, color);
|
|
130
|
+
}
|
|
131
|
+
selected = [...selected, option.id];
|
|
132
|
+
search = "";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function remove(id: string | number) {
|
|
136
|
+
selected = selected.filter((s) => s !== id);
|
|
137
|
+
colorMap.delete(id);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Close dropdown on outside click — browser only
|
|
141
|
+
let container: HTMLDivElement | null = null;
|
|
142
|
+
let inputEl: HTMLInputElement | null = null;
|
|
143
|
+
|
|
144
|
+
function open() {
|
|
145
|
+
showDropdown = true;
|
|
146
|
+
queueMicrotask(() => inputEl?.focus());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
onMount(() => {
|
|
150
|
+
if (!browser) return;
|
|
151
|
+
if (resetButton === true) {
|
|
152
|
+
initialSelected = [...selected];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function handleOutside(e: MouseEvent) {
|
|
156
|
+
if (container && !container.contains(e.target as Node)) {
|
|
157
|
+
showDropdown = false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
document.addEventListener("mousedown", handleOutside);
|
|
162
|
+
return () => document.removeEventListener("mousedown", handleOutside);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
function clearAll() {
|
|
166
|
+
selected = [];
|
|
167
|
+
colorMap = new Map();
|
|
168
|
+
search = "";
|
|
169
|
+
queueMicrotask(() => inputEl?.focus());
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div class="gem-c-select-with-search" bind:this={container}>
|
|
174
|
+
<label class="govuk-label" for="ms-input">{label}</label>
|
|
175
|
+
{#if hint}
|
|
176
|
+
<div class="govuk-hint">{hint}</div>
|
|
177
|
+
{/if}
|
|
178
|
+
|
|
179
|
+
<div
|
|
180
|
+
class:choices={true}
|
|
181
|
+
class:is-open={showDropdown}
|
|
182
|
+
class:is-focused={showDropdown}
|
|
183
|
+
data-type="select-multiple"
|
|
184
|
+
on:click={open}
|
|
185
|
+
>
|
|
186
|
+
<div class="choices__search-row">
|
|
187
|
+
<div class="choices__box">
|
|
188
|
+
<div class="choices__inner">
|
|
189
|
+
<input
|
|
190
|
+
id="ms-input"
|
|
191
|
+
class="choices__input"
|
|
192
|
+
bind:this={inputEl}
|
|
193
|
+
bind:value={search}
|
|
194
|
+
{placeholder}
|
|
195
|
+
autocomplete="off"
|
|
196
|
+
on:focus={() => (showDropdown = true)}
|
|
197
|
+
on:input={() => (showDropdown = true)}
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
{#if selected.length}
|
|
202
|
+
<div
|
|
203
|
+
class="choices__list choices__list--multiple"
|
|
204
|
+
aria-label="Selected items"
|
|
205
|
+
>
|
|
206
|
+
{#each selected as id (id)}
|
|
207
|
+
{@const item = options.find((o) => o.id === id)}
|
|
208
|
+
{#if item}
|
|
209
|
+
<span class="choices__item">
|
|
210
|
+
{#if enableColors && colorMap.has(id)}
|
|
211
|
+
<span
|
|
212
|
+
class="choices__item-circle"
|
|
213
|
+
style={`background:${colorMap.get(id)}`}
|
|
214
|
+
></span>
|
|
215
|
+
{/if}
|
|
216
|
+
|
|
217
|
+
<span class="choices__item-label">{item.label}</span>
|
|
218
|
+
|
|
219
|
+
<button
|
|
220
|
+
type="button"
|
|
221
|
+
class="choices__button"
|
|
222
|
+
on:click|stopPropagation={() => remove(id)}
|
|
223
|
+
aria-label={`Remove ${item.label}`}
|
|
224
|
+
title={`Remove ${item.label}`}
|
|
225
|
+
>
|
|
226
|
+
<img
|
|
227
|
+
src={crossIconUrl}
|
|
228
|
+
alt=""
|
|
229
|
+
aria-hidden="true"
|
|
230
|
+
width="18"
|
|
231
|
+
height="18"
|
|
232
|
+
/>
|
|
233
|
+
</button>
|
|
234
|
+
</span>
|
|
235
|
+
{/if}
|
|
236
|
+
{/each}
|
|
237
|
+
</div>
|
|
238
|
+
{/if}
|
|
239
|
+
|
|
240
|
+
{#if selected.length || (resetButton && hasInitialSelection && !isAtDefault)}
|
|
241
|
+
<div class="choices__actions">
|
|
242
|
+
{#if selected.length}
|
|
243
|
+
<button
|
|
244
|
+
type="button"
|
|
245
|
+
class="choices__clear-all"
|
|
246
|
+
on:click|stopPropagation={clearAll}
|
|
247
|
+
>
|
|
248
|
+
Clear all
|
|
249
|
+
</button>
|
|
250
|
+
{/if}
|
|
251
|
+
|
|
252
|
+
{#if resetButton && hasInitialSelection && !isAtDefault}
|
|
253
|
+
<button
|
|
254
|
+
type="button"
|
|
255
|
+
class="choices__reset"
|
|
256
|
+
on:click|stopPropagation={resetToInitial}
|
|
257
|
+
>
|
|
258
|
+
Reset to default
|
|
259
|
+
</button>
|
|
260
|
+
{/if}
|
|
261
|
+
</div>
|
|
262
|
+
{/if}
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<button
|
|
266
|
+
type="button"
|
|
267
|
+
class="search-addon-btn"
|
|
268
|
+
aria-label="Search"
|
|
269
|
+
on:click|stopPropagation={() => open()}
|
|
270
|
+
>
|
|
271
|
+
<span class="search-addon-icon"><IconSearch /></span>
|
|
272
|
+
</button>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
{#if showDropdown}
|
|
277
|
+
<div
|
|
278
|
+
class="choices__list choices__list--dropdown"
|
|
279
|
+
class:is-open={showDropdown}
|
|
280
|
+
role="listbox"
|
|
281
|
+
aria-label="Options"
|
|
282
|
+
>
|
|
283
|
+
{#each filteredOptions as o (o.id)}
|
|
284
|
+
<div
|
|
285
|
+
class="choices__item choices__item--selectable"
|
|
286
|
+
role="option"
|
|
287
|
+
on:click={() => selectOption(o)}
|
|
288
|
+
>
|
|
289
|
+
{o.label}
|
|
290
|
+
</div>
|
|
291
|
+
{/each}
|
|
292
|
+
|
|
293
|
+
{#if filteredOptions.length === 0}
|
|
294
|
+
<div class="choices__item" aria-disabled="true" style="opacity:0.75">
|
|
295
|
+
No results found
|
|
296
|
+
</div>
|
|
297
|
+
{/if}
|
|
298
|
+
</div>
|
|
299
|
+
{/if}
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<style>
|
|
303
|
+
:root {
|
|
304
|
+
--govuk-black: #0b0c0c;
|
|
305
|
+
--govuk-blue: #1d70b8;
|
|
306
|
+
--govuk-grey: #b1b4b6;
|
|
307
|
+
--govuk-light-grey: #f3f2f1;
|
|
308
|
+
--govuk-focus: #fd0;
|
|
309
|
+
|
|
310
|
+
--select-height: 46px;
|
|
311
|
+
--item-height: 44px;
|
|
312
|
+
--addon-width: 46px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
:global(.gem-c-select-with-search) {
|
|
316
|
+
display: block;
|
|
317
|
+
width: 100%;
|
|
318
|
+
max-width: 100%;
|
|
319
|
+
box-sizing: border-box;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:global(.govuk-label) {
|
|
323
|
+
font-family: "GDS Transport", arial, sans-serif;
|
|
324
|
+
font-size: 1.1875rem;
|
|
325
|
+
line-height: 1.31;
|
|
326
|
+
color: var(--govuk-black);
|
|
327
|
+
display: block;
|
|
328
|
+
margin-bottom: 5px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/* ========================================
|
|
332
|
+
CHOICES BASE
|
|
333
|
+
======================================== */
|
|
334
|
+
|
|
335
|
+
:global(.gem-c-select-with-search) .choices {
|
|
336
|
+
width: 100%;
|
|
337
|
+
max-width: 100%;
|
|
338
|
+
box-sizing: border-box;
|
|
339
|
+
|
|
340
|
+
display: flex;
|
|
341
|
+
flex-direction: column;
|
|
342
|
+
align-items: stretch;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.choices__search-row {
|
|
346
|
+
display: flex;
|
|
347
|
+
flex-direction: row;
|
|
348
|
+
align-items: flex-start;
|
|
349
|
+
gap: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
:global(.gem-c-select-with-search) .choices__box {
|
|
353
|
+
border: 2px solid var(--govuk-black);
|
|
354
|
+
border-radius: 0;
|
|
355
|
+
background: white;
|
|
356
|
+
|
|
357
|
+
flex: 1 1 auto;
|
|
358
|
+
min-width: 0;
|
|
359
|
+
|
|
360
|
+
display: flex;
|
|
361
|
+
flex-direction: column;
|
|
362
|
+
|
|
363
|
+
padding-right: 0;
|
|
364
|
+
box-sizing: border-box;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
:global(.gem-c-select-with-search) .choices.is-focused .choices__box,
|
|
368
|
+
:global(.gem-c-select-with-search) .choices.is-open .choices__box {
|
|
369
|
+
outline: 3px solid var(--govuk-focus);
|
|
370
|
+
outline-offset: 0;
|
|
371
|
+
box-shadow: inset 0 0 0 2px var(--govuk-black);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:global(.gem-c-select-with-search) .choices__inner {
|
|
375
|
+
border: 0;
|
|
376
|
+
background: white;
|
|
377
|
+
min-height: var(--select-height);
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
padding: 5px;
|
|
381
|
+
gap: 8px;
|
|
382
|
+
cursor: text;
|
|
383
|
+
flex: 0 0 var(--select-height);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
:global(.gem-c-select-with-search) .choices__input {
|
|
387
|
+
border: none;
|
|
388
|
+
font-size: 19px;
|
|
389
|
+
margin: 0;
|
|
390
|
+
width: 100%;
|
|
391
|
+
min-width: 0;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
:global(.gem-c-select-with-search) .choices__input:focus {
|
|
395
|
+
outline: none;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.ms-divider {
|
|
399
|
+
border-top: 1px solid var(--govuk-grey);
|
|
400
|
+
margin: 0 5px;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/* ========================================
|
|
404
|
+
MULTI SELECT CHIPS
|
|
405
|
+
======================================== */
|
|
406
|
+
|
|
407
|
+
:global(.gem-c-select-with-search) .choices__list--multiple {
|
|
408
|
+
display: flex;
|
|
409
|
+
flex-wrap: wrap;
|
|
410
|
+
align-items: flex-start;
|
|
411
|
+
gap: 4px 10px;
|
|
412
|
+
width: 100%;
|
|
413
|
+
|
|
414
|
+
border-top: 1px solid var(--govuk-grey);
|
|
415
|
+
margin: 0 5px;
|
|
416
|
+
padding: 8px 8px 10px;
|
|
417
|
+
width: calc(100% - 10px);
|
|
418
|
+
|
|
419
|
+
box-sizing: border-box;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
:global(.gem-c-select-with-search) .choices__list--multiple .choices__item {
|
|
423
|
+
display: inline-flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
background: var(--govuk-light-grey);
|
|
426
|
+
color: var(--govuk-black);
|
|
427
|
+
box-shadow: 0 2px 0 var(--govuk-grey);
|
|
428
|
+
border-radius: 0;
|
|
429
|
+
|
|
430
|
+
min-height: 32px;
|
|
431
|
+
padding: 2px 0 2px 10px;
|
|
432
|
+
margin: 4px 10px 0 0;
|
|
433
|
+
line-height: 1.2;
|
|
434
|
+
|
|
435
|
+
max-width: 100%;
|
|
436
|
+
box-sizing: border-box;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
:global(.gem-c-select-with-search) .choices__item-circle {
|
|
440
|
+
width: 16px;
|
|
441
|
+
height: 16px;
|
|
442
|
+
border-radius: 50%;
|
|
443
|
+
margin-right: 8px;
|
|
444
|
+
border: 1px solid var(--govuk-black);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
:global(.gem-c-select-with-search) .choices__item-label {
|
|
448
|
+
flex: 1 1 auto;
|
|
449
|
+
min-width: 0;
|
|
450
|
+
overflow: visible;
|
|
451
|
+
text-overflow: unset;
|
|
452
|
+
white-space: normal;
|
|
453
|
+
word-break: break-word;
|
|
454
|
+
max-width: 26ch;
|
|
455
|
+
line-height: 1.2;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
:global(.gem-c-select-with-search)
|
|
459
|
+
.choices[data-type*="select-multiple"]
|
|
460
|
+
.choices__button {
|
|
461
|
+
width: 32px;
|
|
462
|
+
padding: 0;
|
|
463
|
+
|
|
464
|
+
border: 0;
|
|
465
|
+
margin-left: 8px;
|
|
466
|
+
|
|
467
|
+
background: transparent;
|
|
468
|
+
color: var(--govuk-black);
|
|
469
|
+
font-size: 20px;
|
|
470
|
+
line-height: 1;
|
|
471
|
+
|
|
472
|
+
opacity: 0.85;
|
|
473
|
+
cursor: pointer;
|
|
474
|
+
transition:
|
|
475
|
+
background-color 120ms ease,
|
|
476
|
+
opacity 120ms ease;
|
|
477
|
+
|
|
478
|
+
align-self: stretch;
|
|
479
|
+
height: auto;
|
|
480
|
+
min-height: 100%;
|
|
481
|
+
padding: 0 10px;
|
|
482
|
+
border-left: 1px solid var(--govuk-grey);
|
|
483
|
+
display: inline-flex;
|
|
484
|
+
align-items: center;
|
|
485
|
+
justify-content: center;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
:global(.gem-c-select-with-search)
|
|
489
|
+
.choices[data-type*="select-multiple"]
|
|
490
|
+
.choices__button:hover {
|
|
491
|
+
background-color: #e0e0e0;
|
|
492
|
+
opacity: 1;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
:global(.gem-c-select-with-search)
|
|
496
|
+
.choices[data-type*="select-multiple"]
|
|
497
|
+
.choices__button:focus {
|
|
498
|
+
outline: 3px solid var(--govuk-focus);
|
|
499
|
+
outline-offset: 0;
|
|
500
|
+
opacity: 1;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* ========================================
|
|
504
|
+
SEARCH BUTTON
|
|
505
|
+
======================================== */
|
|
506
|
+
|
|
507
|
+
.search-addon-btn {
|
|
508
|
+
width: var(--addon-width);
|
|
509
|
+
height: var(--select-height);
|
|
510
|
+
display: inline-flex;
|
|
511
|
+
align-items: center;
|
|
512
|
+
justify-content: center;
|
|
513
|
+
background-color: var(--govuk-blue);
|
|
514
|
+
color: #fff;
|
|
515
|
+
border: 0;
|
|
516
|
+
padding: 0;
|
|
517
|
+
font-size: 19px;
|
|
518
|
+
font-family: "GDS Transport", arial, sans-serif;
|
|
519
|
+
cursor: pointer;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.search-addon-btn:focus-visible {
|
|
523
|
+
outline: 3px solid var(--govuk-focus);
|
|
524
|
+
box-shadow: inset 0 0 0 4px var(--govuk-black);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.search-addon-icon {
|
|
528
|
+
position: relative;
|
|
529
|
+
width: var(--addon-width);
|
|
530
|
+
height: var(--addon-width);
|
|
531
|
+
display: flex;
|
|
532
|
+
align-items: center;
|
|
533
|
+
justify-content: center;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
:global(.gem-c-select-with-search) .choices__list--dropdown {
|
|
537
|
+
position: static !important;
|
|
538
|
+
inset: auto !important;
|
|
539
|
+
transform: none !important;
|
|
540
|
+
|
|
541
|
+
display: block !important;
|
|
542
|
+
width: 100%;
|
|
543
|
+
box-sizing: border-box;
|
|
544
|
+
|
|
545
|
+
margin-top: 0;
|
|
546
|
+
border: 2px solid var(--govuk-black);
|
|
547
|
+
border-top: none;
|
|
548
|
+
background: white;
|
|
549
|
+
|
|
550
|
+
max-height: 300px;
|
|
551
|
+
overflow-y: auto;
|
|
552
|
+
z-index: auto;
|
|
553
|
+
width: calc(100% - var(--addon-width));
|
|
554
|
+
margin-left: 0;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
:global(.gem-c-select-with-search) .choices__list--dropdown .choices__item {
|
|
558
|
+
display: flex;
|
|
559
|
+
align-items: center;
|
|
560
|
+
min-height: var(--item-height);
|
|
561
|
+
padding: 12px 10px;
|
|
562
|
+
position: relative;
|
|
563
|
+
width: 100%;
|
|
564
|
+
|
|
565
|
+
box-sizing: border-box;
|
|
566
|
+
flex: 0 0 auto;
|
|
567
|
+
white-space: normal;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
:global(.gem-c-select-with-search)
|
|
571
|
+
.choices__list--dropdown
|
|
572
|
+
.choices__item::after {
|
|
573
|
+
content: "";
|
|
574
|
+
position: absolute;
|
|
575
|
+
left: 15px;
|
|
576
|
+
right: 15px;
|
|
577
|
+
bottom: 0;
|
|
578
|
+
height: 1px;
|
|
579
|
+
background: var(--govuk-grey);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
:global(.gem-c-select-with-search) .choices__item--selectable:hover {
|
|
583
|
+
background: var(--govuk-blue);
|
|
584
|
+
color: white;
|
|
585
|
+
cursor: pointer;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
:global(.gem-c-select-with-search) .choices__list--dropdown {
|
|
589
|
+
display: block !important;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
:global(.gem-c-select-with-search)
|
|
593
|
+
.choices.is-open
|
|
594
|
+
.choices__box
|
|
595
|
+
.choices__inner,
|
|
596
|
+
:global(.gem-c-select-with-search)
|
|
597
|
+
.choices.is-focused
|
|
598
|
+
.choices__box
|
|
599
|
+
.choices__inner {
|
|
600
|
+
border-bottom: 0;
|
|
601
|
+
box-shadow: none;
|
|
602
|
+
margin-bottom: 0 !important;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
:global(.gem-c-select-with-search)
|
|
606
|
+
.choices.is-open
|
|
607
|
+
.choices__box:has(.choices__list--multiple)
|
|
608
|
+
.choices__inner,
|
|
609
|
+
:global(.gem-c-select-with-search)
|
|
610
|
+
.choices.is-focused
|
|
611
|
+
.choices__box:has(.choices__list--multiple)
|
|
612
|
+
.choices__inner {
|
|
613
|
+
border-bottom: 0;
|
|
614
|
+
padding-bottom: 0;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
:global(.gem-c-select-with-search) .choices.is-focused .choices__box,
|
|
618
|
+
:global(.gem-c-select-with-search) .choices.is-open .choices__box {
|
|
619
|
+
outline: none;
|
|
620
|
+
box-shadow: inset 0 0 0 2px var(--govuk-black);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.search-addon-btn:focus-visible {
|
|
624
|
+
outline: none;
|
|
625
|
+
box-shadow: inset 0 0 0 3px var(--govuk-black);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
:global(.gem-c-select-with-search)
|
|
629
|
+
.choices[data-type*="select-multiple"]
|
|
630
|
+
.choices__button:focus {
|
|
631
|
+
outline: none;
|
|
632
|
+
box-shadow: inset 0 0 0 3px var(--govuk-black);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.choices__actions {
|
|
636
|
+
display: block;
|
|
637
|
+
width: 100%;
|
|
638
|
+
box-sizing: border-box;
|
|
639
|
+
|
|
640
|
+
margin: 0 5px;
|
|
641
|
+
width: calc(100% - 10px);
|
|
642
|
+
padding: 8px 8px 10px;
|
|
643
|
+
|
|
644
|
+
text-align: left;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.choices__clear-all {
|
|
648
|
+
background: transparent;
|
|
649
|
+
border: 0;
|
|
650
|
+
padding: 0;
|
|
651
|
+
color: var(--govuk-blue);
|
|
652
|
+
font-family: "GDS Transport", arial, sans-serif;
|
|
653
|
+
font-size: 19px;
|
|
654
|
+
cursor: pointer;
|
|
655
|
+
text-decoration: underline;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
.choices__clear-all:hover {
|
|
659
|
+
color: #003078;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.choices__clear-all:focus-visible {
|
|
663
|
+
outline: 3px solid var(--govuk-focus);
|
|
664
|
+
outline-offset: 0;
|
|
665
|
+
box-shadow: inset 0 0 0 3px var(--govuk-black);
|
|
666
|
+
text-decoration: none;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
:global(.gem-c-select-with-search) .choices__list--dropdown {
|
|
670
|
+
margin: 0px 1px !important;
|
|
671
|
+
padding: 0;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.choices__reset {
|
|
675
|
+
background: transparent;
|
|
676
|
+
border: 0;
|
|
677
|
+
padding: 0;
|
|
678
|
+
margin-left: 16px;
|
|
679
|
+
|
|
680
|
+
color: var(--govuk-blue);
|
|
681
|
+
font-family: "GDS Transport", arial, sans-serif;
|
|
682
|
+
font-size: 19px;
|
|
683
|
+
cursor: pointer;
|
|
684
|
+
text-decoration: underline;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.choices__reset:hover {
|
|
688
|
+
color: #003078;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.choices__reset:focus-visible {
|
|
692
|
+
outline: 3px solid var(--govuk-focus);
|
|
693
|
+
outline-offset: 0;
|
|
694
|
+
box-shadow: inset 0 0 0 3px var(--govuk-black);
|
|
695
|
+
text-decoration: none;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
:global(.gem-c-select-with-search) .choices__list--dropdown {
|
|
699
|
+
scrollbar-width: thin;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
:global(.gem-c-select-with-search)
|
|
703
|
+
.choices__list--dropdown::-webkit-scrollbar {
|
|
704
|
+
width: 10px;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
:global(.gem-c-select-with-search)
|
|
708
|
+
.choices__list--dropdown::-webkit-scrollbar-thumb {
|
|
709
|
+
background-color: var(--govuk-grey);
|
|
710
|
+
border-radius: 0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.choices__actions:empty {
|
|
714
|
+
display: none;
|
|
715
|
+
}
|
|
716
|
+
</style>
|