@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.
33 lines (32 loc) • 1.42 kB
TypeScript
import { MouseEvent, ReactNode } from "react";
import { SearchResult } from "@elastic/search-ui";
export interface GenericResultViewTagProps {
/**
* The elasticsearch field that this tag will display
*/
field: string;
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: string | string[]) => 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) => ReactNode;
onClick?: (e: MouseEvent<HTMLDivElement>, tagValue: ReactNode, fieldValue: string | string[]) => void;
clickBehavior?: "copy-text" | "follow-url" | string;
}
export declare function GenericResultViewTag({ field, result, icon, label, valueMapper, singleValueMapper, clickBehavior, onClick }: GenericResultViewTagProps): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];