@adriansyah/heroui-svelte 0.0.2 → 0.0.4

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.
Files changed (61) hide show
  1. package/README.md +3 -3
  2. package/dist/components/autocomplete/autocomplete-popover.svelte +1 -1
  3. package/dist/components/autocomplete/autocomplete-trigger.svelte +45 -21
  4. package/dist/components/autocomplete/autocomplete-trigger.svelte.d.ts +8 -2
  5. package/dist/components/autocomplete/autocomplete.svelte +13 -7
  6. package/dist/components/autocomplete/index.svelte.d.ts +3 -3
  7. package/dist/components/autocomplete/index.svelte.js +10 -11
  8. package/dist/components/avatar/context.svelte.d.ts +1 -1
  9. package/dist/components/avatar/context.svelte.js +1 -1
  10. package/dist/components/button/button.svelte +1 -1
  11. package/dist/components/button/index.svelte.d.ts +1 -1
  12. package/dist/components/button/index.svelte.js +1 -1
  13. package/dist/components/button-group/context.svelte.d.ts +1 -1
  14. package/dist/components/button-group/context.svelte.js +1 -1
  15. package/dist/components/card/context.svelte.d.ts +1 -1
  16. package/dist/components/card/context.svelte.js +1 -1
  17. package/dist/components/checkbox/checkbox-content.svelte +7 -6
  18. package/dist/components/checkbox/checkbox-control.svelte +7 -6
  19. package/dist/components/checkbox/checkbox.svelte +7 -2
  20. package/dist/components/collection/collection.svelte +1 -1
  21. package/dist/components/collection/collection.svelte.d.ts +1 -1
  22. package/dist/components/filter/filter-provider.svelte +1 -1
  23. package/dist/components/filter/index.svelte.d.ts +3 -3
  24. package/dist/components/filter/index.svelte.js +3 -18
  25. package/dist/components/input/index.svelte.d.ts +1 -1
  26. package/dist/components/input/index.svelte.js +3 -3
  27. package/dist/components/input/input.svelte +1 -1
  28. package/dist/components/input-group/input-group-input.svelte +1 -1
  29. package/dist/components/input-group/input-group-textarea.svelte +1 -1
  30. package/dist/components/input-group/input-group.svelte +1 -1
  31. package/dist/components/list-box/index.svelte.d.ts +21 -1
  32. package/dist/components/list-box/index.svelte.js +56 -2
  33. package/dist/components/list-box/list-box-item-indicator.svelte +3 -9
  34. package/dist/components/list-box/list-box-item.svelte +23 -48
  35. package/dist/components/list-box/list-box-item.svelte.d.ts +4 -1
  36. package/dist/components/list-box/list-box.svelte +2 -3
  37. package/dist/components/modal/index.svelte.d.ts +1 -1
  38. package/dist/components/modal/index.svelte.js +1 -1
  39. package/dist/components/modal/modal-content.svelte +1 -1
  40. package/dist/components/modal/modal-trigger.svelte +18 -9
  41. package/dist/components/modal/modal-trigger.svelte.d.ts +5 -1
  42. package/dist/components/pagination/index.svelte.d.ts +1 -1
  43. package/dist/components/pagination/index.svelte.js +1 -1
  44. package/dist/components/pagination/pagination-content.svelte +17 -1
  45. package/dist/components/pagination/pagination-link.svelte +5 -1
  46. package/dist/components/pagination/pagination-next.svelte +7 -1
  47. package/dist/components/pagination/pagination-previous.svelte +7 -1
  48. package/dist/components/pagination/pagination-summary.svelte +7 -1
  49. package/dist/components/pagination/pagination.svelte +9 -2
  50. package/dist/components/popover/index.svelte.d.ts +1 -1
  51. package/dist/components/popover/index.svelte.js +1 -1
  52. package/dist/components/popover/popover-trigger.svelte +26 -9
  53. package/dist/components/popover/popover-trigger.svelte.d.ts +12 -7
  54. package/dist/components/popover/popover.svelte +3 -3
  55. package/dist/components/popover/popover.svelte.d.ts +2 -4
  56. package/dist/components/search-input/search-input.svelte +5 -4
  57. package/dist/components/table/index.svelte.d.ts +1 -1
  58. package/dist/components/table/index.svelte.js +1 -1
  59. package/dist/components/text-field/text-field.svelte +1 -1
  60. package/dist/components/textarea/textarea.svelte +1 -1
  61. package/package.json +2 -2
