react-addsearch-ui 0.2.2 → 0.2.4
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/dist/index.es.js +1 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -451,5 +451,5 @@ Expecting `+oe.join(", ")+", got '"+(this.terminals_[P]||P)+"'":"Parse error on
|
|
|
451
451
|
return undefined
|
|
452
452
|
}
|
|
453
453
|
`.trim()},blockValue:function(g){var h=this.aliasable("container.hooks.blockHelperMissing"),u=[this.contextName(0)];this.setupHelperArgs(g,0,u);var _=this.popStack();u.splice(1,0,_),this.push(this.source.functionCall(h,"call",u))},ambiguousBlockValue:function(){var g=this.aliasable("container.hooks.blockHelperMissing"),h=[this.contextName(0)];this.setupHelperArgs("",0,h,!0),this.flushInline();var u=this.topStack();h.splice(1,0,u),this.pushSource(["if (!",this.lastHelper,") { ",u," = ",this.source.functionCall(g,"call",h),"}"])},appendContent:function(g){this.pendingContent?g=this.pendingContent+g:this.pendingLocation=this.source.currentLocation,this.pendingContent=g},append:function(){if(this.isInline())this.replaceStack(function(h){return[" != null ? ",h,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var g=this.popStack();this.pushSource(["if (",g," != null) { ",this.appendToBuffer(g,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(g){this.lastContext=g},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(g,h,u,_){var S=0;_||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(g[S++])),this.resolvePath("context",g,S,h,u)},lookupBlockParam:function(g,h){this.useBlockParams=!0,this.push(["blockParams[",g[0],"][",g[1],"]"]),this.resolvePath("context",h,1)},lookupData:function(g,h,u){g?this.pushStackLiteral("container.data(data, "+g+")"):this.pushStackLiteral("data"),this.resolvePath("data",h,0,!0,u)},resolvePath:function(g,h,u,_,S){var I=this;if(this.options.strict||this.options.assumeObjects)this.push(d(this.options.strict&&S,this,h,g));else for(var T=h.length;u<T;u++)this.replaceStack(function(P){var N=I.nameLookup(P,h[u],g);return _?[" && ",N]:[" != null ? ",N," : ",P]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(g,h){this.pushContext(),this.pushString(h),h!=="SubExpression"&&(typeof g=="string"?this.pushString(g):this.pushStackLiteral(g))},emptyHash:function(g){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(g?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var g=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(g.ids)),this.stringParams&&(this.push(this.objectLiteral(g.contexts)),this.push(this.objectLiteral(g.types))),this.push(this.objectLiteral(g.values))},pushString:function(g){this.pushStackLiteral(this.quotedString(g))},pushLiteral:function(g){this.pushStackLiteral(g)},pushProgram:function(g){g!=null?this.pushStackLiteral(this.programExpression(g)):this.pushStackLiteral(null)},registerDecorator:function(g,h){var u=this.nameLookup("decorators",h,"decorator"),_=this.setupHelperArgs(h,g);this.decorators.push(["fn = ",this.decorators.functionCall(u,"",["fn","props","container",_])," || fn;"])},invokeHelper:function(g,h,u){var _=this.popStack(),S=this.setupHelper(g,h),I=[];u&&I.push(S.name),I.push(_),this.options.strict||I.push(this.aliasable("container.hooks.helperMissing"));var T=["(",this.itemsSeparatedBy(I,"||"),")"],P=this.source.functionCall(T,"call",S.callParams);this.push(P)},itemsSeparatedBy:function(g,h){var u=[];u.push(g[0]);for(var _=1;_<g.length;_++)u.push(h,g[_]);return u},invokeKnownHelper:function(g,h){var u=this.setupHelper(g,h);this.push(this.source.functionCall(u.name,"call",u.callParams))},invokeAmbiguous:function(g,h){this.useRegister("helper");var u=this.popStack();this.emptyHash();var _=this.setupHelper(0,g,h),S=["(","(helper = ",this.lastHelper=this.nameLookup("helpers",g,"helper")," || ",u,")"];this.options.strict||(S[0]="(helper = ",S.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",S,_.paramsInit?["),(",_.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",_.callParams)," : helper))"])},invokePartial:function(g,h,u){var _=[],S=this.setupParams(h,1,_);g&&(h=this.popStack(),delete S.name),u&&(S.indent=JSON.stringify(u)),S.helpers="helpers",S.partials="partials",S.decorators="container.decorators",g?_.unshift(h):_.unshift(this.nameLookup("partials",h,"partial")),this.options.compat&&(S.depths="depths"),S=this.objectLiteral(S),_.push(S),this.push(this.source.functionCall("container.invokePartial","",_))},assignToHash:function(g){var h=this.popStack(),u=void 0,_=void 0,S=void 0;this.trackIds&&(S=this.popStack()),this.stringParams&&(_=this.popStack(),u=this.popStack());var I=this.hash;u&&(I.contexts[g]=u),_&&(I.types[g]=_),S&&(I.ids[g]=S),I.values[g]=h},pushId:function(g,h,u){g==="BlockParam"?this.pushStackLiteral("blockParams["+h[0]+"].path["+h[1]+"]"+(u?" + "+JSON.stringify("."+u):"")):g==="PathExpression"?this.pushString(h):g==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:e,compileChildren:function(g,h){for(var u=g.children,_=void 0,S=void 0,I=0,T=u.length;I<T;I++){_=u[I],S=new this.compiler;var P=this.matchExistingProgram(_);if(P==null){this.context.programs.push("");var N=this.context.programs.length;_.index=N,_.name="program"+N,this.context.programs[N]=S.compile(_,h,this.context,!this.precompile),this.context.decorators[N]=S.decorators,this.context.environments[N]=_,this.useDepths=this.useDepths||S.useDepths,this.useBlockParams=this.useBlockParams||S.useBlockParams,_.useDepths=this.useDepths,_.useBlockParams=this.useBlockParams}else _.index=P.index,_.name="program"+P.index,this.useDepths=this.useDepths||P.useDepths,this.useBlockParams=this.useBlockParams||P.useBlockParams}},matchExistingProgram:function(g){for(var h=0,u=this.context.environments.length;h<u;h++){var _=this.context.environments[h];if(_&&_.equals(g))return _}},programExpression:function(g){var h=this.environment.children[g],u=[h.index,"data",h.blockParams];return(this.useBlockParams||this.useDepths)&&u.push("blockParams"),this.useDepths&&u.push("depths"),"container.program("+u.join(", ")+")"},useRegister:function(g){this.registers[g]||(this.registers[g]=!0,this.registers.list.push(g))},push:function(g){return g instanceof r||(g=this.source.wrap(g)),this.inlineStack.push(g),g},pushStackLiteral:function(g){this.push(new r(g))},pushSource:function(g){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),g&&this.source.push(g)},replaceStack:function(g){var h=["("],u=void 0,_=void 0,S=void 0;if(!this.isInline())throw new s.default("replaceStack on non-inline");var I=this.popStack(!0);if(I instanceof r)h=["(",u=[I.value]],S=!0;else{_=!0;var T=this.incrStack();h=["((",this.push(T)," = ",I,")"],u=this.topStack()}var P=g.call(this,u);S||this.popStack(),_&&this.stackSlot--,this.push(h.concat(P,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var g=this.inlineStack;this.inlineStack=[];for(var h=0,u=g.length;h<u;h++){var _=g[h];if(_ instanceof r)this.compileStack.push(_);else{var S=this.incrStack();this.pushSource([S," = ",_,";"]),this.compileStack.push(S)}}},isInline:function(){return this.inlineStack.length},popStack:function(g){var h=this.isInline(),u=(h?this.inlineStack:this.compileStack).pop();if(!g&&u instanceof r)return u.value;if(!h){if(!this.stackSlot)throw new s.default("Invalid stack pop");this.stackSlot--}return u},topStack:function(){var g=this.isInline()?this.inlineStack:this.compileStack,h=g[g.length-1];return h instanceof r?h.value:h},contextName:function(g){return this.useDepths&&g?"depths["+g+"]":"depth"+g},quotedString:function(g){return this.source.quotedString(g)},objectLiteral:function(g){return this.source.objectLiteral(g)},aliasable:function(g){var h=this.aliases[g];return h?(h.referenceCount++,h):((h=this.aliases[g]=this.source.wrap(g)).aliasable=!0,h.referenceCount=1,h)},setupHelper:function(g,h,u){var _=[];return{params:_,paramsInit:this.setupHelperArgs(h,g,_,u),name:this.nameLookup("helpers",h,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(_)}},setupParams:function(g,h,u){var _={},S=[],I=[],T=[],P=!u,N=void 0;P&&(u=[]),_.name=this.quotedString(g),_.hash=this.popStack(),this.trackIds&&(_.hashIds=this.popStack()),this.stringParams&&(_.hashTypes=this.popStack(),_.hashContexts=this.popStack());var q=this.popStack(),j=this.popStack();(j||q)&&(_.fn=j||"container.noop",_.inverse=q||"container.noop");for(var D=h;D--;)N=this.popStack(),u[D]=N,this.trackIds&&(T[D]=this.popStack()),this.stringParams&&(I[D]=this.popStack(),S[D]=this.popStack());return P&&(_.args=this.source.generateArray(u)),this.trackIds&&(_.ids=this.source.generateArray(T)),this.stringParams&&(_.types=this.source.generateArray(I),_.contexts=this.source.generateArray(S)),this.options.data&&(_.data="data"),this.useBlockParams&&(_.blockParams="blockParams"),_},setupHelperArgs:function(g,h,u,_){var S=this.setupParams(g,h,u);return S.loc=JSON.stringify(this.source.currentLocation),S=this.objectLiteral(S),_?(this.useRegister("options"),u.push("options"),["options=",S]):u?(u.push(S),""):S}},function(){for(var g="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),h=e.RESERVED_WORDS={},u=0,_=g.length;u<_;u++)h[g[u]]=!0}(),e.isValidJavaScriptVariableName=function(g){return!e.RESERVED_WORDS[g]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(g)},n.default=e,c.exports=n.default},function(c,n,y){function r(a,s,v){if(C.isArray(a)){for(var f=[],g=0,h=a.length;g<h;g++)f.push(s.wrap(a[g],v));return f}return typeof a=="boolean"||typeof a=="number"?a+"":a}function e(a){this.srcFile=a,this.source=[]}var d=y(13).default;n.__esModule=!0;var C=y(5),l=void 0;l||(l=function(a,s,v,f){this.src="",f&&this.add(f)},l.prototype={add:function(a){C.isArray(a)&&(a=a.join("")),this.src+=a},prepend:function(a){C.isArray(a)&&(a=a.join("")),this.src=a+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),e.prototype={isEmpty:function(){return!this.source.length},prepend:function(a,s){this.source.unshift(this.wrap(a,s))},push:function(a,s){this.source.push(this.wrap(a,s))},merge:function(){var a=this.empty();return this.each(function(s){a.add([" ",s,`
|
|
454
|
-
`])}),a},each:function(a){for(var s=0,v=this.source.length;s<v;s++)a(this.source[s])},empty:function(){var a=this.currentLocation||{start:{}};return new l(a.start.line,a.start.column,this.srcFile)},wrap:function(a){var s=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return a instanceof l?a:(a=r(a,this,s),new l(s.start.line,s.start.column,this.srcFile,a))},functionCall:function(a,s,v){return v=this.generateList(v),this.wrap([a,s?"."+s+"(":"(",v,")"])},quotedString:function(a){return'"'+(a+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var s=this,v=[];d(a).forEach(function(g){var h=r(a[g],s);h!=="undefined"&&v.push([s.quotedString(g),":",h])});var f=this.generateList(v);return f.prepend("{"),f.add("}"),f},generateList:function(a){for(var s=this.empty(),v=0,f=a.length;v<f;v++)v&&s.add(","),s.add(r(a[v],this));return s},generateArray:function(a){var s=this.generateList(a);return s.prepend("["),s.add("]"),s}},n.default=e,c.exports=n.default}])},3633:function(w,c,n){w.exports=n(261).default}},o={};function E(w){var c=o[w];if(c!==void 0)return c.exports;var n=o[w]={exports:{}};return p[w].call(n.exports,n,n.exports,E),n.exports}return E.n=function(w){var c=w&&w.__esModule?function(){return w.default}:function(){return w};return E.d(c,{a:c}),c},E.d=function(w,c){for(var n in c)E.o(c,n)&&!E.o(w,n)&&Object.defineProperty(w,n,{enumerable:!0,get:c[n]})},E.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),E.o=function(w,c){return Object.prototype.hasOwnProperty.call(w,c)},E(2987)}()})})(ss);var yl=ss.exports;const Ct=qr(yl),vl=({addSearchUi:t,searchFieldMaxWidthInPixels:i,searchFieldHeaderText:p,searchInputPlaceholderText:o,searchButtonText:E,hasSearchInputAutofocus:w,hasSearchAsYouType:c,minLengthToShowSearchAsYouTypeResults:n,hasSearchInputFieldIcon:y,hasAutocomplete:r,hasAiAnswers:e,loadMoreResults:d,sortByOptions:C,filters:l,hasActiveFilters:a})=>{const[s,v]=St.useState(!1),f=St.useRef(null),g=St.useMemo(()=>l.filter(S=>S.type==="checkbox-group"||S.type==="radio-group"||S.type==="tags"),[l]),h=St.useMemo(()=>g.length>0,[g]),u=St.useMemo(()=>l&&l.find(S=>S.type==="tabs"),[]),_=St.useMemo(()=>l&&l.find(S=>S.type==="select-list"),[]);return St.useEffect(()=>{t.searchField({containerId:"search-field-container",placeholder:o,button:E,icon:y,autofocus:w,searchAsYouType:c,minLengthToShowResults:n}),e&&t.aiAnswersResult({containerId:"conversational-search-result-container",mainHeadlineText:"AI-generated answer",answerMaxHeight:150,sourcesHeadlineText:"Based on the following sources:",hasHideToggle:!1}),t.searchResults({containerId:"search-results-container"}),r&&t.autocomplete({containerId:"autocomplete-container",sources:[{type:Ct.AUTOCOMPLETE_TYPE.SUGGESTIONS}]}),d==="button"?t.loadMore({containerId:"loadmore-container",type:Ct.LOAD_MORE_TYPE.BUTTON}):d==="pagination"?t.pagination({containerId:"pagination-container"}):d==="scroll"&&t.loadMore({containerId:f.current,type:Ct.LOAD_MORE_TYPE.INFINITE_SCROLL,infiniteScrollElement:f.current}),C!=null&&C.length&&(C==null?void 0:C.length)>0&&t.sortBy({containerId:"sortby-container",options:C}),l&&l.length>0&&(l.forEach((S,I)=>{S.type==="checkbox-group"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.CHECKBOX_GROUP,options:S.options}):S.type==="radio-group"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.RADIO_GROUP,options:S.options}):S.type==="tags"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.TAGS,options:S.options}):S.type==="tabs"?t.filters({containerId:"tab-filters-container",type:Ct.FILTER_TYPE.TABS,options:S.options}):S.type==="select-list"&&(t.filters({containerId:"select-list-filters-container",type:Ct.FILTER_TYPE.SELECT_LIST,options:S.options}),t.filters({containerId:"select-list-filters-container-mobile",type:Ct.FILTER_TYPE.SELECT_LIST,options:S.options}))}),a&&t.activeFilters({containerId:"active-filters-container"})),t.start()},[s,f.current,l,C,a,d,a,r,c,w,y,E,o,p]),_e.jsxs("div",{id:"addsearch-ui-container",className:"flex flex-col p-4 w-full h-full",children:[_e.jsxs("div",{className:"flex items-center gap-4",children:[p&&_e.jsx("h2",{className:"text-xl font-semibold",children:p}),_e.jsx("div",{style:{maxWidth:`${i}px`},id:"search-field-container"})]}),_e.jsx("div",{id:"autocomplete-container"}),_e.jsx("div",{id:"conversational-search-result-container"}),u&&_e.jsx("div",{className:"mt-10 flex justify-center",children:_e.jsx("div",{id:"tab-filters-container"})}),h&&_e.jsxs("div",{className:`flex flex-col md:hidden mt-10 border border-gray-300 rounded-md ${s?"bg-gray-50":""}`,children:[_e.jsxs("button",{onClick:()=>v(!s),className:"flex items-center justify-between w-full text-sm md:text-base p-2",children:[_e.jsxs("div",{className:"flex items-center gap-2",children:[_e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_e.jsx("path",{d:"M20 5.6C20 5.04 20 4.76 19.89 4.546C19.7944 4.358 19.6418 4.20504 19.454 4.109C19.24 4 18.96 4 18.4 4H5.6C5.04 4 4.76 4 4.546 4.109C4.35785 4.20487 4.20487 4.35785 4.109 4.546C4 4.76 4 5.04 4 5.6V6.337C4 6.582 4 6.704 4.028 6.819C4.05249 6.92138 4.09299 7.01925 4.148 7.109C4.209 7.209 4.296 7.296 4.468 7.469L9.531 12.531C9.704 12.704 9.791 12.791 9.852 12.891C9.90733 12.9817 9.94733 13.0783 9.972 13.181C10 13.295 10 13.416 10 13.655V18.411C10 19.268 10 19.697 10.18 19.955C10.2581 20.0666 10.3582 20.161 10.4741 20.2326C10.59 20.3041 10.7192 20.3512 10.854 20.371C11.165 20.417 11.549 20.226 12.315 19.842L13.115 19.442C13.437 19.282 13.597 19.202 13.714 19.082C13.8178 18.976 13.8967 18.8483 13.945 18.708C14 18.55 14 18.37 14 18.011V13.663C14 13.418 14 13.296 14.028 13.181C14.0525 13.0786 14.093 12.9807 14.148 12.891C14.208 12.791 14.295 12.705 14.465 12.535L14.469 12.531L19.532 7.469C19.704 7.296 19.79 7.209 19.852 7.109C19.9073 7.01833 19.9473 6.92167 19.972 6.819C20 6.706 20 6.584 20 6.345V5.6Z",stroke:"#8D8D8D",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Filter by"]}),_e.jsx("svg",{className:`${s?"transform rotate-180":""}`,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.64604 4.64601C1.69249 4.59945 1.74766 4.5625 1.80841 4.5373C1.86915 4.51209 1.93427 4.49911 2.00004 4.49911C2.06581 4.49911 2.13093 4.51209 2.19167 4.5373C2.25242 4.5625 2.30759 4.59945 2.35404 4.64601L8.00004 10.293L13.646 4.64601C13.6925 4.59952 13.7477 4.56264 13.8085 4.53749C13.8692 4.51233 13.9343 4.49938 14 4.49938C14.0658 4.49938 14.1309 4.51233 14.1916 4.53749C14.2524 4.56264 14.3076 4.59952 14.354 4.64601C14.4005 4.6925 14.4374 4.74769 14.4626 4.80842C14.4877 4.86916 14.5007 4.93426 14.5007 5.00001C14.5007 5.06575 14.4877 5.13085 14.4626 5.19159C14.4374 5.25233 14.4005 5.30752 14.354 5.35401L8.35404 11.354C8.30759 11.4006 8.25242 11.4375 8.19167 11.4627C8.13093 11.4879 8.06581 11.5009 8.00004 11.5009C7.93427 11.5009 7.86915 11.4879 7.80841 11.4627C7.74766 11.4375 7.69248 11.4006 7.64604 11.354L1.64604 5.35401C1.59948 5.30756 1.56253 5.25239 1.53733 5.19164C1.51212 5.1309 1.49915 5.06578 1.49915 5.00001C1.49915 4.93424 1.51212 4.86912 1.53733 4.80837C1.56253 4.74763 1.59948 4.69245 1.64604 4.64601Z",fill:"#3A3A3A"})})]}),s&&_e.jsx("div",{className:"p-4 flex flex-col gap-6",children:g.map((S,I)=>_e.jsxs("div",{children:[S.labelText&&_e.jsx("p",{className:"mb-3 pb-1 border-b border-gray-200 text-sm font-semibold",children:S.labelText}),_e.jsx("div",{id:`filters-container-${I}`})]},S.type))})]}),_&&_e.jsx("div",{className:"mt-10 w-full flex justify-end",children:_e.jsx("div",{className:"md:hidden",id:"select-list-filters-container-mobile"})}),_e.jsxs("div",{className:"mt-2 md:mt-8 flex flex-col items-end md:flex-row md:items-center md:justify-between gap-2",children:[a&&_e.jsx("div",{children:_e.jsx("div",{id:"active-filters-container"})}),(_||(C==null?void 0:C.length)&&C.length>0)&&_e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[_&&_e.jsx("div",{className:"hidden md:flex",id:"select-list-filters-container"}),(C==null?void 0:C.length)&&C.length>0&&_e.jsx("div",{id:"sortby-container"})]})]}),_e.jsx("div",{className:"mt-4",children:h?_e.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-1-4 md:gap-6",children:[_e.jsx("div",{className:"mt-4 hidden md:flex flex-col gap-6",children:g.map((S,I)=>_e.jsxs("div",{children:[S.labelText&&_e.jsx("p",{className:"mb-3 pb-1 border-b border-gray-200 text-sm font-semibold",children:S.labelText}),_e.jsx("div",{id:`filters-container-${I}`})]},S.type))}),_e.jsxs("div",{className:"w-full h-full",children:[_e.jsx("div",{className:"h-[500px]",children:_e.jsx("div",{ref:f,id:"search-results-container"})}),_e.jsx("div",{className:"flex justify-center",children:_e.jsx("div",{id:"loadmore-container"})}),_e.jsx("div",{id:"pagination-container"})]})]}):_e.jsx("div",{className:"flex",children:_e.jsxs("div",{className:"w-full h-full",children:[_e.jsx("div",{className:"h-[500px]",children:_e.jsx("div",{ref:f,id:"search-results-container"})}),_e.jsx("div",{className:"flex justify-center",children:_e.jsx("div",{id:"loadmore-container"})}),_e.jsx("div",{id:"pagination-container"})]})})})]})},xl=({publicSiteKey:t,primaryColor:i,customFont:p,searchFieldMaxWidthInPixels:o=600,searchFieldHeaderText:E,searchButtonText:w,searchInputPlaceholderText:c="Keyword...",hasSearchInputAutofocus:n=!0,hasSearchAsYouType:y=!1,minLengthToShowSearchAsYouTypeResults:r=3,hasSearchInputFieldIcon:e=!0,hasAutocomplete:d=!0,hasAiAnswers:C=!1,hasAiAnswersHideToggle:l,loadMoreResults:a="pagination",sortByOptions:s=[],filters:v=[],hasActiveFilters:f=!0})=>{const[g,h]=St.useState(null);return St.useEffect(()=>{const u=new gl(t),_=new Ct(u,{hasAiAnswers:!0});h(_)},[]),St.useEffect(()=>{i&&document.documentElement.style.setProperty("--addsearch-primary-color",i)},[i]),St.useEffect(()=>{p&&document.documentElement.style.setProperty("--addsearch-font-family",`'${p}', sans-serif`)},[p]),g&&_e.jsx(vl,{addSearchUi:g,searchFieldMaxWidthInPixels:o,searchFieldHeaderText:E,searchButtonText:w,searchInputPlaceholderText:c,hasSearchInputAutofocus:n,hasSearchAsYouType:y,minLengthToShowSearchAsYouTypeResults:r,hasSearchInputFieldIcon:e,hasAutocomplete:d,hasAiAnswers:C,hasAiAnswersHideToggle:l,loadMoreResults:a,sortByOptions:s,filters:v,hasActiveFilters:f})};ut.AddSearchUiIntegration=xl,Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"})});
|
|
454
|
+
`])}),a},each:function(a){for(var s=0,v=this.source.length;s<v;s++)a(this.source[s])},empty:function(){var a=this.currentLocation||{start:{}};return new l(a.start.line,a.start.column,this.srcFile)},wrap:function(a){var s=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return a instanceof l?a:(a=r(a,this,s),new l(s.start.line,s.start.column,this.srcFile,a))},functionCall:function(a,s,v){return v=this.generateList(v),this.wrap([a,s?"."+s+"(":"(",v,")"])},quotedString:function(a){return'"'+(a+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var s=this,v=[];d(a).forEach(function(g){var h=r(a[g],s);h!=="undefined"&&v.push([s.quotedString(g),":",h])});var f=this.generateList(v);return f.prepend("{"),f.add("}"),f},generateList:function(a){for(var s=this.empty(),v=0,f=a.length;v<f;v++)v&&s.add(","),s.add(r(a[v],this));return s},generateArray:function(a){var s=this.generateList(a);return s.prepend("["),s.add("]"),s}},n.default=e,c.exports=n.default}])},3633:function(w,c,n){w.exports=n(261).default}},o={};function E(w){var c=o[w];if(c!==void 0)return c.exports;var n=o[w]={exports:{}};return p[w].call(n.exports,n,n.exports,E),n.exports}return E.n=function(w){var c=w&&w.__esModule?function(){return w.default}:function(){return w};return E.d(c,{a:c}),c},E.d=function(w,c){for(var n in c)E.o(c,n)&&!E.o(w,n)&&Object.defineProperty(w,n,{enumerable:!0,get:c[n]})},E.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),E.o=function(w,c){return Object.prototype.hasOwnProperty.call(w,c)},E(2987)}()})})(ss);var yl=ss.exports;const Ct=qr(yl),vl=({addSearchUi:t,searchFieldMaxWidthInPixels:i,searchFieldHeaderText:p,searchInputPlaceholderText:o,searchButtonText:E,hasSearchInputAutofocus:w,hasSearchAsYouType:c,minLengthToShowSearchAsYouTypeResults:n,hasSearchInputFieldIcon:y,hasAutocomplete:r,hasAiAnswers:e,loadMoreResults:d,sortByOptions:C,filters:l,hasActiveFilters:a})=>{const[s,v]=St.useState(!1),f=St.useRef(null),g=St.useMemo(()=>l.filter(S=>S.type==="checkbox-group"||S.type==="radio-group"||S.type==="tags"),[l]),h=St.useMemo(()=>g.length>0,[g]),u=St.useMemo(()=>l&&l.find(S=>S.type==="tabs"),[]),_=St.useMemo(()=>l&&l.find(S=>S.type==="select-list"),[]);return St.useEffect(()=>{t.searchField({containerId:"search-field-container",placeholder:o,button:E,icon:y,autofocus:w,searchAsYouType:c,minLengthToShowResults:n}),e&&t.aiAnswersResult({containerId:"conversational-search-result-container",mainHeadlineText:"AI-generated answer",answerMaxHeight:150,sourcesHeadlineText:"Based on the following sources:"}),t.searchResults({containerId:"search-results-container"}),r&&t.autocomplete({containerId:"autocomplete-container",sources:[{type:Ct.AUTOCOMPLETE_TYPE.SUGGESTIONS}]}),d==="button"?t.loadMore({containerId:"loadmore-container",type:Ct.LOAD_MORE_TYPE.BUTTON}):d==="pagination"?t.pagination({containerId:"pagination-container"}):d==="scroll"&&t.loadMore({containerId:f.current,type:Ct.LOAD_MORE_TYPE.INFINITE_SCROLL,infiniteScrollElement:f.current}),C!=null&&C.length&&(C==null?void 0:C.length)>0&&t.sortBy({containerId:"sortby-container",options:C}),l&&l.length>0&&(l.forEach((S,I)=>{S.type==="checkbox-group"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.CHECKBOX_GROUP,options:S.options}):S.type==="radio-group"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.RADIO_GROUP,options:S.options}):S.type==="tags"?t.filters({containerId:`filters-container-${I}`,type:Ct.FILTER_TYPE.TAGS,options:S.options}):S.type==="tabs"?t.filters({containerId:"tab-filters-container",type:Ct.FILTER_TYPE.TABS,options:S.options}):S.type==="select-list"&&(t.filters({containerId:"select-list-filters-container",type:Ct.FILTER_TYPE.SELECT_LIST,options:S.options}),t.filters({containerId:"select-list-filters-container-mobile",type:Ct.FILTER_TYPE.SELECT_LIST,options:S.options}))}),a&&t.activeFilters({containerId:"active-filters-container"})),t.start()},[s,f.current,l,C,a,d,a,r,c,w,y,E,o,p]),_e.jsxs("div",{id:"addsearch-ui-container",className:"flex flex-col p-4 w-full h-full",children:[_e.jsxs("div",{className:"flex items-center gap-4",children:[p&&_e.jsx("h2",{className:"text-xl font-semibold",children:p}),_e.jsx("div",{style:{maxWidth:`${i}px`},id:"search-field-container"})]}),_e.jsx("div",{id:"autocomplete-container"}),_e.jsx("div",{id:"conversational-search-result-container"}),u&&_e.jsx("div",{className:"mt-10 flex justify-center",children:_e.jsx("div",{id:"tab-filters-container"})}),h&&_e.jsxs("div",{className:`flex flex-col md:hidden mt-10 border border-gray-300 rounded-md ${s?"bg-gray-50":""}`,children:[_e.jsxs("button",{onClick:()=>v(!s),className:"flex items-center justify-between w-full text-sm md:text-base p-2",children:[_e.jsxs("div",{className:"flex items-center gap-2",children:[_e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_e.jsx("path",{d:"M20 5.6C20 5.04 20 4.76 19.89 4.546C19.7944 4.358 19.6418 4.20504 19.454 4.109C19.24 4 18.96 4 18.4 4H5.6C5.04 4 4.76 4 4.546 4.109C4.35785 4.20487 4.20487 4.35785 4.109 4.546C4 4.76 4 5.04 4 5.6V6.337C4 6.582 4 6.704 4.028 6.819C4.05249 6.92138 4.09299 7.01925 4.148 7.109C4.209 7.209 4.296 7.296 4.468 7.469L9.531 12.531C9.704 12.704 9.791 12.791 9.852 12.891C9.90733 12.9817 9.94733 13.0783 9.972 13.181C10 13.295 10 13.416 10 13.655V18.411C10 19.268 10 19.697 10.18 19.955C10.2581 20.0666 10.3582 20.161 10.4741 20.2326C10.59 20.3041 10.7192 20.3512 10.854 20.371C11.165 20.417 11.549 20.226 12.315 19.842L13.115 19.442C13.437 19.282 13.597 19.202 13.714 19.082C13.8178 18.976 13.8967 18.8483 13.945 18.708C14 18.55 14 18.37 14 18.011V13.663C14 13.418 14 13.296 14.028 13.181C14.0525 13.0786 14.093 12.9807 14.148 12.891C14.208 12.791 14.295 12.705 14.465 12.535L14.469 12.531L19.532 7.469C19.704 7.296 19.79 7.209 19.852 7.109C19.9073 7.01833 19.9473 6.92167 19.972 6.819C20 6.706 20 6.584 20 6.345V5.6Z",stroke:"#8D8D8D",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Filter by"]}),_e.jsx("svg",{className:`${s?"transform rotate-180":""}`,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:_e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.64604 4.64601C1.69249 4.59945 1.74766 4.5625 1.80841 4.5373C1.86915 4.51209 1.93427 4.49911 2.00004 4.49911C2.06581 4.49911 2.13093 4.51209 2.19167 4.5373C2.25242 4.5625 2.30759 4.59945 2.35404 4.64601L8.00004 10.293L13.646 4.64601C13.6925 4.59952 13.7477 4.56264 13.8085 4.53749C13.8692 4.51233 13.9343 4.49938 14 4.49938C14.0658 4.49938 14.1309 4.51233 14.1916 4.53749C14.2524 4.56264 14.3076 4.59952 14.354 4.64601C14.4005 4.6925 14.4374 4.74769 14.4626 4.80842C14.4877 4.86916 14.5007 4.93426 14.5007 5.00001C14.5007 5.06575 14.4877 5.13085 14.4626 5.19159C14.4374 5.25233 14.4005 5.30752 14.354 5.35401L8.35404 11.354C8.30759 11.4006 8.25242 11.4375 8.19167 11.4627C8.13093 11.4879 8.06581 11.5009 8.00004 11.5009C7.93427 11.5009 7.86915 11.4879 7.80841 11.4627C7.74766 11.4375 7.69248 11.4006 7.64604 11.354L1.64604 5.35401C1.59948 5.30756 1.56253 5.25239 1.53733 5.19164C1.51212 5.1309 1.49915 5.06578 1.49915 5.00001C1.49915 4.93424 1.51212 4.86912 1.53733 4.80837C1.56253 4.74763 1.59948 4.69245 1.64604 4.64601Z",fill:"#3A3A3A"})})]}),s&&_e.jsx("div",{className:"p-4 flex flex-col gap-6",children:g.map((S,I)=>_e.jsxs("div",{children:[S.labelText&&_e.jsx("p",{className:"mb-3 pb-1 border-b border-gray-200 text-sm font-semibold",children:S.labelText}),_e.jsx("div",{id:`filters-container-${I}`})]},S.type))})]}),_&&_e.jsx("div",{className:"mt-10 w-full flex justify-end",children:_e.jsx("div",{className:"md:hidden",id:"select-list-filters-container-mobile"})}),_e.jsxs("div",{className:"mt-2 md:mt-8 flex flex-col items-end md:flex-row md:items-center md:justify-between gap-2",children:[a&&_e.jsx("div",{children:_e.jsx("div",{id:"active-filters-container"})}),(_||(C==null?void 0:C.length)&&C.length>0)&&_e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[_&&_e.jsx("div",{className:"hidden md:flex",id:"select-list-filters-container"}),(C==null?void 0:C.length)&&C.length>0&&_e.jsx("div",{id:"sortby-container"})]})]}),_e.jsx("div",{className:"mt-4",children:h?_e.jsxs("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-1-4 md:gap-6",children:[_e.jsx("div",{className:"mt-4 hidden md:flex flex-col gap-6",children:g.map((S,I)=>_e.jsxs("div",{children:[S.labelText&&_e.jsx("p",{className:"mb-3 pb-1 border-b border-gray-200 text-sm font-semibold",children:S.labelText}),_e.jsx("div",{id:`filters-container-${I}`})]},S.type))}),_e.jsxs("div",{className:"w-full h-full",children:[_e.jsx("div",{className:"h-[500px]",children:_e.jsx("div",{ref:f,id:"search-results-container"})}),_e.jsx("div",{className:"flex justify-center",children:_e.jsx("div",{id:"loadmore-container"})}),_e.jsx("div",{id:"pagination-container"})]})]}):_e.jsx("div",{className:"flex",children:_e.jsxs("div",{className:"w-full h-full",children:[_e.jsx("div",{className:"h-[500px]",children:_e.jsx("div",{ref:f,id:"search-results-container"})}),_e.jsx("div",{className:"flex justify-center",children:_e.jsx("div",{id:"loadmore-container"})}),_e.jsx("div",{id:"pagination-container"})]})})})]})},xl=({publicSiteKey:t,primaryColor:i,customFont:p,searchFieldMaxWidthInPixels:o=600,searchFieldHeaderText:E,searchButtonText:w,searchInputPlaceholderText:c="Keyword...",hasSearchInputAutofocus:n=!0,hasSearchAsYouType:y=!1,minLengthToShowSearchAsYouTypeResults:r=3,hasSearchInputFieldIcon:e=!0,hasAutocomplete:d=!0,hasAiAnswers:C=!1,hasAiAnswersHideToggle:l,loadMoreResults:a="pagination",sortByOptions:s=[],filters:v=[],hasActiveFilters:f=!0})=>{const[g,h]=St.useState(null);return St.useEffect(()=>{const u=new gl(t),_=new Ct(u,{hasAiAnswers:!0});h(_)},[]),St.useEffect(()=>{i&&document.documentElement.style.setProperty("--addsearch-primary-color",i)},[i]),St.useEffect(()=>{p&&document.documentElement.style.setProperty("--addsearch-font-family",`'${p}', sans-serif`)},[p]),g&&_e.jsx(vl,{addSearchUi:g,searchFieldMaxWidthInPixels:o,searchFieldHeaderText:E,searchButtonText:w,searchInputPlaceholderText:c,hasSearchInputAutofocus:n,hasSearchAsYouType:y,minLengthToShowSearchAsYouTypeResults:r,hasSearchInputFieldIcon:e,hasAutocomplete:d,hasAiAnswers:C,hasAiAnswersHideToggle:l,loadMoreResults:a,sortByOptions:s,filters:v,hasActiveFilters:f})};ut.AddSearchUiIntegration=xl,Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"})});
|
|
455
455
|
//# sourceMappingURL=index.umd.js.map
|