flowbite-svelte 0.27.4 → 0.27.6
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 +29 -0
- package/accordions/Accordion.svelte +24 -0
- package/accordions/Accordion.svelte.d.ts +30 -0
- package/accordions/AccordionItem.svelte +36 -70
- package/accordions/AccordionItem.svelte.d.ts +5 -8
- package/breadcrumbs/BreadcrumbItem.svelte +37 -44
- package/breadcrumbs/BreadcrumbItem.svelte.d.ts +1 -0
- package/buttongroups/ButtonGroup.svelte +4 -4
- package/buttongroups/ButtonGroup.svelte.d.ts +2 -0
- package/buttons/Button.svelte +3 -8
- package/buttons/Button.svelte.d.ts +2 -2
- package/cards/Card.svelte +12 -12
- package/cards/Card.svelte.d.ts +3 -2
- package/carousels/CarouselTransition.svelte +1 -1
- package/carousels/Thumbnail.svelte +9 -1
- package/darkmode/DarkMode.svelte +27 -24
- package/drawer/Drawer.svelte +26 -13
- package/drawer/Drawer.svelte.d.ts +1 -0
- package/forms/Checkbox.svelte +17 -18
- package/forms/FloatingLabelInput.svelte.d.ts +1 -1
- package/forms/Helper.svelte.d.ts +1 -1
- package/forms/Input.svelte +70 -38
- package/forms/Input.svelte.d.ts +15 -5
- package/forms/InputAddon.svelte +29 -0
- package/forms/InputAddon.svelte.d.ts +19 -0
- package/forms/Label.svelte.d.ts +1 -1
- package/forms/NumberInput.svelte +7 -0
- package/forms/NumberInput.svelte.d.ts +16 -0
- package/forms/Radio.svelte +30 -43
- package/forms/Radio.svelte.d.ts +2 -2
- package/forms/Search.svelte +51 -43
- package/forms/Search.svelte.d.ts +5 -6
- package/forms/SimpleSearch.svelte +17 -62
- package/forms/SimpleSearch.svelte.d.ts +0 -18
- package/forms/Toggle.svelte +4 -13
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/list-group/ListgroupItem.svelte +38 -40
- package/modals/Modal.svelte.d.ts +2 -2
- package/package.json +7 -4
- package/ratings/Rating.svelte +21 -20
- package/ratings/Rating.svelte.d.ts +1 -0
- package/tables/Table.svelte.d.ts +1 -1
- package/tables/TableSearch.svelte.d.ts +1 -1
- package/toasts/Toast.svelte +0 -1
- package/tooltips/Tooltip.svelte.d.ts +1 -1
- package/types.d.ts +3 -32
- package/typography/P.svelte.d.ts +1 -1
- package/utils/Frame.svelte +1 -1
- package/utils/Frame.svelte.d.ts +1 -1
- package/utils/Popper.svelte +19 -16
- package/utils/focusTrap.js +15 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
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.27.6](https://github.com/themesberg/flowbite-svelte/compare/v0.27.5...v0.27.6) (2022-10-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* card padding-x in mobile view ([#358](https://github.com/themesberg/flowbite-svelte/issues/358)) ([639457f](https://github.com/themesberg/flowbite-svelte/commit/639457f5efc54f38fda9288aa9cf017c2d0f883d))
|
|
11
|
+
* color flicker when changing theme using DarkMode ([#353](https://github.com/themesberg/flowbite-svelte/issues/353)) ([7e1daf1](https://github.com/themesberg/flowbite-svelte/commit/7e1daf14b1b91b0f3c0dac55c38e28fee42c4878))
|
|
12
|
+
* improved focustrap ([#354](https://github.com/themesberg/flowbite-svelte/issues/354)) ([fb17cd3](https://github.com/themesberg/flowbite-svelte/commit/fb17cd357e748df4b1d95060bcbecf7b406d3f03))
|
|
13
|
+
* input icons ([#350](https://github.com/themesberg/flowbite-svelte/issues/350)) ([7b72712](https://github.com/themesberg/flowbite-svelte/commit/7b727121b3b730eb552200c1de36f3cdc45f7977))
|
|
14
|
+
* input number workaround ([#351](https://github.com/themesberg/flowbite-svelte/issues/351)) ([e4cb012](https://github.com/themesberg/flowbite-svelte/commit/e4cb01221c3b4334a2c860aa32ccee06df2fe41d))
|
|
15
|
+
* remove // [@ts-ignore](https://github.com/ts-ignore) ([ea82a2b](https://github.com/themesberg/flowbite-svelte/commit/ea82a2bc22085bad26967a82d078d8ab86b2477d))
|
|
16
|
+
* remove package-lock, pnpm-lock and node_modules and reinstall ([a8985ea](https://github.com/themesberg/flowbite-svelte/commit/a8985ea2fdb7c18eb23e61dd163e65da98a53ae4))
|
|
17
|
+
* remove svelte-sidebar-menu ([2820488](https://github.com/themesberg/flowbite-svelte/commit/28204885bbefcb826e073a1e6b7127a0b488b752))
|
|
18
|
+
* ts types for Popper ([#362](https://github.com/themesberg/flowbite-svelte/issues/362)) ([4a22230](https://github.com/themesberg/flowbite-svelte/commit/4a22230d66d780cb2d5c189266f97c87c251b70a))
|
|
19
|
+
|
|
20
|
+
### [0.27.5](https://github.com/themesberg/flowbite-svelte/compare/v0.27.4...v0.27.5) (2022-10-01)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* add fetchMarkdownPosts in utils/index ([#333](https://github.com/themesberg/flowbite-svelte/issues/333)) ([b604c0c](https://github.com/themesberg/flowbite-svelte/commit/b604c0c31c99b743817d814b3b043c42ccfaf14c))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* accordion slots + docs ([#349](https://github.com/themesberg/flowbite-svelte/issues/349)) ([78a2542](https://github.com/themesberg/flowbite-svelte/commit/78a25427e31f61ba86ce825d9127515326448afa))
|
|
31
|
+
* props using vite named import ([#347](https://github.com/themesberg/flowbite-svelte/issues/347)) ([7072e03](https://github.com/themesberg/flowbite-svelte/commit/7072e03b7ec8bac2e3d74d53f87c54dab772e159))
|
|
32
|
+
* use vite to import a file as text ([#342](https://github.com/themesberg/flowbite-svelte/issues/342)) ([07ac592](https://github.com/themesberg/flowbite-svelte/commit/07ac592b0a06cda8afd71d918145693a0834b4f3))
|
|
33
|
+
|
|
5
34
|
### [0.27.4](https://github.com/themesberg/flowbite-svelte/compare/v0.27.3...v0.27.4) (2022-09-26)
|
|
6
35
|
|
|
7
36
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script context="module">import { writable } from 'svelte/store';
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script>import Frame from '../utils/Frame.svelte';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { setContext } from 'svelte';
|
|
7
|
+
export let single = true;
|
|
8
|
+
export let flush = false;
|
|
9
|
+
export let activeClasses = 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800';
|
|
10
|
+
export let inactiveClasses = 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 hover:dark:bg-gray-800';
|
|
11
|
+
export let defaultClass = 'text-gray-500 dark:text-gray-400';
|
|
12
|
+
const ctx = {
|
|
13
|
+
flush,
|
|
14
|
+
activeClasses,
|
|
15
|
+
inactiveClasses,
|
|
16
|
+
selected: single ? writable() : undefined
|
|
17
|
+
};
|
|
18
|
+
setContext('ctx', ctx);
|
|
19
|
+
let frameClass = classNames(defaultClass, 'divide-y divide-gray-200 dark:divide-gray-700', 'border-gray-200 dark:border-gray-700', 'rounded-t-xl', $$props.class);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Frame class={frameClass} color="none" border={!flush}>
|
|
23
|
+
<slot />
|
|
24
|
+
</Frame>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type Writable } from 'svelte/store';
|
|
3
|
+
export interface AccordionCtxType {
|
|
4
|
+
flush: boolean;
|
|
5
|
+
activeClasses: string;
|
|
6
|
+
inactiveClasses: string;
|
|
7
|
+
selected?: Writable<object>;
|
|
8
|
+
}
|
|
9
|
+
declare const __propDef: {
|
|
10
|
+
props: {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
single?: boolean | undefined;
|
|
13
|
+
flush?: boolean | undefined;
|
|
14
|
+
activeClasses?: string | undefined;
|
|
15
|
+
inactiveClasses?: string | undefined;
|
|
16
|
+
defaultClass?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {
|
|
22
|
+
default: {};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare type AccordionProps = typeof __propDef.props;
|
|
26
|
+
export declare type AccordionEvents = typeof __propDef.events;
|
|
27
|
+
export declare type AccordionSlots = typeof __propDef.slots;
|
|
28
|
+
export default class Accordion extends SvelteComponentTyped<AccordionProps, AccordionEvents, AccordionSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -1,76 +1,42 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import ChevronDown from '../utils/ChevronDown.svelte';
|
|
2
|
+
import ChevronUp from '../utils/ChevronUp.svelte';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { getContext, onMount } from 'svelte';
|
|
5
|
+
import { writable } from 'svelte/store';
|
|
2
6
|
import { slide } from 'svelte/transition';
|
|
3
|
-
export let
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
7
|
+
export let open = false;
|
|
8
|
+
export let activeClasses = undefined;
|
|
9
|
+
export let inactiveClasses = undefined;
|
|
10
|
+
export let defaultClass = 'flex items-center justify-between w-full font-medium text-left group-first:rounded-t-xl';
|
|
11
|
+
const ctx = getContext('ctx') ?? {};
|
|
12
|
+
// single selection
|
|
13
|
+
const self = {};
|
|
14
|
+
const selected = ctx.selected ?? writable();
|
|
15
|
+
onMount(() => {
|
|
16
|
+
if (open)
|
|
17
|
+
$selected = self;
|
|
18
|
+
// this will trigger unsubscribe on destroy
|
|
19
|
+
return selected.subscribe((x) => (open = x === self));
|
|
20
|
+
});
|
|
21
|
+
const handleToggle = (e) => selected.set(open ? {} : self);
|
|
17
22
|
let buttonClass;
|
|
18
|
-
$:
|
|
19
|
-
buttonClass = classBtn + colorClass;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
buttonClass = classBtn;
|
|
23
|
-
}
|
|
23
|
+
$: buttonClass = classNames(defaultClass, ctx.flush ? 'py-5' : 'p-5', open && (ctx.flush ? 'text-gray-900 dark:text-white' : activeClasses || ctx.activeClasses), !open && (ctx.flush ? 'text-gray-500 dark:text-gray-400' : inactiveClasses || ctx.inactiveClasses), $$props.class);
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
|
-
<h2 aria-expanded={
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{#if isOpen}
|
|
36
|
-
{#if $$slots.arrowup}
|
|
37
|
-
<slot name="arrowup" />
|
|
38
|
-
{:else}
|
|
39
|
-
<svg
|
|
40
|
-
data-accordion-icon
|
|
41
|
-
class="w-6 h-6 rotate-180 shrink-0"
|
|
42
|
-
fill="currentColor"
|
|
43
|
-
viewBox="0 0 20 20"
|
|
44
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
45
|
-
><path
|
|
46
|
-
fill-rule="evenodd"
|
|
47
|
-
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
|
48
|
-
clip-rule="evenodd"
|
|
49
|
-
/></svg
|
|
50
|
-
>
|
|
51
|
-
{/if}
|
|
52
|
-
{:else if $$slots.arrowdown}
|
|
53
|
-
<slot name="arrowdown" />
|
|
54
|
-
{:else}
|
|
55
|
-
<svg
|
|
56
|
-
data-accordion-icon
|
|
57
|
-
class="w-6 h-6 shrink-0"
|
|
58
|
-
fill="currentColor"
|
|
59
|
-
viewBox="0 0 20 20"
|
|
60
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
-
><path
|
|
62
|
-
fill-rule="evenodd"
|
|
63
|
-
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
|
64
|
-
clip-rule="evenodd"
|
|
65
|
-
/></svg
|
|
66
|
-
>
|
|
67
|
-
{/if}
|
|
68
|
-
</button>
|
|
26
|
+
<h2 aria-expanded={open} class="group">
|
|
27
|
+
<button on:click={handleToggle} type="button" class={buttonClass}>
|
|
28
|
+
<slot name="header" />
|
|
29
|
+
{#if open}
|
|
30
|
+
<slot name="arrowup"><ChevronUp /></slot>
|
|
31
|
+
{:else}
|
|
32
|
+
<slot name="arrowdown"><ChevronDown /></slot>
|
|
33
|
+
{/if}
|
|
34
|
+
</button>
|
|
69
35
|
</h2>
|
|
70
|
-
{#if
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
36
|
+
{#if open}
|
|
37
|
+
<div transition:slide={{ duration: 500 }}>
|
|
38
|
+
<div class={ctx.flush ? 'py-5' : 'p-5'}>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
76
42
|
{/if}
|
|
@@ -2,13 +2,10 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
color?: boolean | undefined;
|
|
10
|
-
btnClass?: string | undefined;
|
|
11
|
-
colorClass?: string | undefined;
|
|
5
|
+
open?: boolean | undefined;
|
|
6
|
+
activeClasses?: string | undefined;
|
|
7
|
+
inactiveClasses?: string | undefined;
|
|
8
|
+
defaultClass?: string | undefined;
|
|
12
9
|
};
|
|
13
10
|
events: {
|
|
14
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -17,7 +14,7 @@ declare const __propDef: {
|
|
|
17
14
|
header: {};
|
|
18
15
|
arrowup: {};
|
|
19
16
|
arrowdown: {};
|
|
20
|
-
|
|
17
|
+
default: {};
|
|
21
18
|
};
|
|
22
19
|
};
|
|
23
20
|
export declare type AccordionItemProps = typeof __propDef.props;
|
|
@@ -1,51 +1,44 @@
|
|
|
1
1
|
<script>export let home = false;
|
|
2
|
+
export let href = undefined;
|
|
2
3
|
export let linkClass = 'ml-1 text-sm font-medium text-gray-700 hover:text-gray-900 md:ml-2 dark:text-gray-400 dark:hover:text-white';
|
|
3
4
|
export let spanClass = 'ml-1 text-sm font-medium text-gray-500 md:ml-2 dark:text-gray-400';
|
|
4
5
|
export let homeClass = 'inline-flex items-center text-sm font-medium text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white';
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
|
-
<li class="inline-flex items-center" {...$$
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<slot />
|
|
44
|
-
</a>
|
|
45
|
-
{:else}
|
|
46
|
-
<span class={spanClass}>
|
|
47
|
-
<slot />
|
|
48
|
-
</span>
|
|
49
|
-
{/if}
|
|
50
|
-
{/if}
|
|
8
|
+
<li class="inline-flex items-center" {...$$restProps}>
|
|
9
|
+
{#if home}
|
|
10
|
+
<a class={homeClass} {href}>
|
|
11
|
+
{#if $$slots.icon}
|
|
12
|
+
<slot name="icon" />
|
|
13
|
+
{:else}
|
|
14
|
+
<svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
><path
|
|
16
|
+
d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z" /></svg>
|
|
17
|
+
{/if}
|
|
18
|
+
<slot />
|
|
19
|
+
</a>
|
|
20
|
+
{:else}
|
|
21
|
+
{#if $$slots.icon}
|
|
22
|
+
<slot name="icon" />
|
|
23
|
+
{:else}
|
|
24
|
+
<svg
|
|
25
|
+
class="w-6 h-6 text-gray-400"
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
viewBox="0 0 20 20"
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
><path
|
|
30
|
+
fill-rule="evenodd"
|
|
31
|
+
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
|
32
|
+
clip-rule="evenodd" /></svg>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if href}
|
|
35
|
+
<a class={linkClass} {href}>
|
|
36
|
+
<slot />
|
|
37
|
+
</a>
|
|
38
|
+
{:else}
|
|
39
|
+
<span class={spanClass}>
|
|
40
|
+
<slot />
|
|
41
|
+
</span>
|
|
42
|
+
{/if}
|
|
43
|
+
{/if}
|
|
51
44
|
</li>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>import { setContext } from 'svelte';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
export let
|
|
4
|
-
|
|
5
|
-
setContext('
|
|
3
|
+
export let size = 'md';
|
|
4
|
+
export let divClass = 'inline-flex rounded-lg shadow-sm';
|
|
5
|
+
setContext('group', { size });
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<div {...$$restProps} class={classNames(divClass, $$props.class)} role="group">
|
|
9
|
-
|
|
9
|
+
<slot />
|
|
10
10
|
</div>
|
package/buttons/Button.svelte
CHANGED
|
@@ -10,7 +10,6 @@ export let btnClass = undefined;
|
|
|
10
10
|
export let type = 'button';
|
|
11
11
|
export let color = group ? (outline ? 'dark' : 'alternative') : 'blue';
|
|
12
12
|
export let shadow = null;
|
|
13
|
-
const background = getContext('background');
|
|
14
13
|
const colorClasses = {
|
|
15
14
|
blue: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800',
|
|
16
15
|
dark: 'text-white bg-gray-800 hover:bg-gray-900 focus:ring-gray-300 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700',
|
|
@@ -77,16 +76,12 @@ const hasBorder = () => outline || color === 'alternative' || color === 'light';
|
|
|
77
76
|
let buttonClass;
|
|
78
77
|
$: buttonClass = btnClass
|
|
79
78
|
? btnClass
|
|
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
|
-
|
|
82
|
-
: 'inline-flex items-center justify-center ' + sizeClasses[size], gradient ? gradientClasses[color] : outline ? outlineClasses[color] : colorClasses[color], color === 'alternative' &&
|
|
83
|
-
(background
|
|
79
|
+
: 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 ? 'p-0.5' : 'inline-flex items-center justify-center ' + sizeClasses[size], gradient ? gradientClasses[color] : outline ? outlineClasses[color] : colorClasses[color], color === 'alternative' &&
|
|
80
|
+
(group
|
|
84
81
|
? 'dark:bg-gray-700 dark:text-white dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-600'
|
|
85
82
|
: 'dark:bg-transparent dark:border-gray-800 dark:hover:border-gray-700'), outline &&
|
|
86
83
|
color === 'dark' &&
|
|
87
|
-
(
|
|
88
|
-
? 'dark:text-white dark:border-white'
|
|
89
|
-
: 'dark:text-gray-400 dark:border-gray-700'), hasBorder() && group && 'border-l-0 first:border-l', rounded(false), shadow && coloredShadowClasses[shadow], $$props.disabled && 'cursor-not-allowed opacity-50', $$props.class);
|
|
84
|
+
(group ? 'dark:text-white dark:border-white' : 'dark:text-gray-400 dark:border-gray-700'), hasBorder() && group && 'border-l-0 first:border-l', rounded(false), shadow && coloredShadowClasses[shadow], $$props.disabled && 'cursor-not-allowed opacity-50', $$props.class);
|
|
90
85
|
let gradientOutlineClass;
|
|
91
86
|
$: gradientOutlineClass = classNames('inline-flex items-center justify-center', sizeClasses[size], rounded(true), 'bg-white text-gray-900 dark:bg-gray-900 dark:text-white', // this is limitation - no transparency
|
|
92
87
|
'transition-all duration-75 ease-in group-hover:bg-opacity-0 group-hover:text-inherit');
|
|
@@ -10,8 +10,8 @@ declare const __propDef: {
|
|
|
10
10
|
href?: string | undefined;
|
|
11
11
|
btnClass?: string | undefined;
|
|
12
12
|
type?: ButtonType | undefined;
|
|
13
|
-
color?: "
|
|
14
|
-
shadow?: "
|
|
13
|
+
color?: "red" | "yellow" | "green" | "purple" | "pink" | "blue" | "light" | "dark" | "cyan" | "teal" | "lime" | "alternative" | "purpleToBlue" | "cyanToBlue" | "greenToBlue" | "purpleToPink" | "pinkToOrange" | "tealToLime" | "redToYellow" | undefined;
|
|
14
|
+
shadow?: "red" | "green" | "purple" | "pink" | "blue" | "cyan" | "teal" | "lime" | null | undefined;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
17
|
click: MouseEvent;
|
package/cards/Card.svelte
CHANGED
|
@@ -8,10 +8,10 @@ export let padding = 'lg';
|
|
|
8
8
|
export let size = 'sm';
|
|
9
9
|
const paddings = {
|
|
10
10
|
none: 'p-0',
|
|
11
|
-
sm: 'p-4',
|
|
12
|
-
md: 'p-5',
|
|
13
|
-
lg: 'p-6',
|
|
14
|
-
xl: 'p-8'
|
|
11
|
+
sm: 'p-4 sm:p-6 md:p-8',
|
|
12
|
+
md: 'p-4 sm:p-5',
|
|
13
|
+
lg: 'p-4 sm:p-6',
|
|
14
|
+
xl: 'p-4 sm:p-8'
|
|
15
15
|
};
|
|
16
16
|
const sizes = {
|
|
17
17
|
xs: 'max-w-xs',
|
|
@@ -29,12 +29,12 @@ $: imgClass = classNames(reverse ? 'rounded-b-lg' : 'rounded-t-lg', horizontal &
|
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<Frame tag={href ? 'a' : 'div'} rounded shadow border {href} class={cardClass}>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
{#if img}
|
|
33
|
+
<img class={imgClass} src={img} alt="" />
|
|
34
|
+
<div class={innerPdding}>
|
|
35
|
+
<slot />
|
|
36
|
+
</div>
|
|
37
|
+
{:else}
|
|
38
|
+
<slot />
|
|
39
|
+
{/if}
|
|
40
40
|
</Frame>
|
package/cards/Card.svelte.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SizeType } from '../types';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
[x: string]: any;
|
|
@@ -6,8 +7,8 @@ declare const __propDef: {
|
|
|
6
7
|
horizontal?: boolean | undefined;
|
|
7
8
|
reverse?: boolean | undefined;
|
|
8
9
|
img?: string | undefined;
|
|
9
|
-
padding?: "sm" | "md" | "lg" | "
|
|
10
|
-
size?:
|
|
10
|
+
padding?: "none" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
11
|
+
size?: SizeType | undefined;
|
|
11
12
|
};
|
|
12
13
|
events: {
|
|
13
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -34,7 +34,7 @@ const multiple = (node, params) => {
|
|
|
34
34
|
};
|
|
35
35
|
// Slide
|
|
36
36
|
// export let slideClass: string = 'hidden';
|
|
37
|
-
let imageShowingIndex =
|
|
37
|
+
let imageShowingIndex = 0;
|
|
38
38
|
// $: image = images[imageShowingIndex];
|
|
39
39
|
const nextSlide = () => {
|
|
40
40
|
if (imageShowingIndex === images.length - 1) {
|
|
@@ -6,7 +6,15 @@ export let thumbWidth;
|
|
|
6
6
|
export let selected = false;
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
|
-
<img
|
|
9
|
+
<img
|
|
10
|
+
class="opacity-40"
|
|
11
|
+
class:active={selected}
|
|
12
|
+
id={id.toString()}
|
|
13
|
+
src={thumbImg}
|
|
14
|
+
alt={altTag}
|
|
15
|
+
title="Image from {titleLink}"
|
|
16
|
+
on:click
|
|
17
|
+
width="{thumbWidth}%" />
|
|
10
18
|
|
|
11
19
|
<style>
|
|
12
20
|
.active {
|
package/darkmode/DarkMode.svelte
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export let btnClass = 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 fixed left-0 top-8 z-50';
|
|
3
|
-
let dark = false;
|
|
1
|
+
<script>export let btnClass = 'text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-2.5 fixed left-0 top-8 z-50';
|
|
4
2
|
const toggleTheme = () => {
|
|
5
|
-
|
|
6
|
-
localStorage.setItem('color-theme',
|
|
3
|
+
const isDark = window.document.documentElement.classList.toggle('dark');
|
|
4
|
+
localStorage.setItem('color-theme', isDark ? 'dark' : 'light');
|
|
7
5
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svelte:head>
|
|
9
|
+
<script>
|
|
10
|
+
if (window) {
|
|
11
|
+
localStorage.getItem('color-theme') === 'dark' ||
|
|
12
|
+
(!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
11
13
|
? window.document.documentElement.classList.add('dark')
|
|
12
14
|
: window.document.documentElement.classList.remove('dark');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
</svelte:head>
|
|
16
18
|
|
|
17
19
|
<button on:click={toggleTheme} aria-label="Dark mode" type="button" class={btnClass}>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
<span class="hidden dark:block">
|
|
21
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
22
|
+
<path
|
|
23
|
+
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1
|
|
24
|
+
0 100-2H3a1 1 0 000 2h1z"
|
|
25
|
+
fill-rule="evenodd"
|
|
26
|
+
clip-rule="evenodd" />
|
|
27
|
+
</svg>
|
|
28
|
+
</span>
|
|
29
|
+
<span class="dark:hidden">
|
|
30
|
+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
31
|
+
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
|
|
32
|
+
</svg>
|
|
33
|
+
</span>
|
|
31
34
|
</button>
|
package/drawer/Drawer.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>import classNames from 'classnames';
|
|
2
2
|
import { fly, slide, blur, fade } from 'svelte/transition';
|
|
3
3
|
import { clickOutside } from '../utils/clickOutside';
|
|
4
|
+
export let activateClickOutside = true;
|
|
4
5
|
export let hidden = true;
|
|
5
6
|
export let position = 'fixed';
|
|
6
7
|
export let leftOffset = 'inset-y-0 left-0';
|
|
@@ -36,24 +37,36 @@ const placements = {
|
|
|
36
37
|
};
|
|
37
38
|
const handleDrawer = () => {
|
|
38
39
|
hidden = !hidden;
|
|
39
|
-
console.log('clicked');
|
|
40
40
|
};
|
|
41
41
|
let backdropDivClass = classNames('fixed top-0 left-0 z-50 w-full h-full', backdrop && bgColor, backdrop && bgOpacity);
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
{#if !hidden}
|
|
45
|
-
{#if backdrop}
|
|
45
|
+
{#if backdrop && activateClickOutside}
|
|
46
46
|
<div class={backdropDivClass} on:click={() => !hidden && handleDrawer()} />
|
|
47
47
|
{/if}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
{#if activateClickOutside}
|
|
49
|
+
<div
|
|
50
|
+
use:clickOutside={() => !hidden && handleDrawer()}
|
|
51
|
+
{id}
|
|
52
|
+
{...$$restProps}
|
|
53
|
+
class={classNames(divClass, width, position, placements[placement], $$props.class)}
|
|
54
|
+
transition:multiple={transitionParams}
|
|
55
|
+
tabindex="-1"
|
|
56
|
+
aria-controls={id}
|
|
57
|
+
aria-labelledby={id}>
|
|
58
|
+
<slot {hidden} />
|
|
59
|
+
</div>
|
|
60
|
+
{:else}
|
|
61
|
+
<div
|
|
62
|
+
{id}
|
|
63
|
+
{...$$restProps}
|
|
64
|
+
class={classNames(divClass, width, position, placements[placement], $$props.class)}
|
|
65
|
+
transition:multiple={transitionParams}
|
|
66
|
+
tabindex="-1"
|
|
67
|
+
aria-controls={id}
|
|
68
|
+
aria-labelledby={id}>
|
|
69
|
+
<slot {hidden} />
|
|
70
|
+
</div>
|
|
71
|
+
{/if}
|
|
59
72
|
{/if}
|
|
@@ -3,6 +3,7 @@ import type { drawerTransitionParamTypes, drawerTransitionTypes } from '../types
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
+
activateClickOutside?: boolean | undefined;
|
|
6
7
|
hidden?: boolean | undefined;
|
|
7
8
|
position?: "fixed" | "absolute" | undefined;
|
|
8
9
|
leftOffset?: string | undefined;
|