@searchcraft/javascript-sdk 0.9.7 → 0.10.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.
Files changed (119) hide show
  1. package/README.md +2 -2
  2. package/dist/components/defineCustomElements.js +6 -6
  3. package/dist/components/index.d.ts +2514 -68
  4. package/dist/components/index.js +45 -14
  5. package/dist/components/index.js.map +1 -1
  6. package/dist/components/{p-e55a7970.js → p-1adf78b9.js} +2 -2
  7. package/dist/components/p-1adf78b9.js.map +1 -0
  8. package/dist/components/{p-60f05735.js → p-34a32648.js} +4 -4
  9. package/dist/components/p-34a32648.js.map +1 -0
  10. package/dist/components/p-39e70a00.js +67 -0
  11. package/dist/components/p-39e70a00.js.map +1 -0
  12. package/dist/components/{p-e41b0f43.js → p-3f63fa14.js} +14 -21
  13. package/dist/components/p-3f63fa14.js.map +1 -0
  14. package/dist/components/{p-bf6a086a.js → p-73db9122.js} +3 -10
  15. package/dist/components/p-73db9122.js.map +1 -0
  16. package/dist/components/p-810a7850.js +17 -0
  17. package/dist/components/p-810a7850.js.map +1 -0
  18. package/dist/components/{p-8f854dec.js → p-8aa0fff5.js} +4 -3
  19. package/dist/components/p-8aa0fff5.js.map +1 -0
  20. package/dist/components/{p-5fdaf1e6.js → p-a64b4cba.js} +2 -145
  21. package/dist/components/p-a64b4cba.js.map +1 -0
  22. package/dist/components/{p-71cc28c1.js → p-acf23bab.js} +2 -2
  23. package/dist/components/p-acf23bab.js.map +1 -0
  24. package/dist/components/{p-bb12ab5a.js → p-bc9e0e40.js} +4 -3
  25. package/dist/components/p-bc9e0e40.js.map +1 -0
  26. package/dist/components/{p-4df578e4.js → p-c317a36a.js} +7 -7
  27. package/dist/components/p-c317a36a.js.map +1 -0
  28. package/dist/components/{p-e27a0dab.js → p-d361b781.js} +5 -7
  29. package/dist/components/p-d361b781.js.map +1 -0
  30. package/dist/components/p-e72d0167.js +147 -0
  31. package/dist/components/p-e72d0167.js.map +1 -0
  32. package/dist/components/{p-0e393fe1.js → p-f2585cdf.js} +3 -9
  33. package/dist/components/p-f2585cdf.js.map +1 -0
  34. package/dist/components/{p-580c09dc.js → p-f8df3d49.js} +143 -143
  35. package/dist/components/p-f8df3d49.js.map +1 -0
  36. package/dist/components/searchcraft-ad.js +1 -1
  37. package/dist/components/searchcraft-button.js +1 -1
  38. package/dist/components/searchcraft-error-message.js +1 -1
  39. package/dist/components/searchcraft-facet-list.js +1 -1
  40. package/dist/components/searchcraft-filter-panel.js +6 -5
  41. package/dist/components/searchcraft-filter-panel.js.map +1 -1
  42. package/dist/components/searchcraft-input-form.js +2 -2
  43. package/dist/components/searchcraft-input-label.js +1 -1
  44. package/dist/components/searchcraft-pagination.js +3 -9
  45. package/dist/components/searchcraft-pagination.js.map +1 -1
  46. package/dist/components/searchcraft-popover-button.js +2 -2
  47. package/dist/components/searchcraft-popover-button.js.map +1 -1
  48. package/dist/components/searchcraft-popover-form.js +14 -15
  49. package/dist/components/searchcraft-popover-form.js.map +1 -1
  50. package/dist/components/searchcraft-popover-list-item.js +1 -1
  51. package/dist/components/searchcraft-popover-list-view.js +1 -1
  52. package/dist/components/searchcraft-results-info.js +15 -19
  53. package/dist/components/searchcraft-results-info.js.map +1 -1
  54. package/dist/components/searchcraft-search-result.d.ts +11 -0
  55. package/dist/components/searchcraft-search-result.js +8 -0
  56. package/dist/components/searchcraft-search-result.js.map +1 -0
  57. package/dist/components/searchcraft-search-results-per-page.js +3 -10
  58. package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
  59. package/dist/components/searchcraft-search-results.d.ts +11 -0
  60. package/dist/components/{searchcraft-base-search-results.js → searchcraft-search-results.js} +25 -71
  61. package/dist/components/searchcraft-search-results.js.map +1 -0
  62. package/dist/components/searchcraft-select.js +1 -1
  63. package/dist/components/searchcraft-slider.js +1 -1
  64. package/dist/components/searchcraft-theme.js +4 -42
  65. package/dist/components/searchcraft-theme.js.map +1 -1
  66. package/dist/components/searchcraft-toggle-button.js +1 -1
  67. package/dist/hydrate/index.d.ts +242 -0
  68. package/dist/hydrate/index.js +23290 -0
  69. package/dist/hydrate/index.mjs +23282 -0
  70. package/dist/hydrate/package.json +12 -0
  71. package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +2 -0
  72. package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +3 -2
  73. package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +6 -7
  74. package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +3 -1
  75. package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +29 -1
  76. package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +22 -14
  77. package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +3 -2
  78. package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +21 -8
  79. package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +30 -0
  80. package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +26 -15
  81. package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
  82. package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +3 -2
  83. package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +41 -15
  84. package/dist/types/components/searchcraft-search-result/searchcraft-search-result.d.ts +25 -0
  85. package/dist/types/components/searchcraft-search-results/searchcraft-search-results.d.ts +80 -0
  86. package/dist/types/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.d.ts +20 -5
  87. package/dist/types/components/searchcraft-select/searchcraft-select.d.ts +3 -5
  88. package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +3 -3
  89. package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +23 -16
  90. package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
  91. package/dist/types/components.d.ts +836 -612
  92. package/dist/types/index.d.ts +5 -4
  93. package/dist/types/utils/html.d.ts +6 -0
  94. package/dist/types/utils/index.d.ts +1 -0
  95. package/package.json +9 -7
  96. package/dist/components/bundled.types.d.ts +0 -2275
  97. package/dist/components/p-0e393fe1.js.map +0 -1
  98. package/dist/components/p-19fe91f1.js +0 -136
  99. package/dist/components/p-19fe91f1.js.map +0 -1
  100. package/dist/components/p-4df578e4.js.map +0 -1
  101. package/dist/components/p-580c09dc.js.map +0 -1
  102. package/dist/components/p-5fdaf1e6.js.map +0 -1
  103. package/dist/components/p-60f05735.js.map +0 -1
  104. package/dist/components/p-71cc28c1.js.map +0 -1
  105. package/dist/components/p-8f854dec.js.map +0 -1
  106. package/dist/components/p-bb12ab5a.js.map +0 -1
  107. package/dist/components/p-bf6a086a.js.map +0 -1
  108. package/dist/components/p-d9551738.js +0 -25
  109. package/dist/components/p-d9551738.js.map +0 -1
  110. package/dist/components/p-e27a0dab.js.map +0 -1
  111. package/dist/components/p-e41b0f43.js.map +0 -1
  112. package/dist/components/p-e55a7970.js.map +0 -1
  113. package/dist/components/searchcraft-base-search-result.d.ts +0 -11
  114. package/dist/components/searchcraft-base-search-result.js +0 -8
  115. package/dist/components/searchcraft-base-search-result.js.map +0 -1
  116. package/dist/components/searchcraft-base-search-results.d.ts +0 -11
  117. package/dist/components/searchcraft-base-search-results.js.map +0 -1
  118. package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +0 -55
  119. package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +0 -89
