@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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-3608c57d.js';
|
|
2
2
|
import { c as classNames } from './index-72ac5051.js';
|
|
3
|
-
import { u as useSearchcraftStore } from './store-
|
|
3
|
+
import { u as useSearchcraftStore } from './store-aa071d9c.js';
|
|
4
4
|
import { a as getMillis } from './units-b6eba560.js';
|
|
5
5
|
|
|
6
6
|
function deepMergeWithSpread(obj1, obj2) {
|
|
7
|
-
const result =
|
|
7
|
+
const result = { ...obj1 };
|
|
8
8
|
for (const key in obj2) {
|
|
9
9
|
// biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>
|
|
10
10
|
if (obj2.hasOwnProperty(key)) {
|
|
@@ -27,12 +27,11 @@ function removeSubstringMatches(arr) {
|
|
|
27
27
|
function facetToRecord(facet) {
|
|
28
28
|
const records = {};
|
|
29
29
|
const traverseAndAddToFragments = (facetChild) => {
|
|
30
|
-
var _a;
|
|
31
30
|
records[facetChild.path] = {
|
|
32
31
|
count: facetChild.count,
|
|
33
32
|
path: facetChild.path,
|
|
34
33
|
};
|
|
35
|
-
|
|
34
|
+
facetChild.children?.forEach((child) => {
|
|
36
35
|
traverseAndAddToFragments(child);
|
|
37
36
|
});
|
|
38
37
|
};
|
|
@@ -47,6 +46,9 @@ function recordToObject(record) {
|
|
|
47
46
|
};
|
|
48
47
|
Object.keys(record).forEach((key) => {
|
|
49
48
|
const fragment = record[key];
|
|
49
|
+
if (!fragment) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
50
52
|
if (fragment.path === '/') {
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
@@ -129,40 +131,35 @@ function mergeFacetRoots(fieldName, currentRoot, incomingRoot) {
|
|
|
129
131
|
};
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
const searchcraftFacetListModuleCss = ":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}.filtersListContainer{width:100%}.filterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:14px;position:relative;-webkit-font-smoothing:antialiased}.filterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;width:24px}.filterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.filterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.filterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.filterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.childFilterCheckboxLabel{align-items:center;color:var(--sc-content-primary);display:flex;font-family:var(--sc-font-family);font-size:14px;font-weight:600;gap:12px;margin-left:24px;position:relative}.childFilterCheckboxLabel input[type=checkbox]{align-items:center;appearance:none;background-color:var(--sc-surface-brand-secondary-hover);border:1px solid var(--sc-surface-disabled);border-radius:8px;cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px;-webkit-font-smoothing:antialiased}.childFilterCheckboxLabel input[type=checkbox]:focus{outline:2px solid var(--sc-surface-brand-primary)}.childFilterCheckboxLabel input[type=checkbox]:checked{background-color:var(--sc-surface-brand-primary);position:relative}.childFilterCheckboxLabel input[type=checkbox]:checked+.checkContainer{display:block}.childFilterCheckboxLabel input[type=checkbox]:checked+.dashContainer{display:block}.checkContainer{display:none;height:16px;width:16px;position:absolute;top:9px;left:8px}.dashContainer{display:none;height:3px;width:14px;position:absolute;top:3px;left:9px}.searchcraft-facet-message{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);color:var(--sc-content-disabled);text-align:center}";
|
|
133
|
-
const SearchcraftFacetListStyle0 = searchcraftFacetListModuleCss;
|
|
134
|
-
|
|
135
134
|
const SearchcraftFacetList = class {
|
|
136
135
|
constructor(hostRef) {
|
|
137
136
|
registerInstance(this, hostRef);
|
|
138
137
|
this.facetSelectionUpdated = createEvent(this, "facetSelectionUpdated", 7);
|
|
139
|
-
this.searchStore = useSearchcraftStore.getState();
|
|
140
|
-
this.formatLabel = (facetChild) => {
|
|
141
|
-
const label = facetChild.path.replace(/^\//, '');
|
|
142
|
-
const count = facetChild.count;
|
|
143
|
-
return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
|
|
144
|
-
};
|
|
145
|
-
this.formatSubLabel = (facetChild, facetChildAncestor) => {
|
|
146
|
-
const facetChildPath = facetChild.path.substring(facetChildAncestor.path.length);
|
|
147
|
-
const label = facetChildPath.replace(/^\//, '');
|
|
148
|
-
const count = facetChild.count;
|
|
149
|
-
return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
|
|
150
|
-
};
|
|
151
|
-
this.fieldName = undefined;
|
|
152
|
-
this.baseFacetRoot = undefined;
|
|
153
|
-
this.facetRoot = undefined;
|
|
154
|
-
this.selectedPaths = {};
|
|
155
|
-
this.lastTimeTaken = undefined;
|
|
156
|
-
this.hasNewSearchTerm = false;
|
|
157
|
-
this.lastQuery = undefined;
|
|
158
|
-
this.lastSearchMode = undefined;
|
|
159
|
-
this.lastSortType = undefined;
|
|
160
|
-
this.unsubscribe = undefined;
|
|
161
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* The name of the field where facets are applied.
|
|
141
|
+
*/
|
|
142
|
+
fieldName = '';
|
|
143
|
+
/**
|
|
144
|
+
* When the facets are updated.
|
|
145
|
+
*/
|
|
146
|
+
facetSelectionUpdated;
|
|
147
|
+
baseFacetRoot;
|
|
148
|
+
facetRoot;
|
|
149
|
+
selectedPaths = {};
|
|
150
|
+
lastTimeTaken;
|
|
151
|
+
hasNewSearchTerm = false;
|
|
152
|
+
lastQuery;
|
|
153
|
+
lastSearchMode;
|
|
154
|
+
lastSortType;
|
|
155
|
+
unsubscribe;
|
|
156
|
+
searchStore = useSearchcraftStore.getState();
|
|
162
157
|
handleStateUpdate(state) {
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
158
|
+
const facetPrime = state.searchResults?.data.facets;
|
|
159
|
+
const timeTaken = state.searchResults?.data.time_taken;
|
|
160
|
+
if (!this.fieldName) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
166
163
|
/** Things to do when the state's search term has changed, but before the response received */
|
|
167
164
|
if (state.query !== this.lastQuery ||
|
|
168
165
|
state.searchMode !== this.lastSearchMode ||
|
|
@@ -180,7 +177,7 @@ const SearchcraftFacetList = class {
|
|
|
180
177
|
this.facetRoot = incomingFacetRoot;
|
|
181
178
|
this.hasNewSearchTerm = false;
|
|
182
179
|
}
|
|
183
|
-
else if (this.baseFacetRoot) {
|
|
180
|
+
else if (this.baseFacetRoot && incomingFacetRoot) {
|
|
184
181
|
/** Data is from an existing search term, merge the facets together */
|
|
185
182
|
this.facetRoot = mergeFacetRoots(this.fieldName, this.baseFacetRoot, incomingFacetRoot);
|
|
186
183
|
}
|
|
@@ -197,8 +194,7 @@ const SearchcraftFacetList = class {
|
|
|
197
194
|
});
|
|
198
195
|
}
|
|
199
196
|
disconnectedCallback() {
|
|
200
|
-
|
|
201
|
-
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
197
|
+
this.unsubscribe?.();
|
|
202
198
|
}
|
|
203
199
|
handleCheckboxChange(path) {
|
|
204
200
|
const isCheckboxChecked = !this.selectedPaths[path];
|
|
@@ -207,7 +203,10 @@ const SearchcraftFacetList = class {
|
|
|
207
203
|
* Checkbox Checked: Add to the selectedPaths record
|
|
208
204
|
* Uses spread operator here so UI updates.
|
|
209
205
|
*/
|
|
210
|
-
this.selectedPaths =
|
|
206
|
+
this.selectedPaths = {
|
|
207
|
+
...this.selectedPaths,
|
|
208
|
+
[path]: true,
|
|
209
|
+
};
|
|
211
210
|
}
|
|
212
211
|
else {
|
|
213
212
|
/**
|
|
@@ -224,80 +223,101 @@ const SearchcraftFacetList = class {
|
|
|
224
223
|
*/
|
|
225
224
|
const paths = Object.keys(this.selectedPaths).filter((path) => this.selectedPaths[path]);
|
|
226
225
|
const pathsWithParentPathsRemoved = removeSubstringMatches(paths);
|
|
227
|
-
this.facetSelectionUpdated
|
|
226
|
+
this.facetSelectionUpdated?.emit({ paths: pathsWithParentPathsRemoved });
|
|
228
227
|
}
|
|
228
|
+
formatLabel = (facetChild) => {
|
|
229
|
+
const label = facetChild.path.replace(/^\//, '');
|
|
230
|
+
const count = facetChild.count;
|
|
231
|
+
return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
|
|
232
|
+
};
|
|
233
|
+
formatSubLabel = (facetChild, facetChildAncestor) => {
|
|
234
|
+
const facetChildPath = facetChild.path.substring(facetChildAncestor.path.length);
|
|
235
|
+
const label = facetChildPath.replace(/^\//, '');
|
|
236
|
+
const count = facetChild.count;
|
|
237
|
+
return `${label.replace(/-/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())} (${count})`;
|
|
238
|
+
};
|
|
229
239
|
render() {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
240
|
+
if (!this.fieldName) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const firstFacet = this.facetRoot?.[this.fieldName];
|
|
244
|
+
return (h("div", { class: classNames('filtersListContainer', 'searchcraft-filters-list-container') }, !firstFacet && (h("p", { class: 'searchcraft-facet-message' }, "Enter a search to view facets.")), firstFacet?.map((facetChild) => {
|
|
245
|
+
const isChildSelected = facetChild.children
|
|
246
|
+
? facetChild.children?.some((child) => this.selectedPaths[child.path])
|
|
247
|
+
: false;
|
|
248
|
+
return (h("div", { key: facetChild.path, class: classNames('searchcraft-filters-list-item') }, h("label", { class: classNames('filterCheckboxLabel', 'searchcraft-filters-list-checkbox-label') }, h("input", { checked: this.selectedPaths[facetChild.path], onChange: (_event) => this.handleCheckboxChange(facetChild.path), type: 'checkbox' }), isChildSelected ? (h("div", { class: classNames('dashContainer', 'searchcraft-filter-list-dash-container') }, h("searchcraft-dash-icon", null))) : (h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("searchcraft-check-icon", null))), this.formatLabel(facetChild)), facetChild.children && facetChild.children.length > 0 && (h(Fragment, null, facetChild.children.map((grandchild) => (h("label", { key: grandchild.path, class: classNames('childFilterCheckboxLabel', 'searchcraft-child-filter-checkbox-label'), style: {
|
|
249
|
+
display: this.selectedPaths[facetChild.path]
|
|
250
|
+
? 'flex'
|
|
251
|
+
: 'none',
|
|
252
|
+
} }, h("input", { checked: this.selectedPaths[grandchild.path], onChange: (_event) => {
|
|
253
|
+
this.handleCheckboxChange(grandchild.path);
|
|
254
|
+
}, type: 'checkbox' }), h("div", { class: classNames('checkContainer', 'searchcraft-filter-list-check-container') }, h("searchcraft-check-icon", null)), this.formatSubLabel(grandchild, facetChild))))))));
|
|
255
|
+
})));
|
|
246
256
|
}
|
|
247
257
|
};
|
|
248
|
-
SearchcraftFacetList.style = SearchcraftFacetListStyle0;
|
|
249
|
-
|
|
250
|
-
const searchcraftSliderModuleCss = ":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-slider-container{align-items:center;display:flex;flex-direction:column;gap:10px;width:100%}.searchcraft-slider-range-container{align-items:center;background-color:var(--sc-surface-disabled);border-radius:999px;display:flex;position:relative;height:4px;width:100%}.searchcraft-slider-range-container::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range{background-color:var(--sc-surface-brand-primary);border-radius:2px;height:4px;position:absolute;top:50%;transform:translateY(-50%);z-index:0}.searchcraft-slider-range-container .searchcraft-slider-active-range::-webkit-slider-runnable-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-active-range::-moz-range-track{pointer-events:none}.searchcraft-slider-range-container .searchcraft-slider-input{appearance:none;background:transparent;border-radius:2px;height:4px;margin:0;outline:none;pointer-events:none;position:absolute;width:100%;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-webkit-slider-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px;-webkit-appearance:none}.searchcraft-slider-range-container .searchcraft-slider-input::-moz-range-thumb{background-color:var(--sc-surface-neutral-light);border-radius:50%;border:2px solid var(--sc-border-neutral);cursor:pointer;height:20px;pointer-events:all;width:20px}.searchcraft-slider-label-container{color:var(--sc-content-primary);display:flex;font-family:\"Source Sans Pro\", sans-serif;font-size:15px;font-weight:600;justify-content:space-between;margin-top:10px;width:100%}.searchcraft-slider-label{min-width:30px;text-align:center}";
|
|
251
|
-
const SearchcraftSliderStyle0 = searchcraftSliderModuleCss;
|
|
252
258
|
|
|
253
259
|
const SearchcraftSlider = class {
|
|
254
260
|
constructor(hostRef) {
|
|
255
261
|
registerInstance(this, hostRef);
|
|
256
262
|
this.rangeChanged = createEvent(this, "rangeChanged", 7);
|
|
257
|
-
this.emitUpdate = async () => {
|
|
258
|
-
this.rangeChanged.emit({
|
|
259
|
-
startValue: this.startValue,
|
|
260
|
-
endValue: this.endValue,
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
this.handleStartValueChange = (event) => {
|
|
264
|
-
const inputElement = event.target;
|
|
265
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
266
|
-
this.lastFocusedHandle = 'min';
|
|
267
|
-
if (value <= this.endValue) {
|
|
268
|
-
this.startValue = value;
|
|
269
|
-
this.emitUpdate();
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
this.startValue = this.endValue;
|
|
273
|
-
inputElement.value = `${this.endValue}`;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
this.handleEndValueChange = (event) => {
|
|
277
|
-
const inputElement = event.target;
|
|
278
|
-
const value = Number.parseInt(inputElement.value, 10);
|
|
279
|
-
this.lastFocusedHandle = 'max';
|
|
280
|
-
if (value >= this.startValue) {
|
|
281
|
-
this.endValue = value;
|
|
282
|
-
this.emitUpdate();
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
this.endValue = this.startValue;
|
|
286
|
-
inputElement.value = `${this.startValue}`;
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
this.max = 100;
|
|
290
|
-
this.min = 0;
|
|
291
|
-
this.granularity = getMillis('month');
|
|
292
|
-
this.dataType = 'number';
|
|
293
|
-
this.endValue = this.max;
|
|
294
|
-
this.startValue = this.min;
|
|
295
|
-
this.lastFocusedHandle = 'max';
|
|
296
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* The maximum value allowed.
|
|
266
|
+
*/
|
|
267
|
+
max = 100;
|
|
268
|
+
/**
|
|
269
|
+
* The minimum value allowed.
|
|
270
|
+
*/
|
|
271
|
+
min = 0;
|
|
272
|
+
/**
|
|
273
|
+
* The granularity that the value must adhere to.
|
|
274
|
+
*/
|
|
275
|
+
granularity = getMillis('month');
|
|
276
|
+
/** The type of data allowed. */
|
|
277
|
+
dataType = 'number';
|
|
278
|
+
endValue = this.max;
|
|
279
|
+
startValue = this.min;
|
|
280
|
+
lastFocusedHandle = 'max';
|
|
281
|
+
/**
|
|
282
|
+
* When the range has changed.
|
|
283
|
+
* */
|
|
284
|
+
rangeChanged;
|
|
297
285
|
componentDidLoad() {
|
|
298
286
|
this.startValue = this.min;
|
|
299
287
|
this.endValue = this.max;
|
|
300
288
|
}
|
|
289
|
+
emitUpdate = async () => {
|
|
290
|
+
this.rangeChanged?.emit({
|
|
291
|
+
startValue: this.startValue,
|
|
292
|
+
endValue: this.endValue,
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
handleStartValueChange = (event) => {
|
|
296
|
+
const inputElement = event.target;
|
|
297
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
298
|
+
this.lastFocusedHandle = 'min';
|
|
299
|
+
if (value <= this.endValue) {
|
|
300
|
+
this.startValue = value;
|
|
301
|
+
this.emitUpdate();
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
this.startValue = this.endValue;
|
|
305
|
+
inputElement.value = `${this.endValue}`;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
handleEndValueChange = (event) => {
|
|
309
|
+
const inputElement = event.target;
|
|
310
|
+
const value = Number.parseInt(inputElement.value, 10);
|
|
311
|
+
this.lastFocusedHandle = 'max';
|
|
312
|
+
if (value >= this.startValue) {
|
|
313
|
+
this.endValue = value;
|
|
314
|
+
this.emitUpdate();
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
this.endValue = this.startValue;
|
|
318
|
+
inputElement.value = `${this.startValue}`;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
301
321
|
render() {
|
|
302
322
|
const rangeMin = this.min;
|
|
303
323
|
const rangeMax = this.max;
|
|
@@ -309,31 +329,37 @@ const SearchcraftSlider = class {
|
|
|
309
329
|
const endLabel = this.dataType === 'number'
|
|
310
330
|
? this.endValue
|
|
311
331
|
: new Date(this.endValue).getFullYear();
|
|
312
|
-
return (h("div", { key: '
|
|
332
|
+
return (h("div", { key: 'bf815949fc9e24e7f3ff9e1870affe676592fc68', class: 'searchcraft-slider-container' }, h("div", { key: 'd0913ee4e35f551782ec5649b9782c535e81ff74', class: 'searchcraft-slider-range-container' }, h("div", { key: '5397b3ef9a79c589080560e886ef709b77279748', class: 'searchcraft-slider-active-range', style: {
|
|
313
333
|
left: `${startPercent}%`,
|
|
314
334
|
width: `${endPercent - startPercent}%`,
|
|
315
|
-
} }), h("input", { key: '
|
|
335
|
+
} }), h("input", { key: '714896ec90ea07a1be7b73e7168c6fab9d2c095b', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-min-handle'), max: this.max, min: this.min, onInput: this.handleStartValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }, type: 'range', value: this.startValue }), h("input", { key: '646042689f17b594dac00ba04c80d5d3a32a3cd0', class: classNames('searchcraft-slider-input', 'searchcraft-slider-input-max-handle'), max: this.max, min: this.min, onInput: this.handleEndValueChange.bind(this), step: this.granularity, style: { zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }, type: 'range', value: this.endValue })), h("div", { key: 'a6bc39619d6bcbb3ccf09e923436122db4559289', class: 'searchcraft-slider-label-container' }, h("span", { key: 'd15f19f86abeacb5c100403e9e4be20f28f604c0', class: 'searchcraft-slider-label' }, startLabel), h("span", { key: '6c0394917a4f54edae8a347cc8b225a64d044ea6', class: 'searchcraft-slider-label' }, endLabel))));
|
|
316
336
|
}
|
|
317
337
|
};
|
|
318
|
-
SearchcraftSlider.style = SearchcraftSliderStyle0;
|
|
319
|
-
|
|
320
|
-
const searchcraftToggleButtonModuleCss = ":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-toggle-button-container{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.searchcraft-toggle-button-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-font-size);font-weight:var(--sc-body-font-weight);line-height:var(--sc-body-line-height);margin:0;color:var(--sc-content-neutral-primary)}.searchcraft-toggle-button-sub-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-font-size);font-weight:var(--sc-body-small-font-weight);line-height:var(--sc-body-small-line-height);margin:0;color:var(--sc-content-neutral-secondary)}.searchcraft-toggle-button-background{transition:background-color 0.2s;background:var(--sc-surface-disabled);border:none;border-radius:16px;cursor:pointer;height:26px;position:relative;width:44px;flex-shrink:0}.searchcraft-toggle-button-background.active{background:var(--sc-surface-brand-primary);box-shadow:0px 0px 0px 1px rgba(0, 0, 0, 0.05)}.searchcraft-toggle-button-handle{background:var(--sc-surface-neutral-light);border-radius:50%;height:18px;left:4px;position:absolute;top:calc(50% - 9px);transition:transform 0.3s ease;width:18px}.searchcraft-toggle-button-handle.active{transform:translateX(16px)}";
|
|
321
|
-
const SearchcraftToggleButtonStyle0 = searchcraftToggleButtonModuleCss;
|
|
322
338
|
|
|
323
339
|
const SearchcraftToggleButton = class {
|
|
324
340
|
constructor(hostRef) {
|
|
325
341
|
registerInstance(this, hostRef);
|
|
326
342
|
this.toggleUpdated = createEvent(this, "toggleUpdated", 7);
|
|
327
|
-
this.handleToggle = async () => {
|
|
328
|
-
this.isActive = !this.isActive;
|
|
329
|
-
this.toggleUpdated.emit(this.isActive);
|
|
330
|
-
};
|
|
331
|
-
this.label = 'Toggle';
|
|
332
|
-
this.subLabel = undefined;
|
|
333
|
-
this.isActive = false;
|
|
334
|
-
this.unsubscribe = undefined;
|
|
335
|
-
this.lastQuery = undefined;
|
|
336
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* The label.
|
|
346
|
+
*/
|
|
347
|
+
label = 'Toggle';
|
|
348
|
+
/**
|
|
349
|
+
* The secondary label displayed below the main label.
|
|
350
|
+
*/
|
|
351
|
+
subLabel;
|
|
352
|
+
/**
|
|
353
|
+
* When the toggle element is changed.
|
|
354
|
+
*/
|
|
355
|
+
toggleUpdated;
|
|
356
|
+
isActive = false;
|
|
357
|
+
unsubscribe;
|
|
358
|
+
lastQuery;
|
|
359
|
+
handleToggle = async () => {
|
|
360
|
+
this.isActive = !this.isActive;
|
|
361
|
+
this.toggleUpdated?.emit(this.isActive);
|
|
362
|
+
};
|
|
337
363
|
connectedCallback() {
|
|
338
364
|
/** When the query changes, sets toggle button state back to inactive. */
|
|
339
365
|
this.unsubscribe = useSearchcraftStore.subscribe((state) => {
|
|
@@ -344,18 +370,16 @@ const SearchcraftToggleButton = class {
|
|
|
344
370
|
});
|
|
345
371
|
}
|
|
346
372
|
disconnectedCallback() {
|
|
347
|
-
|
|
348
|
-
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
373
|
+
this.unsubscribe?.();
|
|
349
374
|
}
|
|
350
375
|
render() {
|
|
351
|
-
return (h("div", { key: '
|
|
376
|
+
return (h("div", { key: '8967ffc9328e0e6822f558d04ab31bc7b7f5c871', class: 'searchcraft-toggle-button-container' }, h("div", { key: 'd46d8ad6aff1bb012bea8e4b10cec03a12da8d64' }, h("p", { key: 'f9fd16a0da58bd66697d13df34a93cd70a6148c6', class: 'searchcraft-toggle-button-label' }, this.label), this.subLabel && (h("p", { key: 'ba7a0c309ca4cc0faa891ad9e270ac16f1d1d4cc', class: 'searchcraft-toggle-button-sub-label' }, this.subLabel))), h("button", { key: '3b406713d41f055bbaf32d231188faba0dfa48fb', class: classNames('searchcraft-toggle-button-background', {
|
|
352
377
|
active: this.isActive,
|
|
353
|
-
}), onClick: this.handleToggle, type: 'button' }, h("div", { key: '
|
|
378
|
+
}), onClick: this.handleToggle, type: 'button' }, h("div", { key: '7dab3166e027e4efad18a3db9b541c1a4ba7da5f', class: classNames('searchcraft-toggle-button-handle', {
|
|
354
379
|
active: this.isActive,
|
|
355
380
|
}) }))));
|
|
356
381
|
}
|
|
357
382
|
};
|
|
358
|
-
SearchcraftToggleButton.style = SearchcraftToggleButtonStyle0;
|
|
359
383
|
|
|
360
384
|
export { SearchcraftFacetList as searchcraft_facet_list, SearchcraftSlider as searchcraft_slider, SearchcraftToggleButton as searchcraft_toggle_button };
|
|
361
385
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"searchcraft-facet-list.searchcraft-slider.searchcraft-toggle-button.entry.js","mappings":";;;;;AAMA,SAAS,mBAAmB,CAAC,IAAI,EAAE,IAAI;IACrC,MAAM,MAAM,qBAAQ,IAAI,CAAE,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;;QAEtB,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE;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B;;QAClB,MAAA,IAAI,CAAC,WAAW,oDAAI,CAAC;KACtB;IAED,MAAM;QACJ,QACE,4DAAK,KAAK,EAAC,qCAAqC,IAC9C,8DACE,0DAAG,KAAK,EAAC,iCAAiC,IAAE,IAAI,CAAC,KAAK,CAAK,EAC1D,IAAI,CAAC,QAAQ,KACZ,0DAAG,KAAK,EAAC,qCAAqC,IAAE,IAAI,CAAC,QAAQ,CAAK,CACnE,CACG,EACN,+DACE,KAAK,EAAE,UAAU,CAAC,sCAAsC,EAAE;gBACxD,MAAM,EAAE,IAAI,CAAC,QAAQ;aACtB,CAAC,EACF,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,IAAI,EAAC,QAAQ,IAEb,4DACE,KAAK,EAAE,UAAU,CAAC,kCAAkC,EAAE;gBACpD,MAAM,EAAE,IAAI,CAAC,QAAQ;aACtB,CAAC,GACF,CACK,CACL,EACN;KACH;;;;;;","names":[],"sources":["src/utils/facets.ts","src/components/searchcraft-facet-list/searchcraft-facet-list.module.scss?tag=searchcraft-facet-list","src/components/searchcraft-facet-list/searchcraft-facet-list.tsx","src/components/searchcraft-slider/searchcraft-slider.module.scss?tag=searchcraft-slider","src/components/searchcraft-slider/searchcraft-slider.tsx","src/components/searchcraft-toggle-button/searchcraft-toggle-button.module.scss?tag=searchcraft-toggle-button","src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n };\n}\n",".filtersListContainer {\n width: 100%;\n}\n\n.filterCheckboxLabel {\n align-items: center;\n color: var(--sc-content-primary);\n display: flex;\n font-family: var(--sc-font-family);\n font-size: 14px;\n font-weight: 600;\n gap: 14px;\n position: relative;\n -webkit-font-smoothing: antialiased;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"] {\n align-items: center;\n appearance: none;\n background-color: var(--sc-surface-brand-secondary-hover);\n border: 1px solid var(--sc-surface-disabled);\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n width: 24px;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked {\n background-color: var(--sc-surface-brand-primary);\n position: relative;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked + .checkContainer {\n display: block;\n}\n\n.filterCheckboxLabel input[type=\"checkbox\"]:checked + .dashContainer {\n display: block;\n}\n\n.childFilterCheckboxLabel {\n align-items: center;\n color: var(--sc-content-primary);\n display: flex;\n font-family: var(--sc-font-family);\n font-size: 14px;\n font-weight: 600;\n gap: 12px;\n margin-left: 24px;\n position: relative;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"] {\n align-items: center;\n appearance: none;\n background-color: var(--sc-surface-brand-secondary-hover);\n border: 1px solid var(--sc-surface-disabled);\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n height: 24px;\n justify-content: center;\n position: relative;\n width: 24px;\n -webkit-font-smoothing: antialiased;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:focus {\n outline: 2px solid var(--sc-surface-brand-primary);\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked {\n background-color: var(--sc-surface-brand-primary);\n position: relative;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked + .checkContainer {\n display: block;\n}\n\n.childFilterCheckboxLabel input[type=\"checkbox\"]:checked + .dashContainer {\n display: block;\n}\n\n.checkContainer {\n display: none;\n height: 16px;\n width: 16px;\n position: absolute;\n top: 9px;\n left: 8px;\n}\n\n.dashContainer {\n display: none;\n height: 3px;\n width: 14px;\n position: absolute;\n top: 3px;\n left: 9px;\n}\n\n.searchcraft-facet-message {\n @include body-small();\n color: var(--sc-content-disabled);\n text-align: center;\n}","import {\n Component,\n h,\n State,\n Prop,\n Event,\n type EventEmitter,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport type { FacetChild, FacetRoot } from '@searchcraft/core';\n\nimport { useSearchcraftStore, type SearchcraftState } from '@provider/store';\nimport { mergeFacetRoots, removeSubstringMatches } from '@utils';\n\n/**\n * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.\n * It is consumed within the `searchcraft-filter-panel`.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-facet-list field-name=\"title\" />\n * ```\n *\n * ```js\n * // index.js\n * const facetList = document.querySelector('searchcraft-facet-list');\n *\n * facetList.addEventListener('facetSelectionUpdated', () => {\n * console.log('Facet selection updated');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-facet-list',\n styleUrl: 'searchcraft-facet-list.module.scss',\n shadow: false,\n})\nexport class SearchcraftFacetList {\n /**\n * The name of the field where facets are applied.\n */\n @Prop() fieldName: string;\n\n /**\n * When the facets are updated.\n */\n @Event() facetSelectionUpdated: EventEmitter<{ paths: string[] }>;\n\n @State() baseFacetRoot: FacetRoot | undefined;\n @State() facetRoot: FacetRoot | undefined;\n @State() selectedPaths: Record<string, boolean> = {};\n @State() lastTimeTaken: number | undefined;\n @State() hasNewSearchTerm = false;\n\n @State() lastQuery: string | undefined;\n @State() lastSearchMode: string | undefined;\n @State() lastSortType: string | undefined;\n\n @State() unsubscribe: (() => void) | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n handleStateUpdate(state: SearchcraftState) {\n const facetPrime = state.searchResults?.data.facets;\n const timeTaken = state.searchResults?.data.time_taken;\n\n /** Things to do when the state's search term has changed, but before the response received */\n if (\n state.query !== this.lastQuery ||\n state.searchMode !== this.lastSearchMode ||\n state.sortType !== this.lastSortType\n ) {\n this.selectedPaths = {};\n this.hasNewSearchTerm = true;\n }\n\n /** Things to do when a new response with a new facet prime has been received */\n if (timeTaken !== this.lastTimeTaken && facetPrime) {\n this.facetRoot = undefined;\n const incomingFacetRoot: FacetRoot = facetPrime.find(\n (facet) => this.fieldName === Object.keys(facet)[0],\n );\n\n /** Data is from a new search term: completely override our facets */\n if (this.hasNewSearchTerm) {\n this.baseFacetRoot = incomingFacetRoot;\n this.facetRoot = incomingFacetRoot;\n this.hasNewSearchTerm = false;\n } else if (this.baseFacetRoot) {\n /** Data is from an existing search term, merge the facets together */\n this.facetRoot = mergeFacetRoots(\n this.fieldName,\n this.baseFacetRoot,\n incomingFacetRoot,\n );\n }\n }\n\n this.lastQuery = state.query;\n this.lastSearchMode = state.searchMode;\n this.lastSortType = state.sortType;\n this.lastTimeTaken = timeTaken;\n }\n\n connectedCallback() {\n this.handleStateUpdate(this.searchStore);\n\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n this.handleStateUpdate(state);\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleCheckboxChange(path: string) {\n const isCheckboxChecked = !this.selectedPaths[path];\n\n if (isCheckboxChecked) {\n /**\n * Checkbox Checked: Add to the selectedPaths record\n * Uses spread operator here so UI updates.\n */\n this.selectedPaths = {\n ...this.selectedPaths,\n [path]: true,\n };\n } else {\n /**\n * Checkbox Uncheck: Remove any paths and sub-paths\n */\n const updatedPaths = Object.keys(this.selectedPaths).filter(\n (testPath) => !testPath.includes(path),\n );\n\n this.selectedPaths = updatedPaths.reduce(\n (acc, str) => {\n acc[str] = true;\n return acc;\n },\n {} as Record<string, boolean>,\n );\n }\n\n /**\n * Emit the paths array, with parent paths removed.\n */\n const paths = Object.keys(this.selectedPaths).filter(\n (path) => this.selectedPaths[path],\n );\n const pathsWithParentPathsRemoved = removeSubstringMatches(paths);\n\n this.facetSelectionUpdated.emit({ paths: pathsWithParentPathsRemoved });\n }\n\n formatLabel = (facetChild: FacetChild): string => {\n const label = facetChild.path.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n formatSubLabel = (\n facetChild: FacetChild,\n facetChildAncestor: FacetChild,\n ): string => {\n const facetChildPath = facetChild.path.substring(\n facetChildAncestor.path.length,\n );\n const label = facetChildPath.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n render() {\n const firstFacet = this.facetRoot?.[this.fieldName];\n\n return (\n <div\n class={classNames(\n 'filtersListContainer',\n 'searchcraft-filters-list-container',\n )}\n >\n {!firstFacet && (\n <p class='searchcraft-facet-message'>\n Enter a search to view facets.\n </p>\n )}\n {firstFacet?.map((facetChild: FacetChild) => {\n const isChildSelected = facetChild.children\n ? facetChild.children?.some(\n (child) => this.selectedPaths[child.path],\n )\n : false;\n\n return (\n <div\n key={facetChild.path}\n class={classNames('searchcraft-filters-list-item')}\n >\n <label\n class={classNames(\n 'filterCheckboxLabel',\n 'searchcraft-filters-list-checkbox-label',\n )}\n >\n <input\n checked={this.selectedPaths[facetChild.path]}\n onChange={(_event: Event) =>\n this.handleCheckboxChange(facetChild.path)\n }\n type='checkbox'\n />\n {isChildSelected ? (\n <div\n class={classNames(\n 'dashContainer',\n 'searchcraft-filter-list-dash-container',\n )}\n >\n <searchcraft-dash-icon />\n </div>\n ) : (\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n )}\n {this.formatLabel(facetChild)}\n </label>\n {facetChild.children && facetChild.children.length > 0 && (\n <Fragment>\n {facetChild.children.map((grandchild) => (\n <label\n key={grandchild.path}\n class={classNames(\n 'childFilterCheckboxLabel',\n 'searchcraft-child-filter-checkbox-label',\n )}\n style={{\n display: this.selectedPaths[facetChild.path]\n ? 'flex'\n : 'none',\n }}\n >\n <input\n checked={this.selectedPaths[grandchild.path]}\n onChange={(_event: Event) => {\n this.handleCheckboxChange(grandchild.path);\n }}\n type='checkbox'\n />\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n {this.formatSubLabel(grandchild, facetChild)}\n </label>\n ))}\n </Fragment>\n )}\n </div>\n );\n })}\n </div>\n );\n }\n}\n",".searchcraft-slider-container {\n align-items: center;\n display: flex;\n flex-direction: column;\n gap: 10px;\n width: 100%;\n}\n\n.searchcraft-slider-range-container {\n align-items: center;\n background-color: var(--sc-surface-disabled);\n border-radius: 999px;\n display: flex;\n position: relative;\n height: 4px;\n width: 100%;\n\n &::-webkit-slider-runnable-track {\n pointer-events: none;\n }\n\n .searchcraft-slider-active-range {\n background-color: var(--sc-surface-brand-primary);\n border-radius: 2px;\n height: 4px;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 0;\n\n &::-webkit-slider-runnable-track {\n pointer-events: none;\n }\n\n &::-moz-range-track {\n pointer-events: none;\n }\n }\n\n .searchcraft-slider-input {\n appearance: none;\n background: transparent;\n border-radius: 2px;\n height: 4px;\n margin: 0;\n outline: none;\n pointer-events: none;\n position: absolute;\n width: 100%;\n -webkit-appearance: none;\n\n &::-webkit-slider-thumb {\n background-color: var(--sc-surface-neutral-light);\n border-radius: 50%;\n border: 2px solid var(--sc-border-neutral);\n cursor: pointer;\n height: 20px;\n pointer-events: all;\n width: 20px;\n -webkit-appearance: none;\n }\n\n &::-moz-range-thumb {\n background-color: var(--sc-surface-neutral-light);\n border-radius: 50%;\n border: 2px solid var(--sc-border-neutral);\n cursor: pointer;\n height: 20px;\n pointer-events: all;\n width: 20px;\n }\n }\n}\n\n.searchcraft-slider-label-container {\n color: var(--sc-content-primary);\n display: flex;\n font-family: 'Source Sans Pro', sans-serif;\n font-size: 15px;\n font-weight: 600;\n justify-content: space-between;\n margin-top: 10px;\n width: 100%;\n}\n\n.searchcraft-slider-label {\n min-width: 30px;\n text-align: center;\n}","import {\n Component,\n Event,\n type EventEmitter,\n h,\n State,\n Prop,\n} from '@stencil/core';\nimport { getMillis } from '@utils';\nimport classNames from 'classnames';\n\n/**\n * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.\n * The component renders a slider interface, which can be used to visually choose a value between two boundaries.\n * It is consumed by the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-slider',\n styleUrl: 'searchcraft-slider.module.scss',\n shadow: false,\n})\nexport class SearchcraftSlider {\n /**\n * The maximum value allowed.\n */\n @Prop() max = 100;\n /**\n * The minimum value allowed.\n */\n @Prop() min = 0;\n /**\n * The granularity that the value must adhere to.\n */\n @Prop() granularity: number = getMillis('month');\n /** The type of data allowed. */\n @Prop() dataType: 'number' | 'date' = 'number';\n\n @State() endValue = this.max;\n @State() startValue = this.min;\n @State() lastFocusedHandle: 'min' | 'max' = 'max';\n\n /**\n * When the range has changed.\n * */\n @Event() rangeChanged: EventEmitter<{ startValue: number; endValue: number }>;\n\n componentDidLoad() {\n this.startValue = this.min;\n this.endValue = this.max;\n }\n\n private emitUpdate = async () => {\n this.rangeChanged.emit({\n startValue: this.startValue,\n endValue: this.endValue,\n });\n };\n\n private handleStartValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'min';\n if (value <= this.endValue) {\n this.startValue = value;\n this.emitUpdate();\n } else {\n this.startValue = this.endValue;\n inputElement.value = `${this.endValue}`;\n }\n };\n\n private handleEndValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'max';\n if (value >= this.startValue) {\n this.endValue = value;\n this.emitUpdate();\n } else {\n this.endValue = this.startValue;\n inputElement.value = `${this.startValue}`;\n }\n };\n\n render() {\n const rangeMin = this.min;\n const rangeMax = this.max;\n const startPercent =\n ((this.startValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n const endPercent =\n ((this.endValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n\n const startLabel =\n this.dataType === 'number'\n ? this.startValue\n : new Date(this.startValue).getFullYear();\n\n const endLabel =\n this.dataType === 'number'\n ? this.endValue\n : new Date(this.endValue).getFullYear();\n\n return (\n <div class='searchcraft-slider-container'>\n <div class='searchcraft-slider-range-container'>\n <div\n class='searchcraft-slider-active-range'\n style={{\n left: `${startPercent}%`,\n width: `${endPercent - startPercent}%`,\n }}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-min-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleStartValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }}\n type='range'\n value={this.startValue}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-max-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleEndValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }}\n type='range'\n value={this.endValue}\n />\n </div>\n <div class='searchcraft-slider-label-container'>\n <span class='searchcraft-slider-label'>{startLabel}</span>\n <span class='searchcraft-slider-label'>{endLabel}</span>\n </div>\n </div>\n );\n }\n}\n",".searchcraft-toggle-button-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 10px;\n}\n\n.searchcraft-toggle-button-label {\n @include body();\n margin: 0;\n color: var(--sc-content-neutral-primary);\n}\n\n.searchcraft-toggle-button-sub-label {\n @include body-small();\n margin: 0;\n color: var(--sc-content-neutral-secondary);\n}\n\n.searchcraft-toggle-button-background {\n transition: background-color 0.2s;\n background: var(--sc-surface-disabled);\n border: none;\n border-radius: 16px;\n cursor: pointer;\n height: 26px;\n position: relative;\n width: 44px;\n flex-shrink: 0;\n}\n\n.searchcraft-toggle-button-background.active {\n background: var(--sc-surface-brand-primary);\n box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.05);\n}\n\n.searchcraft-toggle-button-handle {\n background: var(--sc-surface-neutral-light);\n border-radius: 50%;\n height: 18px;\n left: 4px;\n position: absolute;\n top: calc(50% - 18px/2);\n transition: transform 0.3s ease;\n width: 18px;\n}\n\n.searchcraft-toggle-button-handle.active {\n transform: translateX(16px);\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n * It is consumed within the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n styleUrl: 'searchcraft-toggle-button.module.scss',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated.emit(this.isActive);\n };\n\n connectedCallback() {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query !== this.lastQuery && state.query.trim().length === 0) {\n this.isActive = false;\n }\n this.lastQuery = state.query;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <div class='searchcraft-toggle-button-container'>\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class={classNames('searchcraft-toggle-button-background', {\n active: this.isActive,\n })}\n onClick={this.handleToggle}\n type='button'\n >\n <div\n class={classNames('searchcraft-toggle-button-handle', {\n active: this.isActive,\n })}\n />\n </button>\n </div>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"searchcraft-facet-list.searchcraft-slider.searchcraft-toggle-button.entry.js","mappings":";;;;;AAMA,SAAS,mBAAmB,CAAC,IAAI,EA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craft-facet-list/searchcraft-facet-list.tsx","src/components/searchcraft-slider/searchcraft-slider.tsx","src/components/searchcraft-toggle-button/searchcraft-toggle-button.tsx"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\n\nfunction deepMergeWithSpread(obj1, obj2) {\n const result = { ...obj1 };\n\n for (const key in obj2) {\n // biome-ignore lint/suspicious/noPrototypeBuiltins: <explanation>\n if (obj2.hasOwnProperty(key)) {\n if (obj2[key] instanceof Object && obj1[key] instanceof Object) {\n result[key] = deepMergeWithSpread(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result;\n}\n\n/**\n * Given an array of facet paths, removes parent facet paths.\n */\nexport function removeSubstringMatches(arr: string[]): string[] {\n return arr.filter(\n (entry, index, array) =>\n !array.some(\n (otherEntry, otherIndex) =>\n otherIndex !== index && otherEntry.includes(entry),\n ),\n );\n}\n\ntype FacetChildFragment = {\n count: number;\n path: string;\n};\n\nfunction facetToRecord(facet: FacetChild): Record<string, FacetChildFragment> {\n const records: Record<string, FacetChildFragment> = {};\n\n const traverseAndAddToFragments = (facetChild: FacetChild) => {\n records[facetChild.path] = {\n count: facetChild.count,\n path: facetChild.path,\n };\n\n facetChild.children?.forEach((child) => {\n traverseAndAddToFragments(child);\n });\n };\n\n traverseAndAddToFragments(facet);\n\n return records;\n}\n\nfunction recordToObject(\n record: Record<string, FacetChildFragment>,\n): FacetChildObject {\n const root: FacetChildObject = {\n count: 0,\n path: '/',\n children: {},\n };\n\n Object.keys(record).forEach((key) => {\n const fragment = record[key];\n if (!fragment) {\n return;\n }\n\n if (fragment.path === '/') {\n return;\n }\n const pathParts = fragment.path.substring(1).split('/');\n let currentRoot = root;\n let currentPath = '';\n\n pathParts.forEach((part, index) => {\n const nextPath = `${currentPath}/${part}`;\n if (!currentRoot.children[nextPath]) {\n currentRoot.children[nextPath] = {\n count: 0,\n path: nextPath,\n children: {},\n };\n }\n\n if (index === pathParts.length - 1) {\n currentRoot.children[nextPath].count = fragment.count;\n }\n\n currentPath = nextPath;\n currentRoot = currentRoot.children[nextPath];\n });\n });\n\n return root;\n}\n\nfunction objectToFacet(childObject: FacetChildObject): FacetChild {\n const transformed: FacetChild = {\n count: childObject.count,\n path: childObject.path,\n children: [],\n };\n\n if (Object.keys(childObject.children).length > 0) {\n transformed.children = Object.values(childObject.children).map(\n (subChildObject) => objectToFacet(subChildObject),\n );\n }\n\n return transformed;\n}\n\n/**\n * Filters records with the parent paths from record2 OUT of record1\n */\nfunction filterRecordByParentPaths(\n record1: Record<string, FacetChild>,\n record2: Record<string, FacetChild>,\n): Record<string, FacetChild> {\n // Extract all paths (keys) both records\n const paths1 = Object.keys(record1);\n const paths2 = Object.keys(record2);\n\n // Find all parent paths in record2\n const parentPaths = new Set(\n paths2\n .filter((path) => path.split('/').length > 2) // Only consider paths with more than one level\n .map((path) => path.substring(0, path.lastIndexOf('/'))),\n );\n\n // Filter out keys in record1 that share a parent path with any of the identified parent paths\n const filteredRecord = Object.fromEntries(\n paths1\n .filter(\n (path) => !parentPaths.has(path.substring(0, path.lastIndexOf('/'))),\n )\n .map((path) => [path, record1[path]]), // Reconstruct the key-value pairs\n );\n\n return filteredRecord as Record<string, FacetChild>;\n}\n\nexport function mergeFacetRoots(\n fieldName: string,\n currentRoot: FacetRoot,\n incomingRoot: FacetRoot,\n): FacetRoot {\n const currentArray = currentRoot[fieldName];\n const incomingArray = incomingRoot[fieldName];\n\n const currentRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: currentArray,\n };\n\n const incomingRootFacetChild: FacetChild = {\n count: 0,\n path: '/',\n children: incomingArray,\n };\n\n // Flatten them into records\n const currentRecord: Record<string, FacetChildFragment> = facetToRecord(\n currentRootFacetChild,\n );\n\n const incomingRecord: Record<string, FacetChildFragment> = facetToRecord(\n incomingRootFacetChild,\n );\n\n // Filter out the records from record1 (the current set of records)\n // that share a parent path with record2 (the incoming records)\n const filteredCurrentRecord = filterRecordByParentPaths(\n currentRecord,\n incomingRecord,\n );\n\n // Deep merge the records together\n const mergedRecord: Record<string, FacetChildFragment> = deepMergeWithSpread(\n filteredCurrentRecord,\n incomingRecord,\n );\n\n // Convert into a heirarchical object\n const mergedObject: FacetChildObject = recordToObject(mergedRecord);\n\n // Convert the heirarchical object back to the Facet child structure\n const mergedFacetChild = objectToFacet(mergedObject);\n\n return {\n [fieldName]: mergedFacetChild.children,\n } as FacetRoot;\n}\n","import {\n Component,\n h,\n State,\n Prop,\n Event,\n type EventEmitter,\n Fragment,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\nimport type { FacetChild, FacetRoot } from '@searchcraft/core';\n\nimport { useSearchcraftStore, type SearchcraftState } from '@provider/store';\nimport { mergeFacetRoots, removeSubstringMatches } from '@utils';\n\n/**\n * This web component is designed to display facets in a search interface, allowing users to refine their search results by applying filters based on various attributes.\n * It is consumed within the `searchcraft-filter-panel`.\n *\n * ## Usage\n * ```html\n * <!-- index.html -->\n * <searchcraft-facet-list field-name=\"title\" />\n * ```\n *\n * ```js\n * // index.js\n * const facetList = document.querySelector('searchcraft-facet-list');\n *\n * facetList.addEventListener('facetSelectionUpdated', () => {\n * console.log('Facet selection updated');\n * });\n * ```\n */\n@Component({\n tag: 'searchcraft-facet-list',\n shadow: false,\n})\nexport class SearchcraftFacetList {\n /**\n * The name of the field where facets are applied.\n */\n @Prop() fieldName = '';\n\n /**\n * When the facets are updated.\n */\n @Event() facetSelectionUpdated?: EventEmitter<{ paths: string[] }>;\n\n @State() baseFacetRoot: FacetRoot | undefined;\n @State() facetRoot: FacetRoot | undefined;\n @State() selectedPaths: Record<string, boolean> = {};\n @State() lastTimeTaken: number | undefined;\n @State() hasNewSearchTerm = false;\n\n @State() lastQuery: string | undefined;\n @State() lastSearchMode: string | undefined;\n @State() lastSortType: string | undefined;\n\n @State() unsubscribe: (() => void) | undefined;\n\n private searchStore = useSearchcraftStore.getState();\n\n handleStateUpdate(state: SearchcraftState) {\n const facetPrime = state.searchResults?.data.facets;\n const timeTaken = state.searchResults?.data.time_taken;\n\n if (!this.fieldName) {\n return;\n }\n\n /** Things to do when the state's search term has changed, but before the response received */\n if (\n state.query !== this.lastQuery ||\n state.searchMode !== this.lastSearchMode ||\n state.sortType !== this.lastSortType\n ) {\n this.selectedPaths = {};\n this.hasNewSearchTerm = true;\n }\n\n /** Things to do when a new response with a new facet prime has been received */\n if (timeTaken !== this.lastTimeTaken && facetPrime) {\n this.facetRoot = undefined;\n const incomingFacetRoot: FacetRoot | undefined = facetPrime.find(\n (facet) => this.fieldName === Object.keys(facet)[0],\n );\n\n /** Data is from a new search term: completely override our facets */\n if (this.hasNewSearchTerm) {\n this.baseFacetRoot = incomingFacetRoot;\n this.facetRoot = incomingFacetRoot;\n this.hasNewSearchTerm = false;\n } else if (this.baseFacetRoot && incomingFacetRoot) {\n /** Data is from an existing search term, merge the facets together */\n this.facetRoot = mergeFacetRoots(\n this.fieldName,\n this.baseFacetRoot,\n incomingFacetRoot,\n );\n }\n }\n\n this.lastQuery = state.query;\n this.lastSearchMode = state.searchMode;\n this.lastSortType = state.sortType;\n this.lastTimeTaken = timeTaken;\n }\n\n connectedCallback() {\n this.handleStateUpdate(this.searchStore);\n\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n this.handleStateUpdate(state);\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n handleCheckboxChange(path: string) {\n const isCheckboxChecked = !this.selectedPaths[path];\n\n if (isCheckboxChecked) {\n /**\n * Checkbox Checked: Add to the selectedPaths record\n * Uses spread operator here so UI updates.\n */\n this.selectedPaths = {\n ...this.selectedPaths,\n [path]: true,\n };\n } else {\n /**\n * Checkbox Uncheck: Remove any paths and sub-paths\n */\n const updatedPaths = Object.keys(this.selectedPaths).filter(\n (testPath) => !testPath.includes(path),\n );\n\n this.selectedPaths = updatedPaths.reduce(\n (acc, str) => {\n acc[str] = true;\n return acc;\n },\n {} as Record<string, boolean>,\n );\n }\n\n /**\n * Emit the paths array, with parent paths removed.\n */\n const paths = Object.keys(this.selectedPaths).filter(\n (path) => this.selectedPaths[path],\n );\n const pathsWithParentPathsRemoved = removeSubstringMatches(paths);\n\n this.facetSelectionUpdated?.emit({ paths: pathsWithParentPathsRemoved });\n }\n\n formatLabel = (facetChild: FacetChild): string => {\n const label = facetChild.path.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n formatSubLabel = (\n facetChild: FacetChild,\n facetChildAncestor: FacetChild,\n ): string => {\n const facetChildPath = facetChild.path.substring(\n facetChildAncestor.path.length,\n );\n const label = facetChildPath.replace(/^\\//, '');\n const count = facetChild.count;\n return `${label.replace(/-/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase())} (${count})`;\n };\n\n render() {\n if (!this.fieldName) {\n return;\n }\n\n const firstFacet = this.facetRoot?.[this.fieldName];\n\n return (\n <div\n class={classNames(\n 'filtersListContainer',\n 'searchcraft-filters-list-container',\n )}\n >\n {!firstFacet && (\n <p class='searchcraft-facet-message'>\n Enter a search to view facets.\n </p>\n )}\n {firstFacet?.map((facetChild: FacetChild) => {\n const isChildSelected = facetChild.children\n ? facetChild.children?.some(\n (child) => this.selectedPaths[child.path],\n )\n : false;\n\n return (\n <div\n key={facetChild.path}\n class={classNames('searchcraft-filters-list-item')}\n >\n <label\n class={classNames(\n 'filterCheckboxLabel',\n 'searchcraft-filters-list-checkbox-label',\n )}\n >\n <input\n checked={this.selectedPaths[facetChild.path]}\n onChange={(_event: Event) =>\n this.handleCheckboxChange(facetChild.path)\n }\n type='checkbox'\n />\n {isChildSelected ? (\n <div\n class={classNames(\n 'dashContainer',\n 'searchcraft-filter-list-dash-container',\n )}\n >\n <searchcraft-dash-icon />\n </div>\n ) : (\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n )}\n {this.formatLabel(facetChild)}\n </label>\n {facetChild.children && facetChild.children.length > 0 && (\n <Fragment>\n {facetChild.children.map((grandchild) => (\n <label\n key={grandchild.path}\n class={classNames(\n 'childFilterCheckboxLabel',\n 'searchcraft-child-filter-checkbox-label',\n )}\n style={{\n display: this.selectedPaths[facetChild.path]\n ? 'flex'\n : 'none',\n }}\n >\n <input\n checked={this.selectedPaths[grandchild.path]}\n onChange={(_event: Event) => {\n this.handleCheckboxChange(grandchild.path);\n }}\n type='checkbox'\n />\n <div\n class={classNames(\n 'checkContainer',\n 'searchcraft-filter-list-check-container',\n )}\n >\n <searchcraft-check-icon />\n </div>\n {this.formatSubLabel(grandchild, facetChild)}\n </label>\n ))}\n </Fragment>\n )}\n </div>\n );\n })}\n </div>\n );\n }\n}\n","import {\n Component,\n Event,\n type EventEmitter,\n h,\n State,\n Prop,\n} from '@stencil/core';\nimport { getMillis } from '@utils';\nimport classNames from 'classnames';\n\n/**\n * This web component is designed to allow users to select a value from a range defined by a minimum and maximum value.\n * The component renders a slider interface, which can be used to visually choose a value between two boundaries.\n * It is consumed by the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-slider',\n shadow: false,\n})\nexport class SearchcraftSlider {\n /**\n * The maximum value allowed.\n */\n @Prop() max = 100;\n /**\n * The minimum value allowed.\n */\n @Prop() min = 0;\n /**\n * The granularity that the value must adhere to.\n */\n @Prop() granularity: number = getMillis('month');\n /** The type of data allowed. */\n @Prop() dataType: 'number' | 'date' = 'number';\n\n @State() endValue = this.max;\n @State() startValue = this.min;\n @State() lastFocusedHandle: 'min' | 'max' = 'max';\n\n /**\n * When the range has changed.\n * */\n @Event() rangeChanged:\n | EventEmitter<{ startValue: number; endValue: number }>\n | undefined;\n\n componentDidLoad() {\n this.startValue = this.min;\n this.endValue = this.max;\n }\n\n private emitUpdate = async () => {\n this.rangeChanged?.emit({\n startValue: this.startValue,\n endValue: this.endValue,\n });\n };\n\n private handleStartValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'min';\n if (value <= this.endValue) {\n this.startValue = value;\n this.emitUpdate();\n } else {\n this.startValue = this.endValue;\n inputElement.value = `${this.endValue}`;\n }\n };\n\n private handleEndValueChange = (event: InputEvent) => {\n const inputElement = event.target as HTMLInputElement;\n const value = Number.parseInt(inputElement.value, 10);\n this.lastFocusedHandle = 'max';\n if (value >= this.startValue) {\n this.endValue = value;\n this.emitUpdate();\n } else {\n this.endValue = this.startValue;\n inputElement.value = `${this.startValue}`;\n }\n };\n\n render() {\n const rangeMin = this.min;\n const rangeMax = this.max;\n const startPercent =\n ((this.startValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n const endPercent =\n ((this.endValue - rangeMin) / (rangeMax - rangeMin)) * 100;\n\n const startLabel =\n this.dataType === 'number'\n ? this.startValue\n : new Date(this.startValue).getFullYear();\n\n const endLabel =\n this.dataType === 'number'\n ? this.endValue\n : new Date(this.endValue).getFullYear();\n\n return (\n <div class='searchcraft-slider-container'>\n <div class='searchcraft-slider-range-container'>\n <div\n class='searchcraft-slider-active-range'\n style={{\n left: `${startPercent}%`,\n width: `${endPercent - startPercent}%`,\n }}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-min-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleStartValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'min' ? '2' : '1' }}\n type='range'\n value={this.startValue}\n />\n <input\n class={classNames(\n 'searchcraft-slider-input',\n 'searchcraft-slider-input-max-handle',\n )}\n max={this.max}\n min={this.min}\n onInput={this.handleEndValueChange.bind(this)}\n step={this.granularity}\n style={{ zIndex: this.lastFocusedHandle === 'max' ? '2' : '1' }}\n type='range'\n value={this.endValue}\n />\n </div>\n <div class='searchcraft-slider-label-container'>\n <span class='searchcraft-slider-label'>{startLabel}</span>\n <span class='searchcraft-slider-label'>{endLabel}</span>\n </div>\n </div>\n );\n }\n}\n","import { useSearchcraftStore } from '@provider/store';\nimport {\n Component,\n Event,\n h,\n Prop,\n State,\n type EventEmitter,\n} from '@stencil/core';\nimport classNames from 'classnames';\n\n/**\n * This web component simulates a light switch functionality, providing a simple and intuitive toggle between two states—on and off.\n * It is consumed within the `searchcraft-filter-panel` component.\n */\n@Component({\n tag: 'searchcraft-toggle-button',\n shadow: false,\n})\nexport class SearchcraftToggleButton {\n /**\n * The label.\n */\n @Prop() label = 'Toggle';\n /**\n * The secondary label displayed below the main label.\n */\n @Prop() subLabel: string | undefined;\n\n /**\n * When the toggle element is changed.\n */\n @Event() toggleUpdated?: EventEmitter<boolean>;\n\n @State() isActive = false;\n @State() unsubscribe: (() => void) | undefined;\n @State() lastQuery: string | undefined;\n\n private handleToggle = async () => {\n this.isActive = !this.isActive;\n this.toggleUpdated?.emit(this.isActive);\n };\n\n connectedCallback() {\n /** When the query changes, sets toggle button state back to inactive. */\n this.unsubscribe = useSearchcraftStore.subscribe((state) => {\n if (state.query !== this.lastQuery && state.query.trim().length === 0) {\n this.isActive = false;\n }\n this.lastQuery = state.query;\n });\n }\n\n disconnectedCallback() {\n this.unsubscribe?.();\n }\n\n render() {\n return (\n <div class='searchcraft-toggle-button-container'>\n <div>\n <p class='searchcraft-toggle-button-label'>{this.label}</p>\n {this.subLabel && (\n <p class='searchcraft-toggle-button-sub-label'>{this.subLabel}</p>\n )}\n </div>\n <button\n class={classNames('searchcraft-toggle-button-background', {\n active: this.isActive,\n })}\n onClick={this.handleToggle}\n type='button'\n >\n <div\n class={classNames('searchcraft-toggle-button-handle', {\n active: this.isActive,\n })}\n />\n </button>\n </div>\n );\n }\n}\n"],"version":3}
|