@softwareone/spi-sv5-library 1.6.0 → 1.6.1

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.
@@ -7,12 +7,14 @@
7
7
  tabs: Tab[];
8
8
  activeTab?: number;
9
9
  children?: Snippet;
10
+ onchange?: (index: number) => void;
10
11
  }
11
12
 
12
- let { tabs = [], activeTab = 0, children }: TabsProps = $props();
13
+ let { tabs = [], activeTab = 0, children, onchange }: TabsProps = $props();
13
14
 
14
15
  const handleClick = (index: number) => (): void => {
15
16
  activeTab = index;
17
+ onchange?.(index);
16
18
  };
17
19
  </script>
18
20
 
@@ -39,18 +41,18 @@
39
41
 
40
42
  {#each tabs as tab}
41
43
  {#if activeTab === tab.index}
42
- {#if tab.component}
43
- <div
44
- class="tabs-content"
45
- id="panel-{tab.index}"
46
- role="tabpanel"
47
- aria-labelledby="tab-{tab.index}"
48
- >
44
+ <div
45
+ class="tabs-content"
46
+ id="panel-{tab.index}"
47
+ role="tabpanel"
48
+ aria-labelledby="tab-{tab.index}"
49
+ >
50
+ {#if tab.component}
49
51
  {@render tab.component()}
50
- </div>
51
- {:else}
52
- {@render children?.()}
53
- {/if}
52
+ {:else}
53
+ {@render children?.()}
54
+ {/if}
55
+ </div>
54
56
  {/if}
55
57
  {/each}
56
58
  </div>
@@ -4,6 +4,7 @@ interface TabsProps {
4
4
  tabs: Tab[];
5
5
  activeTab?: number;
6
6
  children?: Snippet;
7
+ onchange?: (index: number) => void;
7
8
  }
8
9
  declare const Tabs: import("svelte").Component<TabsProps, {}, "">;
9
10
  type Tabs = ReturnType<typeof Tabs>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwareone/spi-sv5-library",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Svelte components",
5
5
  "keywords": [
6
6
  "svelte",