@aquera/nile-elements 1.3.0-beta-1.3 → 1.3.0-beta-1.5

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.
Files changed (41) hide show
  1. package/dist/index.js +6 -8
  2. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  3. package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
  4. package/dist/nile-auto-complete/nile-auto-complete.esm.js +1 -1
  5. package/dist/nile-chip/nile-chip.cjs.js +1 -1
  6. package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
  7. package/dist/nile-chip/nile-chip.esm.js +1 -1
  8. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  9. package/dist/nile-dropdown/nile-dropdown.cjs.js.map +1 -1
  10. package/dist/nile-dropdown/nile-dropdown.esm.js +1 -1
  11. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  12. package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
  13. package/dist/nile-popover/nile-popover.esm.js +1 -1
  14. package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
  15. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  16. package/dist/nile-select/virtual-scroll-helper.esm.js +0 -2
  17. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  18. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  19. package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
  20. package/dist/src/nile-auto-complete/nile-auto-complete.js +0 -1
  21. package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
  22. package/dist/src/nile-chip/nile-chip.js +0 -1
  23. package/dist/src/nile-chip/nile-chip.js.map +1 -1
  24. package/dist/src/nile-dropdown/nile-dropdown.js +0 -1
  25. package/dist/src/nile-dropdown/nile-dropdown.js.map +1 -1
  26. package/dist/src/nile-popover/nile-popover.js +0 -1
  27. package/dist/src/nile-popover/nile-popover.js.map +1 -1
  28. package/dist/src/nile-select/virtual-scroll-helper.js +0 -2
  29. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  30. package/dist/src/nile-virtual-select/nile-virtual-select.js +0 -1
  31. package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
  32. package/dist/src/version.js +1 -1
  33. package/dist/src/version.js.map +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/src/nile-auto-complete/nile-auto-complete.ts +0 -2
  37. package/src/nile-chip/nile-chip.ts +0 -1
  38. package/src/nile-dropdown/nile-dropdown.ts +0 -1
  39. package/src/nile-popover/nile-popover.ts +0 -1
  40. package/src/nile-select/virtual-scroll-helper.ts +0 -2
  41. package/src/nile-virtual-select/nile-virtual-select.ts +0 -1
