flowbite-svelte 0.25.6 → 0.25.7
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/avatar/Dot.svelte +1 -1
- package/dropdowns/Dropdown.svelte +12 -10
- package/dropdowns/Dropdown.svelte.d.ts +6 -5
- package/package.json +1 -1
- package/popover/Popover.svelte +14 -2
- package/popover/Popover.svelte.d.ts +2 -0
- package/utils/Popper.svelte +7 -5
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.25.7](https://github.com/themesberg/flowbite-svelte/compare/v0.25.6...v0.25.7) (2022-08-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* dropdown as Popper + fixes ([67fdf78](https://github.com/themesberg/flowbite-svelte/commit/67fdf7837f36d63b3683e0b6f6e78fbf91f6bf23))
|
|
11
|
+
|
|
5
12
|
### [0.25.6](https://github.com/themesberg/flowbite-svelte/compare/v0.25.5...v0.25.6) (2022-08-20)
|
|
6
13
|
|
|
7
14
|
|
package/avatar/Dot.svelte
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script>import { setContext } from 'svelte';
|
|
2
|
-
import Tooltip from '../tooltips/Tooltip.svelte';
|
|
3
2
|
import Button from '../buttons/Button.svelte';
|
|
3
|
+
import Popper from '../utils/Popper.svelte';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ChevronUp, ChevronRight, ChevronDown, ChevronLeft } from 'svelte-heros';
|
|
6
6
|
export let label = '';
|
|
7
7
|
export let inline = false;
|
|
8
|
-
export let tooltipArrow = false;
|
|
9
8
|
export let arrowIcon = true;
|
|
10
9
|
export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4 font-medium text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:w-auto dark:text-gray-400 dark:hover:text-white dark:focus:text-white dark:border-gray-700 dark:hover:bg-gray-700 md:dark:hover:bg-transparent';
|
|
11
10
|
export let placement = 'bottom';
|
|
@@ -19,18 +18,21 @@ const icons = {
|
|
|
19
18
|
};
|
|
20
19
|
// @ts-ignore
|
|
21
20
|
$: icon = icons[placement.split('-')[0]];
|
|
21
|
+
let popoverClass;
|
|
22
|
+
$: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800', 'text-gray-500 dark:text-gray-400', 'border border-gray-200 dark:border-gray-700', 'outline-none', $$props.class);
|
|
22
23
|
</script>
|
|
23
24
|
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
animation="duration-100"
|
|
25
|
+
<Popper
|
|
26
|
+
activeContent={true}
|
|
27
|
+
arrow={false}
|
|
28
28
|
{placement}
|
|
29
|
-
|
|
29
|
+
{...$$restProps}
|
|
30
|
+
class={popoverClass}
|
|
30
31
|
trigger="click"
|
|
32
|
+
on:show
|
|
31
33
|
bind:open
|
|
32
34
|
>
|
|
33
|
-
<slot name="trigger">
|
|
35
|
+
<slot name="trigger" slot="trigger">
|
|
34
36
|
{#if inline}
|
|
35
37
|
<button class={labelClass} class:flex-row-reverse={icon == ChevronLeft}>
|
|
36
38
|
<slot name="label">{label}</slot>
|
|
@@ -53,9 +55,9 @@ $: icon = icons[placement.split('-')[0]];
|
|
|
53
55
|
</Button>
|
|
54
56
|
{/if}
|
|
55
57
|
</slot>
|
|
56
|
-
<slot name="content"
|
|
58
|
+
<slot name="content">
|
|
57
59
|
<ul class="py-1">
|
|
58
60
|
<slot />
|
|
59
61
|
</ul>
|
|
60
62
|
</slot>
|
|
61
|
-
</
|
|
63
|
+
</Popper>
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Placement } from '@
|
|
2
|
+
import type { Placement } from '@popperjs/core';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
label?: string;
|
|
7
7
|
inline?: boolean;
|
|
8
|
-
tooltipArrow?: boolean;
|
|
9
8
|
arrowIcon?: boolean;
|
|
10
9
|
labelClass?: string;
|
|
11
10
|
placement?: 'auto' | Placement;
|
|
12
11
|
open?: boolean;
|
|
13
12
|
};
|
|
14
13
|
events: {
|
|
14
|
+
show: CustomEvent<any>;
|
|
15
|
+
} & {
|
|
15
16
|
[evt: string]: CustomEvent<any>;
|
|
16
17
|
};
|
|
17
18
|
slots: {
|
|
18
|
-
trigger: {
|
|
19
|
-
label: {};
|
|
20
|
-
content: {
|
|
19
|
+
trigger: {
|
|
21
20
|
slot: string;
|
|
22
21
|
};
|
|
22
|
+
label: {};
|
|
23
|
+
content: {};
|
|
23
24
|
default: {};
|
|
24
25
|
};
|
|
25
26
|
};
|
package/package.json
CHANGED
package/popover/Popover.svelte
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
<script>import Popper from '../utils/Popper.svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
+
export let title = '';
|
|
3
4
|
let popoverClass;
|
|
4
|
-
$: popoverClass = classNames('
|
|
5
|
+
$: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800', 'text-gray-500 dark:text-gray-400', 'border border-gray-200 dark:border-gray-700', $$props.class);
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<Popper activeContent={true} {...$$restProps} class={popoverClass} on:show>
|
|
8
9
|
<slot name="trigger" slot="trigger" />
|
|
9
|
-
|
|
10
|
+
{#if $$slots.title || title}
|
|
11
|
+
<div
|
|
12
|
+
class="py-2 px-3 bg-gray-100 rounded-t-lg border-b border-gray-200 dark:border-gray-600 dark:bg-gray-700"
|
|
13
|
+
>
|
|
14
|
+
<slot name="title">
|
|
15
|
+
<h3 class="font-semibold text-gray-900 dark:text-white">{title}</h3>
|
|
16
|
+
</slot>
|
|
17
|
+
</div>
|
|
18
|
+
{/if}
|
|
19
|
+
<div class="py-2 px-3">
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
10
22
|
</Popper>
|
|
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
title?: string;
|
|
5
6
|
};
|
|
6
7
|
events: {
|
|
7
8
|
show: CustomEvent<any>;
|
|
@@ -12,6 +13,7 @@ declare const __propDef: {
|
|
|
12
13
|
trigger: {
|
|
13
14
|
slot: string;
|
|
14
15
|
};
|
|
16
|
+
title: {};
|
|
15
17
|
default: {};
|
|
16
18
|
};
|
|
17
19
|
};
|
package/utils/Popper.svelte
CHANGED
|
@@ -21,7 +21,9 @@ const showHandler = (ev) => {
|
|
|
21
21
|
};
|
|
22
22
|
const hideHandler = (ev) => {
|
|
23
23
|
if (activeContent)
|
|
24
|
-
setTimeout(() => triggerEl.matches(':hover') || contentEl.matches(':hover') ||
|
|
24
|
+
setTimeout(() => (!clickable && (triggerEl.matches(':hover') || contentEl.matches(':hover'))) ||
|
|
25
|
+
contentEl.contains(document.activeElement) ||
|
|
26
|
+
(open = false), 100);
|
|
25
27
|
else
|
|
26
28
|
open = false;
|
|
27
29
|
};
|
|
@@ -55,7 +57,7 @@ let divClass;
|
|
|
55
57
|
$: divClass = classNames('z-10', animation && `transition-opacity ${animation}`, open ? 'visible opacity-100' : 'invisible opacity-0', $$props.class);
|
|
56
58
|
</script>
|
|
57
59
|
|
|
58
|
-
<
|
|
60
|
+
<div
|
|
59
61
|
bind:this={triggerEl}
|
|
60
62
|
on:focusin={showHandler}
|
|
61
63
|
on:focusout={hideHandler}
|
|
@@ -65,14 +67,14 @@ $: divClass = classNames('z-10', animation && `transition-opacity ${animation}`,
|
|
|
65
67
|
class="inline-block"
|
|
66
68
|
>
|
|
67
69
|
<slot name="trigger" />
|
|
68
|
-
</
|
|
70
|
+
</div>
|
|
69
71
|
<div
|
|
70
72
|
bind:this={contentEl}
|
|
71
73
|
role="tooltip"
|
|
72
74
|
tabindex={activeContent ? -1 : undefined}
|
|
73
75
|
class={divClass}
|
|
74
|
-
on:
|
|
75
|
-
on:
|
|
76
|
+
on:focusin={activeContent ? showHandler : undefined}
|
|
77
|
+
on:focusout={activeContent ? hideHandler : undefined}
|
|
76
78
|
on:mouseenter={activeContent && !clickable ? showHandler : undefined}
|
|
77
79
|
on:mouseleave={activeContent && !clickable ? hideHandler : undefined}
|
|
78
80
|
>
|