flowbite-svelte 0.26.2 → 0.26.5
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 +41 -0
- package/alerts/Alert.svelte +28 -70
- package/alerts/Alert.svelte.d.ts +1 -3
- package/cards/Card.svelte +4 -5
- package/dropdowns/Dropdown.svelte +13 -23
- package/index.d.ts +6 -2
- package/index.js +6 -2
- package/list-group/Listgroup.svelte +18 -0
- package/list-group/Listgroup.svelte.d.ts +23 -0
- package/list-group/{ListItem.svelte → ListgroupItem.svelte} +0 -0
- package/list-group/{ListItem.svelte.d.ts → ListgroupItem.svelte.d.ts} +4 -4
- package/modals/Modal.svelte +6 -11
- package/package.json +11 -7
- package/popover/Popover.svelte +12 -14
- package/popover/Popover.svelte.d.ts +0 -4
- package/toasts/Toast.svelte +7 -24
- package/toasts/Toast.svelte.d.ts +1 -3
- package/typography/DescriptionList.svelte +10 -0
- package/typography/DescriptionList.svelte.d.ts +21 -0
- package/typography/Heading.svelte +3 -4
- package/typography/Li.svelte +9 -0
- package/typography/Li.svelte.d.ts +20 -0
- package/typography/List.svelte +23 -0
- package/{list-group → typography}/List.svelte.d.ts +7 -5
- package/typography/Span.svelte +7 -0
- package/typography/Span.svelte.d.ts +19 -0
- package/typography/Ul.svelte +20 -0
- package/typography/Ul.svelte.d.ts +21 -0
- package/utils/Frame.svelte +73 -0
- package/utils/Frame.svelte.d.ts +26 -0
- package/utils/Popper.svelte +25 -12
- package/utils/Popper.svelte.d.ts +2 -1
- package/list-group/List.svelte +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
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.26.5](https://github.com/themesberg/flowbite-svelte/compare/v0.26.4...v0.26.5) (2022-09-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add DescriptionList, List, Span components ([495b61e](https://github.com/themesberg/flowbite-svelte/commit/495b61eb0d81eb9ae06a34fa981dd42a81983ea6))
|
|
11
|
+
* add Ul, Li, Span component ([86d8b66](https://github.com/themesberg/flowbite-svelte/commit/86d8b661f2524f25162a99b6d3b8df761a85b01b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* blockquote page formating ([1641d45](https://github.com/themesberg/flowbite-svelte/commit/1641d45bdc032c01cd201967bf362d9f8a19a422))
|
|
17
|
+
* Heading to the original code ([5604da5](https://github.com/themesberg/flowbite-svelte/commit/5604da5f348420f8878e44d591e9a8704b23e4a0))
|
|
18
|
+
* List in cards page to Listgroup ([b8e05f4](https://github.com/themesberg/flowbite-svelte/commit/b8e05f4f97fbbb0236872b2b5f18f0928c34ad55))
|
|
19
|
+
* rebase merge conflict Alert.svelte ([38df84a](https://github.com/themesberg/flowbite-svelte/commit/38df84a21124d3d3c3c1d716ff21bd678b156b09))
|
|
20
|
+
* removed Ol component ([569f2e3](https://github.com/themesberg/flowbite-svelte/commit/569f2e3a51a59abba641c669949b4b5372c56a01))
|
|
21
|
+
* rename List to Listgroup and ListItem to ListgroupItem ([1b70110](https://github.com/themesberg/flowbite-svelte/commit/1b7011062a729452604b3a0dd1ed54f28ab49132))
|
|
22
|
+
|
|
23
|
+
### [0.26.4](https://github.com/themesberg/flowbite-svelte/compare/v0.26.3...v0.26.4) (2022-09-02)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* programatic popper open merged ([86f9874](https://github.com/themesberg/flowbite-svelte/commit/86f9874e1c2390e3571b6df96acfa61af23fd865))
|
|
29
|
+
|
|
30
|
+
### [0.26.3](https://github.com/themesberg/flowbite-svelte/compare/v0.26.2...v0.26.3) (2022-09-01)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* frame abstraction ([47e4126](https://github.com/themesberg/flowbite-svelte/commit/47e4126fa02ff6b9c93d3ee7e17fee79195ac1d3))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* docs fixes due to dropdown api change ([869f8d7](https://github.com/themesberg/flowbite-svelte/commit/869f8d7bdea3a7ba97702e31b52f0e33fce3c911))
|
|
41
|
+
* remove flowbite-svelte-blocks page, add a link ([2b9e3d3](https://github.com/themesberg/flowbite-svelte/commit/2b9e3d3f72731ace8abb563e28e98309dbc58b3b))
|
|
42
|
+
* remove heros icons from ([203f14c](https://github.com/themesberg/flowbite-svelte/commit/203f14c578e57429892e0df41452abbdef1b3a4e))
|
|
43
|
+
* remove svelte-flag-icons from devDependencies ([8f48867](https://github.com/themesberg/flowbite-svelte/commit/8f488677958313a2debaa3f953314d6452a63013))
|
|
44
|
+
* update svelte-sidebar-menu version ([1106d16](https://github.com/themesberg/flowbite-svelte/commit/1106d161d06244d5db61641babc7691d28388fbd))
|
|
45
|
+
|
|
5
46
|
### [0.26.2](https://github.com/themesberg/flowbite-svelte/compare/v0.26.1...v0.26.2) (2022-08-30)
|
|
6
47
|
|
|
7
48
|
|
package/alerts/Alert.svelte
CHANGED
|
@@ -1,86 +1,44 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import classNames from 'classnames';
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
3
2
|
import { createEventDispatcher } from 'svelte';
|
|
4
3
|
import CloseButton from '../utils/CloseButton.svelte';
|
|
4
|
+
import Frame from '../utils/Frame.svelte';
|
|
5
5
|
const dispatch = createEventDispatcher();
|
|
6
|
-
setContext('background', true);
|
|
7
6
|
export let color = 'blue';
|
|
8
7
|
export let dismissable = false;
|
|
9
8
|
export let rounded = true;
|
|
10
9
|
export let accent = false;
|
|
11
|
-
export let customBgClass = '';
|
|
12
|
-
export let customBorderAccentClass = '';
|
|
13
|
-
export let customTextColor = '';
|
|
14
10
|
let hidden = false;
|
|
15
|
-
const handleAlert = () => {
|
|
16
|
-
dispatch('handleAlert');
|
|
17
|
-
};
|
|
18
11
|
const handleHide = () => {
|
|
19
12
|
hidden = !hidden;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gray: 'bg-gray-100 dark:bg-gray-200 ',
|
|
23
|
-
red: 'bg-red-100 dark:bg-red-200',
|
|
24
|
-
yellow: 'bg-yellow-100 dark:bg-yellow-200 ',
|
|
25
|
-
green: 'bg-green-100 dark:bg-green-200 ',
|
|
26
|
-
indigo: 'bg-indigo-100 dark:bg-indigo-200 ',
|
|
27
|
-
purple: 'bg-purple-100 dark:bg-purple-200 ',
|
|
28
|
-
pink: 'bg-pink-100 dark:bg-pink-200 ',
|
|
29
|
-
blue: 'bg-blue-100 dark:bg-blue-200 ',
|
|
30
|
-
dark: 'bg-gray-50 dark:bg-gray-700',
|
|
31
|
-
custom: customBgClass
|
|
32
|
-
};
|
|
33
|
-
const borderAccentClasses = {
|
|
34
|
-
gray: 'border-gray-500 dark:bg-gray-200 ',
|
|
35
|
-
red: 'border-red-500 dark:bg-red-200 ',
|
|
36
|
-
yellow: 'border-yellow-500 dark:bg-tellow-200 ',
|
|
37
|
-
green: 'border-green-500 dark:bg-green-200 ',
|
|
38
|
-
indigo: 'border-indigo-500 dark:bg-indigo-200 ',
|
|
39
|
-
purple: 'border-purple-500 dark:bg-purple-200 ',
|
|
40
|
-
pink: 'border-pink-500 dark:bg-pink-200 ',
|
|
41
|
-
blue: 'border-blue-500 dark:bg-blue-200 ',
|
|
42
|
-
dark: 'border-gray-500',
|
|
43
|
-
custom: customBorderAccentClass
|
|
44
|
-
};
|
|
45
|
-
const textColors = {
|
|
46
|
-
gray: 'text-gray-700 dark:text-gray-800',
|
|
47
|
-
red: 'text-red-700 dark:text-red-800',
|
|
48
|
-
yellow: 'text-yellow-700 dark:text-yellow-800',
|
|
49
|
-
green: 'text-green-700 dark:text-green-800',
|
|
50
|
-
indigo: 'text-indigo-700 dark:text-indigo-800',
|
|
51
|
-
purple: 'text-purple-700 dark:text-purple-800',
|
|
52
|
-
pink: 'text-pink-700 dark:text-pink-800',
|
|
53
|
-
blue: 'text-blue-700 dark:text-blue-800',
|
|
54
|
-
dark: 'text-gray-700 dark:text-gray-300',
|
|
55
|
-
custom: customTextColor
|
|
13
|
+
dispatch('handleAlert');
|
|
14
|
+
dispatch('close'); // preffered name
|
|
56
15
|
};
|
|
57
16
|
let divClass;
|
|
58
|
-
$: divClass = classNames('p-4 text-sm',
|
|
17
|
+
$: divClass = classNames('p-4 text-sm', accent && 'border-t-4 ', hidden && 'hidden', $$props.class);
|
|
59
18
|
</script>
|
|
60
19
|
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
20
|
+
<Frame {color} {rounded} {...$$restProps} class={divClass} role="alert">
|
|
21
|
+
<div class="flex items-center whitespace-pre-wrap">
|
|
22
|
+
{#if $$slots.icon}
|
|
23
|
+
<slot name="icon" />
|
|
24
|
+
{/if}
|
|
66
25
|
|
|
67
|
-
|
|
26
|
+
<slot />
|
|
68
27
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</div>
|
|
28
|
+
{#if dismissable}
|
|
29
|
+
<CloseButton
|
|
30
|
+
class="-mx-1.5 -my-1.5"
|
|
31
|
+
{color}
|
|
32
|
+
on:click={handleHide}
|
|
33
|
+
on:click
|
|
34
|
+
on:change
|
|
35
|
+
on:keydown
|
|
36
|
+
on:keyup
|
|
37
|
+
on:focus
|
|
38
|
+
on:blur
|
|
39
|
+
on:mouseenter
|
|
40
|
+
on:mouseleave />
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
<slot name="extra" />
|
|
44
|
+
</Frame>
|
package/alerts/Alert.svelte.d.ts
CHANGED
|
@@ -6,9 +6,6 @@ declare const __propDef: {
|
|
|
6
6
|
dismissable?: boolean;
|
|
7
7
|
rounded?: boolean;
|
|
8
8
|
accent?: boolean;
|
|
9
|
-
customBgClass?: string;
|
|
10
|
-
customBorderAccentClass?: string;
|
|
11
|
-
customTextColor?: string;
|
|
12
9
|
};
|
|
13
10
|
events: {
|
|
14
11
|
click: MouseEvent;
|
|
@@ -20,6 +17,7 @@ declare const __propDef: {
|
|
|
20
17
|
mouseenter: CustomEvent<any>;
|
|
21
18
|
mouseleave: CustomEvent<any>;
|
|
22
19
|
handleAlert: CustomEvent<any>;
|
|
20
|
+
close: CustomEvent<any>;
|
|
23
21
|
} & {
|
|
24
22
|
[evt: string]: CustomEvent<any>;
|
|
25
23
|
};
|
package/cards/Card.svelte
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
|
-
import
|
|
2
|
+
import Frame from '../utils/Frame.svelte';
|
|
3
3
|
export let href = undefined;
|
|
4
4
|
export let horizontal = false;
|
|
5
5
|
export let reverse = false;
|
|
6
6
|
export let img = undefined;
|
|
7
7
|
export let padding = 'lg';
|
|
8
8
|
export let size = 'sm';
|
|
9
|
-
setContext('background', true);
|
|
10
9
|
const paddings = {
|
|
11
10
|
none: 'p-0',
|
|
12
11
|
sm: 'p-4',
|
|
@@ -24,12 +23,12 @@ const sizes = {
|
|
|
24
23
|
let innerPdding;
|
|
25
24
|
$: innerPdding = paddings[padding];
|
|
26
25
|
let cardClass;
|
|
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'),
|
|
26
|
+
$: 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'), href && 'hover:bg-gray-100 dark:hover:bg-gray-700', !img && innerPdding, $$props.class);
|
|
28
27
|
let imgClass;
|
|
29
28
|
$: 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'));
|
|
30
29
|
</script>
|
|
31
30
|
|
|
32
|
-
<
|
|
31
|
+
<Frame tag={href ? 'a' : 'div'} rounded shadow border {href} class={cardClass}>
|
|
33
32
|
{#if img}
|
|
34
33
|
<img class={imgClass} src={img} alt="" />
|
|
35
34
|
<div class={innerPdding}>
|
|
@@ -38,4 +37,4 @@ $: imgClass = classNames(reverse ? 'rounded-b-lg' : 'rounded-t-lg', horizontal &
|
|
|
38
37
|
{:else}
|
|
39
38
|
<slot />
|
|
40
39
|
{/if}
|
|
41
|
-
</
|
|
40
|
+
</Frame>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import
|
|
1
|
+
<script>import Button from '../buttons/Button.svelte';
|
|
2
|
+
import Frame from '../utils/Frame.svelte';
|
|
3
3
|
import Popper from '../utils/Popper.svelte';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import ChevronUp from '../utils/ChevronUp.svelte';
|
|
6
6
|
import ChevronRight from '../utils/ChevronRight.svelte';
|
|
7
7
|
import ChevronDown from '../utils/ChevronDown.svelte';
|
|
8
8
|
import ChevronLeft from '../utils/ChevronLeft.svelte';
|
|
9
|
-
import generateId from '../utils/generateId';
|
|
10
9
|
export let label = '';
|
|
11
10
|
export let inline = false;
|
|
12
11
|
export let arrowIcon = true;
|
|
@@ -14,8 +13,6 @@ export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4
|
|
|
14
13
|
export let placement = 'bottom';
|
|
15
14
|
export let open = false;
|
|
16
15
|
export let triggeredBy = undefined;
|
|
17
|
-
let id = generateId();
|
|
18
|
-
setContext('background', true);
|
|
19
16
|
const icons = {
|
|
20
17
|
top: ChevronUp,
|
|
21
18
|
right: ChevronRight,
|
|
@@ -25,13 +22,13 @@ const icons = {
|
|
|
25
22
|
// @ts-ignore
|
|
26
23
|
$: icon = icons[placement.split('-')[0]];
|
|
27
24
|
let popoverClass;
|
|
28
|
-
$: popoverClass = classNames('
|
|
25
|
+
$: popoverClass = classNames('outline-none', $$props.class);
|
|
29
26
|
</script>
|
|
30
27
|
|
|
31
28
|
{#if label}
|
|
32
29
|
<slot name="trigger">
|
|
33
30
|
{#if inline}
|
|
34
|
-
<button
|
|
31
|
+
<button class={labelClass} class:flex-row-reverse={icon == ChevronLeft}>
|
|
35
32
|
<slot name="label">{label}</slot>
|
|
36
33
|
{#if arrowIcon}
|
|
37
34
|
<svelte:component
|
|
@@ -40,7 +37,7 @@ $: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800'
|
|
|
40
37
|
{/if}
|
|
41
38
|
</button>
|
|
42
39
|
{:else}
|
|
43
|
-
<Button {
|
|
40
|
+
<Button {...$$restProps} class={icon == ChevronLeft && 'flex-row-reverse'}>
|
|
44
41
|
<slot name="label">{label}</slot>
|
|
45
42
|
{#if arrowIcon}
|
|
46
43
|
<svelte:component
|
|
@@ -52,19 +49,12 @@ $: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800'
|
|
|
52
49
|
</slot>
|
|
53
50
|
{/if}
|
|
54
51
|
|
|
55
|
-
<Popper
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
bind:open
|
|
64
|
-
triggeredBy={triggeredBy ?? '#' + id}>
|
|
65
|
-
<slot name="content">
|
|
66
|
-
<ul class="py-1">
|
|
67
|
-
<slot />
|
|
68
|
-
</ul>
|
|
69
|
-
</slot>
|
|
52
|
+
<Popper activeContent={true} arrow={false} {placement} trigger="click" on:show bind:open {triggeredBy}>
|
|
53
|
+
<Frame class={popoverClass} rounded border shadow>
|
|
54
|
+
<slot name="content">
|
|
55
|
+
<ul class="py-1">
|
|
56
|
+
<slot />
|
|
57
|
+
</ul>
|
|
58
|
+
</slot>
|
|
59
|
+
</Frame>
|
|
70
60
|
</Popper>
|
package/index.d.ts
CHANGED
|
@@ -43,8 +43,8 @@ export { default as ArrowKeyDown } from './kbd/ArrowKeyDown.svelte';
|
|
|
43
43
|
export { default as ArrowKeyLeft } from './kbd/ArrowKeyLeft.svelte';
|
|
44
44
|
export { default as ArrowKeyRight } from './kbd/ArrowKeyRight.svelte';
|
|
45
45
|
export { default as ArrowKeyUp } from './kbd/ArrowKeyUp.svelte';
|
|
46
|
-
export { default as
|
|
47
|
-
export { default as
|
|
46
|
+
export { default as Listgroup } from './list-group/Listgroup.svelte';
|
|
47
|
+
export { default as ListgroupItem } from './list-group/ListgroupItem.svelte';
|
|
48
48
|
export { default as Modal } from './modals/Modal.svelte';
|
|
49
49
|
export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
|
|
50
50
|
export { default as Navbar } from './navbar/Navbar.svelte';
|
|
@@ -108,13 +108,17 @@ export { default as ToolbarGroup } from './toolbar/ToolbarGroup.svelte';
|
|
|
108
108
|
export { default as Tooltip } from './tooltips/Tooltip.svelte';
|
|
109
109
|
export { default as A } from './typography/A.svelte';
|
|
110
110
|
export { default as Blockquote } from './typography/Blockquote.svelte';
|
|
111
|
+
export { default as DescriptionList } from './typography/DescriptionList.svelte';
|
|
111
112
|
export { default as Heading } from './typography/Heading.svelte';
|
|
112
113
|
export { default as Highlight } from './typography/Highlight.svelte';
|
|
113
114
|
export { default as Hr } from './typography/Hr.svelte';
|
|
114
115
|
export { default as Img } from './typography/Img.svelte';
|
|
116
|
+
export { default as Li } from './typography/Li.svelte';
|
|
115
117
|
export { default as Mark } from './typography/Mark.svelte';
|
|
118
|
+
export { default as List } from './typography/List.svelte';
|
|
116
119
|
export { default as P } from './typography/P.svelte';
|
|
117
120
|
export { default as Secondary } from './typography/Secondary.svelte';
|
|
121
|
+
export { default as Span } from './typography/Span.svelte';
|
|
118
122
|
export { default as TextGradient } from './typography/TextGradient.svelte';
|
|
119
123
|
export { default as Underline } from './typography/Underline.svelte';
|
|
120
124
|
export { default as CloseButton } from './utils/CloseButton.svelte';
|
package/index.js
CHANGED
|
@@ -59,8 +59,8 @@ export { default as ArrowKeyLeft } from './kbd/ArrowKeyLeft.svelte';
|
|
|
59
59
|
export { default as ArrowKeyRight } from './kbd/ArrowKeyRight.svelte';
|
|
60
60
|
export { default as ArrowKeyUp } from './kbd/ArrowKeyUp.svelte';
|
|
61
61
|
// List
|
|
62
|
-
export { default as
|
|
63
|
-
export { default as
|
|
62
|
+
export { default as Listgroup } from './list-group/Listgroup.svelte';
|
|
63
|
+
export { default as ListgroupItem } from './list-group/ListgroupItem.svelte';
|
|
64
64
|
// Modals
|
|
65
65
|
export { default as Modal } from './modals/Modal.svelte';
|
|
66
66
|
// MegaMenu
|
|
@@ -141,13 +141,17 @@ export { default as Tooltip } from './tooltips/Tooltip.svelte';
|
|
|
141
141
|
// Typography
|
|
142
142
|
export { default as A } from './typography/A.svelte';
|
|
143
143
|
export { default as Blockquote } from './typography/Blockquote.svelte';
|
|
144
|
+
export { default as DescriptionList } from './typography/DescriptionList.svelte';
|
|
144
145
|
export { default as Heading } from './typography/Heading.svelte';
|
|
145
146
|
export { default as Highlight } from './typography/Highlight.svelte';
|
|
146
147
|
export { default as Hr } from './typography/Hr.svelte';
|
|
147
148
|
export { default as Img } from './typography/Img.svelte';
|
|
149
|
+
export { default as Li } from './typography/Li.svelte';
|
|
148
150
|
export { default as Mark } from './typography/Mark.svelte';
|
|
151
|
+
export { default as List } from './typography/List.svelte';
|
|
149
152
|
export { default as P } from './typography/P.svelte';
|
|
150
153
|
export { default as Secondary } from './typography/Secondary.svelte';
|
|
154
|
+
export { default as Span } from './typography/Span.svelte';
|
|
151
155
|
export { default as TextGradient } from './typography/TextGradient.svelte';
|
|
152
156
|
export { default as Underline } from './typography/Underline.svelte';
|
|
153
157
|
// utils
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { setContext } from 'svelte';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import ListgroupItem from './ListgroupItem.svelte';
|
|
4
|
+
import Frame from '../utils/Frame.svelte';
|
|
5
|
+
export let items = [];
|
|
6
|
+
export let active = false;
|
|
7
|
+
$: setContext('active', active);
|
|
8
|
+
let groupClass;
|
|
9
|
+
$: groupClass = classNames('divide-y divide-gray-200 dark:divide-gray-600', $$props.class);
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Frame tag={active ? 'div' : 'ul'} rounded border class={groupClass}>
|
|
13
|
+
{#each items as item, index}
|
|
14
|
+
<ListgroupItem {active} {...item} {index} on:click><slot {item} {index} /></ListgroupItem>
|
|
15
|
+
{:else}
|
|
16
|
+
<slot />
|
|
17
|
+
{/each}
|
|
18
|
+
</Frame>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ListGroupItemType } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
items?: ListGroupItemType[];
|
|
7
|
+
active?: boolean;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
click: CustomEvent<any>;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {
|
|
15
|
+
default: {};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare type ListgroupProps = typeof __propDef.props;
|
|
19
|
+
export declare type ListgroupEvents = typeof __propDef.events;
|
|
20
|
+
export declare type ListgroupSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Listgroup extends SvelteComponentTyped<ListgroupProps, ListgroupEvents, ListgroupSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
File without changes
|
|
@@ -27,9 +27,9 @@ declare const __propDef: {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
export declare type
|
|
31
|
-
export declare type
|
|
32
|
-
export declare type
|
|
33
|
-
export default class
|
|
30
|
+
export declare type ListgroupItemProps = typeof __propDef.props;
|
|
31
|
+
export declare type ListgroupItemEvents = typeof __propDef.events;
|
|
32
|
+
export declare type ListgroupItemSlots = typeof __propDef.slots;
|
|
33
|
+
export default class ListgroupItem extends SvelteComponentTyped<ListgroupItemProps, ListgroupItemEvents, ListgroupItemSlots> {
|
|
34
34
|
}
|
|
35
35
|
export {};
|
package/modals/Modal.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import Frame from '../utils/Frame.svelte';
|
|
2
|
+
import { createEventDispatcher } from 'svelte';
|
|
2
3
|
import CloseButton from '../utils/CloseButton.svelte';
|
|
3
4
|
import focusTrap from '../utils/focusTrap';
|
|
4
5
|
export let open = false;
|
|
@@ -8,7 +9,6 @@ export let placement = 'center';
|
|
|
8
9
|
export let autoclose = true;
|
|
9
10
|
export let backdropClasses = 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40';
|
|
10
11
|
const dispatch = createEventDispatcher();
|
|
11
|
-
setContext('background', true);
|
|
12
12
|
const allPlacementClasses = [
|
|
13
13
|
'justify-start',
|
|
14
14
|
'justify-center',
|
|
@@ -110,13 +110,10 @@ const hide = () => {
|
|
|
110
110
|
role={open ? 'dialog' : undefined}
|
|
111
111
|
use:init={open}
|
|
112
112
|
use:focusTrap={open}
|
|
113
|
-
on:click={onButtonsClick}
|
|
114
|
-
>
|
|
113
|
+
on:click={onButtonsClick}>
|
|
115
114
|
<div class="relative p-4 w-full {sizes[size]} h-full md:h-auto">
|
|
116
115
|
<!-- Modal content -->
|
|
117
|
-
<
|
|
118
|
-
class="relative bg-white rounded-lg shadow dark:bg-gray-700 text-gray-500 dark:text-gray-400"
|
|
119
|
-
>
|
|
116
|
+
<Frame rounded shadow class="relative">
|
|
120
117
|
<!-- Modal header -->
|
|
121
118
|
{#if $$slots.header || title}
|
|
122
119
|
<div class="flex justify-between items-center p-4 rounded-t border-b dark:border-gray-600">
|
|
@@ -136,12 +133,10 @@ const hide = () => {
|
|
|
136
133
|
</div>
|
|
137
134
|
<!-- Modal footer -->
|
|
138
135
|
{#if $$slots.footer}
|
|
139
|
-
<div
|
|
140
|
-
class="flex items-center p-6 space-x-2 rounded-b border-t border-gray-200 dark:border-gray-600"
|
|
141
|
-
>
|
|
136
|
+
<div class="flex items-center p-6 space-x-2 rounded-b border-t border-gray-200 dark:border-gray-600">
|
|
142
137
|
<slot name="footer" />
|
|
143
138
|
</div>
|
|
144
139
|
{/if}
|
|
145
|
-
</
|
|
140
|
+
</Frame>
|
|
146
141
|
</div>
|
|
147
142
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.5",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
"prism-themes": "^1.9.0",
|
|
32
32
|
"svelte": "^3.49.0",
|
|
33
33
|
"svelte-check": "^2.8.0",
|
|
34
|
-
"svelte-flag-icons": "^0.1.1",
|
|
35
34
|
"svelte-preprocess": "^4.10.7",
|
|
36
|
-
"svelte-sidebar-menu": "^0.
|
|
35
|
+
"svelte-sidebar-menu": "^0.9.11",
|
|
37
36
|
"svelte2tsx": "^0.5.13",
|
|
38
37
|
"tailwindcss": "^3.1.8",
|
|
39
38
|
"tslib": "^2.4.0",
|
|
@@ -84,8 +83,7 @@
|
|
|
84
83
|
"@floating-ui/dom": "^1.0.1",
|
|
85
84
|
"@popperjs/core": "^2.11.6",
|
|
86
85
|
"classnames": "^2.3.1",
|
|
87
|
-
"flowbite": "^1.5.2"
|
|
88
|
-
"svelte-heros": "^2.3.3"
|
|
86
|
+
"flowbite": "^1.5.2"
|
|
89
87
|
},
|
|
90
88
|
"engines": {
|
|
91
89
|
"npm": ">=7.0.0",
|
|
@@ -153,8 +151,8 @@
|
|
|
153
151
|
"./kbd/ArrowKeyRight.svelte": "./kbd/ArrowKeyRight.svelte",
|
|
154
152
|
"./kbd/ArrowKeyUp.svelte": "./kbd/ArrowKeyUp.svelte",
|
|
155
153
|
"./kbd/Kbd.svelte": "./kbd/Kbd.svelte",
|
|
156
|
-
"./list-group/
|
|
157
|
-
"./list-group/
|
|
154
|
+
"./list-group/Listgroup.svelte": "./list-group/Listgroup.svelte",
|
|
155
|
+
"./list-group/ListgroupItem.svelte": "./list-group/ListgroupItem.svelte",
|
|
158
156
|
"./megamenu/MegaMenu.svelte": "./megamenu/MegaMenu.svelte",
|
|
159
157
|
"./modals/Modal.svelte": "./modals/Modal.svelte",
|
|
160
158
|
"./navbar/Menu.svelte": "./navbar/Menu.svelte",
|
|
@@ -222,20 +220,26 @@
|
|
|
222
220
|
"./types": "./types.js",
|
|
223
221
|
"./typography/A.svelte": "./typography/A.svelte",
|
|
224
222
|
"./typography/Blockquote.svelte": "./typography/Blockquote.svelte",
|
|
223
|
+
"./typography/DescriptionList.svelte": "./typography/DescriptionList.svelte",
|
|
225
224
|
"./typography/Heading.svelte": "./typography/Heading.svelte",
|
|
226
225
|
"./typography/Highlight.svelte": "./typography/Highlight.svelte",
|
|
227
226
|
"./typography/Hr.svelte": "./typography/Hr.svelte",
|
|
228
227
|
"./typography/Img.svelte": "./typography/Img.svelte",
|
|
228
|
+
"./typography/Li.svelte": "./typography/Li.svelte",
|
|
229
|
+
"./typography/List.svelte": "./typography/List.svelte",
|
|
229
230
|
"./typography/Mark.svelte": "./typography/Mark.svelte",
|
|
230
231
|
"./typography/P.svelte": "./typography/P.svelte",
|
|
231
232
|
"./typography/Secondary.svelte": "./typography/Secondary.svelte",
|
|
233
|
+
"./typography/Span.svelte": "./typography/Span.svelte",
|
|
232
234
|
"./typography/TextGradient.svelte": "./typography/TextGradient.svelte",
|
|
235
|
+
"./typography/Ul.svelte": "./typography/Ul.svelte",
|
|
233
236
|
"./typography/Underline.svelte": "./typography/Underline.svelte",
|
|
234
237
|
"./utils/ChevronDown.svelte": "./utils/ChevronDown.svelte",
|
|
235
238
|
"./utils/ChevronLeft.svelte": "./utils/ChevronLeft.svelte",
|
|
236
239
|
"./utils/ChevronRight.svelte": "./utils/ChevronRight.svelte",
|
|
237
240
|
"./utils/ChevronUp.svelte": "./utils/ChevronUp.svelte",
|
|
238
241
|
"./utils/CloseButton.svelte": "./utils/CloseButton.svelte",
|
|
242
|
+
"./utils/Frame.svelte": "./utils/Frame.svelte",
|
|
239
243
|
"./utils/InformationCircle.svelte": "./utils/InformationCircle.svelte",
|
|
240
244
|
"./utils/Popper.svelte": "./utils/Popper.svelte",
|
|
241
245
|
"./utils/UserCircle.svelte": "./utils/UserCircle.svelte",
|
package/popover/Popover.svelte
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
<script>import Popper from '../utils/Popper.svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
export let title = '';
|
|
4
|
-
export let triggeredBy;
|
|
5
4
|
let popoverClass;
|
|
6
5
|
$: popoverClass = classNames('rounded-lg shadow-sm', 'bg-white dark:bg-gray-800', 'text-gray-500 dark:text-gray-400', 'border border-gray-200 dark:border-gray-700', $$props.class);
|
|
7
6
|
</script>
|
|
8
7
|
|
|
9
|
-
<Popper activeContent={true} {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</div>
|
|
8
|
+
<Popper activeContent={true} {...$$restProps} class={popoverClass} on:show>
|
|
9
|
+
{#if $$slots.title || title}
|
|
10
|
+
<div
|
|
11
|
+
class="py-2 px-3 bg-gray-100 rounded-t-lg border-b border-gray-200 dark:border-gray-600 dark:bg-gray-700">
|
|
12
|
+
<slot name="title">
|
|
13
|
+
<h3 class="font-semibold text-gray-900 dark:text-white">{title}</h3>
|
|
14
|
+
</slot>
|
|
15
|
+
</div>
|
|
16
|
+
{/if}
|
|
17
|
+
<div class="py-2 px-3">
|
|
18
|
+
<slot />
|
|
19
|
+
</div>
|
|
22
20
|
</Popper>
|
|
@@ -3,7 +3,6 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
title?: string;
|
|
6
|
-
triggeredBy: string;
|
|
7
6
|
};
|
|
8
7
|
events: {
|
|
9
8
|
show: CustomEvent<any>;
|
|
@@ -11,9 +10,6 @@ declare const __propDef: {
|
|
|
11
10
|
[evt: string]: CustomEvent<any>;
|
|
12
11
|
};
|
|
13
12
|
slots: {
|
|
14
|
-
trigger: {
|
|
15
|
-
slot: string;
|
|
16
|
-
};
|
|
17
13
|
title: {};
|
|
18
14
|
default: {};
|
|
19
15
|
};
|
package/toasts/Toast.svelte
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import
|
|
1
|
+
<script>import Frame from '../utils/Frame.svelte';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
3
|
import CloseButton from '../utils/CloseButton.svelte';
|
|
4
4
|
export let color = 'blue';
|
|
5
5
|
export let simple = false;
|
|
6
|
-
// Export a prop through which you can set a desired transition
|
|
7
|
-
export let transition = 'fade';
|
|
8
|
-
// Pass in extra transition params
|
|
9
|
-
export let params = {};
|
|
10
6
|
// Absolute position
|
|
11
7
|
export let position = undefined; // default not set
|
|
12
8
|
export let visible = true;
|
|
13
|
-
export let divClass = 'w-full max-w-xs p-4
|
|
14
|
-
const colors = {
|
|
15
|
-
blue: 'text-blue-500 bg-blue-100 dark:bg-blue-800 dark:text-blue-200',
|
|
16
|
-
green: 'text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200',
|
|
17
|
-
red: 'text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200',
|
|
18
|
-
gray: 'text-gray-500 bg-gray-100 dark:bg-gray-800 dark:text-gray-200',
|
|
19
|
-
purple: 'text-purple-500 bg-purple-100 dark:bg-purple-800 dark:text-purple-200',
|
|
20
|
-
indigo: 'text-indigo-500 bg-indigo-100 dark:bg-indigo-800 dark:text-indigo-200',
|
|
21
|
-
yellow: 'text-yellow-500 bg-yellow-100 dark:bg-yellow-800 dark:text-yellow-200',
|
|
22
|
-
pink: 'text-pink-500 bg-pink-100 dark:bg-pink-800 dark:text-pink-200'
|
|
23
|
-
};
|
|
24
|
-
// have a custom transition function that returns the desired transition
|
|
25
|
-
let transitionFunc;
|
|
26
|
-
$: transitionFunc = transitions[transition] ?? transitions.fade;
|
|
9
|
+
export let divClass = 'w-full max-w-xs p-4';
|
|
27
10
|
$: classDiv = classNames(divClass, {
|
|
28
11
|
'absolute top-5 left-5': position == 'tl',
|
|
29
12
|
'absolute top-5 right-5': position == 'tr',
|
|
@@ -31,14 +14,14 @@ $: classDiv = classNames(divClass, {
|
|
|
31
14
|
'absolute bottom-5 right-5': position == 'br'
|
|
32
15
|
}, $$props.class);
|
|
33
16
|
let iconClass;
|
|
34
|
-
$: iconClass = classNames('inline-flex items-center justify-center flex-shrink-0
|
|
17
|
+
$: iconClass = classNames('inline-flex items-center justify-center flex-shrink-0 w-8 h-8 mr-3');
|
|
35
18
|
</script>
|
|
36
19
|
|
|
37
20
|
{#if visible}
|
|
38
|
-
<
|
|
21
|
+
<Frame rounded border transition="fade" {...$$restProps} class={classDiv} role="alert">
|
|
39
22
|
<div class="flex {$$slots.extra ? 'items-start' : 'items-center'}">
|
|
40
23
|
{#if $$slots.icon}
|
|
41
|
-
<
|
|
24
|
+
<Frame {color} rounded class={iconClass}><slot name="icon" /></Frame>
|
|
42
25
|
{/if}
|
|
43
26
|
|
|
44
27
|
<div class="text-sm font-normal w-full">
|
|
@@ -49,5 +32,5 @@ $: iconClass = classNames('inline-flex items-center justify-center flex-shrink-0
|
|
|
49
32
|
<CloseButton on:click={() => (visible = false)} />
|
|
50
33
|
{/if}
|
|
51
34
|
</div>
|
|
52
|
-
</
|
|
35
|
+
</Frame>
|
|
53
36
|
{/if}
|
package/toasts/Toast.svelte.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Colors
|
|
2
|
+
import type { Colors } from '../types';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
color?: Colors;
|
|
7
7
|
simple?: boolean;
|
|
8
|
-
transition?: TransitionTypes;
|
|
9
|
-
params?: TransitionParamTypes;
|
|
10
8
|
position?: 'tl' | 'tr' | 'bl' | 'br';
|
|
11
9
|
visible?: boolean;
|
|
12
10
|
divClass?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let tag;
|
|
3
|
+
export let dtClass = 'text-gray-500 md:text-lg dark:text-gray-400';
|
|
4
|
+
export let ddClass = 'text-lg font-semibold';
|
|
5
|
+
let classDesc = classNames(tag === 'dt' ? dtClass : ddClass, $$props.class);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svelte:element this={tag} class={classDesc}>
|
|
9
|
+
<slot />
|
|
10
|
+
</svelte:element>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
tag: 'dt' | 'dd';
|
|
6
|
+
dtClass?: string;
|
|
7
|
+
ddClass?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type DescriptionListProps = typeof __propDef.props;
|
|
17
|
+
export declare type DescriptionListEvents = typeof __propDef.events;
|
|
18
|
+
export declare type DescriptionListSlots = typeof __propDef.slots;
|
|
19
|
+
export default class DescriptionList extends SvelteComponentTyped<DescriptionListProps, DescriptionListEvents, DescriptionListSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -13,8 +13,7 @@ const textSizes = {
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<svelte:element
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<slot />
|
|
16
|
+
this={tag}
|
|
17
|
+
class={classNames(customSize ? customSize : textSizes[tag], textColor, 'w-full', $$props.class)}>
|
|
18
|
+
<slot />
|
|
20
19
|
</svelte:element>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
icon?: boolean;
|
|
6
|
+
liClass?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type LiProps = typeof __propDef.props;
|
|
16
|
+
export declare type LiEvents = typeof __propDef.events;
|
|
17
|
+
export declare type LiSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Li extends SvelteComponentTyped<LiProps, LiEvents, LiSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let tag = 'ul';
|
|
3
|
+
export let list = 'disc';
|
|
4
|
+
export let position = 'inside';
|
|
5
|
+
export let color = 'text-gray-500 dark:text-gray-400';
|
|
6
|
+
export let olClass = 'list-decimal list-inside';
|
|
7
|
+
export let ulClass = 'max-w-md';
|
|
8
|
+
export let dlClass = 'max-w-md divide-y divide-gray-200 dark:divide-gray-700';
|
|
9
|
+
let lists = {
|
|
10
|
+
disc: 'list-disc',
|
|
11
|
+
none: 'list-none',
|
|
12
|
+
decimal: 'list-decimal'
|
|
13
|
+
};
|
|
14
|
+
let positions = {
|
|
15
|
+
inside: 'list-inside',
|
|
16
|
+
outside: 'list-outside'
|
|
17
|
+
};
|
|
18
|
+
let classList = classNames(color, tag === 'ul' ? ulClass : 'ol' ? olClass : dlClass, lists[list], positions[position], $$props.class);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<svelte:element this={tag} class={classList}>
|
|
22
|
+
<slot />
|
|
23
|
+
</svelte:element>
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { ListGroupItemType } from '../types';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
tag?: 'ul' | 'ol' | 'dl';
|
|
6
|
+
list?: 'disc' | 'none' | 'decimal';
|
|
7
|
+
position?: 'inside' | 'outside';
|
|
8
|
+
color?: string;
|
|
9
|
+
olClass?: string;
|
|
10
|
+
ulClass?: string;
|
|
11
|
+
dlClass?: string;
|
|
8
12
|
};
|
|
9
13
|
events: {
|
|
10
|
-
click: CustomEvent<any>;
|
|
11
|
-
} & {
|
|
12
14
|
[evt: string]: CustomEvent<any>;
|
|
13
15
|
};
|
|
14
16
|
slots: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
classSpan?: string;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare type SpanProps = typeof __propDef.props;
|
|
15
|
+
export declare type SpanEvents = typeof __propDef.events;
|
|
16
|
+
export declare type SpanSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Span extends SvelteComponentTyped<SpanProps, SpanEvents, SpanSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
export let list = 'disc';
|
|
3
|
+
export let position = 'inside';
|
|
4
|
+
export let ulClass = 'max-w-md text-gray-500 dark:text-gray-400';
|
|
5
|
+
let lists = {
|
|
6
|
+
disc: 'list-disc',
|
|
7
|
+
none: 'list-none',
|
|
8
|
+
decimal: 'list-decimal'
|
|
9
|
+
};
|
|
10
|
+
let positions = {
|
|
11
|
+
inside: 'list-inside',
|
|
12
|
+
outside: 'list-outside'
|
|
13
|
+
};
|
|
14
|
+
let classUl = classNames(ulClass, lists[list], positions[position], $$props.class);
|
|
15
|
+
console.log('list', list);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<ul class={classUl} {list}>
|
|
19
|
+
<slot />
|
|
20
|
+
</ul>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
list?: 'disc' | 'none' | 'decimal';
|
|
6
|
+
position?: 'inside' | 'outside';
|
|
7
|
+
ulClass?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {
|
|
13
|
+
default: {};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type UlProps = typeof __propDef.props;
|
|
17
|
+
export declare type UlEvents = typeof __propDef.events;
|
|
18
|
+
export declare type UlSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Ul extends SvelteComponentTyped<UlProps, UlEvents, UlSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
import { setContext } from 'svelte';
|
|
3
|
+
import * as transitions from 'svelte/transition';
|
|
4
|
+
setContext('background', true);
|
|
5
|
+
$: setContext('color', color);
|
|
6
|
+
export let tag = 'div';
|
|
7
|
+
export let color = 'default';
|
|
8
|
+
export let rounded = false;
|
|
9
|
+
export let border = false;
|
|
10
|
+
export let shadow = false;
|
|
11
|
+
// Export a prop through which you can set a desired transition
|
|
12
|
+
export let transition = undefined;
|
|
13
|
+
// Pass in extra transition params
|
|
14
|
+
export let params = {};
|
|
15
|
+
// your script goes here
|
|
16
|
+
const bgColors = {
|
|
17
|
+
gray: 'bg-gray-100 dark:bg-gray-200 ',
|
|
18
|
+
red: 'bg-red-100 dark:bg-red-200',
|
|
19
|
+
yellow: 'bg-yellow-100 dark:bg-yellow-200 ',
|
|
20
|
+
green: 'bg-green-100 dark:bg-green-200 ',
|
|
21
|
+
indigo: 'bg-indigo-100 dark:bg-indigo-200 ',
|
|
22
|
+
purple: 'bg-purple-100 dark:bg-purple-200 ',
|
|
23
|
+
pink: 'bg-pink-100 dark:bg-pink-200 ',
|
|
24
|
+
blue: 'bg-blue-100 dark:bg-blue-200 ',
|
|
25
|
+
light: 'bg-gray-50 dark:bg-gray-700',
|
|
26
|
+
dark: 'bg-gray-100 dark:bg-gray-700',
|
|
27
|
+
default: 'bg-white dark:bg-gray-800',
|
|
28
|
+
none: ''
|
|
29
|
+
};
|
|
30
|
+
const textColors = {
|
|
31
|
+
gray: 'text-gray-700 dark:text-gray-800',
|
|
32
|
+
red: 'text-red-700 dark:text-red-800',
|
|
33
|
+
yellow: 'text-yellow-700 dark:text-yellow-800',
|
|
34
|
+
green: 'text-green-700 dark:text-green-800',
|
|
35
|
+
indigo: 'text-indigo-700 dark:text-indigo-800',
|
|
36
|
+
purple: 'text-purple-700 dark:text-purple-800',
|
|
37
|
+
pink: 'text-pink-700 dark:text-pink-800',
|
|
38
|
+
blue: 'text-blue-700 dark:text-blue-800',
|
|
39
|
+
light: 'text-gray-700 dark:text-gray-300',
|
|
40
|
+
dark: 'text-gray-700 dark:text-gray-300',
|
|
41
|
+
default: 'text-gray-500 dark:text-gray-400',
|
|
42
|
+
none: ''
|
|
43
|
+
};
|
|
44
|
+
const borderColors = {
|
|
45
|
+
gray: 'border-gray-500 dark:bg-gray-200 ',
|
|
46
|
+
red: 'border-red-500 dark:bg-red-200 ',
|
|
47
|
+
yellow: 'border-yellow-500 dark:bg-tellow-200 ',
|
|
48
|
+
green: 'border-green-500 dark:bg-green-200 ',
|
|
49
|
+
indigo: 'border-indigo-500 dark:bg-indigo-200 ',
|
|
50
|
+
purple: 'border-purple-500 dark:bg-purple-200 ',
|
|
51
|
+
pink: 'border-pink-500 dark:bg-pink-200 ',
|
|
52
|
+
blue: 'border-blue-500 dark:bg-blue-200 ',
|
|
53
|
+
light: 'border-gray-500',
|
|
54
|
+
dark: 'border-gray-500',
|
|
55
|
+
default: 'border-gray-200 dark:border-gray-700',
|
|
56
|
+
none: ''
|
|
57
|
+
};
|
|
58
|
+
// have a custom transition function that returns the desired transition
|
|
59
|
+
let transitionFunc;
|
|
60
|
+
$: transitionFunc = transitions[transition];
|
|
61
|
+
let divClass;
|
|
62
|
+
$: divClass = classNames(bgColors[color], textColors[color], rounded && 'rounded-lg ', border && 'border', borderColors[color], shadow && 'shadow-md', $$props.class);
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{#if transitionFunc}
|
|
66
|
+
<svelte:element this={tag} transition:transitionFunc={params} {...$$restProps} class={divClass}>
|
|
67
|
+
<slot />
|
|
68
|
+
</svelte:element>
|
|
69
|
+
{:else}
|
|
70
|
+
<svelte:element this={tag} {...$$restProps} class={divClass}>
|
|
71
|
+
<slot />
|
|
72
|
+
</svelte:element>
|
|
73
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { TransitionTypes, TransitionParamTypes } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
tag?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
rounded?: boolean;
|
|
9
|
+
border?: boolean;
|
|
10
|
+
shadow?: boolean;
|
|
11
|
+
transition?: TransitionTypes;
|
|
12
|
+
params?: TransitionParamTypes;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {
|
|
18
|
+
default: {};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type FrameProps = typeof __propDef.props;
|
|
22
|
+
export declare type FrameEvents = typeof __propDef.events;
|
|
23
|
+
export declare type FrameSlots = typeof __propDef.slots;
|
|
24
|
+
export default class Frame extends SvelteComponentTyped<FrameProps, FrameEvents, FrameSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/utils/Popper.svelte
CHANGED
|
@@ -9,21 +9,22 @@ export let arrow = true;
|
|
|
9
9
|
export let offset = 8;
|
|
10
10
|
export let placement = 'top';
|
|
11
11
|
export let trigger = 'hover';
|
|
12
|
-
export let triggeredBy;
|
|
12
|
+
export let triggeredBy = undefined;
|
|
13
|
+
export let open = false;
|
|
13
14
|
const dispatch = createEventDispatcher();
|
|
14
|
-
let open = false;
|
|
15
15
|
let clickable;
|
|
16
16
|
$: clickable = trigger === 'click';
|
|
17
17
|
$: dispatch('show', triggerEl, open);
|
|
18
18
|
let triggerEl;
|
|
19
|
+
let contentEl;
|
|
19
20
|
let triggerEls = [];
|
|
20
21
|
let popper;
|
|
21
22
|
let _blocked = false; // managment of the race condition between focusin and click events
|
|
22
23
|
const block = () => ((_blocked = true), setTimeout(() => (_blocked = false), 250));
|
|
23
24
|
const showHandler = (ev) => {
|
|
24
25
|
if (triggerEl === undefined)
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
console.error('trigger undefined');
|
|
27
|
+
if (triggerEls.includes(ev.target) && triggerEl !== ev.target) {
|
|
27
28
|
triggerEl = ev.target;
|
|
28
29
|
block();
|
|
29
30
|
}
|
|
@@ -32,7 +33,7 @@ const showHandler = (ev) => {
|
|
|
32
33
|
open = clickable && ev.type === 'click' && !_blocked ? !open : true;
|
|
33
34
|
};
|
|
34
35
|
// reactivity
|
|
35
|
-
$: popper &&
|
|
36
|
+
$: popper && popper.setOptions({ placement });
|
|
36
37
|
// typescript typeguards - poper.state.element.reference: Element|HTMLElement|VirtualElement
|
|
37
38
|
const hasHover = (el) => el.matches && el.matches(':hover');
|
|
38
39
|
const hasFocus = (el) => el.contains && el.contains(document.activeElement);
|
|
@@ -50,8 +51,8 @@ const hideHandler = (ev) => {
|
|
|
50
51
|
else
|
|
51
52
|
open = false;
|
|
52
53
|
};
|
|
53
|
-
function init(node,
|
|
54
|
-
popper = createPopper(
|
|
54
|
+
function init(node, _triggerEl) {
|
|
55
|
+
popper = createPopper(_triggerEl, node, {
|
|
55
56
|
placement,
|
|
56
57
|
modifiers: [
|
|
57
58
|
{ name: 'offset', options: { offset: [0, offset] } },
|
|
@@ -59,6 +60,10 @@ function init(node, _open) {
|
|
|
59
60
|
]
|
|
60
61
|
});
|
|
61
62
|
return {
|
|
63
|
+
update(_triggerEl) {
|
|
64
|
+
popper.state.elements.reference = _triggerEl;
|
|
65
|
+
popper.update();
|
|
66
|
+
},
|
|
62
67
|
destroy() {
|
|
63
68
|
popper.destroy();
|
|
64
69
|
}
|
|
@@ -73,8 +78,12 @@ onMount(() => {
|
|
|
73
78
|
['mouseleave', hideHandler, !clickable]
|
|
74
79
|
];
|
|
75
80
|
triggerEls = [...document.querySelectorAll(triggeredBy)];
|
|
76
|
-
if (!triggerEls.length)
|
|
77
|
-
|
|
81
|
+
if (!triggerEls.length) {
|
|
82
|
+
if (contentEl.previousElementSibling)
|
|
83
|
+
triggerEls.push(contentEl.previousElementSibling);
|
|
84
|
+
else
|
|
85
|
+
console.error('No triggers found.');
|
|
86
|
+
}
|
|
78
87
|
triggerEls.forEach((element) => {
|
|
79
88
|
if (element.tabIndex < 0)
|
|
80
89
|
element.tabIndex = 0; // trigger must be focusable
|
|
@@ -82,8 +91,8 @@ onMount(() => {
|
|
|
82
91
|
if (cond)
|
|
83
92
|
element.addEventListener(name, handler);
|
|
84
93
|
});
|
|
94
|
+
triggerEl = triggerEls[0];
|
|
85
95
|
return () => {
|
|
86
|
-
triggerEl = undefined;
|
|
87
96
|
triggerEls.forEach((element) => {
|
|
88
97
|
if (element) {
|
|
89
98
|
for (const [name, handler] of events)
|
|
@@ -94,9 +103,13 @@ onMount(() => {
|
|
|
94
103
|
});
|
|
95
104
|
</script>
|
|
96
105
|
|
|
97
|
-
{#if
|
|
106
|
+
{#if !triggerEl}
|
|
107
|
+
<div id="empty" bind:this={contentEl} />
|
|
108
|
+
{/if}
|
|
109
|
+
|
|
110
|
+
{#if open && triggerEl}
|
|
98
111
|
<div
|
|
99
|
-
use:init={
|
|
112
|
+
use:init={triggerEl}
|
|
100
113
|
transition:fade={{ duration: animation ? animation : 0 }}
|
|
101
114
|
role="tooltip"
|
|
102
115
|
tabIndex={activeContent ? -1 : undefined}
|
package/utils/Popper.svelte.d.ts
CHANGED
package/list-group/List.svelte
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<script>import { setContext } from 'svelte';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import ListItem from './ListItem.svelte';
|
|
4
|
-
export let items = [];
|
|
5
|
-
export let active = false;
|
|
6
|
-
setContext('background', true);
|
|
7
|
-
$: setContext('active', active);
|
|
8
|
-
let groupClass;
|
|
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
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<svelte:element this={active ? 'div' : 'ul'} class={groupClass}>
|
|
13
|
-
{#each items as item, index}
|
|
14
|
-
<ListItem {active} {...item} {index} on:click><slot {item} {index} /></ListItem>
|
|
15
|
-
{:else}
|
|
16
|
-
<slot />
|
|
17
|
-
{/each}
|
|
18
|
-
</svelte:element>
|