@@ -2,5 +2,5 @@ System.register(["tslib","lit","lit/decorators.js","./nile-virtual-select.css.cj
2
2
  * @license
3
3
  * Copyright 2021 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */_export("t",k=/*#__PURE__*/function(){function k(i,_ref){var _this=this;var s=_ref.target,n=_ref.config,o=_ref.callback,t=_ref.skipInitial;_classCallCheck(this,k);this.t=new Set(),this.o=!1,this.i=!1,this.h=i,null!==s&&this.t.add(s!==null&&s!==void 0?s:i),this.l=n,this.o=t!==null&&t!==void 0?t:this.o,this.callback=o,window.ResizeObserver?(this.u=new ResizeObserver(function(i){_this.handleChanges(i),_this.h.requestUpdate();}),i.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.");}return _createClass(k,[{key:"handleChanges",value:function handleChanges(i){var _this$callback;this.value=(_this$callback=this.callback)===null||_this$callback===void 0?void 0:_this$callback.call(this,i,this.u);}},{key:"hostConnected",value:function hostConnected(){var _iterator=_createForOfIteratorHelper(this.t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i=_step.value;this.observe(_i);}}catch(err){_iterator.e(err);}finally{_iterator.f();}}},{key:"hostDisconnected",value:function hostDisconnected(){this.disconnect();}},{key:"hostUpdated",value:function(){var _hostUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:!this.o&&this.i&&this.handleChanges([]),this.i=!1;case 1:case"end":return _context2.stop();}},_callee,this);}));function hostUpdated(){return _hostUpdated.apply(this,arguments);}return hostUpdated;}()},{key:"observe",value:function observe(i){this.t.add(i),this.u.observe(i,this.l),this.i=!0,this.h.requestUpdate();}},{key:"unobserve",value:function unobserve(i){this.t["delete"](i),this.u.unobserve(i);}},{key:"disconnect",value:function disconnect(){this.u.disconnect();}}]);}());_export("N",$=/*#__PURE__*/function(_u){function $(){var _this2;_classCallCheck(this,$);_this2=_callSuper(this,$,arguments),_this2.formControlController=new p(_assertThisInitialized(_this2),{assumeInteractionOn:["nile-blur","nile-input"]}),_this2.hasSlotController=new h(_assertThisInitialized(_this2),"help-text","label"),_this2.portalManager=new _(_assertThisInitialized(_this2)),_this2.hasFocus=!1,_this2.displayLabel="",_this2.selectedOptions=[],_this2.oldValue="",_this2.scrolling=!1,_this2.name="",_this2.data=[],_this2.originalOptionItems=[],_this2.value="",_this2.defaultValue="",_this2.size="medium",_this2.placeholder="Select...",_this2.autoResize=!1,_this2.searchValue="",_this2.searchEnabled=!1,_this2.enableVisibilityEffect=!1,_this2.internalSearchPlaceHolder="Search...",_this2.disableLocalSearch=!1,_this2.optionsLoading=!1,_this2.loading=!1,_this2.multiple=!1,_this2.helpText="",_this2.errorMessage="",_this2.warning=!1,_this2.error=!1,_this2.success=!1,_this2.disabled=!1,_this2.clearable=!1,_this2.open=!1,_this2.hoist=!1,_this2.filled=!1,_this2.pill=!1,_this2.label="",_this2.placement="bottom",_this2.form="",_this2.required=!1,_this2.showNoResults=!1,_this2.noResultsMessage="No results found",_this2.showSelected=!1,_this2.blockValueChange=!1,_this2.noWidthSync=!1,_this2.portal=!1,_this2.maxOptionsVisible=3,_this2.oldMaxOptionsVisible=1,_this2.enableTabClose=!1,_this2.showListbox=!1,_this2.wasShowSelectedCheckedOnClose=!1,_this2.handleDocumentMouseDown=function(i){if(!_this2.open)return;var s=i.composedPath(),n=s.includes(_assertThisInitialized(_this2)),o=_this2.popup&&s.includes(_this2.popup),t=_this2.portal&&_this2.portalManager.portalContainerElement&&s.includes(_this2.portalManager.portalContainerElement);n||o||t||_this2.hide();},_this2.handleWindowError=function(i){var _i$error;(((_i$error=i.error)===null||_i$error===void 0?void 0:_i$error.message)||i.message||"").includes("Cannot read properties of null (reading 'insertBefore')")&&i.preventDefault();},_this2.handleWindowResize=function(){_this2.portalManager.updatePortalAppendPosition();},_this2.handleWindowScroll=function(){_this2.portalManager.updatePortalAppendPosition();},_this2.resizeController=new k(_assertThisInitialized(_this2),{callback:function callback(i){var _iterator2=_createForOfIteratorHelper(i),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _s=_step2.value;_s.target.classList.contains("select__tags")&&_this2.calculateTotalWidthOfTags();}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}});return _this2;}_inherits($,_u);return _createClass($,[{key:"validity",get:function get(){var _this$valueInput;return(_this$valueInput=this.valueInput)===null||_this$valueInput===void 0?void 0:_this$valueInput.validity;}},{key:"validationMessage",get:function get(){var _this$valueInput$vali,_this$valueInput2;return(_this$valueInput$vali=(_this$valueInput2=this.valueInput)===null||_this$valueInput2===void 0?void 0:_this$valueInput2.validationMessage)!==null&&_this$valueInput$vali!==void 0?_this$valueInput$vali:"";}},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet($,"connectedCallback",this,3)([]),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then(function(){_this3.value&&_this3.data.length>0&&_this3.selectionChanged();});}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;this.removeOpenListeners(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.portalManager.cleanupPortalAppend();}},{key:"updated",value:function updated(i){if(i.has("value")&&this.selectionChanged(),i.has("autoResize")){var _this$shadowRoot;var _i2=(_this$shadowRoot=this.shadowRoot)===null||_this$shadowRoot===void 0?void 0:_this$shadowRoot.querySelector(".select__tags");this.autoResize&&_i2?this.resizeController.observe(_i2):_i2&&this.resizeController.unobserve(_i2);}}},{key:"initializeComponent",value:function initializeComponent(){this.open=!1,this.emit("nile-init");}},{key:"getDisplayText",value:function getDisplayText(i){var _this$renderItemConfi;return(_this$renderItemConfi=this.renderItemConfig)!==null&&_this$renderItemConfi!==void 0&&_this$renderItemConfi.getDisplayText?this.renderItemConfig.getDisplayText(i):(i===null||i===void 0?void 0:i.label)||(i===null||i===void 0?void 0:i.name)||(i===null||i===void 0?void 0:i.toString())||"";}},{key:"getItemValue",value:function getItemValue(i){var _this$renderItemConfi2;return(_this$renderItemConfi2=this.renderItemConfig)!==null&&_this$renderItemConfi2!==void 0&&_this$renderItemConfi2.getValue?this.renderItemConfig.getValue(i):(i===null||i===void 0?void 0:i.value)||i;}},{key:"getSearchText",value:function getSearchText(i){var _this$renderItemConfi3;return(_this$renderItemConfi3=this.renderItemConfig)!==null&&_this$renderItemConfi3!==void 0&&_this$renderItemConfi3.getSearchText?this.renderItemConfig.getSearchText(i):this.getDisplayText(i);}},{key:"setupEventListeners",value:function setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowError=this.handleWindowError.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this);}},{key:"addOpenListeners",value:function addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),window.addEventListener("error",this.handleWindowError),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0));}},{key:"removeOpenListeners",value:function removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("error",this.handleWindowError),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0);}},{key:"handleFocus",value:function handleFocus(){this.hasFocus=!0,this.emit("nile-focus");}},{key:"handleBlur",value:function handleBlur(){this.hasFocus=!1,this.emit("nile-blur");}},{key:"firstUpdated",value:function firstUpdated(i){var _superPropGet2,_this4=this;(_superPropGet2=_superPropGet($,"firstUpdated",this,3))!==null&&_superPropGet2!==void 0&&_superPropGet2([i]),this.visibilityManager=new x({host:this,target:this.combobox,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this4.open;},onAnchorOutOfView:function onAnchorOutOfView(){_this4.hide(),_this4.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view",name:_this4.name});},onDocumentHidden:function onDocumentHidden(){_this4.hide(),_this4.emit("nile-visibility-change",{visible:!1,reason:"document-hidden",name:_this4.name});},emit:function emit(i,s){return _this4.emit("nile-".concat(i),s);}});}},{key:"handleDocumentFocusIn",value:function handleDocumentFocusIn(i){if(!this.open)return;var s=i.composedPath(),n=s.includes(this),o=this.popup&&s.includes(this.popup),t=this.portal&&this.portalManager.portalContainerElement&&s.includes(this.portalManager.portalContainerElement);n||o||t||this.hide();}},{key:"handleDocumentKeyDown",value:function handleDocumentKeyDown(i){this.shouldIgnoreKeyPress(i)||(this.isEscapeKey(i)&&this.handleEscapeKey(i),this.isEnterOrSpaceKey(i)&&this.handleEnterOrSpaceKey(i));}},{key:"shouldIgnoreKeyPress",value:function shouldIgnoreKeyPress(i){var s=i.target,n=null!==s.closest(".select__clear"),o=null!==s.closest("nile-icon-button");return n||o;}},{key:"isEscapeKey",value:function isEscapeKey(i){return"Escape"===i.key&&this.open;}},{key:"handleEscapeKey",value:function handleEscapeKey(i){i.preventDefault(),i.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0});}},{key:"isEnterOrSpaceKey",value:function isEnterOrSpaceKey(i){return"Enter"===i.key||" "===i.key;}},{key:"handleEnterOrSpaceKey",value:function handleEnterOrSpaceKey(i){i.preventDefault(),i.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show();}},{key:"handleFooterClick",value:function handleFooterClick(i){i.stopPropagation(),i.preventDefault();}},{key:"toggleShowSelected",value:function toggleShowSelected(i){var _this$selectedOptions,_this5=this;if(i.stopPropagation(),i.preventDefault(),0!==((_this$selectedOptions=this.selectedOptions)===null||_this$selectedOptions===void 0?void 0:_this$selectedOptions.length)){if(this.showSelected=!this.showSelected,this.showSelected){this.searchValue="";var _i3=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter(function(s){var n=_this5.getItemValue(s);return _i3.some(function(i){return String(i)===String(n);});});}else this.data=_toConsumableArray(this.originalOptionItems);this.portalManager.resetMeasuredHeight(),this.requestUpdate(),this.repaintOptionsContainer();}}},{key:"unSelectAll",value:function unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=_toConsumableArray(this.originalOptionItems),this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.resetScrollPosition();}},{key:"handleLabelClick",value:function handleLabelClick(){this.displayInput.focus(),this.hide();}},{key:"handleComboboxMouseDown",value:function handleComboboxMouseDown(i){this.shouldIgnoreComboboxClick(i)||(i.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open);}},{key:"shouldIgnoreComboboxClick",value:function shouldIgnoreComboboxClick(i){var s=i.composedPath().some(function(i){return i instanceof Element&&"nile-icon-button"===i.tagName.toLowerCase();});return this.disabled||s;}},{key:"handleComboboxKeyDown",value:function handleComboboxKeyDown(i){this.isEnterOrSpaceKey(i)&&(i.preventDefault(),this.open=!this.open);}},{key:"handleClearClick",value:function handleClearClick(i){i.stopPropagation(),this.clearSelection();}},{key:"clearSelection",value:function clearSelection(){var _this6=this;this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then(function(){_this6.nileInput({value:_this6.value,name:_this6.name}),_this6.nileChange({value:_this6.value,name:_this6.name}),_this6.emit("nile-clear");});}},{key:"handleClearMouseDown",value:function handleClearMouseDown(i){i.stopPropagation();}},{key:"handleOptionClick",value:function handleOptionClick(i){var s=i.target.closest("nile-option");if(this.shouldBlockValueChange(s))return;var n=this.value;this.oldValue=n,s&&!s.disabled&&this.handleOptionSelection(s);}},{key:"shouldBlockValueChange",value:function shouldBlockValueChange(i){return!(!this.blockValueChange||!i)&&(this.emit("nile-block-change",{value:i===null||i===void 0?void 0:i.value,name:this.name}),this.hide(),!0);}},{key:"handleOptionSelection",value:function handleOptionSelection(i){var _this7=this;var s=i.value;this.multiple?this.toggleOptionSelection(s):this.setSelectedOptions(s),this.updateComplete.then(function(){return _this7.displayInput.focus({preventScroll:!0});}),this.value!==this.oldValue&&this.updateComplete.then(function(){_this7.nileInput({value:_this7.value,name:_this7.name}),_this7.nileChange({value:_this7.value,name:_this7.name});}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}));}},{key:"setSelectedOptions",value:function setSelectedOptions(i){this.value=i,this.selectionChanged();}},{key:"toggleOptionSelection",value:function toggleOptionSelection(i){var s=Array.isArray(this.value)?this.value:[];s.includes(i)?this.value=s.filter(function(s){return s!==i;}):this.value=[].concat(_toConsumableArray(s),[i]),this.selectionChanged();}},{key:"handleTagRemove",value:function handleTagRemove(i,s){i.stopPropagation(),this.disabled||(this.removeTagFromSelection(s),this.emitTagRemovalEvent(s));}},{key:"removeTagFromSelection",value:function removeTagFromSelection(i){var s=this.value;Array.isArray(s)||(s=s?[s]:[]);var n=s.filter(function(s){return s!==i.value;});this.value=n,this.selectionChanged();}},{key:"emitTagRemovalEvent",value:function emitTagRemovalEvent(i){var _this8=this;this.updateComplete.then(function(){_this8.nileInput({value:_this8.value,name:_this8.name}),_this8.nileChange({value:_this8.value,name:_this8.name}),_this8.emit("nile-tag-remove",{value:_this8.value,name:_this8.name,removedtagvalue:i.value});});}},{key:"selectionChanged",value:function selectionChanged(){var _this$renderItemConfi4,_this$originalOptionI;var i=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=b.createVirtualOptionsFromValues(this.value,i,this.getDisplayText.bind(this),(_this$renderItemConfi4=this.renderItemConfig)===null||_this$renderItemConfi4===void 0?void 0:_this$renderItemConfi4.getValue),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{var _this$selectedOptions2;var _i4=Array.isArray(this.value)?this.value[0]:this.value,_s2=(_this$selectedOptions2=this.selectedOptions[0])===null||_this$selectedOptions2===void 0?void 0:_this$selectedOptions2.getTextLabel();this.displayLabel=_s2||(_i4!==null&&_i4!==void 0?_i4:"");}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1,((_this$originalOptionI=this.originalOptionItems)===null||_this$originalOptionI===void 0?void 0:_this$originalOptionI.length)>0&&!this.searchValue&&(this.data=_toConsumableArray(this.originalOptionItems)),this.repaintOptionsContainer()),this.calculateTotalWidthOfTags();}},{key:"handleSearchFocus",value:function handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown);}},{key:"handleSearchBlur",value:function handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown);}},{key:"handleSearchChange",value:function handleSearchChange(i){this.searchValue=i.detail.value,this.portal&&this.portalManager.updatePortalAppendPosition(),this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.repaintOptionsContainer(),this.portalManager.resetMeasuredHeight());}},{key:"repaintOptionsContainer",value:function repaintOptionsContainer(){var _this9=this;this.resetScrollPosition(),this.updateComplete.then(function(){var _this9$shadowRoot;var i=(_this9$shadowRoot=_this9.shadowRoot)===null||_this9$shadowRoot===void 0?void 0:_this9$shadowRoot.querySelector(".virtualized");i&&(_this9.data.length<=5?i.classList.add("no-scroll"):i.classList.remove("no-scroll"));});}},{key:"handleScroll",value:function handleScroll(i){var _this10=this;if(this.showSelected)return;var s=i.target;this.emit("nile-scroll",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(function(){_this10.scrolling&&(_this10.scrolling=!1);},300);Math.ceil(s.scrollTop)>=Math.floor(s.scrollHeight-s.offsetHeight)&&!this.searchValue&&this.emit("nile-scroll-end",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name,isAtBottom:!0});}},{key:"filterVirtualOptions",value:function filterVirtualOptions(i){var _this$renderItemConfi5,_this11=this;var s=w.filterVirtualOptions(i,this.originalOptionItems,this.data,this.getDisplayText.bind(this),(_this$renderItemConfi5=this.renderItemConfig)===null||_this$renderItemConfi5===void 0?void 0:_this$renderItemConfi5.getSearchText);this.portal?(this.portalManager.updatePortalAppendPosition(),this.updateComplete.then(function(){requestAnimationFrame(function(){_this11.resetScrollPosition();});})):this.resetScrollPosition(),this.data=s.filteredItems,this.showNoResults=s.showNoResults,this.showSelected=!1,this.requestUpdate();}},{key:"handleInvalid",value:function handleInvalid(i){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(i);}},{key:"handleDisabledChange",value:function handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange());}},{key:"handleValueChange",value:function handleValueChange(){this.selectionChanged(),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handleDataChange",value:function handleDataChange(){this.data.length>0&&this.open&&!this.showSelected&&!this.searchValue&&(this.originalOptionItems=_toConsumableArray(this.data)),this.selectionChanged(),this.optionsLoading||this.loading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.portalManager.resetMeasuredHeight(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handleRenderItemConfigChange",value:function handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate());}},{key:"handleOptionsLoadingChange",value:function handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handlePortalAppendChange",value:function handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend());}},{key:"handleOpenChange",value:function(){var _handleOpenChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var _this$visibilityManag2,_this$visibilityManag3;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(!(this.open&&!this.disabled)){_context3.next=10;break;}(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup();this.showListbox=!0;_context3.next=5;return this.updateComplete;case 5:_context3.next=7;return this.handleOpen();case 7:this.portal&&this.portalManager.setupPortalAppend();_context3.next=15;break;case 10:(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup();_context3.next=13;return this.handleClose();case 13:this.showListbox=!1;this.portal&&this.portalManager.cleanupPortalAppend();case 15:case"end":return _context3.stop();}},_callee2,this);}));function handleOpenChange(){return _handleOpenChange.apply(this,arguments);}return handleOpenChange;}()},{key:"handleOpen",value:function(){var _handleOpen=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _this$data,_this$popup,_this$popup2;var _g,i,s;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:this.emit("nile-show",{value:this.value,name:this.name});this.addOpenListeners();this.showNoResults=!((_this$data=this.data)!==null&&_this$data!==void 0&&_this$data.length);_context4.next=5;return r(this);case 5:(_this$popup=this.popup)!==null&&_this$popup!==void 0&&_this$popup.popup&&(this.popup.popup.style.visibility="hidden");this.popup.active=!0;_context4.next=9;return new Promise(function(i){return requestAnimationFrame(i);});case 9:_context4.next=11;return new Promise(function(i){return requestAnimationFrame(i);});case 11:((_this$popup2=this.popup)===null||_this$popup2===void 0?void 0:_this$popup2.popup)&&(this.popup.popup.style.visibility="");_g=g(this,"select.show",{dir:"ltr"}),i=_g.keyframes,s=_g.options;_context4.next=15;return l(this.popup.popup,i,s);case 15:this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=_toConsumableArray(this.originalOptionItems),this.wasShowSelectedCheckedOnClose=!1);this.filterVirtualOptions("");this.resetScrollPosition();this.emit("nile-after-show",{value:this.value,name:this.name});case 19:case"end":return _context4.stop();}},_callee3,this);}));function handleOpen(){return _handleOpen.apply(this,arguments);}return handleOpen;}()},{key:"handleClose",value:function(){var _handleClose=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _this$popup3;var _g2,i,s;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:this.emit("nile-hide",{value:this.value,name:this.name});this.removeOpenListeners();this.wasShowSelectedCheckedOnClose=this.showSelected;_context5.next=5;return r(this);case 5:_g2=g(this,"select.hide",{dir:"ltr"}),i=_g2.keyframes,s=_g2.options;_context5.next=8;return l(this.popup.popup,i,s);case 8:this.popup.active=!1;(_this$popup3=this.popup)!==null&&_this$popup3!==void 0&&_this$popup3.popup&&(this.popup.popup.style.visibility="");this.searchValue="";this.portalManager.resetMeasuredHeight();this.emit("nile-after-hide",{value:this.value,name:this.name});case 13:case"end":return _context5.stop();}},_callee4,this);}));function handleClose(){return _handleClose.apply(this,arguments);}return handleClose;}()},{key:"show",value:function(){var _show=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:if(!(!this.open&&!this.disabled)){_context6.next=2;break;}return _context6.abrupt("return",(this.open=!0,v(this,"nile-after-show")));case 2:this.open=!1;case 3:case"end":return _context6.stop();}},_callee5,this);}));function show(){return _show.apply(this,arguments);}return show;}()},{key:"hide",value:function(){var _hide=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(){return _regeneratorRuntime().wrap(function _callee6$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:if(!(this.open&&!this.disabled)){_context7.next=2;break;}return _context7.abrupt("return",(this.open=!1,v(this,"nile-after-hide")));case 2:this.open=!1;case 3:case"end":return _context7.stop();}},_callee6,this);}));function hide(){return _hide.apply(this,arguments);}return hide;}()},{key:"checkValidity",value:function checkValidity(){return this.valueInput.checkValidity();}},{key:"getForm",value:function getForm(){return this.formControlController.getForm();}},{key:"reportValidity",value:function reportValidity(){return this.valueInput.reportValidity();}},{key:"setCustomValidity",value:function setCustomValidity(i){this.valueInput.setCustomValidity(i),this.formControlController.updateValidity();}},{key:"focus",value:function focus(i){this.displayInput.focus(i);}},{key:"blur",value:function blur(){this.displayInput.blur();}},{key:"onInputChange",value:function onInputChange(i){i.stopPropagation();}},{key:"render",value:function render(){var i=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var n=this.hasSlotController.test("label-suffix"),o=this.hasSlotController.test("custom-select"),t=!!this.label||!!i,c=this.clearable&&!this.disabled&&this.value.length>0,e=!!this.placeholder&&0===this.value.length,r=!!this.helpText,l=!!this.errorMessage;return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n ","\n ","\n </div>\n "])),j({"form-control":!0,"form-control--small":"small"===this.size,"form-control--medium":"medium"===this.size,"form-control--large":"large"===this.size,"form-control--has-label":t,"form-control--has-help-text":r}),this.renderLabel(t,n),this.renderFormControlInput(o,c,e,r,l));}},{key:"renderLabel",value:function renderLabel(i,n){return s(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <label\n id=\"label\"\n part=\"form-control-label\"\n class=\"form-control__label\"\n aria-hidden=","\n @click=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n ","\n "])),i?"false":"true",this.handleLabelClick,this.label,n?s(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"");}},{key:"renderFormControlInput",value:function renderFormControlInput(i,n,o,t,c){return s(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div part=\"form-control-input\" class=\"form-control-input\">\n ","\n ","\n </div>\n "])),this.renderPopup(i,n,o),this.renderHelpText(t,c));}},{key:"renderPopup",value:function renderPopup(i,n,o){return s(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-popup\n class=","\n placement=","\n strategy=","\n distance=\"6\"\n ?flip=","\n ?shift=","\n sync=","\n auto-size=\"vertical\"\n auto-size-padding=\"10\"\n exportparts=\"tag__content\"\n >\n ","\n ","\n ","\n </nile-popup>\n "])),j({select:!0,"select--warning":this.warning,"select--error":this.error,"select--success":this.success,"select--standard":!0,"select--filled":this.filled,"select--pill":this.pill,"select--open":this.open,"select--disabled":this.disabled,"select--multiple":this.multiple,"select--focused":this.hasFocus,"select--placeholder-visible":o,"select--top":"top"===this.placement,"select--bottom":"bottom"===this.placement,"select--small":"small"===this.size,"select--medium":"medium"===this.size,"select--large":"large"===this.size}),this.placement,this.portal||this.hoist?"fixed":"absolute",!this.portal,!this.portal,f(this.noWidthSync?void 0:"width"),this.renderCustomSelect(i),this.renderCombobox(i,n),this.showListbox?this.renderListbox():s(_templateObject6||(_templateObject6=_taggedTemplateLiteral([""]))));}},{key:"renderCustomSelect",value:function renderCustomSelect(i){return i?s(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<slot\n slot=\"anchor\"\n name=\"custom-select\"\n class=\"custom-select\"\n @keydown=","\n @mousedown=","\n ></slot>"])),this.handleComboboxKeyDown,this.handleComboboxMouseDown):s(_templateObject8||(_templateObject8=_taggedTemplateLiteral([""])));}},{key:"renderCombobox",value:function renderCombobox(i,n){return s(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div\n part=\"combobox\"\n class=","\n slot=\"anchor\"\n @keydown=","\n @mousedown=","\n >\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n </div>\n "])),j({select__combobox:!0,"select__hide-default":i}),this.handleComboboxKeyDown,this.handleComboboxMouseDown,this.renderPrefix(),this.renderDisplayInput(),this.renderTags(),this.renderValueInput(),this.renderClearButton(n),this.renderSuffix(),this.renderExpandIcon());}},{key:"renderPrefix",value:function renderPrefix(){return s(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <slot\n part=\"prefix\"\n name=\"prefix\"\n class=","\n ></slot>\n "])),j({select__prefix:!0,multiple:this.multiple}));}},{key:"renderDisplayInput",value:function renderDisplayInput(){return s(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n <input\n part=\"display-input\"\n class=\"select__display-input\"\n type=\"text\"\n placeholder=","\n .disabled=","\n .value=","\n autocomplete=\"off\"\n spellcheck=\"false\"\n autocapitalize=\"off\"\n readonly\n aria-controls=\"listbox\"\n aria-expanded=","\n aria-haspopup=\"listbox\"\n aria-labelledby=\"label\"\n aria-disabled=","\n aria-describedby=\"help-text\"\n role=\"combobox\"\n tabindex=\"0\"\n />\n "])),this.placeholder,this.disabled,this.displayLabel,this.open?"true":"false",this.disabled?"true":"false");}},{key:"renderTags",value:function renderTags(){var _this12=this;return this.multiple?s(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div part=\"tags\" class=\"select__tags\">\n ","\n </div>\n "])),this.selectedOptions.map(function(i,n){if(n<_this12.maxOptionsVisible||_this12.maxOptionsVisible<=0){var _o={select__invisible:n+1>_this12.oldMaxOptionsVisible&&_this12.maxOptionsVisible===1/0};return s(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n part=\"tag\"\n exportparts=\"\n base:tag__base,\n content:tag__content,\n remove-button:tag__remove-button,\n remove-button__base:tag__remove-button__base\n \"\n ?pill=","\n size=","\n removable\n @nile-remove=","\n >\n ","\n </nile-tag>\n "])),j(_o),_this12.pill,_this12.size,function(s){return _this12.handleTagRemove(s,i);},i.getTextLabel());}return n===_this12.maxOptionsVisible?s(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <span class=\"select__tags-count\"\n >+"," More\n </span>\n "])),_this12.selectedOptions.length-n):null;})):s(_templateObject15||(_templateObject15=_taggedTemplateLiteral([""])));}},{key:"renderValueInput",value:function renderValueInput(){var _this13=this;return s(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <input\n class=\"select__value-input\"\n type=\"text\"\n ?disabled=","\n ?required=","\n .value=","\n tabindex=\"-1\"\n aria-hidden=\"true\"\n @focus=","\n @invalid=","\n />\n "])),this.disabled,this.required,Array.isArray(this.value)?this.value.join(", "):this.value,function(){return _this13.focus();},this.handleInvalid);}},{key:"renderClearButton",value:function renderClearButton(i){return i?s(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <button\n part=\"clear-button\"\n class=\"select__clear\"\n type=\"button\"\n aria-label=\"clearEntry\"\n @mousedown=","\n @click=","\n tabindex=\"-1\"\n >\n <slot name=\"clear-icon\">\n <nile-icon name=\"var(--nile-icon-close, var(--ng-icon-x-close))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>\n </slot>\n </button>\n "])),this.handleClearMouseDown,this.handleClearClick):s(_templateObject18||(_templateObject18=_taggedTemplateLiteral([""])));}},{key:"renderSuffix",value:function renderSuffix(){return s(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <slot\n part=\"suffix\"\n name=\"suffix\"\n class=","\n ></slot>\n "])),j({select__suffix:!0}));}},{key:"renderExpandIcon",value:function renderExpandIcon(){return s(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <slot\n name=\"expand-icon\"\n part=\"expand-icon\"\n class=\"select__expand-icon\"\n >\n <nile-icon library=\"system\" name=\"var(--nile-icon-arrow-down, var(--ng-icon-chevron-down))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"></nile-icon>\n </slot>\n "])));}},{key:"renderListbox",value:function renderListbox(){return s(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n <div\n id=\"listbox\"\n role=\"listbox\"\n aria-expanded=","\n aria-multiselectable=","\n aria-labelledby=\"label\"\n part=\"listbox\"\n class=\"select__listbox "," ","\"\n tabindex=\"-1\"\n @mouseup=","\n style=","\n >\n ","\n ","\n ","\n ","\n </div>\n "])),this.open?"true":"false",this.multiple?"true":"false",this.searchEnabled?"select__search-enabled ":"",this.portal?"select__portal-append-hidden":"",this.handleOptionClick,this.portal?"display: none;":"",this.renderSearch(),this.renderLoader(),this.getVirtualizedContent(),this.renderFooter());}},{key:"renderSearch",value:function renderSearch(){return this.searchEnabled?s(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n <div part=\"search\" class=\"select__search\">\n <nile-input\n size=\"small\"\n clearable\n .value=","\n placeholder=\"","\"\n @nile-input=","\n @nile-focus=","\n @nile-change=\"","\"\n >\n <nile-icon name=\"var(--nile-icon-search, var(--ng-icon-search-lg))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>\n "])),this.searchValue,this.internalSearchPlaceHolder,this.handleSearchChange,this.handleSearchFocus,this.onInputChange):s(_templateObject23||(_templateObject23=_taggedTemplateLiteral([""])));}},{key:"renderLoader",value:function renderLoader(){return this.loading?s(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n <span part=\"loader\" class=\"virtual-select-loader\">\n <nile-loader size=\"sm\"></nile-loader>\n </span>\n "]))):this.optionsLoading?s(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["\n <span part=\"loader\" class=\"select__loader\">\n <nile-icon\n class=\"select__loader--icon\"\n name=\"button-loading-blue\"\n ></nile-icon>\n </span>\n "]))):s(_templateObject26||(_templateObject26=_taggedTemplateLiteral([""])));}},{key:"renderFooter",value:function renderFooter(){return this.multiple?s(_templateObject27||(_templateObject27=_taggedTemplateLiteral(["\n <div\n part=\"footer\"\n class=\"select__footer ","\"\n @click=\"","\"\n >\n <span\n @click=\"","\"\n style=\"cursor: pointer;\"\n >\n <nile-checkbox\n ?disabled=\"","\"\n ?checked=\"","\"\n >\n &nbsp; Show Selected</nile-checkbox\n >\n </span>\n ","\n </div>\n "])),this.loading?"loading":"",this.handleFooterClick,this.toggleShowSelected,0===this.selectedOptions.length,this.showSelected,0!==this.selectedOptions.length?s(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n <span\n class=\"select__clear\"\n @click=\"","\"\n >\n Clear All\n </span>\n "])),this.unSelectAll):""):s(_templateObject29||(_templateObject29=_taggedTemplateLiteral([""])));}},{key:"renderHelpText",value:function renderHelpText(i,n){return s(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n ","\n ","\n "])),i?s(_templateObject31||(_templateObject31=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",n?s(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"getVirtualizedContent",value:function getVirtualizedContent(){var _this$renderItemConfi6,_this$renderItemConfi7;return y.getVirtualizedContent(this.data,this.searchEnabled,this.getDisplayText.bind(this),this.value,this.multiple,(_this$renderItemConfi6=this.renderItemConfig)===null||_this$renderItemConfi6===void 0?void 0:_this$renderItemConfi6.getDisplayText,(_this$renderItemConfi7=this.renderItemConfig)===null||_this$renderItemConfi7===void 0?void 0:_this$renderItemConfi7.getValue,this.showNoResults,this.noResultsMessage,this.optionsLoading||this.loading,this.handleScroll.bind(this));}},{key:"nileInput",value:function nileInput(i){this.emit("nile-input",i);}},{key:"nileChange",value:function nileChange(i){this.emit("nile-change",i);}},{key:"updateValidity",value:function updateValidity(){var _this14=this;this.updateComplete.then(function(){_this14.formControlController.updateValidity();});}},{key:"calculateWidthOfSelectTagsDiv",value:function calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){var _i5=this.shadowRoot.querySelector(".select__tags");if(_i5){return _i5.offsetWidth-70;}}return null;}},{key:"calculateTotalWidthOfTags",value:function calculateTotalWidthOfTags(){var _this15=this;this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout(function(){var i=[];if(_this15.shadowRoot){_this15.shadowRoot.querySelectorAll("nile-tag").forEach(function(s){s instanceof HTMLElement&&i.push(s.offsetWidth);});}if(_this15.value.length!==i.length)return;var s=_this15.calculateWidthOfSelectTagsDiv();if(!s)return;var n=0,o=0;for(var _t=0;_t<i.length;_t++)if(n+=i[_t],n>s){o=_t;break;}_this15.maxOptionsVisible=o;},1);}},{key:"resetScrollPosition",value:function(){var _resetScrollPosition=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){return _regeneratorRuntime().wrap(function _callee7$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return this.portalManager.resetScrollPosition();case 2:case"end":return _context8.stop();}},_callee7,this);}));function resetScrollPosition(){return _resetScrollPosition.apply(this,arguments);}return resetScrollPosition;}()}]);}(u));$.styles=e,i([n(".select")],$.prototype,"popup",void 0),i([n(".select__combobox")],$.prototype,"combobox",void 0),i([n(".select__display-input")],$.prototype,"displayInput",void 0),i([n(".select__value-input")],$.prototype,"valueInput",void 0),i([n(".virtualized")],$.prototype,"virtualizedContainer",void 0),i([o()],$.prototype,"hasFocus",void 0),i([o()],$.prototype,"displayLabel",void 0),i([o()],$.prototype,"selectedOptions",void 0),i([o()],$.prototype,"oldValue",void 0),i([t()],$.prototype,"name",void 0),i([t({type:Array})],$.prototype,"data",void 0),i([o()],$.prototype,"originalOptionItems",void 0),i([t({converter:{fromAttribute:function fromAttribute(i){return i.split(" ");},toAttribute:function toAttribute(i){return i.join(" ");}}})],$.prototype,"value",void 0),i([a()],$.prototype,"defaultValue",void 0),i([t()],$.prototype,"size",void 0),i([t()],$.prototype,"placeholder",void 0),i([t({type:Boolean})],$.prototype,"autoResize",void 0),i([o()],$.prototype,"searchValue",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"searchEnabled",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"enableVisibilityEffect",void 0),i([t({attribute:"internal-search-placeholder"})],$.prototype,"internalSearchPlaceHolder",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"disableLocalSearch",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"optionsLoading",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"loading",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"multiple",void 0),i([t({attribute:"help-text",reflect:!0})],$.prototype,"helpText",void 0),i([t({attribute:"error-message",reflect:!0})],$.prototype,"errorMessage",void 0),i([t({type:Boolean})],$.prototype,"warning",void 0),i([t({type:Boolean})],$.prototype,"error",void 0),i([t({type:Boolean})],$.prototype,"success",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"clearable",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"open",void 0),i([t({type:Boolean})],$.prototype,"hoist",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"filled",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"pill",void 0),i([t()],$.prototype,"label",void 0),i([t({reflect:!0})],$.prototype,"placement",void 0),i([t({reflect:!0})],$.prototype,"form",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"required",void 0),i([t({type:Boolean})],$.prototype,"showNoResults",void 0),i([t({type:String})],$.prototype,"noResultsMessage",void 0),i([t({type:Boolean})],$.prototype,"showSelected",void 0),i([t({attribute:!1})],$.prototype,"renderItemConfig",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"blockValueChange",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"noWidthSync",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"portal",void 0),i([t({attribute:"max-options-visible",type:Number})],$.prototype,"maxOptionsVisible",void 0),i([o()],$.prototype,"oldMaxOptionsVisible",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"enableTabClose",void 0),i([o()],$.prototype,"showListbox",void 0),i([o()],$.prototype,"wasShowSelectedCheckedOnClose",void 0),i([d("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"handleDisabledChange",null),i([d("value",{waitUntilFirstUpdate:!0})],$.prototype,"handleValueChange",null),i([d("data",{waitUntilFirstUpdate:!0})],$.prototype,"handleDataChange",null),i([d("renderItemConfig",{waitUntilFirstUpdate:!0})],$.prototype,"handleRenderItemConfigChange",null),i([d("optionsLoading",{waitUntilFirstUpdate:!0})],$.prototype,"handleOptionsLoadingChange",null),i([d("portal",{waitUntilFirstUpdate:!0})],$.prototype,"handlePortalAppendChange",null),i([d("open",{waitUntilFirstUpdate:!0})],$.prototype,"handleOpenChange",null),_export("N",$=i([c("nile-virtual-select")],$)),m("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),m("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});}};});
5
+ */_export("t",k=/*#__PURE__*/function(){function k(i,_ref){var _this=this;var s=_ref.target,n=_ref.config,o=_ref.callback,t=_ref.skipInitial;_classCallCheck(this,k);this.t=new Set(),this.o=!1,this.i=!1,this.h=i,null!==s&&this.t.add(s!==null&&s!==void 0?s:i),this.l=n,this.o=t!==null&&t!==void 0?t:this.o,this.callback=o,window.ResizeObserver?(this.u=new ResizeObserver(function(i){_this.handleChanges(i),_this.h.requestUpdate();}),i.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.");}return _createClass(k,[{key:"handleChanges",value:function handleChanges(i){var _this$callback;this.value=(_this$callback=this.callback)===null||_this$callback===void 0?void 0:_this$callback.call(this,i,this.u);}},{key:"hostConnected",value:function hostConnected(){var _iterator=_createForOfIteratorHelper(this.t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i=_step.value;this.observe(_i);}}catch(err){_iterator.e(err);}finally{_iterator.f();}}},{key:"hostDisconnected",value:function hostDisconnected(){this.disconnect();}},{key:"hostUpdated",value:function(){var _hostUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:!this.o&&this.i&&this.handleChanges([]),this.i=!1;case 1:case"end":return _context2.stop();}},_callee,this);}));function hostUpdated(){return _hostUpdated.apply(this,arguments);}return hostUpdated;}()},{key:"observe",value:function observe(i){this.t.add(i),this.u.observe(i,this.l),this.i=!0,this.h.requestUpdate();}},{key:"unobserve",value:function unobserve(i){this.t["delete"](i),this.u.unobserve(i);}},{key:"disconnect",value:function disconnect(){this.u.disconnect();}}]);}());_export("N",$=/*#__PURE__*/function(_u){function $(){var _this2;_classCallCheck(this,$);_this2=_callSuper(this,$,arguments),_this2.formControlController=new p(_assertThisInitialized(_this2),{assumeInteractionOn:["nile-blur","nile-input"]}),_this2.hasSlotController=new h(_assertThisInitialized(_this2),"help-text","label"),_this2.portalManager=new _(_assertThisInitialized(_this2)),_this2.hasFocus=!1,_this2.displayLabel="",_this2.selectedOptions=[],_this2.oldValue="",_this2.scrolling=!1,_this2.name="",_this2.data=[],_this2.originalOptionItems=[],_this2.value="",_this2.defaultValue="",_this2.size="medium",_this2.placeholder="Select...",_this2.autoResize=!1,_this2.searchValue="",_this2.searchEnabled=!1,_this2.enableVisibilityEffect=!1,_this2.internalSearchPlaceHolder="Search...",_this2.disableLocalSearch=!1,_this2.optionsLoading=!1,_this2.loading=!1,_this2.multiple=!1,_this2.helpText="",_this2.errorMessage="",_this2.warning=!1,_this2.error=!1,_this2.success=!1,_this2.disabled=!1,_this2.clearable=!1,_this2.open=!1,_this2.hoist=!1,_this2.filled=!1,_this2.pill=!1,_this2.label="",_this2.placement="bottom",_this2.form="",_this2.required=!1,_this2.showNoResults=!1,_this2.noResultsMessage="No results found",_this2.showSelected=!1,_this2.blockValueChange=!1,_this2.noWidthSync=!1,_this2.portal=!1,_this2.maxOptionsVisible=3,_this2.oldMaxOptionsVisible=1,_this2.enableTabClose=!1,_this2.showListbox=!1,_this2.wasShowSelectedCheckedOnClose=!1,_this2.handleDocumentMouseDown=function(i){if(!_this2.open)return;var s=i.composedPath(),n=s.includes(_assertThisInitialized(_this2)),o=_this2.popup&&s.includes(_this2.popup),t=_this2.portal&&_this2.portalManager.portalContainerElement&&s.includes(_this2.portalManager.portalContainerElement);n||o||t||_this2.hide();},_this2.handleWindowError=function(i){var _i$error;(((_i$error=i.error)===null||_i$error===void 0?void 0:_i$error.message)||i.message||"").includes("Cannot read properties of null (reading 'insertBefore')")&&i.preventDefault();},_this2.handleWindowResize=function(){_this2.portalManager.updatePortalAppendPosition();},_this2.handleWindowScroll=function(){_this2.portalManager.updatePortalAppendPosition();},_this2.resizeController=new k(_assertThisInitialized(_this2),{callback:function callback(i){var _iterator2=_createForOfIteratorHelper(i),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _s=_step2.value;_s.target.classList.contains("select__tags")&&_this2.calculateTotalWidthOfTags();}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}});return _this2;}_inherits($,_u);return _createClass($,[{key:"validity",get:function get(){var _this$valueInput;return(_this$valueInput=this.valueInput)===null||_this$valueInput===void 0?void 0:_this$valueInput.validity;}},{key:"validationMessage",get:function get(){var _this$valueInput$vali,_this$valueInput2;return(_this$valueInput$vali=(_this$valueInput2=this.valueInput)===null||_this$valueInput2===void 0?void 0:_this$valueInput2.validationMessage)!==null&&_this$valueInput$vali!==void 0?_this$valueInput$vali:"";}},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet($,"connectedCallback",this,3)([]),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then(function(){_this3.value&&_this3.data.length>0&&_this3.selectionChanged();});}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;this.removeOpenListeners(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.scrollTimeout&&(clearTimeout(this.scrollTimeout),this.scrollTimeout=void 0),this.portalManager.cleanupPortalAppend();}},{key:"updated",value:function updated(i){if(i.has("value")&&this.selectionChanged(),i.has("autoResize")){var _this$shadowRoot;var _i2=(_this$shadowRoot=this.shadowRoot)===null||_this$shadowRoot===void 0?void 0:_this$shadowRoot.querySelector(".select__tags");this.autoResize&&_i2?this.resizeController.observe(_i2):_i2&&this.resizeController.unobserve(_i2);}}},{key:"initializeComponent",value:function initializeComponent(){this.open=!1,this.emit("nile-init");}},{key:"getDisplayText",value:function getDisplayText(i){var _this$renderItemConfi;return(_this$renderItemConfi=this.renderItemConfig)!==null&&_this$renderItemConfi!==void 0&&_this$renderItemConfi.getDisplayText?this.renderItemConfig.getDisplayText(i):(i===null||i===void 0?void 0:i.label)||(i===null||i===void 0?void 0:i.name)||(i===null||i===void 0?void 0:i.toString())||"";}},{key:"getItemValue",value:function getItemValue(i){var _this$renderItemConfi2;return(_this$renderItemConfi2=this.renderItemConfig)!==null&&_this$renderItemConfi2!==void 0&&_this$renderItemConfi2.getValue?this.renderItemConfig.getValue(i):(i===null||i===void 0?void 0:i.value)||i;}},{key:"getSearchText",value:function getSearchText(i){var _this$renderItemConfi3;return(_this$renderItemConfi3=this.renderItemConfig)!==null&&_this$renderItemConfi3!==void 0&&_this$renderItemConfi3.getSearchText?this.renderItemConfig.getSearchText(i):this.getDisplayText(i);}},{key:"setupEventListeners",value:function setupEventListeners(){this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowError=this.handleWindowError.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this);}},{key:"addOpenListeners",value:function addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),window.addEventListener("error",this.handleWindowError),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0));}},{key:"removeOpenListeners",value:function removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("error",this.handleWindowError),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0);}},{key:"handleFocus",value:function handleFocus(){this.hasFocus=!0,this.emit("nile-focus");}},{key:"handleBlur",value:function handleBlur(){this.hasFocus=!1,this.emit("nile-blur");}},{key:"firstUpdated",value:function firstUpdated(i){var _this4=this;this.visibilityManager=new x({host:this,target:this.combobox,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this4.open;},onAnchorOutOfView:function onAnchorOutOfView(){_this4.hide(),_this4.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view",name:_this4.name});},onDocumentHidden:function onDocumentHidden(){_this4.hide(),_this4.emit("nile-visibility-change",{visible:!1,reason:"document-hidden",name:_this4.name});},emit:function emit(i,s){return _this4.emit("nile-".concat(i),s);}});}},{key:"handleDocumentFocusIn",value:function handleDocumentFocusIn(i){if(!this.open)return;var s=i.composedPath(),n=s.includes(this),o=this.popup&&s.includes(this.popup),t=this.portal&&this.portalManager.portalContainerElement&&s.includes(this.portalManager.portalContainerElement);n||o||t||this.hide();}},{key:"handleDocumentKeyDown",value:function handleDocumentKeyDown(i){this.shouldIgnoreKeyPress(i)||(this.isEscapeKey(i)&&this.handleEscapeKey(i),this.isEnterOrSpaceKey(i)&&this.handleEnterOrSpaceKey(i));}},{key:"shouldIgnoreKeyPress",value:function shouldIgnoreKeyPress(i){var s=i.target,n=null!==s.closest(".select__clear"),o=null!==s.closest("nile-icon-button");return n||o;}},{key:"isEscapeKey",value:function isEscapeKey(i){return"Escape"===i.key&&this.open;}},{key:"handleEscapeKey",value:function handleEscapeKey(i){i.preventDefault(),i.stopPropagation(),this.hide(),this.displayInput.focus({preventScroll:!0});}},{key:"isEnterOrSpaceKey",value:function isEnterOrSpaceKey(i){return"Enter"===i.key||" "===i.key;}},{key:"handleEnterOrSpaceKey",value:function handleEnterOrSpaceKey(i){i.preventDefault(),i.stopImmediatePropagation(),this.open?this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0})):this.show();}},{key:"handleFooterClick",value:function handleFooterClick(i){i.stopPropagation(),i.preventDefault();}},{key:"toggleShowSelected",value:function toggleShowSelected(i){var _this$selectedOptions,_this5=this;if(i.stopPropagation(),i.preventDefault(),0!==((_this$selectedOptions=this.selectedOptions)===null||_this$selectedOptions===void 0?void 0:_this$selectedOptions.length)){if(this.showSelected=!this.showSelected,this.showSelected){this.searchValue="";var _i3=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter(function(s){var n=_this5.getItemValue(s);return _i3.some(function(i){return String(i)===String(n);});});}else this.data=_toConsumableArray(this.originalOptionItems);this.portalManager.resetMeasuredHeight(),this.requestUpdate(),this.repaintOptionsContainer();}}},{key:"unSelectAll",value:function unSelectAll(){this.showSelected=!1,this.value=this.multiple?[]:"",this.data=_toConsumableArray(this.originalOptionItems),this.selectionChanged(),this.emit("nile-change",{value:this.value,name:this.name}),this.emit("nile-clear",{value:this.multiple?this.value:"",name:this.name}),this.resetScrollPosition();}},{key:"handleLabelClick",value:function handleLabelClick(){this.displayInput.focus(),this.hide();}},{key:"handleComboboxMouseDown",value:function handleComboboxMouseDown(i){this.shouldIgnoreComboboxClick(i)||(i.preventDefault(),this.displayInput.focus({preventScroll:!0}),this.open=!this.open);}},{key:"shouldIgnoreComboboxClick",value:function shouldIgnoreComboboxClick(i){var s=i.composedPath().some(function(i){return i instanceof Element&&"nile-icon-button"===i.tagName.toLowerCase();});return this.disabled||s;}},{key:"handleComboboxKeyDown",value:function handleComboboxKeyDown(i){this.isEnterOrSpaceKey(i)&&(i.preventDefault(),this.open=!this.open);}},{key:"handleClearClick",value:function handleClearClick(i){i.stopPropagation(),this.clearSelection();}},{key:"clearSelection",value:function clearSelection(){var _this6=this;this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then(function(){_this6.nileInput({value:_this6.value,name:_this6.name}),_this6.nileChange({value:_this6.value,name:_this6.name}),_this6.emit("nile-clear");});}},{key:"handleClearMouseDown",value:function handleClearMouseDown(i){i.stopPropagation();}},{key:"handleOptionClick",value:function handleOptionClick(i){var s=i.target.closest("nile-option");if(this.shouldBlockValueChange(s))return;var n=this.value;this.oldValue=n,s&&!s.disabled&&this.handleOptionSelection(s);}},{key:"shouldBlockValueChange",value:function shouldBlockValueChange(i){return!(!this.blockValueChange||!i)&&(this.emit("nile-block-change",{value:i===null||i===void 0?void 0:i.value,name:this.name}),this.hide(),!0);}},{key:"handleOptionSelection",value:function handleOptionSelection(i){var _this7=this;var s=i.value;this.multiple?this.toggleOptionSelection(s):this.setSelectedOptions(s),this.updateComplete.then(function(){return _this7.displayInput.focus({preventScroll:!0});}),this.value!==this.oldValue&&this.updateComplete.then(function(){_this7.nileInput({value:_this7.value,name:_this7.name}),_this7.nileChange({value:_this7.value,name:_this7.name});}),this.multiple||(this.hide(),this.displayInput.focus({preventScroll:!0}));}},{key:"setSelectedOptions",value:function setSelectedOptions(i){this.value=i,this.selectionChanged();}},{key:"toggleOptionSelection",value:function toggleOptionSelection(i){var s=Array.isArray(this.value)?this.value:[];s.includes(i)?this.value=s.filter(function(s){return s!==i;}):this.value=[].concat(_toConsumableArray(s),[i]),this.selectionChanged();}},{key:"handleTagRemove",value:function handleTagRemove(i,s){i.stopPropagation(),this.disabled||(this.removeTagFromSelection(s),this.emitTagRemovalEvent(s));}},{key:"removeTagFromSelection",value:function removeTagFromSelection(i){var s=this.value;Array.isArray(s)||(s=s?[s]:[]);var n=s.filter(function(s){return s!==i.value;});this.value=n,this.selectionChanged();}},{key:"emitTagRemovalEvent",value:function emitTagRemovalEvent(i){var _this8=this;this.updateComplete.then(function(){_this8.nileInput({value:_this8.value,name:_this8.name}),_this8.nileChange({value:_this8.value,name:_this8.name}),_this8.emit("nile-tag-remove",{value:_this8.value,name:_this8.name,removedtagvalue:i.value});});}},{key:"selectionChanged",value:function selectionChanged(){var _this$renderItemConfi4,_this$originalOptionI;var i=this.originalOptionItems.length>0?this.originalOptionItems:this.data;if(this.selectedOptions=b.createVirtualOptionsFromValues(this.value,i,this.getDisplayText.bind(this),(_this$renderItemConfi4=this.renderItemConfig)===null||_this$renderItemConfi4===void 0?void 0:_this$renderItemConfi4.getValue),this.multiple)this.placeholder&&0===this.value.length?this.displayLabel="":this.displayLabel=this.selectedOptions.length+" selected";else{var _this$selectedOptions2;var _i4=Array.isArray(this.value)?this.value[0]:this.value,_s2=(_this$selectedOptions2=this.selectedOptions[0])===null||_this$selectedOptions2===void 0?void 0:_this$selectedOptions2.getTextLabel();this.displayLabel=_s2||(_i4!==null&&_i4!==void 0?_i4:"");}this.updateValidity(),0===this.selectedOptions.length&&(this.showSelected=!1,((_this$originalOptionI=this.originalOptionItems)===null||_this$originalOptionI===void 0?void 0:_this$originalOptionI.length)>0&&!this.searchValue&&(this.data=_toConsumableArray(this.originalOptionItems)),this.repaintOptionsContainer()),this.calculateTotalWidthOfTags();}},{key:"handleSearchFocus",value:function handleSearchFocus(){document.removeEventListener("keydown",this.handleDocumentKeyDown);}},{key:"handleSearchBlur",value:function handleSearchBlur(){document.addEventListener("keydown",this.handleDocumentKeyDown);}},{key:"handleSearchChange",value:function handleSearchChange(i){this.searchValue=i.detail.value,this.portal&&this.portalManager.updatePortalAppendPosition(),this.emit("nile-search",{query:this.searchValue,name:this.name}),this.disableLocalSearch||(this.filterVirtualOptions(this.searchValue),this.repaintOptionsContainer(),this.portalManager.resetMeasuredHeight());}},{key:"repaintOptionsContainer",value:function repaintOptionsContainer(){var _this9=this;this.resetScrollPosition(),this.updateComplete.then(function(){var _this9$shadowRoot;var i=(_this9$shadowRoot=_this9.shadowRoot)===null||_this9$shadowRoot===void 0?void 0:_this9$shadowRoot.querySelector(".virtualized");i&&(_this9.data.length<=5?i.classList.add("no-scroll"):i.classList.remove("no-scroll"));});}},{key:"handleScroll",value:function handleScroll(i){var _this10=this;if(this.showSelected)return;var s=i.target;this.emit("nile-scroll",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name}),this.scrolling||(this.scrolling=!0,this.emit("nile-scroll-start",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name})),clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(function(){_this10.scrolling&&(_this10.scrolling=!1);},300);Math.ceil(s.scrollTop)>=Math.floor(s.scrollHeight-s.offsetHeight)&&!this.searchValue&&this.emit("nile-scroll-end",{scrollTop:s.scrollTop,scrollLeft:s.scrollLeft,name:this.name,isAtBottom:!0});}},{key:"filterVirtualOptions",value:function filterVirtualOptions(i){var _this$renderItemConfi5,_this11=this;var s=w.filterVirtualOptions(i,this.originalOptionItems,this.data,this.getDisplayText.bind(this),(_this$renderItemConfi5=this.renderItemConfig)===null||_this$renderItemConfi5===void 0?void 0:_this$renderItemConfi5.getSearchText);this.portal?(this.portalManager.updatePortalAppendPosition(),this.updateComplete.then(function(){requestAnimationFrame(function(){_this11.resetScrollPosition();});})):this.resetScrollPosition(),this.data=s.filteredItems,this.showNoResults=s.showNoResults,this.showSelected=!1,this.requestUpdate();}},{key:"handleInvalid",value:function handleInvalid(i){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(i);}},{key:"handleDisabledChange",value:function handleDisabledChange(){this.disabled&&(this.open=!1,this.handleOpenChange());}},{key:"handleValueChange",value:function handleValueChange(){this.selectionChanged(),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handleDataChange",value:function handleDataChange(){this.data.length>0&&this.open&&!this.showSelected&&!this.searchValue&&(this.originalOptionItems=_toConsumableArray(this.data)),this.selectionChanged(),this.optionsLoading||this.loading||0!==this.data.length?this.data.length>0&&(this.showNoResults=!1):this.showNoResults=!0,this.requestUpdate(),this.portalManager.resetMeasuredHeight(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handleRenderItemConfigChange",value:function handleRenderItemConfigChange(){this.value&&this.data.length>0&&(this.selectionChanged(),this.requestUpdate());}},{key:"handleOptionsLoadingChange",value:function handleOptionsLoadingChange(){this.optionsLoading||0!==this.data.length||(this.showNoResults=!0),this.requestUpdate(),this.portal&&this.portalManager.portalContainerElement&&this.portalManager.updatePortalAppendPosition();}},{key:"handlePortalAppendChange",value:function handlePortalAppendChange(){this.open&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend());}},{key:"handleOpenChange",value:function(){var _handleOpenChange=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var _this$visibilityManag2,_this$visibilityManag3;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(!(this.open&&!this.disabled)){_context3.next=10;break;}(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup();this.showListbox=!0;_context3.next=5;return this.updateComplete;case 5:_context3.next=7;return this.handleOpen();case 7:this.portal&&this.portalManager.setupPortalAppend();_context3.next=15;break;case 10:(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup();_context3.next=13;return this.handleClose();case 13:this.showListbox=!1;this.portal&&this.portalManager.cleanupPortalAppend();case 15:case"end":return _context3.stop();}},_callee2,this);}));function handleOpenChange(){return _handleOpenChange.apply(this,arguments);}return handleOpenChange;}()},{key:"handleOpen",value:function(){var _handleOpen=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _this$data,_this$popup,_this$popup2;var _g,i,s;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:this.emit("nile-show",{value:this.value,name:this.name});this.addOpenListeners();this.showNoResults=!((_this$data=this.data)!==null&&_this$data!==void 0&&_this$data.length);_context4.next=5;return r(this);case 5:(_this$popup=this.popup)!==null&&_this$popup!==void 0&&_this$popup.popup&&(this.popup.popup.style.visibility="hidden");this.popup.active=!0;_context4.next=9;return new Promise(function(i){return requestAnimationFrame(i);});case 9:_context4.next=11;return new Promise(function(i){return requestAnimationFrame(i);});case 11:((_this$popup2=this.popup)===null||_this$popup2===void 0?void 0:_this$popup2.popup)&&(this.popup.popup.style.visibility="");_g=g(this,"select.show",{dir:"ltr"}),i=_g.keyframes,s=_g.options;_context4.next=15;return l(this.popup.popup,i,s);case 15:this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=_toConsumableArray(this.originalOptionItems),this.wasShowSelectedCheckedOnClose=!1);this.filterVirtualOptions("");this.resetScrollPosition();this.emit("nile-after-show",{value:this.value,name:this.name});case 19:case"end":return _context4.stop();}},_callee3,this);}));function handleOpen(){return _handleOpen.apply(this,arguments);}return handleOpen;}()},{key:"handleClose",value:function(){var _handleClose=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _this$popup3;var _g2,i,s;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:this.emit("nile-hide",{value:this.value,name:this.name});this.removeOpenListeners();this.wasShowSelectedCheckedOnClose=this.showSelected;_context5.next=5;return r(this);case 5:_g2=g(this,"select.hide",{dir:"ltr"}),i=_g2.keyframes,s=_g2.options;_context5.next=8;return l(this.popup.popup,i,s);case 8:this.popup.active=!1;(_this$popup3=this.popup)!==null&&_this$popup3!==void 0&&_this$popup3.popup&&(this.popup.popup.style.visibility="");this.searchValue="";this.portalManager.resetMeasuredHeight();this.emit("nile-after-hide",{value:this.value,name:this.name});case 13:case"end":return _context5.stop();}},_callee4,this);}));function handleClose(){return _handleClose.apply(this,arguments);}return handleClose;}()},{key:"show",value:function(){var _show=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:if(!(!this.open&&!this.disabled)){_context6.next=2;break;}return _context6.abrupt("return",(this.open=!0,v(this,"nile-after-show")));case 2:this.open=!1;case 3:case"end":return _context6.stop();}},_callee5,this);}));function show(){return _show.apply(this,arguments);}return show;}()},{key:"hide",value:function(){var _hide=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(){return _regeneratorRuntime().wrap(function _callee6$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:if(!(this.open&&!this.disabled)){_context7.next=2;break;}return _context7.abrupt("return",(this.open=!1,v(this,"nile-after-hide")));case 2:this.open=!1;case 3:case"end":return _context7.stop();}},_callee6,this);}));function hide(){return _hide.apply(this,arguments);}return hide;}()},{key:"checkValidity",value:function checkValidity(){return this.valueInput.checkValidity();}},{key:"getForm",value:function getForm(){return this.formControlController.getForm();}},{key:"reportValidity",value:function reportValidity(){return this.valueInput.reportValidity();}},{key:"setCustomValidity",value:function setCustomValidity(i){this.valueInput.setCustomValidity(i),this.formControlController.updateValidity();}},{key:"focus",value:function focus(i){this.displayInput.focus(i);}},{key:"blur",value:function blur(){this.displayInput.blur();}},{key:"onInputChange",value:function onInputChange(i){i.stopPropagation();}},{key:"render",value:function render(){var i=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var n=this.hasSlotController.test("label-suffix"),o=this.hasSlotController.test("custom-select"),t=!!this.label||!!i,c=this.clearable&&!this.disabled&&this.value.length>0,e=!!this.placeholder&&0===this.value.length,r=!!this.helpText,l=!!this.errorMessage;return s(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n ","\n ","\n </div>\n "])),j({"form-control":!0,"form-control--small":"small"===this.size,"form-control--medium":"medium"===this.size,"form-control--large":"large"===this.size,"form-control--has-label":t,"form-control--has-help-text":r}),this.renderLabel(t,n),this.renderFormControlInput(o,c,e,r,l));}},{key:"renderLabel",value:function renderLabel(i,n){return s(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <label\n id=\"label\"\n part=\"form-control-label\"\n class=\"form-control__label\"\n aria-hidden=","\n @click=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n ","\n "])),i?"false":"true",this.handleLabelClick,this.label,n?s(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"");}},{key:"renderFormControlInput",value:function renderFormControlInput(i,n,o,t,c){return s(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div part=\"form-control-input\" class=\"form-control-input\">\n ","\n ","\n </div>\n "])),this.renderPopup(i,n,o),this.renderHelpText(t,c));}},{key:"renderPopup",value:function renderPopup(i,n,o){return s(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-popup\n class=","\n placement=","\n strategy=","\n distance=\"6\"\n ?flip=","\n ?shift=","\n sync=","\n auto-size=\"vertical\"\n auto-size-padding=\"10\"\n exportparts=\"tag__content\"\n >\n ","\n ","\n ","\n </nile-popup>\n "])),j({select:!0,"select--warning":this.warning,"select--error":this.error,"select--success":this.success,"select--standard":!0,"select--filled":this.filled,"select--pill":this.pill,"select--open":this.open,"select--disabled":this.disabled,"select--multiple":this.multiple,"select--focused":this.hasFocus,"select--placeholder-visible":o,"select--top":"top"===this.placement,"select--bottom":"bottom"===this.placement,"select--small":"small"===this.size,"select--medium":"medium"===this.size,"select--large":"large"===this.size}),this.placement,this.portal||this.hoist?"fixed":"absolute",!this.portal,!this.portal,f(this.noWidthSync?void 0:"width"),this.renderCustomSelect(i),this.renderCombobox(i,n),this.showListbox?this.renderListbox():s(_templateObject6||(_templateObject6=_taggedTemplateLiteral([""]))));}},{key:"renderCustomSelect",value:function renderCustomSelect(i){return i?s(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<slot\n slot=\"anchor\"\n name=\"custom-select\"\n class=\"custom-select\"\n @keydown=","\n @mousedown=","\n ></slot>"])),this.handleComboboxKeyDown,this.handleComboboxMouseDown):s(_templateObject8||(_templateObject8=_taggedTemplateLiteral([""])));}},{key:"renderCombobox",value:function renderCombobox(i,n){return s(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div\n part=\"combobox\"\n class=","\n slot=\"anchor\"\n @keydown=","\n @mousedown=","\n >\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n </div>\n "])),j({select__combobox:!0,"select__hide-default":i}),this.handleComboboxKeyDown,this.handleComboboxMouseDown,this.renderPrefix(),this.renderDisplayInput(),this.renderTags(),this.renderValueInput(),this.renderClearButton(n),this.renderSuffix(),this.renderExpandIcon());}},{key:"renderPrefix",value:function renderPrefix(){return s(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <slot\n part=\"prefix\"\n name=\"prefix\"\n class=","\n ></slot>\n "])),j({select__prefix:!0,multiple:this.multiple}));}},{key:"renderDisplayInput",value:function renderDisplayInput(){return s(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n <input\n part=\"display-input\"\n class=\"select__display-input\"\n type=\"text\"\n placeholder=","\n .disabled=","\n .value=","\n autocomplete=\"off\"\n spellcheck=\"false\"\n autocapitalize=\"off\"\n readonly\n aria-controls=\"listbox\"\n aria-expanded=","\n aria-haspopup=\"listbox\"\n aria-labelledby=\"label\"\n aria-disabled=","\n aria-describedby=\"help-text\"\n role=\"combobox\"\n tabindex=\"0\"\n />\n "])),this.placeholder,this.disabled,this.displayLabel,this.open?"true":"false",this.disabled?"true":"false");}},{key:"renderTags",value:function renderTags(){var _this12=this;return this.multiple?s(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div part=\"tags\" class=\"select__tags\">\n ","\n </div>\n "])),this.selectedOptions.map(function(i,n){if(n<_this12.maxOptionsVisible||_this12.maxOptionsVisible<=0){var _o={select__invisible:n+1>_this12.oldMaxOptionsVisible&&_this12.maxOptionsVisible===1/0};return s(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n part=\"tag\"\n exportparts=\"\n base:tag__base,\n content:tag__content,\n remove-button:tag__remove-button,\n remove-button__base:tag__remove-button__base\n \"\n ?pill=","\n size=","\n removable\n @nile-remove=","\n >\n ","\n </nile-tag>\n "])),j(_o),_this12.pill,_this12.size,function(s){return _this12.handleTagRemove(s,i);},i.getTextLabel());}return n===_this12.maxOptionsVisible?s(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <span class=\"select__tags-count\"\n >+"," More\n </span>\n "])),_this12.selectedOptions.length-n):null;})):s(_templateObject15||(_templateObject15=_taggedTemplateLiteral([""])));}},{key:"renderValueInput",value:function renderValueInput(){var _this13=this;return s(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <input\n class=\"select__value-input\"\n type=\"text\"\n ?disabled=","\n ?required=","\n .value=","\n tabindex=\"-1\"\n aria-hidden=\"true\"\n @focus=","\n @invalid=","\n />\n "])),this.disabled,this.required,Array.isArray(this.value)?this.value.join(", "):this.value,function(){return _this13.focus();},this.handleInvalid);}},{key:"renderClearButton",value:function renderClearButton(i){return i?s(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <button\n part=\"clear-button\"\n class=\"select__clear\"\n type=\"button\"\n aria-label=\"clearEntry\"\n @mousedown=","\n @click=","\n tabindex=\"-1\"\n >\n <slot name=\"clear-icon\">\n <nile-icon name=\"var(--nile-icon-close, var(--ng-icon-x-close))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>\n </slot>\n </button>\n "])),this.handleClearMouseDown,this.handleClearClick):s(_templateObject18||(_templateObject18=_taggedTemplateLiteral([""])));}},{key:"renderSuffix",value:function renderSuffix(){return s(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <slot\n part=\"suffix\"\n name=\"suffix\"\n class=","\n ></slot>\n "])),j({select__suffix:!0}));}},{key:"renderExpandIcon",value:function renderExpandIcon(){return s(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <slot\n name=\"expand-icon\"\n part=\"expand-icon\"\n class=\"select__expand-icon\"\n >\n <nile-icon library=\"system\" name=\"var(--nile-icon-arrow-down, var(--ng-icon-chevron-down))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"></nile-icon>\n </slot>\n "])));}},{key:"renderListbox",value:function renderListbox(){return s(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n <div\n id=\"listbox\"\n role=\"listbox\"\n aria-expanded=","\n aria-multiselectable=","\n aria-labelledby=\"label\"\n part=\"listbox\"\n class=\"select__listbox "," ","\"\n tabindex=\"-1\"\n @mouseup=","\n style=","\n >\n ","\n ","\n ","\n ","\n </div>\n "])),this.open?"true":"false",this.multiple?"true":"false",this.searchEnabled?"select__search-enabled ":"",this.portal?"select__portal-append-hidden":"",this.handleOptionClick,this.portal?"display: none;":"",this.renderSearch(),this.renderLoader(),this.getVirtualizedContent(),this.renderFooter());}},{key:"renderSearch",value:function renderSearch(){return this.searchEnabled?s(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n <div part=\"search\" class=\"select__search\">\n <nile-input\n size=\"small\"\n clearable\n .value=","\n placeholder=\"","\"\n @nile-input=","\n @nile-focus=","\n @nile-change=\"","\"\n >\n <nile-icon name=\"var(--nile-icon-search, var(--ng-icon-search-lg))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>\n "])),this.searchValue,this.internalSearchPlaceHolder,this.handleSearchChange,this.handleSearchFocus,this.onInputChange):s(_templateObject23||(_templateObject23=_taggedTemplateLiteral([""])));}},{key:"renderLoader",value:function renderLoader(){return this.loading?s(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n <span part=\"loader\" class=\"virtual-select-loader\">\n <nile-loader size=\"sm\"></nile-loader>\n </span>\n "]))):this.optionsLoading?s(_templateObject25||(_templateObject25=_taggedTemplateLiteral(["\n <span part=\"loader\" class=\"select__loader\">\n <nile-icon\n class=\"select__loader--icon\"\n name=\"button-loading-blue\"\n ></nile-icon>\n </span>\n "]))):s(_templateObject26||(_templateObject26=_taggedTemplateLiteral([""])));}},{key:"renderFooter",value:function renderFooter(){return this.multiple?s(_templateObject27||(_templateObject27=_taggedTemplateLiteral(["\n <div\n part=\"footer\"\n class=\"select__footer ","\"\n @click=\"","\"\n >\n <span\n @click=\"","\"\n style=\"cursor: pointer;\"\n >\n <nile-checkbox\n ?disabled=\"","\"\n ?checked=\"","\"\n >\n &nbsp; Show Selected</nile-checkbox\n >\n </span>\n ","\n </div>\n "])),this.loading?"loading":"",this.handleFooterClick,this.toggleShowSelected,0===this.selectedOptions.length,this.showSelected,0!==this.selectedOptions.length?s(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n <span\n class=\"select__clear\"\n @click=\"","\"\n >\n Clear All\n </span>\n "])),this.unSelectAll):""):s(_templateObject29||(_templateObject29=_taggedTemplateLiteral([""])));}},{key:"renderHelpText",value:function renderHelpText(i,n){return s(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n ","\n ","\n "])),i?s(_templateObject31||(_templateObject31=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",n?s(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"getVirtualizedContent",value:function getVirtualizedContent(){var _this$renderItemConfi6,_this$renderItemConfi7;return y.getVirtualizedContent(this.data,this.searchEnabled,this.getDisplayText.bind(this),this.value,this.multiple,(_this$renderItemConfi6=this.renderItemConfig)===null||_this$renderItemConfi6===void 0?void 0:_this$renderItemConfi6.getDisplayText,(_this$renderItemConfi7=this.renderItemConfig)===null||_this$renderItemConfi7===void 0?void 0:_this$renderItemConfi7.getValue,this.showNoResults,this.noResultsMessage,this.optionsLoading||this.loading,this.handleScroll.bind(this));}},{key:"nileInput",value:function nileInput(i){this.emit("nile-input",i);}},{key:"nileChange",value:function nileChange(i){this.emit("nile-change",i);}},{key:"updateValidity",value:function updateValidity(){var _this14=this;this.updateComplete.then(function(){_this14.formControlController.updateValidity();});}},{key:"calculateWidthOfSelectTagsDiv",value:function calculateWidthOfSelectTagsDiv(){if(this.shadowRoot){var _i5=this.shadowRoot.querySelector(".select__tags");if(_i5){return _i5.offsetWidth-70;}}return null;}},{key:"calculateTotalWidthOfTags",value:function calculateTotalWidthOfTags(){var _this15=this;this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout(function(){var i=[];if(_this15.shadowRoot){_this15.shadowRoot.querySelectorAll("nile-tag").forEach(function(s){s instanceof HTMLElement&&i.push(s.offsetWidth);});}if(_this15.value.length!==i.length)return;var s=_this15.calculateWidthOfSelectTagsDiv();if(!s)return;var n=0,o=0;for(var _t=0;_t<i.length;_t++)if(n+=i[_t],n>s){o=_t;break;}_this15.maxOptionsVisible=o;},1);}},{key:"resetScrollPosition",value:function(){var _resetScrollPosition=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){return _regeneratorRuntime().wrap(function _callee7$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return this.portalManager.resetScrollPosition();case 2:case"end":return _context8.stop();}},_callee7,this);}));function resetScrollPosition(){return _resetScrollPosition.apply(this,arguments);}return resetScrollPosition;}()}]);}(u));$.styles=e,i([n(".select")],$.prototype,"popup",void 0),i([n(".select__combobox")],$.prototype,"combobox",void 0),i([n(".select__display-input")],$.prototype,"displayInput",void 0),i([n(".select__value-input")],$.prototype,"valueInput",void 0),i([n(".virtualized")],$.prototype,"virtualizedContainer",void 0),i([o()],$.prototype,"hasFocus",void 0),i([o()],$.prototype,"displayLabel",void 0),i([o()],$.prototype,"selectedOptions",void 0),i([o()],$.prototype,"oldValue",void 0),i([t()],$.prototype,"name",void 0),i([t({type:Array})],$.prototype,"data",void 0),i([o()],$.prototype,"originalOptionItems",void 0),i([t({converter:{fromAttribute:function fromAttribute(i){return i.split(" ");},toAttribute:function toAttribute(i){return i.join(" ");}}})],$.prototype,"value",void 0),i([a()],$.prototype,"defaultValue",void 0),i([t()],$.prototype,"size",void 0),i([t()],$.prototype,"placeholder",void 0),i([t({type:Boolean})],$.prototype,"autoResize",void 0),i([o()],$.prototype,"searchValue",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"searchEnabled",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"enableVisibilityEffect",void 0),i([t({attribute:"internal-search-placeholder"})],$.prototype,"internalSearchPlaceHolder",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"disableLocalSearch",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"optionsLoading",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"loading",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"multiple",void 0),i([t({attribute:"help-text",reflect:!0})],$.prototype,"helpText",void 0),i([t({attribute:"error-message",reflect:!0})],$.prototype,"errorMessage",void 0),i([t({type:Boolean})],$.prototype,"warning",void 0),i([t({type:Boolean})],$.prototype,"error",void 0),i([t({type:Boolean})],$.prototype,"success",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"disabled",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"clearable",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"open",void 0),i([t({type:Boolean})],$.prototype,"hoist",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"filled",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"pill",void 0),i([t()],$.prototype,"label",void 0),i([t({reflect:!0})],$.prototype,"placement",void 0),i([t({reflect:!0})],$.prototype,"form",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"required",void 0),i([t({type:Boolean})],$.prototype,"showNoResults",void 0),i([t({type:String})],$.prototype,"noResultsMessage",void 0),i([t({type:Boolean})],$.prototype,"showSelected",void 0),i([t({attribute:!1})],$.prototype,"renderItemConfig",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"blockValueChange",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"noWidthSync",void 0),i([t({type:Boolean,reflect:!0})],$.prototype,"portal",void 0),i([t({attribute:"max-options-visible",type:Number})],$.prototype,"maxOptionsVisible",void 0),i([o()],$.prototype,"oldMaxOptionsVisible",void 0),i([t({type:Boolean,reflect:!0,attribute:!0})],$.prototype,"enableTabClose",void 0),i([o()],$.prototype,"showListbox",void 0),i([o()],$.prototype,"wasShowSelectedCheckedOnClose",void 0),i([d("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"handleDisabledChange",null),i([d("value",{waitUntilFirstUpdate:!0})],$.prototype,"handleValueChange",null),i([d("data",{waitUntilFirstUpdate:!0})],$.prototype,"handleDataChange",null),i([d("renderItemConfig",{waitUntilFirstUpdate:!0})],$.prototype,"handleRenderItemConfigChange",null),i([d("optionsLoading",{waitUntilFirstUpdate:!0})],$.prototype,"handleOptionsLoadingChange",null),i([d("portal",{waitUntilFirstUpdate:!0})],$.prototype,"handlePortalAppendChange",null),i([d("open",{waitUntilFirstUpdate:!0})],$.prototype,"handleOpenChange",null),_export("N",$=i([c("nile-virtual-select")],$)),m("select.show",{keyframes:[{opacity:0,scale:.9},{opacity:1,scale:1}],options:{duration:100,easing:"ease"}}),m("select.hide",{keyframes:[{opacity:1,scale:1},{opacity:0,scale:.9}],options:{duration:100,easing:"ease"}});}};});
6
6
  //# sourceMappingURL=nile-virtual-select.cjs.js.map