@searchcraft/javascript-sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -55
- package/dist/cjs/{index-b3b77ea2.js → index-a81df4f0.js} +258 -239
- package/dist/cjs/index-a81df4f0.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +91 -48
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -37
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -27
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -117
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -13
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +128 -82
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +3 -3
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -1
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -7
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js +81 -68
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -12
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +9 -13
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-theme.cjs.entry.js +38 -0
- package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -0
- package/dist/cjs/{store-d7ebcf7a.js → store-f6ba3dfb.js} +633 -107
- package/dist/cjs/store-f6ba3dfb.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +134 -66
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +100 -49
- 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 +35 -23
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +8 -15
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +61 -59
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +11 -19
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +126 -76
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +14 -18
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -11
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +93 -77
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +47 -25
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +23 -25
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +7 -19
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +65 -55
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +27 -0
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +27 -26
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/provider/store.js +25 -9
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/utils/facets.js +5 -3
- package/dist/collection/utils/facets.js.map +1 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-0ef4ab33.js +66 -0
- package/dist/components/p-0ef4ab33.js.map +1 -0
- package/dist/components/p-1234974c.js +72 -0
- package/dist/components/p-1234974c.js.map +1 -0
- package/dist/components/p-4b92ae26.js +109 -0
- package/dist/components/p-4b92ae26.js.map +1 -0
- package/dist/components/{p-85765b81.js → p-506cdac1.js} +18 -16
- package/dist/components/p-506cdac1.js.map +1 -0
- package/dist/components/p-521fe971.js +60 -0
- package/dist/components/p-521fe971.js.map +1 -0
- package/dist/components/{p-e4846fa2.js → p-5365011f.js} +215 -231
- package/dist/components/p-5365011f.js.map +1 -0
- package/dist/components/p-54998882.js +285 -0
- package/dist/components/p-54998882.js.map +1 -0
- package/dist/components/{p-d6a88eed.js → p-936e2ed4.js} +633 -107
- package/dist/components/p-936e2ed4.js.map +1 -0
- package/dist/components/p-a75ef832.js +34 -0
- package/dist/components/p-a75ef832.js.map +1 -0
- package/dist/components/p-b4a8fcbe.js +144 -0
- package/dist/components/p-b4a8fcbe.js.map +1 -0
- package/dist/components/p-ca881e5c.js +37 -0
- package/dist/components/p-ca881e5c.js.map +1 -0
- package/dist/components/p-d95bc2a0.js +284 -0
- package/dist/components/p-d95bc2a0.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +76 -39
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +14 -16
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-popover-button.js +3 -7
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +87 -74
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +9 -13
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.d.ts +11 -0
- package/dist/components/searchcraft-theme.js +51 -0
- package/dist/components/searchcraft-theme.js.map +1 -0
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/esm/{index-11551663.js → index-3608c57d.js} +258 -239
- package/dist/esm/index-3608c57d.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/searchcraft-base-search-result.entry.js +91 -48
- package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +74 -37
- package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
- package/dist/esm/searchcraft-button_3.entry.js +37 -27
- package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +141 -117
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +11 -13
- package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +128 -82
- package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +4 -4
- package/dist/esm/searchcraft-javascript-sdk.js.map +1 -1
- package/dist/esm/searchcraft-popover-button.entry.js +3 -7
- package/dist/esm/searchcraft-popover-button.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-form.entry.js +81 -68
- package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-list-item.entry.js +29 -12
- package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
- package/dist/esm/searchcraft-results-info.entry.js +9 -13
- package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
- package/dist/esm/searchcraft-theme.entry.js +34 -0
- package/dist/esm/searchcraft-theme.entry.js.map +1 -0
- package/dist/esm/{store-1058f7b0.js → store-aa071d9c.js} +633 -107
- package/dist/esm/store-aa071d9c.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-faaa4394.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/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +2 -1
- package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +1 -0
- package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +1 -0
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +2 -1
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -0
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -10
- package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +2 -1
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -1
- package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +1 -0
- package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +2 -1
- package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +5 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
- package/dist/types/components.d.ts +17 -4
- package/dist/types/index.d.ts +2 -1
- package/dist/types/provider/store.d.ts +1 -0
- package/dist/types/types/_shared.types.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/raw.d.ts +4 -0
- package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -0
- package/dist/types/types/searchcraft-filter-panel.types.d.ts +1 -0
- package/dist/types/types/searchcraft-popover-form.types.d.ts +1 -0
- package/dist/types/utils/facets.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/styles.d.ts +1 -0
- package/dist/types/utils/units.d.ts +1 -0
- package/package.json +6 -4
- package/dist/cjs/index-b3b77ea2.js.map +0 -1
- package/dist/cjs/store-d7ebcf7a.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -227
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -179
- package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -174
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -158
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +0 -266
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +0 -168
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +0 -293
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -159
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.module.css +0 -0
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +0 -322
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +0 -209
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.css +0 -0
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -169
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -231
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -207
- package/dist/components/p-02a16e53.js +0 -240
- package/dist/components/p-02a16e53.js.map +0 -1
- package/dist/components/p-04c46179.js +0 -101
- package/dist/components/p-04c46179.js.map +0 -1
- package/dist/components/p-0e38a723.js +0 -99
- package/dist/components/p-0e38a723.js.map +0 -1
- package/dist/components/p-4c45ef80.js +0 -67
- package/dist/components/p-4c45ef80.js.map +0 -1
- package/dist/components/p-85765b81.js.map +0 -1
- package/dist/components/p-953f4238.js +0 -35
- package/dist/components/p-953f4238.js.map +0 -1
- package/dist/components/p-a248ad69.js +0 -276
- package/dist/components/p-a248ad69.js.map +0 -1
- package/dist/components/p-a9bd1872.js +0 -38
- package/dist/components/p-a9bd1872.js.map +0 -1
- package/dist/components/p-cf4ced92.js +0 -49
- package/dist/components/p-cf4ced92.js.map +0 -1
- package/dist/components/p-d6a88eed.js.map +0 -1
- package/dist/components/p-e4846fa2.js.map +0 -1
- package/dist/components/p-f9d778b3.js +0 -48
- package/dist/components/p-f9d778b3.js.map +0 -1
- package/dist/esm/index-11551663.js.map +0 -1
- package/dist/esm/store-1058f7b0.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e0be53df.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-e0be53df.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +0 -1
package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js
CHANGED
|
@@ -11,36 +11,30 @@ import { getDocumentValueFromSearchResultMapping } from "../../utils/index";
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export class SearchcraftPopoverListView {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The mappings that define how the data in the documents are mapped to the
|
|
16
|
+
* list-view-item elements.
|
|
17
|
+
*/
|
|
18
|
+
popoverResultMappings;
|
|
19
|
+
/**
|
|
20
|
+
* The documents to render in the list view.
|
|
21
|
+
*/
|
|
22
|
+
documents;
|
|
18
23
|
renderDocument(document, index) {
|
|
19
24
|
/**
|
|
20
25
|
* Index field values -> Result container props mappings.
|
|
21
26
|
*/
|
|
22
|
-
const titleContent = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
23
|
-
const subtitleContent = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
24
|
-
const href = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
25
|
-
const imageSource = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
26
|
-
const imageAlt = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
27
|
+
const titleContent = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.title);
|
|
28
|
+
const subtitleContent = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.subtitle);
|
|
29
|
+
const href = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.href);
|
|
30
|
+
const imageSource = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.imageSource);
|
|
31
|
+
const imageAlt = getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.imageAlt);
|
|
27
32
|
return (h("searchcraft-popover-list-item", { key: `${document.document_id}-${index}`, "title-content": titleContent, "subtitle-content": subtitleContent, "image-src": imageSource, "image-alt": imageAlt, href: href, "document-position": index }));
|
|
28
33
|
}
|
|
29
34
|
render() {
|
|
30
|
-
|
|
31
|
-
return (h("div", { key: '6e9017370d7079412d6d31fb439be599d689c9c2', class: 'searchcraft-popover-list-view' }, (_a = this.documents) === null || _a === void 0 ? void 0 : _a.map((document, index) => this.renderDocument(document, index))));
|
|
35
|
+
return (h("div", { key: '2eee5552a2bf24bd0c75a224d4de6da8526df316', class: 'searchcraft-popover-list-view' }, this.documents?.map((document, index) => this.renderDocument(document, index))));
|
|
32
36
|
}
|
|
33
37
|
static get is() { return "searchcraft-popover-list-view"; }
|
|
34
|
-
static get originalStyleUrls() {
|
|
35
|
-
return {
|
|
36
|
-
"$": ["searchcraft-popover-list-view.module.scss"]
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
static get styleUrls() {
|
|
40
|
-
return {
|
|
41
|
-
"$": ["searchcraft-popover-list-view.module.css"]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
38
|
static get properties() {
|
|
45
39
|
return {
|
|
46
40
|
"popoverResultMappings": {
|
|
@@ -48,7 +42,7 @@ export class SearchcraftPopoverListView {
|
|
|
48
42
|
"mutable": false,
|
|
49
43
|
"complexType": {
|
|
50
44
|
"original": "PopoverResultMappings | undefined",
|
|
51
|
-
"resolved": "{ title?: SearchResultMapping; subtitle?: SearchResultMapping; imageSource?: SearchResultMapping; imageAlt?: SearchResultMapping; href?: SearchResultMapping; }",
|
|
45
|
+
"resolved": "undefined | { title?: SearchResultMapping | undefined; subtitle?: SearchResultMapping | undefined; imageSource?: SearchResultMapping | undefined; imageAlt?: SearchResultMapping | undefined; href?: SearchResultMapping | undefined; }",
|
|
52
46
|
"references": {
|
|
53
47
|
"PopoverResultMappings": {
|
|
54
48
|
"location": "import",
|
|
@@ -62,14 +56,16 @@ export class SearchcraftPopoverListView {
|
|
|
62
56
|
"docs": {
|
|
63
57
|
"tags": [],
|
|
64
58
|
"text": "The mappings that define how the data in the documents are mapped to the\nlist-view-item elements."
|
|
65
|
-
}
|
|
59
|
+
},
|
|
60
|
+
"getter": false,
|
|
61
|
+
"setter": false
|
|
66
62
|
},
|
|
67
63
|
"documents": {
|
|
68
64
|
"type": "unknown",
|
|
69
65
|
"mutable": false,
|
|
70
66
|
"complexType": {
|
|
71
67
|
"original": "Record<string, unknown>[] | undefined",
|
|
72
|
-
"resolved": "Record<string, unknown>[]",
|
|
68
|
+
"resolved": "Record<string, unknown>[] | undefined",
|
|
73
69
|
"references": {
|
|
74
70
|
"Record": {
|
|
75
71
|
"location": "global",
|
|
@@ -82,7 +78,9 @@ export class SearchcraftPopoverListView {
|
|
|
82
78
|
"docs": {
|
|
83
79
|
"tags": [],
|
|
84
80
|
"text": "The documents to render in the list view."
|
|
85
|
-
}
|
|
81
|
+
},
|
|
82
|
+
"getter": false,
|
|
83
|
+
"setter": false
|
|
86
84
|
}
|
|
87
85
|
};
|
|
88
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-popover-list-view.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,uCAAuC,EAAE,MAAM,QAAQ,CAAC;AAGjE;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"searchcraft-popover-list-view.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,uCAAuC,EAAE,MAAM,QAAQ,CAAC;AAGjE;;;;;;;;;GASG;AAKH,MAAM,OAAO,0BAA0B;IACrC;;;OAGG;IACK,qBAAqB,CAAoC;IACjE;;OAEG;IACK,SAAS,CAAwC;IAEzD,cAAc,CAAC,QAAiC,EAAE,KAAa;QAC7D;;WAEG;QACH,MAAM,YAAY,GAAG,uCAAuC,CAC1D,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAClC,CAAC;QACF,MAAM,eAAe,GAAG,uCAAuC,CAC7D,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CACrC,CAAC;QACF,MAAM,IAAI,GAAG,uCAAuC,CAClD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,IAAI,CACjC,CAAC;QACF,MAAM,WAAW,GAAG,uCAAuC,CACzD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,WAAW,CACxC,CAAC;QACF,MAAM,QAAQ,GAAG,uCAAuC,CACtD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CACrC,CAAC;QAEF,OAAO,CACL,qCACE,GAAG,EAAE,GAAG,QAAQ,CAAC,WAAW,IAAI,KAAK,EAAE,mBACxB,YAAY,sBACT,eAAe,eACtB,WAAW,eACX,QAAQ,EACnB,IAAI,EAAE,IAAI,uBACS,KAAK,GACxB,CACH,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAC,+BAA+B,IACvC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CACvC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop } from '@stencil/core';\n\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { PopoverResultMappings } from 'types';\n\n/**\n * This web component is designed to display a list of results within a popover interface.\n * It is consumed within the `searchcraft-popover-form` component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-list-view />\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-list-view',\n shadow: false,\n})\nexport class SearchcraftPopoverListView {\n /**\n * The mappings that define how the data in the documents are mapped to the\n * list-view-item elements.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The documents to render in the list view.\n */\n @Prop() documents: Record<string, unknown>[] | undefined;\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.subtitle,\n );\n const href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.href,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageSource,\n );\n const imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageAlt,\n );\n\n return (\n <searchcraft-popover-list-item\n key={`${document.document_id}-${index}`}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n image-src={imageSource}\n image-alt={imageAlt}\n href={href}\n document-position={index}\n />\n );\n }\n\n render() {\n return (\n <div class='searchcraft-popover-list-view'>\n {this.documents?.map((document, index) =>\n this.renderDocument(document, index),\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -12,18 +12,16 @@ import { formatNumberWithCommas } from "../../utils/index";
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export class SearchcraftResultsInfo {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
15
|
+
isRequesting = false;
|
|
16
|
+
resultsCount = 0;
|
|
17
|
+
responseTime = '';
|
|
18
|
+
query = '';
|
|
19
|
+
unsubscribe = () => { };
|
|
21
20
|
connectedCallback() {
|
|
22
21
|
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
23
|
-
var _a, _b, _c, _d;
|
|
24
22
|
this.isRequesting = state.isRequesting;
|
|
25
|
-
this.resultsCount =
|
|
26
|
-
this.responseTime = ((
|
|
23
|
+
this.resultsCount = state.searchResults?.data?.count || 0;
|
|
24
|
+
this.responseTime = ((state.searchResults?.data?.time_taken || 0) * 1000).toFixed(2);
|
|
27
25
|
this.query = state.query || '';
|
|
28
26
|
});
|
|
29
27
|
}
|
|
@@ -40,16 +38,6 @@ export class SearchcraftResultsInfo {
|
|
|
40
38
|
return (h("div", { class: 'searchcraft-results-info-container' }, h("p", { class: 'searchcraft-results-info-content' }, formattedResults, " results found in ", this.responseTime, "ms")));
|
|
41
39
|
}
|
|
42
40
|
static get is() { return "searchcraft-results-info"; }
|
|
43
|
-
static get originalStyleUrls() {
|
|
44
|
-
return {
|
|
45
|
-
"$": ["searchcraft-results-info.module.scss"]
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
static get styleUrls() {
|
|
49
|
-
return {
|
|
50
|
-
"$": ["searchcraft-results-info.module.css"]
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
41
|
static get states() {
|
|
54
42
|
return {
|
|
55
43
|
"isRequesting": {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-results-info.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-results-info/searchcraft-results-info.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAEhD;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"searchcraft-results-info.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-results-info/searchcraft-results-info.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAEhD;;;;;;;;;GASG;AAKH,MAAM,OAAO,sBAAsB;IACxB,YAAY,GAAG,KAAK,CAAC;IACrB,YAAY,GAAG,CAAC,CAAC;IACjB,YAAY,GAAG,EAAE,CAAC;IAClB,KAAK,GAAG,EAAE,CAAC;IAEpB,WAAW,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IAEnC,iBAAiB;QACf,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;YACvC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC;YAC1D,IAAI,CAAC,YAAY,GAAG,CAClB,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,UAAU,IAAI,CAAC,CAAC,GAAG,IAAI,CACpD,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnE,OAAO,CACL,WAAK,KAAK,EAAC,oCAAoC;YAC7C,SAAG,KAAK,EAAC,kCAAkC;gBACxC,gBAAgB;;gBAAoB,IAAI,CAAC,YAAY;qBACpD,CACA,CACP,CAAC;IACJ,CAAC;;;;;;;;CACF","sourcesContent":["import { Component, h, State } from '@stencil/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport { formatNumberWithCommas } from '@utils';\n\n/**\n * This web component is designed to display the number of results returned from a search query.\n * It provides users with real-time feedback on the scale of the results, such as the total number of items found.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-results-info />\n * ```\n */\n@Component({\n tag: 'searchcraft-results-info',\n shadow: false,\n})\nexport class SearchcraftResultsInfo {\n @State() isRequesting = false;\n @State() resultsCount = 0;\n @State() responseTime = '';\n @State() query = '';\n\n unsubscribe: () => void = () => {};\n\n connectedCallback() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n this.isRequesting = state.isRequesting;\n this.resultsCount = state.searchResults?.data?.count || 0;\n this.responseTime = (\n (state.searchResults?.data?.time_taken || 0) * 1000\n ).toFixed(2);\n this.query = state.query || '';\n });\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n render() {\n if (!this.query || this.resultsCount === 0) {\n return null;\n }\n const formattedResults = formatNumberWithCommas(this.resultsCount);\n return (\n <div class='searchcraft-results-info-container'>\n <p class='searchcraft-results-info-content'>\n {formattedResults} results found in {this.responseTime}ms\n </p>\n </div>\n );\n }\n}\n"]}
|
|
@@ -7,51 +7,63 @@ import classNames from "classnames";
|
|
|
7
7
|
* It is consumed by the `searchcraft-filter-panel` component.
|
|
8
8
|
*/
|
|
9
9
|
export class SearchcraftSlider {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const inputElement = event.target;
|
|
32
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
33
|
-
this.lastFocusedHandle = 'max';
|
|
34
|
-
if (value >= this.startValue) {
|
|
35
|
-
this.endValue = value;
|
|
36
|
-
this.emitUpdate();
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.endValue = this.startValue;
|
|
40
|
-
inputElement.value = `${this.startValue}`;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
this.max = 100;
|
|
44
|
-
this.min = 0;
|
|
45
|
-
this.granularity = getMillis('month');
|
|
46
|
-
this.dataType = 'number';
|
|
47
|
-
this.endValue = this.max;
|
|
48
|
-
this.startValue = this.min;
|
|
49
|
-
this.lastFocusedHandle = 'max';
|
|
50
|
-
}
|
|
10
|
+
/**
|
|
11
|
+
* The maximum value allowed.
|
|
12
|
+
*/
|
|
13
|
+
max = 100;
|
|
14
|
+
/**
|
|
15
|
+
* The minimum value allowed.
|
|
16
|
+
*/
|
|
17
|
+
min = 0;
|
|
18
|
+
/**
|
|
19
|
+
* The granularity that the value must adhere to.
|
|
20
|
+
*/
|
|
21
|
+
granularity = getMillis('month');
|
|
22
|
+
/** The type of data allowed. */
|
|
23
|
+
dataType = 'number';
|
|
24
|
+
endValue = this.max;
|
|
25
|
+
startValue = this.min;
|
|
26
|
+
lastFocusedHandle = 'max';
|
|
27
|
+
/**
|
|
28
|
+
* When the range has changed.
|
|
29
|
+
* */
|
|
30
|
+
rangeChanged;
|
|
51
31
|
componentDidLoad() {
|
|
52
32
|
this.startValue = this.min;
|
|
53
33
|
this.endValue = this.max;
|
|
54
34
|
}
|
|
35
|
+
emitUpdate = async () => {
|
|
36
|
+
this.rangeChanged?.emit({
|
|
37
|
+
startValue: this.startValue,
|
|
38
|
+
endValue: this.endValue,
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
handleStartValueChange = (event) => {
|
|
42
|
+
const inputElement = event.target;
|
|
43
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
44
|
+
this.lastFocusedHandle = 'min';
|
|
45
|
+
if (value <= this.endValue) {
|
|
46
|
+
this.startValue = value;
|
|
47
|
+
this.emitUpdate();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.startValue = this.endValue;
|
|
51
|
+
inputElement.value = `${this.endValue}`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
handleEndValueChange = (event) => {
|
|
55
|
+
const inputElement = event.target;
|
|
56
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
57
|
+
this.lastFocusedHandle = 'max';
|
|
58
|
+
if (value >= this.startValue) {
|
|
59
|
+
this.endValue = value;
|
|
60
|
+
this.emitUpdate();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.endValue = this.startValue;
|
|
64
|
+
inputElement.value = `${this.startValue}`;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
55
67
|
render() {
|
|
56
68
|
const rangeMin = this.min;
|
|
57
69
|
const rangeMax = this.max;
|
|
@@ -63,22 +75,12 @@ export class SearchcraftSlider {
|
|
|
63
75
|
const endLabel = this.dataType === 'number'
|
|
64
76
|
? this.endValue
|
|
65
77
|
: new Date(this.endValue).getFullYear();
|
|
66
|
-
return (h("div", { key: '
|
|
78
|
+
return (h("div", { key: 'bf815949fc9e24e7f3ff9e1870affe676592fc68', class: 'searchcraft-slider-container' }, h("div", { key: 'd0913ee4e35f551782ec5649b9782c535e81ff74', class: 'searchcraft-slider-range-container' }, h("div", { key: '5397b3ef9a79c589080560e886ef709b77279748', class: 'searchcraft-slider-active-range', style: {
|
|
67
79
|
left: `${startPercent}%`,
|
|
68
80
|
width: `${endPercent - startPercent}%`,
|
|
69
|
-
} }), h("input", { key: '
|
|
81
|
+
} }), h("input", { key: '714896ec90ea07a1be7b73e7168c6fab9d2c095b', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.max, min: this.min, onInput: this.handleStartValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), h("input", { key: '646042689f17b594dac00ba04c80d5d3a32a3cd0', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.max, min: this.min, onInput: this.handleEndValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), h("div", { key: 'a6bc39619d6bcbb3ccf09e923436122db4559289', class: 'searchcraft-slider-label-container' }, h("span", { key: 'd15f19f86abeacb5c100403e9e4be20f28f604c0', class: 'searchcraft-slider-label' }, startLabel), h("span", { key: '6c0394917a4f54edae8a347cc8b225a64d044ea6', class: 'searchcraft-slider-label' }, endLabel))));
|
|
70
82
|
}
|
|
71
83
|
static get is() { return "searchcraft-slider"; }
|
|
72
|
-
static get originalStyleUrls() {
|
|
73
|
-
return {
|
|
74
|
-
"$": ["searchcraft-slider.module.scss"]
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
static get styleUrls() {
|
|
78
|
-
return {
|
|
79
|
-
"$": ["searchcraft-slider.module.css"]
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
84
|
static get properties() {
|
|
83
85
|
return {
|
|
84
86
|
"max": {
|
|
@@ -95,6 +97,8 @@ export class SearchcraftSlider {
|
|
|
95
97
|
"tags": [],
|
|
96
98
|
"text": "The maximum value allowed."
|
|
97
99
|
},
|
|
100
|
+
"getter": false,
|
|
101
|
+
"setter": false,
|
|
98
102
|
"attribute": "max",
|
|
99
103
|
"reflect": false,
|
|
100
104
|
"defaultValue": "100"
|
|
@@ -113,6 +117,8 @@ export class SearchcraftSlider {
|
|
|
113
117
|
"tags": [],
|
|
114
118
|
"text": "The minimum value allowed."
|
|
115
119
|
},
|
|
120
|
+
"getter": false,
|
|
121
|
+
"setter": false,
|
|
116
122
|
"attribute": "min",
|
|
117
123
|
"reflect": false,
|
|
118
124
|
"defaultValue": "0"
|
|
@@ -131,6 +137,8 @@ export class SearchcraftSlider {
|
|
|
131
137
|
"tags": [],
|
|
132
138
|
"text": "The granularity that the value must adhere to."
|
|
133
139
|
},
|
|
140
|
+
"getter": false,
|
|
141
|
+
"setter": false,
|
|
134
142
|
"attribute": "granularity",
|
|
135
143
|
"reflect": false,
|
|
136
144
|
"defaultValue": "getMillis('month')"
|
|
@@ -149,6 +157,8 @@ export class SearchcraftSlider {
|
|
|
149
157
|
"tags": [],
|
|
150
158
|
"text": "The type of data allowed."
|
|
151
159
|
},
|
|
160
|
+
"getter": false,
|
|
161
|
+
"setter": false,
|
|
152
162
|
"attribute": "data-type",
|
|
153
163
|
"reflect": false,
|
|
154
164
|
"defaultValue": "'number'"
|
|
@@ -174,8 +184,8 @@ export class SearchcraftSlider {
|
|
|
174
184
|
"text": "When the range has changed."
|
|
175
185
|
},
|
|
176
186
|
"complexType": {
|
|
177
|
-
"original": "
|
|
178
|
-
"resolved": "
|
|
187
|
+
"original": "any",
|
|
188
|
+
"resolved": "any",
|
|
179
189
|
"references": {}
|
|
180
190
|
}
|
|
181
191
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-slider.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-slider/searchcraft-slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"searchcraft-slider.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-slider/searchcraft-slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,CAAC,EACD,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;;GAIG;AAKH,MAAM,OAAO,iBAAiB;IAC5B;;OAEG;IACK,GAAG,GAAG,GAAG,CAAC;IAClB;;OAEG;IACK,GAAG,GAAG,CAAC,CAAC;IAChB;;OAEG;IACK,WAAW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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Event,\n type EventEmitter,\n h,\n State,\n Prop,\n} from '@stencil/core';\nimport { getMillis } from '@utils';\nimport classNames from 'classnames';\n\n/**\n * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.\n * The component renders a slider interface, which can be used to visually choose a value between two boundaries.\n * It is consumed by the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-slider',\n shadow: false,\n})\nexport class SearchcraftSlider {\n /**\n * The maximum value allowed.\n */\n @Prop() max = 100;\n /**\n * The minimum value allowed.\n */\n @Prop() min = 0;\n /**\n * The granularity that the value must adhere to.\n */\n @Prop() granularity: number = getMillis('month');\n /** The type of data allowed. */\n @Prop() dataType: 'number' | 'date' = 'number';\n\n @State() endValue = this.max;\n @State() startValue = this.min;\n @State() lastFocusedHandle: 'min' | 'max' = 'max';\n\n /**\n * When the range has changed.\n * */\n @Event() rangeChanged:\n | EventEmitter<{ startValue: number; endValue: number }>\n | undefined;\n\n componentDidLoad() {\n this.startValue = this.min;\n this.endValue = this.max;\n }\n\n private emitUpdate = async () => {\n this.rangeChanged?.emit({\n startValue: this.startValue,\n endValue: this.endValue,\n });\n };\n\n private handleStartValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'min';\n if (value <= this.endValue) {\n this.startValue = value;\n this.emitUpdate();\n } else {\n this.startValue = this.endValue;\n inputElement.value = `${this.endValue}`;\n }\n };\n\n private handleEndValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'max';\n if (value >= this.startValue) {\n this.endValue = value;\n this.emitUpdate();\n } else {\n this.endValue = this.startValue;\n inputElement.value = `${this.startValue}`;\n }\n };\n\n render() {\n const rangeMin = this.min;\n const rangeMax = this.max;\n const startPercent =\n ((this.startValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n const endPercent =\n ((this.endValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n\n const startLabel =\n this.dataType === 'number'\n ? this.startValue\n : new Date(this.startValue).getFullYear();\n\n const endLabel =\n this.dataType === 'number'\n ? this.endValue\n : new Date(this.endValue).getFullYear();\n\n return (\n <div class='searchcraft-slider-container'>\n <div class='searchcraft-slider-range-container'>\n <div\n class='searchcraft-slider-active-range'\n style={{\n left: `${startPercent}%`,\n width: `${endPercent - startPercent}%`,\n }}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-min-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleStartValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }}\n type='range'\n value={this.startValue}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-max-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleEndValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }}\n type='range'\n value={this.endValue}\n />\n </div>\n <div class='searchcraft-slider-label-container'>\n <span class='searchcraft-slider-label'>{startLabel}</span>\n <span class='searchcraft-slider-label'>{endLabel}</span>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styles from "../../themes/hologram.css?raw";
|
|
2
|
+
export class SearchcraftErrorMessage {
|
|
3
|
+
componentDidLoad() {
|
|
4
|
+
console.log('Loading theme...');
|
|
5
|
+
console.log(styles);
|
|
6
|
+
const styleTag = document.querySelector('#searchcraft-theme') ||
|
|
7
|
+
document.createElement('style');
|
|
8
|
+
styleTag.innerHTML = styles;
|
|
9
|
+
styleTag.id = 'searchcraft-theme';
|
|
10
|
+
const head = document.head || document.getElementsByTagName('head')[0];
|
|
11
|
+
if (!head.contains(styleTag)) {
|
|
12
|
+
if (head.firstChild) {
|
|
13
|
+
head.insertBefore(styleTag, head.firstChild);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
head.appendChild(styleTag);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
static get is() { return "searchcraft-theme"; }
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=searchcraft-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchcraft-theme.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-theme/searchcraft-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAMnD,MAAM,OAAO,uBAAuB;IAClC,gBAAgB;QACd,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,MAAM,QAAQ,GACZ,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC;YAC5C,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAClC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC;QAC5B,QAAQ,CAAC,EAAE,GAAG,mBAAmB,CAAC;QAElC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;aAAM,CAAC;QACR,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO;IACT,CAAC;;CACF","sourcesContent":["import { Component } from '@stencil/core';\nimport styles from '../../themes/hologram.css?raw';\n\n@Component({\n tag: 'searchcraft-theme',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n componentDidLoad() {\n console.log('Loading theme...');\n console.log(styles);\n const styleTag =\n document.querySelector('#searchcraft-theme') ||\n document.createElement('style');\n styleTag.innerHTML = styles;\n styleTag.id = 'searchcraft-theme';\n\n const head = document.head || document.getElementsByTagName('head')[0];\n if (!head.contains(styleTag)) {\n if (head.firstChild) {\n head.insertBefore(styleTag, head.firstChild);\n } else {\n head.appendChild(styleTag);\n }\n } else {\n }\n }\n\n render() {\n return;\n }\n}\n"]}
|
|
@@ -6,17 +6,25 @@ import classNames from "classnames";
|
|
|
6
6
|
* It is consumed within the `searchcraft-filter-panel` component.
|
|
7
7
|
*/
|
|
8
8
|
export class SearchcraftToggleButton {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The label.
|
|
11
|
+
*/
|
|
12
|
+
label = 'Toggle';
|
|
13
|
+
/**
|
|
14
|
+
* The secondary label displayed below the main label.
|
|
15
|
+
*/
|
|
16
|
+
subLabel;
|
|
17
|
+
/**
|
|
18
|
+
* When the toggle element is changed.
|
|
19
|
+
*/
|
|
20
|
+
toggleUpdated;
|
|
21
|
+
isActive = false;
|
|
22
|
+
unsubscribe;
|
|
23
|
+
lastQuery;
|
|
24
|
+
handleToggle = async () => {
|
|
25
|
+
this.isActive = !this.isActive;
|
|
26
|
+
this.toggleUpdated?.emit(this.isActive);
|
|
27
|
+
};
|
|
20
28
|
connectedCallback() {
|
|
21
29
|
/** When the query changes, sets toggle button state back to inactive. */
|
|
22
30
|
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
@@ -27,27 +35,16 @@ export class SearchcraftToggleButton {
|
|
|
27
35
|
});
|
|
28
36
|
}
|
|
29
37
|
disconnectedCallback() {
|
|
30
|
-
|
|
31
|
-
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
38
|
+
this.unsubscribe?.();
|
|
32
39
|
}
|
|
33
40
|
render() {
|
|
34
|
-
return (h("div", { key: '
|
|
41
|
+
return (h("div", { key: '8967ffc9328e0e6822f558d04ab31bc7b7f5c871', class: 'searchcraft-toggle-button-container' }, h("div", { key: 'd46d8ad6aff1bb012bea8e4b10cec03a12da8d64' }, h("p", { key: 'f9fd16a0da58bd66697d13df34a93cd70a6148c6', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (h("p", { key: 'ba7a0c309ca4cc0faa891ad9e270ac16f1d1d4cc', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), h("button", { key: '3b406713d41f055bbaf32d231188faba0dfa48fb', class: classNames('searchcraft-toggle-button-background', {
|
|
35
42
|
active: this.isActive,
|
|
36
|
-
}), onClick: this.handleToggle, type: 'button' }, h("div", { key: '
|
|
43
|
+
}), onClick: this.handleToggle, type: 'button' }, h("div", { key: '7dab3166e027e4efad18a3db9b541c1a4ba7da5f', class: classNames('searchcraft-toggle-button-handle', {
|
|
37
44
|
active: this.isActive,
|
|
38
45
|
}) }))));
|
|
39
46
|
}
|
|
40
47
|
static get is() { return "searchcraft-toggle-button"; }
|
|
41
|
-
static get originalStyleUrls() {
|
|
42
|
-
return {
|
|
43
|
-
"$": ["searchcraft-toggle-button.module.scss"]
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
static get styleUrls() {
|
|
47
|
-
return {
|
|
48
|
-
"$": ["searchcraft-toggle-button.module.css"]
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
48
|
static get properties() {
|
|
52
49
|
return {
|
|
53
50
|
"label": {
|
|
@@ -64,6 +61,8 @@ export class SearchcraftToggleButton {
|
|
|
64
61
|
"tags": [],
|
|
65
62
|
"text": "The label."
|
|
66
63
|
},
|
|
64
|
+
"getter": false,
|
|
65
|
+
"setter": false,
|
|
67
66
|
"attribute": "label",
|
|
68
67
|
"reflect": false,
|
|
69
68
|
"defaultValue": "'Toggle'"
|
|
@@ -73,7 +72,7 @@ export class SearchcraftToggleButton {
|
|
|
73
72
|
"mutable": false,
|
|
74
73
|
"complexType": {
|
|
75
74
|
"original": "string | undefined",
|
|
76
|
-
"resolved": "string",
|
|
75
|
+
"resolved": "string | undefined",
|
|
77
76
|
"references": {}
|
|
78
77
|
},
|
|
79
78
|
"required": false,
|
|
@@ -82,6 +81,8 @@ export class SearchcraftToggleButton {
|
|
|
82
81
|
"tags": [],
|
|
83
82
|
"text": "The secondary label displayed below the main label."
|
|
84
83
|
},
|
|
84
|
+
"getter": false,
|
|
85
|
+
"setter": false,
|
|
85
86
|
"attribute": "sub-label",
|
|
86
87
|
"reflect": false
|
|
87
88
|
}
|
package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-toggle-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,SAAS,EACT,KAAK,EACL,CAAC,EACD,IAAI,EACJ,KAAK,GAEN,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;GAGG;
|
|
1
|
+
{"version":3,"file":"searchcraft-toggle-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,i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,CACnE,CACG;YACN,+DACE,KAAK,EAAE,UAAU,CAAC,sCAAsC,EAAE;oBACxD,MAAM,EAAE,IAAI,CAAC,QAAQ;iBACtB,CAAC,EACF,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ;gBAEb,4DACE,KAAK,EAAE,UAAU,CAAC,kCAAkC,EAAE;wBACpD,MAAM,EAAE,IAAI,CAAC,QAAQ;qBACtB,CAAC,GACF,CACK,CACL,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n * It is consumed within the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated?: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated?.emit(this.isActive);\n };\n\n connectedCallback() {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query !== this.lastQuery && state.query.trim().length === 0) {\n this.isActive = false;\n }\n this.lastQuery = state.query;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <div class='searchcraft-toggle-button-container'>\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class={classNames('searchcraft-toggle-button-background', {\n active: this.isActive,\n })}\n onClick={this.handleToggle}\n type='button'\n >\n <div\n class={classNames('searchcraft-toggle-button-handle', {\n active: this.isActive,\n })}\n />\n </button>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItE,cAAc,SAAS,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\nexport type * from './components';\n\nexport {\n parseCustomStyles,\n serializeStyles,\n} from './utils';\n\nexport { useSearchcraftStore, useThemeStore } from './provider/store';\n\nexport { Components } from './components';\n\nexport * from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItE,cAAc,SAAS,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\nexport type * from './components';\n\nexport {\n parseCustomStyles,\n serializeStyles,\n} from './utils';\n\nexport { useSearchcraftStore, useThemeStore } from './provider/store';\n\nexport type { Components } from './components';\n\nexport * from './types';\n"]}
|
|
@@ -35,23 +35,33 @@ const useSearchcraftStore = create((set, get) => {
|
|
|
35
35
|
});
|
|
36
36
|
},
|
|
37
37
|
addFacetPathsForIndexField: (data) => set((state) => ({
|
|
38
|
-
facetPathsForIndexFields:
|
|
38
|
+
facetPathsForIndexFields: {
|
|
39
|
+
...state.facetPathsForIndexFields,
|
|
40
|
+
[data.fieldName]: data,
|
|
41
|
+
},
|
|
39
42
|
})),
|
|
40
43
|
removeFacetPathsForIndexField: (fieldName) => set((state) => {
|
|
41
44
|
const currentPaths = state.facetPathsForIndexFields;
|
|
42
45
|
delete currentPaths[fieldName];
|
|
43
46
|
return {
|
|
44
|
-
facetPathsForIndexFields:
|
|
47
|
+
facetPathsForIndexFields: {
|
|
48
|
+
...currentPaths,
|
|
49
|
+
},
|
|
45
50
|
};
|
|
46
51
|
}),
|
|
47
52
|
addRangeValueForIndexField: (data) => set((state) => ({
|
|
48
|
-
rangeValueForIndexFields:
|
|
53
|
+
rangeValueForIndexFields: {
|
|
54
|
+
...state.rangeValueForIndexFields,
|
|
55
|
+
[data.fieldName]: data,
|
|
56
|
+
},
|
|
49
57
|
})),
|
|
50
58
|
removeRangeValueForIndexField: (fieldName) => set((state) => {
|
|
51
59
|
const currentValues = state.rangeValueForIndexFields;
|
|
52
60
|
delete currentValues[fieldName];
|
|
53
61
|
return {
|
|
54
|
-
rangeValueForIndexFields:
|
|
62
|
+
rangeValueForIndexFields: {
|
|
63
|
+
...currentValues,
|
|
64
|
+
},
|
|
55
65
|
};
|
|
56
66
|
}),
|
|
57
67
|
setSearchMode: (mode) => set({ searchMode: mode }),
|
|
@@ -69,10 +79,14 @@ const useSearchcraftStore = create((set, get) => {
|
|
|
69
79
|
/**
|
|
70
80
|
* When a new query is set, also reset the sort type, search mode, and facet paths.
|
|
71
81
|
*/
|
|
72
|
-
set(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
set({
|
|
83
|
+
query,
|
|
84
|
+
facetPathsForIndexFields: {},
|
|
85
|
+
...(query.trim().length === 0 && {
|
|
86
|
+
searchMode: 'fuzzy',
|
|
87
|
+
sortType: 'asc',
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
76
90
|
},
|
|
77
91
|
setSearchResults: (results) => set({ searchResults: results }),
|
|
78
92
|
setFacets: (facets) => set({ facets }),
|
|
@@ -98,7 +112,9 @@ const useSearchcraftStore = create((set, get) => {
|
|
|
98
112
|
}, (results) => {
|
|
99
113
|
const updatedFacets = results.data.facets || null;
|
|
100
114
|
state.setSearchResults(results);
|
|
101
|
-
|
|
115
|
+
if (updatedFacets) {
|
|
116
|
+
state.setFacets(updatedFacets);
|
|
117
|
+
}
|
|
102
118
|
log(LogLevel.DEBUG, `Search results: ${JSON.stringify(results)}`);
|
|
103
119
|
log(LogLevel.DEBUG, `Updated facets: ${JSON.stringify(updatedFacets)}`);
|
|
104
120
|
state.setIsRequesting(false);
|