@hashrytech/quick-components-kit 0.3.2 → 0.3.3
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 +6 -0
- package/dist/button/Button.svelte +20 -18
- package/dist/button/Button.svelte.d.ts +9 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
|
|
5
|
+
export type ButtonProps = {
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
icon?: Snippet;
|
|
8
|
+
class?: ClassNameValue;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
</script>
|
|
12
|
+
|
|
1
13
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export let className: string = ''; // Allow extra classes
|
|
14
|
+
import {twMerge} from 'tailwind-merge';
|
|
15
|
+
|
|
16
|
+
let {children, icon, ...props}: ButtonProps = $props();
|
|
17
|
+
|
|
7
18
|
</script>
|
|
8
19
|
|
|
9
|
-
<button
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
${variant === 'primary' ? 'bg-blue-600 text-white hover:bg-blue-700' : ''}
|
|
13
|
-
${variant === 'secondary' ? 'bg-gray-200 text-gray-800 hover:bg-gray-300' : ''}
|
|
14
|
-
${variant === 'danger' ? 'bg-red-600 text-white hover:bg-red-700' : ''}
|
|
15
|
-
${size === 'sm' ? 'px-2 py-1 text-sm' : ''}
|
|
16
|
-
${size === 'md' ? 'px-4 py-2 text-base' : ''}
|
|
17
|
-
${size === 'lg' ? 'px-6 py-3 text-lg' : ''}
|
|
18
|
-
${disabled ? 'opacity-50 cursor-not-allowed' : ''}
|
|
19
|
-
${className}`}
|
|
20
|
-
disabled={disabled}>
|
|
21
|
-
<slot />
|
|
20
|
+
<button class={twMerge("flex flex-row items-center gap-2 px-4 py-2 bg-button-primary hover:bg-button-primary-hover rounded-primary w-fit cursor-pointer text-white", props.class)}>
|
|
21
|
+
{#if icon}<span class="w-10">{@render icon()}</span>{/if}
|
|
22
|
+
{@render children?.()}
|
|
22
23
|
</button>
|
|
24
|
+
|
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
-
default: any;
|
|
16
|
-
} ? Props extends Record<string, never> ? any : {
|
|
17
|
-
children?: any;
|
|
18
|
-
} : {});
|
|
19
|
-
declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
20
|
-
type?: "button" | "submit" | "reset";
|
|
21
|
-
variant?: "primary" | "secondary" | "danger";
|
|
22
|
-
size?: "sm" | "md" | "lg";
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
className?: string;
|
|
25
|
-
}, {
|
|
26
|
-
default: {};
|
|
27
|
-
}>, {
|
|
28
|
-
[evt: string]: CustomEvent<any>;
|
|
29
|
-
}, {
|
|
30
|
-
default: {};
|
|
31
|
-
}, {}, string>;
|
|
32
|
-
type Button = InstanceType<typeof Button>;
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
export type ButtonProps = {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
icon?: Snippet;
|
|
6
|
+
class?: ClassNameValue;
|
|
7
|
+
};
|
|
8
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "">;
|
|
9
|
+
type Button = ReturnType<typeof Button>;
|
|
33
10
|
export default Button;
|