@webamoki/web-svelte 0.4.0 → 0.4.2

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.
@@ -2,18 +2,16 @@
2
2
  import Loader2Icon from '@lucide/svelte/icons/loader-2';
3
3
  import { Button } from '../../shadcn/components/ui/button/index.js';
4
4
  import type { ButtonProps } from '../../shadcn/components/ui/button/index.js';
5
- import type { Readable } from 'svelte/store';
6
5
 
7
6
  type Props = ButtonProps & {
8
7
  loading?: boolean;
9
- delayed?: Readable<boolean>;
10
8
  };
11
9
 
12
- let { disabled, loading, delayed, children, ...restProps }: Props = $props();
10
+ let { disabled, loading, children, ...restProps }: Props = $props();
13
11
  </script>
14
12
 
15
- <Button disabled={disabled || loading || $delayed} {...restProps}>
16
- {#if loading || $delayed}
13
+ <Button disabled={disabled || loading} {...restProps}>
14
+ {#if loading}
17
15
  <Loader2Icon class="mr-2 animate-spin" />
18
16
  Please wait
19
17
  {:else}
@@ -1,9 +1,7 @@
1
1
  import { Button } from '../../shadcn/components/ui/button/index.js';
2
2
  import type { ButtonProps } from '../../shadcn/components/ui/button/index.js';
3
- import type { Readable } from 'svelte/store';
4
3
  type Props = ButtonProps & {
5
4
  loading?: boolean;
6
- delayed?: Readable<boolean>;
7
5
  };
8
6
  declare const Button: import("svelte").Component<Props, {}, "">;
9
7
  type Button = ReturnType<typeof Button>;
@@ -36,6 +36,8 @@
36
36
  WithElementRef<HTMLAnchorAttributes> & {
37
37
  variant?: ButtonVariant;
38
38
  size?: ButtonSize;
39
+ } & {
40
+ loading?: boolean;
39
41
  };
40
42
  </script>
41
43
 
@@ -51,15 +53,16 @@
51
53
  children,
52
54
  ...restProps
53
55
  }: ButtonProps = $props();
56
+
57
+ let pointer = disabled ? '' : 'cursor-pointer';
54
58
  </script>
55
59
 
56
60
  <!-- eslint-disable svelte/no-navigation-without-resolve -->
57
-
58
61
  {#if href}
59
62
  <a
60
63
  bind:this={ref}
61
64
  data-slot="button"
62
- class={cn(buttonVariants({ variant, size }), className)}
65
+ class={cn(buttonVariants({ variant, size }), className, pointer)}
63
66
  href={disabled ? undefined : href}
64
67
  aria-disabled={disabled}
65
68
  role={disabled ? 'link' : undefined}
@@ -72,7 +75,7 @@
72
75
  <button
73
76
  bind:this={ref}
74
77
  data-slot="button"
75
- class={cn(buttonVariants({ variant, size }), className)}
78
+ class={cn(buttonVariants({ variant, size }), className, pointer)}
76
79
  {type}
77
80
  {disabled}
78
81
  {...restProps}
@@ -52,6 +52,8 @@ export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
52
52
  export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
53
53
  variant?: ButtonVariant;
54
54
  size?: ButtonSize;
55
+ } & {
56
+ loading?: boolean;
55
57
  };
56
58
  declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
57
59
  type Button = ReturnType<typeof Button>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.0",
6
+ "version": "0.4.2",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",