@searchcraft/javascript-sdk 0.3.1 → 0.4.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 +197 -0
- package/dist/cjs/{index-264ebadc.js → index-6916cc47.js} +30 -3
- package/dist/cjs/index-6916cc47.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -5
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-35d3b670.js → package-38f7e2c7.js} +3 -3
- package/dist/cjs/package-38f7e2c7.js.map +1 -0
- package/dist/cjs/searchcraft-auto-search-form.cjs.entry.js +143 -0
- package/dist/cjs/searchcraft-auto-search-form.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +8 -11
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +74 -0
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +109 -0
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-button-icon.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-button.cjs.entry.js +3 -8
- package/dist/cjs/searchcraft-button.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-check-icon_2.cjs.entry.js +28 -0
- package/dist/cjs/searchcraft-check-icon_2.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-clear-icon-set.cjs.entry.js +30 -0
- package/dist/cjs/searchcraft-clear-icon-set.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-error-message_3.cjs.entry.js +95 -0
- package/dist/cjs/searchcraft-error-message_3.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +236 -0
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +115 -0
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +46 -0
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-search-icon-set.cjs.entry.js +33 -0
- package/dist/cjs/searchcraft-search-icon-set.cjs.entry.js.map +1 -0
- package/dist/cjs/searchcraft-spinner-dark.cjs.entry.js +3 -3
- package/dist/cjs/searchcraft-spinner-dark.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-spinner-light.cjs.entry.js +3 -3
- package/dist/cjs/searchcraft-spinner-light.cjs.entry.js.map +1 -1
- package/dist/{esm/store-b519dd0b.js → cjs/store-afa727af.js} +148 -208
- package/dist/cjs/store-afa727af.js.map +1 -0
- package/dist/cjs/utils-0f309f6d.js +226 -0
- package/dist/cjs/utils-0f309f6d.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -4
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js +46 -95
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.js.map +1 -1
- package/dist/collection/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.css +98 -9
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js +31 -16
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-form/searchcraft-base-search-form.module.css +94 -8
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +125 -153
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +139 -206
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +121 -92
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +105 -23
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +2 -8
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +107 -36
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +1 -22
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +101 -15
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +171 -0
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -0
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +216 -0
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +148 -0
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -0
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +118 -0
- package/dist/collection/components/searchcraft-input/searchcraft-input.js +36 -125
- package/dist/collection/components/searchcraft-input/searchcraft-input.js.map +1 -1
- package/dist/collection/components/searchcraft-input/searchcraft-input.module.css +158 -209
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +1 -12
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +102 -14
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +1 -2
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +103 -9
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +93 -68
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +117 -18
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.js +1 -1
- package/dist/collection/components/searchcraft-spinner-dark/searchcraft-spinner-dark.module.css +103 -4
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.js +1 -1
- package/dist/collection/components/searchcraft-spinner-light/searchcraft-spinner-light.module.css +102 -3
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +62 -59
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +135 -9
- package/dist/collection/index.js +2 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/provider/store.js +54 -34
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/types/index.js +3 -0
- package/dist/collection/types/index.js.map +1 -0
- package/dist/collection/types/searchcraft-base-search-results.types.js +2 -0
- package/dist/collection/types/searchcraft-base-search-results.types.js.map +1 -0
- package/dist/collection/types/searchcraft-filter-panel.types.js +2 -0
- package/dist/collection/types/searchcraft-filter-panel.types.js.map +1 -0
- package/dist/collection/utils/utils.js +171 -35
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +7 -11
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-bbf9973a.js → p-04d13314.js} +2 -2
- package/dist/components/{p-bbf9973a.js.map → p-04d13314.js.map} +1 -1
- package/dist/components/p-08e421ca.js +99 -0
- package/dist/components/p-08e421ca.js.map +1 -0
- package/dist/components/p-37f54c0b.js +54 -0
- package/dist/components/p-37f54c0b.js.map +1 -0
- package/dist/components/{p-727bfc38.js → p-3c181808.js} +135 -113
- package/dist/components/p-3c181808.js.map +1 -0
- package/dist/components/p-415f7b11.js +101 -0
- package/dist/components/p-415f7b11.js.map +1 -0
- package/dist/components/p-4353a2b8.js +155 -0
- package/dist/components/p-4353a2b8.js.map +1 -0
- package/dist/components/{p-b0c1fd63.js → p-4c89f065.js} +3 -3
- package/dist/components/p-4c89f065.js.map +1 -0
- package/dist/components/p-4fad3388.js +82 -0
- package/dist/components/p-4fad3388.js.map +1 -0
- package/dist/components/{p-6b353c3e.js → p-5639be85.js} +23 -3
- package/dist/components/p-5639be85.js.map +1 -0
- package/dist/components/p-9982883f.js +218 -0
- package/dist/components/p-9982883f.js.map +1 -0
- package/dist/components/p-9b9df0ca.js +67 -0
- package/dist/components/p-9b9df0ca.js.map +1 -0
- package/dist/components/p-9f2b8375.js +33 -0
- package/dist/components/p-9f2b8375.js.map +1 -0
- package/dist/components/p-ace4e6a0.js +35 -0
- package/dist/components/p-ace4e6a0.js.map +1 -0
- package/dist/components/p-c8bc1e4f.js +40 -0
- package/dist/components/p-c8bc1e4f.js.map +1 -0
- package/dist/components/{p-aad03c2a.js → p-de50441f.js} +2 -2
- package/dist/components/{p-aad03c2a.js.map → p-de50441f.js.map} +1 -1
- package/dist/components/searchcraft-auto-search-form.js +54 -82
- package/dist/components/searchcraft-auto-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-form.js +20 -52
- package/dist/components/searchcraft-base-search-form.js.map +1 -1
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +51 -52
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button-icon.js +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-check-icon.js +1 -1
- package/dist/components/searchcraft-clear-icon-set.js +39 -1
- package/dist/components/searchcraft-clear-icon-set.js.map +1 -1
- package/dist/components/searchcraft-dash-icon.js +1 -1
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-facet-list.d.ts +11 -0
- package/dist/components/searchcraft-facet-list.js +8 -0
- package/dist/components/searchcraft-facet-list.js.map +1 -0
- package/dist/components/searchcraft-filter-panel.d.ts +11 -0
- package/dist/components/searchcraft-filter-panel.js +162 -0
- package/dist/components/searchcraft-filter-panel.js.map +1 -0
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-results-info.js +5 -6
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-search-icon-set.js +44 -1
- package/dist/components/searchcraft-search-icon-set.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -104
- package/dist/components/searchcraft-slider.js.map +1 -1
- package/dist/components/searchcraft-spinner-dark.js +1 -1
- package/dist/components/searchcraft-spinner-light.js +3 -3
- package/dist/components/searchcraft-spinner-light.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -93
- package/dist/components/searchcraft-toggle-button.js.map +1 -1
- package/dist/esm/{index-d851fb46.js → index-921fe029.js} +30 -4
- package/dist/esm/index-921fe029.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{package-82baadd7.js → package-e62ac63a.js} +3 -3
- package/dist/esm/package-e62ac63a.js.map +1 -0
- package/dist/esm/searchcraft-auto-search-form.entry.js +139 -0
- package/dist/esm/searchcraft-auto-search-form.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-form.entry.js +8 -11
- package/dist/esm/searchcraft-base-search-form.entry.js.map +1 -1
- package/dist/esm/searchcraft-base-search-result.entry.js +70 -0
- package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -0
- package/dist/esm/searchcraft-base-search-results.entry.js +105 -0
- package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -0
- package/dist/esm/searchcraft-button-icon.entry.js +1 -1
- package/dist/esm/searchcraft-button.entry.js +3 -8
- package/dist/esm/searchcraft-button.entry.js.map +1 -1
- package/dist/esm/searchcraft-check-icon_2.entry.js +23 -0
- package/dist/esm/searchcraft-check-icon_2.entry.js.map +1 -0
- package/dist/{components/p-62e6b69c.js → esm/searchcraft-clear-icon-set.entry.js} +7 -24
- package/dist/esm/searchcraft-clear-icon-set.entry.js.map +1 -0
- package/dist/esm/searchcraft-error-message_3.entry.js +89 -0
- package/dist/esm/searchcraft-error-message_3.entry.js.map +1 -0
- package/dist/esm/searchcraft-facet-list_3.entry.js +230 -0
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -0
- package/dist/esm/searchcraft-filter-panel.entry.js +111 -0
- package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -0
- package/dist/esm/searchcraft-javascript-sdk.js +3 -3
- package/dist/esm/searchcraft-results-info.entry.js +42 -0
- package/dist/esm/searchcraft-results-info.entry.js.map +1 -0
- package/dist/{components/p-5a872bdf.js → esm/searchcraft-search-icon-set.entry.js} +7 -26
- package/dist/esm/searchcraft-search-icon-set.entry.js.map +1 -0
- package/dist/esm/searchcraft-spinner-dark.entry.js +3 -3
- package/dist/esm/searchcraft-spinner-dark.entry.js.map +1 -1
- package/dist/esm/searchcraft-spinner-light.entry.js +3 -3
- package/dist/esm/searchcraft-spinner-light.entry.js.map +1 -1
- package/dist/{cjs/store-e3bbdd49.js → esm/store-8d82e948.js} +145 -220
- package/dist/esm/store-8d82e948.js.map +1 -0
- package/dist/esm/utils-ee63b542.js +218 -0
- package/dist/esm/utils-ee63b542.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-15e0ce05.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-15e0ce05.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-2816782c.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-2816782c.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-3292e706.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-3292e706.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-4a2d1f44.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-4a2d1f44.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-4c89f065.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-80e3f29f.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-80e3f29f.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-8a9b0762.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-8a9b0762.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-92d080a7.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-92d080a7.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-9982883f.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-9982883f.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-9f29b018.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-9f29b018.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-a148febe.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-a148febe.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-a2801518.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-a2801518.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-bcc68b15.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-bcc68b15.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-c70b31ae.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-c70b31ae.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-cc614ce6.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-cc614ce6.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-d4a7d8bd.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-d4a7d8bd.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-e108dd2e.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-e108dd2e.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/{p-99356c9a.entry.js → p-e8a96dca.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/p-efb41d6d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-efb41d6d.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-auto-search-form/searchcraft-auto-search-form.d.ts +5 -5
- package/dist/types/components/searchcraft-base-search-form/searchcraft-base-search-form.d.ts +3 -2
- package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +16 -18
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +10 -6
- package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +0 -2
- package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +0 -1
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +24 -0
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +22 -0
- package/dist/types/components/searchcraft-input/searchcraft-input.d.ts +4 -10
- package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +0 -2
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +12 -15
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +8 -9
- package/dist/types/components.d.ts +127 -185
- package/dist/types/index.d.ts +2 -1
- package/dist/types/provider/store.d.ts +15 -14
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/searchcraft-base-search-results.types.d.ts +17 -0
- package/dist/types/types/searchcraft-filter-panel.types.d.ts +42 -0
- package/dist/types/utils/utils.d.ts +23 -15
- package/package.json +2 -2
- package/dist/cjs/index-264ebadc.js.map +0 -1
- package/dist/cjs/package-35d3b670.js.map +0 -1
- package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js +0 -867
- package/dist/cjs/searchcraft-auto-search-form_17.cjs.entry.js.map +0 -1
- package/dist/cjs/store-e3bbdd49.js.map +0 -1
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js +0 -94
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.js.map +0 -1
- package/dist/collection/components/searchcraft-clear-input-button/searchcraft-clear-input-button.module.css +0 -33
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js +0 -168
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.js.map +0 -1
- package/dist/collection/components/searchcraft-filters-list/searchcraft-filters-list.module.css +0 -111
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js +0 -121
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.js.map +0 -1
- package/dist/collection/components/searchcraft-input-caption/searchcraft-input-caption.module.css +0 -79
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js +0 -109
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.js.map +0 -1
- package/dist/collection/components/searchcraft-input-icon/searchcraft-input-icon.module.css +0 -17
- package/dist/components/p-4f939ba2.js +0 -53
- package/dist/components/p-4f939ba2.js.map +0 -1
- package/dist/components/p-5015a359.js +0 -39
- package/dist/components/p-5015a359.js.map +0 -1
- package/dist/components/p-54848b4d.js +0 -136
- package/dist/components/p-54848b4d.js.map +0 -1
- package/dist/components/p-5a872bdf.js.map +0 -1
- package/dist/components/p-62c40862.js +0 -91
- package/dist/components/p-62c40862.js.map +0 -1
- package/dist/components/p-62e6b69c.js.map +0 -1
- package/dist/components/p-69ee3b9a.js +0 -59
- package/dist/components/p-69ee3b9a.js.map +0 -1
- package/dist/components/p-6b353c3e.js.map +0 -1
- package/dist/components/p-727bfc38.js.map +0 -1
- package/dist/components/p-7c280820.js +0 -33
- package/dist/components/p-7c280820.js.map +0 -1
- package/dist/components/p-7d385ffb.js +0 -60
- package/dist/components/p-7d385ffb.js.map +0 -1
- package/dist/components/p-8524c749.js +0 -54
- package/dist/components/p-8524c749.js.map +0 -1
- package/dist/components/p-b0c1fd63.js.map +0 -1
- package/dist/components/p-b38d171d.js +0 -47
- package/dist/components/p-b38d171d.js.map +0 -1
- package/dist/components/p-cd9a038a.js +0 -105
- package/dist/components/p-cd9a038a.js.map +0 -1
- package/dist/components/searchcraft-clear-input-button.d.ts +0 -11
- package/dist/components/searchcraft-clear-input-button.js +0 -8
- package/dist/components/searchcraft-clear-input-button.js.map +0 -1
- package/dist/components/searchcraft-filters-list.d.ts +0 -11
- package/dist/components/searchcraft-filters-list.js +0 -151
- package/dist/components/searchcraft-filters-list.js.map +0 -1
- package/dist/components/searchcraft-input-caption.d.ts +0 -11
- package/dist/components/searchcraft-input-caption.js +0 -8
- package/dist/components/searchcraft-input-caption.js.map +0 -1
- package/dist/components/searchcraft-input-icon.d.ts +0 -11
- package/dist/components/searchcraft-input-icon.js +0 -8
- package/dist/components/searchcraft-input-icon.js.map +0 -1
- package/dist/esm/index-d851fb46.js.map +0 -1
- package/dist/esm/package-82baadd7.js.map +0 -1
- package/dist/esm/searchcraft-auto-search-form_17.entry.js +0 -847
- package/dist/esm/searchcraft-auto-search-form_17.entry.js.map +0 -1
- package/dist/esm/store-b519dd0b.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-1f3ae7f3.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-1f3ae7f3.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-201cb2dc.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-201cb2dc.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2c220368.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2c220368.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-39c0ca33.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-39c0ca33.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-476829a4.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-476829a4.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-b0c1fd63.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-b42eaa55.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-b42eaa55.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-d5f8dda2.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-d5f8dda2.js.map +0 -1
- package/dist/types/components/searchcraft-clear-input-button/searchcraft-clear-input-button.d.ts +0 -10
- package/dist/types/components/searchcraft-filters-list/searchcraft-filters-list.d.ts +0 -34
- package/dist/types/components/searchcraft-input-caption/searchcraft-input-caption.d.ts +0 -9
- package/dist/types/components/searchcraft-input-icon/searchcraft-input-icon.d.ts +0 -9
- package/readme.md +0 -11
- /package/dist/searchcraft-javascript-sdk/{p-b0c1fd63.js.map → p-4c89f065.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-99356c9a.entry.js.map → p-e8a96dca.entry.js.map} +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-921fe029.js';
|
|
2
|
+
import { u as useSearchcraftStore, i as ie } from './store-8d82e948.js';
|
|
3
|
+
import { p as parseCustomStyles } from './utils-ee63b542.js';
|
|
4
|
+
import { p as packageJson } from './package-e62ac63a.js';
|
|
5
|
+
|
|
6
|
+
const searchcraftAutoSearchFormModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-auto-search-form{display:flex;flex-direction:column;gap:4px}";
|
|
7
|
+
const SearchcraftAutoSearchFormStyle0 = searchcraftAutoSearchFormModuleCss;
|
|
8
|
+
|
|
9
|
+
const SearchcraftAutoSearchForm = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.inputClearedOrNoResults = createEvent(this, "inputClearedOrNoResults", 7);
|
|
13
|
+
this.querySubmit = createEvent(this, "querySubmit", 7);
|
|
14
|
+
this.debounceTimeout = null;
|
|
15
|
+
this.debounceDelay = 0;
|
|
16
|
+
this.searchStore = useSearchcraftStore.getState();
|
|
17
|
+
this.handleInputChange = (event) => {
|
|
18
|
+
const target = event.detail;
|
|
19
|
+
if (target === this.query) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.query = target;
|
|
23
|
+
const performSearchActions = () => {
|
|
24
|
+
if (this.query.trim() === '') {
|
|
25
|
+
this.searchStore.setQuery('');
|
|
26
|
+
this.searchResults = null;
|
|
27
|
+
this.searchStore.setSearchResults(null);
|
|
28
|
+
this.inputClearedOrNoResults.emit();
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.searchStore.setQuery(this.query);
|
|
32
|
+
this.querySubmit.emit();
|
|
33
|
+
this.runSearch();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
// Only set a timeout if debounceDelay > 0
|
|
37
|
+
if (this.debounceDelay > 0) {
|
|
38
|
+
if (this.debounceTimeout) {
|
|
39
|
+
clearTimeout(this.debounceTimeout);
|
|
40
|
+
}
|
|
41
|
+
this.debounceTimeout = setTimeout(performSearchActions, this.debounceDelay);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Otherwise just call search actions directly
|
|
45
|
+
performSearchActions();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.handleClearInput = () => {
|
|
49
|
+
if (this.query === '' && !this.searchResults) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.query = '';
|
|
53
|
+
this.searchResults = null;
|
|
54
|
+
this.searchStore.setQuery('');
|
|
55
|
+
this.searchStore.setSearchResults(null);
|
|
56
|
+
if (typeof this.clearInput === 'function') {
|
|
57
|
+
this.clearInput();
|
|
58
|
+
}
|
|
59
|
+
if (this.debounceTimeout) {
|
|
60
|
+
clearTimeout(this.debounceTimeout);
|
|
61
|
+
}
|
|
62
|
+
this.error = false;
|
|
63
|
+
this.inputClearedOrNoResults.emit();
|
|
64
|
+
};
|
|
65
|
+
this.runSearch = async () => {
|
|
66
|
+
if (this.query.trim() === '') {
|
|
67
|
+
this.error = true;
|
|
68
|
+
this.inputClearedOrNoResults.emit();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.error = false;
|
|
72
|
+
this.searchStore.setQuery(this.query);
|
|
73
|
+
try {
|
|
74
|
+
await this.searchStore.search();
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
this.error = true;
|
|
78
|
+
this.inputClearedOrNoResults.emit();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
this.handleFormSubmit = async (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
await this.runSearch();
|
|
85
|
+
};
|
|
86
|
+
this.autoSearchFormClass = '';
|
|
87
|
+
this.clearInput = () => { };
|
|
88
|
+
this.config = undefined;
|
|
89
|
+
this.customStylesForInput = {};
|
|
90
|
+
this.inputCaptionValue = '';
|
|
91
|
+
this.labelForInput = '';
|
|
92
|
+
this.placeholderValue = 'Search here';
|
|
93
|
+
this.searchContainerClass = '';
|
|
94
|
+
this.error = false;
|
|
95
|
+
this.isRequesting = false;
|
|
96
|
+
this.query = '';
|
|
97
|
+
this.searchResults = null;
|
|
98
|
+
}
|
|
99
|
+
init() {
|
|
100
|
+
var _a;
|
|
101
|
+
if (this.config) {
|
|
102
|
+
const searchcraft = new ie(this.config, {
|
|
103
|
+
sdkName: packageJson.name,
|
|
104
|
+
sdkVersion: packageJson.version,
|
|
105
|
+
});
|
|
106
|
+
this.searchStore.initialize(searchcraft, true);
|
|
107
|
+
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
108
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
109
|
+
this.isRequesting = state.isRequesting;
|
|
110
|
+
this.searchResults = Object.assign({}, state.searchResults);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
componentDidLoad() {
|
|
115
|
+
this.init();
|
|
116
|
+
}
|
|
117
|
+
onConfigChange() {
|
|
118
|
+
this.init();
|
|
119
|
+
}
|
|
120
|
+
connectedCallback() { }
|
|
121
|
+
disconnectedCallback() {
|
|
122
|
+
if (this.unsubscribe) {
|
|
123
|
+
this.unsubscribe();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
render() {
|
|
127
|
+
const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);
|
|
128
|
+
return (h("form", { key: '3c1069cbaf543e9b06616d7440eb784010a7b601', class: 'searchcraft-auto-search-form', onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '7ba138f9335b59ee2205a22ef3a8af306db102d1', label: this.labelForInput }), h("searchcraft-input", { key: 'a7400629e259ea15cd58d5f2c87f1659c8d6addb', customStyles: parsedCustomStyles, "input-caption-value": this.inputCaptionValue, "is-requesting": this.isRequesting, onClearInput: this.handleClearInput, onInputChange: this.handleInputChange.bind(this), "placeholder-value": this.placeholderValue, query: this.query }), this.error && (h("searchcraft-error-message", { key: 'f304152c611d3e8849a9d24b07a9db3d5d71197f', errorMessage: 'Please enter a search query.' }))));
|
|
129
|
+
}
|
|
130
|
+
get element() { return getElement(this); }
|
|
131
|
+
static get watchers() { return {
|
|
132
|
+
"config": ["onConfigChange"]
|
|
133
|
+
}; }
|
|
134
|
+
};
|
|
135
|
+
SearchcraftAutoSearchForm.style = SearchcraftAutoSearchFormStyle0;
|
|
136
|
+
|
|
137
|
+
export { SearchcraftAutoSearchForm as searchcraft_auto_search_form };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=searchcraft-auto-search-form.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"searchcraft-auto-search-form.entry.js","mappings":";;;;;AAAA,MAAM,kCAAkC,GAAG,omGAAomG,CAAC;AAChpG,wCAAe,kCAAkC;;MC2BpC,yBAAyB;;;;;QAoB5B,oBAAe,GAAyC,IAAI,CAAC;QAC7D,kBAAa,GAAG,CAAC,CAAC;QAClB,gBAAW,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAoCrD,sBAAiB,GAAG,CAAC,KAAiC;YACpD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC5B,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE;gBACzB,OAAO;aACR;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;YAEpB,MAAM,oBAAoB,GAAG;gBAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oBAC5B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC1B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;oBACxC,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC;iBACrC;qBAAM;oBACL,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACtC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;oBACxB,IAAI,CAAC,SAAS,EAAE,CAAC;iBAClB;aACF,CAAC;;YAGF,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE;gBAC1B,IAA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AI,CAAC,oBAAoB,CAAC,CAAC;QACxE,QACE,6DACE,KAAK,EAAC,8BAA8B,EACpC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,IAE/B,gFAAyB,KAAK,EAAE,IAAI,CAAC,aAAa,GAAI,EACtD,0EACE,YAAY,EAAE,kBAAkB,yBACX,IAAI,CAAC,iBAAiB,mBAC5B,IAAI,CAAC,YAAY,EAChC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,uBAC7B,IAAI,CAAC,gBAAgB,EACxC,KAAK,EAAE,IAAI,CAAC,KAAK,GACjB,EACD,IAAI,CAAC,KAAK,KACT,kFAA2B,YAAY,EAAC,8BAA8B,GAAG,CAC1E,CACI,EACP;KACH;;;;;;;;;;","names":["SearchcraftCore"],"sources":["src/components/searchcraft-auto-search-form/searchcraft-auto-search-form.module.scss?tag=searchcraft-auto-search-form","src/components/searchcraft-auto-search-form/searchcraft-auto-search-form.tsx"],"sourcesContent":[".searchcraft-auto-search-form {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n","import {\n Component,\n Prop,\n State,\n Event,\n type EventEmitter,\n h,\n Element,\n Watch,\n} from '@stencil/core';\n\nimport {\n type SearchcraftConfig,\n SearchcraftCore,\n type SearchcraftResponse,\n} from '@searchcraft/core';\n\nimport { useSearchcraftStore } from '@provider/store';\nimport { parseCustomStyles } from '@utils/utils';\nimport type { ScInputCustomEvent } from '@components/searchcraft-input/searchcraft-input';\n\nimport packageJson from '../../../package.json';\n\n@Component({\n tag: 'searchcraft-auto-search-form',\n styleUrl: 'searchcraft-auto-search-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftAutoSearchForm {\n @Prop() autoSearchFormClass = '';\n @Prop() clearInput: () => void = () => {};\n @Prop() config: SearchcraftConfig | undefined;\n @Prop() customStylesForInput: string | Record<string, string> = {};\n @Prop() inputCaptionValue = '';\n @Prop() labelForInput = '';\n @Prop() placeholderValue = 'Search here';\n @Prop() searchContainerClass = '';\n\n @Event() inputClearedOrNoResults: EventEmitter<void>;\n @Event() querySubmit: EventEmitter<string>;\n\n @State() error = false;\n @State() isRequesting = false;\n @State() query = '';\n @State() searchResults: SearchcraftResponse | null = null;\n\n @Element() element: HTMLElement;\n\n private debounceTimeout: ReturnType<typeof setTimeout> | null = null;\n private debounceDelay = 0;\n private searchStore = useSearchcraftStore.getState();\n unsubscribe: () => void;\n\n init() {\n if (this.config) {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n\n this.unsubscribe?.();\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n this.isRequesting = state.isRequesting;\n this.searchResults = { ...state.searchResults };\n });\n }\n }\n\n componentDidLoad() {\n this.init();\n }\n\n @Watch('config')\n onConfigChange() {\n this.init();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n }\n\n handleInputChange = (event: ScInputCustomEvent<string>) => {\n const target = event.detail;\n if (target === this.query) {\n return;\n }\n this.query = target;\n\n const performSearchActions = () => {\n if (this.query.trim() === '') {\n this.searchStore.setQuery('');\n this.searchResults = null;\n this.searchStore.setSearchResults(null);\n this.inputClearedOrNoResults.emit();\n } else {\n this.searchStore.setQuery(this.query);\n this.querySubmit.emit();\n this.runSearch();\n }\n };\n\n // Only set a timeout if debounceDelay > 0\n if (this.debounceDelay > 0) {\n if (this.debounceTimeout) {\n clearTimeout(this.debounceTimeout);\n }\n this.debounceTimeout = setTimeout(\n performSearchActions,\n this.debounceDelay,\n );\n } else {\n // Otherwise just call search actions directly\n performSearchActions();\n }\n };\n\n handleClearInput = () => {\n if (this.query === '' && !this.searchResults) {\n return;\n }\n this.query = '';\n this.searchResults = null;\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n\n if (typeof this.clearInput === 'function') {\n this.clearInput();\n }\n\n if (this.debounceTimeout) {\n clearTimeout(this.debounceTimeout);\n }\n\n this.error = false;\n this.inputClearedOrNoResults.emit();\n };\n\n private runSearch = async () => {\n if (this.query.trim() === '') {\n this.error = true;\n this.inputClearedOrNoResults.emit();\n } else {\n this.error = false;\n this.searchStore.setQuery(this.query);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n this.error = true;\n this.inputClearedOrNoResults.emit();\n }\n }\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.runSearch();\n };\n\n render() {\n const parsedCustomStyles = parseCustomStyles(this.customStylesForInput);\n return (\n <form\n class='searchcraft-auto-search-form'\n onSubmit={this.handleFormSubmit}\n >\n <searchcraft-input-label label={this.labelForInput} />\n <searchcraft-input\n customStyles={parsedCustomStyles}\n input-caption-value={this.inputCaptionValue}\n is-requesting={this.isRequesting}\n onClearInput={this.handleClearInput}\n onInputChange={this.handleInputChange.bind(this)}\n placeholder-value={this.placeholderValue}\n query={this.query}\n />\n {this.error && (\n <searchcraft-error-message errorMessage='Please enter a search query.' />\n )}\n </form>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { p as packageJson } from './package-82baadd7.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-921fe029.js';
|
|
2
|
+
import { u as useSearchcraftStore, a as useThemeStore, i as ie } from './store-8d82e948.js';
|
|
3
|
+
import { p as packageJson } from './package-e62ac63a.js';
|
|
5
4
|
|
|
6
|
-
const searchcraftBaseSearchFormModuleCss = ":root{--
|
|
5
|
+
const searchcraftBaseSearchFormModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-base-search-form-input-container{align-items:center;display:flex;gap:8px}";
|
|
7
6
|
const SearchcraftBaseSearchFormStyle0 = searchcraftBaseSearchFormModuleCss;
|
|
8
7
|
|
|
9
8
|
const SearchcraftBaseSearchForm = class {
|
|
@@ -46,19 +45,17 @@ const SearchcraftBaseSearchForm = class {
|
|
|
46
45
|
readKey: '',
|
|
47
46
|
endpointURL: '',
|
|
48
47
|
index: [],
|
|
49
|
-
organizationId: '',
|
|
50
|
-
applicationId: '',
|
|
51
48
|
};
|
|
52
49
|
this.errorMessage = 'Search was unsuccessful';
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
50
|
+
this.inputLabel = 'Search';
|
|
51
|
+
this.buttonLabel = 'Find';
|
|
52
|
+
this.buttonPlacement = 'right';
|
|
55
53
|
this.error = false;
|
|
56
54
|
this.query = '';
|
|
57
55
|
this.searchResults = null;
|
|
58
56
|
}
|
|
59
57
|
render() {
|
|
60
|
-
|
|
61
|
-
return (h("form", { key: '7a0640c6646a1eefda23ceb1623a72b457be648a', class: classNames(`${formClass}`, 'searchcraft-base-search-form'), onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '33d98e7db9af81170cb693b1f89a38da0a8234e7', label: this.labelForInput }), h("div", { key: '8764b5abbc5008d46bdd8b60b95558252ad6999c', class: classNames('searchContainer', 'searchcraft-base-search-form-input-container') }, this.rightToLeftOrientation && h("searchcraft-button", { key: 'c2a008f5da3bae24bd7417245c4e0df0aa73fd7c' }), h("searchcraft-input", { key: 'dad6c9c1e37ff05a8f032ad3f63ddb1ec234d2e5', onClearInput: this.handleClearInput, onSearchInputChange: this.handleSearchInputChange, query: this.query, rightToLeftOrientation: this.rightToLeftOrientation }), !this.rightToLeftOrientation && (h("searchcraft-button", { key: '2f2a75da81103e3435cbf3337daf605010167339', onButtonClick: this.handleFormSubmit }))), this.error && (h("searchcraft-error-message", { key: '8477fb8f5c3662587e318d8d7c9e1bbd3b7d86a5', errorMessage: this.errorMessage }))));
|
|
58
|
+
return (h("form", { key: '3200182783a9612326e4350beda3e0facc3abd83', class: 'searchcraft-base-search-form', onSubmit: this.handleFormSubmit }, h("searchcraft-input-label", { key: '51fbd74cab7f82435b21edcee9855fe570199d5a', label: this.inputLabel }), h("div", { key: '245a6e8fd2abf14f379e8dee9a2012a7a0fa7636', class: 'searchcraft-base-search-form-input-container' }, this.buttonPlacement === 'left' && (h("searchcraft-button", { key: '53b09c93f5ebaf548b6954923eaa5eb0e8c6ba18', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), h("searchcraft-input", { key: 'b8154b313b93cbd043bf141bdb505f8fc874428b', onClearInput: this.handleClearInput, onInputChange: this.handleSearchInputChange, query: this.query }), this.buttonPlacement === 'right' && (h("searchcraft-button", { key: '534fbb59f038a670f2a65293fa5dd6a9a3cba92d', onButtonClick: this.handleFormSubmit, label: this.buttonLabel }))), this.error && (h("searchcraft-error-message", { key: '8ed98aa322c4104346ac3dcb578133d8e2758866', errorMessage: this.errorMessage }))));
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
61
|
SearchcraftBaseSearchForm.style = SearchcraftBaseSearchFormStyle0;
|
|
@@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E,CAAC;YAChB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,EAAE,CAAC;SACpB,CAAC;QAEF,gBAAW,GAAG;YACZ,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;SAC/B,CAAC;sBAlDkC;YAClC,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;SACV;4BACsB,yBAAyB;0BAC3B,QAAQ;2BACP,MAAM;+BACgB,OAAO;qBAIlC,KAAK;qBACL,EAAE;6BACqB,IAAI;;IAsC5C,MAAM;QACJ,QACE,6DACE,KAAK,EAAC,8BAA8B,EACpC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,IAE/B,gFAAyB,KAAK,EAAE,IAAI,CAAC,UAAU,GAAI,EACnD,4DAAK,KAAK,EAAC,8CAA8C,IACtD,IAAI,CAAC,eAAe,KAAK,MAAM,KAC9B,2EACE,aAAa,EAAE,IAAI,CAAC,gBAAgB,EACpC,KAAK,EAAE,IAAI,CAAC,WAAW,GACvB,CACH,EACD,0EACE,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,aAAa,EAAE,IAAI,CAAC,uBAAuB,EAC3C,KAAK,EAAE,IAAI,CAAC,KAAK,GACjB,EACD,IAAI,CAAC,eAAe,KAAK,OAAO,KAC/B,2EACE,aAAa,EAAE,IAAI,CAAC,gBAAgB,EACpC,KAAK,EAAE,IAAI,CAAC,WAAW,GACvB,CACH,CACG,EACL,IAAI,CAAC,KAAK,KACT,kFAA2B,YAAY,EAAE,IAAI,CAAC,YAAY,GAAI,CAC/D,CACI,EACP;KACH;;;;;;","names":["SearchcraftCore"],"sources":["src/components/searchcraft-base-search-form/searchcraft-base-search-form.module.scss?tag=searchcraft-base-search-form","src/components/searchcraft-base-search-form/searchcraft-base-search-form.tsx"],"sourcesContent":[".searchcraft-base-search-form {\n\n}\n\n.searchcraft-base-search-form-input-container {\n align-items: center;\n display: flex;\n gap: 8px;\n}","import { Component, h, Event, Prop, State } from '@stencil/core';\n\nimport { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\n\nimport { useSearchcraftStore, useThemeStore } from '@provider/store';\n\nimport type { ScInputCustomEvent } from '@components/searchcraft-input/searchcraft-input';\n\nimport packageJson from '../../../package.json';\n\n@Component({\n tag: 'searchcraft-base-search-form',\n styleUrl: 'searchcraft-base-search-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchForm {\n @Prop() config: SearchcraftConfig = {\n readKey: '',\n endpointURL: '',\n index: [],\n };\n @Prop() errorMessage = 'Search was unsuccessful';\n @Prop() inputLabel = 'Search';\n @Prop() buttonLabel = 'Find';\n @Prop() buttonPlacement: 'right' | 'left' = 'right';\n\n @Event() clearInput = () => {};\n\n @State() error = false;\n @State() query = '';\n @State() searchResults: string | null = null;\n\n private searchStore = useSearchcraftStore.getState();\n private themeStore = useThemeStore.getState();\n\n componentDidLoad = () => {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n };\n\n handleFormSubmit = async (event) => {\n event.preventDefault();\n if (this.query.trim() === '') {\n this.error = true;\n } else {\n this.error = false;\n this.searchStore.setQuery(this.query);\n await this.searchStore.search();\n this.searchResults = JSON.stringify(this.searchStore.searchResults);\n }\n };\n\n handleSearchInputChange = (event: ScInputCustomEvent<string>) => {\n this.query = event.detail;\n };\n\n handleClearInput = () => {\n this.query = '';\n this?.clearInput();\n };\n\n toggleTheme = () => {\n this.themeStore.toggleTheme();\n };\n\n render() {\n return (\n <form\n class='searchcraft-base-search-form'\n onSubmit={this.handleFormSubmit}\n >\n <searchcraft-input-label label={this.inputLabel} />\n <div class='searchcraft-base-search-form-input-container'>\n {this.buttonPlacement === 'left' && (\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n )}\n <searchcraft-input\n onClearInput={this.handleClearInput}\n onInputChange={this.handleSearchInputChange}\n query={this.query}\n />\n {this.buttonPlacement === 'right' && (\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n )}\n </div>\n {this.error && (\n <searchcraft-error-message errorMessage={this.errorMessage} />\n )}\n </form>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { r as registerInstance, h, F as Fragment } from './index-921fe029.js';
|
|
2
|
+
import { u as useSearchcraftStore } from './store-8d82e948.js';
|
|
3
|
+
|
|
4
|
+
const searchcraftBaseSearchResultModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-result-container{all:unset;align-items:flex-start;border-radius:16px;display:flex;flex-direction:column;gap:16px;padding:8px;color:inherit;background-color:var(--sc-surface-neutral-primary)}@media (min-width: 900px){.searchcraft-search-result-container{flex-direction:row}}a.searchcraft-search-result-container{cursor:pointer;transition:background-color 100ms}.searchcraft-base-search-result-content-container{flex:1;display:flex;flex-direction:column;gap:8px}.searchcraft-search-result-image{border-radius:var(--sc-image-border-radius);width:100%}@media (min-width: 900px){.searchcraft-search-result-image{width:200px}}.searchcraft-base-search-result-title{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-base-search-result-subtitle{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-disabled)}.searchcraft-base-search-result-body-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-base-search-result-footer-content{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-disabled)}";
|
|
5
|
+
const SearchcraftBaseSearchResultStyle0 = searchcraftBaseSearchResultModuleCss;
|
|
6
|
+
|
|
7
|
+
const SearchcraftBaseSearchResult = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.searchcraftStore = useSearchcraftStore.getState();
|
|
11
|
+
this.recordMeasureEvent = () => {
|
|
12
|
+
var _a, _b, _c;
|
|
13
|
+
const searchcraft = this.searchcraftStore.getSearchcraftInstance();
|
|
14
|
+
if (searchcraft) {
|
|
15
|
+
const document_position = this.documentPosition;
|
|
16
|
+
const search_term = this.searchcraftStore.query;
|
|
17
|
+
const number_of_documents = ((_c = (_b = (_a = this.searchcraftStore.searchResults) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.hits) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
18
|
+
searchcraft.sendMeasureEvent('document_clicked', {
|
|
19
|
+
document_position,
|
|
20
|
+
number_of_documents,
|
|
21
|
+
search_term,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.parseStyles = () => {
|
|
26
|
+
if (this.customStyles) {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(this.customStyles);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('Error parsing custom styles:', error);
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {};
|
|
36
|
+
};
|
|
37
|
+
this.titleContent = undefined;
|
|
38
|
+
this.subtitleContent = undefined;
|
|
39
|
+
this.bodyContent = undefined;
|
|
40
|
+
this.footerContent = undefined;
|
|
41
|
+
this.buttonLabel = undefined;
|
|
42
|
+
this.buttonHref = undefined;
|
|
43
|
+
this.buttonTarget = '_blank';
|
|
44
|
+
this.buttonRel = undefined;
|
|
45
|
+
this.containerHref = undefined;
|
|
46
|
+
this.containerTarget = '_blank';
|
|
47
|
+
this.containerRel = undefined;
|
|
48
|
+
this.imageSrc = undefined;
|
|
49
|
+
this.imageAlt = undefined;
|
|
50
|
+
this.imagePlacement = undefined;
|
|
51
|
+
this.customStyles = undefined;
|
|
52
|
+
this.documentPosition = 0;
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
const styles = this.parseStyles();
|
|
56
|
+
const imageContainer = this.imageSrc && (h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
|
|
57
|
+
const contentContainer = (h(Fragment, null, this.imageSrc && this.imagePlacement === 'left' && imageContainer, h("div", { class: 'searchcraft-base-search-result-content-container' }, this.titleContent && (h("h2", { class: 'searchcraft-base-search-result-title', style: styles.title || {} }, this.titleContent)), this.subtitleContent && (h("h3", { class: 'searchcraft-base-search-result-subtitle', style: styles.subtitle || {} }, this.subtitleContent)), this.bodyContent && (h("p", { class: 'searchcraft-base-search-result-body-content', style: styles.primaryContent || {} }, this.bodyContent)), this.footerContent && (h("p", { class: 'searchcraft-base-search-result-footer-content', style: styles.secondaryContent || {} }, this.footerContent)), this.buttonHref && !this.containerHref && this.buttonLabel && (h("a", { class: 'searchcraft-search-result-button', href: this.buttonHref, style: styles.button || {}, target: this.buttonTarget, rel: this.buttonRel }, this.buttonLabel))), this.imageSrc && this.imagePlacement === 'right' && imageContainer));
|
|
58
|
+
/** Render as an anchor tag if the containerHref prop is present. */
|
|
59
|
+
if (this.containerHref) {
|
|
60
|
+
return (h("a", { class: 'searchcraft-search-result-container', onClick: this.recordMeasureEvent, href: this.containerHref, rel: this.containerRel, style: styles.container || {}, tabindex: '0', target: this.containerTarget }, contentContainer));
|
|
61
|
+
}
|
|
62
|
+
/** Render as a div if no href prop. */
|
|
63
|
+
return (h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
SearchcraftBaseSearchResult.style = SearchcraftBaseSearchResultStyle0;
|
|
67
|
+
|
|
68
|
+
export { SearchcraftBaseSearchResult as searchcraft_base_search_result };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=searchcraft-base-search-result.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"searchcraft-base-search-result.entry.js","mappings":";;;AAAA,MAAM,oCAAoC,GAAG,uvJAAuvJ,CAAC;AACryJ,0CAAe,oCAAoC;;MCOtC,2BAA2B;;;QAkB9B,qBAAgB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAElD,uBAAkB,GAAG;;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;YAEnE,IAAI,WAAW,EAAE;gBACf,MAAM,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC;gBAChD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAA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,EACN;KACH;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.module.scss?tag=searchcraft-base-search-result","src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["\n.searchcraft-search-result-container {\n all: unset;\n align-items: flex-start;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 8px;\n color: inherit;\n\n background-color: var(--sc-surface-neutral-primary);\n\n @media (min-width: 900px) {\n flex-direction: row;\n }\n}\n\na.searchcraft-search-result-container {\n cursor: pointer;\n transition: background-color 100ms;\n}\n\n.searchcraft-base-search-result-content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.searchcraft-search-result-image {\n border-radius: var(--sc-image-border-radius);\n width: 100%;\n\n @media (min-width: 900px) {\n width: 200px;\n }\n}\n\n.searchcraft-base-search-result-title {\n @include body-bold();\n margin: 0;\n color: var(--sc-content-neutral-primary);\n}\n\n.searchcraft-base-search-result-subtitle {\n @include body-small();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n\n.searchcraft-base-search-result-body-content {\n @include body();\n margin: 0;\n color: var(--sc-content-neutral-secondary);\n}\n\n.searchcraft-base-search-result-footer-content {\n @include body();\n margin: 0;\n color: var(--sc-content-disabled);\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-base-search-result',\n styleUrl: 'searchcraft-base-search-result.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n @Prop() titleContent: string | undefined;\n @Prop() subtitleContent: string | undefined;\n @Prop() bodyContent: string | undefined;\n @Prop() footerContent: string | undefined;\n @Prop() buttonLabel: string | undefined;\n @Prop() buttonHref: string | undefined;\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() containerHref: string | undefined;\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() imageSrc: string | undefined;\n @Prop() imageAlt: string | undefined;\n @Prop() imagePlacement: 'left' | 'right';\n @Prop() customStyles: string | undefined;\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-921fe029.js';
|
|
2
|
+
import { u as useSearchcraftStore } from './store-8d82e948.js';
|
|
3
|
+
import { g as getDocumentValueFromSearchResultMapping, s as serializeStyles } from './utils-ee63b542.js';
|
|
4
|
+
|
|
5
|
+
const searchcraftBaseSearchResultsModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-ad-section{align-items:center;background-color:#F1F1F1;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;min-height:176px;text-align:center}.searchcraft-ad-section p{margin:0;color:var(--sc-content-disabled)}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}";
|
|
6
|
+
const SearchcraftBaseSearchResultsStyle0 = searchcraftBaseSearchResultsModuleCss;
|
|
7
|
+
|
|
8
|
+
const SearchcraftBaseSearchResults = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.noResults = createEvent(this, "noResults", 7);
|
|
12
|
+
this.adInterval = 4;
|
|
13
|
+
this.customStylesForResults = undefined;
|
|
14
|
+
this.searchResultMappings = undefined;
|
|
15
|
+
this.placeAdAtEnd = false;
|
|
16
|
+
this.placeAdAtStart = true;
|
|
17
|
+
this.resultImagePlacement = 'right';
|
|
18
|
+
this.buttonLabel = undefined;
|
|
19
|
+
this.buttonTarget = '_blank';
|
|
20
|
+
this.buttonRel = undefined;
|
|
21
|
+
this.containerTarget = '_blank';
|
|
22
|
+
this.containerRel = undefined;
|
|
23
|
+
this.hasSearched = false;
|
|
24
|
+
this.query = '';
|
|
25
|
+
this.searchResults = null;
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
29
|
+
if (state.query.length > 0) {
|
|
30
|
+
this.hasSearched = true;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.hasSearched = false;
|
|
34
|
+
}
|
|
35
|
+
this.searchResults = Object.assign({}, state.searchResults);
|
|
36
|
+
this.query = state.query;
|
|
37
|
+
});
|
|
38
|
+
const { searchResults, query } = useSearchcraftStore.getState();
|
|
39
|
+
this.searchResults = searchResults;
|
|
40
|
+
this.query = query;
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
if (this.unsubscribe) {
|
|
44
|
+
this.unsubscribe();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
renderDocument(document, index) {
|
|
48
|
+
/**
|
|
49
|
+
* Index field values -> Result container props mappings.
|
|
50
|
+
*/
|
|
51
|
+
const titleContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.title);
|
|
52
|
+
const subtitleContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.subtitle);
|
|
53
|
+
const bodyContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.body);
|
|
54
|
+
const containerHref = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.containerHref);
|
|
55
|
+
const buttonHref = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.buttonHref);
|
|
56
|
+
const imageSource = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.imageSource);
|
|
57
|
+
const footerContent = getDocumentValueFromSearchResultMapping(document, this.searchResultMappings.footer);
|
|
58
|
+
const serializedStyles = typeof this.customStylesForResults === 'string'
|
|
59
|
+
? this.customStylesForResults
|
|
60
|
+
: serializeStyles(this.customStylesForResults);
|
|
61
|
+
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 }));
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
65
|
+
if (this.query.trim() === '') {
|
|
66
|
+
return (h("div", { class: 'searchcraft-search-results-empty-state-container' }, h("slot", { name: 'empty-search' })));
|
|
67
|
+
}
|
|
68
|
+
if (!((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const documents = (_d = (_c = (_b = this.searchResults) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.hits) === null || _d === void 0 ? void 0 : _d.map((data, _index) => {
|
|
72
|
+
const { doc: result } = data;
|
|
73
|
+
return result;
|
|
74
|
+
});
|
|
75
|
+
const finalComponents = [];
|
|
76
|
+
if (this.placeAdAtStart) {
|
|
77
|
+
finalComponents.push(h("div", { key: 'ad-section-start', class: 'searchcraft-ad-section' }, h("p", null, "Ad Section")));
|
|
78
|
+
}
|
|
79
|
+
if (this.adInterval > 0) {
|
|
80
|
+
documents.forEach((document, index) => {
|
|
81
|
+
finalComponents.push(this.renderDocument(document, index));
|
|
82
|
+
if ((index + 1) % this.adInterval === 0) {
|
|
83
|
+
finalComponents.push(h("div", { key: `ad-section-${index + 1}`, class: 'searchcraft-ad-section ' }, h("p", null, "Ad Section")));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const documentElements = documents.map((document, index) => this.renderDocument(document, index));
|
|
89
|
+
finalComponents.push(...documentElements);
|
|
90
|
+
}
|
|
91
|
+
if (this.placeAdAtEnd) {
|
|
92
|
+
finalComponents.push(h("div", { key: 'ad-section-end', class: 'searchcraft-ad-section' }, h("p", null, "Ad Section")));
|
|
93
|
+
}
|
|
94
|
+
if (this.query.length > 0 && ((_g = (_f = (_e = this.searchResults) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.hits) === null || _g === void 0 ? void 0 : _g.length) === 0) {
|
|
95
|
+
this.noResults.emit();
|
|
96
|
+
}
|
|
97
|
+
return (h("div", { class: 'searchcraft-search-results-container' }, finalComponents, this.query.length > 0 &&
|
|
98
|
+
((_k = (_j = (_h = this.searchResults) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.hits) === null || _k === void 0 ? void 0 : _k.length) === 0 && (h("div", { class: 'searchcraft-search-results-error-message-container' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.query}" query` })))));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
SearchcraftBaseSearchResults.style = SearchcraftBaseSearchResultsStyle0;
|
|
102
|
+
|
|
103
|
+
export { SearchcraftBaseSearchResults as searchcraft_base_search_results };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=searchcraft-base-search-results.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"searchcraft-base-search-results.entry.js","mappings":";;;;AAAA,MAAM,qCAAqC,GAAG,qhHAAqhH,CAAC;AACpkH,2CAAe,qCAAqC;;MCuBvC,4BAA4B;;;;0BAClB,CAAC;;;4BAMC,KAAK;8BACH,IAAI;oCACoB,OAAO;;4BAEQ,QAAQ;;+BAEL,QAAQ;;2BAKpD,KAAK;qBACX,EAAE;6BACkC,IAAI;;IAIzD,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;YACrD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aACzB;iBAAM;gBACL,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;aAC1B;YACD,IAAI,CAAC,aAAa,qBAAQ,KAAK,CAAC,aAAa,CAAE,CAAC;YAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;SAC1B,CAAC,CAAC;QAEH,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;QAChE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC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,CAAC;SACJ;aAAM;YACL,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KACrD,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CAAC;YACF,eAAe,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC;SAC3C;QAED,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,eAAe,CAAC,IAAI,CAClB,WAAK,GAAG,EAAC,gBAAgB,EAAC,KAAK,EAAC,wBAAwB,IACtD,0BAAiB,CACb,CACP,CAAC;SACH;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,EAAE;YACzE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACvB;QAED,QACE,WAAK,KAAK,EAAC,sCAAsC,IAC9C,eAAe,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YACpB,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,IAAI,0CAAE,MAAM,MAAK,CAAC,KAC1C,WAAK,KAAK,EAAC,oDAAoD,IAC7D,kDACiB,gCAAgC,IAAI,CAAC,KAAK,SAAS,GAClE,CACE,CACP,CACC,EACN;KACH;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-results/searchcraft-base-search-results.module.scss?tag=searchcraft-base-search-results","src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"sourcesContent":[".searchcraft-search-results-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n}\n\n.searchcraft-ad-section {\n align-items: center;\n background-color: #F1F1F1;\n border-radius: 16px;\n display: flex;\n flex-direction: column;\n font-size: 16px;\n justify-content: center;\n min-height: 176px;\n text-align: center;\n\n p {\n margin: 0;\n color: var(--sc-content-disabled);\n }\n}\n\n.searchcraft-search-results-empty-state-container {\n text-align: center;\n}\n\n.searchcraft-search-results-error-message-container {\n text-align: center;\n}\n","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/utils';\nimport type { SearchResultMappings } from 'types';\n\n@Component({\n tag: 'searchcraft-base-search-results',\n styleUrl: 'searchcraft-base-search-results.module.scss',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n @Prop() adInterval = 4;\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n @Prop() placeAdAtEnd = false;\n @Prop() placeAdAtStart = true;\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n @Prop() buttonLabel: string | undefined;\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\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 };\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 const serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\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 });\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"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-921fe029.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
3
|
|
|
4
|
-
const searchcraftButtonModuleCss = ":root{--
|
|
4
|
+
const searchcraftButtonModuleCss = ":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-button{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-bold-font-size);font-weight:var(--sc-body-bold-font-weight);line-height:var(--sc-body-bold-line-height);border-radius:8px;display:flex;padding:12px 20px;position:relative;background-color:var(--sc-surface-brand-primary);border:1px solid var(--sc-border-primary);color:var(--sc-content-brand-on-primary)}.searchcraft-button:hover{cursor:pointer;background-color:var(--sc-surface-brand-primary-hover)}.searchcraft-button:focus{outline:2px solid var(--sc-surface-brand-primary)}.buttonLabel{position:relative}";
|
|
5
5
|
const SearchcraftButtonStyle0 = searchcraftButtonModuleCss;
|
|
6
6
|
|
|
7
7
|
const SearchcraftButton = class {
|
|
@@ -16,14 +16,9 @@ const SearchcraftButton = class {
|
|
|
16
16
|
this.iconPosition = 'left';
|
|
17
17
|
this.label = 'Search';
|
|
18
18
|
this.isRequesting = false;
|
|
19
|
-
this.theme = 'light';
|
|
20
|
-
}
|
|
21
|
-
getButtonStyle() {
|
|
22
|
-
return this.theme === 'light' ? 'buttonLight' : 'buttonDark';
|
|
23
19
|
}
|
|
24
20
|
render() {
|
|
25
|
-
|
|
26
|
-
return (h(Fragment, { key: '1c0e279606587cb454892dad1634f4a60dd42757' }, this.iconOnly ? (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (h("button", { class: classNames(buttonStyle, 'searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.iconElement, h("span", { class: classNames('buttonLabel', 'searchcraft-button-label') }, this.label)))));
|
|
21
|
+
return (h(Fragment, { key: '9310049798538e49e52a11b846aec6a57d4ddd58' }, this.iconOnly ? (h("button", { class: classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.isRequesting ? (h("searchcraft-spinner-dark", null)) : (this.iconElement))) : (h("button", { class: classNames('searchcraft-button'), onClick: this.handleClick, type: 'submit' }, this.iconPosition === 'left' && this.iconElement, h("span", { class: classNames('buttonLabel', 'searchcraft-button-label') }, this.label)))));
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
24
|
SearchcraftButton.style = SearchcraftButtonStyle0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-button.entry.js","mappings":";;;AAAA,MAAM,0BAA0B,GAAG
|
|
1
|
+
{"file":"searchcraft-button.entry.js","mappings":";;;AAAA,MAAM,0BAA0B,GAAG,soHAAsoH,CAAC;AAC1qH,gCAAe,0BAA0B;;MCe5B,iBAAiB;;;;QAUpB,gBAAW,GAAG;YACpB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;SACzB,CAAC;;wBAViB,KAAK;4BACD,MAAM;qBACb,QAAQ;4BAIA,KAAK;;IAM7B,MAAM;QACJ,QACE,EAAC,QAAQ,uDACN,IAAI,CAAC,QAAQ,IACZ,cACE,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,IAChB,mCAA4B,KAE5B,IAAI,CAAC,WAAW,CACjB,CACM,KAET,cACE,KAAK,EAAE,UAAU,CAAC,oBAAoB,CAAC,EACvC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAC,QAAQ,IAEZ,IAAI,CAAC,YAAY,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EACjD,YAAM,KAAK,EAAE,UAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,IAC/D,IAAI,CAAC,KAAK,CACN,CACA,CACV,CACQ,EACX;KACH;;;;;;","names":[],"sources":["src/components/searchcraft-button/searchcraft-button.module.scss?tag=searchcraft-button","src/components/searchcraft-button/searchcraft-button.tsx"],"sourcesContent":[".searchcraft-button {\n @include body-bold;\n\n border-radius: 8px;\n display: flex;\n padding: 12px 20px;\n position: relative;\n\n background-color: var(--sc-surface-brand-primary);\n border: 1px solid var(--sc-border-primary);\n color: var(--sc-content-brand-on-primary);\n\n &:hover {\n cursor: pointer;\n background-color: var(--sc-surface-brand-primary-hover);\n }\n\n &:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n }\n}\n\n.buttonLabel {\n position: relative;\n}","import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n State,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n@Component({\n tag: 'searchcraft-button',\n styleUrl: 'searchcraft-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftButton {\n @Prop() iconElement?: Element;\n @Prop() iconOnly = false;\n @Prop() iconPosition = 'left';\n @Prop() label = 'Search';\n\n @Event() buttonClick!: EventEmitter<void>;\n\n @State() isRequesting = false;\n\n private handleClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <Fragment>\n {this.iconOnly ? (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.isRequesting ? (\n <searchcraft-spinner-dark />\n ) : (\n this.iconElement\n )}\n </button>\n ) : (\n <button\n class={classNames('searchcraft-button')}\n onClick={this.handleClick}\n type='submit'\n >\n {this.iconPosition === 'left' && this.iconElement}\n <span class={classNames('buttonLabel', 'searchcraft-button-label')}>\n {this.label}\n </span>\n </button>\n )}\n </Fragment>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { r as registerInstance, h } from './index-921fe029.js';
|
|
2
|
+
|
|
3
|
+
const SearchcraftCheckIcon = class {
|
|
4
|
+
constructor(hostRef) {
|
|
5
|
+
registerInstance(this, hostRef);
|
|
6
|
+
}
|
|
7
|
+
render() {
|
|
8
|
+
return (h("svg", { key: '3db200942b79612a38293544a029c6854dfa4beb', width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' }, h("title", { key: 'b7b6af8651edb5cc0e054ed775b9029c6c93535e' }, "Checkbox Check"), h("path", { key: '7c74edc45f007245e4c6e4fd5d37dbc6dad20de0', d: 'M13.9999 2L5.74988 10L1.99988 6.36364', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round', "stroke-linejoin": 'round' })));
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SearchcraftDashIcon = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
registerInstance(this, hostRef);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return (h("svg", { key: '4d0c3ab69a973ec8b1d89f52082e4b98ce17e39d', width: '14', height: '3', viewBox: '0 0 14 3', fill: 'none' }, h("title", { key: '99a099dcd6a163ba5b8c1f5b80f9ebfde2152778' }, "Checkbox Dash"), h("line", { key: '49f030f69ff1d37139f868ffb94b5f24442dce37', x1: '1.5', y1: '1.5', x2: '12.5', y2: '1.5', stroke: 'white', "stroke-width": '3', "stroke-linecap": 'round' })));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { SearchcraftCheckIcon as searchcraft_check_icon, SearchcraftDashIcon as searchcraft_dash_icon };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=searchcraft-check-icon_2.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"searchcraft-check-icon.searchcraft-dash-icon.entry.js","mappings":";;MAMa,oBAAoB;;;;IAC/B,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,IACzD,iFAA6B,EAC7B,6DACE,CAAC,EAAC,uCAAuC,EACzC,MAAM,EAAC,OAAO,kBACD,GAAG,oBACD,OAAO,qBACN,OAAO,GACvB,CACE,EACN;KACH;;;MCdU,mBAAmB;;;;IAC9B,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,GAAG,EAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM,IACvD,gFAA4B,EAC5B,6DACE,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,KAAK,EACR,EAAE,EAAC,MAAM,EACT,EAAE,EAAC,KAAK,EACR,MAAM,EAAC,OAAO,kBACD,GAAG,oBACD,OAAO,GACtB,CACE,EACN;KACH;;;;;","names":[],"sources":["src/assets/searchcraft-check-icon.tsx","src/assets/searchcraft-dash-icon.tsx"],"sourcesContent":["import { Component, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-check-icon',\n shadow: true,\n})\nexport class SearchcraftCheckIcon {\n render() {\n return (\n <svg width='16' height='16' viewBox='0 0 16 16' fill='none'>\n <title>Checkbox Check</title>\n <path\n d='M13.9999 2L5.74988 10L1.99988 6.36364'\n stroke='white'\n stroke-width='3'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n );\n }\n}\n","import { Component, h } from '@stencil/core';\n\n@Component({\n tag: 'searchcraft-dash-icon',\n shadow: true,\n})\nexport class SearchcraftDashIcon {\n render() {\n return (\n <svg width='14' height='3' viewBox='0 0 14 3' fill='none'>\n <title>Checkbox Dash</title>\n <line\n x1='1.5'\n y1='1.5'\n x2='12.5'\n y2='1.5'\n stroke='white'\n stroke-width='3'\n stroke-linecap='round'\n />\n </svg>\n );\n }\n}\n"],"version":3}
|