@onsvisual/svelte-components 1.0.61 → 1.0.62
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/css/main.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inputs/Button/Button.svelte.d.ts +2 -2
- package/dist/inputs/Checkbox/Checkbox.svelte.d.ts +2 -2
- package/dist/inputs/Input/Input.svelte.d.ts +2 -2
- package/dist/inputs/Radios/Radio.svelte.d.ts +2 -2
- package/dist/inputs/Textarea/Textarea.svelte.d.ts +2 -2
- package/dist/layout/AnalyticsBanner/docs/component.md +2 -2
- package/dist/layout/AnnouncementBanner/AnnouncementBanner.stories.svelte +63 -0
- package/dist/layout/AnnouncementBanner/AnnouncementBanner.stories.svelte.d.ts +23 -0
- package/dist/layout/AnnouncementBanner/AnnouncementBanner.svelte +66 -0
- package/dist/layout/AnnouncementBanner/AnnouncementBanner.svelte.d.ts +37 -0
- package/dist/layout/AnnouncementBanner/docs/component.md +16 -0
- package/dist/layout/DocumentList/Document.svelte.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { default as Observe } from "./wrappers/Observe/Observe.svelte";
|
|
|
6
6
|
export { default as Theme } from "./wrappers/Theme/Theme.svelte";
|
|
7
7
|
export { default as Accordion } from "./layout/Accordion/Accordion.svelte";
|
|
8
8
|
export { default as AccordionItem } from "./layout/Accordion/AccordionItem.svelte";
|
|
9
|
+
export { default as AnnouncementBanner } from "./layout/AnnouncementBanner/AnnouncementBanner.svelte";
|
|
9
10
|
export { default as BackLink } from "./layout/BackLink/BackLink.svelte";
|
|
10
11
|
export { default as Breadcrumb } from "./layout/Breadcrumb/Breadcrumb.svelte";
|
|
11
12
|
export { default as Card } from "./layout/Card/Card.svelte";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as Accordion } from "./layout/Accordion/Accordion.svelte";
|
|
|
13
13
|
export { default as AccordionItem } from "./layout/Accordion/AccordionItem.svelte";
|
|
14
14
|
export { default as AnalyticsBanner } from "./layout/AnalyticsBanner/AnalyticsBanner.svelte";
|
|
15
15
|
export { analyticsEvent } from "./layout/AnalyticsBanner/AnalyticsBanner.svelte";
|
|
16
|
+
export { default as AnnouncementBanner } from "./layout/AnnouncementBanner/AnnouncementBanner.svelte";
|
|
16
17
|
export { default as BackLink } from "./layout/BackLink/BackLink.svelte";
|
|
17
18
|
export { default as Breadcrumb } from "./layout/Breadcrumb/Breadcrumb.svelte";
|
|
18
19
|
export { default as Card } from "./layout/Card/Card.svelte";
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
export default class Button extends SvelteComponentTyped<{
|
|
5
5
|
cls?: string | null | undefined;
|
|
6
6
|
small?: boolean | undefined;
|
|
7
|
+
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
7
8
|
href?: string | null | undefined;
|
|
8
9
|
color?: string | null | undefined;
|
|
9
10
|
download?: string | null | undefined;
|
|
10
11
|
type?: "button" | "reset" | "submit" | undefined;
|
|
11
|
-
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
12
12
|
noScroll?: boolean | undefined;
|
|
13
13
|
icon?: "code" | "search" | "expand" | "arrow" | "carret" | "chevron" | "cog" | "cross" | "download" | "external" | "pin" | "print" | "shrink" | "signout" | "tick" | null | undefined;
|
|
14
14
|
iconPosition?: "before" | "after" | undefined;
|
|
@@ -33,11 +33,11 @@ declare const __propDef: {
|
|
|
33
33
|
props: {
|
|
34
34
|
cls?: string | null | undefined;
|
|
35
35
|
small?: boolean | undefined;
|
|
36
|
+
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
36
37
|
href?: string | null | undefined;
|
|
37
38
|
color?: string | null | undefined;
|
|
38
39
|
download?: string | null | undefined;
|
|
39
40
|
type?: "button" | "reset" | "submit" | undefined;
|
|
40
|
-
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
41
41
|
noScroll?: boolean | undefined;
|
|
42
42
|
icon?: "code" | "search" | "expand" | "arrow" | "carret" | "chevron" | "cog" | "cross" | "download" | "external" | "pin" | "print" | "shrink" | "signout" | "tick" | null | undefined;
|
|
43
43
|
iconPosition?: "before" | "after" | undefined;
|
|
@@ -7,8 +7,8 @@ export default class Checkbox extends SvelteComponentTyped<{
|
|
|
7
7
|
cls?: string | null | undefined;
|
|
8
8
|
group?: object[] | null | undefined;
|
|
9
9
|
compact?: boolean | undefined;
|
|
10
|
-
description?: string | null | undefined;
|
|
11
10
|
variant?: "default" | "ghost" | undefined;
|
|
11
|
+
description?: string | null | undefined;
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
checked?: boolean | undefined;
|
|
14
14
|
item?: object | undefined;
|
|
@@ -30,8 +30,8 @@ declare const __propDef: {
|
|
|
30
30
|
cls?: string | null | undefined;
|
|
31
31
|
group?: object[] | null | undefined;
|
|
32
32
|
compact?: boolean | undefined;
|
|
33
|
-
description?: string | null | undefined;
|
|
34
33
|
variant?: "default" | "ghost" | undefined;
|
|
34
|
+
description?: string | null | undefined;
|
|
35
35
|
disabled?: boolean | undefined;
|
|
36
36
|
checked?: boolean | undefined;
|
|
37
37
|
item?: object | undefined;
|
|
@@ -10,8 +10,8 @@ export default class Input extends SvelteComponentTyped<{
|
|
|
10
10
|
name?: string | null | undefined;
|
|
11
11
|
error?: boolean | undefined;
|
|
12
12
|
numeric?: boolean | undefined;
|
|
13
|
-
value?: string | null | undefined;
|
|
14
13
|
description?: string | null | undefined;
|
|
14
|
+
value?: string | null | undefined;
|
|
15
15
|
disabled?: boolean | undefined;
|
|
16
16
|
hideLabel?: boolean | undefined;
|
|
17
17
|
charLimit?: number | null | undefined;
|
|
@@ -38,8 +38,8 @@ declare const __propDef: {
|
|
|
38
38
|
name?: string | null | undefined;
|
|
39
39
|
error?: boolean | undefined;
|
|
40
40
|
numeric?: boolean | undefined;
|
|
41
|
-
value?: string | null | undefined;
|
|
42
41
|
description?: string | null | undefined;
|
|
42
|
+
value?: string | null | undefined;
|
|
43
43
|
disabled?: boolean | undefined;
|
|
44
44
|
hideLabel?: boolean | undefined;
|
|
45
45
|
charLimit?: number | null | undefined;
|
|
@@ -6,8 +6,8 @@ export default class Radio extends SvelteComponentTyped<{
|
|
|
6
6
|
id?: string | null | undefined;
|
|
7
7
|
label?: string | null | undefined;
|
|
8
8
|
compact?: boolean | undefined;
|
|
9
|
-
value?: object | null | undefined;
|
|
10
9
|
description?: string | null | undefined;
|
|
10
|
+
value?: object | null | undefined;
|
|
11
11
|
item?: object | undefined;
|
|
12
12
|
}, {
|
|
13
13
|
change: CustomEvent<any>;
|
|
@@ -25,8 +25,8 @@ declare const __propDef: {
|
|
|
25
25
|
id?: string | null | undefined;
|
|
26
26
|
label?: string | null | undefined;
|
|
27
27
|
compact?: boolean | undefined;
|
|
28
|
-
value?: object | null | undefined;
|
|
29
28
|
description?: string | null | undefined;
|
|
29
|
+
value?: object | null | undefined;
|
|
30
30
|
item?: object | undefined;
|
|
31
31
|
};
|
|
32
32
|
events: {
|
|
@@ -7,8 +7,8 @@ export default class Textarea extends SvelteComponentTyped<{
|
|
|
7
7
|
width?: number | undefined;
|
|
8
8
|
label?: string | null | undefined;
|
|
9
9
|
name?: string | null | undefined;
|
|
10
|
-
value?: string | null | undefined;
|
|
11
10
|
description?: string | null | undefined;
|
|
11
|
+
value?: string | null | undefined;
|
|
12
12
|
hideLabel?: boolean | undefined;
|
|
13
13
|
charLimit?: number | null | undefined;
|
|
14
14
|
rows?: number | undefined;
|
|
@@ -27,8 +27,8 @@ declare const __propDef: {
|
|
|
27
27
|
width?: number | undefined;
|
|
28
28
|
label?: string | null | undefined;
|
|
29
29
|
name?: string | null | undefined;
|
|
30
|
-
value?: string | null | undefined;
|
|
31
30
|
description?: string | null | undefined;
|
|
31
|
+
value?: string | null | undefined;
|
|
32
32
|
hideLabel?: boolean | undefined;
|
|
33
33
|
charLimit?: number | null | undefined;
|
|
34
34
|
rows?: number | undefined;
|
|
@@ -3,12 +3,12 @@ This component will display a cookie banner and export a function that allows yo
|
|
|
3
3
|
<!-- prettier-ignore -->
|
|
4
4
|
```html
|
|
5
5
|
<script>
|
|
6
|
-
import { AnalyticsBanner,
|
|
6
|
+
import { AnalyticsBanner, analyticsEvent } from "@onsvisual/svelte-components";
|
|
7
7
|
|
|
8
8
|
// Example of an analytics event triggered by another event "e"
|
|
9
9
|
function doAnalyticsEvent(e) {
|
|
10
10
|
// Assumes that e.detail is in the form {key1: "value1", key2: "value2", etc}
|
|
11
|
-
|
|
11
|
+
analyticsEvent({event: "eventName", ...e.detail});
|
|
12
12
|
}
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import { withComponentDocs } from "../../js/withParams.js";
|
|
4
|
+
import AnnouncementBanner from "./AnnouncementBanner.svelte";
|
|
5
|
+
import componentDocs from "./docs/component.md?raw";
|
|
6
|
+
import { lipsum } from "../../js/utils.js";
|
|
7
|
+
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: "Layout/AnnouncementBanner",
|
|
10
|
+
component: AnnouncementBanner,
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
width: {
|
|
14
|
+
control: { type: "select" }
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
parameters: withComponentDocs(componentDocs)
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{#snippet template(args)}
|
|
22
|
+
<AnnouncementBanner {...args}>
|
|
23
|
+
<p>
|
|
24
|
+
{lipsum()}
|
|
25
|
+
</p>
|
|
26
|
+
</AnnouncementBanner>
|
|
27
|
+
{/snippet}
|
|
28
|
+
|
|
29
|
+
<Story
|
|
30
|
+
name="Default"
|
|
31
|
+
args={{
|
|
32
|
+
title: "Important service announcement",
|
|
33
|
+
description: "This is a website-wide service announcement",
|
|
34
|
+
variant: "teal",
|
|
35
|
+
linkHref: "#0",
|
|
36
|
+
linkText: "More information"
|
|
37
|
+
}}
|
|
38
|
+
{template}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<Story
|
|
42
|
+
name="National emergency"
|
|
43
|
+
args={{
|
|
44
|
+
title: "National emergency",
|
|
45
|
+
description: "This is a level 1 incident",
|
|
46
|
+
variant: "red",
|
|
47
|
+
linkHref: "#0",
|
|
48
|
+
linkText: "More information"
|
|
49
|
+
}}
|
|
50
|
+
{template}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<Story
|
|
54
|
+
name="Notable death"
|
|
55
|
+
args={{
|
|
56
|
+
title: "His Royal Highness Henry VIII",
|
|
57
|
+
description: "1491 to 1547",
|
|
58
|
+
variant: "black",
|
|
59
|
+
linkHref: "#0",
|
|
60
|
+
linkText: "Find out more"
|
|
61
|
+
}}
|
|
62
|
+
{template}
|
|
63
|
+
/>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} AnnouncementBannerProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} AnnouncementBannerEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} AnnouncementBannerSlots */
|
|
4
|
+
export default class AnnouncementBanner extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type AnnouncementBannerProps = typeof __propDef.props;
|
|
11
|
+
export type AnnouncementBannerEvents = typeof __propDef.events;
|
|
12
|
+
export type AnnouncementBannerSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Container from "../../wrappers/Container/Container.svelte";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Optional: Set an additional CSS class for the section
|
|
6
|
+
* @type {string|null}
|
|
7
|
+
*/
|
|
8
|
+
export let cls = null;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the title of the banner (required)
|
|
11
|
+
* @type {string}
|
|
12
|
+
*/
|
|
13
|
+
export let title;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the text content of the banner (required)
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
export let description;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the variant/colour of the banner
|
|
21
|
+
* @type {"black"|"red"|"teal"}
|
|
22
|
+
*/
|
|
23
|
+
export let variant = "teal";
|
|
24
|
+
/**
|
|
25
|
+
* Sets the text content of the banner
|
|
26
|
+
* @type {string|null}
|
|
27
|
+
*/
|
|
28
|
+
export let linkHref = null;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the text content of the banner
|
|
31
|
+
* @type {string|null}
|
|
32
|
+
*/
|
|
33
|
+
export let linkText = null;
|
|
34
|
+
/**
|
|
35
|
+
* Adds margin above section
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export let marginTop = false;
|
|
39
|
+
/**
|
|
40
|
+
* Adds margin below section
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
export let marginBottom = false;
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<Container {cls} width="full" {marginTop} {marginBottom}>
|
|
47
|
+
<div class="ons-announcement-banner__container ons-announcement-banner--{variant}">
|
|
48
|
+
<div class="ons-container">
|
|
49
|
+
<div class="ons-announcement-banner ons-announcement-banner--{variant}">
|
|
50
|
+
<h2 class="ons-announcement-banner__title">{title}</h2>
|
|
51
|
+
<p class="ons-announcement-banner__description">{description}</p>
|
|
52
|
+
{#if linkHref}
|
|
53
|
+
<a class="ons-announcement-banner__link" href={linkHref}>
|
|
54
|
+
{linkText || linkHref.replace("https://", "")}
|
|
55
|
+
</a>
|
|
56
|
+
{/if}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</Container>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
.ons-section__text > :global(*:last-child) {
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} AnnouncementBannerProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} AnnouncementBannerEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} AnnouncementBannerSlots */
|
|
4
|
+
export default class AnnouncementBanner extends SvelteComponentTyped<{
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
cls?: string | null | undefined;
|
|
8
|
+
marginTop?: boolean | undefined;
|
|
9
|
+
marginBottom?: boolean | undefined;
|
|
10
|
+
variant?: "black" | "red" | "teal" | undefined;
|
|
11
|
+
linkHref?: string | null | undefined;
|
|
12
|
+
linkText?: string | null | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
}, {}> {
|
|
16
|
+
}
|
|
17
|
+
export type AnnouncementBannerProps = typeof __propDef.props;
|
|
18
|
+
export type AnnouncementBannerEvents = typeof __propDef.events;
|
|
19
|
+
export type AnnouncementBannerSlots = typeof __propDef.slots;
|
|
20
|
+
import { SvelteComponentTyped } from "svelte";
|
|
21
|
+
declare const __propDef: {
|
|
22
|
+
props: {
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
cls?: string | null | undefined;
|
|
26
|
+
marginTop?: boolean | undefined;
|
|
27
|
+
marginBottom?: boolean | undefined;
|
|
28
|
+
variant?: "black" | "red" | "teal" | undefined;
|
|
29
|
+
linkHref?: string | null | undefined;
|
|
30
|
+
linkText?: string | null | undefined;
|
|
31
|
+
};
|
|
32
|
+
events: {
|
|
33
|
+
[evt: string]: CustomEvent<any>;
|
|
34
|
+
};
|
|
35
|
+
slots: {};
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
This banner is used to highlight important messages for all users of a service or website. The banner is only meant for critical short-term messages, and should be placed immediately below the website navigation header (and above the breadcrumb).
|
|
2
|
+
|
|
3
|
+
Based on [this design system component](https://service-manual.ons.gov.uk/design-system/components/announcement-banner).
|
|
4
|
+
|
|
5
|
+
<!-- prettier-ignore -->
|
|
6
|
+
```html
|
|
7
|
+
<script>
|
|
8
|
+
import { AnnouncementBanner } from "@onsvisual/svelte-components";
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<AnnouncementBanner
|
|
12
|
+
title="Important service announcement"
|
|
13
|
+
description="This is a website-wide service announcement"
|
|
14
|
+
linkHref="https://example.com"
|
|
15
|
+
linkText="More information"/>
|
|
16
|
+
```
|
|
@@ -6,9 +6,9 @@ export default class Document extends SvelteComponentTyped<{
|
|
|
6
6
|
title?: string | null | undefined;
|
|
7
7
|
image?: string | boolean | undefined;
|
|
8
8
|
headingTag?: "h2" | "h3" | undefined;
|
|
9
|
+
description?: string | null | undefined;
|
|
9
10
|
href?: string | null | undefined;
|
|
10
11
|
featured?: boolean | undefined;
|
|
11
|
-
description?: string | null | undefined;
|
|
12
12
|
}, {
|
|
13
13
|
[evt: string]: CustomEvent<any>;
|
|
14
14
|
}, {
|
|
@@ -25,9 +25,9 @@ declare const __propDef: {
|
|
|
25
25
|
title?: string | null | undefined;
|
|
26
26
|
image?: string | boolean | undefined;
|
|
27
27
|
headingTag?: "h2" | "h3" | undefined;
|
|
28
|
+
description?: string | null | undefined;
|
|
28
29
|
href?: string | null | undefined;
|
|
29
30
|
featured?: boolean | undefined;
|
|
30
|
-
description?: string | null | undefined;
|
|
31
31
|
};
|
|
32
32
|
events: {
|
|
33
33
|
[evt: string]: CustomEvent<any>;
|