@searchcraft/javascript-sdk 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{package-38f7e2c7.js → package-2005293c.js} +2 -2
- package/dist/cjs/package-2005293c.js.map +1 -0
- package/dist/cjs/searchcraft-auto-search-form.cjs.entry.js +2 -2
- package/dist/cjs/searchcraft-base-search-form.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-base-search-results.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-error-message_3.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-facet-list_3.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-filter-panel.cjs.entry.js +1 -1
- package/dist/cjs/searchcraft-results-info.cjs.entry.js +1 -1
- package/dist/cjs/{utils-0f309f6d.js → utils-a17279a2.js} +2 -2
- package/dist/cjs/{utils-0f309f6d.js.map → utils-a17279a2.js.map} +1 -1
- package/dist/collection/types/searchcraft-base-search-results.types.js.map +1 -1
- package/dist/collection/utils/utils.js +1 -1
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-4fad3388.js → p-0468a9eb.js} +2 -2
- package/dist/components/{p-4fad3388.js.map → p-0468a9eb.js.map} +1 -1
- package/dist/components/{p-08e421ca.js → p-3e8d3586.js} +2 -2
- package/dist/components/{p-08e421ca.js.map → p-3e8d3586.js.map} +1 -1
- package/dist/components/{p-4353a2b8.js → p-7bb734f3.js} +2 -2
- package/dist/components/{p-4353a2b8.js.map → p-7bb734f3.js.map} +1 -1
- package/dist/components/{p-4c89f065.js → p-c994d722.js} +2 -2
- package/dist/components/p-c994d722.js.map +1 -0
- package/dist/components/{p-9982883f.js → p-f308d05d.js} +2 -2
- package/dist/components/{p-9982883f.js.map → p-f308d05d.js.map} +1 -1
- package/dist/components/searchcraft-auto-search-form.js +3 -3
- package/dist/components/searchcraft-base-search-form.js +2 -2
- package/dist/components/searchcraft-base-search-results.js +1 -1
- package/dist/components/searchcraft-facet-list.js +1 -1
- package/dist/components/searchcraft-filter-panel.js +3 -3
- package/dist/components/searchcraft-input.js +1 -1
- package/dist/components/searchcraft-results-info.js +1 -1
- package/dist/components/searchcraft-slider.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{package-e62ac63a.js → package-07f53086.js} +2 -2
- package/dist/esm/package-07f53086.js.map +1 -0
- package/dist/esm/searchcraft-auto-search-form.entry.js +2 -2
- package/dist/esm/searchcraft-base-search-form.entry.js +1 -1
- package/dist/esm/searchcraft-base-search-results.entry.js +1 -1
- package/dist/esm/searchcraft-error-message_3.entry.js +1 -1
- package/dist/esm/searchcraft-facet-list_3.entry.js +1 -1
- package/dist/esm/searchcraft-filter-panel.entry.js +1 -1
- package/dist/esm/searchcraft-results-info.entry.js +1 -1
- package/dist/esm/{utils-ee63b542.js → utils-c2ce411f.js} +2 -2
- package/dist/esm/{utils-ee63b542.js.map → utils-c2ce411f.js.map} +1 -1
- package/dist/searchcraft-javascript-sdk/index.esm.js +1 -1
- package/dist/searchcraft-javascript-sdk/{p-92d080a7.entry.js → p-1720b612.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-2816782c.entry.js → p-491ae071.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-15e0ce05.entry.js → p-676e2eef.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-9f29b018.entry.js → p-83a074b6.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-cc614ce6.entry.js → p-a56af0b0.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-4c89f065.js → p-c994d722.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-a148febe.entry.js → p-d08d0b15.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-9982883f.js → p-f308d05d.js} +2 -2
- package/dist/searchcraft-javascript-sdk/{p-9982883f.js.map → p-f308d05d.js.map} +1 -1
- package/dist/searchcraft-javascript-sdk/{p-e108dd2e.entry.js → p-fb239507.entry.js} +2 -2
- package/dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js +1 -1
- package/dist/types/types/searchcraft-base-search-results.types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/package-38f7e2c7.js.map +0 -1
- package/dist/components/p-4c89f065.js.map +0 -1
- package/dist/esm/package-e62ac63a.js.map +0 -1
- /package/dist/searchcraft-javascript-sdk/{p-92d080a7.entry.js.map → p-1720b612.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-2816782c.entry.js.map → p-491ae071.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-15e0ce05.entry.js.map → p-676e2eef.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-9f29b018.entry.js.map → p-83a074b6.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-cc614ce6.entry.js.map → p-a56af0b0.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-4c89f065.js.map → p-c994d722.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-a148febe.entry.js.map → p-d08d0b15.entry.js.map} +0 -0
- /package/dist/searchcraft-javascript-sdk/{p-e108dd2e.entry.js.map → p-fb239507.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as s,c as e,h as t}from"./p-80e3f29f.js";import{u as c}from"./p-a2801518.js";import{g as r,s as i}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as s,c as e,h as t}from"./p-80e3f29f.js";import{u as c}from"./p-a2801518.js";import{g as r,s as i}from"./p-f308d05d.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-search-results-container{display:flex;flex-direction:column;justify-content:center;gap:16px}.searchcraft-ad-section{align-items:center;background-color:#F1F1F1;border-radius:16px;display:flex;flex-direction:column;font-size:16px;justify-content:center;min-height:176px;text-align:center}.searchcraft-ad-section p{margin:0;color:var(--sc-content-disabled)}.searchcraft-search-results-empty-state-container{text-align:center}.searchcraft-search-results-error-message-container{text-align:center}";const a=n;const o=class{constructor(t){s(this,t);this.noResults=e(this,"noResults",7);this.adInterval=4;this.customStylesForResults=undefined;this.searchResultMappings=undefined;this.placeAdAtEnd=false;this.placeAdAtStart=true;this.resultImagePlacement="right";this.buttonLabel=undefined;this.buttonTarget="_blank";this.buttonRel=undefined;this.containerTarget="_blank";this.containerRel=undefined;this.hasSearched=false;this.query="";this.searchResults=null}componentDidLoad(){this.unsubscribe=c.subscribe((s=>{if(s.query.length>0){this.hasSearched=true}else{this.hasSearched=false}this.searchResults=Object.assign({},s.searchResults);this.query=s.query}));const{searchResults:s,query:e}=c.getState();this.searchResults=s;this.query=e}disconnectedCallback(){if(this.unsubscribe){this.unsubscribe()}}renderDocument(s,e){const c=r(s,this.searchResultMappings.title);const n=r(s,this.searchResultMappings.subtitle);const a=r(s,this.searchResultMappings.body);const o=r(s,this.searchResultMappings.containerHref);const d=r(s,this.searchResultMappings.buttonHref);const h=r(s,this.searchResultMappings.imageSource);const l=r(s,this.searchResultMappings.footer);const u=typeof this.customStylesForResults==="string"?this.customStylesForResults:i(this.customStylesForResults);return t("searchcraft-base-search-result",{key:`${s.document_id}-${e}`,"custom-styles":u,"image-placement":this.resultImagePlacement,"container-rel":this.containerRel,"container-target":this.containerTarget,"button-label":this.buttonLabel||"View more","button-rel":this.buttonRel,"button-target":this.buttonTarget,"document-position":e,"title-content":c,"subtitle-content":n,"body-content":a,"footer-content":l,"container-href":o,"button-href":d,"image-src":h})}render(){var s,e,c,r,i,n,a,o,d,h;if(this.query.trim()===""){return t("div",{class:"searchcraft-search-results-empty-state-container"},t("slot",{name:"empty-search"}))}if(!((s=this.searchResults)===null||s===void 0?void 0:s.data)){return}const l=(r=(c=(e=this.searchResults)===null||e===void 0?void 0:e.data)===null||c===void 0?void 0:c.hits)===null||r===void 0?void 0:r.map(((s,e)=>{const{doc:t}=s;return t}));const u=[];if(this.placeAdAtStart){u.push(t("div",{key:"ad-section-start",class:"searchcraft-ad-section"},t("p",null,"Ad Section")))}if(this.adInterval>0){l.forEach(((s,e)=>{u.push(this.renderDocument(s,e));if((e+1)%this.adInterval===0){u.push(t("div",{key:`ad-section-${e+1}`,class:"searchcraft-ad-section "},t("p",null,"Ad Section")))}}))}else{const s=l.map(((s,e)=>this.renderDocument(s,e)));u.push(...s)}if(this.placeAdAtEnd){u.push(t("div",{key:"ad-section-end",class:"searchcraft-ad-section"},t("p",null,"Ad Section")))}if(this.query.length>0&&((a=(n=(i=this.searchResults)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.hits)===null||a===void 0?void 0:a.length)===0){this.noResults.emit()}return t("div",{class:"searchcraft-search-results-container"},u,this.query.length>0&&((h=(d=(o=this.searchResults)===null||o===void 0?void 0:o.data)===null||d===void 0?void 0:d.hits)===null||h===void 0?void 0:h.length)===0&&t("div",{class:"searchcraft-search-results-error-message-container"},t("searchcraft-error-message",{"error-message":`No search results found for "${this.query}" query`})))}};o.style=a;export{o as searchcraft_base_search_results};
|
|
2
|
+
//# sourceMappingURL=p-676e2eef.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as s,c as e,h as c}from"./p-80e3f29f.js";import{u as a,a as r,i as t}from"./p-a2801518.js";import{p as i}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as s,c as e,h as c}from"./p-80e3f29f.js";import{u as a,a as r,i as t}from"./p-a2801518.js";import{p as i}from"./p-c994d722.js";const n=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-base-search-form-input-container{align-items:center;display:flex;gap:8px}";const o=n;const h=class{constructor(c){s(this,c);this.clearInput=e(this,"clearInput",7);this.clearInput=()=>{};this.searchStore=a.getState();this.themeStore=r.getState();this.componentDidLoad=()=>{const s=new t(this.config,{sdkName:i.name,sdkVersion:i.version});this.searchStore.initialize(s,true)};this.handleFormSubmit=async s=>{s.preventDefault();if(this.query.trim()===""){this.error=true}else{this.error=false;this.searchStore.setQuery(this.query);await this.searchStore.search();this.searchResults=JSON.stringify(this.searchStore.searchResults)}};this.handleSearchInputChange=s=>{this.query=s.detail};this.handleClearInput=()=>{this.query="";this===null||this===void 0?void 0:this.clearInput()};this.toggleTheme=()=>{this.themeStore.toggleTheme()};this.config={readKey:"",endpointURL:"",index:[]};this.errorMessage="Search was unsuccessful";this.inputLabel="Search";this.buttonLabel="Find";this.buttonPlacement="right";this.error=false;this.query="";this.searchResults=null}render(){return c("form",{key:"3200182783a9612326e4350beda3e0facc3abd83",class:"searchcraft-base-search-form",onSubmit:this.handleFormSubmit},c("searchcraft-input-label",{key:"51fbd74cab7f82435b21edcee9855fe570199d5a",label:this.inputLabel}),c("div",{key:"245a6e8fd2abf14f379e8dee9a2012a7a0fa7636",class:"searchcraft-base-search-form-input-container"},this.buttonPlacement==="left"&&c("searchcraft-button",{key:"53b09c93f5ebaf548b6954923eaa5eb0e8c6ba18",onButtonClick:this.handleFormSubmit,label:this.buttonLabel}),c("searchcraft-input",{key:"b8154b313b93cbd043bf141bdb505f8fc874428b",onClearInput:this.handleClearInput,onInputChange:this.handleSearchInputChange,query:this.query}),this.buttonPlacement==="right"&&c("searchcraft-button",{key:"534fbb59f038a670f2a65293fa5dd6a9a3cba92d",onButtonClick:this.handleFormSubmit,label:this.buttonLabel})),this.error&&c("searchcraft-error-message",{key:"8ed98aa322c4104346ac3dcb578133d8e2758866",errorMessage:this.errorMessage}))}};h.style=o;export{h as searchcraft_base_search_form};
|
|
2
|
+
//# sourceMappingURL=p-83a074b6.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,h as s}from"./p-80e3f29f.js";import{u as a}from"./p-a2801518.js";import{a as c}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,h as s}from"./p-80e3f29f.js";import{u as a}from"./p-a2801518.js";import{a as c}from"./p-f308d05d.js";const t=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-filter-panel{display:flex;flex-direction:column;gap:16px}.searchcraft-filter-panel-section{display:flex;flex-direction:column;gap:8px}.searchcraft-filter-panel-label{font-family:var(--sc-font-family);-webkit-font-smoothing:antialiased;font-size:var(--sc-body-small-bold-font-size);font-weight:var(--sc-body-small-bold-font-weight);line-height:var(--sc-body-small-bold-line-height)}";const n=t;const r=class{constructor(s){e(this,s);this.searchStore=a.getState();this.items=[];this.unsubscribe=undefined;this.lastQuery=undefined}componentDidLoad(){this.unsubscribe=a.subscribe((e=>{this.lastQuery=e.query||""}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}handleDateRangeChanged(e,s,a){const c=new Date(s);const t=new Date(a);this.searchStore.addRangeValueForIndexField({fieldName:e,value:`${e}:[${c.toISOString()} TO ${t.toISOString()}]`});this.searchStore.search()}handleNumericRangeChanged(e,s,a){this.searchStore.addRangeValueForIndexField({fieldName:e,value:`${e}:[${s} TO ${a}]`});this.searchStore.search()}handleFacetSelectionUpdated(e,s){if(s.length>0){this.searchStore.addFacetPathsForIndexField({fieldName:e,value:`${e}: IN [${s.join(" ")}]`})}else{this.searchStore.removeFacetPathsForIndexField(e)}this.searchStore.search()}handleExactMatchToggleUpdated(e){this.searchStore.setSearchMode(e?"normal":"fuzzy");this.searchStore.search()}handleMostRecentToggleUpdated(e){this.searchStore.setSortType(e?"desc":"asc");this.searchStore.search()}render(){return s("div",{key:"786ebd847aa48e29d4a5c18c7a5d3313bef3904e",class:"searchcraft-filter-panel"},this.items.map((e=>{switch(e.type){case"dateRange":{const a=e;const t=new Date(a.options.minDate).getTime();const n=new Date(a.options.maxDate).getTime();const r=c(a.options.granularity);return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-slider",{min:t,max:n,granularity:r,dataType:"date",onRangeChanged:e=>{this.handleDateRangeChanged(a.fieldName,e.detail.startValue,e.detail.endValue)}}))}case"numericRange":{const a=e;return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-slider",{min:a.options.min,max:a.options.max,granularity:a.options.granularity,onRangeChanged:e=>{this.handleNumericRangeChanged(a.fieldName,e.detail.startValue,e.detail.endValue)}}))}case"facets":{const a=e;return s("div",{class:"searchcraft-filter-panel-section"},s("p",{class:"searchcraft-filter-panel-label"},e.label),s("searchcraft-facet-list",{fieldName:a.fieldName,onFacetSelectionUpdated:e=>{this.handleFacetSelectionUpdated(a.fieldName,e.detail.paths)}}))}case"exactMatchToggle":{const a=e;return s("searchcraft-toggle-button",{label:a.label,subLabel:a.options.subLabel,onToggleUpdated:e=>{this.handleExactMatchToggleUpdated(e.detail)}})}case"mostRecentToggle":{const a=e;return s("searchcraft-toggle-button",{label:a.label,subLabel:a.options.subLabel,onToggleUpdated:e=>{this.handleMostRecentToggleUpdated(e.detail)}})}}})))}};r.style=n;export{r as searchcraft_filter_panel};
|
|
2
|
+
//# sourceMappingURL=p-a56af0b0.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const s="@searchcraft/javascript-sdk";const t="0.4.
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
const s="@searchcraft/javascript-sdk";const t="0.4.2";const e="Searchcraft Javascript SDK";const c="Searchcraft";const a="Apache-2.0";const i="dist/index.cjs.js";const n="dist/index.js";const r="dist/types/index.d.ts";const o="dist/collection/collection-manifest.json";const d="dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js";const l={".":{import:"./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.esm.js",require:"./dist/searchcraft-javascript-sdk/searchcraft-javascript-sdk.cjs.js"},"./loader":"./dist/loader/index.js","./components":"./dist/components/index.js"};const p={type:"git",url:"https://bitbucket.org/madebychalk/searchcraft-javascript-sdks/"};const j=["dist/"];const h={build:"stencil build",dev:"stencil build --dev --watch",test:"stencil test --spec --e2e","test.watch":"stencil test --spec --e2e --watchAll",generate:"stencil generate"};const f={classnames:"^2.3.2"};const v={"@searchcraft/core":"*","@stencil/core":"^4.7.0","@stencil/sass":"^3.0.12","@types/node":"^16.18.11",zustand:"^5.0.1"};const m={name:s,private:false,version:t,description:e,author:c,license:a,main:i,module:n,types:r,collection:o,"collection:main":"dist/collection/index.js",unpkg:d,exports:l,repository:p,files:j,scripts:h,dependencies:f,devDependencies:v};export{m as p};
|
|
2
|
+
//# sourceMappingURL=p-c994d722.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as s,h as c,F as a}from"./p-80e3f29f.js";import{c as t}from"./p-5cdc6210.js";import{u as r}from"./p-a2801518.js";import{m as i,r as n,a as o}from"./p-9982883f.js";const d=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.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}";const h=d;const l=class{constructor(c){e(this,c);this.facetSelectionUpdated=s(this,"facetSelectionUpdated",7);this.searchStore=r.getState();this.formatLabel=e=>{const s=e.path.replace(/^\//,"");const c=e.count;return`${s.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${c})`};this.formatSubLabel=(e,s)=>{const c=e.path.substring(s.path.length);const a=c.replace(/^\//,"");const t=e.count;return`${a.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${t})`};this.fieldName=undefined;this.baseFacetRoot=undefined;this.facetRoot=undefined;this.selectedPaths={};this.lastQuery=undefined;this.lastTimeTaken=undefined;this.hasNewSearchTerm=false;this.unsubscribe=undefined}handleStateUpdate(e){var s,c;const a=(s=e.searchResults)===null||s===void 0?void 0:s.data.facets;const t=(c=e.searchResults)===null||c===void 0?void 0:c.data.time_taken;if(e.query!==this.lastQuery){this.selectedPaths={};this.hasNewSearchTerm=true}if(t!==this.lastTimeTaken&&a){this.facetRoot=undefined;const e=a.find((e=>this.fieldName===Object.keys(e)[0]));if(this.hasNewSearchTerm){this.baseFacetRoot=e;this.facetRoot=e;this.hasNewSearchTerm=false}else if(this.baseFacetRoot){this.facetRoot=i(this.fieldName,this.baseFacetRoot,e)}}this.lastQuery=e.query;this.lastTimeTaken=t}connectedCallback(){this.handleStateUpdate(this.searchStore);this.unsubscribe=r.subscribe((e=>{this.handleStateUpdate(e)}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}handleCheckboxChange(e){const s=!this.selectedPaths[e];if(s){this.selectedPaths=Object.assign(Object.assign({},this.selectedPaths),{[e]:true})}else{const s=Object.keys(this.selectedPaths).filter((s=>!s.includes(e)));this.selectedPaths=s.reduce(((e,s)=>{e[s]=true;return e}),{})}const c=Object.keys(this.selectedPaths).filter((e=>this.selectedPaths[e]));const a=n(c);this.facetSelectionUpdated.emit({paths:a})}render(){var e;const s=(e=this.facetRoot)===null||e===void 0?void 0:e[this.fieldName];return c("div",{key:"3dbfa6515c9628e8eea3cddcd108403a9d51f7c1",class:t("filtersListContainer","searchcraft-filters-list-container")},!s&&c("p",{key:"c7c519a6a4b6d27343a0ba953d428ec892dbdc93",class:"searchcraft-facet-message"},"Enter a search to view facets."),s===null||s===void 0?void 0:s.map((e=>{var s;const r=e.children?(s=e.children)===null||s===void 0?void 0:s.some((e=>this.selectedPaths[e.path])):false;return c("div",{key:e.path,class:t("searchcraft-filters-list-item")},c("label",{class:t("filterCheckboxLabel","searchcraft-filters-list-checkbox-label")},c("input",{checked:this.selectedPaths[e.path],onChange:s=>this.handleCheckboxChange(e.path),type:"checkbox"}),r?c("div",{class:t("dashContainer","searchcraft-filter-list-dash-container")},c("searchcraft-dash-icon",null)):c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatLabel(e)),e.children&&e.children.length>0&&c(a,null,e.children.map((s=>c("label",{key:s.path,class:t("childFilterCheckboxLabel","searchcraft-child-filter-checkbox-label"),style:{display:this.selectedPaths[e.path]?"flex":"none"}},c("input",{checked:this.selectedPaths[s.path],onChange:e=>{this.handleCheckboxChange(s.path)},type:"checkbox"}),c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatSubLabel(s,e))))))})))}};l.style=h;const f=':root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-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}';const u=f;const p=class{constructor(c){e(this,c);this.rangeChanged=s(this,"rangeChanged",7);this.emitUpdate=async()=>{this.rangeChanged.emit({startValue:this.startValue,endValue:this.endValue})};this.handleStartValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="min";if(c<=this.endValue){this.startValue=c;this.emitUpdate()}else{this.startValue=this.endValue;s.value=`${this.endValue}`}};this.handleEndValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="max";if(c>=this.startValue){this.endValue=c;this.emitUpdate()}else{this.endValue=this.startValue;s.value=`${this.startValue}`}};this.max=100;this.min=0;this.granularity=o("month");this.dataType="number";this.endValue=this.max;this.startValue=this.min;this.lastFocusedHandle="max"}componentDidLoad(){this.startValue=this.min;this.endValue=this.max}render(){const e=this.min;const s=this.max;const a=(this.startValue-e)/(s-e)*100;const r=(this.endValue-e)/(s-e)*100;const i=this.dataType==="number"?this.startValue:new Date(this.startValue).getFullYear();const n=this.dataType==="number"?this.endValue:new Date(this.endValue).getFullYear();return c("div",{key:"f05bc14a425c9e302cd0aad174af7e80a553258e",class:"searchcraft-slider-container"},c("div",{key:"e52983353639e1c5b695772d55148daa25b48845",class:"searchcraft-slider-range-container"},c("div",{key:"9f7d5601f056a75bfd8f5ef9053a21a4931c8b1c",class:"searchcraft-slider-active-range",style:{left:`${a}%`,width:`${r-a}%`}}),c("input",{key:"c7816c75212e3573ec35171557b79c9de1da60f9",class:t("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}),c("input",{key:"0fe6e721448b99899f6875d05789399f862cb82e",class:t("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})),c("div",{key:"fdf17ab7c1322824bbd94de96b223d3e2ceddfc8",class:"searchcraft-slider-label-container"},c("span",{key:"e7ddfd13f5d258a995bb824e9b26a492e5ca4f32",class:"searchcraft-slider-label"},i),c("span",{key:"67d6f9ea4e8fa7f651c9e9cafb624996df1676ea",class:"searchcraft-slider-label"},n)))}};p.style=u;const b=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-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)}";const g=b;const y=class{constructor(c){e(this,c);this.toggleUpdated=s(this,"toggleUpdated",7);this.handleToggle=async()=>{this.isActive=!this.isActive;this.toggleUpdated.emit(this.isActive)};this.label="Toggle";this.subLabel=undefined;this.isActive=false;this.unsubscribe=undefined;this.lastQuery=undefined}connectedCallback(){this.unsubscribe=r.subscribe((e=>{if(e.query!==this.lastQuery){this.isActive=false;this.lastQuery=e.query}}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}render(){return c("div",{key:"e6d23071452a4a01b95a45748860df7737735c83",class:"searchcraft-toggle-button-container"},c("div",{key:"3d87cd576368065c7fe8d3b50daef9c67c04253e"},c("p",{key:"06d1f349c9132e6a9762d777e3f90c635852e4a1",class:"searchcraft-toggle-button-label"},this.label),this.subLabel&&c("p",{key:"9bf361bdb33977a089d9364822c9c11b846b59a5",class:"searchcraft-toggle-button-sub-label"},this.subLabel)),c("button",{key:"bb8f27eecb9fe8d5dde237f81d04c3e79a7ec87b",class:t("searchcraft-toggle-button-background",{active:this.isActive}),onClick:this.handleToggle,type:"button"},c("div",{key:"d4be7cc5fbadfc28e97c4dfada15236b7be2fda0",class:t("searchcraft-toggle-button-handle",{active:this.isActive})})))}};y.style=g;export{l as searchcraft_facet_list,p as searchcraft_slider,y as searchcraft_toggle_button};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as s,h as c,F as a}from"./p-80e3f29f.js";import{c as t}from"./p-5cdc6210.js";import{u as r}from"./p-a2801518.js";import{m as i,r as n,a as o}from"./p-f308d05d.js";const d=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.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}";const h=d;const l=class{constructor(c){e(this,c);this.facetSelectionUpdated=s(this,"facetSelectionUpdated",7);this.searchStore=r.getState();this.formatLabel=e=>{const s=e.path.replace(/^\//,"");const c=e.count;return`${s.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${c})`};this.formatSubLabel=(e,s)=>{const c=e.path.substring(s.path.length);const a=c.replace(/^\//,"");const t=e.count;return`${a.replace(/-/g," ").replace(/\b\w/g,(e=>e.toUpperCase()))} (${t})`};this.fieldName=undefined;this.baseFacetRoot=undefined;this.facetRoot=undefined;this.selectedPaths={};this.lastQuery=undefined;this.lastTimeTaken=undefined;this.hasNewSearchTerm=false;this.unsubscribe=undefined}handleStateUpdate(e){var s,c;const a=(s=e.searchResults)===null||s===void 0?void 0:s.data.facets;const t=(c=e.searchResults)===null||c===void 0?void 0:c.data.time_taken;if(e.query!==this.lastQuery){this.selectedPaths={};this.hasNewSearchTerm=true}if(t!==this.lastTimeTaken&&a){this.facetRoot=undefined;const e=a.find((e=>this.fieldName===Object.keys(e)[0]));if(this.hasNewSearchTerm){this.baseFacetRoot=e;this.facetRoot=e;this.hasNewSearchTerm=false}else if(this.baseFacetRoot){this.facetRoot=i(this.fieldName,this.baseFacetRoot,e)}}this.lastQuery=e.query;this.lastTimeTaken=t}connectedCallback(){this.handleStateUpdate(this.searchStore);this.unsubscribe=r.subscribe((e=>{this.handleStateUpdate(e)}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}handleCheckboxChange(e){const s=!this.selectedPaths[e];if(s){this.selectedPaths=Object.assign(Object.assign({},this.selectedPaths),{[e]:true})}else{const s=Object.keys(this.selectedPaths).filter((s=>!s.includes(e)));this.selectedPaths=s.reduce(((e,s)=>{e[s]=true;return e}),{})}const c=Object.keys(this.selectedPaths).filter((e=>this.selectedPaths[e]));const a=n(c);this.facetSelectionUpdated.emit({paths:a})}render(){var e;const s=(e=this.facetRoot)===null||e===void 0?void 0:e[this.fieldName];return c("div",{key:"3dbfa6515c9628e8eea3cddcd108403a9d51f7c1",class:t("filtersListContainer","searchcraft-filters-list-container")},!s&&c("p",{key:"c7c519a6a4b6d27343a0ba953d428ec892dbdc93",class:"searchcraft-facet-message"},"Enter a search to view facets."),s===null||s===void 0?void 0:s.map((e=>{var s;const r=e.children?(s=e.children)===null||s===void 0?void 0:s.some((e=>this.selectedPaths[e.path])):false;return c("div",{key:e.path,class:t("searchcraft-filters-list-item")},c("label",{class:t("filterCheckboxLabel","searchcraft-filters-list-checkbox-label")},c("input",{checked:this.selectedPaths[e.path],onChange:s=>this.handleCheckboxChange(e.path),type:"checkbox"}),r?c("div",{class:t("dashContainer","searchcraft-filter-list-dash-container")},c("searchcraft-dash-icon",null)):c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatLabel(e)),e.children&&e.children.length>0&&c(a,null,e.children.map((s=>c("label",{key:s.path,class:t("childFilterCheckboxLabel","searchcraft-child-filter-checkbox-label"),style:{display:this.selectedPaths[e.path]?"flex":"none"}},c("input",{checked:this.selectedPaths[s.path],onChange:e=>{this.handleCheckboxChange(s.path)},type:"checkbox"}),c("div",{class:t("checkContainer","searchcraft-filter-list-check-container")},c("searchcraft-check-icon",null)),this.formatSubLabel(s,e))))))})))}};l.style=h;const f=':root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-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}';const u=f;const p=class{constructor(c){e(this,c);this.rangeChanged=s(this,"rangeChanged",7);this.emitUpdate=async()=>{this.rangeChanged.emit({startValue:this.startValue,endValue:this.endValue})};this.handleStartValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="min";if(c<=this.endValue){this.startValue=c;this.emitUpdate()}else{this.startValue=this.endValue;s.value=`${this.endValue}`}};this.handleEndValueChange=e=>{const s=e.target;const c=Number.parseInt(s.value,10);this.lastFocusedHandle="max";if(c>=this.startValue){this.endValue=c;this.emitUpdate()}else{this.endValue=this.startValue;s.value=`${this.startValue}`}};this.max=100;this.min=0;this.granularity=o("month");this.dataType="number";this.endValue=this.max;this.startValue=this.min;this.lastFocusedHandle="max"}componentDidLoad(){this.startValue=this.min;this.endValue=this.max}render(){const e=this.min;const s=this.max;const a=(this.startValue-e)/(s-e)*100;const r=(this.endValue-e)/(s-e)*100;const i=this.dataType==="number"?this.startValue:new Date(this.startValue).getFullYear();const n=this.dataType==="number"?this.endValue:new Date(this.endValue).getFullYear();return c("div",{key:"f05bc14a425c9e302cd0aad174af7e80a553258e",class:"searchcraft-slider-container"},c("div",{key:"e52983353639e1c5b695772d55148daa25b48845",class:"searchcraft-slider-range-container"},c("div",{key:"9f7d5601f056a75bfd8f5ef9053a21a4931c8b1c",class:"searchcraft-slider-active-range",style:{left:`${a}%`,width:`${r-a}%`}}),c("input",{key:"c7816c75212e3573ec35171557b79c9de1da60f9",class:t("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}),c("input",{key:"0fe6e721448b99899f6875d05789399f862cb82e",class:t("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})),c("div",{key:"fdf17ab7c1322824bbd94de96b223d3e2ceddfc8",class:"searchcraft-slider-label-container"},c("span",{key:"e7ddfd13f5d258a995bb824e9b26a492e5ca4f32",class:"searchcraft-slider-label"},i),c("span",{key:"67d6f9ea4e8fa7f651c9e9cafb624996df1676ea",class:"searchcraft-slider-label"},n)))}};p.style=u;const b=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-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)}";const g=b;const y=class{constructor(c){e(this,c);this.toggleUpdated=s(this,"toggleUpdated",7);this.handleToggle=async()=>{this.isActive=!this.isActive;this.toggleUpdated.emit(this.isActive)};this.label="Toggle";this.subLabel=undefined;this.isActive=false;this.unsubscribe=undefined;this.lastQuery=undefined}connectedCallback(){this.unsubscribe=r.subscribe((e=>{if(e.query!==this.lastQuery){this.isActive=false;this.lastQuery=e.query}}))}disconnectedCallback(){var e;(e=this.unsubscribe)===null||e===void 0?void 0:e.call(this)}render(){return c("div",{key:"e6d23071452a4a01b95a45748860df7737735c83",class:"searchcraft-toggle-button-container"},c("div",{key:"3d87cd576368065c7fe8d3b50daef9c67c04253e"},c("p",{key:"06d1f349c9132e6a9762d777e3f90c635852e4a1",class:"searchcraft-toggle-button-label"},this.label),this.subLabel&&c("p",{key:"9bf361bdb33977a089d9364822c9c11b846b59a5",class:"searchcraft-toggle-button-sub-label"},this.subLabel)),c("button",{key:"bb8f27eecb9fe8d5dde237f81d04c3e79a7ec87b",class:t("searchcraft-toggle-button-background",{active:this.isActive}),onClick:this.handleToggle,type:"button"},c("div",{key:"d4be7cc5fbadfc28e97c4dfada15236b7be2fda0",class:t("searchcraft-toggle-button-handle",{active:this.isActive})})))}};y.style=g;export{l as searchcraft_facet_list,p as searchcraft_slider,y as searchcraft_toggle_button};
|
|
2
|
+
//# sourceMappingURL=p-d08d0b15.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t){if(typeof t==="string"){try{return JSON.parse(t)}catch(n){console.error("Invalid customStyles format:",t);return{}}}return t||{}}function n(t){try{return JSON.stringify(t)}catch(t){console.error("Error serializing styles:",t);return"{}"}}function c(t){const n=new Date;const c=new Date(t);const o=Math.floor((n.getTime()-c.getTime())/1e3);const e=Math.floor(o/60);const r=Math.floor(e/60);const s=Math.floor(r/24);const u=Math.floor(s/365);if(e<60){return`${e}m ago`}if(r<24){return`${r}h ago`}if(s<365){return`${s}d ago`}return`${u}y ago`}function o(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function e(t){const n=60*60*1e3;const c=24*n;const o=30*c;const e=365*c;switch(t){case"hour":return n;case"day":return c;case"month":return o;case"year":return e;default:return 36e5}}function r(t){return t.filter(((t,n,c)=>!c.some(((c,o)=>o!==n&&c.includes(t)))))}function s(t,n){if(t&&n){return n.fieldNames.map((n=>{let o=t[n.fieldName];if(o&&n.dataType==="date"){o=c(o)}return o})).filter((t=>!!t)).join(n.
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
function t(t){if(typeof t==="string"){try{return JSON.parse(t)}catch(n){console.error("Invalid customStyles format:",t);return{}}}return t||{}}function n(t){try{return JSON.stringify(t)}catch(t){console.error("Error serializing styles:",t);return"{}"}}function c(t){const n=new Date;const c=new Date(t);const o=Math.floor((n.getTime()-c.getTime())/1e3);const e=Math.floor(o/60);const r=Math.floor(e/60);const s=Math.floor(r/24);const u=Math.floor(s/365);if(e<60){return`${e}m ago`}if(r<24){return`${r}h ago`}if(s<365){return`${s}d ago`}return`${u}y ago`}function o(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function e(t){const n=60*60*1e3;const c=24*n;const o=30*c;const e=365*c;switch(t){case"hour":return n;case"day":return c;case"month":return o;case"year":return e;default:return 36e5}}function r(t){return t.filter(((t,n,c)=>!c.some(((c,o)=>o!==n&&c.includes(t)))))}function s(t,n){if(t&&n){return n.fieldNames.map((n=>{let o=t[n.fieldName];if(o&&n.dataType==="date"){o=c(o)}return o})).filter((t=>!!t)).join(n.delimiter||" ")}}function u(t,n){const c=Object.assign({},t);for(const o in n){if(n.hasOwnProperty(o)){if(n[o]instanceof Object&&t[o]instanceof Object){c[o]=u(t[o],n[o])}else{c[o]=n[o]}}}return c}function a(t){const n={};const c=t=>{var o;n[t.path]={count:t.count,path:t.path};(o=t.children)===null||o===void 0?void 0:o.forEach((t=>{c(t)}))};c(t);return n}function i(t){const n={count:0,path:"/",children:{}};Object.keys(t).forEach((c=>{const o=t[c];if(o.path==="/"){return}const e=o.path.substring(1).split("/");let r=n;let s="";e.forEach(((t,n)=>{const c=`${s}/${t}`;if(!r.children[c]){r.children[c]={count:0,path:c,children:{}}}if(n===e.length-1){r.children[c].count=o.count}s=c;r=r.children[c]}))}));return n}function f(t){const n={count:t.count,path:t.path,children:[]};if(Object.keys(t.children).length>0){n.children=Object.values(t.children).map((t=>f(t)))}return n}function h(t,n){const c=Object.keys(t);const o=Object.keys(n);const e=new Set(o.filter((t=>t.split("/").length>2)).map((t=>t.substring(0,t.lastIndexOf("/")))));const r=Object.fromEntries(c.filter((t=>!e.has(t.substring(0,t.lastIndexOf("/"))))).map((n=>[n,t[n]])));return r}function l(t,n,c){const o=n[t];const e=c[t];const r={count:0,path:"/",children:o};const s={count:0,path:"/",children:e};const l=a(r);const d=a(s);const O=h(l,d);const b=u(O,d);const j=i(b);const p=f(j);return{[t]:p.children}}export{e as a,o as f,s as g,l as m,t as p,r,n as s};
|
|
2
|
+
//# sourceMappingURL=p-f308d05d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["parseCustomStyles","styles","JSON","parse","error","console","serializeStyles","stringify","getFormattedTimeFromNow","timestamp","now","Date","inputTime","diffInSeconds","Math","floor","getTime","minutes","hours","days","years","formatNumberWithCommas","number","toString","replace","getMillis","unit","millisInHour","millisInDay","millisInMonth","millisInYear","removeSubstringMatches","arr","filter","entry","index","array","some","otherEntry","otherIndex","includes","getDocumentValueFromSearchResultMapping","document","mapping","fieldNames","map","fieldNameDetails","valueFound","fieldName","dataType","value","join","delimeter","deepMergeWithSpread","obj1","obj2","result","Object","assign","key","hasOwnProperty","facetToRecord","facet","records","traverseAndAddToFragments","facetChild","path","count","_a","children","forEach","child","recordToObject","record","root","keys","fragment","pathParts","substring","split","currentRoot","currentPath","part","nextPath","length","objectToFacet","childObject","transformed","values","subChildObject","filterRecordByParentPaths","record1","record2","paths1","paths2","parentPaths","Set","lastIndexOf","filteredRecord","fromEntries","has","mergeFacetRoots","incomingRoot","currentArray","incomingArray","currentRootFacetChild","incomingRootFacetChild","currentRecord","incomingRecord","filteredCurrentRecord","mergedRecord","mergedObject","mergedFacetChild"],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\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\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimeter || ' ');\n }\n}\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\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"],"mappings":"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","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["parseCustomStyles","styles","JSON","parse","error","console","serializeStyles","stringify","getFormattedTimeFromNow","timestamp","now","Date","inputTime","diffInSeconds","Math","floor","getTime","minutes","hours","days","years","formatNumberWithCommas","number","toString","replace","getMillis","unit","millisInHour","millisInDay","millisInMonth","millisInYear","removeSubstringMatches","arr","filter","entry","index","array","some","otherEntry","otherIndex","includes","getDocumentValueFromSearchResultMapping","document","mapping","fieldNames","map","fieldNameDetails","valueFound","fieldName","dataType","value","join","delimiter","deepMergeWithSpread","obj1","obj2","result","Object","assign","key","hasOwnProperty","facetToRecord","facet","records","traverseAndAddToFragments","facetChild","path","count","_a","children","forEach","child","recordToObject","record","root","keys","fragment","pathParts","substring","split","currentRoot","currentPath","part","nextPath","length","objectToFacet","childObject","transformed","values","subChildObject","filterRecordByParentPaths","record1","record2","paths1","paths2","parentPaths","Set","lastIndexOf","filteredRecord","fromEntries","has","mergeFacetRoots","incomingRoot","currentArray","incomingArray","currentRootFacetChild","incomingRootFacetChild","currentRecord","incomingRecord","filteredCurrentRecord","mergedRecord","mergedObject","mergedFacetChild"],"sources":["src/utils/utils.ts"],"sourcesContent":["import type {\n FacetChild,\n FacetChildObject,\n FacetRoot,\n} from '@searchcraft/core';\nimport type { SearchResultMapping } from 'types';\n\nexport function parseCustomStyles(\n styles: string | Record<string, string>,\n): Record<string, string> {\n if (typeof styles === 'string') {\n try {\n return JSON.parse(styles);\n } catch (error) {\n console.error('Invalid customStyles format:', styles);\n return {};\n }\n }\n return styles || {};\n}\n\nexport function serializeStyles(\n styles: Record<string, Record<string, string>>,\n): string {\n try {\n return JSON.stringify(styles);\n } catch (error) {\n console.error('Error serializing styles:', error);\n return '{}';\n }\n}\n\n/**\n * Given a timestamp value, returns a formatted time string for the time\n * since now.\n *\n * @param timestamp\n * @returns {string} Formatted string value\n */\nexport function getFormattedTimeFromNow(timestamp: string): string {\n const now = new Date();\n const inputTime = new Date(timestamp);\n const diffInSeconds = Math.floor(\n (now.getTime() - inputTime.getTime()) / 1000,\n );\n\n const minutes = Math.floor(diffInSeconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const years = Math.floor(days / 365);\n\n if (minutes < 60) {\n return `${minutes}m ago`;\n }\n if (hours < 24) {\n return `${hours}h ago`;\n }\n if (days < 365) {\n return `${days}d ago`;\n }\n return `${years}y ago`;\n}\n\nexport function filterPaths(paths) {\n return paths.filter((path) => {\n const parts = path.split('/').filter(Boolean);\n\n if (parts.length > 1) {\n return true;\n }\n\n return !paths.some(\n (otherPath) => otherPath.startsWith(`${path}/`) && otherPath !== path,\n );\n });\n}\n\nexport function formatNumberWithCommas(number) {\n return number.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n}\n\nexport function getMillis(unit: 'year' | 'month' | 'day' | 'hour'): number {\n const millisInHour = 60 * 60 * 1000;\n const millisInDay = 24 * millisInHour;\n const millisInMonth = 30 * millisInDay;\n const millisInYear = 365 * millisInDay;\n\n switch (unit) {\n case 'hour':\n return millisInHour;\n case 'day':\n return millisInDay;\n case 'month':\n return millisInMonth;\n case 'year':\n return millisInYear;\n default:\n return 3600000;\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\n/**\n * Given a document and a SearchResultMapping, return a mapped value from the document.\n *\n * @param document\n * @param {SearchResultMapping} mapping\n * @returns {string | undefined}\n */\nexport function getDocumentValueFromSearchResultMapping(\n document: Record<string, unknown> | undefined,\n mapping: SearchResultMapping | undefined,\n): string | undefined {\n if (document && mapping) {\n return mapping.fieldNames\n .map((fieldNameDetails) => {\n let valueFound = document[fieldNameDetails.fieldName];\n\n if (valueFound && fieldNameDetails.dataType === 'date') {\n valueFound = getFormattedTimeFromNow(valueFound as string);\n }\n\n return valueFound;\n })\n .filter((value) => !!value)\n .join(mapping.delimiter || ' ');\n }\n}\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\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"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as s,h as e}from"./p-80e3f29f.js";import{u as c}from"./p-a2801518.js";import{f as r}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as s,h as e}from"./p-80e3f29f.js";import{u as c}from"./p-a2801518.js";import{f as r}from"./p-f308d05d.js";const a=":root{--sc-spinner-size:20px;--sc-input-border-radius:8px;--sc-input-search-icon-size:20px;--sc-input-clear-icon-size:20px;--sc-input-padding-left:44px;--sc-input-padding-right:44px;--sc-image-border-radius:8px}:root{--sc-surface-disabled:#D9D9D9;--sc-surface-neutral-primary:#FFFFFF;--sc-surface-neutral-secondary:#F3F3F3;--sc-surface-neutral-light:#FFFFFF;--sc-surface-neutral-primary-hover:#FAFAFA;--sc-surface-neutral-primary-active:#F7F7F7;--sc-surface-neutral-secondary-hover:#EDEDED;--sc-surface-neutral-secondary-active:#E6E6E6;--sc-surface-brand-primary:#000000;--sc-surface-brand-secondary:#E6E6E6;--sc-surface-brand-primary-hover:#2E2E2E;--sc-surface-brand-primary-active:#292929;--sc-surface-brand-secondary-hover:#EBEBEB;--sc-surface-brand-secondary-active:#E0E0E0;--sc-surface-success-primary:#008000;--sc-surface-success-secondary:#CCFFCC;--sc-surface-success-primary-hover:#009900;--sc-surface-success-primary-active:#006600;--sc-surface-success-secondary-hover:#E6FFE6;--sc-surface-success-secondary-active:#E6FFE6;--sc-surface-caution-primary:#CC6600;--sc-surface-caution-secondary:#FFD9B3;--sc-surface-caution-primary-hover:#E57300;--sc-surface-caution-primary-active:#B25A00;--sc-surface-caution-secondary-hover:#FFE5CC;--sc-surface-caution-secondary-active:#FFCC99;--sc-surface-danger-primary:#CC0000;--sc-surface-danger-secondary:#FFCCCC;--sc-surface-danger-primary-hover:#E50000;--sc-surface-danger-primary-active:#B30000;--sc-surface-danger-secondary-hover:#FFE7E7;--sc-surface-danger-secondary-active:#FFB3B3;--sc-content-brand:#000000;--sc-content-success:#008000;--sc-content-caution:#994D00;--sc-content-danger:#990000;--sc-content-disabled:#737373;--sc-content-neutral-primary:#292929;--sc-content-neutral-secondary:#404040;--sc-content-brand-on-primary:#FFFFFF;--sc-content-success-on-primary:#FFFFFF;--sc-content-caution-on-primary:#FFFFFF;--sc-content-danger-on-primary:#FFFFFF;--sc-content-disabled-on-disabled:#737373;--sc-border-neutral:rgba(0,0,0, 0.1);--sc-border-brand:#000000;--sc-border-success:#008000;--sc-border-caution:#CC6600;--sc-border-danger:#CC0000;--sc-border-disabled:#737373}:root{--sc-font-family:sans-serif;--sc-heading-1-font-size:32px;--sc-heading-1-line-height:36px;--sc-heading-1-font-weight:700;--sc-heading-2-font-size:29px;--sc-heading-2-line-height:32px;--sc-heading-2-font-weight:700;--sc-heading-3-font-size:26px;--sc-heading-3-line-height:28px;--sc-heading-3-font-weight:700;--sc-heading-4-font-size:23px;--sc-heading-4-line-height:24px;--sc-heading-4-font-weight:700;--sc-heading-5-font-size:20px;--sc-heading-5-line-height:24px;--sc-heading-5-font-weight:700;--sc-heading-6-font-size:10px;--sc-heading-6-line-height:12px;--sc-heading-6-font-weight:700;--sc-body-bold-font-size:16px;--sc-body-bold-line-height:20px;--sc-body-bold-font-weight:700;--sc-body-font-size:16px;--sc-body-line-height:20px;--sc-body-font-weight:400;--sc-body-small-bold-font-size:12px;--sc-body-small-bold-line-height:16px;--sc-body-small-bold-font-weight:700;--sc-body-small-font-size:12px;--sc-body-small-line-height:16px;--sc-body-small-font-weight:400}.searchcraft-results-info-container{border-bottom:1px solid var(--sc-surface-disabled);display:flex;justify-content:flex-start}.searchcraft-results-info-content{color:var(--sc-content-primary);font-family:var(--sc-font-family);font-size:18px;font-weight:600;line-height:20px;margin:0px 0 8px}@media (max-width: 900px){.searchcraft-results-info-content{margin:0;margin-bottom:8px}}";const n=a;const i=class{constructor(e){s(this,e);this.isRequesting=false;this.resultsCount=0;this.responseTime="";this.query=""}connectedCallback(){this.unsubscribe=c.subscribe((s=>{var e,c,r,a;this.isRequesting=s.isRequesting;this.resultsCount=((c=(e=s.searchResults)===null||e===void 0?void 0:e.data)===null||c===void 0?void 0:c.count)||0;this.responseTime=((((a=(r=s.searchResults)===null||r===void 0?void 0:r.data)===null||a===void 0?void 0:a.time_taken)||0)*1e3).toFixed(2);this.query=s.query||""}))}disconnectedCallback(){if(this.unsubscribe){this.unsubscribe()}}render(){if(!this.query||this.resultsCount===0){return null}const s=r(this.resultsCount);return e("div",{class:"searchcraft-results-info-container"},e("p",{class:"searchcraft-results-info-content"},s," results found in ",this.responseTime,"ms"))}};i.style=n;export{i as searchcraft_results_info};
|
|
2
|
+
//# sourceMappingURL=p-fb239507.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-80e3f29f.js";export{s as setNonce}from"./p-80e3f29f.js";import{g as a}from"./p-e1255160.js";var r=()=>{const t=import.meta.url;const a={};if(t!==""){a.resourcesUrl=new URL(".",t).href}return e(a)};r().then((async e=>{await a();return t([["p-
|
|
1
|
+
import{p as e,b as t}from"./p-80e3f29f.js";export{s as setNonce}from"./p-80e3f29f.js";import{g as a}from"./p-e1255160.js";var r=()=>{const t=import.meta.url;const a={};if(t!==""){a.resourcesUrl=new URL(".",t).href}return e(a)};r().then((async e=>{await a();return t([["p-83a074b6",[[0,"searchcraft-base-search-form",{config:[16],errorMessage:[1,"error-message"],inputLabel:[1,"input-label"],buttonLabel:[1,"button-label"],buttonPlacement:[1,"button-placement"],error:[32],query:[32],searchResults:[32]}]]],["p-a56af0b0",[[0,"searchcraft-filter-panel",{items:[16],unsubscribe:[32],lastQuery:[32]}]]],["p-491ae071",[[0,"searchcraft-auto-search-form",{autoSearchFormClass:[1,"auto-search-form-class"],clearInput:[16],config:[16],customStylesForInput:[1,"custom-styles-for-input"],inputCaptionValue:[1,"input-caption-value"],labelForInput:[1,"label-for-input"],placeholderValue:[1,"placeholder-value"],searchContainerClass:[1,"search-container-class"],error:[32],isRequesting:[32],query:[32],searchResults:[32]},null,{config:["onConfigChange"]}]]],["p-676e2eef",[[4,"searchcraft-base-search-results",{adInterval:[2,"ad-interval"],customStylesForResults:[1,"custom-styles-for-results"],searchResultMappings:[16],placeAdAtEnd:[4,"place-ad-at-end"],placeAdAtStart:[4,"place-ad-at-start"],resultImagePlacement:[1,"result-image-placement"],buttonLabel:[1,"button-label"],buttonTarget:[1,"button-target"],buttonRel:[1,"button-rel"],containerTarget:[1,"container-target"],containerRel:[1,"container-rel"],hasSearched:[32],query:[32],searchResults:[32]}]]],["p-e8a96dca",[[1,"searchcraft-button-icon"]]],["p-4a2d1f44",[[1,"searchcraft-clear-icon-set",{type:[1]}]]],["p-fb239507",[[0,"searchcraft-results-info",{isRequesting:[32],resultsCount:[32],responseTime:[32],query:[32]}]]],["p-3292e706",[[1,"searchcraft-search-icon-set",{type:[1],width:[2],height:[2]}]]],["p-efb41d6d",[[1,"searchcraft-spinner-light"]]],["p-c70b31ae",[[1,"searchcraft-spinner-dark"]]],["p-8a9b0762",[[0,"searchcraft-button",{iconElement:[16],iconOnly:[4,"icon-only"],iconPosition:[1,"icon-position"],label:[1],isRequesting:[32]}]]],["p-d4a7d8bd",[[0,"searchcraft-base-search-result",{titleContent:[1,"title-content"],subtitleContent:[1,"subtitle-content"],bodyContent:[1,"body-content"],footerContent:[1,"footer-content"],buttonLabel:[1,"button-label"],buttonHref:[1,"button-href"],buttonTarget:[1,"button-target"],buttonRel:[1,"button-rel"],containerHref:[1,"container-href"],containerTarget:[1,"container-target"],containerRel:[1,"container-rel"],imageSrc:[1,"image-src"],imageAlt:[1,"image-alt"],imagePlacement:[1,"image-placement"],customStyles:[1,"custom-styles"],documentPosition:[2,"document-position"]}]]],["p-bcc68b15",[[1,"searchcraft-check-icon"],[1,"searchcraft-dash-icon"]]],["p-d08d0b15",[[0,"searchcraft-facet-list",{fieldName:[1,"field-name"],baseFacetRoot:[32],facetRoot:[32],selectedPaths:[32],lastQuery:[32],lastTimeTaken:[32],hasNewSearchTerm:[32],unsubscribe:[32]}],[0,"searchcraft-slider",{max:[2],min:[2],granularity:[2],dataType:[1,"data-type"],endValue:[32],startValue:[32],lastFocusedHandle:[32]}],[0,"searchcraft-toggle-button",{label:[1],subLabel:[1,"sub-label"],isActive:[32],unsubscribe:[32],lastQuery:[32]}]]],["p-1720b612",[[0,"searchcraft-input",{customStyles:[1,"custom-styles"],error:[4],inputCaptionClassName:[1,"input-caption-class-name"],inputCaptionValue:[1,"input-caption-value"],inputClassName:[1,"input-class-name"],isRequesting:[4,"is-requesting"],placeholderValue:[1,"placeholder-value"],query:[1],flex:[4],inputValue:[32]}],[0,"searchcraft-input-label",{inputLabelClassName:[1,"input-label-class-name"],label:[1]}],[0,"searchcraft-error-message",{errorMessage:[1,"error-message"]}]]]],e)}));
|
|
2
2
|
//# sourceMappingURL=searchcraft-javascript-sdk.esm.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"package-38f7e2c7.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"p-4c89f065.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"package-e62ac63a.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
/package/dist/searchcraft-javascript-sdk/{p-92d080a7.entry.js.map → p-1720b612.entry.js.map}
RENAMED
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-2816782c.entry.js.map → p-491ae071.entry.js.map}
RENAMED
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-15e0ce05.entry.js.map → p-676e2eef.entry.js.map}
RENAMED
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-9f29b018.entry.js.map → p-83a074b6.entry.js.map}
RENAMED
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-cc614ce6.entry.js.map → p-a56af0b0.entry.js.map}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-a148febe.entry.js.map → p-d08d0b15.entry.js.map}
RENAMED
|
File without changes
|
/package/dist/searchcraft-javascript-sdk/{p-e108dd2e.entry.js.map → p-fb239507.entry.js.map}
RENAMED
|
File without changes
|