@onsvisual/svelte-components 1.0.20 → 1.0.21

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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/datavis/DataCard/DataCard.svelte +14 -14
  3. package/dist/datavis/DataCard/DataCard.svelte.d.ts +14 -14
  4. package/dist/datavis/Table/Table.svelte +4 -4
  5. package/dist/datavis/Table/Table.svelte.d.ts +4 -4
  6. package/dist/decorators/Blockquote/Blockquote.svelte +2 -2
  7. package/dist/decorators/Blockquote/Blockquote.svelte.d.ts +2 -2
  8. package/dist/decorators/Divider/Divider.svelte +2 -2
  9. package/dist/decorators/Divider/Divider.svelte.d.ts +2 -2
  10. package/dist/decorators/Em/Em.svelte +2 -2
  11. package/dist/decorators/Em/Em.svelte.d.ts +2 -2
  12. package/dist/inputs/Button/Button.svelte +117 -117
  13. package/dist/inputs/Button/Button.svelte.d.ts +6 -6
  14. package/dist/inputs/Checkbox/Checkbox.svelte +6 -6
  15. package/dist/inputs/Checkbox/Checkbox.svelte.d.ts +6 -6
  16. package/dist/inputs/Checkboxes/Checkboxes.svelte +6 -6
  17. package/dist/inputs/Checkboxes/Checkboxes.svelte.d.ts +6 -6
  18. package/dist/inputs/Dropdown/Dropdown.svelte +6 -6
  19. package/dist/inputs/Dropdown/Dropdown.svelte.d.ts +6 -6
  20. package/dist/inputs/ErrorPanel/ErrorPanel.svelte +4 -4
  21. package/dist/inputs/ErrorPanel/ErrorPanel.svelte.d.ts +4 -4
  22. package/dist/inputs/ErrorSummary/ErrorSummary.svelte +4 -4
  23. package/dist/inputs/ErrorSummary/ErrorSummary.svelte.d.ts +4 -4
  24. package/dist/inputs/Input/Input.svelte +14 -14
  25. package/dist/inputs/Input/Input.svelte.d.ts +14 -14
  26. package/dist/inputs/Radios/Radio.svelte +6 -6
  27. package/dist/inputs/Radios/Radio.svelte.d.ts +6 -6
  28. package/dist/inputs/Radios/Radios.svelte +6 -6
  29. package/dist/inputs/Radios/Radios.svelte.d.ts +6 -6
  30. package/dist/inputs/Select/Select.svelte +4 -4
  31. package/dist/inputs/Select/Select.svelte.d.ts +4 -4
  32. package/dist/inputs/Textarea/Textarea.svelte +8 -8
  33. package/dist/inputs/Textarea/Textarea.svelte.d.ts +8 -8
  34. package/dist/layout/Accordion/Accordion.svelte +2 -2
  35. package/dist/layout/Accordion/Accordion.svelte.d.ts +2 -2
  36. package/dist/layout/Accordion/AccordionItem.svelte +2 -2
  37. package/dist/layout/Accordion/AccordionItem.svelte.d.ts +2 -2
  38. package/dist/layout/BackLink/BackLink.svelte +2 -2
  39. package/dist/layout/BackLink/BackLink.svelte.d.ts +2 -2
  40. package/dist/layout/Breadcrumb/Breadcrumb.svelte +4 -4
  41. package/dist/layout/Breadcrumb/Breadcrumb.svelte.d.ts +4 -4
  42. package/dist/layout/Card/Card.svelte +12 -12
  43. package/dist/layout/Card/Card.svelte.d.ts +12 -12
  44. package/dist/layout/Contents/Contents.svelte +4 -4
  45. package/dist/layout/Contents/Contents.svelte.d.ts +4 -4
  46. package/dist/layout/DescriptionList/DescriptionList.svelte +4 -4
  47. package/dist/layout/DescriptionList/DescriptionList.svelte.d.ts +4 -4
  48. package/dist/layout/Details/Details.svelte +2 -2
  49. package/dist/layout/Details/Details.svelte.d.ts +2 -2
  50. package/dist/layout/DocumentList/Document.svelte +8 -8
  51. package/dist/layout/DocumentList/Document.svelte.d.ts +8 -8
  52. package/dist/layout/DocumentList/DocumentList.svelte +2 -2
  53. package/dist/layout/DocumentList/DocumentList.svelte.d.ts +2 -2
  54. package/dist/layout/Grid/Grid.svelte +8 -8
  55. package/dist/layout/Grid/Grid.svelte.d.ts +8 -8
  56. package/dist/layout/Header/Header.svelte +4 -4
  57. package/dist/layout/Header/Header.svelte.d.ts +4 -4
  58. package/dist/layout/Hero/Hero.svelte +11 -8
  59. package/dist/layout/Hero/Hero.svelte.d.ts +6 -6
  60. package/dist/layout/Highlight/Highlight.svelte +4 -4
  61. package/dist/layout/Highlight/Highlight.svelte.d.ts +4 -4
  62. package/dist/layout/Image/Image.svelte +8 -8
  63. package/dist/layout/Image/Image.svelte.d.ts +8 -8
  64. package/dist/layout/List/List.svelte +2 -2
  65. package/dist/layout/List/List.svelte.d.ts +2 -2
  66. package/dist/layout/NavSections/NavSection.svelte +2 -2
  67. package/dist/layout/NavSections/NavSection.svelte.d.ts +2 -2
  68. package/dist/layout/NavSections/NavSections.svelte +2 -2
  69. package/dist/layout/NavSections/NavSections.svelte.d.ts +2 -2
  70. package/dist/layout/Notice/Notice.svelte +2 -2
  71. package/dist/layout/Notice/Notice.svelte.d.ts +2 -2
  72. package/dist/layout/PhaseBanner/PhaseBanner.svelte +2 -2
  73. package/dist/layout/PhaseBanner/PhaseBanner.svelte.d.ts +2 -2
  74. package/dist/layout/RelatedContent/RelatedContent.svelte +2 -2
  75. package/dist/layout/RelatedContent/RelatedContent.svelte.d.ts +2 -2
  76. package/dist/layout/Scroller/Scroller.svelte +2 -2
  77. package/dist/layout/Scroller/Scroller.svelte.d.ts +2 -2
  78. package/dist/layout/Scroller/ScrollerSection.svelte +6 -6
  79. package/dist/layout/Scroller/ScrollerSection.svelte.d.ts +6 -6
  80. package/dist/layout/Section/Section.svelte +6 -6
  81. package/dist/layout/Section/Section.svelte.d.ts +6 -6
  82. package/dist/layout/ShareButtons/ShareButtons.svelte +2 -2
  83. package/dist/layout/ShareButtons/ShareButtons.svelte.d.ts +2 -2
  84. package/dist/layout/Summary/Summary.svelte +6 -6
  85. package/dist/layout/Summary/Summary.svelte.d.ts +6 -6
  86. package/dist/layout/Tabs/Tabs.svelte +2 -2
  87. package/dist/layout/Tabs/Tabs.svelte.d.ts +2 -2
  88. package/dist/layout/Timeline/TimelineItem.svelte +2 -2
  89. package/dist/layout/Timeline/TimelineItem.svelte.d.ts +2 -2
  90. package/dist/wrappers/Container/Container.svelte +4 -4
  91. package/dist/wrappers/Container/Container.svelte.d.ts +4 -4
  92. package/dist/wrappers/Theme/Theme.svelte +2 -2
  93. package/dist/wrappers/Theme/Theme.svelte.d.ts +2 -2
  94. package/package.json +4 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@onsvisual%2Fsvelte-components.svg)](https://www.npmjs.com/package/@onsvisual/svelte-components)
4
4
 
5
- A library of ONS Svelte components for projects large and small. You can find documentation and examples of how to use these components on the [Storybook pages](https://onsvisual.github.io/svelte-components).
5
+ A library of ONS Svelte components for projects large and small. You can find documentation and examples of how to use these components on the [Storybook pages](https://onsdigital.github.io/svelte-components).
6
6
 
7
7
  This component library is inspired by Reuters' fantastic [graphics-components](https://github.com/reuters-graphics/graphics-components) library. The components are adapted from the [ONS Design System](https://service-manual.ons.gov.uk/design-system/).
8
8
 
@@ -4,24 +4,24 @@
4
4
 
5
5
  /**
6
6
  * Title of card
7
- * @type {string}
7
+ * @type {string|null}
8
8
  */
9
- export let title = "";
9
+ export let title = null;
10
10
  /**
11
11
  * Optional: Subtitle of card
12
- * @type {string}
12
+ * @type {string|null}
13
13
  */
14
- export let subtitle = "";
14
+ export let subtitle = null;
15
15
  /**
16
16
  * Optional: URL link for card title
17
- * @type {string}
17
+ * @type {string|null}
18
18
  */
19
- export let href = "";
19
+ export let href = null;
20
20
  /**
21
21
  * Big number (expects a pre-formatted text string)
22
- * @type {string|number}
22
+ * @type {string|number|null}
23
23
  */
24
- export let value = "";
24
+ export let value = null;
25
25
  /**
26
26
  * Mode for the data tile
27
27
  * @type {"number"|"sparkline"|"bar"}
@@ -29,9 +29,9 @@
29
29
  export let mode = "number";
30
30
  /**
31
31
  * Text caption describing the number
32
- * @type {string}
32
+ * @type {string|null}
33
33
  */
34
- export let caption = "";
34
+ export let caption = null;
35
35
  /**
36
36
  * An array of data (required for charts)
37
37
  * @type {object[]|null}
@@ -39,14 +39,14 @@
39
39
  export let data = null;
40
40
  /**
41
41
  * Text describing the source of the data
42
- * @type {string}
42
+ * @type {string|null}
43
43
  */
44
- export let source = "";
44
+ export let source = null;
45
45
  /**
46
46
  * Optional: Set an additional CSS class for the component
47
- * @type {string}
47
+ * @type {string|null}
48
48
  */
49
- export let cls = "";
49
+ export let cls = null;
50
50
  </script>
51
51
 
52
52
  <Card {title} {href} mode="featured" {cls}>
@@ -2,15 +2,15 @@
2
2
  /** @typedef {typeof __propDef.events} DataCardEvents */
3
3
  /** @typedef {typeof __propDef.slots} DataCardSlots */
4
4
  export default class DataCard extends SvelteComponentTyped<{
5
- cls?: string | undefined;
6
- caption?: string | undefined;
5
+ cls?: string | null | undefined;
6
+ caption?: string | null | undefined;
7
7
  data?: object[] | null | undefined;
8
- source?: string | undefined;
9
- title?: string | undefined;
10
- href?: string | undefined;
8
+ source?: string | null | undefined;
9
+ title?: string | null | undefined;
10
+ href?: string | null | undefined;
11
11
  mode?: "number" | "sparkline" | "bar" | undefined;
12
- value?: string | number | undefined;
13
- subtitle?: string | undefined;
12
+ value?: string | number | null | undefined;
13
+ subtitle?: string | null | undefined;
14
14
  }, {
15
15
  [evt: string]: CustomEvent<any>;
16
16
  }, {}> {
@@ -21,15 +21,15 @@ export type DataCardSlots = typeof __propDef.slots;
21
21
  import { SvelteComponentTyped } from "svelte";
22
22
  declare const __propDef: {
23
23
  props: {
24
- cls?: string | undefined;
25
- caption?: string | undefined;
24
+ cls?: string | null | undefined;
25
+ caption?: string | null | undefined;
26
26
  data?: object[] | null | undefined;
27
- source?: string | undefined;
28
- title?: string | undefined;
29
- href?: string | undefined;
27
+ source?: string | null | undefined;
28
+ title?: string | null | undefined;
29
+ href?: string | null | undefined;
30
30
  mode?: "number" | "sparkline" | "bar" | undefined;
31
- value?: string | number | undefined;
32
- subtitle?: string | undefined;
31
+ value?: string | number | null | undefined;
32
+ subtitle?: string | null | undefined;
33
33
  };
34
34
  events: {
35
35
  [evt: string]: CustomEvent<any>;
@@ -3,9 +3,9 @@
3
3
 
4
4
  /**
5
5
  * An optional title for the table
6
- * @type {string}
6
+ * @type {string|null}
7
7
  */
8
- export let title = "";
8
+ export let title = null;
9
9
  /**
10
10
  * Make the table smaller/more compact
11
11
  * @type {boolean}
@@ -46,9 +46,9 @@
46
46
  let sort = columns.map(() => "none");
47
47
  /**
48
48
  * Optional: Set an additional CSS class for the component
49
- * @type {string}
49
+ * @type {string|null}
50
50
  */
51
- export let cls = "";
51
+ export let cls = null;
52
52
 
53
53
  $: formatters = columns.map((d) => d.formatter || formatter(d.dp));
54
54
  </script>
@@ -2,10 +2,10 @@
2
2
  /** @typedef {typeof __propDef.events} TableEvents */
3
3
  /** @typedef {typeof __propDef.slots} TableSlots */
4
4
  export default class Table extends SvelteComponentTyped<{
5
- cls?: string | undefined;
5
+ cls?: string | null | undefined;
6
6
  height?: number | "auto" | undefined;
7
7
  data?: object[] | undefined;
8
- title?: string | undefined;
8
+ title?: string | null | undefined;
9
9
  compact?: boolean | undefined;
10
10
  sortable?: boolean | undefined;
11
11
  responsive?: boolean | undefined;
@@ -21,10 +21,10 @@ export type TableSlots = typeof __propDef.slots;
21
21
  import { SvelteComponentTyped } from "svelte";
22
22
  declare const __propDef: {
23
23
  props: {
24
- cls?: string | undefined;
24
+ cls?: string | null | undefined;
25
25
  height?: number | "auto" | undefined;
26
26
  data?: object[] | undefined;
27
- title?: string | undefined;
27
+ title?: string | null | undefined;
28
28
  compact?: boolean | undefined;
29
29
  sortable?: boolean | undefined;
30
30
  responsive?: boolean | undefined;
@@ -1,9 +1,9 @@
1
1
  <script>
2
2
  /**
3
3
  * Attribution for the quote.
4
- * @type {string}
4
+ * @type {string|null}
5
5
  */
6
- export let attribution = "";
6
+ export let attribution = null;
7
7
  </script>
8
8
 
9
9
  <blockquote class="ons-quote">
@@ -2,7 +2,7 @@
2
2
  /** @typedef {typeof __propDef.events} BlockquoteEvents */
3
3
  /** @typedef {typeof __propDef.slots} BlockquoteSlots */
4
4
  export default class Blockquote extends SvelteComponentTyped<{
5
- attribution?: string | undefined;
5
+ attribution?: string | null | undefined;
6
6
  }, {
7
7
  [evt: string]: CustomEvent<any>;
8
8
  }, {
@@ -15,7 +15,7 @@ export type BlockquoteSlots = typeof __propDef.slots;
15
15
  import { SvelteComponentTyped } from "svelte";
16
16
  declare const __propDef: {
17
17
  props: {
18
- attribution?: string | undefined;
18
+ attribution?: string | null | undefined;
19
19
  };
20
20
  events: {
21
21
  [evt: string]: CustomEvent<any>;
@@ -28,9 +28,9 @@
28
28
  export let marginBottom = true;
29
29
  /**
30
30
  * Optional: Set an additional CSS class for the component
31
- * @type {string}
31
+ * @type {string|null}
32
32
  */
33
- export let cls = "";
33
+ export let cls = null;
34
34
  </script>
35
35
 
36
36
  <Container {width} {marginTop} {marginBottom} {cls}>
@@ -2,7 +2,7 @@
2
2
  /** @typedef {typeof __propDef.events} DividerEvents */
3
3
  /** @typedef {typeof __propDef.slots} DividerSlots */
4
4
  export default class Divider extends SvelteComponentTyped<{
5
- cls?: string | undefined;
5
+ cls?: string | null | undefined;
6
6
  width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
7
7
  marginTop?: boolean | undefined;
8
8
  marginBottom?: boolean | undefined;
@@ -18,7 +18,7 @@ export type DividerSlots = typeof __propDef.slots;
18
18
  import { SvelteComponentTyped } from "svelte";
19
19
  declare const __propDef: {
20
20
  props: {
21
- cls?: string | undefined;
21
+ cls?: string | null | undefined;
22
22
  width?: "narrow" | "medium" | "wide" | "wider" | "full" | undefined;
23
23
  marginTop?: boolean | undefined;
24
24
  marginBottom?: boolean | undefined;
@@ -13,9 +13,9 @@
13
13
  export let mode = "default";
14
14
  /**
15
15
  * Override the font size of the surrounding text
16
- * @type {string}
16
+ * @type {string|null}
17
17
  */
18
- export let fontSize = "";
18
+ export let fontSize = null;
19
19
  /**
20
20
  * Don't break text across lines
21
21
  * @type {boolean}
@@ -4,7 +4,7 @@
4
4
  export default class Em extends SvelteComponentTyped<{
5
5
  mode?: "default" | "badge" | undefined;
6
6
  color?: string | undefined;
7
- fontSize?: string | undefined;
7
+ fontSize?: string | null | undefined;
8
8
  nowrap?: boolean | undefined;
9
9
  ariaLabel?: string | null | undefined;
10
10
  }, {
@@ -21,7 +21,7 @@ declare const __propDef: {
21
21
  props: {
22
22
  mode?: "default" | "badge" | undefined;
23
23
  color?: string | undefined;
24
- fontSize?: string | undefined;
24
+ fontSize?: string | null | undefined;
25
25
  nowrap?: boolean | undefined;
26
26
  ariaLabel?: string | null | undefined;
27
27
  };
@@ -1,125 +1,125 @@
1
1
  <script>
2
- import { createEventDispatcher } from "svelte";
3
- import Icon from "../../decorators/Icon/Icon.svelte";
2
+ import { createEventDispatcher } from "svelte";
3
+ import Icon from "../../decorators/Icon/Icon.svelte";
4
4
 
5
- const dispatch = createEventDispatcher();
5
+ const dispatch = createEventDispatcher();
6
6
 
7
- /**
8
- * Type of button
9
- * @type {"button"|"sumbit"|"reset"}
10
- */
11
- export let type = "button";
12
- /**
13
- * Style variant of button
14
- * @type {"primary"|"secondary"|"ghost"}
15
- */
16
- export let variant = "primary";
17
- /**
18
- * Href of button (renders button as a link)
19
- * @type {string}
20
- */
21
- export let href = "";
22
- /**
23
- * Make button smaller
24
- * @type {boolean}
25
- */
26
- export let small = false;
27
- /**
28
- * Icon on button, eg. "arrow", "search"
29
- * @type {"arrow"|"external"|"signout"|"print"|"download"|"tick"|"search"|null}
30
- */
31
- export let icon = null;
32
- /**
33
- * Position of icon
34
- * @type {"before"|"after"}
35
- */
36
- export let iconPosition = "before";
37
- /**
38
- * Show button as disabled
39
- * @type {boolean}
40
- */
41
- export let disabled = false;
42
- /**
43
- * Visually hide the button text (for icon-only buttons)
44
- * @type {boolean}
45
- */
46
- export let hideLabel = false;
47
- /**
48
- * aria label for button
49
- * @type {string}
50
- */
51
- export let arialabel = "";
52
- /**
53
- * filename if link is used for a file download
54
- * @type {string|null}
55
- */
56
- export let download = null;
57
- /**
58
- * Optional: Set an additional CSS class for the component
59
- * @type {string}
60
- */
61
- export let cls = "";
7
+ /**
8
+ * Type of button
9
+ * @type {"button"|"sumbit"|"reset"}
10
+ */
11
+ export let type = "button";
12
+ /**
13
+ * Style variant of button
14
+ * @type {"primary"|"secondary"|"ghost"}
15
+ */
16
+ export let variant = "primary";
17
+ /**
18
+ * Href of button (renders button as a link)
19
+ * @type {string|null}
20
+ */
21
+ export let href = null;
22
+ /**
23
+ * Make button smaller
24
+ * @type {boolean}
25
+ */
26
+ export let small = false;
27
+ /**
28
+ * Icon on button, eg. "arrow", "search"
29
+ * @type {"arrow"|"external"|"signout"|"print"|"download"|"tick"|"search"|null}
30
+ */
31
+ export let icon = null;
32
+ /**
33
+ * Position of icon
34
+ * @type {"before"|"after"}
35
+ */
36
+ export let iconPosition = "before";
37
+ /**
38
+ * Show button as disabled
39
+ * @type {boolean}
40
+ */
41
+ export let disabled = false;
42
+ /**
43
+ * Visually hide the button text (for icon-only buttons)
44
+ * @type {boolean}
45
+ */
46
+ export let hideLabel = false;
47
+ /**
48
+ * aria label for button
49
+ * @type {string|null}
50
+ */
51
+ export let arialabel = null;
52
+ /**
53
+ * filename if link is used for a file download
54
+ * @type {string|null}
55
+ */
56
+ export let download = null;
57
+ /**
58
+ * Optional: Set an additional CSS class for the component
59
+ * @type {string|null}
60
+ */
61
+ export let cls = null;
62
62
  </script>
63
63
 
64
64
  {#if href}
65
- <a
66
- href={!disabled ? href : null}
67
- role="button"
68
- {download}
69
- class="ons-btn ons-btn--link ons-js-submit-btn {cls}"
70
- class:ons-btn--small={small}
71
- class:ons-btn--secondary={variant === "secondary"}
72
- class:ons-btn--ghost={variant === "ghost"}
73
- class:ons-btn--disabled={disabled}
74
- on:click={(e) => dispatch("click", e)}
75
- aria-label={arialabel}
76
- >
77
- <span class="ons-btn__inner">
78
- {#if iconPosition === "before"}
79
- <slot name="icon">
80
- {#if icon}
81
- <Icon type={icon} marginRight={!hideLabel} />
82
- {/if}
83
- </slot>
84
- {/if}
85
- <span class="ons-btn__text" class:ons-u-vh={hideLabel}><slot /></span>
86
- {#if iconPosition === "after"}
87
- <slot name="icon">
88
- {#if icon}
89
- <Icon type={icon} marginLeft={!hideLabel} />
90
- {/if}
91
- </slot>
92
- {/if}
93
- </span>
94
- </a>
65
+ <a
66
+ href={!disabled ? href : null}
67
+ role="button"
68
+ {download}
69
+ class="ons-btn ons-btn--link ons-js-submit-btn {cls}"
70
+ class:ons-btn--small={small}
71
+ class:ons-btn--secondary={variant === "secondary"}
72
+ class:ons-btn--ghost={variant === "ghost"}
73
+ class:ons-btn--disabled={disabled}
74
+ on:click={(e) => dispatch("click", e)}
75
+ aria-label={arialabel}
76
+ >
77
+ <span class="ons-btn__inner">
78
+ {#if iconPosition === "before"}
79
+ <slot name="icon">
80
+ {#if icon}
81
+ <Icon type={icon} marginRight={!hideLabel} />
82
+ {/if}
83
+ </slot>
84
+ {/if}
85
+ <span class="ons-btn__text" class:ons-u-vh={hideLabel}><slot /></span>
86
+ {#if iconPosition === "after"}
87
+ <slot name="icon">
88
+ {#if icon}
89
+ <Icon type={icon} marginLeft={!hideLabel} />
90
+ {/if}
91
+ </slot>
92
+ {/if}
93
+ </span>
94
+ </a>
95
95
  {:else}
96
- <button
97
- {type}
98
- class="ons-btn {cls}"
99
- class:ons-btn--small={small}
100
- class:ons-btn--secondary={variant === "secondary"}
101
- class:ons-btn--ghost={variant === "ghost"}
102
- class:ons-btn--disabled={disabled}
103
- {disabled}
104
- on:click={(e) => dispatch("click", e)}
105
- aria-label={arialabel}
106
- >
107
- <span class="ons-btn__inner">
108
- {#if iconPosition === "before"}
109
- <slot name="icon">
110
- {#if icon}
111
- <Icon type={icon} marginRight={!hideLabel} />
112
- {/if}
113
- </slot>
114
- {/if}
115
- <span class="ons-btn__text" class:ons-u-vh={hideLabel}><slot /></span>
116
- {#if iconPosition === "after"}
117
- <slot name="icon">
118
- {#if icon}
119
- <Icon type={icon} marginLeft={!hideLabel} />
120
- {/if}
121
- </slot>
122
- {/if}
123
- </span>
124
- </button>
96
+ <button
97
+ {type}
98
+ class="ons-btn {cls}"
99
+ class:ons-btn--small={small}
100
+ class:ons-btn--secondary={variant === "secondary"}
101
+ class:ons-btn--ghost={variant === "ghost"}
102
+ class:ons-btn--disabled={disabled}
103
+ {disabled}
104
+ on:click={(e) => dispatch("click", e)}
105
+ aria-label={arialabel}
106
+ >
107
+ <span class="ons-btn__inner">
108
+ {#if iconPosition === "before"}
109
+ <slot name="icon">
110
+ {#if icon}
111
+ <Icon type={icon} marginRight={!hideLabel} />
112
+ {/if}
113
+ </slot>
114
+ {/if}
115
+ <span class="ons-btn__text" class:ons-u-vh={hideLabel}><slot /></span>
116
+ {#if iconPosition === "after"}
117
+ <slot name="icon">
118
+ {#if icon}
119
+ <Icon type={icon} marginLeft={!hideLabel} />
120
+ {/if}
121
+ </slot>
122
+ {/if}
123
+ </span>
124
+ </button>
125
125
  {/if}
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} ButtonEvents */
3
3
  /** @typedef {typeof __propDef.slots} ButtonSlots */
4
4
  export default class Button extends SvelteComponentTyped<{
5
- cls?: string | undefined;
5
+ cls?: string | null | undefined;
6
6
  small?: boolean | undefined;
7
- href?: string | undefined;
7
+ href?: string | null | undefined;
8
8
  download?: string | null | undefined;
9
9
  type?: "button" | "reset" | "sumbit" | undefined;
10
10
  variant?: "secondary" | "primary" | "ghost" | undefined;
@@ -12,7 +12,7 @@ export default class Button extends SvelteComponentTyped<{
12
12
  iconPosition?: "before" | "after" | undefined;
13
13
  disabled?: boolean | undefined;
14
14
  hideLabel?: boolean | undefined;
15
- arialabel?: string | undefined;
15
+ arialabel?: string | null | undefined;
16
16
  }, {
17
17
  click: CustomEvent<any>;
18
18
  } & {
@@ -28,9 +28,9 @@ export type ButtonSlots = typeof __propDef.slots;
28
28
  import { SvelteComponentTyped } from "svelte";
29
29
  declare const __propDef: {
30
30
  props: {
31
- cls?: string | undefined;
31
+ cls?: string | null | undefined;
32
32
  small?: boolean | undefined;
33
- href?: string | undefined;
33
+ href?: string | null | undefined;
34
34
  download?: string | null | undefined;
35
35
  type?: "button" | "reset" | "sumbit" | undefined;
36
36
  variant?: "secondary" | "primary" | "ghost" | undefined;
@@ -38,7 +38,7 @@ declare const __propDef: {
38
38
  iconPosition?: "before" | "after" | undefined;
39
39
  disabled?: boolean | undefined;
40
40
  hideLabel?: boolean | undefined;
41
- arialabel?: string | undefined;
41
+ arialabel?: string | null | undefined;
42
42
  };
43
43
  events: {
44
44
  click: CustomEvent<any>;
@@ -15,9 +15,9 @@
15
15
  export let label;
16
16
  /**
17
17
  * Optional: Extended description for element
18
- * @type {string}
18
+ * @type {string|null}
19
19
  */
20
- export let description = "";
20
+ export let description = null;
21
21
  /**
22
22
  * Binding for checked state of input
23
23
  * @type {boolean}
@@ -35,9 +35,9 @@
35
35
  export let item = { id, label, description, checked, disabled };
36
36
  /**
37
37
  * Optional: Name of checkbox group
38
- * @type {string}
38
+ * @type {string|null}
39
39
  */
40
- export let groupName = "";
40
+ export let groupName = null;
41
41
  /**
42
42
  * Binding for checked state of input
43
43
  * @type {object[]|null}
@@ -55,9 +55,9 @@
55
55
  export let compact = false;
56
56
  /**
57
57
  * Optional: Set an additional CSS class for the component
58
- * @type {string}
58
+ * @type {string|null}
59
59
  */
60
- export let cls = "";
60
+ export let cls = null;
61
61
 
62
62
  const checkboxes = getContext("checkboxes");
63
63
 
@@ -4,15 +4,15 @@
4
4
  export default class Checkbox extends SvelteComponentTyped<{
5
5
  id: string;
6
6
  label: string;
7
- cls?: string | undefined;
7
+ cls?: string | null | undefined;
8
8
  group?: object[] | null | undefined;
9
9
  compact?: boolean | undefined;
10
- description?: string | undefined;
10
+ description?: string | null | undefined;
11
11
  variant?: "default" | "ghost" | undefined;
12
12
  disabled?: boolean | undefined;
13
13
  checked?: boolean | undefined;
14
14
  item?: object | undefined;
15
- groupName?: string | undefined;
15
+ groupName?: string | null | undefined;
16
16
  }, {
17
17
  change: CustomEvent<any>;
18
18
  } & {
@@ -27,15 +27,15 @@ declare const __propDef: {
27
27
  props: {
28
28
  id: string;
29
29
  label: string;
30
- cls?: string | undefined;
30
+ cls?: string | null | undefined;
31
31
  group?: object[] | null | undefined;
32
32
  compact?: boolean | undefined;
33
- description?: string | undefined;
33
+ description?: string | null | undefined;
34
34
  variant?: "default" | "ghost" | undefined;
35
35
  disabled?: boolean | undefined;
36
36
  checked?: boolean | undefined;
37
37
  item?: object | undefined;
38
- groupName?: string | undefined;
38
+ groupName?: string | null | undefined;
39
39
  };
40
40
  events: {
41
41
  change: CustomEvent<any>;
@@ -5,9 +5,9 @@
5
5
 
6
6
  /**
7
7
  * Title/legend for parent <fieldset>
8
- * @type {string}
8
+ * @type {string|null}
9
9
  */
10
- export let title = "";
10
+ export let title = null;
11
11
  /**
12
12
  * Visually hide the title/legend
13
13
  * @type {boolean}
@@ -15,9 +15,9 @@
15
15
  export let hideTitle = false;
16
16
  /**
17
17
  * Descriptive "how to" label for inputs
18
- * @type {string}
18
+ * @type {string|null}
19
19
  */
20
- export let label = "";
20
+ export let label = null;
21
21
  /** Optional: Define the checkboxes as an array of {id, label, checked, description?}
22
22
  * @type {object[]|null}
23
23
  */
@@ -32,9 +32,9 @@
32
32
  export let value = [];
33
33
  /**
34
34
  * Optional: Set an additional CSS class for the component
35
- * @type {string}
35
+ * @type {string|null}
36
36
  */
37
- export let cls = "";
37
+ export let cls = null;
38
38
 
39
39
  const checkboxes = writable([]);
40
40
  setContext("checkboxes", checkboxes);