{"version":3,"sources":["SearchButton.min__7d400a8f34d33214ce02.js","./src/ui/SearchButton/SearchButton.ts"],"names":["webpackJsonpCoveo__temporary","194","module","exports","__webpack_require__","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","element","options","bindings","SearchButton","ID","AccessibleButton","withElement","withOwner","bind","withLabel","l","withSelectAction","handleClick","build","Utils","trim","$$","text","svgMagnifierContainer","className","SVGIcons","icons","search","el","SVGDom","addClassToSVGInContainer","svgLoadingAnimationContainer","loading","appendChild","_this","click","logger","debug","updateQueryStateModelWithSearchboxQuery","usageAnalytics","logSearchEvent","analyticsActionCauseList","searchboxSubmit","queryController","executeQuery","origin","logInActionsHistory","searchbox","queryStateModel","set","QueryStateModel","attributesEnum","q","getText","doExport","exportGlobally","Component","Initialization","registerAutoCreateComponent"],"mappings":"AAAAA,8BAA8B,KAExBC,IACA,SAAUC,EAAQC,EAASC,GAEjC,YAEA,IAAIC,GAAaC,MAAQA,KAAKD,WAAc,WACxC,GAAIE,GAAgBC,OAAOC,iBACpBC,uBAA2BC,QAAS,SAAUC,EAAGC,GAAKD,EAAEF,UAAYG,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIC,KAAKD,GAAOA,EAAEE,eAAeD,KAAIF,EAAEE,GAAKD,EAAEC,IACzE,OAAO,UAAUF,EAAGC,GAEhB,QAASG,KAAOV,KAAKW,YAAcL,EADnCL,EAAcK,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaL,OAAOW,OAAON,IAAMG,EAAGE,UAAYL,EAAEK,UAAW,GAAIF,OAGvFR,QAAOY,eAAejB,EAAS,cAAgBkB,OAAO,GCjBtD,YACA,OACA,QACA,OACA,QACA,QACA,OACA,QACA,OAEA,OACA,QAgBA,cAkBE,WAAmBC,EAA6BC,EAAgCC,GAAhF,MACE,YAAMF,EAASG,EAAaC,GAAIF,IAAS,IAUzC,IAXiB,EAAAF,UAA6B,EAAAC,WAG9C,GAAI,GAAAI,kBACDC,YAAYN,GACZO,UAAU,EAAKC,MACfC,UAAU,EAAAC,EAAE,WACZC,iBAAiB,WAAM,SAAKC,gBAC5BC,QAGwC,IAAvC,EAAAC,MAAMC,KAAK,EAAAC,GAAG,EAAKhB,SAASiB,QAAe,CAC7C,GAAMC,GAAwB,EAAAF,GAAG,QAAUG,UAAW,uBAAyB,EAAAC,SAASC,MAAMC,QAAQC,EACtG,GAAAC,OAAOC,yBAAyBP,EAAuB,0BACvD,IAAMQ,GAA+B,EAAAV,GAAG,QAAUG,UAAW,+BAAiC,EAAAC,SAASC,MAAMM,SAASJ,EACtH,GAAAC,OAAOC,yBAAyBC,EAA8B,mCAC9D1B,EAAQ4B,YAAYV,GACpBlB,EAAQ4B,YAAYF,GDClB,MAAOG,GCsBf,MA1DkC,QA2CzB,YAAAC,MAAP,WACE9C,KAAK4B,eAGC,YAAAA,YAAR,WACE5B,KAAK+C,OAAOC,MAAM,2CAClBhD,KAAKiD,0CACLjD,KAAKkD,eAAeC,eAAiC,EAAAC,yBAAyBC,oBAC9ErD,KAAKsD,gBAAgBC,cAAeC,OAAQxD,KAAMyD,qBAAqB,KAGjE,YAAAR,wCAAR,WACE,GAAMS,GAAY1D,KAAKiB,SAAWjB,KAAKiB,QAAQyC,SAC/CA,IAAa1D,KAAK2D,gBAAgBC,IAAI,EAAAC,gBAAgBC,eAAeC,EAAGL,EAAUM,YAvD7E,EAAA5C,GAAK,eAEL,EAAA6C,SAAW,WAChB,EAAAC,gBACE/C,aAAcA,KAIX,EAAAF,WAiDT,GA1DkC,EAAAkD,UAArB,GAAAhD,eA4Db,EAAAiD,eAAeC,4BAA4BlD","file":"SearchButton.min__7d400a8f34d33214ce02.js","sourcesContent":["webpackJsonpCoveo__temporary([79],{\n\n/***/ 194:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar GlobalExports_1 = __webpack_require__(3);\nvar Strings_1 = __webpack_require__(6);\nvar AccessibleButton_1 = __webpack_require__(15);\nvar Dom_1 = __webpack_require__(1);\nvar SVGDom_1 = __webpack_require__(16);\nvar SVGIcons_1 = __webpack_require__(12);\nvar Utils_1 = __webpack_require__(4);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar Component_1 = __webpack_require__(7);\nvar Initialization_1 = __webpack_require__(2);\nvar QueryStateModel_1 = __webpack_require__(13);\n/**\n * The SearchButton component renders a search icon that the end user can click to trigger a new query.\n *\n * See also the {@link Searchbox} component, which can automatically instantiate a SearchButton component along with a\n * {@link Querybox} component or an {@link Omnibox} component.\n */\nvar SearchButton = /** @class */ (function (_super) {\n __extends(SearchButton, _super);\n /**\n * Creates a new SearchButton. Binds a `click` event on the element. Adds a search icon on the element.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the SearchButton component.\n * @param bindings The bindings that the component requires to function normally. If not set, these will be\n * automatically resolved (with a slower execution time).\n */\n function SearchButton(element, options, bindings) {\n var _this = _super.call(this, element, SearchButton.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n new AccessibleButton_1.AccessibleButton()\n .withElement(element)\n .withOwner(_this.bind)\n .withLabel(Strings_1.l('Search'))\n .withSelectAction(function () { return _this.handleClick(); })\n .build();\n // Provide a magnifier icon if element contains nothing\n if (Utils_1.Utils.trim(Dom_1.$$(_this.element).text()) == '') {\n var svgMagnifierContainer = Dom_1.$$('span', { className: 'coveo-search-button' }, SVGIcons_1.SVGIcons.icons.search).el;\n SVGDom_1.SVGDom.addClassToSVGInContainer(svgMagnifierContainer, 'coveo-search-button-svg');\n var svgLoadingAnimationContainer = Dom_1.$$('span', { className: 'coveo-search-button-loading' }, SVGIcons_1.SVGIcons.icons.loading).el;\n SVGDom_1.SVGDom.addClassToSVGInContainer(svgLoadingAnimationContainer, 'coveo-search-button-loading-svg');\n element.appendChild(svgMagnifierContainer);\n element.appendChild(svgLoadingAnimationContainer);\n }\n return _this;\n }\n /**\n * Triggers the `click` event handler, which logs a `searchboxSubmit` event in the usage analytics and executes a\n * query.\n */\n SearchButton.prototype.click = function () {\n this.handleClick();\n };\n SearchButton.prototype.handleClick = function () {\n this.logger.debug('Performing query following button click');\n this.updateQueryStateModelWithSearchboxQuery();\n this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.searchboxSubmit, {});\n this.queryController.executeQuery({ origin: this, logInActionsHistory: true });\n };\n SearchButton.prototype.updateQueryStateModelWithSearchboxQuery = function () {\n var searchbox = this.options && this.options.searchbox;\n searchbox && this.queryStateModel.set(QueryStateModel_1.QueryStateModel.attributesEnum.q, searchbox.getText());\n };\n SearchButton.ID = 'SearchButton';\n SearchButton.doExport = function () {\n GlobalExports_1.exportGlobally({\n SearchButton: SearchButton\n });\n };\n SearchButton.options = {};\n return SearchButton;\n}(Component_1.Component));\nexports.SearchButton = SearchButton;\nInitialization_1.Initialization.registerAutoCreateComponent(SearchButton);\n\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// SearchButton.min__7d400a8f34d33214ce02.js","import { exportGlobally } from '../../GlobalExports';\nimport { l } from '../../strings/Strings';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\nimport { $$ } from '../../utils/Dom';\nimport { SVGDom } from '../../utils/SVGDom';\nimport { SVGIcons } from '../../utils/SVGIcons';\nimport { Utils } from '../../utils/Utils';\nimport { IAnalyticsNoMeta, analyticsActionCauseList } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { Initialization } from '../Base/Initialization';\nimport { QueryStateModel } from '../../models/QueryStateModel';\n\nexport interface ISearchButtonOptions {\n searchbox?: ISearchButtonSearchbox;\n}\n\nexport interface ISearchButtonSearchbox {\n getText: () => string;\n}\n\n/**\n * The SearchButton component renders a search icon that the end user can click to trigger a new query.\n *\n * See also the {@link Searchbox} component, which can automatically instantiate a SearchButton component along with a\n * {@link Querybox} component or an {@link Omnibox} component.\n */\nexport class SearchButton extends Component {\n static ID = 'SearchButton';\n\n static doExport = () => {\n exportGlobally({\n SearchButton: SearchButton\n });\n };\n\n static options: ISearchButtonOptions = {};\n\n /**\n * Creates a new SearchButton. Binds a `click` event on the element. Adds a search icon on the element.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the SearchButton component.\n * @param bindings The bindings that the component requires to function normally. If not set, these will be\n * automatically resolved (with a slower execution time).\n */\n constructor(public element: HTMLElement, public options?: ISearchButtonOptions, bindings?: IComponentBindings) {\n super(element, SearchButton.ID, bindings);\n\n new AccessibleButton()\n .withElement(element)\n .withOwner(this.bind)\n .withLabel(l('Search'))\n .withSelectAction(() => this.handleClick())\n .build();\n\n // Provide a magnifier icon if element contains nothing\n if (Utils.trim($$(this.element).text()) == '') {\n const svgMagnifierContainer = $$('span', { className: 'coveo-search-button' }, SVGIcons.icons.search).el;\n SVGDom.addClassToSVGInContainer(svgMagnifierContainer, 'coveo-search-button-svg');\n const svgLoadingAnimationContainer = $$('span', { className: 'coveo-search-button-loading' }, SVGIcons.icons.loading).el;\n SVGDom.addClassToSVGInContainer(svgLoadingAnimationContainer, 'coveo-search-button-loading-svg');\n element.appendChild(svgMagnifierContainer);\n element.appendChild(svgLoadingAnimationContainer);\n }\n }\n\n /**\n * Triggers the `click` event handler, which logs a `searchboxSubmit` event in the usage analytics and executes a\n * query.\n */\n public click() {\n this.handleClick();\n }\n\n private handleClick() {\n this.logger.debug('Performing query following button click');\n this.updateQueryStateModelWithSearchboxQuery();\n this.usageAnalytics.logSearchEvent(analyticsActionCauseList.searchboxSubmit, {});\n this.queryController.executeQuery({ origin: this, logInActionsHistory: true });\n }\n\n private updateQueryStateModelWithSearchboxQuery() {\n const searchbox = this.options && this.options.searchbox;\n searchbox && this.queryStateModel.set(QueryStateModel.attributesEnum.q, searchbox.getText());\n }\n}\n\nInitialization.registerAutoCreateComponent(SearchButton);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/SearchButton/SearchButton.ts"],"sourceRoot":""}