UNPKG

@kit-data-manager/react-search-component

Version:

All-in-one component for rendering an elastic search UI for searching anything. Built-in support for visualizing related items in a graph and resolving unique identifiers.

37 lines (36 loc) 1.52 kB
import { MouseEvent, ReactNode } from "react"; import { SearchResult, FieldValue } from "@elastic/search-ui"; export interface GenericResultViewTagProps { /** * The elasticsearch field that this tag will display */ field: string; /** * When specified, does not read the field from elastic and instead just displays this value */ valueOverride?: string | number | boolean; result: SearchResult; /** * Icon for this tag, can be any react component. Ideally a [lucide icon](https://lucide.dev) with 16px by 16px site. */ icon?: ReactNode; /** * Label to display in a tooltip */ label?: string; /** * Optional, here you can map each value or all values of the elasticsearch field to a string or a React component. * Can't the used together with `singleValueMapper` * @param value */ valueMapper?: (value: FieldValue) => ReactNode; /** * Optional, here you can map each value of the elasticsearch field to a string or a React component. Can't be used * together with `valueMapper` * @param value */ singleValueMapper?: (value: string | number | boolean) => ReactNode; onClick?: (e: MouseEvent<HTMLDivElement>, tagValue: ReactNode, fieldValue: FieldValue) => void; clickBehavior?: "copy-text" | "follow-url" | string; } export declare function GenericResultViewTag(props: GenericResultViewTagProps): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];