ankiutils 0.0.8 → 0.0.10

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.
@@ -24,7 +24,7 @@
24
24
  disabled = false,
25
25
  clearable = false,
26
26
  multiple = false,
27
- onSelected = () => {}
27
+ onSelected: onSelectedBase = () => {}
28
28
  }: Props = $props();
29
29
 
30
30
  let searchTerm = $state('');
@@ -69,7 +69,7 @@
69
69
  }
70
70
  searchTerm = '';
71
71
  inputElement?.focus();
72
- onSelected(selectedOptions);
72
+ onSelectedBase(selectedOptions);
73
73
  }
74
74
 
75
75
  async function scrollHighlightedIntoView() {
@@ -124,6 +124,13 @@
124
124
  }
125
125
  }
126
126
 
127
+ function onSelected() {
128
+ if (!multiple) {
129
+ selectOptionsComponent?.closeDropdown();
130
+ }
131
+ onSelectedBase(selectedOptions);
132
+ }
133
+
127
134
  $effect(() => {
128
135
  if (isOpen) {
129
136
  document.addEventListener('click', handleClickOutside);
@@ -132,12 +139,12 @@
132
139
  });
133
140
  </script>
134
141
 
135
- <div class="dropdown" bind:this={containerElement}>
142
+ <div class="dropdown w-full" bind:this={containerElement}>
136
143
  <div class="flex gap-2">
137
144
  <input
138
145
  bind:this={inputElement}
139
146
  {id}
140
- class="input select-input"
147
+ class="input select-input w-full"
141
148
  type="text"
142
149
  value={displayValue}
143
150
  placeholder={isOpen ? searchPlaceholder : placeholder}
@@ -50,7 +50,7 @@
50
50
  }
51
51
  </script>
52
52
 
53
- <div class="menu dropdown-content flex-nowrap max-h-46 overflow-auto bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm gap-1">
53
+ <div class="menu dropdown-content flex-nowrap w-full max-h-46 overflow-auto bg-base-100 rounded-box z-1 p-2 shadow-sm gap-1">
54
54
  {#if options.length === 0}
55
55
  <div class="text-gray-400">No options found</div>
56
56
  {:else}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ankiutils",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "scripts": {
6
6
  "dev": "vite dev",