{"version":3,"sources":["webpack:///./src/components/pmicom/components/check-drop-down/controller.js"],"names":["MAIN_EASING","CLASS_NO_DISPLAY","require","stuttering","default","onWidthResize","mediumDelay","breakMediumSmall","getNumber","mediaQueryMin","initControllerLink","fillWithDomElements","fillWithDomElementsAll","addEventsTo","freezeScroll","unfreezeScroll","toggleMenuArias","outClickSubscribe","outClickUnSubscribe","asyncImport","duration","CLASS_BUTTON","CLASS_BACK","CLASS_CONTENT","CLASS_APPLY_BUTTON","CLASS_SEARCH","CLASS_MODAL_CLOSE","CLASS_CHECKBOXES","selectors","button","back","content","applyButton","search","modalCloseButton","selectorsAll","checkboxes","module","exports","init","uuid","root","dataset","initElements","initEvents","initialLabel","placeholder","innerHTML","classList","remove","style","height","keyboardCursor","list","querySelector","filteredListElements","listElements","addEventListener","toggleOpen","bind","close","scrollTop","DEBOUNCE","onApply","initSearch","toggleReadOnlyOnInput","initKeyEvents","keyEvent","forEach","checkbox","target","findIndex","element","contains","input","searchInside","focus","searchContent","value","blur","variableTitle","e","querySelectorAll","regExp","RegExp","el","innerText","test","push","add","open","getListElements","Array","from","childNodes","filter","node","nodeName","getCheckBoxesList","map","children","setExtraEvents","onCheck","stopPropagation","setCheck","id","checked","document","getElementById","key","eventFn","ArrowUp","preventDefault","moveCursor","ArrowDown","Escape","isWayDown","length","label","opened","doneSearch","applyButtonHeight","offsetHeight","contentHeight","anime","targets","Math","min","window","innerHeight","easing","finished","then","onOpen","setArias","selectables","setTitle","title","toggleAttribute"],"mappings":";;;;;;;;;AAAA,MAAM;EAAEA,WAAF;EAAeC;AAAf,IAAoCC,mBAAO,CAAC,uCAAD,CAAjD;;AACA,MAAM;EAAEC,UAAF;EAAcC,OAAO,EAAEC;AAAvB,IAAyCH,mBAAO,CAAC,qDAAD,CAAtD;;AACA,MAAM;EACLE,OAAO,EAAE;IAAEE,WAAF;IAAeC;EAAf;AADJ,IAEFL,mBAAO,CAAC,uDAAD,CAFX;;AAGA,MAAM;EACLM,SADK;EAELC,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,QAAQ,CAACC,KAAD,EAAQ;IACf,MAAM1G,OAAO,GAAG0G,KAAK,IAAI,KAAK5F,YAA9B;;IACA,IAAI,KAAKZ,MAAT,EAAiB;MAChB,KAAKA,MAAL,CAAY6C,KAAZ,GAAoB/C,OAApB;MACA,KAAKiD,aAAL,GAAqBjD,OAArB;IACA,CAHD,MAGO,KAAKF,MAAL,CAAYkB,SAAZ,GAAwBhB,OAAxB;EACP,CAxNe;;EAyNhBkC,qBAAqB,GAAG;IACvB,KAAKhC,MAAL,CAAYyG,eAAZ,CAA4B,UAA5B,EAAwC,CAACjI,aAAa,CAACF,gBAAD,CAAtD;EACA;;AA3Ne,CAAjB,C","file":"components--check-drop-downd91775db6ac0caf70696.js","sourcesContent":["const { MAIN_EASING, CLASS_NO_DISPLAY } = require('util/consts');\nconst { stuttering, default: onWidthResize } = require('util/onWidthResize');\nconst {\n\tdefault: { mediumDelay, breakMediumSmall },\n} = require('util/sass-variables');\nconst {\n\tgetNumber,\n\tmediaQueryMin,\n\tinitControllerLink,\n\tfillWithDomElements,\n\tfillWithDomElementsAll,\n\taddEventsTo,\n\tfreezeScroll,\n\tunfreezeScroll,\n\ttoggleMenuArias,\n} = require('util/functions');\nconst {\n\toutClickSubscribe,\n\toutClickUnSubscribe,\n} = require('util/outClickSubscriber');\nconst asyncImport = require('util/asyncImport').default;\nconst duration = getNumber(mediumDelay) * 1000;\n\nconst CLASS_BUTTON = 'check-drop-down--main-button';\nconst CLASS_BACK = 'check-drop-down--back';\nconst CLASS_CONTENT = 'check-drop-down--content';\nconst CLASS_APPLY_BUTTON = 'check-drop-down--apply';\nconst CLASS_SEARCH = 'check-drop-down--search';\nconst CLASS_MODAL_CLOSE = 'mobile-modal-title';\n\nconst CLASS_CHECKBOXES = 'check-drop-down--checkbox';\n\nconst selectors = {\n\tbutton: CLASS_BUTTON,\n\tback: CLASS_BACK,\n\tcontent: CLASS_CONTENT,\n\tapplyButton: CLASS_APPLY_BUTTON,\n\tsearch: CLASS_SEARCH,\n\tmodalCloseButton: CLASS_MODAL_CLOSE,\n};\nconst selectorsAll = {\n\tcheckboxes: CLASS_CHECKBOXES,\n};\n\nmodule.exports = {\n\tasync init() {\n\t\tthis.uuid = this.root.dataset.uuid;\n\t\tthis.initElements();\n\t\tawait asyncImport(this, ['anime', 'debounce']);\n\t\tthis.initEvents();\n\t\tthis.initialLabel = this.search\n\t\t\t? this.search.placeholder\n\t\t\t: this.button.innerHTML;\n\t\tthis.content.classList.remove('init');\n\t\tthis.content.style.height = 0;\n\t\tthis.keyboardCursor = -1;\n\t\tinitControllerLink(this);\n\t},\n\tinitElements() {\n\t\tfillWithDomElements(this, selectors);\n\t\tfillWithDomElementsAll(this, selectorsAll);\n\t\tthis.list = this.root.querySelector('[data-list]');\n\t\tthis.filteredListElements = this.listElements;\n\t},\n\tinitEvents() {\n\t\tthis.button.addEventListener('click', this.toggleOpen.bind(this));\n\t\tthis.modalCloseButton.addEventListener('click', this.close.bind(this));\n\t\tonWidthResize(\n\t\t\t() => {\n\t\t\t\tthis.close();\n\t\t\t\t// already scrolled long list after resize could break mobile behaviour\n\t\t\t\tthis.content.scrollTop = 0;\n\t\t\t},\n\t\t\tstuttering.DEBOUNCE,\n\t\t\t10,\n\t\t);\n\n\t\tif (this.applyButton) {\n\t\t\tthis.applyButton.addEventListener('click', () => {\n\t\t\t\tif (this.onApply) this.onApply();\n\t\t\t\telse this.close();\n\t\t\t});\n\t\t}\n\n\t\tif (this.search) {\n\t\t\tthis.initSearch();\n\t\t\tthis.toggleReadOnlyOnInput();\n\t\t\tonWidthResize(\n\t\t\t\tthis.toggleReadOnlyOnInput.bind(this),\n\t\t\t\tstuttering.DEBOUNCE,\n\t\t\t\t10,\n\t\t\t);\n\t\t}\n\t\tthis.initKeyEvents();\n\t},\n\tinitKeyEvents() {\n\t\tthis.root.addEventListener('keydown', this.keyEvent.bind(this));\n\t\t// keyboard cursor update on focus\n\t\tthis.checkboxes.forEach(checkbox => {\n\t\t\tcheckbox.addEventListener('focus', ({ target }) => {\n\t\t\t\tthis.keyboardCursor = [...this.checkboxes].findIndex(element =>\n\t\t\t\t\telement.contains(target),\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t},\n\tinitSearch() {\n\t\taddEventsTo(this.search, {\n\t\t\tinput: this.searchInside.bind(this),\n\t\t\tfocus: () => {\n\t\t\t\tif (this.searchContent) this.search.value = this.searchContent;\n\t\t\t},\n\t\t\tblur: () => {\n\t\t\t\tif (this.variableTitle) this.search.value = this.variableTitle;\n\t\t\t},\n\t\t});\n\t},\n\tsearchInside(e) {\n\t\tconst value = e ? e.target.value : '';\n\t\tconst list = this.list.querySelectorAll('li');\n\t\tconst regExp = new RegExp(value, 'gi');\n\t\tthis.filteredListElements = [];\n\t\tlist.forEach(el => {\n\t\t\tconst { innerText } = el;\n\t\t\tif (regExp.test(innerText) || !value) {\n\t\t\t\tel.classList.remove(CLASS_NO_DISPLAY);\n\t\t\t\tthis.applyButton && this.applyButton.classList.remove(CLASS_NO_DISPLAY);\n\t\t\t\tthis.filteredListElements.push(el);\n\t\t\t} else {\n\t\t\t\tel.classList.add(CLASS_NO_DISPLAY);\n\t\t\t\tthis.applyButton && this.applyButton.classList.add(CLASS_NO_DISPLAY);\n\t\t\t}\n\t\t});\n\t\tthis.keyboardCursor = -1;\n\t\tthis.open(true);\n\t},\n\tgetListElements() {\n\t\treturn Array.from(this.list.childNodes).filter(\n\t\t\tnode => node.nodeName === 'LI',\n\t\t);\n\t},\n\tgetCheckBoxesList() {\n\t\treturn this.getListElements().map(element => element.children[0]);\n\t},\n\tsetExtraEvents() {\n\t\tif (this.onCheck) {\n\t\t\tthis.list.addEventListener('click', e => {\n\t\t\t\te.stopPropagation();\n\t\t\t\tif (e.target.nodeName !== 'LABEL') this.onCheck(e);\n\t\t\t});\n\t\t}\n\t},\n\tsetCheck(id, checked) {\n\t\tconst checkbox = document.getElementById(`${this.uuid}--${id}`);\n\t\tcheckbox.checked = checked;\n\t},\n\tkeyEvent(e) {\n\t\tconst { key } = e;\n\t\tconst eventFn = {\n\t\t\tArrowUp: () => {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.moveCursor(false);\n\t\t\t},\n\t\t\tArrowDown: () => {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.moveCursor(true);\n\t\t\t},\n\t\t\tEscape: () => {\n\t\t\t\tthis.close(this);\n\t\t\t\tthis.button.focus();\n\t\t\t},\n\t\t}[key];\n\t\teventFn && eventFn();\n\t},\n\tmoveCursor(isWayDown) {\n\t\tconst { length } = this.filteredListElements;\n\t\tthis.keyboardCursor += isWayDown ? 1 : -1;\n\t\tif (this.keyboardCursor < 0) this.keyboardCursor = length - 1;\n\t\tif (this.keyboardCursor >= length) this.keyboardCursor = 0;\n\t\tconst label =\n\t\t\tthis.filteredListElements[this.keyboardCursor].querySelector(\n\t\t\t\t'label, button',\n\t\t\t);\n\t\tlabel.focus();\n\t},\n\ttoggleOpen(e) {\n\t\te.stopPropagation();\n\t\tif (e.target === this.search && this.opened) return;\n\t\tif (this.opened) this.close();\n\t\telse this.open();\n\t},\n\n\topen(doneSearch) {\n\t\tfreezeScroll(true);\n\t\tif (this.search) {\n\t\t\tthis.search.focus();\n\t\t\tif (!this.opened) this.search.value = '';\n\t\t}\n\t\tif (!doneSearch) this.searchInside(); // clear the drop filtering\n\t\tif (!this.opened) outClickSubscribe(this.root, this.close.bind(this));\n\t\tthis.opened = true;\n\t\tthis.root.classList.add('open');\n\t\tlet applyButtonHeight = 0;\n\t\tif (this.applyButton) applyButtonHeight = this.applyButton.offsetHeight;\n\t\tconst contentHeight = this.list.offsetHeight + applyButtonHeight;\n\t\tthis.anime({\n\t\t\ttargets: this.content,\n\t\t\theight: mediaQueryMin(breakMediumSmall)\n\t\t\t\t? Math.min(contentHeight, window.innerHeight / 2) // [ALIGN WITH] .check-drop-down--content css max height\n\t\t\t\t: window.innerHeight,\n\t\t\teasing: MAIN_EASING,\n\t\t\tduration,\n\t\t}).finished.then(() => {\n\t\t\tif (!mediaQueryMin(breakMediumSmall)) {\n\t\t\t\tthis.content.style.height = '100%';\n\t\t\t}\n\t\t});\n\t\tif (this.onOpen) this.onOpen();\n\t\tthis.setArias();\n\t},\n\tclose() {\n\t\tif (this.opened) unfreezeScroll();\n\t\tthis.opened = false;\n\t\tif (this.search) {\n\t\t\tthis.searchContent = this.search.value;\n\t\t\tif (!this.variableTitle) this.search.value = '';\n\t\t}\n\t\tthis.anime({\n\t\t\ttargets: this.content,\n\t\t\theight: 0,\n\t\t\teasing: MAIN_EASING,\n\t\t\tduration,\n\t\t}).finished.then(() => {\n\t\t\tthis.content.style.height = '0';\n\t\t\tthis.root.classList.remove('open');\n\t\t});\n\t\tthis.keyboardCursor = -1;\n\t\tthis.setArias();\n\t\tif (this.opened) outClickUnSubscribe(this.root);\n\t\tthis.opened = false;\n\t},\n\tsetArias() {\n\t\tconst selectables = this.checkboxes.length\n\t\t\t? this.checkboxes\n\t\t\t: this.content.querySelectorAll('button');\n\t\ttoggleMenuArias(\n\t\t\tthis.button,\n\t\t\t[\n\t\t\t\t...[...selectables, this.search].filter(el => !!el),\n\t\t\t\t...(this.applyButton ? [this.applyButton] : []),\n\t\t\t],\n\t\t\tthis.opened,\n\t\t);\n\t},\n\tsetTitle(title) {\n\t\tconst content = title || this.initialLabel;\n\t\tif (this.search) {\n\t\t\tthis.search.value = content;\n\t\t\tthis.variableTitle = content;\n\t\t} else this.button.innerHTML = content;\n\t},\n\ttoggleReadOnlyOnInput() {\n\t\tthis.search.toggleAttribute('readonly', !mediaQueryMin(breakMediumSmall));\n\t},\n};\n"],"sourceRoot":""}