@communitiesuk/svelte-component-library 0.1.19-beta.0 → 0.1.19-beta.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/dist/assets/icons/MaterialIcon.svelte +39 -0
- package/dist/assets/icons/MaterialIcon.svelte.d.ts +27 -0
- package/dist/components/content/InsetText.svelte +7 -1
- package/dist/components/content/InsetText.svelte.d.ts +1 -0
- package/dist/components/data-vis/line-chart/LineChart.svelte +1 -1
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +2 -2
- package/dist/components/data-vis/line-chart/ValueLabel.svelte +23 -8
- package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +8 -6
- package/dist/components/data-vis/position-chart/PositionChart.svelte +415 -89
- package/dist/components/data-vis/position-chart/PositionChart.svelte.d.ts +62 -4
- package/dist/components/data-vis/position-chart/PositionChartAxis.svelte +2 -2
- package/dist/components/layout/ServiceNavigation.svelte +7 -3
- package/dist/components/layout/ServiceNavigation.svelte.d.ts +1 -0
- package/dist/components/ui/Button.svelte +25 -1
- package/dist/components/ui/Card.svelte +101 -0
- package/dist/components/ui/Card.svelte.d.ts +33 -0
- package/dist/components/ui/CheckBox.svelte +25 -0
- package/dist/components/ui/CheckBox.svelte.d.ts +1 -0
- package/dist/components/ui/MultiSelectSearchAutocomplete.svelte +1009 -228
- package/dist/components/ui/MultiSelectSearchAutocomplete.svelte.d.ts +19 -0
- package/dist/components/ui/Radios.svelte +82 -33
- package/dist/components/ui/RelatedContent.svelte +6 -3
- package/dist/components/ui/RelatedContent.svelte.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
// https://fonts.google.com/icons?icon.style=Rounded
|
|
3
|
+
const iconPaths = {
|
|
4
|
+
info: [
|
|
5
|
+
"M24.15 34q.65 0 1.075-.425.425-.425.425-1.075v-9.05q0-.6-.45-1.025Q24.75 22 24.15 22q-.65 0-1.075.425-.425.425-.425 1.075v9.05q0 .6.45 1.025.45.425 1.05.425ZM24 18.3q.7 0 1.175-.45.475-.45.475-1.15t-.475-1.2Q24.7 15 24 15q-.7 0-1.175.5-.475.5-.475 1.2t.475 1.15q.475.45 1.175.45ZM24 44q-4.25 0-7.9-1.525-3.65-1.525-6.35-4.225-2.7-2.7-4.225-6.35Q4 28.25 4 24q0-4.2 1.525-7.85Q7.05 12.5 9.75 9.8q2.7-2.7 6.35-4.25Q19.75 4 24 4q4.2 0 7.85 1.55Q35.5 7.1 38.2 9.8q2.7 2.7 4.25 6.35Q44 19.8 44 24q0 4.25-1.55 7.9-1.55 3.65-4.25 6.35-2.7 2.7-6.35 4.225Q28.2 44 24 44Zm0-20Zm0 17q7 0 12-5t5-12q0-7-5-12T24 7q-7 0-12 5T7 24q0 7 5 12t12 5Z",
|
|
6
|
+
],
|
|
7
|
+
};
|
|
8
|
+
export type IconKind = keyof typeof iconPaths;
|
|
9
|
+
|
|
10
|
+
const orientations = ["n", "ne", "e", "se", "s", "sw", "w", "nw"] as const;
|
|
11
|
+
export type Orientation = (typeof orientations)[number];
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
export let kind: IconKind = "settings";
|
|
16
|
+
export let orientation: Orientation = "n";
|
|
17
|
+
|
|
18
|
+
$: paths = iconPaths[kind] || [];
|
|
19
|
+
$: rotation = orientations.indexOf(orientation) * 45;
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<svg
|
|
23
|
+
class="c inline h-16 w-16"
|
|
24
|
+
viewBox="0 0 48 48"
|
|
25
|
+
style={`transform: rotate(${rotation}deg)`}
|
|
26
|
+
>
|
|
27
|
+
{#each paths as path}
|
|
28
|
+
<path d={path}></path>
|
|
29
|
+
{/each}
|
|
30
|
+
</svg>
|
|
31
|
+
|
|
32
|
+
<style>
|
|
33
|
+
.c {
|
|
34
|
+
width: 1em;
|
|
35
|
+
height: 1em;
|
|
36
|
+
fill: currentColor;
|
|
37
|
+
transition: all 0.1s ease-out;
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const iconPaths: {
|
|
2
|
+
info: string[];
|
|
3
|
+
};
|
|
4
|
+
export type IconKind = keyof typeof iconPaths;
|
|
5
|
+
declare const orientations: readonly ["n", "ne", "e", "se", "s", "sw", "w", "nw"];
|
|
6
|
+
export type Orientation = (typeof orientations)[number];
|
|
7
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
8
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
+
$$bindings?: Bindings;
|
|
10
|
+
} & Exports;
|
|
11
|
+
(internal: unknown, props: Props & {
|
|
12
|
+
$$events?: Events;
|
|
13
|
+
$$slots?: Slots;
|
|
14
|
+
}): Exports & {
|
|
15
|
+
$set?: any;
|
|
16
|
+
$on?: any;
|
|
17
|
+
};
|
|
18
|
+
z_$$bindings?: Bindings;
|
|
19
|
+
}
|
|
20
|
+
declare const MaterialIcon: $$__sveltets_2_IsomorphicComponent<{
|
|
21
|
+
kind?: IconKind;
|
|
22
|
+
orientation?: Orientation;
|
|
23
|
+
}, {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {}, {}, string>;
|
|
26
|
+
type MaterialIcon = InstanceType<typeof MaterialIcon>;
|
|
27
|
+
export default MaterialIcon;
|
|
@@ -4,14 +4,20 @@
|
|
|
4
4
|
// Define component props with types and default values
|
|
5
5
|
let {
|
|
6
6
|
content = "It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application.",
|
|
7
|
+
renderStringAsHTML = false,
|
|
7
8
|
} = $props<{
|
|
8
9
|
content?: string | Snippet;
|
|
10
|
+
renderStringAsHTML?: boolean;
|
|
9
11
|
}>();
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
14
|
<div class="govuk-inset-text">
|
|
13
15
|
{#if typeof content === "string"}
|
|
14
|
-
{
|
|
16
|
+
{#if renderStringAsHTML}
|
|
17
|
+
{@html content}
|
|
18
|
+
{:else}
|
|
19
|
+
{content}
|
|
20
|
+
{/if}
|
|
15
21
|
{:else if content}
|
|
16
22
|
{@render content()}
|
|
17
23
|
{/if}
|
|
@@ -40,7 +40,7 @@ declare const LineChart: import("svelte").Component<{
|
|
|
40
40
|
globalTierParams?: Record<string, any>;
|
|
41
41
|
tieredLineParams?: Record<string, any>;
|
|
42
42
|
tooltipSnippet?: any;
|
|
43
|
-
tooltipContent?:
|
|
43
|
+
tooltipContent?: string;
|
|
44
44
|
basicLineParams?: Record<string, any>;
|
|
45
45
|
colorLineParams?: Function;
|
|
46
46
|
colors?: Record<string, any>;
|
|
@@ -82,7 +82,7 @@ type $$ComponentProps = {
|
|
|
82
82
|
globalTierParams?: Record<string, any>;
|
|
83
83
|
tieredLineParams?: Record<string, any>;
|
|
84
84
|
tooltipSnippet?: any;
|
|
85
|
-
tooltipContent?:
|
|
85
|
+
tooltipContent?: string;
|
|
86
86
|
basicLineParams?: Record<string, any>;
|
|
87
87
|
colorLineParams?: Function;
|
|
88
88
|
colors?: Record<string, any>;
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
activeMarkerId,
|
|
4
4
|
labelColor = "red",
|
|
5
5
|
labelTextColor,
|
|
6
|
-
tooltipContent =
|
|
6
|
+
tooltipContent = undefined,
|
|
7
7
|
xFunction,
|
|
8
8
|
yFunction,
|
|
9
|
-
x,
|
|
10
|
-
y,
|
|
11
|
-
markerRect,
|
|
9
|
+
x = undefined,
|
|
10
|
+
y = undefined,
|
|
11
|
+
markerRect = undefined,
|
|
12
12
|
tooltipSnippet,
|
|
13
|
+
labelText = undefined,
|
|
13
14
|
} = $props();
|
|
14
15
|
|
|
15
16
|
let textDimensions = $state();
|
|
@@ -17,14 +18,21 @@
|
|
|
17
18
|
let horizontalPadding = $derived(verticalPadding * 2);
|
|
18
19
|
</script>
|
|
19
20
|
|
|
20
|
-
<div
|
|
21
|
+
<!-- <div
|
|
21
22
|
style="position:absolute;
|
|
22
23
|
top: {markerRect?.y - (textDimensions?.height ?? 0) - 15}px;
|
|
23
24
|
left: {markerRect?.x +
|
|
24
25
|
(markerRect?.width ?? 0) / 2 -
|
|
25
26
|
(textDimensions?.width ?? 0) / 2}px;
|
|
26
|
-
pointer-events: none;
|
|
27
|
+
pointer-events: none; border 1px solid blue
|
|
27
28
|
"
|
|
29
|
+
> -->
|
|
30
|
+
<div
|
|
31
|
+
style="position:absolute; left: {markerRect?.x - textDimensions?.width / 2}px;
|
|
32
|
+
top: {markerRect?.y -
|
|
33
|
+
textDimensions?.height -
|
|
34
|
+
20}px; pointer-events: none"
|
|
35
|
+
bind:contentRect={textDimensions}
|
|
28
36
|
>
|
|
29
37
|
{#if tooltipSnippet === undefined}
|
|
30
38
|
<div
|
|
@@ -32,10 +40,17 @@ left: {markerRect?.x +
|
|
|
32
40
|
padding: 5px;
|
|
33
41
|
border-radius: 5px;"
|
|
34
42
|
>
|
|
35
|
-
|
|
43
|
+
{#if tooltipContent}
|
|
44
|
+
<div>
|
|
45
|
+
{activeMarkerId[tooltipContent]}
|
|
46
|
+
</div>
|
|
47
|
+
{:else}
|
|
48
|
+
<div>
|
|
49
|
+
<div>{activeMarkerId?.value ?? activeMarkerId}</div>
|
|
50
|
+
</div>{/if}
|
|
36
51
|
</div>
|
|
37
52
|
{:else}
|
|
38
|
-
<div
|
|
53
|
+
<div>
|
|
39
54
|
{@render tooltipSnippet(activeMarkerId)}
|
|
40
55
|
</div>
|
|
41
56
|
{/if}
|
|
@@ -10,10 +10,11 @@ declare const ValueLabel: import("svelte").Component<{
|
|
|
10
10
|
tooltipContent?: any;
|
|
11
11
|
xFunction: any;
|
|
12
12
|
yFunction: any;
|
|
13
|
-
x
|
|
14
|
-
y
|
|
15
|
-
markerRect
|
|
13
|
+
x?: any;
|
|
14
|
+
y?: any;
|
|
15
|
+
markerRect?: any;
|
|
16
16
|
tooltipSnippet: any;
|
|
17
|
+
labelText?: any;
|
|
17
18
|
}, {}, "">;
|
|
18
19
|
type $$ComponentProps = {
|
|
19
20
|
activeMarkerId: any;
|
|
@@ -22,8 +23,9 @@ type $$ComponentProps = {
|
|
|
22
23
|
tooltipContent?: any;
|
|
23
24
|
xFunction: any;
|
|
24
25
|
yFunction: any;
|
|
25
|
-
x
|
|
26
|
-
y
|
|
27
|
-
markerRect
|
|
26
|
+
x?: any;
|
|
27
|
+
y?: any;
|
|
28
|
+
markerRect?: any;
|
|
28
29
|
tooltipSnippet: any;
|
|
30
|
+
labelText?: any;
|
|
29
31
|
};
|