@searchcraft/javascript-sdk 0.7.0 → 0.7.2
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 +7 -1
- package/dist/cjs/{index-d4b4a45e.js → index-a81df4f0.js} +29 -113
- package/dist/{components/p-6cafd48d.js.map → cjs/index-a81df4f0.js.map} +1 -1
- 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 -44
- package/dist/cjs/searchcraft-base-search-result.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +74 -50
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-button_3.cjs.entry.js +37 -36
- package/dist/cjs/searchcraft-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +141 -119
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +11 -14
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js +127 -92
- package/dist/cjs/searchcraft-input-form_2.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-javascript-sdk.cjs.js +2 -2
- 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 -75
- package/dist/cjs/searchcraft-popover-form.cjs.entry.js.map +1 -1
- package/dist/cjs/searchcraft-popover-list-item.cjs.entry.js +29 -6
- 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-abe47006.js → store-f6ba3dfb.js} +26 -10
- package/dist/cjs/{store-abe47006.js.map → store-f6ba3dfb.js.map} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/searchcraft-base-search-result/searchcraft-base-search-result.js +102 -62
- 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 +77 -61
- 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 +26 -30
- package/dist/collection/components/searchcraft-button/searchcraft-button.js.map +1 -1
- package/dist/collection/components/searchcraft-error-message/searchcraft-error-message.js +6 -12
- 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 +59 -51
- 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 +9 -20
- 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 +109 -87
- 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 +10 -20
- 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 +81 -82
- 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 +35 -17
- 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 +17 -19
- 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 +57 -65
- package/dist/collection/components/searchcraft-slider/searchcraft-slider.js.map +1 -1
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js +37 -0
- package/dist/collection/components/searchcraft-theme/searchcraft-theme.js.map +1 -0
- package/dist/collection/components/searchcraft-toggle-button/searchcraft-toggle-button.js +23 -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-e1cf5f9d.js → p-506cdac1.js} +18 -14
- 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-6cafd48d.js → p-5365011f.js} +30 -123
- 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/{esm/store-712f0586.js → components/p-936e2ed4.js} +26 -10
- package/dist/components/{p-01dc5b3b.js.map → p-936e2ed4.js.map} +1 -1
- package/dist/components/p-960ddc89.js +284 -0
- package/dist/components/p-960ddc89.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/searchcraft-base-search-result.js +1 -1
- package/dist/components/searchcraft-base-search-results.js +76 -52
- 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 -17
- 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 -81
- 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-56b713de.js → index-3608c57d.js} +29 -113
- 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 -44
- package/dist/esm/searchcraft-base-search-result.entry.js.map +1 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +74 -50
- package/dist/esm/searchcraft-base-search-results.entry.js.map +1 -1
- package/dist/esm/searchcraft-button_3.entry.js +37 -36
- package/dist/esm/searchcraft-button_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +141 -119
- package/dist/esm/searchcraft-facet-list_3.entry.js.map +1 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +11 -14
- package/dist/esm/searchcraft-filter-panel.entry.js.map +1 -1
- package/dist/esm/searchcraft-input-form_2.entry.js +127 -92
- package/dist/esm/searchcraft-input-form_2.entry.js.map +1 -1
- package/dist/esm/searchcraft-javascript-sdk.js +3 -3
- 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 -75
- package/dist/esm/searchcraft-popover-form.entry.js.map +1 -1
- package/dist/esm/searchcraft-popover-list-item.entry.js +29 -6
- 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/{components/p-01dc5b3b.js → esm/store-aa071d9c.js} +26 -10
- package/dist/esm/{store-712f0586.js.map → store-aa071d9c.js.map} +1 -1
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/p-109ab0e0.entry.js +2 -0
- package/dist/searchcraft-javascript-sdk/p-109ab0e0.entry.js.map +1 -0
- 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-01dc5b3b.js → p-936e2ed4.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-01dc5b3b.js.map → p-936e2ed4.js.map} +1 -1
- 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 +15 -0
- package/dist/types/components/searchcraft-toggle-button/searchcraft-toggle-button.d.ts +2 -1
- package/dist/types/components.d.ts +53 -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 +5 -4
- package/dist/cjs/index-d4b4a45e.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-1ae87308.js +0 -43
- package/dist/components/p-1ae87308.js.map +0 -1
- package/dist/components/p-649654b5.js +0 -268
- package/dist/components/p-649654b5.js.map +0 -1
- package/dist/components/p-662cb490.js +0 -67
- package/dist/components/p-662cb490.js.map +0 -1
- package/dist/components/p-87d1611b.js +0 -97
- package/dist/components/p-87d1611b.js.map +0 -1
- package/dist/components/p-c273e43d.js +0 -40
- package/dist/components/p-c273e43d.js.map +0 -1
- package/dist/components/p-cc9f8c61.js +0 -109
- package/dist/components/p-cc9f8c61.js.map +0 -1
- package/dist/components/p-cf096782.js +0 -56
- package/dist/components/p-cf096782.js.map +0 -1
- package/dist/components/p-da5b92ef.js +0 -253
- package/dist/components/p-da5b92ef.js.map +0 -1
- package/dist/components/p-e1cf5f9d.js.map +0 -1
- package/dist/components/p-f5a06210.js +0 -34
- package/dist/components/p-f5a06210.js.map +0 -1
- package/dist/esm/index-56b713de.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-117fcdd3.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-129e6f2c.js +0 -3
- package/dist/searchcraft-javascript-sdk/p-129e6f2c.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-27cb401c.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-27cb401c.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-4df4a29e.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-54248dd8.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-54248dd8.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-69430dbf.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-69430dbf.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-a460755d.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-a460755d.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-bc2c4259.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-bc2c4259.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-caecdcda.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-f8129731.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-f8129731.entry.js.map +0 -1
- package/dist/searchcraft-javascript-sdk/p-f839b682.entry.js +0 -2
- package/dist/searchcraft-javascript-sdk/p-f839b682.entry.js.map +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h } from './p-5365011f.js';
|
|
2
|
+
import { u as useSearchcraftStore, b as ae } from './p-936e2ed4.js';
|
|
3
|
+
import { p as parseCustomStyles } from './p-d9551738.js';
|
|
4
|
+
import { c as classNames } from './p-5cdc6210.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './p-521fe971.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './p-a75ef832.js';
|
|
7
|
+
import { d as defineCustomElement$1 } from './p-ca881e5c.js';
|
|
8
|
+
|
|
9
|
+
const name = "@searchcraft/javascript-sdk";
|
|
10
|
+
const version = "0.7.2";
|
|
11
|
+
const description = "Searchcraft Javascript SDK";
|
|
12
|
+
const author = "Searchcraft";
|
|
13
|
+
const license = "Apache-2.0";
|
|
14
|
+
const main = "dist/index.cjs.js";
|
|
15
|
+
const module = "dist/index.js";
|
|
16
|
+
const types = "dist/types/index.d.ts";
|
|
17
|
+
const collection = "dist/collection/collection-manifest.json";
|
|
18
|
+
const unpkg = "dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js";
|
|
19
|
+
const exports = {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js",
|
|
22
|
+
require: "./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.cjs.js",
|
|
23
|
+
types: "./dist/types/index.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./components": {
|
|
26
|
+
"import": "./dist/components/index.js",
|
|
27
|
+
types: "./dist/components/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./loader": {
|
|
30
|
+
"import": "./dist/loader/index.js",
|
|
31
|
+
require: "./dist/loader/index.cjs",
|
|
32
|
+
types: "./dist/loader/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./dist/components/*": {
|
|
35
|
+
"import": "./dist/components/*",
|
|
36
|
+
types: "./dist/components/*"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const repository = {
|
|
40
|
+
type: "git",
|
|
41
|
+
url: "https://bitbucket.org/madebychalk/searchcraft-javascript-sdks/"
|
|
42
|
+
};
|
|
43
|
+
const files = [
|
|
44
|
+
"dist/"
|
|
45
|
+
];
|
|
46
|
+
const scripts = {
|
|
47
|
+
build: "stencil build && yarn docs",
|
|
48
|
+
docs: "typedoc --options typedoc.json",
|
|
49
|
+
dev: "stencil build --dev --watch",
|
|
50
|
+
test: "stencil test --spec --e2e",
|
|
51
|
+
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
52
|
+
generate: "stencil generate"
|
|
53
|
+
};
|
|
54
|
+
const dependencies = {
|
|
55
|
+
"@stencil/vue-output-target": "^0.9.2",
|
|
56
|
+
classnames: "^2.3.2"
|
|
57
|
+
};
|
|
58
|
+
const devDependencies = {
|
|
59
|
+
"@searchcraft/core": "^0.7.2",
|
|
60
|
+
"@searchcraft/javascript-sdk": "*",
|
|
61
|
+
"@stencil/core": "^4.7.0",
|
|
62
|
+
"@stencil/react-output-target": "^0.8.2",
|
|
63
|
+
"@stencil/sass": "^3.0.12",
|
|
64
|
+
"@types/node": "^16.18.11",
|
|
65
|
+
zustand: "^5.0.1"
|
|
66
|
+
};
|
|
67
|
+
const packageJson = {
|
|
68
|
+
name: name,
|
|
69
|
+
"private": false,
|
|
70
|
+
version: version,
|
|
71
|
+
description: description,
|
|
72
|
+
author: author,
|
|
73
|
+
license: license,
|
|
74
|
+
main: main,
|
|
75
|
+
module: module,
|
|
76
|
+
types: types,
|
|
77
|
+
collection: collection,
|
|
78
|
+
"collection:main": "dist/collection/index.js",
|
|
79
|
+
unpkg: unpkg,
|
|
80
|
+
exports: exports,
|
|
81
|
+
repository: repository,
|
|
82
|
+
files: files,
|
|
83
|
+
scripts: scripts,
|
|
84
|
+
dependencies: dependencies,
|
|
85
|
+
devDependencies: devDependencies
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const SearchcraftInput = /*@__PURE__*/ proxyCustomElement(class SearchcraftInput extends H {
|
|
89
|
+
constructor() {
|
|
90
|
+
super();
|
|
91
|
+
this.__registerHost();
|
|
92
|
+
this.inputCleared = createEvent(this, "inputCleared", 7);
|
|
93
|
+
this.noResultsReceived = createEvent(this, "noResultsReceived", 7);
|
|
94
|
+
this.inputFocus = createEvent(this, "inputFocus", 7);
|
|
95
|
+
this.inputBlur = createEvent(this, "inputBlur", 7);
|
|
96
|
+
this.inputInit = createEvent(this, "inputInit", 7);
|
|
97
|
+
this.querySubmit = createEvent(this, "querySubmit", 7);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The Searchcraft config object.
|
|
101
|
+
*/
|
|
102
|
+
config;
|
|
103
|
+
/**
|
|
104
|
+
* Whether or not to automatically submit the search term when the input changes.
|
|
105
|
+
*/
|
|
106
|
+
autoSearch = true;
|
|
107
|
+
/**
|
|
108
|
+
* Where to place the search button.
|
|
109
|
+
*/
|
|
110
|
+
buttonPlacement = 'none';
|
|
111
|
+
/**
|
|
112
|
+
* The label for the submit button.
|
|
113
|
+
*/
|
|
114
|
+
buttonLabel;
|
|
115
|
+
/**
|
|
116
|
+
* The label rendered above the input.
|
|
117
|
+
*/
|
|
118
|
+
inputLabel;
|
|
119
|
+
/**
|
|
120
|
+
* A custom styles object to be applied to the input element.
|
|
121
|
+
*/
|
|
122
|
+
customStyles = {};
|
|
123
|
+
/**
|
|
124
|
+
* The input element's placeholder value.
|
|
125
|
+
*/
|
|
126
|
+
placeholderValue = 'Enter Search';
|
|
127
|
+
/**
|
|
128
|
+
* The starting value of the input element.
|
|
129
|
+
*/
|
|
130
|
+
searchTerm = '';
|
|
131
|
+
/**
|
|
132
|
+
* When the input is cleared.
|
|
133
|
+
*/
|
|
134
|
+
inputCleared;
|
|
135
|
+
/**
|
|
136
|
+
* When no results are returned.
|
|
137
|
+
*/
|
|
138
|
+
noResultsReceived;
|
|
139
|
+
/**
|
|
140
|
+
* When the input becomes focused.
|
|
141
|
+
*/
|
|
142
|
+
inputFocus;
|
|
143
|
+
/**
|
|
144
|
+
* When the input becomes unfocused.
|
|
145
|
+
*/
|
|
146
|
+
inputBlur;
|
|
147
|
+
/**
|
|
148
|
+
* Event emitted when input initializes.
|
|
149
|
+
*/
|
|
150
|
+
inputInit;
|
|
151
|
+
/**
|
|
152
|
+
* Event emitted when a query has been submitted.
|
|
153
|
+
*/
|
|
154
|
+
querySubmit;
|
|
155
|
+
inputValue = this.searchTerm;
|
|
156
|
+
error = false;
|
|
157
|
+
isSearchcraftInitialized = false;
|
|
158
|
+
searchStore = useSearchcraftStore.getState();
|
|
159
|
+
init() {
|
|
160
|
+
if (this.config && !this.isSearchcraftInitialized) {
|
|
161
|
+
const searchcraft = new ae(this.config, {
|
|
162
|
+
sdkName: packageJson.name,
|
|
163
|
+
sdkVersion: packageJson.version,
|
|
164
|
+
});
|
|
165
|
+
this.searchStore.initialize(searchcraft, true);
|
|
166
|
+
this.isSearchcraftInitialized = true;
|
|
167
|
+
this.inputInit?.emit();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
componentDidLoad() {
|
|
171
|
+
this.init();
|
|
172
|
+
}
|
|
173
|
+
onConfigChange() {
|
|
174
|
+
this.init();
|
|
175
|
+
}
|
|
176
|
+
handleOnInput = (event) => {
|
|
177
|
+
const input = event.target;
|
|
178
|
+
this.inputValue = input.value;
|
|
179
|
+
if (input.value.trim() === '') {
|
|
180
|
+
this.inputCleared?.emit();
|
|
181
|
+
this.searchTerm = '';
|
|
182
|
+
this.searchStore.setQuery('');
|
|
183
|
+
this.searchStore.setSearchResults(null);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (!this.autoSearch) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.performSearch(input.value);
|
|
190
|
+
};
|
|
191
|
+
performSearch = async (value) => {
|
|
192
|
+
if (value === useSearchcraftStore.getState().query) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.searchTerm = value.trim();
|
|
196
|
+
this.error = false;
|
|
197
|
+
this.searchStore.setQuery(this.searchTerm);
|
|
198
|
+
this.querySubmit?.emit(this.searchTerm);
|
|
199
|
+
try {
|
|
200
|
+
await this.searchStore.search();
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
this.error = true;
|
|
204
|
+
this.inputCleared?.emit();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
handleClearInput = () => {
|
|
208
|
+
this.inputValue = '';
|
|
209
|
+
this.searchTerm = '';
|
|
210
|
+
this.searchStore.setQuery('');
|
|
211
|
+
this.searchStore.setSearchResults(null);
|
|
212
|
+
this.error = false;
|
|
213
|
+
this.inputCleared?.emit();
|
|
214
|
+
};
|
|
215
|
+
handleFormSubmit = async (event) => {
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
await this.performSearch(this.searchTerm);
|
|
218
|
+
};
|
|
219
|
+
render() {
|
|
220
|
+
const validatedCustomStyles = parseCustomStyles(this.customStyles);
|
|
221
|
+
const isShowingClearButton = this.inputValue.length > 0;
|
|
222
|
+
const inputGridClassNames = classNames('searchcraft-input-grid', {
|
|
223
|
+
'searchcraft-input-grid-buttonLeft': this.buttonPlacement === 'left',
|
|
224
|
+
'searchcraft-input-grid-buttonRight': this.buttonPlacement === 'right',
|
|
225
|
+
'searchcraft-input-grid-buttonNone': this.buttonPlacement === 'none',
|
|
226
|
+
});
|
|
227
|
+
const shouldHaveVerticalGap = this.inputLabel || this.error;
|
|
228
|
+
const inputGridStyles = {
|
|
229
|
+
gap: shouldHaveVerticalGap ? '4px 8px' : '0px 8px',
|
|
230
|
+
};
|
|
231
|
+
return (h("form", { key: 'b23e712102e03332d5958b736133ac5222c571ed', class: 'searchcraft-input-form', onSubmit: this.handleFormSubmit }, h("div", { key: '62e1666b20e3901565241c83cb6b398afbaf14bf', class: inputGridClassNames, style: inputGridStyles }, h("div", { key: '1f78f96f48e354ba434bcd6c8eb20f6940d2281c', class: 'searchcraft-input-button-wrapper' }, h("searchcraft-button", { key: '0e89a333f3d489dccb05d978dde8622ee24a2508', onButtonClick: this.handleFormSubmit, label: this.buttonLabel })), this.inputLabel && (h("div", { key: '1b75214db1a0a9d7144e8974e3467da9a94cc845', class: 'searchcraft-input-label-wrapper' }, h("searchcraft-input-label", { key: 'd7edaa9b980eae47628747488e4966ef62fab574', label: this.inputLabel }))), this.error && (h("div", { key: '936858e238d96838caa3aa34dbb4d86b3f6ad839', class: 'searchcraft-input-error-wrapper' }, h("searchcraft-error-message", { key: '75400c0a6f9d20f5c58ef0125f70a0ba8f2da920', errorMessage: 'Something went wrong.' }))), h("div", { key: '0978f74e9a83c78604c494fca9d8a885f73b5fff', class: 'searchcraft-input-wrapper' }, h("input", { key: '4a9f69a9e21c89c97daea9e4c19e41523c71e0f2', autoComplete: 'off', class: 'searchcraft-input', onFocus: () => this.inputFocus?.emit(), onBlur: () => this.inputBlur?.emit(), onInput: (event) => {
|
|
232
|
+
this.handleOnInput(event);
|
|
233
|
+
}, placeholder: this.placeholderValue, style: validatedCustomStyles, type: 'text', value: this.inputValue }), h("div", { key: '9c215722544c132dc9e302c522d0f7c36c205b74', class: 'searchcraft-input-search-icon-wrapper' }, 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' }, h("title", { key: '6be4ba3b739aeebd27e2ba0f3b7766c1ac6cf2e3', id: 'searchcraft-title' }, "Searchcraft Search Icon Light"), 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 && (h("button", { key: '8ca5193982311991eb0bf30a200b5bee25688c54', type: 'button', class: 'searchcraft-input-clear-button', onClick: this.handleClearInput }, 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' }, h("title", { key: '60b50c641ab494c1e8f02f3e1fa19d0a41162859', id: 'icon-title' }, "Searchcraft Clear Input Icon Light"), 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' }))))))));
|
|
234
|
+
}
|
|
235
|
+
static get watchers() { return {
|
|
236
|
+
"config": ["onConfigChange"]
|
|
237
|
+
}; }
|
|
238
|
+
}, [0, "searchcraft-input-form", {
|
|
239
|
+
"config": [16],
|
|
240
|
+
"autoSearch": [4, "auto-search"],
|
|
241
|
+
"buttonPlacement": [1, "button-placement"],
|
|
242
|
+
"buttonLabel": [1, "button-label"],
|
|
243
|
+
"inputLabel": [1, "input-label"],
|
|
244
|
+
"customStyles": [1, "custom-styles"],
|
|
245
|
+
"placeholderValue": [1, "placeholder-value"],
|
|
246
|
+
"searchTerm": [1, "search-term"],
|
|
247
|
+
"inputValue": [32],
|
|
248
|
+
"error": [32],
|
|
249
|
+
"isSearchcraftInitialized": [32]
|
|
250
|
+
}, undefined, {
|
|
251
|
+
"config": ["onConfigChange"]
|
|
252
|
+
}]);
|
|
253
|
+
function defineCustomElement() {
|
|
254
|
+
if (typeof customElements === "undefined") {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const components = ["searchcraft-input-form", "searchcraft-button", "searchcraft-error-message", "searchcraft-input-label"];
|
|
258
|
+
components.forEach(tagName => { switch (tagName) {
|
|
259
|
+
case "searchcraft-input-form":
|
|
260
|
+
if (!customElements.get(tagName)) {
|
|
261
|
+
customElements.define(tagName, SearchcraftInput);
|
|
262
|
+
}
|
|
263
|
+
break;
|
|
264
|
+
case "searchcraft-button":
|
|
265
|
+
if (!customElements.get(tagName)) {
|
|
266
|
+
defineCustomElement$3();
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "searchcraft-error-message":
|
|
270
|
+
if (!customElements.get(tagName)) {
|
|
271
|
+
defineCustomElement$2();
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
case "searchcraft-input-label":
|
|
275
|
+
if (!customElements.get(tagName)) {
|
|
276
|
+
defineCustomElement$1();
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
} });
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { SearchcraftInput as S, defineCustomElement as d };
|
|
283
|
+
|
|
284
|
+
//# sourceMappingURL=p-960ddc89.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-960ddc89.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,IAAI,CAAC,UAAU,CAAC;IAC7B,KAAK,GAAG,KAAK,CAAC;IACd,wBAAwB,GAAG,KAAK,CAAC;IAElC,WAAW,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;IAErD,IAAI;QACF,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE;YACjD,MAAM,WAAW,GAAG,IAAIA,EAAe,CAAC,IAAI,CAAC,MAAM,EAAE;gBACnD,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kBACH,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACF,EACL,oBAAoB,KACnB,+DACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,gCAAgC,EACtC,OAAO,EAAE,IAAI,CAAC,gBAAgB,IAE9B,4DACE,KAAK,EAAC,8BAA8B,EACpC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,qBAClB,YAAY,IAE5B,8DAAO,EAAE,EAAC,YAAY,yCAEd,EACR,6DACE,CAAC,EAAC,uIAAuI,EACzI,MAAM,EAAC,OAAO,kBACD,KAAK,oBACH,OAAO,qBACN,OAAO,GACvB,CACE,CACC,CACV,CACG,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SearchcraftCore"],"sources":["src/components/searchcraft-input-form/searchcraft-input-form.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"],"version":3}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
+
|
|
3
|
+
const SearchcraftErrorMessage = /*@__PURE__*/ proxyCustomElement(class SearchcraftErrorMessage extends H {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.__registerHost();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The error message.
|
|
10
|
+
*/
|
|
11
|
+
errorMessage;
|
|
12
|
+
render() {
|
|
13
|
+
return (h("p", { key: '432bc13abc15f4d9c62ebc751e44e266b258b1f9', class: 'searchcraft-error-message' }, this.errorMessage || 'Search term is required.'));
|
|
14
|
+
}
|
|
15
|
+
}, [0, "searchcraft-error-message", {
|
|
16
|
+
"errorMessage": [1, "error-message"]
|
|
17
|
+
}]);
|
|
18
|
+
function defineCustomElement() {
|
|
19
|
+
if (typeof customElements === "undefined") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const components = ["searchcraft-error-message"];
|
|
23
|
+
components.forEach(tagName => { switch (tagName) {
|
|
24
|
+
case "searchcraft-error-message":
|
|
25
|
+
if (!customElements.get(tagName)) {
|
|
26
|
+
customElements.define(tagName, SearchcraftErrorMessage);
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
} });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { SearchcraftErrorMessage as S, defineCustomElement as d };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=p-a75ef832.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-a75ef832.js","mappings":";;MAea,uBAAuB;;;;;;;;IAI1B,YAAY,CAAU;IAE9B,MAAM;QACJ,QACE,0DAAG,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,YAAY,IAAI,0BAA0B,CAC9C,EACJ;KACH;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-error-message/searchcraft-error-message.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n/**\n * This web component is designed to display a user-friendly error message when a search query fails, providing clear feedback to users and enhancing their experience when an issue arises during the search process.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-error-message error-message=\"No search results found for query\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-error-message',\n shadow: false,\n})\nexport class SearchcraftErrorMessage {\n /**\n * The error message.\n */\n @Prop() errorMessage?: string;\n\n render() {\n return (\n <p class='searchcraft-error-message'>\n {this.errorMessage || 'Search term is required.'}\n </p>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h, F as Fragment } from './p-5365011f.js';
|
|
2
|
+
import { u as useSearchcraftStore } from './p-936e2ed4.js';
|
|
3
|
+
|
|
4
|
+
const SearchcraftBaseSearchResult = /*@__PURE__*/ proxyCustomElement(class SearchcraftBaseSearchResult extends H {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.__registerHost();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The title content.
|
|
11
|
+
*/
|
|
12
|
+
titleContent;
|
|
13
|
+
/**
|
|
14
|
+
* The subtitle content.
|
|
15
|
+
*/
|
|
16
|
+
subtitleContent;
|
|
17
|
+
/**
|
|
18
|
+
* The body content.
|
|
19
|
+
*/
|
|
20
|
+
bodyContent;
|
|
21
|
+
/**
|
|
22
|
+
* The footer content.
|
|
23
|
+
*/
|
|
24
|
+
footerContent;
|
|
25
|
+
/**
|
|
26
|
+
* The label for the button rendered when containerHref is not present.
|
|
27
|
+
*/
|
|
28
|
+
buttonLabel;
|
|
29
|
+
/**
|
|
30
|
+
* The link for the button rendered when containerHref is not present.
|
|
31
|
+
*/
|
|
32
|
+
buttonHref;
|
|
33
|
+
/**
|
|
34
|
+
* Where to open the link for the button rendered when containerHref is not present.
|
|
35
|
+
*/
|
|
36
|
+
buttonTarget = '_blank';
|
|
37
|
+
/**
|
|
38
|
+
* The relationship between the current document and the link for the button rendered when containerHref is not present.
|
|
39
|
+
*/
|
|
40
|
+
buttonRel;
|
|
41
|
+
/**
|
|
42
|
+
* The link for the containing element.
|
|
43
|
+
*/
|
|
44
|
+
containerHref;
|
|
45
|
+
/**
|
|
46
|
+
* Where to open the link for the containing element.
|
|
47
|
+
*/
|
|
48
|
+
containerTarget = '_blank';
|
|
49
|
+
/**
|
|
50
|
+
* The relationship between the current document and the link for the containing element.
|
|
51
|
+
*/
|
|
52
|
+
containerRel;
|
|
53
|
+
/**
|
|
54
|
+
* The image source.
|
|
55
|
+
*/
|
|
56
|
+
imageSrc;
|
|
57
|
+
/**
|
|
58
|
+
* The image alternative text.
|
|
59
|
+
*/
|
|
60
|
+
imageAlt;
|
|
61
|
+
/**
|
|
62
|
+
* The placement of the image.
|
|
63
|
+
*/
|
|
64
|
+
imagePlacement = 'right';
|
|
65
|
+
/**
|
|
66
|
+
* A custom styles object.
|
|
67
|
+
*/
|
|
68
|
+
customStyles;
|
|
69
|
+
/**
|
|
70
|
+
* The position in the document. Used with the "document_clicked" measure event.
|
|
71
|
+
*/
|
|
72
|
+
documentPosition = 0;
|
|
73
|
+
searchcraftStore = useSearchcraftStore.getState();
|
|
74
|
+
recordMeasureEvent = () => {
|
|
75
|
+
const searchcraft = this.searchcraftStore.getSearchcraftInstance();
|
|
76
|
+
if (searchcraft) {
|
|
77
|
+
const document_position = this.documentPosition;
|
|
78
|
+
const search_term = this.searchcraftStore.query;
|
|
79
|
+
const number_of_documents = this.searchcraftStore.searchResults?.data?.hits?.length || 0;
|
|
80
|
+
searchcraft.sendMeasureEvent('document_clicked', {
|
|
81
|
+
document_position,
|
|
82
|
+
number_of_documents,
|
|
83
|
+
search_term,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
parseStyles = () => {
|
|
88
|
+
if (this.customStyles) {
|
|
89
|
+
try {
|
|
90
|
+
return JSON.parse(this.customStyles);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.error('Error parsing custom styles:', error);
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {};
|
|
98
|
+
};
|
|
99
|
+
render() {
|
|
100
|
+
const styles = this.parseStyles();
|
|
101
|
+
const imageContainer = this.imageSrc && (h("img", { alt: this.imageAlt, class: 'searchcraft-search-result-image', src: this.imageSrc, style: styles.image || {} }));
|
|
102
|
+
const contentContainer = (h(Fragment, null, this.imageSrc && this.imagePlacement === 'left' && imageContainer, h("div", { class: 'searchcraft-base-search-result-content-container' }, this.titleContent && (h("h2", { class: 'searchcraft-base-search-result-title', style: styles.title || {} }, this.titleContent)), this.subtitleContent && (h("h3", { class: 'searchcraft-base-search-result-subtitle', style: styles.subtitle || {} }, this.subtitleContent)), this.bodyContent && (h("p", { class: 'searchcraft-base-search-result-body-content', style: styles.primaryContent || {} }, this.bodyContent)), this.footerContent && (h("p", { class: 'searchcraft-base-search-result-footer-content', style: styles.secondaryContent || {} }, this.footerContent)), this.buttonHref && !this.containerHref && this.buttonLabel && (h("a", { class: 'searchcraft-search-result-button', href: this.buttonHref, style: styles.button || {}, target: this.buttonTarget, rel: this.buttonRel }, this.buttonLabel))), this.imageSrc && this.imagePlacement === 'right' && imageContainer));
|
|
103
|
+
/** Render as an anchor tag if the containerHref prop is present. */
|
|
104
|
+
if (this.containerHref) {
|
|
105
|
+
return (h("a", { class: 'searchcraft-search-result-container', onClick: this.recordMeasureEvent, href: this.containerHref, rel: this.containerRel, style: styles.container || {}, tabindex: '0', target: this.containerTarget }, contentContainer));
|
|
106
|
+
}
|
|
107
|
+
/** Render as a div if no href prop. */
|
|
108
|
+
return (h("div", { class: 'searchcraft-search-result-container', style: styles.container || {} }, contentContainer));
|
|
109
|
+
}
|
|
110
|
+
}, [0, "searchcraft-base-search-result", {
|
|
111
|
+
"titleContent": [1, "title-content"],
|
|
112
|
+
"subtitleContent": [1, "subtitle-content"],
|
|
113
|
+
"bodyContent": [1, "body-content"],
|
|
114
|
+
"footerContent": [1, "footer-content"],
|
|
115
|
+
"buttonLabel": [1, "button-label"],
|
|
116
|
+
"buttonHref": [1, "button-href"],
|
|
117
|
+
"buttonTarget": [1, "button-target"],
|
|
118
|
+
"buttonRel": [1, "button-rel"],
|
|
119
|
+
"containerHref": [1, "container-href"],
|
|
120
|
+
"containerTarget": [1, "container-target"],
|
|
121
|
+
"containerRel": [1, "container-rel"],
|
|
122
|
+
"imageSrc": [1, "image-src"],
|
|
123
|
+
"imageAlt": [1, "image-alt"],
|
|
124
|
+
"imagePlacement": [1, "image-placement"],
|
|
125
|
+
"customStyles": [1, "custom-styles"],
|
|
126
|
+
"documentPosition": [2, "document-position"]
|
|
127
|
+
}]);
|
|
128
|
+
function defineCustomElement() {
|
|
129
|
+
if (typeof customElements === "undefined") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const components = ["searchcraft-base-search-result"];
|
|
133
|
+
components.forEach(tagName => { switch (tagName) {
|
|
134
|
+
case "searchcraft-base-search-result":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
customElements.define(tagName, SearchcraftBaseSearchResult);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
} });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { SearchcraftBaseSearchResult as S, defineCustomElement as d };
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=p-b4a8fcbe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-b4a8fcbe.js","mappings":";;;MAYa,2BAA2B;;;;;;;;IAI9B,YAAY,CAAqB;;;;IAIjC,eAAe,CAAqB;;;;IAIpC,WAAW,CAAqB;;;;IAIhC,aAAa,CAAqB;;;;IAIlC,WAAW,CAAqB;;;;IAIhC,UAAU,CAAqB;;;;IAI/B,YAAY,GAA4C,QAAQ,CAAC;;;;IAIjE,SAAS,CAAqD;;;;IAI9D,aAAa,CAAqB;;;;IAIlC,eAAe,GAA4C,QAAQ,CAAC;;;;IAIpE,YAAY,CAAqD;;;;IAIjE,QAAQ,CAAqB;;;;IAI7B,QAAQ,CAAqB;;;;IAI7B,cAAc,GAAqB,OAAO,CAAC;;;;IAI3C,YAAY,CAAqB;;;;IAIjC,gBAAgB,GAAG,CAAC,CAAC;IAErB,gBAAgB,GAAG,mBAAmB,CAAC,QAAQ,EAAE,CAAC;IAElD,kBAAkB,GAAG;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC;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AE,IAE5B,gBAAgB,CACb,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-base-search-result/searchcraft-base-search-result.tsx"],"sourcesContent":["import { useSearchcraftStore } from '@provider/store';\nimport { Component, Fragment, h, Prop } from '@stencil/core';\n\n/**\n * This web component is designed to display detailed information for a single search result.\n * Once a query is submitted, the component formats and presents the result.\n * It is consumed within the `searchcraft-base-search-results` component.\n */\n@Component({\n tag: 'searchcraft-base-search-result',\n shadow: false,\n})\nexport class SearchcraftBaseSearchResult {\n /**\n * The title content.\n */\n @Prop() titleContent: string | undefined;\n /**\n * The subtitle content.\n */\n @Prop() subtitleContent: string | undefined;\n /**\n * The body content.\n */\n @Prop() bodyContent: string | undefined;\n /**\n * The footer content.\n */\n @Prop() footerContent: string | undefined;\n /**\n * The label for the button rendered when containerHref is not present.\n */\n @Prop() buttonLabel: string | undefined;\n /**\n * The link for the button rendered when containerHref is not present.\n */\n @Prop() buttonHref: string | undefined;\n /**\n * Where to open the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the button rendered when containerHref is not present.\n */\n @Prop() buttonRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The link for the containing element.\n */\n @Prop() containerHref: string | undefined;\n /**\n * Where to open the link for the containing element.\n */\n @Prop() containerTarget: '_blank' | '_self' | '_top' | '_parent' = '_blank';\n /**\n * The relationship between the current document and the link for the containing element.\n */\n @Prop() containerRel: 'noreferrer' | 'noopener' | 'nofollow' | undefined;\n /**\n * The image source.\n */\n @Prop() imageSrc: string | undefined;\n /**\n * The image alternative text.\n */\n @Prop() imageAlt: string | undefined;\n /**\n * The placement of the image.\n */\n @Prop() imagePlacement: 'left' | 'right' = 'right';\n /**\n * A custom styles object.\n */\n @Prop() customStyles: string | undefined;\n /**\n * The position in the document. Used with the \"document_clicked\" measure event.\n */\n @Prop() documentPosition = 0;\n\n private searchcraftStore = useSearchcraftStore.getState();\n\n private recordMeasureEvent = () => {\n const searchcraft = this.searchcraftStore.getSearchcraftInstance();\n\n if (searchcraft) {\n const document_position = this.documentPosition;\n const search_term = this.searchcraftStore.query;\n const number_of_documents =\n this.searchcraftStore.searchResults?.data?.hits?.length || 0;\n\n searchcraft.sendMeasureEvent('document_clicked', {\n document_position,\n number_of_documents,\n search_term,\n });\n }\n };\n\n private parseStyles = (): Record<string, { [key: string]: string }> => {\n if (this.customStyles) {\n try {\n return JSON.parse(this.customStyles);\n } catch (error) {\n console.error('Error parsing custom styles:', error);\n return {};\n }\n }\n return {};\n };\n\n render() {\n const styles = this.parseStyles();\n const imageContainer = this.imageSrc && (\n <img\n alt={this.imageAlt}\n class='searchcraft-search-result-image'\n src={this.imageSrc}\n style={styles.image || {}}\n />\n );\n\n const contentContainer = (\n <Fragment>\n {this.imageSrc && this.imagePlacement === 'left' && imageContainer}\n <div class='searchcraft-base-search-result-content-container'>\n {this.titleContent && (\n <h2\n class='searchcraft-base-search-result-title'\n style={styles.title || {}}\n >\n {this.titleContent}\n </h2>\n )}\n {this.subtitleContent && (\n <h3\n class='searchcraft-base-search-result-subtitle'\n style={styles.subtitle || {}}\n >\n {this.subtitleContent}\n </h3>\n )}\n {this.bodyContent && (\n <p\n class='searchcraft-base-search-result-body-content'\n style={styles.primaryContent || {}}\n >\n {this.bodyContent}\n </p>\n )}\n\n {this.footerContent && (\n <p\n class='searchcraft-base-search-result-footer-content'\n style={styles.secondaryContent || {}}\n >\n {this.footerContent}\n </p>\n )}\n {this.buttonHref && !this.containerHref && this.buttonLabel && (\n <a\n class='searchcraft-search-result-button'\n href={this.buttonHref}\n style={styles.button || {}}\n target={this.buttonTarget}\n rel={this.buttonRel}\n >\n {this.buttonLabel}\n </a>\n )}\n </div>\n {this.imageSrc && this.imagePlacement === 'right' && imageContainer}\n </Fragment>\n );\n\n /** Render as an anchor tag if the containerHref prop is present. */\n if (this.containerHref) {\n return (\n <a\n class='searchcraft-search-result-container'\n onClick={this.recordMeasureEvent}\n href={this.containerHref}\n rel={this.containerRel}\n style={styles.container || {}}\n tabindex='0'\n target={this.containerTarget}\n >\n {contentContainer}\n </a>\n );\n }\n\n /** Render as a div if no href prop. */\n return (\n <div\n class='searchcraft-search-result-container'\n style={styles.container || {}}\n >\n {contentContainer}\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-5365011f.js';
|
|
2
|
+
import { c as classNames } from './p-5cdc6210.js';
|
|
3
|
+
|
|
4
|
+
const SearchcraftInputLabel = /*@__PURE__*/ proxyCustomElement(class SearchcraftInputLabel extends H {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.__registerHost();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The classname applied to the label element.
|
|
11
|
+
*/
|
|
12
|
+
inputLabelClassName = '';
|
|
13
|
+
label = '';
|
|
14
|
+
render() {
|
|
15
|
+
return (h("label", { key: '9c71dc7429d7289ed59e7effacb91e040a9ac6a1', class: classNames('searchcraft-input-label', this.inputLabelClassName), htmlFor: 'searchcraft-input-id' }, this.label));
|
|
16
|
+
}
|
|
17
|
+
}, [0, "searchcraft-input-label", {
|
|
18
|
+
"inputLabelClassName": [1, "input-label-class-name"],
|
|
19
|
+
"label": [1]
|
|
20
|
+
}]);
|
|
21
|
+
function defineCustomElement() {
|
|
22
|
+
if (typeof customElements === "undefined") {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const components = ["searchcraft-input-label"];
|
|
26
|
+
components.forEach(tagName => { switch (tagName) {
|
|
27
|
+
case "searchcraft-input-label":
|
|
28
|
+
if (!customElements.get(tagName)) {
|
|
29
|
+
customElements.define(tagName, SearchcraftInputLabel);
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
} });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { SearchcraftInputLabel as S, defineCustomElement as d };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=p-ca881e5c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-ca881e5c.js","mappings":";;;MAgBa,qBAAqB;;;;;;;;IAIxB,mBAAmB,GAAI,EAAE,CAAC;IAC1B,KAAK,GAAG,EAAE,CAAC;IAEnB,MAAM;QACJ,QACE,8DACE,KAAK,EAAE,UAAU,CAAC,yBAAyB,EAAE,IAAI,CAAC,mBAAmB,CAAC,EACtE,OAAO,EAAC,sBAAsB,IAE7B,IAAI,CAAC,KAAK,CACL,EACR;KACH;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/searchcraft-input-label/searchcraft-input-label.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component serves as the input label for the searchcraft-input-form component.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-input-label label=\"Search\" />\n * ```\n */\n@Component({\n tag: 'searchcraft-input-label',\n shadow: false,\n})\nexport class SearchcraftInputLabel {\n /**\n * The classname applied to the label element.\n */\n @Prop() inputLabelClassName? = '';\n @Prop() label = '';\n\n render() {\n return (\n <label\n class={classNames('searchcraft-input-label', this.inputLabelClassName)}\n htmlFor='searchcraft-input-id'\n >\n {this.label}\n </label>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SearchcraftBaseSearchResult$1, d as defineCustomElement$1 } from './p-
|
|
1
|
+
import { S as SearchcraftBaseSearchResult$1, d as defineCustomElement$1 } from './p-b4a8fcbe.js';
|
|
2
2
|
|
|
3
3
|
const SearchcraftBaseSearchResult = SearchcraftBaseSearchResult$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|