Updated
This commit is contained in:
@@ -13,7 +13,7 @@ Searchable dropdown with autocomplete functionality, keyboard navigation, and re
|
||||
| `class` | `string` | `''` | Additional CSS classes for the container |
|
||||
| `items` | `Array<string \| {value: string, label: string}> \| Signal` | `[]` | Items to search from |
|
||||
| `value` | `string \| Signal<string>` | `''` | Selected value (reactive) |
|
||||
| `onSelect` | `function(item)` | `-` | Called when an option is selected |
|
||||
| `onselect` | `function(item)` | `-` | Called when an option is selected |
|
||||
| `label` | `string` | `-` | Label text for the input |
|
||||
| `placeholder` | `string` | `'Search...'` | Placeholder text |
|
||||
|
||||
@@ -48,7 +48,7 @@ const BasicDemo = () => {
|
||||
return Autocomplete({
|
||||
items: fruits,
|
||||
value: selected,
|
||||
onSelect: (value) => selected(value)
|
||||
onselect: (value) => selected(value)
|
||||
});
|
||||
};
|
||||
Mount(BasicDemo, '#demo-basic');
|
||||
@@ -81,7 +81,7 @@ const ObjectsDemo = () => {
|
||||
Autocomplete({
|
||||
items: countries,
|
||||
value: selectedLabel,
|
||||
onSelect: (item) => {
|
||||
onselect: (item) => {
|
||||
const selectedItem = typeof item === 'string'
|
||||
? countries.find(c => c.label === item)
|
||||
: item;
|
||||
@@ -118,7 +118,7 @@ const ReactiveDemo = () => {
|
||||
Autocomplete({
|
||||
items: programmingLanguages,
|
||||
value: selected,
|
||||
onSelect: (value) => selected(value)
|
||||
onselect: (value) => selected(value)
|
||||
}),
|
||||
() => selected() ? Div({ class: 'alert alert-info' }, [
|
||||
`You selected: ${selected()}`
|
||||
@@ -161,7 +161,7 @@ const DynamicDemo = () => {
|
||||
Autocomplete({
|
||||
items: () => allItems[filterType()],
|
||||
value: selected,
|
||||
onSelect: (value) => selected(value)
|
||||
onselect: (value) => selected(value)
|
||||
})
|
||||
]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user