@@ -1,2275 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- import { HTMLStencilElement, JSXBase } from '@stencil/core/internal';
4
-
5
- declare enum LogLevel {
6
- DEBUG = 0,
7
- INFO = 1,
8
- WARN = 2,
9
- ERROR = 3
10
- }
11
- export interface SDKDebuggerOptions {
12
- logLevel: LogLevel;
13
- logFormatter?: (level: LogLevel, message: string) => string;
14
- }
15
- declare class Logger {
16
- private logLevel;
17
- private logFormatter;
18
- constructor(options: SDKDebuggerOptions);
19
- private defaultFormatter;
20
- debug(message: string): void;
21
- info(message: string): void;
22
- warn(message: string): void;
23
- error(message: string): void;
24
- log(level: LogLevel, message: string): void;
25
- }
26
- /**
27
- * The SearchcraftConfig object is used to initialize Searchcraft in your application.
28
- */
29
- export interface SearchcraftConfig {
30
- /**
31
- * Host IP Address and port number configured and created using Vektron
32
- */
33
- endpointURL: string;
34
- /**
35
- * Name or names of search indices configured using Vektron. Given as an array of strings
36
- */
37
- index: string[];
38
- /**
39
- * A unique user identifier for the end user.
40
- */
41
- userId?: string;
42
- /**
43
- * The Index read key provided by Vektron.
44
- */
45
- readKey: string;
46
- /**
47
- * The amount of delay, in milliseconds, to debounce search requests. Defaults to `0`.
48
- */
49
- searchDebounceDelay?: number;
50
- /**
51
- * The maximum number of results to return per page.
52
- */
53
- searchResultsPerPage?: number;
54
- /**
55
- * Name of the ad source to use.
56
- */
57
- adSource?: "adMarketplace" | "Nativo" | "Custom" | "None";
58
- /**
59
- * The maximum number of product ads to show for a single search term.
60
- */
61
- admProductAdQuantity?: number;
62
- /**
63
- * The maximum number of text ads to show for a single search term.
64
- */
65
- admTextAdQuantity?: number;
66
- /**
67
- * The adm sub value.
68
- */
69
- admSub?: string;
70
- /**
71
- * The amount of debounce delay to add before calling the ad_container_rendered event
72
- */
73
- adContainerRenderedDebounceDelay?: number;
74
- /**
75
- * The number of custom ads to render at the start of the search results page.
76
- */
77
- customAdStartQuantity?: number;
78
- /**
79
- * The number of custom ads to render at the end of the search results page.
80
- */
81
- customAdEndQuantity?: number;
82
- /**
83
- * Renders a custom ad in between search results, at the specified interval.
84
- */
85
- customAdInterstitialInterval?: number;
86
- /**
87
- * Specifies the number of ads to be rendered in each interstitial in between search results.
88
- */
89
- customAdInterstitialQuantity?: number;
90
- /**
91
- * A callback function responsible for rendering the custom ad containers.
92
- */
93
- customAdTemplate?: CustomAdTemplateRenderFunction;
94
- /**
95
- * The placement id to use for Nativo ads.
96
- */
97
- nativoPlacementId?: number;
98
- /**
99
- * The class name for nativo ad containers.
100
- */
101
- nativoAdClassName?: string;
102
- /**
103
- * The number of custom ads to render at the start of the search results page.
104
- */
105
- nativoAdStartQuantity?: number;
106
- /**
107
- * The number of custom ads to render at the end of the search results page.
108
- */
109
- nativoAdEndQuantity?: number;
110
- /**
111
- * Renders a custom ad in between search results, at the specified interval.
112
- */
113
- nativoAdInterstitialInterval?: number;
114
- /**
115
- * Specify how many normal search results to render before rendering the first interstitial ad grouping.
116
- */
117
- nativoAdInterstialStartIndex?: number;
118
- /**
119
- * Specifies the number of ads to be rendered in each interstitial in between search results.
120
- */
121
- nativoAdInterstitialQuantity?: number;
122
- }
123
- export type SearchcraftAdSource = "adMarketplace" | "Nativo" | "Custom" | "None";
124
- /**
125
- * Used internally by consuming packages as part of the core sdk constructor.
126
- */
127
- export interface SearchcraftSDKInfo {
128
- sdkName: string;
129
- sdkVersion: string;
130
- }
131
- export interface CustomAdTemplateRenderData {
132
- adContainerId: string;
133
- searchTerm: string;
134
- }
135
- export type CustomAdTemplateRenderFunction = (data: CustomAdTemplateRenderData) => string;
136
- export interface AdClientResponseItem {
137
- id: string;
138
- adSource: SearchcraftAdSource;
139
- }
140
- /**
141
- * A Facet object returned in a search response.
142
- */
143
- export type FacetRoot = {
144
- [key: string]: FacetChild[];
145
- };
146
- export type FacetPrime = FacetRoot[];
147
- /**
148
- * Represents the structure of facets, which group search results into categories.
149
- */
150
- export interface FacetChild {
151
- count: number;
152
- path: string;
153
- children?: FacetChild[];
154
- }
155
- /**
156
- * Types of measure requests that can be sent to the /measure/event endpoint.
157
- */
158
- export type MeasureEventName = "sdk_initialized" | "search_requested" | "search_response_received" | "document_clicked";
159
- /**
160
- * Properties attached to a measure request.
161
- */
162
- export interface MeasureRequestProperties {
163
- searchcraft_organization_id?: string;
164
- searchcraft_application_id?: string;
165
- searchcraft_index_names: string[];
166
- search_term?: string;
167
- number_of_documents?: number;
168
- external_document_id?: string;
169
- document_position?: number;
170
- session_id?: string;
171
- }
172
- /**
173
- * User properties attached to a measure request.
174
- */
175
- export interface MeasureRequestUser {
176
- user_id: string;
177
- country?: string;
178
- city?: string;
179
- device_id?: string;
180
- client_ip?: string;
181
- locale?: string;
182
- os?: string;
183
- platform?: string;
184
- region?: string;
185
- sdk_name?: string;
186
- sdk_version?: string;
187
- user_agent?: string;
188
- latitude?: number;
189
- longitude?: number;
190
- }
191
- /**
192
- * The structure of a response returned from a Searchcraft operation.
193
- */
194
- export interface SearchcraftResponse {
195
- status: number;
196
- data: SearchcraftResponseData | SearchcraftResponseError;
197
- }
198
- /**
199
- * Error returned when a search is unsuccessful.
200
- */
201
- export type SearchcraftResponseError = {
202
- status: number;
203
- message?: string;
204
- code?: number;
205
- hits?: [
206
- ];
207
- facets?: null;
208
- count?: number;
209
- time_taken?: number;
210
- };
211
- /**
212
- * Top-level result returned when a search is successful.
213
- */
214
- export interface SearchcraftResponseData {
215
- count?: number;
216
- facets?: FacetPrime;
217
- hits?: SearchIndexEntry[];
218
- time_taken?: number;
219
- }
220
- /**
221
- * Represents an entry in the search index returned as part of a search result.
222
- */
223
- export interface SearchIndexEntry {
224
- doc?: SearchDocument;
225
- document_id?: string;
226
- score?: number;
227
- }
228
- /**
229
- * Data document returned within a SearchResult.
230
- */
231
- export interface SearchDocument extends Record<string, string | number> {
232
- id: number;
233
- [key: string]: string | number;
234
- }
235
- export interface SearchClientResponseItem {
236
- id: string;
237
- document: SearchDocument;
238
- }
239
- export type FacetPathsForIndexField = {
240
- fieldName: string;
241
- value: string;
242
- };
243
- export type RangeValueForIndexField = {
244
- fieldName: string;
245
- value: string;
246
- };
247
- /**
248
- * Parameters required to make a successful Search request.
249
- */
250
- export type SearchParams = {
251
- /**
252
- * The search mode, which can be either 'fuzzy' or 'exact'.
253
- */
254
- mode: "fuzzy" | "exact";
255
- /**
256
- * The starting point for the results, used for pagination.
257
- * Optional parameter.
258
- */
259
- offset?: number;
260
- /**
261
- * The number of results returned.
262
- * Optional parameter.
263
- */
264
- limit?: number;
265
- /**
266
- * The field to order the results by (e.g., 'date_published', 'title', etc.).
267
- * Optional parameter.
268
- */
269
- order_by?: string;
270
- /**
271
- * The search term provided by the user.
272
- */
273
- searchTerm: string;
274
- /**
275
- * The sort order, which can be either 'asc' or 'desc'.
276
- * Optional parameter.
277
- */
278
- sort?: "asc" | "desc";
279
- facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
280
- rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
281
- };
282
- export interface SubscriptionEventMap {
283
- ad_container_rendered: AdContainerRenderedSubscriptionEvent;
284
- ad_container_viewed: AdContainerViewedSubscriptionEvent;
285
- query_fetched: QueryFetchedEvent;
286
- query_submitted: QuerySubmittedEvent;
287
- input_cleared: InputClearedEvent;
288
- no_results_returned: NoResultsReturnedEvent;
289
- }
290
- export interface AdContainerRenderedSubscriptionEvent extends SubscriptionEvent {
291
- name: "ad_container_rendered";
292
- data: {
293
- adContainerId: string;
294
- adSource: SearchcraftAdSource;
295
- searchTerm: string;
296
- };
297
- }
298
- export interface AdContainerViewedSubscriptionEvent extends SubscriptionEvent {
299
- name: "ad_container_viewed";
300
- data: {
301
- adContainerId: string;
302
- adSource: SearchcraftAdSource;
303
- searchTerm: string;
304
- };
305
- }
306
- export interface QuerySubmittedEvent extends SubscriptionEvent {
307
- name: "query_submitted";
308
- data: {
309
- searchTerm: string;
310
- };
311
- }
312
- export interface QueryFetchedEvent extends SubscriptionEvent {
313
- name: "query_fetched";
314
- data: {
315
- searchTerm: string;
316
- };
317
- }
318
- export interface InputClearedEvent extends SubscriptionEvent {
319
- name: "input_cleared";
320
- }
321
- export interface NoResultsReturnedEvent extends SubscriptionEvent {
322
- name: "no_results_returned";
323
- }
324
- export type SubscriptionEventName = keyof SubscriptionEventMap;
325
- export type SubscriptionEventCallback<T extends SubscriptionEventName> = (event: SubscriptionEventMap[T]) => void;
326
- export type UnsubscribeFunction = () => void;
327
- export interface SubscriptionEvent {
328
- name: SubscriptionEventName;
329
- }
330
- /**
331
- * A data type representing an index field value, along with properties
332
- * describing how to format and display the index field value.
333
- */
334
- export type SearchResultFieldName = {
335
- /**
336
- * The index field name.
337
- */
338
- fieldName: string;
339
- /**
340
- * The data type to treat this index field as.
341
- */
342
- dataType: "text" | "date" | "number";
343
- /**
344
- * The locale to use when formatting dataType: `number`
345
- */
346
- numberFormatLocale?: string;
347
- /**
348
- * If it's a number, the number format to apply.
349
- * reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
350
- */
351
- numberFormatOptions?: Intl.NumberFormatOptions;
352
- /**
353
- * A scale factor to apply to a `number` value.
354
- */
355
- numberScale?: number;
356
- /**
357
- * TODO: Implement DateFormatOptions, for date formatting
358
- */
359
- dateFormatOptions?: unknown;
360
- };
361
- /**
362
- * A data type representing the mapping of index fields, for the purpose of rendering them
363
- * in search result item.
364
- */
365
- export type SearchResultMapping = {
366
- /**
367
- * The fields to map to.
368
- */
369
- fieldNames: SearchResultFieldName[];
370
- /**
371
- * The delimiter used to join them.
372
- */
373
- delimiter?: string;
374
- };
375
- export type SearchResultMappings = {
376
- body?: SearchResultMapping;
377
- buttonHref?: SearchResultMapping;
378
- containerHref?: SearchResultMapping;
379
- footer?: SearchResultMapping;
380
- imageSource?: SearchResultMapping;
381
- subtitle?: SearchResultMapping;
382
- title?: SearchResultMapping;
383
- };
384
- export type PopoverResultMappings = {
385
- title?: SearchResultMapping;
386
- subtitle?: SearchResultMapping;
387
- imageSource?: SearchResultMapping;
388
- imageAlt?: SearchResultMapping;
389
- href?: SearchResultMapping;
390
- };
391
- export interface FilterItem {
392
- type: "facets" | "dateRange" | "numericRange" | "exactMatchToggle" | "mostRecentToggle";
393
- label: string;
394
- options: object | null;
395
- }
396
- export interface FacetsFilterItem extends FilterItem {
397
- fieldName: string;
398
- type: "facets";
399
- options: {
400
- showSublevel: boolean;
401
- };
402
- }
403
- export interface NumericFilterItem extends FilterItem {
404
- fieldName: string;
405
- type: "numericRange";
406
- options: {
407
- min: number;
408
- max: number;
409
- granularity: number;
410
- };
411
- }
412
- export interface DateRangeFilterItem extends FilterItem {
413
- fieldName: string;
414
- type: "dateRange";
415
- options: {
416
- minDate: Date;
417
- maxDate: Date;
418
- granularity: "year" | "month" | "day" | "hour";
419
- };
420
- }
421
- export interface ExactMatchToggleFilterItem extends FilterItem {
422
- type: "exactMatchToggle";
423
- options: {
424
- subLabel?: string;
425
- };
426
- }
427
- export interface MostRecentToggleFilterItem extends FilterItem {
428
- type: "mostRecentToggle";
429
- options: {
430
- subLabel?: string;
431
- };
432
- }
433
- declare class AdClient {
434
- config: SearchcraftConfig;
435
- constructor(config: SearchcraftConfig);
436
- getAdsForSearchParams(_params: SearchParams): Promise<AdClientResponseItem[]>;
437
- onQuerySubmitted(_params: SearchParams): Promise<void>;
438
- onQueryFetched(_params: SearchParams, _response: SearchcraftResponse): Promise<void>;
439
- onInputCleared(): Promise<void>;
440
- onAdContainerRendered(_data: {
441
- adClientResponseItem?: AdClientResponseItem;
442
- adContainerId: string;
443
- adSource: SearchcraftAdSource;
444
- searchTerm: string;
445
- }): Promise<void>;
446
- onAdContainerViewed(_data: {
447
- adClientResponseItem?: AdClientResponseItem;
448
- adContainerId: string;
449
- adSource: SearchcraftAdSource;
450
- searchTerm: string;
451
- }): Promise<void>;
452
- }
453
- declare class MeasureClient {
454
- private measureRequestTimeout;
455
- private measureRequestsBatched;
456
- private config;
457
- private sdkInfo;
458
- private userId;
459
- private sessionId;
460
- constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo, userId: string);
461
- /**
462
- * Getter for the base url used by the /measure endpoints.
463
- */
464
- private get baseMeasureUrl();
465
- /**
466
- * Getter for the measure request user. Uses config values + navigator values.
467
- */
468
- private get measureRequestUser();
469
- /**
470
- * Sends a measure event to the `/measure/event` endpoint for analytics purposes.
471
- *
472
- * @param {MeasureEventName} eventName - Name of the event.
473
- * @param {Partial<MeasureRequestProperties>} properties - Additional properties to send with the event.
474
- * @param {Partial<MeasureRequestUser>} user - Additional user properites to send with the event.
475
- */
476
- sendMeasureEvent: (eventName: MeasureEventName, properties?: Partial<MeasureRequestProperties>, user?: Partial<MeasureRequestUser>) => void;
477
- }
478
- declare class SearchClient {
479
- private config;
480
- private userId;
481
- private parent;
482
- constructor(parent: SearchcraftCore, config: SearchcraftConfig, userId: string);
483
- /**
484
- * Getter for the base url used by the /search endpoint.
485
- */
486
- private get baseSearchUrl();
487
- /**
488
- * Performs a search operation.
489
- * @param {SearchParams} searchParams - The parameters for the search.
490
- */
491
- getSearchResponse: (searchParams: SearchParams) => Promise<SearchcraftResponse>;
492
- }
493
- declare class SearchcraftCore {
494
- config: SearchcraftConfig;
495
- measureClient: MeasureClient | undefined;
496
- searchClient: SearchClient | undefined;
497
- adClient: AdClient | undefined;
498
- userId: string;
499
- private requestTimeout;
500
- private subscriptionEvents;
501
- constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo);
502
- private initInputForms;
503
- /**
504
- * When changes happen in the DOM, we want to link any input forms found to the instance of the core.
505
- */
506
- private startObservingMutations;
507
- private initClients;
508
- emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
509
- subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
510
- /**
511
- * Called when a `<searchcraft-ad>` component is rendered
512
- */
513
- handleAdContainerRendered(data: {
514
- adClientResponseItem?: AdClientResponseItem;
515
- adContainerId: string;
516
- adSource: SearchcraftAdSource;
517
- searchTerm: string;
518
- }): void;
519
- /**
520
- * Called when a `<searchcraft-ad>` is viewed
521
- */
522
- handleAdContainerViewed(data: {
523
- adClientResponseItem?: AdClientResponseItem;
524
- adContainerId: string;
525
- adSource: SearchcraftAdSource;
526
- searchTerm: string;
527
- }): void;
528
- /**
529
- * Perform various actions when the input is cleared
530
- */
531
- handleInputCleared(): void;
532
- /**
533
- * Gets items from the SearchClient and the AdClient.
534
- */
535
- getItems: (searchParams: SearchParams, itemsCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (adClientResponseItems: AdClientResponseItem[]) => void) => void;
536
- }
537
- /**
538
- * Callable functions made available by the SearchcraftStore.
539
- */
540
- export interface SearchcraftStateFunctions {
541
- addFacetPathsForIndexField: (data: FacetPathsForIndexField) => void;
542
- addRangeValueForIndexField: (data: RangeValueForIndexField) => void;
543
- getSearchcraftInstance: () => SearchcraftCore | undefined;
544
- initialize: (searchcraft: unknown, debug?: boolean) => void;
545
- removeFacetPathsForIndexField: (fieldName: string) => void;
546
- removeRangeValueForIndexField: (fieldName: string) => void;
547
- resetFacetPaths: () => void;
548
- search: () => Promise<void>;
549
- setPopoverVisibility: (isVisible: boolean) => void;
550
- setSearchClientResponseItems: (results: SearchClientResponseItem[]) => void;
551
- setSearchResultsPage: (page: number) => void;
552
- setSearchResultsPerPage: (perPage: number) => void;
553
- setSearchTerm: (searchTerm: string) => void;
554
- setSearchMode: (mode: "fuzzy" | "exact") => void;
555
- setSortType: (type: "asc" | "desc") => void;
556
- }
557
- /**
558
- * Values stored in SearchcraftStore.
559
- */
560
- export interface SearchcraftStateValues {
561
- adClientResponseItems: AdClientResponseItem[];
562
- core: SearchcraftCore | undefined;
563
- logger: Logger | undefined;
564
- facetPathsForIndexFields: Record<string, FacetPathsForIndexField>;
565
- isPopoverVisible: boolean;
566
- isSearchInProgress: boolean;
567
- rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
568
- searchMode: "fuzzy" | "exact";
569
- searchClientResponseItems: SearchClientResponseItem[];
570
- searchResponseTimeTaken: number | undefined;
571
- searchResponseFacetPrime: FacetPrime | undefined;
572
- searchResultsCount: number;
573
- searchResultsPage: number;
574
- searchResultsPerPage: number;
575
- searchTerm: string;
576
- sortType: "asc" | "desc";
577
- }
578
- export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {
579
- }
580
- export declare const searchcraftStore: import("zustand").StoreApi<SearchcraftState>;
581
- export declare function parseCustomStyles(styles: string | Record<string, string>): Record<string, string>;
582
- export declare function serializeStyles(styles: Record<string, Record<string, string>>): string;
583
- export type SearchcraftSelectOption = {
584
- label: string;
585
- value: string | number;
586
- selected?: boolean;
587
- };
588
- export namespace Components {
589
- /**
590
- * An inline ad meant to be rendered in a list of search results.
591
- */
592
- interface SearchcraftAd {
593
- "adClientResponseItem"?: AdClientResponseItem;
594
- "adContainerId": string;
595
- "adSource": SearchcraftAdSource;
596
- }
597
- /**
598
- * This web component is designed to display detailed information for a single search result.
599
- * Once a query is submitted, the component formats and presents the result.
600
- * It is consumed within the `searchcraft-base-search-results` component.
601
- */
602
- interface SearchcraftBaseSearchResult {
603
- /**
604
- * The relationship between the current document and the link for the button rendered when containerHref is not present.
605
- */
606
- "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
607
- /**
608
- * Where to open the link for the button rendered when containerHref is not present.
609
- */
610
- "buttonTarget": "_blank" | "_self" | "_top" | "_parent";
611
- /**
612
- * The relationship between the current document and the link for the containing element.
613
- */
614
- "containerRel"?: "noreferrer" | "noopener" | "nofollow";
615
- /**
616
- * Where to open the link for the containing element.
617
- */
618
- "containerTarget": "_blank" | "_self" | "_top" | "_parent";
619
- /**
620
- * A custom styles object.
621
- */
622
- "customStyles"?: string;
623
- /**
624
- * The position in the document. Used with the "document_clicked" measure event.
625
- */
626
- "documentPosition": number;
627
- /**
628
- * The placement of the image.
629
- */
630
- "imagePlacement": "left" | "right";
631
- "item"?: SearchClientResponseItem;
632
- "searchResultMappings"?: SearchResultMappings;
633
- }
634
- /**
635
- * This web component is responsible for displaying the results of a search query.
636
- * Once a query is submitted, the component formats and presents an ordered list of the results.
637
- * ## Usage
638
- * ```html
639
- * <!-- index.html -->
640
- * <searchcraft-base-search-results
641
- * ad-interval="4"
642
- * place-ad-at-start="false"
643
- * result-image-placement="right"
644
- * />
645
- * ```
646
- * ```js
647
- * // index.js
648
- * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
649
- * baseSearchResults.searchResultMappings = containerHref: {
650
- * fieldNames: [
651
- * {
652
- * fieldName: 'canonical_link',
653
- * dataType: 'text',
654
- * },
655
- * ],
656
- * };
657
- * baseSearchResults.addEventListener('noResults', () => {
658
- * console.log('No search results found');
659
- * });
660
- * ```
661
- */
662
- interface SearchcraftBaseSearchResults {
663
- /**
664
- * The label for the button rendered when containerHref is not present for each result.
665
- */
666
- "buttonLabel"?: string;
667
- /**
668
- * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
669
- */
670
- "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
671
- /**
672
- * Where to open the link for the button rendered when containerHref is not present for each result.
673
- */
674
- "buttonTarget": "_blank" | "_self" | "_top" | "_parent";
675
- /**
676
- * The relationship between the current document and the link for the containing element for each result.
677
- */
678
- "containerRel"?: "noreferrer" | "noopener" | "nofollow";
679
- /**
680
- * Where to open the link for the containing element for each result.
681
- */
682
- "containerTarget": "_blank" | "_self" | "_top" | "_parent";
683
- /**
684
- * A custom styles object.
685
- */
686
- "customStylesForResults"?: string | Record<string, Record<string, string>>;
687
- /**
688
- * The placement of the image for each result.
689
- */
690
- "resultImagePlacement": "left" | "right";
691
- /**
692
- * Formats the content rendered for each result.
693
- */
694
- "searchResultMappings"?: SearchResultMappings;
695
- }
696
- /**
697
- * This web component represents a button to be consumed within the `search-input-form` component.
698
- * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
699
- * It is consumed within the `searchcraft-input-form` component.
700
- */
701
- interface SearchcraftButton {
702
- /**
703
- * Whether the button is disabled.
704
- */
705
- "disabled"?: boolean;
706
- /**
707
- * Controls the visual representation of the button.
708
- */
709
- "hierarchy"?: "primary" | "tertiary";
710
- /**
711
- * The icon element.
712
- */
713
- "icon"?: Element;
714
- /**
715
- * Should the button only display an icon.
716
- */
717
- "iconOnly"?: boolean;
718
- /**
719
- * The position of the icon.
720
- */
721
- "iconPosition"?: "left" | "right";
722
- /**
723
- * The label for the button.
724
- */
725
- "label": string;
726
- /**
727
- * The type of the button.
728
- */
729
- "type"?: "submit" | "reset" | "button";
730
- }
731
- /**
732
- * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
733
- * ## Usage
734
- * ```html
735
- * <!-- index.html -->
736
- * <searchcraft-error-message error-message="No search results found for query" />
737
- * ```
738
- */
739
- interface SearchcraftErrorMessage {
740
- /**
741
- * The error message.
742
- */
743
- "errorMessage"?: string;
744
- }
745
- /**
746
- * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
747
- * It is consumed within the `searchcraft-filter-panel`.
748
- * ## Usage
749
- * ```html
750
- * <!-- index.html -->
751
- * <searchcraft-facet-list field-name="title" />
752
- * ```
753
- * ```js
754
- * // index.js
755
- * const facetList = document.querySelector('searchcraft-facet-list');
756
- * facetList.addEventListener('facetSelectionUpdated', () => {
757
- * console.log('Facet selection updated');
758
- * });
759
- * ```
760
- */
761
- interface SearchcraftFacetList {
762
- /**
763
- * The name of the field where facets are applied.
764
- */
765
- "fieldName": string;
766
- }
767
- /**
768
- * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
769
- * ## Usage
770
- * ```html
771
- * <!-- index.html -->
772
- * <searchcraft-filter-panel />
773
- * ```
774
- */
775
- interface SearchcraftFilterPanel {
776
- /**
777
- * The items to filter.
778
- */
779
- "items": FilterItem[];
780
- }
781
- /**
782
- * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
783
- * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
784
- * ## Usage
785
- * ```html
786
- * <!-- index.html -->
787
- * <searchcraft-input-form placeholder-value="Search here" />
788
- * ```
789
- * ```js
790
- * // index.js
791
- * const searchInputForm = document.querySelector('searchcraft-input-form');
792
- * ```
793
- */
794
- interface SearchcraftInputForm {
795
- /**
796
- * Whether or not to automatically submit the search term when the input changes.
797
- */
798
- "autoSearch": boolean;
799
- /**
800
- * The label for the submit button.
801
- */
802
- "buttonLabel"?: string;
803
- /**
804
- * Where to place the search button.
805
- */
806
- "buttonPlacement": "left" | "right" | "none";
807
- "core"?: SearchcraftCore;
808
- /**
809
- * A custom styles object to be applied to the input element.
810
- */
811
- "customStyles": string | Record<string, string>;
812
- /**
813
- * The label rendered above the input.
814
- */
815
- "inputLabel"?: string;
816
- /**
817
- * The input element's placeholder value.
818
- */
819
- "placeholderValue": string;
820
- }
821
- /**
822
- * This web component serves as the input label for the searchcraft-input-form component.
823
- * ## Usage
824
- * ```html
825
- * <!-- index.html -->
826
- * <searchcraft-input-label label="Search" />
827
- * ```
828
- */
829
- interface SearchcraftInputLabel {
830
- /**
831
- * The classname applied to the label element.
832
- */
833
- "inputLabelClassName"?: string | undefined;
834
- "label": string;
835
- }
836
- /**
837
- * This web component is designed to facilitate pagination of search results.
838
- * Once a query is submitted, calculates the number for pages.
839
- * ## Usage
840
- * ```html
841
- * <!-- index.html -->
842
- * <searchcraft-pagination />
843
- * ```
844
- */
845
- interface SearchcraftPagination {
846
- /**
847
- * The custom styles object.
848
- */
849
- "customStyles"?: string;
850
- }
851
- /**
852
- * Renders a button which, when clicked, turns on popover visibility.
853
- */
854
- interface SearchcraftPopoverButton {
855
- }
856
- /**
857
- * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
858
- * ## Usage
859
- * ```html
860
- * <!-- index.html -->
861
- * <searchcraft-popover-form type="fullscreen" />
862
- * ```
863
- * ```js
864
- * // index.js
865
- * const popoverForm = document.querySelector('searchcraft-popover-form');
866
- * popoverForm.popoverResultMappings = {
867
- * containerHref: {
868
- * fieldNames: [
869
- * {
870
- * fieldName: 'canonical_link',
871
- * dataType: 'text',
872
- * },
873
- * ],
874
- * };
875
- * ```
876
- */
877
- interface SearchcraftPopoverForm {
878
- /**
879
- * The hotkey that activates the popover.
880
- */
881
- "hotkey": string;
882
- /**
883
- * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
884
- */
885
- "hotkeyModifier": "ctrl" | "meta" | "alt" | "option";
886
- /**
887
- * Formats the content rendered for each result.
888
- */
889
- "popoverResultMappings"?: PopoverResultMappings;
890
- /**
891
- * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
892
- */
893
- "type": "inline" | "fullscreen" | "modal";
894
- }
895
- /**
896
- * A single list item rendered in a searchcraft-popover-list-view.
897
- */
898
- interface SearchcraftPopoverListItem {
899
- /**
900
- * The document position relative to the search results (For Measure)
901
- */
902
- "documentPosition": number;
903
- "item": SearchClientResponseItem | undefined;
904
- "popoverResultMappings": PopoverResultMappings | undefined;
905
- }
906
- /**
907
- * This web component is designed to display a list of results within a popover interface.
908
- * It is consumed within the `searchcraft-popover-form` component.
909
- * ## Usage
910
- * ```html
911
- * <!-- index.html -->
912
- * <searchcraft-popover-list-view />
913
- * ```
914
- */
915
- interface SearchcraftPopoverListView {
916
- "adClientResponseItems": AdClientResponseItem[] | undefined;
917
- /**
918
- * The mappings that define how the data in the documents are mapped to the list-view-item elements.
919
- */
920
- "popoverResultMappings": PopoverResultMappings | undefined;
921
- /**
922
- * The items to render in the list view.
923
- */
924
- "searchClientResponseItems": SearchClientResponseItem[] | undefined;
925
- "searchResultsPage": number;
926
- "searchResultsPerPage": number;
927
- }
928
- /**
929
- * This web component is designed to display the number of results returned from a search query.
930
- * ## Usage
931
- * ```html
932
- * <!-- index.html -->
933
- * <script>
934
- * const resultsInfo = document.querySelector('searchcraft-results-info');
935
- * resultsInfo.customFormatter = (range, count, responseTime) =>
936
- * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
937
- * </script>
938
- * <searchcraft-results-info />
939
- * ```
940
- */
941
- interface SearchcraftResultsInfo {
942
- /**
943
- * The custom formatter for the resulting string.
944
- * @example ```ts resultsInfo.customFormatter = (range, count, responseTime) => `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`; ```
945
- */
946
- "customFormatter"?: (range: [
947
- string,
948
- string
949
- ], count: string, responseTime: string) => void;
950
- /**
951
- * The custom styles object.
952
- */
953
- "customStyles"?: string;
954
- }
955
- /**
956
- * This web component is designed to choose the number of search results displayed.
957
- * ## Usage
958
- * ```html
959
- * <!-- index.html -->
960
- * <searchcraft-search-results-per-page increment="20" />
961
- * ```
962
- */
963
- interface SearchcraftSearchResultsPerPage {
964
- /**
965
- * The custom styles object.
966
- */
967
- "customStyles"?: string;
968
- /**
969
- * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
970
- */
971
- "increment": string | number;
972
- }
973
- /**
974
- * This web component is designed to allow users to select between a group of options.
975
- * ## Usage
976
- * ```html
977
- * <!-- index.html -->
978
- * <searchcraft-select
979
- * inputId="searchcraft-select"
980
- * name="searchcraft-select"
981
- * options="[{ label: 'label', value: 'value' }]"
982
- * />
983
- * ```
984
- */
985
- interface SearchcraftSelect {
986
- /**
987
- * The caption displayed below the select input.
988
- */
989
- "caption"?: string;
990
- /**
991
- * A custom styles object.
992
- */
993
- "customStyles"?: string;
994
- /**
995
- * Whether the select input is disabled.
996
- */
997
- "disabled"?: boolean;
998
- /**
999
- * The ID for the select input.
1000
- */
1001
- "inputId": string;
1002
- /**
1003
- * The label of the select input.
1004
- */
1005
- "label"?: string;
1006
- /**
1007
- * The ID for the label of the select input.
1008
- */
1009
- "labelId"?: string;
1010
- /**
1011
- * The name of the select input.
1012
- */
1013
- "name": string;
1014
- /**
1015
- * The options for the select input.
1016
- */
1017
- "options": SearchcraftSelectOption[] | string;
1018
- }
1019
- /**
1020
- * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
1021
- * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
1022
- * It is consumed by the `searchcraft-filter-panel` component.
1023
- */
1024
- interface SearchcraftSlider {
1025
- /**
1026
- * The type of data allowed.
1027
- */
1028
- "dataType": "number" | "date";
1029
- /**
1030
- * The granularity that the value must adhere to.
1031
- */
1032
- "granularity": number;
1033
- /**
1034
- * The maximum value allowed.
1035
- */
1036
- "max": number;
1037
- /**
1038
- * The minimum value allowed.
1039
- */
1040
- "min": number;
1041
- }
1042
- /**
1043
- * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
1044
- * It does not render anything visible, its only function is to manage the css styles on the page.
1045
- * ## Usage
1046
- * ```html
1047
- * <!-- index.html -->
1048
- * <searchcraft-theme theme="light" custom-theme="{}" />
1049
- * ```
1050
- */
1051
- interface SearchcraftTheme {
1052
- /**
1053
- * The custom theme configuration object.
1054
- */
1055
- "customTheme"?: string;
1056
- /**
1057
- * The name of the theme.
1058
- */
1059
- "theme"?: string;
1060
- }
1061
- /**
1062
- * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
1063
- * It is consumed within the `searchcraft-filter-panel` component.
1064
- */
1065
- interface SearchcraftToggleButton {
1066
- /**
1067
- * The label.
1068
- */
1069
- "label": string;
1070
- /**
1071
- * The secondary label displayed below the main label.
1072
- */
1073
- "subLabel": string | undefined;
1074
- }
1075
- }
1076
- export interface SearchcraftButtonCustomEvent<T> extends CustomEvent<T> {
1077
- detail: T;
1078
- target: HTMLSearchcraftButtonElement;
1079
- }
1080
- export interface SearchcraftFacetListCustomEvent<T> extends CustomEvent<T> {
1081
- detail: T;
1082
- target: HTMLSearchcraftFacetListElement;
1083
- }
1084
- export interface SearchcraftInputFormCustomEvent<T> extends CustomEvent<T> {
1085
- detail: T;
1086
- target: HTMLSearchcraftInputFormElement;
1087
- }
1088
- export interface SearchcraftSelectCustomEvent<T> extends CustomEvent<T> {
1089
- detail: T;
1090
- target: HTMLSearchcraftSelectElement;
1091
- }
1092
- export interface SearchcraftSliderCustomEvent<T> extends CustomEvent<T> {
1093
- detail: T;
1094
- target: HTMLSearchcraftSliderElement;
1095
- }
1096
- export interface SearchcraftToggleButtonCustomEvent<T> extends CustomEvent<T> {
1097
- detail: T;
1098
- target: HTMLSearchcraftToggleButtonElement;
1099
- }
1100
- declare global {
1101
- /**
1102
- * An inline ad meant to be rendered in a list of search results.
1103
- */
1104
- interface HTMLSearchcraftAdElement extends Components.SearchcraftAd, HTMLStencilElement {
1105
- }
1106
- var HTMLSearchcraftAdElement: {
1107
- prototype: HTMLSearchcraftAdElement;
1108
- new (): HTMLSearchcraftAdElement;
1109
- };
1110
- /**
1111
- * This web component is designed to display detailed information for a single search result.
1112
- * Once a query is submitted, the component formats and presents the result.
1113
- * It is consumed within the `searchcraft-base-search-results` component.
1114
- */
1115
- interface HTMLSearchcraftBaseSearchResultElement extends Components.SearchcraftBaseSearchResult, HTMLStencilElement {
1116
- }
1117
- var HTMLSearchcraftBaseSearchResultElement: {
1118
- prototype: HTMLSearchcraftBaseSearchResultElement;
1119
- new (): HTMLSearchcraftBaseSearchResultElement;
1120
- };
1121
- /**
1122
- * This web component is responsible for displaying the results of a search query.
1123
- * Once a query is submitted, the component formats and presents an ordered list of the results.
1124
- * ## Usage
1125
- * ```html
1126
- * <!-- index.html -->
1127
- * <searchcraft-base-search-results
1128
- * ad-interval="4"
1129
- * place-ad-at-start="false"
1130
- * result-image-placement="right"
1131
- * />
1132
- * ```
1133
- * ```js
1134
- * // index.js
1135
- * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
1136
- * baseSearchResults.searchResultMappings = containerHref: {
1137
- * fieldNames: [
1138
- * {
1139
- * fieldName: 'canonical_link',
1140
- * dataType: 'text',
1141
- * },
1142
- * ],
1143
- * };
1144
- * baseSearchResults.addEventListener('noResults', () => {
1145
- * console.log('No search results found');
1146
- * });
1147
- * ```
1148
- */
1149
- interface HTMLSearchcraftBaseSearchResultsElement extends Components.SearchcraftBaseSearchResults, HTMLStencilElement {
1150
- }
1151
- var HTMLSearchcraftBaseSearchResultsElement: {
1152
- prototype: HTMLSearchcraftBaseSearchResultsElement;
1153
- new (): HTMLSearchcraftBaseSearchResultsElement;
1154
- };
1155
- interface HTMLSearchcraftButtonElementEventMap {
1156
- "buttonClick": void;
1157
- }
1158
- /**
1159
- * This web component represents a button to be consumed within the `search-input-form` component.
1160
- * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
1161
- * It is consumed within the `searchcraft-input-form` component.
1162
- */
1163
- interface HTMLSearchcraftButtonElement extends Components.SearchcraftButton, HTMLStencilElement {
1164
- addEventListener<K extends keyof HTMLSearchcraftButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftButtonElement, ev: SearchcraftButtonCustomEvent<HTMLSearchcraftButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1165
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1166
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1167
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1168
- removeEventListener<K extends keyof HTMLSearchcraftButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftButtonElement, ev: SearchcraftButtonCustomEvent<HTMLSearchcraftButtonElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1169
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1170
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1171
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1172
- }
1173
- var HTMLSearchcraftButtonElement: {
1174
- prototype: HTMLSearchcraftButtonElement;
1175
- new (): HTMLSearchcraftButtonElement;
1176
- };
1177
- /**
1178
- * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
1179
- * ## Usage
1180
- * ```html
1181
- * <!-- index.html -->
1182
- * <searchcraft-error-message error-message="No search results found for query" />
1183
- * ```
1184
- */
1185
- interface HTMLSearchcraftErrorMessageElement extends Components.SearchcraftErrorMessage, HTMLStencilElement {
1186
- }
1187
- var HTMLSearchcraftErrorMessageElement: {
1188
- prototype: HTMLSearchcraftErrorMessageElement;
1189
- new (): HTMLSearchcraftErrorMessageElement;
1190
- };
1191
- interface HTMLSearchcraftFacetListElementEventMap {
1192
- "facetSelectionUpdated": {
1193
- paths: string[];
1194
- };
1195
- }
1196
- /**
1197
- * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
1198
- * It is consumed within the `searchcraft-filter-panel`.
1199
- * ## Usage
1200
- * ```html
1201
- * <!-- index.html -->
1202
- * <searchcraft-facet-list field-name="title" />
1203
- * ```
1204
- * ```js
1205
- * // index.js
1206
- * const facetList = document.querySelector('searchcraft-facet-list');
1207
- * facetList.addEventListener('facetSelectionUpdated', () => {
1208
- * console.log('Facet selection updated');
1209
- * });
1210
- * ```
1211
- */
1212
- interface HTMLSearchcraftFacetListElement extends Components.SearchcraftFacetList, HTMLStencilElement {
1213
- addEventListener<K extends keyof HTMLSearchcraftFacetListElementEventMap>(type: K, listener: (this: HTMLSearchcraftFacetListElement, ev: SearchcraftFacetListCustomEvent<HTMLSearchcraftFacetListElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1214
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1215
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1216
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1217
- removeEventListener<K extends keyof HTMLSearchcraftFacetListElementEventMap>(type: K, listener: (this: HTMLSearchcraftFacetListElement, ev: SearchcraftFacetListCustomEvent<HTMLSearchcraftFacetListElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1218
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1219
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1220
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1221
- }
1222
- var HTMLSearchcraftFacetListElement: {
1223
- prototype: HTMLSearchcraftFacetListElement;
1224
- new (): HTMLSearchcraftFacetListElement;
1225
- };
1226
- /**
1227
- * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
1228
- * ## Usage
1229
- * ```html
1230
- * <!-- index.html -->
1231
- * <searchcraft-filter-panel />
1232
- * ```
1233
- */
1234
- interface HTMLSearchcraftFilterPanelElement extends Components.SearchcraftFilterPanel, HTMLStencilElement {
1235
- }
1236
- var HTMLSearchcraftFilterPanelElement: {
1237
- prototype: HTMLSearchcraftFilterPanelElement;
1238
- new (): HTMLSearchcraftFilterPanelElement;
1239
- };
1240
- interface HTMLSearchcraftInputFormElementEventMap {
1241
- "inputFocus": void;
1242
- "inputBlur": void;
1243
- "inputInit": void;
1244
- }
1245
- /**
1246
- * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
1247
- * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
1248
- * ## Usage
1249
- * ```html
1250
- * <!-- index.html -->
1251
- * <searchcraft-input-form placeholder-value="Search here" />
1252
- * ```
1253
- * ```js
1254
- * // index.js
1255
- * const searchInputForm = document.querySelector('searchcraft-input-form');
1256
- * ```
1257
- */
1258
- interface HTMLSearchcraftInputFormElement extends Components.SearchcraftInputForm, HTMLStencilElement {
1259
- addEventListener<K extends keyof HTMLSearchcraftInputFormElementEventMap>(type: K, listener: (this: HTMLSearchcraftInputFormElement, ev: SearchcraftInputFormCustomEvent<HTMLSearchcraftInputFormElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1260
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1261
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1262
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1263
- removeEventListener<K extends keyof HTMLSearchcraftInputFormElementEventMap>(type: K, listener: (this: HTMLSearchcraftInputFormElement, ev: SearchcraftInputFormCustomEvent<HTMLSearchcraftInputFormElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1264
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1265
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1266
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1267
- }
1268
- var HTMLSearchcraftInputFormElement: {
1269
- prototype: HTMLSearchcraftInputFormElement;
1270
- new (): HTMLSearchcraftInputFormElement;
1271
- };
1272
- /**
1273
- * This web component serves as the input label for the searchcraft-input-form component.
1274
- * ## Usage
1275
- * ```html
1276
- * <!-- index.html -->
1277
- * <searchcraft-input-label label="Search" />
1278
- * ```
1279
- */
1280
- interface HTMLSearchcraftInputLabelElement extends Components.SearchcraftInputLabel, HTMLStencilElement {
1281
- }
1282
- var HTMLSearchcraftInputLabelElement: {
1283
- prototype: HTMLSearchcraftInputLabelElement;
1284
- new (): HTMLSearchcraftInputLabelElement;
1285
- };
1286
- /**
1287
- * This web component is designed to facilitate pagination of search results.
1288
- * Once a query is submitted, calculates the number for pages.
1289
- * ## Usage
1290
- * ```html
1291
- * <!-- index.html -->
1292
- * <searchcraft-pagination />
1293
- * ```
1294
- */
1295
- interface HTMLSearchcraftPaginationElement extends Components.SearchcraftPagination, HTMLStencilElement {
1296
- }
1297
- var HTMLSearchcraftPaginationElement: {
1298
- prototype: HTMLSearchcraftPaginationElement;
1299
- new (): HTMLSearchcraftPaginationElement;
1300
- };
1301
- /**
1302
- * Renders a button which, when clicked, turns on popover visibility.
1303
- */
1304
- interface HTMLSearchcraftPopoverButtonElement extends Components.SearchcraftPopoverButton, HTMLStencilElement {
1305
- }
1306
- var HTMLSearchcraftPopoverButtonElement: {
1307
- prototype: HTMLSearchcraftPopoverButtonElement;
1308
- new (): HTMLSearchcraftPopoverButtonElement;
1309
- };
1310
- /**
1311
- * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
1312
- * ## Usage
1313
- * ```html
1314
- * <!-- index.html -->
1315
- * <searchcraft-popover-form type="fullscreen" />
1316
- * ```
1317
- * ```js
1318
- * // index.js
1319
- * const popoverForm = document.querySelector('searchcraft-popover-form');
1320
- * popoverForm.popoverResultMappings = {
1321
- * containerHref: {
1322
- * fieldNames: [
1323
- * {
1324
- * fieldName: 'canonical_link',
1325
- * dataType: 'text',
1326
- * },
1327
- * ],
1328
- * };
1329
- * ```
1330
- */
1331
- interface HTMLSearchcraftPopoverFormElement extends Components.SearchcraftPopoverForm, HTMLStencilElement {
1332
- }
1333
- var HTMLSearchcraftPopoverFormElement: {
1334
- prototype: HTMLSearchcraftPopoverFormElement;
1335
- new (): HTMLSearchcraftPopoverFormElement;
1336
- };
1337
- /**
1338
- * A single list item rendered in a searchcraft-popover-list-view.
1339
- */
1340
- interface HTMLSearchcraftPopoverListItemElement extends Components.SearchcraftPopoverListItem, HTMLStencilElement {
1341
- }
1342
- var HTMLSearchcraftPopoverListItemElement: {
1343
- prototype: HTMLSearchcraftPopoverListItemElement;
1344
- new (): HTMLSearchcraftPopoverListItemElement;
1345
- };
1346
- /**
1347
- * This web component is designed to display a list of results within a popover interface.
1348
- * It is consumed within the `searchcraft-popover-form` component.
1349
- * ## Usage
1350
- * ```html
1351
- * <!-- index.html -->
1352
- * <searchcraft-popover-list-view />
1353
- * ```
1354
- */
1355
- interface HTMLSearchcraftPopoverListViewElement extends Components.SearchcraftPopoverListView, HTMLStencilElement {
1356
- }
1357
- var HTMLSearchcraftPopoverListViewElement: {
1358
- prototype: HTMLSearchcraftPopoverListViewElement;
1359
- new (): HTMLSearchcraftPopoverListViewElement;
1360
- };
1361
- /**
1362
- * This web component is designed to display the number of results returned from a search query.
1363
- * ## Usage
1364
- * ```html
1365
- * <!-- index.html -->
1366
- * <script>
1367
- * const resultsInfo = document.querySelector('searchcraft-results-info');
1368
- * resultsInfo.customFormatter = (range, count, responseTime) =>
1369
- * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
1370
- * </script>
1371
- * <searchcraft-results-info />
1372
- * ```
1373
- */
1374
- interface HTMLSearchcraftResultsInfoElement extends Components.SearchcraftResultsInfo, HTMLStencilElement {
1375
- }
1376
- var HTMLSearchcraftResultsInfoElement: {
1377
- prototype: HTMLSearchcraftResultsInfoElement;
1378
- new (): HTMLSearchcraftResultsInfoElement;
1379
- };
1380
- /**
1381
- * This web component is designed to choose the number of search results displayed.
1382
- * ## Usage
1383
- * ```html
1384
- * <!-- index.html -->
1385
- * <searchcraft-search-results-per-page increment="20" />
1386
- * ```
1387
- */
1388
- interface HTMLSearchcraftSearchResultsPerPageElement extends Components.SearchcraftSearchResultsPerPage, HTMLStencilElement {
1389
- }
1390
- var HTMLSearchcraftSearchResultsPerPageElement: {
1391
- prototype: HTMLSearchcraftSearchResultsPerPageElement;
1392
- new (): HTMLSearchcraftSearchResultsPerPageElement;
1393
- };
1394
- interface HTMLSearchcraftSelectElementEventMap {
1395
- "selectChange": string;
1396
- }
1397
- /**
1398
- * This web component is designed to allow users to select between a group of options.
1399
- * ## Usage
1400
- * ```html
1401
- * <!-- index.html -->
1402
- * <searchcraft-select
1403
- * inputId="searchcraft-select"
1404
- * name="searchcraft-select"
1405
- * options="[{ label: 'label', value: 'value' }]"
1406
- * />
1407
- * ```
1408
- */
1409
- interface HTMLSearchcraftSelectElement extends Components.SearchcraftSelect, HTMLStencilElement {
1410
- addEventListener<K extends keyof HTMLSearchcraftSelectElementEventMap>(type: K, listener: (this: HTMLSearchcraftSelectElement, ev: SearchcraftSelectCustomEvent<HTMLSearchcraftSelectElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1411
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1412
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1413
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1414
- removeEventListener<K extends keyof HTMLSearchcraftSelectElementEventMap>(type: K, listener: (this: HTMLSearchcraftSelectElement, ev: SearchcraftSelectCustomEvent<HTMLSearchcraftSelectElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1415
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1416
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1417
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1418
- }
1419
- var HTMLSearchcraftSelectElement: {
1420
- prototype: HTMLSearchcraftSelectElement;
1421
- new (): HTMLSearchcraftSelectElement;
1422
- };
1423
- interface HTMLSearchcraftSliderElementEventMap {
1424
- "rangeChanged": any;
1425
- }
1426
- /**
1427
- * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
1428
- * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
1429
- * It is consumed by the `searchcraft-filter-panel` component.
1430
- */
1431
- interface HTMLSearchcraftSliderElement extends Components.SearchcraftSlider, HTMLStencilElement {
1432
- addEventListener<K extends keyof HTMLSearchcraftSliderElementEventMap>(type: K, listener: (this: HTMLSearchcraftSliderElement, ev: SearchcraftSliderCustomEvent<HTMLSearchcraftSliderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1433
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1434
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1435
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1436
- removeEventListener<K extends keyof HTMLSearchcraftSliderElementEventMap>(type: K, listener: (this: HTMLSearchcraftSliderElement, ev: SearchcraftSliderCustomEvent<HTMLSearchcraftSliderElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1437
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1438
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1439
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1440
- }
1441
- var HTMLSearchcraftSliderElement: {
1442
- prototype: HTMLSearchcraftSliderElement;
1443
- new (): HTMLSearchcraftSliderElement;
1444
- };
1445
- /**
1446
- * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
1447
- * It does not render anything visible, its only function is to manage the css styles on the page.
1448
- * ## Usage
1449
- * ```html
1450
- * <!-- index.html -->
1451
- * <searchcraft-theme theme="light" custom-theme="{}" />
1452
- * ```
1453
- */
1454
- interface HTMLSearchcraftThemeElement extends Components.SearchcraftTheme, HTMLStencilElement {
1455
- }
1456
- var HTMLSearchcraftThemeElement: {
1457
- prototype: HTMLSearchcraftThemeElement;
1458
- new (): HTMLSearchcraftThemeElement;
1459
- };
1460
- interface HTMLSearchcraftToggleButtonElementEventMap {
1461
- "toggleUpdated": boolean;
1462
- }
1463
- /**
1464
- * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
1465
- * It is consumed within the `searchcraft-filter-panel` component.
1466
- */
1467
- interface HTMLSearchcraftToggleButtonElement extends Components.SearchcraftToggleButton, HTMLStencilElement {
1468
- addEventListener<K extends keyof HTMLSearchcraftToggleButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftToggleButtonElement, ev: SearchcraftToggleButtonCustomEvent<HTMLSearchcraftToggleButtonElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1469
- addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1470
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1471
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1472
- removeEventListener<K extends keyof HTMLSearchcraftToggleButtonElementEventMap>(type: K, listener: (this: HTMLSearchcraftToggleButtonElement, ev: SearchcraftToggleButtonCustomEvent<HTMLSearchcraftToggleButtonElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1473
- removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1474
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1475
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1476
- }
1477
- var HTMLSearchcraftToggleButtonElement: {
1478
- prototype: HTMLSearchcraftToggleButtonElement;
1479
- new (): HTMLSearchcraftToggleButtonElement;
1480
- };
1481
- interface HTMLElementTagNameMap {
1482
- "searchcraft-ad": HTMLSearchcraftAdElement;
1483
- "searchcraft-base-search-result": HTMLSearchcraftBaseSearchResultElement;
1484
- "searchcraft-base-search-results": HTMLSearchcraftBaseSearchResultsElement;
1485
- "searchcraft-button": HTMLSearchcraftButtonElement;
1486
- "searchcraft-error-message": HTMLSearchcraftErrorMessageElement;
1487
- "searchcraft-facet-list": HTMLSearchcraftFacetListElement;
1488
- "searchcraft-filter-panel": HTMLSearchcraftFilterPanelElement;
1489
- "searchcraft-input-form": HTMLSearchcraftInputFormElement;
1490
- "searchcraft-input-label": HTMLSearchcraftInputLabelElement;
1491
- "searchcraft-pagination": HTMLSearchcraftPaginationElement;
1492
- "searchcraft-popover-button": HTMLSearchcraftPopoverButtonElement;
1493
- "searchcraft-popover-form": HTMLSearchcraftPopoverFormElement;
1494
- "searchcraft-popover-list-item": HTMLSearchcraftPopoverListItemElement;
1495
- "searchcraft-popover-list-view": HTMLSearchcraftPopoverListViewElement;
1496
- "searchcraft-results-info": HTMLSearchcraftResultsInfoElement;
1497
- "searchcraft-search-results-per-page": HTMLSearchcraftSearchResultsPerPageElement;
1498
- "searchcraft-select": HTMLSearchcraftSelectElement;
1499
- "searchcraft-slider": HTMLSearchcraftSliderElement;
1500
- "searchcraft-theme": HTMLSearchcraftThemeElement;
1501
- "searchcraft-toggle-button": HTMLSearchcraftToggleButtonElement;
1502
- }
1503
- }
1504
- declare namespace LocalJSX {
1505
- /**
1506
- * An inline ad meant to be rendered in a list of search results.
1507
- */
1508
- interface SearchcraftAd {
1509
- "adClientResponseItem"?: AdClientResponseItem;
1510
- "adContainerId"?: string;
1511
- "adSource"?: SearchcraftAdSource;
1512
- }
1513
- /**
1514
- * This web component is designed to display detailed information for a single search result.
1515
- * Once a query is submitted, the component formats and presents the result.
1516
- * It is consumed within the `searchcraft-base-search-results` component.
1517
- */
1518
- interface SearchcraftBaseSearchResult {
1519
- /**
1520
- * The relationship between the current document and the link for the button rendered when containerHref is not present.
1521
- */
1522
- "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
1523
- /**
1524
- * Where to open the link for the button rendered when containerHref is not present.
1525
- */
1526
- "buttonTarget"?: "_blank" | "_self" | "_top" | "_parent";
1527
- /**
1528
- * The relationship between the current document and the link for the containing element.
1529
- */
1530
- "containerRel"?: "noreferrer" | "noopener" | "nofollow";
1531
- /**
1532
- * Where to open the link for the containing element.
1533
- */
1534
- "containerTarget"?: "_blank" | "_self" | "_top" | "_parent";
1535
- /**
1536
- * A custom styles object.
1537
- */
1538
- "customStyles"?: string;
1539
- /**
1540
- * The position in the document. Used with the "document_clicked" measure event.
1541
- */
1542
- "documentPosition"?: number;
1543
- /**
1544
- * The placement of the image.
1545
- */
1546
- "imagePlacement"?: "left" | "right";
1547
- "item"?: SearchClientResponseItem;
1548
- "searchResultMappings"?: SearchResultMappings;
1549
- }
1550
- /**
1551
- * This web component is responsible for displaying the results of a search query.
1552
- * Once a query is submitted, the component formats and presents an ordered list of the results.
1553
- * ## Usage
1554
- * ```html
1555
- * <!-- index.html -->
1556
- * <searchcraft-base-search-results
1557
- * ad-interval="4"
1558
- * place-ad-at-start="false"
1559
- * result-image-placement="right"
1560
- * />
1561
- * ```
1562
- * ```js
1563
- * // index.js
1564
- * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
1565
- * baseSearchResults.searchResultMappings = containerHref: {
1566
- * fieldNames: [
1567
- * {
1568
- * fieldName: 'canonical_link',
1569
- * dataType: 'text',
1570
- * },
1571
- * ],
1572
- * };
1573
- * baseSearchResults.addEventListener('noResults', () => {
1574
- * console.log('No search results found');
1575
- * });
1576
- * ```
1577
- */
1578
- interface SearchcraftBaseSearchResults {
1579
- /**
1580
- * The label for the button rendered when containerHref is not present for each result.
1581
- */
1582
- "buttonLabel"?: string;
1583
- /**
1584
- * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
1585
- */
1586
- "buttonRel"?: "noreferrer" | "noopener" | "nofollow";
1587
- /**
1588
- * Where to open the link for the button rendered when containerHref is not present for each result.
1589
- */
1590
- "buttonTarget"?: "_blank" | "_self" | "_top" | "_parent";
1591
- /**
1592
- * The relationship between the current document and the link for the containing element for each result.
1593
- */
1594
- "containerRel"?: "noreferrer" | "noopener" | "nofollow";
1595
- /**
1596
- * Where to open the link for the containing element for each result.
1597
- */
1598
- "containerTarget"?: "_blank" | "_self" | "_top" | "_parent";
1599
- /**
1600
- * A custom styles object.
1601
- */
1602
- "customStylesForResults"?: string | Record<string, Record<string, string>>;
1603
- /**
1604
- * The placement of the image for each result.
1605
- */
1606
- "resultImagePlacement"?: "left" | "right";
1607
- /**
1608
- * Formats the content rendered for each result.
1609
- */
1610
- "searchResultMappings"?: SearchResultMappings;
1611
- }
1612
- /**
1613
- * This web component represents a button to be consumed within the `search-input-form` component.
1614
- * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
1615
- * It is consumed within the `searchcraft-input-form` component.
1616
- */
1617
- interface SearchcraftButton {
1618
- /**
1619
- * Whether the button is disabled.
1620
- */
1621
- "disabled"?: boolean;
1622
- /**
1623
- * Controls the visual representation of the button.
1624
- */
1625
- "hierarchy"?: "primary" | "tertiary";
1626
- /**
1627
- * The icon element.
1628
- */
1629
- "icon"?: Element;
1630
- /**
1631
- * Should the button only display an icon.
1632
- */
1633
- "iconOnly"?: boolean;
1634
- /**
1635
- * The position of the icon.
1636
- */
1637
- "iconPosition"?: "left" | "right";
1638
- /**
1639
- * The label for the button.
1640
- */
1641
- "label"?: string;
1642
- /**
1643
- * The event fired when the button is clicked.
1644
- */
1645
- "onButtonClick"?: (event: SearchcraftButtonCustomEvent<void>) => void;
1646
- /**
1647
- * The type of the button.
1648
- */
1649
- "type"?: "submit" | "reset" | "button";
1650
- }
1651
- /**
1652
- * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
1653
- * ## Usage
1654
- * ```html
1655
- * <!-- index.html -->
1656
- * <searchcraft-error-message error-message="No search results found for query" />
1657
- * ```
1658
- */
1659
- interface SearchcraftErrorMessage {
1660
- /**
1661
- * The error message.
1662
- */
1663
- "errorMessage"?: string;
1664
- }
1665
- /**
1666
- * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
1667
- * It is consumed within the `searchcraft-filter-panel`.
1668
- * ## Usage
1669
- * ```html
1670
- * <!-- index.html -->
1671
- * <searchcraft-facet-list field-name="title" />
1672
- * ```
1673
- * ```js
1674
- * // index.js
1675
- * const facetList = document.querySelector('searchcraft-facet-list');
1676
- * facetList.addEventListener('facetSelectionUpdated', () => {
1677
- * console.log('Facet selection updated');
1678
- * });
1679
- * ```
1680
- */
1681
- interface SearchcraftFacetList {
1682
- /**
1683
- * The name of the field where facets are applied.
1684
- */
1685
- "fieldName"?: string;
1686
- /**
1687
- * When the facets are updated.
1688
- */
1689
- "onFacetSelectionUpdated"?: (event: SearchcraftFacetListCustomEvent<{
1690
- paths: string[];
1691
- }>) => void;
1692
- }
1693
- /**
1694
- * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
1695
- * ## Usage
1696
- * ```html
1697
- * <!-- index.html -->
1698
- * <searchcraft-filter-panel />
1699
- * ```
1700
- */
1701
- interface SearchcraftFilterPanel {
1702
- /**
1703
- * The items to filter.
1704
- */
1705
- "items"?: FilterItem[];
1706
- }
1707
- /**
1708
- * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
1709
- * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
1710
- * ## Usage
1711
- * ```html
1712
- * <!-- index.html -->
1713
- * <searchcraft-input-form placeholder-value="Search here" />
1714
- * ```
1715
- * ```js
1716
- * // index.js
1717
- * const searchInputForm = document.querySelector('searchcraft-input-form');
1718
- * ```
1719
- */
1720
- interface SearchcraftInputForm {
1721
- /**
1722
- * Whether or not to automatically submit the search term when the input changes.
1723
- */
1724
- "autoSearch"?: boolean;
1725
- /**
1726
- * The label for the submit button.
1727
- */
1728
- "buttonLabel"?: string;
1729
- /**
1730
- * Where to place the search button.
1731
- */
1732
- "buttonPlacement"?: "left" | "right" | "none";
1733
- "core"?: SearchcraftCore;
1734
- /**
1735
- * A custom styles object to be applied to the input element.
1736
- */
1737
- "customStyles"?: string | Record<string, string>;
1738
- /**
1739
- * The label rendered above the input.
1740
- */
1741
- "inputLabel"?: string;
1742
- /**
1743
- * When the input becomes unfocused.
1744
- */
1745
- "onInputBlur"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1746
- /**
1747
- * When the input becomes focused.
1748
- */
1749
- "onInputFocus"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1750
- /**
1751
- * Event emitted when input initializes.
1752
- */
1753
- "onInputInit"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1754
- /**
1755
- * The input element's placeholder value.
1756
- */
1757
- "placeholderValue"?: string;
1758
- }
1759
- /**
1760
- * This web component serves as the input label for the searchcraft-input-form component.
1761
- * ## Usage
1762
- * ```html
1763
- * <!-- index.html -->
1764
- * <searchcraft-input-label label="Search" />
1765
- * ```
1766
- */
1767
- interface SearchcraftInputLabel {
1768
- /**
1769
- * The classname applied to the label element.
1770
- */
1771
- "inputLabelClassName"?: string | undefined;
1772
- "label"?: string;
1773
- }
1774
- /**
1775
- * This web component is designed to facilitate pagination of search results.
1776
- * Once a query is submitted, calculates the number for pages.
1777
- * ## Usage
1778
- * ```html
1779
- * <!-- index.html -->
1780
- * <searchcraft-pagination />
1781
- * ```
1782
- */
1783
- interface SearchcraftPagination {
1784
- /**
1785
- * The custom styles object.
1786
- */
1787
- "customStyles"?: string;
1788
- }
1789
- /**
1790
- * Renders a button which, when clicked, turns on popover visibility.
1791
- */
1792
- interface SearchcraftPopoverButton {
1793
- }
1794
- /**
1795
- * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
1796
- * ## Usage
1797
- * ```html
1798
- * <!-- index.html -->
1799
- * <searchcraft-popover-form type="fullscreen" />
1800
- * ```
1801
- * ```js
1802
- * // index.js
1803
- * const popoverForm = document.querySelector('searchcraft-popover-form');
1804
- * popoverForm.popoverResultMappings = {
1805
- * containerHref: {
1806
- * fieldNames: [
1807
- * {
1808
- * fieldName: 'canonical_link',
1809
- * dataType: 'text',
1810
- * },
1811
- * ],
1812
- * };
1813
- * ```
1814
- */
1815
- interface SearchcraftPopoverForm {
1816
- /**
1817
- * The hotkey that activates the popover.
1818
- */
1819
- "hotkey"?: string;
1820
- /**
1821
- * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.
1822
- */
1823
- "hotkeyModifier"?: "ctrl" | "meta" | "alt" | "option";
1824
- /**
1825
- * Formats the content rendered for each result.
1826
- */
1827
- "popoverResultMappings"?: PopoverResultMappings;
1828
- /**
1829
- * The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
1830
- */
1831
- "type"?: "inline" | "fullscreen" | "modal";
1832
- }
1833
- /**
1834
- * A single list item rendered in a searchcraft-popover-list-view.
1835
- */
1836
- interface SearchcraftPopoverListItem {
1837
- /**
1838
- * The document position relative to the search results (For Measure)
1839
- */
1840
- "documentPosition"?: number;
1841
- "item"?: SearchClientResponseItem | undefined;
1842
- "popoverResultMappings"?: PopoverResultMappings | undefined;
1843
- }
1844
- /**
1845
- * This web component is designed to display a list of results within a popover interface.
1846
- * It is consumed within the `searchcraft-popover-form` component.
1847
- * ## Usage
1848
- * ```html
1849
- * <!-- index.html -->
1850
- * <searchcraft-popover-list-view />
1851
- * ```
1852
- */
1853
- interface SearchcraftPopoverListView {
1854
- "adClientResponseItems"?: AdClientResponseItem[] | undefined;
1855
- /**
1856
- * The mappings that define how the data in the documents are mapped to the list-view-item elements.
1857
- */
1858
- "popoverResultMappings"?: PopoverResultMappings | undefined;
1859
- /**
1860
- * The items to render in the list view.
1861
- */
1862
- "searchClientResponseItems"?: SearchClientResponseItem[] | undefined;
1863
- "searchResultsPage": number;
1864
- "searchResultsPerPage": number;
1865
- }
1866
- /**
1867
- * This web component is designed to display the number of results returned from a search query.
1868
- * ## Usage
1869
- * ```html
1870
- * <!-- index.html -->
1871
- * <script>
1872
- * const resultsInfo = document.querySelector('searchcraft-results-info');
1873
- * resultsInfo.customFormatter = (range, count, responseTime) =>
1874
- * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
1875
- * </script>
1876
- * <searchcraft-results-info />
1877
- * ```
1878
- */
1879
- interface SearchcraftResultsInfo {
1880
- /**
1881
- * The custom formatter for the resulting string.
1882
- * @example ```ts resultsInfo.customFormatter = (range, count, responseTime) => `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`; ```
1883
- */
1884
- "customFormatter"?: (range: [
1885
- string,
1886
- string
1887
- ], count: string, responseTime: string) => void;
1888
- /**
1889
- * The custom styles object.
1890
- */
1891
- "customStyles"?: string;
1892
- }
1893
- /**
1894
- * This web component is designed to choose the number of search results displayed.
1895
- * ## Usage
1896
- * ```html
1897
- * <!-- index.html -->
1898
- * <searchcraft-search-results-per-page increment="20" />
1899
- * ```
1900
- */
1901
- interface SearchcraftSearchResultsPerPage {
1902
- /**
1903
- * The custom styles object.
1904
- */
1905
- "customStyles"?: string;
1906
- /**
1907
- * The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
1908
- */
1909
- "increment"?: string | number;
1910
- }
1911
- /**
1912
- * This web component is designed to allow users to select between a group of options.
1913
- * ## Usage
1914
- * ```html
1915
- * <!-- index.html -->
1916
- * <searchcraft-select
1917
- * inputId="searchcraft-select"
1918
- * name="searchcraft-select"
1919
- * options="[{ label: 'label', value: 'value' }]"
1920
- * />
1921
- * ```
1922
- */
1923
- interface SearchcraftSelect {
1924
- /**
1925
- * The caption displayed below the select input.
1926
- */
1927
- "caption"?: string;
1928
- /**
1929
- * A custom styles object.
1930
- */
1931
- "customStyles"?: string;
1932
- /**
1933
- * Whether the select input is disabled.
1934
- */
1935
- "disabled"?: boolean;
1936
- /**
1937
- * The ID for the select input.
1938
- */
1939
- "inputId": string;
1940
- /**
1941
- * The label of the select input.
1942
- */
1943
- "label"?: string;
1944
- /**
1945
- * The ID for the label of the select input.
1946
- */
1947
- "labelId"?: string;
1948
- /**
1949
- * The name of the select input.
1950
- */
1951
- "name": string;
1952
- /**
1953
- * The event fired when the select is changed.
1954
- */
1955
- "onSelectChange"?: (event: SearchcraftSelectCustomEvent<string>) => void;
1956
- /**
1957
- * The options for the select input.
1958
- */
1959
- "options"?: SearchcraftSelectOption[] | string;
1960
- }
1961
- /**
1962
- * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
1963
- * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
1964
- * It is consumed by the `searchcraft-filter-panel` component.
1965
- */
1966
- interface SearchcraftSlider {
1967
- /**
1968
- * The type of data allowed.
1969
- */
1970
- "dataType"?: "number" | "date";
1971
- /**
1972
- * The granularity that the value must adhere to.
1973
- */
1974
- "granularity"?: number;
1975
- /**
1976
- * The maximum value allowed.
1977
- */
1978
- "max"?: number;
1979
- /**
1980
- * The minimum value allowed.
1981
- */
1982
- "min"?: number;
1983
- /**
1984
- * When the range has changed.
1985
- */
1986
- "onRangeChanged"?: (event: SearchcraftSliderCustomEvent<any>) => void;
1987
- }
1988
- /**
1989
- * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
1990
- * It does not render anything visible, its only function is to manage the css styles on the page.
1991
- * ## Usage
1992
- * ```html
1993
- * <!-- index.html -->
1994
- * <searchcraft-theme theme="light" custom-theme="{}" />
1995
- * ```
1996
- */
1997
- interface SearchcraftTheme {
1998
- /**
1999
- * The custom theme configuration object.
2000
- */
2001
- "customTheme"?: string;
2002
- /**
2003
- * The name of the theme.
2004
- */
2005
- "theme"?: string;
2006
- }
2007
- /**
2008
- * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
2009
- * It is consumed within the `searchcraft-filter-panel` component.
2010
- */
2011
- interface SearchcraftToggleButton {
2012
- /**
2013
- * The label.
2014
- */
2015
- "label"?: string;
2016
- /**
2017
- * When the toggle element is changed.
2018
- */
2019
- "onToggleUpdated"?: (event: SearchcraftToggleButtonCustomEvent<boolean>) => void;
2020
- /**
2021
- * The secondary label displayed below the main label.
2022
- */
2023
- "subLabel"?: string | undefined;
2024
- }
2025
- interface IntrinsicElements {
2026
- "searchcraft-ad": SearchcraftAd;
2027
- "searchcraft-base-search-result": SearchcraftBaseSearchResult;
2028
- "searchcraft-base-search-results": SearchcraftBaseSearchResults;
2029
- "searchcraft-button": SearchcraftButton;
2030
- "searchcraft-error-message": SearchcraftErrorMessage;
2031
- "searchcraft-facet-list": SearchcraftFacetList;
2032
- "searchcraft-filter-panel": SearchcraftFilterPanel;
2033
- "searchcraft-input-form": SearchcraftInputForm;
2034
- "searchcraft-input-label": SearchcraftInputLabel;
2035
- "searchcraft-pagination": SearchcraftPagination;
2036
- "searchcraft-popover-button": SearchcraftPopoverButton;
2037
- "searchcraft-popover-form": SearchcraftPopoverForm;
2038
- "searchcraft-popover-list-item": SearchcraftPopoverListItem;
2039
- "searchcraft-popover-list-view": SearchcraftPopoverListView;
2040
- "searchcraft-results-info": SearchcraftResultsInfo;
2041
- "searchcraft-search-results-per-page": SearchcraftSearchResultsPerPage;
2042
- "searchcraft-select": SearchcraftSelect;
2043
- "searchcraft-slider": SearchcraftSlider;
2044
- "searchcraft-theme": SearchcraftTheme;
2045
- "searchcraft-toggle-button": SearchcraftToggleButton;
2046
- }
2047
- }
2048
- declare module "@stencil/core" {
2049
- export namespace JSX {
2050
- interface IntrinsicElements {
2051
- /**
2052
- * An inline ad meant to be rendered in a list of search results.
2053
- */
2054
- "searchcraft-ad": LocalJSX.SearchcraftAd & JSXBase.HTMLAttributes<HTMLSearchcraftAdElement>;
2055
- /**
2056
- * This web component is designed to display detailed information for a single search result.
2057
- * Once a query is submitted, the component formats and presents the result.
2058
- * It is consumed within the `searchcraft-base-search-results` component.
2059
- */
2060
- "searchcraft-base-search-result": LocalJSX.SearchcraftBaseSearchResult & JSXBase.HTMLAttributes<HTMLSearchcraftBaseSearchResultElement>;
2061
- /**
2062
- * This web component is responsible for displaying the results of a search query.
2063
- * Once a query is submitted, the component formats and presents an ordered list of the results.
2064
- * ## Usage
2065
- * ```html
2066
- * <!-- index.html -->
2067
- * <searchcraft-base-search-results
2068
- * ad-interval="4"
2069
- * place-ad-at-start="false"
2070
- * result-image-placement="right"
2071
- * />
2072
- * ```
2073
- * ```js
2074
- * // index.js
2075
- * const baseSearchResults = document.querySelector('searchcraft-base-search-results');
2076
- * baseSearchResults.searchResultMappings = containerHref: {
2077
- * fieldNames: [
2078
- * {
2079
- * fieldName: 'canonical_link',
2080
- * dataType: 'text',
2081
- * },
2082
- * ],
2083
- * };
2084
- * baseSearchResults.addEventListener('noResults', () => {
2085
- * console.log('No search results found');
2086
- * });
2087
- * ```
2088
- */
2089
- "searchcraft-base-search-results": LocalJSX.SearchcraftBaseSearchResults & JSXBase.HTMLAttributes<HTMLSearchcraftBaseSearchResultsElement>;
2090
- /**
2091
- * This web component represents a button to be consumed within the `search-input-form` component.
2092
- * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
2093
- * It is consumed within the `searchcraft-input-form` component.
2094
- */
2095
- "searchcraft-button": LocalJSX.SearchcraftButton & JSXBase.HTMLAttributes<HTMLSearchcraftButtonElement>;
2096
- /**
2097
- * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
2098
- * ## Usage
2099
- * ```html
2100
- * <!-- index.html -->
2101
- * <searchcraft-error-message error-message="No search results found for query" />
2102
- * ```
2103
- */
2104
- "searchcraft-error-message": LocalJSX.SearchcraftErrorMessage & JSXBase.HTMLAttributes<HTMLSearchcraftErrorMessageElement>;
2105
- /**
2106
- * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.
2107
- * It is consumed within the `searchcraft-filter-panel`.
2108
- * ## Usage
2109
- * ```html
2110
- * <!-- index.html -->
2111
- * <searchcraft-facet-list field-name="title" />
2112
- * ```
2113
- * ```js
2114
- * // index.js
2115
- * const facetList = document.querySelector('searchcraft-facet-list');
2116
- * facetList.addEventListener('facetSelectionUpdated', () => {
2117
- * console.log('Facet selection updated');
2118
- * });
2119
- * ```
2120
- */
2121
- "searchcraft-facet-list": LocalJSX.SearchcraftFacetList & JSXBase.HTMLAttributes<HTMLSearchcraftFacetListElement>;
2122
- /**
2123
- * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
2124
- * ## Usage
2125
- * ```html
2126
- * <!-- index.html -->
2127
- * <searchcraft-filter-panel />
2128
- * ```
2129
- */
2130
- "searchcraft-filter-panel": LocalJSX.SearchcraftFilterPanel & JSXBase.HTMLAttributes<HTMLSearchcraftFilterPanelElement>;
2131
- /**
2132
- * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
2133
- * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.
2134
- * ## Usage
2135
- * ```html
2136
- * <!-- index.html -->
2137
- * <searchcraft-input-form placeholder-value="Search here" />
2138
- * ```
2139
- * ```js
2140
- * // index.js
2141
- * const searchInputForm = document.querySelector('searchcraft-input-form');
2142
- * ```
2143
- */
2144
- "searchcraft-input-form": LocalJSX.SearchcraftInputForm & JSXBase.HTMLAttributes<HTMLSearchcraftInputFormElement>;
2145
- /**
2146
- * This web component serves as the input label for the searchcraft-input-form component.
2147
- * ## Usage
2148
- * ```html
2149
- * <!-- index.html -->
2150
- * <searchcraft-input-label label="Search" />
2151
- * ```
2152
- */
2153
- "searchcraft-input-label": LocalJSX.SearchcraftInputLabel & JSXBase.HTMLAttributes<HTMLSearchcraftInputLabelElement>;
2154
- /**
2155
- * This web component is designed to facilitate pagination of search results.
2156
- * Once a query is submitted, calculates the number for pages.
2157
- * ## Usage
2158
- * ```html
2159
- * <!-- index.html -->
2160
- * <searchcraft-pagination />
2161
- * ```
2162
- */
2163
- "searchcraft-pagination": LocalJSX.SearchcraftPagination & JSXBase.HTMLAttributes<HTMLSearchcraftPaginationElement>;
2164
- /**
2165
- * Renders a button which, when clicked, turns on popover visibility.
2166
- */
2167
- "searchcraft-popover-button": LocalJSX.SearchcraftPopoverButton & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverButtonElement>;
2168
- /**
2169
- * This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
2170
- * ## Usage
2171
- * ```html
2172
- * <!-- index.html -->
2173
- * <searchcraft-popover-form type="fullscreen" />
2174
- * ```
2175
- * ```js
2176
- * // index.js
2177
- * const popoverForm = document.querySelector('searchcraft-popover-form');
2178
- * popoverForm.popoverResultMappings = {
2179
- * containerHref: {
2180
- * fieldNames: [
2181
- * {
2182
- * fieldName: 'canonical_link',
2183
- * dataType: 'text',
2184
- * },
2185
- * ],
2186
- * };
2187
- * ```
2188
- */
2189
- "searchcraft-popover-form": LocalJSX.SearchcraftPopoverForm & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverFormElement>;
2190
- /**
2191
- * A single list item rendered in a searchcraft-popover-list-view.
2192
- */
2193
- "searchcraft-popover-list-item": LocalJSX.SearchcraftPopoverListItem & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverListItemElement>;
2194
- /**
2195
- * This web component is designed to display a list of results within a popover interface.
2196
- * It is consumed within the `searchcraft-popover-form` component.
2197
- * ## Usage
2198
- * ```html
2199
- * <!-- index.html -->
2200
- * <searchcraft-popover-list-view />
2201
- * ```
2202
- */
2203
- "searchcraft-popover-list-view": LocalJSX.SearchcraftPopoverListView & JSXBase.HTMLAttributes<HTMLSearchcraftPopoverListViewElement>;
2204
- /**
2205
- * This web component is designed to display the number of results returned from a search query.
2206
- * ## Usage
2207
- * ```html
2208
- * <!-- index.html -->
2209
- * <script>
2210
- * const resultsInfo = document.querySelector('searchcraft-results-info');
2211
- * resultsInfo.customFormatter = (range, count, responseTime) =>
2212
- * `${range[0]}-${range[1]} of ${count} results in ${responseTime}ms`;
2213
- * </script>
2214
- * <searchcraft-results-info />
2215
- * ```
2216
- */
2217
- "searchcraft-results-info": LocalJSX.SearchcraftResultsInfo & JSXBase.HTMLAttributes<HTMLSearchcraftResultsInfoElement>;
2218
- /**
2219
- * This web component is designed to choose the number of search results displayed.
2220
- * ## Usage
2221
- * ```html
2222
- * <!-- index.html -->
2223
- * <searchcraft-search-results-per-page increment="20" />
2224
- * ```
2225
- */
2226
- "searchcraft-search-results-per-page": LocalJSX.SearchcraftSearchResultsPerPage & JSXBase.HTMLAttributes<HTMLSearchcraftSearchResultsPerPageElement>;
2227
- /**
2228
- * This web component is designed to allow users to select between a group of options.
2229
- * ## Usage
2230
- * ```html
2231
- * <!-- index.html -->
2232
- * <searchcraft-select
2233
- * inputId="searchcraft-select"
2234
- * name="searchcraft-select"
2235
- * options="[{ label: 'label', value: 'value' }]"
2236
- * />
2237
- * ```
2238
- */
2239
- "searchcraft-select": LocalJSX.SearchcraftSelect & JSXBase.HTMLAttributes<HTMLSearchcraftSelectElement>;
2240
- /**
2241
- * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.
2242
- * The component renders a slider interface, which can be used to visually choose a value between two boundaries.
2243
- * It is consumed by the `searchcraft-filter-panel` component.
2244
- */
2245
- "searchcraft-slider": LocalJSX.SearchcraftSlider & JSXBase.HTMLAttributes<HTMLSearchcraftSliderElement>;
2246
- /**
2247
- * This web component adds Searchcraft's built-in css theme to your page's <head> tag.
2248
- * It does not render anything visible, its only function is to manage the css styles on the page.
2249
- * ## Usage
2250
- * ```html
2251
- * <!-- index.html -->
2252
- * <searchcraft-theme theme="light" custom-theme="{}" />
2253
- * ```
2254
- */
2255
- "searchcraft-theme": LocalJSX.SearchcraftTheme & JSXBase.HTMLAttributes<HTMLSearchcraftThemeElement>;
2256
- /**
2257
- * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.
2258
- * It is consumed within the `searchcraft-filter-panel` component.
2259
- */
2260
- "searchcraft-toggle-button": LocalJSX.SearchcraftToggleButton & JSXBase.HTMLAttributes<HTMLSearchcraftToggleButtonElement>;
2261
- }
2262
- }
2263
- }
2264
- /**
2265
- * The consumer-facing `Searchcraft` class.
2266
- */
2267
- export declare class Searchcraft extends SearchcraftCore {
2268
- constructor(config: SearchcraftConfig);
2269
- }
2270
-
2271
- export {
2272
- LocalJSX as JSX,
2273
- };
2274
-
2275
- export {};