fumadocs-ui
Version:
The Radix UI version of Fumadocs UI
113 lines (112 loc) • 3.74 kB
TypeScript
import { search_d_exports } from "../../contexts/search.js";
import * as react_jsx_runtime72 from "react/jsx-runtime";
import { ComponentProps, ReactNode } from "react";
import { DialogContent, DialogOverlay } from "@radix-ui/react-dialog";
import { HighlightedText, ReactSortedResult } from "fumadocs-core/search";
//#region src/components/dialog/search.d.ts
type SearchItemType = (ReactSortedResult & {
external?: boolean;
}) | {
id: string;
type: 'action';
node: ReactNode;
onSelect: () => void;
};
interface SearchDialogProps extends search_d_exports.SharedProps {
search: string;
onSearchChange: (v: string) => void;
onSelect?: (item: SearchItemType) => void;
isLoading?: boolean;
children: ReactNode;
}
declare function SearchDialog({
open,
onOpenChange,
search,
onSearchChange,
isLoading,
onSelect: onSelectProp,
children
}: SearchDialogProps): react_jsx_runtime72.JSX.Element;
declare function SearchDialogHeader(props: ComponentProps<'div'>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogInput(props: ComponentProps<'input'>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogClose({
children,
className,
...props
}: ComponentProps<'button'>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogFooter(props: ComponentProps<'div'>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogOverlay(props: ComponentProps<typeof DialogOverlay>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogContent({
children,
...props
}: ComponentProps<typeof DialogContent>): react_jsx_runtime72.JSX.Element;
declare function SearchDialogList({
items,
Empty,
Item,
...props
}: Omit<ComponentProps<'div'>, 'children'> & {
items: SearchItemType[] | null | undefined;
/**
* Renderer for empty list UI
*/
Empty?: () => ReactNode;
/**
* Renderer for items
*/
Item?: (props: {
item: SearchItemType;
onClick: () => void;
}) => ReactNode;
}): react_jsx_runtime72.JSX.Element;
declare function SearchDialogListItem({
item,
className,
children,
renderHighlights: render,
...props
}: ComponentProps<'button'> & {
renderHighlights?: typeof renderHighlights;
item: SearchItemType;
}): react_jsx_runtime72.JSX.Element;
declare function SearchDialogIcon(props: ComponentProps<'svg'>): react_jsx_runtime72.JSX.Element;
interface TagsListProps extends ComponentProps<'div'> {
tag?: string;
onTagChange: (tag: string | undefined) => void;
allowClear?: boolean;
}
declare function TagsList({
tag,
onTagChange,
allowClear,
...props
}: TagsListProps): react_jsx_runtime72.JSX.Element;
declare function TagsListItem({
value,
className,
...props
}: ComponentProps<'button'> & {
value: string;
}): react_jsx_runtime72.JSX.Element;
declare function renderHighlights(highlights: HighlightedText<ReactNode>[]): ReactNode;
declare function useSearch(): {
open: boolean;
onOpenChange: (open: boolean) => void;
search: string;
onSearchChange: (v: string) => void;
onSelect: (item: SearchItemType) => void;
isLoading: boolean;
};
declare function useTagsList(): {
value?: string;
onValueChange: (value: string | undefined) => void;
allowClear: boolean;
};
declare function useSearchList(): {
active: string | null;
setActive: (v: string | null) => void;
};
type SharedProps = search_d_exports.SharedProps;
export { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogListItem, SearchDialogOverlay, SearchDialogProps, SearchItemType, type SharedProps, TagsList, TagsListItem, TagsListProps, useSearch, useSearchList, useTagsList };
//# sourceMappingURL=search.d.ts.map