@momentum-ui/web-components 2.26.7 → 2.26.11
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.
- package/dist/109.js +3 -3
- package/dist/1572.js +1 -1
- package/dist/1598.js +1 -1
- package/dist/2547.js +1 -1
- package/dist/6067.js +1 -1
- package/dist/6408.js +8 -7
- package/dist/comp/md-combobox-entry.js +2 -2
- package/dist/comp/md-country-code-picker-entry.js +2 -2
- package/dist/comp/md-date-time-picker-entry.js +1 -1
- package/dist/comp/md-editable-field-entry.js +1 -1
- package/dist/comp/md-help-text-entry.js +4 -4
- package/dist/comp/md-input-entry.js +9 -8
- package/dist/comp/md-input-file.js +1 -1
- package/dist/comp/md-phone-input-entry.js +2 -2
- package/dist/comp/md-radio-entry.js +10 -3
- package/dist/comp/md-timepicker-entry.js +1 -1
- package/dist/index-entry.js +166 -158
- package/dist/types/components/combobox/ComboBox.d.ts +1 -1
- package/dist/types/components/form/FormArray.d.ts +6 -1
- package/dist/types/components/form/FormControl.d.ts +3 -0
- package/dist/types/components/form/index.d.ts +1 -0
- package/dist/types/components/form/validators.array.d.ts +12 -0
- package/dist/types/components/form/validators.d.ts +1 -0
- package/dist/types/components/input/Input.d.ts +2 -2
- package/dist/types/components/radio/Radio.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html/directives/style-map"),require("lit-html"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html/directives/style-map","lit-html","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/repeat","lit-virtualizer"],e);else{var i="object"==typeof exports?e(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html/directives/style-map"),require("lit-html"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer")):e(t["lit-element"],t["lit-html/directives/class-map"],t["lit-html/directives/style-map"],t["lit-html"],t["lit-html/directives/if-defined"],t["@momentum-ui/icons/data/momentumUiIconsNames.json"],t["@momentum-ui/utils/lib/getColorValue"],t.mobx,t["lit-html/directives/repeat"],t["lit-virtualizer"]);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(self,(t,e,i,s,o,l,n,r,a,h)=>(()=>{"use strict";var d,p={4928:(t,e,i)=>{i.r(e),i.d(e,{ComboBox:()=>s}),i(20109),i(61200);var s,o=i(90195),l=i(3001),n=i(31890),r=i(66677),a=i(26272),h=i(41488),d=i(40333),p=i(23968),u=i(97822),c=i(22818),m=i(8229),b=i(86635),g=i(97103),f=i(46795),x=function(t,e,i,s){var o,l=arguments.length,n=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(n=(l<3?o(n):l>3?o(e,i,n):o(e,i))||n);return l>3&&n&&Object.defineProperty(e,i,n),n},v=function(t,e,i,s){return new(i||(i=Promise))(function(o,l){function n(t){try{a(s.next(t))}catch(t){l(t)}}function r(t){try{a(s.throw(t))}catch(t){l(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,r)}a((s=s.apply(t,e||[])).next())})};!function(t){class e{determineMessageType(t){return t.reduce((t,e)=>"error"===e?t:e.type,"")}filterMessagesByType(t,e){return t.reduce((t,i)=>i.type===e?t.concat(i.message):t,[])}}t.MessageController=e;let i=class extends((0,l.yC)(h.LitElement)){constructor(){super(...arguments),this._focusedIndex=-1,this._focusedGroupIndex=-1,this.label="Options",this.options=[],this.customOptions=[],this.placeholder="",this.isMulti=!1,this.useVirtualScroll=!1,this.disabled=!1,this.ordered=!1,this.expanded=!1,this.groupExpandedList=[],this.searchItem=!1,this.compact=!1,this.noClearIcon=!1,this.selectWhenInFocus=!1,this.selectedOptions=[],this.visibleOptions=8,this.optionId="",this.optionValue="",this.isCustomContent=!1,this.searchable=!1,this.shape="none",this.value=[],this.inputValue="",this.allowCustomValue=!1,this.autofocus=!1,this.resultsTextLocalization="No Results",this.optionsTextLocalization="No Options",this.trimSpace=!1,this.invalid=!1,this.invalidText="",this.ariaLabel="",this.searchResultAriaLabel="",this.ariaLabelForComboBox="",this.clearAriaLabel="Clear",this.arrowAriaLabel="Expand",this.clearIconHeight="auto",this.allTextLocalization="All",this.selectAllTextLocalization="Select All",this.selectedTextLocalization="Selected",this.allowSelectAll=!1,this.showCustomError=!1,this.showLoader=!1,this.showSelectedCount=!1,this.popupChevronAriaHidden="true",this.newMomentum=!1,this.showFilterIcon=!1,this.preventFilter=!1,this.isDropdownArrow=!1,this.comboboxId="",this.helpText="",this.messageArr=[],this.htmlId="",this.readOnly=!1,this.messageController=new e,this.isOptGroup=!1,this.isSelectAllChecked=!1,this.multiSelectedIndex=-1,this.multiSelected=[],this.customContent=[],this.notifySelectedChange=(0,r.sg)(t=>{this.dispatchEvent(new CustomEvent("change-selected",{composed:!0,bubbles:!0,detail:t}))},0),this.handleGroupFilter=t=>{const e=t.filter(t=>{if("string"!=typeof t&&"true"===t.isLabel)return t.groupName});return this.searchItem=!0,this.groupExpandedList=e.map(t=>{if("string"!=typeof t)return t.groupName}),t.filter(e=>"string"==typeof e||"true"!==e.isLabel||!!t.find(t=>{if("string"!=typeof e&&"string"!=typeof t)return e.groupName===t.groupName&&"false"===t.isLabel}))},this.notifyInputValueChanged=(0,r.sg)(t=>{this.dispatchEvent(new CustomEvent("combobox-input",{composed:!0,bubbles:!0,detail:{value:t}})),this.notifySearchResultCount(),this.focusedGroupIndex=0,requestAnimationFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})},250),this.handleOutsideClick=t=>{let e=!1;const i=t.composedPath();i.length&&(e=!!i.find(t=>t===this),e||(this.setVisualListbox(!1),this.unselectedAllMultiTag()))}}get focusedIndex(){return this._focusedIndex}set focusedIndex(t){this.updateFocusedIndex(t)}updateFocusedIndex(t){var e;const i=this._focusedIndex;if(this.checkForVirtualScroll()){let i;i=this.allowSelectAll?0===t?"selectAll":this.getOptionId(this.filteredOptions[t-1]):this.getOptionId(this.filteredOptions[t]);const s=this.lists?null===(e=[...this.lists])||void 0===e?void 0:e.find(t=>0!==t.offsetHeight&&t.id===i):"";this.lists&&[...this.lists].forEach(t=>{t.toggleAttribute("focused",!1)}),s&&(null==s||s.toggleAttribute("focused",!0))}else if(this.lists){const e=this.lists[i];e&&e.toggleAttribute("focused",!1);const s=this.lists[t];s&&s.toggleAttribute("focused",!0)}this._focusedIndex=t,this.requestUpdate("focusedIndex",i)}get focusedGroupIndex(){return this._focusedGroupIndex}set focusedGroupIndex(t){const e=this._focusedGroupIndex;if(this.labels&&0!==this.labels.length){const i=this.labels[e];i&&i.toggleAttribute("focused",!1);const s=this.labels[t];s&&(s.toggleAttribute("focused",!0),s.focus())}this._focusedGroupIndex=t,this.requestUpdate("focusedGroupIndex",e)}get messageType(){return this.messageArr.length>0?this.messageController.determineMessageType(this.messageArr):null}get messages(){return this.messageType?this.messageController.filterMessagesByType(this.messageArr,this.messageType):null}notifySearchResultCount(){if(this.searchResultAriaLabel){const t=/{{.*?}}/g;this.ariaLabelForComboBox=this.searchResultAriaLabel.replace(t,this.filteredOptions.length.toString())}else this.ariaLabel?this.ariaLabelForComboBox=`${this.ariaLabel}, ${this.filteredOptions.length} results found.`:this.ariaLabelForComboBox=`ComboBox Element, ${this.filteredOptions.length} results found.`}firstUpdated(t){this.ariaLabelForComboBox=this.ariaLabel?this.ariaLabel:"ComboBox Element",super.firstUpdated(t),this.isCustomContent&&(this.optionId="id",this.optionValue="value",this.setOptionCustomContent()),this.setInitialValue()}updated(t){super.updated(t),t.has("expanded")&&(this.expanded?(this.resizeListbox(),this.checkSelectedOptions()):this.unCheckAllOptions()),t.has("focusedIndex")&&this.focusedIndex>=0&&(this.checkForVirtualScroll()||this.scrollToOption()),t.has("value")&&0===this.selectedOptions.length&&this.setInitialValue(),t.has("customOptions")&&this.isCustomContent&&(this.setOptionCustomContent(),this.resizeListbox()),t.has("showCustomError")&&this.resizeListbox(),t.has("showLoader")&&this.resizeListbox(),t.has("searchItem")&&this.resizeListbox()}handleFocusIn(t){var e;this.disabled&&!this.readOnly||(this.noClearIcon&&(requestAnimationFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1}),this.selectWhenInFocus&&this.input.select()),null===(e=super.handleFocusIn)||void 0===e||e.call(this,t)),this.dispatchEvent(new CustomEvent("combobox-focus-in",{composed:!0,bubbles:!0}))}handleFocusOut(t){var e;null===(e=super.handleFocusOut)||void 0===e||e.call(this,t),this.dispatchEvent(new CustomEvent("combobox-focus-out",{composed:!0,bubbles:!0}))}findFilteredOption(t){return this.isOptionObject(t)?this.filteredOptions.findIndex(e=>this.getOptionId(e)===this.getOptionId(t)&&this.getOptionValue(e)===this.getOptionValue(t)):this.filteredOptions.indexOf(t)}setInitialValue(){var t;if(this.value.length)if(this.isMulti)this.value.forEach(t=>{-1!==this.findFilteredOption(t)&&this.setSelectedOption(t)});else{const e=this.value[0],i=this.findFilteredOption(e);-1!==i&&(this.setSelectedOption(e),this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.focusedIndex=i,this.focusedGroupIndex=-1)}}isOptionObject(t){return"object"==typeof t&&null!==t}setOptionCustomContent(){if(this.isOptGroup){const t=[...this.querySelectorAll("optgroup")],e=[];for(const i of t){const t=i.getAttribute("label"),s=[...i.querySelectorAll("[slot]")];e.push({isLabel:"true",[this.optionValue]:t,groupName:t});for(const i of s){const s=i.getAttribute("aria-label"),o=i.getAttribute("display-value"),l=i.getAttribute("slot");s&&o&&e.push({[this.optionId]:s,[this.optionValue]:o,isLabel:"false",groupName:t,slot:l})}}this.options=e}else this.customContent=[...this.querySelectorAll("[slot]")],this.customContent&&this.customContent.length?this.options=this.customContent.map(t=>{const e=t.getAttribute("aria-label"),i=t.getAttribute("display-value");if(e&&i)return{[this.optionId]:e,[this.optionValue]:i}}):this.options=[]}getOptionValue(t){return this.isOptionObject(t)?t[this.optionValue]:t}getOptionGroupName(t){return null==t?void 0:t.groupName}getOptionId(t){return this.isOptionObject(t)?t[this.optionId]:t}getFocusedItem(t){if(t>=0)return this.filteredOptions[t]}setupEvents(){document.addEventListener("click",this.handleOutsideClick),this.addEventListener("remove-all-selected",this.removeAllSelected),this.addEventListener("selected-changed",this.selectedChange)}teardownEvents(){document.removeEventListener("click",this.handleOutsideClick),this.removeEventListener("remove-all-selected",this.removeAllSelected),this.removeEventListener("selected-changed",this.selectedChange)}setVisualListbox(t){this.expanded=t}setGroupList(t){this.groupExpandedList.includes(t)?(this.groupExpandedList.splice(this.groupExpandedList.indexOf(t),1),this.groupExpandedList=[...this.groupExpandedList]):this.searchItem?this.groupExpandedList.push(t):this.groupExpandedList=[t]}findSelectedOption(t){return this.optionId&&t?this.selectedOptions.findIndex(e=>e&&e[this.optionId]===t[this.optionId]):this.selectedOptions.indexOf(t)}findOptionIndex(t){const e=t.composedPath();if(this.checkForVirtualScroll()){let t="";return[...this.lists].forEach(i=>{e.includes(i)&&(t=i.id)}),this.filteredOptions.findIndex(e=>this.getOptionId(e)===t)}return[...this.lists].findIndex(t=>e.includes(t))}checkSelectedOptions(){if(this.checkForVirtualScroll()){const t=this.selectedOptions.map(t=>this.getOptionId(t)),e=[...this.lists].filter(t=>"selectAll"!==t.id);null==e||e.forEach(e=>{t.includes(e.id)?(this.isMulti&&(null==e||e.setAttribute("aria-checked","true")),null==e||e.setAttribute("aria-selected","true")):this.isMulti&&(null==e||e.setAttribute("aria-checked","false"))})}}unCheckAllOptions(){var t;this.checkForVirtualScroll()&&this.isMulti&&(null===(t=[...this.lists])||void 0===t||t.forEach(t=>{"selectAll"!==(null==t?void 0:t.id)&&(null==t||t.setAttribute("aria-checked","false"))}))}setSelectedOption(t){this.isMulti||(this.selectedOptions=[]);const e=this.findSelectedOption(t);if(-1!==e){const t=this.selectedOptions[e];this.selectedOptions.splice(e,1),this.notifySelectedChange({value:t,selected:this.selectedOptions})}else this.selectedOptions.push(t),this.notifySelectedChange({value:t,selected:this.selectedOptions});this.checkSelectedOptions(),this.isMulti&&this.allowSelectAll&&(this.isSelectAllChecked=this.isSelectAllSelected()),this.requestUpdate()}filterOptions(t){if(this.preventFilter)return this.searchItem=!1,this.options;if(t&&t.length){const e=this.options.filter(e=>this.isOptGroup&&"string"!=typeof e&&"true"===e.isLabel?e:(this.isCustomContent?this.getOptionId(e):this.getOptionValue(e)).toLowerCase().includes(t.toLowerCase()));return this.isOptGroup?this.handleGroupFilter(e):e}return this.searchItem=!1,this.options}getListBoxVerticalPadding(){if(this.listBox){const t=window.getComputedStyle(this.listBox,null),e=parseInt(t.getPropertyValue("padding-top"))+parseInt(t.getPropertyValue("padding-bottom"));if(!isNaN(e))return e+2}return 10}resizeListbox(){this.updateOnNextFrame(()=>{var t;let e=0,i=0,s=0;const o=this.getListBoxVerticalPadding();if(this.lists){const t=this.checkForVirtualScroll()?[...this.lists].filter(t=>0!==t.offsetHeight):[...this.lists];e=t.slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0),s=this.checkForVirtualScroll()&&this.allowSelectAll?t.slice(1,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0):t.slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0)}if(this.labels&&(i=[...this.labels].slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0)),this.listBox&&(this.listBox.style.maxHeight=`${e+i+o}px`),this.virtualizer&&(this.virtualizer.style.height=`${s+o}px`),this.showCustomError||this.showLoader){const e=null===(t=this.listBox)||void 0===t?void 0:t.querySelector("[slot]");this.listBox&&e&&(this.listBox.style.height=`${e.clientHeight+o}px`,this.listBox.style.maxHeight=`${e.clientHeight+o}px`)}})}setInputValue(t=""){this.input.value=t}updateOnNextFrame(t){requestAnimationFrame(t)}unCheckedAllOptions(){this.isMulti&&(this.lists.forEach((t,e)=>this.unCheckedOption(e)),this.isSelectAllChecked=!1)}unCheckedOption(t){this.isMulti&&(this.lists[t].setAttribute("aria-checked","false"),this.notifySelectedChange({value:this.filteredOptions[t],selected:this.selectedOptions}))}checkAllOptions(){this.isMulti&&this.lists.forEach((t,e)=>this.checkOption(e))}checkOption(t){this.isMulti&&(this.lists[t].setAttribute("aria-checked","true"),this.notifySelectedChange({value:this.filteredOptions[t],selected:this.selectedOptions}))}isSelectAllSelected(){return this.selectedOptions.length===this.options.length}setFocusOnHost(t){this.setFocus&&this.setFocus(t)}isOptionFocused(t){return this.focusedIndex===t}getAriaState(t){return this.isOptionFocused(t)}scrollToOption(){var t,e;let i=0;const{top:s,bottom:o}=this.listBox.getBoundingClientRect(),l=this.lists[this.focusedIndex],n=null===(t=this.lists[this.focusedIndex+1]||l)||void 0===t?void 0:t.getBoundingClientRect(),r=null===(e=this.lists[this.focusedIndex-1]||l)||void 0===e?void 0:e.getBoundingClientRect();(null==n?void 0:n.bottom)>o?i=n.bottom-o+2:(null==r?void 0:r.top)<s&&(i=r.top-s-2),this.updateOnNextFrame(()=>{this.listBox.scrollTop+=i})}getCustomContentName(t){const e=this.options.indexOf(t);if(this.isOptGroup){const t=this.options[e];if(t&&"string"!=typeof t)return t.slot}else if(-1!==e)return this.customContent[e].slot}setInputSelectionRange(t,e){this.input.setSelectionRange(t,e)}isOptionChecked(t){return-1!==this.findSelectedOption(t)?"true":"false"}getInputSelection(){return this.input.selectionStart}canMultiSelect(){return 0===this.getInputSelection()&&0!==this.selectedOptions.length&&this.isMulti}removeMultiTag(){this.selected&&this.multiSelected.forEach(t=>{const e=this.selected[t];e&&e.hasAttribute("selected")&&this.removeSelected(this.selectedOptions[t])})}unselectedAllMultiTag(){this.selected&&this.selected.forEach(t=>t.removeAttribute("selected")),this.multiSelectedIndex=-1}findLastMultiSelected(){return this.selected[this.multiSelectedIndex]}toggleMultiSelectedTag(t,e){t&&t.toggleAttribute("selected",e)}selectMultiTag(t){if(this.canMultiSelect()){if(!t){this.multiSelected=[];const t=this.findLastMultiSelected();this.toggleMultiSelectedTag(t,!1)}this.multiSelectedIndex<=0?this.multiSelectedIndex=this.selectedOptions.length-1:this.multiSelectedIndex--,this.multiSelected.push(this.multiSelectedIndex);const e=this.findLastMultiSelected();this.toggleMultiSelectedTag(e,!0)}}handleListClick(t){return v(this,void 0,void 0,function*(){this.dispatchEvent(new CustomEvent("selected-changed",{detail:{event:t}})),yield this.updateComplete,this.isMulti?this.setVisualListbox(!0):this.setVisualListbox(!1),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})})}handleSelectAll(){return v(this,void 0,void 0,function*(){this.isSelectAllChecked=!this.isSelectAllChecked,this.isSelectAllChecked?(this.selectedOptions=[...this.options],this.checkAllOptions()):(this.selectedOptions=[],this.unCheckedAllOptions()),yield this.updateComplete,this.setVisualListbox(!0),this.notifySelectedChange({selected:this.selectedOptions})})}handleInputKeyUp(t){switch(t.code){case o.Uz.Escape:break;case o.Uz.Backspace:this.setFocusOnHost(!0),this.setVisualListbox(!0),this.resizeListbox(),this.removeMultiTag();break;case o.Uz.ArrowLeft:this.isMulti&&(t.shiftKey?this.selectMultiTag(!0):this.selectMultiTag(!1));break;default:this.isMulti&&this.unselectedAllMultiTag()}}handleInput(t){const e=t.target.value;this.inputValue=e.trim(),this.notifyInputValueChanged(e.trim())}removeAllSelected(){var t;this.focusedIndex=-1,this.focusedGroupIndex=-1,this.selectedOptions=[],this.inputValue="",this.setInputValue(),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,""),this.setVisualListbox(!1),this.unCheckedAllOptions(),this.setSelectedAttribute(void 0),this.updateOnNextFrame(()=>{this.input.focus()}),this.notifySelectedChange({selected:this.selectedOptions})}removeSelected(t){const e=this.findSelectedOption(t),i=this.filteredOptions.indexOf(t);-1!==i&&this.unCheckedOption(i),-1!==e&&(this.selectedOptions.splice(e,1),this.requestUpdate()),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})}selectedChange(t){var e;const{event:i}=t.detail;let s=this.findOptionIndex(i);if(-1!==s){this.focusedIndex=this.allowSelectAll&&this.checkForVirtualScroll()?s+1:s,this.isMulti&&this.allowSelectAll&&!this.checkForVirtualScroll()&&(s-=1);const t=this.getFocusedItem(s);this.setSelectedAttribute(t),t&&(this.setSelectedOption(t),this.isMulti?this.isMulti&&this.allowSelectAll&&(this.isSelectAllChecked=this.isSelectAllSelected()):(this.setInputValue(this.getOptionValue(t)),null===(e=this.input)||void 0===e||e.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(t))))}}setSelectedAttribute(t){var e;let i="";t&&(i=this.getOptionId(t)),null===(e=this.lists)||void 0===e||e.forEach((t,e)=>{(null==t?void 0:t.id)===i?null==t||t.setAttribute("selected","true"):null==t||t.setAttribute("selected","false")})}shouldChangeButton(){const t=this.input&&this.input.value.length>0&&!this.noClearIcon||this.isMulti&&this.selectedOptions.length&&!this.noClearIcon;return t&&document.dispatchEvent(new CustomEvent("on-widget-update")),t}setCustomValue(){this.optionId||this.optionValue||(this.options=[...this.options,this.inputValue],this.setSelectedOption(this.inputValue),this.isMulti||this.updateOnNextFrame(()=>{var t;this.focusedIndex=this.filteredOptions.length-1;const e=this.getFocusedItem(this.focusedIndex);e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))}),this.dispatchEvent(new CustomEvent("custom-value-add",{composed:!0,bubbles:!0,detail:{value:this.inputValue}}))),this.inputValue=""}handleGroupFocus(){this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.filteredGroupOptions.length>0&&-1===this.focusedGroupIndex&&(this.focusedGroupIndex=this.filteredGroupOptions.findIndex(t=>"string"!=typeof t&&t.groupName===this.groupExpandedList[0])),this.updateOnNextFrame(()=>{-1===this.focusedGroupIndex||!this.allowSelectAll&&this.focusedGroupIndex>=this.filteredGroupOptions.length-1||this.allowSelectAll&&this.focusedGroupIndex>=this.filteredGroupOptions.length?this.focusedGroupIndex=0:this.focusedGroupIndex++}),this.focusedIndex=-1}handleInputKeyDown(t){var e,i;switch(t.code){case o.Uz.Backspace:this.focusedIndex=-1;break;case o.Uz.Tab:case o.Uz.Enter:if(this.setFocusOnHost(!0),this.expanded&&this.updateOnNextFrame(()=>{var t;const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);this.allowCustomValue&&this.input&&this.input.value.length&&-1===this.findFilteredOption(this.inputValue)?this.setCustomValue():(e&&(this.setSelectedAttribute(e),this.setSelectedOption(e),this.showSelectedCount||(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))),this.isMulti&&this.allowSelectAll&&0===this.focusedIndex&&this.handleSelectAll())}),this.setVisualListbox(!1),t.code===o.Uz.Tab&&this.isMulti)return;break;case o.Uz.ArrowDown:if(this.isOptGroup&&0===this.filteredOptions.length)return void this.handleGroupFocus();this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.updateOnNextFrame(()=>{var t;-1===this.focusedIndex||!this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length-1||this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length?this.focusedIndex=0:this.focusedIndex++;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],!this.showSelectedCount&&e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e))),this.focusedGroupIndex=-1});break;case o.Uz.ArrowUp:if(this.isOptGroup&&0===this.filteredOptions.length)return void this.handleGroupFocus();this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.updateOnNextFrame(()=>{var t;this.focusedIndex<=0?this.focusedIndex=this.allowSelectAll?this.filteredOptions.length:this.filteredOptions.length-1:this.focusedIndex--;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],e&&!this.showSelectedCount&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.focusedGroupIndex=-1)});break;case o.Uz.ArrowLeft:case o.Uz.ArrowRight:t.stopPropagation();break;case o.Uz.Escape:this.setFocusOnHost(!0),this.expanded?(t.stopPropagation(),this.setVisualListbox(!1)):(this.setInputValue(),null===(e=this.input)||void 0===e||e.setAttribute(o.iw.AriaActivedescendant,""),this.focusedIndex=-1,this.focusedGroupIndex=-1,this.removeAllSelected(),this.setSelectedAttribute(void 0));break;case o.Uz.Home:this.setInputSelectionRange(0,0);break;case o.Uz.End:{const{length:t}=this.inputValue;this.setInputSelectionRange(t,t)}break;case o.Uz.Space:if(this.isMulti&&this.expanded){t.preventDefault();const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);e&&(this.setSelectedOption(e),this.setSelectedAttribute(e),this.showSelectedCount||(this.setInputValue(),null===(i=this.input)||void 0===i||i.setAttribute(o.iw.AriaActivedescendant,""))),0===this.focusedIndex&&this.allowSelectAll&&this.handleSelectAll()}this.expanded=!0}}handleGroupLabelKeyDown(t,e){switch(t.code){case o.Uz.Tab:this.handleGroupFocus();break;case o.Uz.Enter:case o.Uz.Space:-1!==this.focusedGroupIndex?this.toggleGroupListBox(t,e.value):(this.setFocusOnHost(!0),this.setVisualListbox(!1),this.updateOnNextFrame(()=>{var t;const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);e&&(this.setSelectedOption(e),this.showSelectedCount||(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1}))),this.isMulti&&this.allowSelectAll&&0===this.focusedIndex&&this.handleSelectAll()}));break;case o.Uz.ArrowDown:if(0===this.filteredOptions.length)return;this.setFocusOnHost(!1),this.updateOnNextFrame(()=>{var t;-1===this.focusedIndex||!this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length-1||this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length?this.focusedIndex=0:this.focusedIndex++;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],!this.showSelectedCount&&e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e))),this.focusedGroupIndex=-1});break;case o.Uz.ArrowUp:if(this.isOptGroup&&0===this.filteredOptions.length)return;this.setFocusOnHost(!1),this.updateOnNextFrame(()=>{var t;this.focusedIndex<=0?this.focusedIndex=this.allowSelectAll?this.filteredOptions.length:this.filteredOptions.length-1:this.focusedIndex--;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],e&&!this.showSelectedCount&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))});break;case o.Uz.Escape:this.focusedGroupIndex=-1,this.setVisualListbox(!1),this.setFocusOnHost(!0),this.input.focus();break;default:this.setVisualListbox(!0)}}toggleVisualListBox(t){var e,i;if(!this.readOnly){if(t.target.classList.contains("md-combobox-listbox"))t.target.focus();else if("md-icon"===t.target.localName){const s=null===(i=null===(e=t.target.parentElement)||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.parentElement;if(s){const t=s.querySelector(".md-combobox-listbox");(0,g.setTimeout)(()=>{t.focus()},10)}}this.expanded?this.setVisualListbox(!1):(this.dispatchEvent(new CustomEvent("combobox-on-expand",{composed:!0,bubbles:!0})),this.notifySearchResultCount(),this.setVisualListbox(!0)),this.input.focus(),this.setGroupList(""),this.focusedGroupIndex=-1}}toggleGroupListBox(t,e){t.stopPropagation(),this.focusedGroupIndex=this.filteredGroupOptions.findIndex(t=>"string"!=typeof t&&t.groupName===e),this.setGroupList(e),this.resizeListbox()}handleRemoveAll(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("remove-all-selected"))}connectedCallback(){super.connectedCallback(),this.setupEvents(),this.querySelector("optgroup")&&(this.isOptGroup=!0)}disconnectedCallback(){super.disconnectedCallback(),this.teardownEvents()}static get styles(){return[a.A,f.A]}get listItemOptionMap(){return{"md-combobox-multiselect":this.isMulti,compact:this.compact,"md-combobox-dropdown-arrow":this.isDropdownArrow}}get filteredOptions(){return this.filterOptions(this.trimSpace?this.inputValue.replace(/\s+/g,""):this.inputValue).filter(t=>!this.isOptGroup||("string"!=typeof t&&this.groupExpandedList.includes(this.getOptionGroupName(t))?"false"===t.isLabel:void 0))}get filteredGroupOptions(){return this.filterOptions(this.trimSpace?this.inputValue.replace(/\s+/g,""):this.inputValue).filter(t=>!this.isOptGroup||("string"!=typeof t?"true"===t.isLabel:void 0))}get comboBoxTemplateClassMap(){return{[`md-combobox--${this.shape}`]:!!this.shape,"md-combobox-searchable":this.searchable,"md-combobox-has-leading-icon":this.searchable||this.showFilterIcon,"md-new-combobox":this.newMomentum,[`md-${this.messageType}`]:!!this.messageType,"md-combobox-readonly":this.readOnly,"md-combobox-compact":this.compact,"md-combobox-dropdown-arrow":this.isDropdownArrow}}searchIconTemplate(){return this.leadingIconTemplate("search-bold","search-icon")}filterIconTemplate(){return this.leadingIconTemplate("filter-bold","filter-icon")}leadingIconTemplate(t,e){return h.html`
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/repeat","lit-virtualizer"],e);else{var i="object"==typeof exports?e(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer")):e(t["lit-element"],t["lit-html/directives/class-map"],t["lit-html"],t["lit-html/directives/style-map"],t["lit-html/directives/if-defined"],t["@momentum-ui/icons/data/momentumUiIconsNames.json"],t["@momentum-ui/utils/lib/getColorValue"],t.mobx,t["lit-html/directives/repeat"],t["lit-virtualizer"]);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(self,(t,e,i,s,o,l,n,r,a,h)=>(()=>{"use strict";var d,p={4928:(t,e,i)=>{i.r(e),i.d(e,{ComboBox:()=>s}),i(20109),i(61200);var s,o=i(90195),l=i(3001),n=i(31890),r=i(66677),a=i(26272),h=i(41488),d=i(40333),p=i(23968),u=i(97822),c=i(22818),m=i(8229),b=i(86635),g=i(97103),f=i(46795),x=function(t,e,i,s){var o,l=arguments.length,n=l<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(n=(l<3?o(n):l>3?o(e,i,n):o(e,i))||n);return l>3&&n&&Object.defineProperty(e,i,n),n},v=function(t,e,i,s){return new(i||(i=Promise))(function(o,l){function n(t){try{a(s.next(t))}catch(t){l(t)}}function r(t){try{a(s.throw(t))}catch(t){l(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,r)}a((s=s.apply(t,e||[])).next())})};!function(t){class e{determineMessageType(t){return t.reduce((t,e)=>"error"===e?t:e.type,"")}filterMessagesByType(t,e){return t.reduce((t,i)=>i.type===e?t.concat(i.message):t,[])}}t.MessageController=e;let i=class extends((0,l.yC)(h.LitElement)){constructor(){super(...arguments),this._focusedIndex=-1,this._focusedGroupIndex=-1,this.label="Options",this.options=[],this.customOptions=[],this.placeholder="",this.isMulti=!1,this.useVirtualScroll=!1,this.disabled=!1,this.ordered=!1,this.expanded=!1,this.groupExpandedList=[],this.searchItem=!1,this.compact=!1,this.noClearIcon=!1,this.selectWhenInFocus=!1,this.selectedOptions=[],this.visibleOptions=8,this.optionId="",this.optionValue="",this.isCustomContent=!1,this.searchable=!1,this.shape="none",this.value=[],this.inputValue="",this.allowCustomValue=!1,this.autofocus=!1,this.resultsTextLocalization="No Results",this.optionsTextLocalization="No Options",this.trimSpace=!1,this.invalid=!1,this.invalidText="",this.ariaLabel="",this.searchResultAriaLabel="",this.ariaLabelForComboBox="",this.clearAriaLabel="Clear",this.arrowAriaLabel="Expand",this.clearIconHeight="auto",this.allTextLocalization="All",this.selectAllTextLocalization="Select All",this.selectedTextLocalization="Selected",this.allowSelectAll=!1,this.showCustomError=!1,this.showLoader=!1,this.showSelectedCount=!1,this.popupChevronAriaHidden="true",this.newMomentum=!1,this.showFilterIcon=!1,this.preventFilter=!1,this.isDropdownArrow=!1,this.comboboxId="",this.helpText="",this.messageArr=[],this.htmlId="",this.readOnly=!1,this.messageController=new e,this.isOptGroup=!1,this.isSelectAllChecked=!1,this.multiSelectedIndex=-1,this.multiSelected=[],this.customContent=[],this.notifySelectedChange=(0,r.sg)(t=>{this.dispatchEvent(new CustomEvent("change-selected",{composed:!0,bubbles:!0,detail:t}))},0),this.handleGroupFilter=t=>{const e=t.filter(t=>{if("string"!=typeof t&&"true"===t.isLabel)return t.groupName});return this.searchItem=!0,this.groupExpandedList=e.map(t=>{if("string"!=typeof t)return t.groupName}),t.filter(e=>"string"==typeof e||"true"!==e.isLabel||!!t.find(t=>{if("string"!=typeof e&&"string"!=typeof t)return e.groupName===t.groupName&&"false"===t.isLabel}))},this.notifyInputValueChanged=(0,r.sg)(t=>{this.dispatchEvent(new CustomEvent("combobox-input",{composed:!0,bubbles:!0,detail:{value:t}})),this.notifySearchResultCount(),this.focusedGroupIndex=0,requestAnimationFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})},250),this.handleOutsideClick=t=>{let e=!1;const i=t.composedPath();i.length&&(e=!!i.find(t=>t===this),e||(this.setVisualListbox(!1),this.unselectedAllMultiTag()))}}get focusedIndex(){return this._focusedIndex}set focusedIndex(t){this.updateFocusedIndex(t)}updateFocusedIndex(t){var e;const i=this._focusedIndex;if(this.checkForVirtualScroll()){let i;i=this.allowSelectAll?0===t?"selectAll":this.getOptionId(this.filteredOptions[t-1]):this.getOptionId(this.filteredOptions[t]);const s=this.lists?null===(e=[...this.lists])||void 0===e?void 0:e.find(t=>0!==t.offsetHeight&&t.id===i):"";this.lists&&[...this.lists].forEach(t=>{t.toggleAttribute("focused",!1)}),s&&(null==s||s.toggleAttribute("focused",!0))}else if(this.lists){const e=this.lists[i];e&&e.toggleAttribute("focused",!1);const s=this.lists[t];s&&s.toggleAttribute("focused",!0)}this._focusedIndex=t,this.requestUpdate("focusedIndex",i)}get focusedGroupIndex(){return this._focusedGroupIndex}set focusedGroupIndex(t){const e=this._focusedGroupIndex;if(this.labels&&0!==this.labels.length){const i=this.labels[e];i&&i.toggleAttribute("focused",!1);const s=this.labels[t];s&&(s.toggleAttribute("focused",!0),s.focus())}this._focusedGroupIndex=t,this.requestUpdate("focusedGroupIndex",e)}get messageType(){return this.messageArr.length>0?this.messageController.determineMessageType(this.messageArr):null}get messages(){return this.messageType?this.messageController.filterMessagesByType(this.messageArr,this.messageType):null}notifySearchResultCount(){if(this.searchResultAriaLabel){const t=/{{.*?}}/g;this.ariaLabelForComboBox=this.searchResultAriaLabel.replace(t,this.filteredOptions.length.toString())}else this.ariaLabel?this.ariaLabelForComboBox=`${this.ariaLabel}, ${this.filteredOptions.length} results found.`:this.ariaLabelForComboBox=`ComboBox Element, ${this.filteredOptions.length} results found.`}firstUpdated(t){this.ariaLabelForComboBox=this.ariaLabel?this.ariaLabel:"ComboBox Element",super.firstUpdated(t),this.isCustomContent&&(this.optionId="id",this.optionValue="value",this.setOptionCustomContent()),this.setInitialValue()}updated(t){super.updated(t),t.has("expanded")&&(this.expanded?(this.resizeListbox(),this.checkSelectedOptions()):this.unCheckAllOptions()),t.has("focusedIndex")&&this.focusedIndex>=0&&(this.checkForVirtualScroll()||this.scrollToOption()),t.has("value")&&0===this.selectedOptions.length&&this.setInitialValue(),t.has("customOptions")&&this.isCustomContent&&(this.setOptionCustomContent(),this.resizeListbox()),t.has("showCustomError")&&this.resizeListbox(),t.has("showLoader")&&this.resizeListbox(),t.has("searchItem")&&this.resizeListbox()}handleFocusIn(t){var e;this.disabled&&!this.readOnly||(this.noClearIcon&&(requestAnimationFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1}),this.selectWhenInFocus&&this.input.select()),null===(e=super.handleFocusIn)||void 0===e||e.call(this,t)),this.dispatchEvent(new CustomEvent("combobox-focus-in",{composed:!0,bubbles:!0}))}handleFocusOut(t){var e;null===(e=super.handleFocusOut)||void 0===e||e.call(this,t),this.dispatchEvent(new CustomEvent("combobox-focus-out",{composed:!0,bubbles:!0}))}findFilteredOption(t){return this.isOptionObject(t)?this.filteredOptions.findIndex(e=>this.getOptionId(e)===this.getOptionId(t)&&this.getOptionValue(e)===this.getOptionValue(t)):this.filteredOptions.indexOf(t)}setInitialValue(){var t;if(this.value.length)if(this.isMulti)this.value.forEach(t=>{-1!==this.findFilteredOption(t)&&this.setSelectedOption(t)});else{const e=this.value[0],i=this.findFilteredOption(e);-1!==i&&(this.setSelectedOption(e),this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.focusedIndex=i,this.focusedGroupIndex=-1)}}isOptionObject(t){return"object"==typeof t&&null!==t}setOptionCustomContent(){if(this.isOptGroup){const t=[...this.querySelectorAll("optgroup")],e=[];for(const i of t){const t=i.getAttribute("label"),s=[...i.querySelectorAll("[slot]")];e.push({isLabel:"true",[this.optionValue]:t,groupName:t});for(const i of s){const s=i.getAttribute("aria-label"),o=i.getAttribute("display-value"),l=i.getAttribute("slot");s&&o&&e.push({[this.optionId]:s,[this.optionValue]:o,isLabel:"false",groupName:t,slot:l})}}this.options=e}else this.customContent=[...this.querySelectorAll("[slot]")],this.customContent&&this.customContent.length?this.options=this.customContent.map(t=>{const e=t.getAttribute("aria-label"),i=t.getAttribute("display-value");if(e&&i)return{[this.optionId]:e,[this.optionValue]:i}}):this.options=[]}getOptionValue(t){return this.isOptionObject(t)?String(t[this.optionValue]):t}getOptionGroupName(t){return null==t?void 0:t.groupName}getOptionId(t){return this.isOptionObject(t)?String(t[this.optionId]):t}getFocusedItem(t){if(t>=0)return this.filteredOptions[t]}setupEvents(){document.addEventListener("click",this.handleOutsideClick),this.addEventListener("remove-all-selected",this.removeAllSelected),this.addEventListener("selected-changed",this.selectedChange)}teardownEvents(){document.removeEventListener("click",this.handleOutsideClick),this.removeEventListener("remove-all-selected",this.removeAllSelected),this.removeEventListener("selected-changed",this.selectedChange)}setVisualListbox(t){this.expanded=t}setGroupList(t){this.groupExpandedList.includes(t)?(this.groupExpandedList.splice(this.groupExpandedList.indexOf(t),1),this.groupExpandedList=[...this.groupExpandedList]):this.searchItem?this.groupExpandedList.push(t):this.groupExpandedList=[t]}findSelectedOption(t){return this.optionId&&t?this.selectedOptions.findIndex(e=>e&&e[this.optionId]===t[this.optionId]):this.selectedOptions.indexOf(t)}findOptionIndex(t){const e=t.composedPath();if(this.checkForVirtualScroll()){let t="";return[...this.lists].forEach(i=>{e.includes(i)&&(t=i.id)}),this.filteredOptions.findIndex(e=>this.getOptionId(e)===t)}return[...this.lists].findIndex(t=>e.includes(t))}checkSelectedOptions(){if(this.checkForVirtualScroll()){const t=this.selectedOptions.map(t=>this.getOptionId(t)),e=[...this.lists].filter(t=>"selectAll"!==t.id);null==e||e.forEach(e=>{t.includes(e.id)?(this.isMulti&&(null==e||e.setAttribute("aria-checked","true")),null==e||e.setAttribute("aria-selected","true")):this.isMulti&&(null==e||e.setAttribute("aria-checked","false"))})}}unCheckAllOptions(){var t;this.checkForVirtualScroll()&&this.isMulti&&(null===(t=[...this.lists])||void 0===t||t.forEach(t=>{"selectAll"!==(null==t?void 0:t.id)&&(null==t||t.setAttribute("aria-checked","false"))}))}setSelectedOption(t){this.isMulti||(this.selectedOptions=[]);const e=this.findSelectedOption(t);if(-1!==e){const t=this.selectedOptions[e];this.selectedOptions.splice(e,1),this.notifySelectedChange({value:t,selected:this.selectedOptions})}else this.selectedOptions.push(t),this.notifySelectedChange({value:t,selected:this.selectedOptions});this.checkSelectedOptions(),this.isMulti&&this.allowSelectAll&&(this.isSelectAllChecked=this.isSelectAllSelected()),this.requestUpdate()}filterOptions(t){if(this.preventFilter)return this.searchItem=!1,this.options;if(t&&t.length){const e=this.options.filter(e=>this.isOptGroup&&"string"!=typeof e&&"true"===e.isLabel?e:(this.isCustomContent?this.getOptionId(e):this.getOptionValue(e)).toLowerCase().includes(t.toLowerCase()));return this.isOptGroup?this.handleGroupFilter(e):e}return this.searchItem=!1,this.options}getListBoxVerticalPadding(){if(this.listBox){const t=window.getComputedStyle(this.listBox,null),e=parseInt(t.getPropertyValue("padding-top"))+parseInt(t.getPropertyValue("padding-bottom"));if(!isNaN(e))return e+2}return 10}resizeListbox(){this.updateOnNextFrame(()=>{var t;let e=0,i=0,s=0;const o=this.getListBoxVerticalPadding();if(this.lists){const t=this.checkForVirtualScroll()?[...this.lists].filter(t=>0!==t.offsetHeight):[...this.lists];e=t.slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0),s=this.checkForVirtualScroll()&&this.allowSelectAll?t.slice(1,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0):t.slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0)}if(this.labels&&(i=[...this.labels].slice(0,this.visibleOptions).reduce((t,e)=>t+e.offsetHeight,0)),this.listBox&&(this.listBox.style.maxHeight=`${e+i+o}px`),this.virtualizer&&(this.virtualizer.style.height=`${s+o}px`),this.showCustomError||this.showLoader){const e=null===(t=this.listBox)||void 0===t?void 0:t.querySelector("[slot]");this.listBox&&e&&(this.listBox.style.height=`${e.clientHeight+o}px`,this.listBox.style.maxHeight=`${e.clientHeight+o}px`)}})}setInputValue(t=""){this.input.value=t}updateOnNextFrame(t){requestAnimationFrame(t)}unCheckedAllOptions(){this.isMulti&&(this.lists.forEach((t,e)=>this.unCheckedOption(e)),this.isSelectAllChecked=!1)}unCheckedOption(t){this.isMulti&&(this.lists[t].setAttribute("aria-checked","false"),this.notifySelectedChange({value:this.filteredOptions[t],selected:this.selectedOptions}))}checkAllOptions(){this.isMulti&&this.lists.forEach((t,e)=>this.checkOption(e))}checkOption(t){this.isMulti&&(this.lists[t].setAttribute("aria-checked","true"),this.notifySelectedChange({value:this.filteredOptions[t],selected:this.selectedOptions}))}isSelectAllSelected(){return this.selectedOptions.length===this.options.length}setFocusOnHost(t){this.setFocus&&this.setFocus(t)}isOptionFocused(t){return this.focusedIndex===t}getAriaState(t){return this.isOptionFocused(t)}scrollToOption(){var t,e;let i=0;const{top:s,bottom:o}=this.listBox.getBoundingClientRect(),l=this.lists[this.focusedIndex],n=null===(t=this.lists[this.focusedIndex+1]||l)||void 0===t?void 0:t.getBoundingClientRect(),r=null===(e=this.lists[this.focusedIndex-1]||l)||void 0===e?void 0:e.getBoundingClientRect();(null==n?void 0:n.bottom)>o?i=n.bottom-o+2:(null==r?void 0:r.top)<s&&(i=r.top-s-2),this.updateOnNextFrame(()=>{this.listBox.scrollTop+=i})}getCustomContentName(t){const e=this.options.indexOf(t);if(this.isOptGroup){const t=this.options[e];if(t&&"string"!=typeof t)return t.slot}else if(-1!==e)return this.customContent[e].slot}setInputSelectionRange(t,e){this.input.setSelectionRange(t,e)}isOptionChecked(t){return-1!==this.findSelectedOption(t)?"true":"false"}getInputSelection(){return this.input.selectionStart}canMultiSelect(){return 0===this.getInputSelection()&&0!==this.selectedOptions.length&&this.isMulti}removeMultiTag(){this.selected&&this.multiSelected.forEach(t=>{const e=this.selected[t];e&&e.hasAttribute("selected")&&this.removeSelected(this.selectedOptions[t])})}unselectedAllMultiTag(){this.selected&&this.selected.forEach(t=>t.removeAttribute("selected")),this.multiSelectedIndex=-1}findLastMultiSelected(){return this.selected[this.multiSelectedIndex]}toggleMultiSelectedTag(t,e){t&&t.toggleAttribute("selected",e)}selectMultiTag(t){if(this.canMultiSelect()){if(!t){this.multiSelected=[];const t=this.findLastMultiSelected();this.toggleMultiSelectedTag(t,!1)}this.multiSelectedIndex<=0?this.multiSelectedIndex=this.selectedOptions.length-1:this.multiSelectedIndex--,this.multiSelected.push(this.multiSelectedIndex);const e=this.findLastMultiSelected();this.toggleMultiSelectedTag(e,!0)}}handleListClick(t){return v(this,void 0,void 0,function*(){this.dispatchEvent(new CustomEvent("selected-changed",{detail:{event:t}})),yield this.updateComplete,this.isMulti?this.setVisualListbox(!0):this.setVisualListbox(!1),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})})}handleSelectAll(){return v(this,void 0,void 0,function*(){this.isSelectAllChecked=!this.isSelectAllChecked,this.isSelectAllChecked?(this.selectedOptions=[...this.options],this.checkAllOptions()):(this.selectedOptions=[],this.unCheckedAllOptions()),yield this.updateComplete,this.setVisualListbox(!0),this.notifySelectedChange({selected:this.selectedOptions})})}handleInputKeyUp(t){switch(t.code){case o.Uz.Escape:break;case o.Uz.Backspace:this.setFocusOnHost(!0),this.setVisualListbox(!0),this.resizeListbox(),this.removeMultiTag();break;case o.Uz.ArrowLeft:this.isMulti&&(t.shiftKey?this.selectMultiTag(!0):this.selectMultiTag(!1));break;default:this.isMulti&&this.unselectedAllMultiTag()}}handleInput(t){const e=t.target.value;this.inputValue=e.trim(),this.notifyInputValueChanged(e.trim())}removeAllSelected(){var t;this.focusedIndex=-1,this.focusedGroupIndex=-1,this.selectedOptions=[],this.inputValue="",this.setInputValue(),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,""),this.setVisualListbox(!1),this.unCheckedAllOptions(),this.setSelectedAttribute(void 0),this.updateOnNextFrame(()=>{this.input.focus()}),this.notifySelectedChange({selected:this.selectedOptions})}removeSelected(t){const e=this.findSelectedOption(t),i=this.filteredOptions.indexOf(t);-1!==i&&this.unCheckedOption(i),-1!==e&&(this.selectedOptions.splice(e,1),this.requestUpdate()),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1})}selectedChange(t){var e;const{event:i}=t.detail;let s=this.findOptionIndex(i);if(-1!==s){this.focusedIndex=this.allowSelectAll&&this.checkForVirtualScroll()?s+1:s,this.isMulti&&this.allowSelectAll&&!this.checkForVirtualScroll()&&(s-=1);const t=this.getFocusedItem(s);this.setSelectedAttribute(t),t&&(this.setSelectedOption(t),this.isMulti?this.isMulti&&this.allowSelectAll&&(this.isSelectAllChecked=this.isSelectAllSelected()):(this.setInputValue(this.getOptionValue(t)),null===(e=this.input)||void 0===e||e.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(t))))}}setSelectedAttribute(t){var e;let i="";t&&(i=this.getOptionId(t)),null===(e=this.lists)||void 0===e||e.forEach((t,e)=>{(null==t?void 0:t.id)===i?null==t||t.setAttribute("selected","true"):null==t||t.setAttribute("selected","false")})}shouldChangeButton(){const t=this.input&&this.input.value.length>0&&!this.noClearIcon||this.isMulti&&this.selectedOptions.length&&!this.noClearIcon;return t&&document.dispatchEvent(new CustomEvent("on-widget-update")),t}setCustomValue(){this.optionId||this.optionValue||(this.options=[...this.options,this.inputValue],this.setSelectedOption(this.inputValue),this.isMulti||this.updateOnNextFrame(()=>{var t;this.focusedIndex=this.filteredOptions.length-1;const e=this.getFocusedItem(this.focusedIndex);e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))}),this.dispatchEvent(new CustomEvent("custom-value-add",{composed:!0,bubbles:!0,detail:{value:this.inputValue}}))),this.inputValue=""}handleGroupFocus(){this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.filteredGroupOptions.length>0&&-1===this.focusedGroupIndex&&(this.focusedGroupIndex=this.filteredGroupOptions.findIndex(t=>"string"!=typeof t&&t.groupName===this.groupExpandedList[0])),this.updateOnNextFrame(()=>{-1===this.focusedGroupIndex||!this.allowSelectAll&&this.focusedGroupIndex>=this.filteredGroupOptions.length-1||this.allowSelectAll&&this.focusedGroupIndex>=this.filteredGroupOptions.length?this.focusedGroupIndex=0:this.focusedGroupIndex++}),this.focusedIndex=-1}handleInputKeyDown(t){var e,i;switch(t.code){case o.Uz.Backspace:this.focusedIndex=-1;break;case o.Uz.Tab:case o.Uz.Enter:if(this.setFocusOnHost(!0),this.expanded&&this.updateOnNextFrame(()=>{var t;const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);this.allowCustomValue&&this.input&&this.input.value.length&&-1===this.findFilteredOption(this.inputValue)?this.setCustomValue():(e&&(this.setSelectedAttribute(e),this.setSelectedOption(e),this.showSelectedCount||(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))),this.isMulti&&this.allowSelectAll&&0===this.focusedIndex&&this.handleSelectAll())}),this.setVisualListbox(!1),t.code===o.Uz.Tab&&this.isMulti)return;break;case o.Uz.ArrowDown:if(this.isOptGroup&&0===this.filteredOptions.length)return void this.handleGroupFocus();this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.updateOnNextFrame(()=>{var t;-1===this.focusedIndex||!this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length-1||this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length?this.focusedIndex=0:this.focusedIndex++;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],!this.showSelectedCount&&e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e))),this.focusedGroupIndex=-1});break;case o.Uz.ArrowUp:if(this.isOptGroup&&0===this.filteredOptions.length)return void this.handleGroupFocus();this.setFocusOnHost(!1),this.expanded||this.setVisualListbox(!0),this.updateOnNextFrame(()=>{var t;this.focusedIndex<=0?this.focusedIndex=this.allowSelectAll?this.filteredOptions.length:this.filteredOptions.length-1:this.focusedIndex--;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],e&&!this.showSelectedCount&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.focusedGroupIndex=-1)});break;case o.Uz.ArrowLeft:case o.Uz.ArrowRight:t.stopPropagation();break;case o.Uz.Escape:this.setFocusOnHost(!0),this.expanded?(t.stopPropagation(),this.setVisualListbox(!1)):(this.setInputValue(),null===(e=this.input)||void 0===e||e.setAttribute(o.iw.AriaActivedescendant,""),this.focusedIndex=-1,this.focusedGroupIndex=-1,this.removeAllSelected(),this.setSelectedAttribute(void 0));break;case o.Uz.Home:this.setInputSelectionRange(0,0);break;case o.Uz.End:{const{length:t}=this.inputValue;this.setInputSelectionRange(t,t)}break;case o.Uz.Space:if(this.isMulti&&this.expanded){t.preventDefault();const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);e&&(this.setSelectedOption(e),this.setSelectedAttribute(e),this.showSelectedCount||(this.setInputValue(),null===(i=this.input)||void 0===i||i.setAttribute(o.iw.AriaActivedescendant,""))),0===this.focusedIndex&&this.allowSelectAll&&this.handleSelectAll()}this.expanded=!0}}handleGroupLabelKeyDown(t,e){switch(t.code){case o.Uz.Tab:this.handleGroupFocus();break;case o.Uz.Enter:case o.Uz.Space:-1!==this.focusedGroupIndex?this.toggleGroupListBox(t,e.value):(this.setFocusOnHost(!0),this.setVisualListbox(!1),this.updateOnNextFrame(()=>{var t;const e=this.getFocusedItem(this.allowSelectAll?this.focusedIndex-1:this.focusedIndex);e&&(this.setSelectedOption(e),this.showSelectedCount||(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)),this.updateOnNextFrame(()=>{this.input.focus(),this.focusedGroupIndex=-1}))),this.isMulti&&this.allowSelectAll&&0===this.focusedIndex&&this.handleSelectAll()}));break;case o.Uz.ArrowDown:if(0===this.filteredOptions.length)return;this.setFocusOnHost(!1),this.updateOnNextFrame(()=>{var t;-1===this.focusedIndex||!this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length-1||this.allowSelectAll&&this.focusedIndex>=this.filteredOptions.length?this.focusedIndex=0:this.focusedIndex++;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],!this.showSelectedCount&&e&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e))),this.focusedGroupIndex=-1});break;case o.Uz.ArrowUp:if(this.isOptGroup&&0===this.filteredOptions.length)return;this.setFocusOnHost(!1),this.updateOnNextFrame(()=>{var t;this.focusedIndex<=0?this.focusedIndex=this.allowSelectAll?this.filteredOptions.length:this.filteredOptions.length-1:this.focusedIndex--;const e=this.getFocusedItem(this.focusedIndex);this.groupExpandedList=[this.getOptionGroupName(e)],e&&!this.showSelectedCount&&(this.setInputValue(this.getOptionValue(e)),null===(t=this.input)||void 0===t||t.setAttribute(o.iw.AriaActivedescendant,this.getOptionId(e)))});break;case o.Uz.Escape:this.focusedGroupIndex=-1,this.setVisualListbox(!1),this.setFocusOnHost(!0),this.input.focus();break;default:this.setVisualListbox(!0)}}toggleVisualListBox(t){var e,i;if(!this.readOnly){if(t.target.classList.contains("md-combobox-listbox"))t.target.focus();else if("md-icon"===t.target.localName){const s=null===(i=null===(e=t.target.parentElement)||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.parentElement;if(s){const t=s.querySelector(".md-combobox-listbox");(0,g.setTimeout)(()=>{t.focus()},10)}}this.expanded?this.setVisualListbox(!1):(this.dispatchEvent(new CustomEvent("combobox-on-expand",{composed:!0,bubbles:!0})),this.notifySearchResultCount(),this.setVisualListbox(!0)),this.input.focus(),this.setGroupList(""),this.focusedGroupIndex=-1}}toggleGroupListBox(t,e){t.stopPropagation(),this.focusedGroupIndex=this.filteredGroupOptions.findIndex(t=>"string"!=typeof t&&t.groupName===e),this.setGroupList(e),this.resizeListbox()}handleRemoveAll(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("remove-all-selected"))}connectedCallback(){super.connectedCallback(),this.setupEvents(),this.querySelector("optgroup")&&(this.isOptGroup=!0)}disconnectedCallback(){super.disconnectedCallback(),this.teardownEvents()}static get styles(){return[a.A,f.A]}get listItemOptionMap(){return{"md-combobox-multiselect":this.isMulti,compact:this.compact,"md-combobox-dropdown-arrow":this.isDropdownArrow}}get filteredOptions(){return this.filterOptions(this.trimSpace?this.inputValue.replace(/\s+/g,""):this.inputValue).filter(t=>!this.isOptGroup||("string"!=typeof t&&this.groupExpandedList.includes(this.getOptionGroupName(t))?"false"===t.isLabel:void 0))}get filteredGroupOptions(){return this.filterOptions(this.trimSpace?this.inputValue.replace(/\s+/g,""):this.inputValue).filter(t=>!this.isOptGroup||("string"!=typeof t?"true"===t.isLabel:void 0))}get comboBoxTemplateClassMap(){return{[`md-combobox--${this.shape}`]:!!this.shape,"md-combobox-searchable":this.searchable,"md-combobox-has-leading-icon":this.searchable||this.showFilterIcon,"md-new-combobox":this.newMomentum,[`md-${this.messageType}`]:!!this.messageType,"md-combobox-readonly":this.readOnly,"md-combobox-compact":this.compact,"md-combobox-dropdown-arrow":this.isDropdownArrow}}searchIconTemplate(){return this.leadingIconTemplate("search-bold","search-icon")}filterIconTemplate(){return this.leadingIconTemplate("filter-bold","filter-icon")}leadingIconTemplate(t,e){return h.html`
|
|
2
2
|
<md-icon
|
|
3
3
|
name=${t}
|
|
4
4
|
class=${e}
|
|
@@ -215,4 +215,4 @@
|
|
|
215
215
|
</div>
|
|
216
216
|
`:d.nothing}
|
|
217
217
|
${this.messagesTemplate()} ${this.helpTextTemplate()}
|
|
218
|
-
`}};x([(0,h.property)({type:String})],i.prototype,"label",void 0),x([(0,h.property)({type:Array})],i.prototype,"options",void 0),x([(0,h.property)({type:Array,attribute:"custom-options"})],i.prototype,"customOptions",void 0),x([(0,h.property)({type:String})],i.prototype,"placeholder",void 0),x([(0,h.property)({type:Boolean,attribute:"is-multi"})],i.prototype,"isMulti",void 0),x([(0,h.property)({type:Boolean,attribute:"use-virtual-scroll"})],i.prototype,"useVirtualScroll",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"ordered",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"expanded",void 0),x([(0,h.property)({type:Array,reflect:!0})],i.prototype,"groupExpandedList",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"searchItem",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"compact",void 0),x([(0,h.property)({type:Boolean,attribute:"no-clear-icon"})],i.prototype,"noClearIcon",void 0),x([(0,h.property)({type:Boolean,attribute:"select-when-in-focus"})],i.prototype,"selectWhenInFocus",void 0),x([(0,h.property)({type:Array})],i.prototype,"selectedOptions",void 0),x([(0,h.property)({type:Number,attribute:"visible-option",reflect:!0})],i.prototype,"visibleOptions",void 0),x([(0,h.property)({type:String,attribute:"option-id",reflect:!0})],i.prototype,"optionId",void 0),x([(0,h.property)({type:String,attribute:"option-value",reflect:!0})],i.prototype,"optionValue",void 0),x([(0,h.property)({type:Boolean,attribute:"with-custom-content"})],i.prototype,"isCustomContent",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"searchable",void 0),x([(0,h.property)({type:String})],i.prototype,"shape",void 0),x([(0,h.property)({type:Array})],i.prototype,"value",void 0),x([(0,h.property)({type:String,attribute:"input-value",reflect:!0})],i.prototype,"inputValue",void 0),x([(0,h.property)({type:Boolean,attribute:"allow-custom-value",reflect:!0})],i.prototype,"allowCustomValue",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"autofocus",void 0),x([(0,h.property)({type:String,attribute:"no-results-i18n"})],i.prototype,"resultsTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"no-options-i18n"})],i.prototype,"optionsTextLocalization",void 0),x([(0,h.property)({type:Boolean,reflect:!0,attribute:"search-trim-space"})],i.prototype,"trimSpace",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"invalid",void 0),x([(0,h.property)({type:String,reflect:!0,attribute:"invalid-text-i18n"})],i.prototype,"invalidText",void 0),x([(0,h.property)({type:String,reflect:!0})],i.prototype,"ariaLabel",void 0),x([(0,h.property)({type:String,attribute:"search-result-aria-label"})],i.prototype,"searchResultAriaLabel",void 0),x([(0,h.internalProperty)()],i.prototype,"ariaLabelForComboBox",void 0),x([(0,h.property)({type:String,attribute:"clear-aria-label"})],i.prototype,"clearAriaLabel",void 0),x([(0,h.property)({type:String,attribute:"arrow-aria-label"})],i.prototype,"arrowAriaLabel",void 0),x([(0,h.property)({type:String,attribute:"clear-icon-height"})],i.prototype,"clearIconHeight",void 0),x([(0,h.property)({type:String,attribute:"all-i18n"})],i.prototype,"allTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"select-all-i18n"})],i.prototype,"selectAllTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"selected-all-i18n"})],i.prototype,"selectedTextLocalization",void 0),x([(0,h.property)({type:Boolean,attribute:"allow-select-all",reflect:!0})],i.prototype,"allowSelectAll",void 0),x([(0,h.property)({type:Boolean,attribute:"show-custom-error",reflect:!0})],i.prototype,"showCustomError",void 0),x([(0,h.property)({type:Boolean,attribute:"show-loader",reflect:!0})],i.prototype,"showLoader",void 0),x([(0,h.property)({type:Boolean,attribute:"show-selected-count",reflect:!0})],i.prototype,"showSelectedCount",void 0),x([(0,h.property)({type:String,attribute:"popup-chevron-aria-hidden"})],i.prototype,"popupChevronAriaHidden",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"newMomentum",void 0),x([(0,h.property)({type:Boolean,attribute:"show-filter-icon"})],i.prototype,"showFilterIcon",void 0),x([(0,h.property)({type:Boolean,attribute:"prevent-filter"})],i.prototype,"preventFilter",void 0),x([(0,h.property)({type:Boolean,attribute:"is-dropdown-arrow"})],i.prototype,"isDropdownArrow",void 0),x([(0,h.property)({type:String})],i.prototype,"comboboxId",void 0),x([(0,h.property)({type:String})],i.prototype,"helpText",void 0),x([(0,h.property)({type:Array})],i.prototype,"messageArr",void 0),x([(0,h.property)({type:String})],i.prototype,"htmlId",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"readOnly",void 0),x([(0,h.internalProperty)()],i.prototype,"isOptGroup",void 0),x([(0,h.internalProperty)()],i.prototype,"isSelectAllChecked",void 0),x([(0,h.query)(".group")],i.prototype,"group",void 0),x([(0,h.query)(".md-combobox-listbox")],i.prototype,"input",void 0),x([(0,h.query)(".md-combobox-button")],i.prototype,"button",void 0),x([(0,h.query)("div#md-combobox-listbox")],i.prototype,"listBox",void 0),x([(0,h.query)(".virtual-scroll")],i.prototype,"virtualizer",void 0),x([(0,h.queryAll)("div.md-combobox-option")],i.prototype,"lists",void 0),x([(0,h.queryAll)(".group-label")],i.prototype,"labels",void 0),x([(0,h.queryAll)(".md-combobox-selected-item")],i.prototype,"selected",void 0),i=x([(0,n.w)("md-combobox")],i),t.ELEMENT=i}(s||(s={}))},8229:t=>{t.exports=
|
|
218
|
+
`}};x([(0,h.property)({type:String})],i.prototype,"label",void 0),x([(0,h.property)({type:Array})],i.prototype,"options",void 0),x([(0,h.property)({type:Array,attribute:"custom-options"})],i.prototype,"customOptions",void 0),x([(0,h.property)({type:String})],i.prototype,"placeholder",void 0),x([(0,h.property)({type:Boolean,attribute:"is-multi"})],i.prototype,"isMulti",void 0),x([(0,h.property)({type:Boolean,attribute:"use-virtual-scroll"})],i.prototype,"useVirtualScroll",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"disabled",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"ordered",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"expanded",void 0),x([(0,h.property)({type:Array,reflect:!0})],i.prototype,"groupExpandedList",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"searchItem",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"compact",void 0),x([(0,h.property)({type:Boolean,attribute:"no-clear-icon"})],i.prototype,"noClearIcon",void 0),x([(0,h.property)({type:Boolean,attribute:"select-when-in-focus"})],i.prototype,"selectWhenInFocus",void 0),x([(0,h.property)({type:Array})],i.prototype,"selectedOptions",void 0),x([(0,h.property)({type:Number,attribute:"visible-option",reflect:!0})],i.prototype,"visibleOptions",void 0),x([(0,h.property)({type:String,attribute:"option-id",reflect:!0})],i.prototype,"optionId",void 0),x([(0,h.property)({type:String,attribute:"option-value",reflect:!0})],i.prototype,"optionValue",void 0),x([(0,h.property)({type:Boolean,attribute:"with-custom-content"})],i.prototype,"isCustomContent",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"searchable",void 0),x([(0,h.property)({type:String})],i.prototype,"shape",void 0),x([(0,h.property)({type:Array})],i.prototype,"value",void 0),x([(0,h.property)({type:String,attribute:"input-value",reflect:!0})],i.prototype,"inputValue",void 0),x([(0,h.property)({type:Boolean,attribute:"allow-custom-value",reflect:!0})],i.prototype,"allowCustomValue",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"autofocus",void 0),x([(0,h.property)({type:String,attribute:"no-results-i18n"})],i.prototype,"resultsTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"no-options-i18n"})],i.prototype,"optionsTextLocalization",void 0),x([(0,h.property)({type:Boolean,reflect:!0,attribute:"search-trim-space"})],i.prototype,"trimSpace",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"invalid",void 0),x([(0,h.property)({type:String,reflect:!0,attribute:"invalid-text-i18n"})],i.prototype,"invalidText",void 0),x([(0,h.property)({type:String,reflect:!0})],i.prototype,"ariaLabel",void 0),x([(0,h.property)({type:String,attribute:"search-result-aria-label"})],i.prototype,"searchResultAriaLabel",void 0),x([(0,h.internalProperty)()],i.prototype,"ariaLabelForComboBox",void 0),x([(0,h.property)({type:String,attribute:"clear-aria-label"})],i.prototype,"clearAriaLabel",void 0),x([(0,h.property)({type:String,attribute:"arrow-aria-label"})],i.prototype,"arrowAriaLabel",void 0),x([(0,h.property)({type:String,attribute:"clear-icon-height"})],i.prototype,"clearIconHeight",void 0),x([(0,h.property)({type:String,attribute:"all-i18n"})],i.prototype,"allTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"select-all-i18n"})],i.prototype,"selectAllTextLocalization",void 0),x([(0,h.property)({type:String,attribute:"selected-all-i18n"})],i.prototype,"selectedTextLocalization",void 0),x([(0,h.property)({type:Boolean,attribute:"allow-select-all",reflect:!0})],i.prototype,"allowSelectAll",void 0),x([(0,h.property)({type:Boolean,attribute:"show-custom-error",reflect:!0})],i.prototype,"showCustomError",void 0),x([(0,h.property)({type:Boolean,attribute:"show-loader",reflect:!0})],i.prototype,"showLoader",void 0),x([(0,h.property)({type:Boolean,attribute:"show-selected-count",reflect:!0})],i.prototype,"showSelectedCount",void 0),x([(0,h.property)({type:String,attribute:"popup-chevron-aria-hidden"})],i.prototype,"popupChevronAriaHidden",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"newMomentum",void 0),x([(0,h.property)({type:Boolean,attribute:"show-filter-icon"})],i.prototype,"showFilterIcon",void 0),x([(0,h.property)({type:Boolean,attribute:"prevent-filter"})],i.prototype,"preventFilter",void 0),x([(0,h.property)({type:Boolean,attribute:"is-dropdown-arrow"})],i.prototype,"isDropdownArrow",void 0),x([(0,h.property)({type:String})],i.prototype,"comboboxId",void 0),x([(0,h.property)({type:String})],i.prototype,"helpText",void 0),x([(0,h.property)({type:Array})],i.prototype,"messageArr",void 0),x([(0,h.property)({type:String})],i.prototype,"htmlId",void 0),x([(0,h.property)({type:Boolean,reflect:!0})],i.prototype,"readOnly",void 0),x([(0,h.internalProperty)()],i.prototype,"isOptGroup",void 0),x([(0,h.internalProperty)()],i.prototype,"isSelectAllChecked",void 0),x([(0,h.query)(".group")],i.prototype,"group",void 0),x([(0,h.query)(".md-combobox-listbox")],i.prototype,"input",void 0),x([(0,h.query)(".md-combobox-button")],i.prototype,"button",void 0),x([(0,h.query)("div#md-combobox-listbox")],i.prototype,"listBox",void 0),x([(0,h.query)(".virtual-scroll")],i.prototype,"virtualizer",void 0),x([(0,h.queryAll)("div.md-combobox-option")],i.prototype,"lists",void 0),x([(0,h.queryAll)(".group-label")],i.prototype,"labels",void 0),x([(0,h.queryAll)(".md-combobox-selected-item")],i.prototype,"selected",void 0),i=x([(0,n.w)("md-combobox")],i),t.ELEMENT=i}(s||(s={}))},8229:t=>{t.exports=s},22818:t=>{t.exports=a},23968:t=>{t.exports=e},32022:t=>{t.exports=l},40333:t=>{t.exports=i},41488:e=>{e.exports=t},60554:t=>{t.exports=n},85314:t=>{t.exports=r},86635:t=>{t.exports=h},97822:t=>{t.exports=o}},u={};function c(t){var e=u[t];if(void 0!==e)return e.exports;var i=u[t]={exports:{}};return p[t].call(i.exports,i,i.exports,c),i.exports}c.m=p,d=[],c.O=(t,e,i,s)=>{if(!e){var o=1/0;for(a=0;a<d.length;a++){for(var[e,i,s]=d[a],l=!0,n=0;n<e.length;n++)(!1&s||o>=s)&&Object.keys(c.O).every(t=>c.O[t](e[n]))?e.splice(n--,1):(l=!1,s<o&&(o=s));if(l){d.splice(a--,1);var r=i();void 0!==r&&(t=r)}}return t}s=s||0;for(var a=d.length;a>0&&d[a-1][2]>s;a--)d[a]=d[a-1];d[a]=[e,i,s]},c.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return c.d(e,{a:e}),e},c.d=(t,e)=>{for(var i in e)c.o(e,i)&&!c.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),c.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t={2169:0,2547:0};c.O.j=e=>0===t[e];var e=(e,i)=>{var s,o,[l,n,r]=i,a=0;if(l.some(e=>0!==t[e])){for(s in n)c.o(n,s)&&(c.m[s]=n[s]);if(r)var h=r(c)}for(e&&e(i);a<l.length;a++)o=l[a],c.o(t,o)&&t[o]&&t[o][0](),t[o]=0;return c.O(h)},i=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})();var m=c.O(void 0,[8493,7103,1890,6272,6325,9217,6283,2176,6798,5830,1200,8889,8373,4624,300,591,768,3001,4977,109,6795,3820,5433],()=>c(4928));return c.O(m)})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"),require("country-codes-list"),require("country-flags-svg"),require("lit-html/directives/repeat.js"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/repeat","lit-virtualizer","country-codes-list","country-flags-svg","lit-html/directives/repeat.js"],t);else{var o="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"),require("country-codes-list"),require("country-flags-svg"),require("lit-html/directives/repeat.js")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"],e["lit-html/directives/style-map"],e["lit-html/directives/if-defined"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit-html/directives/repeat"],e["lit-virtualizer"],e["country-codes-list"],e["country-flags-svg"],e["lit-html/directives/repeat.js"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(self,(e,t,o,r,i,l,n,s,a,d,u,p,c)=>(()=>{"use strict";var m,h={6963:e=>{e.exports=c},8229:e=>{e.exports=r},13060:e=>{e.exports=u},18224:(e,t,o)=>{o.r(t),o.d(t,{CountryCodePicker:()=>r}),o(4928);var r,i=o(31890),l=o(26272),n=o(13060),s=o(65875),a=o(41488),d=o(40333),u=o(23968),p=o(6963),c=o(96953),m=function(e,t,o,r){var i,l=arguments.length,n=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(n=(l<3?i(n):l>3?i(t,o,n):i(t,o))||n);return l>3&&n&&Object.defineProperty(t,o,n),n};!function(e){let t=class extends a.LitElement{constructor(){super(...arguments),this.codePlaceholder="+1",this.countryCallingCode="",this.showFlags=!1,this.pill=!1,this.disabled=!1,this.ariaLabel="",this.clearAriaLabel="Clear Country Code",this.id="",this.newMomentum=!1,this.isDropdownArrow=!0,this.countryCode="US",this.codeList=[]}connectedCallback(){super.connectedCallback(),this.codeList=(0,n.customArray)({name:"{countryNameEn}",value:"{countryCallingCode}",code:"{countryCode}"}),""===this.id&&(this.id=`md-country-code-picker-${Math.random().toString(36).substring(2,6)}`)}getCountryFlag(e){return a.html`
|
|
2
2
|
<span class="flag-svg-wrapper">
|
|
3
3
|
<img src="${(0,s.findFlagUrlByIso2Code)(e)}" />
|
|
4
4
|
</span>
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
${(0,p.repeat)(this.codeList,e=>e.name,(e,t)=>this.countryCodeOptionTemplate(e,t))}
|
|
37
37
|
</md-combobox>
|
|
38
38
|
</div>
|
|
39
|
-
`}};m([(0,a.property)({type:String,reflect:!0})],t.prototype,"codePlaceholder",void 0),m([(0,a.property)({type:String,attribute:"country-calling-code"})],t.prototype,"countryCallingCode",void 0),m([(0,a.property)({type:Boolean,attribute:"show-flags"})],t.prototype,"showFlags",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"pill",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"disabled",void 0),m([(0,a.property)({type:String})],t.prototype,"ariaLabel",void 0),m([(0,a.property)({type:String})],t.prototype,"clearAriaLabel",void 0),m([(0,a.property)({type:String})],t.prototype,"id",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"newMomentum",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"isDropdownArrow",void 0),m([(0,a.internalProperty)()],t.prototype,"countryCode",void 0),m([(0,a.internalProperty)()],t.prototype,"codeList",void 0),m([(0,a.query)("md-combobox")],t.prototype,"combobox",void 0),t=m([(0,i.w)("md-country-code-picker")],t),e.ELEMENT=t}(r||(r={}))},22818:e=>{e.exports=a},23968:e=>{e.exports=t},32022:e=>{e.exports=l},40333:e=>{e.exports=
|
|
39
|
+
`}};m([(0,a.property)({type:String,reflect:!0})],t.prototype,"codePlaceholder",void 0),m([(0,a.property)({type:String,attribute:"country-calling-code"})],t.prototype,"countryCallingCode",void 0),m([(0,a.property)({type:Boolean,attribute:"show-flags"})],t.prototype,"showFlags",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"pill",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"disabled",void 0),m([(0,a.property)({type:String})],t.prototype,"ariaLabel",void 0),m([(0,a.property)({type:String})],t.prototype,"clearAriaLabel",void 0),m([(0,a.property)({type:String})],t.prototype,"id",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"newMomentum",void 0),m([(0,a.property)({type:Boolean})],t.prototype,"isDropdownArrow",void 0),m([(0,a.internalProperty)()],t.prototype,"countryCode",void 0),m([(0,a.internalProperty)()],t.prototype,"codeList",void 0),m([(0,a.query)("md-combobox")],t.prototype,"combobox",void 0),t=m([(0,i.w)("md-country-code-picker")],t),e.ELEMENT=t}(r||(r={}))},22818:e=>{e.exports=a},23968:e=>{e.exports=t},32022:e=>{e.exports=l},40333:e=>{e.exports=o},41488:t=>{t.exports=e},60554:e=>{e.exports=n},65875:e=>{e.exports=p},85314:e=>{e.exports=s},86635:e=>{e.exports=d},97822:e=>{e.exports=i}},y={};function v(e){var t=y[e];if(void 0!==t)return t.exports;var o=y[e]={exports:{}};return h[e].call(o.exports,o,o.exports,v),o.exports}v.m=h,m=[],v.O=(e,t,o,r)=>{if(!t){var i=1/0;for(a=0;a<m.length;a++){for(var[t,o,r]=m[a],l=!0,n=0;n<t.length;n++)(!1&r||i>=r)&&Object.keys(v.O).every(e=>v.O[e](t[n]))?t.splice(n--,1):(l=!1,r<i&&(i=r));if(l){m.splice(a--,1);var s=o();void 0!==s&&(e=s)}}return e}r=r||0;for(var a=m.length;a>0&&m[a-1][2]>r;a--)m[a]=m[a-1];m[a]=[t,o,r]},v.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return v.d(t,{a:t}),t},v.d=(e,t)=>{for(var o in t)v.o(t,o)&&!v.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),v.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={6753:0};v.O.j=t=>0===e[t];var t=(t,o)=>{var r,i,[l,n,s]=o,a=0;if(l.some(t=>0!==e[t])){for(r in n)v.o(n,r)&&(v.m[r]=n[r]);if(s)var d=s(v)}for(t&&t(o);a<l.length;a++)i=l[a],v.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return v.O(d)},o=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var g=v.O(void 0,[8493,7103,1890,6272,6325,9217,6283,2176,6798,5830,1200,8889,8373,4624,300,591,768,3001,4977,109,6795,3820,5433,2547,6953],()=>v(18224));return v.O(g)})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat"),require("@popperjs/core/lib/modifiers/arrow"),require("@popperjs/core/lib/modifiers/flip"),require("@popperjs/core/lib/modifiers/offset"),require("@popperjs/core/lib/modifiers/preventOverflow"),require("@popperjs/core/lib/popper-lite"),require("luxon"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/class-map.js","lit-html/directives/repeat","@popperjs/core/lib/modifiers/arrow","@popperjs/core/lib/modifiers/flip","@popperjs/core/lib/modifiers/offset","@popperjs/core/lib/modifiers/preventOverflow","@popperjs/core/lib/popper-lite","luxon"],t);else{var i="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat"),require("@popperjs/core/lib/modifiers/arrow"),require("@popperjs/core/lib/modifiers/flip"),require("@popperjs/core/lib/modifiers/offset"),require("@popperjs/core/lib/modifiers/preventOverflow"),require("@popperjs/core/lib/popper-lite"),require("luxon")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"],e["lit-html/directives/style-map"],e["lit-html/directives/if-defined"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit-html/directives/class-map.js"],e["lit-html/directives/repeat"],e["@popperjs/core/lib/modifiers/arrow"],e["@popperjs/core/lib/modifiers/flip"],e["@popperjs/core/lib/modifiers/offset"],e["@popperjs/core/lib/modifiers/preventOverflow"],e["@popperjs/core/lib/popper-lite"],e.luxon);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(self,(e,t,i,o,r,a,l,s,p,d,n,u,m,c,h,v)=>(()=>{"use strict";var f,y={4863:e=>{e.exports=h},8229:e=>{e.exports=o},17518:e=>{e.exports=p},22818:e=>{e.exports=d},22962:e=>{e.exports=n},23968:e=>{e.exports=t},32022:e=>{e.exports=a},40333:e=>{e.exports=i},41488:t=>{t.exports=e},60554:e=>{e.exports=l},65796:e=>{e.exports=v},68250:e=>{e.exports=m},69371:e=>{e.exports=c},84157:e=>{e.exports=u},85314:e=>{e.exports=s},85416:(e,t,i)=>{i.r(t),i.d(t,{DateTimePicker:()=>o}),i(96408),i(11323);var o,r=i(31890),a=i(81625),l=i(26272),s=i(41488),p=i(97822),d=i(65796),n=i(90195),u=i(33663),m=function(e,t,i,o){var r,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(l=(a<3?r(l):a>3?r(t,i,l):r(t,i))||l);return a>3&&l&&Object.defineProperty(t,i,l),l};!function(e){e.weekStartDays=["Sunday","Monday"];let t=class extends s.LitElement{constructor(){super(...arguments),this.maxDate=void 0,this.minDate=void 0,this.weekStart="Sunday",this.ariaLabel="",this.twoDigitAutoTab=!1,this.shouldCloseOnSelect=!1,this.twentyFourHourFormat=!1,this.timeSpecificity=n.R5.SECOND,this.dateValue=void 0,this.timeValue="00:00:00-08:00",this.value=void 0,this.disableDateValidation=!1,this.locale=void 0,this.placeholder=void 0,this.useISOFormat=!0,this.disabled=!1,this.positioningStrategy=void 0,this.showDefaultNowDate=!0,this.compactInput=void 0,this.controlButtons=void 0,this.fullDateTime=void 0,this.selectedTimeObject=void 0,this.selectedDateObject=(0,a.tB)(),this.handleDateChange=e=>{var t,i;this.selectedDateObject=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.data,this.dateValue=null===(i=this.selectedDateObject)||void 0===i?void 0:i.toISODate(),this.combineDateAndTimeValues(this.dateValue,this.timeValue)},this.handleTimeChange=e=>{var t,i,o;this.selectedTimeObject=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.data,this.timeValue=null===(i=this.selectedTimeObject)||void 0===i?void 0:i.startOf("second").toISOTime({suppressMilliseconds:!0}),(null===(o=this.controlButtons)||void 0===o?void 0:o.apply)||this.combineDateAndTimeValues(this.dateValue,this.timeValue)},this.handleDateTimeInputChange=e=>{var t;this.value=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.value},this.parseValueForVisuals=e=>{e&&(this.dateValue=e.split("T")[0],this.timeValue=e.split("T")[1])},this.updateDateTimeObject=()=>{this.value?this.fullDateTime=d.DateTime.fromISO(this.value,{locale:this.locale}):this.fullDateTime=d.DateTime.fromISO("",{locale:this.locale}),this.dispatchEvent(new CustomEvent("date-time-change",{bubbles:!0,composed:!0,detail:{dateTimeString:this.value,dateTime:this.fullDateTime,locale:this.locale,twentyFourHourFormat:this.twentyFourHourFormat}}))},this.combineDateAndTimeValues=(e,t)=>{e&&(this.value=t?`${e}T${t}`:e)}}firstUpdated(e){var t;if(super.firstUpdated(e),!this.value&&this.showDefaultNowDate){const e=null===(t=this.selectedDateObject)||void 0===t?void 0:t.toISODate();this.combineDateAndTimeValues(e,this.timeValue)}}updated(e){var t;super.updated(e),e.has("value")&&(this.value&&this.parseValueForVisuals(this.value),this.updateDateTimeObject()),this.dateValue&&this.timeValue&&!(null===(t=this.controlButtons)||void 0===t?void 0:t.apply)&&(e.has("dateValue")||e.has("timeValue"))&&this.combineDateAndTimeValues(this.dateValue,this.timeValue),this.value&&e.has("locale")&&(this.fullDateTime=d.DateTime.fromISO(this.value,{locale:this.locale}))}get placeholderValue(){return this.placeholder?this.placeholder:"YYYY-MM-DDTHH:MM:SS-HH:MM"}static get styles(){return[l.A,u.A]}get displayValue(){if(!this.useISOFormat&&this.fullDateTime&&this.fullDateTime.isValid)return this.fullDateTime.toLocaleString(d.DateTime.DATETIME_MED,{locale:this.locale})}render(){var e;return s.html`
|
|
2
2
|
<md-datepicker
|
|
3
3
|
includes-time
|
|
4
4
|
?disabled=${this.disabled}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat"),require("dompurify"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/class-map.js","lit-html/directives/repeat","dompurify"],t);else{var i="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat"),require("dompurify")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"],e["lit-html/directives/style-map"],e["lit-html/directives/if-defined"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit-html/directives/class-map.js"],e["lit-html/directives/repeat"],e.dompurify);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(e,t,i,s,r,l,o,a,n,d,p)=>(()=>{"use strict";var h,m={8229:e=>{e.exports=s},17518:e=>{e.exports=n},22818:e=>{e.exports=d},23968:e=>{e.exports=t},31347:e=>{e.exports=p},32022:e=>{e.exports=l},40333:e=>{e.exports=i},41488:t=>{t.exports=e},50565:(e,t,i)=>{i.r(t),i.d(t,{EditableTextfield:()=>v,alignment:()=>u}),i(96408);var s=i(31890),r=i(74548),l=i(26272),o=i(31347),a=i.n(o),n=i(41488),d=i(40333),p=i(23968),h=i(97822),m=i(18728),c=function(e,t,i,s){var r,l=arguments.length,o=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(l<3?r(o):l>3?r(t,i,o):r(t,i))||o);return l>3&&o&&Object.defineProperty(t,i,o),o};const u=["left","right","center"];var v;!function(e){let t=class extends n.LitElement{constructor(){super(...arguments),this.alignment="left",this.disabled=!1,this.isEditing=!1,this.maxLines="",this.content="Click to edit text",this.message={type:"error",message:"That is not a valid input."},this.alert=!1,this.hideMessage=!1,this.pattern="",this.type=null,this.ariaLabel="editable field",this.ariaDescribedBy="",this.reportValidity=()=>{this.dispatchEvent(new Event("invalid",{bubbles:!1,cancelable:!0,composed:!0}))},this.checkValidity=e=>{let t=!0;const i=i=>{null===e.match(i)&&(t=!1)};if(this.pattern)i(new RegExp(this.pattern));else if(e&&this.type)switch(this.type){case"integer":i(new RegExp(r.b.integerString));break;case"decimal":i(new RegExp(r.b.decimalString))}return t},this.handleFocus=()=>{this.disabled||(this.isEditing=!0,this.setRange())},this.handleKeydown=e=>{var t,i;const{key:s,code:r}=e;if(!["Tab","Meta","Shift","Delete","Backspace","Arrow"].some(e=>r.includes(e)))if("integer"===this.type&&(s.includes(".")||"-"===s&&(null===(t=this.editableField)||void 0===t?void 0:t.innerText.includes("-"))))e.preventDefault();else if("integer"!==this.type&&"decimal"!==this.type||!r.match("Space")){if(this.type&&1===s.length){const t=((null===(i=this.editableField)||void 0===i?void 0:i.innerText.trim())||"")+s;("integer"!==this.type||/^-?\d*$/.test(t))&&("decimal"!==this.type||/^-?\d*\.?\d*$/.test(t))||e.preventDefault()}}else e.preventDefault()},this.handleBlur=()=>{var e,t,i;this.isEditing=!1,this.maxLines.length>0&&(null===(e=this.editableField)||void 0===e||e.scrollTo(0,0));const s=(null===(i=null===(t=this.editableField)||void 0===t?void 0:t.innerText)||void 0===i?void 0:i.trim())||"",r=a().sanitize(s);r!==this.content&&(this.content=r),this.alert=!1,this.handleValidation()}}connectedCallback(){super.connectedCallback(),this.addEventListener("focus",this.handleFocus)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focus",this.handleFocus)}firstUpdated(e){super.firstUpdated(e),this.innerText&&this.innerText.length>0&&(this.content=this.innerText.trim())}setRange(){var e;if(this.editableField){const t=document.createRange(),i=window.getSelection(),s=this.editableField.childNodes[0];if(!s||s.nodeType!==Node.TEXT_NODE)return;const r=(null===(e=s.nodeValue)||void 0===e?void 0:e.length)||0;t.setStart(s,r),t.collapse(!0),i&&0===i.toString().length&&(i.removeAllRanges(),i.addRange(t)),this.maxLines.length>0&&(this.editableField.scrollTop=this.editableField.scrollHeight)}}handleValidation(){var e;(this.type||this.pattern)&&((null===(e=this.checkValidity)||void 0===e?void 0:e.call(this,this.content))||(this.reportValidity(),this.showAlert()))}showAlert(){this.alert=!0}static get styles(){return[l.A,m.A]}get overflowStyles(){return this.maxLines.length&&this.maxLines.length>0&&`max-height: ${2*parseInt(this.maxLines)}rem; -webkit-line-clamp: ${this.maxLines}; word-break: break-all;`}messagesTemplate(){var e,t,i;return this.alert?n.html`
|
|
2
2
|
<div class="md-editable-textfield__messages" style="display: ${this.hideMessage?"none":"block"}">
|
|
3
3
|
<md-help-text
|
|
4
4
|
id="alert-message"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map"],t);else{var r="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map")):t(e["lit-element"],e["lit-html/directives/class-map"]);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(e,t)=>(()=>{"use strict";var
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html"],t);else{var r="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"]);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(self,(e,t,r)=>(()=>{"use strict";var i,o={20109:(e,t,r)=>{r.r(t),r.d(t,{HelpText:()=>i});var i,o=r(31890),s=r(26272),l=r(41488),n=r(23968),a=r(24977),p=r(40333),c=function(e,t,r,i){var o,s=arguments.length,l=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,i);else for(var n=e.length-1;n>=0;n--)(o=e[n])&&(l=(s<3?o(l):s>3?o(t,r,l):o(t,r))||l);return s>3&&l&&Object.defineProperty(t,r,l),l};!function(e){let t=class extends l.LitElement{constructor(){super(...arguments),this.message="",this.messageType=void 0,this.id="",this.ariaLive="off"}get inputMessageClassMap(){return{[`md-${this.messageType}`]:!!this.messageType}}static get styles(){return[s.A,a.A]}getIconName(){switch(this.messageType){case"success":return"check-circle-badge-filled";case"error":return"error-legacy-badge-filled";case"warning":return"warning-badge-filled";case"priority":return"info-badge-filled";default:return""}}render(){return l.html`
|
|
2
2
|
<div
|
|
3
|
-
class="md-input__message ${(0,
|
|
3
|
+
class="md-input__message ${(0,n.classMap)(this.inputMessageClassMap)}"
|
|
4
4
|
id=${this.id}
|
|
5
5
|
aria-live=${this.ariaLive}
|
|
6
6
|
role="alert"
|
|
7
7
|
>
|
|
8
|
-
|
|
8
|
+
${this.messageType?l.html`<md-icon name="${this.getIconName()}" size="14" iconSet="momentumDesign"></md-icon>`:p.nothing}
|
|
9
9
|
<slot>${this.message}</slot>
|
|
10
10
|
</div>
|
|
11
|
-
`}};
|
|
11
|
+
`}};c([(0,l.property)({type:String})],t.prototype,"message",void 0),c([(0,l.property)({type:String})],t.prototype,"messageType",void 0),c([(0,l.property)({type:String})],t.prototype,"id",void 0),c([(0,l.property)({type:String})],t.prototype,"ariaLive",void 0),t=c([(0,o.w)("md-help-text")],t),e.ELEMENT=t}(i||(i={}))},23968:e=>{e.exports=t},40333:e=>{e.exports=r},41488:t=>{t.exports=e}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return o[e](r,r.exports,l),r.exports}l.m=o,i=[],l.O=(e,t,r,o)=>{if(!t){var s=1/0;for(c=0;c<i.length;c++){for(var[t,r,o]=i[c],n=!0,a=0;a<t.length;a++)(!1&o||s>=o)&&Object.keys(l.O).every(e=>l.O[e](t[a]))?t.splice(a--,1):(n=!1,o<s&&(s=o));if(n){i.splice(c--,1);var p=r();void 0!==p&&(e=p)}}return e}o=o||0;for(var c=i.length;c>0&&i[c-1][2]>o;c--)i[c]=i[c-1];i[c]=[t,r,o]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={109:0,1745:0};l.O.j=t=>0===e[t];var t=(t,r)=>{var i,o,[s,n,a]=r,p=0;if(s.some(t=>0!==e[t])){for(i in n)l.o(n,i)&&(l.m[i]=n[i]);if(a)var c=a(l)}for(t&&t(r);p<s.length;p++)o=s[p],l.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return l.O(c)},r=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var n=l.O(void 0,[1890,6272,4977],()=>l(20109));return l.O(n)})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/class-map.js","lit-html/directives/repeat"],t);else{var i="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/class-map.js"),require("lit-html/directives/repeat")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"],e["lit-html/directives/style-map"],e["lit-html/directives/if-defined"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit-html/directives/class-map.js"],e["lit-html/directives/repeat"]);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(e,t,i,s,a,o,l,r,n,p)=>(()=>{"use strict";var d,h={8229:e=>{e.exports=s},17518:e=>{e.exports=n},22818:e=>{e.exports=p},23968:e=>{e.exports=t},32022:e=>{e.exports=o},40333:e=>{e.exports=i},41488:t=>{t.exports=e},60554:e=>{e.exports=l},85314:e=>{e.exports=r},96408:(e,t,i)=>{i.r(t),i.d(t,{Input:()=>S,ariaInvalidType:()=>C,containerSize:()=>v,iconNames:()=>$,iconPosition:()=>x,inputShape:()=>f,inputSize:()=>g,inputType:()=>b,nestedLevel:()=>w}),i(20109),i(61200),i(6396),i(12176);var s=i(90195),a=i(31890),o=i(32972),l=i(26272),r=i(32022),n=i(41488),p=i(40333),d=i(23968),h=i(97822),m=i(22818),u=i(8229),c=i(21572),y=function(e,t,i,s){var a,o=arguments.length,l=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var r=e.length-1;r>=0;r--)(a=e[r])&&(l=(o<3?a(l):o>3?a(t,i,l):a(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l};const v=["small-1","small-2","small-3","small-4","small-5","small-6","small-7","small-8","small-9","small-10","small-11","small-12","medium-1","medium-2","medium-3","medium-4","medium-5","medium-6","medium-7","medium-8","medium-9","medium-10","medium-11","medium-12","large-1","large-2","large-3","large-4","large-5","large-6","large-7","large-8","large-9","large-10","large-11","large-12"],g=["small-1","small-2","small-3","small-4","small-5","small-6","small-7","small-8","small-9","small-10","small-11","small-12","medium-1","medium-2","medium-3","medium-4","medium-5","medium-6","medium-7","medium-8","medium-9","medium-10","medium-11","medium-12","large-1","large-2","large-3","large-4","large-5","large-6","large-7","large-8","large-9","large-10","large-11","large-12"],b=["text","number","password","email","tel","checkbox"],f=["none","pill"],$=r,x=["before","after"],w=[0,1,2,3],C=["grammar","false","spelling","true"];var S;!function(e){class t{determineMessageType(e){return e.reduce((e,t)=>"error"===t?e:t.type,"")}filterMessagesByType(e,t){return e.reduce((e,i)=>i.type===t?e.concat(i.message):e,[])}}e.MessageController=t;let i=class extends((0,o.y)(n.LitElement)){constructor(){super(...arguments),this.ariaDescribedBy="",this.ariaInvalid="false",this.ariaLabel="input",this.autofocus=!1,this.auxiliaryContentPosition=null,this.clear=!1,this.clearAriaLabel="",this.compact=!1,this.containerSize="small-12",this.disabled=!1,this.id="",this.inputSize="",this.isFilled=!1,this.isLoading=!1,this.label="",this.helpText="",this.hideMessage=!1,this.htmlId="",this.role="",this.messageArr=[],this.min=void 0,this.max=void 0,this.maxLength=void 0,this.multi=!1,this.multiline=!1,this.name="",this.nestedLevel=0,this.placeholder="",this.readOnly=!1,this.required=!1,this.searchable=!1,this.secondaryLabel="",this.selectWhenInFocus=!1,this.shape="",this.type="text",this.value="",this.ariaControls="",this.ariaExpanded="",this.newMomentum=!1,this.disableUserTextInput=!1,this.autocomplete=void 0,this.showDropdown=!1,this.dropdownExpanded=!1,this.dropdownAriaLabel="Show options",this.maxSuggestedLength=void 0,this.isEditing=!1,this.hasRightSlotContent=!1,this.messageController=new t}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleOutsideClick)}select(){var e;null===(e=this.input)||void 0===e||e.select()}focus(){var e;null===(e=this.input)||void 0===e||e.focus()}handleOutsideClick(e){let t=!1;const i=e.composedPath();i.length&&(t=!!i.find(e=>e===this),t||(this.input.blur(),this.isEditing=!1))}handleKeyDown(e){this.dispatchEvent(new CustomEvent("input-keydown",{bubbles:!0,composed:!0,detail:{srcEvent:e}}))}handleFocus(e){this.disabled||(this.isEditing=!0,this.selectWhenInFocus&&this.select(),this.dispatchEvent(new CustomEvent("input-focus",{bubbles:!0,composed:!0,detail:{srcEvent:e}})))}handleMouseDown(e){this.disabled||(this.isEditing=!0,this.dispatchEvent(new CustomEvent("input-mousedown",{bubbles:!0,composed:!0,detail:{srcEvent:e}})))}handleChange(e){var t;this.value=e.target.value,null===(t=this.control)||void 0===t||t.setValue(this.value),this.dispatchEvent(new CustomEvent("input-change",{bubbles:!0,composed:!0,detail:{srcEvent:e,value:this.value}}))}handleBlur(e){var t;null===(t=this.control)||void 0===t||t.markAsTouched(),this.isEditing=!1,this.dispatchEvent(new CustomEvent("input-blur",{bubbles:!0,composed:!0,detail:{srcEvent:e}}))}handleClear(e){if("keydown"===e.type){const{code:t}=e;if(t!==s.Uz.Space&&t!==s.Uz.Enter)return;e.preventDefault(),e.stopPropagation()}else"click"===e.type&&(e.preventDefault(),e.stopPropagation());this.input.focus(),this.dispatchEvent(new CustomEvent("input-clear",{bubbles:!0,composed:!0,detail:{srcEvent:e}})),document.dispatchEvent(new CustomEvent("on-widget-update")),this.handleChange(e)}handleLabelClick(){this.input.focus()}handleRighSlotChange(){var e;this.hasRightSlotContent=(null===(e=this.inputSectionRightSlot)||void 0===e?void 0:e.assignedNodes().length)>0}handleDropdownClick(e){e.preventDefault(),this.dropdownExpanded=!this.dropdownExpanded,this.dispatchEvent(new CustomEvent("input-dropdown-click",{bubbles:!0,composed:!0,detail:{srcEvent:e,expanded:this.dropdownExpanded}}))}get messageType(){return this.messageArr.length>0?this.messageController.determineMessageType(this.messageArr):null}get messages(){return this.messageType?this.messageController.filterMessagesByType(this.messageArr,this.messageType):null}get inputClassMap(){return{"md-input--filled":this.isFilled,colums:!!this.containerSize,[`${this.containerSize}`]:!!this.containerSize,"md-read-only":this.readOnly,"md-disabled":this.disabled,[`md-${this.messageType}`]:!!this.messageType,[`md-input--nested-${this.nestedLevel}`]:!!this.nestedLevel,"md-multi":this.multi,"md-new-momentum":this.newMomentum}}get inputWrapperClassMap(){return{columns:!!this.inputSize,[`${this.inputSize}`]:!!this.inputSize}}get inputTemplateClassMap(){return{"md-input--multiline":this.multiline,"md-input--multi":this.multi,[`md-input--${this.shape}`]:!!this.shape,"md-input--compact":this.compact,"md-input--before":"before"===this.auxiliaryContentPosition||this.searchable,"md-input--after":"after"===this.auxiliaryContentPosition,"md-active":this.isEditing,"md-focus":this.isEditing,"md-read-only":this.readOnly,"md-disable-user-text-input":this.disableUserTextInput,"md-disabled":this.disabled,"md-dirty":!!this.value,"md-has-right-icon":this.hasRightIcon}}get ariaExpandedValue(){return"true"===this.ariaExpanded||"false"===this.ariaExpanded?this.ariaExpanded:void 0}get hasRightIcon(){return!(!this.clear||this.disabled||!this.value||this.readOnly)||!!this.showDropdown||!this.compact&&this.hasRightSlotContent}inputTemplate(){var e;return this.multiline?n.html`
|
|
2
2
|
<textarea
|
|
3
3
|
part="input"
|
|
4
4
|
class="md-input ${(0,d.classMap)(this.inputTemplateClassMap)}"
|
|
@@ -104,11 +104,12 @@
|
|
|
104
104
|
>
|
|
105
105
|
</md-icon>
|
|
106
106
|
</button>
|
|
107
|
-
`:p.nothing}
|
|
108
|
-
<span
|
|
109
|
-
|
|
107
|
+
`:p.nothing}characterCountLabelTemplate(){return!this.maxSuggestedLength||this.disabled||this.readOnly?p.nothing:n.html`<div class="md-input__character-count-label-container">
|
|
108
|
+
<span
|
|
109
|
+
class="md-input__character-count-label ${(0,d.classMap)({error:this.value.length>this.maxSuggestedLength})}"
|
|
110
|
+
>${this.value.length}/${this.maxSuggestedLength}</span
|
|
110
111
|
>
|
|
111
|
-
</div>
|
|
112
|
+
</div> `}secondaryLabelTemplate(){return this.secondaryLabel?n.html`
|
|
112
113
|
<md-label
|
|
113
114
|
class="md-input__secondary-label ${(0,d.classMap)({disabled:this.disabled,newMomentum:this.newMomentum})}"
|
|
114
115
|
secondaryLabel
|
|
@@ -140,7 +141,7 @@
|
|
|
140
141
|
.label=${this.label}
|
|
141
142
|
@label-click=${()=>this.handleLabelClick()}
|
|
142
143
|
></md-label>
|
|
143
|
-
`:p.nothing}static get styles(){return[
|
|
144
|
+
`:p.nothing}static get styles(){return[l.A,c.A]}render(){return n.html`
|
|
144
145
|
<div class="md-input-container ${(0,d.classMap)(this.inputClassMap)}" part="md-input-container">
|
|
145
146
|
${this.labelTemplate()}
|
|
146
147
|
<div class="md-input__wrapper ${(0,d.classMap)(this.inputWrapperClassMap)}">
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
<div class="md-input__info-and-error-labels-container">
|
|
151
152
|
${this.messagesTemplate()} ${this.secondaryLabelTemplate()} ${this.helpTextTemplate()}
|
|
152
153
|
</div>
|
|
153
|
-
${this.
|
|
154
|
+
${this.characterCountLabelTemplate()}
|
|
154
155
|
</div>
|
|
155
156
|
</div>
|
|
156
|
-
`}};y([(0,n.property)({type:String})],i.prototype,"ariaDescribedBy",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"ariaInvalid",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaLabel",void 0),y([(0,n.property)({type:Boolean,reflect:!0})],i.prototype,"autofocus",void 0),y([(0,n.property)({type:String})],i.prototype,"auxiliaryContentPosition",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"clear",void 0),y([(0,n.property)({type:String})],i.prototype,"clearAriaLabel",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"compact",void 0),y([(0,n.property)({type:String})],i.prototype,"containerSize",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"disabled",void 0),y([(0,n.property)({type:String})],i.prototype,"id",void 0),y([(0,n.property)({type:String})],i.prototype,"inputSize",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"isFilled",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"isLoading",void 0),y([(0,n.property)({type:String})],i.prototype,"label",void 0),y([(0,n.property)({type:String})],i.prototype,"helpText",void 0),y([(0,n.property)({type:Boolean,attribute:"hide-message",reflect:!0})],i.prototype,"hideMessage",void 0),y([(0,n.property)({type:String})],i.prototype,"htmlId",void 0),y([(0,n.property)({type:String})],i.prototype,"role",void 0),y([(0,n.property)({type:Array})],i.prototype,"messageArr",void 0),y([(0,n.property)({type:Number,reflect:!0})],i.prototype,"min",void 0),y([(0,n.property)({type:Number,reflect:!0})],i.prototype,"max",void 0),y([(0,n.property)({type:Number})],i.prototype,"maxLength",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"multi",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"multiline",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"name",void 0),y([(0,n.property)({type:Number})],i.prototype,"nestedLevel",void 0),y([(0,n.property)({type:String})],i.prototype,"placeholder",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"readOnly",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"required",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"searchable",void 0),y([(0,n.property)({type:String})],i.prototype,"secondaryLabel",void 0),y([(0,n.property)({type:Boolean,attribute:"select-when-in-focus"})],i.prototype,"selectWhenInFocus",void 0),y([(0,n.property)({type:String})],i.prototype,"shape",void 0),y([(0,n.property)({type:String})],i.prototype,"type",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"value",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaControls",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaExpanded",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"newMomentum",void 0),y([(0,n.property)({type:Object})],i.prototype,"control",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"disableUserTextInput",void 0),y([(0,n.property)({type:String})],i.prototype,"autocomplete",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"showDropdown",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"dropdownExpanded",void 0),y([(0,n.property)({type:String})],i.prototype,"dropdownAriaLabel",void 0),y([(0,n.property)({type:
|
|
157
|
+
`}};y([(0,n.property)({type:String})],i.prototype,"ariaDescribedBy",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"ariaInvalid",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaLabel",void 0),y([(0,n.property)({type:Boolean,reflect:!0})],i.prototype,"autofocus",void 0),y([(0,n.property)({type:String})],i.prototype,"auxiliaryContentPosition",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"clear",void 0),y([(0,n.property)({type:String})],i.prototype,"clearAriaLabel",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"compact",void 0),y([(0,n.property)({type:String})],i.prototype,"containerSize",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"disabled",void 0),y([(0,n.property)({type:String})],i.prototype,"id",void 0),y([(0,n.property)({type:String})],i.prototype,"inputSize",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"isFilled",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"isLoading",void 0),y([(0,n.property)({type:String})],i.prototype,"label",void 0),y([(0,n.property)({type:String})],i.prototype,"helpText",void 0),y([(0,n.property)({type:Boolean,attribute:"hide-message",reflect:!0})],i.prototype,"hideMessage",void 0),y([(0,n.property)({type:String})],i.prototype,"htmlId",void 0),y([(0,n.property)({type:String})],i.prototype,"role",void 0),y([(0,n.property)({type:Array})],i.prototype,"messageArr",void 0),y([(0,n.property)({type:Number,reflect:!0})],i.prototype,"min",void 0),y([(0,n.property)({type:Number,reflect:!0})],i.prototype,"max",void 0),y([(0,n.property)({type:Number})],i.prototype,"maxLength",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"multi",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"multiline",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"name",void 0),y([(0,n.property)({type:Number})],i.prototype,"nestedLevel",void 0),y([(0,n.property)({type:String})],i.prototype,"placeholder",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"readOnly",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"required",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"searchable",void 0),y([(0,n.property)({type:String})],i.prototype,"secondaryLabel",void 0),y([(0,n.property)({type:Boolean,attribute:"select-when-in-focus"})],i.prototype,"selectWhenInFocus",void 0),y([(0,n.property)({type:String})],i.prototype,"shape",void 0),y([(0,n.property)({type:String})],i.prototype,"type",void 0),y([(0,n.property)({type:String,reflect:!0})],i.prototype,"value",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaControls",void 0),y([(0,n.property)({type:String})],i.prototype,"ariaExpanded",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"newMomentum",void 0),y([(0,n.property)({type:Object})],i.prototype,"control",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"disableUserTextInput",void 0),y([(0,n.property)({type:String})],i.prototype,"autocomplete",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"showDropdown",void 0),y([(0,n.property)({type:Boolean})],i.prototype,"dropdownExpanded",void 0),y([(0,n.property)({type:String})],i.prototype,"dropdownAriaLabel",void 0),y([(0,n.property)({type:Number})],i.prototype,"maxSuggestedLength",void 0),y([(0,n.query)(".md-input")],i.prototype,"input",void 0),y([(0,n.internalProperty)()],i.prototype,"isEditing",void 0),y([(0,n.query)('slot[name="input-section-right"]')],i.prototype,"inputSectionRightSlot",void 0),y([(0,n.internalProperty)()],i.prototype,"hasRightSlotContent",void 0),i=y([(0,a.w)("md-input")],i),e.ELEMENT=i}(S||(S={}))},97822:e=>{e.exports=a}},m={};function u(e){var t=m[e];if(void 0!==t)return t.exports;var i=m[e]={exports:{}};return h[e](i,i.exports,u),i.exports}u.m=h,d=[],u.O=(e,t,i,s)=>{if(!t){var a=1/0;for(n=0;n<d.length;n++){for(var[t,i,s]=d[n],o=!0,l=0;l<t.length;l++)(!1&s||a>=s)&&Object.keys(u.O).every(e=>u.O[e](t[l]))?t.splice(l--,1):(o=!1,s<a&&(a=s));if(o){d.splice(n--,1);var r=i();void 0!==r&&(e=r)}}return e}s=s||0;for(var n=d.length;n>0&&d[n-1][2]>s;n--)d[n]=d[n-1];d[n]=[t,i,s]},u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var i in t)u.o(t,i)&&!u.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={1266:0,6408:0};u.O.j=t=>0===e[t];var t=(t,i)=>{var s,a,[o,l,r]=i,n=0;if(o.some(t=>0!==e[t])){for(s in l)u.o(l,s)&&(u.m[s]=l[s]);if(r)var p=r(u)}for(t&&t(i);n<o.length;n++)a=o[n],u.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return u.O(p)},i=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var c=u.O(void 0,[8493,1890,6272,6325,9217,6283,2176,6798,5830,1200,2576,8210,4977,1270,1598,109,1572,6396],()=>u(96408));return u.O(c)})());
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
@change=${e=>this.handleFile(e)}
|
|
15
15
|
/>
|
|
16
16
|
</div>
|
|
17
|
-
`}};d([(0,s.property)({type:String,attribute:"accept-language"})],t.prototype,"acceptLanguage",void 0),d([(0,s.property)({type:String})],t.prototype,"getLocalization",void 0),d([(0,s.query)("input[type='file']")],t.prototype,"input",void 0),d([(0,s.internalProperty)()],t.prototype,"acceptTypes",void 0),d([(0,s.internalProperty)()],t.prototype,"fileName",void 0),t=d([(0,n.wW)("md-input-file")],t),e.ELEMENT=t}(i||(i={}))},97822:e=>{e.exports=n}},d={};function f(e){var t=d[e];if(void 0!==t)return t.exports;var r=d[e]={exports:{}};return u[e](r,r.exports,f),r.exports}f.m=u,l=[],f.O=(e,t,r,i)=>{if(!t){var n=1/0;for(c=0;c<l.length;c++){for(var[t,r,i]=l[c],o=!0,a=0;a<t.length;a++)(!1&i||n>=i)&&Object.keys(f.O).every(e=>f.O[e](t[a]))?t.splice(a--,1):(o=!1,i<n&&(n=i));if(o){l.splice(c--,1);var s=r();void 0!==s&&(e=s)}}return e}i=i||0;for(var c=l.length;c>0&&l[c-1][2]>i;c--)l[c]=l[c-1];l[c]=[t,r,i]},f.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return f.d(t,{a:t}),t},s=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,f.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);f.r(r);var i={};a=a||[null,s({}),s([]),s(s)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~a.indexOf(n);n=s(n))Object.getOwnPropertyNames(n).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,f.d(r,i),r},f.d=(e,t)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((t,r)=>(f.f[r](e,t),t),[])),f.u=e=>"chunks/md-"+e+".js",f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c={},p="@momentum-ui/web-components:",f.l=(e,t,r,i)=>{if(c[e])c[e].push(t);else{var n,o;if(void 0!==r)for(var l=document.getElementsByTagName("script"),a=0;a<l.length;a++){var s=l[a];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==p+r){n=s;break}}n||(o=!0,(n=document.createElement("script")).charset="utf-8",f.nc&&n.setAttribute("nonce",f.nc),n.setAttribute("data-webpack",p+r),n.src=e),c[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var i=c[e];if(delete c[e],n.parentNode&&n.parentNode.removeChild(n),i&&i.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),o&&document.head.appendChild(n)}},f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/",(()=>{var e={144:0,1270:0,3001:0,3477:0,5382:0,7032:0,7763:0,8889:0};f.f.j=(t,r)=>{var i=f.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((r,n)=>i=e[t]=[r,n]);r.push(i[2]=n);var o=f.p+f.u(t),l=new Error;f.l(o,r=>{if(f.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,i[1](l)}},"chunk-"+t,t)}},f.O.j=t=>0===e[t];var t=(t,r)=>{var i,n,[o,l,a]=r,s=0;if(o.some(t=>0!==e[t])){for(i in l)f.o(l,i)&&(f.m[i]=l[i]);if(a)var c=a(f)}for(t&&t(r);s<o.length;s++)n=o[s],f.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return f.O(c)},r=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var
|
|
17
|
+
`}};d([(0,s.property)({type:String,attribute:"accept-language"})],t.prototype,"acceptLanguage",void 0),d([(0,s.property)({type:String})],t.prototype,"getLocalization",void 0),d([(0,s.query)("input[type='file']")],t.prototype,"input",void 0),d([(0,s.internalProperty)()],t.prototype,"acceptTypes",void 0),d([(0,s.internalProperty)()],t.prototype,"fileName",void 0),t=d([(0,n.wW)("md-input-file")],t),e.ELEMENT=t}(i||(i={}))},97822:e=>{e.exports=n}},d={};function f(e){var t=d[e];if(void 0!==t)return t.exports;var r=d[e]={exports:{}};return u[e](r,r.exports,f),r.exports}f.m=u,l=[],f.O=(e,t,r,i)=>{if(!t){var n=1/0;for(c=0;c<l.length;c++){for(var[t,r,i]=l[c],o=!0,a=0;a<t.length;a++)(!1&i||n>=i)&&Object.keys(f.O).every(e=>f.O[e](t[a]))?t.splice(a--,1):(o=!1,i<n&&(n=i));if(o){l.splice(c--,1);var s=r();void 0!==s&&(e=s)}}return e}i=i||0;for(var c=l.length;c>0&&l[c-1][2]>i;c--)l[c]=l[c-1];l[c]=[t,r,i]},f.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return f.d(t,{a:t}),t},s=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,f.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);f.r(r);var i={};a=a||[null,s({}),s([]),s(s)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~a.indexOf(n);n=s(n))Object.getOwnPropertyNames(n).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,f.d(r,i),r},f.d=(e,t)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((t,r)=>(f.f[r](e,t),t),[])),f.u=e=>"chunks/md-"+e+".js",f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c={},p="@momentum-ui/web-components:",f.l=(e,t,r,i)=>{if(c[e])c[e].push(t);else{var n,o;if(void 0!==r)for(var l=document.getElementsByTagName("script"),a=0;a<l.length;a++){var s=l[a];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==p+r){n=s;break}}n||(o=!0,(n=document.createElement("script")).charset="utf-8",n.timeout=120,f.nc&&n.setAttribute("nonce",f.nc),n.setAttribute("data-webpack",p+r),n.src=e),c[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var i=c[e];if(delete c[e],n.parentNode&&n.parentNode.removeChild(n),i&&i.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),o&&document.head.appendChild(n)}},f.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/",(()=>{var e={144:0,1270:0,3001:0,3477:0,5382:0,7032:0,7763:0,8889:0};f.f.j=(t,r)=>{var i=f.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((r,n)=>i=e[t]=[r,n]);r.push(i[2]=n);var o=f.p+f.u(t),l=new Error;f.l(o,r=>{if(f.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;l.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,i[1](l)}},"chunk-"+t,t)}},f.O.j=t=>0===e[t];var t=(t,r)=>{var i,n,[o,l,a]=r,s=0;if(o.some(t=>0!==e[t])){for(i in l)f.o(l,i)&&(f.m[i]=l[i]);if(a)var c=a(f)}for(t&&t(r);s<o.length;s++)n=o[s],f.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return f.O(c)},r=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var m=f.O(void 0,[1890,6272,6325,9217,6283,2176,6798,8373,4624,300,768,195,2972,6015],()=>f(52619));return f.O(m)})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"),require("country-codes-list"),require("country-flags-svg"),require("lit-html/directives/repeat.js"),require("lit-html/directives/class-map.js"),require("libphonenumber-js"));else if("function"==typeof define&&define.amd)define(["lit-element","lit-html/directives/class-map","lit-html","lit-html/directives/style-map","lit-html/directives/if-defined","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit-html/directives/repeat","lit-virtualizer","country-codes-list","country-flags-svg","lit-html/directives/repeat.js","lit-html/directives/class-map.js","libphonenumber-js"],t);else{var i="object"==typeof exports?t(require("lit-element"),require("lit-html/directives/class-map"),require("lit-html"),require("lit-html/directives/style-map"),require("lit-html/directives/if-defined"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit-html/directives/repeat"),require("lit-virtualizer"),require("country-codes-list"),require("country-flags-svg"),require("lit-html/directives/repeat.js"),require("lit-html/directives/class-map.js"),require("libphonenumber-js")):t(e["lit-element"],e["lit-html/directives/class-map"],e["lit-html"],e["lit-html/directives/style-map"],e["lit-html/directives/if-defined"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit-html/directives/repeat"],e["lit-virtualizer"],e["country-codes-list"],e["country-flags-svg"],e["lit-html/directives/repeat.js"],e["lit-html/directives/class-map.js"],e["libphonenumber-js"]);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(self,(e,t,i,o,r,l,a,s,n,d,p,u,c,h,m)=>(()=>{"use strict";var y,v={860:e=>{e.exports=m},6963:e=>{e.exports=c},8229:e=>{e.exports=o},13060:e=>{e.exports=p},17518:e=>{e.exports=h},18224:(e,t,i)=>{i(4928);var o,r=i(31890),l=i(26272),a=i(13060),s=i(65875),n=i(41488),d=i(40333),p=i(23968),u=i(6963),c=i(96953),h=function(e,t,i,o){var r,l=arguments.length,a=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(l<3?r(a):l>3?r(t,i,a):r(t,i))||a);return l>3&&a&&Object.defineProperty(t,i,a),a};!function(e){let t=class extends n.LitElement{constructor(){super(...arguments),this.codePlaceholder="+1",this.countryCallingCode="",this.showFlags=!1,this.pill=!1,this.disabled=!1,this.ariaLabel="",this.clearAriaLabel="Clear Country Code",this.id="",this.newMomentum=!1,this.isDropdownArrow=!0,this.countryCode="US",this.codeList=[]}connectedCallback(){super.connectedCallback(),this.codeList=(0,a.customArray)({name:"{countryNameEn}",value:"{countryCallingCode}",code:"{countryCode}"}),""===this.id&&(this.id=`md-country-code-picker-${Math.random().toString(36).substring(2,6)}`)}getCountryFlag(e){return n.html`
|
|
2
2
|
<span class="flag-svg-wrapper">
|
|
3
3
|
<img src="${(0,s.findFlagUrlByIso2Code)(e)}" />
|
|
4
4
|
</span>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
${(0,u.repeat)(this.codeList,e=>e.name,(e,t)=>this.countryCodeOptionTemplate(e,t))}
|
|
37
37
|
</md-combobox>
|
|
38
38
|
</div>
|
|
39
|
-
`}};h([(0,n.property)({type:String,reflect:!0})],t.prototype,"codePlaceholder",void 0),h([(0,n.property)({type:String,attribute:"country-calling-code"})],t.prototype,"countryCallingCode",void 0),h([(0,n.property)({type:Boolean,attribute:"show-flags"})],t.prototype,"showFlags",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"pill",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"disabled",void 0),h([(0,n.property)({type:String})],t.prototype,"ariaLabel",void 0),h([(0,n.property)({type:String})],t.prototype,"clearAriaLabel",void 0),h([(0,n.property)({type:String})],t.prototype,"id",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"newMomentum",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"isDropdownArrow",void 0),h([(0,n.internalProperty)()],t.prototype,"countryCode",void 0),h([(0,n.internalProperty)()],t.prototype,"codeList",void 0),h([(0,n.query)("md-combobox")],t.prototype,"combobox",void 0),t=h([(0,r.w)("md-country-code-picker")],t),e.ELEMENT=t}(o||(o={}))},22818:e=>{e.exports=n},23968:e=>{e.exports=t},32022:e=>{e.exports=l},40333:e=>{e.exports=
|
|
39
|
+
`}};h([(0,n.property)({type:String,reflect:!0})],t.prototype,"codePlaceholder",void 0),h([(0,n.property)({type:String,attribute:"country-calling-code"})],t.prototype,"countryCallingCode",void 0),h([(0,n.property)({type:Boolean,attribute:"show-flags"})],t.prototype,"showFlags",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"pill",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"disabled",void 0),h([(0,n.property)({type:String})],t.prototype,"ariaLabel",void 0),h([(0,n.property)({type:String})],t.prototype,"clearAriaLabel",void 0),h([(0,n.property)({type:String})],t.prototype,"id",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"newMomentum",void 0),h([(0,n.property)({type:Boolean})],t.prototype,"isDropdownArrow",void 0),h([(0,n.internalProperty)()],t.prototype,"countryCode",void 0),h([(0,n.internalProperty)()],t.prototype,"codeList",void 0),h([(0,n.query)("md-combobox")],t.prototype,"combobox",void 0),t=h([(0,r.w)("md-country-code-picker")],t),e.ELEMENT=t}(o||(o={}))},22818:e=>{e.exports=n},23968:e=>{e.exports=t},32022:e=>{e.exports=l},40333:e=>{e.exports=i},41488:t=>{t.exports=e},60554:e=>{e.exports=a},65875:e=>{e.exports=u},84205:(e,t,i)=>{i.r(t),i.d(t,{PhoneInput:()=>o}),i(4928),i(18224),i(96408);var o,r=i(31890),l=i(860),a=i(41488),s=i(23968),n=i(77833),d=function(e,t,i,o){var r,l=arguments.length,a=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(l<3?r(a):l>3?r(t,i,a):r(t,i))||a);return l>3&&a&&Object.defineProperty(t,i,a),a};!function(e){let t=class extends a.LitElement{constructor(){super(...arguments),this.codePlaceholder="+1",this.numberPlaceholder="Enter Phone Number",this.countryCallingCode="",this.showFlags=!1,this.pill=!1,this.disabled=!1,this.value="",this.errorMessage="",this.showErrorMessage=!1,this.countryCodeAriaLabel="",this.dialNumberAriaLabel="",this.clearAriaLabel="Clear Input",this.clearCountryCodeAriaLabel="Clear Country Code",this.id="",this.newMomentum=!1,this.countryCode="US",this.formattedValue="",this.isValid=!0}get isRtl(){try{if(!this.isConnected)return!1;const e=getComputedStyle(this);return"rtl"===(null==e?void 0:e.direction)}catch(e){return!1}}connectedCallback(){super.connectedCallback(),""===this.id&&(this.id=`md-phone-input-${Math.random().toString(36).substring(2,6)}`),this.validateInput(this.value)}validateNumber(){this.isValid=!this.value||(0,l.isValidNumberForRegion)(this.value,this.countryCode)}handleCountryChange(e){var t,i;const o=e.detail.srcEvent;o.detail.value&&(null===(t=o.detail.value)||void 0===t?void 0:t.id)?(this.countryCallingCode=o.detail.value.id,this.countryCode=null===(i=o.detail.value.id.split(",")[2])||void 0===i?void 0:i.trim()):(this.countryCode="US",this.countryCallingCode=""),this.validateNumber(),this.dispatchEvent(new CustomEvent("countrycode-change",{bubbles:!0,composed:!0,detail:{srcEvent:o,isValid:this.isValid}}))}handlePhoneChange(e){this.value=e.detail.value,e.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-change",{bubbles:!0,composed:!0,detail:{srcEvent:e,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleKeydown(e){this.isValid=!0,e.stopPropagation(),this.dispatchEvent(new CustomEvent("phoneinput-keydown",{bubbles:!0,composed:!0,detail:{srcEvent:e,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}handleBlur(e){this.validateInput(this.value),this.validateNumber(),e.stopPropagation(),this.removeCountryCode(),this.dispatchEvent(new CustomEvent("phoneinput-blur",{bubbles:!0,composed:!0,detail:{srcEvent:e,value:`${this.countryCallingCode}${this.value}`,isValid:this.isValid,phoneNumber:this.value}}))}removeCountryCode(){var e;const t=null===(e=this.countryCallingCode.split(",")[0])||void 0===e?void 0:e.trim();if(this.value.startsWith(t)){const e=this.value.slice(t.length).replace(/^-/,"");this.value=e}}validateInput(e){this.formattedValue=new l.AsYouType(this.countryCode).input(e)}get flagClassMap(){return{"new-momentum":this.newMomentum}}get containerClassMap(){return{"md-phone-input__container":!0,rtl:this.isRtl}}static get styles(){return[n.A]}render(){return a.html`
|
|
40
40
|
<div class=${(0,s.classMap)(this.containerClassMap)}>
|
|
41
41
|
<md-country-code-picker
|
|
42
42
|
part="md-country-code-picker"
|