@docsearch/react 3.6.1 → 3.6.3

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 CHANGED
@@ -40,4 +40,4 @@ export default App;
40
40
 
41
41
  ## Documentation
42
42
 
43
- [Read documentation →](https://docsearch.algolia.com/docs/DocSearch-v3)
43
+ [Read documentation →](https://docsearch.algolia.com/docs/docsearch-v3)
@@ -1,9 +1,9 @@
1
1
  import { AutocompleteState, AutocompleteOptions } from '@algolia/autocomplete-core';
2
- import { SearchOptions } from '@algolia/client-search';
3
- import { SearchClient } from 'algoliasearch/lite';
2
+ import { SearchClient } from 'algoliasearch';
3
+ import { SearchQuery, LiteClient } from 'algoliasearch/lite';
4
4
  import React from 'react';
5
5
 
6
- declare type ContentType = 'content' | 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
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,13 @@ declare type DocSearchHit = {
78
78
  __autocomplete_id?: number;
79
79
  };
80
80
 
81
- declare type InternalDocSearchHit = DocSearchHit & {
81
+ type InternalDocSearchHit = DocSearchHit & {
82
82
  __docsearch_parent: InternalDocSearchHit | null;
83
83
  };
84
84
 
85
- declare type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
85
+ type StoredDocSearchHit = Omit<DocSearchHit, '_highlightResult' | '_snippetResult'>;
86
86
 
87
- declare type DocSearchTranslations = Partial<{
87
+ type DocSearchTranslations = Partial<{
88
88
  button: ButtonTranslations;
89
89
  modal: ModalTranslations;
90
90
  }>;
@@ -93,7 +93,7 @@ interface DocSearchProps {
93
93
  apiKey: string;
94
94
  indexName: string;
95
95
  placeholder?: string;
96
- searchParameters?: SearchOptions;
96
+ searchParameters?: SearchQuery;
97
97
  maxResultsPerGroup?: number;
98
98
  transformItems?: (items: DocSearchHit[]) => DocSearchHit[];
99
99
  hitComponent?: (props: {
@@ -103,7 +103,7 @@ interface DocSearchProps {
103
103
  resultsFooterComponent?: (props: {
104
104
  state: AutocompleteState<InternalDocSearchHit>;
105
105
  }) => JSX.Element | null;
106
- transformSearchClient?: (searchClient: SearchClient) => SearchClient;
106
+ transformSearchClient?: <T extends LiteClient | SearchClient>(searchClient: T) => T;
107
107
  disableUserPersonalization?: boolean;
108
108
  initialQuery?: string;
109
109
  navigator?: AutocompleteOptions<InternalDocSearchHit>['navigator'];
@@ -113,18 +113,18 @@ interface DocSearchProps {
113
113
  }) => string;
114
114
  insights?: AutocompleteOptions<InternalDocSearchHit>['insights'];
115
115
  }
116
- declare function DocSearch(props: DocSearchProps): JSX.Element;
116
+ declare function DocSearch(props: DocSearchProps): React.JSX.Element;
117
117
 
118
- declare type ButtonTranslations = Partial<{
118
+ type ButtonTranslations = Partial<{
119
119
  buttonText: string;
120
120
  buttonAriaLabel: string;
121
121
  }>;
122
- declare type DocSearchButtonProps = React.ComponentProps<'button'> & {
122
+ type DocSearchButtonProps = React.ComponentProps<'button'> & {
123
123
  translations?: ButtonTranslations;
124
124
  };
125
- declare const DocSearchButton: React.ForwardRefExoticComponent<Pick<DocSearchButtonProps, "translations" | "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & React.RefAttributes<HTMLButtonElement>>;
125
+ declare const DocSearchButton: React.ForwardRefExoticComponent<Omit<DocSearchButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
126
126
 
127
- declare type FooterTranslations = Partial<{
127
+ type FooterTranslations = Partial<{
128
128
  selectText: string;
129
129
  selectKeyAriaLabel: string;
130
130
  navigateText: string;
@@ -135,19 +135,19 @@ declare type FooterTranslations = Partial<{
135
135
  searchByText: string;
136
136
  }>;
137
137
 
138
- declare type ErrorScreenTranslations = Partial<{
138
+ type ErrorScreenTranslations = Partial<{
139
139
  titleText: string;
140
140
  helpText: string;
141
141
  }>;
142
142
 
143
- declare type NoResultsScreenTranslations = Partial<{
143
+ type NoResultsScreenTranslations = Partial<{
144
144
  noResultsText: string;
145
145
  suggestedQueryText: string;
146
146
  reportMissingResultsText: string;
147
147
  reportMissingResultsLinkText: string;
148
148
  }>;
149
149
 
150
- declare type StartScreenTranslations = Partial<{
150
+ type StartScreenTranslations = Partial<{
151
151
  recentSearchesTitle: string;
152
152
  noRecentSearchesText: string;
153
153
  saveRecentSearchButtonTitle: string;
@@ -156,13 +156,13 @@ declare type StartScreenTranslations = Partial<{
156
156
  removeFavoriteSearchButtonTitle: string;
157
157
  }>;
158
158
 
159
- declare type ScreenStateTranslations = Partial<{
159
+ type ScreenStateTranslations = Partial<{
160
160
  errorScreen: ErrorScreenTranslations;
161
161
  startScreen: StartScreenTranslations;
162
162
  noResultsScreen: NoResultsScreenTranslations;
163
163
  }>;
164
164
 
165
- declare type SearchBoxTranslations = Partial<{
165
+ type SearchBoxTranslations = Partial<{
166
166
  resetButtonTitle: string;
167
167
  resetButtonAriaLabel: string;
168
168
  cancelButtonText: string;
@@ -170,16 +170,16 @@ declare type SearchBoxTranslations = Partial<{
170
170
  searchInputLabel: string;
171
171
  }>;
172
172
 
173
- declare type ModalTranslations = Partial<{
173
+ type ModalTranslations = Partial<{
174
174
  searchBox: SearchBoxTranslations;
175
175
  footer: FooterTranslations;
176
176
  }> & ScreenStateTranslations;
177
- declare type DocSearchModalProps = DocSearchProps & {
177
+ type DocSearchModalProps = DocSearchProps & {
178
178
  initialScrollY: number;
179
179
  onClose?: () => void;
180
180
  translations?: ModalTranslations;
181
181
  };
182
- declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, maxResultsPerGroup, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, }: DocSearchModalProps): JSX.Element;
182
+ declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, maxResultsPerGroup, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, insights, }: DocSearchModalProps): React.JSX.Element;
183
183
 
184
184
  interface UseDocSearchKeyboardEventsProps {
185
185
  isOpen: boolean;
@@ -190,6 +190,6 @@ interface UseDocSearchKeyboardEventsProps {
190
190
  }
191
191
  declare function useDocSearchKeyboardEvents({ isOpen, onOpen, onClose, onInput, searchButtonRef, }: UseDocSearchKeyboardEventsProps): void;
192
192
 
193
- declare const version = "3.6.1";
193
+ declare const version = "3.6.3";
194
194
 
195
195
  export { type ButtonTranslations, DocSearch, DocSearchButton, type DocSearchButtonProps, DocSearchModal, type DocSearchModalProps, type DocSearchProps, type DocSearchTranslations, type ModalTranslations, type UseDocSearchKeyboardEventsProps, useDocSearchKeyboardEvents, version };