@onsvisual/svelte-components 0.1.60 → 0.1.62
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/@types/layout/Cards/Card.svelte.d.ts +4 -0
- package/dist/layout/Cards/Card.svelte +30 -20
- package/dist/layout/NavSections/NavSection.svelte +9 -2
- package/dist/layout/NavSections/NavSections.svelte +4 -1
- package/dist/layout/Tabs/Tab.svelte +4 -2
- package/dist/layout/Tabs/Tabs.svelte +1 -2
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ export default class Card extends SvelteComponentTyped<{
|
|
|
15
15
|
}, {
|
|
16
16
|
[evt: string]: CustomEvent<any>;
|
|
17
17
|
}, {
|
|
18
|
+
image: {};
|
|
19
|
+
title: {};
|
|
18
20
|
default: {};
|
|
19
21
|
}> {
|
|
20
22
|
}
|
|
@@ -39,6 +41,8 @@ declare const __propDef: {
|
|
|
39
41
|
[evt: string]: CustomEvent<any>;
|
|
40
42
|
};
|
|
41
43
|
slots: {
|
|
44
|
+
image: {};
|
|
45
|
+
title: {};
|
|
42
46
|
default: {};
|
|
43
47
|
};
|
|
44
48
|
};
|
|
@@ -31,31 +31,41 @@
|
|
|
31
31
|
<div id="{id}" class="ons-card" aria-describedBy="{id}_text">
|
|
32
32
|
{#if href && title}
|
|
33
33
|
<a href="{href}" class="ons-card__link ons-u-db" class:ons-u-vh="{hideTitle}">
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
<slot name="image">
|
|
35
|
+
{#if image}
|
|
36
|
+
<img
|
|
37
|
+
class="ons-card__image ons-u-mb-s"
|
|
38
|
+
style:width="100%"
|
|
39
|
+
src="{image}"
|
|
40
|
+
alt="{imageAlt}"
|
|
41
|
+
loading="lazy"
|
|
42
|
+
/>
|
|
43
|
+
{/if}
|
|
44
|
+
</slot>
|
|
45
|
+
<slot name="title">
|
|
46
|
+
<h3
|
|
47
|
+
class="ons-card__title ons-u-fs-m"
|
|
48
|
+
style:padding="{!noBackground && !image
|
|
49
|
+
? "12px 16px 0"
|
|
50
|
+
: !noBackground
|
|
51
|
+
? "0 16px"
|
|
52
|
+
: ""}"
|
|
53
|
+
>
|
|
54
|
+
{title}
|
|
55
|
+
</h3>
|
|
56
|
+
</slot>
|
|
57
|
+
</a>
|
|
58
|
+
{:else if title}
|
|
59
|
+
<slot name="title">
|
|
43
60
|
<h3
|
|
44
61
|
class="ons-card__title ons-u-fs-m"
|
|
45
|
-
|
|
62
|
+
class:ons-u-vh="{hideTitle}"
|
|
63
|
+
style:padding="{!noBackground ? "8px 16px 0" : ""}"
|
|
64
|
+
style:margin-bottom="5px"
|
|
46
65
|
>
|
|
47
66
|
{title}
|
|
48
67
|
</h3>
|
|
49
|
-
</
|
|
50
|
-
{:else if title}
|
|
51
|
-
<h3
|
|
52
|
-
class="ons-card__title ons-u-fs-m"
|
|
53
|
-
class:ons-u-vh="{hideTitle}"
|
|
54
|
-
style:padding="{!noBackground ? "8px 16px 0" : ""}"
|
|
55
|
-
style:margin-bottom="5px"
|
|
56
|
-
>
|
|
57
|
-
{title}
|
|
58
|
-
</h3>
|
|
68
|
+
</slot>
|
|
59
69
|
{/if}
|
|
60
70
|
<div id="{id}_text" class:tile__body="{!noBackground}">
|
|
61
71
|
<slot />
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
onMount(() => {
|
|
39
39
|
if (sections && observer) {
|
|
40
|
-
$sections = [
|
|
40
|
+
$sections = [...section.parentElement.childNodes].filter((c) => c.tagName === "SECTION");
|
|
41
41
|
$observer.observe(section);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -50,7 +50,14 @@
|
|
|
50
50
|
});
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
<section
|
|
53
|
+
<section
|
|
54
|
+
id="{id}"
|
|
55
|
+
title="{title}"
|
|
56
|
+
data-subsection="{subsection}"
|
|
57
|
+
class="{cls}"
|
|
58
|
+
aria-label="{title}"
|
|
59
|
+
bind:this="{section}"
|
|
60
|
+
>
|
|
54
61
|
{#if title}
|
|
55
62
|
{#if subsection}
|
|
56
63
|
<h3 class="subsection-title ons-u-fs-m" class:ons-u-vh="{hideTitle}">{title}</h3>
|
|
@@ -114,7 +114,10 @@
|
|
|
114
114
|
{/if}
|
|
115
115
|
<ol class="ons-list ons-u-mb-m ons-list--dashed">
|
|
116
116
|
{#each $sections as section}
|
|
117
|
-
<li
|
|
117
|
+
<li
|
|
118
|
+
class="ons-list__item"
|
|
119
|
+
class:ons-list__item-indented="{section.dataset.subsection === 'true'}"
|
|
120
|
+
>
|
|
118
121
|
<a
|
|
119
122
|
href="#{section.id}"
|
|
120
123
|
class="ons-list__link"
|
|
@@ -25,20 +25,22 @@
|
|
|
25
25
|
|
|
26
26
|
onMount(() => {
|
|
27
27
|
if (sections) {
|
|
28
|
-
|
|
29
|
-
$
|
|
28
|
+
$sections = [...el.parentElement.childNodes].filter((c) => c.tagName === "SECTION");
|
|
29
|
+
if ($selected === null || $selected === undefined) $selected = $sections[0]?.id;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
onDestroy(() => {
|
|
34
34
|
if (sections) {
|
|
35
35
|
$sections = $sections.filter((s) => s.id !== id);
|
|
36
|
+
if ($selected === id) $selected = $sections.length > 0 ? $sections[0].id : null;
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
</script>
|
|
39
40
|
|
|
40
41
|
<section
|
|
41
42
|
id="{id}"
|
|
43
|
+
title="{title}"
|
|
42
44
|
class="ons-tabs__panel"
|
|
43
45
|
bind:this="{el}"
|
|
44
46
|
class:ons-tabs__panel--hidden="{$selected !== id}"
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
$_selected = id;
|
|
30
30
|
[...$sections].forEach(
|
|
31
31
|
(s) =>
|
|
32
|
-
(s.
|
|
33
|
-
s.id === id ? "ons-tabs__panel" : "ons-tabs__panel ons-tabs__panel--hidden")
|
|
32
|
+
(s.className = s.id === id ? "ons-tabs__panel" : "ons-tabs__panel ons-tabs__panel--hidden")
|
|
34
33
|
);
|
|
35
34
|
dispatch("change", { id });
|
|
36
35
|
}
|