@aquera/nile-elements 1.2.1-beta-1.6 → 1.2.1-beta-1.7

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 (43) hide show
  1. package/demo/index.html +83 -100
  2. package/demo/variables.css +2 -3
  3. package/dist/index.js +369 -656
  4. package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
  5. package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
  6. package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
  7. package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
  8. package/dist/nile-calendar/nile-calendar.css.esm.js +38 -220
  9. package/dist/nile-calendar/nile-calendar.esm.js +98 -204
  10. package/dist/nile-select/nile-select.cjs.js +1 -1
  11. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  12. package/dist/nile-select/nile-select.esm.js +4 -4
  13. package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
  14. package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
  15. package/dist/nile-select/virtual-scroll-helper.esm.js +1 -0
  16. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  17. package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
  18. package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
  19. package/dist/src/nile-calendar/nile-calendar.css.js +36 -218
  20. package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  21. package/dist/src/nile-calendar/nile-calendar.d.ts +0 -15
  22. package/dist/src/nile-calendar/nile-calendar.js +93 -318
  23. package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  24. package/dist/src/nile-rich-text-editor/utils.d.ts +0 -13
  25. package/dist/src/nile-rich-text-editor/utils.js +1 -537
  26. package/dist/src/nile-rich-text-editor/utils.js.map +1 -1
  27. package/dist/src/nile-select/nile-select.d.ts +1 -0
  28. package/dist/src/nile-select/nile-select.js +30 -9
  29. package/dist/src/nile-select/nile-select.js.map +1 -1
  30. package/dist/src/nile-select/virtual-scroll-helper.js +1 -0
  31. package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
  32. package/dist/src/nile-virtual-select/nile-virtual-select.js +1 -0
  33. package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
  34. package/dist/src/version.js +1 -1
  35. package/dist/src/version.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/nile-calendar/nile-calendar.css.ts +36 -218
  39. package/src/nile-calendar/nile-calendar.ts +106 -343
  40. package/src/nile-select/nile-select.ts +25 -15
  41. package/src/nile-select/virtual-scroll-helper.ts +2 -0
  42. package/src/nile-virtual-select/nile-virtual-select.ts +1 -0
  43. package/vscode-html-custom-data.json +17 -41
