@searchcraft/javascript-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 +5 -0
- package/dist/components/defineCustomElements.js +23 -23
- package/dist/components/html.js +1 -1
- package/dist/components/index.d.ts +191 -0
- package/dist/components/index.js +28 -30
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +12 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/searchcraft-ad.js +1 -1
- package/dist/components/searchcraft-ad2.js +4 -4
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-button2.js +2 -2
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-error-message2.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-facet-list2.js +59 -4
- package/dist/components/searchcraft-facet-list2.js.map +1 -1
- package/dist/components/searchcraft-filter-panel.js +47 -6
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-input-form2.js +6 -6
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input-label2.js +2 -2
- package/dist/components/searchcraft-loading.js +1 -1
- package/dist/components/searchcraft-loading2.js +5 -2
- package/dist/components/searchcraft-loading2.js.map +1 -1
- package/dist/components/searchcraft-pagination.js +137 -4
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +4 -4
- package/dist/components/searchcraft-popover-footer.js +1 -1
- package/dist/components/searchcraft-popover-footer2.js +52 -6
- package/dist/components/searchcraft-popover-footer2.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +96 -22
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-item2.js +4 -4
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-popover-list-view2.js +4 -4
- package/dist/components/searchcraft-results-info.js +4 -4
- package/dist/components/searchcraft-search-result.js +1 -1
- package/dist/components/searchcraft-search-result2.js +3 -3
- package/dist/components/searchcraft-search-results-per-page.js +3 -3
- package/dist/components/searchcraft-search-results.js +5 -5
- package/dist/components/searchcraft-select.js +1 -1
- package/dist/components/searchcraft-select2.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-slider2.js +5 -5
- package/dist/components/searchcraft-summary-box.js +1 -2256
- package/dist/components/searchcraft-summary-box.js.map +1 -1
- package/dist/components/searchcraft-summary-box2.js +2261 -0
- package/dist/components/searchcraft-summary-box2.js.map +1 -0
- package/dist/components/searchcraft-theme.js +3 -3
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/components/searchcraft-toggle-button2.js +5 -5
- package/dist/hydrate/index.js +389 -19
- package/dist/hydrate/index.mjs +389 -19
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +47 -0
- package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +37 -0
- package/dist/types/components/searchcraft-popover-footer/searchcraft-popover-footer.d.ts +15 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +24 -0
- package/dist/types/components.d.ts +168 -0
- package/dist/types/types/sdk-types/searchcraft-filter-panel.types.d.ts +13 -0
- package/package.json +19 -2
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { c as classNames } from './index3.js?
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
9
|
-
import { d as defineCustomElement$
|
|
10
|
-
import { d as defineCustomElement$
|
|
11
|
-
import { d as defineCustomElement$
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { c as classNames } from './index3.js?scv=0.14.0';
|
|
4
|
+
import { d as defineCustomElement$b } from './searchcraft-ad2.js?scv=0.14.0';
|
|
5
|
+
import { d as defineCustomElement$a } from './searchcraft-button2.js?scv=0.14.0';
|
|
6
|
+
import { d as defineCustomElement$9 } from './searchcraft-error-message2.js?scv=0.14.0';
|
|
7
|
+
import { d as defineCustomElement$8 } from './searchcraft-input-form2.js?scv=0.14.0';
|
|
8
|
+
import { d as defineCustomElement$7 } from './searchcraft-input-label2.js?scv=0.14.0';
|
|
9
|
+
import { d as defineCustomElement$6 } from './searchcraft-loading2.js?scv=0.14.0';
|
|
10
|
+
import { d as defineCustomElement$5 } from './searchcraft-popover-footer2.js?scv=0.14.0';
|
|
11
|
+
import { d as defineCustomElement$4 } from './searchcraft-popover-list-item2.js?scv=0.14.0';
|
|
12
|
+
import { d as defineCustomElement$3 } from './searchcraft-popover-list-view2.js?scv=0.14.0';
|
|
13
|
+
import { d as defineCustomElement$2 } from './searchcraft-summary-box2.js?scv=0.14.0';
|
|
12
14
|
|
|
13
15
|
const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverForm extends H {
|
|
14
16
|
constructor(registerHost) {
|
|
@@ -50,6 +52,27 @@ const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
|
|
|
50
52
|
* 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
|
|
51
53
|
*/
|
|
52
54
|
placeholderBehavior;
|
|
55
|
+
/**
|
|
56
|
+
* Base URL for the "View all" footer link. The current search term will be appended (URL encoded).
|
|
57
|
+
*
|
|
58
|
+
* For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.
|
|
59
|
+
*/
|
|
60
|
+
viewAllResultsBaseUrl;
|
|
61
|
+
/**
|
|
62
|
+
* Optional label for the "View All" footer button. Defaults to "View All".
|
|
63
|
+
*/
|
|
64
|
+
viewAllResultsLabel;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to display the AI generative summary box before the search results.
|
|
67
|
+
* 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.
|
|
68
|
+
*/
|
|
69
|
+
showSummaryBox = false;
|
|
70
|
+
/**
|
|
71
|
+
* The SDK variant used to render this component. Used for UTM attribution on the footer link.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
sdkVariant = 'js';
|
|
53
76
|
isPopoverVisibleInState = false;
|
|
54
77
|
searchClientResponseItems = [];
|
|
55
78
|
adClientResponseItems = [];
|
|
@@ -136,6 +159,14 @@ const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
|
|
|
136
159
|
case 'Escape':
|
|
137
160
|
this.core?.store.getState().setPopoverVisibility(false);
|
|
138
161
|
break;
|
|
162
|
+
case 'Enter':
|
|
163
|
+
if ((event.metaKey || event.ctrlKey) &&
|
|
164
|
+
this.viewAllResultsHref &&
|
|
165
|
+
this.hasResultsToShow) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
this.navigateToViewAllResults();
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
139
170
|
default:
|
|
140
171
|
return;
|
|
141
172
|
}
|
|
@@ -166,6 +197,12 @@ const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
|
|
|
166
197
|
if (this.placeholderBehavior) {
|
|
167
198
|
this.modalElement.setAttribute('placeholder-behavior', this.placeholderBehavior);
|
|
168
199
|
}
|
|
200
|
+
if (this.viewAllResultsBaseUrl) {
|
|
201
|
+
this.modalElement.setAttribute('view-all-results-base-url', this.viewAllResultsBaseUrl);
|
|
202
|
+
}
|
|
203
|
+
if (this.viewAllResultsLabel) {
|
|
204
|
+
this.modalElement.setAttribute('view-all-results-label', this.viewAllResultsLabel);
|
|
205
|
+
}
|
|
169
206
|
document.body.appendChild(this.modalElement);
|
|
170
207
|
}
|
|
171
208
|
}
|
|
@@ -229,24 +266,47 @@ const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
|
|
|
229
266
|
this.searchTerm?.trim()?.length > 0 &&
|
|
230
267
|
this.searchClientResponseItems.length > 0);
|
|
231
268
|
}
|
|
269
|
+
get viewAllResultsHref() {
|
|
270
|
+
const baseUrl = this.viewAllResultsBaseUrl;
|
|
271
|
+
if (!baseUrl) {
|
|
272
|
+
return undefined;
|
|
273
|
+
}
|
|
274
|
+
const term = this.searchTerm?.trim();
|
|
275
|
+
if (!term) {
|
|
276
|
+
return baseUrl;
|
|
277
|
+
}
|
|
278
|
+
return `${baseUrl}${encodeURIComponent(term).replace(/%20/g, '+')}`;
|
|
279
|
+
}
|
|
280
|
+
get resolvedViewAllResultsLabel() {
|
|
281
|
+
return this.viewAllResultsLabel ?? 'View All';
|
|
282
|
+
}
|
|
283
|
+
navigateToViewAllResults() {
|
|
284
|
+
const href = this.viewAllResultsHref;
|
|
285
|
+
if (!href || !this.hasResultsToShow) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (typeof window !== 'undefined') {
|
|
289
|
+
window.location.href = href;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
232
292
|
renderInlinePopover() {
|
|
233
293
|
const isListViewVisible = this.hasResultsToShow && this.isFocused;
|
|
234
294
|
return (h("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-inline', {
|
|
235
295
|
'searchcraft-popover-form-active': isListViewVisible,
|
|
236
|
-
}) }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (h("div", { class: 'searchcraft-popover-form-inline-wrapper' }, h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })))));
|
|
296
|
+
}) }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-inline-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior })), isListViewVisible && (h("div", { class: 'searchcraft-popover-form-inline-wrapper' }, this.showSummaryBox && (h("searchcraft-summary-box", { searchcraftId: this.searchcraftId })), h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })))));
|
|
237
297
|
}
|
|
238
298
|
renderModalPopover() {
|
|
239
299
|
if (this.isPopoverVisibleInState) {
|
|
240
300
|
return (h("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-modal', {
|
|
241
301
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
242
|
-
}) }, h("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), h("div", { class: 'searchcraft-popover-form-modal-wrapper' }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), h("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId }))));
|
|
302
|
+
}) }, h("div", { class: 'searchcraft-popover-form-modal-backdrop', onClick: this.handleModalBackdropClick }), h("div", { class: 'searchcraft-popover-form-modal-wrapper' }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-modal-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), h("div", { class: 'searchcraft-popover-form-modal-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (h("searchcraft-summary-box", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel }))));
|
|
243
303
|
}
|
|
244
304
|
}
|
|
245
305
|
renderFullscreenPopover() {
|
|
246
306
|
if (this.isPopoverVisibleInState) {
|
|
247
307
|
return (h("div", { class: classNames('searchcraft-popover-form searchcraft-popover-form-fullscreen', {
|
|
248
308
|
'searchcraft-popover-form-active': this.hasResultsToShow,
|
|
249
|
-
}) }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), h("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId })));
|
|
309
|
+
}) }, h("div", { class: 'searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input' }, h("searchcraft-input-form", { onInputFocus: this.handleInputFocus.bind(this), onInputInit: this.handleInputInit.bind(this), searchcraftId: this.searchcraftId, placeholderValue: this.placeholderValue, placeholderBehavior: this.placeholderBehavior }), h("button", { type: 'button', class: 'searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button', onClick: this.handleCancelButtonClick.bind(this) }, "Cancel")), h("div", { class: 'searchcraft-popover-form-fullscreen-popover-list-view' }, this.showSummaryBox && this.hasResultsToShow && (h("searchcraft-summary-box", { searchcraftId: this.searchcraftId })), this.hasResultsToShow && (h("searchcraft-popover-list-view", { popoverResultMappings: this.popoverResultMappings, searchClientResponseItems: this.searchClientResponseItems, adClientResponseItems: this.adClientResponseItems, searchResultsPage: this.searchResultsPage, searchResultsPerPage: this.searchResultsPerPage, searchcraftId: this.searchcraftId }))), h("searchcraft-popover-footer", { searchcraftId: this.searchcraftId, sdkVariant: this.sdkVariant, viewAllResultsHref: this.viewAllResultsHref, viewAllResultsLabel: this.resolvedViewAllResultsLabel })));
|
|
250
310
|
}
|
|
251
311
|
}
|
|
252
312
|
render() {
|
|
@@ -267,6 +327,10 @@ const SearchcraftPopoverForm$1 = /*@__PURE__*/ proxyCustomElement(class Searchcr
|
|
|
267
327
|
"searchcraftId": [1, "searchcraft-id"],
|
|
268
328
|
"placeholderValue": [1, "placeholder-value"],
|
|
269
329
|
"placeholderBehavior": [1, "placeholder-behavior"],
|
|
330
|
+
"viewAllResultsBaseUrl": [1, "view-all-results-base-url"],
|
|
331
|
+
"viewAllResultsLabel": [1, "view-all-results-label"],
|
|
332
|
+
"showSummaryBox": [4, "show-summary-box"],
|
|
333
|
+
"sdkVariant": [1, "sdk-variant"],
|
|
270
334
|
"isPopoverVisibleInState": [32],
|
|
271
335
|
"searchClientResponseItems": [32],
|
|
272
336
|
"adClientResponseItems": [32],
|
|
@@ -283,7 +347,7 @@ function defineCustomElement$1() {
|
|
|
283
347
|
if (typeof customElements === "undefined") {
|
|
284
348
|
return;
|
|
285
349
|
}
|
|
286
|
-
const components = ["searchcraft-popover-form", "searchcraft-ad", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-form", "searchcraft-input-label", "searchcraft-popover-footer", "searchcraft-popover-form", "searchcraft-popover-list-item", "searchcraft-popover-list-view"];
|
|
350
|
+
const components = ["searchcraft-popover-form", "searchcraft-ad", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-form", "searchcraft-input-label", "searchcraft-loading", "searchcraft-popover-footer", "searchcraft-popover-form", "searchcraft-popover-list-item", "searchcraft-popover-list-view", "searchcraft-summary-box"];
|
|
287
351
|
components.forEach(tagName => { switch (tagName) {
|
|
288
352
|
case "searchcraft-popover-form":
|
|
289
353
|
if (!customElements.get(transformTag(tagName))) {
|
|
@@ -292,32 +356,37 @@ function defineCustomElement$1() {
|
|
|
292
356
|
break;
|
|
293
357
|
case "searchcraft-ad":
|
|
294
358
|
if (!customElements.get(transformTag(tagName))) {
|
|
295
|
-
defineCustomElement$
|
|
359
|
+
defineCustomElement$b();
|
|
296
360
|
}
|
|
297
361
|
break;
|
|
298
362
|
case "searchcraft-button":
|
|
299
363
|
if (!customElements.get(transformTag(tagName))) {
|
|
300
|
-
defineCustomElement$
|
|
364
|
+
defineCustomElement$a();
|
|
301
365
|
}
|
|
302
366
|
break;
|
|
303
367
|
case "searchcraft-error-message":
|
|
304
368
|
if (!customElements.get(transformTag(tagName))) {
|
|
305
|
-
defineCustomElement$
|
|
369
|
+
defineCustomElement$9();
|
|
306
370
|
}
|
|
307
371
|
break;
|
|
308
372
|
case "searchcraft-input-form":
|
|
309
373
|
if (!customElements.get(transformTag(tagName))) {
|
|
310
|
-
defineCustomElement$
|
|
374
|
+
defineCustomElement$8();
|
|
311
375
|
}
|
|
312
376
|
break;
|
|
313
377
|
case "searchcraft-input-label":
|
|
314
378
|
if (!customElements.get(transformTag(tagName))) {
|
|
315
|
-
defineCustomElement$
|
|
379
|
+
defineCustomElement$7();
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
case "searchcraft-loading":
|
|
383
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
384
|
+
defineCustomElement$6();
|
|
316
385
|
}
|
|
317
386
|
break;
|
|
318
387
|
case "searchcraft-popover-footer":
|
|
319
388
|
if (!customElements.get(transformTag(tagName))) {
|
|
320
|
-
defineCustomElement$
|
|
389
|
+
defineCustomElement$5();
|
|
321
390
|
}
|
|
322
391
|
break;
|
|
323
392
|
case "searchcraft-popover-form":
|
|
@@ -327,10 +396,15 @@ function defineCustomElement$1() {
|
|
|
327
396
|
break;
|
|
328
397
|
case "searchcraft-popover-list-item":
|
|
329
398
|
if (!customElements.get(transformTag(tagName))) {
|
|
330
|
-
defineCustomElement$
|
|
399
|
+
defineCustomElement$4();
|
|
331
400
|
}
|
|
332
401
|
break;
|
|
333
402
|
case "searchcraft-popover-list-view":
|
|
403
|
+
if (!customElements.get(transformTag(tagName))) {
|
|
404
|
+
defineCustomElement$3();
|
|
405
|
+
}
|
|
406
|
+
break;
|
|
407
|
+
case "searchcraft-summary-box":
|
|
334
408
|
if (!customElements.get(transformTag(tagName))) {
|
|
335
409
|
defineCustomElement$2();
|
|
336
410
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-popover-form.js","mappings":";;;;;;;;;;;;MAmDaA,wBAAsB,iBAAAC,kBAAA,CAAA,MAAA,sBAAA,SAAAC,CAAA,CAAA;;;;;;;AACjC;;;;;AAKG;IACK,IAAI,GAAuC,QAAQ;AAC3D;;AAEG;AACK,IAAA,qBAAqB;AAC7B;;AAEG;IACK,MAAM,GAAY,GAAG;AAC7B;;AAEG;IACK,cAAc,GAAwC,MAAM;AACpE;;AAEG;AACK,IAAA,aAAa;AACrB;;AAEG;IACK,gBAAgB,GAAY,cAAc;AAClD;;;;AAIG;AACK,IAAA,mBAAmB;IAElB,uBAAuB,GAAG,KAAK;IAC/B,yBAAyB,GAA+B,EAAE;IAC1D,qBAAqB,GAA2B,EAAE;AAClD,IAAA,UAAU;IACV,SAAS,GAAG,KAAK;IACjB,YAAY,GAAG,GAAG;IAClB,YAAY,GAAG,GAAG;IAClB,YAAY,GAAG,GAAG;AAClB,IAAA,iBAAiB;AACjB,IAAA,oBAAoB;AAEpB,IAAA,YAAY;;AAIb,IAAA,WAAW;AACX,IAAA,WAAW;AACnB,IAAA,IAAI;AAEJ,IAAA,eAAe,CAAC,IAAqB,EAAA;AACnC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;;QAEhB,MAAM,aAAa,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC;AAChE,QAAA,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,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AAC,mBAAmB,EAC7C,CAAA,EACF,CAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,0FAA0F,EAChG,OAAO,EAAE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,aAGzC,CACL,EACN,CAAK,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,uDAAuD,EAAA,EAC/D,IAAI,CAAC,gBAAgB,KACpB,CAAA,CAAA,+BAAA,EAAA,EACE,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EACjD,yBAAyB,EAAE,IAAI,CAAC,yBAAyB,EACzD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,EACjD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,aAAa,EAAE,IAAI,CAAC,aAAa,EACjC,CAAA,CACH,CACG,EACN,CAA4B,CAAA,4BAAA,EAAA,EAAA,aAAa,EAAE,IAAI,CAAC,aAAa,EAAI,CAAA,CAC7D;;;IAKZ,MAAM,GAAA;AACJ,QAAA,QAAQ,IAAI,CAAC,IAAI;AACf,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,IAAI,CAAC,mBAAmB,EAAE;AACnC,YAAA,KAAK,OAAO;AACV,gBAAA,OAAO,IAAI,CAAC,kBAAkB,EAAE;AAClC,YAAA,KAAK,YAAY;AACf,gBAAA,OAAO,IAAI,CAAC,uBAAuB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftPopoverForm","__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, Element, Prop, State, h } from '@stencil/core';\nimport type {\n AdClientResponseItem,\n PopoverResultMappings,\n SearchClientResponseItem,\n} from '@types';\nimport classNames from 'classnames';\n\n/**\n * 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.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftPopoverForm } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftPopoverForm } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-form type=\"inline\" />\n * ```\n *\n * ```js\n * // index.js\n * const popoverForm = document.querySelector('searchcraft-popover-form');\n *\n * popoverForm.popoverResultMappings = {};\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftPopoverForm type=\"inline\" popoverResultMappings={[]} />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftPopoverForm type=\"inline\" :popoverResultMappings=\"[]\"\" />\n * ```\n *\n */\n@Component({\n tag: 'searchcraft-popover-form',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n /**\n * The type of popover form to render.\n * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.\n */\n @Prop() type?: 'inline' | 'fullscreen' | 'modal' = 'inline';\n /**\n * Formats the content rendered for each result.\n */\n @Prop() popoverResultMappings?: PopoverResultMappings;\n /**\n * The hotkey that activates the popover.\n */\n @Prop() hotkey?: string = 'k';\n /**\n * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.\n */\n @Prop() hotkeyModifier?: 'ctrl' | 'meta' | 'alt' | 'option' = 'meta';\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue?: string = 'Enter Search';\n /**\n * The placeholder's render behavior.\n * 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus.\n * 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.\n */\n @Prop() placeholderBehavior?: 'hide-on-focus' | 'hide-on-text-entered';\n\n @State() isPopoverVisibleInState = false;\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchTerm: string | undefined;\n @State() isFocused = false;\n @State() breakpointSm = 576;\n @State() breakpointMd = 768;\n @State() breakpointLg = 992;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n\n @State() modalElement;\n\n @Element() hostElement!: HTMLElement;\n\n private unsubscribe: (() => void) | undefined;\n private cleanupCore?: () => void;\n core?: SearchcraftCore;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.core = core;\n // Loads the breakpoint values into state\n const computedStyle = getComputedStyle(document.documentElement);\n this.breakpointSm = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-sm').trim(),\n );\n this.breakpointMd = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-md').trim(),\n );\n this.breakpointLg = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-lg').trim(),\n );\n // Set popover visiblity in state\n this.isPopoverVisibleInState = core.store.getState().isPopoverVisible;\n\n // Add event listeners\n document.addEventListener('click', this.handleDocumentClick);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n\n // Subscribe to state events\n this.unsubscribe = core.store.subscribe((state) => {\n if (this.isPopoverVisibleInState !== state.isPopoverVisible) {\n this.handlePopoverVisibilityChange(state.isPopoverVisible);\n }\n\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n });\n\n // Set hotkey and hotkeyModifier in state.\n core.store\n .getState()\n .setHotKeyAndHotKeyModifier(this.hotkey, this.hotkeyModifier);\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n document.removeEventListener('click', this.handleDocumentClick);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n handleDocumentClick = (event: MouseEvent) => {\n if (!this.hostElement.contains(event.target as Node)) {\n this.isFocused = false;\n }\n };\n\n /**\n * Handles when popover visibility is changed in state\n */\n handlePopoverVisibilityChange(isVisible: boolean) {\n this.isPopoverVisibleInState = isVisible;\n document.body.style.overflow = isVisible ? 'hidden' : 'auto';\n }\n\n /**\n * Actions to perform when various keys are pressed within the popover form.\n */\n handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Document-scoped actions\n if (event.key === this.hotkey) {\n this.handleHotkeyPressed(event);\n }\n\n // Document-scoped -> Popover-scoped keyboard event boundary\n if (!this.hostElement.contains(document.activeElement)) {\n return;\n }\n\n // Popover-scoped actions\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n this.focusOnNextListItem(event.key);\n break;\n case 'Escape':\n this.core?.store.getState().setPopoverVisibility(false);\n break;\n default:\n return;\n }\n };\n\n handleInputInit = () => {\n const input = this.hostElement.querySelector(\n '.searchcraft-input-form-input',\n ) as HTMLInputElement | undefined;\n input?.focus();\n };\n\n /**\n * When popover is `inline` and the viewport is at the smallest breakpoint,\n * focusing on the input will open a modal version of the popover form.\n */\n handleInputFocus() {\n this.isFocused = true;\n\n if (\n this.type === 'inline' &&\n window.visualViewport &&\n window.visualViewport.width < this.breakpointSm\n ) {\n this.core?.store.getState().setPopoverVisibility(true);\n\n // Appends a popover form of type=`modal` to the body\n if (!this.modalElement) {\n this.modalElement = document.createElement('searchcraft-popover-form');\n this.modalElement.popoverResultMappings = this.popoverResultMappings;\n this.modalElement.setAttribute('type', 'fullscreen');\n this.modalElement.setAttribute('searchcraft-id', this.searchcraftId);\n if (this.placeholderValue) {\n this.modalElement.setAttribute(\n 'placeholder-value',\n this.placeholderValue,\n );\n }\n if (this.placeholderBehavior) {\n this.modalElement.setAttribute(\n 'placeholder-behavior',\n this.placeholderBehavior,\n );\n }\n document.body.appendChild(this.modalElement);\n }\n }\n }\n\n handleModalBackdropClick(_event: MouseEvent) {\n this.core?.store.getState().setPopoverVisibility(false);\n }\n\n /**\n * When a hotkey is pressed, tests if the modifiers also match.\n * If modifiers match, toggles visibility of the popover modal.\n */\n handleHotkeyPressed(event: KeyboardEvent) {\n if (\n (event.ctrlKey && this.hotkeyModifier === 'ctrl') ||\n (event.altKey && this.hotkeyModifier === 'alt') ||\n (event.metaKey && this.hotkeyModifier === 'meta')\n ) {\n event.preventDefault();\n if (this.type === 'inline' && !this.isPopoverVisibleInState) {\n const hostElementInput = this.hostElement.querySelector(\n '.searchcraft-input-form-input',\n ) as HTMLInputElement | undefined;\n hostElementInput?.focus();\n } else {\n this.core?.store\n .getState()\n .setPopoverVisibility(!this.isPopoverVisibleInState);\n }\n }\n }\n\n handleCancelButtonClick() {\n this.core?.store.getState().setPopoverVisibility(false);\n }\n\n /**\n * Moves focus to the next/previous list item in the list view. If you are at the top\n * of the list view, it moves focus back to the input.\n *\n * @param direction\n */\n focusOnNextListItem(direction: 'ArrowDown' | 'ArrowUp') {\n const listItems = Array.from(\n document.querySelectorAll<HTMLAnchorElement>(\n '.searchcraft-popover-list-item-link',\n ),\n ).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);\n\n const currentIndex = listItems.indexOf(\n document.activeElement as HTMLAnchorElement,\n );\n\n if (direction === 'ArrowDown') {\n listItems[(currentIndex + 1) % listItems.length]?.focus();\n } else if (direction === 'ArrowUp') {\n if (currentIndex >= 1) {\n listItems[currentIndex - 1]?.focus();\n } else {\n const input = document.querySelector('.searchcraft-input-form-input') as\n | HTMLInputElement\n | undefined;\n\n if (input) {\n input.focus();\n requestAnimationFrame(() => {\n input.selectionEnd = input.value.length;\n input.selectionStart = input.value.length;\n });\n }\n }\n }\n }\n\n get hasResultsToShow() {\n return (\n this.searchTerm &&\n this.searchTerm?.trim()?.length > 0 &&\n this.searchClientResponseItems.length > 0\n );\n }\n\n renderInlinePopover() {\n const isListViewVisible = this.hasResultsToShow && this.isFocused;\n\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-inline',\n {\n 'searchcraft-popover-form-active': isListViewVisible,\n },\n )}\n >\n <div class='searchcraft-popover-form-input searchcraft-popover-form-inline-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n </div>\n {isListViewVisible && (\n <div class='searchcraft-popover-form-inline-wrapper'>\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n <searchcraft-popover-footer searchcraftId={this.searchcraftId} />\n </div>\n )}\n </div>\n );\n }\n\n renderModalPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-modal',\n {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n },\n )}\n >\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}\n <div\n class='searchcraft-popover-form-modal-backdrop'\n onClick={this.handleModalBackdropClick}\n />\n <div class='searchcraft-popover-form-modal-wrapper'>\n <div class='searchcraft-popover-form-input searchcraft-popover-form-modal-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n <div class='searchcraft-popover-form-modal-popover-list-view'>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n )}\n </div>\n <searchcraft-popover-footer searchcraftId={this.searchcraftId} />\n </div>\n </div>\n );\n }\n }\n\n renderFullscreenPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-fullscreen',\n {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n },\n )}\n >\n <div class='searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n <div class='searchcraft-popover-form-fullscreen-popover-list-view'>\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n )}\n </div>\n <searchcraft-popover-footer searchcraftId={this.searchcraftId} />\n </div>\n );\n }\n }\n\n render() {\n switch (this.type) {\n case 'inline':\n return this.renderInlinePopover();\n case 'modal':\n return this.renderModalPopover();\n case 'fullscreen':\n return this.renderFullscreenPopover();\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"searchcraft-popover-form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AACX,gBAAA,OAAO,IAAI,CAAC,mBAAmB,EAAE;AACnC,YAAA,KAAK,OAAO;AACV,gBAAA,OAAO,IAAI,CAAC,kBAAkB,EAAE;AAClC,YAAA,KAAK,YAAY;AACf,gBAAA,OAAO,IAAI,CAAC,uBAAuB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftPopoverForm","__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/searchcraft-popover-form/searchcraft-popover-form.tsx"],"sourcesContent":["import type { SearchcraftCore } from '@classes';\nimport { registry } from '@classes/CoreInstanceRegistry';\nimport { Component, Element, Prop, State, h } from '@stencil/core';\nimport type {\n AdClientResponseItem,\n PopoverResultMappings,\n SearchClientResponseItem,\n} from '@types';\nimport classNames from 'classnames';\n\n/**\n * 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.\n *\n * @react-import\n * ```jsx\n * import { SearchcraftPopoverForm } from \"@searchcraft/react-sdk\";\n * ```\n *\n * @vue-import\n * ```jsx\n * import { SearchcraftPopoverForm } from \"@searchcraft/vue-sdk\";\n * ```\n *\n * @js-example\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-form type=\"inline\" />\n * ```\n *\n * ```js\n * // index.js\n * const popoverForm = document.querySelector('searchcraft-popover-form');\n *\n * popoverForm.popoverResultMappings = {};\n * ```\n *\n * @react-example\n * ```jsx\n * <SearchcraftPopoverForm type=\"inline\" popoverResultMappings={[]} />\n * ```\n *\n * @vue-example\n * ```jsx\n * <SearchcraftPopoverForm type=\"inline\" :popoverResultMappings=\"[]\"\" />\n * ```\n *\n */\n@Component({\n tag: 'searchcraft-popover-form',\n shadow: false,\n})\nexport class SearchcraftPopoverForm {\n /**\n * The type of popover form to render.\n * - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content.\n * - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component.\n * - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.\n */\n @Prop() type?: 'inline' | 'fullscreen' | 'modal' = 'inline';\n /**\n * Formats the content rendered for each result.\n */\n @Prop() popoverResultMappings?: PopoverResultMappings;\n /**\n * The hotkey that activates the popover.\n */\n @Prop() hotkey?: string = 'k';\n /**\n * The hotkey modifier that activates the popover. Used together with the `hotkey` prop.\n */\n @Prop() hotkeyModifier?: 'ctrl' | 'meta' | 'alt' | 'option' = 'meta';\n /**\n * The id of the Searchcraft instance that this component should use.\n */\n @Prop() searchcraftId?: string;\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue?: string = 'Enter Search';\n /**\n * The placeholder's render behavior.\n * 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus.\n * 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.\n */\n @Prop() placeholderBehavior?: 'hide-on-focus' | 'hide-on-text-entered';\n /**\n * Base URL for the \"View all\" footer link. The current search term will be appended (URL encoded).\n *\n * For example, in a CMS-backed site you might set this to `/?s=` so the final URL becomes `/?s=<search-term>`.\n */\n @Prop() viewAllResultsBaseUrl?: string;\n /**\n * Optional label for the \"View All\" footer button. Defaults to \"View All\".\n */\n @Prop() viewAllResultsLabel?: string;\n /**\n * Whether to display the AI generative summary box before the search results.\n * 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.\n */\n @Prop() showSummaryBox?: boolean = false;\n /**\n * The SDK variant used to render this component. Used for UTM attribution on the footer link.\n *\n * @internal\n */\n @Prop() sdkVariant?: 'js' | 'react' | 'vue' = 'js';\n\n @State() isPopoverVisibleInState = false;\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchTerm: string | undefined;\n @State() isFocused = false;\n @State() breakpointSm = 576;\n @State() breakpointMd = 768;\n @State() breakpointLg = 992;\n @State() searchResultsPage;\n @State() searchResultsPerPage;\n\n @State() modalElement;\n\n @Element() hostElement!: HTMLElement;\n\n private unsubscribe: (() => void) | undefined;\n private cleanupCore?: () => void;\n core?: SearchcraftCore;\n\n onCoreAvailable(core: SearchcraftCore) {\n this.core = core;\n // Loads the breakpoint values into state\n const computedStyle = getComputedStyle(document.documentElement);\n this.breakpointSm = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-sm').trim(),\n );\n this.breakpointMd = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-md').trim(),\n );\n this.breakpointLg = Number.parseFloat(\n computedStyle.getPropertyValue('--sc-breakpoint-lg').trim(),\n );\n // Set popover visiblity in state\n this.isPopoverVisibleInState = core.store.getState().isPopoverVisible;\n\n // Add event listeners\n document.addEventListener('click', this.handleDocumentClick);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n\n // Subscribe to state events\n this.unsubscribe = core.store.subscribe((state) => {\n if (this.isPopoverVisibleInState !== state.isPopoverVisible) {\n this.handlePopoverVisibilityChange(state.isPopoverVisible);\n }\n\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n });\n\n // Set hotkey and hotkeyModifier in state.\n core.store\n .getState()\n .setHotKeyAndHotKeyModifier(this.hotkey, this.hotkeyModifier);\n }\n\n connectedCallback() {\n this.cleanupCore = registry.useCoreInstance(\n this.searchcraftId,\n this.onCoreAvailable.bind(this),\n );\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n this.cleanupCore?.();\n document.removeEventListener('click', this.handleDocumentClick);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n handleDocumentClick = (event: MouseEvent) => {\n if (!this.hostElement.contains(event.target as Node)) {\n this.isFocused = false;\n }\n };\n\n /**\n * Handles when popover visibility is changed in state\n */\n handlePopoverVisibilityChange(isVisible: boolean) {\n this.isPopoverVisibleInState = isVisible;\n document.body.style.overflow = isVisible ? 'hidden' : 'auto';\n }\n\n /**\n * Actions to perform when various keys are pressed within the popover form.\n */\n handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Document-scoped actions\n if (event.key === this.hotkey) {\n this.handleHotkeyPressed(event);\n }\n\n // Document-scoped -> Popover-scoped keyboard event boundary\n if (!this.hostElement.contains(document.activeElement)) {\n return;\n }\n\n // Popover-scoped actions\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n event.preventDefault();\n this.focusOnNextListItem(event.key);\n break;\n case 'Escape':\n this.core?.store.getState().setPopoverVisibility(false);\n break;\n case 'Enter':\n if (\n (event.metaKey || event.ctrlKey) &&\n this.viewAllResultsHref &&\n this.hasResultsToShow\n ) {\n event.preventDefault();\n this.navigateToViewAllResults();\n }\n break;\n default:\n return;\n }\n };\n\n handleInputInit = () => {\n const input = this.hostElement.querySelector(\n '.searchcraft-input-form-input',\n ) as HTMLInputElement | undefined;\n input?.focus();\n };\n\n /**\n * When popover is `inline` and the viewport is at the smallest breakpoint,\n * focusing on the input will open a modal version of the popover form.\n */\n handleInputFocus() {\n this.isFocused = true;\n\n if (\n this.type === 'inline' &&\n window.visualViewport &&\n window.visualViewport.width < this.breakpointSm\n ) {\n this.core?.store.getState().setPopoverVisibility(true);\n\n // Appends a popover form of type=`modal` to the body\n if (!this.modalElement) {\n this.modalElement = document.createElement('searchcraft-popover-form');\n this.modalElement.popoverResultMappings = this.popoverResultMappings;\n this.modalElement.setAttribute('type', 'fullscreen');\n this.modalElement.setAttribute('searchcraft-id', this.searchcraftId);\n if (this.placeholderValue) {\n this.modalElement.setAttribute(\n 'placeholder-value',\n this.placeholderValue,\n );\n }\n if (this.placeholderBehavior) {\n this.modalElement.setAttribute(\n 'placeholder-behavior',\n this.placeholderBehavior,\n );\n }\n if (this.viewAllResultsBaseUrl) {\n this.modalElement.setAttribute(\n 'view-all-results-base-url',\n this.viewAllResultsBaseUrl,\n );\n }\n if (this.viewAllResultsLabel) {\n this.modalElement.setAttribute(\n 'view-all-results-label',\n this.viewAllResultsLabel,\n );\n }\n document.body.appendChild(this.modalElement);\n }\n }\n }\n\n handleModalBackdropClick(_event: MouseEvent) {\n this.core?.store.getState().setPopoverVisibility(false);\n }\n\n /**\n * When a hotkey is pressed, tests if the modifiers also match.\n * If modifiers match, toggles visibility of the popover modal.\n */\n handleHotkeyPressed(event: KeyboardEvent) {\n if (\n (event.ctrlKey && this.hotkeyModifier === 'ctrl') ||\n (event.altKey && this.hotkeyModifier === 'alt') ||\n (event.metaKey && this.hotkeyModifier === 'meta')\n ) {\n event.preventDefault();\n if (this.type === 'inline' && !this.isPopoverVisibleInState) {\n const hostElementInput = this.hostElement.querySelector(\n '.searchcraft-input-form-input',\n ) as HTMLInputElement | undefined;\n hostElementInput?.focus();\n } else {\n this.core?.store\n .getState()\n .setPopoverVisibility(!this.isPopoverVisibleInState);\n }\n }\n }\n\n handleCancelButtonClick() {\n this.core?.store.getState().setPopoverVisibility(false);\n }\n\n /**\n * Moves focus to the next/previous list item in the list view. If you are at the top\n * of the list view, it moves focus back to the input.\n *\n * @param direction\n */\n focusOnNextListItem(direction: 'ArrowDown' | 'ArrowUp') {\n const listItems = Array.from(\n document.querySelectorAll<HTMLAnchorElement>(\n '.searchcraft-popover-list-item-link',\n ),\n ).filter((el) => !el.hasAttribute('disabled') && el.offsetParent !== null);\n\n const currentIndex = listItems.indexOf(\n document.activeElement as HTMLAnchorElement,\n );\n\n if (direction === 'ArrowDown') {\n listItems[(currentIndex + 1) % listItems.length]?.focus();\n } else if (direction === 'ArrowUp') {\n if (currentIndex >= 1) {\n listItems[currentIndex - 1]?.focus();\n } else {\n const input = document.querySelector('.searchcraft-input-form-input') as\n | HTMLInputElement\n | undefined;\n\n if (input) {\n input.focus();\n requestAnimationFrame(() => {\n input.selectionEnd = input.value.length;\n input.selectionStart = input.value.length;\n });\n }\n }\n }\n }\n\n get hasResultsToShow() {\n return (\n this.searchTerm &&\n this.searchTerm?.trim()?.length > 0 &&\n this.searchClientResponseItems.length > 0\n );\n }\n\n get viewAllResultsHref() {\n const baseUrl = this.viewAllResultsBaseUrl;\n if (!baseUrl) {\n return undefined;\n }\n\n const term = this.searchTerm?.trim();\n if (!term) {\n return baseUrl;\n }\n\n return `${baseUrl}${encodeURIComponent(term).replace(/%20/g, '+')}`;\n }\n\n get resolvedViewAllResultsLabel() {\n return this.viewAllResultsLabel ?? 'View All';\n }\n\n navigateToViewAllResults() {\n const href = this.viewAllResultsHref;\n\n if (!href || !this.hasResultsToShow) {\n return;\n }\n\n if (typeof window !== 'undefined') {\n window.location.href = href;\n }\n }\n\n renderInlinePopover() {\n const isListViewVisible = this.hasResultsToShow && this.isFocused;\n\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-inline',\n {\n 'searchcraft-popover-form-active': isListViewVisible,\n },\n )}\n >\n <div class='searchcraft-popover-form-input searchcraft-popover-form-inline-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n </div>\n {isListViewVisible && (\n <div class='searchcraft-popover-form-inline-wrapper'>\n {this.showSummaryBox && (\n <searchcraft-summary-box searchcraftId={this.searchcraftId} />\n )}\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n <searchcraft-popover-footer\n searchcraftId={this.searchcraftId}\n sdkVariant={this.sdkVariant}\n viewAllResultsHref={this.viewAllResultsHref}\n viewAllResultsLabel={this.resolvedViewAllResultsLabel}\n />\n </div>\n )}\n </div>\n );\n }\n\n renderModalPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-modal',\n {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n },\n )}\n >\n {/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}\n <div\n class='searchcraft-popover-form-modal-backdrop'\n onClick={this.handleModalBackdropClick}\n />\n <div class='searchcraft-popover-form-modal-wrapper'>\n <div class='searchcraft-popover-form-input searchcraft-popover-form-modal-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button searchcraft-popover-form-modal-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n <div class='searchcraft-popover-form-modal-popover-list-view'>\n {this.showSummaryBox && this.hasResultsToShow && (\n <searchcraft-summary-box searchcraftId={this.searchcraftId} />\n )}\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n )}\n </div>\n <searchcraft-popover-footer\n searchcraftId={this.searchcraftId}\n sdkVariant={this.sdkVariant}\n viewAllResultsHref={this.viewAllResultsHref}\n viewAllResultsLabel={this.resolvedViewAllResultsLabel}\n />\n </div>\n </div>\n );\n }\n }\n\n renderFullscreenPopover() {\n if (this.isPopoverVisibleInState) {\n return (\n <div\n class={classNames(\n 'searchcraft-popover-form searchcraft-popover-form-fullscreen',\n {\n 'searchcraft-popover-form-active': this.hasResultsToShow,\n },\n )}\n >\n <div class='searchcraft-popover-form-input searchcraft-popover-form-fullscreen-input'>\n <searchcraft-input-form\n onInputFocus={this.handleInputFocus.bind(this)}\n onInputInit={this.handleInputInit.bind(this)}\n searchcraftId={this.searchcraftId}\n placeholderValue={this.placeholderValue}\n placeholderBehavior={this.placeholderBehavior}\n />\n <button\n type='button'\n class='searchcraft-popover-form-cancel-button searchcraft-popover-form-fullscreen-cancel-button'\n onClick={this.handleCancelButtonClick.bind(this)}\n >\n Cancel\n </button>\n </div>\n <div class='searchcraft-popover-form-fullscreen-popover-list-view'>\n {this.showSummaryBox && this.hasResultsToShow && (\n <searchcraft-summary-box searchcraftId={this.searchcraftId} />\n )}\n {this.hasResultsToShow && (\n <searchcraft-popover-list-view\n popoverResultMappings={this.popoverResultMappings}\n searchClientResponseItems={this.searchClientResponseItems}\n adClientResponseItems={this.adClientResponseItems}\n searchResultsPage={this.searchResultsPage}\n searchResultsPerPage={this.searchResultsPerPage}\n searchcraftId={this.searchcraftId}\n />\n )}\n </div>\n <searchcraft-popover-footer\n searchcraftId={this.searchcraftId}\n sdkVariant={this.sdkVariant}\n viewAllResultsHref={this.viewAllResultsHref}\n viewAllResultsLabel={this.resolvedViewAllResultsLabel}\n />\n </div>\n );\n }\n }\n\n render() {\n switch (this.type) {\n case 'inline':\n return this.renderInlinePopover();\n case 'modal':\n return this.renderModalPopover();\n case 'fullscreen':\n return this.renderFullscreenPopover();\n }\n }\n}\n"],"version":3}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftPopoverListItem$1, d as defineCustomElement$1 } from './searchcraft-popover-list-item2.js?
|
|
1
|
+
import { S as SearchcraftPopoverListItem$1, d as defineCustomElement$1 } from './searchcraft-popover-list-item2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftPopoverListItem = SearchcraftPopoverListItem$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { g as getDocumentValueFromSearchResultMapping } from './units.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { g as getDocumentValueFromSearchResultMapping } from './units.js?scv=0.14.0';
|
|
4
4
|
import './purify.es.js';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverListItem extends H {
|
|
@@ -57,7 +57,7 @@ const SearchcraftPopoverListItem = /*@__PURE__*/ proxyCustomElement(class Search
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
render() {
|
|
60
|
-
return (h("div", { key: '
|
|
60
|
+
return (h("div", { key: '119fc0a527160924a22d185ce764202b1d342e9b', class: 'searchcraft-popover-list-item' }, h("a", { key: '95a5db24035c3be7decb2f062710214fa5726f27', class: 'searchcraft-popover-list-item-link', href: this.href, onClick: this.handleLinkClick.bind(this) }, this.imageSource && (h("div", { key: '6a5ddee0b5f03bc7cf5c5dacc5b4a5ee2fcbe511', class: 'searchcraft-popover-list-item-image-wrapper' }, h("img", { key: '3cdae906aee5b6ef7d1f618419476e75af4c4ebe', alt: this.imageAlt, src: this.imageSource, class: 'searchcraft-popover-list-item-image' }))), h("div", { key: 'd0b55113188fb8fafff8ee15d3dc919617852b62', class: 'searchcraft-popover-list-item-content' }, this.title && (h("p", { key: '1482260827b057f03db9eb6e8d7df7f5977fe3dc', class: 'searchcraft-popover-list-item-content-title' }, this.title)), this.subtitle && (h("p", { key: 'c4210cef3c4372ee4f9ce4a41dbea10d0e915175', class: 'searchcraft-popover-list-item-content-subtitle' }, this.subtitle))))));
|
|
61
61
|
}
|
|
62
62
|
}, [768, "searchcraft-popover-list-item", {
|
|
63
63
|
"item": [16],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftPopoverListView$1, d as defineCustomElement$1 } from './searchcraft-popover-list-view2.js?
|
|
1
|
+
import { S as SearchcraftPopoverListView$1, d as defineCustomElement$1 } from './searchcraft-popover-list-view2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftPopoverListView = SearchcraftPopoverListView$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { d as defineCustomElement$2 } from './searchcraft-ad2.js?
|
|
4
|
-
import { d as defineCustomElement$1 } from './searchcraft-popover-list-item2.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { d as defineCustomElement$2 } from './searchcraft-ad2.js?scv=0.14.0';
|
|
4
|
+
import { d as defineCustomElement$1 } from './searchcraft-popover-list-item2.js?scv=0.14.0';
|
|
5
5
|
|
|
6
6
|
const SearchcraftPopoverListView = /*@__PURE__*/ proxyCustomElement(class SearchcraftPopoverListView extends H {
|
|
7
7
|
constructor(registerHost) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { f as formatNumberWithCommas } from './units.js?
|
|
4
|
-
import { h as html } from './html.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { f as formatNumberWithCommas } from './units.js?scv=0.14.0';
|
|
4
|
+
import { h as html } from './html.js?scv=0.14.0';
|
|
5
5
|
|
|
6
6
|
const SearchcraftResultsInfo$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftResultsInfo extends H {
|
|
7
7
|
constructor(registerHost) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftSearchResult$1, d as defineCustomElement$1 } from './searchcraft-search-result2.js?
|
|
1
|
+
import { S as SearchcraftSearchResult$1, d as defineCustomElement$1 } from './searchcraft-search-result2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftSearchResult = SearchcraftSearchResult$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { h as html } from './html.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { h as html } from './html.js?scv=0.14.0';
|
|
4
4
|
|
|
5
5
|
const SearchcraftSearchResult = /*@__PURE__*/ proxyCustomElement(class SearchcraftSearchResult extends H {
|
|
6
6
|
constructor(registerHost) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { d as defineCustomElement$2 } from './searchcraft-select2.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { d as defineCustomElement$2 } from './searchcraft-select2.js?scv=0.14.0';
|
|
4
4
|
|
|
5
5
|
const SearchcraftSearchResultsPerPage$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftSearchResultsPerPage extends H {
|
|
6
6
|
constructor(registerHost) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { r as registry } from './CoreInstanceRegistry.js?
|
|
3
|
-
import { d as defineCustomElement$4 } from './searchcraft-ad2.js?
|
|
4
|
-
import { d as defineCustomElement$3 } from './searchcraft-error-message2.js?
|
|
5
|
-
import { d as defineCustomElement$2 } from './searchcraft-search-result2.js?
|
|
1
|
+
import { p as proxyCustomElement, H, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { r as registry } from './CoreInstanceRegistry.js?scv=0.14.0';
|
|
3
|
+
import { d as defineCustomElement$4 } from './searchcraft-ad2.js?scv=0.14.0';
|
|
4
|
+
import { d as defineCustomElement$3 } from './searchcraft-error-message2.js?scv=0.14.0';
|
|
5
|
+
import { d as defineCustomElement$2 } from './searchcraft-search-result2.js?scv=0.14.0';
|
|
6
6
|
|
|
7
7
|
const SearchcraftSearchResults$1 = /*@__PURE__*/ proxyCustomElement(class SearchcraftSearchResults extends H {
|
|
8
8
|
constructor(registerHost) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftSelect$1, d as defineCustomElement$1 } from './searchcraft-select2.js?
|
|
1
|
+
import { S as SearchcraftSelect$1, d as defineCustomElement$1 } from './searchcraft-select2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftSelect = SearchcraftSelect$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h, t as transformTag } from './index2.js?
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftSelect = /*@__PURE__*/ proxyCustomElement(class SearchcraftSelect extends H {
|
|
4
4
|
constructor(registerHost) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftSlider$1, d as defineCustomElement$1 } from './searchcraft-slider2.js?
|
|
1
|
+
import { S as SearchcraftSlider$1, d as defineCustomElement$1 } from './searchcraft-slider2.js?scv=0.14.0';
|
|
2
2
|
|
|
3
3
|
const SearchcraftSlider = SearchcraftSlider$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, c as createEvent, h, t as transformTag } from './index2.js?
|
|
2
|
-
import { a as getDifferenceInUnits, b as getStartOf, c as getFormattedDateString } from './units.js?
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, t as transformTag } from './index2.js?scv=0.14.0';
|
|
2
|
+
import { a as getDifferenceInUnits, b as getStartOf, c as getFormattedDateString } from './units.js?scv=0.14.0';
|
|
3
3
|
import './purify.es.js';
|
|
4
|
-
import { c as classNames } from './index3.js?
|
|
4
|
+
import { c as classNames } from './index3.js?scv=0.14.0';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Creates a throttled version of the given function that only invokes
|
|
@@ -159,10 +159,10 @@ const SearchcraftSlider = /*@__PURE__*/ proxyCustomElement(class SearchcraftSlid
|
|
|
159
159
|
100;
|
|
160
160
|
const startLabel = this.getLabel(this.startValue);
|
|
161
161
|
const endLabel = this.getLabel(this.endValue);
|
|
162
|
-
return (h("div", { key: '
|
|
162
|
+
return (h("div", { key: '59b07f5c8a14f6cbad8bae6faebf12e9a511bcbb', class: 'searchcraft-slider' }, h("div", { key: '603c0bc39c6fe018016caf17b3b73f5b3c410fba', class: 'searchcraft-slider-range' }, h("div", { key: '31d4097f29aa13d0ab14ec861ecea803e8190ed0', class: 'searchcraft-slider-active-range', style: {
|
|
163
163
|
left: `${startPercent}%`,
|
|
164
164
|
width: `${endPercent - startPercent}%`,
|
|
165
|
-
} }), h("input", { key: '
|
|
165
|
+
} }), h("input", { key: '40299fe0d7b973b448151a045b7a7f6c3b8846fd', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleStartValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), h("input", { key: 'd46ad0cee946b168cd6004f8a2f819f6e46c50e4', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.upperBound, min: this.lowerBound, onInput: this.handleEndValueChange.bind(this), step: this.step, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), h("div", { key: 'e65452bc456b0fa69d0dc0dd1276e19b9cf521e6', class: 'searchcraft-slider-label' }, h("span", { key: '2b5aec3e96d9bc9420b047a1d00cce40f361c729', class: 'searchcraft-slider-start-label' }, startLabel), h("span", { key: 'fce2109bd481b3df9ac4beee3731a24c012e4512', class: 'searchcraft-slider-end-label' }, endLabel))));
|
|
166
166
|
}
|
|
167
167
|
}, [768, "searchcraft-slider", {
|
|
168
168
|
"max": [2],
|