@communitiesuk/svelte-component-library 0.1.19-beta.2 → 0.1.19-beta.21
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/data-vis/Histogram.svelte +282 -0
- package/dist/components/data-vis/Histogram.svelte.d.ts +75 -0
- package/dist/components/data-vis/axis/Axis.svelte +145 -34
- package/dist/components/data-vis/axis/Axis.svelte.d.ts +34 -30
- package/dist/components/data-vis/axis/Ticks.svelte +163 -60
- package/dist/components/data-vis/axis/Ticks.svelte.d.ts +26 -30
- 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/position-chart/PositionChart.svelte +255 -117
- package/dist/components/data-vis/position-chart/PositionChart.svelte.d.ts +28 -4
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte +39 -34
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte.d.ts +6 -2
- 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 +185 -0
- package/dist/components/ui/BasicMultiSelect.svelte.d.ts +8 -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/Details.svelte +10 -2
- package/dist/components/ui/Details.svelte.d.ts +2 -0
- package/dist/components/ui/Masthead.svelte +36 -6
- package/dist/components/ui/Masthead.svelte.d.ts +4 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte +12 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte.d.ts +4 -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 +185 -34
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +5 -0
- package/dist/components/ui/Tabs.svelte +190 -18
- package/dist/components/ui/Tabs.svelte.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +4 -1
|
@@ -1,70 +1,75 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
let {
|
|
2
|
+
let {
|
|
3
|
+
markerRadius = undefined,
|
|
4
|
+
textSize = "s",
|
|
5
|
+
chartWidth,
|
|
6
|
+
axisLabels = ["Left", "Right"],
|
|
7
|
+
} = $props();
|
|
3
8
|
</script>
|
|
4
9
|
|
|
5
|
-
<div
|
|
6
|
-
|
|
10
|
+
<div
|
|
11
|
+
class="axis govuk-body-{textSize}"
|
|
12
|
+
style="--axis-padding:{markerRadius}px; width: {chartWidth}"
|
|
13
|
+
>
|
|
14
|
+
<div class="right-label">
|
|
7
15
|
<svg
|
|
8
16
|
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
width="
|
|
17
|
+
width="18"
|
|
10
18
|
height="16"
|
|
11
|
-
viewBox="0 0 11
|
|
19
|
+
viewBox="0 0 11 20"
|
|
12
20
|
fill="none"
|
|
13
21
|
>
|
|
14
22
|
<path
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
transform="translate(20,21)rotate(180)"
|
|
24
|
+
d="M 19.7071 12.7071 C 20.0976 12.3166 20.0976 11.6834 19.7071 11.2929 L 13.3431 4.9289 C 12.9526 4.5384 12.3195 4.5384 11.9289 4.9289 C 11.5384 5.3195 11.5384 5.9526 11.9289 6.3431 L 17.5858 12 L 11.9289 17.6568 C 11.5384 18.0474 11.5384 18.6805 11.9289 19.0711 C 12.3195 19.4616 12.9526 19.4616 13.3431 19.0711 L 19.7071 12.7071 Z M 4 12 L 4 13 L 19 13 L 19 12 L 19 11 L 9 11 L 4 11 Z"
|
|
25
|
+
fill="darkgrey"
|
|
17
26
|
></path>
|
|
18
27
|
</svg>
|
|
19
|
-
<span
|
|
28
|
+
<span class="axis-text">{axisLabels[0]}</span>
|
|
20
29
|
</div>
|
|
21
|
-
<div class="
|
|
22
|
-
<span
|
|
30
|
+
<div class="left-label">
|
|
31
|
+
<span class="axis-text">{axisLabels[1]}</span>
|
|
23
32
|
<svg
|
|
24
33
|
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
-
width="
|
|
34
|
+
width="18"
|
|
26
35
|
height="16"
|
|
27
|
-
viewBox="0 0
|
|
36
|
+
viewBox="0 0 11 20"
|
|
28
37
|
fill="none"
|
|
29
38
|
>
|
|
30
39
|
<path
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
transform="translate(-5,-3)"
|
|
41
|
+
d="M 19.7071 12.7071 C 20.0976 12.3166 20.0976 11.6834 19.7071 11.2929 L 13.3431 4.9289 C 12.9526 4.5384 12.3195 4.5384 11.9289 4.9289 C 11.5384 5.3195 11.5384 5.9526 11.9289 6.3431 L 17.5858 12 L 11.9289 17.6568 C 11.5384 18.0474 11.5384 18.6805 11.9289 19.0711 C 12.3195 19.4616 12.9526 19.4616 13.3431 19.0711 L 19.7071 12.7071 Z M 4 12 L 4 13 L 19 13 L 19 12 L 19 11 L 9 11 L 4 11 Z"
|
|
42
|
+
fill="darkgrey"
|
|
33
43
|
></path>
|
|
34
44
|
</svg>
|
|
35
45
|
</div>
|
|
36
46
|
</div>
|
|
37
47
|
|
|
38
48
|
<style>
|
|
49
|
+
svg {
|
|
50
|
+
overflow: visible;
|
|
51
|
+
}
|
|
52
|
+
|
|
39
53
|
.axis {
|
|
40
54
|
display: flex;
|
|
41
55
|
justify-content: space-between;
|
|
42
|
-
|
|
43
|
-
padding: 0 var(--axis-padding);
|
|
56
|
+
margin-bottom: 0;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
.
|
|
47
|
-
.
|
|
59
|
+
.left-label,
|
|
60
|
+
.right-label {
|
|
48
61
|
display: flex;
|
|
49
|
-
|
|
50
|
-
gap: 5px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* Tell the parent to act as a container */
|
|
54
|
-
.axis {
|
|
55
|
-
container-type: inline-size;
|
|
62
|
+
max-width: 120px;
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.less-deprived {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
65
|
+
.left-label {
|
|
66
|
+
text-align: end;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
.axis-text {
|
|
70
|
+
font-family: "GDS Transport";
|
|
71
|
+
line-height: 0.9;
|
|
72
|
+
color: #666666;
|
|
73
|
+
font-style: italic;
|
|
69
74
|
}
|
|
70
75
|
</style>
|
|
@@ -5,9 +5,13 @@ type PositionChartAxis = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const PositionChartAxis: import("svelte").Component<{
|
|
7
7
|
markerRadius?: any;
|
|
8
|
-
|
|
8
|
+
textSize?: string;
|
|
9
|
+
chartWidth: any;
|
|
10
|
+
axisLabels?: any[];
|
|
9
11
|
}, {}, "">;
|
|
10
12
|
type $$ComponentProps = {
|
|
11
13
|
markerRadius?: any;
|
|
12
|
-
|
|
14
|
+
textSize?: string;
|
|
15
|
+
chartWidth: any;
|
|
16
|
+
axisLabels?: any[];
|
|
13
17
|
};
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
copyrightHref = "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/",
|
|
52
52
|
rebrand = true,
|
|
53
53
|
borderTopColor = "#00625E",
|
|
54
|
+
removeCopyrightPadding = false,
|
|
54
55
|
} = $props<{
|
|
55
56
|
sections?: FooterSection[];
|
|
56
57
|
inlineLinks?: FooterItem[];
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
copyrightHref?: string;
|
|
69
70
|
rebrand?: boolean;
|
|
70
71
|
borderTopColor?: string;
|
|
72
|
+
removeCopyrightPadding?: boolean;
|
|
71
73
|
}>();
|
|
72
74
|
</script>
|
|
73
75
|
|
|
@@ -218,6 +220,7 @@
|
|
|
218
220
|
<a
|
|
219
221
|
class={[
|
|
220
222
|
"govuk-footer__link",
|
|
223
|
+
{ "no-copyright-padding": removeCopyrightPadding },
|
|
221
224
|
{
|
|
222
225
|
"govuk-footer__copyright-logo": !copyrightLogoUrl && rebrand,
|
|
223
226
|
},
|
|
@@ -234,3 +237,9 @@
|
|
|
234
237
|
</div>
|
|
235
238
|
</div>
|
|
236
239
|
</footer>
|
|
240
|
+
|
|
241
|
+
<style>
|
|
242
|
+
.no-copyright-padding {
|
|
243
|
+
padding: 0;
|
|
244
|
+
}
|
|
245
|
+
</style>
|
|
@@ -27,6 +27,7 @@ type $$ComponentProps = {
|
|
|
27
27
|
copyrightHref?: string;
|
|
28
28
|
rebrand?: boolean;
|
|
29
29
|
borderTopColor?: string;
|
|
30
|
+
removeCopyrightPadding?: boolean;
|
|
30
31
|
};
|
|
31
32
|
declare const Footer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
32
33
|
type Footer = ReturnType<typeof Footer>;
|
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
bannerText = "This is a new service. Help us improve it and ",
|
|
6
6
|
linkText = "give your feedback by email",
|
|
7
7
|
linkHref = "#",
|
|
8
|
+
bottomBorder = true,
|
|
8
9
|
} = $props<{
|
|
9
10
|
tagText?: string;
|
|
10
11
|
bannerText?: string;
|
|
11
12
|
linkText?: string;
|
|
12
13
|
linkHref?: string;
|
|
14
|
+
bottomBorder?: boolean;
|
|
13
15
|
}>();
|
|
14
16
|
</script>
|
|
15
17
|
|
|
16
|
-
<div
|
|
18
|
+
<div
|
|
19
|
+
class="govuk-phase-banner govuk-width-container {bottomBorder
|
|
20
|
+
? ''
|
|
21
|
+
: 'no-bottom-border'}"
|
|
22
|
+
>
|
|
17
23
|
<p class="govuk-phase-banner__content">
|
|
18
24
|
<strong class="govuk-tag govuk-phase-banner__content__tag">
|
|
19
25
|
{tagText}
|
|
@@ -25,4 +31,7 @@
|
|
|
25
31
|
</div>
|
|
26
32
|
|
|
27
33
|
<style>
|
|
34
|
+
.no-bottom-border {
|
|
35
|
+
border-bottom: none;
|
|
36
|
+
}
|
|
28
37
|
</style>
|
|
@@ -17,11 +17,15 @@ Use the component with or without navigation items based on your needs. -->
|
|
|
17
17
|
serviceUrl = "#",
|
|
18
18
|
navigationItems = undefined,
|
|
19
19
|
collapseOnDesktop = false,
|
|
20
|
+
customiseServiceNameLink = false,
|
|
21
|
+
serviceNameLinkStyle = "govuk-link no-underline",
|
|
20
22
|
} = $props<{
|
|
21
23
|
serviceName?: string;
|
|
22
24
|
serviceUrl?: string;
|
|
23
25
|
navigationItems?: NavigationItem[];
|
|
24
26
|
collapseOnDesktop?: boolean;
|
|
27
|
+
customiseServiceNameLink?: boolean;
|
|
28
|
+
serviceNameLinkStyle?: string;
|
|
25
29
|
}>();
|
|
26
30
|
|
|
27
31
|
// Reactive state declarations
|
|
@@ -94,7 +98,12 @@ Use the component with or without navigation items based on your needs. -->
|
|
|
94
98
|
<div class="govuk-width-container">
|
|
95
99
|
<div class="govuk-service-navigation__container">
|
|
96
100
|
<span class="govuk-service-navigation__service-name">
|
|
97
|
-
<a
|
|
101
|
+
<a
|
|
102
|
+
href={serviceUrl}
|
|
103
|
+
class={customiseServiceNameLink
|
|
104
|
+
? serviceNameLinkStyle
|
|
105
|
+
: "govuk-service-navigation__link"}
|
|
106
|
+
>
|
|
98
107
|
{serviceName}
|
|
99
108
|
</a>
|
|
100
109
|
</span>
|
|
@@ -145,3 +154,12 @@ Use the component with or without navigation items based on your needs. -->
|
|
|
145
154
|
</div>
|
|
146
155
|
</div>
|
|
147
156
|
</section>
|
|
157
|
+
|
|
158
|
+
<style>
|
|
159
|
+
.no-underline {
|
|
160
|
+
text-decoration: none;
|
|
161
|
+
}
|
|
162
|
+
.no-underline:hover {
|
|
163
|
+
text-decoration: underline;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
@@ -8,6 +8,8 @@ type $$ComponentProps = {
|
|
|
8
8
|
serviceUrl?: string;
|
|
9
9
|
navigationItems?: NavigationItem[];
|
|
10
10
|
collapseOnDesktop?: boolean;
|
|
11
|
+
customiseServiceNameLink?: boolean;
|
|
12
|
+
serviceNameLinkStyle?: string;
|
|
11
13
|
};
|
|
12
14
|
declare const ServiceNavigation: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
15
|
type ServiceNavigation = ReturnType<typeof ServiceNavigation>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { browser } from "$app/environment";
|
|
4
|
+
|
|
5
|
+
type Option = { id: string | number; label: string };
|
|
6
|
+
type SelectedWithColor = Option & { color: string };
|
|
7
|
+
|
|
8
|
+
// ---------- Props ----------
|
|
9
|
+
let {
|
|
10
|
+
options = [],
|
|
11
|
+
selectedWithColors = $bindable<SelectedWithColor[]>([]),
|
|
12
|
+
colorArray = ["#808080"],
|
|
13
|
+
placeholder = "Select...",
|
|
14
|
+
} = $props();
|
|
15
|
+
|
|
16
|
+
let showDropdown = $state(false);
|
|
17
|
+
let search = $state("");
|
|
18
|
+
|
|
19
|
+
// ---------- Assign colours to incoming items ----------
|
|
20
|
+
$effect(() => {
|
|
21
|
+
if (!Array.isArray(selectedWithColors)) return;
|
|
22
|
+
if (!colorArray.length) return;
|
|
23
|
+
|
|
24
|
+
const used = new Set(
|
|
25
|
+
selectedWithColors.map((s) => s.color).filter(Boolean),
|
|
26
|
+
);
|
|
27
|
+
let changed = false;
|
|
28
|
+
|
|
29
|
+
const updated = selectedWithColors.map((item) => {
|
|
30
|
+
if (item.color) return item;
|
|
31
|
+
const color = colorArray.find((c) => !used.has(c)) ?? colorArray[0];
|
|
32
|
+
used.add(color);
|
|
33
|
+
changed = true;
|
|
34
|
+
return { ...item, color };
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (changed) selectedWithColors = updated;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ---------- Compute filtered options ----------
|
|
41
|
+
const filteredOptions = $derived(
|
|
42
|
+
options.filter(
|
|
43
|
+
(o) =>
|
|
44
|
+
!selectedWithColors.some((s) => s.id === o.id) &&
|
|
45
|
+
o.label.toLowerCase().includes(search.toLowerCase()),
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// ---------- Helpers ----------
|
|
50
|
+
function getFirstAvailableColor() {
|
|
51
|
+
const used = new Set(selectedWithColors.map((s) => s.color));
|
|
52
|
+
return colorArray.find((c) => !used.has(c)) ?? colorArray[0];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function select(option: Option) {
|
|
56
|
+
const color = getFirstAvailableColor();
|
|
57
|
+
selectedWithColors = [...selectedWithColors, { ...option, color }];
|
|
58
|
+
search = "";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function remove(item: SelectedWithColor) {
|
|
62
|
+
selectedWithColors = selectedWithColors.filter((s) => s.id !== item.id);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Close dropdown on outside click — browser only
|
|
66
|
+
let container: HTMLDivElement | null = null;
|
|
67
|
+
|
|
68
|
+
onMount(() => {
|
|
69
|
+
if (!browser) return;
|
|
70
|
+
|
|
71
|
+
function handleOutside(e: MouseEvent) {
|
|
72
|
+
if (container && !container.contains(e.target as Node)) {
|
|
73
|
+
showDropdown = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
document.addEventListener("mousedown", handleOutside);
|
|
78
|
+
return () => document.removeEventListener("mousedown", handleOutside);
|
|
79
|
+
});
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<!-- ---------- TEMPLATE ---------- -->
|
|
83
|
+
<div class="container" bind:this={container}>
|
|
84
|
+
<div class="box" on:click={() => (showDropdown = true)}>
|
|
85
|
+
<input
|
|
86
|
+
{placeholder}
|
|
87
|
+
bind:value={search}
|
|
88
|
+
on:input={() => (showDropdown = true)}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<div class="tags">
|
|
92
|
+
{#each selectedWithColors as item (item.id)}
|
|
93
|
+
<span class="tag">
|
|
94
|
+
<span class="dot" style={`background:${item.color}`}></span>
|
|
95
|
+
{item.label}
|
|
96
|
+
<button on:click|stopPropagation={() => remove(item)}>×</button>
|
|
97
|
+
</span>
|
|
98
|
+
{/each}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
{#if showDropdown}
|
|
103
|
+
<ul class="dropdown">
|
|
104
|
+
{#each filteredOptions as o (o.id)}
|
|
105
|
+
<li on:click={() => select(o)}>{o.label}</li>
|
|
106
|
+
{/each}
|
|
107
|
+
|
|
108
|
+
{#if filteredOptions.length === 0}
|
|
109
|
+
<li class="no">No results</li>
|
|
110
|
+
{/if}
|
|
111
|
+
</ul>
|
|
112
|
+
{/if}
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<style>
|
|
116
|
+
.container {
|
|
117
|
+
position: relative;
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.box {
|
|
122
|
+
border: 1px solid #ccc;
|
|
123
|
+
padding: 8px;
|
|
124
|
+
border-radius: 6px;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
input {
|
|
129
|
+
width: 100%;
|
|
130
|
+
font-size: 16px;
|
|
131
|
+
border: none;
|
|
132
|
+
outline: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.tags {
|
|
136
|
+
margin-top: 6px;
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
gap: 4px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tag {
|
|
143
|
+
background: #f3f2f1;
|
|
144
|
+
padding: 2px 6px;
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 6px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.dot {
|
|
152
|
+
width: 10px;
|
|
153
|
+
height: 10px;
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
border: 1px solid #999;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.dropdown {
|
|
159
|
+
position: absolute;
|
|
160
|
+
background: white;
|
|
161
|
+
width: 100%;
|
|
162
|
+
border: 1px solid #ccc;
|
|
163
|
+
border-radius: 6px;
|
|
164
|
+
margin-top: 4px;
|
|
165
|
+
z-index: 10;
|
|
166
|
+
max-height: 200px;
|
|
167
|
+
overflow-y: auto;
|
|
168
|
+
padding: 0;
|
|
169
|
+
list-style: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.dropdown li {
|
|
173
|
+
padding: 8px;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.dropdown li:hover {
|
|
178
|
+
background: #eef4ff;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.no {
|
|
182
|
+
color: #777;
|
|
183
|
+
padding: 8px;
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const BasicMultiSelect: import("svelte").Component<{
|
|
2
|
+
options?: any[];
|
|
3
|
+
selectedWithColors?: any[];
|
|
4
|
+
colorArray?: any[];
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
}, {}, "selectedWithColors">;
|
|
7
|
+
type BasicMultiSelect = ReturnType<typeof BasicMultiSelect>;
|
|
8
|
+
export default BasicMultiSelect;
|
|
@@ -1,101 +1,89 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import CardHeader from "./CardHeader.svelte";
|
|
3
|
+
|
|
2
4
|
let {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
headerIsLink = true,
|
|
6
|
+
headerText = "Card header",
|
|
7
|
+
headerTextSize = "1.5rem",
|
|
8
|
+
headerTextColor = "#1D70B8",
|
|
9
|
+
headerBackgroundColor = "white",
|
|
6
10
|
href = undefined,
|
|
7
|
-
|
|
8
|
-
bodyText =
|
|
11
|
+
onlyTextInBody = true,
|
|
12
|
+
bodyText = "Text in the body of the card",
|
|
13
|
+
headerSnippet = undefined,
|
|
14
|
+
bodySnippet = undefined,
|
|
15
|
+
children = undefined,
|
|
9
16
|
bodyTextColor = "#0B0C0C",
|
|
10
17
|
bodyBackgroundColor = "#FBFCFD",
|
|
11
18
|
bodyTopBorderColor = "#F4F8FB",
|
|
12
19
|
bodyBottomBorderColor = "#c3d9e9",
|
|
13
20
|
selectedValue = $bindable(),
|
|
14
|
-
|
|
21
|
+
display = "flex",
|
|
22
|
+
gridPosition = undefined,
|
|
23
|
+
subtitle = undefined,
|
|
15
24
|
} = $props();
|
|
16
25
|
</script>
|
|
17
26
|
|
|
18
|
-
<div class="card">
|
|
27
|
+
<div class="card" style="display: {display}">
|
|
19
28
|
<div
|
|
20
|
-
class="
|
|
21
|
-
style="background-color: {
|
|
29
|
+
class="header-div"
|
|
30
|
+
style="background-color: {headerBackgroundColor}; grid-row: {gridPosition?.[0]
|
|
31
|
+
?.row ?? null}; grid-column: {gridPosition?.[0]?.col ?? null};"
|
|
22
32
|
>
|
|
23
|
-
{#if
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
33
|
-
width="10"
|
|
34
|
-
height="17"
|
|
35
|
-
viewBox="0 0 10 17"
|
|
36
|
-
fill="none"
|
|
37
|
-
>
|
|
38
|
-
<path
|
|
39
|
-
d="M6.21622 8.5L0 2.36667L1.89189 0.5L10 8.5L1.89189 16.5L0 14.6333L6.21622 8.5Z"
|
|
40
|
-
fill={linkTextColor}
|
|
41
|
-
></path>
|
|
42
|
-
</svg>
|
|
43
|
-
</a>
|
|
33
|
+
{#if headerIsLink}
|
|
34
|
+
<CardHeader
|
|
35
|
+
text={headerText}
|
|
36
|
+
textSize={headerTextSize}
|
|
37
|
+
textColor={headerTextColor}
|
|
38
|
+
backgroundColor={headerBackgroundColor}
|
|
39
|
+
{href}
|
|
40
|
+
{subtitle}
|
|
41
|
+
></CardHeader>
|
|
44
42
|
{:else}
|
|
45
|
-
{@render
|
|
43
|
+
{@render headerSnippet?.()}
|
|
46
44
|
{/if}
|
|
47
45
|
</div>
|
|
48
46
|
|
|
49
47
|
<div
|
|
50
48
|
class="body-div"
|
|
51
|
-
style="--body-bg-color: {bodyBackgroundColor}; --body-bottom-border-color: {bodyBottomBorderColor}; --body-top-border-color: {bodyTopBorderColor};
|
|
49
|
+
style="--body-bg-color: {bodyBackgroundColor}; --body-bottom-border-color: {bodyBottomBorderColor}; --body-top-border-color: {bodyTopBorderColor}; grid-row: {gridPosition?.[1]
|
|
50
|
+
?.row ?? null}; grid-column: {gridPosition?.[1]?.col ?? null};"
|
|
52
51
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
{#if onlyTextInBody}
|
|
53
|
+
<p
|
|
54
|
+
class="govuk-body body-text"
|
|
55
|
+
style="--body-text-color: {bodyTextColor};"
|
|
56
|
+
>
|
|
57
|
+
{bodyText}
|
|
58
|
+
</p>
|
|
59
|
+
{:else if children}
|
|
60
|
+
{@render children?.()}
|
|
61
|
+
{:else}
|
|
62
|
+
{@render bodySnippet?.()}
|
|
63
|
+
{/if}
|
|
56
64
|
</div>
|
|
57
65
|
</div>
|
|
58
66
|
|
|
59
67
|
<style>
|
|
60
68
|
.card {
|
|
61
|
-
display: flex;
|
|
62
69
|
flex-direction: column;
|
|
70
|
+
min-width: 0;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
.
|
|
66
|
-
padding:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.link {
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
justify-content: space-between;
|
|
73
|
-
width: 100%;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.link-heading {
|
|
77
|
-
color: var(--link-text-color);
|
|
73
|
+
.header-div {
|
|
74
|
+
padding: 20px;
|
|
75
|
+
flex: 1;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
.body-div {
|
|
81
79
|
background-color: var(--body-bg-color);
|
|
82
80
|
border-bottom: 1px solid var(--body-bottom-border-color);
|
|
83
81
|
border-top: 1px solid var(--body-top-border-color);
|
|
84
|
-
padding:
|
|
82
|
+
padding: 15px 20px;
|
|
85
83
|
flex: 1;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
.body-text {
|
|
89
87
|
color: var(--body-text-color);
|
|
90
88
|
}
|
|
91
|
-
|
|
92
|
-
.govuk-heading-m {
|
|
93
|
-
/* overwriting margin and line-height to make link centered vertically */
|
|
94
|
-
margin: 0;
|
|
95
|
-
line-height: 1;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
a {
|
|
99
|
-
color: #1d70b8;
|
|
100
|
-
}
|
|
101
89
|
</style>
|
|
@@ -4,30 +4,44 @@ type Card = {
|
|
|
4
4
|
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
5
|
};
|
|
6
6
|
declare const Card: import("svelte").Component<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
headerIsLink?: boolean;
|
|
8
|
+
headerText?: string;
|
|
9
|
+
headerTextSize?: string;
|
|
10
|
+
headerTextColor?: string;
|
|
11
|
+
headerBackgroundColor?: string;
|
|
10
12
|
href?: any;
|
|
11
|
-
|
|
12
|
-
bodyText?:
|
|
13
|
+
onlyTextInBody?: boolean;
|
|
14
|
+
bodyText?: string;
|
|
15
|
+
headerSnippet?: any;
|
|
16
|
+
bodySnippet?: any;
|
|
17
|
+
children?: any;
|
|
13
18
|
bodyTextColor?: string;
|
|
14
19
|
bodyBackgroundColor?: string;
|
|
15
20
|
bodyTopBorderColor?: string;
|
|
16
21
|
bodyBottomBorderColor?: string;
|
|
17
22
|
selectedValue?: any;
|
|
18
|
-
|
|
23
|
+
display?: string;
|
|
24
|
+
gridPosition?: any;
|
|
25
|
+
subtitle?: any;
|
|
19
26
|
}, {}, "selectedValue">;
|
|
20
27
|
type $$ComponentProps = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
headerIsLink?: boolean;
|
|
29
|
+
headerText?: string;
|
|
30
|
+
headerTextSize?: string;
|
|
31
|
+
headerTextColor?: string;
|
|
32
|
+
headerBackgroundColor?: string;
|
|
24
33
|
href?: any;
|
|
25
|
-
|
|
26
|
-
bodyText?:
|
|
34
|
+
onlyTextInBody?: boolean;
|
|
35
|
+
bodyText?: string;
|
|
36
|
+
headerSnippet?: any;
|
|
37
|
+
bodySnippet?: any;
|
|
38
|
+
children?: any;
|
|
27
39
|
bodyTextColor?: string;
|
|
28
40
|
bodyBackgroundColor?: string;
|
|
29
41
|
bodyTopBorderColor?: string;
|
|
30
42
|
bodyBottomBorderColor?: string;
|
|
31
43
|
selectedValue?: any;
|
|
32
|
-
|
|
44
|
+
display?: string;
|
|
45
|
+
gridPosition?: any;
|
|
46
|
+
subtitle?: any;
|
|
33
47
|
};
|