@onsvisual/svelte-components 0.0.3 → 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.
Files changed (68) hide show
  1. package/README.md +5 -3
  2. package/dist/@types/index.d.ts +12 -12
  3. package/dist/@types/js/docsPage.d.ts +25 -0
  4. package/dist/@types/js/withParams.d.ts +15 -0
  5. package/dist/@types/layout/Filler/Filler.svelte.d.ts +41 -0
  6. package/dist/@types/layout/Grid/Grid.svelte.d.ts +45 -0
  7. package/dist/@types/layout/Hero/Hero.svelte.d.ts +43 -0
  8. package/dist/@types/layout/Scroller/Scroller.svelte.d.ts +51 -0
  9. package/dist/@types/layout/Scroller/ScrollerSection.svelte.d.ts +33 -0
  10. package/dist/@types/{components/layout → layout}/TitleBlock/Meta.svelte.d.ts +2 -2
  11. package/dist/index.js +12 -12
  12. package/dist/js/docsPage.js +13 -0
  13. package/dist/js/utils.js +3 -0
  14. package/dist/js/withParams.js +46 -0
  15. package/dist/{components/layout → layout}/Accordion/AccordionItem.svelte +1 -1
  16. package/dist/{components/layout → layout}/Divider/Divider.svelte +1 -1
  17. package/dist/layout/Filler/Filler.svelte +66 -0
  18. package/dist/{components/layout → layout}/Footer/Footer.svelte +1 -1
  19. package/dist/layout/Grid/Grid.svelte +111 -0
  20. package/dist/{components/layout → layout}/Header/Header.svelte +1 -1
  21. package/dist/layout/Hero/Hero.svelte +74 -0
  22. package/dist/layout/Scroller/Scroller.svelte +336 -0
  23. package/dist/layout/Scroller/ScrollerSection.svelte +61 -0
  24. package/dist/{components/layout → layout}/Section/Section.svelte +6 -6
  25. package/dist/layout/TitleBlock/Meta.svelte +26 -0
  26. package/package.json +32 -25
  27. package/dist/components/layout/TitleBlock/Meta.svelte +0 -0
  28. package/dist/@types/{components/decorators → decorators}/Blockquote/Blockquote.svelte.d.ts +0 -0
  29. package/dist/@types/{components/decorators → decorators}/Em/Em.svelte.d.ts +0 -0
  30. package/dist/@types/{components/inputs → inputs}/Button/Button.svelte.d.ts +0 -0
  31. package/dist/@types/{components/inputs → inputs}/Button/Icon.svelte.d.ts +0 -0
  32. package/dist/@types/{components/inputs → inputs}/Dropdown/Dropdown.svelte.d.ts +4 -4
  33. package/dist/@types/{components/inputs → inputs}/Input/Input.svelte.d.ts +2 -2
  34. package/dist/@types/{components/inputs → inputs}/Select/Select.svelte.d.ts +4 -4
  35. package/dist/@types/{components/inputs → inputs}/Textarea/Textarea.svelte.d.ts +2 -2
  36. /package/dist/@types/{components/layout → layout}/Accordion/Accordion.svelte.d.ts +0 -0
  37. /package/dist/@types/{components/layout → layout}/Accordion/AccordionItem.svelte.d.ts +0 -0
  38. /package/dist/@types/{components/layout → layout}/Divider/Divider.svelte.d.ts +0 -0
  39. /package/dist/@types/{components/layout → layout}/Footer/Footer.svelte.d.ts +0 -0
  40. /package/dist/@types/{components/layout → layout}/Footer/ONSLogo.svelte.d.ts +0 -0
  41. /package/dist/@types/{components/layout → layout}/Header/Header.svelte.d.ts +0 -0
  42. /package/dist/@types/{components/layout → layout}/Header/ONSLogo.svelte.d.ts +0 -0
  43. /package/dist/@types/{components/layout → layout}/Section/Section.svelte.d.ts +0 -0
  44. /package/dist/@types/{components/layout → layout}/TitleBlock/TitleBlock.svelte.d.ts +0 -0
  45. /package/dist/@types/{components/layout → layout}/Twisty/Twisty.svelte.d.ts +0 -0
  46. /package/dist/@types/{components/wrappers → wrappers}/Container/Container.svelte.d.ts +0 -0
  47. /package/dist/@types/{components/wrappers → wrappers}/Embed/Embed.svelte.d.ts +0 -0
  48. /package/dist/@types/{components/wrappers → wrappers}/Main/Main.svelte.d.ts +0 -0
  49. /package/dist/@types/{components/wrappers → wrappers}/Theme/Theme.svelte.d.ts +0 -0
  50. /package/dist/@types/{components/wrappers → wrappers}/Theme/themes.d.ts +0 -0
  51. /package/dist/{components/decorators → decorators}/Blockquote/Blockquote.svelte +0 -0
  52. /package/dist/{components/decorators → decorators}/Em/Em.svelte +0 -0
  53. /package/dist/{components/inputs → inputs}/Button/Button.svelte +0 -0
  54. /package/dist/{components/inputs → inputs}/Button/Icon.svelte +0 -0
  55. /package/dist/{components/inputs → inputs}/Dropdown/Dropdown.svelte +0 -0
  56. /package/dist/{components/inputs → inputs}/Input/Input.svelte +0 -0
  57. /package/dist/{components/inputs → inputs}/Select/Select.svelte +0 -0
  58. /package/dist/{components/inputs → inputs}/Textarea/Textarea.svelte +0 -0
  59. /package/dist/{components/layout → layout}/Accordion/Accordion.svelte +0 -0
  60. /package/dist/{components/layout → layout}/Footer/ONSLogo.svelte +0 -0
  61. /package/dist/{components/layout → layout}/Header/ONSLogo.svelte +0 -0
  62. /package/dist/{components/layout → layout}/TitleBlock/TitleBlock.svelte +0 -0
  63. /package/dist/{components/layout → layout}/Twisty/Twisty.svelte +0 -0
  64. /package/dist/{components/wrappers → wrappers}/Container/Container.svelte +0 -0
  65. /package/dist/{components/wrappers → wrappers}/Embed/Embed.svelte +0 -0
  66. /package/dist/{components/wrappers → wrappers}/Main/Main.svelte +0 -0
  67. /package/dist/{components/wrappers → wrappers}/Theme/Theme.svelte +0 -0
  68. /package/dist/{components/wrappers → wrappers}/Theme/themes.js +0 -0
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
- # ⚙️ graphics-components
1
+ # @onsvisual/svelte-components
2
+
3
+ [![npm version](https://badge.fury.io/js/@onsvisual%2Fsvelte-components.svg)](https://www.npmjs.com/package/@onsvisual/svelte-components)
4
+
5
+ A library of ONS Svelte components for projects large and small. Its codebase and docs borrow **heavily** from Reuters' fantastic [graphics-components](https://github.com/reuters-graphics/graphics-components) library.
2
6
 
3
- [![npm version](https://badge.fury.io/js/@reuters-graphics%2Fgraphics-components.svg)](https://badge.fury.io/js/@reuters-graphics%2Fgraphics-components)
4
7
 
5
- This is a fork of the Reuters [graphics-components](https://github.com/reuters-graphics/graphics-components) repo, for experimentation.
@@ -1,12 +1,12 @@
1
- export { default as Theme } from "./components/wrappers/Theme/Theme.svelte";
2
- export { default as Container } from "./components/wrappers/Container/Container.svelte";
3
- export { default as Accordion } from "./components/layout/Accordion/Accordion.svelte";
4
- export { default as Footer } from "./components/layout/Footer/Footer.svelte";
5
- export { default as Header } from "./components/layout/Header/Header.svelte";
6
- export { default as Twisty } from "./components/layout/Twisty/Twisty.svelte";
7
- export { default as Button } from "./components/ui/Button/Button.svelte";
8
- export { default as Dropdown } from "./components/ui/Dropdown/Dropdown.svelte";
9
- export { default as Em } from "./components/ui/Em/Em.svelte";
10
- export { default as Input } from "./components/ui/Input/Input.svelte";
11
- export { default as Select } from "./components/ui/Select/Select.svelte";
12
- export { default as Textarea } from "./components/ui/Textarea/Textarea.svelte";
1
+ export { default as Theme } from "./wrappers/Theme/Theme.svelte";
2
+ export { default as Container } from "./wrappers/Container/Container.svelte";
3
+ export { default as Accordion } from "./layout/Accordion/Accordion.svelte";
4
+ export { default as Footer } from "./layout/Footer/Footer.svelte";
5
+ export { default as Header } from "./layout/Header/Header.svelte";
6
+ export { default as Twisty } from "./layout/Twisty/Twisty.svelte";
7
+ export { default as Button } from "./inputs/Button/Button.svelte";
8
+ export { default as Dropdown } from "./inputs/Dropdown/Dropdown.svelte";
9
+ export { default as Em } from "./decorators/Em/Em.svelte";
10
+ export { default as Input } from "./inputs/Input/Input.svelte";
11
+ export { default as Select } from "./inputs/Select/Select.svelte";
12
+ export { default as Textarea } from "./inputs/Textarea/Textarea.svelte";
@@ -0,0 +1,25 @@
1
+ export namespace parameters {
2
+ let viewMode: string;
3
+ namespace previewTabs {
4
+ namespace canvas {
5
+ let hidden: boolean;
6
+ }
7
+ }
8
+ let toolbar: {
9
+ zoom: {
10
+ hidden: boolean;
11
+ };
12
+ eject: {
13
+ hidden: boolean;
14
+ };
15
+ fullscreen: {
16
+ hidden: boolean;
17
+ };
18
+ "storybook/background": {
19
+ hidden: boolean;
20
+ };
21
+ "storybook/outline": {
22
+ hidden: boolean;
23
+ };
24
+ };
25
+ }
@@ -0,0 +1,15 @@
1
+ export function withSource(source: object, otherOptions?: object): {
2
+ parameters: {
3
+ docs: any;
4
+ };
5
+ };
6
+ export function withStoryDocs(storyDocs: string, otherOptions?: object): {
7
+ parameters: {
8
+ docs: any;
9
+ };
10
+ };
11
+ export function withComponentDocs(componentDocs: string, otherOptions?: object): {
12
+ parameters: {
13
+ docs: any;
14
+ };
15
+ };
@@ -0,0 +1,41 @@
1
+ /** @typedef {typeof __propDef.props} FillerProps */
2
+ /** @typedef {typeof __propDef.events} FillerEvents */
3
+ /** @typedef {typeof __propDef.slots} FillerSlots */
4
+ export default class Filler extends SvelteComponentTyped<{
5
+ theme?: "light" | "dark" | "lightblue";
6
+ background?: string;
7
+ width?: "narrow" | "medium" | "wide" | "full";
8
+ height?: "full" | "auto" | "tall";
9
+ marginTop?: boolean;
10
+ marginBottom?: boolean;
11
+ themeOverrides?: any;
12
+ id?: string;
13
+ }, {
14
+ [evt: string]: CustomEvent<any>;
15
+ }, {
16
+ default: {};
17
+ }> {
18
+ }
19
+ export type FillerProps = typeof __propDef.props;
20
+ export type FillerEvents = typeof __propDef.events;
21
+ export type FillerSlots = typeof __propDef.slots;
22
+ import { SvelteComponentTyped } from "svelte";
23
+ declare const __propDef: {
24
+ props: {
25
+ theme?: "light" | "dark" | "lightblue";
26
+ background?: string;
27
+ width?: "narrow" | "medium" | "wide" | "full";
28
+ height?: "auto" | "tall" | "full";
29
+ marginTop?: boolean;
30
+ marginBottom?: boolean;
31
+ themeOverrides?: object;
32
+ id?: string;
33
+ };
34
+ events: {
35
+ [evt: string]: CustomEvent<any>;
36
+ };
37
+ slots: {
38
+ default: {};
39
+ };
40
+ };
41
+ export {};
@@ -0,0 +1,45 @@
1
+ /** @typedef {typeof __propDef.props} GridProps */
2
+ /** @typedef {typeof __propDef.events} GridEvents */
3
+ /** @typedef {typeof __propDef.slots} GridSlots */
4
+ export default class Grid extends SvelteComponentTyped<{
5
+ theme?: "light" | "dark" | "lightblue";
6
+ width?: "narrow" | "medium" | "wide" | "full";
7
+ height?: string | number;
8
+ marginTop?: boolean;
9
+ marginBottom?: boolean;
10
+ themeOverrides?: any;
11
+ id?: string;
12
+ colwidth?: "narrow" | "medium" | "wide" | "full";
13
+ caption?: string;
14
+ gap?: number;
15
+ }, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {
18
+ default: {};
19
+ }> {
20
+ }
21
+ export type GridProps = typeof __propDef.props;
22
+ export type GridEvents = typeof __propDef.events;
23
+ export type GridSlots = typeof __propDef.slots;
24
+ import { SvelteComponentTyped } from "svelte";
25
+ declare const __propDef: {
26
+ props: {
27
+ theme?: "light" | "dark" | "lightblue";
28
+ width?: "narrow" | "medium" | "wide" | "full";
29
+ height?: number | string;
30
+ marginTop?: boolean;
31
+ marginBottom?: boolean;
32
+ themeOverrides?: object;
33
+ id?: string;
34
+ colwidth?: "narrow" | "medium" | "wide" | "full";
35
+ caption?: string;
36
+ gap?: number;
37
+ };
38
+ events: {
39
+ [evt: string]: CustomEvent<any>;
40
+ };
41
+ slots: {
42
+ default: {};
43
+ };
44
+ };
45
+ export {};
@@ -0,0 +1,43 @@
1
+ /** @typedef {typeof __propDef.props} HeroProps */
2
+ /** @typedef {typeof __propDef.events} HeroEvents */
3
+ /** @typedef {typeof __propDef.slots} HeroSlots */
4
+ export default class Hero extends SvelteComponentTyped<{
5
+ theme?: "light" | "dark" | "lightblue";
6
+ background?: string;
7
+ width?: "narrow" | "medium" | "wide" | "full";
8
+ height?: "full" | "auto" | "tall";
9
+ themeOverrides?: any;
10
+ title?: string;
11
+ id?: string;
12
+ lede?: string;
13
+ date?: string;
14
+ }, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {
17
+ default: {};
18
+ }> {
19
+ }
20
+ export type HeroProps = typeof __propDef.props;
21
+ export type HeroEvents = typeof __propDef.events;
22
+ export type HeroSlots = typeof __propDef.slots;
23
+ import { SvelteComponentTyped } from "svelte";
24
+ declare const __propDef: {
25
+ props: {
26
+ theme?: "light" | "dark" | "lightblue";
27
+ background?: string;
28
+ width?: "narrow" | "medium" | "wide" | "full";
29
+ height?: "auto" | "tall" | "full";
30
+ themeOverrides?: object;
31
+ title?: string;
32
+ id?: string;
33
+ lede?: string;
34
+ date?: string;
35
+ };
36
+ events: {
37
+ [evt: string]: CustomEvent<any>;
38
+ };
39
+ slots: {
40
+ default: {};
41
+ };
42
+ };
43
+ export {};
@@ -0,0 +1,51 @@
1
+ /** @typedef {typeof __propDef.props} ScrollerProps */
2
+ /** @typedef {typeof __propDef.events} ScrollerEvents */
3
+ /** @typedef {typeof __propDef.slots} ScrollerSlots */
4
+ export default class Scroller extends SvelteComponentTyped<{
5
+ marginBottom?: boolean;
6
+ id?: string;
7
+ progress?: number;
8
+ splitscreen?: boolean;
9
+ threshold?: number;
10
+ count?: number;
11
+ index?: number;
12
+ sectionId?: string;
13
+ offset?: number;
14
+ visible?: boolean;
15
+ }, {
16
+ change: CustomEvent<any>;
17
+ } & {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {
20
+ background: {};
21
+ foreground: {};
22
+ }> {
23
+ }
24
+ export type ScrollerProps = typeof __propDef.props;
25
+ export type ScrollerEvents = typeof __propDef.events;
26
+ export type ScrollerSlots = typeof __propDef.slots;
27
+ import { SvelteComponentTyped } from "svelte";
28
+ declare const __propDef: {
29
+ props: {
30
+ marginBottom?: boolean;
31
+ id?: string;
32
+ progress?: number;
33
+ splitscreen?: boolean;
34
+ threshold?: number;
35
+ count?: number;
36
+ index?: number;
37
+ sectionId?: string;
38
+ offset?: number;
39
+ visible?: boolean;
40
+ };
41
+ events: {
42
+ change: CustomEvent<any>;
43
+ } & {
44
+ [evt: string]: CustomEvent<any>;
45
+ };
46
+ slots: {
47
+ background: {};
48
+ foreground: {};
49
+ };
50
+ };
51
+ export {};
@@ -0,0 +1,33 @@
1
+ /** @typedef {typeof __propDef.props} ScrollerSectionProps */
2
+ /** @typedef {typeof __propDef.events} ScrollerSectionEvents */
3
+ /** @typedef {typeof __propDef.slots} ScrollerSectionSlots */
4
+ export default class ScrollerSection extends SvelteComponentTyped<{
5
+ theme?: "light" | "dark" | "lightblue";
6
+ title?: string;
7
+ id?: string;
8
+ hideTitle?: boolean;
9
+ }, {
10
+ [evt: string]: CustomEvent<any>;
11
+ }, {
12
+ default: {};
13
+ }> {
14
+ }
15
+ export type ScrollerSectionProps = typeof __propDef.props;
16
+ export type ScrollerSectionEvents = typeof __propDef.events;
17
+ export type ScrollerSectionSlots = typeof __propDef.slots;
18
+ import { SvelteComponentTyped } from "svelte";
19
+ declare const __propDef: {
20
+ props: {
21
+ theme?: "light" | "dark" | "lightblue";
22
+ title?: string;
23
+ id?: string;
24
+ hideTitle?: boolean;
25
+ };
26
+ events: {
27
+ [evt: string]: CustomEvent<any>;
28
+ };
29
+ slots: {
30
+ default: {};
31
+ };
32
+ };
33
+ export {};
@@ -2,7 +2,7 @@
2
2
  /** @typedef {typeof __propDef.events} MetaEvents */
3
3
  /** @typedef {typeof __propDef.slots} MetaSlots */
4
4
  export default class Meta extends SvelteComponentTyped<{
5
- [x: string]: never;
5
+ meta?: any;
6
6
  }, {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  }, {}> {
@@ -13,7 +13,7 @@ export type MetaSlots = typeof __propDef.slots;
13
13
  import { SvelteComponentTyped } from "svelte";
14
14
  declare const __propDef: {
15
15
  props: {
16
- [x: string]: never;
16
+ meta?: any;
17
17
  };
18
18
  events: {
19
19
  [evt: string]: CustomEvent<any>;
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // Wrappers
2
- export { default as Theme } from "./components/wrappers/Theme/Theme.svelte";
3
- export { default as Container } from "./components/wrappers/Container/Container.svelte";
2
+ export { default as Theme } from "./wrappers/Theme/Theme.svelte";
3
+ export { default as Container } from "./wrappers/Container/Container.svelte";
4
4
 
5
5
  // Layout
6
- export { default as Accordion } from "./components/layout/Accordion/Accordion.svelte";
7
- export { default as Footer } from "./components/layout/Footer/Footer.svelte";
8
- export { default as Header } from "./components/layout/Header/Header.svelte";
9
- 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";
10
10
 
11
11
  // Inputs
12
- export { default as Button } from "./components/ui/Button/Button.svelte";
13
- export { default as Dropdown } from "./components/ui/Dropdown/Dropdown.svelte";
14
- export { default as Em } from "./components/ui/Em/Em.svelte";
15
- export { default as Input } from "./components/ui/Input/Input.svelte";
16
- export { default as Select } from "./components/ui/Select/Select.svelte";
17
- export { default as Textarea } from "./components/ui/Textarea/Textarea.svelte";
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
+ };
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { onMount, getContext } from "svelte";
3
- import { slugify } from "../../../js/utils";
3
+ import { slugify } from "$lib/js/utils.js";
4
4
 
5
5
  /**
6
6
  * A title for the element
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import Container from "$lib/components/wrappers/Container/Container.svelte";
2
+ import Container from "$lib/wrappers/Container/Container.svelte";
3
3
 
4
4
  /**
5
5
  * (Optional) Include a horizontal rule
@@ -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>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { onMount, getContext } from "svelte";
3
- import Theme from "$lib/components/wrappers/Theme/Theme.svelte";
3
+ import Theme from "$lib/wrappers/Theme/Theme.svelte";
4
4
 
5
5
  const page = getContext("page");
6
6
 
@@ -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>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { onMount, getContext } from "svelte";
3
- import Theme from "$lib/components/wrappers/Theme/Theme.svelte";
3
+ import Theme from "$lib/wrappers/Theme/Theme.svelte";
4
4
  import ONSLogo from "./ONSLogo.svelte";
5
5
 
6
6
  const page = getContext("page");