@onsvisual/svelte-components 1.0.0-next.5 → 1.0.0-next.7

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 (95) hide show
  1. package/dist/datavis/DataTile/DataTile.stories.svelte +14 -0
  2. package/dist/datavis/DataTile/DataTile.svelte +23 -4
  3. package/dist/datavis/DataTile/DataTile.svelte.d.ts +4 -0
  4. package/dist/datavis/DataTile/Sparkline.svelte +117 -0
  5. package/dist/datavis/DataTile/Sparkline.svelte.d.ts +27 -0
  6. package/dist/datavis/Table/Table.svelte +6 -0
  7. package/dist/datavis/Table/Table.svelte.d.ts +2 -0
  8. package/dist/decorators/Divider/Divider.svelte +8 -3
  9. package/dist/decorators/Divider/Divider.svelte.d.ts +2 -0
  10. package/dist/decorators/Icon/Icon.stories.svelte +25 -0
  11. package/dist/{inputs/Button/Icon.svelte.d.ts → decorators/Icon/Icon.stories.svelte.d.ts} +2 -6
  12. package/dist/{inputs/Button → decorators/Icon}/Icon.svelte +20 -3
  13. package/dist/decorators/Icon/Icon.svelte.d.ts +29 -0
  14. package/dist/decorators/Icon/docs/component.md +12 -0
  15. package/dist/inputs/Button/Button.svelte +9 -4
  16. package/dist/inputs/Button/Button.svelte.d.ts +6 -4
  17. package/dist/inputs/Checkbox/Checkbox.svelte +6 -1
  18. package/dist/inputs/Checkbox/Checkbox.svelte.d.ts +2 -0
  19. package/dist/inputs/Checkboxes/Checkboxes.svelte +6 -1
  20. package/dist/inputs/Checkboxes/Checkboxes.svelte.d.ts +2 -0
  21. package/dist/inputs/Dropdown/Dropdown.svelte +6 -1
  22. package/dist/inputs/Dropdown/Dropdown.svelte.d.ts +2 -0
  23. package/dist/inputs/ErrorPanel/ErrorPanel.svelte +6 -1
  24. package/dist/inputs/ErrorPanel/ErrorPanel.svelte.d.ts +2 -0
  25. package/dist/inputs/ErrorSummary/ErrorSummary.svelte +6 -1
  26. package/dist/inputs/ErrorSummary/ErrorSummary.svelte.d.ts +2 -0
  27. package/dist/inputs/Input/Input.svelte +6 -1
  28. package/dist/inputs/Input/Input.svelte.d.ts +2 -0
  29. package/dist/inputs/Radios/Radios.svelte +6 -1
  30. package/dist/inputs/Radios/Radios.svelte.d.ts +2 -0
  31. package/dist/inputs/Select/Select.svelte +6 -1
  32. package/dist/inputs/Select/Select.svelte.d.ts +2 -0
  33. package/dist/inputs/Textarea/Textarea.svelte +6 -1
  34. package/dist/inputs/Textarea/Textarea.svelte.d.ts +2 -0
  35. package/dist/layout/Accordion/Accordion.svelte +1 -1
  36. package/dist/layout/Accordion/Accordion.svelte.d.ts +2 -2
  37. package/dist/layout/Breadcrumb/Breadcrumb.svelte +6 -1
  38. package/dist/layout/Breadcrumb/Breadcrumb.svelte.d.ts +4 -2
  39. package/dist/layout/Card/Card.svelte +1 -1
  40. package/dist/layout/Card/Card.svelte.d.ts +2 -2
  41. package/dist/layout/Contents/Contents.svelte +6 -1
  42. package/dist/layout/Contents/Contents.svelte.d.ts +2 -0
  43. package/dist/layout/DescriptionList/DescriptionList.svelte +6 -1
  44. package/dist/layout/DescriptionList/DescriptionList.svelte.d.ts +2 -0
  45. package/dist/layout/Details/Details.svelte +6 -1
  46. package/dist/layout/Details/Details.svelte.d.ts +2 -0
  47. package/dist/layout/DocumentList/DocumentList.svelte +6 -1
  48. package/dist/layout/DocumentList/DocumentList.svelte.d.ts +2 -0
  49. package/dist/layout/Footer/Footer.svelte +1 -1
  50. package/dist/layout/Footer/Footer.svelte.d.ts +4 -4
  51. package/dist/layout/Grid/Grid.svelte +3 -3
  52. package/dist/layout/Grid/Grid.svelte.d.ts +2 -2
  53. package/dist/layout/Header/Header.svelte +1 -1
  54. package/dist/layout/Header/Header.svelte.d.ts +4 -4
  55. package/dist/layout/Hero/Hero.stories.svelte +2 -1
  56. package/dist/layout/Hero/Hero.svelte +9 -8
  57. package/dist/layout/Hero/Hero.svelte.d.ts +8 -6
  58. package/dist/layout/Highlight/Highlight.svelte +15 -22
  59. package/dist/layout/Highlight/Highlight.svelte.d.ts +6 -6
  60. package/dist/layout/Image/Image.svelte +6 -1
  61. package/dist/layout/Image/Image.svelte.d.ts +2 -0
  62. package/dist/layout/List/List.svelte +6 -1
  63. package/dist/layout/List/List.svelte.d.ts +2 -0
  64. package/dist/layout/NavSections/NavSection.svelte +1 -1
  65. package/dist/layout/NavSections/NavSection.svelte.d.ts +2 -2
  66. package/dist/layout/NavSections/NavSections.svelte +3 -3
  67. package/dist/layout/NavSections/NavSections.svelte.d.ts +2 -2
  68. package/dist/layout/Notice/Notice.svelte +6 -1
  69. package/dist/layout/Notice/Notice.svelte.d.ts +2 -0
  70. package/dist/layout/PhaseBanner/PhaseBanner.svelte +6 -1
  71. package/dist/layout/PhaseBanner/PhaseBanner.svelte.d.ts +2 -0
  72. package/dist/layout/RelatedContent/RelatedContent.svelte +6 -1
  73. package/dist/layout/RelatedContent/RelatedContent.svelte.d.ts +2 -0
  74. package/dist/layout/Scroller/Scroller.svelte +6 -1
  75. package/dist/layout/Scroller/Scroller.svelte.d.ts +2 -0
  76. package/dist/layout/Scroller/ScrollerSection.svelte +6 -1
  77. package/dist/layout/Scroller/ScrollerSection.svelte.d.ts +2 -0
  78. package/dist/layout/Section/Section.svelte +3 -3
  79. package/dist/layout/Section/Section.svelte.d.ts +2 -2
  80. package/dist/layout/ShareButtons/ShareButtons.svelte +8 -3
  81. package/dist/layout/ShareButtons/ShareButtons.svelte.d.ts +2 -0
  82. package/dist/layout/Summary/Summary.svelte +6 -1
  83. package/dist/layout/Summary/Summary.svelte.d.ts +2 -0
  84. package/dist/layout/Tabs/Tabs.svelte +6 -1
  85. package/dist/layout/Tabs/Tabs.svelte.d.ts +2 -0
  86. package/dist/templates/intro.mdx +1 -1
  87. package/dist/wrappers/Container/Container.svelte +41 -28
  88. package/dist/wrappers/Container/Container.svelte.d.ts +8 -4
  89. package/dist/wrappers/Container/docs/component.md +4 -2
  90. package/dist/wrappers/Theme/Theme.svelte +4 -4
  91. package/dist/wrappers/Theme/Theme.svelte.d.ts +6 -6
  92. package/dist/wrappers/Theme/docs/component.md +1 -1
  93. package/dist/wrappers/Theme/themes.d.ts +28 -0
  94. package/dist/wrappers/Theme/themes.js +2 -1
  95. package/package.json +3 -1
