feat(InputMenu): new component (#86)

This commit is contained in:
Benjamin Canac
2024-05-06 18:59:49 +02:00
committed by GitHub
parent f409395297
commit 99f20a4154
59 changed files with 3345 additions and 1265 deletions

View File

@@ -1,4 +1,4 @@
import type { FuseResultMatch } from 'fuse.js'
import type { FuseResult, FuseResultMatch } from 'fuse.js'
function truncateHTMLFromStart(html: string, maxLength: number) {
let truncated = ''
@@ -32,7 +32,7 @@ function truncateHTMLFromStart(html: string, maxLength: number) {
return truncated
}
export function highlight(item: { matches?: FuseResultMatch[] }, searchTerm: string, forceKey?: string, omitKeys?: string[]) {
export function highlight<T>(item: T & { matches?: FuseResult<T>['matches'] }, searchTerm: string, forceKey?: string, omitKeys?: string[]) {
const generateHighlightedText = (value: FuseResultMatch['value'], indices: FuseResultMatch['indices'] = []) => {
value = value || ''
let content = ''