@hashrytech/quick-components-kit 0.17.3 → 0.17.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 +12 -0
- package/dist/components/button/Button.svelte +8 -5
- package/dist/components/button/Button.svelte.d.ts +1 -1
- package/dist/components/drawer/Drawer.svelte +1 -1
- package/dist/components/modal/Modal.svelte +2 -2
- package/dist/components/portal/Portal.svelte +11 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
children?: Snippet;
|
|
8
8
|
icon?: Snippet;
|
|
9
|
-
|
|
9
|
+
activeIcon?: Snippet;
|
|
10
10
|
onclick?: (event: MouseEvent) => void;
|
|
11
11
|
class?: ClassNameValue;
|
|
12
12
|
};
|
|
@@ -16,15 +16,18 @@
|
|
|
16
16
|
<script lang="ts">
|
|
17
17
|
import {twMerge} from 'tailwind-merge';
|
|
18
18
|
|
|
19
|
-
let { disabled=$bindable(), children, icon,
|
|
19
|
+
let { disabled=$bindable(), children, icon, activeIcon, onclick, ...props }: ButtonProps = $props();
|
|
20
20
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
|
-
<button {disabled} class={twMerge("flex flex-row items-center gap-2 px-4 py-2 focus:outline-primary-focus bg-primary-button hover:bg-primary-button-hover rounded-primary
|
|
23
|
+
<button {disabled} class={twMerge("flex flex-row items-center gap-2 px-4 py-2 focus:outline-primary-focus bg-primary-button hover:bg-primary-button-hover rounded-primary cursor-pointer focus:ring-primary-focus focus:ring",
|
|
24
24
|
"disabled:bg-primary-button/60 disabled:cursor-default", props.class)}
|
|
25
25
|
{onclick}>
|
|
26
|
-
{#if
|
|
27
|
-
|
|
26
|
+
{#if activeIcon}
|
|
27
|
+
<span>{@render activeIcon()}</span>
|
|
28
|
+
{:else if icon}
|
|
29
|
+
<span>{@render icon()}</span>
|
|
30
|
+
{/if}
|
|
28
31
|
{@render children?.()}
|
|
29
32
|
</button>
|
|
30
33
|
|
|
@@ -112,7 +112,7 @@ A flexible, accessible slide-in drawer component for Svelte 5 using Tailwind CSS
|
|
|
112
112
|
</script>
|
|
113
113
|
|
|
114
114
|
{#if open}
|
|
115
|
-
<Portal>
|
|
115
|
+
<Portal class="fixed z-50">
|
|
116
116
|
<Overlay {transitionDuration} {disableBodyScroll} class={overlayClasses} onclick={closeDrawer} />
|
|
117
117
|
<div bind:this={drawerElement} use:trapFocus role="dialog" aria-modal="true" aria-label={ariaLabel} tabindex={open ? 0 : -1} aria-hidden={!open}
|
|
118
118
|
class={twMerge("fixed bg-white overflow-y-auto focus:outline-none", postionClasses[position], props.class)}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
{#if open}
|
|
56
|
-
<Portal>
|
|
56
|
+
<Portal class="fixed z-50">
|
|
57
57
|
<Overlay {transitionDuration} {disableBodyScroll} class={overlayClasses} onclick={closeModal} />
|
|
58
58
|
<div bind:this={modalElement} use:trapFocus role="dialog" aria-modal="true" aria-label={ariaLabel} tabindex={open ? 0 : -1} aria-hidden={!open}
|
|
59
59
|
class={twMerge("fixed w-full max-w-2xl top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 h-6/12 overflow-y-auto focus:outline-none bg-white rounded-primary", props.class)}
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
in:fly={{y: 150, duration: transitionDuration}}
|
|
62
62
|
out:fly={{y: 150, duration: transitionDuration}}>
|
|
63
63
|
|
|
64
|
-
{@render children?.()}
|
|
64
|
+
{@render children?.()}
|
|
65
65
|
|
|
66
66
|
</div>
|
|
67
67
|
</Portal>
|
|
@@ -36,17 +36,17 @@ A utility component that renders its children outside the current DOM hierarchy
|
|
|
36
36
|
|
|
37
37
|
<script lang="ts" module>
|
|
38
38
|
import { type Snippet } from 'svelte';
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
40
|
+
import {twMerge} from 'tailwind-merge';
|
|
41
|
+
import { onMount, onDestroy } from 'svelte';
|
|
42
|
+
import { browser } from '$app/environment';
|
|
43
|
+
|
|
44
|
+
export type PortalProps = {
|
|
45
|
+
target?: HTMLElement;
|
|
46
|
+
append?: boolean;
|
|
47
|
+
children?: Snippet;
|
|
48
|
+
class?: ClassNameValue;
|
|
49
|
+
};
|
|
50
50
|
|
|
51
51
|
</script>
|
|
52
52
|
|