flowbite-svelte 0.12.0 → 0.12.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.
package/README.md CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  [Cards](https://flowbite-svelte.vercel.app/cards)
36
36
 
37
- ## Dark mode component
37
+ ## Dark mode components
38
38
 
39
39
  [Dark mode](https://flowbite-svelte.vercel.app/darkmode)
40
40
 
@@ -46,15 +46,15 @@
46
46
 
47
47
  [Forms](https://flowbite-svelte.vercel.app/forms)
48
48
 
49
- ## Footer
49
+ ## Footer components
50
50
 
51
51
  [Footer](https://flowbite-svelte.vercel.app/footer)
52
52
 
53
- ## Icons
53
+ ## Icons components
54
54
 
55
55
  [Icons](https://flowbite-svelte.vercel.app/icons)
56
56
 
57
- ## List group component
57
+ ## List group components
58
58
 
59
59
  [List group](https://flowbite-svelte.vercel.app/list-group)
60
60
 
@@ -66,6 +66,10 @@
66
66
 
67
67
  [Navbars](https://flowbite-svelte.vercel.app/navbar)
68
68
 
69
+ ## Pagination components
70
+
71
+ [Pagination](https://flowbite-svelte.vercel.app/paginations)
72
+
69
73
  ## Sidebar components
70
74
 
71
75
  [Sidebar](https://flowbite-svelte.vercel.app/sidebars)
@@ -78,6 +82,10 @@
78
82
 
79
83
  [Tabs](https://flowbite-svelte.vercel.app/tabs)
80
84
 
85
+ ## Timeline components
86
+
87
+ [Timeline](https://flowbite-svelte.vercel.app/timelines)
88
+
81
89
  ## Toast components
82
90
 
83
91
  [Toast](https://flowbite-svelte.vercel.app/toasts)
package/index.d.ts CHANGED
@@ -59,9 +59,11 @@ export { default as TableData } from "./paginations/TableData.svelte";
59
59
  export { default as Sidebar } from "./sidebars/Sidebar.svelte";
60
60
  export { default as Spinner } from "./spinners/Spinner.svelte";
61
61
  export { default as SpinnerButton } from "./spinners/SpinnerButton.svelte";
62
+ export { default as InteractiveTabHead } from "./tabs/InteractiveTabHead.svelte";
62
63
  export { default as InteractiveTabs } from "./tabs/InteractiveTabs.svelte";
63
64
  export { default as DefaultTabs } from "./tabs/DefaultTabs.svelte";
64
65
  export { default as PillTabs } from "./tabs/PillTabs.svelte";
66
+ export { default as TabContent } from "./tabs/TabContent.svelte";
65
67
  export { default as Group } from "./timelines/Group.svelte";
66
68
  export { default as GroupItem } from "./timelines/GroupItem.svelte";
67
69
  export { default as Activity } from "./timelines/Activity.svelte";
package/index.js CHANGED
@@ -96,9 +96,11 @@ export { default as Spinner } from'./spinners/Spinner.svelte'
96
96
  export { default as SpinnerButton } from'./spinners/SpinnerButton.svelte'
97
97
 
98
98
  // Tabs
99
+ export { default as InteractiveTabHead } from './tabs/InteractiveTabHead.svelte'
99
100
  export { default as InteractiveTabs } from'./tabs/InteractiveTabs.svelte'
100
101
  export { default as DefaultTabs } from'./tabs/DefaultTabs.svelte'
101
102
  export { default as PillTabs } from './tabs/PillTabs.svelte'
103
+ export { default as TabContent } from './tabs/TabContent.svelte'
102
104
 
103
105
  // Timeline
104
106
  export { default as Group } from './timelines/Group.svelte'
@@ -7,10 +7,10 @@ export let textColor = 'gray';
7
7
  export let title = 'Terms of Service';
8
8
  export let btn1;
9
9
  export let btn2;
10
- const closeModal = () => {
10
+ export const closeModal = () => {
11
11
  modalIdStore.update((value) => (value = null));
12
12
  };
13
- export let showModalId;
13
+ let showModalId;
14
14
  modalIdStore.subscribe((value) => {
15
15
  showModalId = value;
16
16
  });
@@ -8,7 +8,7 @@ declare const __propDef: {
8
8
  title?: string;
9
9
  btn1: string;
10
10
  btn2: string;
11
- showModalId: string;
11
+ closeModal?: () => void;
12
12
  };
13
13
  events: {
14
14
  handlebtn1: CustomEvent<any>;
@@ -24,5 +24,6 @@ export declare type ExtraLargeModalProps = typeof __propDef.props;
24
24
  export declare type ExtraLargeModalEvents = typeof __propDef.events;
25
25
  export declare type ExtraLargeModalSlots = typeof __propDef.slots;
26
26
  export default class ExtraLargeModal extends SvelteComponentTyped<ExtraLargeModalProps, ExtraLargeModalEvents, ExtraLargeModalSlots> {
27
+ get closeModal(): () => void;
27
28
  }
28
29
  export {};
@@ -7,10 +7,10 @@ export let textColor = 'gray';
7
7
  export let title = 'Terms of Service';
8
8
  export let btn1;
9
9
  export let btn2;
10
- const closeModal = () => {
10
+ export const closeModal = () => {
11
11
  modalIdStore.update((value) => (value = null));
12
12
  };
13
- export let showModalId;
13
+ let showModalId;
14
14
  modalIdStore.subscribe((value) => {
15
15
  showModalId = value;
16
16
  });
@@ -8,7 +8,7 @@ declare const __propDef: {
8
8
  title?: string;
9
9
  btn1: string;
10
10
  btn2: string;
11
- showModalId: string;
11
+ closeModal?: () => void;
12
12
  };
13
13
  events: {
14
14
  handlebtn1: CustomEvent<any>;
@@ -24,5 +24,6 @@ export declare type LargeModalProps = typeof __propDef.props;
24
24
  export declare type LargeModalEvents = typeof __propDef.events;
25
25
  export declare type LargeModalSlots = typeof __propDef.slots;
26
26
  export default class LargeModal extends SvelteComponentTyped<LargeModalProps, LargeModalEvents, LargeModalSlots> {
27
+ get closeModal(): () => void;
27
28
  }
28
29
  export {};
@@ -8,10 +8,10 @@ export let textColor = 'gray';
8
8
  export let title = 'Terms of Service';
9
9
  export let btn1;
10
10
  export let btn2;
11
- const closeModal = () => {
11
+ export const closeModal = () => {
12
12
  modalIdStore.update((value) => (value = null));
13
13
  };
14
- export let showModalId;
14
+ let showModalId;
15
15
  modalIdStore.subscribe((value) => {
16
16
  showModalId = value;
17
17
  });
@@ -8,7 +8,7 @@ declare const __propDef: {
8
8
  title?: string;
9
9
  btn1: string;
10
10
  btn2: string;
11
- showModalId: string;
11
+ closeModal?: () => void;
12
12
  };
13
13
  events: {
14
14
  handlebtn1: CustomEvent<any>;
@@ -24,5 +24,6 @@ export declare type MediumModalProps = typeof __propDef.props;
24
24
  export declare type MediumModalEvents = typeof __propDef.events;
25
25
  export declare type MediumModalSlots = typeof __propDef.slots;
26
26
  export default class MediumModal extends SvelteComponentTyped<MediumModalProps, MediumModalEvents, MediumModalSlots> {
27
+ get closeModal(): () => void;
27
28
  }
28
29
  export {};
@@ -7,10 +7,10 @@ export let rememberMe = false;
7
7
  export let signUp;
8
8
  export let action;
9
9
  export let emailPlaceholder = 'name@company.com';
10
- const closeModal = () => {
10
+ export const closeModal = () => {
11
11
  modalIdStore.update((value) => (value = null));
12
12
  };
13
- export let showModalId;
13
+ let showModalId;
14
14
  modalIdStore.subscribe((value) => {
15
15
  showModalId = value;
16
16
  });
@@ -10,7 +10,7 @@ declare const __propDef: {
10
10
  signUp: string;
11
11
  action: string;
12
12
  emailPlaceholder?: string;
13
- showModalId: string;
13
+ closeModal?: () => void;
14
14
  };
15
15
  events: {
16
16
  [evt: string]: CustomEvent<any>;
@@ -21,5 +21,6 @@ export declare type SignInModalProps = typeof __propDef.props;
21
21
  export declare type SignInModalEvents = typeof __propDef.events;
22
22
  export declare type SignInModalSlots = typeof __propDef.slots;
23
23
  export default class SignInModal extends SvelteComponentTyped<SignInModalProps, SignInModalEvents, SignInModalSlots> {
24
+ get closeModal(): () => void;
24
25
  }
25
26
  export {};
@@ -7,10 +7,10 @@ export let textColor = 'gray';
7
7
  export let title = 'Terms of Service';
8
8
  export let btn1;
9
9
  export let btn2;
10
- const closeModal = () => {
10
+ export const closeModal = () => {
11
11
  modalIdStore.update((value) => (value = null));
12
12
  };
13
- export let showModalId;
13
+ let showModalId;
14
14
  modalIdStore.subscribe((value) => {
15
15
  showModalId = value;
16
16
  });
@@ -8,7 +8,7 @@ declare const __propDef: {
8
8
  title?: string;
9
9
  btn1: string;
10
10
  btn2: string;
11
- showModalId: string;
11
+ closeModal?: () => void;
12
12
  };
13
13
  events: {
14
14
  handlebtn1: CustomEvent<any>;
@@ -24,5 +24,6 @@ export declare type SmallModalProps = typeof __propDef.props;
24
24
  export declare type SmallModalEvents = typeof __propDef.events;
25
25
  export declare type SmallModalSlots = typeof __propDef.slots;
26
26
  export default class SmallModal extends SvelteComponentTyped<SmallModalProps, SmallModalEvents, SmallModalSlots> {
27
+ get closeModal(): () => void;
27
28
  }
28
29
  export {};
@@ -1,12 +1,5 @@
1
1
  <script >import { page, session } from '$app/stores';
2
- let hidden = true;
3
- let block = false;
4
- let activeDropdown = undefined;
5
- const handleDropdown = (id) => {
6
- hidden = !hidden;
7
- block = !block;
8
- activeDropdown = id;
9
- };
2
+ import NavDropdown from './NavDropdown.svelte';
10
3
  let barHidden = true;
11
4
  const handleClickbtn = () => {
12
5
  barHidden = !barHidden;
@@ -65,41 +58,16 @@ export let liButtonClass = `flex justify-between items-center py-2 pr-4 pl-3 w-f
65
58
  </button>
66
59
  <div class="w-full md:block md:w-auto" class:hidden={barHidden} id="mobile-menu">
67
60
  <ul class="flex flex-col mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium">
68
- {#each menus as { id, name, href, rel, child }}
61
+ {#each menus as { name, href, rel, child }}
69
62
  {#if child}
70
- <li>
71
- <button on:click={() => handleDropdown(id)} class={liButtonClass}
72
- >{name}
73
- <svg
74
- class="ml-1 w-4 h-4"
75
- fill="currentColor"
76
- viewBox="0 0 20 20"
77
- xmlns="http://www.w3.org/2000/svg"
78
- ><path
79
- fill-rule="evenodd"
80
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
81
- clip-rule="evenodd"
82
- /></svg
83
- ></button
84
- >
85
- {#if activeDropdown === id}
86
- <!-- Dropdown menu -->
87
- <div
88
- class:hidden
89
- class:block
90
- class={dropdownDiv}
91
- style="position: absolute; margin: 0px;"
92
- >
93
- <ul class="py-1" aria-labelledby="dropdownLargeButton">
94
- {#each child as item}
95
- <li>
96
- <a href={item.href} {rel} class={dropdownLinkClassWithChild}>{item.name}</a>
97
- </li>
98
- {/each}
99
- </ul>
100
- </div>
101
- {/if}
102
- </li>
63
+ <NavDropdown
64
+ {liButtonClass}
65
+ {dropdownDiv}
66
+ {name}
67
+ {child}
68
+ {rel}
69
+ {dropdownLinkClassWithChild}
70
+ />
103
71
  {:else}
104
72
  <li>
105
73
  <a
@@ -0,0 +1,41 @@
1
+ <script >export let liButtonClass;
2
+ export let name;
3
+ let hidden = true;
4
+ let block = false;
5
+ export let child;
6
+ const handleDropdown = () => {
7
+ hidden = !hidden;
8
+ block = !block;
9
+ };
10
+ export let dropdownDiv;
11
+ export let dropdownLinkClassWithChild;
12
+ export let rel;
13
+ </script>
14
+
15
+ <li>
16
+ <button on:click={() => handleDropdown()} class={liButtonClass}
17
+ >{name}
18
+ <svg
19
+ class="ml-1 w-4 h-4"
20
+ fill="currentColor"
21
+ viewBox="0 0 20 20"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ ><path
24
+ fill-rule="evenodd"
25
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
26
+ clip-rule="evenodd"
27
+ /></svg
28
+ ></button
29
+ >
30
+
31
+ <!-- Dropdown menu -->
32
+ <div class:hidden class:block class={dropdownDiv} style="position: absolute; margin: 0px;">
33
+ <ul class="py-1" aria-labelledby="dropdownLargeButton">
34
+ {#each child as item}
35
+ <li>
36
+ <a href={item.href} {rel} class={dropdownLinkClassWithChild}>{item.name}</a>
37
+ </li>
38
+ {/each}
39
+ </ul>
40
+ </div>
41
+ </li>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { NavbarType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ liButtonClass: string;
6
+ name: string;
7
+ child: NavbarType[];
8
+ dropdownDiv: string;
9
+ dropdownLinkClassWithChild: string;
10
+ rel: string;
11
+ };
12
+ events: {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {};
16
+ };
17
+ export declare type NavDropdownProps = typeof __propDef.props;
18
+ export declare type NavDropdownEvents = typeof __propDef.events;
19
+ export declare type NavDropdownSlots = typeof __propDef.slots;
20
+ export default class NavDropdown extends SvelteComponentTyped<NavDropdownProps, NavDropdownEvents, NavDropdownSlots> {
21
+ }
22
+ export {};
@@ -1,5 +1,5 @@
1
1
  <script >import { page, session } from '$app/stores';
2
- export let sitename = 'Svelte Flow';
2
+ export let name = 'Svelte Flow';
3
3
  export let logo = '/images/mkdir-logo.png';
4
4
  export let alt = 'Svelte Flow';
5
5
  export let textsize = 'text-sm';
@@ -19,7 +19,7 @@ export let liLinkClass = `block py-2 pr-4 pl-3 text-gray-700 border-b border-gr
19
19
  <div class={navDivClass}>
20
20
  <a href="/" class="flex">
21
21
  <img src={logo} {alt} />
22
- <span class={spanClass}>{sitename}</span>
22
+ <span class={spanClass}>{name}</span>
23
23
  </a>
24
24
  <button
25
25
  on:click={handleClickbtn}
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { LinkType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
- sitename?: string;
5
+ name?: string;
6
6
  logo?: string;
7
7
  alt?: string;
8
8
  textsize?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "./package/index.js",
6
6
  "author": {
@@ -125,18 +125,23 @@
125
125
  "./modals/SmallModal.svelte": "./modals/SmallModal.svelte",
126
126
  "./modals/modalStores": "./modals/modalStores.js",
127
127
  "./navbar/DropdownNavbar.svelte": "./navbar/DropdownNavbar.svelte",
128
+ "./navbar/NavDropdown.svelte": "./navbar/NavDropdown.svelte",
128
129
  "./navbar/Navbar.svelte": "./navbar/Navbar.svelte",
129
130
  "./paginations/Next.svelte": "./paginations/Next.svelte",
130
131
  "./paginations/Pagination.svelte": "./paginations/Pagination.svelte",
131
132
  "./paginations/Previous.svelte": "./paginations/Previous.svelte",
132
133
  "./paginations/TableData.svelte": "./paginations/TableData.svelte",
133
134
  "./sidebars/Sidebar.svelte": "./sidebars/Sidebar.svelte",
135
+ "./sidebars/SidebarDropdown.svelte": "./sidebars/SidebarDropdown.svelte",
134
136
  "./spinners/Spinner.svelte": "./spinners/Spinner.svelte",
135
137
  "./spinners/SpinnerButton.svelte": "./spinners/SpinnerButton.svelte",
136
138
  "./tables/Table.svelte": "./tables/Table.svelte",
137
139
  "./tabs/DefaultTabs.svelte": "./tabs/DefaultTabs.svelte",
140
+ "./tabs/InteractiveTabHead.svelte": "./tabs/InteractiveTabHead.svelte",
138
141
  "./tabs/InteractiveTabs.svelte": "./tabs/InteractiveTabs.svelte",
139
142
  "./tabs/PillTabs.svelte": "./tabs/PillTabs.svelte",
143
+ "./tabs/TabContent.svelte": "./tabs/TabContent.svelte",
144
+ "./tabs/tabStore": "./tabs/tabStore.js",
140
145
  "./timelines/Activity.svelte": "./timelines/Activity.svelte",
141
146
  "./timelines/ActivityItem.svelte": "./timelines/ActivityItem.svelte",
142
147
  "./timelines/Group.svelte": "./timelines/Group.svelte",
@@ -1,13 +1,7 @@
1
- <script >import { slide } from 'svelte/transition';
1
+ <script >import SidebarDropdown from './SidebarDropdown.svelte';
2
2
  export let site;
3
3
  export let links;
4
4
  export let cta;
5
- let isOpen = false;
6
- let activeDropdown = undefined;
7
- const handleDropdown = (id) => {
8
- isOpen = !isOpen;
9
- activeDropdown = id;
10
- };
11
5
  </script>
12
6
 
13
7
  <aside class="w-64" aria-label="Sidebar">
@@ -23,48 +17,7 @@ const handleDropdown = (id) => {
23
17
  <ul class="space-y-2">
24
18
  {#each links as link (link.id)}
25
19
  {#if link.children}
26
- <li>
27
- <button
28
- type="button"
29
- on:click={() => handleDropdown(link.id)}
30
- class="flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
31
- aria-controls="dropdown"
32
- data-collapse-toggle="dropdown"
33
- >
34
- {#if link.icon}
35
- <svelte:component this={link.icon} className="h-4 w-4 mr-2" />
36
- {/if}
37
- <span class="flex-1 ml-3 text-left whitespace-nowrap" sidebar-toggle-item=""
38
- >{link.name}</span
39
- >
40
- <svg
41
- sidebar-toggle-item=""
42
- class="w-6 h-6"
43
- fill="currentColor"
44
- viewBox="0 0 20 20"
45
- xmlns="http://www.w3.org/2000/svg"
46
- ><path
47
- fill-rule="evenodd"
48
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
49
- clip-rule="evenodd"
50
- /></svg
51
- >
52
- </button>
53
- {#if isOpen && link.id == activeDropdown}
54
- <ul id="dropdown" class="py-2 space-y-2" transition:slide={{ duration: 500 }}>
55
- {#each link.children as child}
56
- <li>
57
- <a
58
- href={child.href}
59
- rel={child.rel}
60
- class="flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
61
- >{child.name}</a
62
- >
63
- </li>
64
- {/each}
65
- </ul>
66
- {/if}
67
- </li>
20
+ <SidebarDropdown {link} />
68
21
  {:else}
69
22
  <li>
70
23
  <a
@@ -0,0 +1,50 @@
1
+ <script >import { slide } from 'svelte/transition';
2
+ export let link;
3
+ let isOpen = false;
4
+ let activeDropdown = undefined;
5
+ const handleDropdown = (id) => {
6
+ isOpen = !isOpen;
7
+ activeDropdown = id;
8
+ };
9
+ </script>
10
+
11
+ <li>
12
+ <button
13
+ type="button"
14
+ on:click={() => handleDropdown(link.id)}
15
+ class="flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
16
+ aria-controls="dropdown"
17
+ data-collapse-toggle="dropdown"
18
+ >
19
+ {#if link.icon}
20
+ <svelte:component this={link.icon} className="h-4 w-4 mr-2" />
21
+ {/if}
22
+ <span class="flex-1 ml-3 text-left whitespace-nowrap" sidebar-toggle-item="">{link.name}</span>
23
+ <svg
24
+ sidebar-toggle-item=""
25
+ class="w-6 h-6"
26
+ fill="currentColor"
27
+ viewBox="0 0 20 20"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ ><path
30
+ fill-rule="evenodd"
31
+ d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
32
+ clip-rule="evenodd"
33
+ /></svg
34
+ >
35
+ </button>
36
+ {#if isOpen && link.id == activeDropdown}
37
+ <ul id="dropdown" class="py-2 space-y-2" transition:slide={{ duration: 500 }}>
38
+ {#each link.children as child}
39
+ <li>
40
+ <a
41
+ href={child.href}
42
+ rel={child.rel}
43
+ class="flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"
44
+ >{child.name}</a
45
+ >
46
+ </li>
47
+ {/each}
48
+ </ul>
49
+ {/if}
50
+ </li>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { SidebarType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ link: SidebarType;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export declare type SidebarDropdownProps = typeof __propDef.props;
13
+ export declare type SidebarDropdownEvents = typeof __propDef.events;
14
+ export declare type SidebarDropdownSlots = typeof __propDef.slots;
15
+ export default class SidebarDropdown extends SvelteComponentTyped<SidebarDropdownProps, SidebarDropdownEvents, SidebarDropdownSlots> {
16
+ }
17
+ export {};
@@ -0,0 +1,53 @@
1
+ <script >import { tabStore } from './tabStore';
2
+ export let tabs;
3
+ export let tabId = 'myTab';
4
+ export let activeTabValue = 1;
5
+ const handleClick = (tabValue) => () => {
6
+ tabStore.update((n) => (n = tabValue));
7
+ activeTabValue = tabValue;
8
+ };
9
+ </script>
10
+
11
+ <!--
12
+ @component
13
+ Header part of Interactive tab component. Use with TabContent.
14
+
15
+ @param tabs: TabHeadType[];
16
+ @param tabId = 'myTab';
17
+
18
+ - Usage:
19
+
20
+ ```tsx
21
+ <InteractiveHead>
22
+ <TabContent>
23
+ Some HTML|Component|string
24
+ </TabContent>
25
+ </InteractiveHead>
26
+ ```
27
+ -->
28
+ <div class="mb-4 border-b border-gray-200">
29
+ <ul
30
+ class="flex flex-wrap -mb-px text-sm font-medium text-center"
31
+ id={tabId}
32
+ data-tabs-toggle="#myTabContent"
33
+ role="tablist"
34
+ >
35
+ {#each tabs as { name, id }}
36
+ <li class="mr-2" role="presentation">
37
+ <button
38
+ on:click={handleClick(id)}
39
+ class="inline-block py-4 px-4 text-sm font-medium text-center text-gray-500 rounded-t-lg border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"
40
+ id="{name}-tab"
41
+ data-tabs-target="#{name}"
42
+ type="button"
43
+ role="tab"
44
+ class:active={activeTabValue === id}
45
+ aria-controls={name}
46
+ aria-selected="false">{name}</button
47
+ >
48
+ </li>
49
+ {/each}
50
+ </ul>
51
+ </div>
52
+
53
+ <slot />
@@ -0,0 +1,37 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { TabHeadType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ tabs: TabHeadType[];
6
+ tabId?: string;
7
+ activeTabValue?: number;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ default: {};
14
+ };
15
+ };
16
+ export declare type InteractiveTabHeadProps = typeof __propDef.props;
17
+ export declare type InteractiveTabHeadEvents = typeof __propDef.events;
18
+ export declare type InteractiveTabHeadSlots = typeof __propDef.slots;
19
+ /**
20
+ * Header part of Interactive tab component. Use with TabContent.
21
+ *
22
+ * @param tabs: TabHeadType[];
23
+ * @param tabId = 'myTab';
24
+ *
25
+ * - Usage:
26
+ *
27
+ * ```tsx
28
+ * <InteractiveHead>
29
+ * <TabContent>
30
+ * Some HTML|Component|string
31
+ * </TabContent>
32
+ * </InteractiveHead>
33
+ * ```
34
+ */
35
+ export default class InteractiveTabHead extends SvelteComponentTyped<InteractiveTabHeadProps, InteractiveTabHeadEvents, InteractiveTabHeadSlots> {
36
+ }
37
+ export {};
@@ -32,7 +32,7 @@ export let tabs;
32
32
  >
33
33
  {#if typeof content === 'string'}
34
34
  <p class="text-sm text-gray-500 dark:text-gray-400">
35
- {content}
35
+ {@html content}
36
36
  </p>
37
37
  {:else}
38
38
  <svelte:component this={content} />
@@ -0,0 +1,32 @@
1
+ <script >import { tabStore } from './tabStore';
2
+ export let divClass = 'p-4 rounded-lg dark:bg-gray-800';
3
+ export let tab;
4
+ let activeTabValue;
5
+ tabStore.subscribe((value) => {
6
+ activeTabValue = value;
7
+ });
8
+ </script>
9
+
10
+ <!--
11
+ @component
12
+ Content part of Interactive tab component. Use with InteractiveHead.
13
+
14
+ - let tabId = 'myTab';
15
+ - let tabs: TabHeadType;
16
+ - let divClass: string;
17
+ - Usage:
18
+
19
+ ```tsx
20
+ <InteractiveHead>
21
+ <TabContent>
22
+ Some HTML|Component|string
23
+ </TabContent>
24
+ </InteractiveHead>
25
+ ```
26
+ -->
27
+
28
+ {#if activeTabValue === tab.id}
29
+ <div class={divClass} id="{tab.id}Content" role="tabpanel" aria-labelledby="{tab.name}-tab">
30
+ <slot />
31
+ </div>
32
+ {/if}
@@ -0,0 +1,36 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { TabHeadType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ divClass?: string;
6
+ tab: TabHeadType;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {
12
+ default: {};
13
+ };
14
+ };
15
+ export declare type TabContentProps = typeof __propDef.props;
16
+ export declare type TabContentEvents = typeof __propDef.events;
17
+ export declare type TabContentSlots = typeof __propDef.slots;
18
+ /**
19
+ * Content part of Interactive tab component. Use with InteractiveHead.
20
+ *
21
+ * - let tabId = 'myTab';
22
+ * - let tabs: TabHeadType;
23
+ * - let divClass: string;
24
+ * - Usage:
25
+ *
26
+ * ```tsx
27
+ * <InteractiveHead>
28
+ * <TabContent>
29
+ * Some HTML|Component|string
30
+ * </TabContent>
31
+ * </InteractiveHead>
32
+ * ```
33
+ */
34
+ export default class TabContent extends SvelteComponentTyped<TabContentProps, TabContentEvents, TabContentSlots> {
35
+ }
36
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Writable } from 'svelte/store';
2
+ export declare const tabStore: Writable<number>;
@@ -0,0 +1,2 @@
1
+ import { writable } from 'svelte/store';
2
+ export const tabStore = writable(1);
package/types.d.ts CHANGED
@@ -48,13 +48,16 @@ export interface InteractiveTabType {
48
48
  id: number;
49
49
  content: string | typeof SvelteComponent;
50
50
  }
51
+ export interface TabHeadType {
52
+ name: string;
53
+ id: number;
54
+ }
51
55
  export interface PillTabType {
52
56
  name: string;
53
57
  selected: boolean;
54
58
  href: string;
55
59
  }
56
60
  export interface NavbarType {
57
- id: number;
58
61
  name: string;
59
62
  href: string;
60
63
  rel?: string;