@onsvisual/svelte-components 0.1.36 → 0.1.37
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.
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TabsSlots */
|
|
4
4
|
export default class Tabs extends SvelteComponentTyped<{
|
|
5
5
|
compact?: boolean;
|
|
6
|
+
border?: boolean;
|
|
6
7
|
}, {
|
|
7
8
|
[evt: string]: CustomEvent<any>;
|
|
8
9
|
}, {
|
|
@@ -16,6 +17,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
16
17
|
declare const __propDef: {
|
|
17
18
|
props: {
|
|
18
19
|
compact?: boolean;
|
|
20
|
+
border?: boolean;
|
|
19
21
|
};
|
|
20
22
|
events: {
|
|
21
23
|
[evt: string]: CustomEvent<any>;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
const sections = getContext("sections");
|
|
22
22
|
const selected = getContext("selected");
|
|
23
|
+
const border = getContext("border");
|
|
23
24
|
|
|
24
25
|
let el;
|
|
25
26
|
|
|
@@ -42,7 +43,17 @@
|
|
|
42
43
|
class="ons-tabs__panel"
|
|
43
44
|
bind:this="{el}"
|
|
44
45
|
class:ons-tabs__panel--hidden="{$selected !== id}"
|
|
46
|
+
class:tab-border="{border}"
|
|
45
47
|
>
|
|
46
48
|
<h2 id="{id}-content-title" class="ons-u-vh" class:ons-u-vh="{hideTitle}">{title}</h2>
|
|
47
49
|
<slot />
|
|
48
50
|
</section>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
section.tab-border {
|
|
54
|
+
border: 1px solid var(--ons-color-borders);
|
|
55
|
+
border-radius: 4px;
|
|
56
|
+
border-top-left-radius: 0;
|
|
57
|
+
padding-left: 12px;
|
|
58
|
+
padding-right: 12px;
|
|
59
|
+
}</style>
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* Make tabs smaller/more compact
|
|
7
7
|
*/
|
|
8
8
|
export let compact = false;
|
|
9
|
+
/**
|
|
10
|
+
* Include a border around the tab panel
|
|
11
|
+
* @type {boolean}
|
|
12
|
+
*/
|
|
13
|
+
export let border = false;
|
|
9
14
|
|
|
10
15
|
const sections = writable([]);
|
|
11
16
|
setContext("sections", sections);
|
|
@@ -13,6 +18,8 @@
|
|
|
13
18
|
const selected = writable(null);
|
|
14
19
|
setContext("selected", selected);
|
|
15
20
|
|
|
21
|
+
setContext("border", border);
|
|
22
|
+
|
|
16
23
|
function showSection(id) {
|
|
17
24
|
$selected = id;
|
|
18
25
|
[...$sections].forEach(
|
|
@@ -25,7 +32,7 @@
|
|
|
25
32
|
|
|
26
33
|
<section class="ons-tabs">
|
|
27
34
|
<h2 class="ons-tabs__title ons-u-fs-r--b ons-u-mt-no ons-u-vh">Contents</h2>
|
|
28
|
-
<div class="ons-tabs__container">
|
|
35
|
+
<div class="ons-tabs__container" class:tabs-no-border="{border}">
|
|
29
36
|
<ul class="ons-tabs__list ons-tabs__list--row" role="tablist">
|
|
30
37
|
{#each $sections as section}
|
|
31
38
|
<li
|
|
@@ -82,4 +89,7 @@
|
|
|
82
89
|
}
|
|
83
90
|
.ons-tab[aria-selected="true"]:not(:focus) {
|
|
84
91
|
background-color: var(--background, white);
|
|
92
|
+
}
|
|
93
|
+
.tabs-no-border {
|
|
94
|
+
border: none;
|
|
85
95
|
}</style>
|