fix: lista de estabelecimentos não abre sozinha e remove check icon
Remove onFocus que abria o popover automaticamente ao focar no input vazio. Agora só abre quando o usuário começa a digitar. Remove RiCheckLine dos itens da lista; item selecionado aparece em bold (font-semibold) em vez de check verde. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RiCheckLine, RiSearchLine } from "@remixicon/react";
|
import { RiSearchLine } from "@remixicon/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from "@/components/ui/popover";
|
} from "@/components/ui/popover";
|
||||||
import { cn } from "@/lib/utils/ui";
|
|
||||||
|
|
||||||
export interface EstabelecimentoInputProps {
|
export interface EstabelecimentoInputProps {
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -78,11 +77,6 @@ export function EstabelecimentoInput({
|
|||||||
required={required}
|
required={required}
|
||||||
maxLength={maxLength}
|
maxLength={maxLength}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
onFocus={() => {
|
|
||||||
if (estabelecimentos.length > 0) {
|
|
||||||
setOpen(true);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
{estabelecimentos.length > 0 && (
|
{estabelecimentos.length > 0 && (
|
||||||
<RiSearchLine className="absolute right-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none" />
|
<RiSearchLine className="absolute right-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none" />
|
||||||
@@ -106,17 +100,13 @@ export function EstabelecimentoInput({
|
|||||||
key={item}
|
key={item}
|
||||||
value={item}
|
value={item}
|
||||||
onSelect={() => handleSelect(item)}
|
onSelect={() => handleSelect(item)}
|
||||||
className="cursor-pointer gap-1"
|
className="cursor-pointer"
|
||||||
>
|
>
|
||||||
<RiCheckLine
|
<span
|
||||||
className={cn(
|
className={`truncate flex-1 ${value === item ? "font-semibold" : ""}`}
|
||||||
"size-4 shrink-0",
|
>
|
||||||
value === item
|
{item}
|
||||||
? "opacity-100 text-success"
|
</span>
|
||||||
: "opacity-5",
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<span className="truncate flex-1">{item}</span>
|
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
))}
|
))}
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user