flowbite-svelte 0.15.22 → 0.15.26
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 +32 -0
- package/alerts/Alert.svelte +72 -99
- package/alerts/Alert.svelte.d.ts +8 -4
- package/badges/Badge.svelte +10 -13
- package/badges/BadgeIcon.svelte +10 -13
- package/badges/BadgeLink.svelte +10 -13
- package/buttongroups/ButtonGroup.svelte +7 -6
- package/buttongroups/ButtonGroupOutline.svelte +7 -6
- package/buttons/Button.svelte +13 -13
- package/buttons/ColorShadowButton.svelte +10 -13
- package/buttons/GradientDuotoneButton.svelte +9 -12
- package/buttons/GradientMonochromeButton.svelte +10 -13
- package/buttons/GradientOutlineButton.svelte +10 -21
- package/cards/Card.svelte +10 -13
- package/cards/CtaCard.svelte +9 -12
- package/cards/EcommerceCard.svelte +19 -23
- package/cards/InteractiveCard.svelte +10 -13
- package/cards/SignInCard.svelte +10 -10
- package/dropdowns/DropdownDefault.svelte +15 -19
- package/forms/Checkbox.svelte +8 -8
- package/forms/Input.svelte +5 -3
- package/forms/RadioItem.svelte +8 -8
- package/forms/Range.svelte +4 -4
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +2 -4
- package/alerts/BorderAlert.svelte +0 -79
- package/alerts/BorderAlert.svelte.d.ts +0 -21
- package/alerts/InfoAlert.svelte +0 -120
- package/alerts/InfoAlert.svelte.d.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
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.26](https://github.com/themesberg/flowbite-svelte/compare/v0.15.25...v0.15.26) (2022-05-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* change from ./package/index.js to index.js for main in package.json ([785fe2c](https://github.com/themesberg/flowbite-svelte/commit/785fe2cd88feded7a2872e85248c84b001c1e3b4))
|
|
11
|
+
|
|
12
|
+
### [0.15.25](https://github.com/themesberg/flowbite-svelte/compare/v0.15.24...v0.15.25) (2022-05-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* demo page issues ([268db3c](https://github.com/themesberg/flowbite-svelte/commit/268db3ca3db363ee8bbd6eec69d9f622350050ee))
|
|
18
|
+
* input label margin on empty labels ([e08bb0d](https://github.com/themesberg/flowbite-svelte/commit/e08bb0d5caaf10b2c14a852cc68047be7c9e6fdc))
|
|
19
|
+
* remove button margin ([9cc1795](https://github.com/themesberg/flowbite-svelte/commit/9cc179505bd77ed775fee1879415f191f36b4764))
|
|
20
|
+
|
|
21
|
+
### [0.15.24](https://github.com/themesberg/flowbite-svelte/compare/v0.15.23...v0.15.24) (2022-05-12)
|
|
22
|
+
|
|
23
|
+
### [0.15.23](https://github.com/themesberg/flowbite-svelte/compare/v0.15.22...v0.15.23) (2022-05-11)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* more alert options ([7071490](https://github.com/themesberg/flowbite-svelte/commit/7071490d458312c3f0833097c10829b20a34919a))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* add handleAlert to Alert component ([bd82de3](https://github.com/themesberg/flowbite-svelte/commit/bd82de36be389de61d4c11348d081e9637dd51b1))
|
|
34
|
+
* demo page bugs ([542b88a](https://github.com/themesberg/flowbite-svelte/commit/542b88a386fdc34acf904b589215441e65b8fb69))
|
|
35
|
+
* demo page text dark mode, dropdown error ([fa46244](https://github.com/themesberg/flowbite-svelte/commit/fa46244d3871bdc5a9cd5bed0f4a3e8b0fc6d3fd))
|
|
36
|
+
|
|
5
37
|
### [0.15.22](https://github.com/themesberg/flowbite-svelte/compare/v0.15.21...v0.15.22) (2022-05-10)
|
|
6
38
|
|
|
7
39
|
### [0.15.21](https://github.com/themesberg/flowbite-svelte/compare/v0.15.20...v0.15.21) (2022-05-10)
|
package/alerts/Alert.svelte
CHANGED
|
@@ -1,127 +1,100 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from 'svelte';
|
|
2
2
|
const dispatch = createEventDispatcher();
|
|
3
3
|
export let color = 'blue';
|
|
4
|
-
export let
|
|
4
|
+
export let icon = null;
|
|
5
5
|
export let closeBtn = false;
|
|
6
|
-
export let
|
|
6
|
+
export let rounded = true;
|
|
7
|
+
export let borderAccent = false;
|
|
7
8
|
let hidden = false;
|
|
8
|
-
const
|
|
9
|
-
dispatch('
|
|
9
|
+
const handleAlert = () => {
|
|
10
|
+
dispatch('handleAlert');
|
|
10
11
|
};
|
|
11
12
|
const handleHide = () => {
|
|
12
13
|
hidden = !hidden;
|
|
13
14
|
};
|
|
14
|
-
let divClass;
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
divClass
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
slotClass = 'ml-3 text-sm font-medium text-gray-700 dark:text-gray-800';
|
|
29
|
-
buttonClass =
|
|
30
|
-
'ml-auto -mx-1.5 -my-1.5 bg-gray-100 text-gray-500 rounded-lg focus:ring-2 focus:ring-gray-400 p-1.5 hover:bg-gray-200 inline-flex h-8 w-8 dark:bg-gray-200 dark:text-gray-600 dark:hover:bg-gray-300';
|
|
15
|
+
let divClass = 'flex flex-col p-4 mb-4 gap-2 ';
|
|
16
|
+
let contentClass;
|
|
17
|
+
let buttonClass = 'ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 p-1.5 inline-flex h-8 w-8 ';
|
|
18
|
+
// TODO: update on change
|
|
19
|
+
if (rounded)
|
|
20
|
+
divClass += 'rounded-lg ';
|
|
21
|
+
if (borderAccent)
|
|
22
|
+
divClass += 'border-t-4 ';
|
|
23
|
+
if (color === 'gray') {
|
|
24
|
+
divClass += 'bg-gray-100 dark:bg-gray-200 ';
|
|
25
|
+
if (borderAccent)
|
|
26
|
+
divClass += 'border-gray-500 dark:bg-gray-200 ';
|
|
27
|
+
contentClass = 'text-gray-700 dark:text-gray-800';
|
|
28
|
+
buttonClass += 'bg-gray-100 text-gray-500 focus:ring-gray-400 hover:bg-gray-200 dark:bg-gray-200 dark:text-gray-600 dark:hover:bg-gray-300';
|
|
31
29
|
}
|
|
32
30
|
else if (color === 'red') {
|
|
33
|
-
divClass
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
divClass += 'bg-red-100 dark:bg-red-200';
|
|
32
|
+
if (borderAccent)
|
|
33
|
+
divClass += 'border-red-500 dark:bg-red-200 ';
|
|
34
|
+
contentClass = 'text-red-700 dark:text-red-800';
|
|
35
|
+
buttonClass += 'bg-red-100 text-red-500 focus:ring-red-400 hover:bg-red-200 dark:bg-red-200 dark:text-red-600 dark:hover:bg-red-300';
|
|
38
36
|
}
|
|
39
37
|
else if (color === 'yellow') {
|
|
40
|
-
divClass
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
divClass += 'bg-yellow-100 dark:bg-yellow-200 ';
|
|
39
|
+
if (borderAccent)
|
|
40
|
+
divClass += 'border-yellow-500 dark:bg-tellow-200 ';
|
|
41
|
+
contentClass = 'text-yellow-700 dark:text-yellow-800';
|
|
42
|
+
buttonClass += 'bg-yellow-100 text-yellow-500 focus:ring-yellow-400 hover:bg-yellow-200 dark:bg-yellow-200 dark:text-yellow-600 dark:hover:bg-yellow-300';
|
|
45
43
|
}
|
|
46
44
|
else if (color === 'green') {
|
|
47
|
-
divClass
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
divClass += 'bg-green-100 dark:bg-green-200 ';
|
|
46
|
+
if (borderAccent)
|
|
47
|
+
divClass += 'border-green-500 dark:bg-green-200 ';
|
|
48
|
+
contentClass = 'text-green-700 dark:text-green-800';
|
|
49
|
+
buttonClass += 'bg-green-100 text-green-500 focus:ring-green-400 hover:bg-green-200 dark:bg-green-200 dark:text-green-600 dark:hover:bg-green-300';
|
|
52
50
|
}
|
|
53
51
|
else if (color === 'indigo') {
|
|
54
|
-
divClass
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
divClass += 'bg-indigo-100 dark:bg-indigo-200 ';
|
|
53
|
+
if (borderAccent)
|
|
54
|
+
divClass += 'border-indigo-500 dark:bg-indigo-200 ';
|
|
55
|
+
contentClass = 'text-indigo-700 dark:text-indigo-800';
|
|
56
|
+
buttonClass += 'bg-indigo-100 text-indigo-500 focus:ring-indigo-400 hover:bg-indigo-200 dark:bg-indigo-200 dark:text-indigo-600 dark:hover:bg-indigo-300';
|
|
59
57
|
}
|
|
60
58
|
else if (color === 'purple') {
|
|
61
|
-
divClass
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
divClass += 'bg-purple-100 dark:bg-purple-200 ';
|
|
60
|
+
if (borderAccent)
|
|
61
|
+
divClass += 'border-purple-500 dark:bg-purple-200 ';
|
|
62
|
+
contentClass = 'text-purple-700 dark:text-purple-800';
|
|
63
|
+
buttonClass += 'bg-purple-100 text-purple-500 focus:ring-purple-400 hover:bg-purple-200 dark:bg-purple-200 dark:text-purple-600 dark:hover:bg-purple-300';
|
|
66
64
|
}
|
|
67
65
|
else if (color === 'pink') {
|
|
68
|
-
divClass
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
divClass += 'bg-pink-100 dark:bg-pink-200 ';
|
|
67
|
+
if (borderAccent)
|
|
68
|
+
divClass += 'border-pink-500 dark:bg-pink-200 ';
|
|
69
|
+
contentClass = 'text-pink-700 dark:text-pink-800';
|
|
70
|
+
buttonClass += 'bg-pink-100 text-pink-500 focus:ring-pink-400 hover:bg-pink-200 dark:bg-pink-200 dark:text-pink-600 dark:hover:bg-pink-300';
|
|
73
71
|
}
|
|
74
72
|
else {
|
|
75
|
-
divClass
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
divClass += 'bg-blue-100 dark:bg-blue-200 ';
|
|
74
|
+
if (borderAccent)
|
|
75
|
+
divClass += 'border-blue-500 dark:bg-blue-200 ';
|
|
76
|
+
contentClass = 'text-blue-700 dark:text-blue-800';
|
|
77
|
+
buttonClass += 'bg-blue-100 text-blue-500 focus:ring-blue-400 hover:bg-blue-200 dark:bg-blue-200 dark:text-blue-600 dark:hover:bg-blue-300';
|
|
80
78
|
}
|
|
81
|
-
let button1Class = 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
82
79
|
</script>
|
|
83
80
|
|
|
84
|
-
<div id={
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
<div id={$$props.id} class:hidden class="{divClass} {$$props.class}" role="alert">
|
|
82
|
+
<div class="flex">
|
|
83
|
+
{#if icon}
|
|
84
|
+
<svelte:component this={icon} class="flex-shrink-0 w-5 h-5 {contentClass} mr-3" />
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
<div class="text-sm font-medium {contentClass}">
|
|
88
|
+
<slot name="content" />
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{#if closeBtn}
|
|
92
|
+
<button on:click={handleHide} on:click={handleAlert} type="button" class={buttonClass} aria-label="Close">
|
|
93
|
+
<span class="sr-only">Close</span>
|
|
94
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" 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" clip-rule="evenodd" /></svg>
|
|
95
|
+
</button>
|
|
96
|
+
{/if}
|
|
94
97
|
</div>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<span class="sr-only">Close</span>
|
|
98
|
-
<svg
|
|
99
|
-
class="w-5 h-5"
|
|
100
|
-
fill="currentColor"
|
|
101
|
-
viewBox="0 0 20 20"
|
|
102
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
-
><path
|
|
104
|
-
fill-rule="evenodd"
|
|
105
|
-
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"
|
|
106
|
-
clip-rule="evenodd"
|
|
107
|
-
/></svg
|
|
108
|
-
>
|
|
109
|
-
</button>
|
|
110
|
-
{/if}
|
|
111
|
-
{#if btn1}
|
|
112
|
-
<button on:click={handlebtn1} type="button" class={buttonClass} aria-label="Close">
|
|
113
|
-
<span class="sr-only">Close</span>
|
|
114
|
-
<svg
|
|
115
|
-
class="w-5 h-5"
|
|
116
|
-
fill="currentColor"
|
|
117
|
-
viewBox="0 0 20 20"
|
|
118
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
119
|
-
><path
|
|
120
|
-
fill-rule="evenodd"
|
|
121
|
-
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"
|
|
122
|
-
clip-rule="evenodd"
|
|
123
|
-
/></svg
|
|
124
|
-
>
|
|
125
|
-
</button>
|
|
126
|
-
{/if}
|
|
98
|
+
|
|
99
|
+
<slot name="extra" />
|
|
127
100
|
</div>
|
package/alerts/Alert.svelte.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
3
|
import type { Colors } from '../types';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
6
|
+
[x: string]: any;
|
|
5
7
|
color?: Colors;
|
|
6
|
-
|
|
8
|
+
icon?: typeof SvelteComponent | null;
|
|
7
9
|
closeBtn?: boolean;
|
|
8
|
-
|
|
10
|
+
rounded?: boolean;
|
|
11
|
+
borderAccent?: boolean;
|
|
9
12
|
};
|
|
10
13
|
events: {
|
|
11
|
-
|
|
14
|
+
handleAlert: CustomEvent<any>;
|
|
12
15
|
} & {
|
|
13
16
|
[evt: string]: CustomEvent<any>;
|
|
14
17
|
};
|
|
15
18
|
slots: {
|
|
16
|
-
|
|
19
|
+
content: {};
|
|
20
|
+
extra: {};
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
23
|
export declare type AlertProps = typeof __propDef.props;
|
package/badges/Badge.svelte
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
<script>export let textSize = 'text-xs';
|
|
2
2
|
export let name = 'Read more';
|
|
3
3
|
export let color = 'blue';
|
|
4
|
-
let badgeClass;
|
|
5
|
-
if (color === '
|
|
6
|
-
badgeClass
|
|
7
|
-
}
|
|
8
|
-
else if (color === 'gray') {
|
|
9
|
-
badgeClass = `bg-gray-100 text-gray-800 ${textSize} font-semibold mr-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-gray-300`;
|
|
4
|
+
let badgeClass = 'font-semibold mr-2 px-2.5 py-0.5 rounded ';
|
|
5
|
+
if (color === 'gray') {
|
|
6
|
+
badgeClass += `bg-gray-100 text-gray-800 ${textSize} dark:bg-gray-700 dark:text-gray-300`;
|
|
10
7
|
}
|
|
11
8
|
else if (color === 'red') {
|
|
12
|
-
badgeClass
|
|
9
|
+
badgeClass += `bg-red-100 text-red-800 ${textSize} dark:bg-red-200 dark:text-red-900`;
|
|
13
10
|
}
|
|
14
11
|
else if (color === 'green') {
|
|
15
|
-
badgeClass
|
|
12
|
+
badgeClass += `bg-green-100 text-green-800 ${textSize} dark:bg-green-200 dark:text-green-900`;
|
|
16
13
|
}
|
|
17
14
|
else if (color === 'yellow') {
|
|
18
|
-
badgeClass
|
|
15
|
+
badgeClass += `bg-yellow-100 text-yellow-800 ${textSize} dark:bg-yellow-200 dark:text-yellow-900`;
|
|
19
16
|
}
|
|
20
17
|
else if (color === 'indigo') {
|
|
21
|
-
badgeClass
|
|
18
|
+
badgeClass += `bg-indigo-100 text-indigo-800 ${textSize} dark:bg-indigo-200 dark:text-indigo-900`;
|
|
22
19
|
}
|
|
23
20
|
else if (color === 'purple') {
|
|
24
|
-
badgeClass
|
|
21
|
+
badgeClass += `bg-purple-100 text-purple-800 ${textSize} dark:bg-purple-200 dark:text-purple-900`;
|
|
25
22
|
}
|
|
26
23
|
else if (color === 'pink') {
|
|
27
|
-
badgeClass
|
|
24
|
+
badgeClass += `bg-pink-100 text-pink-800 ${textSize} dark:bg-pink-200 dark:text-pink-900`;
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
|
-
badgeClass
|
|
27
|
+
badgeClass += `bg-blue-100 text-blue-800 ${textSize} dark:bg-blue-200 dark:text-blue-800`;
|
|
31
28
|
}
|
|
32
29
|
</script>
|
|
33
30
|
|
package/badges/BadgeIcon.svelte
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
<script>export let textSize = 'text-xs';
|
|
2
2
|
export let name = '';
|
|
3
3
|
export let color = 'blue';
|
|
4
|
-
let badgeClass;
|
|
5
|
-
if (color === '
|
|
6
|
-
badgeClass
|
|
7
|
-
}
|
|
8
|
-
else if (color === 'gray') {
|
|
9
|
-
badgeClass = `bg-gray-100 text-gray-800 ${textSize} font-medium inline-flex items-center px-2.5 py-0.5 rounded mr-2 dark:bg-gray-700 dark:text-gray-300`;
|
|
4
|
+
let badgeClass = 'font-medium inline-flex items-center px-2.5 py-0.5 rounded mr-2 ';
|
|
5
|
+
if (color === 'gray') {
|
|
6
|
+
badgeClass += `bg-gray-100 text-gray-800 ${textSize} dark:bg-gray-700 dark:text-gray-300`;
|
|
10
7
|
}
|
|
11
8
|
else if (color === 'red') {
|
|
12
|
-
badgeClass
|
|
9
|
+
badgeClass += `bg-red-100 text-red-800 ${textSize} dark:bg-red-700 dark:text-red-300`;
|
|
13
10
|
}
|
|
14
11
|
else if (color === 'green') {
|
|
15
|
-
badgeClass
|
|
12
|
+
badgeClass += `bg-green-100 text-green-800 ${textSize} dark:bg-green-700 dark:text-green-300`;
|
|
16
13
|
}
|
|
17
14
|
else if (color === 'yellow') {
|
|
18
|
-
badgeClass
|
|
15
|
+
badgeClass += `bg-yellow-100 text-yellow-800 ${textSize} dark:bg-yellow-700 dark:text-yellow-300`;
|
|
19
16
|
}
|
|
20
17
|
else if (color === 'indigo') {
|
|
21
|
-
badgeClass
|
|
18
|
+
badgeClass += `bg-indigo-100 text-indigo-800 ${textSize} dark:bg-indigo-700 dark:text-indigo-300`;
|
|
22
19
|
}
|
|
23
20
|
else if (color === 'purple') {
|
|
24
|
-
badgeClass
|
|
21
|
+
badgeClass += `bg-purple-100 text-purple-800 ${textSize} dark:bg-purple-700 dark:text-purple-300`;
|
|
25
22
|
}
|
|
26
23
|
else if (color === 'pink') {
|
|
27
|
-
badgeClass
|
|
24
|
+
badgeClass += `bg-pink-100 text-pink-800 ${textSize} dark:bg-pink-700 dark:text-pink-300`;
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
|
-
badgeClass
|
|
27
|
+
badgeClass += `bg-blue-100 text-blue-800 ${textSize} dark:bg-blue-700 dark:text-blue-300`;
|
|
31
28
|
}
|
|
32
29
|
</script>
|
|
33
30
|
|
package/badges/BadgeLink.svelte
CHANGED
|
@@ -2,33 +2,30 @@
|
|
|
2
2
|
export let name = 'Read more';
|
|
3
3
|
export let color = 'blue';
|
|
4
4
|
export let href = '/';
|
|
5
|
-
let badgeClass;
|
|
6
|
-
if (color === '
|
|
7
|
-
badgeClass
|
|
8
|
-
}
|
|
9
|
-
else if (color === 'gray') {
|
|
10
|
-
badgeClass = `bg-gray-100 hover:bg-gray-200 text-gray-800 ${textSize} font-semibold mr-2 px-2.5 py-0.5 rounded dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-gray-300`;
|
|
5
|
+
let badgeClass = 'font-semibold mr-2 px-2.5 py-0.5 rounded ';
|
|
6
|
+
if (color === 'gray') {
|
|
7
|
+
badgeClass += `bg-gray-100 hover:bg-gray-200 text-gray-800 ${textSize} dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-gray-300`;
|
|
11
8
|
}
|
|
12
9
|
else if (color === 'red') {
|
|
13
|
-
badgeClass
|
|
10
|
+
badgeClass += `bg-red-100 hover:bg-red-200 text-red-800 ${textSize} dark:bg-red-200 dark:text-red-800 dark:hover:bg-red-300`;
|
|
14
11
|
}
|
|
15
12
|
else if (color === 'green') {
|
|
16
|
-
badgeClass
|
|
13
|
+
badgeClass += `bg-green-100 hover:bg-green-200 text-green-800 ${textSize} dark:bg-green-200 dark:text-green-800 dark:hover:bg-green-300`;
|
|
17
14
|
}
|
|
18
15
|
else if (color === 'yellow') {
|
|
19
|
-
badgeClass
|
|
16
|
+
badgeClass += `bg-yellow-100 hover:bg-yellow-200 text-yellow-800 ${textSize} dark:bg-yellow-200 dark:text-yellow-800 dark:hover:bg-yellow-300`;
|
|
20
17
|
}
|
|
21
18
|
else if (color === 'indigo') {
|
|
22
|
-
badgeClass
|
|
19
|
+
badgeClass += `bg-indigo-100 hover:bg-indigo-200 text-indigo-800 ${textSize} dark:bg-indigo-200 dark:text-indigo-800 dark:hover:bg-indigo-300`;
|
|
23
20
|
}
|
|
24
21
|
else if (color === 'purple') {
|
|
25
|
-
badgeClass
|
|
22
|
+
badgeClass += `bg-purple-100 hover:bg-purple-200 text-purple-800 ${textSize} dark:bg-purple-200 dark:text-purple-800 dark:hover:bg-purple-300`;
|
|
26
23
|
}
|
|
27
24
|
else if (color === 'pink') {
|
|
28
|
-
badgeClass
|
|
25
|
+
badgeClass += `bg-pink-100 hover:bg-pink-200 text-pink-800 ${textSize} dark:bg-pink-200 dark:text-pink-800 dark:hover:bg-pink-300`;
|
|
29
26
|
}
|
|
30
27
|
else {
|
|
31
|
-
badgeClass
|
|
28
|
+
badgeClass += `bg-blue-100 hover:bg-blue-200 text-blue-800 ${textSize} dark:bg-blue-200 dark:text-blue-800 dark:hover:bg-blue-300`;
|
|
32
29
|
}
|
|
33
30
|
</script>
|
|
34
31
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script>export let buttons;
|
|
2
2
|
let btnLength = buttons.length;
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
3
|
+
let baseClass = 'inline-flex relative items-center py-2 px-4 text-sm font-medium text-gray-900 bg-white border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-blue-500 dark:focus:text-white ';
|
|
4
|
+
let classFirst = 'rounded-l-lg border';
|
|
5
|
+
let classMiddle = 'border-t border-b';
|
|
6
|
+
let classLast = 'rounded-r-md border';
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<div class="inline-flex rounded-md shadow-sm" role="group">
|
|
9
10
|
{#each buttons as { name, icon, href, rel, iconClass, iconSize }, i}
|
|
10
11
|
{#if i === 0}
|
|
11
|
-
<button type="button" class={classFirst}>
|
|
12
|
+
<button type="button" class="{baseClass} {classFirst}">
|
|
12
13
|
{#if icon}
|
|
13
14
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
14
15
|
{/if}
|
|
@@ -19,7 +20,7 @@ let classLast = 'inline-flex relative items-center py-2 px-4 text-sm font-medium
|
|
|
19
20
|
{/if}
|
|
20
21
|
</button>
|
|
21
22
|
{:else if i === btnLength - 1}
|
|
22
|
-
<button type="button" class={classLast}>
|
|
23
|
+
<button type="button" class="{baseClass} {classLast}">
|
|
23
24
|
{#if icon}
|
|
24
25
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
25
26
|
{/if}
|
|
@@ -30,7 +31,7 @@ let classLast = 'inline-flex relative items-center py-2 px-4 text-sm font-medium
|
|
|
30
31
|
{/if}
|
|
31
32
|
</button>
|
|
32
33
|
{:else}
|
|
33
|
-
<button type="button" class={classMiddle}>
|
|
34
|
+
<button type="button" class="{baseClass} {classMiddle}">
|
|
34
35
|
{#if icon}
|
|
35
36
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
36
37
|
{/if}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script>export let buttons;
|
|
2
2
|
let btnLength = buttons.length;
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
3
|
+
let baseClass = 'inline-flex items-center py-2 px-4 text-sm font-medium text-gray-900 bg-transparent border-gray-900 hover:bg-gray-900 hover:text-white focus:z-10 focus:ring-2 focus:ring-gray-500 focus:bg-gray-900 focus:text-white dark:border-white dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:bg-gray-700';
|
|
4
|
+
let classFirst = 'rounded-l-lg border';
|
|
5
|
+
let classMiddle = 'border-t border-b';
|
|
6
|
+
let classLast = 'rounded-r-md border';
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<div class="inline-flex rounded-md shadow-sm">
|
|
9
10
|
{#each buttons as { href, name, rel, icon, iconClass, iconSize }, i}
|
|
10
11
|
{#if i === 0}
|
|
11
|
-
<button type="button" class={classFirst}>
|
|
12
|
+
<button type="button" class="{baseClass} {classFirst}">
|
|
12
13
|
{#if icon}
|
|
13
14
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
14
15
|
{/if}
|
|
@@ -19,7 +20,7 @@ let classLast = 'inline-flex items-center py-2 px-4 text-sm font-medium text-gra
|
|
|
19
20
|
{/if}
|
|
20
21
|
</button>
|
|
21
22
|
{:else if i === btnLength - 1}
|
|
22
|
-
<button type="button" class={classLast}>
|
|
23
|
+
<button type="button" class="{baseClass} {classLast}">
|
|
23
24
|
{#if icon}
|
|
24
25
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
25
26
|
{/if}
|
|
@@ -30,7 +31,7 @@ let classLast = 'inline-flex items-center py-2 px-4 text-sm font-medium text-gra
|
|
|
30
31
|
{/if}
|
|
31
32
|
</button>
|
|
32
33
|
{:else}
|
|
33
|
-
<button type="button" class={classMiddle}>
|
|
34
|
+
<button type="button" class="{baseClass} {classMiddle}">
|
|
34
35
|
{#if icon}
|
|
35
36
|
<svelte:component this={icon} size={iconSize} class="mr-2 {iconClass}" />
|
|
36
37
|
{/if}
|
package/buttons/Button.svelte
CHANGED
|
@@ -21,67 +21,67 @@ let round = rounded ? 'rounded-full' : 'rounded-lg';
|
|
|
21
21
|
switch (btnColor) {
|
|
22
22
|
default:
|
|
23
23
|
case 'blue':
|
|
24
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
24
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
25
25
|
if (disabled)
|
|
26
26
|
buttonClass += ' bg-blue-400 dark:bg-blue-500 cursor-not-allowed';
|
|
27
27
|
else
|
|
28
28
|
buttonClass += ' bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800';
|
|
29
29
|
break;
|
|
30
30
|
case 'blue-outline':
|
|
31
|
-
buttonClass = `text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
31
|
+
buttonClass = `text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-600 dark:focus:ring-blue-800`;
|
|
32
32
|
break;
|
|
33
33
|
case 'dark':
|
|
34
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
34
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
35
35
|
if (disabled)
|
|
36
36
|
buttonClass += ' bg-gray-400 dark:bg-gray-500 cursor-not-allowed';
|
|
37
37
|
else
|
|
38
38
|
buttonClass += ' bg-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-800 dark:border-gray-700';
|
|
39
39
|
break;
|
|
40
40
|
case 'dark-outline':
|
|
41
|
-
buttonClass = `text-gray-900 hover:text-white border border-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
41
|
+
buttonClass = `text-gray-900 hover:text-white border border-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-gray-600 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-800`;
|
|
42
42
|
break;
|
|
43
43
|
case 'light':
|
|
44
|
-
buttonClass = `text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium ${round} ${textSize} ${paddings} text-center
|
|
44
|
+
buttonClass = `text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium ${round} ${textSize} ${paddings} text-center dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700`;
|
|
45
45
|
break;
|
|
46
46
|
case 'green':
|
|
47
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
47
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
48
48
|
if (disabled)
|
|
49
49
|
buttonClass += ' bg-green-400 dark:bg-green-500 cursor-not-allowed';
|
|
50
50
|
else
|
|
51
51
|
buttonClass += ' bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800';
|
|
52
52
|
break;
|
|
53
53
|
case 'green-outline':
|
|
54
|
-
buttonClass = `text-green-700 hover:text-white border border-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
54
|
+
buttonClass = `text-green-700 hover:text-white border border-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-green-500 dark:text-green-500 dark:hover:text-white dark:hover:bg-green-600 dark:focus:ring-green-800`;
|
|
55
55
|
break;
|
|
56
56
|
case 'red':
|
|
57
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
57
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
58
58
|
if (disabled)
|
|
59
59
|
buttonClass += ' bg-red-400 dark:bg-red-500 cursor-not-allowed';
|
|
60
60
|
else
|
|
61
61
|
buttonClass += ' bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900';
|
|
62
62
|
break;
|
|
63
63
|
case 'red-outline':
|
|
64
|
-
buttonClass = `text-red-700 hover:text-white border border-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
64
|
+
buttonClass = `text-red-700 hover:text-white border border-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600 dark:focus:ring-red-900`;
|
|
65
65
|
break;
|
|
66
66
|
case 'yellow':
|
|
67
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
67
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
68
68
|
if (disabled)
|
|
69
69
|
buttonClass += ' bg-yellow-400 dark:bg-yellow-500 cursor-not-allowed';
|
|
70
70
|
else
|
|
71
71
|
buttonClass += ' bg-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 dark:focus:ring-yellow-900';
|
|
72
72
|
break;
|
|
73
73
|
case 'yellow-outline':
|
|
74
|
-
buttonClass = `text-yellow-400 hover:text-white border border-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
74
|
+
buttonClass = `text-yellow-400 hover:text-white border border-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-yellow-300 dark:text-yellow-300 dark:hover:text-white dark:hover:bg-yellow-400 dark:focus:ring-yellow-900`;
|
|
75
75
|
break;
|
|
76
76
|
case 'purple':
|
|
77
|
-
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}
|
|
77
|
+
buttonClass = `text-white text-center font-medium ${round} ${textSize} ${paddings}`;
|
|
78
78
|
if (disabled)
|
|
79
79
|
buttonClass += ' bg-purple-400 dark:bg-purple-500 cursor-not-allowed';
|
|
80
80
|
else
|
|
81
81
|
buttonClass += ' bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-900';
|
|
82
82
|
break;
|
|
83
83
|
case 'purple-outline':
|
|
84
|
-
buttonClass = `text-purple-700 hover:text-white border border-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 font-medium rounded-lg ${textSize} ${paddings} text-center
|
|
84
|
+
buttonClass = `text-purple-700 hover:text-white border border-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 font-medium rounded-lg ${textSize} ${paddings} text-center dark:border-purple-400 dark:text-purple-400 dark:hover:text-white dark:hover:bg-purple-500 dark:focus:ring-purple-900`;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
buttonClass += ' items-center inline-flex';
|