diff --git a/cmdk/src/index.tsx b/cmdk/src/index.tsx index bd5c229..5c3f786 100644 --- a/cmdk/src/index.tsx +++ b/cmdk/src/index.tsx @@ -5,10 +5,11 @@ import { commandScore } from './command-score' type Children = { children?: React.ReactNode } type DivProps = React.HTMLAttributes -type LoadingProps = Children & { - /** Estimated progress of loading asynchronous options. */ - progress?: number -} +type LoadingProps = Children & + DivProps & { + /** Estimated progress of loading asynchronous options. */ + progress?: number + } type EmptyProps = Children & DivProps & {} type SeparatorProps = DivProps & { /** Whether this separator should always be rendered. Useful if you disable automatic filtering. */ @@ -509,8 +510,8 @@ const Command = React.forwardRef((props, forwarded return (
{ etc.onKeyDown?.(e) @@ -629,7 +630,6 @@ const Item = React.forwardRef((props, forwardedRef) = return (
((props, forwardedRef) = aria-selected={selected || undefined} data-disabled={disabled || undefined} data-selected={selected || undefined} - onPointerMove={disabled ? undefined : select} - onClick={disabled ? undefined : onSelect} + {...etc} + onPointerMove={ + disabled + ? etc.onPointerMove + : (event) => { + etc.onPointerMove?.(event) + select() + } + } + onClick={ + disabled + ? etc.onClick + : (event) => { + etc.onClick?.(event) + onSelect() + } + } > {props.children}
@@ -672,10 +687,10 @@ const Group = React.forwardRef((props, forwardedRef) return (