@@ -1,21 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import { listboxItemVariants } from "@heroui/styles";
4
- import { ListBoxContext } from "./index.svelte";
4
+ import { ListBoxItemContext } from "./index.svelte";
5
5
 
6
6
  let { ...props }: HTMLAttributes<HTMLDivElement> = $props();
7
7
 
8
- let node = $state<HTMLElement>();
9
- const ctx = ListBoxContext.get();
10
- const value = $derived(
11
- node?.closest(".list-box-item")?.getAttribute("data-value"),
12
- );
13
- const selected = $derived(value && ctx.isSelected(value));
8
+ const ctx = ListBoxItemContext.get();
14
9
  </script>
15
10
 
16
11
  <div
17
12
  {...props}
18
- bind:this={node}
19
13
  data-slot="list-box-item-indicator"
20
14
  class={listboxItemVariants().indicator({ class: props.class?.toString() })}
21
15
  >
@@ -26,7 +20,7 @@
26
20
  role="presentation"
27
21
  stroke="currentColor"
28
22
  stroke-dasharray={22}
29
- stroke-dashoffset={selected ? 44 : 66}
23
+ stroke-dashoffset={ctx.selected ? 44 : 66}
30
24
  stroke-linecap="round"
31
25
  stroke-linejoin="round"
32
26
  stroke-width={2}
@@ -1,78 +1,53 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import { listboxItemVariants } from "@heroui/styles";
4
- import { ListBoxContext } from "../../index.js";
5
- import { FilterContext } from "../filter/index.svelte";
6
- import { watch } from "svelte-utils";
4
+ import { ListBoxItemContext } from "../../index.js";
5
+ import { box } from "@adriansyah/svelte-utils";
6
+ import type { Snippet } from "svelte";
7
7
 
8
8
  let {
9
- value,
9
+ value = crypto.randomUUID(),
10
10
  disabled,
11
11
  selected = $bindable(),
12
+ child,
12
13
  ...props
13
14
  }: HTMLAttributes<HTMLDivElement> & {
14
- value: string;
15
+ value?: string;
15
16
  selected?: boolean;
16
17
  disabled?: boolean;
18
+ child?: Snippet<[ListBoxItemContext]>;
17
19
  } = $props();
18
20
 