@@ -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",x=/*#__PURE__*/function(){function x(i,_ref){var _this=this;var s=_ref.target,o=_ref.config,n=_ref.callback,c=_ref.skipInitial;_classCallCheck(this,x);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=o,this.o=c!==null&&c!==void 0?c:this.o,this.callback=n,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(x,[{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",k=/*#__PURE__*/function(_u){function k(){var _this2;_classCallCheck(this,k);_this2=_callSuper(this,k,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.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.showListbox=!1,_this2.wasShowSelectedCheckedOnClose=!1,_this2.handleDocumentMouseDown=function(i){if(!_this2.open)return;var s=i.composedPath(),o=s.includes(_assertThisInitialized(_this2)),n=_this2.popup&&s.includes(_this2.popup),c=_this2.portal&&_this2.portalManager.portalContainerElement&&s.includes(_this2.portalManager.portalContainerElement);o||n||c||_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 x(_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(k,_u);return _createClass(k,[{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(k,"connectedCallback",this,3)([]),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then(function(){_this3.value&&_this3.data.length>0&&_this3.selectionChanged();});}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.removeOpenListeners(),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:"handleDocumentFocusIn",value:function handleDocumentFocusIn(i){if(!this.open)return;var s=i.composedPath(),o=s.includes(this),n=this.popup&&s.includes(this.popup),c=this.portal&&this.portalManager.portalContainerElement&&s.includes(this.portalManager.portalContainerElement);o||n||c||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,o=null!==s.closest(".select__clear"),n=null!==s.closest("nile-icon-button");return o||n;}},{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,_this4=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){var _i3=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter(function(s){var o=_this4.getItemValue(s);return _i3.some(function(i){return String(i)===String(o);});});}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 _this5=this;this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then(function(){_this5.nileInput({value:_this5.value,name:_this5.name}),_this5.nileChange({value:_this5.value,name:_this5.name}),_this5.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 o=this.value;this.oldValue=o,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 _this6=this;var s=i.value;this.multiple?this.toggleOptionSelection(s):this.setSelectedOptions(s),this.updateComplete.then(function(){return _this6.displayInput.focus({preventScroll:!0});}),this.value!==this.oldValue&&this.updateComplete.then(function(){_this6.nileInput({value:_this6.value,name:_this6.name}),_this6.nileChange({value:_this6.value,name:_this6.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 o=s.filter(function(s){return s!==i.value;});this.value=o,this.selectionChanged();}},{key:"emitTagRemovalEvent",value:function emitTagRemovalEvent(i){var _this7=this;this.updateComplete.then(function(){_this7.nileInput({value:_this7.value,name:_this7.name}),_this7.nileChange({value:_this7.value,name:_this7.name}),_this7.emit("nile-tag-remove",{value:_this7.value,name:_this7.name,removedtagvalue:i.value});});}},{key:"selectionChanged",value:function selectionChanged(){var _this$renderItemConfi4;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.filterVirtualOptions(""),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.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 _this8=this;this.resetScrollPosition(),this.updateComplete.then(function(){var _this8$shadowRoot;var i=(_this8$shadowRoot=_this8.shadowRoot)===null||_this8$shadowRoot===void 0?void 0:_this8$shadowRoot.querySelector(".virtualized");i&&(_this8.data.length<=5?i.classList.add("no-scroll"):i.classList.remove("no-scroll"));});}},{key:"handleScroll",value:function handleScroll(i){var _this9=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(){_this9.scrolling&&(_this9.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;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.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.data.length>0&&this.open&&this.searchValue&&(this.originalOptionItems=[].concat(_toConsumableArray(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(){return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(!(this.open&&!this.disabled)){_context3.next=7;break;}_context3.next=3;return this.handleOpen();case 3:this.showListbox=!0;this.portal&&this.portalManager.setupPortalAppend();_context3.next=11;break;case 7:_context3.next=9;return this.handleClose();case 9:this.showListbox=!1;this.portal&&this.portalManager.cleanupPortalAppend();case 11: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;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 l(this);case 5:this.popup.active=!0;_g=g(this,"select.show",{dir:"ltr"}),i=_g.keyframes,s=_g.options;_context4.next=9;return r(this.popup.popup,i,s);case 9:this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=_toConsumableArray(this.originalOptionItems),this.wasShowSelectedCheckedOnClose=!1);this.initializeOriginalItems();this.filterVirtualOptions(this.searchValue);this.resetScrollPosition();this.emit("nile-after-show",{value:this.value,name:this.name});case 14: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 _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 l(this);case 5:_g2=g(this,"select.hide",{dir:"ltr"}),i=_g2.keyframes,s=_g2.options;_context5.next=8;return r(this.popup.popup,i,s);case 8:this.popup.active=!1;this.searchValue="";this.portalManager.resetMeasuredHeight();this.emit("nile-after-hide",{value:this.value,name:this.name});case 12:case"end":return _context5.stop();}},_callee4,this);}));function handleClose(){return _handleClose.apply(this,arguments);}return handleClose;}()},{key:"initializeOriginalItems",value:function initializeOriginalItems(){this.data.length>0&&(this.originalOptionItems=_toConsumableArray(this.data));}},{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 o=this.hasSlotController.test("label-suffix"),n=this.hasSlotController.test("custom-select"),c=!!this.label||!!i,t=this.clearable&&!this.disabled&&this.value.length>0,e=!!this.placeholder&&0===this.value.length,l=!!this.helpText,r=!!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":c,"form-control--has-help-text":l}),this.renderLabel(c,o),this.renderFormControlInput(n,t,e,l,r));}},{key:"renderLabel",value:function renderLabel(i,o){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,o?s(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"");}},{key:"renderFormControlInput",value:function renderFormControlInput(i,o,n,c,t){return s(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div part=\"form-control-input\" class=\"form-control-input\">\n ","\n ","\n </div>\n "])),this.renderPopup(i,o,n),this.renderHelpText(c,t));}},{key:"renderPopup",value:function renderPopup(i,o,n){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 >\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":n,"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,o),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,o){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(o),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 _this10=this;return this.multiple?s(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div part=\"tags\" class=\"select__tags\">\n ","\n </div>\n "])),this.selectedOptions.map(function(i,o){if(o<_this10.maxOptionsVisible||_this10.maxOptionsVisible<=0){var _n={select__invisible:o+1>_this10.oldMaxOptionsVisible&&_this10.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(_n),_this10.pill,_this10.size,function(s){return _this10.handleTagRemove(s,i);},i.getTextLabel());}return o===_this10.maxOptionsVisible?s(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <span class=\"select__tags-count\"\n >+"," More\n </span>\n "])),_this10.selectedOptions.length-o):null;})):s(_templateObject15||(_templateObject15=_taggedTemplateLiteral([""])));}},{key:"renderValueInput",value:function renderValueInput(){var _this11=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 _this11.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,o){return s(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n ","\n ","\n "])),i?s(_templateObject31||(_templateObject31=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?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 _this12=this;this.updateComplete.then(function(){_this12.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 _this13=this;this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout(function(){var i=[];if(_this13.shadowRoot){_this13.shadowRoot.querySelectorAll("nile-tag").forEach(function(s){s instanceof HTMLElement&&i.push(s.offsetWidth);});}if(_this13.value.length!==i.length)return;var s=_this13.calculateWidthOfSelectTagsDiv();if(!s)return;var o=0,n=0;for(var _c=0;_c<i.length;_c++)if(o+=i[_c],o>s){n=_c;break;}_this13.maxOptionsVisible=n;},1);}},{key:"resetScrollPosition",value:function resetScrollPosition(){var _this14=this;this.updateComplete.then(function(){if(_this14.virtualizedContainer&&_this14.virtualizedContainer.isConnected){var _this14$shadowRoot;_this14.virtualizedContainer.scrollTop=0;var _i6=(_this14$shadowRoot=_this14.shadowRoot)===null||_this14$shadowRoot===void 0?void 0:_this14$shadowRoot.querySelector(".select__listbox");_i6&&_i6.isConnected&&(_i6.scrollTop=0);var _s3=_this14.virtualizedContainer.querySelector("lit-virtualizer");_s3&&_s3.isConnected&&(_s3.scrollTop=0);}});}}]);}(u));k.styles=e,i([o(".select")],k.prototype,"popup",void 0),i([o(".select__combobox")],k.prototype,"combobox",void 0),i([o(".select__display-input")],k.prototype,"displayInput",void 0),i([o(".select__value-input")],k.prototype,"valueInput",void 0),i([o(".virtualized")],k.prototype,"virtualizedContainer",void 0),i([n()],k.prototype,"hasFocus",void 0),i([n()],k.prototype,"displayLabel",void 0),i([n()],k.prototype,"selectedOptions",void 0),i([n()],k.prototype,"oldValue",void 0),i([c()],k.prototype,"name",void 0),i([c({type:Array})],k.prototype,"data",void 0),i([n()],k.prototype,"originalOptionItems",void 0),i([c({converter:{fromAttribute:function fromAttribute(i){return i.split(" ");},toAttribute:function toAttribute(i){return i.join(" ");}}})],k.prototype,"value",void 0),i([a()],k.prototype,"defaultValue",void 0),i([c()],k.prototype,"size",void 0),i([c()],k.prototype,"placeholder",void 0),i([c({type:Boolean})],k.prototype,"autoResize",void 0),i([n()],k.prototype,"searchValue",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"searchEnabled",void 0),i([c({attribute:"internal-search-placeholder"})],k.prototype,"internalSearchPlaceHolder",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"disableLocalSearch",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"optionsLoading",void 0),i([c({type:Boolean,reflect:!0,attribute:!0})],k.prototype,"loading",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"multiple",void 0),i([c({attribute:"help-text",reflect:!0})],k.prototype,"helpText",void 0),i([c({attribute:"error-message",reflect:!0})],k.prototype,"errorMessage",void 0),i([c({type:Boolean})],k.prototype,"warning",void 0),i([c({type:Boolean})],k.prototype,"error",void 0),i([c({type:Boolean})],k.prototype,"success",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"disabled",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"clearable",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"open",void 0),i([c({type:Boolean})],k.prototype,"hoist",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"filled",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"pill",void 0),i([c()],k.prototype,"label",void 0),i([c({reflect:!0})],k.prototype,"placement",void 0),i([c({reflect:!0})],k.prototype,"form",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"required",void 0),i([c({type:Boolean})],k.prototype,"showNoResults",void 0),i([c({type:String})],k.prototype,"noResultsMessage",void 0),i([c({type:Boolean})],k.prototype,"showSelected",void 0),i([c({attribute:!1})],k.prototype,"renderItemConfig",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"blockValueChange",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"noWidthSync",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"portal",void 0),i([c({attribute:"max-options-visible",type:Number})],k.prototype,"maxOptionsVisible",void 0),i([n()],k.prototype,"oldMaxOptionsVisible",void 0),i([n()],k.prototype,"showListbox",void 0),i([n()],k.prototype,"wasShowSelectedCheckedOnClose",void 0),i([d("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"handleDisabledChange",null),i([d("value",{waitUntilFirstUpdate:!0})],k.prototype,"handleValueChange",null),i([d("data",{waitUntilFirstUpdate:!0})],k.prototype,"handleDataChange",null),i([d("renderItemConfig",{waitUntilFirstUpdate:!0})],k.prototype,"handleRenderItemConfigChange",null),i([d("optionsLoading",{waitUntilFirstUpdate:!0})],k.prototype,"handleOptionsLoadingChange",null),i([d("portal",{waitUntilFirstUpdate:!0})],k.prototype,"handlePortalAppendChange",null),i([d("open",{waitUntilFirstUpdate:!0})],k.prototype,"handleOpenChange",null),_export("N",k=i([t("nile-virtual-select")],k)),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",x=/*#__PURE__*/function(){function x(i,_ref){var _this=this;var s=_ref.target,o=_ref.config,n=_ref.callback,c=_ref.skipInitial;_classCallCheck(this,x);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=o,this.o=c!==null&&c!==void 0?c:this.o,this.callback=n,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(x,[{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",k=/*#__PURE__*/function(_u){function k(){var _this2;_classCallCheck(this,k);_this2=_callSuper(this,k,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.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.showListbox=!1,_this2.wasShowSelectedCheckedOnClose=!1,_this2.handleDocumentMouseDown=function(i){if(!_this2.open)return;var s=i.composedPath(),o=s.includes(_assertThisInitialized(_this2)),n=_this2.popup&&s.includes(_this2.popup),c=_this2.portal&&_this2.portalManager.portalContainerElement&&s.includes(_this2.portalManager.portalContainerElement);o||n||c||_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 x(_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(k,_u);return _createClass(k,[{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(k,"connectedCallback",this,3)([]),this.initializeComponent(),this.setupEventListeners(),this.updateComplete.then(function(){_this3.value&&_this3.data.length>0&&_this3.selectionChanged();});}},{key:"disconnectedCallback",value:function disconnectedCallback(){this.removeOpenListeners(),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:"handleDocumentFocusIn",value:function handleDocumentFocusIn(i){if(!this.open)return;var s=i.composedPath(),o=s.includes(this),n=this.popup&&s.includes(this.popup),c=this.portal&&this.portalManager.portalContainerElement&&s.includes(this.portalManager.portalContainerElement);o||n||c||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,o=null!==s.closest(".select__clear"),n=null!==s.closest("nile-icon-button");return o||n;}},{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,_this4=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){var _i3=Array.isArray(this.value)?this.value:[this.value];this.data=this.originalOptionItems.filter(function(s){var o=_this4.getItemValue(s);return _i3.some(function(i){return String(i)===String(o);});});}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 _this5=this;this.value,this.value=this.multiple?[]:"",this.selectionChanged(),this.updateComplete.then(function(){_this5.nileInput({value:_this5.value,name:_this5.name}),_this5.nileChange({value:_this5.value,name:_this5.name}),_this5.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 o=this.value;this.oldValue=o,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 _this6=this;var s=i.value;this.multiple?this.toggleOptionSelection(s):this.setSelectedOptions(s),this.updateComplete.then(function(){return _this6.displayInput.focus({preventScroll:!0});}),this.value!==this.oldValue&&this.updateComplete.then(function(){_this6.nileInput({value:_this6.value,name:_this6.name}),_this6.nileChange({value:_this6.value,name:_this6.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 o=s.filter(function(s){return s!==i.value;});this.value=o,this.selectionChanged();}},{key:"emitTagRemovalEvent",value:function emitTagRemovalEvent(i){var _this7=this;this.updateComplete.then(function(){_this7.nileInput({value:_this7.value,name:_this7.name}),_this7.nileChange({value:_this7.value,name:_this7.name}),_this7.emit("nile-tag-remove",{value:_this7.value,name:_this7.name,removedtagvalue:i.value});});}},{key:"selectionChanged",value:function selectionChanged(){var _this$renderItemConfi4;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.filterVirtualOptions(""),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.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 _this8=this;this.resetScrollPosition(),this.updateComplete.then(function(){var _this8$shadowRoot;var i=(_this8$shadowRoot=_this8.shadowRoot)===null||_this8$shadowRoot===void 0?void 0:_this8$shadowRoot.querySelector(".virtualized");i&&(_this8.data.length<=5?i.classList.add("no-scroll"):i.classList.remove("no-scroll"));});}},{key:"handleScroll",value:function handleScroll(i){var _this9=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(){_this9.scrolling&&(_this9.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;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.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.data.length>0&&this.open&&this.searchValue&&(this.originalOptionItems=[].concat(_toConsumableArray(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(){return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:this.emit("nile-open-change",{open:this.open});if(!(this.open&&!this.disabled)){_context3.next=8;break;}_context3.next=4;return this.handleOpen();case 4:this.showListbox=!0;this.portal&&this.portalManager.setupPortalAppend();_context3.next=12;break;case 8:_context3.next=10;return this.handleClose();case 10:this.showListbox=!1;this.portal&&this.portalManager.cleanupPortalAppend();case 12: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;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 l(this);case 5:this.popup.active=!0;_g=g(this,"select.show",{dir:"ltr"}),i=_g.keyframes,s=_g.options;_context4.next=9;return r(this.popup.popup,i,s);case 9:this.wasShowSelectedCheckedOnClose&&(this.showSelected=!1,this.data=_toConsumableArray(this.originalOptionItems),this.wasShowSelectedCheckedOnClose=!1);this.initializeOriginalItems();this.filterVirtualOptions(this.searchValue);this.resetScrollPosition();this.emit("nile-after-show",{value:this.value,name:this.name});case 14: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 _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 l(this);case 5:_g2=g(this,"select.hide",{dir:"ltr"}),i=_g2.keyframes,s=_g2.options;_context5.next=8;return r(this.popup.popup,i,s);case 8:this.popup.active=!1;this.searchValue="";this.portalManager.resetMeasuredHeight();this.emit("nile-after-hide",{value:this.value,name:this.name});case 12:case"end":return _context5.stop();}},_callee4,this);}));function handleClose(){return _handleClose.apply(this,arguments);}return handleClose;}()},{key:"initializeOriginalItems",value:function initializeOriginalItems(){this.data.length>0&&(this.originalOptionItems=_toConsumableArray(this.data));}},{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 o=this.hasSlotController.test("label-suffix"),n=this.hasSlotController.test("custom-select"),c=!!this.label||!!i,t=this.clearable&&!this.disabled&&this.value.length>0,e=!!this.placeholder&&0===this.value.length,l=!!this.helpText,r=!!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":c,"form-control--has-help-text":l}),this.renderLabel(c,o),this.renderFormControlInput(n,t,e,l,r));}},{key:"renderLabel",value:function renderLabel(i,o){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,o?s(_templateObject3||(_templateObject3=_taggedTemplateLiteral([" <slot name=\"label-suffix\"></slot> "]))):"");}},{key:"renderFormControlInput",value:function renderFormControlInput(i,o,n,c,t){return s(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div part=\"form-control-input\" class=\"form-control-input\">\n ","\n ","\n </div>\n "])),this.renderPopup(i,o,n),this.renderHelpText(c,t));}},{key:"renderPopup",value:function renderPopup(i,o,n){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 >\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":n,"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,o),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,o){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(o),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 _this10=this;return this.multiple?s(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div part=\"tags\" class=\"select__tags\">\n ","\n </div>\n "])),this.selectedOptions.map(function(i,o){if(o<_this10.maxOptionsVisible||_this10.maxOptionsVisible<=0){var _n={select__invisible:o+1>_this10.oldMaxOptionsVisible&&_this10.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(_n),_this10.pill,_this10.size,function(s){return _this10.handleTagRemove(s,i);},i.getTextLabel());}return o===_this10.maxOptionsVisible?s(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <span class=\"select__tags-count\"\n >+"," More\n </span>\n "])),_this10.selectedOptions.length-o):null;})):s(_templateObject15||(_templateObject15=_taggedTemplateLiteral([""])));}},{key:"renderValueInput",value:function renderValueInput(){var _this11=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 _this11.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,o){return s(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n ","\n ","\n "])),i?s(_templateObject31||(_templateObject31=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?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 _this12=this;this.updateComplete.then(function(){_this12.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 _this13=this;this.maxOptionsVisible!==1/0&&(this.oldMaxOptionsVisible=this.maxOptionsVisible),this.maxOptionsVisible=1/0,setTimeout(function(){var i=[];if(_this13.shadowRoot){_this13.shadowRoot.querySelectorAll("nile-tag").forEach(function(s){s instanceof HTMLElement&&i.push(s.offsetWidth);});}if(_this13.value.length!==i.length)return;var s=_this13.calculateWidthOfSelectTagsDiv();if(!s)return;var o=0,n=0;for(var _c=0;_c<i.length;_c++)if(o+=i[_c],o>s){n=_c;break;}_this13.maxOptionsVisible=n;},1);}},{key:"resetScrollPosition",value:function resetScrollPosition(){var _this14=this;this.updateComplete.then(function(){if(_this14.virtualizedContainer&&_this14.virtualizedContainer.isConnected){var _this14$shadowRoot;_this14.virtualizedContainer.scrollTop=0;var _i6=(_this14$shadowRoot=_this14.shadowRoot)===null||_this14$shadowRoot===void 0?void 0:_this14$shadowRoot.querySelector(".select__listbox");_i6&&_i6.isConnected&&(_i6.scrollTop=0);var _s3=_this14.virtualizedContainer.querySelector("lit-virtualizer");_s3&&_s3.isConnected&&(_s3.scrollTop=0);}});}}]);}(u));k.styles=e,i([o(".select")],k.prototype,"popup",void 0),i([o(".select__combobox")],k.prototype,"combobox",void 0),i([o(".select__display-input")],k.prototype,"displayInput",void 0),i([o(".select__value-input")],k.prototype,"valueInput",void 0),i([o(".virtualized")],k.prototype,"virtualizedContainer",void 0),i([n()],k.prototype,"hasFocus",void 0),i([n()],k.prototype,"displayLabel",void 0),i([n()],k.prototype,"selectedOptions",void 0),i([n()],k.prototype,"oldValue",void 0),i([c()],k.prototype,"name",void 0),i([c({type:Array})],k.prototype,"data",void 0),i([n()],k.prototype,"originalOptionItems",void 0),i([c({converter:{fromAttribute:function fromAttribute(i){return i.split(" ");},toAttribute:function toAttribute(i){return i.join(" ");}}})],k.prototype,"value",void 0),i([a()],k.prototype,"defaultValue",void 0),i([c()],k.prototype,"size",void 0),i([c()],k.prototype,"placeholder",void 0),i([c({type:Boolean})],k.prototype,"autoResize",void 0),i([n()],k.prototype,"searchValue",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"searchEnabled",void 0),i([c({attribute:"internal-search-placeholder"})],k.prototype,"internalSearchPlaceHolder",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"disableLocalSearch",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"optionsLoading",void 0),i([c({type:Boolean,reflect:!0,attribute:!0})],k.prototype,"loading",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"multiple",void 0),i([c({attribute:"help-text",reflect:!0})],k.prototype,"helpText",void 0),i([c({attribute:"error-message",reflect:!0})],k.prototype,"errorMessage",void 0),i([c({type:Boolean})],k.prototype,"warning",void 0),i([c({type:Boolean})],k.prototype,"error",void 0),i([c({type:Boolean})],k.prototype,"success",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"disabled",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"clearable",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"open",void 0),i([c({type:Boolean})],k.prototype,"hoist",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"filled",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"pill",void 0),i([c()],k.prototype,"label",void 0),i([c({reflect:!0})],k.prototype,"placement",void 0),i([c({reflect:!0})],k.prototype,"form",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"required",void 0),i([c({type:Boolean})],k.prototype,"showNoResults",void 0),i([c({type:String})],k.prototype,"noResultsMessage",void 0),i([c({type:Boolean})],k.prototype,"showSelected",void 0),i([c({attribute:!1})],k.prototype,"renderItemConfig",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"blockValueChange",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"noWidthSync",void 0),i([c({type:Boolean,reflect:!0})],k.prototype,"portal",void 0),i([c({attribute:"max-options-visible",type:Number})],k.prototype,"maxOptionsVisible",void 0),i([n()],k.prototype,"oldMaxOptionsVisible",void 0),i([n()],k.prototype,"showListbox",void 0),i([n()],k.prototype,"wasShowSelectedCheckedOnClose",void 0),i([d("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"handleDisabledChange",null),i([d("value",{waitUntilFirstUpdate:!0})],k.prototype,"handleValueChange",null),i([d("data",{waitUntilFirstUpdate:!0})],k.prototype,"handleDataChange",null),i([d("renderItemConfig",{waitUntilFirstUpdate:!0})],k.prototype,"handleRenderItemConfigChange",null),i([d("optionsLoading",{waitUntilFirstUpdate:!0})],k.prototype,"handleOptionsLoadingChange",null),i([d("portal",{waitUntilFirstUpdate:!0})],k.prototype,"handlePortalAppendChange",null),i([d("open",{waitUntilFirstUpdate:!0})],k.prototype,"handleOpenChange",null),_export("N",k=i([t("nile-virtual-select")],k)),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