flowbite-svelte 0.22.13 → 0.22.16
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 +31 -0
- package/badges/Badge.svelte +1 -1
- package/badges/Badge.svelte.d.ts +1 -1
- package/buttons/Button.svelte +9 -2
- package/buttons/Button.svelte.d.ts +1 -0
- package/cards/Card.svelte +28 -86
- package/cards/Card.svelte.d.ts +6 -11
- package/cards/EcommerceCard.svelte +37 -77
- package/cards/EcommerceCard.svelte.d.ts +0 -1
- package/cards/SignInCard.svelte +32 -50
- package/forms/Input.svelte +8 -1
- package/forms/Toggle.svelte +2 -10
- package/list-group/List.svelte +1 -1
- package/list-group/ListItem.svelte +1 -1
- package/megamenu/MegaMenu.svelte +1 -10
- package/package.json +2 -1
- package/utils/CloseButton.svelte +3 -3
- package/utils/OptsButton.svelte +18 -0
- package/utils/OptsButton.svelte.d.ts +27 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
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.22.16](https://github.com/themesberg/flowbite-svelte/compare/v0.22.15...v0.22.16) (2022-07-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* cards/index.md, buttons ([9b2ca39](https://github.com/themesberg/flowbite-svelte/commit/9b2ca3914681439e667b5b6026f6c6e22b56b6fd))
|
|
11
|
+
|
|
12
|
+
### [0.22.15](https://github.com/themesberg/flowbite-svelte/compare/v0.22.14...v0.22.15) (2022-07-26)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* cards - re-written ([1084f38](https://github.com/themesberg/flowbite-svelte/commit/1084f38514e4cac5662ae6b969dde27e829ea24e))
|
|
18
|
+
* cards - re-written ([52716e0](https://github.com/themesberg/flowbite-svelte/commit/52716e08ac0f4446e3c7160fc3dc83e515201d7d))
|
|
19
|
+
* cards - wip ([0948c89](https://github.com/themesberg/flowbite-svelte/commit/0948c89a124662b7c5c238350df341e0956dac8a))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* cards layout on index.md pages ([2080f8e](https://github.com/themesberg/flowbite-svelte/commit/2080f8ee29163a8ad5208f37c95ebf498be92c39))
|
|
25
|
+
|
|
26
|
+
### [0.22.14](https://github.com/themesberg/flowbite-svelte/compare/v0.22.13...v0.22.14) (2022-07-25)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* $$restProps before $$props.class ([9378cf5](https://github.com/themesberg/flowbite-svelte/commit/9378cf5349446ec8355317e98e462e379350a697))
|
|
32
|
+
* add padding to w-full ([e1008c9](https://github.com/themesberg/flowbite-svelte/commit/e1008c9620f18b42664059595ae3fe1e421e097b))
|
|
33
|
+
* layout and Toc padding ([6a67345](https://github.com/themesberg/flowbite-svelte/commit/6a6734545429c7228a1bf3cbc58f7e4739dbfe65))
|
|
34
|
+
* various minor fixes ([9ac3296](https://github.com/themesberg/flowbite-svelte/commit/9ac3296635db9e7af2a45cc928477ac15e831dc4))
|
|
35
|
+
|
|
5
36
|
### [0.22.13](https://github.com/themesberg/flowbite-svelte/compare/v0.22.12...v0.22.13) (2022-07-24)
|
|
6
37
|
|
|
7
38
|
### [0.22.12](https://github.com/themesberg/flowbite-svelte/compare/v0.22.11...v0.22.12) (2022-07-24)
|
package/badges/Badge.svelte
CHANGED
package/badges/Badge.svelte.d.ts
CHANGED
package/buttons/Button.svelte
CHANGED
|
@@ -3,6 +3,7 @@ export let pill = false;
|
|
|
3
3
|
export let outline = false;
|
|
4
4
|
export let gradient = false;
|
|
5
5
|
export let size = 'md';
|
|
6
|
+
export let href = undefined;
|
|
6
7
|
export let color = 'blue';
|
|
7
8
|
export let shadow = null;
|
|
8
9
|
const colorClasses = {
|
|
@@ -64,7 +65,13 @@ $: gradientOutlineClass = classNames('inline-flex items-center justify-center',
|
|
|
64
65
|
'transition-all duration-75 ease-in group-hover:bg-opacity-0 group-hover:text-inherit');
|
|
65
66
|
</script>
|
|
66
67
|
|
|
67
|
-
<
|
|
68
|
+
<svelte:element
|
|
69
|
+
this={href ? 'a' : 'button'}
|
|
70
|
+
type={href ? undefined : 'button'}
|
|
71
|
+
{...$$restProps}
|
|
72
|
+
class={buttonClass}
|
|
73
|
+
on:click
|
|
74
|
+
>
|
|
68
75
|
{#if outline && gradient}
|
|
69
76
|
<!-- Trick to prentend outline without using border
|
|
70
77
|
This has a limitation of no supporting transparency as
|
|
@@ -73,4 +80,4 @@ $: gradientOutlineClass = classNames('inline-flex items-center justify-center',
|
|
|
73
80
|
{:else}
|
|
74
81
|
<slot />
|
|
75
82
|
{/if}
|
|
76
|
-
</
|
|
83
|
+
</svelte:element>
|
|
@@ -6,6 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
outline?: boolean;
|
|
7
7
|
gradient?: boolean;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
href?: string;
|
|
9
10
|
color?: 'blue' | 'alternative' | 'dark' | 'light' | 'green' | 'red' | 'yellow' | 'purple';
|
|
10
11
|
shadow?: 'blue' | 'green' | 'cyan' | 'teal' | 'lime' | 'red' | 'pink' | 'purple' | null;
|
|
11
12
|
};
|
package/cards/Card.svelte
CHANGED
|
@@ -1,90 +1,32 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
export let
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
buttonClass +=
|
|
22
|
-
'bg-yellow-700 rounded-lg hover:bg-yellow-800 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
|
|
23
|
-
}
|
|
24
|
-
else if (btnColor === 'green') {
|
|
25
|
-
buttonClass +=
|
|
26
|
-
'bg-green-700 rounded-lg hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
|
|
27
|
-
}
|
|
28
|
-
else if (btnColor === 'indigo') {
|
|
29
|
-
buttonClass +=
|
|
30
|
-
'bg-indigo-700 rounded-lg hover:bg-indigo-800 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
|
|
31
|
-
}
|
|
32
|
-
else if (btnColor === 'purple') {
|
|
33
|
-
buttonClass +=
|
|
34
|
-
'bg-purple-700 rounded-lg hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
|
|
35
|
-
}
|
|
36
|
-
else if (btnColor === 'pink') {
|
|
37
|
-
buttonClass +=
|
|
38
|
-
'bg-pink-700 rounded-lg hover:bg-pink-800 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
buttonClass +=
|
|
42
|
-
'bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
43
|
-
}
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
import { setContext } from 'svelte';
|
|
3
|
+
export let href = undefined;
|
|
4
|
+
export let horizontal = false;
|
|
5
|
+
export let reverse = false;
|
|
6
|
+
export let img = undefined;
|
|
7
|
+
export let padding = 'lg';
|
|
8
|
+
setContext('background', true);
|
|
9
|
+
const paddings = {
|
|
10
|
+
sm: 'p-4',
|
|
11
|
+
md: 'p-5',
|
|
12
|
+
lg: 'p-6',
|
|
13
|
+
xl: 'p-8'
|
|
14
|
+
};
|
|
15
|
+
let innerPdding;
|
|
16
|
+
$: innerPdding = paddings[padding];
|
|
17
|
+
let cardClass;
|
|
18
|
+
$: cardClass = classNames('block max-w-sm', 'flex', 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
|
+
let imgClass;
|
|
20
|
+
$: 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'));
|
|
44
21
|
</script>
|
|
45
22
|
|
|
46
|
-
<
|
|
23
|
+
<svelte:element this={href ? 'a' : 'div'} {href} class={cardClass}>
|
|
47
24
|
{#if img}
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{/if}
|
|
25
|
+
<img class={imgClass} src={img} alt="" />
|
|
26
|
+
<div class={innerPdding}>
|
|
27
|
+
<slot />
|
|
28
|
+
</div>
|
|
29
|
+
{:else}
|
|
30
|
+
<div><slot /></div>
|
|
55
31
|
{/if}
|
|
56
|
-
|
|
57
|
-
{#if header}
|
|
58
|
-
{#if link}
|
|
59
|
-
<a href={link} {rel}>
|
|
60
|
-
<h3 class={headerClass}>
|
|
61
|
-
{header}
|
|
62
|
-
</h3>
|
|
63
|
-
</a>
|
|
64
|
-
{:else}
|
|
65
|
-
<h3 class={headerClass}>
|
|
66
|
-
{header}
|
|
67
|
-
</h3>
|
|
68
|
-
{/if}
|
|
69
|
-
{/if}
|
|
70
|
-
{#if $$slots.paragraph}
|
|
71
|
-
<slot name="paragraph" />
|
|
72
|
-
{/if}
|
|
73
|
-
{#if link && btnLabel}
|
|
74
|
-
<a href={link} {rel} class={buttonClass}>
|
|
75
|
-
{btnLabel}
|
|
76
|
-
<svg
|
|
77
|
-
class="ml-2 -mr-1 w-4 h-4"
|
|
78
|
-
fill="currentColor"
|
|
79
|
-
viewBox="0 0 20 20"
|
|
80
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
81
|
-
><path
|
|
82
|
-
fill-rule="evenodd"
|
|
83
|
-
d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z"
|
|
84
|
-
clip-rule="evenodd"
|
|
85
|
-
/></svg
|
|
86
|
-
>
|
|
87
|
-
</a>
|
|
88
|
-
{/if}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
32
|
+
</svelte:element>
|
package/cards/Card.svelte.d.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Colors } from '../types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
href?: string;
|
|
6
|
+
horizontal?: boolean;
|
|
7
|
+
reverse?: boolean;
|
|
8
8
|
img?: string;
|
|
9
|
-
|
|
10
|
-
btnColor?: Colors;
|
|
11
|
-
textdivClass?: string;
|
|
12
|
-
headerClass?: string;
|
|
13
|
-
header?: string;
|
|
14
|
-
divClass?: string;
|
|
9
|
+
padding?: 'sm' | 'md' | 'lg';
|
|
15
10
|
};
|
|
16
11
|
events: {
|
|
17
12
|
[evt: string]: CustomEvent<any>;
|
|
18
13
|
};
|
|
19
14
|
slots: {
|
|
20
|
-
|
|
15
|
+
default: {};
|
|
21
16
|
};
|
|
22
17
|
};
|
|
23
18
|
export declare type CardProps = typeof __propDef.props;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import Badge from '../badges/Badge.svelte';
|
|
2
|
+
import Rating from '../ratings/Rating.svelte';
|
|
3
|
+
import Card from './Card.svelte';
|
|
4
|
+
export let img;
|
|
2
5
|
export let href = '/';
|
|
3
6
|
export let btnColor = 'blue';
|
|
4
7
|
export let rel = '';
|
|
@@ -7,86 +10,43 @@ export let stars = 0;
|
|
|
7
10
|
export let price = '';
|
|
8
11
|
export let btnText = '';
|
|
9
12
|
export let headerClass = 'text-xl font-semibold tracking-tight text-gray-900 dark:text-white';
|
|
10
|
-
export let divClass = 'max-w-sm bg-white rounded-lg shadow-md dark:bg-gray-800 dark:border-gray-700';
|
|
11
13
|
export let priceClass = 'text-3xl font-bold text-gray-900 dark:text-white';
|
|
12
|
-
let spanClass = 'text-xs font-semibold mr-2
|
|
14
|
+
let spanClass = 'flex items-center text-xs font-semibold mr-2 py-0.5 rounded';
|
|
13
15
|
let linkClass = 'text-white focus:ring-4 font-medium rounded-lg text-sm px-5 py-2.5 text-center ';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
else if (btnColor === 'yellow') {
|
|
25
|
-
spanClass += 'bg-yellow-100 text-yellow-800 dark:bg-yellow-200 dark:text-yellow-800';
|
|
26
|
-
linkClass +=
|
|
27
|
-
'bg-yellow-700 hover:bg-yellow-800 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
|
|
28
|
-
}
|
|
29
|
-
else if (btnColor === 'green') {
|
|
30
|
-
spanClass += 'bg-green-100 text-green-800 dark:bg-green-200 dark:text-green-800';
|
|
31
|
-
linkClass +=
|
|
32
|
-
'bg-green-700 hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
|
|
33
|
-
}
|
|
34
|
-
else if (btnColor === 'indigo') {
|
|
35
|
-
spanClass += 'bg-indigo-100 text-indigo-800 dark:bg-indigo-200 dark:text-indigo-800';
|
|
36
|
-
linkClass +=
|
|
37
|
-
'bg-indigo-700 hover:bg-indigo-800 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
|
|
38
|
-
}
|
|
39
|
-
else if (btnColor === 'purple') {
|
|
40
|
-
spanClass += 'bg-purple-100 text-purple-800 dark:bg-purple-200 dark:text-purple-800';
|
|
41
|
-
linkClass +=
|
|
42
|
-
'bg-purple-700 hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
|
|
43
|
-
}
|
|
44
|
-
else if (btnColor === 'pink') {
|
|
45
|
-
spanClass += 'bg-pink-100 text-pink-800 dark:bg-pink-200 dark:text-pink-800';
|
|
46
|
-
linkClass +=
|
|
47
|
-
'bg-pink-700 hover:bg-pink-800 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
spanClass += 'bg-blue-100 text-blue-800 dark:bg-blue-200 dark:text-blue-800';
|
|
51
|
-
linkClass +=
|
|
52
|
-
'bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
53
|
-
}
|
|
16
|
+
const linkColors = {
|
|
17
|
+
gray: 'bg-gray-700 hover:bg-gray-800 focus:ring-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800',
|
|
18
|
+
red: 'bg-red-700 hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800',
|
|
19
|
+
yellow: 'bg-yellow-700 hover:bg-yellow-800 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800',
|
|
20
|
+
green: 'bg-green-700 hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800',
|
|
21
|
+
indigo: 'bg-indigo-700 hover:bg-indigo-800 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800',
|
|
22
|
+
purple: 'bg-purple-700 hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800',
|
|
23
|
+
pink: 'bg-pink-700 hover:bg-pink-800 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800',
|
|
24
|
+
blue: 'bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800'
|
|
25
|
+
};
|
|
54
26
|
</script>
|
|
55
27
|
|
|
56
|
-
<
|
|
28
|
+
<Card padding="sm">
|
|
57
29
|
<a {href} {rel}>
|
|
58
|
-
<img class="p-
|
|
30
|
+
<img class="p-3 rounded-t-lg" src={img.src} alt={img.alt} />
|
|
59
31
|
</a>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<span class={spanClass}>{stars}</span>
|
|
80
|
-
{/if}
|
|
81
|
-
</div>
|
|
82
|
-
<slot />
|
|
83
|
-
<div class="flex justify-between items-center">
|
|
84
|
-
{#if price}
|
|
85
|
-
<span class={priceClass}>{price}</span>
|
|
86
|
-
{/if}
|
|
87
|
-
{#if btnText}
|
|
88
|
-
<a {href} {rel} class={linkClass}>{btnText}</a>
|
|
89
|
-
{/if}
|
|
90
|
-
</div>
|
|
32
|
+
|
|
33
|
+
<a {href} {rel}>
|
|
34
|
+
<h3 class={headerClass}>
|
|
35
|
+
{title}
|
|
36
|
+
</h3>
|
|
37
|
+
</a>
|
|
38
|
+
{#if stars}
|
|
39
|
+
<Rating rating={stars} divClass={spanClass}>
|
|
40
|
+
<Badge slot="text" color={btnColor}>5</Badge>
|
|
41
|
+
</Rating>
|
|
42
|
+
{/if}
|
|
43
|
+
<slot />
|
|
44
|
+
<div class="flex justify-between items-center">
|
|
45
|
+
{#if price}
|
|
46
|
+
<span class={priceClass}>{price}</span>
|
|
47
|
+
{/if}
|
|
48
|
+
{#if btnText}
|
|
49
|
+
<a {href} {rel} class="{linkClass} {linkColors[btnColor]}">{btnText}</a>
|
|
50
|
+
{/if}
|
|
91
51
|
</div>
|
|
92
|
-
</
|
|
52
|
+
</Card>
|
package/cards/SignInCard.svelte
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
<script>import Alert from '../alerts/Alert.svelte';
|
|
2
|
+
import Button from '../buttons/Button.svelte';
|
|
3
|
+
import Input from '../forms/Input.svelte';
|
|
4
|
+
import Card from './Card.svelte';
|
|
5
|
+
import Label from '../forms/Label.svelte';
|
|
6
|
+
import Checkbox from '../forms/Checkbox.svelte';
|
|
2
7
|
export let login;
|
|
3
8
|
export let title = 'Sign in';
|
|
4
9
|
export let btnSignInColor = 'blue';
|
|
@@ -8,60 +13,33 @@ export let lostPassword;
|
|
|
8
13
|
let email;
|
|
9
14
|
let password;
|
|
10
15
|
let error;
|
|
11
|
-
let submitClass = 'w-full text-white focus:ring-4 font-medium rounded-lg text-sm px-5 py-2.5 text-center ';
|
|
12
|
-
if (btnSignInColor === 'blue') {
|
|
13
|
-
submitClass += 'bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
14
|
-
}
|
|
15
|
-
else if (btnSignInColor === 'gray') {
|
|
16
|
-
submitClass += 'bg-gray-700 hover:bg-gray-800 focus:ring-gray-300 dark:bg-gray-600 dark:hover:bg-gray-700 dark:focus:ring-gray-800';
|
|
17
|
-
}
|
|
18
|
-
else if (btnSignInColor === 'red') {
|
|
19
|
-
submitClass += 'bg-red-700 hover:bg-red-800 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800';
|
|
20
|
-
}
|
|
21
|
-
else if (btnSignInColor === 'yellow') {
|
|
22
|
-
submitClass += 'bg-yellow-700 hover:bg-yellow-800 focus:ring-yellow-300 dark:bg-yellow-600 dark:hover:bg-yellow-700 dark:focus:ring-yellow-800';
|
|
23
|
-
}
|
|
24
|
-
else if (btnSignInColor === 'green') {
|
|
25
|
-
submitClass += 'bg-green-700 hover:bg-green-800 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
|
|
26
|
-
}
|
|
27
|
-
else if (btnSignInColor === 'indigo') {
|
|
28
|
-
submitClass += 'bg-indigo-700 hover:bg-indigo-800 focus:ring-indigo-300 dark:bg-indigo-600 dark:hover:bg-indigo-700 dark:focus:ring-indigo-800';
|
|
29
|
-
}
|
|
30
|
-
else if (btnSignInColor === 'purple') {
|
|
31
|
-
submitClass += 'bg-purple-700 hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-800';
|
|
32
|
-
}
|
|
33
|
-
else if (btnSignInColor === 'pink') {
|
|
34
|
-
submitClass += 'bg-pink-700 hover:bg-pink-800 focus:ring-pink-300 dark:bg-pink-600 dark:hover:bg-pink-700 dark:focus:ring-pink-800';
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
submitClass += 'bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
38
|
-
}
|
|
39
16
|
</script>
|
|
40
17
|
|
|
41
|
-
<
|
|
42
|
-
<form class="space-y-6" on:submit|preventDefault={login}>
|
|
18
|
+
<Card>
|
|
19
|
+
<form class="flex flex-col space-y-6" on:submit|preventDefault={login}>
|
|
43
20
|
<h3 class="text-xl font-medium text-gray-900 dark:text-white">{title}</h3>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
|
|
22
|
+
<Label class="space-y-2">
|
|
23
|
+
<span>Email</span>
|
|
24
|
+
<Input type="email" name="email" bind:value={email} placeholder="name@company.com" required />
|
|
25
|
+
</Label>
|
|
26
|
+
|
|
27
|
+
<Label class="space-y-2">
|
|
28
|
+
<span>Your password</span>
|
|
29
|
+
<Input type="password" name="password" placeholder="•••••" bind:value={password} required />
|
|
30
|
+
</Label>
|
|
31
|
+
|
|
52
32
|
<div class="flex items-start">
|
|
53
33
|
{#if rememberMe}
|
|
54
|
-
<
|
|
55
|
-
<div class="flex items-center h-5">
|
|
56
|
-
<input id="remember" aria-describedby="remember" type="checkbox" class="w-4 h-4 bg-gray-50 rounded border border-gray-300 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" />
|
|
57
|
-
</div>
|
|
58
|
-
<div class="ml-3 text-sm">
|
|
59
|
-
<label for="remember" class="font-medium text-gray-900 dark:text-gray-300">Remember me</label>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
34
|
+
<Checkbox>Remember me</Checkbox>
|
|
62
35
|
{/if}
|
|
63
36
|
{#if lostPassword}
|
|
64
|
-
<a
|
|
37
|
+
<a
|
|
38
|
+
href={lostPassword.href}
|
|
39
|
+
rel={lostPassword.rel}
|
|
40
|
+
class="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500"
|
|
41
|
+
>{lostPassword.name}</a
|
|
42
|
+
>
|
|
65
43
|
{/if}
|
|
66
44
|
</div>
|
|
67
45
|
{#if error}
|
|
@@ -71,11 +49,15 @@ else {
|
|
|
71
49
|
</Alert>
|
|
72
50
|
</div>
|
|
73
51
|
{/if}
|
|
74
|
-
<
|
|
52
|
+
<Button type="submit" color={btnSignInColor} class="w-full1">Login to your account</Button>
|
|
75
53
|
{#if signup}
|
|
76
54
|
<div class="text-sm font-medium text-gray-500 dark:text-gray-300">
|
|
77
|
-
Not registered? <a
|
|
55
|
+
Not registered? <a
|
|
56
|
+
href={signup.href}
|
|
57
|
+
rel={signup.rel}
|
|
58
|
+
class="text-blue-700 hover:underline dark:text-blue-500">{signup.name}</a
|
|
59
|
+
>
|
|
78
60
|
</div>
|
|
79
61
|
{/if}
|
|
80
62
|
</form>
|
|
81
|
-
</
|
|
63
|
+
</Card>
|
package/forms/Input.svelte
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
|
+
import { getContext } from 'svelte';
|
|
2
3
|
export let type = 'text';
|
|
3
4
|
export let value = '';
|
|
4
5
|
export let size = 'md';
|
|
5
6
|
export let inputClass = 'block w-full border disabled:cursor-not-allowed disabled:opacity-50 rounded-lg';
|
|
6
7
|
export let color = 'base';
|
|
7
8
|
const colorClasses = {
|
|
8
|
-
base: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:
|
|
9
|
+
base: 'bg-gray-50 border-gray-300 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500',
|
|
9
10
|
green: 'border-green-500 bg-green-50 text-green-900 placeholder-green-700 focus:border-green-500 focus:ring-green-500 dark:border-green-400 dark:bg-green-100 dark:focus:border-green-500 dark:focus:ring-green-500',
|
|
10
11
|
red: 'border-red-500 bg-red-50 text-red-900 placeholder-red-700 focus:border-red-500 focus:ring-red-500 dark:border-red-400 dark:bg-red-100 dark:focus:border-red-500 dark:focus:ring-red-500'
|
|
11
12
|
};
|
|
12
13
|
export let ref = null;
|
|
14
|
+
// tinted if put in component having its own background
|
|
15
|
+
let background = getContext('background');
|
|
13
16
|
// you need to this to avoid 2-way binding
|
|
14
17
|
function setType(node) {
|
|
15
18
|
node.type = type;
|
|
@@ -25,6 +28,10 @@ function setType(node) {
|
|
|
25
28
|
class={classNames(
|
|
26
29
|
inputClass,
|
|
27
30
|
colorClasses[color],
|
|
31
|
+
color === 'base' &&
|
|
32
|
+
(background
|
|
33
|
+
? 'dark:bg-gray-600 dark:border-gray-500'
|
|
34
|
+
: 'dark:bg-gray-700 dark:border-gray-600'),
|
|
28
35
|
{
|
|
29
36
|
'p-2 sm:text-xs': size === 'sm',
|
|
30
37
|
'p-2.5 text-sm': size === 'md',
|
package/forms/Toggle.svelte
CHANGED
|
@@ -23,18 +23,10 @@ const sizes = {
|
|
|
23
23
|
large: 'w-14 h-7 after:top-0.5 after:left-[4px] after:h-6 after:w-6'
|
|
24
24
|
};
|
|
25
25
|
let divClass;
|
|
26
|
-
$: divClass = classNames(common, background ? 'dark:bg-gray-600 dark:border-gray-500' : 'dark:bg-gray-700 dark:border-gray-600', colors[$$restProps.color ?? 'blue'], sizes[size]);
|
|
26
|
+
$: divClass = classNames(common, background ? 'dark:bg-gray-600 dark:border-gray-500' : 'dark:bg-gray-700 dark:border-gray-600', colors[$$restProps.color ?? 'blue'], sizes[size], 'relative');
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
|
-
<Checkbox
|
|
30
|
-
custom
|
|
31
|
-
class="relative {$$props.class}"
|
|
32
|
-
{value}
|
|
33
|
-
bind:checked
|
|
34
|
-
bind:group
|
|
35
|
-
{...$$restProps}
|
|
36
|
-
on:click
|
|
37
|
-
>
|
|
29
|
+
<Checkbox custom {...$$restProps} class={$$props.class} {value} bind:checked bind:group on:click>
|
|
38
30
|
<div class={divClass} />
|
|
39
31
|
<slot />
|
|
40
32
|
</Checkbox>
|
package/list-group/List.svelte
CHANGED
|
@@ -6,7 +6,7 @@ export let active = false;
|
|
|
6
6
|
setContext('background', true);
|
|
7
7
|
$: setContext('active', active);
|
|
8
8
|
let groupClass;
|
|
9
|
-
$: groupClass = classNames('rounded-lg border border-gray-200 dark:border-gray-600', 'divide-y divide-gray-200 dark:divide-gray-600', $$props.class);
|
|
9
|
+
$: groupClass = classNames('text-gray-900 bg-white dark:text-gray-200 dark:bg-gray-700', 'rounded-lg border border-gray-200 dark:border-gray-600', 'divide-y divide-gray-200 dark:divide-gray-600', $$props.class);
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<svelte:element this={active ? 'div' : 'ul'} class={groupClass}>
|
|
@@ -8,7 +8,7 @@ export let href = '';
|
|
|
8
8
|
let dispatch = createEventDispatcher();
|
|
9
9
|
const states = {
|
|
10
10
|
current: 'text-white bg-blue-700 dark:text-white dark:bg-gray-800',
|
|
11
|
-
normal: '
|
|
11
|
+
normal: '',
|
|
12
12
|
disabled: 'text-gray-900 bg-gray-100 dark:bg-gray-600 dark:text-gray-400'
|
|
13
13
|
};
|
|
14
14
|
let focusClass = 'focus:z-40 focus:outline-none focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:focus:ring-gray-500 dark:focus:text-white';
|
package/megamenu/MegaMenu.svelte
CHANGED
|
@@ -12,18 +12,9 @@ function init(node) {
|
|
|
12
12
|
node.parentElement.classList.add('inset-x-0');
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
let wrapper;
|
|
16
|
-
afterUpdate(() => {
|
|
17
|
-
if (wrapper) {
|
|
18
|
-
const width = wrapper.getBoundingClientRect();
|
|
19
|
-
// wrapper.style.marginLeft = '-50%';
|
|
20
|
-
// console.log('after', width);
|
|
21
|
-
// console.log(wrapper.clientWidth);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
15
|
</script>
|
|
25
16
|
|
|
26
|
-
<div class={wrapperClass} use:init
|
|
17
|
+
<div class={wrapperClass} use:init>
|
|
27
18
|
<div class="flex flex-col md:flex-row p-4 max-w-screen-xl justify-center mx-auto">
|
|
28
19
|
<ul class={ulClass}>
|
|
29
20
|
{#each items as item, index}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.16",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"./tooltips/Tooltip.svelte": "./tooltips/Tooltip.svelte",
|
|
234
234
|
"./types": "./types.js",
|
|
235
235
|
"./utils/CloseButton.svelte": "./utils/CloseButton.svelte",
|
|
236
|
+
"./utils/OptsButton.svelte": "./utils/OptsButton.svelte",
|
|
236
237
|
"./utils/clickOutside": "./utils/clickOutside.js",
|
|
237
238
|
"./utils/generateId": "./utils/generateId.js"
|
|
238
239
|
},
|
package/utils/CloseButton.svelte
CHANGED
|
@@ -12,14 +12,14 @@ const colors = {
|
|
|
12
12
|
default: 'focus:ring-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'
|
|
13
13
|
};
|
|
14
14
|
let buttonClass = '';
|
|
15
|
-
$: buttonClass = classNames('ml-auto -mx-1 -my-1.5 rounded-lg focus:ring-2 p-1.5
|
|
15
|
+
$: buttonClass = classNames('ml-auto -mx-1 -my-1.5 rounded-lg focus:ring-2 p-1.5 focus:outline-none', colors[color], $$props.class);
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<button on:click type="button" class={buttonClass} aria-label="Close">
|
|
19
19
|
<slot>
|
|
20
20
|
<span class="sr-only">Close</span>
|
|
21
|
-
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
|
|
22
|
-
|
|
21
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
+
<path
|
|
23
23
|
fill-rule="evenodd"
|
|
24
24
|
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"
|
|
25
25
|
clip-rule="evenodd"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import CloseButton from './CloseButton.svelte';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<CloseButton on:click {...$$props}>
|
|
6
|
+
<span class="sr-only">Open options</span>
|
|
7
|
+
<svg
|
|
8
|
+
class="w-6 h-6"
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
viewBox="0 0 20 20"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
</CloseButton>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} OptsButtonProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} OptsButtonEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} OptsButtonSlots */
|
|
4
|
+
export default class OptsButton extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
click: MouseEvent;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
}, {}> {
|
|
11
|
+
}
|
|
12
|
+
export type OptsButtonProps = typeof __propDef.props;
|
|
13
|
+
export type OptsButtonEvents = typeof __propDef.events;
|
|
14
|
+
export type OptsButtonSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
click: MouseEvent;
|
|
22
|
+
} & {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {};
|
|
26
|
+
};
|
|
27
|
+
export {};
|