@docsearch/react 4.0.0-beta.5 → 4.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,31 +140,101 @@ type DocSearchAskAi = {
140
140
  };
141
141
  };
142
142
  interface DocSearchProps {
143
+ /**
144
+ * Algolia application id used by the search client.
145
+ */
143
146
  appId: string;
147
+ /**
148
+ * Public api key with search permissions for the index.
149
+ */
144
150
  apiKey: string;
151
+ /**
152
+ * Name of the algolia index to query.
153
+ */
145
154
  indexName: string;
155
+ /**
156
+ * Configuration or assistant id to enable ask ai mode. Pass a string assistant id or a full config object.
157
+ */
146
158
  askAi?: DocSearchAskAi | string;
159
+ /**
160
+ * Theme overrides applied to the modal and related components.
161
+ */
147
162
  theme?: DocSearchTheme;
163
+ /**
164
+ * Placeholder text for the search input.
165
+ */
148
166
  placeholder?: string;
167
+ /**
168
+ * Additional algolia search parameters to merge into each query.
169
+ */
149
170
  searchParameters?: SearchParamsObject;
171
+ /**
172
+ * Maximum number of hits to display per source/group.
173
+ */
150
174
  maxResultsPerGroup?: number;
175
+ /**
176
+ * Hook to post-process hits before rendering.
177
+ */
151
178
  transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
179
+ /**
180
+ * Custom component to render an individual hit.
181
+ */
152
182
  hitComponent?: (props: {
153
183
  hit: InternalDocSearchHit | StoredDocSearchHit;
154
184
  children: React.ReactNode;
155
185
  }) => JSX.Element;
186
+ /**
187
+ * Custom component rendered at the bottom of the results panel.
188
+ */
156
189
  resultsFooterComponent?: (props: {
157
190
  state: AutocompleteState<InternalDocSearchHit>;
158
191
  }) => JSX.Element | null;
192
+ /**
193
+ * Hook to wrap or modify the algolia search client.
194
+ */
159
195
  transformSearchClient?: (searchClient: DocSearchTransformClient) => DocSearchTransformClient;
196
+ /**
197
+ * Disable storage and usage of recent and favorite searches.
198
+ */
160
199
  disableUserPersonalization?: boolean;
200
+ /**
201
+ * Query string to prefill when opening the modal.
202
+ */
161
203
  initialQuery?: string;
204
+ /**
205
+ * Custom navigator for controlling link navigation.
206
+ */
162
207
  navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
208
+ /**
209
+ * Localized strings for the button and modal ui.
210
+ */
163
211
  translations?: DocSearchTranslations;
212
+ /**
213
+ * Builds a url to report missing results for a given query.
214
+ */
164
215
  getMissingResultsUrl?: ({ query }: {
165
216
  query: string;
166
217
  }) => string;
218
+ /**
219
+ * Insights client integration options to send analytics events.
220
+ */
167
221
  insights?: AutocompleteOptions<InternalDocSearchHit>['insights'];
222
+ /**
223
+ * The container element where the modal should be portaled to. Defaults to document.body.
224
+ */
225
+ portalContainer?: DocumentFragment | Element;
226
+ /**
227
+ * Limit of how many recent searches should be saved/displayed..
228
+ *
229
+ * @default 7
230
+ */
231
+ recentSearchesLimit?: number;
232
+ /**
233
+ * Limit of how many recent searches should be saved/displayed when there are favorited searches..
234
+ *
235
+ * @default 4
236
+ */
237
+ recentSearchesWithFavoritesLimit?: number;
168
238
  }
169
239
  declare function DocSearch({ ...props }: DocSearchProps): JSX.Element;
170
240
 
@@ -284,7 +354,7 @@ type DocSearchModalProps = DocSearchProps & {
284
354
  canHandleAskAi?: boolean;
285
355
  translations?: ModalTranslations;
286
356
  };
287
- declare function DocSearchModal({ appId, apiKey, indexName, placeholder, askAi, searchParameters, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, canHandleAskAi, }: DocSearchModalProps): JSX.Element;
357
+ declare function DocSearchModal({ appId, apiKey, indexName, placeholder, askAi, searchParameters, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, canHandleAskAi, recentSearchesLimit, recentSearchesWithFavoritesLimit, }: DocSearchModalProps): JSX.Element;
288
358
 
289
359
  interface UseDocSearchKeyboardEventsProps {
290
360
  isOpen: boolean;
@@ -297,6 +367,7 @@ interface UseDocSearchKeyboardEventsProps {
297
367
  }
298
368
  declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
299
369
 
300
- declare const version = "4.0.0-beta.5";
370
+ declare const version = "4.0.0-beta.7";
301
371
 
302
- export { type ButtonTranslations, DocSearch, type DocSearchAskAi, DocSearchButton, type DocSearchButtonProps, type DocSearchHit, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchState, type DocSearchTheme, type DocSearchTransformClient, type DocSearchTranslations, type InternalDocSearchHit, type ModalTranslations, type StoredAskAiMessage, type StoredAskAiState, type StoredDocSearchHit, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
372
+ export { DocSearch, DocSearchButton, DocSearchModal, useDocSearchKeyboardEvents, version };
373
+ export type { ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, UseDocSearchKeyboardEventsProps };