@onsvisual/svelte-components 0.0.2 → 0.0.4
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 +5 -3
- package/dist/@types/decorators/Blockquote/Blockquote.svelte.d.ts +27 -0
- package/dist/@types/index.d.ts +12 -12
- package/dist/@types/js/docsPage.d.ts +25 -0
- package/dist/@types/js/withParams.d.ts +15 -0
- package/dist/@types/layout/Divider/Divider.svelte.d.ts +33 -0
- package/dist/@types/layout/Filler/Filler.svelte.d.ts +41 -0
- package/dist/@types/layout/Grid/Grid.svelte.d.ts +45 -0
- package/dist/@types/layout/Hero/Hero.svelte.d.ts +43 -0
- package/dist/@types/layout/Scroller/Scroller.svelte.d.ts +51 -0
- package/dist/@types/layout/Scroller/ScrollerSection.svelte.d.ts +33 -0
- package/dist/@types/layout/Section/Section.svelte.d.ts +41 -0
- package/dist/@types/layout/TitleBlock/Meta.svelte.d.ts +23 -0
- package/dist/@types/layout/TitleBlock/TitleBlock.svelte.d.ts +23 -0
- package/dist/@types/wrappers/Embed/Embed.svelte.d.ts +27 -0
- package/dist/@types/wrappers/Main/Main.svelte.d.ts +27 -0
- package/dist/css/main.css +4 -55
- package/dist/decorators/Blockquote/Blockquote.svelte +27 -0
- package/dist/index.js +15 -13
- package/dist/js/docsPage.js +13 -0
- package/dist/js/utils.js +3 -0
- package/dist/js/withParams.js +46 -0
- package/dist/{components/layout → layout}/Accordion/AccordionItem.svelte +1 -1
- package/dist/layout/Divider/Divider.svelte +53 -0
- package/dist/layout/Filler/Filler.svelte +66 -0
- package/dist/{components/layout → layout}/Footer/Footer.svelte +1 -1
- package/dist/layout/Grid/Grid.svelte +111 -0
- package/dist/{components/layout → layout}/Header/Header.svelte +1 -1
- package/dist/layout/Hero/Hero.svelte +74 -0
- package/dist/layout/Scroller/Scroller.svelte +336 -0
- package/dist/layout/Scroller/ScrollerSection.svelte +61 -0
- package/dist/layout/Section/Section.svelte +65 -0
- package/dist/layout/TitleBlock/Meta.svelte +26 -0
- package/dist/layout/TitleBlock/TitleBlock.svelte +0 -0
- package/dist/{components/layout → wrappers}/Container/Container.svelte +4 -2
- package/dist/wrappers/Embed/Embed.svelte +21 -0
- package/dist/wrappers/Main/Main.svelte +3 -0
- package/package.json +34 -19
- /package/dist/@types/{components/ui → decorators}/Em/Em.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Button/Button.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Button/Icon.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Dropdown/Dropdown.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Input/Input.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Select/Select.svelte.d.ts +0 -0
- /package/dist/@types/{components/ui → inputs}/Textarea/Textarea.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Accordion/Accordion.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Accordion/AccordionItem.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Footer/Footer.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Footer/ONSLogo.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Header/Header.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Header/ONSLogo.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → layout}/Twisty/Twisty.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → wrappers}/Container/Container.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → wrappers}/Theme/Theme.svelte.d.ts +0 -0
- /package/dist/@types/{components/layout → wrappers}/Theme/themes.d.ts +0 -0
- /package/dist/{components/ui → decorators}/Em/Em.svelte +0 -0
- /package/dist/{components/ui → inputs}/Button/Button.svelte +0 -0
- /package/dist/{components/ui → inputs}/Button/Icon.svelte +0 -0
- /package/dist/{components/ui → inputs}/Dropdown/Dropdown.svelte +0 -0
- /package/dist/{components/ui → inputs}/Input/Input.svelte +0 -0
- /package/dist/{components/ui → inputs}/Select/Select.svelte +0 -0
- /package/dist/{components/ui → inputs}/Textarea/Textarea.svelte +0 -0
- /package/dist/{components/layout → layout}/Accordion/Accordion.svelte +0 -0
- /package/dist/{components/layout → layout}/Footer/ONSLogo.svelte +0 -0
- /package/dist/{components/layout → layout}/Header/ONSLogo.svelte +0 -0
- /package/dist/{components/layout → layout}/Twisty/Twisty.svelte +0 -0
- /package/dist/{components/layout → wrappers}/Theme/Theme.svelte +0 -0
- /package/dist/{components/layout → wrappers}/Theme/themes.js +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* (Optional) attribution for the quote. If you leave this blank, you will just get an indented text block.
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export let attribution = "";
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<blockquote class="ons-quote">
|
|
10
|
+
{#if attribution}
|
|
11
|
+
<svg
|
|
12
|
+
class="ons-svg-icon"
|
|
13
|
+
viewBox="0 0 14 10"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
focusable="false"
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
d="M13.44.77h-3l-2 4v6h6v-6h-3l2-4zm-8 0h-3l-2 4v6h6v-6h-3l2-4z"
|
|
20
|
+
transform="translate(-0.44 -0.77)"></path>
|
|
21
|
+
</svg>
|
|
22
|
+
<span class="ons-quote__text ons-u-fs-l"><slot /></span>
|
|
23
|
+
<span class="ons-quote__ref">— {attribution}</span>
|
|
24
|
+
{:else}
|
|
25
|
+
<span class="ons-quote__text ons-u-fs-l"><slot /></span>
|
|
26
|
+
{/if}
|
|
27
|
+
</blockquote>
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
// Wrappers
|
|
2
|
+
export { default as Theme } from "./wrappers/Theme/Theme.svelte";
|
|
3
|
+
export { default as Container } from "./wrappers/Container/Container.svelte";
|
|
4
|
+
|
|
1
5
|
// Layout
|
|
2
|
-
export { default as Accordion } from "./
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as Theme } from "./components/layout/Theme/Theme.svelte";
|
|
7
|
-
export { default as Twisty } from "./components/layout/Twisty/Twisty.svelte";
|
|
6
|
+
export { default as Accordion } from "./layout/Accordion/Accordion.svelte";
|
|
7
|
+
export { default as Footer } from "./layout/Footer/Footer.svelte";
|
|
8
|
+
export { default as Header } from "./layout/Header/Header.svelte";
|
|
9
|
+
export { default as Twisty } from "./layout/Twisty/Twisty.svelte";
|
|
8
10
|
|
|
9
|
-
//
|
|
10
|
-
export { default as Button } from "./
|
|
11
|
-
export { default as Dropdown } from "./
|
|
12
|
-
export { default as Em } from "./
|
|
13
|
-
export { default as Input } from "./
|
|
14
|
-
export { default as Select } from "./
|
|
15
|
-
export { default as Textarea } from "./
|
|
11
|
+
// Inputs
|
|
12
|
+
export { default as Button } from "./inputs/Button/Button.svelte";
|
|
13
|
+
export { default as Dropdown } from "./inputs/Dropdown/Dropdown.svelte";
|
|
14
|
+
export { default as Em } from "./decorators/Em/Em.svelte";
|
|
15
|
+
export { default as Input } from "./inputs/Input/Input.svelte";
|
|
16
|
+
export { default as Select } from "./inputs/Select/Select.svelte";
|
|
17
|
+
export { default as Textarea } from "./inputs/Textarea/Textarea.svelte";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const parameters = {
|
|
2
|
+
viewMode: "docs",
|
|
3
|
+
previewTabs: {
|
|
4
|
+
canvas: { hidden: true },
|
|
5
|
+
},
|
|
6
|
+
toolbar: {
|
|
7
|
+
zoom: { hidden: true },
|
|
8
|
+
eject: { hidden: true },
|
|
9
|
+
fullscreen: { hidden: true },
|
|
10
|
+
"storybook/background": { hidden: true },
|
|
11
|
+
"storybook/outline": { hidden: true },
|
|
12
|
+
},
|
|
13
|
+
};
|
package/dist/js/utils.js
CHANGED
|
@@ -15,7 +15,9 @@ export const slugify = (str, suffix = true) =>
|
|
|
15
15
|
// .concat(suffix ? `-${randomString()}` : "");
|
|
16
16
|
|
|
17
17
|
export const validDate = (str) => {
|
|
18
|
+
if (!str) return false;
|
|
18
19
|
const date = new Date(str);
|
|
20
|
+
// @ts-ignore
|
|
19
21
|
return !isNaN(date);
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -25,6 +27,7 @@ export const formatDate = (
|
|
|
25
27
|
opts = { year: "numeric", month: "long", day: "2-digit" }
|
|
26
28
|
) => {
|
|
27
29
|
const date = new Date(str);
|
|
30
|
+
// @ts-ignore
|
|
28
31
|
return date.toLocaleDateString(locale, opts);
|
|
29
32
|
};
|
|
30
33
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use custom source code in the "Show code" pull down.
|
|
3
|
+
* @param {object} source Source code object, where key is the language of the source code and value is the code string.
|
|
4
|
+
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withStoryDocs
|
|
5
|
+
* @returns props object including parameters
|
|
6
|
+
*/
|
|
7
|
+
export const withSource = (source, otherOptions = {}) => {
|
|
8
|
+
const language = Object.keys(source)[0];
|
|
9
|
+
const code = source[language];
|
|
10
|
+
const docs = {
|
|
11
|
+
...otherOptions?.parameters?.docs,
|
|
12
|
+
source: { code, language },
|
|
13
|
+
};
|
|
14
|
+
const parameters = { docs };
|
|
15
|
+
return { parameters };
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Add custom documentation to a story.
|
|
20
|
+
* @param {string} storyDocs Markdown string of docs
|
|
21
|
+
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withSource
|
|
22
|
+
* @returns props object including parameters
|
|
23
|
+
*/
|
|
24
|
+
export const withStoryDocs = (storyDocs, otherOptions = {}) => {
|
|
25
|
+
const docs = {
|
|
26
|
+
...otherOptions?.parameters?.docs,
|
|
27
|
+
description: { story: storyDocs },
|
|
28
|
+
};
|
|
29
|
+
const parameters = { docs };
|
|
30
|
+
return { parameters };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Add custom documentation to the top of the component docs page.
|
|
35
|
+
* @param {string} componentDocs Markdown string of docs
|
|
36
|
+
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withSource
|
|
37
|
+
* @returns props object including parameters
|
|
38
|
+
*/
|
|
39
|
+
export const withComponentDocs = (componentDocs, otherOptions = {}) => {
|
|
40
|
+
const docs = {
|
|
41
|
+
...otherOptions?.parameters?.docs,
|
|
42
|
+
description: { component: componentDocs },
|
|
43
|
+
};
|
|
44
|
+
const parameters = { docs };
|
|
45
|
+
return { parameters };
|
|
46
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Container from "$lib/wrappers/Container/Container.svelte";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* (Optional) Include a horizontal rule
|
|
6
|
+
* @type {boolean}
|
|
7
|
+
*/
|
|
8
|
+
export let hr = true;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the width of the container
|
|
11
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
12
|
+
*/
|
|
13
|
+
export let width = "medium";
|
|
14
|
+
/**
|
|
15
|
+
* Sets a predefined theme
|
|
16
|
+
* @type {"light"|"dark"|"lightblue"}
|
|
17
|
+
*/
|
|
18
|
+
export let theme = null;
|
|
19
|
+
/**
|
|
20
|
+
* Define additional props to override the base theme
|
|
21
|
+
* @type {object}
|
|
22
|
+
*/
|
|
23
|
+
export let themeOverrides = null;
|
|
24
|
+
/**
|
|
25
|
+
* Optional margin above section
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
export let marginTop = false;
|
|
29
|
+
/**
|
|
30
|
+
* Optional margin below section
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
33
|
+
export let marginBottom = true;
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<Container
|
|
37
|
+
theme="{theme}"
|
|
38
|
+
themeOverrides="{themeOverrides}"
|
|
39
|
+
width="{width}"
|
|
40
|
+
marginTop="{marginTop}"
|
|
41
|
+
marginBottom="{marginBottom}"
|
|
42
|
+
>
|
|
43
|
+
<hr style:border="{hr ? null : "none"}" />
|
|
44
|
+
</Container>
|
|
45
|
+
|
|
46
|
+
<style>
|
|
47
|
+
hr {
|
|
48
|
+
width: 75px;
|
|
49
|
+
border: none;
|
|
50
|
+
border-top: 2px solid;
|
|
51
|
+
margin: -10px auto 0;
|
|
52
|
+
color: var(--muted, #777);
|
|
53
|
+
}</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Container from "$lib/wrappers/Container/Container.svelte";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* (Optional) Sets the unique ID of the section
|
|
6
|
+
* @type {string}
|
|
7
|
+
*/
|
|
8
|
+
export let id = null;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the width of the section
|
|
11
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
12
|
+
*/
|
|
13
|
+
export let width = "narrow";
|
|
14
|
+
/**
|
|
15
|
+
* Sets the minimum height of the section
|
|
16
|
+
* @type {"auto"|"tall"|"full"}
|
|
17
|
+
*/
|
|
18
|
+
export let height = "tall";
|
|
19
|
+
/**
|
|
20
|
+
* Sets a predefined theme
|
|
21
|
+
* @type {"light"|"dark"|"lightblue"}
|
|
22
|
+
*/
|
|
23
|
+
export let theme = "lightblue";
|
|
24
|
+
/**
|
|
25
|
+
* Define additional props to override the base theme
|
|
26
|
+
* @type {object}
|
|
27
|
+
*/
|
|
28
|
+
export let themeOverrides = null;
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the background CSS for the section
|
|
31
|
+
* @type {string}
|
|
32
|
+
*/
|
|
33
|
+
export let background = null;
|
|
34
|
+
/**
|
|
35
|
+
* Optional margin above section
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export let marginTop = false;
|
|
39
|
+
/**
|
|
40
|
+
* Optional margin below section
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
export let marginBottom = true;
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<Container
|
|
47
|
+
theme="{theme}"
|
|
48
|
+
themeOverrides="{themeOverrides}"
|
|
49
|
+
width="{width}"
|
|
50
|
+
background="{background}"
|
|
51
|
+
marginTop="{marginTop}"
|
|
52
|
+
marginBottom="{marginBottom}"
|
|
53
|
+
height="{height}"
|
|
54
|
+
>
|
|
55
|
+
<section
|
|
56
|
+
class="ons-hero__details ons-feature__filler ons-u-fs-l ons-font-weight__normal"
|
|
57
|
+
id="{id}"
|
|
58
|
+
>
|
|
59
|
+
<slot />
|
|
60
|
+
</section>
|
|
61
|
+
</Container>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
:global(.ons-feature__filler > p + p) {
|
|
65
|
+
margin-top: 30px;
|
|
66
|
+
}</style>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Container from "$lib/wrappers/Container/Container.svelte";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* (Optional) Sets the unique ID of the section
|
|
6
|
+
* @type {string}
|
|
7
|
+
*/
|
|
8
|
+
export let id = null;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the width of the section
|
|
11
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
12
|
+
*/
|
|
13
|
+
export let width = "medium";
|
|
14
|
+
/**
|
|
15
|
+
* Sets a predefined theme
|
|
16
|
+
* @type {"light"|"dark"|"lightblue"}
|
|
17
|
+
*/
|
|
18
|
+
export let theme = null;
|
|
19
|
+
/**
|
|
20
|
+
* Define additional props to override the base theme
|
|
21
|
+
* @type {object}
|
|
22
|
+
*/
|
|
23
|
+
export let themeOverrides = null;
|
|
24
|
+
/**
|
|
25
|
+
* Optional margin above section
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
export let marginTop = false;
|
|
29
|
+
/**
|
|
30
|
+
* Optional margin below section
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
33
|
+
export let marginBottom = true;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the width of the section
|
|
36
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
37
|
+
*/
|
|
38
|
+
export let colwidth = "medium"; // narrow | medium | wide | full
|
|
39
|
+
/**
|
|
40
|
+
* (Optional) caption below the grid
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
export let caption = "";
|
|
44
|
+
/**
|
|
45
|
+
* Set the minimum height of a grid row (can be a number in pixels, or a valid CSS height, like "100vh")
|
|
46
|
+
* @type {number|string}
|
|
47
|
+
*/
|
|
48
|
+
export let height = 200; // pixel height or "full" for 100vh
|
|
49
|
+
/**
|
|
50
|
+
* Set the grid gap, in pixels
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
export let gap = 12;
|
|
54
|
+
|
|
55
|
+
let gridClass = !colwidth || colwidth === "full" ? "" : `grid-${colwidth}`;
|
|
56
|
+
let rowHeight = height === "full" ? "100vh" : !Number.isNaN(height) ? height + "px" : height;
|
|
57
|
+
let gridGap = !Number.isNaN(gap) ? gap + "px" : gap;
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<figure id="{id}" aria-label="{caption}">
|
|
61
|
+
<Container
|
|
62
|
+
theme="{theme}"
|
|
63
|
+
themeOverrides="{themeOverrides}"
|
|
64
|
+
width="{width}"
|
|
65
|
+
height="{['tall', 'full'].includes(height) ? height : 'auto'}"
|
|
66
|
+
marginTop="{marginTop}"
|
|
67
|
+
marginBottom="{!caption ? marginBottom : false}"
|
|
68
|
+
>
|
|
69
|
+
<div class="grid {gridClass}" style:grid-gap="{gridGap}" style:min-height="{rowHeight}">
|
|
70
|
+
<slot />
|
|
71
|
+
</div>
|
|
72
|
+
</Container>
|
|
73
|
+
{#if caption}
|
|
74
|
+
<figcaption>
|
|
75
|
+
<Container
|
|
76
|
+
theme="{theme}"
|
|
77
|
+
themeOverrides="{themeOverrides}"
|
|
78
|
+
width="narrow"
|
|
79
|
+
marginBottom="{marginBottom}"
|
|
80
|
+
>
|
|
81
|
+
<span class="ons-figure__caption">{@html caption}</span>
|
|
82
|
+
</Container>
|
|
83
|
+
</figcaption>
|
|
84
|
+
{/if}
|
|
85
|
+
</figure>
|
|
86
|
+
|
|
87
|
+
<style>
|
|
88
|
+
figure,
|
|
89
|
+
figcaption {
|
|
90
|
+
display: block;
|
|
91
|
+
margin: 0;
|
|
92
|
+
padding: 0;
|
|
93
|
+
}
|
|
94
|
+
.grid {
|
|
95
|
+
display: grid;
|
|
96
|
+
grid-template-columns: repeat(auto-fit, 100%);
|
|
97
|
+
width: 100%;
|
|
98
|
+
margin: 0;
|
|
99
|
+
}
|
|
100
|
+
.grid-narrow {
|
|
101
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
|
|
102
|
+
}
|
|
103
|
+
.grid-medium {
|
|
104
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
|
|
105
|
+
}
|
|
106
|
+
.grid-wide {
|
|
107
|
+
grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)) !important;
|
|
108
|
+
}
|
|
109
|
+
:global(.grid > div) {
|
|
110
|
+
min-height: inherit;
|
|
111
|
+
}</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { validDate, formatDate } from "$lib/js/utils.js";
|
|
3
|
+
import Container from "$lib/wrappers/Container/Container.svelte";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* (Optional) Sets the unique ID of the section
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
export let id = null;
|
|
10
|
+
/**
|
|
11
|
+
* Sets the width of the section
|
|
12
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
13
|
+
*/
|
|
14
|
+
export let width = "medium";
|
|
15
|
+
/**
|
|
16
|
+
* Sets the minimum height of the section
|
|
17
|
+
* @type {"auto"|"tall"|"full"}
|
|
18
|
+
*/
|
|
19
|
+
export let height = "tall";
|
|
20
|
+
/**
|
|
21
|
+
* Sets the title/headline
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
export let title = "Page headline";
|
|
25
|
+
/**
|
|
26
|
+
* Sets the lede (short intro text)
|
|
27
|
+
* @type {string}
|
|
28
|
+
*/
|
|
29
|
+
export let lede = "";
|
|
30
|
+
/**
|
|
31
|
+
* (Optional) Sets the date, using the format "yyyy-mm-dd"
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
export let date = null;
|
|
35
|
+
/**
|
|
36
|
+
* Sets a predefined theme
|
|
37
|
+
* @type {"light"|"dark"|"lightblue"}
|
|
38
|
+
*/
|
|
39
|
+
export let theme = "dark";
|
|
40
|
+
/**
|
|
41
|
+
* Define additional props to override the base theme
|
|
42
|
+
* @type {object}
|
|
43
|
+
*/
|
|
44
|
+
export let themeOverrides = null;
|
|
45
|
+
/**
|
|
46
|
+
* Overrides the background CSS for the section
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
export let background = "rgb(32, 96, 149)";
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<Container
|
|
53
|
+
theme="{theme}"
|
|
54
|
+
themeOverrides="{themeOverrides}"
|
|
55
|
+
width="{width}"
|
|
56
|
+
background="{background}"
|
|
57
|
+
height="{height}"
|
|
58
|
+
>
|
|
59
|
+
<div id="{id}" class="ons-hero__details ons-grid__col ons-col-8@m ons-col-10@s@m">
|
|
60
|
+
{#if title}
|
|
61
|
+
<header>
|
|
62
|
+
<h1 class="ons-hero__title ons-u-fs-xxxl">{title}</h1>
|
|
63
|
+
</header>
|
|
64
|
+
{/if}
|
|
65
|
+
{#if lede}<p class="ons-hero__text ons-u-fs-l ons-font-weight__normal">{lede}</p>{/if}
|
|
66
|
+
{#if validDate(date)}<p class="ons-hero__text">{formatDate(date)}</p>{/if}
|
|
67
|
+
<slot />
|
|
68
|
+
</div>
|
|
69
|
+
</Container>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.ons-hero__details {
|
|
73
|
+
padding-left: 0;
|
|
74
|
+
}</style>
|