@hashrytech/quick-components-kit 0.5.0 → 0.6.0
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 +13 -0
- package/dist/checkbox/Checkbox.svelte +41 -0
- package/dist/checkbox/Checkbox.svelte.d.ts +20 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/drawer/Drawer.svelte +82 -0
- package/dist/drawer/Drawer.svelte.d.ts +19 -0
- package/dist/drawer/index.d.ts +1 -0
- package/dist/drawer/index.js +1 -0
- package/dist/hamburger-menu/HamburgerMenu.svelte +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/modal/Modal.svelte +64 -0
- package/dist/modal/Modal.svelte.d.ts +17 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/modal/index.js +1 -0
- package/dist/radio/Radio.svelte +41 -0
- package/dist/radio/Radio.svelte.d.ts +20 -0
- package/dist/radio/index.d.ts +1 -0
- package/dist/radio/index.js +1 -0
- package/dist/text-input/TextInput.svelte +1 -1
- package/package.json +1 -1
- package/dist/navbar-aside/NavBarAside.svelte +0 -35
- package/dist/navbar-aside/NavBarAside.svelte.d.ts +0 -14
- package/dist/navbar-aside/index.d.ts +0 -1
- package/dist/navbar-aside/index.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @hashrytech/quick-components-kit
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: adding modal component
|
|
8
|
+
- feat: adding checkbox component
|
|
9
|
+
- feat: Adding drawer component
|
|
10
|
+
- feat: adding radio button component
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- fix: removing navbar-aside component
|
|
15
|
+
|
|
3
16
|
## 0.5.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import {twMerge} from 'tailwind-merge';
|
|
5
|
+
|
|
6
|
+
export type CheckBoxProps = {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
group?: any[];
|
|
13
|
+
labelPosition?: "left" | "right";
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
icon?: Snippet;
|
|
17
|
+
onclick?: (event: MouseEvent) => void;
|
|
18
|
+
labelClass?: ClassNameValue;
|
|
19
|
+
class?: ClassNameValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
|
|
26
|
+
let {id, name, label="", labelPosition="right", checked=$bindable(true), group=$bindable(), size="md", disabled=$bindable(false), onclick, labelClass, ...props}: CheckBoxProps = $props();
|
|
27
|
+
|
|
28
|
+
const sizeMap = {
|
|
29
|
+
sm: 'w-4 h-4',
|
|
30
|
+
md: 'w-5 h-5',
|
|
31
|
+
lg: 'w-6 h-6',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<label for={id} class="inline-flex items-center gap-2 cursor-pointer select-none">
|
|
37
|
+
{#if labelPosition === "left"}<span class={twMerge("text-sm", labelClass)}>{label}</span>{/if}
|
|
38
|
+
<input {id} name={name ? name : id} type="checkbox" bind:checked bind:group {disabled} class={twMerge("rounded border-border-primary focus:ring-2 ring-focus-primary text-button-primary accent-button-primary cursor-pointer",
|
|
39
|
+
sizeMap[size], props.class)} />
|
|
40
|
+
{#if labelPosition === "right"}<span class={twMerge("text-sm", labelClass)}>{label}</span>{/if}
|
|
41
|
+
</label>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export type CheckBoxProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
group?: any[];
|
|
10
|
+
labelPosition?: "left" | "right";
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
icon?: Snippet;
|
|
14
|
+
onclick?: (event: MouseEvent) => void;
|
|
15
|
+
labelClass?: ClassNameValue;
|
|
16
|
+
class?: ClassNameValue;
|
|
17
|
+
};
|
|
18
|
+
declare const Checkbox: import("svelte").Component<CheckBoxProps, {}, "disabled" | "checked" | "group">;
|
|
19
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
20
|
+
export default Checkbox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { onDestroy, onMount, type Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import { fade, fly } from 'svelte/transition';
|
|
5
|
+
import {twMerge} from 'tailwind-merge';
|
|
6
|
+
import { browser } from '$app/environment';
|
|
7
|
+
|
|
8
|
+
export type DrawerProps = {
|
|
9
|
+
open?: boolean;
|
|
10
|
+
escapeKeyClose?: boolean;
|
|
11
|
+
disableBodyScroll?: boolean;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
transitionDuration?: number;
|
|
14
|
+
transitionDistance?: number;
|
|
15
|
+
transitionPosition?: "left" | "right" | "top" | "bottom";
|
|
16
|
+
overlayClasses?: string;
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
class?: ClassNameValue;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
let {open=$bindable(false), escapeKeyClose=true, disableBodyScroll=true, ariaLabel="Drawer", transitionPosition="left", transitionDuration=200, transitionDistance=240, overlayClasses="", children, ...props}: DrawerProps = $props();
|
|
25
|
+
|
|
26
|
+
const transitionProperties = {
|
|
27
|
+
x: transitionPosition == "left" ? -transitionDistance : transitionPosition == "right" ? transitionDistance : 0,
|
|
28
|
+
y: transitionPosition == "top" ? -transitionDistance : transitionPosition == "bottom" ? transitionDistance : 0,
|
|
29
|
+
duration: transitionDuration
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const postionClasses = {
|
|
33
|
+
left: "top-0 bottom-0 left-0 w-60",
|
|
34
|
+
right: "top-0 bottom-0 right-0 w-60",
|
|
35
|
+
top: "top-0 left-0 right-0 h-60",
|
|
36
|
+
bottom: "bottom-0 left-0 right-0 h-60",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const lockScroll = () => document.body.style.overflow = 'hidden';
|
|
40
|
+
const unlockScroll = () => document.body.style.overflow = '';
|
|
41
|
+
|
|
42
|
+
$effect(() => {
|
|
43
|
+
if (open && disableBodyScroll) lockScroll(); else unlockScroll();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
onMount(() => {
|
|
47
|
+
if(browser){
|
|
48
|
+
window.addEventListener('keydown', handleKeydown);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
onDestroy(() => {
|
|
53
|
+
if(browser){
|
|
54
|
+
window.removeEventListener('keydown', handleKeydown);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export function closeDrawer() {
|
|
60
|
+
open = false;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function handleKeydown (event: { key: string; }) {
|
|
64
|
+
if(open && escapeKeyClose && event.key === "Escape") {
|
|
65
|
+
closeDrawer();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
{#if open}
|
|
72
|
+
<!-- Overlay -->
|
|
73
|
+
<div transition:fade={{duration: transitionDuration}} class={twMerge("fixed inset-0 bg-overlay-primary", overlayClasses)} role="presentation" onclick={() => open = false}></div>
|
|
74
|
+
|
|
75
|
+
<div role="dialog" aria-modal="true" aria-label={ariaLabel} tabindex="{open ? 0 : -1}" aria-hidden="{!open}"
|
|
76
|
+
class={twMerge("fixed flex flex-col items-center gap-2 bg-white outline-0 focus:outline-0 active:outline-focus-primary focus:outline-focus-primary overflow-y-auto", postionClasses[transitionPosition], props.class)}
|
|
77
|
+
in:fly={transitionProperties}
|
|
78
|
+
out:fly={transitionProperties}>
|
|
79
|
+
{@render children?.()}
|
|
80
|
+
</div>
|
|
81
|
+
{/if}
|
|
82
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export type DrawerProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
escapeKeyClose?: boolean;
|
|
6
|
+
disableBodyScroll?: boolean;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
transitionDuration?: number;
|
|
9
|
+
transitionDistance?: number;
|
|
10
|
+
transitionPosition?: "left" | "right" | "top" | "bottom";
|
|
11
|
+
overlayClasses?: string;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
class?: ClassNameValue;
|
|
14
|
+
};
|
|
15
|
+
declare const Drawer: import("svelte").Component<DrawerProps, {
|
|
16
|
+
closeDrawer: () => void;
|
|
17
|
+
}, "open">;
|
|
18
|
+
type Drawer = ReturnType<typeof Drawer>;
|
|
19
|
+
export default Drawer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Drawer } from './Drawer.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Drawer } from './Drawer.svelte';
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
<button class={twMerge("p-2 rounded focus:outline-none focus:ring-2 focus:ring-focus-primary cursor-pointer
|
|
22
|
+
<button class={twMerge("p-2 rounded focus:outline-none focus:ring-2 focus:ring-focus-primary cursor-pointer w-fit", props.class)} aria-label={ariaLabel} {onclick}>
|
|
23
23
|
<!-- Icon -->
|
|
24
24
|
<div class="space-y-2">
|
|
25
25
|
{#each Array(numberOfLines) as _}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export * from './text-input/index.js';
|
|
|
2
2
|
export * from './button/index.js';
|
|
3
3
|
export * from './link-button/index.js';
|
|
4
4
|
export * from './hamburger-menu/index.js';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './drawer/index.js';
|
|
6
|
+
export * from './modal/index.js';
|
package/dist/index.js
CHANGED
|
@@ -4,5 +4,6 @@ export * from './text-input/index.js';
|
|
|
4
4
|
export * from './button/index.js';
|
|
5
5
|
export * from './link-button/index.js';
|
|
6
6
|
export * from './hamburger-menu/index.js';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './drawer/index.js';
|
|
8
|
+
export * from './modal/index.js';
|
|
8
9
|
// Add more components here...
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { onDestroy, onMount, type Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import { fade } from 'svelte/transition';
|
|
5
|
+
import {twMerge} from 'tailwind-merge';
|
|
6
|
+
import { browser } from '$app/environment';
|
|
7
|
+
|
|
8
|
+
export type ModalProps = {
|
|
9
|
+
open?: boolean;
|
|
10
|
+
escapeKeyClose?: boolean;
|
|
11
|
+
disableBodyScroll?: boolean;
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
overlayTransitionDuration?: number;
|
|
14
|
+
overlayClasses?: string;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
class?: ClassNameValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
let {open=$bindable(false), escapeKeyClose=true, disableBodyScroll=true, overlayTransitionDuration=0, ariaLabel="Modal", overlayClasses="", children, ...props}: ModalProps = $props();
|
|
23
|
+
|
|
24
|
+
const lockScroll = () => document.body.style.overflow = 'hidden';
|
|
25
|
+
const unlockScroll = () => document.body.style.overflow = '';
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
if (open && disableBodyScroll) lockScroll(); else unlockScroll();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
onMount(() => {
|
|
32
|
+
if(browser){
|
|
33
|
+
window.addEventListener('keydown', handleKeydown);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
onDestroy(() => {
|
|
38
|
+
if(browser){
|
|
39
|
+
window.removeEventListener('keydown', handleKeydown);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export function closeDrawer() {
|
|
44
|
+
open = false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function handleKeydown (event: { key: string; }) {
|
|
48
|
+
if(open && escapeKeyClose && event.key === "Escape") {
|
|
49
|
+
closeDrawer();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
{#if open}
|
|
56
|
+
<!-- Overlay -->
|
|
57
|
+
<div transition:fade={{duration: overlayTransitionDuration}} class={twMerge("fixed inset-0 bg-overlay-primary", overlayClasses)} role="presentation" onclick={() => open = false}></div>
|
|
58
|
+
|
|
59
|
+
<div role="dialog" aria-modal="true" aria-label={ariaLabel} tabindex="{open ? 0 : -1}" aria-hidden="{!open}"
|
|
60
|
+
class={twMerge("fixed bg-white top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 outline-0 focus:outline-0 active:outline-focus-primary focus:outline-focus-primary overflow-y-auto w-full max-w-md h-96", props.class)}>
|
|
61
|
+
{@render children?.()}
|
|
62
|
+
</div>
|
|
63
|
+
{/if}
|
|
64
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export type ModalProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
escapeKeyClose?: boolean;
|
|
6
|
+
disableBodyScroll?: boolean;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
overlayTransitionDuration?: number;
|
|
9
|
+
overlayClasses?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
class?: ClassNameValue;
|
|
12
|
+
};
|
|
13
|
+
declare const Modal: import("svelte").Component<ModalProps, {
|
|
14
|
+
closeDrawer: () => void;
|
|
15
|
+
}, "open">;
|
|
16
|
+
type Modal = ReturnType<typeof Modal>;
|
|
17
|
+
export default Modal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Modal } from './modal.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Modal } from './modal.svelte';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import {twMerge} from 'tailwind-merge';
|
|
5
|
+
|
|
6
|
+
export type RadioProps = {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
value?: any;
|
|
12
|
+
group?: any;
|
|
13
|
+
labelPosition?: "left" | "right";
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
icon?: Snippet;
|
|
17
|
+
onclick?: (event: MouseEvent) => void;
|
|
18
|
+
labelClass?: ClassNameValue;
|
|
19
|
+
class?: ClassNameValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
|
|
26
|
+
let {id, name, label="", labelPosition="right", value=$bindable(), group=$bindable(), size="md", disabled=$bindable(false), onclick, labelClass, ...props}: RadioProps = $props();
|
|
27
|
+
|
|
28
|
+
const sizeMap = {
|
|
29
|
+
sm: 'w-4 h-4',
|
|
30
|
+
md: 'w-5 h-5',
|
|
31
|
+
lg: 'w-6 h-6',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<label for={id} class="inline-flex items-center gap-2 cursor-pointer select-none">
|
|
37
|
+
{#if labelPosition === "left"}<span class={twMerge("text-sm", labelClass)}>{label}</span>{/if}
|
|
38
|
+
<input {id} name={name ? name : id} type="radio" bind:value bind:group {disabled} class={twMerge("border-border-primary focus:ring-2 ring-focus-primary text-button-primary accent-button-primary cursor-pointer",
|
|
39
|
+
sizeMap[size], props.class)} />
|
|
40
|
+
{#if labelPosition === "right"}<span class={twMerge("text-sm", labelClass)}>{label}</span>{/if}
|
|
41
|
+
</label>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export type RadioProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
value?: any;
|
|
9
|
+
group?: any;
|
|
10
|
+
labelPosition?: "left" | "right";
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
icon?: Snippet;
|
|
14
|
+
onclick?: (event: MouseEvent) => void;
|
|
15
|
+
labelClass?: ClassNameValue;
|
|
16
|
+
class?: ClassNameValue;
|
|
17
|
+
};
|
|
18
|
+
declare const Radio: import("svelte").Component<RadioProps, {}, "value" | "disabled" | "group">;
|
|
19
|
+
type Radio = ReturnType<typeof Radio>;
|
|
20
|
+
export default Radio;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Radio } from './Radio.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Radio } from './Radio.svelte';
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<div class="relative">
|
|
74
74
|
{#if icon}<div class="absolute inset-y-0 left-0 flex items-center justify-center rounded-l-primary m-0.5 w-10">{@render icon()}</div>{/if}
|
|
75
75
|
<input {disabled} {required} {type} {id} {name} {placeholder} {onchange} {onmouseup} bind:value
|
|
76
|
-
class={twMerge("rounded-primary border-
|
|
76
|
+
class={twMerge("rounded-primary border-border-primary focus:border-primary-500 focus:ring-primary-500 placeholder:opacity-50 disabled:bg-neutral-300/30 disabled:border-gray-300/30",
|
|
77
77
|
error ? "bg-red-50 border-red-300 ring-red-300" : "",
|
|
78
78
|
icon ? "pl-10" : "",
|
|
79
79
|
sizeStyle[size], inputClasses)}
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import { fade, fly, slide } from 'svelte/transition';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
|
|
6
|
-
export type ButtonProps = {
|
|
7
|
-
open?: boolean;
|
|
8
|
-
transitionDuration?: number;
|
|
9
|
-
transitionDistance?: number;
|
|
10
|
-
transitionPosition?: "left-0" | "right-0";
|
|
11
|
-
overlayClasses?: string;
|
|
12
|
-
children?: Snippet;
|
|
13
|
-
class?: ClassNameValue;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
import {twMerge} from 'tailwind-merge';
|
|
20
|
-
|
|
21
|
-
let {open=$bindable(false), transitionPosition="left-0", transitionDuration=200, transitionDistance=-240, overlayClasses="", children, ...props}: ButtonProps = $props();
|
|
22
|
-
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
{#if open}
|
|
26
|
-
<!-- Overlay -->
|
|
27
|
-
<div transition:fade={{duration: transitionDuration}} class={twMerge("fixed inset-0 bg-neutral-700/80", overlayClasses)} role="presentation" onclick={() => open = false}></div>
|
|
28
|
-
|
|
29
|
-
<aside class={twMerge("fixed top-0 flex flex-col items-center gap-2 bg-white w-60 h-screen", transitionPosition, props.class)}
|
|
30
|
-
in:fly={{ x: transitionDistance, duration: transitionDuration }}
|
|
31
|
-
out:fly={{ x: transitionDistance, duration: transitionDuration }}>
|
|
32
|
-
{@render children?.()}
|
|
33
|
-
</aside>
|
|
34
|
-
{/if}
|
|
35
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
export type ButtonProps = {
|
|
4
|
-
open?: boolean;
|
|
5
|
-
transitionDuration?: number;
|
|
6
|
-
transitionDistance?: number;
|
|
7
|
-
transitionPosition?: "left-0" | "right-0";
|
|
8
|
-
overlayClasses?: string;
|
|
9
|
-
children?: Snippet;
|
|
10
|
-
class?: ClassNameValue;
|
|
11
|
-
};
|
|
12
|
-
declare const NavBarAside: import("svelte").Component<ButtonProps, {}, "open">;
|
|
13
|
-
type NavBarAside = ReturnType<typeof NavBarAside>;
|
|
14
|
-
export default NavBarAside;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NavBarAside } from './NavBarAside.svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as NavBarAside } from './NavBarAside.svelte';
|