@searchcraft/javascript-sdk 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js +28 -11
- package/dist/cjs/searchcraft-auto-search-form_19.cjs.entry.js.map +1 -1
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +4 -4
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +1 -3
- 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 +15 -12
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +5 -1
- package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
- package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +24 -16
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +3 -3
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +15 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
- package/dist/components/{p-dd2a4022.js → p-27a6ca57.js} +7 -3
- package/dist/components/p-27a6ca57.js.map +1 -0
- package/dist/components/searchcraft-auto-search-form.js +5 -5
- package/dist/components/searchcraft-auto-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-form.js +1 -1
- package/dist/components/searchcraft-filters-list.js +2 -4
- package/dist/components/searchcraft-filters-list.js.map +1 -1
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-slider.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +15 -0
- package/dist/components/searchcraft-toggle-button.js.map +1 -1
- package/dist/esm/searchcraft-auto-search-form_19.entry.js +28 -11
- package/dist/esm/searchcraft-auto-search-form_19.entry.js.map +1 -1
- package/dist/searchcraft-javascript-sdk/p-72382d90.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-72382d90.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +3 -1
- package/package.json +1 -1
- package/dist/components/p-dd2a4022.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-6c007e2e.entry.js.map +0 -1
|
@@ -24,9 +24,6 @@ const SearchcraftAutoSearchForm = class {
|
|
|
24
24
|
this.searchResults = null;
|
|
25
25
|
this.searchStore.setSearchResults(null);
|
|
26
26
|
}
|
|
27
|
-
else {
|
|
28
|
-
this.querySubmit.emit(this.query);
|
|
29
|
-
}
|
|
30
27
|
};
|
|
31
28
|
this.handleInputKeyUp = (event) => {
|
|
32
29
|
const target = event.detail;
|
|
@@ -50,6 +47,9 @@ const SearchcraftAutoSearchForm = class {
|
|
|
50
47
|
}, this.debounceDelay);
|
|
51
48
|
};
|
|
52
49
|
this.handleClearInput = () => {
|
|
50
|
+
if (this.query === '' && !this.searchResults) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
53
|
this.query = '';
|
|
54
54
|
this.searchResults = null;
|
|
55
55
|
this.searchStore.setQuery('');
|
|
@@ -121,7 +121,7 @@ const SearchcraftAutoSearchForm = class {
|
|
|
121
121
|
render() {
|
|
122
122
|
const formClass = this.rightToLeftOrientation ? 'formRTL' : 'formLTR';
|
|
123
123
|
const parsedCustomStyles = store.parseCustomStyles(this.customStylesForInput);
|
|
124
|
-
return (index.h("form", { key: '
|
|
124
|
+
return (index.h("form", { key: '6f59f4b7d525c62fce6b21712519e3880c6756a2', class: `${formClass}`, onSubmit: this.handleFormSubmit }, index.h("searchcraft-input-label", { key: 'cbaa772a365131dbfcffec9e2a28438f1c978efe', label: this.labelForInput }), index.h("searchcraft-input", { key: '70a4933978df3878720e1189a15481123e12eba5', 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: 'd665a04dcc8999a09afa47f1a20156f12db6600c', errorMessage: 'Please enter a search query.' }))));
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
|
|
@@ -356,7 +356,7 @@ const SearchcraftErrorMessage = class {
|
|
|
356
356
|
};
|
|
357
357
|
SearchcraftErrorMessage.style = SearchcraftErrorMessageStyle0;
|
|
358
358
|
|
|
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:#
|
|
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;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.checkboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.checkboxLabel input[type=checkbox]:checked{background-color:#007DB3;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;border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childCheckboxLabel input[type=checkbox]:focus{outline:2px solid #007DB3}.childCheckboxLabel input[type=checkbox]:checked{background-color:#007DB3;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:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}";
|
|
360
360
|
const SearchcraftFiltersListStyle0 = searchcraftFiltersListModuleCss;
|
|
361
361
|
|
|
362
362
|
const SearchcraftFiltersList = class {
|
|
@@ -428,12 +428,10 @@ const SearchcraftFiltersList = class {
|
|
|
428
428
|
this.selectedFilters = this.selectedFilters.filter((filter) => filter !== value && !childValues.includes(filter));
|
|
429
429
|
}
|
|
430
430
|
else {
|
|
431
|
-
// Add parent filter to selectedFilters
|
|
432
431
|
this.selectedFilters = [...this.selectedFilters, value];
|
|
433
432
|
}
|
|
434
433
|
}
|
|
435
434
|
else {
|
|
436
|
-
// Update selectedFilters for child filters
|
|
437
435
|
this.selectedFilters = isChecked
|
|
438
436
|
? [...this.selectedFilters, value]
|
|
439
437
|
: this.selectedFilters.filter((filter) => filter !== value);
|
|
@@ -456,7 +454,7 @@ const SearchcraftFiltersList = class {
|
|
|
456
454
|
const isChildSelected = filter.children
|
|
457
455
|
? filter.children.some((child) => this.selectedFilters.includes(child.value))
|
|
458
456
|
: false;
|
|
459
|
-
return (index.h("div", { key: filter.value, class: 'filterItem' }, index.h("label", { class: 'checkboxLabel' }, index.h("input", {
|
|
457
|
+
return (index.h("div", { key: filter.value, class: 'filterItem' }, index.h("label", { class: 'checkboxLabel' }, index.h("input", { checked: this.selectedFilters.includes(filter.value), onChange: (event) => this.handleCheckboxChange(filter.value, event.target.checked, true), type: 'checkbox' }), 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
458
|
marginLeft: '20px',
|
|
461
459
|
display: this.selectedFilters.includes(filter.value)
|
|
462
460
|
? 'flex'
|
|
@@ -469,7 +467,7 @@ const SearchcraftFiltersList = class {
|
|
|
469
467
|
};
|
|
470
468
|
SearchcraftFiltersList.style = SearchcraftFiltersListStyle0;
|
|
471
469
|
|
|
472
|
-
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
|
|
470
|
+
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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightLTR::placeholder{color:#737373}.inputLightLTR:focus{outline:2px solid #000}.inputDarkLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkLTR::placeholder{color:#BFBFBF}.inputDarkLTR:focus{outline:2px solid #FFF}.inputErrorLightLTR{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputLightRTL::placeholder{color:#737373}.inputLightRTL:focus{outline:2px solid #000}.inputDarkRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.inputDarkRTL::placeholder{color:#BFBFBF}.inputDarkRTL:focus{outline:2px solid #FFF}.inputErrorLightRTL{border:none;border-radius:8px;font-family:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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:\"Brygada 1918\";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:\"Brygada 1918\";font-size:16px;font-weight:600}.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%}";
|
|
473
471
|
const SearchcraftInputStyle0 = searchcraftInputModuleCss;
|
|
474
472
|
|
|
475
473
|
const SearchcraftInput = class {
|
|
@@ -504,6 +502,10 @@ const SearchcraftInput = class {
|
|
|
504
502
|
this.inputKeyUp.emit(input.value);
|
|
505
503
|
}
|
|
506
504
|
handleClearInput() {
|
|
505
|
+
if (this.query === '') {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
this.query = '';
|
|
507
509
|
if (this.clearInput) {
|
|
508
510
|
this.clearInput.emit();
|
|
509
511
|
}
|
|
@@ -523,7 +525,7 @@ const SearchcraftInput = class {
|
|
|
523
525
|
const placeholderStyle = {
|
|
524
526
|
fontSize: validatedCustomStyles.placeholderFontSize || '16px',
|
|
525
527
|
};
|
|
526
|
-
return (index.h("div", { key: '
|
|
528
|
+
return (index.h("div", { key: '7047cbe1692a4c8f11232d7f65e00824703d8b50', 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, `
|
|
527
529
|
#searchcraft-input-id::placeholder {
|
|
528
530
|
font-size: ${placeholderStyle.fontSize};
|
|
529
531
|
}
|
|
@@ -671,7 +673,7 @@ const SearchcraftSearchIconSet = class {
|
|
|
671
673
|
}
|
|
672
674
|
};
|
|
673
675
|
|
|
674
|
-
const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{position:absolute;top:50%;transform:translateY(-50%);
|
|
676
|
+
const searchcraftSliderModuleCss = ".sliderContainer{display:flex;flex-direction:column;gap:10px;font-family:Arial, sans-serif;align-items:center;width:100%}.rangeContainer{display:flex;position:relative;width:100%;align-items:center}.rangeContainer .activeRange{background:#007DB3;border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.rangeContainer .rangeSlider{width:100%;height:4px;background:transparent;border-radius:2px;outline:none;-webkit-appearance:none;appearance:none;position:absolute;margin:0}.rangeContainer .rangeSlider::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.rangeContainer .rangeSlider::-moz-range-thumb{width:20px;height:20px;background-color:#FFF;border-radius:50%;border:2px solid #e6e6e6;cursor:pointer}.yearLabels{display:flex;justify-content:space-between;width:100%;margin-top:10px;font-size:15px;font-weight:600;font-family:\"Source Sans Pro\", sans-serif;color:#666}.yearLabel{min-width:30px;text-align:center}";
|
|
675
677
|
const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
|
|
676
678
|
|
|
677
679
|
const SearchcraftSlider = class {
|
|
@@ -773,7 +775,15 @@ const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
|
|
|
773
775
|
const SearchcraftToggleButton = class {
|
|
774
776
|
constructor(hostRef) {
|
|
775
777
|
index.registerInstance(this, hostRef);
|
|
778
|
+
this.autoSearchFormElement = null;
|
|
776
779
|
this.searchStore = store.useSearchcraftStore.getState();
|
|
780
|
+
this.handleSearchRequest = () => {
|
|
781
|
+
this.isActive = false;
|
|
782
|
+
this.searchStore.setSearchParams({
|
|
783
|
+
mode: 'fuzzy',
|
|
784
|
+
sort: 'asc',
|
|
785
|
+
});
|
|
786
|
+
};
|
|
777
787
|
this.handleToggle = async () => {
|
|
778
788
|
this.isActive = !this.isActive;
|
|
779
789
|
if (this.type === 'mode') {
|
|
@@ -806,11 +816,18 @@ const SearchcraftToggleButton = class {
|
|
|
806
816
|
this.query = state.query || '';
|
|
807
817
|
this.resultsCount = ((_c = (_b = (_a = state.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
808
818
|
});
|
|
819
|
+
this.autoSearchFormElement = document.querySelector('searchcraft-auto-search-form');
|
|
820
|
+
if (this.autoSearchFormElement) {
|
|
821
|
+
this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
|
|
822
|
+
}
|
|
809
823
|
}
|
|
810
824
|
disconnectedCallback() {
|
|
811
825
|
if (this.unsubscribe) {
|
|
812
826
|
this.unsubscribe();
|
|
813
827
|
}
|
|
828
|
+
if (this.autoSearchFormElement) {
|
|
829
|
+
this.autoSearchFormElement.addEventListener('querySubmit', this.handleSearchRequest);
|
|
830
|
+
}
|
|
814
831
|
}
|
|
815
832
|
render() {
|
|
816
833
|
if (!this.query || this.resultsCount === 0) {
|