noph-ui 0.18.15 → 0.19.0

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.
@@ -16,7 +16,9 @@
16
16
  clampMenuWidth = false,
17
17
  children,
18
18
  optionsFilter,
19
- oncomplete = (option) => {
19
+ showPopover = $bindable(),
20
+ hidePopover = $bindable(),
21
+ onoptionselect = (option) => {
20
22
  value = option.label
21
23
  finalPopulated = populated
22
24
  menuElement?.hidePopover()
@@ -28,6 +30,13 @@
28
30
  ...attributes
29
31
  }: AutoCompleteProps = $props()
30
32
 
33
+ showPopover = () => {
34
+ menuElement?.showPopover()
35
+ }
36
+
37
+ hidePopover = () => {
38
+ menuElement?.hidePopover()
39
+ }
31
40
  const uid = $props.id()
32
41
  let defaultOptionsFilter = (option: AutoCompleteOption) => {
33
42
  return !value || option.label.toLocaleLowerCase().includes(value.toLocaleLowerCase())
@@ -43,7 +52,7 @@
43
52
  <Item
44
53
  onclick={(event) => {
45
54
  event.preventDefault()
46
- oncomplete(option)
55
+ onoptionselect(option)
47
56
  element?.focus()
48
57
  }}
49
58
  disabled={option.disabled}
@@ -57,7 +66,7 @@
57
66
  event.preventDefault()
58
67
  }
59
68
  if (event.key === 'Enter') {
60
- oncomplete(option)
69
+ onoptionselect(option)
61
70
  }
62
71
  if (event.key === 'Tab') {
63
72
  finalPopulated = populated
@@ -1,4 +1,4 @@
1
1
  import type { AutoCompleteProps } from './types.ts';
2
- declare const AutoComplete: import("svelte").Component<AutoCompleteProps, {}, "element" | "value" | "reportValidity" | "checkValidity" | "focused">;
2
+ declare const AutoComplete: import("svelte").Component<AutoCompleteProps, {}, "element" | "value" | "showPopover" | "hidePopover" | "reportValidity" | "checkValidity" | "focused">;
3
3
  type AutoComplete = ReturnType<typeof AutoComplete>;
4
4
  export default AutoComplete;
@@ -8,6 +8,8 @@ export interface AutoCompleteOption {
8
8
  export interface AutoCompleteProps extends Omit<InputFieldProps, 'clientWidth' | 'clientHeight'> {
9
9
  options: AutoCompleteOption[];
10
10
  optionsFilter?: (option: AutoCompleteOption) => boolean;
11
- oncomplete?: (option: AutoCompleteOption) => void;
11
+ onoptionselect?: (option: AutoCompleteOption) => void;
12
12
  clampMenuWidth?: boolean;
13
+ showPopover?: () => void;
14
+ hidePopover?: () => void;
13
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.18.15",
3
+ "version": "0.19.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {