@aquera/nile-elements 1.3.4-beta-1 → 1.3.4-beta-2
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/index.js +3 -2
- package/dist/nile-chip/nile-chip.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.esm.js +3 -2
- package/dist/src/nile-chip/nile-chip.js +8 -0
- package/dist/src/nile-chip/nile-chip.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-chip/nile-chip.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -6010,6 +6010,7 @@ box-shadow: none;
|
|
|
6010
6010
|
.noOutline=${!0}
|
|
6011
6011
|
.noPadding=${!0}
|
|
6012
6012
|
.disabled=${this.disabled}
|
|
6013
|
+
.readonly=${this.readonly}
|
|
6013
6014
|
.portal=${this.portal}
|
|
6014
6015
|
openOnFocus
|
|
6015
6016
|
exportparts="options__wrapper, input, base"
|
|
@@ -6029,7 +6030,7 @@ box-shadow: none;
|
|
|
6029
6030
|
>
|
|
6030
6031
|
`:""}
|
|
6031
6032
|
</div>
|
|
6032
|
-
`}handleSelect(e){const t=e.detail.value,i=this.autoCompleteOptions.find((e=>e.name===t||e.id===t));let M=null;if(this.showTooltip)if(i?.tooltip?.content){const{content:e,for:t}=i.tooltip;if(!t||"tag"===t)if(e instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const t=this.tooltips.length-1;e.then((e=>{this.tooltips[t]=e,this.requestUpdate()}))}else M=e}else M=i?.name||t;this.noDuplicates&&this.tags.includes(t)||(this.tags=[...this.tags,t],i?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,M]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(e){this.tags=this.tags.filter((t=>t!==e)),this.noDuplicates&&this.autoCompleteOptions.includes(e)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,e]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(e){this.inputValue=e.detail.value}handleInputKeydown(e){this.acceptUserInput&&("Tab"===e.key&&e.preventDefault(),"Enter"!==e.key&&"Tab"!==e.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(e.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==e.key&&"Tab"!==e.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((e=>!this.tags.includes(e))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};e([De()],jn.prototype,"tags",void 0),e([De()],jn.prototype,"inputValue",void 0),e([De()],jn.prototype,"isDropdownOpen",void 0),e([De()],jn.prototype,"tooltips",void 0),e([Ie("nile-auto-complete")],jn.prototype,"autoComplete",void 0),e([ce({type:Boolean})],jn.prototype,"warning",void 0),e([ce({type:Boolean})],jn.prototype,"noAutoComplete",void 0),e([ce({type:Boolean})],jn.prototype,"error",void 0),e([ce({type:Boolean})],jn.prototype,"success",void 0),e([ce({type:Boolean})],jn.prototype,"noDuplicates",void 0),e([ce()],jn.prototype,"label",void 0),e([ce({type:String})],jn.prototype,"tagVariant",void 0),e([ce({type:Boolean})],jn.prototype,"acceptUserInput",void 0),e([ce({type:Boolean})],jn.prototype,"clearable",void 0),e([ce()],jn.prototype,"placeholder",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"readonly",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"disabled",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"portal",void 0),e([ce({type:Boolean})],jn.prototype,"enableVirtualScroll",void 0),e([ce({type:Array})],jn.prototype,"autoCompleteOptions",void 0),e([ce({type:Array})],jn.prototype,"filteredAutoCompleteOptions",void 0),e([ce({type:Array})],jn.prototype,"value",void 0),e([ce({type:Boolean})],jn.prototype,"noWrap",void 0),e([ce({type:Boolean})],jn.prototype,"loading",void 0),e([ce({type:Array})],jn.prototype,"errorIndexes",void 0),e([ce({attribute:"help-text",reflect:!0})],jn.prototype,"helpText",void 0),e([ce({attribute:"error-message",reflect:!0})],jn.prototype,"errorMessage",void 0),e([ce({attribute:!1})],jn.prototype,"filterFunction",void 0),e([ce({attribute:!1})],jn.prototype,"renderItemFunction",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"enableVisibilityEffect",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"enableTabClose",void 0),e([ce({type:Boolean})],jn.prototype,"showTooltip",void 0),jn=e([Ne("nile-chip")],jn);const In=r`
|
|
6033
|
+
`}handleSelect(e){const t=e.detail.value,i=this.autoCompleteOptions.find((e=>e.name===t||e.id===t));let M=null;if(this.showTooltip)if(i?.tooltip?.content){const{content:e,for:t}=i.tooltip;if(!t||"tag"===t)if(e instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const t=this.tooltips.length-1;e.then((e=>{this.tooltips[t]=e,this.requestUpdate()}))}else M=e}else M=i?.name||t;this.noDuplicates&&this.tags.includes(t)||(this.tags=[...this.tags,t],i?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,M]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(e){this.tags=this.tags.filter((t=>t!==e)),this.noDuplicates&&this.autoCompleteOptions.includes(e)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,e]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(e){this.inputValue=e.detail.value}handleInputKeydown(e){if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(e.key))return void e.preventDefault()}this.acceptUserInput&&("Tab"===e.key&&e.preventDefault(),"Enter"!==e.key&&"Tab"!==e.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(e.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==e.key&&"Tab"!==e.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((e=>!this.tags.includes(e))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};e([De()],jn.prototype,"tags",void 0),e([De()],jn.prototype,"inputValue",void 0),e([De()],jn.prototype,"isDropdownOpen",void 0),e([De()],jn.prototype,"tooltips",void 0),e([Ie("nile-auto-complete")],jn.prototype,"autoComplete",void 0),e([ce({type:Boolean})],jn.prototype,"warning",void 0),e([ce({type:Boolean})],jn.prototype,"noAutoComplete",void 0),e([ce({type:Boolean})],jn.prototype,"error",void 0),e([ce({type:Boolean})],jn.prototype,"success",void 0),e([ce({type:Boolean})],jn.prototype,"noDuplicates",void 0),e([ce()],jn.prototype,"label",void 0),e([ce({type:String})],jn.prototype,"tagVariant",void 0),e([ce({type:Boolean})],jn.prototype,"acceptUserInput",void 0),e([ce({type:Boolean})],jn.prototype,"clearable",void 0),e([ce()],jn.prototype,"placeholder",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"readonly",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"disabled",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"portal",void 0),e([ce({type:Boolean})],jn.prototype,"enableVirtualScroll",void 0),e([ce({type:Array})],jn.prototype,"autoCompleteOptions",void 0),e([ce({type:Array})],jn.prototype,"filteredAutoCompleteOptions",void 0),e([ce({type:Array})],jn.prototype,"value",void 0),e([ce({type:Boolean})],jn.prototype,"noWrap",void 0),e([ce({type:Boolean})],jn.prototype,"loading",void 0),e([ce({type:Array})],jn.prototype,"errorIndexes",void 0),e([ce({attribute:"help-text",reflect:!0})],jn.prototype,"helpText",void 0),e([ce({attribute:"error-message",reflect:!0})],jn.prototype,"errorMessage",void 0),e([ce({attribute:!1})],jn.prototype,"filterFunction",void 0),e([ce({attribute:!1})],jn.prototype,"renderItemFunction",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"enableVisibilityEffect",void 0),e([ce({type:Boolean,reflect:!0})],jn.prototype,"enableTabClose",void 0),e([ce({type:Boolean})],jn.prototype,"showTooltip",void 0),jn=e([Ne("nile-chip")],jn);const In=r`
|
|
6033
6034
|
.form-control .form-control__label {
|
|
6034
6035
|
display: none;
|
|
6035
6036
|
}
|
|
@@ -14703,7 +14704,7 @@ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
|
|
|
14703
14704
|
|
|
14704
14705
|
|
|
14705
14706
|
|
|
14706
|
-
`,bS={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let fS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),xS(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(CS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=bS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?ES(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){ES(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=OS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&SS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;pS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":xS(this.editorEl,"strong");break;case"italic":xS(this.editorEl,"em");break;case"underline":xS(this.editorEl,"u");break;case"left":pS(this.editorEl,"left");break;case"center":pS(this.editorEl,"center");break;case"right":pS(this.editorEl,"right");break;case"justify":pS(this.editorEl,"justify");break;case"ul":kS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":kS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=OS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=LS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=LS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],fS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],fS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],fS.prototype,"singleLineEditor",void 0),e([ce({type:String})],fS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],fS.prototype,"mentions",void 0),e([De()],fS.prototype,"content",void 0),fS=e([Ne("nile-rich-text-editor")],fS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.3.4-beta-1"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const vS=r`
|
|
14707
|
+
`,bS={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let fS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),xS(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(CS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=bS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?ES(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){ES(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=OS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&SS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;pS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":xS(this.editorEl,"strong");break;case"italic":xS(this.editorEl,"em");break;case"underline":xS(this.editorEl,"u");break;case"left":pS(this.editorEl,"left");break;case"center":pS(this.editorEl,"center");break;case"right":pS(this.editorEl,"right");break;case"justify":pS(this.editorEl,"justify");break;case"ul":kS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":kS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=OS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=LS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=LS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],fS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],fS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],fS.prototype,"singleLineEditor",void 0),e([ce({type:String})],fS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],fS.prototype,"mentions",void 0),e([De()],fS.prototype,"content",void 0),fS=e([Ne("nile-rich-text-editor")],fS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.3.4-beta-2"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const vS=r`
|
|
14707
14708
|
:host {
|
|
14708
14709
|
--sidebar-width: 240px;
|
|
14709
14710
|
--sidebar-collapsed-width: 70px;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,o,h,l,n,a,r,p,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.state;s=_litDecoratorsJs.query;o=_litDecoratorsJs.property;h=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){l=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_litDirectivesUnsafeHtmlJs){p=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_r){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.hasSlotController=new a(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.tooltips=[],_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.portal=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.showTooltip=!1,_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.isDropdownOpen=!1);};return _this;}_inherits(d,_r);return _createClass(d,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(d,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this$renderRoot$quer,_this$autoComplete,_this$autoComplete2,_this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:i=this.noAutoComplete?(_this$renderRoot$quer=this.renderRoot.querySelector("nile-input"))===null||_this$renderRoot$quer===void 0?void 0:_this$renderRoot$quer.input:((_this$autoComplete=this.autoComplete)===null||_this$autoComplete===void 0||(_this$autoComplete=_this$autoComplete.inputElement)===null||_this$autoComplete===void 0?void 0:_this$autoComplete.input)||((_this$autoComplete2=this.autoComplete)===null||_this$autoComplete2===void 0?void 0:_this$autoComplete2.inputElement);this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 4:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){var _this4=this;_superPropGet(d,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this4.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(d,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this5=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled}),e?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,e){var s=_this5.tooltips[e],o=i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0}),_this5.errorIndexes.includes(e)?"error":"normal",function(){return _this5.handleRemove(t);},"normal"!==_this5.tagVariant,p(t));return _this5.showTooltip&&s?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-lite-tooltip allowHTML .content=",">\n ","\n </nile-lite-tooltip>\n "])),s,o):o;}),this.noAutoComplete?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus):i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .showTooltips=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n .portal=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.showTooltip,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.portal,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){var _e$tooltip,_this6=this,_e$tooltip3;var i=t.detail.value,e=this.autoCompleteOptions.find(function(t){return t.name===i||t.id===i;});var s=null;if(this.showTooltip)if(e!==null&&e!==void 0&&(_e$tooltip=e.tooltip)!==null&&_e$tooltip!==void 0&&_e$tooltip.content){var _e$tooltip2=e.tooltip,_t2=_e$tooltip2.content,_i=_e$tooltip2["for"];if(!_i||"tag"===_i)if(_t2 instanceof Promise){this.tooltips=[].concat(_toConsumableArray(this.tooltips),["Loading..."]);var _i2=this.tooltips.length-1;_t2.then(function(t){_this6.tooltips[_i2]=t,_this6.requestUpdate();});}else s=_t2;}else s=(e===null||e===void 0?void 0:e.name)||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[].concat(_toConsumableArray(this.tags),[i]),(e===null||e===void 0||(_e$tooltip3=e.tooltip)===null||_e$tooltip3===void 0?void 0:_e$tooltip3.content)instanceof Promise||(this.tooltips=[].concat(_toConsumableArray(this.tooltips),[s])),this.emit("nile-chip-change",{value:this.tags}),this.resetInput());}},{key:"handleRemove",value:function handleRemove(t){this.tags=this.tags.filter(function(i){return i!==t;}),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[].concat(_toConsumableArray(this.filteredAutoCompleteOptions),[t])),this.emit("nile-chip-change",{value:this.tags});}},{key:"handleInputChange",value:function handleInputChange(t){this.inputValue=t.detail.value;}},{key:"handleInputKeydown",value:function handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){var _this$visibilityManag2;this.noAutoComplete||((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this7=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this7.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){var _this$visibilityManag3;this.inputValue="",this.isDropdownOpen=!1,(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[l];}}]);}(r));t([e()],d.prototype,"tags",void 0),t([e()],d.prototype,"inputValue",void 0),t([e()],d.prototype,"isDropdownOpen",void 0),t([e()],d.prototype,"tooltips",void 0),t([s("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([o({type:Boolean})],d.prototype,"warning",void 0),t([o({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],d.prototype,"error",void 0),t([o({type:Boolean})],d.prototype,"success",void 0),t([o({type:Boolean})],d.prototype,"noDuplicates",void 0),t([o()],d.prototype,"label",void 0),t([o({type:String})],d.prototype,"tagVariant",void 0),t([o({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],d.prototype,"clearable",void 0),t([o()],d.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([o({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"value",void 0),t([o({type:Boolean})],d.prototype,"noWrap",void 0),t([o({type:Boolean})],d.prototype,"loading",void 0),t([o({type:Array})],d.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([o({attribute:!1})],d.prototype,"filterFunction",void 0),t([o({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([o({type:Boolean})],d.prototype,"showTooltip",void 0),_export("N",d=t([h("nile-chip")],d));}};});
|
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,o,h,l,n,r,a,p,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.state;s=_litDecoratorsJs.query;o=_litDecoratorsJs.property;h=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){l=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;},function(_litDirectivesUnsafeHtmlJs){p=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_a){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.tooltips=[],_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.portal=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.showTooltip=!1,_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.isDropdownOpen=!1);};return _this;}_inherits(d,_a);return _createClass(d,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(d,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this$renderRoot$quer,_this$autoComplete,_this$autoComplete2,_this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:i=this.noAutoComplete?(_this$renderRoot$quer=this.renderRoot.querySelector("nile-input"))===null||_this$renderRoot$quer===void 0?void 0:_this$renderRoot$quer.input:((_this$autoComplete=this.autoComplete)===null||_this$autoComplete===void 0||(_this$autoComplete=_this$autoComplete.inputElement)===null||_this$autoComplete===void 0?void 0:_this$autoComplete.input)||((_this$autoComplete2=this.autoComplete)===null||_this$autoComplete2===void 0?void 0:_this$autoComplete2.inputElement);this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 4:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){var _this4=this;_superPropGet(d,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this4.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(d,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this5=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled}),e?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,e){var s=_this5.tooltips[e],o=i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0}),_this5.errorIndexes.includes(e)?"error":"normal",function(){return _this5.handleRemove(t);},"normal"!==_this5.tagVariant,p(t));return _this5.showTooltip&&s?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-lite-tooltip allowHTML .content=",">\n ","\n </nile-lite-tooltip>\n "])),s,o):o;}),this.noAutoComplete?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus):i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .showTooltips=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n .readonly=","\n .portal=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.showTooltip,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.readonly,this.portal,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){var _e$tooltip,_this6=this,_e$tooltip3;var i=t.detail.value,e=this.autoCompleteOptions.find(function(t){return t.name===i||t.id===i;});var s=null;if(this.showTooltip)if(e!==null&&e!==void 0&&(_e$tooltip=e.tooltip)!==null&&_e$tooltip!==void 0&&_e$tooltip.content){var _e$tooltip2=e.tooltip,_t2=_e$tooltip2.content,_i=_e$tooltip2["for"];if(!_i||"tag"===_i)if(_t2 instanceof Promise){this.tooltips=[].concat(_toConsumableArray(this.tooltips),["Loading..."]);var _i2=this.tooltips.length-1;_t2.then(function(t){_this6.tooltips[_i2]=t,_this6.requestUpdate();});}else s=_t2;}else s=(e===null||e===void 0?void 0:e.name)||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[].concat(_toConsumableArray(this.tags),[i]),(e===null||e===void 0||(_e$tooltip3=e.tooltip)===null||_e$tooltip3===void 0?void 0:_e$tooltip3.content)instanceof Promise||(this.tooltips=[].concat(_toConsumableArray(this.tooltips),[s])),this.emit("nile-chip-change",{value:this.tags}),this.resetInput());}},{key:"handleRemove",value:function handleRemove(t){this.tags=this.tags.filter(function(i){return i!==t;}),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[].concat(_toConsumableArray(this.filteredAutoCompleteOptions),[t])),this.emit("nile-chip-change",{value:this.tags});}},{key:"handleInputChange",value:function handleInputChange(t){this.inputValue=t.detail.value;}},{key:"handleInputKeydown",value:function handleInputKeydown(t){if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault();}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){var _this$visibilityManag2;this.noAutoComplete||((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this7=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this7.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){var _this$visibilityManag3;this.inputValue="",this.isDropdownOpen=!1,(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[l];}}]);}(a));t([e()],d.prototype,"tags",void 0),t([e()],d.prototype,"inputValue",void 0),t([e()],d.prototype,"isDropdownOpen",void 0),t([e()],d.prototype,"tooltips",void 0),t([s("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([o({type:Boolean})],d.prototype,"warning",void 0),t([o({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],d.prototype,"error",void 0),t([o({type:Boolean})],d.prototype,"success",void 0),t([o({type:Boolean})],d.prototype,"noDuplicates",void 0),t([o()],d.prototype,"label",void 0),t([o({type:String})],d.prototype,"tagVariant",void 0),t([o({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],d.prototype,"clearable",void 0),t([o()],d.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([o({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"value",void 0),t([o({type:Boolean})],d.prototype,"noWrap",void 0),t([o({type:Boolean})],d.prototype,"loading",void 0),t([o({type:Array})],d.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([o({attribute:!1})],d.prototype,"filterFunction",void 0),t([o({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([o({type:Boolean})],d.prototype,"showTooltip",void 0),_export("N",d=t([h("nile-chip")],d));}};});
|
|
2
2
|
//# sourceMappingURL=nile-chip.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n @state() tooltips: (string | null)[] = [];\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n private visibilityManager?: VisibilityManager;\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n @property({ type: Boolean }) showTooltip: boolean = false;\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n \n const inputTarget =\n this.noAutoComplete\n ? this.renderRoot.querySelector('nile-input')?.input\n : this.autoComplete?.inputElement?.input || this.autoComplete?.inputElement;\n \n this.visibilityManager = new VisibilityManager({\n host: this,\n target: inputTarget,\n enableVisibilityEffect: this.enableVisibilityEffect,\n enableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n } \n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n }\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n if (!path.includes(this)) {\n this.isDropdownOpen = false; \n }\n };\n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.visibilityManager?.cleanup();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map((tag, index) => {\n const tooltipContent = this.tooltips[index];\n const tagTemplate = html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index)\n ? 'error'\n : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${unsafeHTML(tag)}\n </nile-tag>\n `;\n\n if (this.showTooltip && tooltipContent) {\n return html`\n <nile-lite-tooltip allowHTML .content=${tooltipContent}>\n ${tagTemplate}\n </nile-lite-tooltip>\n `;\n }\n\n return tagTemplate;\n })}\n\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .showTooltips=${this.showTooltip}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n .portal=${this.portal}\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-complete=${this.handleSelect}\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n // Add the selected value to the tags array only if it doesn't already exist\n const selectedValue = event.detail.value;\n const selectedOption = this.autoCompleteOptions.find(\n (opt) => opt.name === selectedValue || opt.id === selectedValue\n );\n\n let tooltipContent: string | null = null;\n \n if (this.showTooltip) {\n if (selectedOption?.tooltip?.content) {\n const { content, for: showFor } = selectedOption.tooltip;\n if (!showFor || showFor === 'tag') {\n if (content instanceof Promise) {\n this.tooltips = [...this.tooltips, 'Loading...'];\n \n const currentIndex = this.tooltips.length - 1;\n content.then((resolved) => {\n this.tooltips[currentIndex] = resolved;\n this.requestUpdate();\n });\n } else {\n tooltipContent = content;\n }\n }\n } else {\n tooltipContent = selectedOption?.name || selectedValue;\n }\n }\n\n if (!this.noDuplicates || !this.tags.includes(selectedValue)) {\n this.tags = [...this.tags, selectedValue];\n \n\n if (!(selectedOption?.tooltip?.content instanceof Promise)) {\n this.tooltips = [...this.tooltips, tooltipContent];\n }\n \n this.emit('nile-chip-change', { value: this.tags });\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n \n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.visibilityManager?.setup();\n this.isDropdownOpen = true;\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n this.visibilityManager?.cleanup();\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","d","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","tooltips","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","portal","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","enableVisibilityEffect","enableTabClose","showTooltip","handleDocumentClick","event","composedPath","_this","_inherits","_r","_createClass","key","updated","changedProperties","super","has","options","JSON","parse","e","Array","isArray","_toConsumableArray","filter","option","onTagsChanged","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","inputTarget","renderRoot","querySelector","input","autoComplete","inputElement","visibilityManager","VisibilityManager","host","target","isOpen","onAnchorOutOfView","emit","visible","reason","onDocumentHidden","detail","_context2","stop","firstUpdated","connectedCallback","document","addEventListener","disconnectedCallback","cleanup","removeEventListener","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","tooltipContent","tagTemplate","_templateObject2","handleRemove","unsafeHTML","_templateObject3","_templateObject4","handleInputChange","handleInputKeydown","handleFocus","_templateObject5","handleSelect","_templateObject6","_templateObject7","_e$tooltip","_this6","_e$tooltip3","selectedValue","selectedOption","find","opt","name","id","tooltip","content","_e$tooltip2","showFor","Promise","concat","currentIndex","length","then","resolved","requestUpdate","resetInput","preventDefault","setup","_this$visibilityManag3","__decorate","get","styles","NileElement","state","prototype","query","property","type","Boolean","String","reflect","attribute","customElement"],"mappings":"0paA2BaA,4BAAN,SAAAC,EAAA,uEAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CACvCF,CAAAA,sBAAAA,CAAAA,KAAAA,EACA,YACA,OAGOA,CAAAA,CAAAA,KAAAA,CAAIG,KAAa,EAEjBH,CAAAA,KAAAA,CAAU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MC,OAASE,CAAAA,OAAAA,CAAAA,CAAS,KAA+B7J,CAAAuJ,CAAAA,SAAAA,CAAA,gBAAA,CAAA,IAAA,EAAA,CAAA,CAEtCL,CAAA,CAAA,CAA5BO,CAAS,CAAA,CAAEC,KAAMC,OAAwC3J,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAuJ,SAAA,CAAA,aAAA,CAAA,IAAA,gBA7F/CvJ,CAAQkJ,CAAAA,CAAAA,CAAA,CADpBa,CAAAA,CAAc,cACF/J"}
|
|
1
|
+
{"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n @state() tooltips: (string | null)[] = [];\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n private visibilityManager?: VisibilityManager;\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n @property({ type: Boolean }) showTooltip: boolean = false;\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n \n const inputTarget =\n this.noAutoComplete\n ? this.renderRoot.querySelector('nile-input')?.input\n : this.autoComplete?.inputElement?.input || this.autoComplete?.inputElement;\n \n this.visibilityManager = new VisibilityManager({\n host: this,\n target: inputTarget,\n enableVisibilityEffect: this.enableVisibilityEffect,\n enableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n } \n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n if (this.autoComplete) {\n this.autoComplete.isDropdownOpen = false;\n }\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n if (!path.includes(this)) {\n this.isDropdownOpen = false; \n }\n };\n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.visibilityManager?.cleanup();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map((tag, index) => {\n const tooltipContent = this.tooltips[index];\n const tagTemplate = html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index)\n ? 'error'\n : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${unsafeHTML(tag)}\n </nile-tag>\n `;\n\n if (this.showTooltip && tooltipContent) {\n return html`\n <nile-lite-tooltip allowHTML .content=${tooltipContent}>\n ${tagTemplate}\n </nile-lite-tooltip>\n `;\n }\n\n return tagTemplate;\n })}\n\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .showTooltips=${this.showTooltip}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n .readonly=${this.readonly}\n .portal=${this.portal}\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-complete=${this.handleSelect}\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n // Add the selected value to the tags array only if it doesn't already exist\n const selectedValue = event.detail.value;\n const selectedOption = this.autoCompleteOptions.find(\n (opt) => opt.name === selectedValue || opt.id === selectedValue\n );\n\n let tooltipContent: string | null = null;\n \n if (this.showTooltip) {\n if (selectedOption?.tooltip?.content) {\n const { content, for: showFor } = selectedOption.tooltip;\n if (!showFor || showFor === 'tag') {\n if (content instanceof Promise) {\n this.tooltips = [...this.tooltips, 'Loading...'];\n \n const currentIndex = this.tooltips.length - 1;\n content.then((resolved) => {\n this.tooltips[currentIndex] = resolved;\n this.requestUpdate();\n });\n } else {\n tooltipContent = content;\n }\n }\n } else {\n tooltipContent = selectedOption?.name || selectedValue;\n }\n }\n\n if (!this.noDuplicates || !this.tags.includes(selectedValue)) {\n this.tags = [...this.tags, selectedValue];\n \n\n if (!(selectedOption?.tooltip?.content instanceof Promise)) {\n this.tooltips = [...this.tooltips, tooltipContent];\n }\n \n this.emit('nile-chip-change', { value: this.tags });\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (this.readonly) {\n const allowedKeys = [\"ArrowUp\", \"ArrowDown\", \"Enter\", \"Tab\"];\n if (!allowedKeys.includes(event.key)) {\n event.preventDefault();\n return;\n }\n }\n\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n if (this.showTooltip) {\n this.tooltips = [...this.tooltips, this.inputValue];\n } else {\n this.tooltips = [...this.tooltips, null];\n }\n \n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.visibilityManager?.setup();\n this.isDropdownOpen = true;\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n this.visibilityManager?.cleanup();\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","d","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","tooltips","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","portal","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","enableVisibilityEffect","enableTabClose","showTooltip","handleDocumentClick","event","composedPath","_this","_inherits","_a","_createClass","key","updated","changedProperties","super","has","options","JSON","parse","e","Array","isArray","_toConsumableArray","filter","option","onTagsChanged","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","inputTarget","renderRoot","querySelector","input","autoComplete","inputElement","visibilityManager","VisibilityManager","host","target","isOpen","onAnchorOutOfView","emit","visible","reason","onDocumentHidden","detail","_context2","stop","firstUpdated","connectedCallback","document","addEventListener","disconnectedCallback","cleanup","removeEventListener","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","tooltipContent","tagTemplate","_templateObject2","handleRemove","unsafeHTML","_templateObject3","_templateObject4","handleInputChange","handleInputKeydown","handleFocus","_templateObject5","handleSelect","_templateObject6","_templateObject7","_e$tooltip","_this6","_e$tooltip3","selectedValue","selectedOption","find","opt","name","id","tooltip","content","_e$tooltip2","showFor","Promise","currentIndex","length","then","resolved","requestUpdate","resetInput","preventDefault","concat","setup","__decorate","get","styles","NileElement","state","prototype","query","property","type","Boolean","String","reflect","attribute","customElement"],"mappings":"0paA2BaA,4BAAN,SAAAC,EAAA,uEAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CACvCF,CAAAA,sBAAAA,CAAAA,KAAAA,EACA,YACA,OAGOA,CAAAA,CAAAA,KAAA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MC,CAAAA,OAAAA,CAASE,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC5J,EAAAsJ,SAAA,CAAA,wBAAA,CAAA,IAAA,EAE/BL,CAAAA,CAAAA,CAAAA,CAAA,CAA3CO,CAAS,CAAA,CAAEC,IAAMC,CAAAA,OAAAA,CAASE,SAAS,CAA+B5J,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAsJ,SAAA,CAAA,gBAAA,CAAA,IAAA,IAEtCL,CAAA,CAAA,CAA5BO,CAAS,CAAA,CAAEC,KAAMC,OAAwC1J,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAsJ,SAAA,CAAA,aAAA,CAAA,IAAA,gBA7F/CtJ,CAAQiJ,CAAAA,CAAAA,CAAA,CADpBa,CAAAA,CAAc,cACF9J"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,query as s,property as o,customElement as h}from"lit/decorators.js";import{s as l}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as
|
|
1
|
+
import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,query as s,property as o,customElement as h}from"lit/decorators.js";import{s as l}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as r}from"../internal/slot.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";import{V as c}from"../utilities/visibility-manager.esm.js";let d=class extends a{constructor(){super(...arguments),this.hasSlotController=new r(this,"help-text","label"),this.tags=[],this.inputValue="",this.isDropdownOpen=!1,this.tooltips=[],this.warning=!1,this.noAutoComplete=!1,this.error=!1,this.success=!1,this.noDuplicates=!1,this.label="",this.tagVariant="",this.acceptUserInput=!1,this.clearable=!1,this.placeholder="type here...",this.readonly=!1,this.disabled=!1,this.portal=!1,this.enableVirtualScroll=!1,this.autoCompleteOptions=[],this.filteredAutoCompleteOptions=[],this.value=[],this.noWrap=!1,this.loading=!1,this.errorIndexes=[],this.helpText="",this.errorMessage="",this.filterFunction=(t,i)=>t.toLowerCase().includes(i.toLowerCase()),this.renderItemFunction=t=>t,this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.showTooltip=!1,this.handleDocumentClick=t=>{t.composedPath().includes(this)||(this.isDropdownOpen=!1)}}static get styles(){return[l]}updated(t){if(super.updated(t),t.has("autoCompleteOptions")){let t=this.autoCompleteOptions;if("string"==typeof t)try{t=JSON.parse(t)}catch(i){t=[]}this.filteredAutoCompleteOptions=Array.isArray(t)?[...t]:[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t))))}t.has("value")&&(this.tags=[...this.value],this.onTagsChanged()),t.has("tags")&&this.onTagsChanged()}async firstUpdated(t){await this.updateComplete;const i=this.noAutoComplete?this.renderRoot.querySelector("nile-input")?.input:this.autoComplete?.inputElement?.input||this.autoComplete?.inputElement;this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.isDropdownOpen,onAnchorOutOfView:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this.isDropdownOpen=!1,this.autoComplete&&(this.autoComplete.isDropdownOpen=!1),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(t,i)=>this.emit(`nile-${t}`,i)})}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t)))),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.visibilityManager?.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy")}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i`
|
|
2
2
|
<div
|
|
3
3
|
part="form-control"
|
|
4
4
|
class=${n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled})}
|
|
@@ -60,6 +60,7 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
|
|
|
60
60
|
.noOutline=${!0}
|
|
61
61
|
.noPadding=${!0}
|
|
62
62
|
.disabled=${this.disabled}
|
|
63
|
+
.readonly=${this.readonly}
|
|
63
64
|
.portal=${this.portal}
|
|
64
65
|
openOnFocus
|
|
65
66
|
exportparts="options__wrapper, input, base"
|
|
@@ -79,4 +80,4 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
|
|
|
79
80
|
>
|
|
80
81
|
`:""}
|
|
81
82
|
</div>
|
|
82
|
-
`}handleSelect(t){const i=t.detail.value,e=this.autoCompleteOptions.find((t=>t.name===i||t.id===i));let s=null;if(this.showTooltip)if(e?.tooltip?.content){const{content:t,for:i}=e.tooltip;if(!i||"tag"===i)if(t instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const i=this.tooltips.length-1;t.then((t=>{this.tooltips[i]=t,this.requestUpdate()}))}else s=t}else s=e?.name||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[...this.tags,i],e?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,s]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],d.prototype,"tags",void 0),t([e()],d.prototype,"inputValue",void 0),t([e()],d.prototype,"isDropdownOpen",void 0),t([e()],d.prototype,"tooltips",void 0),t([s("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([o({type:Boolean})],d.prototype,"warning",void 0),t([o({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],d.prototype,"error",void 0),t([o({type:Boolean})],d.prototype,"success",void 0),t([o({type:Boolean})],d.prototype,"noDuplicates",void 0),t([o()],d.prototype,"label",void 0),t([o({type:String})],d.prototype,"tagVariant",void 0),t([o({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],d.prototype,"clearable",void 0),t([o()],d.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([o({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"value",void 0),t([o({type:Boolean})],d.prototype,"noWrap",void 0),t([o({type:Boolean})],d.prototype,"loading",void 0),t([o({type:Array})],d.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([o({attribute:!1})],d.prototype,"filterFunction",void 0),t([o({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([o({type:Boolean})],d.prototype,"showTooltip",void 0),d=t([h("nile-chip")],d);export{d as N};
|
|
83
|
+
`}handleSelect(t){const i=t.detail.value,e=this.autoCompleteOptions.find((t=>t.name===i||t.id===i));let s=null;if(this.showTooltip)if(e?.tooltip?.content){const{content:t,for:i}=e.tooltip;if(!i||"tag"===i)if(t instanceof Promise){this.tooltips=[...this.tooltips,"Loading..."];const i=this.tooltips.length-1;t.then((t=>{this.tooltips[i]=t,this.requestUpdate()}))}else s=t}else s=e?.name||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[...this.tags,i],e?.tooltip?.content instanceof Promise||(this.tooltips=[...this.tooltips,s]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}handleInputKeydown(t){if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault()}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.showTooltip?this.tooltips=[...this.tooltips,this.inputValue]:this.tooltips=[...this.tooltips,null],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.visibilityManager?.setup(),this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.visibilityManager?.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],d.prototype,"tags",void 0),t([e()],d.prototype,"inputValue",void 0),t([e()],d.prototype,"isDropdownOpen",void 0),t([e()],d.prototype,"tooltips",void 0),t([s("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([o({type:Boolean})],d.prototype,"warning",void 0),t([o({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],d.prototype,"error",void 0),t([o({type:Boolean})],d.prototype,"success",void 0),t([o({type:Boolean})],d.prototype,"noDuplicates",void 0),t([o()],d.prototype,"label",void 0),t([o({type:String})],d.prototype,"tagVariant",void 0),t([o({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],d.prototype,"clearable",void 0),t([o()],d.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([o({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],d.prototype,"value",void 0),t([o({type:Boolean})],d.prototype,"noWrap",void 0),t([o({type:Boolean})],d.prototype,"loading",void 0),t([o({type:Array})],d.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([o({attribute:!1})],d.prototype,"filterFunction",void 0),t([o({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([o({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([o({type:Boolean})],d.prototype,"showTooltip",void 0),d=t([h("nile-chip")],d);export{d as N};
|
|
@@ -245,6 +245,7 @@ let NileChip = class NileChip extends NileElement {
|
|
|
245
245
|
.noOutline=${true}
|
|
246
246
|
.noPadding=${true}
|
|
247
247
|
.disabled=${this.disabled}
|
|
248
|
+
.readonly=${this.readonly}
|
|
248
249
|
.portal=${this.portal}
|
|
249
250
|
openOnFocus
|
|
250
251
|
exportparts="options__wrapper, input, base"
|
|
@@ -321,6 +322,13 @@ let NileChip = class NileChip extends NileElement {
|
|
|
321
322
|
this.inputValue = event.detail.value;
|
|
322
323
|
}
|
|
323
324
|
handleInputKeydown(event) {
|
|
325
|
+
if (this.readonly) {
|
|
326
|
+
const allowedKeys = ["ArrowUp", "ArrowDown", "Enter", "Tab"];
|
|
327
|
+
if (!allowedKeys.includes(event.key)) {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
324
332
|
if (!this.acceptUserInput) {
|
|
325
333
|
return;
|
|
326
334
|
}
|