@searchcraft/react-sdk 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1484 -1359
- package/dist/client/index.js.map +1 -1
- package/dist/client/themes/hologram.css +1 -1
- package/dist/client/themes/hologram.css.map +1 -1
- package/dist/server/index.d.ts +148 -83
- package/dist/server/index.js +1514 -1389
- package/dist/server/index.js.map +1 -1
- package/package.json +4 -7
package/dist/server/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export type SearchResultFieldName = {
|
|
|
42
42
|
numberFormatLocale?: string;
|
|
43
43
|
/**
|
|
44
44
|
* If it's a number, the number format to apply.
|
|
45
|
-
*
|
|
45
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
46
46
|
*/
|
|
47
47
|
numberFormatOptions?: Intl.NumberFormatOptions;
|
|
48
48
|
/**
|
|
@@ -50,9 +50,14 @@ export type SearchResultFieldName = {
|
|
|
50
50
|
*/
|
|
51
51
|
numberScale?: number;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* The locale to use when formatting dataType: `date`.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
dateFormatLocale?: string;
|
|
56
|
+
/**
|
|
57
|
+
* If it's a date, the date format to apply.
|
|
58
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
59
|
+
*/
|
|
60
|
+
dateFormatOptions?: Intl.DateTimeFormatOptions;
|
|
56
61
|
};
|
|
57
62
|
/**
|
|
58
63
|
* A data type representing the mapping of index fields, for the purpose of rendering them
|
|
@@ -112,6 +117,7 @@ export interface ExactMatchToggleFilterItem extends FilterItem {
|
|
|
112
117
|
};
|
|
113
118
|
}
|
|
114
119
|
export interface MostRecentToggleFilterItem extends FilterItem {
|
|
120
|
+
fieldName: string;
|
|
115
121
|
type: "mostRecentToggle";
|
|
116
122
|
options: {
|
|
117
123
|
subLabel?: string;
|
|
@@ -120,6 +126,7 @@ export interface MostRecentToggleFilterItem extends FilterItem {
|
|
|
120
126
|
export type TemplateHtml = (strings: TemplateStringsArray, ...values: (string | number | undefined)[]) => string;
|
|
121
127
|
export type SearchResultTemplate<T> = (data: T, index: number, utils: {
|
|
122
128
|
html: TemplateHtml;
|
|
129
|
+
source_index?: string;
|
|
123
130
|
}) => string;
|
|
124
131
|
export type SearchResultTemplateData = any;
|
|
125
132
|
export type ResultsInfoTemplate = (data: {
|
|
@@ -138,7 +145,12 @@ export type CustomAdTemplate = (data: {
|
|
|
138
145
|
}, utils: {
|
|
139
146
|
html: TemplateHtml;
|
|
140
147
|
}) => string;
|
|
141
|
-
export type PopoverButtonTemplate = (data:
|
|
148
|
+
export type PopoverButtonTemplate = (data: {
|
|
149
|
+
isPopoverVisible: boolean;
|
|
150
|
+
}, utils: {
|
|
151
|
+
html: TemplateHtml;
|
|
152
|
+
}) => string;
|
|
153
|
+
export type ADMAdTemplate = (data: ADMAd, utils: {
|
|
142
154
|
html: TemplateHtml;
|
|
143
155
|
}) => string;
|
|
144
156
|
/**
|
|
@@ -146,11 +158,11 @@ export type PopoverButtonTemplate = (data: boolean, utils: {
|
|
|
146
158
|
*/
|
|
147
159
|
export interface SearchcraftConfig {
|
|
148
160
|
/**
|
|
149
|
-
* Host IP Address and port number configured and created using Vektron
|
|
161
|
+
* Host IP Address and port number configured and created using Vektron.
|
|
150
162
|
*/
|
|
151
163
|
endpointURL: string;
|
|
152
164
|
/**
|
|
153
|
-
* Name or names of search indices configured using Vektron. Given as an array of strings
|
|
165
|
+
* Name or names of search indices configured using Vektron. Given as an array of strings.
|
|
154
166
|
*/
|
|
155
167
|
index: string[];
|
|
156
168
|
/**
|
|
@@ -189,6 +201,10 @@ export interface SearchcraftConfig {
|
|
|
189
201
|
* The amount of debounce delay to add before calling the ad_container_rendered event
|
|
190
202
|
*/
|
|
191
203
|
adContainerRenderedDebounceDelay?: number;
|
|
204
|
+
/**
|
|
205
|
+
* A callback function responsible for rendering the ADM ad containers.
|
|
206
|
+
*/
|
|
207
|
+
admAdTemplate?: ADMAdTemplate;
|
|
192
208
|
/**
|
|
193
209
|
* The number of custom ads to render at the start of the search results page.
|
|
194
210
|
*/
|
|
@@ -250,6 +266,17 @@ export interface AdClientResponseItem {
|
|
|
250
266
|
id: string;
|
|
251
267
|
adSource: SearchcraftAdSource;
|
|
252
268
|
}
|
|
269
|
+
export interface ADMAd {
|
|
270
|
+
adv_id: number;
|
|
271
|
+
adv_name: string;
|
|
272
|
+
click_url?: string;
|
|
273
|
+
image_url?: string;
|
|
274
|
+
impression_url?: string;
|
|
275
|
+
price?: number;
|
|
276
|
+
price_currency?: string;
|
|
277
|
+
sale_price?: number;
|
|
278
|
+
term: string;
|
|
279
|
+
}
|
|
253
280
|
/**
|
|
254
281
|
* A Facet object returned in a search response.
|
|
255
282
|
*/
|
|
@@ -301,6 +328,56 @@ export interface MeasureRequestUser {
|
|
|
301
328
|
latitude?: number;
|
|
302
329
|
longitude?: number;
|
|
303
330
|
}
|
|
331
|
+
export interface FacetPathsForIndexField {
|
|
332
|
+
fieldName: string;
|
|
333
|
+
value: string;
|
|
334
|
+
}
|
|
335
|
+
export interface RangeValueForIndexField {
|
|
336
|
+
fieldName: string;
|
|
337
|
+
value: string;
|
|
338
|
+
}
|
|
339
|
+
export interface SearchClientRequestProperties {
|
|
340
|
+
/**
|
|
341
|
+
* The search mode, which can be either 'fuzzy' or 'exact'.
|
|
342
|
+
*/
|
|
343
|
+
mode: "fuzzy" | "exact";
|
|
344
|
+
/**
|
|
345
|
+
* The starting point for the results, used for pagination.
|
|
346
|
+
* Optional parameter.
|
|
347
|
+
*/
|
|
348
|
+
offset?: number;
|
|
349
|
+
/**
|
|
350
|
+
* The number of results returned.
|
|
351
|
+
* Optional parameter.
|
|
352
|
+
*/
|
|
353
|
+
limit?: number;
|
|
354
|
+
/**
|
|
355
|
+
* The field to order the results by (e.g., 'date_published', 'title', etc.).
|
|
356
|
+
* Optional parameter.
|
|
357
|
+
*/
|
|
358
|
+
order_by?: string | null;
|
|
359
|
+
/**
|
|
360
|
+
* The search term provided by the user.
|
|
361
|
+
*/
|
|
362
|
+
searchTerm: string;
|
|
363
|
+
/**
|
|
364
|
+
* The sort order, which can be either 'asc' or 'desc'.
|
|
365
|
+
* Optional parameter.
|
|
366
|
+
*/
|
|
367
|
+
sort?: "asc" | "desc" | null;
|
|
368
|
+
/**
|
|
369
|
+
* The facet path value(s) specified by the `facets` filter items that the `searchcraft-filter-panel` renders.
|
|
370
|
+
* There may be multiple rendered within a single filter panel.
|
|
371
|
+
* Optional parameter.
|
|
372
|
+
*/
|
|
373
|
+
facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
|
|
374
|
+
/**
|
|
375
|
+
* The date range slider value(s) specified by the `dateRange` filter items that the `searchcraft-filter-panel` renders.
|
|
376
|
+
* There may be multiple rendered within a single filter panel.
|
|
377
|
+
* Optional parameter.
|
|
378
|
+
*/
|
|
379
|
+
rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
|
|
380
|
+
}
|
|
304
381
|
/**
|
|
305
382
|
* The structure of a response returned from a Searchcraft operation.
|
|
306
383
|
*/
|
|
@@ -327,16 +404,17 @@ export type SearchcraftResponseError = {
|
|
|
327
404
|
export interface SearchcraftResponseData {
|
|
328
405
|
count?: number;
|
|
329
406
|
facets?: FacetPrime;
|
|
330
|
-
hits?:
|
|
407
|
+
hits?: SearchIndexHit[];
|
|
331
408
|
time_taken?: number;
|
|
332
409
|
}
|
|
333
410
|
/**
|
|
334
411
|
* Represents an entry in the search index returned as part of a search result.
|
|
335
412
|
*/
|
|
336
|
-
export interface
|
|
413
|
+
export interface SearchIndexHit {
|
|
337
414
|
doc?: SearchDocument;
|
|
338
415
|
document_id?: string;
|
|
339
416
|
score?: number;
|
|
417
|
+
source_index?: string;
|
|
340
418
|
}
|
|
341
419
|
/**
|
|
342
420
|
* Data document returned within a SearchResult.
|
|
@@ -348,55 +426,14 @@ export interface SearchDocument extends Record<string, string | number> {
|
|
|
348
426
|
export interface SearchClientResponseItem {
|
|
349
427
|
id: string;
|
|
350
428
|
document: SearchDocument;
|
|
429
|
+
source_index?: string;
|
|
351
430
|
}
|
|
352
|
-
export type FacetPathsForIndexField = {
|
|
353
|
-
fieldName: string;
|
|
354
|
-
value: string;
|
|
355
|
-
};
|
|
356
|
-
export type RangeValueForIndexField = {
|
|
357
|
-
fieldName: string;
|
|
358
|
-
value: string;
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
* Parameters required to make a successful Search request.
|
|
362
|
-
*/
|
|
363
|
-
export type SearchParams = {
|
|
364
|
-
/**
|
|
365
|
-
* The search mode, which can be either 'fuzzy' or 'exact'.
|
|
366
|
-
*/
|
|
367
|
-
mode: "fuzzy" | "exact";
|
|
368
|
-
/**
|
|
369
|
-
* The starting point for the results, used for pagination.
|
|
370
|
-
* Optional parameter.
|
|
371
|
-
*/
|
|
372
|
-
offset?: number;
|
|
373
|
-
/**
|
|
374
|
-
* The number of results returned.
|
|
375
|
-
* Optional parameter.
|
|
376
|
-
*/
|
|
377
|
-
limit?: number;
|
|
378
|
-
/**
|
|
379
|
-
* The field to order the results by (e.g., 'date_published', 'title', etc.).
|
|
380
|
-
* Optional parameter.
|
|
381
|
-
*/
|
|
382
|
-
order_by?: string;
|
|
383
|
-
/**
|
|
384
|
-
* The search term provided by the user.
|
|
385
|
-
*/
|
|
386
|
-
searchTerm: string;
|
|
387
|
-
/**
|
|
388
|
-
* The sort order, which can be either 'asc' or 'desc'.
|
|
389
|
-
* Optional parameter.
|
|
390
|
-
*/
|
|
391
|
-
sort?: "asc" | "desc";
|
|
392
|
-
facetPathsForIndexFields?: Record<string, FacetPathsForIndexField>;
|
|
393
|
-
rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
|
|
394
|
-
};
|
|
395
431
|
export interface SubscriptionEventMap {
|
|
396
432
|
ad_container_rendered: AdContainerRenderedSubscriptionEvent;
|
|
397
433
|
ad_container_viewed: AdContainerViewedSubscriptionEvent;
|
|
398
434
|
query_fetched: QueryFetchedEvent;
|
|
399
435
|
query_submitted: QuerySubmittedEvent;
|
|
436
|
+
initialized: InitializedEvent;
|
|
400
437
|
input_cleared: InputClearedEvent;
|
|
401
438
|
no_results_returned: NoResultsReturnedEvent;
|
|
402
439
|
}
|
|
@@ -434,6 +471,9 @@ export interface InputClearedEvent extends SubscriptionEvent {
|
|
|
434
471
|
export interface NoResultsReturnedEvent extends SubscriptionEvent {
|
|
435
472
|
name: "no_results_returned";
|
|
436
473
|
}
|
|
474
|
+
export interface InitializedEvent extends SubscriptionEvent {
|
|
475
|
+
name: "initialized";
|
|
476
|
+
}
|
|
437
477
|
export type SubscriptionEventName = keyof SubscriptionEventMap;
|
|
438
478
|
export type SubscriptionEventCallback<T extends SubscriptionEventName> = (event: SubscriptionEventMap[T]) => void;
|
|
439
479
|
export type UnsubscribeFunction = () => void;
|
|
@@ -443,9 +483,9 @@ export interface SubscriptionEvent {
|
|
|
443
483
|
declare class AdClient {
|
|
444
484
|
config: SearchcraftConfig;
|
|
445
485
|
constructor(config: SearchcraftConfig);
|
|
446
|
-
|
|
447
|
-
onQuerySubmitted(
|
|
448
|
-
onQueryFetched(
|
|
486
|
+
getAds(_properties: SearchClientRequestProperties): Promise<AdClientResponseItem[]>;
|
|
487
|
+
onQuerySubmitted(_properties: SearchClientRequestProperties): Promise<void>;
|
|
488
|
+
onQueryFetched(_properties: SearchClientRequestProperties, _response: SearchcraftResponse): Promise<void>;
|
|
449
489
|
onInputCleared(): Promise<void>;
|
|
450
490
|
onAdContainerRendered(_data: {
|
|
451
491
|
adClientResponseItem?: AdClientResponseItem;
|
|
@@ -466,7 +506,7 @@ declare class MeasureClient {
|
|
|
466
506
|
private config;
|
|
467
507
|
private sdkInfo;
|
|
468
508
|
private userId;
|
|
469
|
-
|
|
509
|
+
sessionId: string;
|
|
470
510
|
constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo, userId: string);
|
|
471
511
|
/**
|
|
472
512
|
* Getter for the base url used by the /measure endpoints.
|
|
@@ -496,10 +536,19 @@ declare class SearchClient {
|
|
|
496
536
|
*/
|
|
497
537
|
private get baseSearchUrl();
|
|
498
538
|
/**
|
|
499
|
-
*
|
|
500
|
-
* @param {
|
|
539
|
+
* Make the request to get the search results.
|
|
540
|
+
* @param {properties} properties - The properties for the search.
|
|
541
|
+
* @returns
|
|
542
|
+
*/
|
|
543
|
+
getSearchResponseItems: (properties: SearchClientRequestProperties | string) => Promise<SearchcraftResponse>;
|
|
544
|
+
private handleGetSearchResponseItemsWithString;
|
|
545
|
+
private handleGetSearchResponseItemsWithObject;
|
|
546
|
+
/**
|
|
547
|
+
* Builds a query object for the SearchClient request.
|
|
548
|
+
* @param {properties} properties - The properties for the search.
|
|
549
|
+
* @returns {SearchClientQuery} - A properly formatted SearchClient query object.
|
|
501
550
|
*/
|
|
502
|
-
|
|
551
|
+
private formatParamsForRequest;
|
|
503
552
|
}
|
|
504
553
|
/**
|
|
505
554
|
* Javascript Class providing the functionality to interact with the Searchcraft BE
|
|
@@ -543,30 +592,36 @@ export declare class SearchcraftCore {
|
|
|
543
592
|
* Perform various actions when the input is cleared
|
|
544
593
|
*/
|
|
545
594
|
handleInputCleared(): void;
|
|
546
|
-
|
|
547
|
-
* Gets items from the SearchClient and the AdClient.
|
|
548
|
-
*/
|
|
549
|
-
getItems: (searchParams: SearchParams, itemsCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (adClientResponseItems: AdClientResponseItem[]) => void) => void;
|
|
595
|
+
getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
|
|
550
596
|
}
|
|
551
597
|
/**
|
|
552
598
|
* Callable functions made available by the SearchcraftStore.
|
|
553
599
|
*/
|
|
554
600
|
export interface SearchcraftStateFunctions {
|
|
555
|
-
addFacetPathsForIndexField: (
|
|
556
|
-
addRangeValueForIndexField: (
|
|
557
|
-
|
|
558
|
-
|
|
601
|
+
addFacetPathsForIndexField: (field: FacetPathsForIndexField) => void;
|
|
602
|
+
addRangeValueForIndexField: (field: RangeValueForIndexField) => void;
|
|
603
|
+
getSearchcraftCore: () => SearchcraftCore | undefined;
|
|
604
|
+
init: (searchcraft: SearchcraftCore | undefined, debug?: boolean) => void;
|
|
559
605
|
removeFacetPathsForIndexField: (fieldName: string) => void;
|
|
560
606
|
removeRangeValueForIndexField: (fieldName: string) => void;
|
|
561
607
|
resetFacetPaths: () => void;
|
|
562
608
|
search: () => Promise<void>;
|
|
609
|
+
set: (state: Partial<SearchcraftState> | ((state: SearchcraftState) => Partial<SearchcraftState>)) => SearchcraftState;
|
|
610
|
+
setAdClientResponseItems: (items: AdClientResponseItem[]) => void;
|
|
611
|
+
setSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
612
|
+
setInitialSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
613
|
+
setInitialQuery: (query: string) => void;
|
|
563
614
|
setPopoverVisibility: (isVisible: boolean) => void;
|
|
564
|
-
|
|
615
|
+
setSearchResultsCount: (count: number) => void;
|
|
616
|
+
setSearchClientResponseItems: (items: SearchClientResponseItem[]) => void;
|
|
565
617
|
setSearchResultsPage: (page: number) => void;
|
|
566
618
|
setSearchResultsPerPage: (perPage: number) => void;
|
|
567
619
|
setSearchTerm: (searchTerm: string) => void;
|
|
568
620
|
setSearchMode: (mode: "fuzzy" | "exact") => void;
|
|
569
|
-
|
|
621
|
+
setSortOrder: (props: {
|
|
622
|
+
orderByField: string | null;
|
|
623
|
+
sortType: "asc" | "desc" | null;
|
|
624
|
+
}) => void;
|
|
570
625
|
setHotKeyAndHotKeyModifier: (hotkey?: string, hotkeyModifier?: "ctrl" | "meta" | "alt" | "option") => void;
|
|
571
626
|
}
|
|
572
627
|
/**
|
|
@@ -579,6 +634,8 @@ export interface SearchcraftStateValues {
|
|
|
579
634
|
hotkeyModifier: "ctrl" | "meta" | "alt" | "option";
|
|
580
635
|
logger: Logger | undefined;
|
|
581
636
|
facetPathsForIndexFields: Record<string, FacetPathsForIndexField>;
|
|
637
|
+
initialQuery: string;
|
|
638
|
+
initialSearchClientResponseItems: SearchClientResponseItem[];
|
|
582
639
|
isPopoverVisible: boolean;
|
|
583
640
|
isSearchInProgress: boolean;
|
|
584
641
|
rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
|
|
@@ -590,13 +647,13 @@ export interface SearchcraftStateValues {
|
|
|
590
647
|
searchResultsPage: number;
|
|
591
648
|
searchResultsPerPage: number;
|
|
592
649
|
searchTerm: string;
|
|
593
|
-
|
|
650
|
+
orderByField: string | undefined | null;
|
|
651
|
+
sortType: "asc" | "desc" | undefined | null;
|
|
652
|
+
afterInit: (state: SearchcraftState) => void;
|
|
594
653
|
}
|
|
595
654
|
export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {
|
|
596
655
|
}
|
|
597
656
|
export declare const searchcraftStore: import("zustand").StoreApi<SearchcraftState>;
|
|
598
|
-
export declare function parseCustomStyles(styles: string | Record<string, string>): Record<string, string>;
|
|
599
|
-
export declare function serializeStyles(styles: Record<string, Record<string, string>>): string;
|
|
600
657
|
export type SearchcraftSelectOption = {
|
|
601
658
|
label: string;
|
|
602
659
|
value: string | number;
|
|
@@ -800,13 +857,13 @@ export namespace Components {
|
|
|
800
857
|
* ```js
|
|
801
858
|
* // index.js
|
|
802
859
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
803
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
860
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
804
861
|
* <span>Click me</span>
|
|
805
862
|
* `;
|
|
806
863
|
* ```
|
|
807
864
|
* @react-example ```jsx
|
|
808
865
|
* <SearchcraftPopoverButton
|
|
809
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
866
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
810
867
|
* <span>Click me</span>
|
|
811
868
|
* `}
|
|
812
869
|
* >
|
|
@@ -815,7 +872,7 @@ export namespace Components {
|
|
|
815
872
|
* ```
|
|
816
873
|
* @vue-example ```jsx
|
|
817
874
|
* <SearchcraftPopoverButton
|
|
818
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
875
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
819
876
|
* <span>Click me</span>
|
|
820
877
|
* `}
|
|
821
878
|
* >
|
|
@@ -1011,6 +1068,10 @@ export namespace Components {
|
|
|
1011
1068
|
* ```
|
|
1012
1069
|
*/
|
|
1013
1070
|
interface SearchcraftSearchResults {
|
|
1071
|
+
/**
|
|
1072
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
1073
|
+
*/
|
|
1074
|
+
"initialQuery"?: string;
|
|
1014
1075
|
/**
|
|
1015
1076
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
1016
1077
|
*/
|
|
@@ -1363,13 +1424,13 @@ declare global {
|
|
|
1363
1424
|
* ```js
|
|
1364
1425
|
* // index.js
|
|
1365
1426
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
1366
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
1427
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
1367
1428
|
* <span>Click me</span>
|
|
1368
1429
|
* `;
|
|
1369
1430
|
* ```
|
|
1370
1431
|
* @react-example ```jsx
|
|
1371
1432
|
* <SearchcraftPopoverButton
|
|
1372
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
1433
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
1373
1434
|
* <span>Click me</span>
|
|
1374
1435
|
* `}
|
|
1375
1436
|
* >
|
|
@@ -1378,7 +1439,7 @@ declare global {
|
|
|
1378
1439
|
* ```
|
|
1379
1440
|
* @vue-example ```jsx
|
|
1380
1441
|
* <SearchcraftPopoverButton
|
|
1381
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
1442
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
1382
1443
|
* <span>Click me</span>
|
|
1383
1444
|
* `}
|
|
1384
1445
|
* >
|
|
@@ -1910,13 +1971,13 @@ declare namespace LocalJSX {
|
|
|
1910
1971
|
* ```js
|
|
1911
1972
|
* // index.js
|
|
1912
1973
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
1913
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
1974
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
1914
1975
|
* <span>Click me</span>
|
|
1915
1976
|
* `;
|
|
1916
1977
|
* ```
|
|
1917
1978
|
* @react-example ```jsx
|
|
1918
1979
|
* <SearchcraftPopoverButton
|
|
1919
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
1980
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
1920
1981
|
* <span>Click me</span>
|
|
1921
1982
|
* `}
|
|
1922
1983
|
* >
|
|
@@ -1925,7 +1986,7 @@ declare namespace LocalJSX {
|
|
|
1925
1986
|
* ```
|
|
1926
1987
|
* @vue-example ```jsx
|
|
1927
1988
|
* <SearchcraftPopoverButton
|
|
1928
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
1989
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
1929
1990
|
* <span>Click me</span>
|
|
1930
1991
|
* `}
|
|
1931
1992
|
* >
|
|
@@ -2121,6 +2182,10 @@ declare namespace LocalJSX {
|
|
|
2121
2182
|
* ```
|
|
2122
2183
|
*/
|
|
2123
2184
|
interface SearchcraftSearchResults {
|
|
2185
|
+
/**
|
|
2186
|
+
* A query that will appears when the component initializes or the search term is ''..
|
|
2187
|
+
*/
|
|
2188
|
+
"initialQuery"?: string;
|
|
2124
2189
|
/**
|
|
2125
2190
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
2126
2191
|
*/
|
|
@@ -2409,13 +2474,13 @@ declare module "@stencil/core" {
|
|
|
2409
2474
|
* ```js
|
|
2410
2475
|
* // index.js
|
|
2411
2476
|
* const popoverButton = document.querySelector('searchcraft-popover-button');
|
|
2412
|
-
* popoverButton.template = (isPopoverVisible, { html }) => html`
|
|
2477
|
+
* popoverButton.template = ({ isPopoverVisible }, { html }) => html`
|
|
2413
2478
|
* <span>Click me</span>
|
|
2414
2479
|
* `;
|
|
2415
2480
|
* ```
|
|
2416
2481
|
* @react-example ```jsx
|
|
2417
2482
|
* <SearchcraftPopoverButton
|
|
2418
|
-
* template={(isPopoverVisible, { html }) => html`
|
|
2483
|
+
* template={({ isPopoverVisible }, { html }) => html`
|
|
2419
2484
|
* <span>Click me</span>
|
|
2420
2485
|
* `}
|
|
2421
2486
|
* >
|
|
@@ -2424,7 +2489,7 @@ declare module "@stencil/core" {
|
|
|
2424
2489
|
* ```
|
|
2425
2490
|
* @vue-example ```jsx
|
|
2426
2491
|
* <SearchcraftPopoverButton
|
|
2427
|
-
* :template={(isPopoverVisible, { html }) => html`
|
|
2492
|
+
* :template={({ isPopoverVisible }, { html }) => html`
|
|
2428
2493
|
* <span>Click me</span>
|
|
2429
2494
|
* `}
|
|
2430
2495
|
* >
|