flowbite-svelte 0.24.12 → 0.24.15
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 +22 -0
- package/alerts/Alert.svelte +9 -3
- package/alerts/Alert.svelte.d.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -1
- package/tabs/InteractiveTabs.svelte +3 -2
- package/tabs/Tabs.svelte +115 -0
- package/tabs/Tabs.svelte.d.ts +39 -0
- package/types.d.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.15](https://github.com/themesberg/flowbite-svelte/compare/v0.24.14...v0.24.15) (2022-08-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update prop names for Alert ([3775700](https://github.com/themesberg/flowbite-svelte/commit/377570061f48de43af44c5f87f46b049f4d87341))
|
|
11
|
+
|
|
12
|
+
### [0.24.14](https://github.com/themesberg/flowbite-svelte/compare/v0.24.13...v0.24.14) (2022-08-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add custom color to Alert component and update props ([2e2a71b](https://github.com/themesberg/flowbite-svelte/commit/2e2a71b4fb83bca28a1bf6b107f4163acbb6b011))
|
|
18
|
+
|
|
19
|
+
### [0.24.13](https://github.com/themesberg/flowbite-svelte/compare/v0.24.12...v0.24.13) (2022-08-16)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add disabled to InteractiveTabs ([f5ca0fe](https://github.com/themesberg/flowbite-svelte/commit/f5ca0fe858a50ef2c017ed6ec266c0012166b5f9))
|
|
25
|
+
* add Tabs component for all tab ([758e2e7](https://github.com/themesberg/flowbite-svelte/commit/758e2e743eb845c7190a7c6c2a9888c67c46db73))
|
|
26
|
+
|
|
5
27
|
### [0.24.12](https://github.com/themesberg/flowbite-svelte/compare/v0.24.11...v0.24.12) (2022-08-16)
|
|
6
28
|
|
|
7
29
|
|
package/alerts/Alert.svelte
CHANGED
|
@@ -9,6 +9,9 @@ export let icon = null;
|
|
|
9
9
|
export let dismissable = false;
|
|
10
10
|
export let rounded = true;
|
|
11
11
|
export let accent = false;
|
|
12
|
+
export let customBgClass = '';
|
|
13
|
+
export let customBorderAccentClass = '';
|
|
14
|
+
export let customTextColor = '';
|
|
12
15
|
let hidden = false;
|
|
13
16
|
const handleAlert = () => {
|
|
14
17
|
dispatch('handleAlert');
|
|
@@ -25,7 +28,8 @@ const bgClasses = {
|
|
|
25
28
|
purple: 'bg-purple-100 dark:bg-purple-200 ',
|
|
26
29
|
pink: 'bg-pink-100 dark:bg-pink-200 ',
|
|
27
30
|
blue: 'bg-blue-100 dark:bg-blue-200 ',
|
|
28
|
-
dark: 'bg-gray-100 dark:bg-gray-700'
|
|
31
|
+
dark: 'bg-gray-100 dark:bg-gray-700',
|
|
32
|
+
custom: customBgClass
|
|
29
33
|
};
|
|
30
34
|
const borderAccentClasses = {
|
|
31
35
|
gray: 'border-gray-500 dark:bg-gray-200 ',
|
|
@@ -36,7 +40,8 @@ const borderAccentClasses = {
|
|
|
36
40
|
purple: 'border-purple-500 dark:bg-purple-200 ',
|
|
37
41
|
pink: 'border-pink-500 dark:bg-pink-200 ',
|
|
38
42
|
blue: 'border-blue-500 dark:bg-blue-200 ',
|
|
39
|
-
dark: 'border-gray-500'
|
|
43
|
+
dark: 'border-gray-500',
|
|
44
|
+
custom: customBorderAccentClass
|
|
40
45
|
};
|
|
41
46
|
const textColors = {
|
|
42
47
|
gray: 'text-gray-700 dark:text-gray-800',
|
|
@@ -47,7 +52,8 @@ const textColors = {
|
|
|
47
52
|
purple: 'text-purple-700 dark:text-purple-800',
|
|
48
53
|
pink: 'text-pink-700 dark:text-pink-800',
|
|
49
54
|
blue: 'text-blue-700 dark:text-blue-800',
|
|
50
|
-
dark: 'text-gray-700 dark:text-gray-300'
|
|
55
|
+
dark: 'text-gray-700 dark:text-gray-300',
|
|
56
|
+
custom: customTextColor
|
|
51
57
|
};
|
|
52
58
|
let divClass;
|
|
53
59
|
$: divClass = classNames('flex flex-col p-4 mb-4 gap-2 text-sm', bgClasses[color] ?? bgClasses.blue, accent && (borderAccentClasses[color] ?? borderAccentClasses.blue), rounded && 'rounded-lg ', accent && 'border-t-4 ', textColors[color], $$props.class);
|
package/alerts/Alert.svelte.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export { default as TableBodyRow } from './tables/TableBodyRow.svelte';
|
|
|
89
89
|
export { default as TableHead } from './tables/TableHead.svelte';
|
|
90
90
|
export { default as TableHeadCell } from './tables/TableHeadCell.svelte';
|
|
91
91
|
export { default as TableSearch } from './tables/TableSearch.svelte';
|
|
92
|
+
export { default as Tabs } from './tabs/Tabs.svelte';
|
|
92
93
|
export { tabStore } from './tabs/tabStores.js';
|
|
93
94
|
export { default as InteractiveTabHead } from './tabs/InteractiveTabHead.svelte';
|
|
94
95
|
export { default as InteractiveTabs } from './tabs/InteractiveTabs.svelte';
|
package/index.js
CHANGED
|
@@ -117,6 +117,7 @@ export { default as TableHead } from './tables/TableHead.svelte';
|
|
|
117
117
|
export { default as TableHeadCell } from './tables/TableHeadCell.svelte';
|
|
118
118
|
export { default as TableSearch } from './tables/TableSearch.svelte';
|
|
119
119
|
// Tabs
|
|
120
|
+
export { default as Tabs } from './tabs/Tabs.svelte';
|
|
120
121
|
export { tabStore } from './tabs/tabStores.js';
|
|
121
122
|
export { default as InteractiveTabHead } from './tabs/InteractiveTabHead.svelte';
|
|
122
123
|
export { default as InteractiveTabs } from './tabs/InteractiveTabs.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.15",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -204,6 +204,7 @@
|
|
|
204
204
|
"./tabs/InteractiveTabs.svelte": "./tabs/InteractiveTabs.svelte",
|
|
205
205
|
"./tabs/PillTabs.svelte": "./tabs/PillTabs.svelte",
|
|
206
206
|
"./tabs/TabContent.svelte": "./tabs/TabContent.svelte",
|
|
207
|
+
"./tabs/Tabs.svelte": "./tabs/Tabs.svelte",
|
|
207
208
|
"./tabs/UnderlineTabs.svelte": "./tabs/UnderlineTabs.svelte",
|
|
208
209
|
"./tabs/tabStores": "./tabs/tabStores.js",
|
|
209
210
|
"./timelines/Activity.svelte": "./timelines/Activity.svelte",
|
|
@@ -10,7 +10,7 @@ const handleClick = (tabValue) => () => (activeTabValue = tabValue);
|
|
|
10
10
|
|
|
11
11
|
<div class="mb-4 border-b border-gray-200 dark:border-gray-700">
|
|
12
12
|
<ul class="flex flex-wrap -mb-px" id={tabId} role="tablist">
|
|
13
|
-
{#each tabs as { name, id }}
|
|
13
|
+
{#each tabs as { name, id, disabled }}
|
|
14
14
|
<li class="mr-2" role="presentation">
|
|
15
15
|
<button
|
|
16
16
|
on:click={handleClick(id)}
|
|
@@ -27,7 +27,8 @@ const handleClick = (tabValue) => () => (activeTabValue = tabValue);
|
|
|
27
27
|
id="{name}-tab"
|
|
28
28
|
type="button"
|
|
29
29
|
role="tab"
|
|
30
|
-
aria-controls={name}
|
|
30
|
+
aria-controls={name}
|
|
31
|
+
{disabled}>{name}</button
|
|
31
32
|
>
|
|
32
33
|
</li>
|
|
33
34
|
{/each}
|
package/tabs/Tabs.svelte
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let tabStyle = 'default';
|
|
3
|
+
export let tabId = 'myTab';
|
|
4
|
+
export let tabLabel = 'Full-width tabs';
|
|
5
|
+
export let activeTabValue = 1;
|
|
6
|
+
export let tabs;
|
|
7
|
+
export let customDivClass = '';
|
|
8
|
+
export let customUlClass = '';
|
|
9
|
+
export let customLiClass = '';
|
|
10
|
+
export let customActiveClass = '';
|
|
11
|
+
export let customInActiveClass = '';
|
|
12
|
+
export let iconClass = 'mr-2 w-5 h-5 text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-300';
|
|
13
|
+
export let contentDivClass = 'p-4 bg-gray-50 rounded-lg dark:bg-gray-800';
|
|
14
|
+
export let fullSelectClass = 'bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
|
|
15
|
+
const divClasses = {
|
|
16
|
+
default: 'mb-4 border-b border-gray-200 dark:border-gray-700',
|
|
17
|
+
full: 'mb-4',
|
|
18
|
+
icon: 'mb-4 border-b border-gray-200 dark:border-gray-700',
|
|
19
|
+
pill: 'mb-4 ',
|
|
20
|
+
underline: 'mb-4 text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700',
|
|
21
|
+
custom: customDivClass
|
|
22
|
+
};
|
|
23
|
+
const ulClasses = {
|
|
24
|
+
default: 'flex flex-wrap -mb-px',
|
|
25
|
+
full: 'hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400 mb-1',
|
|
26
|
+
icon: 'flex flex-wrap -mb-px text-sm font-medium text-center text-gray-500 dark:text-gray-400',
|
|
27
|
+
pill: 'flex flex-wrap',
|
|
28
|
+
underline: 'flex flex-wrap -mb-px',
|
|
29
|
+
custom: customUlClass
|
|
30
|
+
};
|
|
31
|
+
const liClasses = {
|
|
32
|
+
default: 'mr-2',
|
|
33
|
+
full: 'w-full',
|
|
34
|
+
icon: 'mr-2',
|
|
35
|
+
pill: 'mr-2',
|
|
36
|
+
underline: 'mr-2',
|
|
37
|
+
custom: customLiClass
|
|
38
|
+
};
|
|
39
|
+
const activeClasses = {
|
|
40
|
+
default: 'inline-block py-4 px-4 text-sm font-medium text-center text-blue-600 bg-gray-100 rounded-t-lg active dark:bg-gray-800 dark:text-blue-500',
|
|
41
|
+
full: 'inline-block p-4 w-full text-gray-900 bg-gray-100 focus:ring-4 focus:ring-blue-300 active focus:outline-none dark:bg-gray-700 dark:text-white',
|
|
42
|
+
icon: 'inline-flex p-4 text-blue-600 rounded-t-lg border-b-2 border-blue-600 active dark:text-blue-500 dark:border-blue-500 group',
|
|
43
|
+
pill: 'active inline-block py-3 px-4 text-sm font-medium text-center text-white bg-blue-600 rounded-lg',
|
|
44
|
+
underline: 'inline-block p-4 text-blue-600 rounded-t-lg border-b-2 border-blue-600 active dark:text-blue-500 dark:border-blue-500',
|
|
45
|
+
custom: customActiveClass
|
|
46
|
+
};
|
|
47
|
+
const inactiveClasses = {
|
|
48
|
+
default: 'inline-block py-4 px-4 text-sm font-medium text-center text-gray-500 rounded-t-lg hover:text-gray-600 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300',
|
|
49
|
+
full: 'inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700',
|
|
50
|
+
icon: 'inline-flex p-4 rounded-t-lg border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300 group ',
|
|
51
|
+
pill: 'inline-block py-3 px-4 text-sm font-medium text-center text-gray-500 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white',
|
|
52
|
+
underline: 'inline-block p-4 rounded-t-lg border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300',
|
|
53
|
+
custom: customInActiveClass
|
|
54
|
+
};
|
|
55
|
+
const handleClick = (tabValue) => () => (activeTabValue = tabValue);
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
{#if tabStyle === 'full'}
|
|
59
|
+
<div class="sm:hidden">
|
|
60
|
+
<label for="tabs" class="sr-only">{tabLabel}</label>
|
|
61
|
+
<select id="tabs" class={fullSelectClass}>
|
|
62
|
+
{#each tabs as { name }}
|
|
63
|
+
<option>{name}</option>
|
|
64
|
+
{/each}
|
|
65
|
+
</select>
|
|
66
|
+
</div>
|
|
67
|
+
{/if}
|
|
68
|
+
<div class={divClasses[tabStyle]}>
|
|
69
|
+
<ul class={ulClasses[tabStyle]} id={tabId} role="tablist">
|
|
70
|
+
{#each tabs as { name, id, disabled, icon, iconSize }}
|
|
71
|
+
<li class={liClasses[tabStyle]} role="presentation">
|
|
72
|
+
<button
|
|
73
|
+
on:click={handleClick(id)}
|
|
74
|
+
on:blur
|
|
75
|
+
on:click
|
|
76
|
+
on:focus
|
|
77
|
+
on:keydown
|
|
78
|
+
on:keypress
|
|
79
|
+
on:keyup
|
|
80
|
+
on:mouseenter
|
|
81
|
+
on:mouseleave
|
|
82
|
+
on:mouseover
|
|
83
|
+
class={classNames(
|
|
84
|
+
activeTabValue === id ? activeClasses[tabStyle] : inactiveClasses[tabStyle]
|
|
85
|
+
)}
|
|
86
|
+
id="{name}-tab"
|
|
87
|
+
type="button"
|
|
88
|
+
role="tab"
|
|
89
|
+
aria-controls={name}
|
|
90
|
+
{disabled}
|
|
91
|
+
>
|
|
92
|
+
{#if icon}
|
|
93
|
+
<svelte:component this={icon} size={iconSize} class={iconClass} />
|
|
94
|
+
{/if}
|
|
95
|
+
{name}</button
|
|
96
|
+
>
|
|
97
|
+
</li>
|
|
98
|
+
{/each}
|
|
99
|
+
</ul>
|
|
100
|
+
</div>
|
|
101
|
+
<div id="{tabId}Content">
|
|
102
|
+
{#each tabs as { name, content, id }}
|
|
103
|
+
{#if activeTabValue === id}
|
|
104
|
+
<div class={contentDivClass} id={name} role="tabpanel" aria-labelledby="{name}-tab">
|
|
105
|
+
{#if typeof content === 'string'}
|
|
106
|
+
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
107
|
+
{@html content}
|
|
108
|
+
</p>
|
|
109
|
+
{:else}
|
|
110
|
+
<svelte:component this={content} />
|
|
111
|
+
{/if}
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
114
|
+
{/each}
|
|
115
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { InteractiveTabType } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
tabStyle?: 'default' | 'full' | 'icon' | 'pill' | 'underline' | 'custom';
|
|
6
|
+
tabId?: string;
|
|
7
|
+
tabLabel?: string;
|
|
8
|
+
activeTabValue?: number;
|
|
9
|
+
tabs: InteractiveTabType[];
|
|
10
|
+
customDivClass?: string;
|
|
11
|
+
customUlClass?: string;
|
|
12
|
+
customLiClass?: string;
|
|
13
|
+
customActiveClass?: string;
|
|
14
|
+
customInActiveClass?: string;
|
|
15
|
+
iconClass?: string;
|
|
16
|
+
contentDivClass?: string;
|
|
17
|
+
fullSelectClass?: string;
|
|
18
|
+
};
|
|
19
|
+
events: {
|
|
20
|
+
blur: FocusEvent;
|
|
21
|
+
click: MouseEvent;
|
|
22
|
+
focus: FocusEvent;
|
|
23
|
+
keydown: KeyboardEvent;
|
|
24
|
+
keypress: KeyboardEvent;
|
|
25
|
+
keyup: KeyboardEvent;
|
|
26
|
+
mouseenter: MouseEvent;
|
|
27
|
+
mouseleave: MouseEvent;
|
|
28
|
+
mouseover: MouseEvent;
|
|
29
|
+
} & {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
};
|
|
32
|
+
slots: {};
|
|
33
|
+
};
|
|
34
|
+
export declare type TabsProps = typeof __propDef.props;
|
|
35
|
+
export declare type TabsEvents = typeof __propDef.events;
|
|
36
|
+
export declare type TabsSlots = typeof __propDef.slots;
|
|
37
|
+
export default class Tabs extends SvelteComponentTyped<TabsProps, TabsEvents, TabsSlots> {
|
|
38
|
+
}
|
|
39
|
+
export {};
|
package/types.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface CheckboxType {
|
|
|
57
57
|
disabled?: boolean;
|
|
58
58
|
helper?: string;
|
|
59
59
|
}
|
|
60
|
-
export declare type Colors = 'blue' | 'gray' | 'red' | 'yellow' | 'purple' | 'green' | 'indigo' | 'pink' | 'white';
|
|
60
|
+
export declare type Colors = 'blue' | 'gray' | 'red' | 'yellow' | 'purple' | 'green' | 'indigo' | 'pink' | 'white' | 'custom';
|
|
61
61
|
export declare type CrumbType = {
|
|
62
62
|
label: string;
|
|
63
63
|
href: string;
|
|
@@ -114,6 +114,10 @@ export declare type InputType = 'color' | 'date' | 'datetime-local' | 'email' |
|
|
|
114
114
|
export interface InteractiveTabType {
|
|
115
115
|
name: string;
|
|
116
116
|
id: number;
|
|
117
|
+
active?: boolean;
|
|
118
|
+
disabled?: boolean;
|
|
119
|
+
icon?: typeof SvelteComponent;
|
|
120
|
+
iconSize?: number;
|
|
117
121
|
content: string | typeof SvelteComponent;
|
|
118
122
|
}
|
|
119
123
|
export interface ListGroupItemType {
|