@searchcraft/javascript-sdk 0.1.8 → 0.2.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/dist/cjs/{index-7b49313c.js → index-6c5282a0.js} +11 -5
- package/dist/cjs/index-6c5282a0.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{searchcraft-auto-search-form_13.cjs.entry.js → searchcraft-auto-search-form_17.cjs.entry.js} +307 -30
- package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +3 -3
- package/dist/cjs/searchcraft-button-icon.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-button.cjs.entry.js +2 -2
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
- package/dist/cjs/{store-3d577aac.js → store-ccdd30e6.js} +102 -39
- package/dist/cjs/store-ccdd30e6.js.map +1 -0
- package/dist/cjs/{utils-39791159.js → utils-bd99e8b0.js} +3 -3
- package/dist/cjs/utils-bd99e8b0.js.map +1 -0
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +35 -9
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +0 -6
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +1 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +2 -2
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +13 -6
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +43 -9
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +8 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +1 -1
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +2 -2
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +1 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +155 -0
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -0
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +70 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +21 -2
- package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +51 -0
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -0
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +16 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +121 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +77 -0
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +1 -1
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +1 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +92 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +31 -0
- package/dist/collection/provider/store.js +31 -2
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/utils/utils.js +2 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +3 -3
- package/dist/components/{p-85d96d9b.js → p-01c5864b.js} +2 -2
- package/dist/components/{p-85d96d9b.js.map → p-01c5864b.js.map} +1 -1
- package/dist/components/{p-6b1d0cba.js → p-0ef8f141.js} +3 -3
- package/dist/components/{p-6b1d0cba.js.map → p-0ef8f141.js.map} +1 -1
- package/dist/components/{p-c14731ca.js → p-162887a4.js} +3 -3
- package/dist/components/{p-c14731ca.js.map → p-162887a4.js.map} +1 -1
- package/dist/components/{p-3ea9ba3a.js → p-2bff6d1e.js} +4 -4
- package/dist/components/{p-3ea9ba3a.js.map → p-2bff6d1e.js.map} +1 -1
- package/dist/components/{p-04bad430.js → p-2f5acc0e.js} +3 -3
- package/dist/components/{p-04bad430.js.map → p-2f5acc0e.js.map} +1 -1
- package/dist/components/{p-781a9a8c.js → p-42f8a605.js} +3 -3
- package/dist/components/{p-781a9a8c.js.map → p-42f8a605.js.map} +1 -1
- package/dist/components/p-544b2de1.js +86 -0
- package/dist/components/p-544b2de1.js.map +1 -0
- package/dist/components/{p-d73bc01d.js → p-68ad42b5.js} +2 -2
- package/dist/components/{p-d73bc01d.js.map → p-68ad42b5.js.map} +1 -1
- package/dist/components/{p-af65953e.js → p-7498e493.js} +7 -3
- package/dist/components/p-7498e493.js.map +1 -0
- package/dist/components/{p-9c617862.js → p-80ea9602.js} +102 -39
- package/dist/components/p-80ea9602.js.map +1 -0
- package/dist/components/{p-17c94ac1.js → p-aff5cd24.js} +3 -3
- package/dist/components/p-aff5cd24.js.map +1 -0
- package/dist/components/{p-62f37242.js → p-d11d9b1f.js} +17 -12
- package/dist/components/p-d11d9b1f.js.map +1 -0
- package/dist/components/{p-d33fdd81.js → p-ee5e7a8c.js} +2 -2
- package/dist/components/{p-d33fdd81.js.map → p-ee5e7a8c.js.map} +1 -1
- package/dist/components/{p-a3ea7edc.js → p-fc0540e5.js} +2 -2
- package/dist/components/{p-a3ea7edc.js.map → p-fc0540e5.js.map} +1 -1
- package/dist/components/{p-07fba086.js → p-fd1f6c2f.js} +6 -6
- package/dist/components/p-fd1f6c2f.js.map +1 -0
- package/dist/components/searchcraft-auto-search-form.js +35 -23
- package/dist/components/searchcraft-auto-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-form.js +14 -14
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +28 -14
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button-icon.js +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-clear-icon-set.js +1 -1
- package/dist/components/searchcraft-clear-input-button.js +1 -1
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-filters-list.d.ts +11 -0
- package/dist/components/searchcraft-filters-list.js +127 -0
- package/dist/components/searchcraft-filters-list.js.map +1 -0
- package/dist/components/searchcraft-input-caption.js +1 -1
- package/dist/components/searchcraft-input-icon.js +1 -1
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-results-info.d.ts +11 -0
- package/dist/components/searchcraft-results-info.js +64 -0
- package/dist/components/searchcraft-results-info.js.map +1 -0
- package/dist/components/searchcraft-search-icon-set.js +1 -1
- package/dist/components/searchcraft-slider.d.ts +11 -0
- package/dist/components/searchcraft-slider.js +96 -0
- package/dist/components/searchcraft-slider.js.map +1 -0
- package/dist/components/searchcraft-spinner-dark.js +1 -1
- package/dist/components/searchcraft-spinner-light.js +1 -1
- package/dist/components/searchcraft-toggle-button.d.ts +11 -0
- package/dist/components/searchcraft-toggle-button.js +84 -0
- package/dist/components/searchcraft-toggle-button.js.map +1 -0
- package/dist/esm/{index-e4a4f86d.js → index-0ac5bb53.js} +11 -5
- package/dist/esm/index-0ac5bb53.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{searchcraft-auto-search-form_13.entry.js → searchcraft-auto-search-form_17.entry.js} +304 -31
- package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-form.entry.js +3 -3
- package/dist/esm/searchcraft-button-icon.entry.js +1 -1
- package/dist/esm/searchcraft-button.entry.js +2 -2
- package/dist/esm/searchcraft-javascript-sdk.js +3 -3
- package/dist/esm/{store-03dc618f.js → store-311de204.js} +102 -39
- package/dist/esm/store-311de204.js.map +1 -0
- package/dist/esm/{utils-7bff0c78.js → utils-e2076797.js} +3 -3
- package/dist/esm/utils-e2076797.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-0880cfbb.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-0880cfbb.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js → p-5ec960bd.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/p-6108dd80.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-6108dd80.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-80ea9602.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-80ea9602.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-6c825f8c.entry.js → p-a9bac3ca.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-17c94ac1.js → p-aff5cd24.js} +1 -1
- package/dist/searchcraft-javascript-sdk/p-aff5cd24.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js → p-cc454542.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
- package/dist/types/components/searchcraft-auto-search-form/searchcraft-auto-search-form.d.ts +4 -2
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +3 -1
- package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +30 -0
- package/dist/types/components/searchcraft-input/searchcraft-input.d.ts +2 -0
- package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +10 -0
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +17 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +17 -0
- package/dist/types/components.d.ts +90 -2
- package/dist/types/provider/store.d.ts +17 -5
- package/dist/types/utils/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/index-7b49313c.js.map +0 -1
- package/dist/cjs/searchcraft-auto-search-form_13.cjs.entry.js.map +0 -1
- package/dist/cjs/store-3d577aac.js.map +0 -1
- package/dist/cjs/utils-39791159.js.map +0 -1
- package/dist/components/p-07fba086.js.map +0 -1
- package/dist/components/p-17c94ac1.js.map +0 -1
- package/dist/components/p-62f37242.js.map +0 -1
- package/dist/components/p-9c617862.js.map +0 -1
- package/dist/components/p-af65953e.js.map +0 -1
- package/dist/components/p-f3af2b04.js +0 -86
- package/dist/components/p-f3af2b04.js.map +0 -1
- package/dist/esm/index-e4a4f86d.js.map +0 -1
- package/dist/esm/searchcraft-auto-search-form_13.entry.js.map +0 -1
- package/dist/esm/store-03dc618f.js.map +0 -1
- package/dist/esm/utils-7bff0c78.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-17c94ac1.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-9c617862.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-9c617862.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-bc3c001e.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-bc3c001e.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e6f6972c.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-e6f6972c.js.map +0 -1
- /package/dist/searchcraft-javascript-sdk/{p-98eab6f9.entry.js.map → p-5ec960bd.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-6c825f8c.entry.js.map → p-a9bac3ca.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-6a17384e.entry.js.map → p-cc454542.entry.js.map} +0 -0
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-
|
|
2
|
-
import { u as useSearchcraftStore, g } from './store-
|
|
3
|
-
import { p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties } from './utils-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-0ac5bb53.js';
|
|
2
|
+
import { u as useSearchcraftStore, g } from './store-311de204.js';
|
|
3
|
+
import { p as parseCustomStyles, a as parseSearchKeys, s as serializeStyles, e as extractDynamicProperties } from './utils-e2076797.js';
|
|
4
4
|
import { c as classNames } from './index-72ac5051.js';
|
|
5
5
|
|
|
6
|
-
const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{text-align:left;width:100%}.formRTL{text-align:right;width:100%}
|
|
6
|
+
const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{text-align:left;width:100%}.formRTL{text-align:right;width:100%}";
|
|
7
7
|
const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
|
|
8
8
|
|
|
9
9
|
const SearchcraftAutoSearchForm = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
registerInstance(this, hostRef);
|
|
12
12
|
this.querySubmit = createEvent(this, "querySubmit", 7);
|
|
13
|
+
this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
|
|
13
14
|
this.debounceTimeout = null;
|
|
14
|
-
this.debounceDelay =
|
|
15
|
+
this.debounceDelay = 0;
|
|
15
16
|
this.searchStore = useSearchcraftStore.getState();
|
|
16
17
|
this.handleInputChange = (event) => {
|
|
17
18
|
this.query = event.detail;
|
|
19
|
+
this.searchStore.setQuery(this.query);
|
|
20
|
+
this.querySubmit.emit(this.query);
|
|
21
|
+
};
|
|
22
|
+
this.handleInputKeyUp = (event) => {
|
|
23
|
+
const target = event.detail;
|
|
24
|
+
this.query = target;
|
|
25
|
+
this.searchStore.setQuery(this.query);
|
|
18
26
|
this.querySubmit.emit(this.query);
|
|
19
|
-
// Clear the previous debounce timeout
|
|
20
27
|
if (this.debounceTimeout) {
|
|
21
28
|
clearTimeout(this.debounceTimeout);
|
|
22
29
|
}
|
|
23
|
-
// Set a new debounce timeout
|
|
24
30
|
this.debounceTimeout = setTimeout(() => {
|
|
25
|
-
this.runSearch();
|
|
31
|
+
this.query.trim() !== '' && this.runSearch();
|
|
26
32
|
}, this.debounceDelay);
|
|
27
33
|
};
|
|
28
34
|
this.handleClearInput = () => {
|
|
29
35
|
this.query = '';
|
|
36
|
+
this.searchStore.setQuery('');
|
|
30
37
|
if (typeof this.clearInput === 'function') {
|
|
31
38
|
this.clearInput();
|
|
32
39
|
}
|
|
@@ -34,22 +41,22 @@ const SearchcraftAutoSearchForm = class {
|
|
|
34
41
|
clearTimeout(this.debounceTimeout);
|
|
35
42
|
}
|
|
36
43
|
this.error = false;
|
|
37
|
-
this.
|
|
44
|
+
this.inputClearedOrNoResults.emit();
|
|
38
45
|
};
|
|
39
46
|
this.runSearch = async () => {
|
|
40
47
|
if (this.query.trim() === '') {
|
|
41
48
|
this.error = true;
|
|
42
|
-
this.
|
|
49
|
+
this.inputClearedOrNoResults.emit();
|
|
43
50
|
}
|
|
44
51
|
else {
|
|
45
52
|
this.error = false;
|
|
46
53
|
this.searchStore.setQuery(this.query);
|
|
47
54
|
try {
|
|
48
55
|
await this.searchStore.search();
|
|
49
|
-
this.searchResults = JSON.stringify(this.searchStore.searchResults);
|
|
50
56
|
}
|
|
51
57
|
catch (error) {
|
|
52
58
|
this.error = true;
|
|
59
|
+
this.inputClearedOrNoResults.emit();
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
};
|
|
@@ -75,13 +82,14 @@ const SearchcraftAutoSearchForm = class {
|
|
|
75
82
|
this.error = false;
|
|
76
83
|
this.isRequesting = false;
|
|
77
84
|
this.query = '';
|
|
78
|
-
this.searchResults =
|
|
85
|
+
this.searchResults = null;
|
|
79
86
|
}
|
|
80
87
|
componentDidLoad() {
|
|
81
88
|
const searchcraft = new g(this.config);
|
|
82
89
|
this.searchStore.initialize(searchcraft, true);
|
|
83
90
|
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
84
91
|
this.isRequesting = state.isRequesting;
|
|
92
|
+
this.searchResults = Object.assign({}, state.searchResults);
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
95
|
disconnectedCallback() {
|
|
@@ -90,14 +98,18 @@ const SearchcraftAutoSearchForm = class {
|
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
render() {
|
|
101
|
+
var _a, _b, _c;
|
|
93
102
|
const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
|
|
94
103
|
const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);
|
|
95
|
-
|
|
104
|
+
if (this.query.length > 0 && ((_c = (_b = (_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) === 0) {
|
|
105
|
+
this.inputClearedOrNoResults.emit();
|
|
106
|
+
}
|
|
107
|
+
return (h("form", { key: '49950058e612dc1017fb56235affd3b8077b6926', class: `${formClass}`, onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: 'ce2cb4d74c139fc4f010d1ca51739c49a8e9f6c2', label: this.labelForInput }), h("searchcraft-input", { key: '8fb1eee5dca952ba472f03e768b57663528f5c84', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "is-requesting": this.isRequesting, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (h("searchcraft-error-message", { key: 'd1c893186af4cdb927f31b086aa7d027947c1d2c', errorMessage: 'Please enter a search query.' }))));
|
|
96
108
|
}
|
|
97
109
|
};
|
|
98
110
|
SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
|
|
99
111
|
|
|
100
|
-
const searchcraftBaseSearchResultModuleCss = "
|
|
112
|
+
const searchcraftBaseSearchResultModuleCss = "@charset \"UTF-8\";:root{--font-stack:Helvetica, Arial, sans-serif}.interactiveResultContainerLight{background-color:#FAFAFA;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerLight{flex-direction:row}}.interactiveResultContainerDark{background-color:#2E2E2E;align-items:flex-start;border-radius:16px;display:flex;position:relative;flex-direction:column;gap:16px;padding:8px}@media (min-width: 600px){.interactiveResultContainerDark{flex-direction:row}}.resultContainer{align-items:flex-start;display:flex;flex-direction:column;gap:16px}@media (min-width: 600px){.resultContainer{flex-direction:row}}.interactiveIconLarge{display:inline-block;position:absolute;right:5px;top:8px}@media (max-width: 600px){.interactiveIconLarge{display:none}}.interactiveIconSmall{position:absolute;right:5px;top:-2px;display:inline-block}@media (min-width: 600px){.interactiveIconSmall{display:none}}.imageContainer{max-width:100%}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.secondaryContentContainer{display:flex}.imageLight{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #D9D9D9}.imageDark{aspect-ratio:2/1;border-radius:8px;max-height:100%;max-width:100%;border:1px solid #333}.headingLight{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#292929}.headingDark{font-family:var(--font-stack);font-size:16px;font-weight:700;line-height:20px;margin-bottom:4px;margin-top:0px;position:relative;color:#FFF}.subheadingLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#737373}.subheadingDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px;margin-top:0px;color:#BFBFBF}.primaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.primaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.secondaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.secondaryContentLight::after{content:\"•\";color:#404040;font-size:1em;margin-left:5px;margin-right:5px}.secondaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}.tertiaryContentLight{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#404040}.tertiaryContentDark{font-family:var(--font-stack);font-size:16px;font-weight:400;line-height:20px;margin-bottom:4px;margin-top:0px;color:#E6E6E6}";
|
|
101
113
|
const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
|
|
102
114
|
|
|
103
115
|
const SearchcraftBaseSearchResult = class {
|
|
@@ -141,16 +153,16 @@ const SearchcraftBaseSearchResult = class {
|
|
|
141
153
|
render() {
|
|
142
154
|
const isLightTheme = this.themeMode === 'light';
|
|
143
155
|
const styles = this.parseStyles();
|
|
144
|
-
return (h("div", { key: '
|
|
156
|
+
return (h("div", { key: '91cfc671b0b99082915df3eaafa053a9a7f77929', class: this.isInteractive
|
|
145
157
|
? isLightTheme
|
|
146
158
|
? 'interactiveResultContainerLight'
|
|
147
159
|
: 'interactiveResultContainerDark'
|
|
148
|
-
: 'resultContainer', style: styles.container || {}, tabindex: '0', onClick: this.handleContainerClick, onKeyDown: this.keyDownCallback }, h("div", { key: '
|
|
160
|
+
: 'resultContainer', style: styles.container || {}, tabindex: '0', onClick: this.handleContainerClick, onKeyDown: this.keyDownCallback }, h("div", { key: 'ccda236ef60aee285472155889c5490c69a86415', class: 'imageContainer' }, h("img", { key: 'e55d743952e2997d91f6486436e3a7955ffc1dcc', alt: this.imageDescription, src: this.imageSource, style: styles.image || {}, class: isLightTheme ? 'imageLight' : 'imageDark' })), h("div", { key: 'b0e831c0c7bfef46b8b6da4e84536adf3ebd7158', class: 'contentContainer' }, h("h2", { key: '54137612623a39d711f4e3c888bf2015b6fb9500', style: styles.heading || {}, class: isLightTheme ? 'headingLight' : 'headingDark' }, this.headingText), h("h3", { key: 'de46df990be3d0b5d2134d272e1766e911ab094a', style: styles.subheading || {}, class: isLightTheme ? 'subheadingLight' : 'subheadingDark' }, this.subheadingText), h("p", { key: 'd9e7656bc739b0dd2267f86ac51b17d9ca16da6a', style: styles.primaryContent || {}, class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark' }, this.primaryContent), h("div", { key: 'd05813b3da29b8b21c2e370db9c0cbc7b48b9556', class: 'secondaryContentContainer' }, h("p", { key: 'e8d2ede937705a5bd88927779ee24e35ba2efbd8', style: styles.secondaryContent || {}, class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark' }, this.secondaryContent), h("p", { key: '2f9b9f603d55bcefe8347675cb31f705b1f7a0e8', style: styles.tertiaryContent || {}, class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark' }, this.tertiaryContent)), this.buttonText && (h("button", { key: '58724046c9704974cb3ae1c34335ebb7131b91ab', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText)))));
|
|
149
161
|
}
|
|
150
162
|
};
|
|
151
163
|
SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
|
|
152
164
|
|
|
153
|
-
const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:
|
|
165
|
+
const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:16px 0}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;background-color:#F1F1F1;border:1px solid #DCDDDE;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;margin:auto;min-height:150px;text-align:center;width:100%}.adSection p{margin-top:5px}.emptyState{width:100%;text-align:center}.errorMessageContainer{text-align:center}";
|
|
154
166
|
const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
|
|
155
167
|
|
|
156
168
|
const SearchcraftBaseSearchResults = class {
|
|
@@ -158,19 +170,28 @@ const SearchcraftBaseSearchResults = class {
|
|
|
158
170
|
registerInstance(this, hostRef);
|
|
159
171
|
this.query = '';
|
|
160
172
|
this.searchResults = null;
|
|
161
|
-
this.
|
|
173
|
+
this.hasSearched = false;
|
|
174
|
+
this.documentAttributesForDisplay = '';
|
|
162
175
|
this.customStylesForResults = {};
|
|
163
176
|
this.placeAdAtStart = true;
|
|
164
177
|
this.placeAdAtEnd = false;
|
|
165
178
|
this.adInterval = 4;
|
|
166
179
|
this.formatTime = true;
|
|
180
|
+
this.fallbackElement = null;
|
|
167
181
|
}
|
|
168
182
|
componentDidLoad() {
|
|
169
|
-
if (!this.
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
if (!this.documentAttributesForDisplay ||
|
|
184
|
+
this.documentAttributesForDisplay.length === 0) {
|
|
185
|
+
console.warn('No document attributes provided; using empty keys array.');
|
|
186
|
+
this.documentAttributesForDisplay = '';
|
|
172
187
|
}
|
|
173
188
|
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
189
|
+
if (state.query.length > 0) {
|
|
190
|
+
this.hasSearched = true;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.hasSearched = false;
|
|
194
|
+
}
|
|
174
195
|
this.searchResults = Object.assign({}, state.searchResults);
|
|
175
196
|
this.query = state.query;
|
|
176
197
|
});
|
|
@@ -204,11 +225,14 @@ const SearchcraftBaseSearchResults = class {
|
|
|
204
225
|
}
|
|
205
226
|
render() {
|
|
206
227
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
228
|
+
if (!this.hasSearched) {
|
|
229
|
+
return (h("div", { class: 'emptyState' }, h("slot", { name: 'empty-search' })));
|
|
230
|
+
}
|
|
207
231
|
if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
208
232
|
console.warn('No search results data available');
|
|
209
233
|
return h("div", { class: 'emptyState' }, "No results to display.");
|
|
210
234
|
}
|
|
211
|
-
const parsedSearchKeys = parseSearchKeys(this.
|
|
235
|
+
const parsedSearchKeys = parseSearchKeys(this.documentAttributesForDisplay);
|
|
212
236
|
const serializedStyles = typeof this.customStylesForResults === 'string'
|
|
213
237
|
? this.customStylesForResults
|
|
214
238
|
: serializeStyles(this.customStylesForResults);
|
|
@@ -249,7 +273,7 @@ const SearchcraftBaseSearchResults = class {
|
|
|
249
273
|
finalComponents.push(h("div", { key: 'ad-section-end', class: 'adSection' }, h("span", null, "##"), h("p", null, " Ad Impressions")));
|
|
250
274
|
}
|
|
251
275
|
return (h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
|
|
252
|
-
((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` }))));
|
|
276
|
+
((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0 && (h("div", { class: 'errorMessageContainer' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
|
|
253
277
|
}
|
|
254
278
|
};
|
|
255
279
|
SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
|
|
@@ -275,7 +299,7 @@ const SearchcraftClearIconSet = class {
|
|
|
275
299
|
}
|
|
276
300
|
};
|
|
277
301
|
|
|
278
|
-
const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:
|
|
302
|
+
const searchcraftClearInputButtonModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputClearButtonLTR{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;padding:0;position:absolute;right:0;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:0px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
|
|
279
303
|
const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
|
|
280
304
|
|
|
281
305
|
const SearchcraftClearInputButton = class {
|
|
@@ -311,11 +335,104 @@ const SearchcraftErrorMessage = class {
|
|
|
311
335
|
}
|
|
312
336
|
render() {
|
|
313
337
|
const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
|
|
314
|
-
return (h("p", { key: '
|
|
338
|
+
return (h("p", { key: '544903d700810ed5d6efdefedab646cafed2376d', class: classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
|
|
315
339
|
}
|
|
316
340
|
};
|
|
317
341
|
SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
|
|
318
342
|
|
|
343
|
+
const searchcraftFiltersListModuleCss = "@charset \"UTF-8\";.filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px}.checkboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:checked{background-color:#000}.checkboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}.remainingFilterListCheckbox{margin-left:16px}.childCheckboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:12px}.childCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:#EDEDED;border:1px solid #D9D9D9;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000}.childCheckboxLabel input[type=checkbox]:checked::before{color:#fff;content:\"✔\"}";
|
|
344
|
+
const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
|
|
345
|
+
|
|
346
|
+
const SearchcraftFiltersList = class {
|
|
347
|
+
constructor(hostRef) {
|
|
348
|
+
registerInstance(this, hostRef);
|
|
349
|
+
this.filtersUpdated = createEvent(this, "filtersUpdated", 7);
|
|
350
|
+
this.searchStore = useSearchcraftStore.getState();
|
|
351
|
+
this.handleFilterChange = (value, checked) => {
|
|
352
|
+
if (checked) {
|
|
353
|
+
this.selectedFilters.add(value);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this.selectedFilters.delete(value);
|
|
357
|
+
}
|
|
358
|
+
const selectedFiltersArray = Array.from(this.selectedFilters);
|
|
359
|
+
this.filtersUpdated.emit(selectedFiltersArray);
|
|
360
|
+
this.searchStore.setSelectedFilters(selectedFiltersArray);
|
|
361
|
+
this.searchStore.search();
|
|
362
|
+
};
|
|
363
|
+
this.filters = [];
|
|
364
|
+
this.dynamicFilters = [];
|
|
365
|
+
this.initialFilters = [];
|
|
366
|
+
this.isRequesting = false;
|
|
367
|
+
this.selectedFilters = new Set();
|
|
368
|
+
this.originalFilterCounts = {};
|
|
369
|
+
this.query = '';
|
|
370
|
+
this.resultsCount = 0;
|
|
371
|
+
}
|
|
372
|
+
connectedCallback() {
|
|
373
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
374
|
+
var _a, _b, _c, _d;
|
|
375
|
+
this.isRequesting = state.isRequesting;
|
|
376
|
+
this.query = state.query || '';
|
|
377
|
+
this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
378
|
+
const facets = (_d = state.searchResults) === null || _d === void 0 ? void 0 : _d.data.facets;
|
|
379
|
+
if (facets) {
|
|
380
|
+
this.populateFiltersFromFacets(facets);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
disconnectedCallback() {
|
|
385
|
+
if (this.unsubscribe) {
|
|
386
|
+
this.unsubscribe();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
populateFiltersFromFacets(facets) {
|
|
390
|
+
var _a;
|
|
391
|
+
const newFilters = Object.entries(((_a = facets.section) === null || _a === void 0 ? void 0 : _a.counts) || {}).map(([key, count]) => {
|
|
392
|
+
const filterValue = key;
|
|
393
|
+
this.originalFilterCounts[filterValue] = `${count}`;
|
|
394
|
+
return {
|
|
395
|
+
label: `${key.replace(/^\//, '')} (${count})`,
|
|
396
|
+
value: filterValue,
|
|
397
|
+
};
|
|
398
|
+
});
|
|
399
|
+
// Update dynamic filters while preserving the initial filters
|
|
400
|
+
const updatedFilters = [
|
|
401
|
+
...this.initialFilters,
|
|
402
|
+
...newFilters.filter((filter) => !this.initialFilters.some((initial) => initial.value === filter.value)),
|
|
403
|
+
];
|
|
404
|
+
this.dynamicFilters = updatedFilters;
|
|
405
|
+
// Store the initial filters only once
|
|
406
|
+
if (this.initialFilters.length === 0) {
|
|
407
|
+
this.initialFilters = [...updatedFilters];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
formatLabel(label) {
|
|
411
|
+
return label
|
|
412
|
+
.replace(/-/g, ' ') // Replace dashes with spaces
|
|
413
|
+
.split(' ') // Split words
|
|
414
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1)) // Capitalize the first letter
|
|
415
|
+
.join(' '); // Join words back into a single string
|
|
416
|
+
}
|
|
417
|
+
render() {
|
|
418
|
+
if (!this.query || this.resultsCount === 0) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
const filtersToRender = this.initialFilters.map((initialFilter) => {
|
|
422
|
+
const isChecked = this.selectedFilters.has(initialFilter.value);
|
|
423
|
+
const dynamicChildren = this.dynamicFilters.filter((dynamicFilter) => dynamicFilter.value.startsWith(initialFilter.value) &&
|
|
424
|
+
dynamicFilter.value !== initialFilter.value);
|
|
425
|
+
return Object.assign(Object.assign({}, initialFilter), { isChecked, children: dynamicChildren });
|
|
426
|
+
});
|
|
427
|
+
return (h("div", { class: 'filtersList' }, filtersToRender.map((filter) => (h("div", { key: filter.value }, h("label", { class: 'checkboxLabel' }, h("input", { class: 'filterCheckbox', checked: filter.isChecked, onChange: (event) => this.handleFilterChange(filter.value, event.target.checked), type: 'checkbox', value: filter.value }), this.formatLabel(filter.label)), filter.isChecked &&
|
|
428
|
+
filter.children.map((childFilter) => {
|
|
429
|
+
const childLabel = childFilter.label.split('/').pop(); // Get only the part after the last '/'
|
|
430
|
+
return (h("label", { class: 'childCheckboxLabel', key: childFilter.value, style: { marginLeft: '20px' } }, h("input", { class: 'childFilterCheckbox', checked: this.selectedFilters.has(childFilter.value), onChange: (event) => this.handleFilterChange(childFilter.value, event.target.checked), type: 'checkbox', value: childFilter.value }), this.formatLabel(childLabel || '')));
|
|
431
|
+
}))))));
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
|
|
435
|
+
|
|
319
436
|
const searchcraftInputModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputContainerLTR{position:relative;width:100%}.inputContainerRTL{position:relative;width:100%;margin-left:8px}.inputLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-right:8px;padding-left:36px;padding-right:16px}.inputLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-right:8px;padding-left:36px;padding-right:16px}.inputDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorLightLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightLTR::placeholder{color:#737373}.inputErrorLightLTR:focus{outline:2px solid #000}.inputErrorLightLTR:focus-visible{outline:2px solid #c00}.inputErrorDarkLTR{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-right:8px;padding-left:36px;padding-right:16px}.inputErrorDarkLTR::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkLTR::placeholder{color:#BFBFBF}.inputErrorDarkLTR:focus{outline:2px solid #FFF}.inputErrorDarkLTR:focus-visible{outline:2px solid #FFB3B3}.inputLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#EDEDED;color:#292929;outline:2px solid #c00;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorLightRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorLightRTL::placeholder{color:#737373}.inputErrorLightRTL:focus{outline:2px solid #000}.inputErrorLightRTL:focus-visible{outline:2px solid #c00}.inputErrorDarkRTL{border:none;border-radius:8px;font-family:var(--font-stack);outline:none;padding-bottom:15px;padding-top:15px;width:100%;background-color:#1A1A1A;color:#FFF;outline:2px solid #FFB3B3;margin-left:8px;padding-left:16px;padding-right:36px;text-align:right}.inputErrorDarkRTL::placeholder{font-family:var(--font-stack);font-size:16px}.inputErrorDarkRTL::placeholder{color:#BFBFBF}.inputErrorDarkRTL:focus{outline:2px solid #FFF}.inputErrorDarkRTL:focus-visible{outline:2px solid #FFB3B3}.inputWrapper{align-items:center;display:flex;position:relative;width:100%}";
|
|
320
437
|
const SearchcraftInputStyle0 = searchcraftInputModuleCss;
|
|
321
438
|
|
|
@@ -324,6 +441,7 @@ const SearchcraftInput = class {
|
|
|
324
441
|
registerInstance(this, hostRef);
|
|
325
442
|
this.clearInput = createEvent(this, "clearInput", 7);
|
|
326
443
|
this.searchInputChange = createEvent(this, "searchInputChange", 7);
|
|
444
|
+
this.inputKeyUp = createEvent(this, "inputKeyUp", 7);
|
|
327
445
|
this.customStyles = {};
|
|
328
446
|
this.error = false;
|
|
329
447
|
this.formClassName = '';
|
|
@@ -345,6 +463,10 @@ const SearchcraftInput = class {
|
|
|
345
463
|
const input = event.target;
|
|
346
464
|
this.searchInputChange.emit(input.value);
|
|
347
465
|
}
|
|
466
|
+
handleInputKeyUp(event) {
|
|
467
|
+
const input = event.target;
|
|
468
|
+
this.inputKeyUp.emit(input.value);
|
|
469
|
+
}
|
|
348
470
|
handleClearInput() {
|
|
349
471
|
if (this.clearInput) {
|
|
350
472
|
this.clearInput.emit();
|
|
@@ -365,11 +487,11 @@ const SearchcraftInput = class {
|
|
|
365
487
|
const placeholderStyle = {
|
|
366
488
|
fontSize: validatedCustomStyles.placeholderFontSize || '16px',
|
|
367
489
|
};
|
|
368
|
-
return (h("div", { key: '
|
|
490
|
+
return (h("div", { key: 'ca2698b808ef606d890817f6b8c133503663570e', class: classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (h(Fragment, null, h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
|
|
369
491
|
#searchcraft-input-id::placeholder {
|
|
370
492
|
font-size: ${placeholderStyle.fontSize};
|
|
371
493
|
}
|
|
372
|
-
`), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h(
|
|
494
|
+
`), this.inputCaptionValue && (h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (h(Fragment, null, h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), h("input", { autoComplete: 'off', class: classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), onKeyUp: this.handleInputKeyUp.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), h("style", null, `
|
|
373
495
|
#searchcraft-input-id::placeholder {
|
|
374
496
|
font-size: ${placeholderStyle.fontSize};
|
|
375
497
|
}
|
|
@@ -456,6 +578,40 @@ const SearchcraftInputLabel = class {
|
|
|
456
578
|
};
|
|
457
579
|
SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
|
|
458
580
|
|
|
581
|
+
const searchcraftResultsInfoModuleCss = ".container{border-bottom:1px solid #D9D9D9;display:flex;justify-content:flex-start;width:100%}.resultsInfo{color:#292929;font-family:\"Brygada 1918\";font-size:18px;font-weight:600;line-height:20px;margin:0;margin-bottom:8px}";
|
|
582
|
+
const SearchcraftResultsInfoStyle0 = searchcraftResultsInfoModuleCss;
|
|
583
|
+
|
|
584
|
+
const SearchcraftResultsInfo = class {
|
|
585
|
+
constructor(hostRef) {
|
|
586
|
+
registerInstance(this, hostRef);
|
|
587
|
+
this.isRequesting = false;
|
|
588
|
+
this.resultsCount = 0;
|
|
589
|
+
this.responseTime = '';
|
|
590
|
+
this.query = '';
|
|
591
|
+
}
|
|
592
|
+
connectedCallback() {
|
|
593
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
594
|
+
var _a, _b, _c, _d;
|
|
595
|
+
this.isRequesting = state.isRequesting;
|
|
596
|
+
this.resultsCount = ((_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.count) || 0;
|
|
597
|
+
this.responseTime = ((((_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.time_taken) || 0) * 1000).toFixed(2);
|
|
598
|
+
this.query = state.query || ''; // Update query from store
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
disconnectedCallback() {
|
|
602
|
+
if (this.unsubscribe) {
|
|
603
|
+
this.unsubscribe();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
render() {
|
|
607
|
+
if (!this.query || this.resultsCount === 0) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
return (h("div", { class: 'container' }, h("p", { class: 'resultsInfo' }, this.resultsCount, " results found in ", this.responseTime, "ms")));
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
SearchcraftResultsInfo.style = SearchcraftResultsInfoStyle0;
|
|
614
|
+
|
|
459
615
|
const SearchcraftSearchIconSet = class {
|
|
460
616
|
constructor(hostRef) {
|
|
461
617
|
registerInstance(this, hostRef);
|
|
@@ -480,6 +636,69 @@ const SearchcraftSearchIconSet = class {
|
|
|
480
636
|
}
|
|
481
637
|
};
|
|
482
638
|
|
|
639
|
+
const searchcraftSliderModuleCss = ".slider-container{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center}label{font-size:14px;font-weight:bold;margin-bottom:10px}.range-container{display:flex;width:100%;align-items:center}.range-slider{width:100%;height:4px;background:#ddd;border-radius:2px;outline:none;margin:0 -1px;position:relative}.range-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:1px solid #E6E6E6;cursor:pointer;position:relative}.range-slider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:1px solid #E6E6E6;cursor:pointer}.range-slider:before{content:\"\";position:absolute;height:4px;background-color:#FFF;border-radius:2px;left:0;right:0;z-index:-1}.year-labels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\";color:#666}.year-label{min-width:30px;text-align:center}";
|
|
640
|
+
const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
|
|
641
|
+
|
|
642
|
+
const SearchcraftSlider = class {
|
|
643
|
+
constructor(hostRef) {
|
|
644
|
+
registerInstance(this, hostRef);
|
|
645
|
+
this.searchStore = useSearchcraftStore.getState();
|
|
646
|
+
this.updateYears = async () => {
|
|
647
|
+
this.searchStore.setYearsRange([this.startYear, this.endYear]);
|
|
648
|
+
try {
|
|
649
|
+
if (typeof this.query === 'string' && this.query.trim() !== '') {
|
|
650
|
+
await this.searchStore.search();
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
console.warn('Query is missing or empty, skipping search request.');
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
catch (error) {
|
|
657
|
+
console.error('Search failed:', error);
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
this.handleStartYearChange = (event) => {
|
|
661
|
+
const value = Number.parseInt(event.target.value, 10);
|
|
662
|
+
this.startYear = Math.min(value, this.endYear);
|
|
663
|
+
this.updateYears();
|
|
664
|
+
};
|
|
665
|
+
this.handleEndYearChange = (event) => {
|
|
666
|
+
const value = Number.parseInt(event.target.value, 10);
|
|
667
|
+
this.endYear = Math.max(value, this.startYear);
|
|
668
|
+
this.updateYears();
|
|
669
|
+
};
|
|
670
|
+
this.minYear = 2000;
|
|
671
|
+
this.maxYear = new Date().getFullYear();
|
|
672
|
+
this.endYear = this.maxYear;
|
|
673
|
+
this.query = '';
|
|
674
|
+
this.startYear = this.minYear;
|
|
675
|
+
this.hasSearched = false;
|
|
676
|
+
this.resultsCount = 0;
|
|
677
|
+
}
|
|
678
|
+
componentDidLoad() {
|
|
679
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
680
|
+
var _a, _b, _c;
|
|
681
|
+
if (state.query.length > 0) {
|
|
682
|
+
this.hasSearched = true;
|
|
683
|
+
this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
684
|
+
}
|
|
685
|
+
this.query = state.query;
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
disconnectedCallback() {
|
|
689
|
+
if (this.unsubscribe) {
|
|
690
|
+
this.unsubscribe();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
render() {
|
|
694
|
+
if (!this.query || this.resultsCount === 0) {
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
return (h("div", { class: 'slider-container' }, h("div", { class: 'range-container' }, h("input", { class: 'range-slider', max: this.maxYear, min: this.minYear, onInput: this.handleStartYearChange, step: '1', type: 'range', value: this.startYear }), h("input", { class: 'range-slider', max: this.maxYear, min: this.minYear, onInput: this.handleEndYearChange, step: '1', type: 'range', value: this.endYear })), h("div", { class: 'year-labels' }, h("span", { class: 'year-label' }, this.startYear), h("span", { class: 'year-label' }, this.endYear))));
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
SearchcraftSlider.style = SearchcraftSliderStyle0;
|
|
701
|
+
|
|
483
702
|
const searchcraftSpinnerDarkModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.spinnerDark{height:100%;width:100%;background:conic-gradient(#000 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}.spinnerLight{height:100%;width:100%;background:conic-gradient(#737373 50%, #FFFFFF);clip-path:circle(50%);mask-image:radial-gradient(circle at center, rgba(0, 0, 0, 0) 6.6666666667px, rgb(0, 0, 0) 6.6666666667px);animation:spinning 1s linear infinite}@keyframes spinning{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}";
|
|
484
703
|
const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
|
|
485
704
|
|
|
@@ -488,7 +707,7 @@ const SearchcraftSpinnerDark = class {
|
|
|
488
707
|
registerInstance(this, hostRef);
|
|
489
708
|
}
|
|
490
709
|
render() {
|
|
491
|
-
return (h("div", { key: '
|
|
710
|
+
return (h("div", { key: '60b629930c2e2795236f6768b40c95ce9390e882', class: 'spinnerContainer' }, h("div", { key: 'bfef3329f2e81ecf6538738ac0213da6259dd1c3', class: 'spinnerDark' })));
|
|
492
711
|
}
|
|
493
712
|
};
|
|
494
713
|
SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
|
|
@@ -501,11 +720,65 @@ const SearchcraftSpinnerLight = class {
|
|
|
501
720
|
registerInstance(this, hostRef);
|
|
502
721
|
}
|
|
503
722
|
render() {
|
|
504
|
-
return (h("div", { key: '
|
|
723
|
+
return (h("div", { key: 'ad5224c97faf7e329d2a8904488c17dfd7414b9e', class: 'spinnerContainer' }, h("div", { key: '6336ce7737af65eedac46ee290b20291ce5b6096', class: 'spinnerLight' })));
|
|
505
724
|
}
|
|
506
725
|
};
|
|
507
726
|
SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
|
|
508
727
|
|
|
509
|
-
|
|
728
|
+
const searchcraftToggleButtonModuleCss = ".toggle-wrapper{box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);margin-left:10px;border:none;border-radius:16px;width:44px;height:26px;background:#ddd;position:relative;cursor:pointer}.toggle-wrapper.active{box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05);background:#007DB3}.toggle-wrapper .toggle-switch{width:18px;height:18px;background:#fff;border-radius:50%;position:absolute;top:calc(50% - 9px);left:4px;transition:transform 0.3s ease}.toggle-wrapper .toggle-switch.active{transform:translateX(16px)}";
|
|
729
|
+
const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
|
|
730
|
+
|
|
731
|
+
const SearchcraftToggleButton = class {
|
|
732
|
+
constructor(hostRef) {
|
|
733
|
+
registerInstance(this, hostRef);
|
|
734
|
+
this.searchStore = useSearchcraftStore.getState();
|
|
735
|
+
this.handleToggle = async () => {
|
|
736
|
+
this.isActive = !this.isActive;
|
|
737
|
+
if (this.type === 'mode') {
|
|
738
|
+
const mode = this.isActive ? 'normal' : 'fuzzy';
|
|
739
|
+
this.searchStore.setSearchParams({
|
|
740
|
+
mode,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
else if (this.type === 'sort') {
|
|
744
|
+
const sort = this.isActive ? 'desc' : 'asc';
|
|
745
|
+
this.searchStore.setSearchParams({
|
|
746
|
+
sort,
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
try {
|
|
750
|
+
await this.searchStore.search();
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
console.error('Search failed:', error);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
this.type = 'mode';
|
|
757
|
+
this.isActive = false;
|
|
758
|
+
this.query = '';
|
|
759
|
+
this.resultsCount = 0;
|
|
760
|
+
}
|
|
761
|
+
componentDidLoad() {
|
|
762
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
763
|
+
var _a, _b, _c;
|
|
764
|
+
this.query = state.query || '';
|
|
765
|
+
this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
disconnectedCallback() {
|
|
769
|
+
if (this.unsubscribe) {
|
|
770
|
+
this.unsubscribe();
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
render() {
|
|
774
|
+
if (!this.query || this.resultsCount === 0) {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
return (h("button", { class: `toggle-wrapper ${this.isActive ? 'active' : ''}`, onClick: this.handleToggle, type: 'button' }, h("div", { class: `toggle-switch ${this.isActive ? 'active' : ''}` })));
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
|
|
781
|
+
|
|
782
|
+
export { SearchcraftAutoSearchForm as searchcraft_auto_search_form, SearchcraftBaseSearchResult as searchcraft_base_search_result, SearchcraftBaseSearchResults as searchcraft_base_search_results, SearchcraftClearIconSet as searchcraft_clear_icon_set, SearchcraftClearInputButton as searchcraft_clear_input_button, SearchcraftErrorMessage as searchcraft_error_message, SearchcraftFiltersList as searchcraft_filters_list, SearchcraftInput as searchcraft_input, SearchcraftInputCaption as searchcraft_input_caption, SearchcraftInputIcon as searchcraft_input_icon, SearchcraftInputLabel as searchcraft_input_label, SearchcraftResultsInfo as searchcraft_results_info, SearchcraftSearchIconSet as searchcraft_search_icon_set, SearchcraftSlider as searchcraft_slider, SearchcraftSpinnerDark as searchcraft_spinner_dark, SearchcraftSpinnerLight as searchcraft_spinner_light, SearchcraftToggleButton as searchcraft_toggle_button };
|
|
510
783
|
|
|
511
|
-
//# sourceMappingURL=searchcraft-auto-search-
|
|
784
|
+
//# sourceMappingURL=searchcraft-auto-search-form_17.entry.js.map
|