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"
optionsButton={
<AddNewVariableButton>
<CommandItem>
<CommandItem value="doNotFilter-addNewVariable">
<IconComponent
name="Plus"
className={cn("mr-2 h-4 w-4 text-primary")}
aria-hidden="true"
/>
Add New Variable
<span>Add New Variable</span>
</CommandItem>
</AddNewVariableButton>
}

View file

@ -136,10 +136,15 @@ export default function InputComponent({
side="bottom"
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} />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup defaultChecked={false}>
{options.map((option, id) => (
<CommandItem