@communitiesuk/svelte-component-library 0.1.17 → 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 +116 -98
- 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 -41
- 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
|
@@ -7,13 +7,16 @@ declare const Lines: import("svelte").Component<{
|
|
|
7
7
|
tieredDataObject: any;
|
|
8
8
|
dataArray: any;
|
|
9
9
|
lineFunction: any;
|
|
10
|
+
areaFunction: any;
|
|
10
11
|
chartWidth: any;
|
|
11
12
|
xFunction: any;
|
|
12
13
|
yFunction: any;
|
|
13
14
|
clickedSeries: any;
|
|
14
15
|
hoveredSeries: any;
|
|
16
|
+
clickedTier: any;
|
|
17
|
+
hoveredTier: any;
|
|
15
18
|
chartHeight: any;
|
|
16
|
-
|
|
19
|
+
globalTierParams: any;
|
|
17
20
|
chartBackgroundColor?: string;
|
|
18
21
|
nothingSelected: any;
|
|
19
22
|
onMouseEnterSeries: any;
|
|
@@ -27,19 +30,21 @@ declare const Lines: import("svelte").Component<{
|
|
|
27
30
|
series: any;
|
|
28
31
|
y: any;
|
|
29
32
|
x: any;
|
|
30
|
-
tooltipContent: any;
|
|
31
33
|
}, {}, "">;
|
|
32
34
|
type $$ComponentProps = {
|
|
33
35
|
tieredDataObject: any;
|
|
34
36
|
dataArray: any;
|
|
35
37
|
lineFunction: any;
|
|
38
|
+
areaFunction: any;
|
|
36
39
|
chartWidth: any;
|
|
37
40
|
xFunction: any;
|
|
38
41
|
yFunction: any;
|
|
39
42
|
clickedSeries: any;
|
|
40
43
|
hoveredSeries: any;
|
|
44
|
+
clickedTier: any;
|
|
45
|
+
hoveredTier: any;
|
|
41
46
|
chartHeight: any;
|
|
42
|
-
|
|
47
|
+
globalTierParams: any;
|
|
43
48
|
chartBackgroundColor?: string;
|
|
44
49
|
nothingSelected: any;
|
|
45
50
|
onMouseEnterSeries: any;
|
|
@@ -53,5 +58,4 @@ type $$ComponentProps = {
|
|
|
53
58
|
series: any;
|
|
54
59
|
y: any;
|
|
55
60
|
x: any;
|
|
56
|
-
tooltipContent: any;
|
|
57
61
|
};
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
yFunction,
|
|
11
11
|
x,
|
|
12
12
|
y,
|
|
13
|
+
pathStrokeColor = null,
|
|
13
14
|
markerShape = "circle",
|
|
14
15
|
markerRadius = 5,
|
|
15
|
-
markerFill =
|
|
16
|
+
markerFill = pathStrokeColor,
|
|
16
17
|
markerStroke = "white",
|
|
17
18
|
markerStrokeWidth = 1,
|
|
19
|
+
interactiveMarkers,
|
|
18
20
|
} = $props();
|
|
19
21
|
</script>
|
|
20
22
|
|
|
@@ -22,20 +24,42 @@
|
|
|
22
24
|
{@const markerId = "marker-" + marker[series] + marker[x]}
|
|
23
25
|
<g
|
|
24
26
|
data-id={markerId}
|
|
25
|
-
onclick={
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
onclick={interactiveMarkers
|
|
28
|
+
? (event) => onClickMarker(event, marker, markerId)
|
|
29
|
+
: null}
|
|
30
|
+
onmouseenter={interactiveMarkers
|
|
31
|
+
? (event) =>
|
|
32
|
+
onMouseEnterMarker(
|
|
33
|
+
event,
|
|
34
|
+
marker,
|
|
35
|
+
markerId,
|
|
36
|
+
event.currentTarget.getBoundingClientRect(),
|
|
37
|
+
)
|
|
38
|
+
: null}
|
|
39
|
+
onmouseleave={interactiveMarkers
|
|
40
|
+
? (event) => onMouseLeaveMarker(event, marker, markerId)
|
|
41
|
+
: null}
|
|
28
42
|
transform="translate({xFunction(marker[x])},{yFunction(marker[y])})"
|
|
29
43
|
role="button"
|
|
30
44
|
tabindex="0"
|
|
31
|
-
onkeydown={
|
|
45
|
+
onkeydown={interactiveMarkers
|
|
46
|
+
? (e) => e.key === "Enter" && onClickMarker(e, marker)
|
|
47
|
+
: null}
|
|
48
|
+
pointer-events={interactiveMarkers ? null : "none"}
|
|
32
49
|
>
|
|
50
|
+
<circle
|
|
51
|
+
r={markerRadius + 6}
|
|
52
|
+
fill="transparent"
|
|
53
|
+
stroke="none"
|
|
54
|
+
pointer-events="all"
|
|
55
|
+
></circle>
|
|
33
56
|
{#if markerShape === "circle"}
|
|
34
57
|
<circle
|
|
35
58
|
r={markerRadius}
|
|
36
59
|
stroke={markerStroke}
|
|
37
60
|
fill={markerFill}
|
|
38
61
|
stroke-width={markerStrokeWidth}
|
|
62
|
+
pointer-events="none"
|
|
39
63
|
></circle>
|
|
40
64
|
{:else if ["square", "diamond"].includes(markerShape)}
|
|
41
65
|
<rect
|
|
@@ -47,6 +71,7 @@
|
|
|
47
71
|
stroke={markerStroke}
|
|
48
72
|
fill={markerFill}
|
|
49
73
|
stroke-width={markerStrokeWidth}
|
|
74
|
+
pointer-events="none"
|
|
50
75
|
></rect>
|
|
51
76
|
{:else if markerShape === "triangle"}
|
|
52
77
|
<polygon
|
|
@@ -55,6 +80,7 @@
|
|
|
55
80
|
stroke={markerStroke}
|
|
56
81
|
fill={markerFill}
|
|
57
82
|
stroke-width={markerStrokeWidth}
|
|
83
|
+
pointer-events="none"
|
|
58
84
|
></polygon>
|
|
59
85
|
{/if}
|
|
60
86
|
</g>
|
|
@@ -13,11 +13,13 @@ declare const Marker: import("svelte").Component<{
|
|
|
13
13
|
yFunction: any;
|
|
14
14
|
x: any;
|
|
15
15
|
y: any;
|
|
16
|
+
pathStrokeColor?: any;
|
|
16
17
|
markerShape?: string;
|
|
17
18
|
markerRadius?: number;
|
|
18
|
-
markerFill?:
|
|
19
|
+
markerFill?: any;
|
|
19
20
|
markerStroke?: string;
|
|
20
21
|
markerStrokeWidth?: number;
|
|
22
|
+
interactiveMarkers: any;
|
|
21
23
|
}, {}, "">;
|
|
22
24
|
type $$ComponentProps = {
|
|
23
25
|
dataArray: any;
|
|
@@ -29,9 +31,11 @@ type $$ComponentProps = {
|
|
|
29
31
|
yFunction: any;
|
|
30
32
|
x: any;
|
|
31
33
|
y: any;
|
|
34
|
+
pathStrokeColor?: any;
|
|
32
35
|
markerShape?: string;
|
|
33
36
|
markerRadius?: number;
|
|
34
|
-
markerFill?:
|
|
37
|
+
markerFill?: any;
|
|
35
38
|
markerStroke?: string;
|
|
36
39
|
markerStrokeWidth?: number;
|
|
40
|
+
interactiveMarkers: any;
|
|
37
41
|
};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
series,
|
|
17
17
|
y,
|
|
18
18
|
tier,
|
|
19
|
-
|
|
19
|
+
interactiveLines,
|
|
20
20
|
} = $props();
|
|
21
21
|
|
|
22
22
|
let oldY = $derived(yFunction(dataArray.data[0][y]));
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<g
|
|
33
|
-
{id}
|
|
33
|
+
data-id={id}
|
|
34
34
|
transform="translate({chartWidth + 8},{0})"
|
|
35
|
-
onclick={
|
|
35
|
+
onclick={interactiveLines
|
|
36
36
|
? () => onClickSeries(dataArray[series], tier)
|
|
37
37
|
: undefined}
|
|
38
|
-
onmouseenter={
|
|
38
|
+
onmouseenter={interactiveLines
|
|
39
39
|
? () => onMouseEnterSeries(dataArray[series], tier)
|
|
40
40
|
: undefined}
|
|
41
|
-
onmouseleave={
|
|
41
|
+
onmouseleave={interactiveLines
|
|
42
42
|
? () => onMouseLeaveSeries(dataArray[series], tier)
|
|
43
43
|
: undefined}
|
|
44
44
|
role="button"
|
|
45
45
|
tabindex="0"
|
|
46
46
|
onkeydown={(e) => e.key === "Enter" && onClickSeries(dataArray[series])}
|
|
47
|
-
pointer-events={
|
|
47
|
+
pointer-events={interactiveLines ? null : "none"}
|
|
48
48
|
{opacity}
|
|
49
49
|
>
|
|
50
50
|
<path
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
stroke-width="1"
|
|
55
55
|
></path>
|
|
56
56
|
<text
|
|
57
|
-
{id}
|
|
58
57
|
dominant-baseline="central"
|
|
59
58
|
text-anchor="start"
|
|
60
59
|
x={20}
|
|
@@ -62,6 +61,6 @@
|
|
|
62
61
|
stroke-width={clickedSeries ? 0.7 : 0}
|
|
63
62
|
stroke="black"
|
|
64
63
|
>
|
|
65
|
-
{labelText(dataArray)}
|
|
64
|
+
{typeof labelText === "function" ? labelText(dataArray) : labelText}
|
|
66
65
|
</text>
|
|
67
66
|
</g>
|
|
@@ -20,7 +20,7 @@ declare const SeriesLabel: import("svelte").Component<{
|
|
|
20
20
|
series: any;
|
|
21
21
|
y: any;
|
|
22
22
|
tier: any;
|
|
23
|
-
|
|
23
|
+
interactiveLines: any;
|
|
24
24
|
}, {}, "">;
|
|
25
25
|
type $$ComponentProps = {
|
|
26
26
|
id: any;
|
|
@@ -39,5 +39,5 @@ type $$ComponentProps = {
|
|
|
39
39
|
series: any;
|
|
40
40
|
y: any;
|
|
41
41
|
tier: any;
|
|
42
|
-
|
|
42
|
+
interactiveLines: any;
|
|
43
43
|
};
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
let {
|
|
3
3
|
activeMarkerId,
|
|
4
|
-
labelColor,
|
|
4
|
+
labelColor = "red",
|
|
5
5
|
labelTextColor,
|
|
6
|
-
tooltipContent,
|
|
6
|
+
tooltipContent = activeMarkerId.y,
|
|
7
7
|
xFunction,
|
|
8
8
|
yFunction,
|
|
9
9
|
x,
|
|
10
10
|
y,
|
|
11
|
+
markerRect,
|
|
12
|
+
tooltipSnippet,
|
|
11
13
|
} = $props();
|
|
12
14
|
|
|
13
15
|
let textDimensions = $state();
|
|
14
|
-
let lineSpacing = $state(20);
|
|
15
16
|
let verticalPadding = $state(8);
|
|
16
17
|
let horizontalPadding = $derived(verticalPadding * 2);
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
></rect>
|
|
34
|
-
{/if}
|
|
35
|
-
<text
|
|
36
|
-
x={horizontalPadding / 2}
|
|
37
|
-
y={(textDimensions?.height + verticalPadding) / 2}
|
|
38
|
-
dominant-baseline="middle"
|
|
39
|
-
font-size="16"
|
|
40
|
-
fill={labelTextColor}
|
|
41
|
-
bind:contentRect={textDimensions}
|
|
20
|
+
<div
|
|
21
|
+
style="position:absolute;
|
|
22
|
+
top: {markerRect?.y - (textDimensions?.height ?? 0) - 15}px;
|
|
23
|
+
left: {markerRect?.x +
|
|
24
|
+
(markerRect?.width ?? 0) / 2 -
|
|
25
|
+
(textDimensions?.width ?? 0) / 2}px;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
"
|
|
28
|
+
>
|
|
29
|
+
{#if tooltipSnippet === undefined}
|
|
30
|
+
<div
|
|
31
|
+
style="background-color: {labelColor};
|
|
32
|
+
padding: 5px;
|
|
33
|
+
border-radius: 5px;"
|
|
42
34
|
>
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
</
|
|
49
|
-
|
|
50
|
-
</
|
|
35
|
+
<div bind:contentRect={textDimensions}>{activeMarkerId.y}</div>
|
|
36
|
+
</div>
|
|
37
|
+
{:else}
|
|
38
|
+
<div bind:contentRect={textDimensions}>
|
|
39
|
+
{@render tooltipSnippet(activeMarkerId)}
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
@@ -5,21 +5,25 @@ type ValueLabel = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const ValueLabel: import("svelte").Component<{
|
|
7
7
|
activeMarkerId: any;
|
|
8
|
-
labelColor
|
|
8
|
+
labelColor?: string;
|
|
9
9
|
labelTextColor: any;
|
|
10
|
-
tooltipContent
|
|
10
|
+
tooltipContent?: any;
|
|
11
11
|
xFunction: any;
|
|
12
12
|
yFunction: any;
|
|
13
13
|
x: any;
|
|
14
14
|
y: any;
|
|
15
|
+
markerRect: any;
|
|
16
|
+
tooltipSnippet: any;
|
|
15
17
|
}, {}, "">;
|
|
16
18
|
type $$ComponentProps = {
|
|
17
19
|
activeMarkerId: any;
|
|
18
|
-
labelColor
|
|
20
|
+
labelColor?: string;
|
|
19
21
|
labelTextColor: any;
|
|
20
|
-
tooltipContent
|
|
22
|
+
tooltipContent?: any;
|
|
21
23
|
xFunction: any;
|
|
22
24
|
yFunction: any;
|
|
23
25
|
x: any;
|
|
24
26
|
y: any;
|
|
27
|
+
markerRect: any;
|
|
28
|
+
tooltipSnippet: any;
|
|
25
29
|
};
|