@@ -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 a CSS class for the container
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
- * Optional margin above container
25
+ * Adds margin above container
24
26
  * @type {boolean}
25
27
  */
26
28
  export let marginTop = false;
27
29
  /**
28
- * Optional margin below container
30
+ * Adds margin below container
29
31
  * @type {boolean}
30
32
  */
31
33
  export let marginBottom = false;
32
34
  /**
33
- * Overrides the base theme background (accepts any valid CSS background value)
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
- <div
40
- {id}
41
- class="ons-page__container {cls || ''}"
42
- class:ons-container={width !== "full"}
43
- class:ons-container--wide={width === "wider"}
44
- class:ons-u-mt-xl={marginTop}
45
- class:ons-u-mb-xl={marginBottom}
46
- style:background
47
- style:height={typeof height === "number" ? `${height}px` : height === "full" ? "100vh" : height}
48
- >
49
- {#if width === "narrow"}
50
- <div class="ons-grid">
51
- <div class="ons-grid__col ons-col-10@m ons-col-8@l">
52
- <slot />
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
- </div>
55
- {:else if width === "medium"}
56
- <div class="ons-grid">
57
- <div class="ons-grid__col ons-col-10@l">
58
- <slot />
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
- </div>
61
- {:else}
62
- <slot />
63
- {/if}
64
- </div>
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
- id?: string | undefined;
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
- background?: string | null | undefined;
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
- id?: string | undefined;
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
- background?: string | null | undefined;
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, minimum height and theme of a block of content.
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}"> {child_components} </Container>
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 a CSS class for the theme container
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 || (!theme && !background)}
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
- cls?: string | undefined;
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
- cls?: string | undefined;
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="{theme_name}"> {child_components} </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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "1.0.0-next.5",
3
+ "version": "1.0.0-next.7",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "npm run build:package && npm run build:docs",
@@ -61,6 +61,8 @@
61
61
  "@vitest/browser": "3.2.3",
62
62
  "@vitest/coverage-v8": "3.2.3",
63
63
  "csso": "^5.0.5",
64
+ "d3-scale": "^4.0.2",
65
+ "d3-shape": "^3.2.0",
64
66
  "eslint": "^9.18.0",
65
67
  "eslint-config-prettier": "^10.0.1",
66
68
  "eslint-plugin-storybook": "^9.0.11",