@searchcraft/vue-sdk 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.d.ts +194 -1
- package/dist/index.es.js +3511 -3239
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +25 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -147,8 +147,9 @@ export const filterPanelItems = [
|
|
|
147
147
|
field: 'section',
|
|
148
148
|
label: 'Filter by Section',
|
|
149
149
|
options: {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
showSublevel: false,
|
|
151
|
+
initialCollapseState: 'open', // 'open' or 'closed' - controls if section starts expanded or collapsed
|
|
152
|
+
viewMoreThreshold: 8, // Number of facets to show before "view more" link appears (0 = show all)
|
|
152
153
|
},
|
|
153
154
|
},
|
|
154
155
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,19 @@ export interface FacetsFilterItem extends FilterItem {
|
|
|
184
184
|
options: {
|
|
185
185
|
showSublevel: boolean;
|
|
186
186
|
exclude?: string[];
|
|
187
|
+
/**
|
|
188
|
+
* Initial collapse state of the facet section.
|
|
189
|
+
* - 'open': Section is expanded by default
|
|
190
|
+
* - 'closed': Section is collapsed by default
|
|
191
|
+
* @default 'open'
|
|
192
|
+
*/
|
|
193
|
+
initialCollapseState?: "open" | "closed";
|
|
194
|
+
/**
|
|
195
|
+
* The number of facets to show before displaying a "view more" link.
|
|
196
|
+
* Set to 0 to show all facets without a "view more" link.
|
|
197
|
+
* @default 8
|
|
198
|
+
*/
|
|
199
|
+
viewMoreThreshold?: number;
|
|
187
200
|
};
|
|
188
201
|
}
|
|
189
202
|
export interface NumericFilterItem extends FilterItem {
|
|
@@ -837,7 +850,19 @@ export namespace Components {
|
|
|
837
850
|
* It is consumed within the `searchcraft-filter-panel`.
|
|
838
851
|
* @js-example ```html
|
|
839
852
|
* <!-- index.html -->
|
|
853
|
+
* <!-- Basic usage -->
|
|
840
854
|
* <searchcraft-facet-list field-name="title" />
|
|
855
|
+
* <!-- With collapsible section (initially closed) and view more threshold -->
|
|
856
|
+
* <searchcraft-facet-list
|
|
857
|
+
* field-name="category"
|
|
858
|
+
* initial-collapse-state="closed"
|
|
859
|
+
* view-more-threshold="5"
|
|
860
|
+
* />
|
|
861
|
+
* <!-- Show all facets without "view more" link -->
|
|
862
|
+
* <searchcraft-facet-list
|
|
863
|
+
* field-name="brand"
|
|
864
|
+
* view-more-threshold="0"
|
|
865
|
+
* />
|
|
841
866
|
* ```
|
|
842
867
|
* ```js
|
|
843
868
|
* // index.js
|
|
@@ -845,6 +870,8 @@ export namespace Components {
|
|
|
845
870
|
* facetList.addEventListener('facetSelectionUpdated', () => {
|
|
846
871
|
* console.log('Facet selection updated');
|
|
847
872
|
* });
|
|
873
|
+
* // Programmatically toggle collapse state
|
|
874
|
+
* await facetList.handleCollapseToggle();
|
|
848
875
|
* ```
|
|
849
876
|
*/
|
|
850
877
|
interface SearchcraftFacetList {
|
|
@@ -857,10 +884,30 @@ export namespace Components {
|
|
|
857
884
|
* @default ''
|
|
858
885
|
*/
|
|
859
886
|
"fieldName": string;
|
|
887
|
+
/**
|
|
888
|
+
* Returns whether the facet section is currently collapsed.
|
|
889
|
+
* @returns A promise that resolves to true if collapsed, false if expanded.
|
|
890
|
+
*/
|
|
891
|
+
"getIsCollapsed": () => Promise<boolean>;
|
|
892
|
+
/**
|
|
893
|
+
* Toggles the collapsed state of the facet section.
|
|
894
|
+
* @returns A promise that resolves when the toggle is complete.
|
|
895
|
+
*/
|
|
896
|
+
"handleCollapseToggle": () => Promise<void>;
|
|
897
|
+
/**
|
|
898
|
+
* Initial collapse state of the facet section.
|
|
899
|
+
* @default 'open'
|
|
900
|
+
*/
|
|
901
|
+
"initialCollapseState"?: "open" | "closed";
|
|
860
902
|
/**
|
|
861
903
|
* The id of the Searchcraft instance that this component should use.
|
|
862
904
|
*/
|
|
863
905
|
"searchcraftId"?: string;
|
|
906
|
+
/**
|
|
907
|
+
* The number of facets to show before displaying a "view more" link. Set to 0 to show all facets without a "view more" link.
|
|
908
|
+
* @default 8
|
|
909
|
+
*/
|
|
910
|
+
"viewMoreThreshold"?: number;
|
|
864
911
|
}
|
|
865
912
|
/**
|
|
866
913
|
* This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
|
|
@@ -1007,10 +1054,25 @@ export namespace Components {
|
|
|
1007
1054
|
* ```
|
|
1008
1055
|
*/
|
|
1009
1056
|
interface SearchcraftPagination {
|
|
1057
|
+
/**
|
|
1058
|
+
* The URL query string parameter name used to track the current page. When a user navigates to a URL that contains this parameter, the pagination component will automatically navigate to that page.
|
|
1059
|
+
* @default "p"
|
|
1060
|
+
*/
|
|
1061
|
+
"pageQueryParam": string;
|
|
1062
|
+
/**
|
|
1063
|
+
* Whether to scroll to the top of the search results when pagination buttons are clicked.
|
|
1064
|
+
* @default true
|
|
1065
|
+
*/
|
|
1066
|
+
"scrollToTop"?: boolean;
|
|
1010
1067
|
/**
|
|
1011
1068
|
* The id of the Searchcraft instance that this component should use.
|
|
1012
1069
|
*/
|
|
1013
1070
|
"searchcraftId"?: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* Whether to use a query string parameter to track and restore the current page. Set to `false` to disable query string synchronisation entirely.
|
|
1073
|
+
* @default true
|
|
1074
|
+
*/
|
|
1075
|
+
"usePageQueryParam": boolean;
|
|
1014
1076
|
}
|
|
1015
1077
|
/**
|
|
1016
1078
|
* Renders a button which, when clicked, turns on popover visibility.
|
|
@@ -1070,10 +1132,23 @@ export namespace Components {
|
|
|
1070
1132
|
* Renders the footer for the searchcraft-popover-form.
|
|
1071
1133
|
*/
|
|
1072
1134
|
interface SearchcraftPopoverFooter {
|
|
1135
|
+
/**
|
|
1136
|
+
* The SDK variant used to render this component. Used for UTM attribution. This isn't exposed for developer consumption, it's set automatically.
|
|
1137
|
+
* @default 'js'
|
|
1138
|
+
*/
|
|
1139
|
+
"sdkVariant"?: "js" | "react" | "vue";
|
|
1073
1140
|
/**
|
|
1074
1141
|
* The id of the Searchcraft instance that this component should use.
|
|
1075
1142
|
*/
|
|
1076
1143
|
"searchcraftId"?: string;
|
|
1144
|
+
/**
|
|
1145
|
+
* Optional href for the "View all" button.
|
|
1146
|
+
*/
|
|
1147
|
+
"viewAllResultsHref"?: string;
|
|
1148
|
+
/**
|
|
1149
|
+
* Optional label for the "View all" button.
|
|
1150
|
+
*/
|
|
1151
|
+
"viewAllResultsLabel"?: string;
|
|
1077
1152
|
}
|
|
1078
1153
|
/**
|
|
1079
1154
|
* 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.
|
|
@@ -1123,15 +1198,33 @@ export namespace Components {
|
|
|
1123
1198
|
* Formats the content rendered for each result.
|
|
1124
1199
|
*/
|
|
1125
1200
|
"popoverResultMappings"?: PopoverResultMappings;
|
|
1201
|
+
/**
|
|
1202
|
+
* The SDK variant used to render this component. Used for UTM attribution on the footer link.
|
|
1203
|
+
* @default 'js'
|
|
1204
|
+
*/
|
|
1205
|
+
"sdkVariant"?: "js" | "react" | "vue";
|
|
1126
1206
|
/**
|
|
1127
1207
|
* The id of the Searchcraft instance that this component should use.
|
|
1128
1208
|
*/
|
|
1129
1209
|
"searchcraftId"?: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* Whether to display the AI generative summary box before the search results. NOTE: This requires the usage of a read key that has "SUMMARY" permissions and either a subscription to Searchcraft Cloud with AI features enabled or a self-hosted model connected.
|
|
1212
|
+
* @default false
|
|
1213
|
+
*/
|
|
1214
|
+
"showSummaryBox"?: boolean;
|
|
1130
1215
|
/**
|
|
1131
1216
|
* 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.
|
|
1132
1217
|
* @default 'inline'
|
|
1133
1218
|
*/
|
|
1134
1219
|
"type"?: "inline" | "fullscreen" | "modal";
|
|
1220
|
+
/**
|
|
1221
|
+
* Base URL for the "View all" footer link. The current search term will be appended (URL encoded). For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.
|
|
1222
|
+
*/
|
|
1223
|
+
"viewAllResultsBaseUrl"?: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* Optional label for the "View All" footer button. Defaults to "View All".
|
|
1226
|
+
*/
|
|
1227
|
+
"viewAllResultsLabel"?: string;
|
|
1135
1228
|
}
|
|
1136
1229
|
/**
|
|
1137
1230
|
* A single list item rendered in a searchcraft-popover-list-view.
|
|
@@ -1542,7 +1635,19 @@ declare global {
|
|
|
1542
1635
|
* It is consumed within the `searchcraft-filter-panel`.
|
|
1543
1636
|
* @js-example ```html
|
|
1544
1637
|
* <!-- index.html -->
|
|
1638
|
+
* <!-- Basic usage -->
|
|
1545
1639
|
* <searchcraft-facet-list field-name="title" />
|
|
1640
|
+
* <!-- With collapsible section (initially closed) and view more threshold -->
|
|
1641
|
+
* <searchcraft-facet-list
|
|
1642
|
+
* field-name="category"
|
|
1643
|
+
* initial-collapse-state="closed"
|
|
1644
|
+
* view-more-threshold="5"
|
|
1645
|
+
* />
|
|
1646
|
+
* <!-- Show all facets without "view more" link -->
|
|
1647
|
+
* <searchcraft-facet-list
|
|
1648
|
+
* field-name="brand"
|
|
1649
|
+
* view-more-threshold="0"
|
|
1650
|
+
* />
|
|
1546
1651
|
* ```
|
|
1547
1652
|
* ```js
|
|
1548
1653
|
* // index.js
|
|
@@ -1550,6 +1655,8 @@ declare global {
|
|
|
1550
1655
|
* facetList.addEventListener('facetSelectionUpdated', () => {
|
|
1551
1656
|
* console.log('Facet selection updated');
|
|
1552
1657
|
* });
|
|
1658
|
+
* // Programmatically toggle collapse state
|
|
1659
|
+
* await facetList.handleCollapseToggle();
|
|
1553
1660
|
* ```
|
|
1554
1661
|
*/
|
|
1555
1662
|
interface HTMLSearchcraftFacetListElement extends Components.SearchcraftFacetList, HTMLStencilElement {
|
|
@@ -2133,7 +2240,19 @@ declare namespace LocalJSX {
|
|
|
2133
2240
|
* It is consumed within the `searchcraft-filter-panel`.
|
|
2134
2241
|
* @js-example ```html
|
|
2135
2242
|
* <!-- index.html -->
|
|
2243
|
+
* <!-- Basic usage -->
|
|
2136
2244
|
* <searchcraft-facet-list field-name="title" />
|
|
2245
|
+
* <!-- With collapsible section (initially closed) and view more threshold -->
|
|
2246
|
+
* <searchcraft-facet-list
|
|
2247
|
+
* field-name="category"
|
|
2248
|
+
* initial-collapse-state="closed"
|
|
2249
|
+
* view-more-threshold="5"
|
|
2250
|
+
* />
|
|
2251
|
+
* <!-- Show all facets without "view more" link -->
|
|
2252
|
+
* <searchcraft-facet-list
|
|
2253
|
+
* field-name="brand"
|
|
2254
|
+
* view-more-threshold="0"
|
|
2255
|
+
* />
|
|
2137
2256
|
* ```
|
|
2138
2257
|
* ```js
|
|
2139
2258
|
* // index.js
|
|
@@ -2141,6 +2260,8 @@ declare namespace LocalJSX {
|
|
|
2141
2260
|
* facetList.addEventListener('facetSelectionUpdated', () => {
|
|
2142
2261
|
* console.log('Facet selection updated');
|
|
2143
2262
|
* });
|
|
2263
|
+
* // Programmatically toggle collapse state
|
|
2264
|
+
* await facetList.handleCollapseToggle();
|
|
2144
2265
|
* ```
|
|
2145
2266
|
*/
|
|
2146
2267
|
interface SearchcraftFacetList {
|
|
@@ -2153,6 +2274,11 @@ declare namespace LocalJSX {
|
|
|
2153
2274
|
* @default ''
|
|
2154
2275
|
*/
|
|
2155
2276
|
"fieldName"?: string;
|
|
2277
|
+
/**
|
|
2278
|
+
* Initial collapse state of the facet section.
|
|
2279
|
+
* @default 'open'
|
|
2280
|
+
*/
|
|
2281
|
+
"initialCollapseState"?: "open" | "closed";
|
|
2156
2282
|
/**
|
|
2157
2283
|
* Emitted when the facets are updated.
|
|
2158
2284
|
*/
|
|
@@ -2163,6 +2289,11 @@ declare namespace LocalJSX {
|
|
|
2163
2289
|
* The id of the Searchcraft instance that this component should use.
|
|
2164
2290
|
*/
|
|
2165
2291
|
"searchcraftId"?: string;
|
|
2292
|
+
/**
|
|
2293
|
+
* The number of facets to show before displaying a "view more" link. Set to 0 to show all facets without a "view more" link.
|
|
2294
|
+
* @default 8
|
|
2295
|
+
*/
|
|
2296
|
+
"viewMoreThreshold"?: number;
|
|
2166
2297
|
}
|
|
2167
2298
|
/**
|
|
2168
2299
|
* This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
|
|
@@ -2321,10 +2452,25 @@ declare namespace LocalJSX {
|
|
|
2321
2452
|
* ```
|
|
2322
2453
|
*/
|
|
2323
2454
|
interface SearchcraftPagination {
|
|
2455
|
+
/**
|
|
2456
|
+
* The URL query string parameter name used to track the current page. When a user navigates to a URL that contains this parameter, the pagination component will automatically navigate to that page.
|
|
2457
|
+
* @default "p"
|
|
2458
|
+
*/
|
|
2459
|
+
"pageQueryParam"?: string;
|
|
2460
|
+
/**
|
|
2461
|
+
* Whether to scroll to the top of the search results when pagination buttons are clicked.
|
|
2462
|
+
* @default true
|
|
2463
|
+
*/
|
|
2464
|
+
"scrollToTop"?: boolean;
|
|
2324
2465
|
/**
|
|
2325
2466
|
* The id of the Searchcraft instance that this component should use.
|
|
2326
2467
|
*/
|
|
2327
2468
|
"searchcraftId"?: string;
|
|
2469
|
+
/**
|
|
2470
|
+
* Whether to use a query string parameter to track and restore the current page. Set to `false` to disable query string synchronisation entirely.
|
|
2471
|
+
* @default true
|
|
2472
|
+
*/
|
|
2473
|
+
"usePageQueryParam"?: boolean;
|
|
2328
2474
|
}
|
|
2329
2475
|
/**
|
|
2330
2476
|
* Renders a button which, when clicked, turns on popover visibility.
|
|
@@ -2384,10 +2530,23 @@ declare namespace LocalJSX {
|
|
|
2384
2530
|
* Renders the footer for the searchcraft-popover-form.
|
|
2385
2531
|
*/
|
|
2386
2532
|
interface SearchcraftPopoverFooter {
|
|
2533
|
+
/**
|
|
2534
|
+
* The SDK variant used to render this component. Used for UTM attribution. This isn't exposed for developer consumption, it's set automatically.
|
|
2535
|
+
* @default 'js'
|
|
2536
|
+
*/
|
|
2537
|
+
"sdkVariant"?: "js" | "react" | "vue";
|
|
2387
2538
|
/**
|
|
2388
2539
|
* The id of the Searchcraft instance that this component should use.
|
|
2389
2540
|
*/
|
|
2390
2541
|
"searchcraftId"?: string;
|
|
2542
|
+
/**
|
|
2543
|
+
* Optional href for the "View all" button.
|
|
2544
|
+
*/
|
|
2545
|
+
"viewAllResultsHref"?: string;
|
|
2546
|
+
/**
|
|
2547
|
+
* Optional label for the "View all" button.
|
|
2548
|
+
*/
|
|
2549
|
+
"viewAllResultsLabel"?: string;
|
|
2391
2550
|
}
|
|
2392
2551
|
/**
|
|
2393
2552
|
* 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.
|
|
@@ -2437,15 +2596,33 @@ declare namespace LocalJSX {
|
|
|
2437
2596
|
* Formats the content rendered for each result.
|
|
2438
2597
|
*/
|
|
2439
2598
|
"popoverResultMappings"?: PopoverResultMappings;
|
|
2599
|
+
/**
|
|
2600
|
+
* The SDK variant used to render this component. Used for UTM attribution on the footer link.
|
|
2601
|
+
* @default 'js'
|
|
2602
|
+
*/
|
|
2603
|
+
"sdkVariant"?: "js" | "react" | "vue";
|
|
2440
2604
|
/**
|
|
2441
2605
|
* The id of the Searchcraft instance that this component should use.
|
|
2442
2606
|
*/
|
|
2443
2607
|
"searchcraftId"?: string;
|
|
2608
|
+
/**
|
|
2609
|
+
* Whether to display the AI generative summary box before the search results. NOTE: This requires the usage of a read key that has "SUMMARY" permissions and either a subscription to Searchcraft Cloud with AI features enabled or a self-hosted model connected.
|
|
2610
|
+
* @default false
|
|
2611
|
+
*/
|
|
2612
|
+
"showSummaryBox"?: boolean;
|
|
2444
2613
|
/**
|
|
2445
2614
|
* 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.
|
|
2446
2615
|
* @default 'inline'
|
|
2447
2616
|
*/
|
|
2448
2617
|
"type"?: "inline" | "fullscreen" | "modal";
|
|
2618
|
+
/**
|
|
2619
|
+
* Base URL for the "View all" footer link. The current search term will be appended (URL encoded). For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.
|
|
2620
|
+
*/
|
|
2621
|
+
"viewAllResultsBaseUrl"?: string;
|
|
2622
|
+
/**
|
|
2623
|
+
* Optional label for the "View All" footer button. Defaults to "View All".
|
|
2624
|
+
*/
|
|
2625
|
+
"viewAllResultsLabel"?: string;
|
|
2449
2626
|
}
|
|
2450
2627
|
/**
|
|
2451
2628
|
* A single list item rendered in a searchcraft-popover-list-view.
|
|
@@ -2840,7 +3017,19 @@ declare module "@stencil/core" {
|
|
|
2840
3017
|
* It is consumed within the `searchcraft-filter-panel`.
|
|
2841
3018
|
* @js-example ```html
|
|
2842
3019
|
* <!-- index.html -->
|
|
3020
|
+
* <!-- Basic usage -->
|
|
2843
3021
|
* <searchcraft-facet-list field-name="title" />
|
|
3022
|
+
* <!-- With collapsible section (initially closed) and view more threshold -->
|
|
3023
|
+
* <searchcraft-facet-list
|
|
3024
|
+
* field-name="category"
|
|
3025
|
+
* initial-collapse-state="closed"
|
|
3026
|
+
* view-more-threshold="5"
|
|
3027
|
+
* />
|
|
3028
|
+
* <!-- Show all facets without "view more" link -->
|
|
3029
|
+
* <searchcraft-facet-list
|
|
3030
|
+
* field-name="brand"
|
|
3031
|
+
* view-more-threshold="0"
|
|
3032
|
+
* />
|
|
2844
3033
|
* ```
|
|
2845
3034
|
* ```js
|
|
2846
3035
|
* // index.js
|
|
@@ -2848,6 +3037,8 @@ declare module "@stencil/core" {
|
|
|
2848
3037
|
* facetList.addEventListener('facetSelectionUpdated', () => {
|
|
2849
3038
|
* console.log('Facet selection updated');
|
|
2850
3039
|
* });
|
|
3040
|
+
* // Programmatically toggle collapse state
|
|
3041
|
+
* await facetList.handleCollapseToggle();
|
|
2851
3042
|
* ```
|
|
2852
3043
|
*/
|
|
2853
3044
|
"searchcraft-facet-list": LocalJSX.SearchcraftFacetList & JSXBase.HTMLAttributes<HTMLSearchcraftFacetListElement>;
|
|
@@ -3323,7 +3514,9 @@ export interface SearchcraftPopoverFormProps extends Components.SearchcraftPopov
|
|
|
3323
3514
|
* </template>
|
|
3324
3515
|
* ```
|
|
3325
3516
|
*/
|
|
3326
|
-
export declare const SearchcraftPopoverForm: import("vue").
|
|
3517
|
+
export declare const SearchcraftPopoverForm: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
3518
|
+
[key: string]: any;
|
|
3519
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
3327
3520
|
/**
|
|
3328
3521
|
* The Props for the SearchcraftResultsInfo component.
|
|
3329
3522
|
*/
|