fuma 2.0.23 → 2.0.25

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.
@@ -36,6 +36,7 @@
36
36
  export { klass as class }
37
37
  export let classList = ''
38
38
  export let inputElement: HTMLInputElement
39
+ export let dropdown: DropDown
39
40
 
40
41
  let proposedItems: RelationItem[] = []
41
42
 
@@ -45,20 +46,24 @@
45
46
  let searchValue = ''
46
47
 
47
48
  const dispatch = createEventDispatcher<{
48
- input: { value: RelationItem | null; focus: () => void }
49
+ input: { value: RelationItem | null }
49
50
  }>()
50
51
 
51
52
  export async function clear() {
52
53
  searchValue = ''
53
54
  item = null
54
- dispatch('input', { value: item, focus: () => inputElement.focus() })
55
+ dispatch('input', { value: item })
55
56
  await tick()
56
57
  inputElement.focus()
57
58
  }
58
59
 
59
60
  export async function select(index = focusIndex) {
60
61
  item = proposedItems[index]
61
- dispatch('input', { value: item, focus: () => inputElement.focus() })
62
+ dispatch('input', { value: item })
63
+ }
64
+
65
+ export function focus() {
66
+ inputElement.focus()
62
67
  }
63
68
 
64
69
  export async function searchItems(searchValue = '') {
@@ -86,7 +91,7 @@
86
91
  }
87
92
  </script>
88
93
 
89
- <DropDown {tippyProps} disable={flatMode} {...dropdownProps}>
94
+ <DropDown bind:this={dropdown} {tippyProps} disable={flatMode} {...dropdownProps}>
90
95
  <div class="contents" slot="activator">
91
96
  <FormControl {key} {label} {error} class={klass}>
92
97
  {#snippet children({ key })}
@@ -27,14 +27,15 @@ declare class __sveltets_Render<RelationItem extends {
27
27
  class?: string;
28
28
  classList?: string;
29
29
  inputElement: HTMLInputElement;
30
+ dropdown: DropDown;
30
31
  clear?: (() => Promise<void>) | undefined;
31
32
  select?: ((index?: number) => Promise<void>) | undefined;
33
+ focus?: (() => void) | undefined;
32
34
  searchItems?: ((searchValue?: string) => Promise<void>) | undefined;
33
35
  };
34
36
  events(): {
35
37
  input: CustomEvent<{
36
38
  value: RelationItem | null;
37
- focus: () => void;
38
39
  }>;
39
40
  } & {
40
41
  [evt: string]: CustomEvent<any>;
@@ -44,6 +45,7 @@ declare class __sveltets_Render<RelationItem extends {
44
45
  exports(): {
45
46
  clear: () => Promise<void>;
46
47
  select: (index?: number) => Promise<void>;
48
+ focus: () => void;
47
49
  searchItems: (searchValue?: string) => Promise<void>;
48
50
  };
49
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",