flowbite-svelte 0.15.32 → 0.15.35
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/AccordionFlush.svelte +40 -0
- package/accordions/AccordionFlush.svelte.d.ts +27 -0
- package/accordions/AccordionItem.svelte +1 -11
- package/accordions/AccordionItem.svelte.d.ts +0 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -1
- package/sidebars/SidebarDropdown.svelte +4 -2
- package/sidebars/SidebarDropdown.svelte.d.ts +2 -0
- package/sidebars/SidebarItem.svelte +3 -1
- package/sidebars/SidebarItem.svelte.d.ts +2 -0
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.35](https://github.com/themesberg/flowbite-svelte/compare/v0.15.34...v0.15.35) (2022-05-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add ulClass and childClass in SidebarItem's SidebarDropdown ([2e0f46b](https://github.com/themesberg/flowbite-svelte/commit/2e0f46b6c65037e4a40bba688936af99839bd863))
|
|
11
|
+
|
|
12
|
+
### [0.15.34](https://github.com/themesberg/flowbite-svelte/compare/v0.15.33...v0.15.34) (2022-05-15)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* add childClass and ulClass to SidebarDropdown ([8754489](https://github.com/themesberg/flowbite-svelte/commit/875448911cbf0e427f51a08b51d5f160974b159b))
|
|
18
|
+
|
|
19
|
+
### [0.15.33](https://github.com/themesberg/flowbite-svelte/compare/v0.15.32...v0.15.33) (2022-05-15)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add AccordionFlush component ([e2d297d](https://github.com/themesberg/flowbite-svelte/commit/e2d297def8272347a68fe39e3296d07d1bd2b436))
|
|
25
|
+
|
|
5
26
|
### [0.15.32](https://github.com/themesberg/flowbite-svelte/compare/v0.15.31...v0.15.32) (2022-05-15)
|
|
6
27
|
|
|
7
28
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>import { slide } from 'svelte/transition';
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { ChevronDownSolid, ChevronUpSolid } from 'svelte-heros';
|
|
4
|
+
export let id = '';
|
|
5
|
+
export let 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';
|
|
6
|
+
export let slotClass = 'py-5 border-b border-gray-200 dark:border-gray-700';
|
|
7
|
+
export let isOpen = false;
|
|
8
|
+
export let icons = {
|
|
9
|
+
up: ChevronUpSolid,
|
|
10
|
+
down: ChevronDownSolid
|
|
11
|
+
};
|
|
12
|
+
onMount(() => {
|
|
13
|
+
if (isOpen) {
|
|
14
|
+
isOpen = true;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const handleToggle = (id) => {
|
|
18
|
+
isOpen = !isOpen;
|
|
19
|
+
};
|
|
20
|
+
export let iconSize = 24;
|
|
21
|
+
export let iconClass = 'text-gray-500 sm:w-6 sm:h-6 dark:text-gray-300';
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<h2 aria-expanded={isOpen}>
|
|
25
|
+
<button on:click={() => handleToggle(id)} type="button" class:rounded-t-xl={id === '1'} class:border-t-0={id !== '1'} class="{btnClass} {$$props.class ? $$props.class : ''}">
|
|
26
|
+
<slot name="header" />
|
|
27
|
+
{#if isOpen}
|
|
28
|
+
<svelte:component this={icons.up} size={iconSize} class="mr-2 {iconClass}" />
|
|
29
|
+
{:else}
|
|
30
|
+
<svelte:component this={icons.down} size={iconSize} class="mr-2 {iconClass}" />
|
|
31
|
+
{/if}
|
|
32
|
+
</button>
|
|
33
|
+
</h2>
|
|
34
|
+
{#if isOpen}
|
|
35
|
+
<div transition:slide={{ duration: 500 }}>
|
|
36
|
+
<div class={slotClass}>
|
|
37
|
+
<slot name="body" />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
{/if}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AccordionIconType } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
id?: string;
|
|
7
|
+
btnClass?: string;
|
|
8
|
+
slotClass?: string;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
icons?: AccordionIconType;
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
iconClass?: string;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {
|
|
18
|
+
header: {};
|
|
19
|
+
body: {};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare type AccordionFlushProps = typeof __propDef.props;
|
|
23
|
+
export declare type AccordionFlushEvents = typeof __propDef.events;
|
|
24
|
+
export declare type AccordionFlushSlots = typeof __propDef.slots;
|
|
25
|
+
export default class AccordionFlush extends SvelteComponentTyped<AccordionFlushProps, AccordionFlushEvents, AccordionFlushSlots> {
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -6,16 +6,10 @@ export let btnClass = 'flex items-center focus:ring-4 focus:ring-gray-200 dark:f
|
|
|
6
6
|
export let slotClass = 'p-5 border border-t-0 border-gray-200 dark:border-gray-700';
|
|
7
7
|
export let isOpen = false;
|
|
8
8
|
export let color = false;
|
|
9
|
-
export let flush = false;
|
|
10
9
|
export let icons = {
|
|
11
10
|
up: ChevronUpSolid,
|
|
12
11
|
down: ChevronDownSolid
|
|
13
12
|
};
|
|
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
13
|
onMount(() => {
|
|
20
14
|
if (isOpen) {
|
|
21
15
|
isOpen = true;
|
|
@@ -26,10 +20,6 @@ const handleToggle = (id) => {
|
|
|
26
20
|
if (color && isOpen) {
|
|
27
21
|
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
22
|
}
|
|
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
23
|
else {
|
|
34
24
|
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
25
|
}
|
|
@@ -39,7 +29,7 @@ export let iconClass = 'text-gray-500 sm:w-6 sm:h-6 dark:text-gray-300';
|
|
|
39
29
|
</script>
|
|
40
30
|
|
|
41
31
|
<h2 aria-expanded={isOpen}>
|
|
42
|
-
<button on:click={() => handleToggle(id)} type="button" class:rounded-t-xl={id === '1'
|
|
32
|
+
<button on:click={() => handleToggle(id)} type="button" class:rounded-t-xl={id === '1'} class:border-t-0={id !== '1'} class="{btnClass} {$$props.class ? $$props.class : ''}">
|
|
43
33
|
<slot name="header" />
|
|
44
34
|
{#if isOpen}
|
|
45
35
|
<svelte:component this={icons.up} size={iconSize} class="mr-2 {iconClass}" />
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as AccordionItem } from './accordions/AccordionItem.svelte';
|
|
2
|
+
export { default as AccordionFlush } from './accordions/AccordionFlush.svelte';
|
|
2
3
|
export { default as Alert } from './alerts/Alert.svelte';
|
|
3
4
|
export { default as Avatar } from './avatar/Avatar.svelte';
|
|
4
5
|
export { default as Badge } from './badges/Badge.svelte';
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.35",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"exports": {
|
|
83
83
|
"./package.json": "./package.json",
|
|
84
84
|
"./.DS_Store": "./.DS_Store",
|
|
85
|
+
"./accordions/AccordionFlush.svelte": "./accordions/AccordionFlush.svelte",
|
|
85
86
|
"./accordions/AccordionItem.svelte": "./accordions/AccordionItem.svelte",
|
|
86
87
|
"./alerts/Alert.svelte": "./alerts/Alert.svelte",
|
|
87
88
|
"./avatar/Avatar.svelte": "./avatar/Avatar.svelte",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>import { slide } from 'svelte/transition';
|
|
2
2
|
export let link;
|
|
3
|
+
export let childClass = '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';
|
|
4
|
+
export let ulClass = 'py-2 space-y-2';
|
|
3
5
|
let isOpen = false;
|
|
4
6
|
let activeDropdown = undefined;
|
|
5
7
|
const handleDropdown = (id) => {
|
|
@@ -17,10 +19,10 @@ const handleDropdown = (id) => {
|
|
|
17
19
|
<svg sidebar-toggle-item="" class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" 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" clip-rule="evenodd" /></svg>
|
|
18
20
|
</button>
|
|
19
21
|
{#if isOpen && link.id == activeDropdown}
|
|
20
|
-
<ul id="dropdown" class=
|
|
22
|
+
<ul id="dropdown" class={ulClass} transition:slide={{ duration: 500 }}>
|
|
21
23
|
{#each link.children as child}
|
|
22
24
|
<li>
|
|
23
|
-
<a href={child.href} rel={child.rel} class=
|
|
25
|
+
<a href={child.href} rel={child.rel} class={childClass}>{child.name}</a>
|
|
24
26
|
</li>
|
|
25
27
|
{/each}
|
|
26
28
|
</ul>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>import SidebarDropdown from './SidebarDropdown.svelte';
|
|
2
2
|
export let links;
|
|
3
|
+
export let childClass = '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';
|
|
4
|
+
export let dropDownulClass = 'py-2 space-y-2';
|
|
3
5
|
let ulClass = 'space-y-2';
|
|
4
6
|
export let border = false;
|
|
5
7
|
if (border) {
|
|
@@ -10,7 +12,7 @@ if (border) {
|
|
|
10
12
|
<ul class={ulClass}>
|
|
11
13
|
{#each links as link (link.id)}
|
|
12
14
|
{#if link.children}
|
|
13
|
-
<SidebarDropdown {link} />
|
|
15
|
+
<SidebarDropdown {link} ulClass={dropDownulClass} {childClass} />
|
|
14
16
|
{:else}
|
|
15
17
|
<li>
|
|
16
18
|
<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">
|