From 8869265f22a574db742b50bff24cb004f81b67c6 Mon Sep 17 00:00:00 2001 From: usernamebuzz Date: Sat, 4 Jan 2025 17:04:09 +0900 Subject: [PATCH 1/4] fix: modify incorrect selected style in commandItem --- apps/www/registry/new-york/ui/command.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/www/registry/new-york/ui/command.tsx b/apps/www/registry/new-york/ui/command.tsx index b08184b8359..70be14e9ae5 100644 --- a/apps/www/registry/new-york/ui/command.tsx +++ b/apps/www/registry/new-york/ui/command.tsx @@ -81,13 +81,13 @@ const CommandEmpty = React.forwardRef< CommandEmpty.displayName = CommandPrimitive.Empty.displayName const CommandGroup = React.forwardRef< - React.ElementRef, + React.ComponentRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( + React.ComponentRef, + React.ComponentPropsWithoutRef & { + forcedSelected?: boolean + } +>(({ className, forcedSelected, ...props }, ref) => ( )) From 0117b50fc1cbbc8a800cdbc24f8f6692ca0a60c4 Mon Sep 17 00:00:00 2001 From: usernamebuzz Date: Sat, 4 Jan 2025 17:08:30 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20chore:=20use=20element?= =?UTF-8?q?=20ref?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/www/registry/new-york/ui/command.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/www/registry/new-york/ui/command.tsx b/apps/www/registry/new-york/ui/command.tsx index 70be14e9ae5..ea7549d5167 100644 --- a/apps/www/registry/new-york/ui/command.tsx +++ b/apps/www/registry/new-york/ui/command.tsx @@ -81,7 +81,7 @@ const CommandEmpty = React.forwardRef< CommandEmpty.displayName = CommandPrimitive.Empty.displayName const CommandGroup = React.forwardRef< - React.ComponentRef, + React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( , + React.ElementRef, React.ComponentPropsWithoutRef & { forcedSelected?: boolean } From 747afdac6bbe5c8b8e6f67bd6d32123a0c36eb48 Mon Sep 17 00:00:00 2001 From: usernamebuzz Date: Sat, 4 Jan 2025 17:13:00 +0900 Subject: [PATCH 3/4] fix: modify incorrect selected style in default ui too --- apps/www/registry/default/ui/command.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/www/registry/default/ui/command.tsx b/apps/www/registry/default/ui/command.tsx index 4603919587a..724e9a9b3d4 100644 --- a/apps/www/registry/default/ui/command.tsx +++ b/apps/www/registry/default/ui/command.tsx @@ -87,7 +87,7 @@ const CommandGroup = React.forwardRef< , - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + forcedSelected?: boolean + } +>(({ className, forcedSelected, ...props }, ref) => ( )) From af32365bdf8c183c92c5f2860d984bb5a4e4f5a5 Mon Sep 17 00:00:00 2001 From: usernamebuzz Date: Sat, 4 Jan 2025 17:20:42 +0900 Subject: [PATCH 4/4] feat: set text-accent-foreground --- apps/www/registry/default/ui/command.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/registry/default/ui/command.tsx b/apps/www/registry/default/ui/command.tsx index 724e9a9b3d4..80c214d2062 100644 --- a/apps/www/registry/default/ui/command.tsx +++ b/apps/www/registry/default/ui/command.tsx @@ -119,7 +119,7 @@ const CommandItem = React.forwardRef< className={cn( "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", forcedSelected && - "bg-accent group-hover/cmd:bg-transparent hover:!bg-accent", + "bg-accent text-accent-foreground group-hover/cmd:bg-transparent group-hover/cmd:text-foreground hover:!bg-accent hover:!text-accent-foreground", className )} data-selected={false}