{"version":3,"sources":["Breadcrumb.min__d957946aa95219e5e0e2.js","./src/ui/Breadcrumb/Breadcrumb.ts"],"names":["webpackJsonpCoveo__temporary","239","module","exports","__webpack_require__","__extends","this","extendStatics","Object","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","prototype","create","defineProperty","value","element","options","bindings","Breadcrumb","ID","ComponentOptions","initComponentOptions","bind","oneRootElement","InitializationEvents","afterInitialization","handleAfterInitialization","onRootElement","BreadcrumbEvents","redrawBreadcrumb","style","display","setAttribute","addDefaultAccessibilityAttributes","_this","getBreadcrumbs","args","breadcrumbs","trigger","root","populateBreadcrumb","logger","debug","isEmpty","lastBreadcrumbs","focusFirstEnabledResultList","clearBreadcrumbs","clearBreadcrumb","usageAnalytics","logSearchEvent","analyticsActionCauseList","breadcrumbResetAll","queryController","executeQuery","drawBreadcrumb","$$","empty","length","breadcrumbItems","document","createElement","addClass","appendChild","each","bcrumb","elem","clearText","undefined","l","el","clear","className","AccessibleButton","withElement","withSelectAction","withOwner","withoutLabelOrTitle","build","handleDeferredQuerySuccess","handleQueryError","QueryEvents","deferredQuerySuccess","queryError","resultLists","searchInterface","getComponents","firstEnabledResultList","find","resultList","disabled","focus","getAttribute","doExport","exportGlobally","Component","Initialization","registerAutoCreateComponent","600"],"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,EAAG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F,KAAKgB,QAAQiB,aAAa,aAAc,EAAAoC,EAAE,gBA3IvC,EAAAjD,GAAK,aACL,EAAAH,WAEA,EAAA4E,SAAW,WAChB,EAAAC,gBACE3E,WAAYA,KAyIlB,GA/IgC,EAAA4E,UAAnB,GAAA5E,aAiJb,EAAA6E,eAAeC,4BAA4B9E,IDGrC+E,IACA,SAAUtG,EAAQC","file":"Breadcrumb.min__d957946aa95219e5e0e2.js","sourcesContent":["webpackJsonpCoveo__temporary([76],{\n\n/***/ 239:\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 });\n__webpack_require__(600);\nvar underscore_1 = __webpack_require__(0);\nvar BreadcrumbEvents_1 = __webpack_require__(35);\nvar InitializationEvents_1 = __webpack_require__(16);\nvar QueryEvents_1 = __webpack_require__(11);\nvar GlobalExports_1 = __webpack_require__(3);\nvar Strings_1 = __webpack_require__(6);\nvar AccessibleButton_1 = __webpack_require__(17);\nvar Dom_1 = __webpack_require__(1);\nvar AnalyticsActionListMeta_1 = __webpack_require__(10);\nvar Component_1 = __webpack_require__(7);\nvar ComponentOptions_1 = __webpack_require__(8);\nvar Initialization_1 = __webpack_require__(2);\n/**\n * The Breadcrumb component displays a summary of the currently active query filters.\n *\n * For example, when the user selects a {@link Facet} value, the breadcrumbs display this value.\n *\n * The active filters are obtained by the component by firing an event in the Breadcrumb component.\n *\n * All other components having an active state can react to this event by providing custom bits of HTML to display\n * inside the breadcrumbs.\n *\n * Thus, it is possible to easily extend the Breadcrumb component using custom code to display information about custom\n * states and filters.\n *\n * See {@link BreadcrumbEvents} for the list of events and parameters sent when a Breadcrumb component is populated.\n */\nvar Breadcrumb = /** @class */ (function (_super) {\n __extends(Breadcrumb, _super);\n /**\n * Creates a new Breadcrumb component. Binds event on {@link QueryEvents.deferredQuerySuccess} to draw the\n * breadcrumbs.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the Breadcrumb 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 Breadcrumb(element, options, bindings) {\n var _this = _super.call(this, element, Breadcrumb.ID, bindings) || this;\n _this.element = element;\n _this.options = options;\n _this.options = ComponentOptions_1.ComponentOptions.initComponentOptions(element, Breadcrumb, options);\n _this.bind.oneRootElement(InitializationEvents_1.InitializationEvents.afterInitialization, function () { return _this.handleAfterInitialization(); });\n _this.bind.onRootElement(BreadcrumbEvents_1.BreadcrumbEvents.redrawBreadcrumb, function () { return _this.redrawBreadcrumb(); });\n _this.element.style.display = 'none';\n _this.element.setAttribute('tabindex', '-1');\n _this.addDefaultAccessibilityAttributes();\n return _this;\n }\n /**\n * Triggers the event to populate the breadcrumbs. Components such as {@link Facet} can populate the breadcrumbs.\n *\n * This method triggers a {@link BreadcrumbEvents.populateBreadcrumb} event with an\n * {@link IPopulateBreadcrumbEventArgs} object (an array) that other components or code can populate.\n * @returns {IBreadcrumbItem[]} A populated breadcrumb item list.\n */\n Breadcrumb.prototype.getBreadcrumbs = function () {\n var args = { breadcrumbs: [] };\n this.bind.trigger(this.root, BreadcrumbEvents_1.BreadcrumbEvents.populateBreadcrumb, args);\n this.logger.debug('Retrieved breadcrumbs', args.breadcrumbs);\n // If newly received breadcrumbs are empty, and last breadcrumbs were not.\n // this means end user removed the last filter:\n // We want to shift keyboard focus to the result list container in that case, for ease of use of the interface\n // https://coveord.atlassian.net/browse/JSUI-3078\n if (underscore_1.isEmpty(args.breadcrumbs) && !underscore_1.isEmpty(this.lastBreadcrumbs)) {\n this.focusFirstEnabledResultList();\n }\n this.lastBreadcrumbs = args.breadcrumbs;\n return args.breadcrumbs;\n };\n /**\n * Triggers the event to clear the current breadcrumbs that components such as {@link Facet} can populate.\n *\n * Also triggers a new query and logs the `breadcrumbResetAll` event in the usage analytics.\n */\n Breadcrumb.prototype.clearBreadcrumbs = function () {\n var args = {};\n this.bind.trigger(this.root, BreadcrumbEvents_1.BreadcrumbEvents.clearBreadcrumb, args);\n this.logger.debug('Clearing breadcrumbs');\n this.usageAnalytics.logSearchEvent(AnalyticsActionListMeta_1.analyticsActionCauseList.breadcrumbResetAll, {});\n this.queryController.executeQuery();\n };\n /**\n * Draws the specified breadcrumb items.\n * @param breadcrumbs The breadcrumb items to draw.\n */\n Breadcrumb.prototype.drawBreadcrumb = function (breadcrumbs) {\n var _this = this;\n Dom_1.$$(this.element).empty();\n if (breadcrumbs.length != 0) {\n this.element.style.display = '';\n }\n else {\n this.element.style.display = 'none';\n }\n var breadcrumbItems = document.createElement('div');\n Dom_1.$$(breadcrumbItems).addClass('coveo-breadcrumb-items');\n this.element.appendChild(breadcrumbItems);\n underscore_1.each(breadcrumbs, function (bcrumb) {\n var elem = bcrumb.element;\n Dom_1.$$(elem).addClass('coveo-breadcrumb-item');\n breadcrumbItems.appendChild(elem);\n });\n var clearText = Dom_1.$$('div', undefined, Strings_1.l('ClearAllFilters')).el;\n var clear = Dom_1.$$('div', {\n className: 'coveo-breadcrumb-clear-all'\n }, clearText).el;\n new AccessibleButton_1.AccessibleButton()\n .withElement(clear)\n .withSelectAction(function () { return _this.clearBreadcrumbs(); })\n .withOwner(this.bind)\n .withoutLabelOrTitle()\n .build();\n this.element.appendChild(clear);\n };\n Breadcrumb.prototype.redrawBreadcrumb = function () {\n this.lastBreadcrumbs ? this.drawBreadcrumb(this.lastBreadcrumbs) : this.drawBreadcrumb(this.getBreadcrumbs());\n };\n Breadcrumb.prototype.handleDeferredQuerySuccess = function () {\n this.drawBreadcrumb(this.getBreadcrumbs());\n };\n Breadcrumb.prototype.handleQueryError = function () {\n this.drawBreadcrumb(this.getBreadcrumbs());\n };\n Breadcrumb.prototype.handleAfterInitialization = function () {\n var _this = this;\n // We must bind to these events after the initialization to make sure the breadcrumb generation\n // is made with updated components. (E.G facet, facetrange, ...)\n this.bind.onRootElement(QueryEvents_1.QueryEvents.deferredQuerySuccess, function () { return _this.handleDeferredQuerySuccess(); });\n this.bind.onRootElement(QueryEvents_1.QueryEvents.queryError, function () { return _this.handleQueryError(); });\n };\n Breadcrumb.prototype.focusFirstEnabledResultList = function () {\n var resultLists = this.searchInterface.getComponents('ResultList');\n var firstEnabledResultList = underscore_1.find(resultLists, function (resultList) { return resultList.disabled === false; });\n if (firstEnabledResultList) {\n Dom_1.$$(firstEnabledResultList.element).focus(true);\n }\n };\n Breadcrumb.prototype.addDefaultAccessibilityAttributes = function () {\n if (!this.element.getAttribute('role')) {\n this.element.setAttribute('role', 'navigation');\n }\n if (!this.element.getAttribute('aria-label')) {\n this.element.setAttribute('aria-label', Strings_1.l('Breadcrumb'));\n }\n };\n Breadcrumb.ID = 'Breadcrumb';\n Breadcrumb.options = {};\n Breadcrumb.doExport = function () {\n GlobalExports_1.exportGlobally({\n Breadcrumb: Breadcrumb\n });\n };\n return Breadcrumb;\n}(Component_1.Component));\nexports.Breadcrumb = Breadcrumb;\nInitialization_1.Initialization.registerAutoCreateComponent(Breadcrumb);\n\n\n/***/ }),\n\n/***/ 600:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// Breadcrumb.min__d957946aa95219e5e0e2.js","import 'styling/_Breadcrumb';\nimport { each, find, isEmpty } from 'underscore';\nimport { BreadcrumbEvents, IBreadcrumbItem, IClearBreadcrumbEventArgs, IPopulateBreadcrumbEventArgs } from '../../events/BreadcrumbEvents';\nimport { InitializationEvents } from '../../events/InitializationEvents';\nimport { QueryEvents } from '../../events/QueryEvents';\nimport { exportGlobally } from '../../GlobalExports';\nimport { l } from '../../strings/Strings';\nimport { AccessibleButton } from '../../utils/AccessibleButton';\nimport { $$ } from '../../utils/Dom';\nimport { analyticsActionCauseList, IAnalyticsNoMeta } from '../Analytics/AnalyticsActionListMeta';\nimport { Component } from '../Base/Component';\nimport { IComponentBindings } from '../Base/ComponentBindings';\nimport { ComponentOptions } from '../Base/ComponentOptions';\nimport { Initialization } from '../Base/Initialization';\n\nexport interface IBreadcrumbOptions {}\n\n/**\n * The Breadcrumb component displays a summary of the currently active query filters.\n *\n * For example, when the user selects a {@link Facet} value, the breadcrumbs display this value.\n *\n * The active filters are obtained by the component by firing an event in the Breadcrumb component.\n *\n * All other components having an active state can react to this event by providing custom bits of HTML to display\n * inside the breadcrumbs.\n *\n * Thus, it is possible to easily extend the Breadcrumb component using custom code to display information about custom\n * states and filters.\n *\n * See {@link BreadcrumbEvents} for the list of events and parameters sent when a Breadcrumb component is populated.\n */\nexport class Breadcrumb extends Component {\n static ID = 'Breadcrumb';\n static options: IBreadcrumbOptions = {};\n\n static doExport = () => {\n exportGlobally({\n Breadcrumb: Breadcrumb\n });\n };\n\n private lastBreadcrumbs: IBreadcrumbItem[];\n\n /**\n * Creates a new Breadcrumb component. Binds event on {@link QueryEvents.deferredQuerySuccess} to draw the\n * breadcrumbs.\n * @param element The HTMLElement on which to instantiate the component.\n * @param options The options for the Breadcrumb 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?: IBreadcrumbOptions, bindings?: IComponentBindings) {\n super(element, Breadcrumb.ID, bindings);\n\n this.options = ComponentOptions.initComponentOptions(element, Breadcrumb, options);\n\n this.bind.oneRootElement(InitializationEvents.afterInitialization, () => this.handleAfterInitialization());\n this.bind.onRootElement(BreadcrumbEvents.redrawBreadcrumb, () => this.redrawBreadcrumb());\n this.element.style.display = 'none';\n this.element.setAttribute('tabindex', '-1');\n this.addDefaultAccessibilityAttributes();\n }\n\n /**\n * Triggers the event to populate the breadcrumbs. Components such as {@link Facet} can populate the breadcrumbs.\n *\n * This method triggers a {@link BreadcrumbEvents.populateBreadcrumb} event with an\n * {@link IPopulateBreadcrumbEventArgs} object (an array) that other components or code can populate.\n * @returns {IBreadcrumbItem[]} A populated breadcrumb item list.\n */\n public getBreadcrumbs(): IBreadcrumbItem[] {\n const args = { breadcrumbs: [] };\n this.bind.trigger(this.root, BreadcrumbEvents.populateBreadcrumb, args);\n this.logger.debug('Retrieved breadcrumbs', args.breadcrumbs);\n\n // If newly received breadcrumbs are empty, and last breadcrumbs were not.\n // this means end user removed the last filter:\n // We want to shift keyboard focus to the result list container in that case, for ease of use of the interface\n // https://coveord.atlassian.net/browse/JSUI-3078\n if (isEmpty(args.breadcrumbs) && !isEmpty(this.lastBreadcrumbs)) {\n this.focusFirstEnabledResultList();\n }\n this.lastBreadcrumbs = args.breadcrumbs;\n return args.breadcrumbs;\n }\n\n /**\n * Triggers the event to clear the current breadcrumbs that components such as {@link Facet} can populate.\n *\n * Also triggers a new query and logs the `breadcrumbResetAll` event in the usage analytics.\n */\n public clearBreadcrumbs() {\n const args = {};\n this.bind.trigger(this.root, BreadcrumbEvents.clearBreadcrumb, args);\n this.logger.debug('Clearing breadcrumbs');\n this.usageAnalytics.logSearchEvent(analyticsActionCauseList.breadcrumbResetAll, {});\n this.queryController.executeQuery();\n }\n\n /**\n * Draws the specified breadcrumb items.\n * @param breadcrumbs The breadcrumb items to draw.\n */\n public drawBreadcrumb(breadcrumbs: IBreadcrumbItem[]) {\n $$(this.element).empty();\n if (breadcrumbs.length != 0) {\n this.element.style.display = '';\n } else {\n this.element.style.display = 'none';\n }\n\n const breadcrumbItems = document.createElement('div');\n $$(breadcrumbItems).addClass('coveo-breadcrumb-items');\n this.element.appendChild(breadcrumbItems);\n each(breadcrumbs, (bcrumb: IBreadcrumbItem) => {\n const elem = bcrumb.element;\n $$(elem).addClass('coveo-breadcrumb-item');\n breadcrumbItems.appendChild(elem);\n });\n\n const clearText = $$('div', undefined, l('ClearAllFilters')).el;\n const clear = $$(\n 'div',\n {\n className: 'coveo-breadcrumb-clear-all'\n },\n clearText\n ).el;\n\n new AccessibleButton()\n .withElement(clear)\n .withSelectAction(() => this.clearBreadcrumbs())\n .withOwner(this.bind)\n .withoutLabelOrTitle()\n .build();\n\n this.element.appendChild(clear);\n }\n\n private redrawBreadcrumb() {\n this.lastBreadcrumbs ? this.drawBreadcrumb(this.lastBreadcrumbs) : this.drawBreadcrumb(this.getBreadcrumbs());\n }\n\n private handleDeferredQuerySuccess() {\n this.drawBreadcrumb(this.getBreadcrumbs());\n }\n\n private handleQueryError() {\n this.drawBreadcrumb(this.getBreadcrumbs());\n }\n\n private handleAfterInitialization() {\n // We must bind to these events after the initialization to make sure the breadcrumb generation\n // is made with updated components. (E.G facet, facetrange, ...)\n this.bind.onRootElement(QueryEvents.deferredQuerySuccess, () => this.handleDeferredQuerySuccess());\n this.bind.onRootElement(QueryEvents.queryError, () => this.handleQueryError());\n }\n\n private focusFirstEnabledResultList() {\n const resultLists = this.searchInterface.getComponents('ResultList');\n const firstEnabledResultList = find(resultLists, resultList => resultList.disabled === false);\n if (firstEnabledResultList) {\n $$(firstEnabledResultList.element).focus(true);\n }\n }\n\n private addDefaultAccessibilityAttributes() {\n if (!this.element.getAttribute('role')) {\n this.element.setAttribute('role', 'navigation');\n }\n if (!this.element.getAttribute('aria-label')) {\n this.element.setAttribute('aria-label', l('Breadcrumb'));\n }\n }\n}\n\nInitialization.registerAutoCreateComponent(Breadcrumb);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ui/Breadcrumb/Breadcrumb.ts"],"sourceRoot":""}