flowbite-svelte 0.23.3 → 0.24.0
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 +20 -0
- package/README.md +2 -0
- package/alerts/Alert.svelte +1 -1
- package/badges/Badge.svelte +1 -1
- package/cards/Card.svelte +11 -2
- package/cards/Card.svelte.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/modals/Modal.svelte +1 -1
- package/package.json +2 -2
- package/toasts/Toast.svelte +1 -1
- package/tooltips/Tooltip.svelte +27 -22
- package/utils/OptsButton.svelte +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
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.24.0](https://github.com/themesberg/flowbite-svelte/compare/v0.23.3...v0.24.0) (2022-08-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* change node version to 0.16.16 since new playwright and sveltekit require it, https://github.com/sveltejs/kit/issues/5842
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* change node version to 0.16.16 since new playwright and sveltekit require it, https://github.com/sveltejs/kit/issues/5842 ([6175c2c](https://github.com/themesberg/flowbite-svelte/commit/6175c2cb54c60829eb329bce90772e59b888063f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* [#200](https://github.com/themesberg/flowbite-svelte/issues/200) undefined in tooltips ([4ed2ec0](https://github.com/themesberg/flowbite-svelte/commit/4ed2ec04945676cbc3e40011fb7790d1de18d8db))
|
|
20
|
+
* A11y fix for all alt taking out picture for img tag ([a247c32](https://github.com/themesberg/flowbite-svelte/commit/a247c32171543450647877a0f7192e63ee64fbb5))
|
|
21
|
+
* add CloseButton to index and change import from $lib ([cc8fe25](https://github.com/themesberg/flowbite-svelte/commit/cc8fe2504474f6a0fbefb5474ef5cf798f6a28a8))
|
|
22
|
+
* alerts with list color removal ([f940441](https://github.com/themesberg/flowbite-svelte/commit/f940441098e4f033b6dd405d0cb774e6d8b5030e))
|
|
23
|
+
* clean up import from utils for docs ([b50126d](https://github.com/themesberg/flowbite-svelte/commit/b50126d2f78e7613e48008b46c0bd77cdc7471fa))
|
|
24
|
+
|
|
5
25
|
### [0.23.3](https://github.com/themesberg/flowbite-svelte/compare/v0.23.2...v0.23.3) (2022-08-05)
|
|
6
26
|
|
|
7
27
|
|
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
[](https://github.com/themesberg/flowbite-svelte/releases)
|
|
6
6
|
[](https://github.com/themesberg/flowbite-svelte/blob/main/LICENSE)
|
|
7
7
|
|
|
8
|
+
**⚠️ Flowbite-Svelte is currently in early development and APIs and packages are likely to change quite often.**
|
|
9
|
+
|
|
8
10
|
<p>
|
|
9
11
|
<a href="https://flowbite-svelte.com" >
|
|
10
12
|
<img alt="Flowbite-Svelte CSS components" width="350" src="https://raw.githubusercontent.com/themesberg/flowbite-svelte/main/static/images/flowbite-svelte.png">
|
package/alerts/Alert.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import { setContext } from 'svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { createEventDispatcher } from 'svelte';
|
|
4
|
-
import CloseButton from '
|
|
4
|
+
import { CloseButton } from '$lib';
|
|
5
5
|
const dispatch = createEventDispatcher();
|
|
6
6
|
setContext('background', true);
|
|
7
7
|
export let color = 'blue';
|
package/badges/Badge.svelte
CHANGED
package/cards/Card.svelte
CHANGED
|
@@ -5,17 +5,26 @@ export let horizontal = false;
|
|
|
5
5
|
export let reverse = false;
|
|
6
6
|
export let img = undefined;
|
|
7
7
|
export let padding = 'lg';
|
|
8
|
+
export let size = 'sm';
|
|
8
9
|
setContext('background', true);
|
|
9
10
|
const paddings = {
|
|
11
|
+
none: 'p-0',
|
|
10
12
|
sm: 'p-4',
|
|
11
13
|
md: 'p-5',
|
|
12
14
|
lg: 'p-6',
|
|
13
15
|
xl: 'p-8'
|
|
14
16
|
};
|
|
17
|
+
const sizes = {
|
|
18
|
+
xs: 'max-w-xs',
|
|
19
|
+
sm: 'max-w-sm',
|
|
20
|
+
md: 'max-w-lg',
|
|
21
|
+
lg: 'max-w-2xl',
|
|
22
|
+
xl: 'max-w-screen-xl'
|
|
23
|
+
};
|
|
15
24
|
let innerPdding;
|
|
16
25
|
$: innerPdding = paddings[padding];
|
|
17
26
|
let cardClass;
|
|
18
|
-
$: cardClass = classNames('
|
|
27
|
+
$: cardClass = classNames('flex', sizes[size], reverse ? 'flex-col-reverse' : 'flex-col', horizontal && (reverse ? 'md:flex-row-reverse md:max-w-xl' : 'md:flex-row md:max-w-xl'), 'bg-white dark:bg-gray-800 shadow-md', 'text-gray-500 dark:text-gray-400', 'rounded-lg border border-gray-200 dark:border-gray-700', href && 'hover:bg-gray-100 dark:hover:bg-gray-700', !img && innerPdding, $$props.class);
|
|
19
28
|
let imgClass;
|
|
20
29
|
$: imgClass = classNames(reverse ? 'rounded-b-lg' : 'rounded-t-lg', horizontal && 'object-cover w-full h-96 md:h-auto md:w-48 md:rounded-none', horizontal && (reverse ? 'md:rounded-r-lg' : 'md:rounded-l-lg'));
|
|
21
30
|
</script>
|
|
@@ -27,6 +36,6 @@ $: imgClass = classNames(reverse ? 'rounded-b-lg' : 'rounded-t-lg', horizontal &
|
|
|
27
36
|
<slot />
|
|
28
37
|
</div>
|
|
29
38
|
{:else}
|
|
30
|
-
<
|
|
39
|
+
<slot />
|
|
31
40
|
{/if}
|
|
32
41
|
</svelte:element>
|
package/cards/Card.svelte.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -108,3 +108,4 @@ export { default as TimelineItemHorizontal } from './timelines/TimelineItemHoriz
|
|
|
108
108
|
export { default as TimelineItemVertical } from './timelines/TimelineItemVertical.svelte';
|
|
109
109
|
export { default as Toast } from './toasts/Toast.svelte';
|
|
110
110
|
export { default as Tooltip } from './tooltips/Tooltip.svelte';
|
|
111
|
+
export { default as CloseButton } from './utils/CloseButton.svelte';
|
package/index.js
CHANGED
|
@@ -139,3 +139,5 @@ export { default as TimelineItemVertical } from './timelines/TimelineItemVertica
|
|
|
139
139
|
export { default as Toast } from './toasts/Toast.svelte';
|
|
140
140
|
// Tooltips
|
|
141
141
|
export { default as Tooltip } from './tooltips/Tooltip.svelte';
|
|
142
|
+
// utils
|
|
143
|
+
export { default as CloseButton } from './utils/CloseButton.svelte';
|
package/modals/Modal.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from 'svelte';
|
|
2
2
|
import { setContext } from 'svelte';
|
|
3
|
-
import CloseButton from '
|
|
3
|
+
import { CloseButton } from '$lib';
|
|
4
4
|
import focusTrap from '../utils/focusTrap';
|
|
5
5
|
export let open = false;
|
|
6
6
|
export let title = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"npm": ">=7.0.0",
|
|
89
|
-
"node": ">=16.
|
|
89
|
+
"node": ">=16.16.0"
|
|
90
90
|
},
|
|
91
91
|
"contributors": [
|
|
92
92
|
"Zoltán Szőgyényi <zoltan@themesberg.com>",
|
package/toasts/Toast.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
import * as transitions from 'svelte/transition';
|
|
3
|
-
import CloseButton from '
|
|
3
|
+
import { CloseButton } from '$lib';
|
|
4
4
|
export let color = 'blue';
|
|
5
5
|
export let simple = false;
|
|
6
6
|
// Export a prop through which you can set a desired transition
|
package/tooltips/Tooltip.svelte
CHANGED
|
@@ -23,25 +23,12 @@ const arrowStyleClasses = {
|
|
|
23
23
|
custom: tipColor
|
|
24
24
|
};
|
|
25
25
|
let toolTipClass;
|
|
26
|
-
$: toolTipClass = classNames(tipClass, animation !== false && `transition-opacity ${animation}`,
|
|
27
|
-
'invisible opacity-0': !open
|
|
28
|
-
}, tipStyleClasses[style], $$props.class);
|
|
26
|
+
$: toolTipClass = classNames(tipClass, animation !== false && `transition-opacity ${animation}`, !open && 'invisible opacity-0', tipStyleClasses[style], $$props.class);
|
|
29
27
|
let open = false;
|
|
30
|
-
const floatingPlacement = (
|
|
28
|
+
const floatingPlacement = (placement) => {
|
|
31
29
|
return placement === 'auto' ? undefined : placement;
|
|
32
30
|
};
|
|
33
|
-
const
|
|
34
|
-
if (!placement) {
|
|
35
|
-
return 'top';
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
top: 'bottom',
|
|
39
|
-
right: 'left',
|
|
40
|
-
bottom: 'top',
|
|
41
|
-
left: 'right'
|
|
42
|
-
}[placement.split('-')[0]];
|
|
43
|
-
};
|
|
44
|
-
const floatingMiddleware = ({ arrowRef, placement }) => {
|
|
31
|
+
const floatingMiddleware = (arrowRef, placement) => {
|
|
45
32
|
const middleware = [];
|
|
46
33
|
middleware.push(offset(8));
|
|
47
34
|
middleware.push(placement === 'auto' ? autoPlacement() : flip());
|
|
@@ -54,8 +41,8 @@ const floatingMiddleware = ({ arrowRef, placement }) => {
|
|
|
54
41
|
let placementData;
|
|
55
42
|
let tooltipRef, triggerRef, arrowRef;
|
|
56
43
|
const updatePosition = () => computePosition(triggerRef, tooltipRef, {
|
|
57
|
-
middleware: floatingMiddleware(
|
|
58
|
-
placement: floatingPlacement(
|
|
44
|
+
middleware: floatingMiddleware(arrowRef, placement),
|
|
45
|
+
placement: floatingPlacement(placement)
|
|
59
46
|
}).then((data) => (placementData = data));
|
|
60
47
|
let attachedScroll = false;
|
|
61
48
|
$: tooltipRef && open && updatePosition();
|
|
@@ -75,6 +62,24 @@ onDestroy(() => {
|
|
|
75
62
|
window.removeEventListener('scroll', updatePosition, true);
|
|
76
63
|
}
|
|
77
64
|
});
|
|
65
|
+
const arrPos = {
|
|
66
|
+
top: 'bottom',
|
|
67
|
+
right: 'left',
|
|
68
|
+
bottom: 'top',
|
|
69
|
+
left: 'right'
|
|
70
|
+
};
|
|
71
|
+
let floatingArrowPlacement;
|
|
72
|
+
$: {
|
|
73
|
+
if (placementData) {
|
|
74
|
+
const arrow = placementData.middlewareData.arrow;
|
|
75
|
+
const pos = arrPos[placementData?.placement?.split('-')[0]] ?? 'top';
|
|
76
|
+
if (pos === 'top' || pos === 'bottom')
|
|
77
|
+
floatingArrowPlacement = `${pos}: -4px; left: ${px(arrow?.x)}`;
|
|
78
|
+
else
|
|
79
|
+
floatingArrowPlacement = `${pos}: -4px; top: ${px(arrow?.y)}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const px = (x) => (x === undefined ? '' : x + 'px');
|
|
78
83
|
</script>
|
|
79
84
|
|
|
80
85
|
<svelte:window on:resize={() => open && updatePosition()} />
|
|
@@ -112,7 +117,9 @@ onDestroy(() => {
|
|
|
112
117
|
bind:this={tooltipRef}
|
|
113
118
|
data-testid="tooltip"
|
|
114
119
|
class={toolTipClass}
|
|
115
|
-
style={
|
|
120
|
+
style:left={px(placementData?.x)}
|
|
121
|
+
style:top={px(placementData?.y)}
|
|
122
|
+
style:position={placementData?.strategy ?? ''}
|
|
116
123
|
>
|
|
117
124
|
<div class="relative z-20">
|
|
118
125
|
<slot name="content">
|
|
@@ -123,9 +130,7 @@ onDestroy(() => {
|
|
|
123
130
|
<div
|
|
124
131
|
class={classNames('absolute z-10 h-2 w-2 rotate-45', arrowStyleClasses[style])}
|
|
125
132
|
data-testid="tooltip-arrow"
|
|
126
|
-
style={
|
|
127
|
-
placementData?.middlewareData.arrow?.y
|
|
128
|
-
}px;${floatingArrowPlacement({ placement: placementData?.placement })}:-4px`}
|
|
133
|
+
style={floatingArrowPlacement}
|
|
129
134
|
bind:this={arrowRef}
|
|
130
135
|
>
|
|
131
136
|
|
package/utils/OptsButton.svelte
CHANGED