19
- const filter = FilterContext.getOr();
20
- const ctx = ListBoxContext.get();
21
- const hidden = $derived(filter && !filter.matches(value));
22
-
23
- watch(
24
- () => selected,
25
- (curr) => {
26
- if (curr === ctx.isSelected(value)) return;
27
- ctx.setSelected(value, curr ?? ctx.isSelected(value));
28
- },
29
- );
30
-
31
- watch(
32
- () => ctx.isSelected(value),
33
- (curr) => {
34
- if (curr === selected) return;
35
- selected = curr;
36
- },
21
+ const ctx = new ListBoxItemContext(
22
+ () => ({ value, disabled }),
23
+ box(
24
+ () => !!selected,
25
+ (v) => (selected = v),
26
+ ),
37
27
  );
38
-
39
- $effect(() => () => ctx.setSelected(value, false));
40
- $effect(() => filter?.register(value));
41
28
  </script>
42
29
 
43
- {#if !hidden}
30
+ {#if child}
31
+ {@render child(ctx)}
32
+ {:else if ctx.visible}
44
33
  <div
45
- {...props}
46
- onkeydown={(ev) => {
47
- if (
48
- ev.code === "Space" ||
49
- (ev.code === "Enter" && ev.target === ev.currentTarget)
50
- ) {
51
- ev.preventDefault();
52
- ctx.setSelected(value, !selected);
53
- }
54
- }}
55
- onclick={() => ctx.setSelected(value, !selected)}
56
- role="checkbox"
57
- tabindex="0"
58
- data-value={value}
59
- data-disabled={ctx.opts.disabled ?? disabled}
34
+ {...ctx.props(props)}
60
35
  data-slot="list-box-item"
61
36
  class={listboxItemVariants().item({ class: props.class?.toString() })}
62
37
  >
63
- {#if ctx.opts.name}
38
+ {#if ctx.listbox.opts.name}
64
39
  <input
65
40
  {@attach (node) => {
66
41
  const form = node.form;
67
42
  if (!form) return;
68
- const reset = () => ctx.setSelected(value, false);
43
+ const reset = () => (ctx.selected = false);
69
44
  form.addEventListener("reset", reset);
70
45
  return () => form.removeEventListener("reset", reset);
71
46
  }}
72
- checked={ctx.isSelected(value)}
73
- disabled={ctx.opts.disabled ?? disabled}
74
- required={ctx.opts.required}
75
- name={ctx.opts.name}
47
+ checked={ctx.selected}
48
+ disabled={ctx.disabled}
49
+ required={ctx.listbox.opts.required}
50
+ name={ctx.listbox.opts.name}
76
51
  type={"checkbox"}
77
52
  {value}
78
53
  hidden
@@ -1,8 +1,11 @@
1
1
  import type { HTMLAttributes } from "svelte/elements";
2
+ import { ListBoxItemContext } from "../../index.js";
3
+ import type { Snippet } from "svelte";
2
4
  type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
3
- value: string;
5
+ value?: string;
4
6
  selected?: boolean;
5
7
  disabled?: boolean;
8
+ child?: Snippet<[ListBoxItemContext]>;
6
9
  };
7
10
  declare const ListBoxItem: import("svelte").Component<$$ComponentProps, {}, "selected">;
8
11
  type ListBoxItem = ReturnType<typeof ListBoxItem>;
@@ -2,18 +2,17 @@
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import { listboxVariants } from "@heroui/styles";
4
4
  import { type ListBoxOpts, ListBoxContext } from "../../index.js";
5
- import { box } from "svelte-utils";
5
+ import { box } from "@adriansyah/svelte-utils";
6
6
 
7
7
  type Props = HTMLAttributes<HTMLDivElement> &
8
8
  Partial<ListBoxOpts> & {
9
9
  selected?: string[];
10
10
  };
11
11
 
12
- const id = $props.id();
13
12
  let {
14
13
  multiple,
15
14
  selected = $bindable([]),
16
- name = id,
15
+ name,
17
16
  disabled,
18
17
  required,
19
18
  ...props
@@ -1,5 +1,5 @@
1
1
  import type { ModalVariants } from "@heroui/styles";
2
- import { Context, DialogState, type Getter } from "svelte-utils";
2
+ import { Context, DialogState, type Getter } from "@adriansyah/svelte-utils";
3
3
  export type ModalOpts = ModalVariants & {
4
4
  placement?: "top" | "bottom" | "center" | "auto";
5
5
  };
@@ -1,4 +1,4 @@
1
- import { Context, DialogState } from "svelte-utils";
1
+ import { Context, DialogState } from "@adriansyah/svelte-utils";
2
2
  export class ModalContext extends Context {
3
3
  opts;
4
4
  dialog = new DialogState();
@@ -2,7 +2,7 @@
2
2
  import type { HTMLDialogAttributes } from "svelte/elements";
3
3
  import { modalVariants } from "@heroui/styles";
4
4
  import { ModalContext } from "../../index.js";
5
- import { getViewport } from "svelte-utils";
5
+ import { getViewport } from "@adriansyah/svelte-utils";
6
6
 
7
7
  type Props = HTMLDialogAttributes;
8
8
 
@@ -1,23 +1,32 @@
1
1
  <script lang="ts">
2
+ import type { HTMLAttributes } from "svelte/elements";
2
3
  import Button from "../button/button.svelte";
3
4
  import { ModalContext } from "./index.svelte";
4
- import type { ComponentProps } from "svelte";
5
+ import type { ComponentProps, Snippet } from "svelte";
5
6
 
6
7
  const {
7
8
  action = "show",
9
+ child,
8
10
  ...props
9
11
  }: ComponentProps<typeof Button> & {
10
12
  action?: "show" | "close";
13
+ child?: Snippet<[{ props: HTMLAttributes<any> }]>;
11
14
  } = $props();
12
15
 
13
16
  const ctx = ModalContext.get();
17
+ const merged: HTMLAttributes<any> = $derived({
18
+ ...props,
19
+ onclick: (ev) => {
20
+ ctx.dialog.toggle?.();
21
+ props.onclick?.(ev);
22
+ },
23
+ });
14
24
  </script>
15
25
 
16
- <Button
17
- {...props}
18
- type="button"
19
- command={action === "show" ? "show-modal" : "close"}
20
- commandfor={ctx.dialog.nodeId}
21
- >
22
- {@render props.children?.()}
23
- </Button>
26
+ {#if child}
27
+ {@render child({ props: merged })}
28
+ {:else}
29
+ <Button {...merged} type="button">
30
+ {@render props.children?.()}
31
+ </Button>
32
+ {/if}
@@ -1,7 +1,11 @@
1
+ import type { HTMLAttributes } from "svelte/elements";
1
2
  import Button from "../button/button.svelte";
2
- import type { ComponentProps } from "svelte";
3
+ import type { ComponentProps, Snippet } from "svelte";
3
4
  type $$ComponentProps = ComponentProps<typeof Button> & {
4
5
  action?: "show" | "close";
6
+ child?: Snippet<[{
7
+ props: HTMLAttributes<any>;
8
+ }]>;
5
9
  };
6
10
  declare const ModalTrigger: import("svelte").Component<$$ComponentProps, {}, "">;
7
11
  type ModalTrigger = ReturnType<typeof ModalTrigger>;
@@ -1,5 +1,5 @@
1
1
  import { type PaginationVariants } from "@heroui/styles";
2
- import { Context, type Box, type Getter } from "svelte-utils";
2
+ import { Context, type Box, type Getter } from "@adriansyah/svelte-utils";
3
3
  export type PaginationProps = {
4
4
  total?: number;
5
5
  pageSize?: number;
@@ -1,5 +1,5 @@
1
1
  import {} from "@heroui/styles";
2
- import { box, Context } from "svelte-utils";
2
+ import { box, Context } from "@adriansyah/svelte-utils";
3
3
  export default class PaginationState extends Context {
4
4
  opts;
5
5
  #page;
@@ -2,6 +2,10 @@
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import PaginationState from "./index.svelte";
4
4
  import { paginationVariants } from "@heroui/styles";
5
+ import PaginationItem from "./pagination-item.svelte";
6
+ import PaginationPrevious from "./pagination-previous.svelte";
7
+ import PaginationNext from "./pagination-next.svelte";
8
+ import PaginationLink from "./pagination-link.svelte";
5
9
 
6
10
  const props: HTMLAttributes<HTMLUListElement> = $props();
7
11
  const pagination = PaginationState.get();
@@ -13,5 +17,17 @@
13
17
  class: props.class?.toString(),
14
18
  })}
15
19
  >
16
- {@render props.children?.()}
20
+ {#if props.children}
21
+ {@render props.children()}
22
+ {:else}
23
+ <PaginationItem>
24
+ <PaginationPrevious />
25
+ </PaginationItem>
26
+ <PaginationItem>
27
+ <PaginationLink disabled={pagination.total === 0} page={pagination.page} />
28
+ </PaginationItem>
29
+ <PaginationItem>
30
+ <PaginationNext />
31
+ </PaginationItem>
32
+ {/if}
17
33
  </ul>
@@ -22,5 +22,9 @@
22
22
  class: props.class?.toString(),
23
23
  })}
24
24
  >
25
- {@render props.children?.()}
25
+ {#if props.children}
26
+ {@render props.children()}
27
+ {:else}
28
+ {page}
29
+ {/if}
26
30
  </button>
@@ -2,6 +2,7 @@
2
2
  import type { HTMLButtonAttributes } from "svelte/elements";
3
3
  import PaginationState from "./index.svelte";
4
4
  import { paginationVariants } from "@heroui/styles";
5
+ import { PaginationNextIcon } from ".";
5
6
 
6
7
  const props: HTMLButtonAttributes = $props();
7
8
  const pagination = PaginationState.get();
@@ -19,5 +20,10 @@
19
20
  class: ["pagination__link--nav"],
20
21
  })}
21
22
  >
22
- {@render props.children?.()}
23
+ {#if props.children}
24
+ {@render props.children()}
25
+ {:else}
26
+ Next
27
+ <PaginationNextIcon />
28
+ {/if}
23
29
  </button>
@@ -2,6 +2,7 @@
2
2
  import type { HTMLButtonAttributes } from "svelte/elements";
3
3
  import PaginationState from "./index.svelte";
4
4
  import { paginationVariants } from "@heroui/styles";
5
+ import PaginationPreviousIcon from "./pagination-previous-icon.svelte";
5
6
 
6
7
  const props: HTMLButtonAttributes = $props();
7
8
  const pagination = PaginationState.get();
@@ -19,5 +20,10 @@
19
20
  class: ["pagination__link--nav"],
20
21
  })}
