@searchcraft/javascript-sdk 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -37
- package/dist/components/defineCustomElements.d.ts +1 -0
- package/dist/components/defineCustomElements.js +46 -0
- package/dist/components/index.d.ts +44 -11
- package/dist/components/index.js +104 -53
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-05872320.js +1462 -0
- package/dist/components/p-05872320.js.map +1 -0
- package/dist/components/{p-433f974c.js → p-11b05b94.js} +5 -5
- package/dist/components/p-11b05b94.js.map +1 -0
- package/dist/components/{p-6e2eef88.js → p-3026f7d3.js} +17 -126
- package/dist/components/p-3026f7d3.js.map +1 -0
- package/dist/components/{p-ec0d230e.js → p-3568414f.js} +4 -4
- package/dist/components/p-3568414f.js.map +1 -0
- package/dist/{cjs/SearchcraftStore-75fac5e0.js → components/p-6d8b0ead.js} +1408 -1350
- package/dist/components/p-6d8b0ead.js.map +1 -0
- package/dist/components/{p-fc7cda96.js → p-7777d986.js} +4 -4
- package/dist/components/{p-fc7cda96.js.map → p-7777d986.js.map} +1 -1
- package/dist/components/p-b0bc5cee.js +102 -0
- package/dist/components/p-b0bc5cee.js.map +1 -0
- package/dist/components/{p-4e9cd62e.js → p-bb12ab5a.js} +3 -3
- package/dist/components/{p-4e9cd62e.js.map → p-bb12ab5a.js.map} +1 -1
- package/dist/components/{p-97332d3e.js → p-cd9ba361.js} +3 -3
- package/dist/components/p-cd9ba361.js.map +1 -0
- package/dist/components/searchcraft-ad.d.ts +11 -0
- package/dist/components/searchcraft-ad.js +8 -0
- package/dist/components/searchcraft-ad.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +79 -29
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +7 -7
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-pagination.js +2 -2
- package/dist/components/searchcraft-pagination.js.map +1 -1
- package/dist/components/searchcraft-popover-button.js +3 -3
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +28 -35
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +2 -2
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-search-results-per-page.js +3 -3
- package/dist/components/searchcraft-search-results-per-page.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.js +1 -1
- package/dist/components/searchcraft-theme.js.map +1 -1
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/types/components/searchcraft-ad/searchcraft-ad.d.ts +19 -0
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +10 -7
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +1 -1
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +4 -29
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +1 -11
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +4 -0
- package/dist/types/components.d.ts +33 -158
- package/dist/types/index.d.ts +10 -1
- package/dist/types/store/SearchcraftStore.d.ts +4 -0
- package/dist/types/{provider → store}/SearchcraftStore.types.d.ts +2 -1
- package/dist/{collection/provider/store.js → types/store/index.d.ts} +2 -2
- package/package.json +8 -17
- package/dist/cjs/SearchcraftStore-75fac5e0.js.map +0 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-5b0b9d4c.js +0 -84
- package/dist/cjs/index-5b0b9d4c.js.map +0 -1
- package/dist/cjs/index-a81df4f0.js +0 -1577
- package/dist/cjs/index-a81df4f0.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -14
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -17
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js +0 -152
- package/dist/cjs/searchcraft-base-search-result_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +0 -97
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +0 -88
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +0 -393
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +0 -113
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +0 -260
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +0 -27
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +0 -1
- package/dist/cjs/searchcraft-pagination.cjs.entry.js +0 -106
- package/dist/cjs/searchcraft-pagination.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js +0 -22
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js +0 -234
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js +0 -101
- package/dist/cjs/searchcraft-popover-list-item_2.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +0 -80
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js +0 -75
- package/dist/cjs/searchcraft-search-results-per-page.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-select.cjs.entry.js +0 -70
- package/dist/cjs/searchcraft-select.cjs.entry.js.map +0 -1
- package/dist/cjs/searchcraft-theme.cjs.entry.js +0 -56
- package/dist/cjs/searchcraft-theme.cjs.entry.js.map +0 -1
- package/dist/cjs/styles-7b2d06f2.js +0 -28
- package/dist/cjs/styles-7b2d06f2.js.map +0 -1
- package/dist/cjs/units-fe4d8083.js +0 -88
- package/dist/cjs/units-fe4d8083.js.map +0 -1
- package/dist/collection/collection-manifest.json +0 -32
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +0 -302
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js +0 -73
- package/dist/collection/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +0 -313
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +0 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +0 -217
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +0 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +0 -44
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +0 -1
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +0 -200
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +0 -1
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +0 -149
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +0 -1
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +0 -443
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +0 -1
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +0 -67
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +0 -1
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js +0 -141
- package/dist/collection/components/searchcraft-pagination/searchcraft-pagination.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +0 -15
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +0 -381
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +0 -128
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js +0 -73
- package/dist/collection/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.js.map +0 -1
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +0 -141
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +0 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +0 -138
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +0 -1
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js +0 -129
- package/dist/collection/components/searchcraft-search-results-per-page/searchcraft-search-results-per-page.js.map +0 -1
- package/dist/collection/components/searchcraft-select/searchcraft-select.js +0 -261
- package/dist/collection/components/searchcraft-select/searchcraft-select.js.map +0 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +0 -194
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +0 -1
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +0 -97
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +0 -1
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +0 -118
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +0 -1
- package/dist/collection/index.js +0 -3
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/provider/SearchcraftStore.js +0 -160
- package/dist/collection/provider/SearchcraftStore.js.map +0 -1
- package/dist/collection/provider/SearchcraftStore.types.js +0 -2
- package/dist/collection/provider/SearchcraftStore.types.js.map +0 -1
- package/dist/collection/provider/store.js.map +0 -1
- package/dist/collection/utils/facets.js +0 -128
- package/dist/collection/utils/facets.js.map +0 -1
- package/dist/collection/utils/index.js +0 -4
- package/dist/collection/utils/index.js.map +0 -1
- package/dist/collection/utils/styles.js +0 -22
- package/dist/collection/utils/styles.js.map +0 -1
- package/dist/collection/utils/units.js +0 -83
- package/dist/collection/utils/units.js.map +0 -1
- package/dist/components/p-25ee7496.js +0 -58
- package/dist/components/p-25ee7496.js.map +0 -1
- package/dist/components/p-38419178.js +0 -1625
- package/dist/components/p-38419178.js.map +0 -1
- package/dist/components/p-433f974c.js.map +0 -1
- package/dist/components/p-6e2eef88.js.map +0 -1
- package/dist/components/p-97332d3e.js.map +0 -1
- package/dist/components/p-bff4d3fc.js +0 -65
- package/dist/components/p-bff4d3fc.js.map +0 -1
- package/dist/components/p-de4a48b1.js +0 -65
- package/dist/components/p-de4a48b1.js.map +0 -1
- package/dist/components/p-ec0d230e.js.map +0 -1
- package/dist/components/searchcraft-base-search-result-ad.d.ts +0 -11
- package/dist/components/searchcraft-base-search-result-ad.js +0 -8
- package/dist/components/searchcraft-base-search-result-ad.js.map +0 -1
- package/dist/components/searchcraft-popover-list-item-ad.d.ts +0 -11
- package/dist/components/searchcraft-popover-list-item-ad.js +0 -8
- package/dist/components/searchcraft-popover-list-item-ad.js.map +0 -1
- package/dist/esm/SearchcraftStore-3cfd565a.js +0 -1625
- package/dist/esm/SearchcraftStore-3cfd565a.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-3608c57d.js +0 -1548
- package/dist/esm/index-3608c57d.js.map +0 -1
- package/dist/esm/index-72ac5051.js +0 -82
- package/dist/esm/index-72ac5051.js.map +0 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js +0 -13
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/searchcraft-base-search-result_2.entry.js +0 -147
- package/dist/esm/searchcraft-base-search-result_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +0 -93
- package/dist/esm/searchcraft-base-search-results.entry.js.map +0 -1
- package/dist/esm/searchcraft-button_3.entry.js +0 -82
- package/dist/esm/searchcraft-button_3.entry.js.map +0 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +0 -387
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +0 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +0 -109
- package/dist/esm/searchcraft-filter-panel.entry.js.map +0 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +0 -255
- package/dist/esm/searchcraft-input-form_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-javascript-sdk.js +0 -22
- package/dist/esm/searchcraft-javascript-sdk.js.map +0 -1
- package/dist/esm/searchcraft-pagination.entry.js +0 -102
- package/dist/esm/searchcraft-pagination.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-button.entry.js +0 -18
- package/dist/esm/searchcraft-popover-button.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-form.entry.js +0 -230
- package/dist/esm/searchcraft-popover-form.entry.js.map +0 -1
- package/dist/esm/searchcraft-popover-list-item_2.entry.js +0 -96
- package/dist/esm/searchcraft-popover-list-item_2.entry.js.map +0 -1
- package/dist/esm/searchcraft-results-info.entry.js +0 -76
- package/dist/esm/searchcraft-results-info.entry.js.map +0 -1
- package/dist/esm/searchcraft-search-results-per-page.entry.js +0 -71
- package/dist/esm/searchcraft-search-results-per-page.entry.js.map +0 -1
- package/dist/esm/searchcraft-select.entry.js +0 -66
- package/dist/esm/searchcraft-select.entry.js.map +0 -1
- package/dist/esm/searchcraft-theme.entry.js +0 -52
- package/dist/esm/searchcraft-theme.entry.js.map +0 -1
- package/dist/esm/styles-961644ef.js +0 -25
- package/dist/esm/styles-961644ef.js.map +0 -1
- package/dist/esm/units-daaf96f5.js +0 -84
- package/dist/esm/units-daaf96f5.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -1
- package/dist/loader/index.cjs.js +0 -1
- package/dist/loader/index.d.ts +0 -24
- package/dist/loader/index.es2017.js +0 -1
- package/dist/loader/index.js +0 -2
- package/dist/loader/package.json +0 -11
- package/dist/searchcraft-javascript-sdk/index.esm.js +0 -2
- package/dist/searchcraft-javascript-sdk/index.esm.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-279f3e15.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2bc82b48.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-2dc07b47.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-37842dee.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-38419178.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-38419178.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-3be70f20.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js +0 -7
- package/dist/searchcraft-javascript-sdk/p-5cdc6210.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-5e064c07.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6104fe5d.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-6104fe5d.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-6bffd3f5.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7813f3cc.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7f4dd50c.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-9340f4e4.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-a84b1548.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-b8ea0454.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-c4a9d8ab.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-d9551738.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-d9551738.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e11de2d6.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e1255160.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e1255160.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +0 -2
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +0 -1
- package/dist/types/components/searchcraft-base-search-result-ad/searchcraft-base-search-result-ad.d.ts +0 -14
- package/dist/types/components/searchcraft-popover-list-item-ad/searchcraft-popover-list-item-ad.d.ts +0 -14
- package/dist/types/provider/SearchcraftStore.d.ts +0 -4
- package/dist/types/provider/store.d.ts +0 -3
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
2
|
-
import { useSearchcraftStore } from "../../provider/store";
|
|
3
|
-
import { serializeStyles } from "../../utils/index";
|
|
4
|
-
/**
|
|
5
|
-
* This web component is responsible for displaying the results of a search query.
|
|
6
|
-
* Once a query is submitted, the component formats and presents an ordered list of the results.
|
|
7
|
-
*
|
|
8
|
-
* ## Usage
|
|
9
|
-
* ```html
|
|
10
|
-
* <!-- index.html -->
|
|
11
|
-
* <searchcraft-base-search-results
|
|
12
|
-
* ad-interval="4"
|
|
13
|
-
* place-ad-at-start="false"
|
|
14
|
-
* result-image-placement="right"
|
|
15
|
-
* />
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* ```js
|
|
19
|
-
* // index.js
|
|
20
|
-
* const baseSearchResults = document.querySelector('searchcraft-base-search-results');
|
|
21
|
-
*
|
|
22
|
-
* baseSearchResults.searchResultMappings = containerHref: {
|
|
23
|
-
* fieldNames: [
|
|
24
|
-
* {
|
|
25
|
-
* fieldName: 'canonical_link',
|
|
26
|
-
* dataType: 'text',
|
|
27
|
-
* },
|
|
28
|
-
* ],
|
|
29
|
-
* };
|
|
30
|
-
*
|
|
31
|
-
* baseSearchResults.addEventListener('noResults', () => {
|
|
32
|
-
* console.log('No search results found');
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export class SearchcraftBaseSearchResults {
|
|
37
|
-
/**
|
|
38
|
-
* A custom styles object.
|
|
39
|
-
*/
|
|
40
|
-
customStylesForResults;
|
|
41
|
-
/**
|
|
42
|
-
* Formats the content rendered for each result.
|
|
43
|
-
*/
|
|
44
|
-
searchResultMappings;
|
|
45
|
-
/**
|
|
46
|
-
* The placement of the image for each result.
|
|
47
|
-
*/
|
|
48
|
-
resultImagePlacement = 'right';
|
|
49
|
-
/**
|
|
50
|
-
* The label for the button rendered when containerHref is not present for each result.
|
|
51
|
-
*/
|
|
52
|
-
buttonLabel;
|
|
53
|
-
/**
|
|
54
|
-
* Where to open the link for the button rendered when containerHref is not present for each result.
|
|
55
|
-
*/
|
|
56
|
-
buttonTarget = '_blank';
|
|
57
|
-
/**
|
|
58
|
-
* The relationship between the current document and the link for the button rendered when containerHref is not present for each result.
|
|
59
|
-
*/
|
|
60
|
-
buttonRel;
|
|
61
|
-
/**
|
|
62
|
-
* Where to open the link for the containing element for each result.
|
|
63
|
-
*/
|
|
64
|
-
containerTarget = '_blank';
|
|
65
|
-
/**
|
|
66
|
-
* The relationship between the current document and the link for the containing element for each result.
|
|
67
|
-
*/
|
|
68
|
-
containerRel;
|
|
69
|
-
/**
|
|
70
|
-
* When no results are returned.
|
|
71
|
-
*/
|
|
72
|
-
noResults;
|
|
73
|
-
searchTerm = '';
|
|
74
|
-
searchClientResponseItems = [];
|
|
75
|
-
adClientResponseItems = [];
|
|
76
|
-
searchResultsPerPage;
|
|
77
|
-
searchResultsPage;
|
|
78
|
-
unsubscribe = () => { };
|
|
79
|
-
componentDidLoad() {
|
|
80
|
-
this.unsubscribe = useSearchcraftStore.subscribe((state) => this.handleStateChange(state));
|
|
81
|
-
const currentState = useSearchcraftStore.getState();
|
|
82
|
-
this.searchClientResponseItems = currentState.searchClientResponseItems;
|
|
83
|
-
this.searchTerm = currentState.searchTerm;
|
|
84
|
-
}
|
|
85
|
-
disconnectedCallback() {
|
|
86
|
-
this.unsubscribe?.();
|
|
87
|
-
}
|
|
88
|
-
handleStateChange(state) {
|
|
89
|
-
this.searchClientResponseItems = [...state.searchClientResponseItems];
|
|
90
|
-
this.adClientResponseItems = [...state.adClientResponseItems];
|
|
91
|
-
this.searchTerm = state.searchTerm;
|
|
92
|
-
this.searchResultsPage = state.searchResultsPage;
|
|
93
|
-
this.searchResultsPerPage = state.searchResultsPerPage;
|
|
94
|
-
}
|
|
95
|
-
render() {
|
|
96
|
-
if (this.searchTerm.trim() === '') {
|
|
97
|
-
return (h("div", { class: 'searchcraft-search-results-empty-state-container' }, h("slot", { name: 'empty-search' })));
|
|
98
|
-
}
|
|
99
|
-
if (this.searchClientResponseItems.length === 0) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (this.searchTerm.length > 0 &&
|
|
103
|
-
this.searchClientResponseItems.length === 0) {
|
|
104
|
-
this.noResults?.emit();
|
|
105
|
-
}
|
|
106
|
-
let serializedStyles = '';
|
|
107
|
-
if (this.customStylesForResults) {
|
|
108
|
-
serializedStyles =
|
|
109
|
-
typeof this.customStylesForResults === 'string'
|
|
110
|
-
? this.customStylesForResults
|
|
111
|
-
: serializeStyles(this.customStylesForResults);
|
|
112
|
-
}
|
|
113
|
-
return (h("div", { class: 'searchcraft-search-results-container' }, this.adClientResponseItems?.map((item) => (h("searchcraft-base-search-result-ad", { adClientResponseItem: item, key: item.adId }))), this.searchClientResponseItems?.map((item, index) => (h("searchcraft-base-search-result", { key: item.id, "custom-styles": serializedStyles, "image-placement": this.resultImagePlacement, "container-rel": this.containerRel, "container-target": this.containerTarget, "button-label": this.buttonLabel || 'View more', "button-rel": this.buttonRel, "button-target": this.buttonTarget, "document-position": this.searchResultsPerPage * this.searchResultsPage + index, searchResultMappings: this.searchResultMappings, item: item }))), this.searchTerm.length > 0 &&
|
|
114
|
-
this.searchClientResponseItems.length === 0 && (h("div", { class: 'searchcraft-search-results-error-message-container' }, h("searchcraft-error-message", { "error-message": `No search results found for "${this.searchTerm}" query` })))));
|
|
115
|
-
}
|
|
116
|
-
static get is() { return "searchcraft-base-search-results"; }
|
|
117
|
-
static get properties() {
|
|
118
|
-
return {
|
|
119
|
-
"customStylesForResults": {
|
|
120
|
-
"type": "string",
|
|
121
|
-
"mutable": false,
|
|
122
|
-
"complexType": {
|
|
123
|
-
"original": "| string\n | Record<string, Record<string, string>>\n | undefined",
|
|
124
|
-
"resolved": "string | undefined | { [x: string]: Record<string, string>; }",
|
|
125
|
-
"references": {
|
|
126
|
-
"Record": {
|
|
127
|
-
"location": "global",
|
|
128
|
-
"id": "global::Record"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"required": false,
|
|
133
|
-
"optional": false,
|
|
134
|
-
"docs": {
|
|
135
|
-
"tags": [],
|
|
136
|
-
"text": "A custom styles object."
|
|
137
|
-
},
|
|
138
|
-
"getter": false,
|
|
139
|
-
"setter": false,
|
|
140
|
-
"attribute": "custom-styles-for-results",
|
|
141
|
-
"reflect": false
|
|
142
|
-
},
|
|
143
|
-
"searchResultMappings": {
|
|
144
|
-
"type": "unknown",
|
|
145
|
-
"mutable": false,
|
|
146
|
-
"complexType": {
|
|
147
|
-
"original": "SearchResultMappings | undefined",
|
|
148
|
-
"resolved": "undefined | { body?: SearchResultMapping | undefined; buttonHref?: SearchResultMapping | undefined; containerHref?: SearchResultMapping | undefined; footer?: SearchResultMapping | undefined; imageSource?: SearchResultMapping | undefined; subtitle?: SearchResultMapping | undefined; title?: SearchResultMapping | undefined; }",
|
|
149
|
-
"references": {
|
|
150
|
-
"SearchResultMappings": {
|
|
151
|
-
"location": "import",
|
|
152
|
-
"path": "@searchcraft/core",
|
|
153
|
-
"id": "../core-sdk/dist/index.d.ts::SearchResultMappings"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"required": false,
|
|
158
|
-
"optional": false,
|
|
159
|
-
"docs": {
|
|
160
|
-
"tags": [],
|
|
161
|
-
"text": "Formats the content rendered for each result."
|
|
162
|
-
},
|
|
163
|
-
"getter": false,
|
|
164
|
-
"setter": false
|
|
165
|
-
},
|
|
166
|
-
"resultImagePlacement": {
|
|
167
|
-
"type": "string",
|
|
168
|
-
"mutable": false,
|
|
169
|
-
"complexType": {
|
|
170
|
-
"original": "'left' | 'right'",
|
|
171
|
-
"resolved": "\"left\" | \"right\"",
|
|
172
|
-
"references": {}
|
|
173
|
-
},
|
|
174
|
-
"required": false,
|
|
175
|
-
"optional": false,
|
|
176
|
-
"docs": {
|
|
177
|
-
"tags": [],
|
|
178
|
-
"text": "The placement of the image for each result."
|
|
179
|
-
},
|
|
180
|
-
"getter": false,
|
|
181
|
-
"setter": false,
|
|
182
|
-
"attribute": "result-image-placement",
|
|
183
|
-
"reflect": false,
|
|
184
|
-
"defaultValue": "'right'"
|
|
185
|
-
},
|
|
186
|
-
"buttonLabel": {
|
|
187
|
-
"type": "string",
|
|
188
|
-
"mutable": false,
|
|
189
|
-
"complexType": {
|
|
190
|
-
"original": "string | undefined",
|
|
191
|
-
"resolved": "string | undefined",
|
|
192
|
-
"references": {}
|
|
193
|
-
},
|
|
194
|
-
"required": false,
|
|
195
|
-
"optional": false,
|
|
196
|
-
"docs": {
|
|
197
|
-
"tags": [],
|
|
198
|
-
"text": "The label for the button rendered when containerHref is not present for each result."
|
|
199
|
-
},
|
|
200
|
-
"getter": false,
|
|
201
|
-
"setter": false,
|
|
202
|
-
"attribute": "button-label",
|
|
203
|
-
"reflect": false
|
|
204
|
-
},
|
|
205
|
-
"buttonTarget": {
|
|
206
|
-
"type": "string",
|
|
207
|
-
"mutable": false,
|
|
208
|
-
"complexType": {
|
|
209
|
-
"original": "'_blank' | '_self' | '_top' | '_parent'",
|
|
210
|
-
"resolved": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\"",
|
|
211
|
-
"references": {}
|
|
212
|
-
},
|
|
213
|
-
"required": false,
|
|
214
|
-
"optional": false,
|
|
215
|
-
"docs": {
|
|
216
|
-
"tags": [],
|
|
217
|
-
"text": "Where to open the link for the button rendered when containerHref is not present for each result."
|
|
218
|
-
},
|
|
219
|
-
"getter": false,
|
|
220
|
-
"setter": false,
|
|
221
|
-
"attribute": "button-target",
|
|
222
|
-
"reflect": false,
|
|
223
|
-
"defaultValue": "'_blank'"
|
|
224
|
-
},
|
|
225
|
-
"buttonRel": {
|
|
226
|
-
"type": "string",
|
|
227
|
-
"mutable": false,
|
|
228
|
-
"complexType": {
|
|
229
|
-
"original": "'noreferrer' | 'noopener' | 'nofollow' | undefined",
|
|
230
|
-
"resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\" | undefined",
|
|
231
|
-
"references": {}
|
|
232
|
-
},
|
|
233
|
-
"required": false,
|
|
234
|
-
"optional": false,
|
|
235
|
-
"docs": {
|
|
236
|
-
"tags": [],
|
|
237
|
-
"text": "The relationship between the current document and the link for the button rendered when containerHref is not present for each result."
|
|
238
|
-
},
|
|
239
|
-
"getter": false,
|
|
240
|
-
"setter": false,
|
|
241
|
-
"attribute": "button-rel",
|
|
242
|
-
"reflect": false
|
|
243
|
-
},
|
|
244
|
-
"containerTarget": {
|
|
245
|
-
"type": "string",
|
|
246
|
-
"mutable": false,
|
|
247
|
-
"complexType": {
|
|
248
|
-
"original": "'_blank' | '_self' | '_top' | '_parent'",
|
|
249
|
-
"resolved": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\"",
|
|
250
|
-
"references": {}
|
|
251
|
-
},
|
|
252
|
-
"required": false,
|
|
253
|
-
"optional": false,
|
|
254
|
-
"docs": {
|
|
255
|
-
"tags": [],
|
|
256
|
-
"text": "Where to open the link for the containing element for each result."
|
|
257
|
-
},
|
|
258
|
-
"getter": false,
|
|
259
|
-
"setter": false,
|
|
260
|
-
"attribute": "container-target",
|
|
261
|
-
"reflect": false,
|
|
262
|
-
"defaultValue": "'_blank'"
|
|
263
|
-
},
|
|
264
|
-
"containerRel": {
|
|
265
|
-
"type": "string",
|
|
266
|
-
"mutable": false,
|
|
267
|
-
"complexType": {
|
|
268
|
-
"original": "'noreferrer' | 'noopener' | 'nofollow' | undefined",
|
|
269
|
-
"resolved": "\"nofollow\" | \"noopener\" | \"noreferrer\" | undefined",
|
|
270
|
-
"references": {}
|
|
271
|
-
},
|
|
272
|
-
"required": false,
|
|
273
|
-
"optional": false,
|
|
274
|
-
"docs": {
|
|
275
|
-
"tags": [],
|
|
276
|
-
"text": "The relationship between the current document and the link for the containing element for each result."
|
|
277
|
-
},
|
|
278
|
-
"getter": false,
|
|
279
|
-
"setter": false,
|
|
280
|
-
"attribute": "container-rel",
|
|
281
|
-
"reflect": false
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
static get states() {
|
|
286
|
-
return {
|
|
287
|
-
"searchTerm": {},
|
|
288
|
-
"searchClientResponseItems": {},
|
|
289
|
-
"adClientResponseItems": {},
|
|
290
|
-
"searchResultsPerPage": {},
|
|
291
|
-
"searchResultsPage": {}
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
static get events() {
|
|
295
|
-
return [{
|
|
296
|
-
"method": "noResults",
|
|
297
|
-
"name": "noResults",
|
|
298
|
-
"bubbles": true,
|
|
299
|
-
"cancelable": true,
|
|
300
|
-
"composed": true,
|
|
301
|
-
"docs": {
|
|
302
|
-
"tags": [],
|
|
303
|
-
"text": "When no results are returned."
|
|
304
|
-
},
|
|
305
|
-
"complexType": {
|
|
306
|
-
"original": "void",
|
|
307
|
-
"resolved": "void",
|
|
308
|
-
"references": {}
|
|
309
|
-
}
|
|
310
|
-
}];
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
//# sourceMappingURL=searchcraft-base-search-results.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-base-search-results.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-base-search-results/searchcraft-base-search-results.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,KAAK,EACL,IAAI,EACJ,KAAK,GAEN,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAyB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,kBACxB,IAAI,CAAC,WAAW,IAAI,WAAW,gBACjC,IAAI,CAAC,SAAS,mBACX,IAAI,CAAC,YAAY,uBAE9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,GAAG,KAAK,EAE5D,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAC/C,IAAI,EAAE,IAAI,GACV,CACH,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;gBACzB,IAAI,CAAC,yBAAyB,CAAC,MAAM,KAAK,CAAC,IAAI,CAC7C,WAAK,KAAK,EAAC,oDAAoD;gBAC7D,kDACiB,gCAAgC,IAAI,CAAC,UAAU,SAAS,GACvE,CACE,CACP,CACC,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Event,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\n\nimport type {\n AdClientResponseItem,\n SearchClientResponseItem,\n} from '@searchcraft/core';\n\nimport { type SearchcraftState, useSearchcraftStore } from '@provider/store';\n\nimport { serializeStyles } from '@utils';\nimport type { SearchResultMappings } from '@searchcraft/core';\n\n/**\n * This web component is responsible for displaying the results of a search query.\n * Once a query is submitted, the component formats and presents an ordered list of the results.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-base-search-results\n * ad-interval=\"4\"\n * place-ad-at-start=\"false\"\n * result-image-placement=\"right\"\n * />\n * ```\n *\n * ```js\n * // index.js\n * const baseSearchResults = document.querySelector('searchcraft-base-search-results');\n *\n * baseSearchResults.searchResultMappings = containerHref: {\n * fieldNames: [\n * {\n * fieldName: 'canonical_link',\n * dataType: 'text',\n * },\n * ],\n * };\n *\n * baseSearchResults.addEventListener('noResults', () => {\n * console.log('No search results found');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-base-search-results',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResults {\n /**\n * A custom styles object.\n */\n @Prop() customStylesForResults:\n | string\n | Record<string, Record<string, string>>\n | undefined;\n /**\n * Formats the content rendered for each result.\n */\n @Prop() searchResultMappings: SearchResultMappings | undefined;\n /**\n * The placement of the image for each result.\n */\n @Prop() resultImagePlacement: 'left' | 'right' = 'right';\n /**\n * The label for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present for each result.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * Where to open the link for the containing element for each result.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element for each result.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n\n /**\n * When no results are returned.\n */\n @Event() noResults?: EventEmitter<void>;\n\n @State() searchTerm = '';\n @State() searchClientResponseItems: SearchClientResponseItem[] = [];\n @State() adClientResponseItems: AdClientResponseItem[] = [];\n @State() searchResultsPerPage;\n @State() searchResultsPage;\n\n private unsubscribe: () => void = () => {};\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) =>\n this.handleStateChange(state),\n );\n const currentState = useSearchcraftStore.getState();\n this.searchClientResponseItems = currentState.searchClientResponseItems;\n this.searchTerm = currentState.searchTerm;\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleStateChange(state: SearchcraftState) {\n this.searchClientResponseItems = [...state.searchClientResponseItems];\n this.adClientResponseItems = [...state.adClientResponseItems];\n this.searchTerm = state.searchTerm;\n this.searchResultsPage = state.searchResultsPage;\n this.searchResultsPerPage = state.searchResultsPerPage;\n }\n\n render() {\n if (this.searchTerm.trim() === '') {\n return (\n <div class='searchcraft-search-results-empty-state-container'>\n <slot name='empty-search' />\n </div>\n );\n }\n\n if (this.searchClientResponseItems.length === 0) {\n return;\n }\n\n if (\n this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0\n ) {\n this.noResults?.emit();\n }\n\n let serializedStyles = '';\n if (this.customStylesForResults) {\n serializedStyles =\n typeof this.customStylesForResults === 'string'\n ? this.customStylesForResults\n : serializeStyles(this.customStylesForResults);\n }\n\n return (\n <div class='searchcraft-search-results-container'>\n {this.adClientResponseItems?.map((item) => (\n <searchcraft-base-search-result-ad\n adClientResponseItem={item}\n key={item.adId}\n />\n ))}\n {this.searchClientResponseItems?.map((item, index) => (\n <searchcraft-base-search-result\n key={item.id}\n custom-styles={serializedStyles}\n image-placement={this.resultImagePlacement}\n container-rel={this.containerRel}\n container-target={this.containerTarget}\n button-label={this.buttonLabel || 'View more'}\n button-rel={this.buttonRel}\n button-target={this.buttonTarget}\n document-position={\n this.searchResultsPerPage * this.searchResultsPage + index\n }\n searchResultMappings={this.searchResultMappings}\n item={item}\n />\n ))}\n {this.searchTerm.length > 0 &&\n this.searchClientResponseItems.length === 0 && (\n <div class='searchcraft-search-results-error-message-container'>\n <searchcraft-error-message\n error-message={`No search results found for \"${this.searchTerm}\" query`}\n />\n </div>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { h, Fragment, } from "@stencil/core";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
/**
|
|
4
|
-
* This web component represents a button to be consumed within the `search-input-form` component.
|
|
5
|
-
* It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.
|
|
6
|
-
* It is consumed within the `searchcraft-input-form` component.
|
|
7
|
-
*/
|
|
8
|
-
export class SearchcraftButton {
|
|
9
|
-
/**
|
|
10
|
-
* Controls the visual representation of the button.
|
|
11
|
-
*/
|
|
12
|
-
hierarchy = 'primary';
|
|
13
|
-
/**
|
|
14
|
-
* Whether the button is disabled.
|
|
15
|
-
*/
|
|
16
|
-
disabled = false;
|
|
17
|
-
/**
|
|
18
|
-
* The icon element.
|
|
19
|
-
*/
|
|
20
|
-
icon;
|
|
21
|
-
/**
|
|
22
|
-
* Should the button only display an icon.
|
|
23
|
-
*/
|
|
24
|
-
iconOnly = false;
|
|
25
|
-
/**
|
|
26
|
-
* The position of the icon.
|
|
27
|
-
*/
|
|
28
|
-
iconPosition = 'left';
|
|
29
|
-
/**
|
|
30
|
-
* The label for the button.
|
|
31
|
-
*/
|
|
32
|
-
label = 'Search';
|
|
33
|
-
/**
|
|
34
|
-
* The type of the button.
|
|
35
|
-
*/
|
|
36
|
-
type = 'button';
|
|
37
|
-
/**
|
|
38
|
-
* The event fired when the button is clicked.
|
|
39
|
-
*/
|
|
40
|
-
buttonClick;
|
|
41
|
-
handleButtonClick = () => {
|
|
42
|
-
this.buttonClick.emit();
|
|
43
|
-
};
|
|
44
|
-
render() {
|
|
45
|
-
return (h("button", { key: 'ff883b930d03da6cbfb40badd3be1de0a873f853', "aria-label": this.label, class: classNames('searchcraft-button', {
|
|
46
|
-
'searchcraft-button-primary': this.hierarchy === 'primary',
|
|
47
|
-
'searchcraft-button-tertiary': this.hierarchy === 'tertiary',
|
|
48
|
-
'searchcraft-button-disabled': this.disabled,
|
|
49
|
-
}), disabled: this.disabled, onClick: this.handleButtonClick, type: this.type }, this.iconOnly ? (this.icon) : (h(Fragment, null, this.iconPosition === 'left' && this.icon, h("span", null, this.label), this.iconPosition === 'right' && this.icon))));
|
|
50
|
-
}
|
|
51
|
-
static get is() { return "searchcraft-button"; }
|
|
52
|
-
static get properties() {
|
|
53
|
-
return {
|
|
54
|
-
"hierarchy": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"mutable": false,
|
|
57
|
-
"complexType": {
|
|
58
|
-
"original": "'primary' | 'tertiary'",
|
|
59
|
-
"resolved": "\"primary\" | \"tertiary\" | undefined",
|
|
60
|
-
"references": {}
|
|
61
|
-
},
|
|
62
|
-
"required": false,
|
|
63
|
-
"optional": true,
|
|
64
|
-
"docs": {
|
|
65
|
-
"tags": [],
|
|
66
|
-
"text": "Controls the visual representation of the button."
|
|
67
|
-
},
|
|
68
|
-
"getter": false,
|
|
69
|
-
"setter": false,
|
|
70
|
-
"attribute": "hierarchy",
|
|
71
|
-
"reflect": false,
|
|
72
|
-
"defaultValue": "'primary'"
|
|
73
|
-
},
|
|
74
|
-
"disabled": {
|
|
75
|
-
"type": "boolean",
|
|
76
|
-
"mutable": false,
|
|
77
|
-
"complexType": {
|
|
78
|
-
"original": "boolean",
|
|
79
|
-
"resolved": "boolean | undefined",
|
|
80
|
-
"references": {}
|
|
81
|
-
},
|
|
82
|
-
"required": false,
|
|
83
|
-
"optional": true,
|
|
84
|
-
"docs": {
|
|
85
|
-
"tags": [],
|
|
86
|
-
"text": "Whether the button is disabled."
|
|
87
|
-
},
|
|
88
|
-
"getter": false,
|
|
89
|
-
"setter": false,
|
|
90
|
-
"attribute": "disabled",
|
|
91
|
-
"reflect": false,
|
|
92
|
-
"defaultValue": "false"
|
|
93
|
-
},
|
|
94
|
-
"icon": {
|
|
95
|
-
"type": "unknown",
|
|
96
|
-
"mutable": false,
|
|
97
|
-
"complexType": {
|
|
98
|
-
"original": "Element",
|
|
99
|
-
"resolved": "Element | undefined",
|
|
100
|
-
"references": {
|
|
101
|
-
"Element": {
|
|
102
|
-
"location": "global",
|
|
103
|
-
"id": "global::Element"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"required": false,
|
|
108
|
-
"optional": true,
|
|
109
|
-
"docs": {
|
|
110
|
-
"tags": [],
|
|
111
|
-
"text": "The icon element."
|
|
112
|
-
},
|
|
113
|
-
"getter": false,
|
|
114
|
-
"setter": false
|
|
115
|
-
},
|
|
116
|
-
"iconOnly": {
|
|
117
|
-
"type": "boolean",
|
|
118
|
-
"mutable": false,
|
|
119
|
-
"complexType": {
|
|
120
|
-
"original": "boolean",
|
|
121
|
-
"resolved": "boolean | undefined",
|
|
122
|
-
"references": {}
|
|
123
|
-
},
|
|
124
|
-
"required": false,
|
|
125
|
-
"optional": true,
|
|
126
|
-
"docs": {
|
|
127
|
-
"tags": [],
|
|
128
|
-
"text": "Should the button only display an icon."
|
|
129
|
-
},
|
|
130
|
-
"getter": false,
|
|
131
|
-
"setter": false,
|
|
132
|
-
"attribute": "icon-only",
|
|
133
|
-
"reflect": false,
|
|
134
|
-
"defaultValue": "false"
|
|
135
|
-
},
|
|
136
|
-
"iconPosition": {
|
|
137
|
-
"type": "string",
|
|
138
|
-
"mutable": false,
|
|
139
|
-
"complexType": {
|
|
140
|
-
"original": "'left' | 'right'",
|
|
141
|
-
"resolved": "\"left\" | \"right\" | undefined",
|
|
142
|
-
"references": {}
|
|
143
|
-
},
|
|
144
|
-
"required": false,
|
|
145
|
-
"optional": true,
|
|
146
|
-
"docs": {
|
|
147
|
-
"tags": [],
|
|
148
|
-
"text": "The position of the icon."
|
|
149
|
-
},
|
|
150
|
-
"getter": false,
|
|
151
|
-
"setter": false,
|
|
152
|
-
"attribute": "icon-position",
|
|
153
|
-
"reflect": false,
|
|
154
|
-
"defaultValue": "'left'"
|
|
155
|
-
},
|
|
156
|
-
"label": {
|
|
157
|
-
"type": "string",
|
|
158
|
-
"mutable": false,
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "string",
|
|
161
|
-
"resolved": "string",
|
|
162
|
-
"references": {}
|
|
163
|
-
},
|
|
164
|
-
"required": false,
|
|
165
|
-
"optional": false,
|
|
166
|
-
"docs": {
|
|
167
|
-
"tags": [],
|
|
168
|
-
"text": "The label for the button."
|
|
169
|
-
},
|
|
170
|
-
"getter": false,
|
|
171
|
-
"setter": false,
|
|
172
|
-
"attribute": "label",
|
|
173
|
-
"reflect": false,
|
|
174
|
-
"defaultValue": "'Search'"
|
|
175
|
-
},
|
|
176
|
-
"type": {
|
|
177
|
-
"type": "string",
|
|
178
|
-
"mutable": false,
|
|
179
|
-
"complexType": {
|
|
180
|
-
"original": "'submit' | 'reset' | 'button'",
|
|
181
|
-
"resolved": "\"button\" | \"reset\" | \"submit\" | undefined",
|
|
182
|
-
"references": {}
|
|
183
|
-
},
|
|
184
|
-
"required": false,
|
|
185
|
-
"optional": true,
|
|
186
|
-
"docs": {
|
|
187
|
-
"tags": [],
|
|
188
|
-
"text": "The type of the button."
|
|
189
|
-
},
|
|
190
|
-
"getter": false,
|
|
191
|
-
"setter": false,
|
|
192
|
-
"attribute": "type",
|
|
193
|
-
"reflect": false,
|
|
194
|
-
"defaultValue": "'button'"
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
static get events() {
|
|
199
|
-
return [{
|
|
200
|
-
"method": "buttonClick",
|
|
201
|
-
"name": "buttonClick",
|
|
202
|
-
"bubbles": true,
|
|
203
|
-
"cancelable": true,
|
|
204
|
-
"composed": true,
|
|
205
|
-
"docs": {
|
|
206
|
-
"tags": [],
|
|
207
|
-
"text": "The event fired when the button is clicked."
|
|
208
|
-
},
|
|
209
|
-
"complexType": {
|
|
210
|
-
"original": "void",
|
|
211
|
-
"resolved": "void",
|
|
212
|
-
"references": {}
|
|
213
|
-
}
|
|
214
|
-
}];
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=searchcraft-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-button.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-button/searchcraft-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EAEL,IAAI,EACJ,CAAC,EACD,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC;;;;GAIG;AAKH,MAAM,OAAO,iBAAiB;IAC5B;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Event,\n type EventEmitter,\n Prop,\n h,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component represents a button to be consumed within the `search-input-form` component.\n * It provides a clear, interactive way for users to submit search queries or trigger actions in a search interface.\n * It is consumed within the `searchcraft-input-form` component.\n */\n@Component({\n tag: 'searchcraft-button',\n shadow: false,\n})\nexport class SearchcraftButton {\n /**\n * Controls the visual representation of the button.\n */\n @Prop() hierarchy?: 'primary' | 'tertiary' = 'primary';\n /**\n * Whether the button is disabled.\n */\n @Prop() disabled?: boolean = false;\n /**\n * The icon element.\n */\n @Prop() icon?: Element;\n /**\n * Should the button only display an icon.\n */\n @Prop() iconOnly?: boolean = false;\n /**\n * The position of the icon.\n */\n @Prop() iconPosition?: 'left' | 'right' = 'left';\n /**\n * The label for the button.\n */\n @Prop() label = 'Search';\n /**\n * The type of the button.\n */\n @Prop() type?: 'submit' | 'reset' | 'button' = 'button';\n /**\n * The event fired when the button is clicked.\n */\n @Event() buttonClick!: EventEmitter<void>;\n\n private handleButtonClick = () => {\n this.buttonClick.emit();\n };\n\n render() {\n return (\n <button\n aria-label={this.label}\n class={classNames('searchcraft-button', {\n 'searchcraft-button-primary': this.hierarchy === 'primary',\n 'searchcraft-button-tertiary': this.hierarchy === 'tertiary',\n 'searchcraft-button-disabled': this.disabled,\n })}\n disabled={this.disabled}\n onClick={this.handleButtonClick}\n type={this.type}\n >\n {this.iconOnly ? (\n this.icon\n ) : (\n <Fragment>\n {this.iconPosition === 'left' && this.icon}\n <span>{this.label}</span>\n {this.iconPosition === 'right' && this.icon}\n </Fragment>\n )}\n </button>\n );\n }\n}\n"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
/**
|
|
3
|
-
* This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.
|
|
4
|
-
*
|
|
5
|
-
* ## Usage
|
|
6
|
-
* ```html
|
|
7
|
-
* <!-- index.html -->
|
|
8
|
-
* <searchcraft-error-message error-message="No search results found for query" />
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export class SearchcraftErrorMessage {
|
|
12
|
-
/**
|
|
13
|
-
* The error message.
|
|
14
|
-
*/
|
|
15
|
-
errorMessage;
|
|
16
|
-
render() {
|
|
17
|
-
return (h("p", { key: 'dc97bb66da10a98fca027f928deaaf80d945417b', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
|
|
18
|
-
}
|
|
19
|
-
static get is() { return "searchcraft-error-message"; }
|
|
20
|
-
static get properties() {
|
|
21
|
-
return {
|
|
22
|
-
"errorMessage": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"mutable": false,
|
|
25
|
-
"complexType": {
|
|
26
|
-
"original": "string",
|
|
27
|
-
"resolved": "string | undefined",
|
|
28
|
-
"references": {}
|
|
29
|
-
},
|
|
30
|
-
"required": false,
|
|
31
|
-
"optional": true,
|
|
32
|
-
"docs": {
|
|
33
|
-
"tags": [],
|
|
34
|
-
"text": "The error message."
|
|
35
|
-
},
|
|
36
|
-
"getter": false,
|
|
37
|
-
"setter": false,
|
|
38
|
-
"attribute": "error-message",
|
|
39
|
-
"reflect": false
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=searchcraft-error-message.js.map
|
package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"searchcraft-error-message.js","sourceRoot":"","sources":["../../../../src/components/searchcraft-error-message/searchcraft-error-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;GAQG;AAKH,MAAM,OAAO,uBAAuB;IAClC;;OAEG;IACK,YAAY,CAAU;IAE9B,MAAM;QACJ,OAAO,CACL,0DAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,CACL,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\n @Prop() errorMessage?: string;\n\n render() {\n return (\n <p class='searchcraft-error-message'>\n {this.errorMessage || 'Search term is required.'}\n </p>\n );\n }\n}\n"]}
|