@searchcraft/javascript-sdk 0.7.1 → 0.8.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/{store-f6ba3dfb.js → SearchcraftStore-75fac5e0.js} +576 -443
- package/dist/cjs/SearchcraftStore-75fac5e0.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js +152 -0
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +30 -80
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +22 -7
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +19 -18
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +6 -6
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +20 -33
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +1 -1
- package/dist/cjs/searchcraft-pagination.cjs.entry.js +106 -0
- package/dist/cjs/searchcraft-pagination.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -3
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js +27 -25
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js +101 -0
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +51 -13
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js +75 -0
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-select.cjs.entry.js +70 -0
- package/dist/cjs/searchcraft-select.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-theme.cjs.entry.js +29 -11
- package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -1
- package/dist/cjs/units-fe4d8083.js.map +1 -1
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +86 -208
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js +73 -0
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js.map +1 -0
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +37 -144
- 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 +87 -17
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +1 -1
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +8 -8
- 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 +7 -7
- 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 +10 -14
- 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 +1 -1
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js +141 -0
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js.map +1 -0
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -1
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +26 -21
- 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 +59 -92
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js +73 -0
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js.map +1 -0
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +77 -24
- 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 +105 -17
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js +129 -0
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js.map +1 -0
- package/dist/collection/components/searchcraft-select/searchcraft-select.js +261 -0
- package/dist/collection/components/searchcraft-select/searchcraft-select.js.map +1 -0
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +2 -2
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +81 -11
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +7 -6
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
- package/dist/collection/index.js +1 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/provider/SearchcraftStore.js +160 -0
- package/dist/collection/provider/SearchcraftStore.js.map +1 -0
- package/dist/collection/provider/SearchcraftStore.types.js +2 -0
- package/dist/collection/provider/SearchcraftStore.types.js.map +1 -0
- package/dist/collection/provider/store.js +2 -136
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/utils/units.js.map +1 -1
- package/dist/components/index.js +11 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-a75ef832.js → p-0e393fe1.js} +2 -2
- package/dist/components/{p-a75ef832.js.map → p-0e393fe1.js.map} +1 -1
- package/dist/components/p-25ee7496.js +58 -0
- package/dist/components/p-25ee7496.js.map +1 -0
- package/dist/components/{p-936e2ed4.js → p-38419178.js} +576 -442
- package/dist/components/p-38419178.js.map +1 -0
- package/dist/components/{p-d95bc2a0.js → p-3df3ff8b.js} +17 -21
- package/dist/components/p-3df3ff8b.js.map +1 -0
- package/dist/components/{p-1234974c.js → p-433f974c.js} +9 -8
- package/dist/components/p-433f974c.js.map +1 -0
- package/dist/components/{p-4b92ae26.js → p-4e9cd62e.js} +4 -4
- package/dist/components/{p-4b92ae26.js.map → p-4e9cd62e.js.map} +1 -1
- package/dist/components/{p-755f491b.js → p-6104fe5d.js} +2 -2
- package/dist/components/p-6104fe5d.js.map +1 -0
- package/dist/components/{p-b4a8fcbe.js → p-97332d3e.js} +51 -59
- package/dist/components/p-97332d3e.js.map +1 -0
- package/dist/components/p-bf6a086a.js +92 -0
- package/dist/components/p-bf6a086a.js.map +1 -0
- package/dist/components/p-bff4d3fc.js +65 -0
- package/dist/components/p-bff4d3fc.js.map +1 -0
- package/dist/components/{p-521fe971.js → p-d19bf6ff.js} +25 -8
- package/dist/components/p-d19bf6ff.js.map +1 -0
- package/dist/components/p-de4a48b1.js +65 -0
- package/dist/components/p-de4a48b1.js.map +1 -0
- package/dist/components/{p-ca881e5c.js → p-e55a7970.js} +2 -2
- package/dist/components/{p-ca881e5c.js.map → p-e55a7970.js.map} +1 -1
- package/dist/components/p-ec0d230e.js +75 -0
- package/dist/components/p-ec0d230e.js.map +1 -0
- package/dist/components/{p-54998882.js → p-fc7cda96.js} +10 -10
- package/dist/components/p-fc7cda96.js.map +1 -0
- package/dist/components/searchcraft-base-search-result-ad.d.ts +11 -0
- package/dist/components/searchcraft-base-search-result-ad.js +8 -0
- package/dist/components/searchcraft-base-search-result-ad.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +44 -89
- 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 +9 -9
- 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-pagination.d.ts +11 -0
- package/dist/components/searchcraft-pagination.js +135 -0
- package/dist/components/searchcraft-pagination.js.map +1 -0
- package/dist/components/searchcraft-popover-button.js +2 -2
- package/dist/components/searchcraft-popover-form.js +41 -30
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item-ad.d.ts +11 -0
- package/dist/components/searchcraft-popover-list-item-ad.js +8 -0
- package/dist/components/searchcraft-popover-list-item-ad.js.map +1 -0
- 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 +60 -17
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-search-results-per-page.d.ts +11 -0
- package/dist/components/searchcraft-search-results-per-page.js +105 -0
- package/dist/components/searchcraft-search-results-per-page.js.map +1 -0
- package/dist/components/searchcraft-select.d.ts +11 -0
- package/dist/components/searchcraft-select.js +8 -0
- package/dist/components/searchcraft-select.js.map +1 -0
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.js +34 -13
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/esm/{store-aa071d9c.js → SearchcraftStore-3cfd565a.js} +576 -442
- package/dist/esm/SearchcraftStore-3cfd565a.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/searchcraft-base-search-result_2.entry.js +147 -0
- package/dist/esm/searchcraft-base-search-result_2.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-results.entry.js +30 -80
- package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
- package/dist/esm/searchcraft-button_3.entry.js +22 -7
- package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +17 -16
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +5 -5
- package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +19 -32
- package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +1 -1
- package/dist/esm/searchcraft-pagination.entry.js +102 -0
- package/dist/esm/searchcraft-pagination.entry.js.map +1 -0
- package/dist/esm/searchcraft-popover-button.entry.js +2 -2
- package/dist/esm/searchcraft-popover-form.entry.js +20 -18
- package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-list-item_2.entry.js +96 -0
- package/dist/esm/searchcraft-popover-list-item_2.entry.js.map +1 -0
- package/dist/esm/searchcraft-results-info.entry.js +51 -13
- package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
- package/dist/esm/searchcraft-search-results-per-page.entry.js +71 -0
- package/dist/esm/searchcraft-search-results-per-page.entry.js.map +1 -0
- package/dist/esm/searchcraft-select.entry.js +66 -0
- package/dist/esm/searchcraft-select.entry.js.map +1 -0
- package/dist/esm/searchcraft-theme.entry.js +29 -11
- package/dist/esm/searchcraft-theme.entry.js.map +1 -1
- package/dist/esm/{units-b6eba560.js → units-daaf96f5.js} +2 -2
- package/dist/esm/units-daaf96f5.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-38419178.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-38419178.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-755f491b.js → p-6104fe5d.js} +2 -2
- package/dist/searchcraft-javascript-sdk/p-6104fe5d.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-69da4e58.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-69da4e58.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-a3074a6d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-a3074a6d.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-d2fffca9.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-d2fffca9.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.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 +20 -41
- package/dist/types/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.d.ts +14 -0
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +9 -18
- package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +17 -6
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +1 -1
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +2 -2
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +1 -1
- package/dist/types/components/searchcraft-pagination/searchcraft-pagination.d.ts +33 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +9 -7
- package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +9 -12
- package/dist/types/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.d.ts +14 -0
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +7 -4
- package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +26 -4
- package/dist/types/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.d.ts +33 -0
- package/dist/types/components/searchcraft-select/searchcraft-select.d.ts +64 -0
- package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +20 -1
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +1 -1
- package/dist/types/components.d.ts +476 -166
- package/dist/types/index.d.ts +1 -2
- package/dist/types/provider/SearchcraftStore.d.ts +4 -0
- package/dist/types/provider/SearchcraftStore.types.d.ts +44 -0
- package/dist/types/provider/store.d.ts +2 -34
- package/dist/types/utils/units.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +0 -117
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +0 -49
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +0 -1
- package/dist/cjs/store-f6ba3dfb.js.map +0 -1
- package/dist/collection/types/_shared.types.js +0 -2
- package/dist/collection/types/_shared.types.js.map +0 -1
- package/dist/collection/types/index.js +0 -5
- package/dist/collection/types/index.js.map +0 -1
- package/dist/collection/types/searchcraft-base-search-results.types.js +0 -2
- package/dist/collection/types/searchcraft-base-search-results.types.js.map +0 -1
- package/dist/collection/types/searchcraft-filter-panel.types.js +0 -2
- package/dist/collection/types/searchcraft-filter-panel.types.js.map +0 -1
- package/dist/collection/types/searchcraft-popover-form.types.js +0 -2
- package/dist/collection/types/searchcraft-popover-form.types.js.map +0 -1
- package/dist/components/p-0ef4ab33.js +0 -66
- package/dist/components/p-0ef4ab33.js.map +0 -1
- package/dist/components/p-1234974c.js.map +0 -1
- package/dist/components/p-506cdac1.js +0 -58
- package/dist/components/p-506cdac1.js.map +0 -1
- package/dist/components/p-521fe971.js.map +0 -1
- package/dist/components/p-54998882.js.map +0 -1
- package/dist/components/p-755f491b.js.map +0 -1
- package/dist/components/p-936e2ed4.js.map +0 -1
- package/dist/components/p-b4a8fcbe.js.map +0 -1
- package/dist/components/p-d95bc2a0.js.map +0 -1
- package/dist/esm/searchcraft-base-search-result.entry.js +0 -113
- package/dist/esm/searchcraft-base-search-result.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-list-item.entry.js +0 -45
- package/dist/esm/searchcraft-popover-list-item.entry.js.map +0 -1
- package/dist/esm/store-aa071d9c.js.map +0 -1
- package/dist/esm/units-b6eba560.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-755f491b.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +0 -2
- package/dist/types/types/_shared.types.d.ts +0 -46
- package/dist/types/types/index.d.ts +0 -5
- package/dist/types/types/searchcraft-base-search-results.types.d.ts +0 -11
- package/dist/types/types/searchcraft-filter-panel.types.d.ts +0 -43
- package/dist/types/types/searchcraft-popover-form.types.d.ts +0 -9
- /package/dist/searchcraft-javascript-sdk/{p-faaa4394.entry.js.map → p-7f4dd50c.entry.js.map} +0 -0
- /package/dist/types/{types → themes}/raw.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, } from "@stencil/core";
|
|
2
2
|
import { useSearchcraftStore } from "../../provider/store";
|
|
3
|
-
import {
|
|
3
|
+
import { serializeStyles } from "../../utils/index";
|
|
4
4
|
/**
|
|
5
5
|
* This web component is responsible for displaying the results of a search query.
|
|
6
6
|
* Once a query is submitted, the component formats and presents an ordered list of the results.
|
|
@@ -34,10 +34,6 @@ import { getDocumentValueFromSearchResultMapping, serializeStyles, } from "../..
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export class SearchcraftBaseSearchResults {
|
|
37
|
-
/**
|
|
38
|
-
* How often ads are injected.
|
|
39
|
-
*/
|
|
40
|
-
adInterval = 4;
|
|
41
37
|
/**
|
|
42
38
|
* A custom styles object.
|
|
43
39
|
*/
|
|
@@ -46,14 +42,6 @@ export class SearchcraftBaseSearchResults {
|
|
|
46
42
|
* Formats the content rendered for each result.
|
|
47
43
|
*/
|
|
48
44
|
searchResultMappings;
|
|
49
|
-
/**
|
|
50
|
-
* Should an ad be placed at the end of the results.
|
|
51
|
-
*/
|
|
52
|
-
placeAdAtEnd = false;
|
|
53
|
-
/**
|
|
54
|
-
* Should an ad be placed at the start of the results.
|
|
55
|
-
*/
|
|
56
|
-
placeAdAtStart = true;
|
|
57
45
|
/**
|
|
58
46
|
* The placement of the image for each result.
|
|
59
47
|
*/
|
|
@@ -82,109 +70,52 @@ export class SearchcraftBaseSearchResults {
|
|
|
82
70
|
* When no results are returned.
|
|
83
71
|
*/
|
|
84
72
|
noResults;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
searchTerm = '';
|
|
74
|
+
searchClientResponseItems = [];
|
|
75
|
+
adClientResponseItems = [];
|
|
76
|
+
searchResultsPerPage;
|
|
77
|
+
searchResultsPage;
|
|
88
78
|
unsubscribe = () => { };
|
|
89
79
|
componentDidLoad() {
|
|
90
|
-
this.unsubscribe = useSearchcraftStore.subscribe((state) =>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
else {
|
|
95
|
-
this.hasSearched = false;
|
|
96
|
-
}
|
|
97
|
-
this.searchResults = { ...state.searchResults };
|
|
98
|
-
this.query = state.query;
|
|
99
|
-
});
|
|
100
|
-
const { searchResults, query } = useSearchcraftStore.getState();
|
|
101
|
-
this.searchResults = searchResults;
|
|
102
|
-
this.query = query;
|
|
80
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => this.handleStateChange(state));
|
|
81
|
+
const currentState = useSearchcraftStore.getState();
|
|
82
|
+
this.searchClientResponseItems = currentState.searchClientResponseItems;
|
|
83
|
+
this.searchTerm = currentState.searchTerm;
|
|
103
84
|
}
|
|
104
85
|
disconnectedCallback() {
|
|
105
|
-
|
|
106
|
-
this.unsubscribe();
|
|
107
|
-
}
|
|
86
|
+
this.unsubscribe?.();
|
|
108
87
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const bodyContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.body);
|
|
116
|
-
const containerHref = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.containerHref);
|
|
117
|
-
const buttonHref = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.buttonHref);
|
|
118
|
-
const imageSource = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.imageSource);
|
|
119
|
-
const footerContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings?.footer);
|
|
120
|
-
let serializedStyles = '';
|
|
121
|
-
if (this.customStylesForResults) {
|
|
122
|
-
serializedStyles =
|
|
123
|
-
typeof this.customStylesForResults === 'string'
|
|
124
|
-
? this.customStylesForResults
|
|
125
|
-
: serializeStyles(this.customStylesForResults);
|
|
126
|
-
}
|
|
127
|
-
return (h("searchcraft-base-search-result", { key: `${document.document_id}-${index}`, "custom-styles": serializedStyles, "image-placement": this.resultImagePlacement, "container-rel": this.containerRel, "container-target": this.containerTarget, "button-label": this.buttonLabel || 'View more', "button-rel": this.buttonRel, "button-target": this.buttonTarget, "document-position": index, "title-content": titleContent, "subtitle-content": subtitleContent, "body-content": bodyContent, "footer-content": footerContent, "container-href": containerHref, "button-href": buttonHref, "image-src": imageSource }));
|
|
88
|
+
handleStateChange(state) {
|
|
89
|
+
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
90
|
+
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
91
|
+
this.searchTerm = state.searchTerm;
|
|
92
|
+
this.searchResultsPage = state.searchResultsPage;
|
|
93
|
+
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
128
94
|
}
|
|
129
95
|
render() {
|
|
130
|
-
if (this.
|
|
96
|
+
if (this.searchTerm.trim() === '') {
|
|
131
97
|
return (h("div", { class: 'searchcraft-search-results-empty-state-container' }, h("slot", { name: 'empty-search' })));
|
|
132
98
|
}
|
|
133
|
-
if (
|
|
99
|
+
if (this.searchClientResponseItems.length === 0) {
|
|
134
100
|
return;
|
|
135
101
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return result;
|
|
139
|
-
});
|
|
140
|
-
const finalComponents = [];
|
|
141
|
-
if (this.placeAdAtStart) {
|
|
142
|
-
finalComponents.push(h("div", { key: 'ad-section-start', class: 'searchcraft-ad-section' }, h("p", null, "Ad Section")));
|
|
143
|
-
}
|
|
144
|
-
if (this.adInterval > 0) {
|
|
145
|
-
documents.forEach((document, index) => {
|
|
146
|
-
finalComponents.push(this.renderDocument(document, index));
|
|
147
|
-
if ((index + 1) % this.adInterval === 0) {
|
|
148
|
-
finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'searchcraft-ad-section ' }, h("p", null, "Ad Section")));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
const documentElements = documents.map((document, index) => this.renderDocument(document, index));
|
|
154
|
-
finalComponents.push(...documentElements);
|
|
155
|
-
}
|
|
156
|
-
if (this.placeAdAtEnd) {
|
|
157
|
-
finalComponents.push(h("div", { key: 'ad-section-end', class: 'searchcraft-ad-section' }, h("p", null, "Ad Section")));
|
|
158
|
-
}
|
|
159
|
-
if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {
|
|
102
|
+
if (this.searchTerm.length > 0 &&
|
|
103
|
+
this.searchClientResponseItems.length === 0) {
|
|
160
104
|
this.noResults?.emit();
|
|
161
105
|
}
|
|
162
|
-
|
|
163
|
-
|
|
106
|
+
let serializedStyles = '';
|
|
107
|
+
if (this.customStylesForResults) {
|
|
108
|
+
serializedStyles =
|
|
109
|
+
typeof this.customStylesForResults === 'string'
|
|
110
|
+
? this.customStylesForResults
|
|
111
|
+
: serializeStyles(this.customStylesForResults);
|
|
112
|
+
}
|
|
113
|
+
return (h("div", { class: 'searchcraft-search-results-container' }, this.adClientResponseItems?.map((item) => (h("searchcraft-base-search-result-ad", { adClientResponseItem: item, key: item.adId }))), this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": serializedStyles, "image-placement": this.resultImagePlacement, "container-rel": this.containerRel, "container-target": this.containerTarget, "button-label": this.buttonLabel || 'View more', "button-rel": this.buttonRel, "button-target": this.buttonTarget, "document-position": this.searchResultsPerPage * this.searchResultsPage + index, searchResultMappings: this.searchResultMappings, item: item }))), this.searchTerm.length > 0 &&
|
|
114
|
+
this.searchClientResponseItems.length === 0 && (h("div", { class: 'searchcraft-search-results-error-message-container' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.searchTerm}" query` })))));
|
|
164
115
|
}
|
|
165
116
|
static get is() { return "searchcraft-base-search-results"; }
|
|
166
117
|
static get properties() {
|
|
167
118
|
return {
|
|
168
|
-
"adInterval": {
|
|
169
|
-
"type": "number",
|
|
170
|
-
"mutable": false,
|
|
171
|
-
"complexType": {
|
|
172
|
-
"original": "number",
|
|
173
|
-
"resolved": "number",
|
|
174
|
-
"references": {}
|
|
175
|
-
},
|
|
176
|
-
"required": false,
|
|
177
|
-
"optional": false,
|
|
178
|
-
"docs": {
|
|
179
|
-
"tags": [],
|
|
180
|
-
"text": "How often ads are injected."
|
|
181
|
-
},
|
|
182
|
-
"getter": false,
|
|
183
|
-
"setter": false,
|
|
184
|
-
"attribute": "ad-interval",
|
|
185
|
-
"reflect": false,
|
|
186
|
-
"defaultValue": "4"
|
|
187
|
-
},
|
|
188
119
|
"customStylesForResults": {
|
|
189
120
|
"type": "string",
|
|
190
121
|
"mutable": false,
|
|
@@ -218,8 +149,8 @@ export class SearchcraftBaseSearchResults {
|
|
|
218
149
|
"references": {
|
|
219
150
|
"SearchResultMappings": {
|
|
220
151
|
"location": "import",
|
|
221
|
-
"path": "
|
|
222
|
-
"id": "
|
|
152
|
+
"path": "@searchcraft/core",
|
|
153
|
+
"id": "../core-sdk/dist/index.d.ts::SearchResultMappings"
|
|
223
154
|
}
|
|
224
155
|
}
|
|
225
156
|
},
|
|
@@ -232,46 +163,6 @@ export class SearchcraftBaseSearchResults {
|
|
|
232
163
|
"getter": false,
|
|
233
164
|
"setter": false
|
|
234
165
|
},
|
|
235
|
-
"placeAdAtEnd": {
|
|
236
|
-
"type": "boolean",
|
|
237
|
-
"mutable": false,
|
|
238
|
-
"complexType": {
|
|
239
|
-
"original": "boolean",
|
|
240
|
-
"resolved": "boolean",
|
|
241
|
-
"references": {}
|
|
242
|
-
},
|
|
243
|
-
"required": false,
|
|
244
|
-
"optional": false,
|
|
245
|
-
"docs": {
|
|
246
|
-
"tags": [],
|
|
247
|
-
"text": "Should an ad be placed at the end of the results."
|
|
248
|
-
},
|
|
249
|
-
"getter": false,
|
|
250
|
-
"setter": false,
|
|
251
|
-
"attribute": "place-ad-at-end",
|
|
252
|
-
"reflect": false,
|
|
253
|
-
"defaultValue": "false"
|
|
254
|
-
},
|
|
255
|
-
"placeAdAtStart": {
|
|
256
|
-
"type": "boolean",
|
|
257
|
-
"mutable": false,
|
|
258
|
-
"complexType": {
|
|
259
|
-
"original": "boolean",
|
|
260
|
-
"resolved": "boolean",
|
|
261
|
-
"references": {}
|
|
262
|
-
},
|
|
263
|
-
"required": false,
|
|
264
|
-
"optional": false,
|
|
265
|
-
"docs": {
|
|
266
|
-
"tags": [],
|
|
267
|
-
"text": "Should an ad be placed at the start of the results."
|
|
268
|
-
},
|
|
269
|
-
"getter": false,
|
|
270
|
-
"setter": false,
|
|
271
|
-
"attribute": "place-ad-at-start",
|
|
272
|
-
"reflect": false,
|
|
273
|
-
"defaultValue": "true"
|
|
274
|
-
},
|
|
275
166
|
"resultImagePlacement": {
|
|
276
167
|
"type": "string",
|
|
277
168
|
"mutable": false,
|
|
@@ -393,9 +284,11 @@ export class SearchcraftBaseSearchResults {
|
|
|
393
284
|
}
|
|
394
285
|
static get states() {
|
|
395
286
|
return {
|
|
396
|
-
"
|
|
397
|
-
"
|
|
398
|
-
"
|
|
287
|
+
"searchTerm": {},
|
|
288
|
+
"searchClientResponseItems": {},
|
|
289
|
+
"adClientResponseItems": {},
|
|
290
|
+
"searchResultsPerPage": {},
|
|
291
|
+
"searchResultsPage": {}
|
|
399
292
|
};
|
|
400
293
|
}
|
|
401
294
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-base-search-results.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,KAAK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AK,KAAK,EAAC,oDAAoD;gBAC7D,kDACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACE,CACP,CACC,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type { SearchcraftResponse } from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\n\nimport {\n getDocumentValueFromSearchResultMapping,\n serializeStyles,\n} from '@utils';\nimport type { SearchResultMappings } from 'types';\nimport type { JSX } from '@stencil/core/internal';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * How often ads are injected.\n */\n @Prop() adInterval = 4;\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * Should an ad be placed at the end of the results.\n */\n @Prop() placeAdAtEnd = false;\n /**\n * Should an ad be placed at the start of the results.\n */\n @Prop() placeAdAtStart = true;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults?: EventEmitter<void>;\n\n @State() hasSearched = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query.length > 0) {\n this.hasSearched = true;\n } else {\n this.hasSearched = false;\n }\n this.searchResults = { ...state.searchResults } as SearchcraftResponse;\n this.query = state.query;\n });\n\n const { searchResults, query } = useSearchcraftStore.getState();\n this.searchResults = searchResults;\n this.query = query;\n }\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\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.searchResultMappings?.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.subtitle,\n );\n const bodyContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.body,\n );\n const containerHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.containerHref,\n );\n const buttonHref = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.buttonHref,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.imageSource,\n );\n const footerContent = getDocumentValueFromSearchResultMapping(\n document,\n this.searchResultMappings?.footer,\n );\n\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n\n return (\n <searchcraft-base-search-result\n key={`${document.document_id}-${index}`}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={index}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n body-content={bodyContent}\n footer-content={footerContent}\n container-href={containerHref}\n button-href={buttonHref}\n image-src={imageSource}\n />\n );\n }\n\n render() {\n if (this.query.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (!this.searchResults?.data) {\n return;\n }\n\n const documents: Record<string, unknown>[] =\n this.searchResults?.data?.hits?.map((data, _index) => {\n const { doc: result } = data;\n return result;\n }) as Record<string, unknown>[];\n\n const finalComponents: JSX.Element[] = [];\n\n if (this.placeAdAtStart) {\n finalComponents.push(\n <div key='ad-section-start' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.adInterval > 0) {\n documents.forEach((document, index) => {\n finalComponents.push(this.renderDocument(document, index));\n\n if ((index + 1) % this.adInterval === 0) {\n finalComponents.push(\n <div\n key={`ad-section-${index + 1}`}\n class='searchcraft-ad-section '\n >\n <p>Ad Section</p>\n </div>,\n );\n }\n });\n } else {\n const documentElements = documents.map((document, index) =>\n this.renderDocument(document, index),\n );\n finalComponents.push(...documentElements);\n }\n\n if (this.placeAdAtEnd) {\n finalComponents.push(\n <div key='ad-section-end' class='searchcraft-ad-section'>\n <p>Ad Section</p>\n </div>,\n );\n }\n\n if (this.query.length > 0 && this.searchResults?.data?.hits?.length === 0) {\n this.noResults?.emit();\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {finalComponents}\n {this.query.length > 0 &&\n this.searchResults?.data?.hits?.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.query}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"searchcraft-base-search-results.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,KAAK,EACL,IAAI,EACJ,KAAK,GAEN,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAyB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,MAAM,OAAO,4BAA4B;IACvC;;OAEG;IACK,sBAAsB,CAGhB;IACd;;OAEG;IACK,oBAAoB,CAAmC;IAC/D;;OAEG;IACK,oBAAoB,GAAqB,OAAO,CAAC;IACzD;;OAEG;IACK,WAAW,CAAqB;IACxC;;OAEG;IACK,YAAY,GAA4C,QAAQ,CAAC;IACzE;;OAEG;IACK,SAAS,CAAqD;IACtE;;OAEG;IACK,eAAe,GAA4C,QAAQ,CAAC;IAC5E;;OAEG;IACK,YAAY,CAAqD;IAEzE;;OAEG;IACM,SAAS,CAAsB;IAE/B,UAAU,GAAG,EAAE,CAAC;IAChB,yBAAyB,GAA+B,EAAE,CAAC;IAC3D,qBAAqB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C,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, useSearchcraftStore } from '@provider/store';\n\nimport { serializeStyles } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults?: EventEmitter<void>;\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = useSearchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleStateChange(state: SearchcraftState) {\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (this.searchClientResponseItems.length === 0) {\n return;\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0\n ) {\n this.noResults?.emit();\n }\n\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-base-search-result-ad\n adClientResponseItem={item}\n key={item.adId}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n {this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.searchTerm}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -6,10 +6,18 @@ import classNames from "classnames";
|
|
|
6
6
|
* It is consumed within the `searchcraft-input-form` component.
|
|
7
7
|
*/
|
|
8
8
|
export class SearchcraftButton {
|
|
9
|
+
/**
|
|
10
|
+
* Controls the visual representation of the button.
|
|
11
|
+
*/
|
|
12
|
+
hierarchy = 'primary';
|
|
13
|
+
/**
|
|
14
|
+
* Whether the button is disabled.
|
|
15
|
+
*/
|
|
16
|
+
disabled = false;
|
|
9
17
|
/**
|
|
10
18
|
* The icon element.
|
|
11
19
|
*/
|
|
12
|
-
|
|
20
|
+
icon;
|
|
13
21
|
/**
|
|
14
22
|
* Should the button only display an icon.
|
|
15
23
|
*/
|
|
@@ -23,20 +31,67 @@ export class SearchcraftButton {
|
|
|
23
31
|
*/
|
|
24
32
|
label = 'Search';
|
|
25
33
|
/**
|
|
26
|
-
*
|
|
34
|
+
* The type of the button.
|
|
35
|
+
*/
|
|
36
|
+
type = 'button';
|
|
37
|
+
/**
|
|
38
|
+
* The event fired when the button is clicked.
|
|
27
39
|
*/
|
|
28
40
|
buttonClick;
|
|
29
|
-
|
|
30
|
-
handleClick = () => {
|
|
41
|
+
handleButtonClick = () => {
|
|
31
42
|
this.buttonClick.emit();
|
|
32
43
|
};
|
|
33
44
|
render() {
|
|
34
|
-
return (h(
|
|
45
|
+
return (h("button", { key: 'fc258e1c7aab54611c781789eef7facc074f02c3', class: classNames('searchcraft-button', {
|
|
46
|
+
'searchcraft-button-primary': this.hierarchy === 'primary',
|
|
47
|
+
'searchcraft-button-tertiary': this.hierarchy === 'tertiary',
|
|
48
|
+
'searchcraft-button-disabled': this.disabled,
|
|
49
|
+
}), disabled: this.disabled, onClick: this.handleButtonClick, type: this.type }, this.iconOnly ? (this.icon) : (h(Fragment, null, this.iconPosition === 'left' && this.icon, h("span", null, this.label), this.iconPosition === 'right' && this.icon))));
|
|
35
50
|
}
|
|
36
51
|
static get is() { return "searchcraft-button"; }
|
|
37
52
|
static get properties() {
|
|
38
53
|
return {
|
|
39
|
-
"
|
|
54
|
+
"hierarchy": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"mutable": false,
|
|
57
|
+
"complexType": {
|
|
58
|
+
"original": "'primary' | 'tertiary'",
|
|
59
|
+
"resolved": "\"primary\" | \"tertiary\" | undefined",
|
|
60
|
+
"references": {}
|
|
61
|
+
},
|
|
62
|
+
"required": false,
|
|
63
|
+
"optional": true,
|
|
64
|
+
"docs": {
|
|
65
|
+
"tags": [],
|
|
66
|
+
"text": "Controls the visual representation of the button."
|
|
67
|
+
},
|
|
68
|
+
"getter": false,
|
|
69
|
+
"setter": false,
|
|
70
|
+
"attribute": "hierarchy",
|
|
71
|
+
"reflect": false,
|
|
72
|
+
"defaultValue": "'primary'"
|
|
73
|
+
},
|
|
74
|
+
"disabled": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"mutable": false,
|
|
77
|
+
"complexType": {
|
|
78
|
+
"original": "boolean",
|
|
79
|
+
"resolved": "boolean | undefined",
|
|
80
|
+
"references": {}
|
|
81
|
+
},
|
|
82
|
+
"required": false,
|
|
83
|
+
"optional": true,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [],
|
|
86
|
+
"text": "Whether the button is disabled."
|
|
87
|
+
},
|
|
88
|
+
"getter": false,
|
|
89
|
+
"setter": false,
|
|
90
|
+
"attribute": "disabled",
|
|
91
|
+
"reflect": false,
|
|
92
|
+
"defaultValue": "false"
|
|
93
|
+
},
|
|
94
|
+
"icon": {
|
|
40
95
|
"type": "unknown",
|
|
41
96
|
"mutable": false,
|
|
42
97
|
"complexType": {
|
|
@@ -63,11 +118,11 @@ export class SearchcraftButton {
|
|
|
63
118
|
"mutable": false,
|
|
64
119
|
"complexType": {
|
|
65
120
|
"original": "boolean",
|
|
66
|
-
"resolved": "boolean",
|
|
121
|
+
"resolved": "boolean | undefined",
|
|
67
122
|
"references": {}
|
|
68
123
|
},
|
|
69
124
|
"required": false,
|
|
70
|
-
"optional":
|
|
125
|
+
"optional": true,
|
|
71
126
|
"docs": {
|
|
72
127
|
"tags": [],
|
|
73
128
|
"text": "Should the button only display an icon."
|
|
@@ -82,12 +137,12 @@ export class SearchcraftButton {
|
|
|
82
137
|
"type": "string",
|
|
83
138
|
"mutable": false,
|
|
84
139
|
"complexType": {
|
|
85
|
-
"original": "
|
|
86
|
-
"resolved": "
|
|
140
|
+
"original": "'left' | 'right'",
|
|
141
|
+
"resolved": "\"left\" | \"right\" | undefined",
|
|
87
142
|
"references": {}
|
|
88
143
|
},
|
|
89
144
|
"required": false,
|
|
90
|
-
"optional":
|
|
145
|
+
"optional": true,
|
|
91
146
|
"docs": {
|
|
92
147
|
"tags": [],
|
|
93
148
|
"text": "The position of the icon."
|
|
@@ -117,14 +172,29 @@ export class SearchcraftButton {
|
|
|
117
172
|
"attribute": "label",
|
|
118
173
|
"reflect": false,
|
|
119
174
|
"defaultValue": "'Search'"
|
|
175
|
+
},
|
|
176
|
+
"type": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "'submit' | 'reset' | 'button'",
|
|
181
|
+
"resolved": "\"button\" | \"reset\" | \"submit\" | undefined",
|
|
182
|
+
"references": {}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": true,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": "The type of the button."
|
|
189
|
+
},
|
|
190
|
+
"getter": false,
|
|
191
|
+
"setter": false,
|
|
192
|
+
"attribute": "type",
|
|
193
|
+
"reflect": false,
|
|
194
|
+
"defaultValue": "'button'"
|
|
120
195
|
}
|
|
121
196
|
};
|
|
122
197
|
}
|
|
123
|
-
static get states() {
|
|
124
|
-
return {
|
|
125
|
-
"isRequesting": {}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
198
|
static get events() {
|
|
129
199
|
return [{
|
|
130
200
|
"method": "buttonClick",
|
|
@@ -134,7 +204,7 @@ export class SearchcraftButton {
|
|
|
134
204
|
"composed": true,
|
|
135
205
|
"docs": {
|
|
136
206
|
"tags": [],
|
|
137
|
-
"text": "
|
|
207
|
+
"text": "The event fired when the button is clicked."
|
|
138
208
|
},
|
|
139
209
|
"complexType": {
|
|
140
210
|
"original": "void",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-button/searchcraft-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,CAAC,EACD,
|
|
1
|
+
{"version":3,"file":"searchcraft-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-button/searchcraft-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,CAAC,EACD,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;;GAIG;AAKH,MAAM,OAAO,iBAAiB;IAC5B;;OAEG;IACK,SAAS,GAA4B,SAAS,CAAC;IACvD;;OAEG;IACK,QAAQ,GAAa,KAAK,CAAC;IACnC;;OAE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,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * Controls the visual representation of the button.\n */\n @Prop() hierarchy?: 'primary' | 'tertiary' = 'primary';\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled?: boolean = false;\n /**\n * The icon element.\n */\n @Prop() icon?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly?: boolean = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition?: 'left' | 'right' = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n /**\n * The type of the button.\n */\n @Prop() type?: 'submit' | 'reset' | 'button' = 'button';\n /**\n * The event fired when the button is clicked.\n */\n @Event() buttonClick!: EventEmitter<void>;\n\n private handleButtonClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <button\n class={classNames('searchcraft-button', {\n 'searchcraft-button-primary': this.hierarchy === 'primary',\n 'searchcraft-button-tertiary': this.hierarchy === 'tertiary',\n 'searchcraft-button-disabled': this.disabled,\n })}\n disabled={this.disabled}\n onClick={this.handleButtonClick}\n type={this.type}\n >\n {this.iconOnly ? (\n this.icon\n ) : (\n <Fragment>\n {this.iconPosition === 'left' && this.icon}\n <span>{this.label}</span>\n {this.iconPosition === 'right' && this.icon}\n </Fragment>\n )}\n </button>\n );\n }\n}\n"]}
|
|
@@ -14,7 +14,7 @@ export class SearchcraftErrorMessage {
|
|
|
14
14
|
*/
|
|
15
15
|
errorMessage;
|
|
16
16
|
render() {
|
|
17
|
-
return (h("p", { key: '
|
|
17
|
+
return (h("p", { key: 'dc97bb66da10a98fca027f928deaaf80d945417b', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
|
|
18
18
|
}
|
|
19
19
|
static get is() { return "searchcraft-error-message"; }
|
|
20
20
|
static get properties() {
|
|
@@ -35,19 +35,19 @@ export class SearchcraftFacetList {
|
|
|
35
35
|
selectedPaths = {};
|
|
36
36
|
lastTimeTaken;
|
|
37
37
|
hasNewSearchTerm = false;
|
|
38
|
-
|
|
38
|
+
lastSearchTerm;
|
|
39
39
|
lastSearchMode;
|
|
40
40
|
lastSortType;
|
|
41
41
|
unsubscribe;
|
|
42
42
|
searchStore = useSearchcraftStore.getState();
|
|
43
43
|
handleStateUpdate(state) {
|
|
44
|
-
const facetPrime = state.
|
|
45
|
-
const timeTaken = state.
|
|
44
|
+
const facetPrime = state.searchResponseFacetPrime;
|
|
45
|
+
const timeTaken = state.searchResponseTimeTaken;
|
|
46
46
|
if (!this.fieldName) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
/** Things to do when the state's search term has changed, but before the response received */
|
|
50
|
-
if (state.
|
|
50
|
+
if (state.searchTerm !== this.lastSearchTerm ||
|
|
51
51
|
state.searchMode !== this.lastSearchMode ||
|
|
52
52
|
state.sortType !== this.lastSortType) {
|
|
53
53
|
this.selectedPaths = {};
|
|
@@ -68,7 +68,7 @@ export class SearchcraftFacetList {
|
|
|
68
68
|
this.facetRoot = mergeFacetRoots(this.fieldName, this.baseFacetRoot, incomingFacetRoot);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
this.
|
|
71
|
+
this.lastSearchTerm = state.searchTerm;
|
|
72
72
|
this.lastSearchMode = state.searchMode;
|
|
73
73
|
this.lastSortType = state.sortType;
|
|
74
74
|
this.lastTimeTaken = timeTaken;
|
|
@@ -131,13 +131,13 @@ export class SearchcraftFacetList {
|
|
|
131
131
|
const isChildSelected = facetChild.children
|
|
132
132
|
? facetChild.children?.some((child) => this.selectedPaths[child.path])
|
|
133
133
|
: false;
|
|
134
|
-
return (h("div", { key: facetChild.path, class: classNames('searchcraft-filters-list-item') }, h("label", { class: classNames('filterCheckboxLabel', 'searchcraft-filters-list-checkbox-label') }, h("input", { checked: this.selectedPaths[facetChild.path], onChange: (_event) => this.handleCheckboxChange(facetChild.path), type: 'checkbox' }), isChildSelected ? (h("div", { class: classNames('dashContainer', 'searchcraft-filter-list-dash-container') }, h("
|
|
134
|
+
return (h("div", { key: facetChild.path, class: classNames('searchcraft-filters-list-item') }, h("label", { class: classNames('filterCheckboxLabel', 'searchcraft-filters-list-checkbox-label') }, h("input", { checked: this.selectedPaths[facetChild.path], onChange: (_event) => this.handleCheckboxChange(facetChild.path), type: 'checkbox' }), isChildSelected ? (h("div", { class: classNames('dashContainer', 'searchcraft-filter-list-dash-container') }, h("svg", { width: '14', height: '3', viewBox: '0 0 14 3', fill: 'none' }, h("title", null, "Checkbox Dash"), h("line", { x1: '1.5', y1: '1.5', x2: '12.5', y2: '1.5', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round' })))) : (h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", null, "Checkbox Check"), h("path", { d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' })))), this.formatLabel(facetChild)), facetChild.children && facetChild.children.length > 0 && (h(Fragment, null, facetChild.children.map((grandchild) => (h("label", { key: grandchild.path, class: classNames('childFilterCheckboxLabel', 'searchcraft-child-filter-checkbox-label'), style: {
|
|
135
135
|
display: this.selectedPaths[facetChild.path]
|
|
136
136
|
? 'flex'
|
|
137
137
|
: 'none',
|
|
138
138
|
} }, h("input", { checked: this.selectedPaths[grandchild.path], onChange: (_event) => {
|
|
139
139
|
this.handleCheckboxChange(grandchild.path);
|
|
140
|
-
}, type: 'checkbox' }), h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("
|
|
140
|
+
}, type: 'checkbox' }), h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", null, "Checkbox Check"), h("path", { d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), this.formatSubLabel(grandchild, facetChild))))))));
|
|
141
141
|
})));
|
|
142
142
|
}
|
|
143
143
|
static get is() { return "searchcraft-facet-list"; }
|
|
@@ -172,7 +172,7 @@ export class SearchcraftFacetList {
|
|
|
172
172
|
"selectedPaths": {},
|
|
173
173
|
"lastTimeTaken": {},
|
|
174
174
|
"hasNewSearchTerm": {},
|
|
175
|
-
"
|
|
175
|
+
"lastSearchTerm": {},
|
|
176
176
|
"lastSearchMode": {},
|
|
177
177
|
"lastSortType": {},
|
|
178
178
|
"unsubscribe": {}
|