flowbite-svelte 0.10.11 → 0.11.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/avatar/Avatar.svelte +40 -0
- package/avatar/Avatar.svelte.d.ts +19 -0
- package/buttons/GradientOutlineButton.svelte +1 -1
- package/index.d.ts +2 -0
- package/index.js +7 -1
- package/package.json +3 -1
- package/toasts/Toast.svelte +84 -0
- package/toasts/Toast.svelte.d.ts +25 -0
- package/types.d.ts +10 -0
- package/types.js +0 -7
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script >export let avatar = {
|
|
2
|
+
src: '/',
|
|
3
|
+
alt: '',
|
|
4
|
+
size: 8,
|
|
5
|
+
border: false,
|
|
6
|
+
round: false,
|
|
7
|
+
header: '',
|
|
8
|
+
text: ''
|
|
9
|
+
};
|
|
10
|
+
let isCircle = avatar.round ? 'rounded-full' : 'rounded';
|
|
11
|
+
let isBorder = avatar.border ? 'p-1 ring-2 ring-gray-300 dark:ring-gray-500' : '';
|
|
12
|
+
export let avatarClass = `w-${avatar.size} h-${avatar.size} ${isCircle} ${isBorder}`;
|
|
13
|
+
export let placehoder = false;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
{#if placehoder}
|
|
17
|
+
<div class="relative w-10 h-10 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
|
|
18
|
+
<svg
|
|
19
|
+
class="absolute w-12 h-12 text-gray-400 -left-1"
|
|
20
|
+
fill="currentColor"
|
|
21
|
+
viewBox="0 0 20 20"
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
><path
|
|
24
|
+
fill-rule="evenodd"
|
|
25
|
+
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
26
|
+
clip-rule="evenodd"
|
|
27
|
+
/></svg
|
|
28
|
+
>
|
|
29
|
+
</div>
|
|
30
|
+
{:else if avatar.header && avatar.text}
|
|
31
|
+
<div class="flex items-center space-x-4">
|
|
32
|
+
<img class="class={avatarClass}" alt={avatar.alt} src={avatar.src} />
|
|
33
|
+
<div class="space-y-1 font-medium dark:text-white">
|
|
34
|
+
<div>{avatar.header}</div>
|
|
35
|
+
<div class="text-sm text-gray-500 dark:text-gray-400">{avatar.text}</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
{:else}
|
|
39
|
+
<img class={avatarClass} alt={avatar.alt} src={avatar.src} />
|
|
40
|
+
{/if}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { AvatarType } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
avatar?: AvatarType;
|
|
6
|
+
avatarClass?: string;
|
|
7
|
+
placehoder?: boolean;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export declare type AvatarProps = typeof __propDef.props;
|
|
15
|
+
export declare type AvatarEvents = typeof __propDef.events;
|
|
16
|
+
export declare type AvatarSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Avatar extends SvelteComponentTyped<AvatarProps, AvatarEvents, AvatarSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -10,7 +10,7 @@ if (color === 'purple2blue') {
|
|
|
10
10
|
'relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0';
|
|
11
11
|
}
|
|
12
12
|
else if (color === 'cyan2blue') {
|
|
13
|
-
btnClass = `relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden ${textSize} font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-cyan-500 to-blue-500 group-hover:from-cyan-500 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:ring-cyan-200 dark:focus:ring-cyan-800`;
|
|
13
|
+
btnClass = `relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden ${textSize} font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-cyan-500 to-blue-500 group-hover:from-cyan-500 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-cyan-200 dark:focus:ring-cyan-800`;
|
|
14
14
|
spanClass =
|
|
15
15
|
'relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0';
|
|
16
16
|
}
|
package/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as ForgotPassword } from "./auth/ForgotPassword.svelte";
|
|
|
8
8
|
export { default as Login } from "./auth/Login.svelte";
|
|
9
9
|
export { default as Register } from "./auth/Register.svelte";
|
|
10
10
|
export { default as Reset } from "./auth/Reset.svelte";
|
|
11
|
+
export { default as Avatar } from "./avatar/Avatar.svelte";
|
|
11
12
|
export { default as Badge } from "./badges/Badge.svelte";
|
|
12
13
|
export { default as BadgeIcon } from "./badges/BadgeIcon.svelte";
|
|
13
14
|
export { default as BadgeLink } from "./badges/BadgeLink.svelte";
|
|
@@ -56,5 +57,6 @@ export { default as SpinnerButton } from "./spinners/SpinnerButton.svelte";
|
|
|
56
57
|
export { default as InteractiveTabs } from "./tabs/InteractiveTabs.svelte";
|
|
57
58
|
export { default as DefaultTabs } from "./tabs/DefaultTabs.svelte";
|
|
58
59
|
export { default as PillTabs } from "./tabs/PillTabs.svelte";
|
|
60
|
+
export { default as Toast } from "./toasts/Toast.svelte";
|
|
59
61
|
export { default as Tooltip } from "./tooltips/Tooltip.svelte";
|
|
60
62
|
export { default as LightTooltip } from "./tooltips/LightTooltip.svelte";
|
package/index.js
CHANGED
|
@@ -12,7 +12,10 @@ export { default as Confirm } from'./auth/Confirm.svelte'
|
|
|
12
12
|
export { default as ForgotPassword } from'./auth/ForgotPassword.svelte'
|
|
13
13
|
export { default as Login } from'./auth/Login.svelte'
|
|
14
14
|
export { default as Register } from'./auth/Register.svelte'
|
|
15
|
-
export { default as Reset } from'./auth/Reset.svelte'
|
|
15
|
+
export { default as Reset } from './auth/Reset.svelte'
|
|
16
|
+
|
|
17
|
+
// Avatar
|
|
18
|
+
export { default as Avatar } from './avatar/Avatar.svelte'
|
|
16
19
|
|
|
17
20
|
// Badges
|
|
18
21
|
export { default as Badge } from'./badges/Badge.svelte'
|
|
@@ -88,6 +91,9 @@ export { default as InteractiveTabs } from'./tabs/InteractiveTabs.svelte'
|
|
|
88
91
|
export { default as DefaultTabs } from'./tabs/DefaultTabs.svelte'
|
|
89
92
|
export { default as PillTabs } from'./tabs/PillTabs.svelte'
|
|
90
93
|
|
|
94
|
+
// Toast
|
|
95
|
+
export { default as Toast } from './toasts/Toast.svelte'
|
|
96
|
+
|
|
91
97
|
// Tooltips
|
|
92
98
|
export { default as Tooltip } from'./tooltips/Tooltip.svelte'
|
|
93
99
|
export { default as LightTooltip } from'./tooltips/LightTooltip.svelte'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Shinichi Okada",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"./auth/Login.svelte": "./auth/Login.svelte",
|
|
81
81
|
"./auth/Register.svelte": "./auth/Register.svelte",
|
|
82
82
|
"./auth/Reset.svelte": "./auth/Reset.svelte",
|
|
83
|
+
"./avatar/Avatar.svelte": "./avatar/Avatar.svelte",
|
|
83
84
|
"./badges/Badge.svelte": "./badges/Badge.svelte",
|
|
84
85
|
"./badges/BadgeIcon.svelte": "./badges/BadgeIcon.svelte",
|
|
85
86
|
"./badges/BadgeLink.svelte": "./badges/BadgeLink.svelte",
|
|
@@ -130,6 +131,7 @@
|
|
|
130
131
|
"./tabs/DefaultTabs.svelte": "./tabs/DefaultTabs.svelte",
|
|
131
132
|
"./tabs/InteractiveTabs.svelte": "./tabs/InteractiveTabs.svelte",
|
|
132
133
|
"./tabs/PillTabs.svelte": "./tabs/PillTabs.svelte",
|
|
134
|
+
"./toasts/Toast.svelte": "./toasts/Toast.svelte",
|
|
133
135
|
"./tooltips/LightTooltip.svelte": "./tooltips/LightTooltip.svelte",
|
|
134
136
|
"./tooltips/Tooltip.svelte": "./tooltips/Tooltip.svelte",
|
|
135
137
|
"./types": "./types.js"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script >import { fade, blur, fly, slide } from 'svelte/transition';
|
|
2
|
+
import { quintOut } from 'svelte/easing';
|
|
3
|
+
let visible = true;
|
|
4
|
+
const handleHide = () => {
|
|
5
|
+
visible = !visible;
|
|
6
|
+
};
|
|
7
|
+
export let iconColor = 'blue';
|
|
8
|
+
// Export a prop through which you can set a desired transition
|
|
9
|
+
export let transitionType = 'fade';
|
|
10
|
+
// Pass in params
|
|
11
|
+
export let transitionParams = {};
|
|
12
|
+
let iconDivClass;
|
|
13
|
+
export let divClass = 'flex items-center w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800';
|
|
14
|
+
export let textClass = 'ml-3 text-sm font-normal';
|
|
15
|
+
export let btnClass = 'ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700';
|
|
16
|
+
if (iconColor === 'blue') {
|
|
17
|
+
iconDivClass =
|
|
18
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:bg-blue-800 dark:text-blue-200';
|
|
19
|
+
}
|
|
20
|
+
else if (iconColor === 'green') {
|
|
21
|
+
iconDivClass =
|
|
22
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200';
|
|
23
|
+
}
|
|
24
|
+
else if (iconColor === 'red') {
|
|
25
|
+
iconDivClass =
|
|
26
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-red-500 bg-red-100 rounded-lg dark:bg-red-800 dark:text-red-200';
|
|
27
|
+
}
|
|
28
|
+
else if (iconColor === 'gray') {
|
|
29
|
+
iconDivClass =
|
|
30
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-gray-500 bg-gray-100 rounded-lg dark:bg-gray-800 dark:text-gray-200';
|
|
31
|
+
}
|
|
32
|
+
else if (iconColor === 'purple') {
|
|
33
|
+
iconDivClass =
|
|
34
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-purple-500 bg-purple-100 rounded-lg dark:bg-purple-800 dark:text-purple-200';
|
|
35
|
+
}
|
|
36
|
+
else if (iconColor === 'indigo') {
|
|
37
|
+
iconDivClass =
|
|
38
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-indigo-500 bg-indigo-100 rounded-lg dark:bg-indigo-800 dark:text-indigo-200';
|
|
39
|
+
}
|
|
40
|
+
else if (iconColor === 'yellow') {
|
|
41
|
+
iconDivClass =
|
|
42
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-yellow-500 bg-yellow-100 rounded-lg dark:bg-yellow-800 dark:text-yellow-200';
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
iconDivClass =
|
|
46
|
+
'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:bg-blue-800 dark:text-blue-200';
|
|
47
|
+
}
|
|
48
|
+
// have a custom transition function that returns the desired transition
|
|
49
|
+
function multiple(node, params) {
|
|
50
|
+
switch (transitionType) {
|
|
51
|
+
case 'slide':
|
|
52
|
+
return slide(node, params);
|
|
53
|
+
case 'blur':
|
|
54
|
+
return blur(node, params);
|
|
55
|
+
case 'fly':
|
|
56
|
+
return fly(node, params);
|
|
57
|
+
case 'fade':
|
|
58
|
+
return fade(node, params);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
{#if visible}
|
|
64
|
+
<div transition:multiple={transitionParams} class={divClass} role="alert">
|
|
65
|
+
<div class={iconDivClass}>
|
|
66
|
+
<slot name="icon" />
|
|
67
|
+
</div>
|
|
68
|
+
<div class={textClass}><slot name="text" /></div>
|
|
69
|
+
<button type="button" class={btnClass} on:click={handleHide} aria-label="Close">
|
|
70
|
+
<span class="sr-only">Close</span>
|
|
71
|
+
<svg
|
|
72
|
+
class="w-5 h-5"
|
|
73
|
+
fill="currentColor"
|
|
74
|
+
viewBox="0 0 20 20"
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
><path
|
|
77
|
+
fill-rule="evenodd"
|
|
78
|
+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
|
79
|
+
clip-rule="evenodd"
|
|
80
|
+
/></svg
|
|
81
|
+
>
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
{/if}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Colors, TransitionTypes } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
iconColor?: Colors;
|
|
6
|
+
transitionType?: TransitionTypes;
|
|
7
|
+
transitionParams?: {};
|
|
8
|
+
divClass?: string;
|
|
9
|
+
textClass?: string;
|
|
10
|
+
btnClass?: string;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
icon: {};
|
|
17
|
+
text: {};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare type ToastProps = typeof __propDef.props;
|
|
21
|
+
export declare type ToastEvents = typeof __propDef.events;
|
|
22
|
+
export declare type ToastSlots = typeof __propDef.slots;
|
|
23
|
+
export default class Toast extends SvelteComponentTyped<ToastProps, ToastEvents, ToastSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/types.d.ts
CHANGED
|
@@ -87,3 +87,13 @@ export declare type SelectOptionType = {
|
|
|
87
87
|
name: string;
|
|
88
88
|
value: string;
|
|
89
89
|
};
|
|
90
|
+
export interface AvatarType {
|
|
91
|
+
src?: string;
|
|
92
|
+
alt?: string;
|
|
93
|
+
size?: 6 | 8 | 12 | 16 | 24 | 48;
|
|
94
|
+
border?: boolean;
|
|
95
|
+
round?: boolean;
|
|
96
|
+
header?: string;
|
|
97
|
+
text?: string;
|
|
98
|
+
}
|
|
99
|
+
export declare type TransitionTypes = 'fade' | 'fly' | 'slide' | 'blur';
|