flowbite-svelte 0.15.18 → 0.15.21
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/CHANGELOG.md +21 -0
- package/accordions/AccordionItem.svelte +34 -7
- package/accordions/AccordionItem.svelte.d.ts +7 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/sidebars/Sidebar.svelte +2 -22
- package/sidebars/Sidebar.svelte.d.ts +4 -3
- package/sidebars/SidebarItem.svelte +28 -0
- package/sidebars/SidebarItem.svelte.d.ts +18 -0
- package/tabs/FullWidthTabs.svelte +5 -17
- package/types.d.ts +4 -0
- package/accordions/AccordionDefault.svelte +0 -25
- package/accordions/AccordionDefault.svelte.d.ts +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.15.21](https://github.com/themesberg/flowbite-svelte/compare/v0.15.20...v0.15.21) (2022-05-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add right round corner to FullWidthTabs ([adaf72f](https://github.com/themesberg/flowbite-svelte/commit/adaf72fd01499ec8e73cdac1cf1b50054a2d8ead))
|
|
11
|
+
|
|
12
|
+
### [0.15.20](https://github.com/themesberg/flowbite-svelte/compare/v0.15.19...v0.15.20) (2022-05-10)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add always open, color, flush, and arrow style to Accordion component ([e435bb6](https://github.com/themesberg/flowbite-svelte/commit/e435bb6cb29cbc778409379484a996a9d8fad76b))
|
|
18
|
+
|
|
19
|
+
### [0.15.19](https://github.com/themesberg/flowbite-svelte/compare/v0.15.18...v0.15.19) (2022-05-10)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* add SidebarItem to Sidebar component ([a3a9654](https://github.com/themesberg/flowbite-svelte/commit/a3a965498817449cc90bdb20d9babe4f000e4466))
|
|
25
|
+
|
|
5
26
|
### [0.15.18](https://github.com/themesberg/flowbite-svelte/compare/v0.15.17...v0.15.18) (2022-05-10)
|
|
6
27
|
|
|
7
28
|
### [0.15.17](https://github.com/themesberg/flowbite-svelte/compare/v0.15.16...v0.15.17) (2022-05-09)
|
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
<script>import { slide } from 'svelte/transition';
|
|
2
|
+
import { onMount } from 'svelte';
|
|
2
3
|
import { ChevronDownSolid, ChevronUpSolid } from 'svelte-heros';
|
|
3
4
|
export let id = '';
|
|
4
5
|
export let btnClass = 'flex items-center focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 justify-between p-5 w-full font-medium border border-gray-200 dark:border-gray-700 text-left text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800';
|
|
5
6
|
export let slotClass = 'p-5 border border-t-0 border-gray-200 dark:border-gray-700';
|
|
6
|
-
let isOpen = false;
|
|
7
|
-
let
|
|
7
|
+
export let isOpen = false;
|
|
8
|
+
export let color = false;
|
|
9
|
+
export let flush = false;
|
|
10
|
+
export let icons = {
|
|
11
|
+
up: ChevronUpSolid,
|
|
12
|
+
down: ChevronDownSolid
|
|
13
|
+
};
|
|
14
|
+
if (flush) {
|
|
15
|
+
btnClass = 'flex justify-between items-center py-5 w-full font-medium text-left text-gray-500 border-b border-gray-200 dark:border-gray-700 dark:text-gray-400';
|
|
16
|
+
slotClass = 'py-5 border-b border-gray-200 dark:border-gray-700';
|
|
17
|
+
}
|
|
18
|
+
// $: console.log('isOpen', isOpen);
|
|
19
|
+
onMount(() => {
|
|
20
|
+
if (isOpen) {
|
|
21
|
+
isOpen = true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
8
24
|
const handleToggle = (id) => {
|
|
9
25
|
isOpen = !isOpen;
|
|
10
|
-
|
|
26
|
+
if (color && isOpen) {
|
|
27
|
+
btnClass = 'flex items-center focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 justify-between p-5 w-full font-medium border border-gray-200 dark:border-gray-700 text-left text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 focus:ring-blue-200 dark:focus:ring-blue-800 hover:bg-blue-100 text-blue-500 bg-blue-200 text-blue-700';
|
|
28
|
+
}
|
|
29
|
+
else if (flush) {
|
|
30
|
+
btnClass = 'flex justify-between items-center py-5 w-full font-medium text-left text-gray-500 border-b border-gray-200 dark:border-gray-700 dark:text-gray-400';
|
|
31
|
+
slotClass = 'py-5 border-b border-gray-200 dark:border-gray-700';
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
btnClass = 'flex items-center focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 justify-between p-5 w-full font-medium border border-gray-200 dark:border-gray-700 text-left text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800';
|
|
35
|
+
}
|
|
11
36
|
};
|
|
37
|
+
export let iconSize = 24;
|
|
38
|
+
export let iconClass = 'text-gray-500 sm:w-6 sm:h-6 dark:text-gray-300';
|
|
12
39
|
</script>
|
|
13
40
|
|
|
14
41
|
<h2 aria-expanded={isOpen}>
|
|
15
|
-
<button on:click={() => handleToggle(id)} type="button" class:rounded-t-xl={id === '1'} class:border-t-0={id !== '1'} class={btnClass}>
|
|
16
|
-
<
|
|
42
|
+
<button on:click={() => handleToggle(id)} type="button" class:rounded-t-xl={id === '1' && !flush} class:border-t-0={id !== '1'} class={btnClass}>
|
|
43
|
+
<slot name="header" />
|
|
17
44
|
{#if isOpen}
|
|
18
|
-
<
|
|
45
|
+
<svelte:component this={icons.up} size={iconSize} class="mr-2 {iconClass}" />
|
|
19
46
|
{:else}
|
|
20
|
-
<
|
|
47
|
+
<svelte:component this={icons.down} size={iconSize} class="mr-2 {iconClass}" />
|
|
21
48
|
{/if}
|
|
22
49
|
</button>
|
|
23
50
|
</h2>
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AccordionIconType } from '../types';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
id?: string;
|
|
5
6
|
btnClass?: string;
|
|
6
7
|
slotClass?: string;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
color?: boolean;
|
|
10
|
+
flush?: boolean;
|
|
11
|
+
icons?: AccordionIconType;
|
|
12
|
+
iconSize?: number;
|
|
13
|
+
iconClass?: string;
|
|
7
14
|
};
|
|
8
15
|
events: {
|
|
9
16
|
[evt: string]: CustomEvent<any>;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { default as Accordion } from './accordions/AccordionDefault.svelte';
|
|
2
1
|
export { default as AccordionItem } from './accordions/AccordionItem.svelte';
|
|
3
2
|
export { default as Alert } from './alerts/Alert.svelte';
|
|
4
3
|
export { default as BorderAlert } from './alerts/BorderAlert.svelte';
|
|
@@ -64,6 +63,7 @@ export { default as Rating } from './ratings/Rating.svelte';
|
|
|
64
63
|
export { default as AdvancedRating } from './ratings/AdvancedRating.svelte';
|
|
65
64
|
export { default as ScoreRating } from './ratings/ScoreRating.svelte';
|
|
66
65
|
export { default as Sidebar } from './sidebars/Sidebar.svelte';
|
|
66
|
+
export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
|
|
67
67
|
export { default as Spinner } from './spinners/Spinner.svelte';
|
|
68
68
|
export { default as Table } from './tables/Table.svelte';
|
|
69
69
|
export { default as TableDefaultRow } from './tables/TableDefaultRow.svelte';
|
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Accordion
|
|
2
|
-
export { default as Accordion } from './accordions/AccordionDefault.svelte';
|
|
3
2
|
export { default as AccordionItem } from './accordions/AccordionItem.svelte';
|
|
4
3
|
// Alerts
|
|
5
4
|
export { default as Alert } from './alerts/Alert.svelte';
|
|
@@ -84,6 +83,7 @@ export { default as AdvancedRating } from './ratings/AdvancedRating.svelte';
|
|
|
84
83
|
export { default as ScoreRating } from './ratings/ScoreRating.svelte';
|
|
85
84
|
// Sidebar
|
|
86
85
|
export { default as Sidebar } from './sidebars/Sidebar.svelte';
|
|
86
|
+
export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
|
|
87
87
|
// Spin
|
|
88
88
|
export { default as Spinner } from './spinners/Spinner.svelte';
|
|
89
89
|
// Tables
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.21",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "./package/index.js",
|
|
6
6
|
"author": {
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"exports": {
|
|
82
82
|
"./package.json": "./package.json",
|
|
83
83
|
"./.DS_Store": "./.DS_Store",
|
|
84
|
-
"./accordions/AccordionDefault.svelte": "./accordions/AccordionDefault.svelte",
|
|
85
84
|
"./accordions/AccordionItem.svelte": "./accordions/AccordionItem.svelte",
|
|
86
85
|
"./alerts/Alert.svelte": "./alerts/Alert.svelte",
|
|
87
86
|
"./alerts/BorderAlert.svelte": "./alerts/BorderAlert.svelte",
|
|
@@ -156,6 +155,7 @@
|
|
|
156
155
|
"./ratings/ScoreRating.svelte": "./ratings/ScoreRating.svelte",
|
|
157
156
|
"./sidebars/Sidebar.svelte": "./sidebars/Sidebar.svelte",
|
|
158
157
|
"./sidebars/SidebarDropdown.svelte": "./sidebars/SidebarDropdown.svelte",
|
|
158
|
+
"./sidebars/SidebarItem.svelte": "./sidebars/SidebarItem.svelte",
|
|
159
159
|
"./spinners/Spinner.svelte": "./spinners/Spinner.svelte",
|
|
160
160
|
"./tables/Table.svelte": "./tables/Table.svelte",
|
|
161
161
|
"./tables/TableCheckbox.svelte": "./tables/TableCheckbox.svelte",
|
package/sidebars/Sidebar.svelte
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let site;
|
|
3
|
-
export let links;
|
|
1
|
+
<script>export let site;
|
|
4
2
|
export let cta;
|
|
5
3
|
</script>
|
|
6
4
|
|
|
@@ -12,25 +10,7 @@ export let cta;
|
|
|
12
10
|
<span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white">{site.name}</span>
|
|
13
11
|
</a>
|
|
14
12
|
{/if}
|
|
15
|
-
<
|
|
16
|
-
{#each links as link (link.id)}
|
|
17
|
-
{#if link.children}
|
|
18
|
-
<SidebarDropdown {link} />
|
|
19
|
-
{:else}
|
|
20
|
-
<li>
|
|
21
|
-
<a href={link.href} rel={link.rel} class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
22
|
-
{#if link.icon}
|
|
23
|
-
<svelte:component this={link.icon} size={link.iconSize} color={link.iconColor} class="mr-2 {link.iconClass}" />
|
|
24
|
-
{/if}
|
|
25
|
-
<span class="ml-3">{link.name}</span>
|
|
26
|
-
{#if link.subtext}
|
|
27
|
-
{@html link.subtext}
|
|
28
|
-
{/if}
|
|
29
|
-
</a>
|
|
30
|
-
</li>
|
|
31
|
-
{/if}
|
|
32
|
-
{/each}
|
|
33
|
-
</ul>
|
|
13
|
+
<slot />
|
|
34
14
|
{#if cta}
|
|
35
15
|
<div id="dropdown-cta" class="p-4 mt-6 bg-blue-50 rounded-lg dark:bg-blue-900" role="alert">
|
|
36
16
|
<div class="flex items-center mb-3">
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { SiteType,
|
|
2
|
+
import type { SiteType, SidebarCtaType } from '../types';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
site: SiteType;
|
|
6
|
-
links: SidebarType[];
|
|
7
6
|
cta: SidebarCtaType;
|
|
8
7
|
};
|
|
9
8
|
events: {
|
|
10
9
|
[evt: string]: CustomEvent<any>;
|
|
11
10
|
};
|
|
12
|
-
slots: {
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
13
14
|
};
|
|
14
15
|
export declare type SidebarProps = typeof __propDef.props;
|
|
15
16
|
export declare type SidebarEvents = typeof __propDef.events;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script>import SidebarDropdown from './SidebarDropdown.svelte';
|
|
2
|
+
export let links;
|
|
3
|
+
let ulClass = 'space-y-2';
|
|
4
|
+
export let border = false;
|
|
5
|
+
if (border) {
|
|
6
|
+
ulClass = 'pt-4 mt-4 space-y-2 border-t border-gray-200 dark:border-gray-700';
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<ul class={ulClass}>
|
|
11
|
+
{#each links as link (link.id)}
|
|
12
|
+
{#if link.children}
|
|
13
|
+
<SidebarDropdown {link} />
|
|
14
|
+
{:else}
|
|
15
|
+
<li>
|
|
16
|
+
<a href={link.href} rel={link.rel} class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700">
|
|
17
|
+
{#if link.icon}
|
|
18
|
+
<svelte:component this={link.icon} size={link.iconSize} color={link.iconColor} class="mr-2 {link.iconClass}" />
|
|
19
|
+
{/if}
|
|
20
|
+
<span class="ml-3">{link.name}</span>
|
|
21
|
+
{#if link.subtext}
|
|
22
|
+
{@html link.subtext}
|
|
23
|
+
{/if}
|
|
24
|
+
</a>
|
|
25
|
+
</li>
|
|
26
|
+
{/if}
|
|
27
|
+
{/each}
|
|
28
|
+
</ul>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SidebarType } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
links: SidebarType[];
|
|
6
|
+
border?: boolean;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type SidebarItemProps = typeof __propDef.props;
|
|
14
|
+
export declare type SidebarItemEvents = typeof __propDef.events;
|
|
15
|
+
export declare type SidebarItemSlots = typeof __propDef.slots;
|
|
16
|
+
export default class SidebarItem extends SvelteComponentTyped<SidebarItemProps, SidebarItemEvents, SidebarItemSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -4,28 +4,16 @@ export let tabLabel;
|
|
|
4
4
|
|
|
5
5
|
<div class="sm:hidden">
|
|
6
6
|
<label for="tabs" class="sr-only">{tabLabel}</label>
|
|
7
|
-
<select
|
|
8
|
-
id="tabs"
|
|
9
|
-
class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
10
|
-
>
|
|
7
|
+
<select id="tabs" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
|
11
8
|
{#each tabs as { name }}
|
|
12
9
|
<option>{name}</option>
|
|
13
10
|
{/each}
|
|
14
11
|
</select>
|
|
15
12
|
</div>
|
|
16
|
-
<ul
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
<li class="w-full">
|
|
21
|
-
<a
|
|
22
|
-
{href}
|
|
23
|
-
{rel}
|
|
24
|
-
class={active
|
|
25
|
-
? 'inline-block p-4 w-full text-gray-900 bg-gray-100 rounded-l-lg focus:ring-4 focus:ring-blue-300 active focus:outline-none dark:bg-gray-700 dark:text-white'
|
|
26
|
-
: 'inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700'}
|
|
27
|
-
aria-current="page">{name}</a
|
|
28
|
-
>
|
|
13
|
+
<ul class="hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400">
|
|
14
|
+
{#each tabs as { name, href, rel, active }, i}
|
|
15
|
+
<li class="w-full" data-id={i}>
|
|
16
|
+
<a {href} {rel} class:rounded-l-lg={i === 0} class:rounded-r-lg={i === tabs.length - 1} class={active ? 'inline-block p-4 w-full text-gray-900 bg-gray-100 focus:ring-4 focus:ring-blue-300 active focus:outline-none dark:bg-gray-700 dark:text-white' : 'inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700'} aria-current="page">{name}</a>
|
|
29
17
|
</li>
|
|
30
18
|
{/each}
|
|
31
19
|
</ul>
|
package/types.d.ts
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script>import { onDestroy } from 'svelte';
|
|
2
|
-
import { setContext } from 'svelte';
|
|
3
|
-
import { createEventDispatcher } from 'svelte';
|
|
4
|
-
import { writable } from 'svelte/store';
|
|
5
|
-
export let duration = 0.2;
|
|
6
|
-
export let easing = 'ease';
|
|
7
|
-
export let id = undefined;
|
|
8
|
-
const dispatch = createEventDispatcher();
|
|
9
|
-
// create a store for the children to access
|
|
10
|
-
const store = writable({ id, duration, easing });
|
|
11
|
-
// when the store changes, update the id prop
|
|
12
|
-
const unsubscribe = store.subscribe((s) => {
|
|
13
|
-
id = s.id;
|
|
14
|
-
dispatch('change', { id });
|
|
15
|
-
});
|
|
16
|
-
// when the id prop changes, update the store
|
|
17
|
-
$: store.update((s) => Object.assign(s, { id }));
|
|
18
|
-
// make the store available to children
|
|
19
|
-
setContext('svelte-collapsible-accordion', store);
|
|
20
|
-
onDestroy(unsubscribe);
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<div>
|
|
24
|
-
<slot />
|
|
25
|
-
</div>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
duration?: number;
|
|
5
|
-
easing?: string;
|
|
6
|
-
id?: number;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
change: CustomEvent<any>;
|
|
10
|
-
} & {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {
|
|
14
|
-
default: {};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare type AccordionDefaultProps = typeof __propDef.props;
|
|
18
|
-
export declare type AccordionDefaultEvents = typeof __propDef.events;
|
|
19
|
-
export declare type AccordionDefaultSlots = typeof __propDef.slots;
|
|
20
|
-
export default class AccordionDefault extends SvelteComponentTyped<AccordionDefaultProps, AccordionDefaultEvents, AccordionDefaultSlots> {
|
|
21
|
-
}
|
|
22
|
-
export {};
|