flowbite-svelte 0.15.19 → 0.15.20
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 +7 -0
- package/accordions/AccordionItem.svelte +34 -7
- package/accordions/AccordionItem.svelte.d.ts +7 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -2
- 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,13 @@
|
|
|
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.20](https://github.com/themesberg/flowbite-svelte/compare/v0.15.19...v0.15.20) (2022-05-10)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add always open, color, flush, and arrow style to Accordion component ([e435bb6](https://github.com/themesberg/flowbite-svelte/commit/e435bb6cb29cbc778409379484a996a9d8fad76b))
|
|
11
|
+
|
|
5
12
|
### [0.15.19](https://github.com/themesberg/flowbite-svelte/compare/v0.15.18...v0.15.19) (2022-05-10)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -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';
|
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.20",
|
|
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",
|
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 {};
|