@searchcraft/javascript-sdk 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -55
- package/dist/cjs/{index-b3b77ea2.js → index-a81df4f0.js} +258 -239
- package/dist/cjs/index-a81df4f0.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js +91 -48
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -37
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -27
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -117
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -13
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +128 -82
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +3 -3
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js.map +1 -1
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js +3 -7
- package/dist/cjs/searchcraft-popover-button.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js +81 -68
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -12
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +9 -13
- package/dist/cjs/searchcraft-results-info.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-theme.cjs.entry.js +38 -0
- package/dist/cjs/searchcraft-theme.cjs.entry.js.map +1 -0
- package/dist/cjs/{store-d7ebcf7a.js → store-f6ba3dfb.js} +633 -107
- package/dist/cjs/store-f6ba3dfb.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +134 -66
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js.map +1 -1
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js +100 -49
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.js.map +1 -1
- package/dist/collection/components/searchcraft-button/searchcraft-button.js +35 -23
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +8 -15
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js.map +1 -1
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js +61 -59
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.js.map +1 -1
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js +11 -19
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.js.map +1 -1
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js +126 -76
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.js.map +1 -1
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js +14 -18
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js +1 -11
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js +93 -77
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js +47 -25
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.js.map +1 -1
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js +23 -25
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.js.map +1 -1
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js +7 -19
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.js.map +1 -1
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js +65 -55
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +27 -0
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +27 -26
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/provider/store.js +25 -9
- package/dist/collection/provider/store.js.map +1 -1
- package/dist/collection/utils/facets.js +5 -3
- package/dist/collection/utils/facets.js.map +1 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-0ef4ab33.js +66 -0
- package/dist/components/p-0ef4ab33.js.map +1 -0
- package/dist/components/p-1234974c.js +72 -0
- package/dist/components/p-1234974c.js.map +1 -0
- package/dist/components/p-4b92ae26.js +109 -0
- package/dist/components/p-4b92ae26.js.map +1 -0
- package/dist/components/{p-85765b81.js → p-506cdac1.js} +18 -16
- package/dist/components/p-506cdac1.js.map +1 -0
- package/dist/components/p-521fe971.js +60 -0
- package/dist/components/p-521fe971.js.map +1 -0
- package/dist/components/{p-e4846fa2.js → p-5365011f.js} +215 -231
- package/dist/components/p-5365011f.js.map +1 -0
- package/dist/components/p-54998882.js +285 -0
- package/dist/components/p-54998882.js.map +1 -0
- package/dist/components/{p-d6a88eed.js → p-936e2ed4.js} +633 -107
- package/dist/components/p-936e2ed4.js.map +1 -0
- package/dist/components/p-a75ef832.js +34 -0
- package/dist/components/p-a75ef832.js.map +1 -0
- package/dist/components/p-b4a8fcbe.js +144 -0
- package/dist/components/p-b4a8fcbe.js.map +1 -0
- package/dist/components/p-ca881e5c.js +37 -0
- package/dist/components/p-ca881e5c.js.map +1 -0
- package/dist/components/p-d95bc2a0.js +284 -0
- package/dist/components/p-d95bc2a0.js.map +1 -0
- package/dist/components/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +76 -39
- package/dist/components/searchcraft-base-search-results.js.map +1 -1
- package/dist/components/searchcraft-button.js +1 -1
- package/dist/components/searchcraft-error-message.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +14 -16
- package/dist/components/searchcraft-filter-panel.js.map +1 -1
- package/dist/components/searchcraft-input-form.js +1 -1
- package/dist/components/searchcraft-input-label.js +1 -1
- package/dist/components/searchcraft-popover-button.js +3 -7
- package/dist/components/searchcraft-popover-button.js.map +1 -1
- package/dist/components/searchcraft-popover-form.js +87 -74
- package/dist/components/searchcraft-popover-form.js.map +1 -1
- package/dist/components/searchcraft-popover-list-item.js +1 -1
- package/dist/components/searchcraft-popover-list-view.js +1 -1
- package/dist/components/searchcraft-results-info.js +9 -13
- package/dist/components/searchcraft-results-info.js.map +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/components/searchcraft-theme.d.ts +11 -0
- package/dist/components/searchcraft-theme.js +51 -0
- package/dist/components/searchcraft-theme.js.map +1 -0
- package/dist/components/searchcraft-toggle-button.js +1 -1
- package/dist/esm/{index-11551663.js → index-3608c57d.js} +258 -239
- package/dist/esm/index-3608c57d.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/searchcraft-base-search-result.entry.js +91 -48
- package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +74 -37
- package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
- package/dist/esm/searchcraft-button_3.entry.js +37 -27
- package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +141 -117
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +11 -13
- package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +128 -82
- package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +4 -4
- package/dist/esm/searchcraft-javascript-sdk.js.map +1 -1
- package/dist/esm/searchcraft-popover-button.entry.js +3 -7
- package/dist/esm/searchcraft-popover-button.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-form.entry.js +81 -68
- package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-list-item.entry.js +29 -12
- package/dist/esm/searchcraft-popover-list-item.entry.js.map +1 -1
- package/dist/esm/searchcraft-results-info.entry.js +9 -13
- package/dist/esm/searchcraft-results-info.entry.js.map +1 -1
- package/dist/esm/searchcraft-theme.entry.js +34 -0
- package/dist/esm/searchcraft-theme.entry.js.map +1 -0
- package/dist/esm/{store-1058f7b0.js → store-aa071d9c.js} +633 -107
- package/dist/esm/store-aa071d9c.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-26f5263d.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-2ff7eb35.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-36f0532e.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-41b6bc5d.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-57eddb07.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-5d6fbee0.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-64c5a1d2.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js +3 -0
- package/dist/searchcraft-javascript-sdk/p-7e13c128.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-8b0a60b3.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js +11 -0
- package/dist/searchcraft-javascript-sdk/p-936e2ed4.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-c7df8be6.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-eb6058e8.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-faaa4394.entry.js.map +1 -0
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js.map +1 -1
- package/dist/types/components/searchcraft-base-search-result/searchcraft-base-search-result.d.ts +1 -0
- package/dist/types/components/searchcraft-base-search-results/searchcraft-base-search-results.d.ts +2 -1
- package/dist/types/components/searchcraft-button/searchcraft-button.d.ts +1 -0
- package/dist/types/components/searchcraft-error-message/searchcraft-error-message.d.ts +1 -0
- package/dist/types/components/searchcraft-facet-list/searchcraft-facet-list.d.ts +2 -1
- package/dist/types/components/searchcraft-filter-panel/searchcraft-filter-panel.d.ts +1 -0
- package/dist/types/components/searchcraft-input-form/searchcraft-input-form.d.ts +7 -10
- package/dist/types/components/searchcraft-input-label/searchcraft-input-label.d.ts +2 -1
- package/dist/types/components/searchcraft-popover-button/searchcraft-popover-button.d.ts +1 -0
- package/dist/types/components/searchcraft-popover-form/searchcraft-popover-form.d.ts +2 -1
- package/dist/types/components/searchcraft-popover-list-item/searchcraft-popover-list-item.d.ts +2 -0
- package/dist/types/components/searchcraft-popover-list-view/searchcraft-popover-list-view.d.ts +1 -0
- package/dist/types/components/searchcraft-results-info/searchcraft-results-info.d.ts +1 -0
- package/dist/types/components/searchcraft-slider/searchcraft-slider.d.ts +2 -1
- package/dist/types/components/searchcraft-theme/searchcraft-theme.d.ts +5 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
- package/dist/types/components.d.ts +17 -4
- package/dist/types/index.d.ts +2 -1
- package/dist/types/provider/store.d.ts +1 -0
- package/dist/types/types/_shared.types.d.ts +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/raw.d.ts +4 -0
- package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -0
- package/dist/types/types/searchcraft-filter-panel.types.d.ts +1 -0
- package/dist/types/types/searchcraft-popover-form.types.d.ts +1 -0
- package/dist/types/utils/facets.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/styles.d.ts +1 -0
- package/dist/types/utils/units.d.ts +1 -0
- package/package.json +6 -4
- package/dist/cjs/index-b3b77ea2.js.map +0 -1
- package/dist/cjs/store-d7ebcf7a.js.map +0 -1
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.module.css +0 -227
- package/dist/collection/components/searchcraft-base-search-results/searchcraft-base-search-results.module.css +0 -179
- package/dist/collection/components/searchcraft-button/searchcraft-button.module.css +0 -174
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.module.css +0 -158
- package/dist/collection/components/searchcraft-facet-list/searchcraft-facet-list.module.css +0 -266
- package/dist/collection/components/searchcraft-filter-panel/searchcraft-filter-panel.module.css +0 -168
- package/dist/collection/components/searchcraft-input-form/searchcraft-input-form.module.css +0 -293
- package/dist/collection/components/searchcraft-input-label/searchcraft-input-label.module.css +0 -159
- package/dist/collection/components/searchcraft-popover-button/searchcraft-popover-button.module.css +0 -0
- package/dist/collection/components/searchcraft-popover-form/searchcraft-popover-form.module.css +0 -322
- package/dist/collection/components/searchcraft-popover-list-item/searchcraft-popover-list-item.module.css +0 -209
- package/dist/collection/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.css +0 -0
- package/dist/collection/components/searchcraft-results-info/searchcraft-results-info.module.css +0 -169
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.module.css +0 -231
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.module.css +0 -207
- package/dist/components/p-02a16e53.js +0 -240
- package/dist/components/p-02a16e53.js.map +0 -1
- package/dist/components/p-04c46179.js +0 -101
- package/dist/components/p-04c46179.js.map +0 -1
- package/dist/components/p-0e38a723.js +0 -99
- package/dist/components/p-0e38a723.js.map +0 -1
- package/dist/components/p-4c45ef80.js +0 -67
- package/dist/components/p-4c45ef80.js.map +0 -1
- package/dist/components/p-85765b81.js.map +0 -1
- package/dist/components/p-953f4238.js +0 -35
- package/dist/components/p-953f4238.js.map +0 -1
- package/dist/components/p-a248ad69.js +0 -276
- package/dist/components/p-a248ad69.js.map +0 -1
- package/dist/components/p-a9bd1872.js +0 -38
- package/dist/components/p-a9bd1872.js.map +0 -1
- package/dist/components/p-cf4ced92.js +0 -49
- package/dist/components/p-cf4ced92.js.map +0 -1
- package/dist/components/p-d6a88eed.js.map +0 -1
- package/dist/components/p-e4846fa2.js.map +0 -1
- package/dist/components/p-f9d778b3.js +0 -48
- package/dist/components/p-f9d778b3.js.map +0 -1
- package/dist/esm/index-11551663.js.map +0 -1
- package/dist/esm/store-1058f7b0.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-4580e8a4.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-7049b93d.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-8e539d62.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-98640a6a.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-9d0f5c89.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-b8bd53ce.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-c27a3673.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-cd852b84.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-d6a88eed.js +0 -11
- package/dist/searchcraft-javascript-sdk/p-d6a88eed.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-e042deb9.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-e0be53df.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-e0be53df.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-efab9f3c.entry.js.map +0 -1
|
@@ -2,29 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const store = require('./store-
|
|
5
|
+
const index = require('./index-a81df4f0.js');
|
|
6
|
+
const store = require('./store-f6ba3dfb.js');
|
|
7
7
|
const units = require('./units-fe4d8083.js');
|
|
8
8
|
|
|
9
|
-
const searchcraftFilterPanelModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height)}";
|
|
10
|
-
const SearchcraftFilterPanelStyle0 = searchcraftFilterPanelModuleCss;
|
|
11
|
-
|
|
12
9
|
const SearchcraftFilterPanel = class {
|
|
13
10
|
constructor(hostRef) {
|
|
14
11
|
index.registerInstance(this, hostRef);
|
|
15
|
-
this.searchStore = store.useSearchcraftStore.getState();
|
|
16
|
-
this.items = [];
|
|
17
|
-
this.unsubscribe = undefined;
|
|
18
|
-
this.lastQuery = undefined;
|
|
19
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* The items to filter.
|
|
15
|
+
*/
|
|
16
|
+
items = [];
|
|
17
|
+
unsubscribe;
|
|
18
|
+
lastQuery;
|
|
19
|
+
searchStore = store.useSearchcraftStore.getState();
|
|
20
20
|
componentDidLoad() {
|
|
21
21
|
this.unsubscribe = store.useSearchcraftStore.subscribe((state) => {
|
|
22
22
|
this.lastQuery = state.query || '';
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
disconnectedCallback() {
|
|
26
|
-
|
|
27
|
-
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
26
|
+
this.unsubscribe?.();
|
|
28
27
|
}
|
|
29
28
|
handleDateRangeChanged(fieldName, min, max) {
|
|
30
29
|
const start = new Date(min);
|
|
@@ -66,7 +65,7 @@ const SearchcraftFilterPanel = class {
|
|
|
66
65
|
* Iterate through `items` and render them based on `type`
|
|
67
66
|
*/
|
|
68
67
|
render() {
|
|
69
|
-
return (index.h("div", { key: '
|
|
68
|
+
return (index.h("div", { key: '9b9fcc79913da68b49909965eb75f9a5b1701acb', class: 'searchcraft-filter-panel' }, this.items.map((filterItem) => {
|
|
70
69
|
switch (filterItem.type) {
|
|
71
70
|
case 'dateRange': {
|
|
72
71
|
const item = filterItem;
|
|
@@ -108,7 +107,6 @@ const SearchcraftFilterPanel = class {
|
|
|
108
107
|
})));
|
|
109
108
|
}
|
|
110
109
|
};
|
|
111
|
-
SearchcraftFilterPanel.style = SearchcraftFilterPanelStyle0;
|
|
112
110
|
|
|
113
111
|
exports.searchcraft_filter_panel = SearchcraftFilterPanel;
|
|
114
112
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-filter-panel.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,+BAA+B,GAAG,2sHAA2sH,CAAC;AACpvH,qCAAe,+BAA+B;;MCwBjC,sBAAsB;;;QASzB,gBAAW,GAAGA,yBAAmB,CAAC,QAAQ,EAAE,CAAC;qBALvB,EAAE;;;;IAOhC,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAGA,yBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;YAIrD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;SACpC,CAAC,CAAC;KACJ;IAED,oBAAoB;;QAClB,MAAA,IAAI,CAAC,WAAW,oDAAI,CAAC;KACtB;IAED,sBAAsB,CAAC,SAAiB,EAAE,GAAW,EAAE,GAAW;QAChE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC;YAC1C,SAAS;YACT,KAAK,EAAE,GAAG,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,OAAO,GAAG,CAAC,WAAW,EAAE,GAAG;SACvE,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;KAC3B;IAED,yBAAyB,CAAC,SAAiB,EAAE,GAAW,EAAE,GAAW;QACnE,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC;YAC1C,SAAS;YACT,KAAK,EAAE,GAAG,SAAS,KAAK,GAAG,OAAO,GAAG,GAAG;SACzC,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;KAC3B;IAED,2BAA2B,CAAC,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,CACE,EACN;iBACH;gBACD,KAAK,kBAAkB,EAAE;oBACvB,MAAM,IAAI,GAAG,UAAwC,CAAC;oBACtD,QACEA,uCACE,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,eAAe,EAAE,CAAC,KAAK;4BACrB,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;yBAClD,GACD,EACF;iBACH;gBACD,KAAK,kBAAkB,EAAE;oBACvB,MAAM,IAAI,GAAG,UAAwC,CAAC;oBACtD,QACEA,uCACE,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,eAAe,EAAE,CAAC,KAAK;4BACrB,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;yBAClD,GACD,EACF;iBACH;aACF;SACF,CAAC,CACE,EACN;KACH;;;;;;","names":["useSearchcraftStore","h","getMillis"],"sources":["src/components/searchcraft-filter-panel/searchcraft-filter-panel.module.scss?tag=searchcraft-filter-panel","src/components/searchcraft-filter-panel/searchcraft-filter-panel.tsx"],"sourcesContent":[".searchcraft-filter-panel {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.searchcraft-filter-panel-section {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.searchcraft-filter-panel-label {\n @include body-small-bold();\n}\n","import { Component, h, Prop, State } from '@stencil/core';\nimport type {\n FilterItem,\n DateRangeFilterItem,\n NumericFilterItem,\n ExactMatchToggleFilterItem,\n FacetsFilterItem,\n} from '../../types/searchcraft-filter-panel.types';\nimport { useSearchcraftStore } from '@provider/store';\nimport { getMillis } from '@utils';\n\n/**\n * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-filter-panel />\n * ```\n */\n@Component({\n tag: 'searchcraft-filter-panel',\n styleUrl: 'searchcraft-filter-panel.module.scss',\n shadow: false,\n})\nexport class SearchcraftFilterPanel {\n /**\n * The items to filter.\n */\n @Prop() items: FilterItem[] = [];\n\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (this.lastQuery !== state.query) {\n // A place to put actions to do when the query changes\n }\n this.lastQuery = state.query || '';\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleDateRangeChanged(fieldName: string, min: number, max: number) {\n const start = new Date(min);\n const end = new Date(max);\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,\n });\n\n this.searchStore.search();\n }\n\n handleNumericRangeChanged(fieldName: string, min: number, max: number) {\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${min} TO ${max}]`,\n });\n this.searchStore.search();\n }\n\n handleFacetSelectionUpdated(fieldName: string, paths: string[]) {\n if (paths.length > 0) {\n this.searchStore.addFacetPathsForIndexField({\n fieldName,\n value: `${fieldName}: IN [${paths.join(' ')}]`,\n });\n } else {\n this.searchStore.removeFacetPathsForIndexField(fieldName);\n }\n this.searchStore.search();\n }\n\n handleExactMatchToggleUpdated(isActive: boolean) {\n this.searchStore.setSearchMode(isActive ? 'exact' : 'fuzzy');\n this.searchStore.search();\n }\n\n handleMostRecentToggleUpdated(isActive: boolean) {\n this.searchStore.setSortType(isActive ? 'desc' : 'asc');\n this.searchStore.search();\n }\n\n /**\n * Iterate through `items` and render them based on `type`\n */\n render() {\n return (\n <div class='searchcraft-filter-panel'>\n {this.items.map((filterItem) => {\n switch (filterItem.type) {\n case 'dateRange': {\n const item = filterItem as DateRangeFilterItem;\n const min = new Date(item.options.minDate).getTime();\n const max = new Date(item.options.maxDate).getTime();\n const granularityValue = getMillis(item.options.granularity);\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={min}\n max={max}\n granularity={granularityValue}\n dataType='date'\n onRangeChanged={(event) => {\n this.handleDateRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'numericRange': {\n const item = filterItem as NumericFilterItem;\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={item.options.min}\n max={item.options.max}\n granularity={item.options.granularity}\n onRangeChanged={(event) => {\n this.handleNumericRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'facets': {\n const item = filterItem as FacetsFilterItem;\n // return \"filters-list\"\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-facet-list\n fieldName={item.fieldName}\n onFacetSelectionUpdated={(event) => {\n this.handleFacetSelectionUpdated(\n item.fieldName,\n event.detail.paths,\n );\n }}\n />\n </div>\n );\n }\n case 'exactMatchToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleExactMatchToggleUpdated(event.detail);\n }}\n />\n );\n }\n case 'mostRecentToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleMostRecentToggleUpdated(event.detail);\n }}\n />\n );\n }\n }\n })}\n </div>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"searchcraft-filter-panel.entry.cjs.js","mappings":";;;;;;;;MAwBa,sBAAsB;;;;;;;IAIzB,KAAK,GAAiB,EAAE,CAAC;IAExB,WAA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AM,CAAC,CAAC;yBAClD,GACD,EACF;iBACH;gBACD,KAAK,kBAAkB,EAAE;oBACvB,MAAM,IAAI,GAAG,UAAwC,CAAC;oBACtD,QACEA,uCACE,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC/B,eAAe,EAAE,CAAC,KAAK;4BACrB,IAAI,CAAC,6BAA6B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;yBAClD,GACD,EACF;iBACH;aACF;SACF,CAAC,CACE,EACN;KACH;;;;;","names":["useSearchcraftStore","h","getMillis"],"sources":["src/components/searchcraft-filter-panel/searchcraft-filter-panel.tsx"],"sourcesContent":["import { Component, h, Prop, State } from '@stencil/core';\nimport type {\n FilterItem,\n DateRangeFilterItem,\n NumericFilterItem,\n ExactMatchToggleFilterItem,\n FacetsFilterItem,\n} from '../../types/searchcraft-filter-panel.types';\nimport { useSearchcraftStore } from '@provider/store';\nimport { getMillis } from '@utils';\n\n/**\n * This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-filter-panel />\n * ```\n */\n@Component({\n tag: 'searchcraft-filter-panel',\n shadow: false,\n})\nexport class SearchcraftFilterPanel {\n /**\n * The items to filter.\n */\n @Prop() items: FilterItem[] = [];\n\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n componentDidLoad() {\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (this.lastQuery !== state.query) {\n // A place to put actions to do when the query changes\n }\n this.lastQuery = state.query || '';\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleDateRangeChanged(fieldName: string, min: number, max: number) {\n const start = new Date(min);\n const end = new Date(max);\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${start.toISOString()} TO ${end.toISOString()}]`,\n });\n\n this.searchStore.search();\n }\n\n handleNumericRangeChanged(fieldName: string, min: number, max: number) {\n this.searchStore.addRangeValueForIndexField({\n fieldName,\n value: `${fieldName}:[${min} TO ${max}]`,\n });\n this.searchStore.search();\n }\n\n handleFacetSelectionUpdated(fieldName: string, paths: string[]) {\n if (paths.length > 0) {\n this.searchStore.addFacetPathsForIndexField({\n fieldName,\n value: `${fieldName}: IN [${paths.join(' ')}]`,\n });\n } else {\n this.searchStore.removeFacetPathsForIndexField(fieldName);\n }\n this.searchStore.search();\n }\n\n handleExactMatchToggleUpdated(isActive: boolean) {\n this.searchStore.setSearchMode(isActive ? 'exact' : 'fuzzy');\n this.searchStore.search();\n }\n\n handleMostRecentToggleUpdated(isActive: boolean) {\n this.searchStore.setSortType(isActive ? 'desc' : 'asc');\n this.searchStore.search();\n }\n\n /**\n * Iterate through `items` and render them based on `type`\n */\n render() {\n return (\n <div class='searchcraft-filter-panel'>\n {this.items.map((filterItem) => {\n switch (filterItem.type) {\n case 'dateRange': {\n const item = filterItem as DateRangeFilterItem;\n const min = new Date(item.options.minDate).getTime();\n const max = new Date(item.options.maxDate).getTime();\n const granularityValue = getMillis(item.options.granularity);\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={min}\n max={max}\n granularity={granularityValue}\n dataType='date'\n onRangeChanged={(event) => {\n this.handleDateRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'numericRange': {\n const item = filterItem as NumericFilterItem;\n // return date range slider\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-slider\n min={item.options.min}\n max={item.options.max}\n granularity={item.options.granularity}\n onRangeChanged={(event) => {\n this.handleNumericRangeChanged(\n item.fieldName,\n event.detail.startValue,\n event.detail.endValue,\n );\n }}\n />\n </div>\n );\n }\n case 'facets': {\n const item = filterItem as FacetsFilterItem;\n // return \"filters-list\"\n return (\n <div class='searchcraft-filter-panel-section'>\n <p class='searchcraft-filter-panel-label'>\n {filterItem.label}\n </p>\n <searchcraft-facet-list\n fieldName={item.fieldName}\n onFacetSelectionUpdated={(event) => {\n this.handleFacetSelectionUpdated(\n item.fieldName,\n event.detail.paths,\n );\n }}\n />\n </div>\n );\n }\n case 'exactMatchToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleExactMatchToggleUpdated(event.detail);\n }}\n />\n );\n }\n case 'mostRecentToggle': {\n const item = filterItem as ExactMatchToggleFilterItem;\n return (\n <searchcraft-toggle-button\n label={item.label}\n subLabel={item.options.subLabel}\n onToggleUpdated={(event) => {\n this.handleMostRecentToggleUpdated(event.detail);\n }}\n />\n );\n }\n }\n })}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const store = require('./store-
|
|
5
|
+
const index = require('./index-a81df4f0.js');
|
|
6
|
+
const store = require('./store-f6ba3dfb.js');
|
|
7
7
|
const styles = require('./styles-7b2d06f2.js');
|
|
8
8
|
const index$1 = require('./index-5b0b9d4c.js');
|
|
9
9
|
const units = require('./units-fe4d8083.js');
|
|
10
10
|
|
|
11
11
|
const name = "@searchcraft/javascript-sdk";
|
|
12
|
-
const version = "0.
|
|
12
|
+
const version = "0.7.1";
|
|
13
13
|
const description = "Searchcraft Javascript SDK";
|
|
14
14
|
const author = "Searchcraft";
|
|
15
15
|
const license = "Apache-2.0";
|
|
@@ -46,17 +46,19 @@ const files = [
|
|
|
46
46
|
"dist/"
|
|
47
47
|
];
|
|
48
48
|
const scripts = {
|
|
49
|
-
build: "stencil build",
|
|
49
|
+
build: "stencil build && yarn docs",
|
|
50
|
+
docs: "typedoc --options typedoc.json",
|
|
50
51
|
dev: "stencil build --dev --watch",
|
|
51
52
|
test: "stencil test --spec --e2e",
|
|
52
53
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
53
54
|
generate: "stencil generate"
|
|
54
55
|
};
|
|
55
56
|
const dependencies = {
|
|
57
|
+
"@stencil/vue-output-target": "^0.9.2",
|
|
56
58
|
classnames: "^2.3.2"
|
|
57
59
|
};
|
|
58
60
|
const devDependencies = {
|
|
59
|
-
"@searchcraft/core": "^0.
|
|
61
|
+
"@searchcraft/core": "^0.7.1",
|
|
60
62
|
"@searchcraft/javascript-sdk": "*",
|
|
61
63
|
"@stencil/core": "^4.7.0",
|
|
62
64
|
"@stencil/react-output-target": "^0.8.2",
|
|
@@ -85,9 +87,6 @@ const packageJson = {
|
|
|
85
87
|
devDependencies: devDependencies
|
|
86
88
|
};
|
|
87
89
|
|
|
88
|
-
const searchcraftInputFormModuleCss = ":root{--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;--sc-popover-form-border-radius:8px;--sc-popover-list-view-height:400px;--sc-popover-list-item-image-size:60px;--sc-popover-list-item-padding-horizontal:8px;--sc-popover-list-item-padding-vertical:8px;--sc-popover-modal-max-width:570px}: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}:root{--sc-breakpoint-sm:576px;--sc-breakpoint-md:768px;--sc-breakpoint-lg:992px}.searchcraft-input-grid{display:grid;gap:4px 8px}.searchcraft-input-grid-buttonLeft{grid-template-rows:repeat(3, auto);grid-template-columns:auto 1fr}.searchcraft-input-grid-buttonLeft .searchcraft-input-button-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-label-wrapper{grid-column:2/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-error-wrapper{grid-column:2/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonLeft .searchcraft-input-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight{grid-template-rows:repeat(3, auto);grid-template-columns:1fr auto}.searchcraft-input-grid-buttonRight .searchcraft-input-button-wrapper{grid-column:2/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonRight .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-grid-buttonNone{grid-template-rows:repeat(3, auto);grid-template-columns:auto}.searchcraft-input-grid-buttonNone .searchcraft-input-button-wrapper{display:none}.searchcraft-input-grid-buttonNone .searchcraft-input-label-wrapper{grid-column:1/span 1;grid-row:1/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-error-wrapper{grid-column:1/span 1;grid-row:3/span 1}.searchcraft-input-grid-buttonNone .searchcraft-input-wrapper{grid-column:1/span 1;grid-row:2/span 1}.searchcraft-input-wrapper{position:relative;display:flex}.searchcraft-input{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);background-color:var(--sc-surface-neutral-secondary);border-radius:var(--sc-input-border-radius);border:none;color:var(--sc-content-neutral-primary);outline:none;padding-left:var(--sc-input-padding-left);padding-right:var(--sc-input-padding-right);padding-top:12px;padding-bottom:12px;flex:1}.searchcraft-input::placeholder{color:var(--sc-content-disabled)}.searchcraft-input:focus{outline:var(--sc-border-brand) solid 2px}.searchcraft-input:focus::placeholder{opacity:0}.searchcraft-input.error{color:var(--sc-content-danger);outline:var(--sc-border-danger) solid 2px}.searchcraft-input.error:focus{outline:var(--sc-border-danger) solid 2px}.searchcraft-input-search-icon-wrapper{align-items:center;justify-content:center;display:flex;position:absolute;pointer-events:none;bottom:0;left:0;top:0;width:var(--sc-input-padding-left)}.searchcraft-input-search-icon{pointer-events:none;width:var(--sc-input-search-icon-size);height:var(--sc-input-search-icon-size)}.searchcraft-input-clear-button{all:unset;align-items:center;justify-content:center;cursor:pointer;display:flex;position:absolute;border:none;outline:none;bottom:0;right:0;top:0;width:var(--sc-input-padding-right)}.searchcraft-input-clear-icon{width:var(--sc-input-clear-icon-size);height:var(--sc-input-clear-icon-size)}";
|
|
89
|
-
const SearchcraftInputFormStyle0 = searchcraftInputFormModuleCss;
|
|
90
|
-
|
|
91
90
|
const SearchcraftInput = class {
|
|
92
91
|
constructor(hostRef) {
|
|
93
92
|
index.registerInstance(this, hostRef);
|
|
@@ -97,64 +96,67 @@ const SearchcraftInput = class {
|
|
|
97
96
|
this.inputBlur = index.createEvent(this, "inputBlur", 7);
|
|
98
97
|
this.inputInit = index.createEvent(this, "inputInit", 7);
|
|
99
98
|
this.querySubmit = index.createEvent(this, "querySubmit", 7);
|
|
100
|
-
this.searchStore = store.useSearchcraftStore.getState();
|
|
101
|
-
this.handleOnInput = (event) => {
|
|
102
|
-
const input = event.target;
|
|
103
|
-
this.inputValue = input.value;
|
|
104
|
-
if (input.value.trim() === '') {
|
|
105
|
-
this.inputCleared.emit();
|
|
106
|
-
this.searchTerm = '';
|
|
107
|
-
this.searchStore.setQuery('');
|
|
108
|
-
this.searchStore.setSearchResults(null);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (!this.autoSearch) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.performSearch(input.value);
|
|
115
|
-
};
|
|
116
|
-
this.performSearch = async (value) => {
|
|
117
|
-
if (value === store.useSearchcraftStore.getState().query) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
this.searchTerm = value.trim();
|
|
121
|
-
this.error = false;
|
|
122
|
-
this.searchStore.setQuery(this.searchTerm);
|
|
123
|
-
this.querySubmit.emit(this.searchTerm);
|
|
124
|
-
try {
|
|
125
|
-
await this.searchStore.search();
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
this.error = true;
|
|
129
|
-
this.inputCleared.emit();
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
this.handleClearInput = () => {
|
|
133
|
-
this.inputValue = '';
|
|
134
|
-
this.searchTerm = '';
|
|
135
|
-
this.searchStore.setQuery('');
|
|
136
|
-
this.searchStore.setSearchResults(null);
|
|
137
|
-
this.error = false;
|
|
138
|
-
if (this.inputCleared) {
|
|
139
|
-
this.inputCleared.emit();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
this.handleFormSubmit = async (event) => {
|
|
143
|
-
event.preventDefault();
|
|
144
|
-
await this.performSearch(this.searchTerm);
|
|
145
|
-
};
|
|
146
|
-
this.config = undefined;
|
|
147
|
-
this.autoSearch = true;
|
|
148
|
-
this.buttonPlacement = 'none';
|
|
149
|
-
this.buttonLabel = undefined;
|
|
150
|
-
this.inputLabel = undefined;
|
|
151
|
-
this.customStyles = {};
|
|
152
|
-
this.placeholderValue = 'Enter Search';
|
|
153
|
-
this.searchTerm = '';
|
|
154
|
-
this.inputValue = this.searchTerm;
|
|
155
|
-
this.error = false;
|
|
156
|
-
this.isSearchcraftInitialized = false;
|
|
157
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* The Searchcraft config object.
|
|
102
|
+
*/
|
|
103
|
+
config;
|
|
104
|
+
/**
|
|
105
|
+
* Whether or not to automatically submit the search term when the input changes.
|
|
106
|
+
*/
|
|
107
|
+
autoSearch = true;
|
|
108
|
+
/**
|
|
109
|
+
* Where to place the search button.
|
|
110
|
+
*/
|
|
111
|
+
buttonPlacement = 'none';
|
|
112
|
+
/**
|
|
113
|
+
* The label for the submit button.
|
|
114
|
+
*/
|
|
115
|
+
buttonLabel;
|
|
116
|
+
/**
|
|
117
|
+
* The label rendered above the input.
|
|
118
|
+
*/
|
|
119
|
+
inputLabel;
|
|
120
|
+
/**
|
|
121
|
+
* A custom styles object to be applied to the input element.
|
|
122
|
+
*/
|
|
123
|
+
customStyles = {};
|
|
124
|
+
/**
|
|
125
|
+
* The input element's placeholder value.
|
|
126
|
+
*/
|
|
127
|
+
placeholderValue = 'Enter Search';
|
|
128
|
+
/**
|
|
129
|
+
* The starting value of the input element.
|
|
130
|
+
*/
|
|
131
|
+
searchTerm = '';
|
|
132
|
+
/**
|
|
133
|
+
* When the input is cleared.
|
|
134
|
+
*/
|
|
135
|
+
inputCleared;
|
|
136
|
+
/**
|
|
137
|
+
* When no results are returned.
|
|
138
|
+
*/
|
|
139
|
+
noResultsReceived;
|
|
140
|
+
/**
|
|
141
|
+
* When the input becomes focused.
|
|
142
|
+
*/
|
|
143
|
+
inputFocus;
|
|
144
|
+
/**
|
|
145
|
+
* When the input becomes unfocused.
|
|
146
|
+
*/
|
|
147
|
+
inputBlur;
|
|
148
|
+
/**
|
|
149
|
+
* Event emitted when input initializes.
|
|
150
|
+
*/
|
|
151
|
+
inputInit;
|
|
152
|
+
/**
|
|
153
|
+
* Event emitted when a query has been submitted.
|
|
154
|
+
*/
|
|
155
|
+
querySubmit;
|
|
156
|
+
inputValue = this.searchTerm;
|
|
157
|
+
error = false;
|
|
158
|
+
isSearchcraftInitialized = false;
|
|
159
|
+
searchStore = store.useSearchcraftStore.getState();
|
|
158
160
|
init() {
|
|
159
161
|
if (this.config && !this.isSearchcraftInitialized) {
|
|
160
162
|
const searchcraft = new store.ae(this.config, {
|
|
@@ -163,7 +165,7 @@ const SearchcraftInput = class {
|
|
|
163
165
|
});
|
|
164
166
|
this.searchStore.initialize(searchcraft, true);
|
|
165
167
|
this.isSearchcraftInitialized = true;
|
|
166
|
-
this.inputInit
|
|
168
|
+
this.inputInit?.emit();
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
171
|
componentDidLoad() {
|
|
@@ -172,6 +174,49 @@ const SearchcraftInput = class {
|
|
|
172
174
|
onConfigChange() {
|
|
173
175
|
this.init();
|
|
174
176
|
}
|
|
177
|
+
handleOnInput = (event) => {
|
|
178
|
+
const input = event.target;
|
|
179
|
+
this.inputValue = input.value;
|
|
180
|
+
if (input.value.trim() === '') {
|
|
181
|
+
this.inputCleared?.emit();
|
|
182
|
+
this.searchTerm = '';
|
|
183
|
+
this.searchStore.setQuery('');
|
|
184
|
+
this.searchStore.setSearchResults(null);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (!this.autoSearch) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.performSearch(input.value);
|
|
191
|
+
};
|
|
192
|
+
performSearch = async (value) => {
|
|
193
|
+
if (value === store.useSearchcraftStore.getState().query) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.searchTerm = value.trim();
|
|
197
|
+
this.error = false;
|
|
198
|
+
this.searchStore.setQuery(this.searchTerm);
|
|
199
|
+
this.querySubmit?.emit(this.searchTerm);
|
|
200
|
+
try {
|
|
201
|
+
await this.searchStore.search();
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
this.error = true;
|
|
205
|
+
this.inputCleared?.emit();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
handleClearInput = () => {
|
|
209
|
+
this.inputValue = '';
|
|
210
|
+
this.searchTerm = '';
|
|
211
|
+
this.searchStore.setQuery('');
|
|
212
|
+
this.searchStore.setSearchResults(null);
|
|
213
|
+
this.error = false;
|
|
214
|
+
this.inputCleared?.emit();
|
|
215
|
+
};
|
|
216
|
+
handleFormSubmit = async (event) => {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
await this.performSearch(this.searchTerm);
|
|
219
|
+
};
|
|
175
220
|
render() {
|
|
176
221
|
const validatedCustomStyles = styles.parseCustomStyles(this.customStyles);
|
|
177
222
|
const isShowingClearButton = this.inputValue.length > 0;
|
|
@@ -184,42 +229,43 @@ const SearchcraftInput = class {
|
|
|
184
229
|
const inputGridStyles = {
|
|
185
230
|
gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',
|
|
186
231
|
};
|
|
187
|
-
return (index.h("form", { key: '
|
|
232
|
+
return (index.h("form", { key: 'b23e712102e03332d5958b736133ac5222c571ed', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, index.h("div", { key: '62e1666b20e3901565241c83cb6b398afbaf14bf', class: inputGridClassNames, style: inputGridStyles }, index.h("div", { key: '1f78f96f48e354ba434bcd6c8eb20f6940d2281c', class: 'searchcraft-input-button-wrapper' }, index.h("searchcraft-button", { key: '0e89a333f3d489dccb05d978dde8622ee24a2508', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (index.h("div", { key: '1b75214db1a0a9d7144e8974e3467da9a94cc845', class: 'searchcraft-input-label-wrapper' }, index.h("searchcraft-input-label", { key: 'd7edaa9b980eae47628747488e4966ef62fab574', label: this.inputLabel }))), this.error && (index.h("div", { key: '936858e238d96838caa3aa34dbb4d86b3f6ad839', class: 'searchcraft-input-error-wrapper' }, index.h("searchcraft-error-message", { key: '75400c0a6f9d20f5c58ef0125f70a0ba8f2da920', errorMessage: 'Something went wrong.' }))), index.h("div", { key: '0978f74e9a83c78604c494fca9d8a885f73b5fff', class: 'searchcraft-input-wrapper' }, index.h("input", { key: '4a9f69a9e21c89c97daea9e4c19e41523c71e0f2', autoComplete: 'off', class: 'searchcraft-input', onFocus: () => this.inputFocus?.emit(), onBlur: () => this.inputBlur?.emit(), onInput: (event) => {
|
|
188
233
|
this.handleOnInput(event);
|
|
189
|
-
}, placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.inputValue }), index.h("div", { key: '
|
|
234
|
+
}, placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.inputValue }), index.h("div", { key: '9c215722544c132dc9e302c522d0f7c36c205b74', class: 'searchcraft-input-search-icon-wrapper' }, index.h("svg", { key: '4f6dfc2a89a888eafcd4aee6d02e40635c2fb78a', class: 'searchcraft-input-search-icon', viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'searchcraft-title' }, index.h("title", { key: '6be4ba3b739aeebd27e2ba0f3b7766c1ac6cf2e3', id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), index.h("path", { key: 'd62f785b5bb2f261a3dbf8e4d91f2db405e36dc4', d: 'M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z', stroke: '#404040', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))), isShowingClearButton && (index.h("button", { key: '8ca5193982311991eb0bf30a200b5bee25688c54', type: 'button', class: 'searchcraft-input-clear-button', onClick: this.handleClearInput }, index.h("svg", { key: 'a929aee41d677e850a2568ee08a047f35711b4bf', class: 'searchcraft-input-clear-icon', viewBox: '0 0 22 22', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', "aria-labelledby": 'icon-title' }, index.h("title", { key: '60b50c641ab494c1e8f02f3e1fa19d0a41162859', id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), index.h("path", { key: '6d47a20770f51f069efe06ee29c1451fd78de357', d: 'M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z', stroke: 'black', "stroke-width": '1.5', "stroke-linecap": 'round', "stroke-linejoin": 'round' }))))))));
|
|
190
235
|
}
|
|
191
236
|
static get watchers() { return {
|
|
192
237
|
"config": ["onConfigChange"]
|
|
193
238
|
}; }
|
|
194
239
|
};
|
|
195
|
-
SearchcraftInput.style = SearchcraftInputFormStyle0;
|
|
196
|
-
|
|
197
|
-
const searchcraftPopoverListViewModuleCss = "";
|
|
198
|
-
const SearchcraftPopoverListViewStyle0 = searchcraftPopoverListViewModuleCss;
|
|
199
240
|
|
|
200
241
|
const SearchcraftPopoverListView = class {
|
|
201
242
|
constructor(hostRef) {
|
|
202
243
|
index.registerInstance(this, hostRef);
|
|
203
|
-
this.popoverResultMappings = undefined;
|
|
204
|
-
this.documents = undefined;
|
|
205
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* The mappings that define how the data in the documents are mapped to the
|
|
247
|
+
* list-view-item elements.
|
|
248
|
+
*/
|
|
249
|
+
popoverResultMappings;
|
|
250
|
+
/**
|
|
251
|
+
* The documents to render in the list view.
|
|
252
|
+
*/
|
|
253
|
+
documents;
|
|
206
254
|
renderDocument(document, index$1) {
|
|
207
255
|
/**
|
|
208
256
|
* Index field values -> Result container props mappings.
|
|
209
257
|
*/
|
|
210
|
-
const titleContent = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
211
|
-
const subtitleContent = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
212
|
-
const href = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
213
|
-
const imageSource = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
214
|
-
const imageAlt = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings
|
|
258
|
+
const titleContent = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.title);
|
|
259
|
+
const subtitleContent = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.subtitle);
|
|
260
|
+
const href = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.href);
|
|
261
|
+
const imageSource = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.imageSource);
|
|
262
|
+
const imageAlt = units.getDocumentValueFromSearchResultMapping(document, this.popoverResultMappings?.imageAlt);
|
|
215
263
|
return (index.h("searchcraft-popover-list-item", { key: `${document.document_id}-${index$1}`, "title-content": titleContent, "subtitle-content": subtitleContent, "image-src": imageSource, "image-alt": imageAlt, href: href, "document-position": index$1 }));
|
|
216
264
|
}
|
|
217
265
|
render() {
|
|
218
|
-
|
|
219
|
-
return (index.h("div", { key: '6e9017370d7079412d6d31fb439be599d689c9c2', class: 'searchcraft-popover-list-view' }, (_a = this.documents) === null || _a === void 0 ? void 0 : _a.map((document, index) => this.renderDocument(document, index))));
|
|
266
|
+
return (index.h("div", { key: '2eee5552a2bf24bd0c75a224d4de6da8526df316', class: 'searchcraft-popover-list-view' }, this.documents?.map((document, index) => this.renderDocument(document, index))));
|
|
220
267
|
}
|
|
221
268
|
};
|
|
222
|
-
SearchcraftPopoverListView.style = SearchcraftPopoverListViewStyle0;
|
|
223
269
|
|
|
224
270
|
exports.searchcraft_input_form = SearchcraftInput;
|
|
225
271
|
exports.searchcraft_popover_list_view = SearchcraftPopoverListView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-input-form.searchcraft-popover-list-view.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,k4MAAk4M,CAAC;AACz6M,mCAAe,6BAA6B;;MCmD/B,gBAAgB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AAM,IAAI,GAAGA,6CAAuC,CAClD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAChC,CAAC;QACF,MAAM,WAAW,GAAGA,6CAAuC,CACzD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,WAAW,CACvC,CAAC;QACF,MAAM,QAAQ,GAAGA,6CAAuC,CACtD,QAAQ,EACR,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CACpC,CAAC;QAEF,QACEF,2CACE,GAAG,EAAE,GAAG,QAAQ,CAAC,WAAW,IAAIC,OAAK,EAAE,mBACxB,YAAY,sBACT,eAAe,eACtB,WAAW,eACX,QAAQ,EACnB,IAAI,EAAE,IAAI,uBACSA,OAAK,GACxB,EACF;KACH;IAED,MAAM;;QACJ,QACED,kEAAK,KAAK,EAAC,+BAA+B,IACvC,MAAA,IAAI,CAAC,SAAS,0CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KACnC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CACG,EACN;KACH;;;;;;;","names":["useSearchcraftStore","SearchcraftCore","parseCustomStyles","classNames","h","index","getDocumentValueFromSearchResultMapping"],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.module.scss?tag=searchcraft-input-form","src/components/searchcraft-input-form/searchcraft-input-form.tsx","src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.module.scss?tag=searchcraft-popover-list-view","src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.tsx"],"sourcesContent":[".searchcraft-input-grid {\n display: grid;\n gap: 4px 8px;\n}\n\n.searchcraft-input-grid-buttonLeft {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto 1fr;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 2 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 2 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonRight {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: 1fr auto;\n\n & .searchcraft-input-button-wrapper {\n grid-column: 2 / span 1;\n grid-row: 2 / span 1;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-grid-buttonNone {\n grid-template-rows: repeat(3, auto);\n grid-template-columns: auto;\n\n & .searchcraft-input-button-wrapper {\n display: none;\n }\n\n & .searchcraft-input-label-wrapper {\n grid-column: 1 / span 1;\n grid-row: 1 / span 1;\n }\n\n & .searchcraft-input-error-wrapper {\n grid-column: 1 / span 1;\n grid-row: 3 / span 1;\n }\n\n & .searchcraft-input-wrapper {\n grid-column: 1 / span 1;\n grid-row: 2 / span 1;\n }\n}\n\n.searchcraft-input-wrapper {\n position: relative;\n display: flex;\n}\n\n.searchcraft-input {\n @include body();\n background-color: var(--sc-surface-neutral-secondary);\n border-radius: var(--sc-input-border-radius);\n border: none;\n color: var(--sc-content-neutral-primary);\n outline: none;\n padding-left: var(--sc-input-padding-left);\n padding-right: var(--sc-input-padding-right);\n padding-top: 12px;\n padding-bottom: 12px;\n flex: 1;\n\n &::placeholder {\n color: var(--sc-content-disabled);\n }\n\n &:focus {\n outline: var(--sc-border-brand) solid 2px;\n }\n\n &:focus::placeholder {\n opacity: 0;\n }\n}\n\n.searchcraft-input.error {\n color: var(--sc-content-danger);\n outline: var(--sc-border-danger) solid 2px;\n\n &:focus {\n outline: var(--sc-border-danger) solid 2px;\n }\n}\n\n.searchcraft-input-search-icon-wrapper {\n align-items: center;\n justify-content: center;\n display: flex;\n position: absolute;\n pointer-events: none;\n bottom: 0;\n left: 0;\n top: 0;\n width: var(--sc-input-padding-left);\n}\n\n.searchcraft-input-search-icon {\n pointer-events: none;\n width: var(--sc-input-search-icon-size);\n height: var(--sc-input-search-icon-size);\n}\n\n.searchcraft-input-clear-button {\n all: unset;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n display: flex;\n position: absolute;\n border: none;\n outline: none;\n bottom: 0;\n right: 0;\n top: 0;\n width: var(--sc-input-padding-right);\n}\n\n.searchcraft-input-clear-icon {\n width: var(--sc-input-clear-icon-size);\n height: var(--sc-input-clear-icon-size);\n}\n","import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\n\nimport { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport packageJson from '../../../package.json';\n\nimport { parseCustomStyles } from '@utils';\nimport { useSearchcraftStore } from '@provider/store';\nimport classNames from 'classnames';\n\nexport interface ScInputCustomEvent<T> extends CustomEvent<T> {\n detail: T;\n target: HTMLSearchcraftInputFormElement;\n}\n\n/**\n * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.\n * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-form placeholder-value=\"Search here\" />\n * ```\n *\n * ```js\n * // index.js\n * const searchInputForm = document.querySelector('searchcraft-input-form');\n *\n * seardchInputForm.config = {\n * index: [],\n * readKey: '',\n * endpointUrl: '',\n * };\n *\n * searchForm.addEventListener('querySubmit', (event) => {\n * console.log('Query submitted', event.detail);\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-input-form',\n styleUrl: 'searchcraft-input-form.module.scss',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * The Searchcraft config object.\n */\n @Prop() config: SearchcraftConfig | undefined;\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel: string | undefined;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * When the input is cleared.\n */\n @Event() inputCleared: EventEmitter<void>;\n /**\n * When no results are returned.\n */\n @Event() noResultsReceived: EventEmitter<void>;\n /**\n * When the input becomes focused.\n */\n @Event() inputFocus: EventEmitter<void>;\n /**\n * When the input becomes unfocused.\n */\n @Event() inputBlur: EventEmitter<void>;\n /**\n * Event emitted when input initializes.\n */\n @Event() inputInit: EventEmitter<void>;\n /**\n * Event emitted when a query has been submitted.\n */\n @Event() querySubmit: EventEmitter<string>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n @State() isSearchcraftInitialized = false;\n\n private searchStore = useSearchcraftStore.getState();\n\n init() {\n if (this.config && !this.isSearchcraftInitialized) {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n this.isSearchcraftInitialized = true;\n this.inputInit.emit();\n }\n }\n\n componentDidLoad() {\n this.init();\n }\n\n @Watch('config')\n onConfigChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (input.value.trim() === '') {\n this.inputCleared.emit();\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n return;\n }\n\n if (!this.autoSearch) {\n return;\n }\n\n this.performSearch(input.value);\n };\n\n private performSearch = async (value: string) => {\n if (value === useSearchcraftStore.getState().query) {\n return;\n }\n\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setQuery(this.searchTerm);\n this.querySubmit.emit(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n this.error = true;\n this.inputCleared.emit();\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n this.error = false;\n\n if (this.inputCleared) {\n this.inputCleared.emit();\n }\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n const shouldHaveVerticalGap = this.inputLabel || this.error;\n const inputGridStyles = {\n gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',\n };\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames} style={inputGridStyles}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n {this.inputLabel && (\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n )}\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Something went wrong.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus.emit()}\n onBlur={() => this.inputBlur.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n d='M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z'\n stroke='#404040'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>\n Searchcraft Clear Input Icon Light\n </title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n","","import { Component, h, Prop } from '@stencil/core';\n\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { PopoverResultMappings } from 'types';\n\n/**\n * This web component is designed to display a list of results within a popover interface.\n * It is consumed within the `searchcraft-popover-form` component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-list-view />\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-list-view',\n styleUrl: 'searchcraft-popover-list-view.module.scss',\n shadow: false,\n})\nexport class SearchcraftPopoverListView {\n /**\n * The mappings that define how the data in the documents are mapped to the\n * list-view-item elements.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The documents to render in the list view.\n */\n @Prop() documents: Record<string, unknown>[] | undefined;\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.subtitle,\n );\n const href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.href,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.imageSource,\n );\n const imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings.imageAlt,\n );\n\n return (\n <searchcraft-popover-list-item\n key={`${document.document_id}-${index}`}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n image-src={imageSource}\n image-alt={imageAlt}\n href={href}\n document-position={index}\n />\n );\n }\n\n render() {\n return (\n <div class='searchcraft-popover-list-view'>\n {this.documents?.map((document, index) =>\n this.renderDocument(document, index),\n )}\n </div>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"searchcraft-input-form.searchcraft-popover-list-view.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA8Ca,gBAAgB;;;;;;;;;;;;;IAInB,MAAM,CAAgC;;;;IAItC,UAAU,GAAG,IAAI,CAAC;;;;IAIlB,eAAe,GAA8B,MAAM,CAAC;;;;IAIpD,WAAW,CAAqB;;;;IAIhC,UAAU,CAAqB;;;;IAI/B,YAAY,GAAoC,EAAE,CAAC;;;;IAInD,gBAAgB,GAAG,cAAc,CAAC;;;;IAIlC,UAAU,GAAG,EAAE,CAAC;;;;IAIf,YAAY,CAAsB;;;;IAIlC,iBAAiB,CAAsB;;;;IAIvC,UAAU,CAAsB;;;;IAIhC,SAAS,CAAsB;;;;IAI/B,SAAS,CAAsB;;;;IAI/B,WAAW,CAAwB;IAEnC,UAAU,GAAG,IAA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R,IAAI,CAAC,qBAAqB,EAAE,WAAW,CACxC,CAAC;QACF,MAAM,QAAQ,GAAGA,6CAAuC,CACtD,QAAQ,EACR,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CACrC,CAAC;QAEF,QACEF,2CACE,GAAG,EAAE,GAAG,QAAQ,CAAC,WAAW,IAAIC,OAAK,EAAE,mBACxB,YAAY,sBACT,eAAe,eACtB,WAAW,eACX,QAAQ,EACnB,IAAI,EAAE,IAAI,uBACSA,OAAK,GACxB,EACF;KACH;IAED,MAAM;QACJ,QACED,kEAAK,KAAK,EAAC,+BAA+B,IACvC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,KACnC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CACrC,CACG,EACN;KACH;;;;;;","names":["useSearchcraftStore","SearchcraftCore","parseCustomStyles","classNames","h","index","getDocumentValueFromSearchResultMapping"],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.tsx","src/components/searchcraft-popover-list-view/searchcraft-popover-list-view.tsx"],"sourcesContent":["import {\n Component,\n h,\n Prop,\n State,\n Event,\n type EventEmitter,\n Watch,\n} from '@stencil/core';\n\nimport { type SearchcraftConfig, SearchcraftCore } from '@searchcraft/core';\nimport packageJson from '../../../package.json';\n\nimport { parseCustomStyles } from '@utils';\nimport { useSearchcraftStore } from '@provider/store';\nimport classNames from 'classnames';\n\n/**\n * This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.\n * It abstracts the complexities of index-based searching, making it accessible to users of all technical levels.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-form placeholder-value=\"Search here\" />\n * ```\n *\n * ```js\n * // index.js\n * const searchInputForm = document.querySelector('searchcraft-input-form');\n *\n * seardchInputForm.config = {\n * index: [],\n * readKey: '',\n * endpointUrl: '',\n * };\n *\n * searchForm.addEventListener('querySubmit', (event) => {\n * console.log('Query submitted', event.detail);\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-input-form',\n shadow: false,\n})\nexport class SearchcraftInput {\n /**\n * The Searchcraft config object.\n */\n @Prop() config: SearchcraftConfig | undefined;\n /**\n * Whether or not to automatically submit the search term when the input changes.\n */\n @Prop() autoSearch = true;\n /**\n * Where to place the search button.\n */\n @Prop() buttonPlacement: 'left' | 'right' | 'none' = 'none';\n /**\n * The label for the submit button.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The label rendered above the input.\n */\n @Prop() inputLabel: string | undefined;\n /**\n * A custom styles object to be applied to the input element.\n */\n @Prop() customStyles: string | Record<string, string> = {};\n /**\n * The input element's placeholder value.\n */\n @Prop() placeholderValue = 'Enter Search';\n /**\n * The starting value of the input element.\n */\n @Prop() searchTerm = '';\n /**\n * When the input is cleared.\n */\n @Event() inputCleared?: EventEmitter<void>;\n /**\n * When no results are returned.\n */\n @Event() noResultsReceived?: EventEmitter<void>;\n /**\n * When the input becomes focused.\n */\n @Event() inputFocus?: EventEmitter<void>;\n /**\n * When the input becomes unfocused.\n */\n @Event() inputBlur?: EventEmitter<void>;\n /**\n * Event emitted when input initializes.\n */\n @Event() inputInit?: EventEmitter<void>;\n /**\n * Event emitted when a query has been submitted.\n */\n @Event() querySubmit?: EventEmitter<string>;\n\n @State() inputValue = this.searchTerm;\n @State() error = false;\n @State() isSearchcraftInitialized = false;\n\n private searchStore = useSearchcraftStore.getState();\n\n init() {\n if (this.config && !this.isSearchcraftInitialized) {\n const searchcraft = new SearchcraftCore(this.config, {\n sdkName: packageJson.name,\n sdkVersion: packageJson.version,\n });\n this.searchStore.initialize(searchcraft, true);\n this.isSearchcraftInitialized = true;\n this.inputInit?.emit();\n }\n }\n\n componentDidLoad() {\n this.init();\n }\n\n @Watch('config')\n onConfigChange() {\n this.init();\n }\n\n handleOnInput = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.inputValue = input.value;\n\n if (input.value.trim() === '') {\n this.inputCleared?.emit();\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n return;\n }\n\n if (!this.autoSearch) {\n return;\n }\n\n this.performSearch(input.value);\n };\n\n private performSearch = async (value: string) => {\n if (value === useSearchcraftStore.getState().query) {\n return;\n }\n\n this.searchTerm = value.trim();\n this.error = false;\n this.searchStore.setQuery(this.searchTerm);\n this.querySubmit?.emit(this.searchTerm);\n\n try {\n await this.searchStore.search();\n } catch (error) {\n this.error = true;\n this.inputCleared?.emit();\n }\n };\n\n handleClearInput = () => {\n this.inputValue = '';\n this.searchTerm = '';\n this.searchStore.setQuery('');\n this.searchStore.setSearchResults(null);\n this.error = false;\n\n this.inputCleared?.emit();\n };\n\n handleFormSubmit = async (event: Event) => {\n event.preventDefault();\n await this.performSearch(this.searchTerm);\n };\n\n render() {\n const validatedCustomStyles = parseCustomStyles(this.customStyles);\n\n const isShowingClearButton = this.inputValue.length > 0;\n\n const inputGridClassNames = classNames('searchcraft-input-grid', {\n 'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',\n 'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',\n 'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',\n });\n\n const shouldHaveVerticalGap = this.inputLabel || this.error;\n const inputGridStyles = {\n gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',\n };\n\n return (\n <form class='searchcraft-input-form' onSubmit={this.handleFormSubmit}>\n <div class={inputGridClassNames} style={inputGridStyles}>\n <div class='searchcraft-input-button-wrapper'>\n <searchcraft-button\n onButtonClick={this.handleFormSubmit}\n label={this.buttonLabel}\n />\n </div>\n {this.inputLabel && (\n <div class='searchcraft-input-label-wrapper'>\n <searchcraft-input-label label={this.inputLabel} />\n </div>\n )}\n {this.error && (\n <div class='searchcraft-input-error-wrapper'>\n <searchcraft-error-message errorMessage='Something went wrong.' />\n </div>\n )}\n <div class='searchcraft-input-wrapper'>\n <input\n autoComplete='off'\n class='searchcraft-input'\n onFocus={() => this.inputFocus?.emit()}\n onBlur={() => this.inputBlur?.emit()}\n onInput={(event) => {\n this.handleOnInput(event);\n }}\n placeholder={this.placeholderValue}\n style={validatedCustomStyles}\n type='text'\n value={this.inputValue}\n />\n <div class='searchcraft-input-search-icon-wrapper'>\n <svg\n class='searchcraft-input-search-icon'\n viewBox='0 0 20 20'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='searchcraft-title'\n >\n <title id='searchcraft-title'>\n Searchcraft Search Icon Light\n </title>\n <path\n d='M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z'\n stroke='#404040'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </div>\n {isShowingClearButton && (\n <button\n type='button'\n class='searchcraft-input-clear-button'\n onClick={this.handleClearInput}\n >\n <svg\n class='searchcraft-input-clear-icon'\n viewBox='0 0 22 22'\n fill='none'\n xmlns='http://www.w3.org/2000/svg'\n aria-labelledby='icon-title'\n >\n <title id='icon-title'>\n Searchcraft Clear Input Icon Light\n </title>\n <path\n d='M14 8L8 14M8 8L14 14M21 11C21 16.5228 16.5228 21 11 21C5.47715 21 1 16.5228 1 11C1 5.47715 5.47715 1 11 1C16.5228 1 21 5.47715 21 11Z'\n stroke='black'\n stroke-width='1.5'\n stroke-linecap='round'\n stroke-linejoin='round'\n />\n </svg>\n </button>\n )}\n </div>\n </div>\n </form>\n );\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\nimport { getDocumentValueFromSearchResultMapping } from '@utils';\nimport type { PopoverResultMappings } from 'types';\n\n/**\n * This web component is designed to display a list of results within a popover interface.\n * It is consumed within the `searchcraft-popover-form` component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-popover-list-view />\n * ```\n */\n@Component({\n tag: 'searchcraft-popover-list-view',\n shadow: false,\n})\nexport class SearchcraftPopoverListView {\n /**\n * The mappings that define how the data in the documents are mapped to the\n * list-view-item elements.\n */\n @Prop() popoverResultMappings: PopoverResultMappings | undefined;\n /**\n * The documents to render in the list view.\n */\n @Prop() documents: Record<string, unknown>[] | undefined;\n\n renderDocument(document: Record<string, unknown>, index: number) {\n /**\n * Index field values -> Result container props mappings.\n */\n const titleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.title,\n );\n const subtitleContent = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.subtitle,\n );\n const href = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.href,\n );\n const imageSource = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageSource,\n );\n const imageAlt = getDocumentValueFromSearchResultMapping(\n document,\n this.popoverResultMappings?.imageAlt,\n );\n\n return (\n <searchcraft-popover-list-item\n key={`${document.document_id}-${index}`}\n title-content={titleContent}\n subtitle-content={subtitleContent}\n image-src={imageSource}\n image-alt={imageAlt}\n href={href}\n document-position={index}\n />\n );\n }\n\n render() {\n return (\n <div class='searchcraft-popover-list-view'>\n {this.documents?.map((document, index) =>\n this.renderDocument(document, index),\n )}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-a81df4f0.js');
|
|
6
6
|
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
|
-
Stencil Client Patch Browser v4.
|
|
9
|
+
Stencil Client Patch Browser v4.25.0 | MIT Licensed | https://stenciljs.com
|
|
10
10
|
*/
|
|
11
11
|
var patchBrowser = () => {
|
|
12
12
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('searchcraft-javascript-sdk.cjs.js', document.baseURI).href));
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["searchcraft-filter-panel.cjs",[[0,"searchcraft-filter-panel",{"items":[16],"unsubscribe":[32],"lastQuery":[32]}]]],["searchcraft-base-search-results.cjs",[[4,"searchcraft-base-search-results",{"adInterval":[2,"ad-interval"],"customStylesForResults":[1,"custom-styles-for-results"],"searchResultMappings":[16],"placeAdAtEnd":[4,"place-ad-at-end"],"placeAdAtStart":[4,"place-ad-at-start"],"resultImagePlacement":[1,"result-image-placement"],"buttonLabel":[1,"button-label"],"buttonTarget":[1,"button-target"],"buttonRel":[1,"button-rel"],"containerTarget":[1,"container-target"],"containerRel":[1,"container-rel"],"hasSearched":[32],"query":[32],"searchResults":[32]}]]],["searchcraft-popover-button.cjs",[[4,"searchcraft-popover-button"]]],["searchcraft-results-info.cjs",[[0,"searchcraft-results-info",{"isRequesting":[32],"resultsCount":[32],"responseTime":[32],"query":[32]}]]],["searchcraft-base-search-result.cjs",[[0,"searchcraft-base-search-result",{"titleContent":[1,"title-content"],"subtitleContent":[1,"subtitle-content"],"bodyContent":[1,"body-content"],"footerContent":[1,"footer-content"],"buttonLabel":[1,"button-label"],"buttonHref":[1,"button-href"],"buttonTarget":[1,"button-target"],"buttonRel":[1,"button-rel"],"containerHref":[1,"container-href"],"containerTarget":[1,"container-target"],"containerRel":[1,"container-rel"],"imageSrc":[1,"image-src"],"imageAlt":[1,"image-alt"],"imagePlacement":[1,"image-placement"],"customStyles":[1,"custom-styles"],"documentPosition":[2,"document-position"]}]]],["searchcraft-popover-list-item.cjs",[[0,"searchcraft-popover-list-item",{"titleContent":[1,"title-content"],"subtitleContent":[1,"subtitle-content"],"imageSrc":[1,"image-src"],"imageAlt":[1,"image-alt"],"href":[1],"documentPosition":[2,"document-position"]}]]],["searchcraft-button_3.cjs",[[0,"searchcraft-button",{"iconElement":[16],"iconOnly":[4,"icon-only"],"iconPosition":[1,"icon-position"],"label":[1],"isRequesting":[32]}],[0,"searchcraft-input-label",{"inputLabelClassName":[1,"input-label-class-name"],"label":[1]}],[0,"searchcraft-error-message",{"errorMessage":[1,"error-message"]}]]],["searchcraft-input-form_2.cjs",[[0,"searchcraft-input-form",{"config":[16],"autoSearch":[4,"auto-search"],"buttonPlacement":[1,"button-placement"],"buttonLabel":[1,"button-label"],"inputLabel":[1,"input-label"],"customStyles":[1,"custom-styles"],"placeholderValue":[1,"placeholder-value"],"searchTerm":[1,"search-term"],"inputValue":[32],"error":[32],"isSearchcraftInitialized":[32]},null,{"config":["onConfigChange"]}],[0,"searchcraft-popover-list-view",{"popoverResultMappings":[16],"documents":[16]}]]],["searchcraft-popover-form.cjs",[[0,"searchcraft-popover-form",{"config":[16],"type":[1],"popoverResultMappings":[16],"hotkey":[1],"hotkeyModifier":[1,"hotkey-modifier"],"isPopoverVisibleInState":[32],"unsubscribe":[32],"searchResults":[32],"searchTerm":[32],"isFocused":[32],"breakpointSm":[32],"breakpointMd":[32],"breakpointLg":[32],"modalElement":[32]}]]],["searchcraft-facet-list_3.cjs",[[0,"searchcraft-facet-list",{"fieldName":[1,"field-name"],"baseFacetRoot":[32],"facetRoot":[32],"selectedPaths":[32],"lastTimeTaken":[32],"hasNewSearchTerm":[32],"lastQuery":[32],"lastSearchMode":[32],"lastSortType":[32],"unsubscribe":[32]}],[0,"searchcraft-slider",{"max":[2],"min":[2],"granularity":[2],"dataType":[1,"data-type"],"endValue":[32],"startValue":[32],"lastFocusedHandle":[32]}],[0,"searchcraft-toggle-button",{"label":[1],"subLabel":[1,"sub-label"],"isActive":[32],"unsubscribe":[32],"lastQuery":[32]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["searchcraft-filter-panel.cjs",[[0,"searchcraft-filter-panel",{"items":[16],"unsubscribe":[32],"lastQuery":[32]}]]],["searchcraft-base-search-results.cjs",[[4,"searchcraft-base-search-results",{"adInterval":[2,"ad-interval"],"customStylesForResults":[1,"custom-styles-for-results"],"searchResultMappings":[16],"placeAdAtEnd":[4,"place-ad-at-end"],"placeAdAtStart":[4,"place-ad-at-start"],"resultImagePlacement":[1,"result-image-placement"],"buttonLabel":[1,"button-label"],"buttonTarget":[1,"button-target"],"buttonRel":[1,"button-rel"],"containerTarget":[1,"container-target"],"containerRel":[1,"container-rel"],"hasSearched":[32],"query":[32],"searchResults":[32]}]]],["searchcraft-popover-button.cjs",[[4,"searchcraft-popover-button"]]],["searchcraft-results-info.cjs",[[0,"searchcraft-results-info",{"isRequesting":[32],"resultsCount":[32],"responseTime":[32],"query":[32]}]]],["searchcraft-theme.cjs",[[0,"searchcraft-theme"]]],["searchcraft-base-search-result.cjs",[[0,"searchcraft-base-search-result",{"titleContent":[1,"title-content"],"subtitleContent":[1,"subtitle-content"],"bodyContent":[1,"body-content"],"footerContent":[1,"footer-content"],"buttonLabel":[1,"button-label"],"buttonHref":[1,"button-href"],"buttonTarget":[1,"button-target"],"buttonRel":[1,"button-rel"],"containerHref":[1,"container-href"],"containerTarget":[1,"container-target"],"containerRel":[1,"container-rel"],"imageSrc":[1,"image-src"],"imageAlt":[1,"image-alt"],"imagePlacement":[1,"image-placement"],"customStyles":[1,"custom-styles"],"documentPosition":[2,"document-position"]}]]],["searchcraft-popover-list-item.cjs",[[0,"searchcraft-popover-list-item",{"titleContent":[1,"title-content"],"subtitleContent":[1,"subtitle-content"],"imageSrc":[1,"image-src"],"imageAlt":[1,"image-alt"],"href":[1],"documentPosition":[2,"document-position"]}]]],["searchcraft-button_3.cjs",[[0,"searchcraft-button",{"iconElement":[16],"iconOnly":[4,"icon-only"],"iconPosition":[1,"icon-position"],"label":[1],"isRequesting":[32]}],[0,"searchcraft-input-label",{"inputLabelClassName":[1,"input-label-class-name"],"label":[1]}],[0,"searchcraft-error-message",{"errorMessage":[1,"error-message"]}]]],["searchcraft-input-form_2.cjs",[[0,"searchcraft-input-form",{"config":[16],"autoSearch":[4,"auto-search"],"buttonPlacement":[1,"button-placement"],"buttonLabel":[1,"button-label"],"inputLabel":[1,"input-label"],"customStyles":[1,"custom-styles"],"placeholderValue":[1,"placeholder-value"],"searchTerm":[1,"search-term"],"inputValue":[32],"error":[32],"isSearchcraftInitialized":[32]},null,{"config":["onConfigChange"]}],[0,"searchcraft-popover-list-view",{"popoverResultMappings":[16],"documents":[16]}]]],["searchcraft-popover-form.cjs",[[0,"searchcraft-popover-form",{"config":[16],"type":[1],"popoverResultMappings":[16],"hotkey":[1],"hotkeyModifier":[1,"hotkey-modifier"],"isPopoverVisibleInState":[32],"unsubscribe":[32],"searchResults":[32],"searchTerm":[32],"isFocused":[32],"breakpointSm":[32],"breakpointMd":[32],"breakpointLg":[32],"modalElement":[32]}]]],["searchcraft-facet-list_3.cjs",[[0,"searchcraft-facet-list",{"fieldName":[1,"field-name"],"baseFacetRoot":[32],"facetRoot":[32],"selectedPaths":[32],"lastTimeTaken":[32],"hasNewSearchTerm":[32],"lastQuery":[32],"lastSearchMode":[32],"lastSortType":[32],"unsubscribe":[32]}],[0,"searchcraft-slider",{"max":[2],"min":[2],"granularity":[2],"dataType":[1,"data-type"],"endValue":[32],"startValue":[32],"lastFocusedHandle":[32]}],[0,"searchcraft-toggle-button",{"label":[1],"subLabel":[1,"sub-label"],"isActive":[32],"unsubscribe":[32],"lastQuery":[32]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-javascript-sdk.cjs.js","mappings":";;;;;;;AAAA;AACA;AACA;AAKA,IAAI,YAAY,GAAG,MAAM;AAUzB,EAAE,MAAM,UAAU,GAAG,4NAAe,CAAC;AACrC,EAAE,MAAM,IAAI,GAAiE,EAAE,CAAC;AAChF,EAAE,IAAI,UAAU,KAAK,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AACtD,GAAG;AACH,EAAE,OAAOA,oBAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;;ACnBD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK;AACvC,EAAE,MAAMC,wBAAa,EAAE,CAAC;AACxB,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC;;;;","names":["promiseResolve","globalScripts","bootstrapLazy"],"sources":["../../node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.
|
|
1
|
+
{"file":"searchcraft-javascript-sdk.cjs.js","mappings":";;;;;;;AAAA;AACA;AACA;AAKA,IAAI,YAAY,GAAG,MAAM;AAUzB,EAAE,MAAM,UAAU,GAAG,4NAAe,CAAC;AACrC,EAAE,MAAM,IAAI,GAAiE,EAAE,CAAC;AAChF,EAAE,IAAI,UAAU,KAAK,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;AACtD,GAAG;AACH,EAAE,OAAOA,oBAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;;ACnBD,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,OAAO,KAAK;AACvC,EAAE,MAAMC,wBAAa,EAAE,CAAC;AACxB,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC,CAAC;;;;","names":["promiseResolve","globalScripts","bootstrapLazy"],"sources":["../../node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.25.0 | MIT Licensed | https://stenciljs.com\n */\n\n// src/client/client-patch-browser.ts\nimport { BUILD, NAMESPACE } from \"@stencil/core/internal/app-data\";\nimport { consoleDevInfo, doc, H, promiseResolve } from \"@stencil/core\";\nvar patchBrowser = () => {\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo(\"Running in development mode.\");\n }\n if (BUILD.cloneNodeFix) {\n patchCloneNodeFix(H.prototype);\n }\n const scriptElm = BUILD.scriptDataOpts ? Array.from(doc.querySelectorAll(\"script\")).find(\n (s) => new RegExp(`/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) || s.getAttribute(\"data-stencil-namespace\") === NAMESPACE\n ) : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})[\"data-opts\"] || {} : {};\n if (importMeta !== \"\") {\n opts.resourcesUrl = new URL(\".\", importMeta).href;\n }\n return promiseResolve(opts);\n};\nvar patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function(deep) {\n if (this.nodeName === \"TEMPLATE\") {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport {\n patchBrowser\n};\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(async (options) => {\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"version":3}
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const store = require('./store-
|
|
7
|
-
|
|
8
|
-
const searchcraftPopoverButtonModuleCss = "";
|
|
9
|
-
const SearchcraftPopoverButtonStyle0 = searchcraftPopoverButtonModuleCss;
|
|
5
|
+
const index = require('./index-a81df4f0.js');
|
|
6
|
+
const store = require('./store-f6ba3dfb.js');
|
|
10
7
|
|
|
11
8
|
const SearchcraftPopoverButton = class {
|
|
12
9
|
constructor(hostRef) {
|
|
@@ -16,10 +13,9 @@ const SearchcraftPopoverButton = class {
|
|
|
16
13
|
store.useSearchcraftStore.getState().setPopoverVisibility(true);
|
|
17
14
|
}
|
|
18
15
|
render() {
|
|
19
|
-
return (index.h("button", { key: '
|
|
16
|
+
return (index.h("button", { key: '3907a514a85a79c320f529840fda06474721871a', type: 'button', onClick: this.handleOnClick.bind(this) }, index.h("slot", { key: '91bedc41efb5c17a774eab7a95e0abac39497408' })));
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
SearchcraftPopoverButton.style = SearchcraftPopoverButtonStyle0;
|
|
23
19
|
|
|
24
20
|
exports.searchcraft_popover_button = SearchcraftPopoverButton;
|
|
25
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-popover-button.entry.cjs.js","mappings":";;;;;;;
|
|
1
|
+
{"file":"searchcraft-popover-button.entry.cjs.js","mappings":";;;;;;;MAUa,wBAAwB;;;;IACnC,aAAa;QACXA,yBAAmB,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,MAAM;QACJ,QACEC,qEAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAC1DA,oEAAQ,CACD,EACT;KACH;;;;;","names":["useSearchcraftStore","h"],"sources":["src/components/searchcraft-popover-button/searchcraft-popover-button.tsx"],"sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, h } from '@stencil/core';\n\n/**\n * Renders a button which, when clicked, turns on popover visibility.\n */\n@Component({\n tag: 'searchcraft-popover-button',\n shadow: false,\n})\nexport class SearchcraftPopoverButton {\n handleOnClick() {\n useSearchcraftStore.getState().setPopoverVisibility(true);\n }\n\n render() {\n return (\n <button type='button' onClick={this.handleOnClick.bind(this)}>\n <slot />\n </button>\n );\n }\n}\n"],"version":3}
|