@aquera/nile-elements 1.2.2 → 1.2.3

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/README.md CHANGED
@@ -79,6 +79,9 @@ To run a local development server that serves the basic demo located in `demo/in
79
79
 
80
80
  In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
81
81
 
82
+ #### Version 1.2.3
83
+ - Nile Chip: Event not working in Nile Chip when noAutoComplete is passed (UIF-995)
84
+
82
85
  #### Version 1.2.2
83
86
  - New Component: Nile Grid (UIF-989)
84
87
  - Dependency Nile 1.0.9
package/dist/index.js CHANGED
@@ -5855,7 +5855,7 @@ class mi{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
5855
5855
  >
5856
5856
  `:""}
5857
5857
  </div>
5858
- `}handleSelect(e){this.noDuplicates&&this.tags.includes(e.detail.value)||(this.tags=[...this.tags,e.detail.value],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.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.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((e=>!this.tags.includes(e))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.autoComplete.value="",this.autoComplete.handleFocus()}};e([ce()],rn.prototype,"tags",void 0),e([ce()],rn.prototype,"inputValue",void 0),e([ce()],rn.prototype,"isDropdownOpen",void 0),e([Ie("nile-auto-complete")],rn.prototype,"autoComplete",void 0),e([ue({type:Boolean})],rn.prototype,"warning",void 0),e([ue({type:Boolean})],rn.prototype,"noAutoComplete",void 0),e([ue({type:Boolean})],rn.prototype,"error",void 0),e([ue({type:Boolean})],rn.prototype,"success",void 0),e([ue({type:Boolean})],rn.prototype,"noDuplicates",void 0),e([ue()],rn.prototype,"label",void 0),e([ue({type:String})],rn.prototype,"tagVariant",void 0),e([ue({type:Boolean})],rn.prototype,"acceptUserInput",void 0),e([ue({type:Boolean})],rn.prototype,"clearable",void 0),e([ue()],rn.prototype,"placeholder",void 0),e([ue({type:Boolean,reflect:!0})],rn.prototype,"readonly",void 0),e([ue({type:Boolean,reflect:!0})],rn.prototype,"disabled",void 0),e([ue({type:Boolean})],rn.prototype,"enableVirtualScroll",void 0),e([ue({type:Array})],rn.prototype,"autoCompleteOptions",void 0),e([ue({type:Array})],rn.prototype,"filteredAutoCompleteOptions",void 0),e([ue({type:Array})],rn.prototype,"value",void 0),e([ue({type:Boolean})],rn.prototype,"noWrap",void 0),e([ue({type:Boolean})],rn.prototype,"loading",void 0),e([ue({type:Array})],rn.prototype,"errorIndexes",void 0),e([ue({attribute:"help-text",reflect:!0})],rn.prototype,"helpText",void 0),e([ue({attribute:"error-message",reflect:!0})],rn.prototype,"errorMessage",void 0),e([ue({attribute:!1})],rn.prototype,"filterFunction",void 0),e([ue({attribute:!1})],rn.prototype,"renderItemFunction",void 0),rn=e([le("nile-chip")],rn);const sn=r`
5858
+ `}handleSelect(e){this.noDuplicates&&this.tags.includes(e.detail.value)||(this.tags=[...this.tags,e.detail.value],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.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.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((e=>!this.tags.includes(e))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};e([ce()],rn.prototype,"tags",void 0),e([ce()],rn.prototype,"inputValue",void 0),e([ce()],rn.prototype,"isDropdownOpen",void 0),e([Ie("nile-auto-complete")],rn.prototype,"autoComplete",void 0),e([ue({type:Boolean})],rn.prototype,"warning",void 0),e([ue({type:Boolean})],rn.prototype,"noAutoComplete",void 0),e([ue({type:Boolean})],rn.prototype,"error",void 0),e([ue({type:Boolean})],rn.prototype,"success",void 0),e([ue({type:Boolean})],rn.prototype,"noDuplicates",void 0),e([ue()],rn.prototype,"label",void 0),e([ue({type:String})],rn.prototype,"tagVariant",void 0),e([ue({type:Boolean})],rn.prototype,"acceptUserInput",void 0),e([ue({type:Boolean})],rn.prototype,"clearable",void 0),e([ue()],rn.prototype,"placeholder",void 0),e([ue({type:Boolean,reflect:!0})],rn.prototype,"readonly",void 0),e([ue({type:Boolean,reflect:!0})],rn.prototype,"disabled",void 0),e([ue({type:Boolean})],rn.prototype,"enableVirtualScroll",void 0),e([ue({type:Array})],rn.prototype,"autoCompleteOptions",void 0),e([ue({type:Array})],rn.prototype,"filteredAutoCompleteOptions",void 0),e([ue({type:Array})],rn.prototype,"value",void 0),e([ue({type:Boolean})],rn.prototype,"noWrap",void 0),e([ue({type:Boolean})],rn.prototype,"loading",void 0),e([ue({type:Array})],rn.prototype,"errorIndexes",void 0),e([ue({attribute:"help-text",reflect:!0})],rn.prototype,"helpText",void 0),e([ue({attribute:"error-message",reflect:!0})],rn.prototype,"errorMessage",void 0),e([ue({attribute:!1})],rn.prototype,"filterFunction",void 0),e([ue({attribute:!1})],rn.prototype,"renderItemFunction",void 0),rn=e([le("nile-chip")],rn);const sn=r`
5859
5859
  .form-control .form-control__label {
5860
5860
  display: none;
5861
5861
  }
