@communitiesuk/svelte-component-library 0.1.18 → 0.2.0-alpha.2
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 +30 -6
- package/dist/assets/css/base.css +9 -0
- package/dist/assets/css/code-block.css +116 -0
- package/dist/assets/css/components.css +47 -0
- package/dist/assets/css/fonts.css +19 -0
- package/dist/assets/css/govuk-additional.css +142 -0
- package/dist/assets/css/govuk-frontend.min.css +2 -2
- package/dist/assets/css/moduk.css +1 -0
- package/dist/assets/css/moj-frontend.min copy.css +4108 -0
- package/dist/assets/css/moj-frontend.min.css +2 -0
- package/dist/assets/css/moj-frontend.min.css.map +1 -0
- package/dist/assets/css/utilities.css +0 -0
- package/dist/assets/images/govuk-crest.svg +1 -1
- package/dist/assets/js/govuk-frontend.min.js +1 -0
- package/dist/assets/js/moj-frontend.min.js +1 -0
- package/dist/assets/rebrand/images/favicon.ico +0 -0
- package/dist/assets/rebrand/images/favicon.svg +1 -0
- package/dist/assets/rebrand/images/govuk-crest.svg +1 -0
- package/dist/assets/rebrand/images/govuk-icon-180.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-192.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-512.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-mask.svg +1 -0
- package/dist/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- package/dist/assets/rebrand/manifest.json +39 -0
- package/dist/components/data-vis/line-chart/Line.svelte +48 -40
- package/dist/components/data-vis/line-chart/Line.svelte.d.ts +6 -4
- package/dist/components/data-vis/line-chart/LineChart.svelte +145 -36
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +25 -9
- package/dist/components/data-vis/line-chart/Lines.svelte +10 -23
- package/dist/components/data-vis/line-chart/Lines.svelte.d.ts +8 -4
- package/dist/components/data-vis/line-chart/Marker.svelte +31 -5
- package/dist/components/data-vis/line-chart/Marker.svelte.d.ts +6 -2
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte +7 -8
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte.d.ts +2 -2
- package/dist/components/data-vis/line-chart/ValueLabel.svelte +26 -34
- package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +8 -4
- package/dist/components/data-vis/map/Map.svelte +299 -71
- package/dist/components/data-vis/map/Map.svelte.d.ts +39 -12
- package/dist/components/data-vis/map/NonStandardControls.svelte +10 -1
- package/dist/components/data-vis/map/NonStandardControls.svelte.d.ts +12 -11
- package/dist/components/data-vis/map/Tooltip.svelte +3 -4
- package/dist/components/data-vis/map/Tooltip.svelte.d.ts +0 -2
- package/dist/components/data-vis/map/mapUtils.d.ts +2 -0
- package/dist/components/data-vis/map/mapUtils.js +50 -0
- package/dist/components/data-vis/table/Table.svelte +28 -40
- package/dist/components/data-vis/table/Table.svelte.d.ts +0 -2
- package/dist/components/layout/Breadcrumbs.svelte +10 -12
- package/dist/components/layout/Breadcrumbs.svelte.d.ts +1 -0
- package/dist/components/layout/Footer.svelte +69 -4
- package/dist/components/layout/Footer.svelte.d.ts +3 -0
- package/dist/components/layout/Header.svelte +56 -16
- package/dist/components/layout/Header.svelte.d.ts +1 -0
- package/dist/components/layout/InternalHeader.svelte +155 -150
- package/dist/components/layout/InternalHeader.svelte.d.ts +1 -0
- package/dist/components/ui/Button.svelte +78 -4
- package/dist/components/ui/Button.svelte.d.ts +2 -0
- package/dist/components/ui/CookieBanner.svelte +356 -0
- package/dist/components/ui/CookieBanner.svelte.d.ts +18 -0
- package/dist/components/ui/FilterPanel.svelte +167 -158
- package/dist/components/ui/FilterPanel.svelte.d.ts +2 -0
- package/dist/components/ui/Masthead.svelte +35 -23
- package/dist/components/ui/Masthead.svelte.d.ts +2 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte +200 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte.d.ts +37 -0
- package/dist/components/ui/Search.svelte +2 -2
- package/dist/components/ui/SearchAutocomplete.svelte +104 -14
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +4 -0
- package/dist/data/IMD2019.json +32846 -0
- package/dist/data/places.csv +20039 -0
- package/dist/data/places.json +100192 -0
- package/dist/data/svgFontDimensions.json +90 -0
- package/dist/data/testData.json +52632 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/package-wrapping/BaseInformation.svelte +0 -33
- package/dist/package-wrapping/SidebarContainer.svelte +0 -7
- package/dist/utils/area-search/geoConfig.d.ts +435 -0
- package/dist/utils/area-search/geoConfig.js +291 -0
- package/dist/utils/cookiesNavigation.d.ts +44 -0
- package/dist/utils/cookiesNavigation.js +63 -0
- package/dist/utils/data-transformations/convert-csv-to-json-proper.cjs +88 -0
- package/dist/utils/data-transformations/convert-csv-to-json-proper.d.cts +1 -0
- package/dist/utils/data-transformations/convertCSV.d.ts +6 -0
- package/dist/utils/data-transformations/convertCSV.js +40 -21
- package/dist/utils/text-string-conversion/textStringConversion.d.ts +6 -0
- package/dist/utils/text-string-conversion/textStringConversion.js +10 -0
- package/package.json +18 -7
- package/dist/components/ui/Breadcrumbs.svelte +0 -198
- package/dist/components/ui/Breadcrumbs.svelte.d.ts +0 -24
- package/dist/components/ui/Footer.svelte +0 -171
- package/dist/components/ui/Footer.svelte.d.ts +0 -30
- package/dist/components/ui/Header.svelte +0 -43
- package/dist/components/ui/Header.svelte.d.ts +0 -7
- package/dist/components/ui/ServiceNavigation.svelte +0 -143
- package/dist/components/ui/ServiceNavigation.svelte.d.ts +0 -13
- package/dist/components/ui/SideNavigation.svelte +0 -346
- package/dist/components/ui/SideNavigation.svelte.d.ts +0 -25
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { onMount } from "svelte";
|
|
3
|
-
import { page } from "$app/stores";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Breadcrumbs component
|
|
7
|
-
*
|
|
8
|
-
* Use this component to display a navigation path to the current page.
|
|
9
|
-
*
|
|
10
|
-
* Features:
|
|
11
|
-
* - Automatically generates breadcrumbs based on the current route
|
|
12
|
-
* - Set `collapseOnMobile` to true to show only the first and last items on mobile devices
|
|
13
|
-
* - Set `inverse` to true to show white links on dark backgrounds (ensure contrast ratio of 4.5:1)
|
|
14
|
-
* - Optionally provide custom items array to override automatic breadcrumb generation
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// Define the BreadcrumbItem type
|
|
18
|
-
export type BreadcrumbItem = {
|
|
19
|
-
text: string;
|
|
20
|
-
href: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Component props
|
|
24
|
-
let {
|
|
25
|
-
items = undefined,
|
|
26
|
-
collapseOnMobile = false,
|
|
27
|
-
inverse = false,
|
|
28
|
-
ariaLabel = "Breadcrumb",
|
|
29
|
-
} = $props<{
|
|
30
|
-
items?: BreadcrumbItem[];
|
|
31
|
-
collapseOnMobile?: boolean;
|
|
32
|
-
inverse?: boolean;
|
|
33
|
-
ariaLabel?: string;
|
|
34
|
-
}>();
|
|
35
|
-
|
|
36
|
-
// Load all page modules for route detection
|
|
37
|
-
const routeModules = $state<Record<string, any>>({});
|
|
38
|
-
|
|
39
|
-
onMount(async () => {
|
|
40
|
-
try {
|
|
41
|
-
// Use Vite's glob import to get all page components
|
|
42
|
-
const modules = import.meta.glob("/src/routes/**/+page.svelte", {
|
|
43
|
-
eager: true,
|
|
44
|
-
});
|
|
45
|
-
Object.assign(routeModules, modules);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
console.warn("Failed to load route modules:", error);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Add support detection
|
|
52
|
-
let isSupported = $state(false);
|
|
53
|
-
onMount(() => {
|
|
54
|
-
isSupported =
|
|
55
|
-
document.body?.classList.contains("govuk-frontend-supported") ?? false;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// State variable to hold the current breadcrumb items
|
|
59
|
-
let breadcrumbItems = $state<BreadcrumbItem[]>([]);
|
|
60
|
-
|
|
61
|
-
// Effect to update breadcrumb items when dependencies change
|
|
62
|
-
$effect(() => {
|
|
63
|
-
breadcrumbItems = items || generateBreadcrumbItems($page, routeModules);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Generate breadcrumb items from the current route
|
|
67
|
-
function generateBreadcrumbItems(page, modules): BreadcrumbItem[] {
|
|
68
|
-
const path = page.url.pathname;
|
|
69
|
-
const pathSegments = path.split("/").filter((segment) => segment !== "");
|
|
70
|
-
|
|
71
|
-
// Always include home page
|
|
72
|
-
const items: BreadcrumbItem[] = [{ text: "Home", href: "/" }];
|
|
73
|
-
|
|
74
|
-
// Build up paths for each breadcrumb
|
|
75
|
-
let currentPath = "";
|
|
76
|
-
|
|
77
|
-
for (let i = 0; i < pathSegments.length; i++) {
|
|
78
|
-
currentPath += `/${pathSegments[i]}`;
|
|
79
|
-
|
|
80
|
-
// Check if this path has a corresponding +page.svelte file
|
|
81
|
-
const isValidRoute = isPathValid(currentPath, modules);
|
|
82
|
-
|
|
83
|
-
// Add breadcrumb if it's a valid route or the current page
|
|
84
|
-
if (isValidRoute || i === pathSegments.length - 1) {
|
|
85
|
-
// Try to get custom title from module exports
|
|
86
|
-
const customTitle = getCustomTitle(currentPath, modules, page.data);
|
|
87
|
-
|
|
88
|
-
// Format text (convert slug to readable text)
|
|
89
|
-
const text = customTitle || formatBreadcrumbText(pathSegments[i]);
|
|
90
|
-
|
|
91
|
-
items.push({
|
|
92
|
-
text: text,
|
|
93
|
-
href: currentPath,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return items;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Check if a path has a corresponding page component
|
|
102
|
-
function isPathValid(path: string, modules: Record<string, any>): boolean {
|
|
103
|
-
// For the root path
|
|
104
|
-
if (path === "/") return true;
|
|
105
|
-
|
|
106
|
-
// Normalize the path to check against module paths
|
|
107
|
-
const modulePath = `/src/routes${path}/+page.svelte`;
|
|
108
|
-
const dynamicModulePaths = Object.keys(modules).filter((m) => {
|
|
109
|
-
// Convert dynamic route patterns like [id] to regex pattern that matches :id or actual values
|
|
110
|
-
const pattern = m.replace(/\[([^\]]+)\]/g, "([^/]+)");
|
|
111
|
-
const regex = new RegExp(
|
|
112
|
-
`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`,
|
|
113
|
-
);
|
|
114
|
-
return regex.test(modulePath);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
return dynamicModulePaths.length > 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Try to get custom title from module exports
|
|
121
|
-
function getCustomTitle(
|
|
122
|
-
path: string,
|
|
123
|
-
modules: Record<string, any>,
|
|
124
|
-
pageData: any,
|
|
125
|
-
): string | null {
|
|
126
|
-
const modulePath = `/src/routes${path}/+page.svelte`;
|
|
127
|
-
|
|
128
|
-
// Check for exact match first
|
|
129
|
-
if (modules[modulePath]) {
|
|
130
|
-
// Check if module exports pageTitle
|
|
131
|
-
if (modules[modulePath].pageTitle) {
|
|
132
|
-
return modules[modulePath].pageTitle;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Check if module exports getPageTitle function
|
|
136
|
-
if (typeof modules[modulePath].getPageTitle === "function") {
|
|
137
|
-
return modules[modulePath].getPageTitle(pageData);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Check for dynamic routes
|
|
142
|
-
const dynamicModulePath = Object.keys(modules).find((m) => {
|
|
143
|
-
const pattern = m.replace(/\[([^\]]+)\]/g, "([^/]+)");
|
|
144
|
-
const regex = new RegExp(
|
|
145
|
-
`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`,
|
|
146
|
-
);
|
|
147
|
-
return regex.test(modulePath);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
if (dynamicModulePath && modules[dynamicModulePath]) {
|
|
151
|
-
if (modules[dynamicModulePath].pageTitle) {
|
|
152
|
-
return modules[dynamicModulePath].pageTitle;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (typeof modules[dynamicModulePath].getPageTitle === "function") {
|
|
156
|
-
return modules[dynamicModulePath].getPageTitle(pageData);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Converts route segments to human-readable text
|
|
165
|
-
*/
|
|
166
|
-
function formatBreadcrumbText(text: string): string {
|
|
167
|
-
// Handle special cases
|
|
168
|
-
if (text === "ui") return "UI Components";
|
|
169
|
-
if (text === "data-vis") return "Data Visualization";
|
|
170
|
-
if (text === "content") return "Content Components";
|
|
171
|
-
if (text === "layout") return "Layout Components";
|
|
172
|
-
if (text === "user-guide") return "User Guide";
|
|
173
|
-
if (text === "playground") return "Playground";
|
|
174
|
-
if (text === "components") return "Components";
|
|
175
|
-
if (text === "local-lib") return "Local Library";
|
|
176
|
-
|
|
177
|
-
// Default: capitalize and replace hyphens with spaces
|
|
178
|
-
return text
|
|
179
|
-
.split("-")
|
|
180
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
181
|
-
.join(" ");
|
|
182
|
-
}
|
|
183
|
-
</script>
|
|
184
|
-
|
|
185
|
-
<nav
|
|
186
|
-
class="govuk-breadcrumbs
|
|
187
|
-
{collapseOnMobile ? 'govuk-breadcrumbs--collapse-on-mobile' : ''}
|
|
188
|
-
{inverse ? 'govuk-breadcrumbs--inverse' : ''}"
|
|
189
|
-
aria-label={ariaLabel}
|
|
190
|
-
>
|
|
191
|
-
<ol class="govuk-breadcrumbs__list">
|
|
192
|
-
{#each breadcrumbItems as item}
|
|
193
|
-
<li class="govuk-breadcrumbs__list-item">
|
|
194
|
-
<a class="govuk-breadcrumbs__link" href={item.href}>{item.text}</a>
|
|
195
|
-
</li>
|
|
196
|
-
{/each}
|
|
197
|
-
</ol>
|
|
198
|
-
</nav>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Breadcrumbs component
|
|
3
|
-
*
|
|
4
|
-
* Use this component to display a navigation path to the current page.
|
|
5
|
-
*
|
|
6
|
-
* Features:
|
|
7
|
-
* - Automatically generates breadcrumbs based on the current route
|
|
8
|
-
* - Set `collapseOnMobile` to true to show only the first and last items on mobile devices
|
|
9
|
-
* - Set `inverse` to true to show white links on dark backgrounds (ensure contrast ratio of 4.5:1)
|
|
10
|
-
* - Optionally provide custom items array to override automatic breadcrumb generation
|
|
11
|
-
*/
|
|
12
|
-
export type BreadcrumbItem = {
|
|
13
|
-
text: string;
|
|
14
|
-
href: string;
|
|
15
|
-
};
|
|
16
|
-
type $$ComponentProps = {
|
|
17
|
-
items?: BreadcrumbItem[];
|
|
18
|
-
collapseOnMobile?: boolean;
|
|
19
|
-
inverse?: boolean;
|
|
20
|
-
ariaLabel?: string;
|
|
21
|
-
};
|
|
22
|
-
declare const Breadcrumbs: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
23
|
-
type Breadcrumbs = ReturnType<typeof Breadcrumbs>;
|
|
24
|
-
export default Breadcrumbs;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// Define component props with default values
|
|
3
|
-
// sections: array of footer navigation sections
|
|
4
|
-
// inlineLinks: array of inline footer links
|
|
5
|
-
// metaCustomContent: custom HTML content for meta section
|
|
6
|
-
// containerWidth: width class for the container
|
|
7
|
-
// showLicence: toggle for OGL license display
|
|
8
|
-
// showCopyright: toggle for crown copyright display
|
|
9
|
-
// copyrightLogoUrl: URL for the crown copyright logo background image (overrides the default CSS background-image)
|
|
10
|
-
// copyrightText: Text to display for the crown copyright notice
|
|
11
|
-
// crownSvgPath: SVG path data for the crown logo used in the license section
|
|
12
|
-
// licenceHref: URL for the Open Government Licence link
|
|
13
|
-
// licenceLinkText: Text for the Open Government Licence link
|
|
14
|
-
// licenceTextBefore: Text to display before the licence link
|
|
15
|
-
// licenceTextAfter: Text to display after the licence link
|
|
16
|
-
// copyrightHref: URL for the crown copyright link
|
|
17
|
-
|
|
18
|
-
// Define types for component props
|
|
19
|
-
interface FooterItem {
|
|
20
|
-
href: string;
|
|
21
|
-
label: string;
|
|
22
|
-
lang?: string;
|
|
23
|
-
hrefLang?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface FooterSection {
|
|
27
|
-
title: string;
|
|
28
|
-
columns?: number;
|
|
29
|
-
items: FooterItem[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Define component props with types and default values
|
|
33
|
-
let {
|
|
34
|
-
sections = [] as FooterSection[],
|
|
35
|
-
inlineLinks = [] as FooterItem[],
|
|
36
|
-
metaCustomContent = "",
|
|
37
|
-
containerWidth = "govuk-width-container",
|
|
38
|
-
showLicence = true,
|
|
39
|
-
showCopyright = true,
|
|
40
|
-
copyrightLogoUrl = "/assets/images/govuk-crest.svg",
|
|
41
|
-
copyrightText = "© Crown copyright",
|
|
42
|
-
crownSvgPath = "M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145",
|
|
43
|
-
licenceHref = "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",
|
|
44
|
-
licenceLinkText = "Open Government Licence v3.0",
|
|
45
|
-
licenceTextBefore = "All content is available under the ",
|
|
46
|
-
licenceTextAfter = ", except where otherwise stated",
|
|
47
|
-
copyrightHref = "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/",
|
|
48
|
-
} = $props<{
|
|
49
|
-
sections?: FooterSection[];
|
|
50
|
-
inlineLinks?: FooterItem[];
|
|
51
|
-
metaCustomContent?: string;
|
|
52
|
-
containerWidth?: string;
|
|
53
|
-
showLicence?: boolean;
|
|
54
|
-
showCopyright?: boolean;
|
|
55
|
-
copyrightLogoUrl?: string;
|
|
56
|
-
copyrightText?: string;
|
|
57
|
-
crownSvgPath?: string;
|
|
58
|
-
licenceHref?: string;
|
|
59
|
-
licenceLinkText?: string;
|
|
60
|
-
licenceTextBefore?: string;
|
|
61
|
-
licenceTextAfter?: string;
|
|
62
|
-
copyrightHref?: string;
|
|
63
|
-
}>();
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<!-- Main footer container -->
|
|
67
|
-
<footer class="govuk-footer">
|
|
68
|
-
<div class={containerWidth}>
|
|
69
|
-
<!-- Navigation sections (optional) -->
|
|
70
|
-
{#if sections.length > 0}
|
|
71
|
-
<div class="govuk-footer__navigation">
|
|
72
|
-
<!-- Iterate through each footer section -->
|
|
73
|
-
{#each sections as section}
|
|
74
|
-
<div
|
|
75
|
-
class="govuk-footer__section {section.columns === 2
|
|
76
|
-
? 'govuk-grid-column-two-thirds'
|
|
77
|
-
: 'govuk-grid-column-one-third'}"
|
|
78
|
-
>
|
|
79
|
-
<h2 class="govuk-footer__heading govuk-heading-m">
|
|
80
|
-
{section.title}
|
|
81
|
-
</h2>
|
|
82
|
-
<ul
|
|
83
|
-
class="govuk-footer__list {section.columns === 2
|
|
84
|
-
? 'govuk-footer__list--columns-2'
|
|
85
|
-
: ''}"
|
|
86
|
-
>
|
|
87
|
-
{#each section.items as item}
|
|
88
|
-
<li class="govuk-footer__list-item">
|
|
89
|
-
<a
|
|
90
|
-
class="govuk-footer__link"
|
|
91
|
-
href={item.href}
|
|
92
|
-
lang={item.lang}
|
|
93
|
-
hreflang={item.hrefLang}
|
|
94
|
-
>
|
|
95
|
-
{item.label}
|
|
96
|
-
</a>
|
|
97
|
-
</li>
|
|
98
|
-
{/each}
|
|
99
|
-
</ul>
|
|
100
|
-
</div>
|
|
101
|
-
{/each}
|
|
102
|
-
</div>
|
|
103
|
-
<hr class="govuk-footer__section-break" />
|
|
104
|
-
{/if}
|
|
105
|
-
|
|
106
|
-
<!-- Footer meta section -->
|
|
107
|
-
<div class="govuk-footer__meta">
|
|
108
|
-
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
|
|
109
|
-
<!-- Inline links section (optional) -->
|
|
110
|
-
{#if inlineLinks.length > 0}
|
|
111
|
-
<h2 class="govuk-visually-hidden">Support links</h2>
|
|
112
|
-
<ul class="govuk-footer__inline-list">
|
|
113
|
-
{#each inlineLinks as link}
|
|
114
|
-
<li class="govuk-footer__inline-list-item">
|
|
115
|
-
<a
|
|
116
|
-
class="govuk-footer__link"
|
|
117
|
-
href={link.href}
|
|
118
|
-
lang={link.lang}
|
|
119
|
-
hreflang={link.hrefLang}
|
|
120
|
-
>
|
|
121
|
-
{link.label}
|
|
122
|
-
</a>
|
|
123
|
-
</li>
|
|
124
|
-
{/each}
|
|
125
|
-
</ul>
|
|
126
|
-
{/if}
|
|
127
|
-
|
|
128
|
-
<!-- Custom meta content (optional) -->
|
|
129
|
-
{#if metaCustomContent}
|
|
130
|
-
<div class="govuk-footer__meta-custom">
|
|
131
|
-
{@html metaCustomContent}
|
|
132
|
-
</div>
|
|
133
|
-
{/if}
|
|
134
|
-
|
|
135
|
-
<!-- Open Government License section (optional) -->
|
|
136
|
-
{#if showLicence}
|
|
137
|
-
<svg
|
|
138
|
-
aria-hidden="true"
|
|
139
|
-
focusable="false"
|
|
140
|
-
class="govuk-footer__licence-logo"
|
|
141
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
142
|
-
viewBox="0 0 483.2 195.7"
|
|
143
|
-
height="17"
|
|
144
|
-
width="41"
|
|
145
|
-
>
|
|
146
|
-
<path fill="currentColor" d={crownSvgPath}></path>
|
|
147
|
-
</svg>
|
|
148
|
-
<span class="govuk-footer__licence-description">
|
|
149
|
-
{licenceTextBefore}
|
|
150
|
-
<a class="govuk-footer__link" href={licenceHref} rel="license"
|
|
151
|
-
>{licenceLinkText}</a
|
|
152
|
-
>{licenceTextAfter}
|
|
153
|
-
</span>
|
|
154
|
-
{/if}
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<!-- Crown copyright section (optional) -->
|
|
158
|
-
{#if showCopyright}
|
|
159
|
-
<div class="govuk-footer__meta-item">
|
|
160
|
-
<a
|
|
161
|
-
class="govuk-footer__link govuk-footer__copyright-logo"
|
|
162
|
-
href={copyrightHref}
|
|
163
|
-
style="background-image: url({copyrightLogoUrl});"
|
|
164
|
-
>
|
|
165
|
-
{copyrightText}
|
|
166
|
-
</a>
|
|
167
|
-
</div>
|
|
168
|
-
{/if}
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</footer>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface FooterItem {
|
|
2
|
-
href: string;
|
|
3
|
-
label: string;
|
|
4
|
-
lang?: string;
|
|
5
|
-
hrefLang?: string;
|
|
6
|
-
}
|
|
7
|
-
interface FooterSection {
|
|
8
|
-
title: string;
|
|
9
|
-
columns?: number;
|
|
10
|
-
items: FooterItem[];
|
|
11
|
-
}
|
|
12
|
-
type $$ComponentProps = {
|
|
13
|
-
sections?: FooterSection[];
|
|
14
|
-
inlineLinks?: FooterItem[];
|
|
15
|
-
metaCustomContent?: string;
|
|
16
|
-
containerWidth?: string;
|
|
17
|
-
showLicence?: boolean;
|
|
18
|
-
showCopyright?: boolean;
|
|
19
|
-
copyrightLogoUrl?: string;
|
|
20
|
-
copyrightText?: string;
|
|
21
|
-
crownSvgPath?: string;
|
|
22
|
-
licenceHref?: string;
|
|
23
|
-
licenceLinkText?: string;
|
|
24
|
-
licenceTextBefore?: string;
|
|
25
|
-
licenceTextAfter?: string;
|
|
26
|
-
copyrightHref?: string;
|
|
27
|
-
};
|
|
28
|
-
declare const Footer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
29
|
-
type Footer = ReturnType<typeof Footer>;
|
|
30
|
-
export default Footer;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!-- Default GOV.UK header
|
|
2
|
-
Most services on GOV.UK should use the default GOV.UK header.
|
|
3
|
-
|
|
4
|
-
It should only show the GOV.UK logo and any GOV.UK-wide links and tools to help your users. Do not add the menu of GOV.UK topic links to your service's GOV.UK header. -->
|
|
5
|
-
|
|
6
|
-
<script lang="ts">
|
|
7
|
-
let { fullWidthBorder = false, homepageUrl = "/" } = $props<{
|
|
8
|
-
fullWidthBorder?: boolean;
|
|
9
|
-
homepageUrl?: string;
|
|
10
|
-
}>();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<header
|
|
14
|
-
class="govuk-header{fullWidthBorder
|
|
15
|
-
? ' govuk-header--full-width-border'
|
|
16
|
-
: ''}"
|
|
17
|
-
data-module="govuk-header"
|
|
18
|
-
>
|
|
19
|
-
<div class="govuk-header__container govuk-width-container">
|
|
20
|
-
<div class="govuk-header__logo">
|
|
21
|
-
<a
|
|
22
|
-
href={homepageUrl}
|
|
23
|
-
class="govuk-header__link govuk-header__link--homepage"
|
|
24
|
-
>
|
|
25
|
-
<svg
|
|
26
|
-
focusable="false"
|
|
27
|
-
role="img"
|
|
28
|
-
class="govuk-header__logotype"
|
|
29
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
-
viewBox="0 0 148 30"
|
|
31
|
-
height="30"
|
|
32
|
-
width="148"
|
|
33
|
-
aria-label="GOV.UK"
|
|
34
|
-
>
|
|
35
|
-
<title>GOV.UK</title>
|
|
36
|
-
<path
|
|
37
|
-
d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1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.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z"
|
|
38
|
-
></path>
|
|
39
|
-
</svg>
|
|
40
|
-
</a>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</header>
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<!-- Service Navigation component
|
|
2
|
-
Use the component with or without navigation items based on your needs. -->
|
|
3
|
-
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
import { onMount } from "svelte";
|
|
6
|
-
import { browser } from "$app/environment";
|
|
7
|
-
|
|
8
|
-
// Define types for navigation items
|
|
9
|
-
type NavigationItem = {
|
|
10
|
-
href: string;
|
|
11
|
-
label: string;
|
|
12
|
-
isActive?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
serviceName = "Service name",
|
|
17
|
-
serviceUrl = "#",
|
|
18
|
-
navigationItems = undefined,
|
|
19
|
-
} = $props<{
|
|
20
|
-
serviceName?: string;
|
|
21
|
-
serviceUrl?: string;
|
|
22
|
-
navigationItems?: NavigationItem[];
|
|
23
|
-
}>();
|
|
24
|
-
|
|
25
|
-
// Reactive state declarations
|
|
26
|
-
let hasNavigation = $derived(navigationItems && navigationItems.length > 0);
|
|
27
|
-
let menuIsOpen = $state(false);
|
|
28
|
-
let isDesktopView = $state(true); // Default to desktop view until we can check
|
|
29
|
-
let tabletBreakpoint = $state("");
|
|
30
|
-
|
|
31
|
-
// References to DOM elements
|
|
32
|
-
let navigationElement = $state<HTMLElement | null>(null);
|
|
33
|
-
let buttonElement = $state<HTMLButtonElement | null>(null);
|
|
34
|
-
|
|
35
|
-
// Derived values for UI state
|
|
36
|
-
let isMenuVisible = $derived(isDesktopView || menuIsOpen);
|
|
37
|
-
let isButtonHidden = $derived(isDesktopView);
|
|
38
|
-
|
|
39
|
-
onMount(() => {
|
|
40
|
-
if (!browser) return;
|
|
41
|
-
|
|
42
|
-
// Get the breakpoint from CSS custom property
|
|
43
|
-
const property = "--govuk-frontend-breakpoint-tablet";
|
|
44
|
-
const value = window
|
|
45
|
-
.getComputedStyle(document.documentElement)
|
|
46
|
-
.getPropertyValue(property)
|
|
47
|
-
.trim();
|
|
48
|
-
|
|
49
|
-
tabletBreakpoint = value || "768px";
|
|
50
|
-
|
|
51
|
-
if (!value) {
|
|
52
|
-
console.warn(
|
|
53
|
-
"CSS custom property (--govuk-frontend-breakpoint-tablet) not found, using fallback",
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Initialize media query
|
|
58
|
-
const mql = window.matchMedia(`(min-width: ${tabletBreakpoint})`);
|
|
59
|
-
|
|
60
|
-
// Set initial state
|
|
61
|
-
isDesktopView = mql.matches;
|
|
62
|
-
|
|
63
|
-
// Set up event listener for viewport changes
|
|
64
|
-
const handleViewportChange = (e: MediaQueryListEvent) => {
|
|
65
|
-
isDesktopView = e.matches;
|
|
66
|
-
if (isDesktopView) {
|
|
67
|
-
// Reset menu state when switching to desktop
|
|
68
|
-
menuIsOpen = false;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
mql.addEventListener("change", handleViewportChange);
|
|
73
|
-
|
|
74
|
-
return () => {
|
|
75
|
-
mql.removeEventListener("change", handleViewportChange);
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Handle menu button click
|
|
80
|
-
function toggleMenu() {
|
|
81
|
-
menuIsOpen = !menuIsOpen;
|
|
82
|
-
}
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<section
|
|
86
|
-
aria-label="Service information"
|
|
87
|
-
class="govuk-service-navigation"
|
|
88
|
-
data-module="govuk-service-navigation"
|
|
89
|
-
>
|
|
90
|
-
<div class="govuk-width-container">
|
|
91
|
-
<div class="govuk-service-navigation__container">
|
|
92
|
-
<span class="govuk-service-navigation__service-name">
|
|
93
|
-
<a href={serviceUrl} class="govuk-service-navigation__link">
|
|
94
|
-
{serviceName}
|
|
95
|
-
</a>
|
|
96
|
-
</span>
|
|
97
|
-
|
|
98
|
-
{#if hasNavigation}
|
|
99
|
-
<nav aria-label="Menu" class="govuk-service-navigation__wrapper">
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
class="govuk-service-navigation__toggle govuk-js-service-navigation-toggle"
|
|
103
|
-
aria-controls="navigation"
|
|
104
|
-
aria-expanded={menuIsOpen}
|
|
105
|
-
onclick={toggleMenu}
|
|
106
|
-
bind:this={buttonElement}
|
|
107
|
-
hidden={isButtonHidden}
|
|
108
|
-
>
|
|
109
|
-
Menu
|
|
110
|
-
</button>
|
|
111
|
-
<ul
|
|
112
|
-
class="govuk-service-navigation__list"
|
|
113
|
-
id="navigation"
|
|
114
|
-
bind:this={navigationElement}
|
|
115
|
-
hidden={!isMenuVisible}
|
|
116
|
-
>
|
|
117
|
-
{#each navigationItems as item}
|
|
118
|
-
<li
|
|
119
|
-
class="govuk-service-navigation__item{item.isActive
|
|
120
|
-
? ' govuk-service-navigation__item--active'
|
|
121
|
-
: ''}"
|
|
122
|
-
>
|
|
123
|
-
<a
|
|
124
|
-
class="govuk-service-navigation__link"
|
|
125
|
-
href={item.href}
|
|
126
|
-
aria-current={item.isActive ? "true" : undefined}
|
|
127
|
-
>
|
|
128
|
-
{#if item.isActive}
|
|
129
|
-
<strong class="govuk-service-navigation__active-fallback"
|
|
130
|
-
>{item.label}</strong
|
|
131
|
-
>
|
|
132
|
-
{:else}
|
|
133
|
-
{item.label}
|
|
134
|
-
{/if}
|
|
135
|
-
</a>
|
|
136
|
-
</li>
|
|
137
|
-
{/each}
|
|
138
|
-
</ul>
|
|
139
|
-
</nav>
|
|
140
|
-
{/if}
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</section>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type NavigationItem = {
|
|
2
|
-
href: string;
|
|
3
|
-
label: string;
|
|
4
|
-
isActive?: boolean;
|
|
5
|
-
};
|
|
6
|
-
type $$ComponentProps = {
|
|
7
|
-
serviceName?: string;
|
|
8
|
-
serviceUrl?: string;
|
|
9
|
-
navigationItems?: NavigationItem[];
|
|
10
|
-
};
|
|
11
|
-
declare const ServiceNavigation: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
-
type ServiceNavigation = ReturnType<typeof ServiceNavigation>;
|
|
13
|
-
export default ServiceNavigation;
|