Add bunext playground for local component development
Runs at http://localhost:7010 via bun run dev. The playground imports the library from src through a committed symlink and tsconfig path alias, so component edits hot-reload without a build step. It has its own install root and is excluded from the published package.
This commit is contained in:
@@ -34,6 +34,11 @@ export type TWUISearchSelectProps<
|
||||
defaultValues?: KeyType[];
|
||||
changeHandler?: (value: KeyType | KeyType[] | "", data?: T | T[]) => void;
|
||||
placeholder?: string;
|
||||
/**
|
||||
* Whether the dropdown should still be open
|
||||
* after a selection is made
|
||||
*/
|
||||
keep_dropdown_open_on_commit?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -64,6 +69,7 @@ export default function SearchSelect<
|
||||
placeholder,
|
||||
multiple = false,
|
||||
defaultValues,
|
||||
keep_dropdown_open_on_commit,
|
||||
...props
|
||||
}: TWUISearchSelectProps<KeyType, T>) {
|
||||
const rootRef = React.useRef<HTMLDivElement>(null);
|
||||
@@ -160,17 +166,18 @@ export default function SearchSelect<
|
||||
setSelected(next);
|
||||
notify(next);
|
||||
setQuery("");
|
||||
setOpen(true);
|
||||
setActiveIndex(0);
|
||||
inputRef.current?.focus();
|
||||
} else {
|
||||
const next = [option];
|
||||
setSelected(next);
|
||||
setQuery(getOptionLabel(option));
|
||||
setOpen(true);
|
||||
setActiveIndex(0);
|
||||
notify(next);
|
||||
}
|
||||
|
||||
const commit_open_status = keep_dropdown_open_on_commit || false;
|
||||
|
||||
setActiveIndex(0);
|
||||
setOpen(commit_open_status);
|
||||
},
|
||||
[multiple, notify, selected],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user