@searchcraft/react-sdk 0.7.1 → 0.8.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/index.d.ts CHANGED
@@ -1,38 +1,276 @@
1
1
  import { Components } from '@searchcraft/javascript-sdk';
2
2
  import { FC } from 'react';
3
3
 
4
+ /**
5
+ * A component that renders a list of search results with customizable styles, layout, and link behavior.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import React from 'react';
10
+ * import { SearchcraftBaseSearchResults } from '@searchcraft/react-sdk';
11
+ * import searchResultMappings from './searchResultMappings';
12
+ *
13
+ * const MySearchComponent = () => {
14
+ * return (
15
+ * <SearchcraftBaseSearchResults
16
+ * searchResultMappings={searchResultMappings}
17
+ * resultImagePlacement="left"
18
+ * buttonLabel="View More"
19
+ * buttonTarget="_blank"
20
+ * buttonRel="noopener"
21
+ * containerTarget="_self"
22
+ * containerRel="nofollow"
23
+ * onNoResults={() => console.log("No search results found")}
24
+ * />
25
+ * );
26
+ * };
27
+ *
28
+ * export default MySearchComponent;
29
+ * ```
30
+ */
4
31
  export declare const SearchcraftBaseSearchResults: FC<SearchcraftBaseSearchResultsProps>;
5
32
 
33
+ /**
34
+ * The props for the SearchcraftBaseSearchResults component.
35
+ */
6
36
  export declare interface SearchcraftBaseSearchResultsProps extends Components.SearchcraftBaseSearchResults {
7
37
  }
8
38
 
39
+ /**
40
+ * A component that represents a filter panel UI view, allowing users to refine and control their search queries by applying various filter criteria.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import React from 'react';
45
+ * import { SearchcraftFilterPanel } from '@searchcraft/react-sdk';
46
+ * import filterItems from './filterItems';
47
+ *
48
+ * const MyFilterComponent = () => {
49
+ * return (
50
+ * <SearchcraftFilterPanel items={filterItems} />
51
+ * );
52
+ * };
53
+ *
54
+ * export default MyFilterComponent;
55
+ * ```
56
+ */
9
57
  export declare const SearchcraftFilterPanel: FC<SearchcraftFilterPanelProps>;
10
58
 
59
+ /**
60
+ * The props for the SearchcraftFilterPanel.
61
+ */
11
62
  export declare interface SearchcraftFilterPanelProps extends Components.SearchcraftFilterPanel {
12
63
  }
13
64
 
65
+ /**
66
+ * A component that provides a user-friendly interface for querying an indexed dataset,
67
+ * enabling users to easily search large collections of data. It abstracts the complexities
68
+ * of index-based searching, making it accessible to users of all technical levels.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * import React from 'react';
73
+ * import { SearchcraftInputForm } from '@searchcraft/react-sdk';
74
+ * import searchcraftConfig from './searchcraftConfig';
75
+ *
76
+ * const MySearchComponent = () => {
77
+ * const handleQuerySubmit = (event: CustomEvent<string>) => {
78
+ * console.log("Query submitted", event.detail);
79
+ * };
80
+ *
81
+ * return (
82
+ * <SearchcraftInputForm
83
+ * config={searchcraftConfig}
84
+ * autoSearch={true}
85
+ * buttonPlacement="right"
86
+ * buttonLabel="Search"
87
+ * inputLabel="Search Database"
88
+ * customStyles={{ border: "1px solid gray", padding: "5px" }}
89
+ * placeholderValue="Search here..."
90
+ * searchTerm=""
91
+ * onQuerySubmit={handleQuerySubmit}
92
+ * onInputCleared={() => console.log("Input cleared")}
93
+ * onNoResultsReceived={() => console.log("No results found")}
94
+ * onInputFocus={() => console.log("Input focused")}
95
+ * onInputBlur={() => console.log("Input blurred")}
96
+ * onInputInit={() => console.log("Input initialized")}
97
+ * />
98
+ * );
99
+ * };
100
+ *
101
+ * export default MySearchComponent;
102
+ * ```
103
+ */
14
104
  export declare const SearchcraftInputForm: FC<SearchcraftInputFormProps>;
15
105
 
106
+ /**
107
+ * The props for the SearchcraftInputForm.
108
+ */
16
109
  export declare interface SearchcraftInputFormProps extends Components.SearchcraftInputForm {
17
110
  }
18
111
 
112
+ /**
113
+ * This React component is designed to facilitate pagination of search results.
114
+ * Once a query is submitted, calculates the number for pages.
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * import React from 'react';
119
+ * import { SearchcraftPagination } from '@searchcraft/react-sdk';
120
+ *
121
+ * const MyPaginationComponent = () => {
122
+ * return (
123
+ * // other searchcraft components
124
+ * <SearchcraftPagination />
125
+ * );
126
+ * };
127
+ *
128
+ * export default MyPaginationComponent;
129
+ * ```
130
+ */
131
+ export declare const SearchcraftPagination: FC<SearchcraftPaginationProps>;
132
+
133
+ /**
134
+ * The props for the SearchcraftPagination component.
135
+ */
136
+ export declare interface SearchcraftPaginationProps extends Components.SearchcraftPagination {
137
+ }
138
+
139
+ /**
140
+ * A button component that, when clicked, toggles the visibility of a popover.
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * import React from 'react';
145
+ * import { SearchcraftPopoverButton } from '@searchcraft/react-sdk';
146
+ *
147
+ * const MyPopoverTrigger = () => {
148
+ * return (
149
+ * <SearchcraftPopoverButton>
150
+ * Open Popover
151
+ * </SearchcraftPopoverButton>
152
+ * );
153
+ * };
154
+ *
155
+ * export default MyPopoverTrigger;
156
+ * ```
157
+ */
19
158
  export declare const SearchcraftPopoverButton: FC<SearchcraftPopoverButtonProps>;
