@docsearch/react 3.6.2 → 3.7.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/README.md +1 -1
- package/dist/esm/index.d.ts +31 -22
- package/dist/esm/index.js +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/index.js.map +1 -1
- package/package.json +16 -7
package/README.md
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AutocompleteState, AutocompleteOptions } from '@algolia/autocomplete-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { BaseItem, AutocompleteState, AutocompleteContext, AutocompleteInsightsApi, AutocompleteOptions } from '@algolia/autocomplete-core';
|
|
2
|
+
import { SearchClient } from 'algoliasearch';
|
|
3
|
+
import { SearchQuery, LiteClient } from 'algoliasearch/lite';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
|
|
7
7
|
interface DocSearchHitAttributeHighlightResult {
|
|
8
8
|
value: string;
|
|
9
9
|
matchLevel: 'full' | 'none' | 'partial';
|
|
@@ -78,13 +78,22 @@ declare type DocSearchHit = {
|
|
|
78
78
|
__autocomplete_id?: number;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
interface DocSearchContext extends AutocompleteContext {
|
|
82
|
+
algoliaInsightsPlugin?: {
|
|
83
|
+
insights: AutocompleteInsightsApi;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
interface DocSearchState<TItem extends BaseItem> extends AutocompleteState<TItem> {
|
|
87
|
+
context: DocSearchContext;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
type InternalDocSearchHit = DocSearchHit & {
|
|
82
91
|
__docsearch_parent: InternalDocSearchHit | null;
|
|
83
92
|
};
|
|
84
93
|
|
|
85
|
-
|
|
94
|
+
type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
|
|
86
95
|
|
|
87
|
-
|
|
96
|
+
type DocSearchTranslations = Partial<{
|
|
88
97
|
button: ButtonTranslations;
|
|
89
98
|
modal: ModalTranslations;
|
|
90
99
|
}>;
|
|
@@ -93,7 +102,7 @@ interface DocSearchProps {
|
|
|
93
102
|
apiKey: string;
|
|
94
103
|
indexName: string;
|
|
95
104
|
placeholder?: string;
|
|
96
|
-
searchParameters?:
|
|
105
|
+
searchParameters?: SearchQuery;
|
|
97
106
|
maxResultsPerGroup?: number;
|
|
98
107
|
transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
|
|
99
108
|
hitComponent?: (props: {
|
|
@@ -103,7 +112,7 @@ interface DocSearchProps {
|
|
|
103
112
|
resultsFooterComponent?: (props: {
|
|
104
113
|
state: AutocompleteState<InternalDocSearchHit>;
|
|
105
114
|
}) => JSX.Element | null;
|
|
106
|
-
transformSearchClient?: (searchClient:
|
|
115
|
+
transformSearchClient?: <T extends LiteClient | SearchClient>(searchClient: T) => T;
|
|
107
116
|
disableUserPersonalization?: boolean;
|
|
108
117
|
initialQuery?: string;
|
|
109
118
|
navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
|
|
@@ -115,16 +124,16 @@ interface DocSearchProps {
|
|
|
115
124
|
}
|
|
116
125
|
declare function DocSearch(props: DocSearchProps): JSX.Element;
|
|
117
126
|
|
|
118
|
-
|
|
127
|
+
type ButtonTranslations = Partial<{
|
|
119
128
|
buttonText: string;
|
|
120
129
|
buttonAriaLabel: string;
|
|
121
130
|
}>;
|
|
122
|
-
|
|
131
|
+
type DocSearchButtonProps = React.ComponentProps<'button'> & {
|
|
123
132
|
translations?: ButtonTranslations;
|
|
124
133
|
};
|
|
125
|
-
declare const DocSearchButton: React.ForwardRefExoticComponent<
|
|
134
|
+
declare const DocSearchButton: React.ForwardRefExoticComponent<Omit<DocSearchButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
126
135
|
|
|
127
|
-
|
|
136
|
+
type FooterTranslations = Partial<{
|
|
128
137
|
selectText: string;
|
|
129
138
|
selectKeyAriaLabel: string;
|
|
130
139
|
navigateText: string;
|
|
@@ -135,19 +144,19 @@ declare type FooterTranslations = Partial<{
|
|
|
135
144
|
searchByText: string;
|
|
136
145
|
}>;
|
|
137
146
|
|
|
138
|
-
|
|
147
|
+
type ErrorScreenTranslations = Partial<{
|
|
139
148
|
titleText: string;
|
|
140
149
|
helpText: string;
|
|
141
150
|
}>;
|
|
142
151
|
|
|
143
|
-
|
|
152
|
+
type NoResultsScreenTranslations = Partial<{
|
|
144
153
|
noResultsText: string;
|
|
145
154
|
suggestedQueryText: string;
|
|
146
155
|
reportMissingResultsText: string;
|
|
147
156
|
reportMissingResultsLinkText: string;
|
|
148
157
|
}>;
|
|
149
158
|
|
|
150
|
-
|
|
159
|
+
type StartScreenTranslations = Partial<{
|
|
151
160
|
recentSearchesTitle: string;
|
|
152
161
|
noRecentSearchesText: string;
|
|
153
162
|
saveRecentSearchButtonTitle: string;
|
|
@@ -156,13 +165,13 @@ declare type StartScreenTranslations = Partial<{
|
|
|
156
165
|
removeFavoriteSearchButtonTitle: string;
|
|
157
166
|
}>;
|
|
158
167
|
|
|
159
|
-
|
|
168
|
+
type ScreenStateTranslations = Partial<{
|
|
160
169
|
errorScreen: ErrorScreenTranslations;
|
|
161
170
|
startScreen: StartScreenTranslations;
|
|
162
171
|
noResultsScreen: NoResultsScreenTranslations;
|
|
163
172
|
}>;
|
|
164
173
|
|
|
165
|
-
|
|
174
|
+
type SearchBoxTranslations = Partial<{
|
|
166
175
|
resetButtonTitle: string;
|
|
167
176
|
resetButtonAriaLabel: string;
|
|
168
177
|
cancelButtonText: string;
|
|
@@ -170,11 +179,11 @@ declare type SearchBoxTranslations = Partial<{
|
|
|
170
179
|
searchInputLabel: string;
|
|
171
180
|
}>;
|
|
172
181
|
|
|
173
|
-
|
|
182
|
+
type ModalTranslations = Partial<{
|
|
174
183
|
searchBox: SearchBoxTranslations;
|
|
175
184
|
footer: FooterTranslations;
|
|
176
185
|
}> & ScreenStateTranslations;
|
|
177
|
-
|
|
186
|
+
type DocSearchModalProps = DocSearchProps & {
|
|
178
187
|
initialScrollY: number;
|
|
179
188
|
onClose?: () => void;
|
|
180
189
|
translations?: ModalTranslations;
|
|
@@ -190,6 +199,6 @@ interface UseDocSearchKeyboardEventsProps {
|
|
|
190
199
|
}
|
|
191
200
|
declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
|
|
192
201
|
|
|
193
|
-
declare const version = "3.
|
|
202
|
+
declare const version = "3.7.0";
|
|
194
203
|
|
|
195
|
-
export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchTranslations, type ModalTranslations, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
|
|
204
|
+
export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, type DocSearchHit, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchState, type DocSearchTranslations, type InternalDocSearchHit, type ModalTranslations, type StoredDocSearchHit, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };
|