@searchcraft/javascript-sdk 0.2.7 → 0.2.9
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.cjs.js +5 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{searchcraft-auto-search-form_18.cjs.entry.js → searchcraft-auto-search-form_19.cjs.entry.js} +120 -97
- package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +2 -2
- package/dist/cjs/searchcraft-button.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +1 -1
- package/dist/{esm/store-9e0b0710.js → cjs/store-f3bec622.js} +99 -3
- package/dist/cjs/store-f3bec622.js.map +1 -0
- package/dist/collection/assets/searchcraft-dash-icon.js +9 -0
- package/dist/collection/assets/searchcraft-dash-icon.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +23 -9
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
- 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 +3 -3
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +1 -3
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +1 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +73 -71
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +1 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +24 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +1 -1
- 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/provider/store.js +3 -1
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/utils/utils.js +17 -6
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-0eb562da.js → p-07edaa9b.js} +3 -3
- package/dist/components/{p-0eb562da.js.map → p-07edaa9b.js.map} +1 -1
- package/dist/components/{p-52b81ff4.js → p-4468fba3.js} +3 -3
- package/dist/components/{p-52b81ff4.js.map → p-4468fba3.js.map} +1 -1
- package/dist/components/{p-14f328f4.js → p-498c7ef9.js} +2 -2
- package/dist/components/{p-14f328f4.js.map → p-498c7ef9.js.map} +1 -1
- package/dist/{cjs/utils-2dc6115c.js → components/p-7d1bcd2d.js} +19 -15
- package/dist/components/p-7d1bcd2d.js.map +1 -0
- package/dist/components/{p-9952c9ba.js → p-bc3f9025.js} +2 -2
- package/dist/components/{p-9952c9ba.js.map → p-bc3f9025.js.map} +1 -1
- package/dist/components/{p-bdf84774.js → p-bfb22305.js} +2 -2
- package/dist/components/{p-bdf84774.js.map → p-bfb22305.js.map} +1 -1
- package/dist/components/{p-1b18e9fe.js → p-c31274dd.js} +4 -4
- package/dist/components/{p-1b18e9fe.js.map → p-c31274dd.js.map} +1 -1
- package/dist/components/{p-643cfdcf.js → p-dd2a4022.js} +6 -6
- package/dist/components/{p-643cfdcf.js.map → p-dd2a4022.js.map} +1 -1
- package/dist/components/p-e5471fcf.js +29 -0
- package/dist/components/p-e5471fcf.js.map +1 -0
- package/dist/components/{p-157e5b1a.js → p-ff049f0a.js} +5 -2
- package/dist/components/p-ff049f0a.js.map +1 -0
- package/dist/components/searchcraft-auto-search-form.js +30 -16
- package/dist/components/searchcraft-auto-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-form.js +8 -8
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +5 -7
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-clear-input-button.js +1 -1
- package/dist/components/searchcraft-dash-icon.d.ts +11 -0
- package/dist/components/searchcraft-dash-icon.js +8 -0
- package/dist/components/searchcraft-dash-icon.js.map +1 -0
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-filters-list.js +84 -76
- package/dist/components/searchcraft-filters-list.js.map +1 -1
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-results-info.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-spinner-dark.js +1 -1
- package/dist/components/searchcraft-spinner-light.js +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{searchcraft-auto-search-form_18.entry.js → searchcraft-auto-search-form_19.entry.js} +114 -92
- package/dist/esm/searchcraft-auto-search-form_19.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-form.entry.js +2 -2
- package/dist/esm/searchcraft-button.entry.js +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +1 -1
- package/dist/{cjs/store-c44c58ab.js → esm/store-6af9ea01.js} +88 -6
- package/dist/esm/store-6af9ea01.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/{p-d9efd790.entry.js → p-05416a3e.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/p-1ab836bf.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-1ab836bf.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-66f38e89.entry.js → p-3cb77ee1.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js.map +1 -0
- 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/assets/searchcraft-dash-icon.d.ts +3 -0
- package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +13 -5
- package/dist/types/components.d.ts +13 -0
- package/dist/types/utils/utils.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cjs/searchcraft-auto-search-form_18.cjs.entry.js.map +0 -1
- package/dist/cjs/store-c44c58ab.js.map +0 -1
- package/dist/cjs/utils-2dc6115c.js.map +0 -1
- package/dist/components/p-157e5b1a.js.map +0 -1
- package/dist/components/p-2bda632c.js +0 -77
- package/dist/components/p-2bda632c.js.map +0 -1
- package/dist/esm/searchcraft-auto-search-form_18.entry.js.map +0 -1
- package/dist/esm/store-9e0b0710.js.map +0 -1
- package/dist/esm/utils-a3373179.js +0 -77
- package/dist/esm/utils-a3373179.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2bda632c.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2bda632c.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-67cc5ccb.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-67cc5ccb.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-901fee50.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-901fee50.js.map +0 -1
- /package/dist/searchcraft-javascript-sdk/{p-d9efd790.entry.js.map → p-05416a3e.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-66f38e89.entry.js.map → p-3cb77ee1.entry.js.map} +0 -0
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const store = require('./store-c44c58ab.js');
|
|
5
|
+
const store = require('./store-f3bec622.js');
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
exports.extractDynamicProperties =
|
|
11
|
-
exports.parseCustomStyles =
|
|
12
|
-
exports.parseSearchKeys =
|
|
13
|
-
exports.serializeStyles =
|
|
9
|
+
exports.extractDynamicProperties = store.extractDynamicProperties;
|
|
10
|
+
exports.parseCustomStyles = store.parseCustomStyles;
|
|
11
|
+
exports.parseSearchKeys = store.parseSearchKeys;
|
|
12
|
+
exports.serializeStyles = store.serializeStyles;
|
|
14
13
|
exports.useSearchcraftStore = store.useSearchcraftStore;
|
|
15
14
|
exports.useThemeStore = store.useThemeStore;
|
|
16
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.cjs.js","mappings":"
|
|
1
|
+
{"file":"index.cjs.js","mappings":";;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["searchcraft-auto-search-
|
|
11
|
+
return index.bootstrapLazy([["searchcraft-auto-search-form_19.cjs",[[1,"searchcraft-auto-search-form",{"autoSearchFormClass":[1,"auto-search-form-class"],"clearInput":[16],"config":[16],"customStylesForInput":[1,"custom-styles-for-input"],"inputCaptionValue":[1,"input-caption-value"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"labelForInput":[1,"label-for-input"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"searchContainerClass":[1,"search-container-class"],"error":[32],"isRequesting":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-base-search-results",{"adInterval":[2,"ad-interval"],"customStylesForResults":[1,"custom-styles-for-results"],"documentAttributesForDisplay":[1,"document-attributes-for-display"],"fallbackElement":[16],"formatTime":[4,"format-time"],"placeAdAtEnd":[4,"place-ad-at-end"],"placeAdAtStart":[4,"place-ad-at-start"],"placeResultImageRight":[4,"place-result-image-right"],"hasSearched":[32],"query":[32],"searchResults":[32]}],[1,"searchcraft-filters-list",{"filters":[16],"dynamicFilters":[32],"selectedFilters":[32],"query":[32],"isRequesting":[32],"resultsCount":[32]}],[1,"searchcraft-results-info",{"isRequesting":[32],"resultsCount":[32],"responseTime":[32],"query":[32]}],[1,"searchcraft-slider",{"maxYear":[2,"max-year"],"minYear":[2,"min-year"],"endYear":[32],"hasSearched":[32],"query":[32],"resultsCount":[32],"startYear":[32]}],[1,"searchcraft-toggle-button",{"type":[1],"isActive":[32],"query":[32],"resultsCount":[32]}],[1,"searchcraft-base-search-result",{"buttonText":[1,"button-text"],"customStyles":[1,"custom-styles"],"headingText":[1,"heading-text"],"imageDescription":[1,"image-description"],"imageSource":[1,"image-source"],"isInteractive":[4,"is-interactive"],"primaryContent":[1,"primary-content"],"secondaryContent":[1,"secondary-content"],"subheadingText":[1,"subheading-text"],"tertiaryContent":[1,"tertiary-content"],"themeMode":[1,"theme-mode"],"placeImageRight":[4,"place-image-right"]}],[1,"searchcraft-check-icon"],[1,"searchcraft-dash-icon"],[1,"searchcraft-input",{"customStyles":[1,"custom-styles"],"error":[4],"formClassName":[1,"form-class-name"],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"inputClassName":[1,"input-class-name"],"inputIconHeight":[2,"input-icon-height"],"inputIconWidth":[2,"input-icon-width"],"isRequesting":[4,"is-requesting"],"placeholderValue":[1,"placeholder-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"query":[1],"theme":[32]}],[1,"searchcraft-input-label",{"inputLabelClassName":[1,"input-label-class-name"],"label":[1],"theme":[32]}],[1,"searchcraft-clear-input-button",{"isRequesting":[4,"is-requesting"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-input-icon",{"error":[4],"height":[2],"rightToLeftOrientation":[4,"right-to-left-orientation"],"width":[2],"theme":[32]}],[1,"searchcraft-error-message",{"errorMessage":[1,"error-message"],"theme":[1]}],[1,"searchcraft-input-caption",{"error":[4],"inputCaptionClassName":[1,"input-caption-class-name"],"inputCaptionValue":[1,"input-caption-value"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"theme":[32]}],[1,"searchcraft-clear-icon-set",{"type":[1]}],[1,"searchcraft-search-icon-set",{"type":[1],"width":[2],"height":[2]}],[1,"searchcraft-spinner-light"],[1,"searchcraft-spinner-dark"]]],["searchcraft-base-search-form.cjs",[[1,"searchcraft-base-search-form",{"config":[16],"errorMessage":[1,"error-message"],"labelForInput":[1,"label-for-input"],"rightToLeftOrientation":[4,"right-to-left-orientation"],"error":[32],"query":[32],"searchResults":[32]}]]],["searchcraft-button-icon.cjs",[[1,"searchcraft-button-icon"]]],["searchcraft-button.cjs",[[1,"searchcraft-button",{"iconElement":[16],"iconOnly":[4,"icon-only"],"iconPosition":[1,"icon-position"],"label":[1],"isRequesting":[32],"theme":[32]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-6c5282a0.js');
|
|
6
|
-
const store = require('./store-
|
|
7
|
-
const utils = require('./utils-2dc6115c.js');
|
|
6
|
+
const store = require('./store-f3bec622.js');
|
|
8
7
|
const index$1 = require('./index-5b0b9d4c.js');
|
|
9
8
|
|
|
10
9
|
const searchcraftAutoSearchFormModuleCss = ":root{--font-stack:Helvetica, Arial, sans-serif}.formLTR{font-family:var(--font-stack);text-align:left;width:100%}.formRTL{font-family:var(--font-stack);text-align:right;width:100%}";
|
|
@@ -21,23 +20,40 @@ const SearchcraftAutoSearchForm = class {
|
|
|
21
20
|
this.handleInputChange = (event) => {
|
|
22
21
|
this.query = event.detail;
|
|
23
22
|
this.searchStore.setQuery(this.query);
|
|
24
|
-
this.
|
|
23
|
+
if (this.query.trim() === '') {
|
|
24
|
+
this.searchResults = null;
|
|
25
|
+
this.searchStore.setSearchResults(null);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.querySubmit.emit(this.query);
|
|
29
|
+
}
|
|
25
30
|
};
|
|
26
31
|
this.handleInputKeyUp = (event) => {
|
|
27
32
|
const target = event.detail;
|
|
33
|
+
if (target === this.query) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
28
36
|
this.query = target;
|
|
29
|
-
this.searchStore.setQuery(this.query);
|
|
30
|
-
this.querySubmit.emit(this.query);
|
|
31
37
|
if (this.debounceTimeout) {
|
|
32
38
|
clearTimeout(this.debounceTimeout);
|
|
33
39
|
}
|
|
34
40
|
this.debounceTimeout = setTimeout(() => {
|
|
35
|
-
this.query.trim()
|
|
41
|
+
if (this.query.trim() === '') {
|
|
42
|
+
this.searchResults = null;
|
|
43
|
+
this.searchStore.setSearchResults(null);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
this.searchStore.setQuery(this.query);
|
|
47
|
+
this.querySubmit.emit(this.query);
|
|
48
|
+
this.runSearch();
|
|
49
|
+
}
|
|
36
50
|
}, this.debounceDelay);
|
|
37
51
|
};
|
|
38
52
|
this.handleClearInput = () => {
|
|
39
53
|
this.query = '';
|
|
54
|
+
this.searchResults = null;
|
|
40
55
|
this.searchStore.setQuery('');
|
|
56
|
+
this.searchStore.setSearchResults(null);
|
|
41
57
|
if (typeof this.clearInput === 'function') {
|
|
42
58
|
this.clearInput();
|
|
43
59
|
}
|
|
@@ -55,6 +71,7 @@ const SearchcraftAutoSearchForm = class {
|
|
|
55
71
|
else {
|
|
56
72
|
this.error = false;
|
|
57
73
|
this.searchStore.setQuery(this.query);
|
|
74
|
+
this.searchStore.setSelectedFilters([]);
|
|
58
75
|
try {
|
|
59
76
|
await this.searchStore.search();
|
|
60
77
|
}
|
|
@@ -102,13 +119,9 @@ const SearchcraftAutoSearchForm = class {
|
|
|
102
119
|
}
|
|
103
120
|
}
|
|
104
121
|
render() {
|
|
105
|
-
var _a, _b, _c;
|
|
106
122
|
const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
|
|
107
|
-
const parsedCustomStyles =
|
|
108
|
-
|
|
109
|
-
this.inputClearedOrNoResults.emit();
|
|
110
|
-
}
|
|
111
|
-
return (index.h("form", { key: 'cfc0e29f0f35598c13f5d87720f38d74cba292fb', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: 'fd5635505ee5f863f128912377960752d4dccd2d', label: this.labelForInput }), index.h("searchcraft-input", { key: '84c3a6da7ed48e835aa74f87ad862672d38876c7', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (index.h("searchcraft-error-message", { key: 'bcb99f333d73ed811c7d7a6d85736ba94fb7fa56', errorMessage: 'Please enter a search query.' }))));
|
|
123
|
+
const parsedCustomStyles = store.parseCustomStyles(this.customStylesForInput);
|
|
124
|
+
return (index.h("form", { key: '2421495aa88b52a47658af9b682e172da7d23691', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: '032e7e3a7f83af11422b64b023a38c2f433d3809', label: this.labelForInput }), index.h("searchcraft-input", { key: 'a3a286e6b5ade795a157a1a046278477731684b4', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "input-icon-height": this.inputIconHeight, "input-icon-width": this.inputIconWidth, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputKeyUp: this.handleInputKeyUp, onSearchInputChange: this.handleInputChange, "placeholder-value": this.placeholderValue, query: this.query, "right-to-left-orientation": this.rightToLeftOrientation }), this.error && (index.h("searchcraft-error-message", { key: '4588522cf331cc8165e789bb3d58f35ef5148f11', errorMessage: 'Please enter a search query.' }))));
|
|
112
125
|
}
|
|
113
126
|
};
|
|
114
127
|
SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
|
|
@@ -158,9 +171,9 @@ const SearchcraftBaseSearchResult = class {
|
|
|
158
171
|
render() {
|
|
159
172
|
const isLightTheme = this.themeMode === 'light';
|
|
160
173
|
const styles = this.parseStyles();
|
|
161
|
-
const imageContainer = this.imageSource && (index.h("div", { key: '
|
|
162
|
-
const contentContainer = (index.h("div", { key: '
|
|
163
|
-
return (index.h("div", { key: '
|
|
174
|
+
const imageContainer = this.imageSource && (index.h("div", { key: '5446a636265cf330a7e67f7539dad7e25077ecda', class: 'imageContainer' }, index.h("img", { key: '59529cce35008eb171f4ee634ed94ff96e716dad', alt: this.imageDescription, class: isLightTheme ? 'imageLight' : 'imageDark', src: this.imageSource, style: styles.image || {} })));
|
|
175
|
+
const contentContainer = (index.h("div", { key: 'fd052ef1e3dedcf5b1467b6b0760d0be349c1faf', class: 'contentContainer' }, index.h("h2", { key: '1d1eca475651641b34d477ea7e2ea2f3eb7a2c49', class: isLightTheme ? 'headingLight' : 'headingDark', style: styles.heading || {} }, this.headingText), index.h("h3", { key: '9fcf054f634d088b72b67a2675b67a89f651285b', class: isLightTheme ? 'subheadingLight' : 'subheadingDark', style: styles.subheading || {} }, this.subheadingText), index.h("p", { key: '477078081008771a462abb042232b84f1e72ddd5', class: isLightTheme ? 'primaryContentLight' : 'primaryContentDark', style: styles.primaryContent || {} }, this.primaryContent), index.h("div", { key: '716ea0fe1efbd18f0b6313baac80834fbab53001', class: 'secondaryContentContainer' }, index.h("p", { key: '340dad3f568e5cc2b0a1b412b92a335b9afb7a0f', class: isLightTheme ? 'secondaryContentLight' : 'secondaryContentDark', style: styles.secondaryContent || {} }, this.secondaryContent), index.h("p", { key: 'b0c940aab4b48d4e560aabe7551b3c1a0a4ef3ae', class: isLightTheme ? 'tertiaryContentLight' : 'tertiaryContentDark', style: styles.tertiaryContent || {} }, this.tertiaryContent)), this.buttonText && (index.h("button", { key: 'd9a08ff62c8bc7d2b13bb42872e2391290de0712', onClick: this.handleButtonClick, style: styles.button || {}, type: 'button' }, this.buttonText))));
|
|
176
|
+
return (index.h("div", { key: '310676a0e48c3a3d76559b3e3012db1681a55499', class: this.isInteractive
|
|
164
177
|
? isLightTheme
|
|
165
178
|
? 'interactiveResultContainerLight'
|
|
166
179
|
: 'interactiveResultContainerDark'
|
|
@@ -218,24 +231,22 @@ const SearchcraftBaseSearchResults = class {
|
|
|
218
231
|
return (index.h("div", { class: 'emptyState' }, index.h("slot", { name: 'empty-search' })));
|
|
219
232
|
}
|
|
220
233
|
if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
221
|
-
|
|
222
|
-
return index.h("div", { class: 'emptyState' }, "No results to display.");
|
|
234
|
+
return;
|
|
223
235
|
}
|
|
224
|
-
const parsedSearchKeys =
|
|
236
|
+
const parsedSearchKeys = store.parseSearchKeys(this.documentAttributesForDisplay);
|
|
225
237
|
const serializedStyles = typeof this.customStylesForResults === 'string'
|
|
226
238
|
? this.customStylesForResults
|
|
227
|
-
:
|
|
239
|
+
: store.serializeStyles(this.customStylesForResults);
|
|
228
240
|
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) => {
|
|
229
241
|
const { doc: result } = document;
|
|
230
|
-
const dynamicProperties =
|
|
242
|
+
const dynamicProperties = store.extractDynamicProperties(result, parsedSearchKeys);
|
|
231
243
|
if (this.formatTime) {
|
|
232
244
|
for (const key of parsedSearchKeys) {
|
|
233
245
|
if (dynamicProperties[key]) {
|
|
234
246
|
const value = dynamicProperties[key];
|
|
235
|
-
// Check if the value is a valid ISO timestamp
|
|
236
247
|
if (typeof value === 'string' &&
|
|
237
248
|
!Number.isNaN(Date.parse(value))) {
|
|
238
|
-
dynamicProperties[key] =
|
|
249
|
+
dynamicProperties[key] = store.getFormattedTimeFromNow(value);
|
|
239
250
|
}
|
|
240
251
|
}
|
|
241
252
|
}
|
|
@@ -320,6 +331,15 @@ const SearchcraftClearInputButton = class {
|
|
|
320
331
|
};
|
|
321
332
|
SearchcraftClearInputButton.style = SearchcraftClearInputButtonStyle0;
|
|
322
333
|
|
|
334
|
+
const SearchcraftDashIcon = class {
|
|
335
|
+
constructor(hostRef) {
|
|
336
|
+
index.registerInstance(this, hostRef);
|
|
337
|
+
}
|
|
338
|
+
render() {
|
|
339
|
+
return (index.h("svg", { key: '4d0c3ab69a973ec8b1d89f52082e4b98ce17e39d', width: '14', height: '3', viewBox: '0 0 14 3', fill: 'none' }, index.h("title", { key: '99a099dcd6a163ba5b8c1f5b80f9ebfde2152778' }, "Checkbox Dash"), index.h("line", { key: '49f030f69ff1d37139f868ffb94b5f24442dce37', x1: '1.5', y1: '1.5', x2: '12.5', y2: '1.5', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round' })));
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
|
|
323
343
|
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}";
|
|
324
344
|
const SearchcraftErrorMessageStyle0 = searchcraftErrorMessageModuleCss;
|
|
325
345
|
|
|
@@ -331,12 +351,12 @@ const SearchcraftErrorMessage = class {
|
|
|
331
351
|
}
|
|
332
352
|
render() {
|
|
333
353
|
const errorMessageStyle = this.theme === 'light' ? 'errorMessageLight' : 'errorMessageDark';
|
|
334
|
-
return (index.h("p", { key: '
|
|
354
|
+
return (index.h("p", { key: '7c26f9a1b2589d57a81f7909c456e712d9b7fe79', class: index$1.classNames(errorMessageStyle) }, this.errorMessage || 'Search term is required.'));
|
|
335
355
|
}
|
|
336
356
|
};
|
|
337
357
|
SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
|
|
338
358
|
|
|
339
|
-
const searchcraftFiltersListModuleCss = ".filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.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;position:relative}.checkboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.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;position:relative}.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;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.childCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:10px;left:7px}";
|
|
359
|
+
const searchcraftFiltersListModuleCss = ".filtersList{width:100%}.checkboxLabel{align-items:center;color:#292929;display:flex;font-family:\"Source Sans Pro\";font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.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;position:relative}.checkboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.checkboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.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;position:relative}.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;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:checked{background-color:#000;position:relative}.childCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:10px;left:7px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:5px;left:9px}.loading{align-items:center;display:flex;justify-content:center;margin:100px}";
|
|
340
360
|
const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
|
|
341
361
|
|
|
342
362
|
const SearchcraftFiltersList = class {
|
|
@@ -344,104 +364,106 @@ const SearchcraftFiltersList = class {
|
|
|
344
364
|
index.registerInstance(this, hostRef);
|
|
345
365
|
this.filtersUpdated = index.createEvent(this, "filtersUpdated", 7);
|
|
346
366
|
this.searchStore = store.useSearchcraftStore.getState();
|
|
347
|
-
this.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
this.selectedFilters.delete(value);
|
|
353
|
-
}
|
|
354
|
-
const deduplicatedFilters = this.deduplicatePaths(Array.from(this.selectedFilters));
|
|
355
|
-
this.filtersUpdated.emit(deduplicatedFilters);
|
|
356
|
-
this.searchStore.setSelectedFilters(deduplicatedFilters);
|
|
357
|
-
this.searchStore.search();
|
|
367
|
+
this.autoSearchFormElement = null;
|
|
368
|
+
this.handleSearchRequest = () => {
|
|
369
|
+
this.selectedFilters = [];
|
|
370
|
+
this.searchStore.setSelectedFilters([]);
|
|
371
|
+
this.emitFiltersUpdate();
|
|
358
372
|
};
|
|
359
373
|
this.filters = [];
|
|
360
374
|
this.dynamicFilters = [];
|
|
361
|
-
this.
|
|
375
|
+
this.selectedFilters = [];
|
|
362
376
|
this.query = '';
|
|
377
|
+
this.isRequesting = false;
|
|
363
378
|
this.resultsCount = 0;
|
|
364
|
-
this.selectedFilters = new Set();
|
|
365
379
|
}
|
|
366
380
|
connectedCallback() {
|
|
367
381
|
var _a;
|
|
368
382
|
const state = this.searchStore;
|
|
369
|
-
|
|
370
|
-
|
|
383
|
+
const facets = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data.facets;
|
|
384
|
+
if (facets) {
|
|
385
|
+
this.populateFiltersFromFacets(facets);
|
|
371
386
|
}
|
|
372
387
|
this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
|
|
373
|
-
var _a, _b, _c, _d;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
this.filtersUpdated.emit([]);
|
|
378
|
-
if (this.searchStore.selectedFilters.length > 0) {
|
|
379
|
-
this.searchStore.setSelectedFilters([]);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
this.query = state.query || '';
|
|
388
|
+
var _a, _b, _c, _d, _e;
|
|
389
|
+
const query = (_a = state.query) === null || _a === void 0 ? void 0 : _a.trim();
|
|
390
|
+
const facets = (_b = state.searchResults) === null || _b === void 0 ? void 0 : _b.data.facets;
|
|
391
|
+
this.query = query || '';
|
|
384
392
|
this.isRequesting = state.isRequesting;
|
|
385
|
-
this.resultsCount = ((
|
|
386
|
-
if (
|
|
387
|
-
this.populateFiltersFromFacets(
|
|
393
|
+
this.resultsCount = ((_e = (_d = (_c = state.searchResults) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.hits) === null || _e === void 0 ? void 0 : _e.length) || 0;
|
|
394
|
+
if (facets && this.selectedFilters.length === 0) {
|
|
395
|
+
this.populateFiltersFromFacets(facets);
|
|
388
396
|
}
|
|
389
397
|
});
|
|
398
|
+
this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
|
|
399
|
+
if (this.autoSearchFormElement) {
|
|
400
|
+
this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
|
|
401
|
+
}
|
|
390
402
|
}
|
|
391
403
|
disconnectedCallback() {
|
|
392
404
|
if (this.unsubscribe) {
|
|
393
405
|
this.unsubscribe();
|
|
394
406
|
}
|
|
407
|
+
if (this.autoSearchFormElement) {
|
|
408
|
+
this.autoSearchFormElement.removeEventListener('querySubmit', this.handleSearchRequest);
|
|
409
|
+
}
|
|
395
410
|
}
|
|
396
411
|
populateFiltersFromFacets(facets) {
|
|
397
412
|
var _a;
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
413
|
+
const flattened = store.flattenFacets(((_a = facets[0]) === null || _a === void 0 ? void 0 : _a.section) || []);
|
|
414
|
+
this.dynamicFilters = flattened.map((filter) => ({
|
|
415
|
+
label: filter.label,
|
|
416
|
+
value: filter.value,
|
|
417
|
+
count: filter.count,
|
|
418
|
+
children: filter.children || [],
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
handleCheckboxChange(value, isChecked, isParent = false) {
|
|
422
|
+
var _a;
|
|
423
|
+
if (isParent) {
|
|
424
|
+
const parentFilter = this.dynamicFilters.find((filter) => filter.value === value);
|
|
425
|
+
const childValues = ((_a = parentFilter === null || parentFilter === void 0 ? void 0 : parentFilter.children) === null || _a === void 0 ? void 0 : _a.map((child) => child.value)) || [];
|
|
426
|
+
if (!isChecked) {
|
|
427
|
+
// Remove children from selectedFilters when parent is unchecked
|
|
428
|
+
this.selectedFilters = this.selectedFilters.filter((filter) => filter !== value && !childValues.includes(filter));
|
|
410
429
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
deduplicatePaths(filters) {
|
|
415
|
-
const pathMap = new Map();
|
|
416
|
-
filters.forEach((path) => {
|
|
417
|
-
const key = path.split('/').pop() || '';
|
|
418
|
-
const existingPath = pathMap.get(key);
|
|
419
|
-
if (!existingPath || path.length < existingPath.length) {
|
|
420
|
-
pathMap.set(key, path);
|
|
430
|
+
else {
|
|
431
|
+
// Add parent filter to selectedFilters
|
|
432
|
+
this.selectedFilters = [...this.selectedFilters, value];
|
|
421
433
|
}
|
|
422
|
-
}
|
|
423
|
-
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
// Update selectedFilters for child filters
|
|
437
|
+
this.selectedFilters = isChecked
|
|
438
|
+
? [...this.selectedFilters, value]
|
|
439
|
+
: this.selectedFilters.filter((filter) => filter !== value);
|
|
440
|
+
}
|
|
441
|
+
this.emitFiltersUpdate();
|
|
442
|
+
}
|
|
443
|
+
emitFiltersUpdate() {
|
|
444
|
+
this.filtersUpdated.emit(this.selectedFilters);
|
|
445
|
+
this.searchStore.setSelectedFilters(this.selectedFilters);
|
|
446
|
+
this.searchStore.search();
|
|
424
447
|
}
|
|
425
|
-
formatLabel(label) {
|
|
426
|
-
return label
|
|
427
|
-
.replace(/-/g, ' ')
|
|
428
|
-
.split(' ')
|
|
429
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
430
|
-
.join(' ');
|
|
448
|
+
formatLabel(label, count) {
|
|
449
|
+
return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
|
|
431
450
|
}
|
|
432
451
|
render() {
|
|
433
452
|
if (!this.query || this.resultsCount === 0) {
|
|
434
453
|
return null;
|
|
435
454
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
455
|
+
return (index.h("div", { class: 'filtersList' }, this.dynamicFilters.map((filter) => {
|
|
456
|
+
const isChildSelected = filter.children
|
|
457
|
+
? filter.children.some((child) => this.selectedFilters.includes(child.value))
|
|
458
|
+
: false;
|
|
459
|
+
return (index.h("div", { key: filter.value, class: 'filterItem' }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { type: 'checkbox', checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true) }), isChildSelected ? (index.h("div", { class: 'dashContainer' }, index.h("searchcraft-dash-icon", null))) : (index.h("div", { class: 'checkContainer' }, index.h("searchcraft-check-icon", null))), this.formatLabel(filter.label, filter.count)), filter.children && filter.children.length > 0 && (index.h("div", { class: 'childrenContainer' }, filter.children.map((child) => (index.h("label", { key: child.value, class: 'childCheckboxLabel', style: {
|
|
460
|
+
marginLeft: '20px',
|
|
461
|
+
display: this.selectedFilters.includes(filter.value)
|
|
462
|
+
? 'flex'
|
|
463
|
+
: 'none',
|
|
464
|
+
} }, index.h("input", { type: 'checkbox', checked: this.selectedFilters.includes(child.value), onChange: (event) => this.handleCheckboxChange(child.value, event.target.checked) }), index.h("div", { class: 'checkContainer' }, index.h("searchcraft-check-icon", null)), this.formatLabel(child.label.includes('/')
|
|
465
|
+
? child.label.split('/').pop() || child.label
|
|
466
|
+
: child.label, child.count))))))));
|
|
445
467
|
})));
|
|
446
468
|
}
|
|
447
469
|
};
|
|
@@ -497,11 +519,11 @@ const SearchcraftInput = class {
|
|
|
497
519
|
: this.isLightTheme
|
|
498
520
|
? 'inputLightLTR'
|
|
499
521
|
: 'inputDarkLTR', 'searchcraft-input');
|
|
500
|
-
const validatedCustomStyles =
|
|
522
|
+
const validatedCustomStyles = store.parseCustomStyles(this.customStyles);
|
|
501
523
|
const placeholderStyle = {
|
|
502
524
|
fontSize: validatedCustomStyles.placeholderFontSize || '16px',
|
|
503
525
|
};
|
|
504
|
-
return (index.h("div", { key: '
|
|
526
|
+
return (index.h("div", { key: '0eea589d7f78b4ae830b1950ab193f9c72797625', class: index$1.classNames(containerClassName, this.formClassName, 'searchcraft-input-form') }, this.rightToLeftOrientation ? (index.h(index.Fragment, null, index.h("input", { autoComplete: 'off', class: index$1.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 }), index.h("style", null, `
|
|
505
527
|
#searchcraft-input-id::placeholder {
|
|
506
528
|
font-size: ${placeholderStyle.fontSize};
|
|
507
529
|
}
|
|
@@ -727,7 +749,7 @@ const SearchcraftSpinnerDark = class {
|
|
|
727
749
|
index.registerInstance(this, hostRef);
|
|
728
750
|
}
|
|
729
751
|
render() {
|
|
730
|
-
return (index.h("div", { key: '
|
|
752
|
+
return (index.h("div", { key: 'be34b9a3ecec05fdc169145a5db5a4f37bbd404b', class: 'spinnerContainer' }, index.h("div", { key: 'b59ffd2fe8dd3ac990003bff3085cb571c08730e', class: 'spinnerDark' })));
|
|
731
753
|
}
|
|
732
754
|
};
|
|
733
755
|
SearchcraftSpinnerDark.style = SearchcraftSpinnerDarkStyle0;
|
|
@@ -740,7 +762,7 @@ const SearchcraftSpinnerLight = class {
|
|
|
740
762
|
index.registerInstance(this, hostRef);
|
|
741
763
|
}
|
|
742
764
|
render() {
|
|
743
|
-
return (index.h("div", { key: '
|
|
765
|
+
return (index.h("div", { key: 'a4f73eee03d4d7253c04c47995315bd121e8ded3', class: 'spinnerContainer' }, index.h("div", { key: '53e3486ef7a2fa6029a6107bae2c0655b1608a12', class: 'spinnerLight' })));
|
|
744
766
|
}
|
|
745
767
|
};
|
|
746
768
|
SearchcraftSpinnerLight.style = SearchcraftSpinnerLightStyle0;
|
|
@@ -805,6 +827,7 @@ exports.searchcraft_base_search_results = SearchcraftBaseSearchResults;
|
|
|
805
827
|
exports.searchcraft_check_icon = SearchcraftCheckIcon;
|
|
806
828
|
exports.searchcraft_clear_icon_set = SearchcraftClearIconSet;
|
|
807
829
|
exports.searchcraft_clear_input_button = SearchcraftClearInputButton;
|
|
830
|
+
exports.searchcraft_dash_icon = SearchcraftDashIcon;
|
|
808
831
|
exports.searchcraft_error_message = SearchcraftErrorMessage;
|
|
809
832
|
exports.searchcraft_filters_list = SearchcraftFiltersList;
|
|
810
833
|
exports.searchcraft_input = SearchcraftInput;
|
|
@@ -818,4 +841,4 @@ exports.searchcraft_spinner_dark = SearchcraftSpinnerDark;
|
|
|
818
841
|
exports.searchcraft_spinner_light = SearchcraftSpinnerLight;
|
|
819
842
|
exports.searchcraft_toggle_button = SearchcraftToggleButton;
|
|
820
843
|
|
|
821
|
-
//# sourceMappingURL=searchcraft-auto-search-
|
|
844
|
+
//# sourceMappingURL=searchcraft-auto-search-form_19.cjs.entry.js.map
|