@onsvisual/svelte-components 1.0.0-next.4 → 1.0.0-next.6
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/datavis/DataTile/DataTile.stories.svelte +28 -0
- package/dist/datavis/DataTile/DataTile.stories.svelte.d.ts +23 -0
- package/dist/datavis/DataTile/DataTile.svelte +56 -0
- package/dist/datavis/DataTile/DataTile.svelte.d.ts +37 -0
- package/dist/datavis/DataTile/docs/component.md +17 -0
- package/dist/datavis/Table/Table.svelte +6 -0
- package/dist/datavis/Table/Table.svelte.d.ts +2 -0
- package/dist/decorators/Divider/Divider.svelte +8 -3
- package/dist/decorators/Divider/Divider.svelte.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inputs/Button/Button.svelte +7 -2
- package/dist/inputs/Button/Button.svelte.d.ts +2 -0
- package/dist/inputs/Checkbox/Checkbox.svelte +48 -39
- package/dist/inputs/Checkbox/Checkbox.svelte.d.ts +8 -6
- package/dist/inputs/Checkboxes/Checkboxes.stories.svelte +7 -15
- package/dist/inputs/Checkboxes/Checkboxes.svelte +35 -11
- package/dist/inputs/Checkboxes/Checkboxes.svelte.d.ts +6 -0
- package/dist/inputs/Checkboxes/docs/component.md +1 -1
- package/dist/inputs/Dropdown/Dropdown.svelte +6 -1
- package/dist/inputs/Dropdown/Dropdown.svelte.d.ts +2 -0
- package/dist/inputs/ErrorPanel/ErrorPanel.svelte +6 -1
- package/dist/inputs/ErrorPanel/ErrorPanel.svelte.d.ts +2 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.svelte +6 -1
- package/dist/inputs/ErrorSummary/ErrorSummary.svelte.d.ts +2 -0
- package/dist/inputs/Input/Input.svelte +6 -1
- package/dist/inputs/Input/Input.svelte.d.ts +2 -0
- package/dist/inputs/Radios/Radio.svelte +31 -22
- package/dist/inputs/Radios/Radio.svelte.d.ts +8 -6
- package/dist/inputs/Radios/Radios.svelte +35 -19
- package/dist/inputs/Radios/Radios.svelte.d.ts +8 -2
- package/dist/inputs/Radios/docs/component.md +2 -2
- package/dist/inputs/Select/Select.svelte +6 -1
- package/dist/inputs/Select/Select.svelte.d.ts +2 -0
- package/dist/inputs/Textarea/Textarea.svelte +6 -1
- package/dist/inputs/Textarea/Textarea.svelte.d.ts +2 -0
- package/dist/intro.mdx +9 -2
- package/dist/layout/Accordion/Accordion.svelte +1 -1
- package/dist/layout/Accordion/Accordion.svelte.d.ts +2 -2
- package/dist/layout/Breadcrumb/Breadcrumb.svelte +11 -1
- package/dist/layout/Breadcrumb/Breadcrumb.svelte.d.ts +4 -0
- package/dist/layout/Card/Card.svelte +1 -1
- package/dist/layout/Card/Card.svelte.d.ts +2 -2
- package/dist/layout/Contents/Contents.svelte +6 -1
- package/dist/layout/Contents/Contents.svelte.d.ts +2 -0
- package/dist/layout/DescriptionList/DescriptionList.svelte +6 -1
- package/dist/layout/DescriptionList/DescriptionList.svelte.d.ts +2 -0
- package/dist/layout/Details/Details.svelte +6 -1
- package/dist/layout/Details/Details.svelte.d.ts +2 -0
- package/dist/layout/DocumentList/DocumentList.svelte +6 -1
- package/dist/layout/DocumentList/DocumentList.svelte.d.ts +2 -0
- package/dist/layout/Footer/Footer.svelte +1 -1
- package/dist/layout/Footer/Footer.svelte.d.ts +4 -4
- package/dist/layout/Grid/Grid.svelte +3 -3
- package/dist/layout/Grid/Grid.svelte.d.ts +2 -2
- package/dist/layout/Header/Header.svelte +1 -1
- package/dist/layout/Header/Header.svelte.d.ts +4 -4
- package/dist/layout/Hero/Hero.stories.svelte +2 -1
- package/dist/layout/Hero/Hero.svelte +9 -8
- package/dist/layout/Hero/Hero.svelte.d.ts +8 -6
- package/dist/layout/Highlight/Highlight.svelte +15 -22
- package/dist/layout/Highlight/Highlight.svelte.d.ts +6 -6
- package/dist/layout/Image/Image.svelte +6 -1
- package/dist/layout/Image/Image.svelte.d.ts +2 -0
- package/dist/layout/List/List.svelte +6 -1
- package/dist/layout/List/List.svelte.d.ts +2 -0
- package/dist/layout/NavSections/NavSection.svelte +1 -1
- package/dist/layout/NavSections/NavSection.svelte.d.ts +2 -2
- package/dist/layout/NavSections/NavSections.svelte +3 -3
- package/dist/layout/NavSections/NavSections.svelte.d.ts +2 -2
- package/dist/layout/Notice/Notice.svelte +6 -1
- package/dist/layout/Notice/Notice.svelte.d.ts +2 -0
- package/dist/layout/PhaseBanner/PhaseBanner.svelte +6 -1
- package/dist/layout/PhaseBanner/PhaseBanner.svelte.d.ts +2 -0
- package/dist/layout/RelatedContent/RelatedContent.svelte +6 -1
- package/dist/layout/RelatedContent/RelatedContent.svelte.d.ts +2 -0
- package/dist/layout/Scroller/Scroller.svelte +6 -1
- package/dist/layout/Scroller/Scroller.svelte.d.ts +2 -0
- package/dist/layout/Scroller/ScrollerSection.svelte +6 -1
- package/dist/layout/Scroller/ScrollerSection.svelte.d.ts +2 -0
- package/dist/layout/Section/Section.svelte +3 -3
- package/dist/layout/Section/Section.svelte.d.ts +2 -2
- package/dist/layout/ShareButtons/ShareButtons.svelte +8 -3
- package/dist/layout/ShareButtons/ShareButtons.svelte.d.ts +2 -0
- package/dist/layout/Summary/Summary.svelte +6 -1
- package/dist/layout/Summary/Summary.svelte.d.ts +2 -0
- package/dist/layout/Tabs/Tabs.svelte +6 -1
- package/dist/layout/Tabs/Tabs.svelte.d.ts +2 -0
- package/dist/templates/intro.mdx +1 -1
- package/dist/wrappers/Container/Container.svelte +41 -28
- package/dist/wrappers/Container/Container.svelte.d.ts +8 -4
- package/dist/wrappers/Container/docs/component.md +4 -2
- package/dist/wrappers/Theme/Theme.svelte +4 -4
- package/dist/wrappers/Theme/Theme.svelte.d.ts +6 -6
- package/dist/wrappers/Theme/docs/component.md +1 -1
- package/dist/wrappers/Theme/themes.d.ts +28 -0
- package/dist/wrappers/Theme/themes.js +2 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ScrollerSectionEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ScrollerSectionSlots */
|
|
4
4
|
export default class ScrollerSection extends SvelteComponentTyped<{
|
|
5
|
+
cls?: string | undefined;
|
|
5
6
|
id?: string | undefined;
|
|
6
7
|
title?: string | undefined;
|
|
7
8
|
hideTitle?: boolean | undefined;
|
|
@@ -17,6 +18,7 @@ export type ScrollerSectionSlots = typeof __propDef.slots;
|
|
|
17
18
|
import { SvelteComponentTyped } from "svelte";
|
|
18
19
|
declare const __propDef: {
|
|
19
20
|
props: {
|
|
21
|
+
cls?: string | undefined;
|
|
20
22
|
id?: string | undefined;
|
|
21
23
|
title?: string | undefined;
|
|
22
24
|
hideTitle?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export let id = "";
|
|
10
10
|
/**
|
|
11
|
-
* Optional: Set
|
|
11
|
+
* Optional: Set an additional CSS class for the section
|
|
12
12
|
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
export let cls = "";
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
*/
|
|
34
34
|
export let hideTitle = false;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Adds margin above section
|
|
37
37
|
* @type {boolean}
|
|
38
38
|
*/
|
|
39
39
|
export let marginTop = false;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Adds margin below section
|
|
42
42
|
* @type {boolean}
|
|
43
43
|
*/
|
|
44
44
|
export let marginBottom = true;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SectionEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SectionSlots */
|
|
4
4
|
export default class Section extends SvelteComponentTyped<{
|
|
5
|
-
id?: string | undefined;
|
|
6
5
|
cls?: string | undefined;
|
|
6
|
+
id?: string | undefined;
|
|
7
7
|
width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
|
|
8
8
|
height?: string | number | null | undefined;
|
|
9
9
|
marginTop?: boolean | undefined;
|
|
@@ -22,8 +22,8 @@ export type SectionSlots = typeof __propDef.slots;
|
|
|
22
22
|
import { SvelteComponentTyped } from "svelte";
|
|
23
23
|
declare const __propDef: {
|
|
24
24
|
props: {
|
|
25
|
-
id?: string | undefined;
|
|
26
25
|
cls?: string | undefined;
|
|
26
|
+
id?: string | undefined;
|
|
27
27
|
width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
|
|
28
28
|
height?: string | number | null | undefined;
|
|
29
29
|
marginTop?: boolean | undefined;
|
|
@@ -8,15 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export let title = "Share this page";
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Adds margin above section
|
|
12
12
|
* @type {boolean}
|
|
13
13
|
*/
|
|
14
14
|
export let marginTop = false;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Adds margin below section
|
|
17
17
|
* @type {boolean}
|
|
18
18
|
*/
|
|
19
19
|
export let marginBottom = true;
|
|
20
|
+
/**
|
|
21
|
+
* Optional: Set an additional CSS class for the component
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
export let cls = "";
|
|
20
25
|
|
|
21
26
|
let href = "";
|
|
22
27
|
let pageTitle = "";
|
|
@@ -27,7 +32,7 @@
|
|
|
27
32
|
});
|
|
28
33
|
</script>
|
|
29
34
|
|
|
30
|
-
<Container width="wide" {marginTop} {marginBottom}>
|
|
35
|
+
<Container width="wide" {marginTop} {marginBottom} {cls}>
|
|
31
36
|
<h2 class="ons-u-fs-r--b ons-u-mb-2xs">{title}</h2>
|
|
32
37
|
<ul class="ons-list ons-list--inline ons-list--icons">
|
|
33
38
|
<li class="ons-list__item">
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ShareButtonsEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ShareButtonsSlots */
|
|
4
4
|
export default class ShareButtons extends SvelteComponentTyped<{
|
|
5
|
+
cls?: string | undefined;
|
|
5
6
|
marginTop?: boolean | undefined;
|
|
6
7
|
marginBottom?: boolean | undefined;
|
|
7
8
|
title?: string | undefined;
|
|
@@ -15,6 +16,7 @@ export type ShareButtonsSlots = typeof __propDef.slots;
|
|
|
15
16
|
import { SvelteComponentTyped } from "svelte";
|
|
16
17
|
declare const __propDef: {
|
|
17
18
|
props: {
|
|
19
|
+
cls?: string | undefined;
|
|
18
20
|
marginTop?: boolean | undefined;
|
|
19
21
|
marginBottom?: boolean | undefined;
|
|
20
22
|
title?: string | undefined;
|
|
@@ -18,13 +18,18 @@
|
|
|
18
18
|
* @type {object[]}
|
|
19
19
|
*/
|
|
20
20
|
export let items = [];
|
|
21
|
+
/**
|
|
22
|
+
* Optional: Set an additional CSS class for the component
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
export let cls = "";
|
|
21
26
|
|
|
22
27
|
function handleChange(item) {
|
|
23
28
|
dispatch("change", { item });
|
|
24
29
|
}
|
|
25
30
|
</script>
|
|
26
31
|
|
|
27
|
-
<div class="ons-summary">
|
|
32
|
+
<div class="ons-summary {cls}">
|
|
28
33
|
<div {id} class="ons-summary__group">
|
|
29
34
|
{#if title}<h2 class="ons-summary__group-title">{title}</h2>{/if}
|
|
30
35
|
<dl class="ons-summary__items">
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SummaryEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SummarySlots */
|
|
4
4
|
export default class Summary extends SvelteComponentTyped<{
|
|
5
|
+
cls?: string | undefined;
|
|
5
6
|
id?: string | undefined;
|
|
6
7
|
title?: string | undefined;
|
|
7
8
|
items?: object[] | undefined;
|
|
@@ -17,6 +18,7 @@ export type SummarySlots = typeof __propDef.slots;
|
|
|
17
18
|
import { SvelteComponentTyped } from "svelte";
|
|
18
19
|
declare const __propDef: {
|
|
19
20
|
props: {
|
|
21
|
+
cls?: string | undefined;
|
|
20
22
|
id?: string | undefined;
|
|
21
23
|
title?: string | undefined;
|
|
22
24
|
items?: object[] | undefined;
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
* @type {string|null}
|
|
21
21
|
*/
|
|
22
22
|
export let selected = null;
|
|
23
|
+
/**
|
|
24
|
+
* Optional: Set an additional CSS class for the component
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
export let cls = "";
|
|
23
28
|
|
|
24
29
|
let el;
|
|
25
30
|
|
|
@@ -39,7 +44,7 @@
|
|
|
39
44
|
</script>
|
|
40
45
|
|
|
41
46
|
<section
|
|
42
|
-
class="ons-tabs"
|
|
47
|
+
class="ons-tabs {cls}"
|
|
43
48
|
class:ons-tabs__border={border}
|
|
44
49
|
class:ons-tabs__compact={compact}
|
|
45
50
|
bind:this={el}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} TabsEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TabsSlots */
|
|
4
4
|
export default class Tabs extends SvelteComponentTyped<{
|
|
5
|
+
cls?: string | undefined;
|
|
5
6
|
compact?: boolean | undefined;
|
|
6
7
|
border?: boolean | undefined;
|
|
7
8
|
selected?: string | null | undefined;
|
|
@@ -19,6 +20,7 @@ export type TabsSlots = typeof __propDef.slots;
|
|
|
19
20
|
import { SvelteComponentTyped } from "svelte";
|
|
20
21
|
declare const __propDef: {
|
|
21
22
|
props: {
|
|
23
|
+
cls?: string | undefined;
|
|
22
24
|
compact?: boolean | undefined;
|
|
23
25
|
border?: boolean | undefined;
|
|
24
26
|
selected?: string | null | undefined;
|
package/dist/templates/intro.mdx
CHANGED
|
@@ -4,7 +4,7 @@ import { Meta } from "@storybook/addon-docs/blocks";
|
|
|
4
4
|
|
|
5
5
|
# Using templates
|
|
6
6
|
|
|
7
|
-
This section includes a series of starter templates constructed from multiple components within this library.
|
|
7
|
+
This section includes a series of starter templates constructed from multiple components within this library. Similar templates to these examples are included in the [sveltekit-starter](https://github.com/ONSvisual/sveltekit-starter) project, which is typically the easiest way to use them.
|
|
8
8
|
|
|
9
9
|
When using these templates in an existing SvelteKit project (or one built from scratch), you will need to include the **main.css** file from this library, which is best imported to your top-level `+layout.svelte` file in Svelte Kit. By doing this, you will not need to include it on individual pages.
|
|
10
10
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import Theme from "../Theme/Theme.svelte";
|
|
3
|
+
|
|
2
4
|
/**
|
|
3
5
|
* Optional: Set the unique ID of the container
|
|
4
6
|
* @type {string}
|
|
5
7
|
*/
|
|
6
8
|
export let id = "";
|
|
7
9
|
/**
|
|
8
|
-
* Optional: Set
|
|
10
|
+
* Optional: Set an additional CSS class for the container
|
|
9
11
|
* @type {string}
|
|
10
12
|
*/
|
|
11
13
|
export let cls = "";
|
|
@@ -20,45 +22,56 @@
|
|
|
20
22
|
*/
|
|
21
23
|
export let height = null;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* Adds margin above container
|
|
24
26
|
* @type {boolean}
|
|
25
27
|
*/
|
|
26
28
|
export let marginTop = false;
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Adds margin below container
|
|
29
31
|
* @type {boolean}
|
|
30
32
|
*/
|
|
31
33
|
export let marginBottom = false;
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Optional: Sets a base theme ("light", "dark" or null for no theme)
|
|
36
|
+
* @type {"light"|"dark"|"paleblue"|"blue"|"navyblue"|"grey"|null}
|
|
37
|
+
*/
|
|
38
|
+
export let theme = null;
|
|
39
|
+
/**
|
|
40
|
+
* Optional: Define additional props to override the base theme
|
|
41
|
+
* @type {object}
|
|
42
|
+
*/
|
|
43
|
+
export let themeOverrides = {};
|
|
44
|
+
/**
|
|
45
|
+
* Optional: Overrides the base theme background (accepts any valid CSS background value)
|
|
34
46
|
* @type {string|null}
|
|
35
47
|
*/
|
|
36
48
|
export let background = null;
|
|
37
49
|
</script>
|
|
38
50
|
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
<Theme {theme} overrides={themeOverrides} {background}>
|
|
52
|
+
<div
|
|
53
|
+
{id}
|
|
54
|
+
class="ons-page__container {cls || ''}"
|
|
55
|
+
class:ons-container={width !== "full"}
|
|
56
|
+
class:ons-container--wide={width === "wider"}
|
|
57
|
+
class:ons-u-mt-xl={marginTop}
|
|
58
|
+
class:ons-u-mb-xl={marginBottom}
|
|
59
|
+
style:height={typeof height === "number" ? `${height}px` : height === "full" ? "100vh" : height}
|
|
60
|
+
>
|
|
61
|
+
{#if width === "narrow"}
|
|
62
|
+
<div class="ons-grid">
|
|
63
|
+
<div class="ons-grid__col ons-col-10@m ons-col-8@l">
|
|
64
|
+
<slot />
|
|
65
|
+
</div>
|
|
53
66
|
</div>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
{:else if width === "medium"}
|
|
68
|
+
<div class="ons-grid">
|
|
69
|
+
<div class="ons-grid__col ons-col-10@l">
|
|
70
|
+
<slot />
|
|
71
|
+
</div>
|
|
59
72
|
</div>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</
|
|
73
|
+
{:else}
|
|
74
|
+
<slot />
|
|
75
|
+
{/if}
|
|
76
|
+
</div>
|
|
77
|
+
</Theme>
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ContainerEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ContainerSlots */
|
|
4
4
|
export default class Container extends SvelteComponentTyped<{
|
|
5
|
-
|
|
5
|
+
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | "grey" | null | undefined;
|
|
6
|
+
background?: string | null | undefined;
|
|
6
7
|
cls?: string | undefined;
|
|
8
|
+
id?: string | undefined;
|
|
7
9
|
width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
|
|
8
10
|
height?: string | number | null | undefined;
|
|
9
11
|
marginTop?: boolean | undefined;
|
|
10
12
|
marginBottom?: boolean | undefined;
|
|
11
|
-
|
|
13
|
+
themeOverrides?: object | undefined;
|
|
12
14
|
}, {
|
|
13
15
|
[evt: string]: CustomEvent<any>;
|
|
14
16
|
}, {
|
|
@@ -21,13 +23,15 @@ export type ContainerSlots = typeof __propDef.slots;
|
|
|
21
23
|
import { SvelteComponentTyped } from "svelte";
|
|
22
24
|
declare const __propDef: {
|
|
23
25
|
props: {
|
|
24
|
-
|
|
26
|
+
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | "grey" | null | undefined;
|
|
27
|
+
background?: string | null | undefined;
|
|
25
28
|
cls?: string | undefined;
|
|
29
|
+
id?: string | undefined;
|
|
26
30
|
width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
|
|
27
31
|
height?: string | number | null | undefined;
|
|
28
32
|
marginTop?: boolean | undefined;
|
|
29
33
|
marginBottom?: boolean | undefined;
|
|
30
|
-
|
|
34
|
+
themeOverrides?: object | undefined;
|
|
31
35
|
};
|
|
32
36
|
events: {
|
|
33
37
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
A container to set the width
|
|
1
|
+
A container to set the width and minimum height of a block of content.
|
|
2
|
+
|
|
3
|
+
Note that the this component includes the `<Theme>` component internally, allowing colour themes to be applied directly without adding an additional wrapper around it.
|
|
2
4
|
|
|
3
5
|
<!-- prettier-ignore -->
|
|
4
6
|
```html
|
|
@@ -6,5 +8,5 @@ A container to set the width, minimum height and theme of a block of content.
|
|
|
6
8
|
import { Container } from "@onsvisual/svelte-components";
|
|
7
9
|
</script>
|
|
8
10
|
|
|
9
|
-
<Container width="{narrow|medium|wide|full}">
|
|
11
|
+
<Container width="{narrow|medium|wide|wider|full}" theme="light">{child_components}</Container>
|
|
10
12
|
```
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Sets a base theme ("light", "dark" or null for no theme)
|
|
6
|
-
* @type {"light"|"dark"|"paleblue"|"blue"|"navyblue"|null}
|
|
6
|
+
* @type {"light"|"dark"|"paleblue"|"blue"|"navyblue"|"grey"|null}
|
|
7
7
|
*/
|
|
8
8
|
export let theme = null;
|
|
9
9
|
/**
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
export let allowClientOverrides = false;
|
|
29
29
|
/**
|
|
30
|
-
* Optional: Set
|
|
30
|
+
* Optional: Set an additional CSS class for the theme container
|
|
31
31
|
* @type {string}
|
|
32
32
|
*/
|
|
33
33
|
export let cls = "";
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
</script>
|
|
48
48
|
|
|
49
49
|
<svelte:head>
|
|
50
|
-
{#if global}
|
|
50
|
+
{#if global && (style || background)}
|
|
51
51
|
{@html "<st" +
|
|
52
52
|
`yle>:root{${style}background:${background || "var(--ons-color-page-light)"};color:var(--ons-color-text);</st` +
|
|
53
53
|
"yle>"}
|
|
54
54
|
{/if}
|
|
55
55
|
</svelte:head>
|
|
56
56
|
|
|
57
|
-
{#if global || (
|
|
57
|
+
{#if global || !(theme || background)}
|
|
58
58
|
<slot />
|
|
59
59
|
{:else}
|
|
60
60
|
<div class="ons-svelte-theme-wrapper {cls}" {style} style:background>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ThemeEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ThemeSlots */
|
|
4
4
|
export default class Theme extends SvelteComponentTyped<{
|
|
5
|
-
|
|
6
|
-
background?: string | null | undefined;
|
|
7
|
-
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | null | undefined;
|
|
5
|
+
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | "grey" | null | undefined;
|
|
8
6
|
overrides?: object | undefined;
|
|
7
|
+
background?: string | null | undefined;
|
|
9
8
|
global?: boolean | undefined;
|
|
10
9
|
allowClientOverrides?: boolean | undefined;
|
|
10
|
+
cls?: string | undefined;
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {
|
|
@@ -20,12 +20,12 @@ export type ThemeSlots = typeof __propDef.slots;
|
|
|
20
20
|
import { SvelteComponentTyped } from "svelte";
|
|
21
21
|
declare const __propDef: {
|
|
22
22
|
props: {
|
|
23
|
-
|
|
24
|
-
background?: string | null | undefined;
|
|
25
|
-
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | null | undefined;
|
|
23
|
+
theme?: "light" | "dark" | "paleblue" | "blue" | "navyblue" | "grey" | null | undefined;
|
|
26
24
|
overrides?: object | undefined;
|
|
25
|
+
background?: string | null | undefined;
|
|
27
26
|
global?: boolean | undefined;
|
|
28
27
|
allowClientOverrides?: boolean | undefined;
|
|
28
|
+
cls?: string | undefined;
|
|
29
29
|
};
|
|
30
30
|
events: {
|
|
31
31
|
[evt: string]: CustomEvent<any>;
|
|
@@ -6,5 +6,5 @@ A component that sets the colour scheme of its child components using CSS variab
|
|
|
6
6
|
import { Theme } from "@onsvisual/svelte-components";
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<Theme theme="{
|
|
9
|
+
<Theme theme="{light|dark|paleblue|blue|navyblue|grey}"> {child_components} </Theme>
|
|
10
10
|
```
|
|
@@ -4,6 +4,7 @@ declare namespace _default {
|
|
|
4
4
|
export { paleblue };
|
|
5
5
|
export { blue };
|
|
6
6
|
export { navyblue };
|
|
7
|
+
export { grey };
|
|
7
8
|
}
|
|
8
9
|
export default _default;
|
|
9
10
|
declare const light: {
|
|
@@ -141,3 +142,30 @@ declare const navyblue: {
|
|
|
141
142
|
"--ons-color-borders-indent": string;
|
|
142
143
|
"--ons-color-borders-light": string;
|
|
143
144
|
};
|
|
145
|
+
declare const grey: {
|
|
146
|
+
"--ons-color-page-light": string;
|
|
147
|
+
"--ons-color-text": string;
|
|
148
|
+
"--ons-color-text-light": string;
|
|
149
|
+
"--ons-color-text-link": string;
|
|
150
|
+
"--ons-color-text-link-hover": string;
|
|
151
|
+
"--ons-color-text-link-active": string;
|
|
152
|
+
"--ons-color-text-link-focus": string;
|
|
153
|
+
"--ons-color-text-inverse": string;
|
|
154
|
+
"--ons-color-text-inverse-link": string;
|
|
155
|
+
"--ons-color-text-inverse-link-hover": string;
|
|
156
|
+
"--ons-color-text-banner-link": string;
|
|
157
|
+
"--ons-color-text-banner-link-hover": string;
|
|
158
|
+
"--ons-color-text-metadata": string;
|
|
159
|
+
"--ons-color-input-bg": string;
|
|
160
|
+
"--ons-color-hero-bg": string;
|
|
161
|
+
"--ons-color-hero-bg-dark": string;
|
|
162
|
+
"--ons-color-banner-bg": string;
|
|
163
|
+
"--ons-color-banner-bg-dark": string;
|
|
164
|
+
"--ons-color-banner-browser-bg:": string;
|
|
165
|
+
"--ons-color-focus": string;
|
|
166
|
+
"--ons-color-focus-dark": string;
|
|
167
|
+
"--ons-color-highlight": string;
|
|
168
|
+
"--ons-color-borders": string;
|
|
169
|
+
"--ons-color-borders-indent": string;
|
|
170
|
+
"--ons-color-borders-light": string;
|
|
171
|
+
};
|
|
@@ -65,5 +65,6 @@ const dark = {
|
|
|
65
65
|
const paleblue = { ...light, "--ons-color-page-light": "--ons-color-ocean-blue-tint" };
|
|
66
66
|
const blue = { ...dark, "--ons-color-page-light": "--ons-color-ocean-blue" };
|
|
67
67
|
const navyblue = { ...dark, "--ons-color-page-light": "--ons-color-night-blue" };
|
|
68
|
+
const grey = { ...light, "--ons-color-page-light": "--ons-color-grey-5" };
|
|
68
69
|
|
|
69
|
-
export default { light, dark, paleblue, blue, navyblue };
|
|
70
|
+
export default { light, dark, paleblue, blue, navyblue, grey };
|