|
|
@ -3,6 +3,8 @@ import { usePointerMovedSinceMount } from 'kbar/lib/utils'; |
|
|
|
import * as React from 'react'; |
|
|
|
import * as React from 'react'; |
|
|
|
import { useVirtual } from 'react-virtual'; |
|
|
|
import { useVirtual } from 'react-virtual'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { URLCallback } from './types'; |
|
|
|
|
|
|
|
|
|
|
|
// From https://github.com/timc1/kbar/blob/main/src/KBarResults.tsx
|
|
|
|
// From https://github.com/timc1/kbar/blob/main/src/KBarResults.tsx
|
|
|
|
// TODO: Go back to KBarResults from kbar when https://github.com/timc1/kbar/issues/281 is fixed
|
|
|
|
// TODO: Go back to KBarResults from kbar when https://github.com/timc1/kbar/issues/281 is fixed
|
|
|
|
// Remember to remove dependency on react-virtual when removing this file
|
|
|
|
// Remember to remove dependency on react-virtual when removing this file
|
|
|
@ -157,7 +159,7 @@ export const KBarResults = (props: KBarResultsProps) => { |
|
|
|
{rowVirtualizer.virtualItems.map((virtualRow) => { |
|
|
|
{rowVirtualizer.virtualItems.map((virtualRow) => { |
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
const item = itemsRef.current[virtualRow.index] as ActionImpl & { |
|
|
|
const item = itemsRef.current[virtualRow.index] as ActionImpl & { |
|
|
|
url?: string; |
|
|
|
url?: string | URLCallback; |
|
|
|
target?: React.HTMLAttributeAnchorTarget; |
|
|
|
target?: React.HTMLAttributeAnchorTarget; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -202,7 +204,7 @@ export const KBarResults = (props: KBarResultsProps) => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<a |
|
|
|
<a |
|
|
|
key={virtualRow.index} |
|
|
|
key={virtualRow.index} |
|
|
|
href={url} |
|
|
|
href={typeof url === 'function' ? url(search) : url} |
|
|
|
target={target} |
|
|
|
target={target} |
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
|
|
ref={active ? (activeRef as React.RefObject<HTMLAnchorElement>) : null} |
|
|
|
ref={active ? (activeRef as React.RefObject<HTMLAnchorElement>) : null} |
|
|
|