@onsvisual/svelte-components 0.1.30 → 0.1.32
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.
|
@@ -8,6 +8,7 @@ export default class Theme extends SvelteComponentTyped<{
|
|
|
8
8
|
theme?: "light" | "dark" | "lightblue";
|
|
9
9
|
overrides?: any;
|
|
10
10
|
background?: string;
|
|
11
|
+
allowClientOverride?: boolean;
|
|
11
12
|
}, {
|
|
12
13
|
[evt: string]: CustomEvent<any>;
|
|
13
14
|
}, {
|
|
@@ -26,6 +27,7 @@ declare const __propDef: {
|
|
|
26
27
|
theme?: "light" | "dark" | "lightblue";
|
|
27
28
|
overrides?: object;
|
|
28
29
|
background?: string;
|
|
30
|
+
allowClientOverride?: boolean;
|
|
29
31
|
};
|
|
30
32
|
events: {
|
|
31
33
|
[evt: string]: CustomEvent<any>;
|
|
@@ -53,6 +53,14 @@
|
|
|
53
53
|
* @type {boolean}
|
|
54
54
|
*/
|
|
55
55
|
export let compact = false;
|
|
56
|
+
|
|
57
|
+
function doChange(e) {
|
|
58
|
+
if (Array.isArray(group)) {
|
|
59
|
+
if (checked) group = [...group, value];
|
|
60
|
+
else group = group.filter((d) => d != value);
|
|
61
|
+
}
|
|
62
|
+
dispatch("change", e);
|
|
63
|
+
}
|
|
56
64
|
</script>
|
|
57
65
|
|
|
58
66
|
<span
|
|
@@ -61,31 +69,17 @@
|
|
|
61
69
|
class:ons-checkboxes__item--no-border="{compact}"
|
|
62
70
|
>
|
|
63
71
|
<span class="ons-checkbox" class:ons-checkbox--no-border="{compact}">
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/>
|
|
76
|
-
{:else}
|
|
77
|
-
<input
|
|
78
|
-
type="checkbox"
|
|
79
|
-
id="{id}"
|
|
80
|
-
name="{name}"
|
|
81
|
-
value="{value}"
|
|
82
|
-
bind:checked="{checked}"
|
|
83
|
-
class="ons-checkbox__input ons-js-checkbox"
|
|
84
|
-
disabled="{disabled}"
|
|
85
|
-
aria-disabled="{disabled}"
|
|
86
|
-
on:change="{(e) => dispatch('change', e)}"
|
|
87
|
-
/>
|
|
88
|
-
{/if}
|
|
72
|
+
<input
|
|
73
|
+
type="checkbox"
|
|
74
|
+
id="{id}"
|
|
75
|
+
name="{name}"
|
|
76
|
+
value="{value}"
|
|
77
|
+
bind:checked="{checked}"
|
|
78
|
+
class="ons-checkbox__input ons-js-checkbox"
|
|
79
|
+
disabled="{disabled}"
|
|
80
|
+
aria-disabled="{disabled}"
|
|
81
|
+
on:change="{doChange}"
|
|
82
|
+
/>
|
|
89
83
|
<label
|
|
90
84
|
class="ons-checkbox__label"
|
|
91
85
|
class:ons-label--with-description="{description}"
|
|
@@ -31,6 +31,11 @@
|
|
|
31
31
|
* @type {string}
|
|
32
32
|
*/
|
|
33
33
|
export let background = null;
|
|
34
|
+
/**
|
|
35
|
+
* Allows client imported CSS for embeddable content
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export let allowClientOverride = false;
|
|
34
39
|
|
|
35
40
|
function makeStyle(theme, overrides, background) {
|
|
36
41
|
if (theme) {
|
|
@@ -41,7 +46,7 @@
|
|
|
41
46
|
.map((key) => `--${key}: ${_theme[key]};`)
|
|
42
47
|
.join("");
|
|
43
48
|
} else if (background) {
|
|
44
|
-
return `--background:${background}
|
|
49
|
+
return `--background:${background};`;
|
|
45
50
|
}
|
|
46
51
|
return null;
|
|
47
52
|
}
|
|
@@ -56,8 +61,22 @@
|
|
|
56
61
|
</svelte:head>
|
|
57
62
|
|
|
58
63
|
{#if style && !global}
|
|
59
|
-
<div
|
|
60
|
-
|
|
64
|
+
<div
|
|
65
|
+
id="{id}"
|
|
66
|
+
class="{cls ? `theme-wrapper ${cls}` : 'theme-wrapper'}"
|
|
67
|
+
style="{style} display: contents"
|
|
68
|
+
>
|
|
69
|
+
{#if allowClientOverride}
|
|
70
|
+
<div class="client-css-override" style:display="contents">
|
|
71
|
+
<div class="theme-internal">
|
|
72
|
+
<slot />
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{:else}
|
|
76
|
+
<div class="theme-internal">
|
|
77
|
+
<slot />
|
|
78
|
+
</div>
|
|
79
|
+
{/if}
|
|
61
80
|
</div>
|
|
62
81
|
{:else}
|
|
63
82
|
<slot />
|
|
@@ -65,9 +84,6 @@
|
|
|
65
84
|
|
|
66
85
|
<style>
|
|
67
86
|
.theme-wrapper {
|
|
68
|
-
position: relative;
|
|
69
|
-
color: var(--text, #222);
|
|
70
|
-
background: var(--background, none);
|
|
71
87
|
--ons-color-text: var(--text, --ons-color-text);
|
|
72
88
|
--ons-color-text-light: var(--muted, --ons-color-text-light);
|
|
73
89
|
--ons-color-borders: var(--muted, --ons-color-borders);
|
|
@@ -89,4 +105,9 @@
|
|
|
89
105
|
background: none;
|
|
90
106
|
border-color: var(--text, #222);
|
|
91
107
|
color: var(--text, #222);
|
|
108
|
+
}
|
|
109
|
+
.theme-internal {
|
|
110
|
+
position: relative;
|
|
111
|
+
color: var(--text, #222);
|
|
112
|
+
background: var(--background, none);
|
|
92
113
|
}</style>
|