21
22
  >
22
- {@render props.children?.()}
23
+ {#if props.children}
24
+ {@render props.children()}
25
+ {:else}
26
+ <PaginationPreviousIcon />
27
+ Prev
28
+ {/if}
23
29
  </button>
@@ -19,5 +19,11 @@
19
19
  class: props.class?.toString(),
20
20
  })}
21
21
  >
22
- {@render children?.(pagination)}
22
+ {#if children}
23
+ {@render children(pagination)}
24
+ {:else if pagination.total === 0}
25
+ Showing empty
26
+ {:else}
27
+ Showing {pagination.start} ~ {pagination.end} of {pagination.total}
28
+ {/if}
23
29
  </div>
@@ -3,7 +3,9 @@
3
3
  import type { PaginationProps } from "./index.svelte";
4
4
  import type { HTMLAttributes } from "svelte/elements";
5
5
  import PaginationState from "./index.svelte";
6
- import { box } from "svelte-utils";
6
+ import { box } from "@adriansyah/svelte-utils";
7
+ import PaginationSummary from "./pagination-summary.svelte";
8
+ import PaginationContent from "./pagination-content.svelte";
7
9
 
8
10
  let {
9
11
  page = $bindable(1),
@@ -36,5 +38,10 @@
36
38
  class: props.class?.toString(),
37
39
  })}
