UNPKG

vue-instantsearch-ssr

Version:

👀 Lightning-fast Algolia search for Vue apps

3 lines (2 loc) • 2.94 kB
import{createSuitMixin as t}from"../mixins/suit.js";import{createWidgetMixin as e}from"../mixins/widget.js";import{connectVoiceSearch as s}from"instantsearch.js/es/connectors/index.js";export default{render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return t.state?s("div",{class:t.suit()},[t._t("default",[s("button",{class:t.suit("button"),attrs:{type:"button",title:t.state.isBrowserSupported?t.buttonTitle:t.disabledButtonTitle,disabled:!t.state.isBrowserSupported},on:{click:t.handleClick}},[t._t("buttonText",[t.errorNotAllowed?s("svg",t._b({},"svg",t.buttonSvgAttrs,!1),[s("line",{attrs:{x1:"1",y1:"1",x2:"23",y2:"23"}}),t._v(" "),s("path",{attrs:{d:"M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"}}),t._v(" "),s("path",{attrs:{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"}}),t._v(" "),s("line",{attrs:{x1:"12",y1:"19",x2:"12",y2:"23"}}),t._v(" "),s("line",{attrs:{x1:"8",y1:"23",x2:"16",y2:"23"}})]):s("svg",t._b({},"svg",t.buttonSvgAttrs,!1),[s("path",{attrs:{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z",fill:t.state.isListening?"currentColor":"none"}}),t._v(" "),s("path",{attrs:{d:"M19 10v2a7 7 0 0 1-14 0v-2"}}),t._v(" "),s("line",{attrs:{x1:"12",y1:"19",x2:"12",y2:"23"}}),t._v(" "),s("line",{attrs:{x1:"8",y1:"23",x2:"16",y2:"23"}})])],null,t.innerSlotProps)],2),t._v(" "),s("div",{class:t.suit("status")},[t._t("status",[s("p",[t._v(t._s(t.state.voiceListeningState.transcript))])],null,t.innerSlotProps)],2)],null,t.rootSlotProps)],2):t._e()},staticRenderFns:[],name:"AisVoiceSearch",mixins:[e({connector:s}),t({name:"VoiceSearch"})],props:{searchAsYouSpeak:{type:Boolean,required:!1,default:void 0},buttonTitle:{type:String,required:!1,default:"Search by voice"},disabledButtonTitle:{type:String,required:!1,default:"Search by voice (not supported on this browser)"}},data:function(){return{buttonSvgAttrs:{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}}},computed:{widgetParams:function(){return{searchAsYouSpeak:this.searchAsYouSpeak}},errorNotAllowed:function(){return"error"===this.state.voiceListeningState.status&&"not-allowed"===this.state.voiceListeningState.errorCode},rootSlotProps:function(){return{isBrowserSupported:this.state.isBrowserSupported,isListening:this.state.isListening,toggleListening:this.state.toggleListening,voiceListeningState:this.state.voiceListeningState}},innerSlotProps:function(){return{status:this.state.voiceListeningState.status,errorCode:this.state.voiceListeningState.errorCode,isListening:this.state.isListening,transcript:this.state.voiceListeningState.transcript,isSpeechFinal:this.state.voiceListeningState.isSpeechFinal,isBrowserSupported:this.state.isBrowserSupported}}},methods:{handleClick:function(t){t.currentTarget.blur(),this.state.toggleListening()}}}; //# sourceMappingURL=VoiceSearch.vue.js.map