@searchcraft/react-sdk 0.7.2 → 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
@@ -2,8 +2,31 @@ import { Components } from '@searchcraft/javascript-sdk';
2
2
  import { FC } from 'react';
3
3
 
4
4
  /**
5
- * The React component for SearchcraftBaseSearchResults.
6
- * @param props
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
+ * ```
7
30
  */
8
31
  export declare const SearchcraftBaseSearchResults: FC<SearchcraftBaseSearchResultsProps>;
9
32
 
@@ -14,8 +37,22 @@ export declare interface SearchcraftBaseSearchResultsProps extends Components.Se
14
37
  }
15
38
 
16
39
  /**
17
- * The React component for the SearchcraftFilterPanel.
18
- * @param props
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
+ * ```
19
56
  */
20
57
  export declare const SearchcraftFilterPanel: FC<SearchcraftFilterPanelProps>;
21
58
 
@@ -26,8 +63,43 @@ export declare interface SearchcraftFilterPanelProps extends Components.Searchcr
26
63
  }
27
64
 
28
65
  /**
29
- * The React component for the SearchcraftInputForm
30
- * @param props
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
+ * ```
31
103
  */
32
104
  export declare const SearchcraftInputForm: FC<SearchcraftInputFormProps>;
33
105
 
@@ -38,8 +110,50 @@ export declare interface SearchcraftInputFormProps extends Components.Searchcraf
38
110
  }
39
111
 
40
112
  /**
41
- * The React component for the SearchcraftPopoverButton.
42
- * @param props
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
+ * ```
43
157
  */
44
158
  export declare const SearchcraftPopoverButton: FC<SearchcraftPopoverButtonProps>;
45
159
 
@@ -50,8 +164,30 @@ export declare interface SearchcraftPopoverButtonProps extends Components.Search
50
164
  }
51
165
 
52
166
  /**
53
- * The React component for SearchcraftPopoverForm.
54
- * @param props
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
+ * ```
55
191
  */
56
192
  export declare const SearchcraftPopoverForm: FC<SearchcraftPopoverFormProps>;
57
193
 
@@ -62,8 +198,26 @@ export declare interface SearchcraftPopoverFormProps extends Components.Searchcr
62
198
  }
63
199
 
64
200
  /**
65
- * The React component for SearchcraftResultsInfo.
66
- * @param props
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
+ * ```
67
221
  */
68
222
  export declare const SearchcraftResultsInfo: FC<SearchcraftResultsInfoProps>;
69
223
 
@@ -74,8 +228,43 @@ export declare interface SearchcraftResultsInfoProps extends Components.Searchcr
74
228
  }
75
229
 
76
230
  /**
77
- * The react component for SearchcraftTheme.
78
- * @param props
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
+ * ```
79
268
  */
80
269
  export declare const SearchcraftTheme: FC<SearchcraftThemeProps>;
81
270