@docsearch/react 4.4.0 → 4.5.0-beta.0
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 +17 -2
- package/dist/esm/DocSearchModal.js +1 -1
- package/dist/esm/Sidepanel.d.ts +62 -7
- package/dist/esm/Sidepanel.js +1 -1
- package/dist/esm/index.d.ts +20 -4
- 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/Sidepanel.js +2 -2
- package/dist/umd/Sidepanel.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 +10 -10
package/dist/esm/Sidepanel.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SidepanelShortcuts, InitialAskAiMessage, DocSearchTheme } from '@docsearch/core';
|
|
1
|
+
import { SidepanelShortcuts, InitialAskAiMessage, DocSearchCallbacks, DocSearchTheme, DocSearchRef } from '@docsearch/core';
|
|
2
|
+
export { DocSearchCallbacks, DocSearchRef } from '@docsearch/core';
|
|
2
3
|
import React, { JSX } from 'react';
|
|
3
4
|
|
|
4
5
|
type AskAiSearchParameters = {
|
|
@@ -122,6 +123,19 @@ type HeaderTranslations = Partial<{
|
|
|
122
123
|
viewConversationHistoryText: string;
|
|
123
124
|
}>;
|
|
124
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Imperative handle exposed by the Sidepanel component for programmatic control.
|
|
128
|
+
*/
|
|
129
|
+
interface SidepanelRef {
|
|
130
|
+
/** Opens the sidepanel. */
|
|
131
|
+
open: () => void;
|
|
132
|
+
/** Closes the sidepanel. */
|
|
133
|
+
close: () => void;
|
|
134
|
+
/** Returns true once the component is mounted and ready. */
|
|
135
|
+
readonly isReady: boolean;
|
|
136
|
+
/** Returns true if the sidepanel is currently open. */
|
|
137
|
+
readonly isOpen: boolean;
|
|
138
|
+
}
|
|
125
139
|
type SidepanelTranslations = Partial<{
|
|
126
140
|
/**
|
|
127
141
|
* Translation texts for the Sidepanel header.
|
|
@@ -200,14 +214,14 @@ type SidepanelProps = {
|
|
|
200
214
|
* @default `{ 'Ctrl/Cmd+I': true }`
|
|
201
215
|
*/
|
|
202
216
|
keyboardShortcuts?: SidepanelShortcuts;
|
|
217
|
+
useStagingEnv?: boolean;
|
|
203
218
|
};
|
|
204
|
-
|
|
219
|
+
declare const Sidepanel: React.ForwardRefExoticComponent<Omit<DocSearchSidepanelProps, "button" | "panel"> & SidepanelProps & {
|
|
205
220
|
isOpen?: boolean;
|
|
206
221
|
onOpen: () => void;
|
|
207
222
|
onClose: () => void;
|
|
208
223
|
initialMessage?: InitialAskAiMessage;
|
|
209
|
-
}
|
|
210
|
-
declare const Sidepanel: ({ isOpen, onOpen, onClose, assistantId, apiKey, appId, indexName, variant, searchParameters, pushSelector, width, expandedWidth, suggestedQuestions: suggestedQuestionsEnabled, translations, keyboardShortcuts, side, initialMessage, }: Props$1) => JSX.Element;
|
|
224
|
+
} & React.RefAttributes<SidepanelRef>>;
|
|
211
225
|
|
|
212
226
|
type SidepanelButtonTranslations = Partial<{
|
|
213
227
|
/**
|
|
@@ -248,7 +262,7 @@ type SidepanelButtonProps = {
|
|
|
248
262
|
type Props = React.ComponentProps<'button'> & SidepanelButtonProps;
|
|
249
263
|
declare const SidepanelButton: ({ variant, keyboardShortcuts, translations, ...props }: Props) => JSX.Element;
|
|
250
264
|
|
|
251
|
-
type DocSearchSidepanelProps = {
|
|
265
|
+
type DocSearchSidepanelProps = DocSearchCallbacks & {
|
|
252
266
|
/**
|
|
253
267
|
* The assistant ID to use for the ask AI feature.
|
|
254
268
|
*/
|
|
@@ -290,7 +304,48 @@ type DocSearchSidepanelProps = {
|
|
|
290
304
|
*/
|
|
291
305
|
panel?: Omit<SidepanelProps, 'keyboardShortcuts'>;
|
|
292
306
|
};
|
|
293
|
-
declare
|
|
307
|
+
declare const DocSearchSidepanel: React.ForwardRefExoticComponent<DocSearchCallbacks & {
|
|
308
|
+
/**
|
|
309
|
+
* The assistant ID to use for the ask AI feature.
|
|
310
|
+
*/
|
|
311
|
+
assistantId: string;
|
|
312
|
+
/**
|
|
313
|
+
* Public api key with search permissions for the index.
|
|
314
|
+
*/
|
|
315
|
+
apiKey: string;
|
|
316
|
+
/**
|
|
317
|
+
* Algolia application id used by the search client.
|
|
318
|
+
*/
|
|
319
|
+
appId: string;
|
|
320
|
+
/**
|
|
321
|
+
* The index name to use for the ask AI feature. Your assistant will search this index for relevant documents.
|
|
322
|
+
*/
|
|
323
|
+
indexName: string;
|
|
324
|
+
/**
|
|
325
|
+
* The search parameters to use for the ask AI feature.
|
|
326
|
+
*/
|
|
327
|
+
searchParameters?: AskAiSearchParameters;
|
|
328
|
+
/**
|
|
329
|
+
* Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
|
|
330
|
+
*
|
|
331
|
+
* @default `{ 'Ctrl/Cmd+I': true }`
|
|
332
|
+
*/
|
|
333
|
+
keyboardShortcuts?: SidepanelShortcuts;
|
|
334
|
+
/**
|
|
335
|
+
* Theme overrides applied to the Sidepanel button and panel.
|
|
336
|
+
*
|
|
337
|
+
* @default 'light'
|
|
338
|
+
*/
|
|
339
|
+
theme?: DocSearchTheme;
|
|
340
|
+
/**
|
|
341
|
+
* Props specific to the Sidepanel button.
|
|
342
|
+
*/
|
|
343
|
+
button?: Omit<SidepanelButtonProps, "keyboardShortcuts">;
|
|
344
|
+
/**
|
|
345
|
+
* Props specific to the Sidepanel panel.
|
|
346
|
+
*/
|
|
347
|
+
panel?: Omit<SidepanelProps, "keyboardShortcuts">;
|
|
348
|
+
} & React.RefAttributes<DocSearchRef>>;
|
|
294
349
|
|
|
295
350
|
export { DocSearchSidepanel, Sidepanel, SidepanelButton };
|
|
296
|
-
export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps, SidepanelTranslations };
|
|
351
|
+
export type { ButtonVariant, DocSearchSidepanelProps, SidepanelButtonProps, SidepanelButtonTranslations, SidepanelProps, SidepanelRef, SidepanelTranslations };
|