20
159
 
160
+ /**
161
+ * The props for the SearchcraftPopoverButton.
162
+ */
21
163
  export declare interface SearchcraftPopoverButtonProps extends Components.SearchcraftPopoverButton {
22
164
  }
23
165
 
166
+ /**
167
+ * A component that displays search results in a popover container that dynamically appears
168
+ * when the user interacts with a search input field, or when a popover button is clicked.
169
+ *
170
+ * @example
171
+ * ```tsx
172
+ * import React from 'react';
173
+ * import { SearchcraftPopoverForm } from '@searchcraft/react-sdk';
174
+ * import searchcraftConfig from './searchcraftConfig';
175
+ * import popoverResultMappings from './popoverResultMappings';
176
+ *
177
+ * const MyPopoverSearch = () => {
178
+ * return (
179
+ * <SearchcraftPopoverForm
180
+ * config={searchcraftConfig}
181
+ * type="fullscreen"
182
+ * popoverResultMappings={popoverResultMappings}
183
+ * hotkey="k"
184
+ * hotkeyModifier="meta"
185
+ * />
186
+ * );
187
+ * };
188
+ *
189
+ * export default MyPopoverSearch;
190
+ * ```
191
+ */
24
192
  export declare const SearchcraftPopoverForm: FC<SearchcraftPopoverFormProps>;
25
193
 
194
+ /**
195
+ * The props for the SearchcraftPopoverForm component.
196
+ */
26
197
  export declare interface SearchcraftPopoverFormProps extends Components.SearchcraftPopoverForm {
27
198
  }
28
199
 
200
+ /**
201
+ * This React component is designed to display the number of results returned from a search query.
202
+ *
203
+ * @example
204
+ * ```tsx
205
+ * import React, { useEffect, useRef } from 'react';
206
+ * import { SearchcraftResultsInfo } from '@searchcraft/react-sdk';
207
+ *
208
+ * const MyResultsInfo = () => {
209
+ * const ref = useRef();
210
+ *
211
+ * useEffect(() => {
212
+ * ref.current.customFormatter = (range, count, responseTime) =>
213
+ * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
214
+ * });
215
+ *
216
+ * return <SearchcraftResultsInfo ref={ref} />;
217
+ * };
218
+ *
219
+ * export default MyResultsInfo;
220
+ * ```
221
+ */
29
222
  export declare const SearchcraftResultsInfo: FC<SearchcraftResultsInfoProps>;
30
223
 
224
+ /**
225
+ * The Props for the SearchcraftResultsInfo component.
226
+ */
31
227
  export declare interface SearchcraftResultsInfoProps extends Components.SearchcraftResultsInfo {
32
228
  }
33
229
 
230
+ /**
231
+ * This React component is designed to choose the number of search results displayed.
232
+ *
233
+ * @example
234
+ * ```tsx
235
+ * import React from 'react';
236
+ * import { SearchcraftSearchResultsPerPage } from '@searchcraft/react-sdk';
237
+ *
238
+ * const MyResultsPerPage = () => {
239
+ * return <SearchcraftSearchResultsPerPage increment={20} />;
240
+ * };
241
+ *
242
+ * export default MyResultsPerPage;
243
+ * ```
244
+ */
245
+ export declare const SearchcraftSearchResultsPerPage: FC<SearchcraftSearchResultsPerPageProps>;
246
+
247
+ /**
248
+ * The Props for the SearchcraftSearchResultsPerPage component.
249
+ */
250
+ export declare interface SearchcraftSearchResultsPerPageProps extends Components.SearchcraftSearchResultsPerPage {
251
+ }
252
+
253
+ /**
254
+ * A component that applies Searchcraft's built-in CSS theme to your page.
255
+ * It does not render anything visible—its only function is to manage the CSS styles on the page.
256
+ *
257
+ * @example
258
+ * ```tsx
259
+ * import React from 'react';
260
+ * import { SearchcraftTheme } from '@searchcraft/react-sdk';
261
+ *
262
+ * const MyThemeProvider = () => {
263
+ * return <SearchcraftTheme theme="light" customTheme={'[]'} />;
264
+ * };
265
+ *
266
+ * export default MyThemeProvider;
267
+ * ```
268
+ */
34
269
  export declare const SearchcraftTheme: FC<SearchcraftThemeProps>;
35
270
 
271
+ /**
272
+ * The Props for the SearchcraftTheme component.
273
+ */
36
274
  export declare interface SearchcraftThemeProps extends Components.SearchcraftTheme {
37
275
  }
38
276