Fixed position on command when filtering

This commit is contained in:
Lucas Oliveira 2024-03-21 15:30:58 +01:00
commit ca460443d1
2 changed files with 10 additions and 4 deletions

View file

@ -586,13 +586,14 @@ export default function ParameterComponent({
optionsIcon="Globe" optionsIcon="Globe"
optionsButton={ optionsButton={
<AddNewVariableButton> <AddNewVariableButton>
<CommandItem> <CommandItem value="doNotFilter-addNewVariable">
<IconComponent <IconComponent
name="Plus" name="Plus"
className={cn("mr-2 h-4 w-4 text-primary")} className={cn("mr-2 h-4 w-4 text-primary")}
aria-hidden="true" aria-hidden="true"
/> />
Add New Variable <span>Add New Variable</span>
</CommandItem> </CommandItem>
</AddNewVariableButton> </AddNewVariableButton>
} }

View file

@ -136,10 +136,15 @@ export default function InputComponent({
side="bottom" side="bottom"
align="center" align="center"
> >
<Command> <Command
filter={(value, search) => {
if (value.includes(search) || value.includes("doNotFilter-"))
return 1; // ensures items arent filtered
return 0;
}}
>
<CommandInput placeholder={optionsPlaceholder} /> <CommandInput placeholder={optionsPlaceholder} />
<CommandList> <CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup defaultChecked={false}> <CommandGroup defaultChecked={false}>
{options.map((option, id) => ( {options.map((option, id) => (
<CommandItem <CommandItem