@searchcraft/javascript-sdk 0.1.5 → 0.1.7
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/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/index-5b0b9d4c.js +84 -0
- package/dist/cjs/index-5b0b9d4c.js.map +1 -0
- package/dist/cjs/index-7b49313c.js +1273 -0
- package/dist/cjs/index-7b49313c.js.map +1 -0
- package/dist/cjs/index.cjs.js +17 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/searchcraft-auto-search-form_13.cjs.entry.js +492 -0
- package/dist/cjs/searchcraft-auto-search-form_13.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +64 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-button-icon.cjs.entry.js +18 -0
- package/dist/cjs/searchcraft-button-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-button.cjs.entry.js +37 -0
- package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +27 -0
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -0
- package/dist/cjs/store-3d577aac.js +251 -0
- package/dist/cjs/store-3d577aac.js.map +1 -0
- package/dist/cjs/utils-39791159.js +53 -0
- package/dist/cjs/utils-39791159.js.map +1 -0
- package/dist/collection/assets/searchcraft-button-icons.js +9 -0
- package/dist/collection/assets/searchcraft-button-icons.js.map +1 -0
- package/dist/collection/assets/searchcraft-clear-icon-set.js +45 -0
- package/dist/collection/assets/searchcraft-clear-icon-set.js.map +1 -0
- package/dist/collection/assets/searchcraft-search-icon-set.js +84 -0
- package/dist/collection/assets/searchcraft-search-icon-set.js.map +1 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +339 -0
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -0
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +19 -0
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +168 -0
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -0
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +14 -0
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +308 -0
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -0
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +209 -0
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +166 -0
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -0
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +36 -0
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +137 -0
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -0
- package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +82 -0
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +96 -0
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +1 -0
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +33 -0
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +64 -0
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -0
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +21 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +333 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +241 -0
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +122 -0
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +1 -0
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +79 -0
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +109 -0
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +1 -0
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +17 -0
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +77 -0
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -0
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +21 -0
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +19 -0
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js.map +1 -0
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +35 -0
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +19 -0
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js.map +1 -0
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +26 -0
- package/dist/collection/index.js +14 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/provider/store.js +68 -0
- package/dist/collection/provider/store.js.map +1 -0
- package/dist/collection/utils/utils.js +45 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-04bad430.js +34 -0
- package/dist/components/p-04bad430.js.map +1 -0
- package/dist/components/p-07fba086.js +69 -0
- package/dist/components/p-07fba086.js.map +1 -0
- package/dist/components/p-17c94ac1.js +48 -0
- package/dist/components/p-17c94ac1.js.map +1 -0
- package/dist/components/p-3ea9ba3a.js +62 -0
- package/dist/components/p-3ea9ba3a.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/index-d6567b9c.js → components/p-5cdc6210.js} +2 -10
- package/dist/components/p-5cdc6210.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-input.entry.js → components/p-62f37242.js} +83 -11
- package/dist/components/p-62f37242.js.map +1 -0
- package/dist/components/p-6b1d0cba.js +54 -0
- package/dist/components/p-6b1d0cba.js.map +1 -0
- package/dist/components/p-781a9a8c.js +34 -0
- package/dist/components/p-781a9a8c.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-input-caption.entry.js → components/p-85d96d9b.js} +32 -10
- package/dist/components/p-85d96d9b.js.map +1 -0
- package/dist/components/p-9c617862.js +247 -0
- package/dist/components/p-9c617862.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js → components/p-a3ea7edc.js} +25 -7
- package/dist/components/p-a3ea7edc.js.map +1 -0
- package/dist/components/p-af65953e.js +1109 -0
- package/dist/components/p-af65953e.js.map +1 -0
- package/dist/components/p-c14731ca.js +41 -0
- package/dist/components/p-c14731ca.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js → components/p-d33fdd81.js} +27 -7
- package/dist/components/p-d33fdd81.js.map +1 -0
- package/dist/components/p-d73bc01d.js +50 -0
- package/dist/components/p-d73bc01d.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js → components/p-f3af2b04.js} +38 -9
- package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-result.entry.js.map → components/p-f3af2b04.js.map} +1 -1
- package/dist/components/searchcraft-auto-search-form.js +196 -0
- package/dist/components/searchcraft-auto-search-form.js.map +1 -0
- package/dist/components/searchcraft-base-search-form.js +153 -0
- package/dist/components/searchcraft-base-search-form.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +8 -0
- package/dist/components/searchcraft-base-search-result.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js → components/searchcraft-base-search-results.js} +49 -11
- package/dist/components/searchcraft-base-search-results.js.map +1 -0
- package/dist/components/searchcraft-button-icon.js +33 -0
- package/dist/components/searchcraft-button-icon.js.map +1 -0
- package/dist/components/searchcraft-button.js +8 -0
- package/dist/components/searchcraft-button.js.map +1 -0
- package/dist/components/searchcraft-clear-icon-set.js +8 -0
- package/dist/components/searchcraft-clear-icon-set.js.map +1 -0
- package/dist/components/searchcraft-clear-input-button.js +8 -0
- package/dist/components/searchcraft-clear-input-button.js.map +1 -0
- package/dist/components/searchcraft-error-message.js +8 -0
- package/dist/components/searchcraft-error-message.js.map +1 -0
- package/dist/components/searchcraft-input-caption.js +8 -0
- package/dist/components/searchcraft-input-caption.js.map +1 -0
- package/dist/components/searchcraft-input-icon.js +8 -0
- package/dist/components/searchcraft-input-icon.js.map +1 -0
- package/dist/components/searchcraft-input-label.js +8 -0
- package/dist/components/searchcraft-input-label.js.map +1 -0
- package/dist/components/searchcraft-input.js +8 -0
- package/dist/components/searchcraft-input.js.map +1 -0
- package/dist/components/searchcraft-search-icon-set.js +8 -0
- package/dist/components/searchcraft-search-icon-set.js.map +1 -0
- package/dist/components/searchcraft-spinner-dark.js +8 -0
- package/dist/components/searchcraft-spinner-dark.js.map +1 -0
- package/dist/components/searchcraft-spinner-light.js +8 -0
- package/dist/components/searchcraft-spinner-light.js.map +1 -0
- package/dist/esm/index-72ac5051.js +82 -0
- package/dist/esm/index-72ac5051.js.map +1 -0
- package/dist/esm/index-e4a4f86d.js +1245 -0
- package/dist/esm/index-e4a4f86d.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/searchcraft-auto-search-form_13.entry.js +476 -0
- package/dist/esm/searchcraft-auto-search-form_13.entry.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-base-search-form.entry.js +4 -4
- package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button-icon.entry.js +1 -1
- package/dist/esm/searchcraft-button-icon.entry.js.map +1 -0
- package/dist/{searchcraft-javascript-sdk → esm}/searchcraft-button.entry.js +4 -4
- package/dist/esm/searchcraft-button.entry.js.map +1 -0
- package/dist/esm/searchcraft-javascript-sdk.js +22 -0
- package/dist/esm/searchcraft-javascript-sdk.js.map +1 -0
- package/dist/esm/store-03dc618f.js +247 -0
- package/dist/esm/store-03dc618f.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -14
- package/dist/searchcraft-javascript-sdk/index.esm.js.map +1 -1
- package/dist/searchcraft-javascript-sdk/p-17c94ac1.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-17c94ac1.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +7 -0
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-6a17384e.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-6a17384e.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-6c825f8c.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-6c825f8c.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-98eab6f9.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-98eab6f9.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-9c617862.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-9c617862.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-e1255160.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-e6f6972c.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-e6f6972c.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-f77e9c21.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-f77e9c21.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -48
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js +0 -34
- package/dist/searchcraft-javascript-sdk/_commonjsHelpers-63cbe26c.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/index-2e19f875.js +0 -3043
- package/dist/searchcraft-javascript-sdk/index-2e19f875.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/index-d6567b9c.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js +0 -101
- package/dist/searchcraft-javascript-sdk/searchcraft-auto-search-form.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-base-search-form.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-base-search-results.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-button-icon.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-button.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-clear-icon-set.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js +0 -31
- package/dist/searchcraft-javascript-sdk/searchcraft-clear-input-button.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js +0 -22
- package/dist/searchcraft-javascript-sdk/searchcraft-error-message.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-input-caption.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js +0 -25
- package/dist/searchcraft-javascript-sdk/searchcraft-input-icon.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js +0 -30
- package/dist/searchcraft-javascript-sdk/searchcraft-input-label.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-input.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-search-icon-set.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js +0 -17
- package/dist/searchcraft-javascript-sdk/searchcraft-spinner-dark.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js +0 -17
- package/dist/searchcraft-javascript-sdk/searchcraft-spinner-light.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js +0 -334
- package/dist/searchcraft-javascript-sdk/shadow-css-423dab2c.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/store-7a83a5d7.js +0 -3008
- package/dist/searchcraft-javascript-sdk/store-7a83a5d7.js.map +0 -1
- /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js +0 -0
- /package/dist/{searchcraft-javascript-sdk → esm}/app-globals-0f993ce5.js.map +0 -0
- /package/dist/{searchcraft-javascript-sdk → esm}/utils-7bff0c78.js +0 -0
- /package/dist/{searchcraft-javascript-sdk → esm}/utils-7bff0c78.js.map +0 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-7b49313c.js');
|
|
6
|
+
const store = require('./store-3d577aac.js');
|
|
7
|
+
const utils = require('./utils-39791159.js');
|
|
8
|
+
const index$1 = require('./index-5b0b9d4c.js');
|
|
9
|
+
|
|
10
|
+
const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{text-align:left;width:100%}.formRTL{text-align:right;width:100%}.searchContainer{align-items:center;display:flex;width:100%}";
|
|
11
|
+
const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
|
|
12
|
+
|
|
13
|
+
const SearchcraftAutoSearchForm = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
index.registerInstance(this, hostRef);
|
|
16
|
+
this.querySubmit = index.createEvent(this, "querySubmit", 7);
|
|
17
|
+
this.debounceTimeout = null;
|
|
18
|
+
this.debounceDelay = 300; // 300ms debounce delay
|
|
19
|
+
this.searchStore = store.useSearchcraftStore.getState();
|
|
20
|
+
this.handleInputChange = (event) => {
|
|
21
|
+
this.query = event.detail;
|
|
22
|
+
this.querySubmit.emit(this.query);
|
|
23
|
+
// Clear the previous debounce timeout
|
|
24
|
+
if (this.debounceTimeout) {
|
|
25
|
+
clearTimeout(this.debounceTimeout);
|
|
26
|
+
}
|
|
27
|
+
// Set a new debounce timeout
|
|
28
|
+
this.debounceTimeout = setTimeout(() => {
|
|
29
|
+
this.runSearch();
|
|
30
|
+
}, this.debounceDelay);
|
|
31
|
+
};
|
|
32
|
+
this.handleClearInput = () => {
|
|
33
|
+
this.query = '';
|
|
34
|
+
if (typeof this.clearInput === 'function') {
|
|
35
|
+
this.clearInput();
|
|
36
|
+
}
|
|
37
|
+
if (this.debounceTimeout) {
|
|
38
|
+
clearTimeout(this.debounceTimeout);
|
|
39
|
+
}
|
|
40
|
+
this.error = false;
|
|
41
|
+
this.searchResults = '';
|
|
42
|
+
};
|
|
43
|
+
this.runSearch = async () => {
|
|
44
|
+
if (this.query.trim() === '') {
|
|
45
|
+
this.error = true;
|
|
46
|
+
this.searchResults = '';
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.error = false;
|
|
50
|
+
this.searchStore.setQuery(this.query);
|
|
51
|
+
try {
|
|
52
|
+
await this.searchStore.search();
|
|
53
|
+
this.searchResults = JSON.stringify(this.searchStore.searchResults);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.error = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
this.handleFormSubmit = async (event) => {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
await this.runSearch();
|
|
63
|
+
};
|
|
64
|
+
this.autoSearchFormClass = '';
|
|
65
|
+
this.clearInput = () => { };
|
|
66
|
+
this.config = {
|
|
67
|
+
apiKey: '',
|
|
68
|
+
endpointURL: '',
|
|
69
|
+
index: [],
|
|
70
|
+
};
|
|
71
|
+
this.customStylesForInput = {};
|
|
72
|
+
this.inputCaptionValue = '';
|
|
73
|
+
this.inputIconHeight = 20;
|
|
74
|
+
this.inputIconWidth = 20;
|
|
75
|
+
this.labelForInput = '';
|
|
76
|
+
this.placeholderValue = 'Search here';
|
|
77
|
+
this.rightToLeftOrientation = false;
|
|
78
|
+
this.searchContainerClass = '';
|
|
79
|
+
this.error = false;
|
|
80
|
+
this.isRequesting = false;
|
|
81
|
+
this.query = '';
|
|
82
|
+
this.searchResults = '';
|
|
83
|
+
}
|
|
84
|
+
componentDidLoad() {
|
|
85
|
+
const searchcraft = new store.g(this.config);
|
|
86
|
+
this.searchStore.initialize(searchcraft, true);
|
|
87
|
+
this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
|
|
88
|
+
this.isRequesting = state.isRequesting;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
disconnectedCallback() {
|
|
92
|
+
if (this.unsubscribe) {
|
|
93
|
+
this.unsubscribe();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
|
|
98
|
+
const parsedCustomStyles = utils.parseCustomStyles(this.customStylesForInput);
|
|
99
|
+
return (index.h("form", { key: '6b735bbdba6e7ff105d176fffa32b9431d5c4e49', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: 'c7284dead137677ee7cd6aedac4dbfb38fac8c4c', label: this.labelForInput }), index.h("div", { key: 'a59294d9b406a1df9beb6264808f6e6a43cedbdd', class: 'searchContainer' }, index.h("searchcraft-input", { key: 'c1faa2d11c94ec3d4d39456612209e72fd208629', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "is-requesting": this.isRequesting, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, onClearInput: this.handleClearInput, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation })), this.error && (index.h("searchcraft-error-message", { key: 'b8b1e5b4b212a30f07f3756c8ce33c142e520420', errorMessage: 'Please enter a search query.' }))));
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
|
|
103
|
+
|
|
104
|
+
const searchcraftBaseSearchResultModuleCss = ":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-height:540px;max-width:100%}@media (min-width: 600px){.imageContainer{max-height:175px}}.contentContainer{max-height:100%;max-width:100%}@media (min-width: 600px){.contentContainer{max-width:50%}}.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}.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}";
|
|
105
|
+
const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
|
|
106
|
+
|
|
107
|
+
const SearchcraftBaseSearchResult = class {
|
|
108
|
+
constructor(hostRef) {
|
|
109
|
+
index.registerInstance(this, hostRef);
|
|
110
|
+
this.buttonCallback = index.createEvent(this, "buttonCallback", 7);
|
|
111
|
+
this.keyDownCallback = index.createEvent(this, "keyDownCallback", 7);
|
|
112
|
+
this.resultCallback = index.createEvent(this, "resultCallback", 7);
|
|
113
|
+
this.buttonCallback = () => { }; // Callback for button click
|
|
114
|
+
this.keyDownCallback = () => { }; // Callback for key down event
|
|
115
|
+
this.resultCallback = () => { }; // Callback for result container click
|
|
116
|
+
this.handleButtonClick = () => {
|
|
117
|
+
this.buttonCallback();
|
|
118
|
+
};
|
|
119
|
+
this.handleContainerClick = () => {
|
|
120
|
+
if (this.isInteractive) {
|
|
121
|
+
this.resultCallback();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
this.buttonText = '';
|
|
125
|
+
this.imageDescription = '';
|
|
126
|
+
this.imageSource = '';
|
|
127
|
+
this.isInteractive = false;
|
|
128
|
+
this.primaryContent = '';
|
|
129
|
+
this.secondaryContent = '';
|
|
130
|
+
this.tertiaryContent = '';
|
|
131
|
+
this.headingText = '';
|
|
132
|
+
this.subheadingText = '';
|
|
133
|
+
this.themeMode = 'light';
|
|
134
|
+
this.customStyles = '{}';
|
|
135
|
+
}
|
|
136
|
+
parseStyles() {
|
|
137
|
+
try {
|
|
138
|
+
return JSON.parse(this.customStyles);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error('Error parsing custom styles:', error);
|
|
142
|
+
return {};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
const isLightTheme = this.themeMode === 'light';
|
|
147
|
+
const styles = this.parseStyles();
|
|
148
|
+
return (index.h("div", { key: 'e16bae2d337d064e057645cfb0ebf52346229b83', class: this.isInteractive
|
|
149
|
+
? isLightTheme
|
|
150
|
+
? 'interactiveResultContainerLight'
|
|
151
|
+
: 'interactiveResultContainerDark'
|
|
152
|
+
: 'resultContainer', style: styles.container || {}, tabindex: '0', onClick: this.handleContainerClick, onKeyDown: this.keyDownCallback }, index.h("div", { key: 'f2154ce85febbe54956a7f28292b13113e3048dd', class: 'imageContainer' }, index.h("img", { key: '8063fa3b88ba56b9cba63ded99967c8097b8b185', alt: this.imageDescription, src: this.imageSource, style: styles.image || {}, class: isLightTheme ? 'imageLight' : 'imageDark' })), index.h("div", { key: 'e04a38165dc98b0d72f215e4252f7065db3664d6', class: 'contentContainer' }, index.h("h2", { key: '33d2d3483d7c0f4e1ae7e15ba5895a8b15b45a34', style: styles.heading || {}, class: isLightTheme ? 'headingLight' : 'headingDark' }, this.headingText), index.h("h3", { key: '9587d0acea25ede251eba3e79dba932a5565f51a', style: styles.subheading || {}, class: isLightTheme ? 'subheadingLight' : 'subheadingDark' }, this.subheadingText), index.h("p", { key: '74f55a23963d5ddc8753d68b164587865da2dd13', style: styles.primaryContent || {}, class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark' }, this.primaryContent), index.h("div", { key: 'db4e498b08c7075b276e90d8ed233dd48992ecdd' }, index.h("p", { key: 'c09d3164a15452c5fbfa23a54028f2080dd56550', style: styles.secondaryContent || {}, class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark' }, this.secondaryContent), index.h("p", { key: 'ae78c4f53d9b12d62cad6b408aad5caf103303db', style: styles.tertiaryContent || {}, class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark' }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: '3ea036c680f3970e9d6f1b00b3505f11e338922c', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText)))));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
|
|
156
|
+
|
|
157
|
+
const searchcraftBaseSearchResultsModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.resultsContainer{display:flex;flex-direction:column;justify-content:center;margin:100px 20px}.resultsContainer>p{align-self:center}.resultsContainer>div{margin-bottom:20px}.resultsContainer>div img{height:300px;width:200px}.adSection{align-items:center;border:1px solid #DCDDDE;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}";
|
|
158
|
+
const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
|
|
159
|
+
|
|
160
|
+
const SearchcraftBaseSearchResults = class {
|
|
161
|
+
constructor(hostRef) {
|
|
162
|
+
index.registerInstance(this, hostRef);
|
|
163
|
+
this.query = '';
|
|
164
|
+
this.searchResults = null;
|
|
165
|
+
this.searchKeys = '';
|
|
166
|
+
this.customStylesForResults = {};
|
|
167
|
+
this.placeAdAtEnd = false;
|
|
168
|
+
this.adInterval = 4;
|
|
169
|
+
}
|
|
170
|
+
componentDidLoad() {
|
|
171
|
+
if (!this.searchKeys || this.searchKeys.length === 0) {
|
|
172
|
+
console.warn('No searchKeys provided; using empty keys array.');
|
|
173
|
+
this.searchKeys = '';
|
|
174
|
+
}
|
|
175
|
+
this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
|
|
176
|
+
this.searchResults = Object.assign({}, state.searchResults);
|
|
177
|
+
this.query = state.query;
|
|
178
|
+
});
|
|
179
|
+
const { searchResults, query } = store.useSearchcraftStore.getState();
|
|
180
|
+
this.searchResults = searchResults;
|
|
181
|
+
this.query = query;
|
|
182
|
+
}
|
|
183
|
+
disconnectedCallback() {
|
|
184
|
+
if (this.unsubscribe) {
|
|
185
|
+
this.unsubscribe();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
render() {
|
|
189
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
190
|
+
if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
191
|
+
console.warn('No search results data available');
|
|
192
|
+
return index.h("div", null, "No results to display.");
|
|
193
|
+
}
|
|
194
|
+
const parsedSearchKeys = utils.parseSearchKeys(this.searchKeys);
|
|
195
|
+
const serializedStyles = typeof this.customStylesForResults === 'string'
|
|
196
|
+
? this.customStylesForResults
|
|
197
|
+
: utils.serializeStyles(this.customStylesForResults);
|
|
198
|
+
const resultsComponents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((document, index$1) => {
|
|
199
|
+
const { doc: result } = document;
|
|
200
|
+
const dynamicProperties = utils.extractDynamicProperties(result, parsedSearchKeys);
|
|
201
|
+
return (index.h("searchcraft-base-search-result", { key: `${document.document_id}-${index$1}`, "button-callback": () => console.log('button callback'), "result-callback": () => console.log('interactive element'), "keydown-callback": () => console.log('keydown'), "is-interactive": true, "heading-text": dynamicProperties[parsedSearchKeys[0]], "subheading-text": dynamicProperties[parsedSearchKeys[1]], "primary-content": dynamicProperties[parsedSearchKeys[2]], "secondary-content": dynamicProperties[parsedSearchKeys[3]], "tertiary-content": dynamicProperties[parsedSearchKeys[4]], "image-source": dynamicProperties[parsedSearchKeys[parsedSearchKeys.length - 1]], "custom-styles": serializedStyles }));
|
|
202
|
+
});
|
|
203
|
+
const finalComponents = [];
|
|
204
|
+
// Add ads at specified intervals
|
|
205
|
+
if (this.adInterval > 0) {
|
|
206
|
+
resultsComponents.forEach((component, index$1) => {
|
|
207
|
+
finalComponents.push(component);
|
|
208
|
+
if ((index$1 + 1) % this.adInterval === 0) {
|
|
209
|
+
finalComponents.push(index.h("div", { key: `ad-section-${index$1 + 1}`, class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
finalComponents.push(...resultsComponents);
|
|
215
|
+
}
|
|
216
|
+
// Add ad at the end if specified
|
|
217
|
+
if (this.placeAdAtEnd) {
|
|
218
|
+
finalComponents.push(index.h("div", { key: 'ad-section-end', class: 'adSection' }, index.h("span", null, "##"), index.h("p", null, " Ad Impressions")));
|
|
219
|
+
}
|
|
220
|
+
return (index.h("div", { class: 'resultsContainer' }, finalComponents, this.query.length > 0 &&
|
|
221
|
+
((_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 && (index.h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` }))));
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
|
|
225
|
+
|
|
226
|
+
const SearchcraftClearIconSet = class {
|
|
227
|
+
constructor(hostRef) {
|
|
228
|
+
index.registerInstance(this, hostRef);
|
|
229
|
+
this.type = 'clear-light';
|
|
230
|
+
}
|
|
231
|
+
render() {
|
|
232
|
+
switch (this.type) {
|
|
233
|
+
case 'clear-light':
|
|
234
|
+
return (index.h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, index.h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), index.h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'black', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
235
|
+
case 'clear-dark':
|
|
236
|
+
return (index.h("svg", { width: '22', height: '22', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, index.h("title", { id: 'icon-title' }, "Searchcraft Clear Input Icon Dark"), index.h("path", { d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'white', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
237
|
+
case 'arrow-light':
|
|
238
|
+
return (index.h("svg", { width: '20', height: '21', viewBox: '0 0 20 21', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, index.h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Light"), index.h("path", { d: 'M7.5 15.0444L12.5 10.0444L7.5 5.04443', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
239
|
+
case 'arrow-dark':
|
|
240
|
+
return (index.h("svg", { width: '8', height: '12', viewBox: '0 0 8 12', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, index.h("title", { id: 'icon-title' }, "Searchcraft Arrow Right Icon Dark"), index.h("path", { d: 'M1.5 11L6.5 6L1.5 1', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
241
|
+
default:
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
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:25px;top:50%;transform:translateY(-50%);width:20px}.inputClearButtonRTL{align-items:center;background:none;border:none;display:flex;height:20px;justify-content:center;left:25px;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:20px}";
|
|
248
|
+
const SearchcraftClearInputButtonStyle0 = searchcraftClearInputButtonModuleCss;
|
|
249
|
+
|
|
250
|
+
const SearchcraftClearInputButton = class {
|
|
251
|
+
constructor(hostRef) {
|
|
252
|
+
index.registerInstance(this, hostRef);
|
|
253
|
+
this.clearInput = index.createEvent(this, "clearInput", 7);
|
|
254
|
+
// Added a click handler to emit the event
|
|
255
|
+
this.handleClearClick = (event) => {
|
|
256
|
+
event.preventDefault(); // Prevent default if necessary
|
|
257
|
+
this.clearInput.emit(); // Emit the event
|
|
258
|
+
};
|
|
259
|
+
this.isRequesting = false;
|
|
260
|
+
this.rightToLeftOrientation = false;
|
|
261
|
+
this.theme = 'light';
|
|
262
|
+
}
|
|
263
|
+
isLightTheme() {
|
|
264
|
+
return this.theme === 'light';
|
|
265
|
+
}
|
|
266
|
+
render() {
|
|
267
|
+
return this.rightToLeftOrientation ? (index.h("button", { class: index$1.classNames('inputClearButtonRTL', '.sc-clear-input-button-rtl'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (index.h("searchcraft-spinner-light", null)) : (index.h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' })))) : (index.h("button", { class: index$1.classNames('inputClearButtonLTR', '.sc-clear-input-button-ltr'), onClick: this.handleClearClick, type: 'button' }, this.isRequesting ? (this.isLightTheme ? (index.h("searchcraft-spinner-light", null)) : (index.h("searchcraft-spinner-dark", null))) : this.isLightTheme ? (index.h("searchcraft-clear-icon-set", { type: 'clear-light' })) : (index.h("searchcraft-clear-icon-set", { type: 'clear-dark' }))));
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
|
|
271
|
+
|
|
272
|
+
const searchcraftErrorMessageModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.errorMessageLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.errorMessageDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}";
|
|
273
|
+
const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
|
|
274
|
+
|
|
275
|
+
const SearchcraftErrorMessage = class {
|
|
276
|
+
constructor(hostRef) {
|
|
277
|
+
index.registerInstance(this, hostRef);
|
|
278
|
+
this.errorMessage = undefined;
|
|
279
|
+
this.theme = 'light';
|
|
280
|
+
}
|
|
281
|
+
render() {
|
|
282
|
+
const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
|
|
283
|
+
return (index.h("p", { key: 'f520ac38f2f42e9780454aef5e25576095ae5ee9', class: index$1.classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
|
|
287
|
+
|
|
288
|
+
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%}";
|
|
289
|
+
const SearchcraftInputStyle0 = searchcraftInputModuleCss;
|
|
290
|
+
|
|
291
|
+
const SearchcraftInput = class {
|
|
292
|
+
constructor(hostRef) {
|
|
293
|
+
index.registerInstance(this, hostRef);
|
|
294
|
+
this.clearInput = index.createEvent(this, "clearInput", 7);
|
|
295
|
+
this.searchInputChange = index.createEvent(this, "searchInputChange", 7);
|
|
296
|
+
this.customStyles = {};
|
|
297
|
+
this.error = false;
|
|
298
|
+
this.formClassName = '';
|
|
299
|
+
this.inputCaptionClassName = '';
|
|
300
|
+
this.inputCaptionValue = '';
|
|
301
|
+
this.inputClassName = '';
|
|
302
|
+
this.inputIconHeight = 20;
|
|
303
|
+
this.inputIconWidth = 20;
|
|
304
|
+
this.isRequesting = false;
|
|
305
|
+
this.placeholderValue = 'Enter Search';
|
|
306
|
+
this.rightToLeftOrientation = false;
|
|
307
|
+
this.query = '';
|
|
308
|
+
this.theme = 'light';
|
|
309
|
+
}
|
|
310
|
+
get isLightTheme() {
|
|
311
|
+
return this.theme === 'light';
|
|
312
|
+
}
|
|
313
|
+
handleInputChange(event) {
|
|
314
|
+
const input = event.target;
|
|
315
|
+
this.searchInputChange.emit(input.value);
|
|
316
|
+
}
|
|
317
|
+
handleClearInput() {
|
|
318
|
+
if (this.clearInput) {
|
|
319
|
+
this.clearInput.emit();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
render() {
|
|
323
|
+
const containerClassName = this.rightToLeftOrientation
|
|
324
|
+
? 'inputContainerRTL'
|
|
325
|
+
: 'inputContainerLTR';
|
|
326
|
+
const inputClassName = index$1.classNames(this.error
|
|
327
|
+
? this.isLightTheme
|
|
328
|
+
? 'inputErrorLightRTL'
|
|
329
|
+
: 'inputErrorDarkRTL'
|
|
330
|
+
: this.isLightTheme
|
|
331
|
+
? 'inputLightLTR'
|
|
332
|
+
: 'inputDarkLTR', 'searchcraft-input');
|
|
333
|
+
const validatedCustomStyles = utils.parseCustomStyles(this.customStyles);
|
|
334
|
+
const placeholderStyle = {
|
|
335
|
+
fontSize: validatedCustomStyles.placeholderFontSize || '16px',
|
|
336
|
+
};
|
|
337
|
+
return (index.h("div", { key: '41f29f98e95d5811e81dd885cd282cd8f50cb776', class: index$1.classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (index.h(index.Fragment, null, index.h("input", { class: index$1.classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), index.h("style", null, `
|
|
338
|
+
#searchcraft-input-id::placeholder {
|
|
339
|
+
font-size: ${placeholderStyle.fontSize};
|
|
340
|
+
}
|
|
341
|
+
`), this.inputCaptionValue && (index.h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (index.h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation })), index.h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }))) : (index.h("div", { class: 'inputWrapper' }, index.h("searchcraft-input-icon", { error: this.error, height: this.inputIconHeight, rightToLeftOrientation: this.rightToLeftOrientation, width: this.inputIconWidth }), index.h("input", { class: index$1.classNames(inputClassName, 'searchcraft-input'), id: 'searchcraft-input-id', onChange: this.handleInputChange.bind(this), placeholder: this.placeholderValue, type: 'text', value: this.query, style: validatedCustomStyles }), index.h("style", null, `
|
|
342
|
+
#searchcraft-input-id::placeholder {
|
|
343
|
+
font-size: ${placeholderStyle.fontSize};
|
|
344
|
+
}
|
|
345
|
+
`), this.inputCaptionValue && (index.h("searchcraft-input-caption", { inputCaptionClassName: this.inputCaptionClassName, inputCaptionValue: this.inputCaptionValue, rightToLeftOrientation: this.rightToLeftOrientation })), this.query.length > 0 && (index.h("searchcraft-clear-input-button", { isRequesting: this.isRequesting, onClearInput: this.handleClearInput, rightToLeftOrientation: this.rightToLeftOrientation }))))));
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
SearchcraftInput.style = SearchcraftInputStyle0;
|
|
349
|
+
|
|
350
|
+
const searchcraftInputCaptionModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputCaptionLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040}.inputCaptionDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6}.inputCaptionErrorLightLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000}.inputCaptionErrorDarkLTR{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3}.inputCaptionLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#404040;text-align:right}.inputCaptionDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#E6E6E6;text-align:right}.inputCaptionErrorLightRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#990000;text-align:right}.inputCaptionErrorDarkRTL{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFB3B3;text-align:right}";
|
|
351
|
+
const SearchcraftInputCaptionStyle0 = searchcraftInputCaptionModuleCss;
|
|
352
|
+
|
|
353
|
+
const SearchcraftInputCaption = class {
|
|
354
|
+
constructor(hostRef) {
|
|
355
|
+
index.registerInstance(this, hostRef);
|
|
356
|
+
this.error = undefined;
|
|
357
|
+
this.inputCaptionClassName = '';
|
|
358
|
+
this.inputCaptionValue = 'Enter Search';
|
|
359
|
+
this.rightToLeftOrientation = false;
|
|
360
|
+
this.theme = 'light';
|
|
361
|
+
}
|
|
362
|
+
isLightTheme() {
|
|
363
|
+
return this.theme === 'light';
|
|
364
|
+
}
|
|
365
|
+
render() {
|
|
366
|
+
return this.rightToLeftOrientation ? (index.h("p", { class: index$1.classNames(this.error
|
|
367
|
+
? this.isLightTheme
|
|
368
|
+
? 'inputCaptionErrorLightRTL'
|
|
369
|
+
: 'inputCaptionErrorDarkRTL'
|
|
370
|
+
: this.isLightTheme
|
|
371
|
+
? 'inputCaptionLightRTL'
|
|
372
|
+
: 'inputCaptionDarkRTL', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue)) : (index.h("p", { class: index$1.classNames(this.error
|
|
373
|
+
? this.isLightTheme
|
|
374
|
+
? 'inputCaptionErrorLightLTR'
|
|
375
|
+
: 'inputCaptionErrorDarkLTR'
|
|
376
|
+
: this.isLightTheme
|
|
377
|
+
? 'inputCaptionLightLTR'
|
|
378
|
+
: 'inputCaptionDarkLTR', this.inputCaptionClassName, '.searchcraft-input-caption') }, this.inputCaptionValue));
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
SearchcraftInputCaption.style = SearchcraftInputCaptionStyle0;
|
|
382
|
+
|
|
383
|
+
const searchcraftInputIconModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.inputIconLTR{left:15px;position:absolute;top:50%;transform:translateY(-50%)}.inputIconRTL{position:absolute;right:15px;top:50%;transform:translateY(-50%)}";
|
|
384
|
+
const SearchcraftInputIconStyle0 = searchcraftInputIconModuleCss;
|
|
385
|
+
|
|
386
|
+
const SearchcraftInputIcon = class {
|
|
387
|
+
constructor(hostRef) {
|
|
388
|
+
index.registerInstance(this, hostRef);
|
|
389
|
+
this.error = undefined;
|
|
390
|
+
this.rightToLeftOrientation = false;
|
|
391
|
+
this.height = 20;
|
|
392
|
+
this.width = 20;
|
|
393
|
+
this.theme = 'light';
|
|
394
|
+
}
|
|
395
|
+
isLightTheme() {
|
|
396
|
+
return this.theme === 'light';
|
|
397
|
+
}
|
|
398
|
+
render() {
|
|
399
|
+
return this.error ? (index.h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'error-dark', width: this.width })))) : (index.h("div", { class: this.rightToLeftOrientation ? 'inputIconRTL' : 'inputIconLTR' }, this.isLightTheme() ? (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-light', width: this.width })) : (index.h("searchcraft-search-icon-set", { height: this.height, type: 'search-dark', width: this.width }))));
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
SearchcraftInputIcon.style = SearchcraftInputIconStyle0;
|
|
403
|
+
|
|
404
|
+
const searchcraftInputLabelModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.labelLight{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#292929}.labelDark{font-family:var(--font-stack);font-size:12px;font-weight:400;line-height:16px;margin-top:4px;color:#FFF}";
|
|
405
|
+
const SearchcraftInputLabelStyle0 = searchcraftInputLabelModuleCss;
|
|
406
|
+
|
|
407
|
+
const SearchcraftInputLabel = class {
|
|
408
|
+
constructor(hostRef) {
|
|
409
|
+
index.registerInstance(this, hostRef);
|
|
410
|
+
this.inputLabelClassName = '';
|
|
411
|
+
this.label = undefined;
|
|
412
|
+
this.theme = 'light';
|
|
413
|
+
}
|
|
414
|
+
isLightTheme() {
|
|
415
|
+
return this.theme === 'light';
|
|
416
|
+
}
|
|
417
|
+
render() {
|
|
418
|
+
// Render nothing if no label prop is provided
|
|
419
|
+
if (!this.label) {
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
const labelStyle = this.isLightTheme() ? 'labelLight' : 'labelDark';
|
|
423
|
+
return (index.h("label", { class: index$1.classNames(labelStyle, this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
SearchcraftInputLabel.style = SearchcraftInputLabelStyle0;
|
|
427
|
+
|
|
428
|
+
const SearchcraftSearchIconSet = class {
|
|
429
|
+
constructor(hostRef) {
|
|
430
|
+
index.registerInstance(this, hostRef);
|
|
431
|
+
this.type = 'search-dark';
|
|
432
|
+
this.width = 20;
|
|
433
|
+
this.height = 20;
|
|
434
|
+
}
|
|
435
|
+
render() {
|
|
436
|
+
const { width, height } = this;
|
|
437
|
+
switch (this.type) {
|
|
438
|
+
case 'search-light':
|
|
439
|
+
return (index.h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, index.h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), index.h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#404040', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
440
|
+
case 'search-dark':
|
|
441
|
+
return (index.h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, index.h("title", { id: 'searchcraft-title' }, "Searchcraft Search Icon Dark"), index.h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#E6E6E6', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
442
|
+
case 'error-light':
|
|
443
|
+
return (index.h("svg", { width: width, height: height, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, index.h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Light"), index.h("path", { d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#737373', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
444
|
+
case 'error-dark':
|
|
445
|
+
return (index.h("svg", { width: width, height: height, viewBox: '0 0 18 18', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, index.h("title", { id: 'searchcraft-title' }, "Searchcraft Error Search Icon Dark"), index.h("path", { d: 'M16.5 16.5L12.875 12.875M14.8333 8.16667C14.8333 11.8486 11.8486 14.8333 8.16667 14.8333C4.48477 14.8333 1.5 11.8486 1.5 8.16667C1.5 4.48477 4.48477 1.5 8.16667 1.5C11.8486 1.5 14.8333 4.48477 14.8333 8.16667Z', stroke: '#BFBFBF', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
446
|
+
default:
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
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)}}";
|
|
453
|
+
const SearchcraftSpinnerDarkStyle0 = searchcraftSpinnerDarkModuleCss;
|
|
454
|
+
|
|
455
|
+
const SearchcraftSpinnerDark = class {
|
|
456
|
+
constructor(hostRef) {
|
|
457
|
+
index.registerInstance(this, hostRef);
|
|
458
|
+
}
|
|
459
|
+
render() {
|
|
460
|
+
return (index.h("div", { key: '76685b09609a42adbff41ee43ecb4b4e161d4598', class: 'spinnerContainer' }, index.h("div", { key: '7e7a01010f21e5b95358b7385d41a45e90a5b3bd', class: 'spinnerDark' })));
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
|
|
464
|
+
|
|
465
|
+
const searchcraftSpinnerLightModuleCss = ".spinnerContainer{background-color:transparent;height:20px;width:20px}.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)}}";
|
|
466
|
+
const SearchcraftSpinnerLightStyle0 = searchcraftSpinnerLightModuleCss;
|
|
467
|
+
|
|
468
|
+
const SearchcraftSpinnerLight = class {
|
|
469
|
+
constructor(hostRef) {
|
|
470
|
+
index.registerInstance(this, hostRef);
|
|
471
|
+
}
|
|
472
|
+
render() {
|
|
473
|
+
return (index.h("div", { key: '7bd4d997ef43d35ee60033a27b6bc46c6d693c33', class: 'spinnerContainer' }, index.h("div", { key: 'f8cc9948aa6a264719ffc54d25a10af27dc0f802', class: 'spinnerLight' })));
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
|
|
477
|
+
|
|
478
|
+
exports.searchcraft_auto_search_form = SearchcraftAutoSearchForm;
|
|
479
|
+
exports.searchcraft_base_search_result = SearchcraftBaseSearchResult;
|
|
480
|
+
exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
|
|
481
|
+
exports.searchcraft_clear_icon_set = SearchcraftClearIconSet;
|
|
482
|
+
exports.searchcraft_clear_input_button = SearchcraftClearInputButton;
|
|
483
|
+
exports.searchcraft_error_message = SearchcraftErrorMessage;
|
|
484
|
+
exports.searchcraft_input = SearchcraftInput;
|
|
485
|
+
exports.searchcraft_input_caption = SearchcraftInputCaption;
|
|
486
|
+
exports.searchcraft_input_icon = SearchcraftInputIcon;
|
|
487
|
+
exports.searchcraft_input_label = SearchcraftInputLabel;
|
|
488
|
+
exports.searchcraft_search_icon_set = SearchcraftSearchIconSet;
|
|
489
|
+
exports.searchcraft_spinner_dark = SearchcraftSpinnerDark;
|
|
490
|
+
exports.searchcraft_spinner_light = SearchcraftSpinnerLight;
|
|
491
|
+
|
|
492
|
+
//# sourceMappingURL=searchcraft-auto-search-form_13.cjs.entry.js.map
|