Skip to content

Commit 99eeb88

Browse files
committed
v1.14.0
fix: #1769
1 parent ecd061c commit 99eeb88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+197
-103
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.14.0
4+
5+
### Minor Changes
6+
7+
- feat(Tabs): add selected and key
8+
39
## 1.13.16
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flowbite-svelte",
3-
"version": "1.13.16",
3+
"version": "1.14.0",
44
"description": "Flowbite components for Svelte",
55
"main": "dist/index.js",
66
"author": {

src/lib/tabs/TabItem.svelte

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
const theme = getTheme("tabItem");
1212
const activeClasses = getContext<string>("activeClasses");
1313
const ctx: TabCtxType = getContext("ctx");
14-
14+
1515
const compoTabStyle = $derived(tabStyle ?? ctx.tabStyle ?? "full");
1616
const { active, inactive } = $derived(tabs({ tabStyle: compoTabStyle, hasDivider: true }));
1717
1818
const tabId = $props.id();
19-
const tabIdentifier = key ?? tabId;
19+
const tabIdentifier = key ?? tabId;
2020
const self: SelectedTab = { id: tabIdentifier, snippet: children };
2121
2222
const registerTab = getContext<(tab: SelectedTab) => void>("registerTab");
@@ -27,32 +27,28 @@
2727
$effect(() => {
2828
updateSingleSelection(open, self);
2929
registerTab?.(self);
30-
30+
3131
return () => {
3232
if (self.id) {
3333
unregisterTab?.(self.id);
3434
}
35-
};
35+
};
3636
});
3737
3838
const { base, button } = $derived(tabItem({ open, disabled }));
3939
</script>
4040

4141
<li {...restProps} class={base({ class: clsx(theme?.base, className) })} role="presentation">
42-
<button
43-
type="button"
44-
onclick={() => (open = true)}
45-
role="tab"
46-
id={self.id}
47-
aria-controls={ctx.panelId}
48-
aria-selected={open}
49-
{disabled}
50-
class={button({
51-
class: clsx(
52-
open ? (activeClass ?? active({ class: activeClasses })) : (inactiveClass ?? inactive()),
53-
theme?.button,
54-
classes?.button
55-
)
42+
<button
43+
type="button"
44+
onclick={() => (open = true)}
45+
role="tab"
46+
id={self.id}
47+
aria-controls={ctx.panelId}
48+
aria-selected={open}
49+
{disabled}
50+
class={button({
51+
class: clsx(open ? (activeClass ?? active({ class: activeClasses })) : (inactiveClass ?? inactive()), theme?.button, classes?.button)
5652
})}
5753
>
5854
{#if titleSlot}
@@ -61,4 +57,24 @@
6157
{title}
6258
{/if}
6359
</button>
64-
</li>
60+
</li>
61+
62+
<!--
63+
@component
64+
[Go to docs](https://flowbite-svelte.com/)
65+
## Type
66+
[TabitemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1730)
67+
## Props
68+
@prop children
69+
@prop titleSlot
70+
@prop open = $bindable(false)
71+
@prop title = "Tab title"
72+
@prop key
73+
@prop activeClass
74+
@prop inactiveClass
75+
@prop class: className
76+
@prop classes
77+
@prop disabled
78+
@prop tabStyle
79+
@prop ...restProps
80+
-->

src/lib/tabs/Tabs.svelte

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
1515
warnThemeDeprecation("Tabs", { ulClass, contentClass }, { ulClass: "class", contentClass: "content" });
16-
16+
1717
const theme = getTheme("tabs");
1818
const styling = $derived(classes ?? { content: contentClass });
1919
const { base, content, divider: dividerClass } = $derived(tabs({ tabStyle, hasDivider: divider }));
@@ -28,7 +28,7 @@
2828
2929
const tabRegistry = $state(new Map<string, SelectedTab>());
3030
let selectedTab: SelectedTab = $state({});
31-
31+
3232
const updateSelection = useSingleSelection<SelectedTab>((v) => {
3333
selectedTab = v ?? {};
3434
selected = v?.id;
@@ -74,4 +74,21 @@
7474

7575
<div id={panelId} class={content({ class: clsx(theme?.content, styling.content) })} role="tabpanel" aria-labelledby={selectedTab.id}>
7676
{@render selectedTab.snippet?.()}
77-
</div>
77+
</div>
78+
79+
<!--
80+
@component
81+
[Go to docs](https://flowbite-svelte.com/)
82+
## Type
83+
[TabsProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1721)
84+
## Props
85+
@prop children
86+
@prop selected = $bindable()
87+
@prop tabStyle = "none"
88+
@prop ulClass
89+
@prop contentClass
90+
@prop divider = true
91+
@prop class: className
92+
@prop classes
93+
@prop ...restProps
94+
-->

src/lib/timeline/Activity.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@component
1818
[Go to docs](https://flowbite-svelte.com/)
1919
## Type
20-
[ActivityProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1765)
20+
[ActivityProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1767)
2121
## Props
2222
@prop children
2323
@prop class: className

src/lib/timeline/ActivityItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
@component
6363
[Go to docs](https://flowbite-svelte.com/)
6464
## Type
65-
[ActivityItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1769)
65+
[ActivityItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1771)
6666
## Props
6767
@prop activities
6868
@prop liClass

src/lib/timeline/Group.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@component
3737
[Go to docs](https://flowbite-svelte.com/)
3838
## Type
39-
[GroupProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1781)
39+
[GroupProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1783)
4040
## Props
4141
@prop children
4242
@prop divClass

src/lib/timeline/GroupItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
@component
6767
[Go to docs](https://flowbite-svelte.com/)
6868
## Type
69-
[GroupItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1789)
69+
[GroupItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1791)
7070
## Props
7171
@prop timelines
7272
@prop aClass

src/lib/timeline/Timeline.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@component
2222
[Go to docs](https://flowbite-svelte.com/)
2323
## Type
24-
[TimelineProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1809)
24+
[TimelineProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1811)
2525
## Props
2626
@prop children
2727
@prop order = "default"

src/lib/timeline/TimelineItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
@component
9898
[Go to docs](https://flowbite-svelte.com/)
9999
## Type
100-
[TimelineItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1814)
100+
[TimelineItemProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L1816)
101101
## Props
102102
@prop children
103103
@prop orientationSlot

0 commit comments

Comments
 (0)