@onsvisual/svelte-components 1.0.15 → 1.0.17
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/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/inputs/Button/Button.svelte +117 -118
- package/dist/inputs/Button/Button.svelte.d.ts +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { default as DocumentList } from "./layout/DocumentList/DocumentList.svel
|
|
|
15
15
|
export { default as Document } from "./layout/DocumentList/Document.svelte";
|
|
16
16
|
export { default as ErrorPage } from "./layout/ErrorPage/ErrorPage.svelte";
|
|
17
17
|
export { default as Footer } from "./layout/Footer/Footer.svelte";
|
|
18
|
-
export { default as Grid } from "./layout/Grid/Grid.svelte";
|
|
19
18
|
export { default as GridCell } from "./layout/Grid/GridCell.svelte";
|
|
20
19
|
export { default as Header } from "./layout/Header/Header.svelte";
|
|
21
20
|
export { default as Highlight } from "./layout/Highlight/Highlight.svelte";
|
|
@@ -56,5 +55,6 @@ export { default as DataCard } from "./datavis/DataCard/DataCard.svelte";
|
|
|
56
55
|
export { default as Table } from "./datavis/Table/Table.svelte";
|
|
57
56
|
export { default as AnalyticsBanner, analyticsEvent } from "./layout/AnalyticsBanner/AnalyticsBanner.svelte";
|
|
58
57
|
export { default as Details, default as Twisty } from "./layout/Details/Details.svelte";
|
|
58
|
+
export { default as Grid, default as Cards } from "./layout/Grid/Grid.svelte";
|
|
59
59
|
export { default as Hero, default as Titleblock } from "./layout/Hero/Hero.svelte";
|
|
60
60
|
export { default as Select, default as AccessibleSelect } from "./inputs/Select/Select.svelte";
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { default as Document } from "./layout/DocumentList/Document.svelte";
|
|
|
25
25
|
export { default as ErrorPage } from "./layout/ErrorPage/ErrorPage.svelte";
|
|
26
26
|
export { default as Footer } from "./layout/Footer/Footer.svelte";
|
|
27
27
|
export { default as Grid } from "./layout/Grid/Grid.svelte";
|
|
28
|
+
export { default as Cards } from "./layout/Grid/Grid.svelte"; // Alias for Grid
|
|
28
29
|
export { default as GridCell } from "./layout/Grid/GridCell.svelte";
|
|
29
30
|
export { default as Header } from "./layout/Header/Header.svelte";
|
|
30
31
|
export { default as Hero } from "./layout/Hero/Hero.svelte";
|
|
@@ -1,126 +1,125 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import Icon from "../../decorators/Icon/Icon.svelte";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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 = "";
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
64
|
{#if href}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</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>
|
|
96
95
|
{:else}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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>
|
|
126
125
|
{/if}
|
|
@@ -5,10 +5,10 @@ export default class Button extends SvelteComponentTyped<{
|
|
|
5
5
|
cls?: string | undefined;
|
|
6
6
|
small?: boolean | undefined;
|
|
7
7
|
href?: string | undefined;
|
|
8
|
-
download?: string | undefined;
|
|
8
|
+
download?: string | null | undefined;
|
|
9
9
|
type?: "button" | "reset" | "sumbit" | undefined;
|
|
10
10
|
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
11
|
-
icon?: "search" | "arrow" | "external" | "signout" | "print" | "download" | "tick" | undefined;
|
|
11
|
+
icon?: "search" | "arrow" | "external" | "signout" | "print" | "download" | "tick" | null | undefined;
|
|
12
12
|
iconPosition?: "before" | "after" | undefined;
|
|
13
13
|
disabled?: boolean | undefined;
|
|
14
14
|
hideLabel?: boolean | undefined;
|
|
@@ -31,10 +31,10 @@ declare const __propDef: {
|
|
|
31
31
|
cls?: string | undefined;
|
|
32
32
|
small?: boolean | undefined;
|
|
33
33
|
href?: string | undefined;
|
|
34
|
-
download?: string | undefined;
|
|
34
|
+
download?: string | null | undefined;
|
|
35
35
|
type?: "button" | "reset" | "sumbit" | undefined;
|
|
36
36
|
variant?: "secondary" | "primary" | "ghost" | undefined;
|
|
37
|
-
icon?: "search" | "arrow" | "external" | "signout" | "print" | "download" | "tick" | undefined;
|
|
37
|
+
icon?: "search" | "arrow" | "external" | "signout" | "print" | "download" | "tick" | null | undefined;
|
|
38
38
|
iconPosition?: "before" | "after" | undefined;
|
|
39
39
|
disabled?: boolean | undefined;
|
|
40
40
|
hideLabel?: boolean | undefined;
|