@algolia/sitesearch
Version:
Opinionated site search modal for the web. Ships zero-build CDN bundles (JS + CSS) and a one-line init API. Powered by Algolia InstantSearch.
87 lines (86 loc) • 3.44 kB
TypeScript
import * as react_jsx_runtime0 from "react/jsx-runtime";
import * as react_jsx_runtime1 from "react/jsx-runtime";
import { ComponentProps, FC, ReactNode } from "react";
//#region src/components/types.d.ts
interface HitsAttributesMapping {
/** Attribute path (supports dotted path) for the primary line of text */
primaryText: string;
/** Attribute path (supports dotted path) for the secondary line of text */
secondaryText?: string;
/** Attribute path (supports dotted path) for an optional tertiary line */
tertiaryText?: string;
/** Attribute path (supports dotted path) for an optional image URL */
image?: string;
}
//#endregion
//#region src/components/search/search-button.d.ts
interface SearchButtonProps$1 {
onClick: () => void;
darkMode?: boolean;
children?: ReactNode;
}
declare const SearchButton$1: FC<SearchButtonProps$1>;
//#endregion
//#region src/components/search/index.d.ts
interface SearchConfig {
/** Algolia Application ID (required) */
applicationId: string;
/** Algolia API Key (required) */
apiKey: string;
/** Algolia Index Name (required) */
indexName: string;
/** Placeholder text for search input (optional, defaults to "What are you looking for?") */
placeholder?: string;
/** Number of hits per page (optional, defaults to 8) */
hitsPerPage?: number;
/** Keyboard shortcut to open search (optional, defaults to "cmd+k") */
keyboardShortcut?: string;
/** Custom search button text (optional) */
buttonText?: string;
/** Custom search button props (optional) */
buttonProps?: ComponentProps<typeof SearchButton$1>;
/** Enable dark mode (optional) */
darkMode?: boolean;
/** Map which hit attributes to render (supports dotted paths) */
attributes?: HitsAttributesMapping;
}
declare function SearchExperience(config: SearchConfig): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/search-askai/search-button.d.ts
interface SearchButtonProps {
onClick: () => void;
darkMode?: boolean;
children?: ReactNode;
}
declare const SearchButton: FC<SearchButtonProps>;
//#endregion
//#region src/components/search-askai/index.d.ts
interface SearchWithAskAIConfig {
/** Algolia Application ID (required) */
applicationId: string;
/** Algolia API Key (required) */
apiKey: string;
/** Algolia Index Name (required) */
indexName: string;
/** AI Assistant ID (required for chat functionality) */
assistantId: string;
/** Base URL for AI chat API (optional, defaults to beta endpoint) */
baseAskaiUrl?: string;
/** Placeholder text for search input (optional, defaults to "What are you looking for?") */
placeholder?: string;
/** Number of hits per page (optional, defaults to 8) */
hitsPerPage?: number;
/** Keyboard shortcut to open search (optional, defaults to "cmd+k") */
keyboardShortcut?: string;
/** Custom search button text (optional) */
buttonText?: string;
/** Custom search button props (optional) */
buttonProps?: ComponentProps<typeof SearchButton>;
/** Enable dark mode (optional) */
darkMode?: boolean;
/** Map which hit attributes to render (supports dotted paths) */
attributes?: HitsAttributesMapping;
}
declare function SearchExperience$1(config: SearchWithAskAIConfig): react_jsx_runtime1.JSX.Element;
//#endregion
export { type HitsAttributesMapping, SearchExperience as Search, type SearchConfig, SearchExperience$1 as SearchWithAskAI, type SearchWithAskAIConfig };