38
40
  >
39
- {@render props.children?.()}
41
+ {#if props.children}
42
+ {@render props.children()}
43
+ {:else}
44
+ <PaginationSummary />
45
+ <PaginationContent />
46
+ {/if}
40
47
  </div>
@@ -1,4 +1,4 @@
1
- import { Context, PopoverState, type Box, type Getter } from "svelte-utils";
1
+ import { Context, PopoverState, type Box, type Getter } from "@adriansyah/svelte-utils";
2
2
  export type PopoverContextOpts = {
3
3
  placement?: "bottom" | "top" | "left" | "right";
4
4
  offset?: number;
@@ -1,4 +1,4 @@
1
- import { Context, getPopoverArea, PopoverState } from "svelte-utils";
1
+ import { Context, getPopoverArea, PopoverState } from "@adriansyah/svelte-utils";
2
2
  export class PopoverContext extends Context {
3
3
  get open() { return this.popover.open; }
4
4
  set open(open) { this.popover.open = open; }
@@ -1,17 +1,34 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from "svelte";
2
+ import type { ComponentProps, Snippet } from "svelte";
3
3
  import Button from "../button/button.svelte";
4
4
  import { PopoverContext } from "./index.svelte";
5
+ import type { PopoverState } from "@adriansyah/@adriansyah/svelte-utils";
5
6
 
6
- const props: ComponentProps<typeof Button> = $props();
7
+ type Props = ComponentProps<typeof Button> & {
8
+ child?: Snippet<
9
+ [{ props: ComponentProps<typeof Button>; popover: PopoverState }]
10
+ >;
11
+ };
12
+
13
+ const { child, ...props }: Props = $props();
7
14
 
8
15
  const ctx = PopoverContext.get();
16
+ const merged: ComponentProps<typeof Button> = $derived({
17
+ ...props,
18
+ ...{
19
+ type: "button",
20
+ command: "toggle-popover",
21
+ commandfor: ctx.popover.nodeId,
22
+ pressed: ctx.popover.open,
23
+ },
24
+ });
9
25
  </script>
10
26
 
11
- <Button
12
- {...props}
13
- type="button"
14
- command="toggle-popover"
15
- commandfor={ctx.popover.nodeId}
16
- pressed={ctx.popover.open}
17
- />
27
+ {#if child}
28
+ {@render child({
29
+ props: merged,
30
+ popover: ctx.popover,
31
+ })}
32
+ {:else}
33
+ <Button {...merged} />
34
+ {/if}
@@ -1,9 +1,14 @@
1
- declare const PopoverTrigger: import("svelte").Component<{
2
- focused?: boolean;
3
- hovered?: boolean;
4
- pending?: boolean;
5
- pressed?: boolean;
6
- disabled?: boolean;
7
- } & import("@heroui/styles").ButtonVariants & import("svelte/elements").HTMLButtonAttributes, {}, "">;
1
+ import type { ComponentProps, Snippet } from "svelte";
2
+ import Button from "../button/button.svelte";
3
+ import type { PopoverState } from "@adriansyah/@adriansyah/svelte-utils";
4
+ type Props = ComponentProps<typeof Button> & {
5
+ child?: Snippet<[
6
+ {
7
+ props: ComponentProps<typeof Button>;
8
+ popover: PopoverState;
9
+ }
10
+ ]>;
11
+ };
12
+ declare const PopoverTrigger: import("svelte").Component<Props, {}, "">;
8
13
  type PopoverTrigger = ReturnType<typeof PopoverTrigger>;
9
14
  export default PopoverTrigger;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { PopoverContext, type PopoverContextOpts } from "./index.svelte";
3
- import { box } from "svelte-utils";
3
+ import { box } from "@adriansyah/svelte-utils";
4
4
  import type { Snippet } from "svelte";
5
5
 
6
6
  type Props = Omit<PopoverContextOpts, "open" | "fallbackAnchor"> & {
@@ -17,7 +17,7 @@
17
17
  children,
18
18
  }: Partial<Props> = $props();
19
19
 
20
- export const context = PopoverContext.getOr([
20
+ new PopoverContext(
21
21
  () => ({
22
22
  fallbackAnchor,
23
23
  offset,
@@ -27,7 +27,7 @@
27
27
  () => open,
28
28
  (v) => (open = v),
29
29
  ),
30
- ]);
30
+ );
31
31
  </script>
32
32
 
33
33
  {@render children?.()}
@@ -1,11 +1,9 @@
1
- import { PopoverContext, type PopoverContextOpts } from "./index.svelte";
1
+ import { type PopoverContextOpts } from "./index.svelte";
2
2
  import type { Snippet } from "svelte";
3
3
  declare const Popover: import("svelte").Component<Partial<Omit<PopoverContextOpts, "open" | "fallbackAnchor"> & {
4
4
  open?: boolean;
5
5
  fallbackAnchor?: HTMLElement;
6
6
  children?: Snippet;
7
- }>, {
8
- context: PopoverContext;
9
- }, "open">;
7
+ }>, {}, "open">;
10
8
  type Popover = ReturnType<typeof Popover>;
11
9
  export default Popover;
@@ -9,7 +9,7 @@
9
9
  InputContext,
10
10
  } from "../../index.js";
11
11
  import type { ComponentProps } from "svelte";
12
- import { box, watch } from "svelte-utils";
12
+ import { box, watch } from "@adriansyah/svelte-utils";
13
13
  import { FilterContext } from "../filter/index.svelte";
14
14
 
15
15
  type Props = ComponentProps<typeof InputGroup> & {
@@ -34,7 +34,7 @@
34
34
 
35
35
  const filter = FilterContext.getOr();
36
36
  const empty = $derived(value === undefined || value === "");
37
- InputContext.getOr([
37
+ new InputContext(
38
38
  () => ({
39
39
  disabled,
40
40
  fullWidth,
@@ -48,13 +48,14 @@
48
48
  () => value,
49
49
  (v) => (value = v),
50
50
  ),
51
- ]);
51
+ );
52
52
 
53
53
  watch(
54
54
  () => value ?? "",
55
55
  (currentValue) => {
56
+ if (currentValue === value) return;
56
57
  const timeout = setTimeout(
57
- () => (debounced = currentValue),
58
+ () => (debounced = String(currentValue)),
58
59
  Math.max(0, debounce),
59
60
  );
60
61
  return () => clearTimeout(timeout);
@@ -1,5 +1,5 @@
1
1
  import type { TableVariants } from "@heroui/styles";
2
- import { Context, type Getter } from "svelte-utils";
2
+ import { Context, type Getter } from "@adriansyah/svelte-utils";
3
3
  export type TableOpts = TableVariants;
4
4
  export default class TableContext extends Context {
5
5
  readonly opts: TableOpts;
@@ -1,4 +1,4 @@
1
- import { Context } from "svelte-utils";
1
+ import { Context } from "@adriansyah/svelte-utils";
2
2
  export default class TableContext extends Context {
3
3
  opts;
4
4
  constructor(opts) {
@@ -2,7 +2,7 @@
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import { textFieldVariants } from "@heroui/styles";
4
4
  import { type InputOpts, type InputValue, InputContext } from "../../index.js";
5
- import { box } from "svelte-utils";
5
+ import { box } from "@adriansyah/svelte-utils";
6
6
 
7
7
  type Props = InputOpts &
8
8
  HTMLAttributes<HTMLDivElement> & {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { HTMLAttributes } from "svelte/elements";
3
3
  import { InputContext, type InputOpts } from "../input";
4
- import { box, coalesce } from "svelte-utils";
4
+ import { box, coalesce } from "@adriansyah/svelte-utils";
5
5
  import { textAreaVariants } from "@heroui/styles";
6
6
 
7
7
  type Props = InputOpts &
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansyah/heroui-svelte",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "devDependencies": {
5
5
  "@chromatic-com/storybook": "latest",
6
6
  "@heroui/styles": "^3.2.6",
@@ -66,6 +66,6 @@
66
66
  "type": "module",
67
67
  "types": "./dist/index.d.ts",
68
68
  "dependencies": {
69
- "@adriansyah/svelte-utils": "^0.0.1"
69
+ "@adriansyah/svelte-utils": "^0.0.2"
70
70
  }
71
71
  }