@docsearch/react 4.2.0 → 4.3.1
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.
- package/dist/esm/DocSearchButton.js +1 -1
- package/dist/esm/DocSearchModal.d.ts +19 -2
- package/dist/esm/DocSearchModal.js +1 -1
- package/dist/esm/index.d.ts +35 -6
- package/dist/esm/index.js +2 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/DocSearchModal.js +2 -2
- package/dist/umd/DocSearchModal.js.map +1 -1
- package/dist/umd/DocsearchButton.js +2 -2
- package/dist/umd/DocsearchButton.js.map +1 -1
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/useDocSearchKeyboardEvents.js +1 -1
- package/dist/umd/useTheme.js +1 -1
- package/dist/umd/version.js +2 -2
- package/dist/umd/version.js.map +1 -1
- package/package.json +3 -2
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
|
|
2
|
-
import { LiteClient, SearchParamsObject } from 'algoliasearch/lite';
|
|
2
|
+
import { Hit, LiteClient, SearchParamsObject } from 'algoliasearch/lite';
|
|
3
3
|
import React, { JSX } from 'react';
|
|
4
4
|
import { UIMessage } from '@ai-sdk/react';
|
|
5
5
|
import { UIDataTypes } from 'ai';
|
|
@@ -135,6 +135,17 @@ type StoredAskAiState = StoredDocSearchHit & {
|
|
|
135
135
|
messages?: StoredAskAiMessage[];
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
type SuggestedQuestion = {
|
|
139
|
+
appId: string;
|
|
140
|
+
assistantId: string;
|
|
141
|
+
question: string;
|
|
142
|
+
locale?: string;
|
|
143
|
+
state: 'published';
|
|
144
|
+
source: string;
|
|
145
|
+
order: number;
|
|
146
|
+
};
|
|
147
|
+
type SuggestedQuestionHit = Hit<SuggestedQuestion>;
|
|
148
|
+
|
|
138
149
|
type DocSearchTranslations = Partial<{
|
|
139
150
|
button: ButtonTranslations;
|
|
140
151
|
modal: ModalTranslations;
|
|
@@ -175,6 +186,12 @@ type DocSearchAskAi = {
|
|
|
175
186
|
* The search parameters to use for the ask AI feature.
|
|
176
187
|
*/
|
|
177
188
|
searchParameters?: AskAiSearchParameters;
|
|
189
|
+
/**
|
|
190
|
+
* Enables displaying suggested questions on Ask AI's new conversation screen.
|
|
191
|
+
*
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
suggestedQuestions?: boolean;
|
|
178
195
|
};
|
|
179
196
|
interface DocSearchIndex {
|
|
180
197
|
name: string;
|
|
@@ -229,16 +246,28 @@ interface DocSearchProps {
|
|
|
229
246
|
transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
|
|
230
247
|
/**
|
|
231
248
|
* Custom component to render an individual hit.
|
|
249
|
+
* Supports template patterns:
|
|
250
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
251
|
+
* - JSX templates: (props) => <div>...</div>
|
|
252
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
232
253
|
*/
|
|
233
254
|
hitComponent?: (props: {
|
|
234
255
|
hit: InternalDocSearchHit | StoredDocSearchHit;
|
|
235
256
|
children: React.ReactNode;
|
|
257
|
+
}, helpers?: {
|
|
258
|
+
html: (template: TemplateStringsArray, ...values: any[]) => any;
|
|
236
259
|
}) => JSX.Element;
|
|
237
260
|
/**
|
|
238
261
|
* Custom component rendered at the bottom of the results panel.
|
|
262
|
+
* Supports template patterns:
|
|
263
|
+
* - HTML strings with html helper: (props, { html }) => html`<div>...</div>`
|
|
264
|
+
* - JSX templates: (props) => <div>...</div>
|
|
265
|
+
* - Function-based templates: (props) => string | JSX.Element | Function.
|
|
239
266
|
*/
|
|
240
267
|
resultsFooterComponent?: (props: {
|
|
241
268
|
state: AutocompleteState<InternalDocSearchHit>;
|
|
269
|
+
}, helpers?: {
|
|
270
|
+
html: (template: TemplateStringsArray, ...values: any[]) => any;
|
|
242
271
|
}) => JSX.Element | null;
|
|
243
272
|
/**
|
|
244
273
|
* Hook to wrap or modify the algolia search client.
|
|
@@ -292,6 +321,7 @@ interface DocSearchProps {
|
|
|
292
321
|
keyboardShortcuts?: KeyboardShortcuts;
|
|
293
322
|
}
|
|
294
323
|
declare function DocSearch(props: DocSearchProps): JSX.Element;
|
|
324
|
+
declare function DocSearchInner(props: DocSearchProps): JSX.Element;
|
|
295
325
|
|
|
296
326
|
type ButtonTranslations = Partial<{
|
|
297
327
|
buttonText: string;
|
|
@@ -423,10 +453,9 @@ type DocSearchModalProps = DocSearchProps & {
|
|
|
423
453
|
onAskAiToggle: (toggle: boolean) => void;
|
|
424
454
|
onClose?: () => void;
|
|
425
455
|
isAskAiActive?: boolean;
|
|
426
|
-
canHandleAskAi?: boolean;
|
|
427
456
|
translations?: ModalTranslations;
|
|
428
457
|
};
|
|
429
|
-
declare function DocSearchModal({ appId, apiKey,
|
|
458
|
+
declare function DocSearchModal({ appId, apiKey, askAi, maxResultsPerGroup, theme, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, onAskAiToggle, isAskAiActive, recentSearchesLimit, recentSearchesWithFavoritesLimit, indices, indexName, searchParameters, ...props }: DocSearchModalProps): JSX.Element;
|
|
430
459
|
|
|
431
460
|
interface UseDocSearchKeyboardEventsProps {
|
|
432
461
|
isOpen: boolean;
|
|
@@ -440,7 +469,7 @@ interface UseDocSearchKeyboardEventsProps {
|
|
|
440
469
|
}
|
|
441
470
|
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, isAskAiActive, onAskAiToggle, searchButtonRef, keyboardShortcuts, }: UseDocSearchKeyboardEventsProps): void;
|
|
442
471
|
|
|
443
|
-
declare const version = "4.
|
|
472
|
+
declare const version = "4.3.1";
|
|
444
473
|
|
|
445
|
-
export { DocSearch, DocSearchButton, DocSearchModal, useDocSearchKeyboardEvents, version };
|
|
446
|
-
export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, UseDocSearchKeyboardEventsProps };
|
|
474
|
+
export { DocSearch, DocSearchButton, DocSearchInner, DocSearchModal, useDocSearchKeyboardEvents, version };
|
|
475
|
+
export type { AskAiSearchParameters, ButtonTranslations, DocSearchAskAi, DocSearchButtonProps, DocSearchHit, DocSearchIndex, DocSearchModalProps, DocSearchProps, DocSearchState, DocSearchTheme, DocSearchTransformClient, DocSearchTranslations, InternalDocSearchHit, KeyboardShortcuts, ModalTranslations, StoredAskAiMessage, StoredAskAiState, StoredDocSearchHit, SuggestedQuestion, SuggestedQuestionHit, UseDocSearchKeyboardEventsProps };
|