@@ -14094,7 +14094,7 @@ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
14094
14094
 
14095
14095
 
14096
14096
 
14097
- `,IS={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 zS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,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(),sS(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 M=t.getRangeAt(0);if(e.shiftKey){if(M.collapsed&&M.startContainer.nodeType===Node.TEXT_NODE){const e=M.startContainer,i=M.startOffset,n=e.data.slice(0,i),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(i);const M=document.createRange();M.setStart(e,o.length),M.collapse(!0),t.removeAllRanges(),t.addRange(M),this.updateContent(),this.updateToolbarState()}}return}M.deleteContents();const i=document.createTextNode("\t");M.insertNode(i);const n=document.createRange();n.setStartAfter(i),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(jS.cssText),this.ensureStructure(),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.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const M=e.parentNode;if(!M)return;const i=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(i);M.insertBefore(n,e),M.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,M=t.getAttribute("data-mention-key"),i=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!M&&!!i&&o.length>0&&o.startsWith(n)&&o.includes(i);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 M=e.getAttribute("name")||"",i=e.getAttribute("label")||M,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="${i}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=IS[M];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${i}"></nile-icon>`:t.textContent=i||M,e.innerHTML=""}if(!t.isConnected){const M=document.createElement("nile-tooltip");M.setAttribute("content",i),M.appendChild(t),e.appendChild(M)}t.setAttribute("aria-label",i),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(M)));const r=this.buttonMap.get(M)??[];return r.push(t),void this.buttonMap.set(M,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:M}=e.detail;"backColor"===t?gS(this.editorEl,"backgroundColor",M,"data-rte-bg"):function(e,t){gS(e,"color",t,"data-rte-color")}(this.editorEl,M),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const M=e.detail;"heading"===t?function(e,t){const M=document.getSelection();if(!M||0===M.rangeCount)return;const i=oS(M.getRangeAt(0).startContainer,e);if(!i)return;if(i.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;i.firstChild;)n.appendChild(i.firstChild);i.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),M.removeAllRanges(),M.addRange(o)}(this.editorEl,M):"font"===t&&NS(this.editorEl,M),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;rS(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),M=this.lastRange.extractContents(),i=document.createElement("div");i.appendChild(M),Array.from(i.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const M=document.createElement("li");M.appendChild(e),t.appendChild(M)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const M=window.getSelection();M?.removeAllRanges(),M?.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":sS(this.editorEl,"strong");break;case"italic":sS(this.editorEl,"em");break;case"underline":sS(this.editorEl,"u");break;case"left":rS(this.editorEl,"left");break;case"center":rS(this.editorEl,"center");break;case"right":rS(this.editorEl,"right");break;case"justify":rS(this.editorEl,"justify");break;case"ul":cS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":cS(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 M=e.currentNode;M.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(M.tagName)&&t.push(M)}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 M=this.buttonMap.get(e);if(M)for(const e of M)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 M=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,i=getComputedStyle(M),n=oS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=M;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const M=getComputedStyle(e).fontWeight;if(parseInt(M,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=M;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=M;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=!!M.closest("a"),N=n.style.textAlign||getComputedStyle(n).textAlign||"start",l="start"===N?"left":N,g=!!M.closest("li")&&M.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"===l&&!["center","right","justify"].includes(l)),this.setBtnActive("center","center"===l),this.setBtnActive("right","right"===l),this.setBtnActive("justify","justify"===l),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=(i.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=aS(i.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(M).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=aS(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.cloneNode(!0);if(this.noStyles)e.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const t=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),M=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),i=["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(;t.nextNode()&&M.nextNode();){const e=t.currentNode,n=M.currentNode,o=window.getComputedStyle(e),r=i.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=e.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ue({type:String,attribute:!0,reflect:!0})],zS.prototype,"value",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],zS.prototype,"noStyles",void 0),e([ue({type:Boolean,attribute:"singlelineeditor",reflect:!0})],zS.prototype,"singleLineEditor",void 0),e([ue({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),M={};for(const e of Object.keys(t)){const i=t[e];Array.isArray(i)&&(M[e]=i.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return M}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],zS.prototype,"mentions",void 0),e([ce()],zS.prototype,"content",void 0),zS=e([le("nile-rich-text-editor")],zS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.2.2"',window.nileVersion="__NILE_VERSION__");const dS=r`
14097
+ `,IS={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 zS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,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(),sS(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 M=t.getRangeAt(0);if(e.shiftKey){if(M.collapsed&&M.startContainer.nodeType===Node.TEXT_NODE){const e=M.startContainer,i=M.startOffset,n=e.data.slice(0,i),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(i);const M=document.createRange();M.setStart(e,o.length),M.collapse(!0),t.removeAllRanges(),t.addRange(M),this.updateContent(),this.updateToolbarState()}}return}M.deleteContents();const i=document.createTextNode("\t");M.insertNode(i);const n=document.createRange();n.setStartAfter(i),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(jS.cssText),this.ensureStructure(),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.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const M=e.parentNode;if(!M)return;const i=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(i);M.insertBefore(n,e),M.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,M=t.getAttribute("data-mention-key"),i=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!M&&!!i&&o.length>0&&o.startsWith(n)&&o.includes(i);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 M=e.getAttribute("name")||"",i=e.getAttribute("label")||M,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="${i}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=IS[M];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${i}"></nile-icon>`:t.textContent=i||M,e.innerHTML=""}if(!t.isConnected){const M=document.createElement("nile-tooltip");M.setAttribute("content",i),M.appendChild(t),e.appendChild(M)}t.setAttribute("aria-label",i),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(M)));const r=this.buttonMap.get(M)??[];return r.push(t),void this.buttonMap.set(M,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:M}=e.detail;"backColor"===t?gS(this.editorEl,"backgroundColor",M,"data-rte-bg"):function(e,t){gS(e,"color",t,"data-rte-color")}(this.editorEl,M),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const M=e.detail;"heading"===t?function(e,t){const M=document.getSelection();if(!M||0===M.rangeCount)return;const i=oS(M.getRangeAt(0).startContainer,e);if(!i)return;if(i.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;i.firstChild;)n.appendChild(i.firstChild);i.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),M.removeAllRanges(),M.addRange(o)}(this.editorEl,M):"font"===t&&NS(this.editorEl,M),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;rS(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),M=this.lastRange.extractContents(),i=document.createElement("div");i.appendChild(M),Array.from(i.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const M=document.createElement("li");M.appendChild(e),t.appendChild(M)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const M=window.getSelection();M?.removeAllRanges(),M?.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":sS(this.editorEl,"strong");break;case"italic":sS(this.editorEl,"em");break;case"underline":sS(this.editorEl,"u");break;case"left":rS(this.editorEl,"left");break;case"center":rS(this.editorEl,"center");break;case"right":rS(this.editorEl,"right");break;case"justify":rS(this.editorEl,"justify");break;case"ul":cS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":cS(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 M=e.currentNode;M.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(M.tagName)&&t.push(M)}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 M=this.buttonMap.get(e);if(M)for(const e of M)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 M=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,i=getComputedStyle(M),n=oS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=M;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const M=getComputedStyle(e).fontWeight;if(parseInt(M,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=M;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=M;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=!!M.closest("a"),N=n.style.textAlign||getComputedStyle(n).textAlign||"start",l="start"===N?"left":N,g=!!M.closest("li")&&M.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"===l&&!["center","right","justify"].includes(l)),this.setBtnActive("center","center"===l),this.setBtnActive("right","right"===l),this.setBtnActive("justify","justify"===l),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=(i.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=aS(i.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(M).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=aS(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.cloneNode(!0);if(this.noStyles)e.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const t=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),M=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),i=["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(;t.nextNode()&&M.nextNode();){const e=t.currentNode,n=M.currentNode,o=window.getComputedStyle(e),r=i.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=e.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ue({type:String,attribute:!0,reflect:!0})],zS.prototype,"value",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],zS.prototype,"noStyles",void 0),e([ue({type:Boolean,attribute:"singlelineeditor",reflect:!0})],zS.prototype,"singleLineEditor",void 0),e([ue({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),M={};for(const e of Object.keys(t)){const i=t[e];Array.isArray(i)&&(M[e]=i.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return M}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],zS.prototype,"mentions",void 0),e([ce()],zS.prototype,"content",void 0),zS=e([le("nile-rich-text-editor")],zS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.2.3"',window.nileVersion="__NILE_VERSION__");const dS=r`
14098
14098
  :host {
14099
14099
  --sidebar-width: 240px;
14100
14100
  --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"],function(_export,_context){"use strict";var t,i,e,s,o,l,h,n,r,a,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,p;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}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;l=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){h=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",p=/*#__PURE__*/function(_a){function p(){var _this;_classCallCheck(this,p);_this=_callSuper(this,p,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_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.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;};return _this;}_inherits(p,_a);return _createClass(p,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(p,"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:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet(p,"connectedCallback",this,3)([]),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this3.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(p,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this4=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 <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}),this.tags.map(function(t,e){return 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}),_this4.errorIndexes.includes(e)?"error":"normal",function(){return _this4.handleRemove(t);},"normal"!==_this4.tagVariant,t);}),this.noAutoComplete?i(_templateObject3||(_templateObject3=_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(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n openOnFocus\n exportparts=\"options__wrapper, input\"\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.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[].concat(_toConsumableArray(this.tags),[t.detail.value]),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.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(){this.noAutoComplete||(this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this5=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this5.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.autoComplete.value="",this.autoComplete.handleFocus();}}],[{key:"styles",get:function get(){return[h];}}]);}(a));t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),_export("N",p=t([l("nile-chip")],p));}};});
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"],function(_export,_context){"use strict";var t,i,e,s,o,l,h,n,r,a,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,p;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}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;l=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){h=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",p=/*#__PURE__*/function(_a){function p(){var _this;_classCallCheck(this,p);_this=_callSuper(this,p,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_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.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;};return _this;}_inherits(p,_a);return _createClass(p,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(p,"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:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet(p,"connectedCallback",this,3)([]),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this3.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(p,"disconnectedCallback",this,3)([]),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this4=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 <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}),this.tags.map(function(t,e){return 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}),_this4.errorIndexes.includes(e)?"error":"normal",function(){return _this4.handleRemove(t);},"normal"!==_this4.tagVariant,t);}),this.noAutoComplete?i(_templateObject3||(_templateObject3=_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(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n openOnFocus\n exportparts=\"options__wrapper, input\"\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.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[].concat(_toConsumableArray(this.tags),[t.detail.value]),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.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(){this.noAutoComplete||(this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this5=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this5.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[h];}}]);}(a));t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),_export("N",p=t([l("nile-chip")],p));}};});
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';\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\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 // 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 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 connectedCallback() {\n super.connectedCallback();\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.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 })}\n >\n ${this.tags.map(\n (tag, index) => html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index) ? 'error' : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${tag}\n </nile-tag>\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 .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 openOnFocus\n exportparts=\"options__wrapper, input\"\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 if (!this.noDuplicates || !this.tags.includes(event.detail.value)) {\n this.tags = [...this.tags, event.detail.value];\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 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.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.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","p","constructor","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","_this","_inherits","_a","_createClass","key","updated","changedProperties","_this2","super","has","options","JSON","parse","e","Array","isArray","filter","option","_toConsumableArray","onTagsChanged","connectedCallback","emit","disconnectedCallback","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","_templateObject2","handleRemove","_templateObject3","handleInputChange","handleInputKeydown","handleFocus","_templateObject4","handleSelect","_templateObject5","_templateObject6","event","detail","concat","resetInput","preventDefault","autoComplete","get","styles","NileElement","__decorate","state","prototype","query","property","type","Boolean","String","reflect","attribute","_export","customElement"],"mappings":"+5JAyBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAA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A,CAAA,oBAAA,CAAA,IAAA,EAAA,CAAA,CAAAQ,OAAA,KA9E7ErG,EAAQ2F,CAAA,CAAA,CADpBW,CAAc,CAAA,WAAA,CAAA,CAAA,CACFtG"}
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';\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\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 // 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 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 connectedCallback() {\n super.connectedCallback();\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.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 })}\n >\n ${this.tags.map(\n (tag, index) => html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index) ? 'error' : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${tag}\n </nile-tag>\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 .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 openOnFocus\n exportparts=\"options__wrapper, input\"\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 if (!this.noDuplicates || !this.tags.includes(event.detail.value)) {\n this.tags = [...this.tags, event.detail.value];\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 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.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 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","p","constructor","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","_this","_inherits","_a","_createClass","key","updated","changedProperties","_this2","super","has","options","JSON","parse","e","Array","isArray","filter","option","_toConsumableArray","onTagsChanged","connectedCallback","emit","disconnectedCallback","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","_templateObject2","handleRemove","_templateObject3","handleInputChange","handleInputKeydown","handleFocus","_templateObject4","handleSelect","_templateObject5","_templateObject6","event","detail","concat","resetInput","preventDefault","autoComplete","get","styles","NileElement","__decorate","state","prototype","query","property","type","Boolean","String","reflect","attribute","_export","customElement"],"mappings":"+5JAyBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAEvC,WACA,CAAA,OAAA,CAAA,CAGOF,KAAAA,CAAIG,IAAAA,CAAa,EAEjBH,CAAAA,KAAAA,CAAUI,UAAW,CAAA,EAAA,CAErBJ,KAAAA,C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,SAAAA,CAAA,oBAAA,CAAA,IAAA,EAAA,CAAA,CAAAQ,OAAA,KA9E7ErG,EAAQ2F,CAAA,CAAA,CADpBW,CAAc,CAAA,WAAA,CAAA,CAAA,CACFtG"}
@@ -72,4 +72,4 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
72
72
  >
73
73
  `:""}
74
74
  </div>
75
- `}handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[...this.tags,t.detail.value],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.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.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,this.autoComplete.value="",this.autoComplete.handleFocus()}};t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),p=t([l("nile-chip")],p);export{p as N};
75
+ `}handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[...this.tags,t.detail.value],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.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.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),p=t([l("nile-chip")],p);export{p as N};
@@ -257,8 +257,10 @@ let NileChip = class NileChip extends NileElement {
257
257
  // Reset the input-related properties
258
258
  this.inputValue = '';
259
259
  this.isDropdownOpen = false;
260
- this.autoComplete.value = '';
261
- this.autoComplete.handleFocus();
260
+ if (!this.noAutoComplete && this.autoComplete) {
261
+ this.autoComplete.value = '';
262
+ this.autoComplete.handleFocus();
263
+ }
262
264
  }
263
265
  };
264
266
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"nile-chip.js","sourceRoot":"","sources":["../../../src/nile-chip/nile-chip.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAIL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,WAAgC,MAAM,0BAA0B,CAAC;AAOjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,WAAW;IAAlC;;QAKY,sBAAiB,GAAG,IAAI,iBAAiB,CACxD,IAAI,EACJ,WAAW,EACX,OAAO,CACR,CAAC;QAEO,SAAI,GAAa,EAAE,CAAC;QAEpB,eAAU,GAAW,EAAE,CAAC;QAExB,mBAAc,GAAY,KAAK,CAAC;QAIzC,yEAAyE;QAC5C,YAAO,GAAG,KAAK,CAAC;QAElB,mBAAc,GAAG,KAAK,CAAC;QAGlD,wEAAwE;QAC3C,UAAK,GAAG,KAAK,CAAC;QAE3C,yEAAyE;QAC5C,YAAO,GAAG,KAAK,CAAC;QAE7C,sCAAsC;QACT,iBAAY,GAAG,KAAK,CAAC;QAElD,oFAAoF;QACxE,UAAK,GAAG,EAAE,CAAC;QAEK,eAAU,GAAW,EAAE,CAAC,CAAC,uCAAuC;QAG5F,uDAAuD;QAC1B,oBAAe,GAAG,KA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AAO,EAAE,CAAC;wCAAyB;AAExB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAA0B;AAE3B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAA6B;AAEF;IAApD,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAEV;IAAxD,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAmB;AAE7C;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;gDAA4J;AAE3J;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;oDAA2D;AA9E7E,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAsTpB;;AAED,eAAe,QAAQ,CAAC","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';\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\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 // 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 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 connectedCallback() {\n super.connectedCallback();\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.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 })}\n >\n ${this.tags.map(\n (tag, index) => html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index) ? 'error' : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${tag}\n </nile-tag>\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 .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 openOnFocus\n exportparts=\"options__wrapper, input\"\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 if (!this.noDuplicates || !this.tags.includes(event.detail.value)) {\n this.tags = [...this.tags, event.detail.value];\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 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.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.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-chip.js","sourceRoot":"","sources":["../../../src/nile-chip/nile-chip.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAIL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,WAAgC,MAAM,0BAA0B,CAAC;AAOjE,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,WAAW;IAAlC;;QAKY,sBAAiB,GAAG,IAAI,iBAAiB,CACxD,IAAI,EACJ,WAAW,EACX,OAAO,CACR,CAA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AAGG;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAGjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAKhC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA6B;AAE9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAAiC;AAEhC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6DAAyC;AAExC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAAmB;AAEhB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAyB;AAExB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAA0B;AAE3B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAA6B;AAEF;IAApD,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAEV;IAAxD,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAmB;AAE7C;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;gDAA4J;AAE3J;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;oDAA2D;AA9E7E,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwTpB;;AAED,eAAe,QAAQ,CAAC","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';\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\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 // 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 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 connectedCallback() {\n super.connectedCallback();\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.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 })}\n >\n ${this.tags.map(\n (tag, index) => html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index) ? 'error' : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${tag}\n </nile-tag>\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 .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 openOnFocus\n exportparts=\"options__wrapper, input\"\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 if (!this.noDuplicates || !this.tags.includes(event.detail.value)) {\n this.tags = [...this.tags, event.detail.value];\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 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.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 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"]}
@@ -1,5 +1,5 @@
1
1
  // Version utility - placeholders will be replaced during build
2
- export const NILE_ELEMENTS_VERSION = '1.2.2';
2
+ export const NILE_ELEMENTS_VERSION = '1.2.3';
3
3
  export const NILE_VERSION = '1.0.9';
4
4
  // Set global versions for runtime access
5
5
  if (typeof window !== 'undefined') {
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C,yCAAyC;AACzC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,mBAAmB,GAAG,qBAAqB,CAAC;IAC3D,MAAc,CAAC,WAAW,GAAG,YAAY,CAAC;AAC7C,CAAC","sourcesContent":["// Version utility - placeholders will be replaced during build\nexport const NILE_ELEMENTS_VERSION = '1.2.2';\nexport const NILE_VERSION = '1.0.9';\n\n// Set global versions for runtime access\nif (typeof window !== 'undefined') {\n (window as any).nileElementsVersion = NILE_ELEMENTS_VERSION;\n (window as any).nileVersion = NILE_VERSION;\n}\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAE/C,yCAAyC;AACzC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,mBAAmB,GAAG,qBAAqB,CAAC;IAC3D,MAAc,CAAC,WAAW,GAAG,YAAY,CAAC;AAC7C,CAAC","sourcesContent":["// Version utility - placeholders will be replaced during build\nexport const NILE_ELEMENTS_VERSION = '1.2.3';\nexport const NILE_VERSION = '1.0.9';\n\n// Set global versions for runtime access\nif (typeof window !== 'undefined') {\n (window as any).nileElementsVersion = NILE_ELEMENTS_VERSION;\n (window as any).nileVersion = NILE_VERSION;\n}\n"]}