@searchcraft/react-sdk 0.15.1 → 0.16.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.
@@ -46,36 +46,21 @@ export declare interface SearchcraftFilterPanelProps extends Components.Searchcr
46
46
  *
47
47
  * @example
48
48
  * ```tsx
49
- * import React from 'react';
50
49
  * import { SearchcraftInputForm } from '@searchcraft/react-sdk';
51
- * import searchcraftConfig from './searchcraftConfig';
52
- *
53
- * const MySearchComponent = () => {
54
- * const handleQuerySubmit = (event: CustomEvent<string>) => {
55
- * console.log("Query submitted", event.detail);
56
- * };
57
50
  *
58
- * return (
59
- * <SearchcraftInputForm
60
- * config={searchcraftConfig}
61
- * autoSearch={true}
62
- * buttonPlacement="right"
63
- * buttonLabel="Search"
64
- * inputLabel="Search Database"
65
- * customStyles={{ border: "1px solid gray", padding: "5px" }}
66
- * placeholderValue="Search here..."
67
- * searchTerm=""
68
- * onQuerySubmit={handleQuerySubmit}
69
- * onInputCleared={() => console.log("Input cleared")}
70
- * onNoResultsReceived={() => console.log("No results found")}
71
- * onInputFocus={() => console.log("Input focused")}
72
- * onInputBlur={() => console.log("Input blurred")}
73
- * onInputInit={() => console.log("Input initialized")}
74
- * />
75
- * );
76
- * };
77
- *
78
- * export default MySearchComponent;
51
+ * const MySearchInput = () => (
52
+ * <SearchcraftInputForm
53
+ * autoSearch={true}
54
+ * buttonPlacement="right"
55
+ * buttonLabel="Search"
56
+ * inputLabel="Search articles"
57
+ * placeholderValue="Search here..."
58
+ * onInputFocus={() => console.log('Input focused')}
59
+ * onInputBlur={() => console.log('Input blurred')}
60
+ * />
61
+ * );
62
+ *
63
+ * export default MySearchInput;
79
64
  * ```
80
65
  */
81
66
  export declare const SearchcraftInputForm: FC<SearchcraftInputFormProps>;
@@ -148,13 +133,11 @@ export declare interface SearchcraftPopoverButtonProps extends Components.Search
148
133
  * ```tsx
149
134
  * import React from 'react';
150
135
  * import { SearchcraftPopoverForm } from '@searchcraft/react-sdk';
151
- * import searchcraftConfig from './searchcraftConfig';
152
136
  * import popoverResultMappings from './popoverResultMappings';
153
137
  *
154
138
  * const MyPopoverSearch = () => {
155
139
  * return (
156
140
  * <SearchcraftPopoverForm
157
- * config={searchcraftConfig}
158
141
  * type="fullscreen"
159
142
  * popoverResultMappings={popoverResultMappings}
160
143
  * hotkey="k"
@@ -179,19 +162,15 @@ export declare interface SearchcraftPopoverFormProps extends Components.Searchcr
179
162
  *
180
163
  * @example
181
164
  * ```tsx
182
- * import React, { useEffect, useRef } from 'react';
183
165
  * import { SearchcraftResultsInfo } from '@searchcraft/react-sdk';
184
166
  *
185
- * const MyResultsInfo = () => {
186
- * const ref = useRef();
187
- *
188
- * useEffect(() => {
189
- * ref.current.customFormatter = (range, count, responseTime) =>
190
- * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
191
- * });
192
- *
193
- * return <SearchcraftResultsInfo ref={ref} />;
194
- * };
167
+ * const MyResultsInfo = () => (
168
+ * <SearchcraftResultsInfo
169
+ * template={({ range, count, responseTime }, { html }) => html`
170
+ * ${range[0]}-${range[1]} of ${count} results in ${responseTime}ms
171
+ * `}
172
+ * />
173
+ * );
195
174
  *
196
175
  * export default MyResultsInfo;
197
176
  * ```
@@ -231,26 +210,19 @@ export declare interface SearchcraftResultsSummaryProps extends Components.Searc
231
210
  *
232
211
  * @example
233
212
  * ```tsx
234
- * import React from 'react';
235
213
  * import { SearchcraftSearchResults } from '@searchcraft/react-sdk';
236
- * import searchResultMappings from './searchResultMappings';
237
- *
238
- * const MySearchComponent = () => {
239
- * return (
240
- * <SearchcraftSearchResults
241
- * searchResultMappings={searchResultMappings}
242
- * resultImagePlacement="left"
243
- * buttonLabel="View More"
244
- * buttonTarget="_blank"
245
- * buttonRel="noopener"
246
- * containerTarget="_self"
247
- * containerRel="nofollow"
248
- * onNoResults={() => console.log("No search results found")}
249
- * />
250
- * );
251
- * };
252
214
  *
253
- * export default MySearchComponent;
215
+ * const MySearchResults = () => (
216
+ * <SearchcraftSearchResults
217
+ * template={(item, index, { html, safeUrl }) => html`
218
+ * <a href="${safeUrl(item.url)}">
219
+ * <h2>${item.title}</h2>
220
+ * </a>
221
+ * `}
222
+ * />
223
+ * );
224
+ *
225
+ * export default MySearchResults;
254
226
  * ```
255
227
  */
256
228
  export declare const SearchcraftSearchResults: FC<SearchcraftSearchResultsProps>;