flowbite-svelte 0.26.8 → 0.26.11
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 +50 -0
- package/buttons/Button.svelte +18 -19
- package/drawer/Drawer.svelte +55 -0
- package/drawer/Drawer.svelte.d.ts +32 -0
- package/dropdowns/Dropdown.svelte +2 -1
- package/dropdowns/Dropdown.svelte.d.ts +1 -0
- package/dropdowns/DropdownItem.svelte +17 -14
- package/dropdowns/DropdownItem.svelte.d.ts +1 -1
- package/forms/Range.svelte +11 -23
- package/forms/Range.svelte.d.ts +1 -5
- package/index.d.ts +3 -1
- package/index.js +5 -1
- package/megamenu/MegaMenu.svelte +20 -8
- package/megamenu/MegaMenu.svelte.d.ts +3 -0
- package/navbar/NavHamburger.svelte +5 -9
- package/navbar/NavLi.svelte +5 -4
- package/navbar/NavUl.svelte +13 -11
- package/navbar/Navbar.svelte +7 -21
- package/navbar/Navbar.svelte.d.ts +1 -2
- package/package.json +5 -3
- package/toolbar/ToolbarButton.svelte +4 -12
- package/typography/A.svelte +2 -2
- package/typography/A.svelte.d.ts +1 -1
- package/typography/Blockquote.svelte +1 -0
- package/typography/DescriptionList.svelte +1 -1
- package/typography/Heading.svelte +3 -2
- package/typography/Heading.svelte.d.ts +1 -1
- package/typography/Hr.svelte +7 -7
- package/typography/Img.svelte +14 -10
- package/typography/Layout.svelte +1 -1
- package/typography/Layout.svelte.d.ts +1 -0
- package/typography/Li.svelte +1 -1
- package/typography/List.svelte +1 -1
- package/typography/Mark.svelte +3 -3
- package/typography/Mark.svelte.d.ts +1 -1
- package/typography/P.svelte +1 -1
- package/typography/Secondary.svelte +3 -3
- package/typography/Secondary.svelte.d.ts +1 -1
- package/typography/Span.svelte +1 -1
- package/typography/Ul.svelte +1 -1
- package/utils/Chevron.svelte +11 -7
- package/utils/Chevron.svelte.d.ts +1 -0
- package/utils/Frame.svelte +12 -0
- package/utils/Frame.svelte.d.ts +1 -1
- package/utils/Popper.svelte +11 -1
- package/utils/Popper.svelte.d.ts +2 -0
- package/utils/backdrop.d.ts +6 -0
- package/utils/backdrop.js +90 -0
- package/video/Video.svelte +18 -0
- package/video/Video.svelte.d.ts +20 -0
- package/typography/Underline.svelte +0 -7
- package/typography/Underline.svelte.d.ts +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
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.11](https://github.com/themesberg/flowbite-svelte/compare/v0.26.10...v0.26.11) (2022-09-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* range - clean up ([79d35ca](https://github.com/themesberg/flowbite-svelte/commit/79d35ca127094efb20e12ad3e14635cf607edddc))
|
|
11
|
+
* video component and page ([27cd7df](https://github.com/themesberg/flowbite-svelte/commit/27cd7df226dde37e8a598b6693ae8278671d5782))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* [#266](https://github.com/themesberg/flowbite-svelte/issues/266) change {id} to {...$$restProps} ([b02822f](https://github.com/themesberg/flowbite-svelte/commit/b02822f273fe5b14613ec77e39285078a740cda0))
|
|
17
|
+
* github issue template ([b6b8fd4](https://github.com/themesberg/flowbite-svelte/commit/b6b8fd46aa7491e29935fe62ca5dc617513ee5ee))
|
|
18
|
+
* github issue template 2 ([343c102](https://github.com/themesberg/flowbite-svelte/commit/343c102ee1901c8d14fc75ab06a0fe28ac594a98))
|
|
19
|
+
* github issue template 3 ([e8c6a1b](https://github.com/themesberg/flowbite-svelte/commit/e8c6a1b7d148d0137ca0e395bf5904e3a2ed408c))
|
|
20
|
+
* github issue template 4 ([5565625](https://github.com/themesberg/flowbite-svelte/commit/5565625e343c197bd4d903878a2955eaae08b788))
|
|
21
|
+
* video component and page ([cc8dcb5](https://github.com/themesberg/flowbite-svelte/commit/cc8dcb54843ecff1f9aacc82d9139aedf7d6e0c1))
|
|
22
|
+
|
|
23
|
+
### [0.26.10](https://github.com/themesberg/flowbite-svelte/compare/v0.26.9...v0.26.10) (2022-09-05)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* add bgColor and bgOpacity to Drawer component ([8dc01fb](https://github.com/themesberg/flowbite-svelte/commit/8dc01fb9ec82b14d5f893d1255b646630e205ce2))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* 683restProps for toolbarbutton ([6ce830c](https://github.com/themesberg/flowbite-svelte/commit/6ce830c2657c6727835ded2b01728c8830a1a7d2))
|
|
34
|
+
* change ml-2 after get access to ml-1 ([b8ffc2c](https://github.com/themesberg/flowbite-svelte/commit/b8ffc2ca5016737da2d40ed5b83d4ef5fdc07e08))
|
|
35
|
+
* megamenu fullscreen position ([eaf0729](https://github.com/themesberg/flowbite-svelte/commit/eaf07294a728b524f2873df26f8250d23682dd81))
|
|
36
|
+
* navbar updates ([468839b](https://github.com/themesberg/flowbite-svelte/commit/468839bd2efee738787b428ef902cecee3f70e12))
|
|
37
|
+
* remove Figma from image page ([0276b51](https://github.com/themesberg/flowbite-svelte/commit/0276b517fc828e77bfd383be122b514bb0793da0))
|
|
38
|
+
|
|
39
|
+
### [0.26.9](https://github.com/themesberg/flowbite-svelte/compare/v0.26.8...v0.26.9) (2022-09-04)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* add id to typograpy components ([64cbe1b](https://github.com/themesberg/flowbite-svelte/commit/64cbe1b6f2cbe43fdf5cb71a0d82e3a5caad1586))
|
|
45
|
+
* add placement to Drawer component ([1b91e52](https://github.com/themesberg/flowbite-svelte/commit/1b91e52618da8935b326a69161d01f0cc7739158))
|
|
46
|
+
* working on drawer ([07a8e02](https://github.com/themesberg/flowbite-svelte/commit/07a8e02ceac450e7e7ceeb2ad9b98bfac7c7c1cf))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* folder names without s and update tests ([4e9c9ce](https://github.com/themesberg/flowbite-svelte/commit/4e9c9ce69e06b1a8e4394c3920c75606894c06d3))
|
|
52
|
+
* no dropdown docs ([4f92d9b](https://github.com/themesberg/flowbite-svelte/commit/4f92d9b56a53677bed7264b6f044e64a10c42c7e))
|
|
53
|
+
* update Htwo using scroll-mt-20 ([2006490](https://github.com/themesberg/flowbite-svelte/commit/200649069a05c6df4ed0e269d3479526092afe01))
|
|
54
|
+
|
|
5
55
|
### [0.26.8](https://github.com/themesberg/flowbite-svelte/compare/v0.26.7...v0.26.8) (2022-09-03)
|
|
6
56
|
|
|
7
57
|
|
package/buttons/Button.svelte
CHANGED
|
@@ -77,7 +77,7 @@ const hasBorder = () => outline || color === 'alternative' || color === 'light';
|
|
|
77
77
|
let buttonClass;
|
|
78
78
|
$: buttonClass = btnClass
|
|
79
79
|
? btnClass
|
|
80
|
-
: classNames('
|
|
80
|
+
: classNames('text-center font-medium', group ? 'focus:ring-2' : 'focus:ring-4', group && 'focus:z-10', !group || color === 'alternative' || (outline && color === 'dark') || 'focus:outline-none', outline && gradient
|
|
81
81
|
? 'p-0.5'
|
|
82
82
|
: 'inline-flex items-center justify-center ' + sizeClasses[size], gradient ? gradientClasses[color] : outline ? outlineClasses[color] : colorClasses[color], color === 'alternative' &&
|
|
83
83
|
(background
|
|
@@ -93,24 +93,23 @@ $: gradientOutlineClass = classNames('inline-flex items-center justify-center',
|
|
|
93
93
|
</script>
|
|
94
94
|
|
|
95
95
|
<svelte:element
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<!-- Trick to prentend outline without using border
|
|
96
|
+
this={href ? 'a' : 'button'}
|
|
97
|
+
type={href ? undefined : type}
|
|
98
|
+
{href}
|
|
99
|
+
{...$$restProps}
|
|
100
|
+
class={buttonClass}
|
|
101
|
+
on:click
|
|
102
|
+
on:change
|
|
103
|
+
on:keydown
|
|
104
|
+
on:keyup
|
|
105
|
+
on:mouseenter
|
|
106
|
+
on:mouseleave>
|
|
107
|
+
{#if outline && gradient}
|
|
108
|
+
<!-- Trick to prentend outline without using border
|
|
110
109
|
This has a limitation of no supporting transparency as
|
|
111
110
|
background is set to bg-white dark:bg-gray-900 -->
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
<span class={gradientOutlineClass}><slot /></span>
|
|
112
|
+
{:else}
|
|
113
|
+
<slot />
|
|
114
|
+
{/if}
|
|
116
115
|
</svelte:element>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
import { fly, slide, blur, fade } from 'svelte/transition';
|
|
3
|
+
import { clickOutside } from '../utils/clickOutside';
|
|
4
|
+
export let hidden = true;
|
|
5
|
+
export let position = 'fixed';
|
|
6
|
+
export let width = 'w-80';
|
|
7
|
+
export let backdrop = true;
|
|
8
|
+
export let bgColor = 'bg-gray-900';
|
|
9
|
+
export let bgOpacity = 'bg-opacity-75';
|
|
10
|
+
export let placement = 'left';
|
|
11
|
+
export let id = 'drawer-example';
|
|
12
|
+
export let divClass = 'overflow-y-auto z-50 p-4 bg-white dark:bg-gray-800';
|
|
13
|
+
export let transitionParams = {};
|
|
14
|
+
export let transitionType = 'fly';
|
|
15
|
+
function multiple(node, params) {
|
|
16
|
+
switch (transitionType) {
|
|
17
|
+
case 'slide':
|
|
18
|
+
return slide(node, params);
|
|
19
|
+
case 'blur':
|
|
20
|
+
return blur(node, params);
|
|
21
|
+
case 'fly':
|
|
22
|
+
return fly(node, params);
|
|
23
|
+
case 'fade':
|
|
24
|
+
return fade(node, params);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const placements = {
|
|
28
|
+
left: 'inset-y-0 left-0',
|
|
29
|
+
right: 'inset-y-0 right-0',
|
|
30
|
+
top: 'inset-x-0 top-0',
|
|
31
|
+
bottom: 'inset-x-0 bottom-0'
|
|
32
|
+
};
|
|
33
|
+
const handleDrawer = () => {
|
|
34
|
+
hidden = !hidden;
|
|
35
|
+
console.log('clicked');
|
|
36
|
+
};
|
|
37
|
+
let backdropDivClass = classNames('fixed top-0 left-0 z-50 w-full h-full', backdrop && bgColor, backdrop && bgOpacity);
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
{#if !hidden}
|
|
41
|
+
{#if backdrop}
|
|
42
|
+
<div class={backdropDivClass} on:click={() => !hidden && handleDrawer()} />
|
|
43
|
+
{/if}
|
|
44
|
+
<div
|
|
45
|
+
use:clickOutside={() => !hidden && handleDrawer()}
|
|
46
|
+
{id}
|
|
47
|
+
{...$$restProps}
|
|
48
|
+
class={classNames(divClass, width, position, placements[placement], $$props.class)}
|
|
49
|
+
transition:multiple={transitionParams}
|
|
50
|
+
tabindex="-1"
|
|
51
|
+
aria-controls={id}
|
|
52
|
+
aria-labelledby={id}>
|
|
53
|
+
<slot {hidden} />
|
|
54
|
+
</div>
|
|
55
|
+
{/if}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { drawerTransitionParamTypes, drawerTransitionTypes } from '../types';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
position?: 'fixed' | 'absolute';
|
|
8
|
+
width?: string;
|
|
9
|
+
backdrop?: boolean;
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
bgOpacity?: string;
|
|
12
|
+
placement?: 'left' | 'right' | 'top' | 'bottom';
|
|
13
|
+
id?: string;
|
|
14
|
+
divClass?: string;
|
|
15
|
+
transitionParams?: drawerTransitionParamTypes;
|
|
16
|
+
transitionType?: drawerTransitionTypes;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {
|
|
22
|
+
default: {
|
|
23
|
+
hidden: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare type DrawerProps = typeof __propDef.props;
|
|
28
|
+
export declare type DrawerEvents = typeof __propDef.events;
|
|
29
|
+
export declare type DrawerSlots = typeof __propDef.slots;
|
|
30
|
+
export default class Drawer extends SvelteComponentTyped<DrawerProps, DrawerEvents, DrawerSlots> {
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -8,6 +8,7 @@ export let arrowIcon = true;
|
|
|
8
8
|
export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4 font-medium text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:w-auto dark:text-gray-400 dark:hover:text-white dark:focus:text-white dark:border-gray-700 dark:hover:bg-gray-700 md:dark:hover:bg-transparent';
|
|
9
9
|
export let placement = 'bottom';
|
|
10
10
|
export let open = false;
|
|
11
|
+
export let color = 'dropdown';
|
|
11
12
|
let popoverClass;
|
|
12
13
|
$: popoverClass = classNames('outline-none', $$props.class);
|
|
13
14
|
</script>
|
|
@@ -36,9 +37,9 @@ $: popoverClass = classNames('outline-none', $$props.class);
|
|
|
36
37
|
|
|
37
38
|
<Popper
|
|
38
39
|
rounded
|
|
39
|
-
border
|
|
40
40
|
shadow
|
|
41
41
|
activeContent
|
|
42
|
+
{color}
|
|
42
43
|
arrow={false}
|
|
43
44
|
{placement}
|
|
44
45
|
trigger="click"
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let liClass = 'block font-medium cursor-pointer py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600';
|
|
3
3
|
export let color = 'default';
|
|
4
|
-
export let
|
|
4
|
+
export let href = undefined;
|
|
5
5
|
const colors = {
|
|
6
6
|
default: 'text-gray-700 dark:text-gray-200 dark:hover:text-white',
|
|
7
7
|
red: 'text-red-600 dark:text-red-500'
|
|
8
8
|
};
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
|
-
<li
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
<li>
|
|
12
|
+
<svelte:element
|
|
13
|
+
this={href ? 'a' : 'div'}
|
|
14
|
+
{href}
|
|
15
|
+
{...$$restProps}
|
|
16
|
+
class={classNames(liClass, colors[color] ?? colors.default, $$props.class)}
|
|
17
|
+
on:click
|
|
18
|
+
on:change
|
|
19
|
+
on:keydown
|
|
20
|
+
on:keyup
|
|
21
|
+
on:focus
|
|
22
|
+
on:blur
|
|
23
|
+
on:mouseenter
|
|
24
|
+
on:mouseleave>
|
|
25
|
+
<slot />
|
|
26
|
+
</svelte:element>
|
|
24
27
|
</li>
|
package/forms/Range.svelte
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let min;
|
|
3
|
-
export let max;
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
4
2
|
export let value;
|
|
5
|
-
export let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
inputClass += 'h-2 mb-6';
|
|
16
|
-
}
|
|
3
|
+
export let size = 'md';
|
|
4
|
+
const sizes = {
|
|
5
|
+
sm: 'h-1 range-sm',
|
|
6
|
+
md: 'h-2',
|
|
7
|
+
lg: 'h-3 range-lg'
|
|
8
|
+
};
|
|
9
|
+
let inputClass;
|
|
10
|
+
$: inputClass = classNames('w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700', sizes[size] ?? sizes.md, $$props.class);
|
|
17
11
|
</script>
|
|
18
12
|
|
|
19
13
|
<input
|
|
20
|
-
{...$$restProps}
|
|
21
|
-
{id}
|
|
22
|
-
name={id}
|
|
23
14
|
type="range"
|
|
24
|
-
{min}
|
|
25
|
-
{max}
|
|
26
15
|
bind:value
|
|
27
|
-
{
|
|
16
|
+
{...$$restProps}
|
|
28
17
|
class={inputClass}
|
|
29
18
|
on:change
|
|
30
19
|
on:click
|
|
31
20
|
on:keydown
|
|
32
21
|
on:keypress
|
|
33
|
-
on:keyup
|
|
34
|
-
/>
|
|
22
|
+
on:keyup />
|
package/forms/Range.svelte.d.ts
CHANGED
|
@@ -2,12 +2,8 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
id?: string;
|
|
6
|
-
min: number;
|
|
7
|
-
max: number;
|
|
8
5
|
value: number;
|
|
9
|
-
|
|
10
|
-
size: 'small' | 'large';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
7
|
};
|
|
12
8
|
events: {
|
|
13
9
|
change: Event;
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Carousel } from './carousels/Carousel.svelte';
|
|
|
11
11
|
export { default as CarouselTransition } from './carousels/CarouselTransition.svelte';
|
|
12
12
|
export { default as DarkMode } from './darkmode/DarkMode.svelte';
|
|
13
13
|
export { default as Datepicker } from './datepicker/Datepicker.svelte';
|
|
14
|
+
export { default as Drawer } from './drawer/Drawer.svelte';
|
|
14
15
|
export { default as Dropdown } from './dropdowns/Dropdown.svelte';
|
|
15
16
|
export { default as DropdownDivider } from './dropdowns/DropdownDivider.svelte';
|
|
16
17
|
export { default as DropdownHeader } from './dropdowns/DropdownHeader.svelte';
|
|
@@ -49,7 +50,6 @@ export { default as Modal } from './modals/Modal.svelte';
|
|
|
49
50
|
export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
|
|
50
51
|
export { default as Navbar } from './navbar/Navbar.svelte';
|
|
51
52
|
export { default as NavBrand } from './navbar/NavBrand.svelte';
|
|
52
|
-
export { default as NavDropdown } from './navbar/NavDropdown.svelte';
|
|
53
53
|
export { default as NavHamburger } from './navbar/NavHamburger.svelte';
|
|
54
54
|
export { default as NavLi } from './navbar/NavLi.svelte';
|
|
55
55
|
export { default as NavUl } from './navbar/NavUl.svelte';
|
|
@@ -124,5 +124,7 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
|
|
|
124
124
|
export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
|
|
125
125
|
export { default as ChevronRight } from './utils/ChevronRight.svelte';
|
|
126
126
|
export { default as ChevronUp } from './utils/ChevronUp.svelte';
|
|
127
|
+
export { default as Chevron } from './utils/Chevron.svelte';
|
|
127
128
|
export { default as InformationCircle } from './utils/InformationCircle.svelte';
|
|
128
129
|
export { default as UserCircle } from './utils/UserCircle.svelte';
|
|
130
|
+
export { default as Video } from './video/Video.svelte';
|
package/index.js
CHANGED
|
@@ -22,6 +22,8 @@ export { default as CarouselTransition } from './carousels/CarouselTransition.sv
|
|
|
22
22
|
export { default as DarkMode } from './darkmode/DarkMode.svelte';
|
|
23
23
|
// Datepicker
|
|
24
24
|
export { default as Datepicker } from './datepicker/Datepicker.svelte';
|
|
25
|
+
// Drawer
|
|
26
|
+
export { default as Drawer } from './drawer/Drawer.svelte';
|
|
25
27
|
// Dropdown
|
|
26
28
|
export { default as Dropdown } from './dropdowns/Dropdown.svelte';
|
|
27
29
|
export { default as DropdownDivider } from './dropdowns/DropdownDivider.svelte';
|
|
@@ -68,7 +70,6 @@ export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
|
|
|
68
70
|
// Navbar
|
|
69
71
|
export { default as Navbar } from './navbar/Navbar.svelte';
|
|
70
72
|
export { default as NavBrand } from './navbar/NavBrand.svelte';
|
|
71
|
-
export { default as NavDropdown } from './navbar/NavDropdown.svelte';
|
|
72
73
|
export { default as NavHamburger } from './navbar/NavHamburger.svelte';
|
|
73
74
|
export { default as NavLi } from './navbar/NavLi.svelte';
|
|
74
75
|
export { default as NavUl } from './navbar/NavUl.svelte';
|
|
@@ -158,5 +159,8 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
|
|
|
158
159
|
export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
|
|
159
160
|
export { default as ChevronRight } from './utils/ChevronRight.svelte';
|
|
160
161
|
export { default as ChevronUp } from './utils/ChevronUp.svelte';
|
|
162
|
+
export { default as Chevron } from './utils/Chevron.svelte';
|
|
161
163
|
export { default as InformationCircle } from './utils/InformationCircle.svelte';
|
|
162
164
|
export { default as UserCircle } from './utils/UserCircle.svelte';
|
|
165
|
+
// video
|
|
166
|
+
export { default as Video } from './video/Video.svelte';
|
package/megamenu/MegaMenu.svelte
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
import Popper from '../utils/Popper.svelte';
|
|
3
3
|
export let items = [];
|
|
4
4
|
export let full = false;
|
|
5
|
-
|
|
5
|
+
export let open = false;
|
|
6
6
|
let wrapperClass;
|
|
7
|
-
$: wrapperClass = classNames(
|
|
7
|
+
$: wrapperClass = classNames(full && 'border-y w-full', $$props.class);
|
|
8
8
|
let ulClass;
|
|
9
|
-
$: ulClass = classNames('grid grid-flow-row gap-y-4 md:gap-x-0 auto-col-max auto-row-max', full && $$slots.extra ? 'grid-cols-2' : 'grid-cols-2 md:grid-cols-3', 'text-sm font-medium',
|
|
9
|
+
$: ulClass = classNames('grid grid-flow-row gap-y-4 md:gap-x-0 auto-col-max auto-row-max', full && $$slots.extra ? 'grid-cols-2' : 'grid-cols-2 md:grid-cols-3', 'text-sm font-medium', full && $$slots.extra && 'md:w-2/3');
|
|
10
10
|
const init = (node) => {
|
|
11
11
|
if (full) {
|
|
12
12
|
node.parentElement.classList.add('inset-x-0');
|
|
@@ -14,8 +14,20 @@ const init = (node) => {
|
|
|
14
14
|
};
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<
|
|
18
|
-
|
|
17
|
+
<Popper
|
|
18
|
+
color={full ? 'default' : 'dropdown'}
|
|
19
|
+
border={!full}
|
|
20
|
+
rounded={!full}
|
|
21
|
+
activeContent
|
|
22
|
+
arrow={false}
|
|
23
|
+
trigger="click"
|
|
24
|
+
placement="bottom"
|
|
25
|
+
yOnly={full}
|
|
26
|
+
{...$$restProps}
|
|
27
|
+
class={wrapperClass}
|
|
28
|
+
on:show
|
|
29
|
+
bind:open>
|
|
30
|
+
<div class="flex flex-col md:flex-row p-4 max-w-screen-md justify-center mx-auto">
|
|
19
31
|
<ul class={ulClass}>
|
|
20
32
|
{#each items as item, index}
|
|
21
33
|
<li>
|
|
@@ -27,4 +39,4 @@ const init = (node) => {
|
|
|
27
39
|
</ul>
|
|
28
40
|
{#if full && $$slots.extra}<div class="md:w-1/3 mt-4 md:mt-0"><slot name="extra" /></div>{/if}
|
|
29
41
|
</div>
|
|
30
|
-
</
|
|
42
|
+
</Popper>
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import ToolbarButton from '../toolbar/ToolbarButton.svelte';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import Menu from './Menu.svelte';
|
|
3
|
-
export let btnClass = 'ml-3
|
|
4
|
+
export let btnClass = 'ml-3 md:hidden';
|
|
4
5
|
</script>
|
|
5
6
|
|
|
6
|
-
<
|
|
7
|
-
{...$$restProps}
|
|
8
|
-
class={classNames(btnClass, $$props.class)}
|
|
9
|
-
data-testid="navbar-toggle"
|
|
10
|
-
on:click>
|
|
11
|
-
<span class="sr-only">Open main menu</span>
|
|
7
|
+
<ToolbarButton name="Open main menu" on:click {...$$restProps} class={classNames(btnClass, $$props.class)}>
|
|
12
8
|
<Menu class="h-6 w-6 shrink-0" />
|
|
13
|
-
</
|
|
9
|
+
</ToolbarButton>
|
package/navbar/NavLi.svelte
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let href = '';
|
|
3
3
|
export let active = false;
|
|
4
|
-
export let activeClass = '
|
|
5
|
-
export let nonActiveClass = '
|
|
6
|
-
|
|
4
|
+
export let activeClass = 'text-white bg-blue-700 md:bg-transparent md:text-blue-700 md:dark:text-white dark:bg-blue-600 md:dark:bg-transparent';
|
|
5
|
+
export let nonActiveClass = 'text-gray-700 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent';
|
|
6
|
+
let liClass;
|
|
7
|
+
$: liClass = classNames('block py-2 pr-4 pl-3 md:p-0 rounded md:border-0', active ? activeClass : nonActiveClass, $$props.class);
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<li>
|
|
@@ -21,7 +22,7 @@ $: aClass = active ? activeClass : nonActiveClass;
|
|
|
21
22
|
on:mouseenter
|
|
22
23
|
on:mouseleave
|
|
23
24
|
on:mouseover
|
|
24
|
-
class={
|
|
25
|
+
class={liClass}>
|
|
25
26
|
<slot />
|
|
26
27
|
</svelte:element>
|
|
27
28
|
</li>
|
package/navbar/NavUl.svelte
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
import { slide } from 'svelte/transition';
|
|
3
3
|
import { quintOut } from 'svelte/easing';
|
|
4
|
+
import Frame from '../utils/Frame.svelte';
|
|
4
5
|
export let divClass = 'w-full md:block md:w-auto';
|
|
5
|
-
export let ulClass = 'flex flex-col mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium';
|
|
6
|
+
export let ulClass = 'flex flex-col p-4 mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium';
|
|
6
7
|
export let hidden = true;
|
|
8
|
+
let _divClass;
|
|
9
|
+
$: _divClass = classNames(divClass, $$props.class);
|
|
10
|
+
let _ulClass;
|
|
11
|
+
$: _ulClass = classNames(ulClass,
|
|
12
|
+
// 'divide-y md:divide-y-0 divide-gray-100 dark:divide-gray-700',
|
|
13
|
+
$$props.class);
|
|
7
14
|
</script>
|
|
8
15
|
|
|
9
16
|
{#if !hidden}
|
|
10
|
-
<div
|
|
11
|
-
{
|
|
12
|
-
class={classNames(divClass, $$props.class)}
|
|
13
|
-
id="mobile-menu"
|
|
14
|
-
transition:slide={{ delay: 250, duration: 500, easing: quintOut }}
|
|
15
|
-
>
|
|
16
|
-
<ul class={classNames(ulClass, $$props.class)}>
|
|
17
|
+
<div {...$$restProps} class={_divClass} transition:slide={{ delay: 250, duration: 500, easing: quintOut }}>
|
|
18
|
+
<Frame tag="ul" border rounded color="navbarUl" class={_ulClass}>
|
|
17
19
|
<slot />
|
|
18
|
-
</
|
|
20
|
+
</Frame>
|
|
19
21
|
</div>
|
|
20
22
|
{:else}
|
|
21
|
-
<div {...$$restProps} class={
|
|
22
|
-
<ul class={
|
|
23
|
+
<div {...$$restProps} class={_divClass} {hidden}>
|
|
24
|
+
<ul class={_ulClass}>
|
|
23
25
|
<slot />
|
|
24
26
|
</ul>
|
|
25
27
|
</div>
|
package/navbar/Navbar.svelte
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
|
|
1
|
+
<script>import Frame from '../utils/Frame.svelte';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
export let navClass = 'px-2 sm:px-4 py-2.5';
|
|
3
4
|
export let navDivClass = 'mx-auto flex flex-wrap justify-between items-center ';
|
|
4
5
|
export let fluid = true;
|
|
5
|
-
export let
|
|
6
|
-
export let border = false;
|
|
6
|
+
export let color = 'navbar';
|
|
7
7
|
let hidden = true;
|
|
8
8
|
let toggle = () => {
|
|
9
9
|
hidden = !hidden;
|
|
10
10
|
};
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<nav
|
|
14
|
-
{
|
|
15
|
-
class={classNames(
|
|
16
|
-
navClass,
|
|
17
|
-
{
|
|
18
|
-
rounded: rounded,
|
|
19
|
-
border: border
|
|
20
|
-
},
|
|
21
|
-
$$props.class
|
|
22
|
-
)}
|
|
23
|
-
>
|
|
24
|
-
<div
|
|
25
|
-
class={classNames(navDivClass, {
|
|
26
|
-
container: fluid
|
|
27
|
-
})}
|
|
28
|
-
>
|
|
13
|
+
<Frame tag="nav" {color} {...$$restProps} class={classNames(navClass, $$props.class)}>
|
|
14
|
+
<div class={classNames(navDivClass, fluid && 'container')}>
|
|
29
15
|
<slot {hidden} {toggle} />
|
|
30
16
|
</div>
|
|
31
|
-
</
|
|
17
|
+
</Frame>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.11",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"./darkmode/DarkMode.svelte": "./darkmode/DarkMode.svelte",
|
|
119
119
|
"./datepicker/Calender.svelte": "./datepicker/Calender.svelte",
|
|
120
120
|
"./datepicker/Datepicker.svelte": "./datepicker/Datepicker.svelte",
|
|
121
|
+
"./drawer/Drawer.svelte": "./drawer/Drawer.svelte",
|
|
121
122
|
"./dropdowns/Dropdown.svelte": "./dropdowns/Dropdown.svelte",
|
|
122
123
|
"./dropdowns/DropdownDivider.svelte": "./dropdowns/DropdownDivider.svelte",
|
|
123
124
|
"./dropdowns/DropdownHeader.svelte": "./dropdowns/DropdownHeader.svelte",
|
|
@@ -232,7 +233,6 @@
|
|
|
232
233
|
"./typography/Secondary.svelte": "./typography/Secondary.svelte",
|
|
233
234
|
"./typography/Span.svelte": "./typography/Span.svelte",
|
|
234
235
|
"./typography/Ul.svelte": "./typography/Ul.svelte",
|
|
235
|
-
"./typography/Underline.svelte": "./typography/Underline.svelte",
|
|
236
236
|
"./utils/Chevron.svelte": "./utils/Chevron.svelte",
|
|
237
237
|
"./utils/ChevronDown.svelte": "./utils/ChevronDown.svelte",
|
|
238
238
|
"./utils/ChevronLeft.svelte": "./utils/ChevronLeft.svelte",
|
|
@@ -244,10 +244,12 @@
|
|
|
244
244
|
"./utils/Popper.svelte": "./utils/Popper.svelte",
|
|
245
245
|
"./utils/UserCircle.svelte": "./utils/UserCircle.svelte",
|
|
246
246
|
"./utils/Wrapper.svelte": "./utils/Wrapper.svelte",
|
|
247
|
+
"./utils/backdrop": "./utils/backdrop.js",
|
|
247
248
|
"./utils/clickOutside": "./utils/clickOutside.js",
|
|
248
249
|
"./utils/createEventDispatcher": "./utils/createEventDispatcher.js",
|
|
249
250
|
"./utils/focusTrap": "./utils/focusTrap.js",
|
|
250
|
-
"./utils/generateId": "./utils/generateId.js"
|
|
251
|
+
"./utils/generateId": "./utils/generateId.js",
|
|
252
|
+
"./video/Video.svelte": "./video/Video.svelte"
|
|
251
253
|
},
|
|
252
254
|
"svelte": "./index.js"
|
|
253
255
|
}
|
|
@@ -23,9 +23,7 @@ const sizing = {
|
|
|
23
23
|
};
|
|
24
24
|
let buttonClass;
|
|
25
25
|
$: buttonClass = classNames('focus:outline-none whitespace-normal', sizing[size], colors[color], color === 'default' &&
|
|
26
|
-
(background
|
|
27
|
-
? 'hover:bg-gray-100 dark:hover:bg-gray-600'
|
|
28
|
-
: 'hover:bg-gray-100 dark:hover:bg-gray-700'), $$props.class);
|
|
26
|
+
(background ? 'hover:bg-gray-100 dark:hover:bg-gray-600' : 'hover:bg-gray-100 dark:hover:bg-gray-700'), $$props.class);
|
|
29
27
|
const svgSizes = {
|
|
30
28
|
xs: 'w-3 h-3',
|
|
31
29
|
sm: 'w-3.5 h-3.5',
|
|
@@ -33,20 +31,14 @@ const svgSizes = {
|
|
|
33
31
|
};
|
|
34
32
|
</script>
|
|
35
33
|
|
|
36
|
-
<button on:click type="button" class={buttonClass} aria-label={ariaLabel ?? name}>
|
|
34
|
+
<button on:click type="button" {...$$restProps} class={buttonClass} aria-label={ariaLabel ?? name}>
|
|
37
35
|
{#if name}<span class="sr-only">{name}</span>{/if}
|
|
38
36
|
<slot>
|
|
39
|
-
<svg
|
|
40
|
-
class={svgSizes[size]}
|
|
41
|
-
fill="currentColor"
|
|
42
|
-
viewBox="0 0 20 20"
|
|
43
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
-
>
|
|
37
|
+
<svg class={svgSizes[size]} fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
45
38
|
<path
|
|
46
39
|
fill-rule="evenodd"
|
|
47
40
|
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"
|
|
48
|
-
clip-rule="evenodd"
|
|
49
|
-
/>
|
|
41
|
+
clip-rule="evenodd" />
|
|
50
42
|
</svg>
|
|
51
43
|
</slot>
|
|
52
44
|
</button>
|
package/typography/A.svelte
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let href = '#';
|
|
3
|
-
export let
|
|
3
|
+
export let color = 'text-blue-600 dark:text-blue-500';
|
|
4
4
|
export let aClass = 'inline-flex items-center hover:underline';
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<a {href} class={classNames(aClass,
|
|
7
|
+
<a {...$$restProps} {href} class={classNames(aClass, color, $$props.class)}>
|
|
8
8
|
<slot />
|
|
9
9
|
</a>
|
package/typography/A.svelte.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export let ddClass = 'text-lg font-semibold';
|
|
|
5
5
|
let classDesc = classNames(tag === 'dt' ? dtClass : ddClass, $$props.class);
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<svelte:element this={tag} class={classDesc}>
|
|
8
|
+
<svelte:element this={tag} {...$$restProps} class={classDesc}>
|
|
9
9
|
<slot />
|
|
10
10
|
</svelte:element>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
export let tag = 'h1';
|
|
3
|
-
export let
|
|
3
|
+
export let color = 'text-gray-900 dark:text-white';
|
|
4
4
|
export let customSize;
|
|
5
5
|
const textSizes = {
|
|
6
6
|
h1: 'text-5xl font-extrabold',
|
|
@@ -14,6 +14,7 @@ const textSizes = {
|
|
|
14
14
|
|
|
15
15
|
<svelte:element
|
|
16
16
|
this={tag}
|
|
17
|
-
|
|
17
|
+
{...$$restProps}
|
|
18
|
+
class={classNames(customSize ? customSize : textSizes[tag], color, 'w-full', $$props.class)}>
|
|
18
19
|
<slot />
|
|
19
20
|
</svelte:element>
|
package/typography/Hr.svelte
CHANGED
|
@@ -13,12 +13,12 @@ let middleClass = classNames(middleBgColor, icon ? iconDivClass : textSpanClass)
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
{#if $$slots}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<div {...$$restProps} class={classDiv}>
|
|
17
|
+
<hr class={horizontalClass} />
|
|
18
|
+
<div class={middleClass}>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
22
|
{:else}
|
|
23
|
-
|
|
23
|
+
<hr class={horizontalClass} />
|
|
24
24
|
{/if}
|
package/typography/Img.svelte
CHANGED
|
@@ -12,15 +12,19 @@ export let captionClass = 'mt-2 text-sm text-center text-gray-500 dark:text-gray
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
{#if caption}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</figure>
|
|
15
|
+
<figure class={figClass}>
|
|
16
|
+
<img
|
|
17
|
+
class={classNames(imgClass, size, alignment, effect, $$props.class)}
|
|
18
|
+
{src}
|
|
19
|
+
{srcset}
|
|
20
|
+
{alt} />
|
|
21
|
+
<figcaption class={captionClass}>{@html caption}</figcaption>
|
|
22
|
+
</figure>
|
|
24
23
|
{:else}
|
|
25
|
-
|
|
24
|
+
<img
|
|
25
|
+
{...$$restProps}
|
|
26
|
+
class={classNames(imgClass, size, alignment, effect, $$props.class)}
|
|
27
|
+
{src}
|
|
28
|
+
{srcset}
|
|
29
|
+
{alt} />
|
|
26
30
|
{/if}
|
package/typography/Layout.svelte
CHANGED
package/typography/Li.svelte
CHANGED
package/typography/List.svelte
CHANGED
|
@@ -18,6 +18,6 @@ let positions = {
|
|
|
18
18
|
let classList = classNames(color, tag === 'ul' ? ulClass : 'ol' ? olClass : dlClass, lists[list], positions[position], $$props.class);
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
|
-
<svelte:element this={tag} class={classList}>
|
|
21
|
+
<svelte:element this={tag} {...$$restProps} class={classList}>
|
|
22
22
|
<slot />
|
|
23
23
|
</svelte:element>
|
package/typography/Mark.svelte
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
|
-
export let
|
|
2
|
+
export let color = 'text-white dark:bg-blue-500';
|
|
3
3
|
export let bgColor = 'bg-blue-600';
|
|
4
4
|
export let markClass = 'px-2 rounded';
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<mark class={classNames(markClass, bgColor,
|
|
8
|
-
|
|
7
|
+
<mark {...$$restProps} class={classNames(markClass, bgColor, color, $$props.class)}>
|
|
8
|
+
<slot />
|
|
9
9
|
</mark>
|
package/typography/P.svelte
CHANGED
|
@@ -72,6 +72,6 @@ let colorAndopacity = color
|
|
|
72
72
|
let classP = classNames(size && sizes[size], (opacity && colorAndopacity) || (color && color), height && heights[height], weight && weights[weight], space && spaces[space], align && aligns[align], justify && 'text-justify', italic && 'italic', firstupper && upperClass, whitespace && whitespaces[whitespace], $$props.class);
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
|
-
<p class={classP}>
|
|
75
|
+
<p {...$$restProps} class={classP}>
|
|
76
76
|
<slot />
|
|
77
77
|
</p>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
|
-
export let
|
|
2
|
+
export let color = 'text-gray-500 dark:text-gray-400';
|
|
3
3
|
export let secondaryClass = 'font-semibold';
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<small class={classNames(
|
|
7
|
-
|
|
6
|
+
<small {...$$restProps} class={classNames(color, secondaryClass, $$props.class)}>
|
|
7
|
+
<slot />
|
|
8
8
|
</small>
|
package/typography/Span.svelte
CHANGED
|
@@ -12,6 +12,6 @@ let underlineClass = classNames('underline', decorationClass);
|
|
|
12
12
|
let classSpan = classNames(italic && 'italic', underline && underlineClass, linethrough && 'line-through', uppercase && 'uppercase', gradient ? gradientClass : 'font-semibold text-gray-900 dark:text-white', highlight && highlightClass, $$props.class);
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
<span class={classSpan}>
|
|
15
|
+
<span {...$$restProps} class={classSpan}>
|
|
16
16
|
<slot />
|
|
17
17
|
</span>
|
package/typography/Ul.svelte
CHANGED
package/utils/Chevron.svelte
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import ChevronLeft from './ChevronLeft.svelte';
|
|
3
3
|
import ChevronUp from './ChevronUp.svelte';
|
|
4
4
|
import ChevronRight from './ChevronRight.svelte';
|
|
5
|
+
import Wrapper from './Wrapper.svelte';
|
|
5
6
|
export let placement = 'bottom';
|
|
7
|
+
export let aligned = false;
|
|
6
8
|
const icons = {
|
|
7
9
|
top: ChevronUp,
|
|
8
10
|
right: ChevronRight,
|
|
@@ -14,10 +16,12 @@ let icon;
|
|
|
14
16
|
$: icon = icons[placement.split('-')[0]] ?? ChevronDown;
|
|
15
17
|
</script>
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
19
|
+
<Wrapper class="flex items-center justify-between" show={aligned}>
|
|
20
|
+
{#if placement.split('-')[0] === 'left'}
|
|
21
|
+
<ChevronLeft class="h-4 w-4 mr-2" />
|
|
22
|
+
<slot />
|
|
23
|
+
{:else}
|
|
24
|
+
<slot />
|
|
25
|
+
<svelte:component this={icon} class="h-4 w-4 ml-2" />
|
|
26
|
+
{/if}
|
|
27
|
+
</Wrapper>
|
package/utils/Frame.svelte
CHANGED
|
@@ -29,6 +29,10 @@ const bgColors = {
|
|
|
29
29
|
light: 'bg-gray-50 dark:bg-gray-700',
|
|
30
30
|
dark: 'bg-gray-100 dark:bg-gray-700',
|
|
31
31
|
default: 'bg-white dark:bg-gray-800',
|
|
32
|
+
dropdown: 'bg-white dark:bg-gray-700',
|
|
33
|
+
navbar: 'bg-white dark:bg-gray-900',
|
|
34
|
+
navbarUl: 'bg-gray-50 dark:bg-gray-800',
|
|
35
|
+
form: 'bg-gray-50 dark:bg-gray-700',
|
|
32
36
|
none: ''
|
|
33
37
|
};
|
|
34
38
|
const textColors = {
|
|
@@ -43,6 +47,10 @@ const textColors = {
|
|
|
43
47
|
light: 'text-gray-700 dark:text-gray-300',
|
|
44
48
|
dark: 'text-gray-700 dark:text-gray-300',
|
|
45
49
|
default: 'text-gray-500 dark:text-gray-400',
|
|
50
|
+
dropdown: 'text-gray-500 dark:text-gray-400',
|
|
51
|
+
navbar: 'text-gray-700 dark:text-gray-200',
|
|
52
|
+
navbarUl: 'text-gray-700 dark:text-gray-400',
|
|
53
|
+
from: 'text-gray-900 dark:text-white',
|
|
46
54
|
none: ''
|
|
47
55
|
};
|
|
48
56
|
const borderColors = {
|
|
@@ -57,6 +65,10 @@ const borderColors = {
|
|
|
57
65
|
light: 'border-gray-500',
|
|
58
66
|
dark: 'border-gray-500',
|
|
59
67
|
default: 'border-gray-200 dark:border-gray-700',
|
|
68
|
+
dropdown: 'border-gray-100 dark:border-gray-700',
|
|
69
|
+
navbar: 'border-gray-100 dark:border-gray-700',
|
|
70
|
+
navbarUl: 'border-gray-100 dark:border-gray-700',
|
|
71
|
+
form: 'border-gray-300 dark:border-gray-700',
|
|
60
72
|
none: ''
|
|
61
73
|
};
|
|
62
74
|
// have a custom transition function that returns the desired transition
|
package/utils/Frame.svelte.d.ts
CHANGED
package/utils/Popper.svelte
CHANGED
|
@@ -9,7 +9,9 @@ export let offset = 8;
|
|
|
9
9
|
export let placement = 'top';
|
|
10
10
|
export let trigger = 'hover';
|
|
11
11
|
export let triggeredBy = undefined;
|
|
12
|
+
export let strategy = 'absolute';
|
|
12
13
|
export let open = false;
|
|
14
|
+
export let yOnly = false;
|
|
13
15
|
const dispatch = createEventDispatcher();
|
|
14
16
|
let clickable;
|
|
15
17
|
$: clickable = trigger === 'click';
|
|
@@ -53,8 +55,16 @@ const hideHandler = (ev) => {
|
|
|
53
55
|
function init(node, _triggerEl) {
|
|
54
56
|
popper = createPopper(_triggerEl, node, {
|
|
55
57
|
placement,
|
|
58
|
+
strategy,
|
|
56
59
|
modifiers: [
|
|
57
|
-
{
|
|
60
|
+
{
|
|
61
|
+
name: 'offset',
|
|
62
|
+
options: {
|
|
63
|
+
offset: ({ placement, reference, popper }) => {
|
|
64
|
+
return [yOnly ? popper.width / 2 - reference.width / 2 - reference.x : 0, offset];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
58
68
|
{ name: 'eventListeners', enabled: open }
|
|
59
69
|
]
|
|
60
70
|
});
|
package/utils/Popper.svelte.d.ts
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createEventDispatcher } from 'svelte';
|
|
2
|
+
export let open = false;
|
|
3
|
+
const backdropClasses = 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40';
|
|
4
|
+
export let placement;
|
|
5
|
+
// const placement:
|
|
6
|
+
// | 'top-left'
|
|
7
|
+
// | 'top-center'
|
|
8
|
+
// | 'top-right'
|
|
9
|
+
// | 'center-left'
|
|
10
|
+
// | 'center'
|
|
11
|
+
// | 'center-right'
|
|
12
|
+
// | 'bottom-left'
|
|
13
|
+
// | 'bottom-center'
|
|
14
|
+
// | 'bottom-right'='center';
|
|
15
|
+
export const init = (node, _open) => {
|
|
16
|
+
getPlacementClasses().map((c) => node.classList.add(c));
|
|
17
|
+
_open && createBackdrop(node);
|
|
18
|
+
console.log('init clicked');
|
|
19
|
+
return {
|
|
20
|
+
update(_open) {
|
|
21
|
+
allPlacementClasses.map((c) => node.classList.remove(c));
|
|
22
|
+
getPlacementClasses().map((c) => node.classList.add(c));
|
|
23
|
+
_open ? createBackdrop(node) : destroyBackdrop(node);
|
|
24
|
+
},
|
|
25
|
+
destroy() {
|
|
26
|
+
destroyBackdrop(node);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const getPlacementClasses = () => {
|
|
31
|
+
switch (placement) {
|
|
32
|
+
// top
|
|
33
|
+
case 'top-left':
|
|
34
|
+
return ['justify-start', 'items-start'];
|
|
35
|
+
case 'top-center':
|
|
36
|
+
return ['justify-center', 'items-start'];
|
|
37
|
+
case 'top-right':
|
|
38
|
+
return ['justify-end', 'items-start'];
|
|
39
|
+
// center
|
|
40
|
+
case 'center-left':
|
|
41
|
+
return ['justify-start', 'items-center'];
|
|
42
|
+
case 'center':
|
|
43
|
+
return ['justify-center', 'items-center'];
|
|
44
|
+
case 'center-right':
|
|
45
|
+
return ['justify-end', 'items-center'];
|
|
46
|
+
// bottom
|
|
47
|
+
case 'bottom-left':
|
|
48
|
+
return ['justify-start', 'items-end'];
|
|
49
|
+
case 'bottom-center':
|
|
50
|
+
return ['justify-center', 'items-end'];
|
|
51
|
+
case 'bottom-right':
|
|
52
|
+
return ['justify-end', 'items-end'];
|
|
53
|
+
default:
|
|
54
|
+
return ['justify-center', 'items-center'];
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const createBackdrop = (node) => {
|
|
58
|
+
if (!backdropEl) {
|
|
59
|
+
backdropEl = document.createElement('div');
|
|
60
|
+
backdropEl.classList.add(...backdropClasses.split(' '));
|
|
61
|
+
const body = document.querySelector('body');
|
|
62
|
+
body.append(backdropEl);
|
|
63
|
+
body.style.overflow = 'hidden';
|
|
64
|
+
document.addEventListener('keydown', handleEscape, true);
|
|
65
|
+
}
|
|
66
|
+
dispatch('show', node);
|
|
67
|
+
};
|
|
68
|
+
const destroyBackdrop = (node) => {
|
|
69
|
+
const body = document.querySelector('body');
|
|
70
|
+
body.style.overflow = 'auto';
|
|
71
|
+
if (backdropEl)
|
|
72
|
+
backdropEl.remove();
|
|
73
|
+
backdropEl = undefined;
|
|
74
|
+
document.removeEventListener('keydown', handleEscape, true);
|
|
75
|
+
dispatch('hide', node);
|
|
76
|
+
};
|
|
77
|
+
let backdropEl;
|
|
78
|
+
const handleEscape = (e) => {
|
|
79
|
+
if (open && e.key === 'Escape')
|
|
80
|
+
open = false;
|
|
81
|
+
};
|
|
82
|
+
const dispatch = createEventDispatcher();
|
|
83
|
+
const allPlacementClasses = [
|
|
84
|
+
'justify-start',
|
|
85
|
+
'justify-center',
|
|
86
|
+
'justify-end',
|
|
87
|
+
'items-start',
|
|
88
|
+
'items-center',
|
|
89
|
+
'items-end'
|
|
90
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import classNames from 'classnames';
|
|
2
|
+
// export let width;
|
|
3
|
+
// export let controls: boolean = true;
|
|
4
|
+
// export let autoplay: boolean = false;
|
|
5
|
+
export let src;
|
|
6
|
+
export let type = 'video/mp4';
|
|
7
|
+
// export let attribute = '';
|
|
8
|
+
let videoClass = classNames($$props.class);
|
|
9
|
+
// const setAttribute = (node, params) => {
|
|
10
|
+
// node.setAttribute(params, '');
|
|
11
|
+
// };
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<video {...$$restProps} class={videoClass}>
|
|
15
|
+
<source {src} {type} />
|
|
16
|
+
<slot />
|
|
17
|
+
Your browser does not support the video tag.
|
|
18
|
+
</video>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
src: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type VideoProps = typeof __propDef.props;
|
|
16
|
+
export declare type VideoEvents = typeof __propDef.events;
|
|
17
|
+
export declare type VideoSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Video extends SvelteComponentTyped<VideoProps, VideoEvents, VideoSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
underlineClass?: string;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {
|
|
11
|
-
default: {};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare type UnderlineProps = typeof __propDef.props;
|
|
15
|
-
export declare type UnderlineEvents = typeof __propDef.events;
|
|
16
|
-
export declare type UnderlineSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Underline extends SvelteComponentTyped<UnderlineProps, UnderlineEvents, UnderlineSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|