@aquera/nile-elements 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/demo/variables.css +1 -0
- package/dist/index.js +3 -3
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.esm.js +9 -9
- package/dist/src/nile-auto-complete/nile-auto-complete.js +4 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
- package/dist/src/nile-chip/nile-chip.js +4 -1
- package/dist/src/nile-chip/nile-chip.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-auto-complete/nile-auto-complete.ts +4 -1
- package/src/nile-chip/nile-chip.ts +4 -1
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.4.2
|
|
83
|
+
- Nile Chip: unSafeHTML error fix (UIF-1041)
|
|
84
|
+
|
|
82
85
|
#### Version 1.4.1
|
|
83
86
|
- Nile Chip: unSafeHTML error fix (UIF-1041)
|
|
84
87
|
|
|
@@ -91,8 +94,8 @@ In this section, you can find the updates for each release of `nile-elements`. I
|
|
|
91
94
|
- Nile Skeleton Loader: New component added (UIF-1028)
|
|
92
95
|
- Nile Icons: new icons added (UIF-1026)
|
|
93
96
|
- Nile Chip: Fixed disabled property (UIF-1034)
|
|
94
|
-
- Nile Date Picker: Added 4 properties
|
|
95
|
-
- Nile Calendar: Added css properties
|
|
97
|
+
- Nile Date Picker: Added 4 properties (UIF-1043)
|
|
98
|
+
- Nile Calendar: Added css properties (UIF-1043)
|
|
96
99
|
- Dependency Nile 1.1.4
|
|
97
100
|
|
|
98
101
|
|
package/demo/variables.css
CHANGED
|
@@ -309,6 +309,7 @@
|
|
|
309
309
|
--nile-colors-primary-500: #80AED3;
|
|
310
310
|
--nile-colors-primary-400: #BFD7E9;
|
|
311
311
|
--nile-colors-primary-100: #E6EFF6;
|
|
312
|
+
--nile-colors-neutral-700: #777D82;
|
|
312
313
|
--nile-colors-neutral-500: #C7CED4;
|
|
313
314
|
--nile-colors-neutral-400: #E6E9EB;
|
|
314
315
|
--nile-colors-neutral-100: #FAFAFA;
|
package/dist/index.js
CHANGED
|
@@ -5834,7 +5834,7 @@ class CM{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
5834
5834
|
`}getContent(){return R`
|
|
5835
5835
|
<nile-menu id="content-menu" @nile-select=${this.handleSelect} exportparts="menu__items-wrapper:options__wrapper" style=${this.portal?"display: none;":""}>
|
|
5836
5836
|
${this.menuItems.map((e=>this.getItemRenderFunction(e)))}
|
|
5837
|
-
</nile-menu>`}getItemRenderFunction(e){const t=this.renderItemFunction(e)
|
|
5837
|
+
</nile-menu>`}getItemRenderFunction(e){const t=this.renderItemFunction(e);let i="";(t||"number"==typeof t)&&(i=t.toString());if(!(!!e.tooltip&&(!e.tooltip.for||"menu"===e.tooltip.for)))return R`
|
|
5838
5838
|
<nile-menu-item value=${t}>${Le(i)}</nile-menu-item>
|
|
5839
5839
|
`;let M=null;const n=e.tooltip.content;return n instanceof Promise?(M="Loading...",n.then((t=>{e.tooltip.content=t,this.requestUpdate()}))):M=n,R`
|
|
5840
5840
|
<nile-menu-item value=${t}>
|
|
@@ -6039,7 +6039,7 @@ box-shadow: none;
|
|
|
6039
6039
|
part='base'
|
|
6040
6040
|
class=${pe({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen})}
|
|
6041
6041
|
>
|
|
6042
|
-
${this.tags.map(((e,t)=>{const i=this.tooltips[t],M=this.enableTagDelete&&this.chipFocusIndex===t
|
|
6042
|
+
${this.tags.map(((e,t)=>{const i=this.tooltips[t],M=this.enableTagDelete&&this.chipFocusIndex===t;let n="";(e||"number"==typeof e)&&(n=e.toString());const o=R`
|
|
6043
6043
|
<nile-tag
|
|
6044
6044
|
class=${pe({"nile-chip__tags":!0,"nile-chip__tags--focused":M})}
|
|
6045
6045
|
aria-selected=${M?"true":"false"}
|
|
@@ -14864,7 +14864,7 @@ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
|
|
|
14864
14864
|
|
|
14865
14865
|
|
|
14866
14866
|
|
|
14867
|
-
`,_S={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let FS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),US(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(GS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=_S[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?WS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){WS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=fS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&ZS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;vS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":US(this.editorEl,"strong");break;case"italic":US(this.editorEl,"em");break;case"underline":US(this.editorEl,"u");break;case"left":vS(this.editorEl,"left");break;case"center":vS(this.editorEl,"center");break;case"right":vS(this.editorEl,"right");break;case"justify":vS(this.editorEl,"justify");break;case"ul":BS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":BS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=fS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=YS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=YS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],FS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],FS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],FS.prototype,"singleLineEditor",void 0),e([ce({type:String})],FS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],FS.prototype,"mentions",void 0),e([De()],FS.prototype,"content",void 0),FS=e([Ne("nile-rich-text-editor")],FS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.4.1"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const HS=r`
|
|
14867
|
+
`,_S={bold:"format_bold",italic:"format_italic",underline:"format_underline",link:"link_2",left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify",ul:"format_list_bulleted",ol:"format_list_numbered",clear:"format_clear"};let FS=class extends ae{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.content="",this.previewEl=null,this.toolbarEl=null,this.lastRange=null,this.buttonMap=new Map,this.headingSelect=null,this.fontSelect=null,this.colorInput=null,this.bgColorInput=null,this.colorSwatchEl=null,this.bgSwatchEl=null,this.containerEl=null,this.mentionsEl=null,this.onEditorKeydown=e=>{if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),US(this.editorEl,"em"),this.updateContent(),this.updateToolbarState()),this.singleLineEditor&&"Enter"===e.key)return void e.preventDefault();if("Tab"!==e.key)return;e.preventDefault(),this.focusAndRestore();const t=window.getSelection();if(!t||0===t.rangeCount)return;const i=t.getRangeAt(0);if(e.shiftKey){if(i.collapsed&&i.startContainer.nodeType===Node.TEXT_NODE){const e=i.startContainer,M=i.startOffset,n=e.data.slice(0,M),o=n.replace(/(\t|[ \u00a0]{2})$/,"");if(o.length!==n.length){e.data=o+e.data.slice(M);const i=document.createRange();i.setStart(e,o.length),i.collapse(!0),t.removeAllRanges(),t.addRange(i),this.updateContent(),this.updateToolbarState()}}return}i.deleteContents();const M=document.createTextNode("\t");i.insertNode(M);const n=document.createRange();n.setStartAfter(M),n.collapse(!0),t.removeAllRanges(),t.addRange(n),this.updateContent(),this.updateToolbarState()},this.onSelectionChange=()=>{if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);this.editorEl.contains(t.commonAncestorContainer)&&(this.lastRange=t.cloneRange(),this.updateToolbarState())}}createRenderRoot(){return this}injectCss(e){if(this.querySelector("style[data-rte-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-style","true"),t.textContent=e,this.insertBefore(t,this.firstChild)}connectedCallback(){super.connectedCallback(),this.injectCss(GS.cssText),this.ensureStructure(),this.placeholder&&this.editorEl&&(this.editorEl.dataset.placeholder=this.placeholder),this.value&&!this.editorEl.innerHTML.trim()&&(this.editorEl.innerHTML=this.value),this.content=this.editorEl.innerHTML,this.toolbarEl&&this.wireAuthoredToolbar(this.toolbarEl),this.mentionsEl=this.querySelector("nile-rte-mentions"),this.mentionsEl&&(this.mentionsEl.attach?.(this.editorEl,this),this.mentionsEl.setExternalConfig?.(this.mentions)),this.wireEditor(),document.addEventListener("selectionchange",this.onSelectionChange,{passive:!0}),this.updateToolbarState(),this.syncPreview()}ensureStructure(){this.toolbarEl=this.querySelector("nile-rte-toolbar"),this.previewEl=this.querySelector("nile-rte-preview"),this.containerEl=this.querySelector(".rte-container"),this.containerEl||(this.containerEl=document.createElement("div"),this.containerEl.className="rte-container",this.appendChild(this.containerEl)),this.ensureEditor(),this.toolbarEl&&this.toolbarEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.toolbarEl),this.editorEl.parentElement!==this.containerEl&&this.containerEl.appendChild(this.editorEl),this.previewEl&&(this.previewEl.parentElement!==this&&this.appendChild(this.previewEl),this.previewEl.previousElementSibling!==this.containerEl&&this.insertBefore(this.previewEl,this.containerEl.nextSibling))}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){document.removeEventListener("selectionchange",this.onSelectionChange),this.mentionsEl&&this.mentionsEl.detach&&this.mentionsEl.detach(),super.disconnectedCallback()}updated(e){e.has("value")&&this.editorEl&&this.value!==this.editorEl.innerHTML&&(this.editorEl.innerHTML=this.value||"<p><br></p>",this.content=this.editorEl.innerHTML,this.syncPreview()),e.has("singleLineEditor")&&(this.editorEl&&this.editorEl.classList.toggle("single-line",this.singleLineEditor),this.previewEl&&this.previewEl.classList.toggle("single-line",this.singleLineEditor))}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable","true"),this.editorEl=e}this.placeholder&&(this.editorEl.dataset.placeholder=this.placeholder),this.editorEl.innerHTML.trim()||(this.editorEl.innerHTML="<p><br></p>")}unwrapMention(e,t=!0){const i=e.parentNode;if(!i)return;const M=t?(e.textContent??"").replace(/\u200B/g,""):"",n=document.createTextNode(M);i.insertBefore(n,e),i.removeChild(e);const o=document.createRange();o.setStartAfter(n),o.collapse(!0);const r=window.getSelection();r?.removeAllRanges(),r?.addRange(o)}scrubBrokenMentions(){if(!this.editorEl)return;this.editorEl.querySelectorAll("span.mention").forEach((e=>{const t=e,i=t.getAttribute("data-mention-key"),M=t.getAttribute("data-mention-label"),n=t.getAttribute("data-mention-trigger")||"",o=(t.textContent??"").replace(/\u200B/g,"").trim(),r=!!i&&!!M&&o.length>0&&o.startsWith(n)&&o.includes(M);o&&r||this.unwrapMention(t,!0)}))}wireEditor(){this.editorEl.addEventListener("input",(()=>{this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState()})),this.editorEl.addEventListener("mouseup",(()=>{this.saveSelection(),this.updateToolbarState()})),this.editorEl.addEventListener("keyup",(e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()})),this.editorEl.addEventListener("keydown",this.onEditorKeydown)}wireAuthoredToolbar(e){this.buttonMap.clear(),this.headingSelect=null,this.fontSelect=null,this.colorInput=null,Array.from(e.children).forEach((e=>{const t=e.tagName.toLowerCase();if("nile-rte-select"!==t||"align"!==e.getAttribute("type")){if("nile-rte-link"===t)return e.editorEl=this.editorEl,void e.addEventListener("link-changed",(()=>{this.updateContent(),this.updateToolbarState()}));if("nile-rte-toolbar-item"===t){let t=e.querySelector(":scope > nile-button");const i=e.getAttribute("name")||"",M=e.getAttribute("label")||i,n=e.getAttribute("icon"),o=e.innerHTML.trim().length>0;if(t||(t=document.createElement("nile-button"),t.variant="tertiary",t.size="small"),n)t.innerHTML=`<nile-icon name="${n}" aria-label="${M}"></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=_S[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="black" aria-label="${M}"></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected){const i=document.createElement("nile-tooltip");i.setAttribute("content",M),i.appendChild(t),e.appendChild(i)}t.setAttribute("aria-label",M),t.addEventListener("mousedown",(e=>e.preventDefault())),t.addEventListener("click",(()=>this.onToolbarCommand(i)));const r=this.buttonMap.get(i)??[];return r.push(t),void this.buttonMap.set(i,r)}if("nile-rte-select"!==t)"nile-rte-color"!==t||e.addEventListener("change",(e=>{this.focusAndRestore();const{mode:t,value:i}=e.detail;"backColor"===t?WS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){WS(e,"color",t,"data-rte-color")}(this.editorEl,i),this.updateContent(),this.updateToolbarState()}));else{const t=e.getAttribute("type")||"";e.addEventListener("change",(e=>{this.focusAndRestore();const i=e.detail;"heading"===t?function(e,t){const i=document.getSelection();if(!i||0===i.rangeCount)return;const M=fS(i.getRangeAt(0).startContainer,e);if(!M)return;if(M.tagName.toLowerCase()===t)return;const n=document.createElement(t);for(;M.firstChild;)n.appendChild(M.firstChild);M.replaceWith(n);const o=document.createRange();o.selectNodeContents(n),o.collapse(!0),i.removeAllRanges(),i.addRange(o)}(this.editorEl,i):"font"===t&&ZS(this.editorEl,i),this.updateContent(),this.updateToolbarState()}))}}else e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;vS(this.editorEl,t),this.updateContent(),this.updateToolbarState()}))}))}saveSelection(){const e=window.getSelection();e&&e.rangeCount&&(this.lastRange=e.getRangeAt(0).cloneRange())}restoreSelection(){if(!this.lastRange)return;const e=document.getSelection();e&&(e.removeAllRanges(),e.addRange(this.lastRange))}focusAndRestore(){this.editorEl?.focus(),this.restoreSelection()}getCleanContent(){const e=this.editorEl.cloneNode(!0);return e.querySelectorAll("*").forEach((e=>{e.removeAttribute("style")})),e.innerHTML}insertList(e){if(this.restoreSelection(),!this.lastRange)return;const t=document.createElement(e),i=this.lastRange.extractContents(),M=document.createElement("div");M.appendChild(i),Array.from(M.childNodes).forEach((e=>{if(e.nodeType===Node.TEXT_NODE&&!e.textContent?.trim())return;const i=document.createElement("li");i.appendChild(e),t.appendChild(i)})),this.lastRange.insertNode(t),this.afterListEdit(t)}afterListEdit(e){const t=document.createRange();t.setStartAfter(e),t.collapse(!0);const i=window.getSelection();i?.removeAllRanges(),i?.addRange(t),this.saveSelection(),this.updateContent(),this.updateToolbarState()}ensureAtLeastOneParagraph(){const e=this.editorEl;if(!e)return;const t=""===(e.textContent??"").replace(/\u200B/g,"").trim();if(0===e.childNodes.length||t)return void(e.innerHTML="<p><br></p>");if(!e.querySelector("p,h1,h2,h3,h4,h5,h6,ul,ol,table,blockquote,pre")){const t=document.createElement("p");for(;e.firstChild;)t.appendChild(e.firstChild);return t.hasChildNodes()||t.appendChild(document.createElement("br")),void e.appendChild(t)}e.querySelectorAll("p").forEach((e=>{""===(e.textContent??"").replace(/\u200B/g,"")&&(e.innerHTML.toLowerCase().includes("<br")||(e.innerHTML="<br>"))}))}onToolbarCommand(e){switch(this.focusAndRestore(),e){case"bold":US(this.editorEl,"strong");break;case"italic":US(this.editorEl,"em");break;case"underline":US(this.editorEl,"u");break;case"left":vS(this.editorEl,"left");break;case"center":vS(this.editorEl,"center");break;case"right":vS(this.editorEl,"right");break;case"justify":vS(this.editorEl,"justify");break;case"ul":BS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":BS(this.editorEl,"ol"),this.updateContent(),this.updateToolbarState();break;case"link":break;case"clear":const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=[];for(;e.nextNode();){const i=e.currentNode;i.removeAttribute("style"),["B","STRONG","I","EM","U","SPAN","FONT"].includes(i.tagName)&&t.push(i)}for(const e of t){for(;e.firstChild;)e.parentNode?.insertBefore(e.firstChild,e);e.remove()}this.ensureAtLeastOneParagraph()}this.updateContent(),this.updateToolbarState()}setBtnActive(e,t){const i=this.buttonMap.get(e);if(i)for(const e of i)e.toggleAttribute("data-active",!!t)}updateToolbarState(){if(!this.editorEl)return;const e=document.getSelection();if(!e||0===e.rangeCount)return;const t=e.getRangeAt(0);if(!this.editorEl.contains(t.commonAncestorContainer))return;const i=function(e){for(;e&&!(e instanceof HTMLElement);)e=e.parentNode;return e}(t.startContainer)||this.editorEl,M=getComputedStyle(i),n=fS(t.startContainer,this.editorEl)||this.editorEl,o=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("strong"===t||"b"===t)return!0;const i=getComputedStyle(e).fontWeight;if(parseInt(i,10)>=600)return!0}e=e.parentNode}return!1})(),r=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=e.tagName.toLowerCase();if("em"===t||"i"===t)return!0;if("italic"===getComputedStyle(e).fontStyle)return!0}e=e.parentNode}return!1})(),s=(()=>{let e=i;for(;e&&e!==this.editorEl;){if(e instanceof HTMLElement){const t=getComputedStyle(e).textDecorationLine;if(t&&t.includes("underline"))return!0;if("u"===e.tagName.toLowerCase())return!0}e=e.parentNode}return!1})(),a=!!i.closest("a"),l=n.style.textAlign||getComputedStyle(n).textAlign||"start",N="start"===l?"left":l,g=!!i.closest("li")&&i.closest("ul,ol")?.tagName.toLowerCase()||"";if(this.setBtnActive("bold",o),this.setBtnActive("italic",r),this.setBtnActive("underline",s),this.setBtnActive("link",a),this.setBtnActive("left","left"===N&&!["center","right","justify"].includes(N)),this.setBtnActive("center","center"===N),this.setBtnActive("right","right"===N),this.setBtnActive("justify","justify"===N),this.setBtnActive("ul","ul"===g),this.setBtnActive("ol","ol"===g),this.headingSelect){const e=n.tagName.toLowerCase(),t=["h1","h2","h3"].includes(e)?e:"p";this.headingSelect.value!==t&&(this.headingSelect.value=t)}if(this.fontSelect){const e=(M.fontFamily||"").replace(/["']/g,"").split(",")[0].trim().toLowerCase();if(e)for(const t of Array.from(this.fontSelect.options))if(t.value.toLowerCase()===e){this.fontSelect.value=t.value;break}}if(this.colorInput){const e=YS(M.color);e&&this.colorInput.value.toLowerCase()!==e.toLowerCase()&&(this.colorInput.value=e),this.colorSwatchEl&&(this.colorSwatchEl.style.backgroundColor=this.colorInput.value)}if(this.bgColorInput){const e=getComputedStyle(i).backgroundColor;if(e&&!/transparent|rgba\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e)){const t=YS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=this.editorEl.cloneNode(!0);if(this.noStyles)t.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),M=["font-weight","font-style","text-decoration","color","background-color","font-size","font-family","text-align","line-height","letter-spacing","white-space","vertical-align","list-style-position","padding-inline-start"];for(;e.nextNode()&&i.nextNode();){const t=e.currentNode,n=i.currentNode,o=window.getComputedStyle(t),r=M.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}this.content=t.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ce({type:String,attribute:!0,reflect:!0})],FS.prototype,"value",void 0),e([ce({type:Boolean,attribute:!0,reflect:!0})],FS.prototype,"noStyles",void 0),e([ce({type:Boolean,attribute:"singlelineeditor",reflect:!0})],FS.prototype,"singleLineEditor",void 0),e([ce({type:String})],FS.prototype,"placeholder",void 0),e([ce({attribute:"mentions",reflect:!0,converter:{fromAttribute:e=>{try{const t=JSON.parse(e),i={};for(const e of Object.keys(t)){const M=t[e];Array.isArray(M)&&(i[e]=M.filter((e=>e&&"string"==typeof e.key&&"string"==typeof e.label)).map((e=>({key:e.key,label:e.label}))))}return i}catch{return{}}},toAttribute:e=>JSON.stringify(e)}})],FS.prototype,"mentions",void 0),e([De()],FS.prototype,"content",void 0),FS=e([Ne("nile-rich-text-editor")],FS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.4.2"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const HS=r`
|
|
14868
14868
|
:host {
|
|
14869
14869
|
|
|
14870
14870
|
top: 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["tslib","lit","lit/decorators.js","./nile-auto-complete.css.cjs.js","../internal/nile-element.cjs.js","../internal/watch.cjs.js","./portal-manager.cjs.js","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js","../floating-ui.dom-007bbe96.cjs.js","./portal-utils.cjs.js","../lit-html-9b3af046.cjs.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,i,e,s,n,o,h,l,r,a,p,d,u,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,m;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);}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _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;e=_lit.nothing;},function(_litDecoratorsJs){s=_litDecoratorsJs.query;n=_litDecoratorsJs.property;o=_litDecoratorsJs.state;h=_litDecoratorsJs.customElement;},function(_nileAutoCompleteCssCjsJs){l=_nileAutoCompleteCssCjsJs.s;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_internalWatchCjsJs){a=_internalWatchCjsJs.w;},function(_portalManagerCjsJs){p=_portalManagerCjsJs.A;},function(_virtualize002CjsJs){d=_virtualize002CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){u=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;},function(_floatingUiDom001CjsJs){},function(_portalUtilsCjsJs){},function(_litHtml003CjsJs){},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("N",m=/*#__PURE__*/function(_r){function m(){var _this;_classCallCheck(this,m);_this=_callSuper(this,m,arguments),_this.disabled=!1,_this.isDropdownOpen=!1,_this.portal=!1,_this.portalManager=new p(_assertThisInitialized(_this)),_this.enableVirtualScroll=!1,_this.openOnFocus=!1,_this.value="",_this.placeholder="Type here ..",_this.noBorder=!1,_this.noOutline=!1,_this.noPadding=!1,_this.loading=!1,_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.allMenuItems=[],_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.menuItems=[],_this.handleWindowResize=function(){_this.portalManager.updatePortalAppendPosition();},_this.handleWindowScroll=function(){_this.portalManager.updatePortalAppendPosition();};return _this;}_inherits(m,_r);return _createClass(m,[{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this2=this;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:this.visibilityManager=new c({host:this,target:this.inputElement.input,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this2.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){var _this2$dropdownElemen;_this2.isDropdownOpen=!1,(_this2$dropdownElemen=_this2.dropdownElement)!==null&&_this2$dropdownElemen!==void 0&&_this2$dropdownElemen.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){var _this2$dropdownElemen2;_this2.isDropdownOpen=!1,(_this2$dropdownElemen2=_this2.dropdownElement)!==null&&_this2$dropdownElemen2!==void 0&&_this2$dropdownElemen2.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this2.emit("nile-".concat(t),i);}});case 3:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(m,"connectedCallback",this,3)([]),this.renderItemFunction=function(t){return t;},this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this);}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(m,"disconnectedCallback",this,3)([]),this.removeOpenListeners(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.portalManager.cleanupPortalAppend();}},{key:"updated",value:function updated(t){_superPropGet(m,"updated",this,3)([t]),t.has("allMenuItems")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.setVirtualMenuWidth(),this.portal&&this.isDropdownOpen&&this.portalManager.updatePortalOptions()),t.has("isDropdownOpen")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.handleDropdownOpenChange()),t.has("value")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.portal&&this.isDropdownOpen&&this.portalManager.updatePortalOptions()),t.has("portal")&&this.handlePortalChange();}},{key:"handlePortalChange",value:function handlePortalChange(){this.isDropdownOpen&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend());}},{key:"handleDropdownOpenChange",value:function handleDropdownOpenChange(){var _this$visibilityManag2,_this$visibilityManag3;this.isDropdownOpen?(this.addOpenListeners(),(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.portal&&this.portalManager.setupPortalAppend()):(this.removeOpenListeners(),(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),this.portal&&this.portalManager.cleanupPortalAppend());}},{key:"addOpenListeners",value:function addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0));}},{key:"removeOpenListeners",value:function removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0);}},{key:"handleDocumentFocusIn",value:function handleDocumentFocusIn(t){var _this$dropdownElement;if(!this.isDropdownOpen)return;var i=t.composedPath(),e=i.includes(this),s=this.dropdownElement&&i.includes(this.dropdownElement),n=this.portal&&this.portalManager.portalContainerElement&&i.includes(this.portalManager.portalContainerElement);e||s||n||(this.isDropdownOpen=!1,(_this$dropdownElement=this.dropdownElement)===null||_this$dropdownElement===void 0?void 0:_this$dropdownElement.hide());}},{key:"handleDocumentMouseDown",value:function handleDocumentMouseDown(t){var _this$dropdownElement2;if(!this.isDropdownOpen)return;var i=t.composedPath(),e=i.includes(this),s=this.dropdownElement&&i.includes(this.dropdownElement),n=this.portal&&this.portalManager.portalContainerElement&&i.includes(this.portalManager.portalContainerElement);e||s||n||(this.isDropdownOpen=!1,(_this$dropdownElement2=this.dropdownElement)===null||_this$dropdownElement2===void 0?void 0:_this$dropdownElement2.hide());}},{key:"render",value:function render(){var t=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-dropdown class=\"nile-dropdown--input\" ?open="," noOpenOnCLick exportparts=\"input, base\">\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n .disabled=","\n .value=","\n @nile-input=","\n @focus=","\n @click=","\n slot=\"trigger\"\n placeholder=","\n exportparts=\"input, base\"\n >\n ","\n </nile-input>\n ","\n </nile-dropdown>\n "])),this.isDropdownOpen,this.noBorder,this.noOutline,this.noPadding,this.disabled,this.value,this.handleSearch,this.handleFocus,this.handleClick,this.placeholder,this.loading?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"var(--nile-icon-button-loading-blue-animated, var(--ng-icon-button-loading-blue-animated))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>"]))):e,this.menuItems.length>0&&!this.loading?t:e);}},{key:"getVirtualizedContent",value:function getVirtualizedContent(){var _this3=this;return i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-menu class=\"virtualized__menu\" @nile-select="," id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\" style=",">\n ","\n </nile-menu>\n "])),this.handleSelect,this.portal?"display: none;":"",d({items:this.menuItems,renderItem:function renderItem(t){return _this3.getItemRenderFunction(t);},scroller:!0}));}},{key:"getContent",value:function getContent(){var _this4=this;return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-menu id=\"content-menu\" @nile-select="," exportparts=\"menu__items-wrapper:options__wrapper\" style=",">\n ","\n </nile-menu>"])),this.handleSelect,this.portal?"display: none;":"",this.menuItems.map(function(t){return _this4.getItemRenderFunction(t);}));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(t){var _this5=this;var e=this.renderItemFunction(t),s=e?e.toString():"";if(!(!!t.tooltip&&(!t.tooltip["for"]||"menu"===t.tooltip["for"])))return i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-menu-item value=",">","</nile-menu-item>\n "])),e,u(s));var n=null;var o=t.tooltip.content;return o instanceof Promise?(n="Loading...",o.then(function(i){t.tooltip.content=i,_this5.requestUpdate();})):n=o,i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-menu-item value=",">\n <nile-lite-tooltip allowHTML .content=",">\n <span class=\"menu-item-text\">","</span>\n </nile-lite-tooltip>\n </nile-menu-item>\n "])),e,n!==null&&n!==void 0?n:"",u(s));}},{key:"handleSelect",value:function handleSelect(t){var _this$dropdownElement3;this.value=t.detail.value,this.emit("nile-complete",{value:t.detail.value}),this.isDropdownOpen=!1,(_this$dropdownElement3=this.dropdownElement)===null||_this$dropdownElement3===void 0?void 0:_this$dropdownElement3.hide();}},{key:"setVirtualMenuWidth",value:function setVirtualMenuWidth(){var _this6=this;var t=this.menuItems.reduce(function(t,i){var e=_this6.renderItemFunction(i).length;return t>e?t:e;},0),i=9.5*t<110?110:9.5*t;this.style.setProperty("--virtual-scroll-container-width",i+"px");}},{key:"handleSearch",value:function handleSearch(t){var _this$dropdownElement4;this.value=t.detail.value.toLowerCase(),this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&((_this$dropdownElement4=this.dropdownElement)!==null&&_this$dropdownElement4!==void 0&&_this$dropdownElement4.show(),this.portal&&this.portalManager.updatePortalOptions());}},{key:"handleFocus",value:function handleFocus(){var _this$inputElement,_this7=this;this.openOnFocus&&(this.portal&&(_this$inputElement=this.inputElement)!==null&&_this$inputElement!==void 0&&_this$inputElement.focus(),setTimeout(function(){var _this7$dropdownElemen;_this7.isDropdownOpen=!0,(_this7$dropdownElemen=_this7.dropdownElement)===null||_this7$dropdownElemen===void 0?void 0:_this7$dropdownElemen.show();},300));}},{key:"handleClick",value:function handleClick(){var _this$dropdownElement5;this.isDropdownOpen=!0,(_this$dropdownElement5=this.dropdownElement)===null||_this$dropdownElement5===void 0?void 0:_this$dropdownElement5.show();}},{key:"applyFilter",value:function applyFilter(t,i){var _this8=this;if("object"!=_typeof(t))return[];var e=[];return t.forEach(function(t){return i(t,_this8.value)&&e.push(t);}),e;}}]);}(r));m.styles=l,t([s("nile-dropdown")],m.prototype,"dropdownElement",void 0),t([s("nile-input")],m.prototype,"inputElement",void 0),t([n({type:Boolean})],m.prototype,"disabled",void 0),t([n({type:Boolean})],m.prototype,"isDropdownOpen",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"portal",void 0),t([n({type:Boolean})],m.prototype,"enableVirtualScroll",void 0),t([n({type:Boolean})],m.prototype,"openOnFocus",void 0),t([n({type:String})],m.prototype,"value",void 0),t([n({type:String})],m.prototype,"placeholder",void 0),t([n({type:Boolean})],m.prototype,"noBorder",void 0),t([n({type:Boolean})],m.prototype,"noOutline",void 0),t([n({type:Boolean})],m.prototype,"noPadding",void 0),t([n({type:Boolean})],m.prototype,"loading",void 0),t([n({attribute:!1})],m.prototype,"filterFunction",void 0),t([n({attribute:!1})],m.prototype,"renderItemFunction",void 0),t([n({type:Array})],m.prototype,"allMenuItems",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"enableVisibilityEffect",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"enableTabClose",void 0),t([o()],m.prototype,"menuItems",void 0),t([a("portal",{waitUntilFirstUpdate:!0})],m.prototype,"handlePortalChange",null),_export("N",m=t([h("nile-auto-complete")],m));}};});
|
|
1
|
+
System.register(["tslib","lit","lit/decorators.js","./nile-auto-complete.css.cjs.js","../internal/nile-element.cjs.js","../internal/watch.cjs.js","./portal-manager.cjs.js","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js","../floating-ui.dom-007bbe96.cjs.js","./portal-utils.cjs.js","../lit-html-9b3af046.cjs.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,i,e,s,n,o,h,l,r,a,p,d,u,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,m;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);}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _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;e=_lit.nothing;},function(_litDecoratorsJs){s=_litDecoratorsJs.query;n=_litDecoratorsJs.property;o=_litDecoratorsJs.state;h=_litDecoratorsJs.customElement;},function(_nileAutoCompleteCssCjsJs){l=_nileAutoCompleteCssCjsJs.s;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_internalWatchCjsJs){a=_internalWatchCjsJs.w;},function(_portalManagerCjsJs){p=_portalManagerCjsJs.A;},function(_virtualize002CjsJs){d=_virtualize002CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){u=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;},function(_floatingUiDom001CjsJs){},function(_portalUtilsCjsJs){},function(_litHtml003CjsJs){},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("N",m=/*#__PURE__*/function(_r){function m(){var _this;_classCallCheck(this,m);_this=_callSuper(this,m,arguments),_this.disabled=!1,_this.isDropdownOpen=!1,_this.portal=!1,_this.portalManager=new p(_assertThisInitialized(_this)),_this.enableVirtualScroll=!1,_this.openOnFocus=!1,_this.value="",_this.placeholder="Type here ..",_this.noBorder=!1,_this.noOutline=!1,_this.noPadding=!1,_this.loading=!1,_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.allMenuItems=[],_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.menuItems=[],_this.handleWindowResize=function(){_this.portalManager.updatePortalAppendPosition();},_this.handleWindowScroll=function(){_this.portalManager.updatePortalAppendPosition();};return _this;}_inherits(m,_r);return _createClass(m,[{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this2=this;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:this.visibilityManager=new c({host:this,target:this.inputElement.input,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this2.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){var _this2$dropdownElemen;_this2.isDropdownOpen=!1,(_this2$dropdownElemen=_this2.dropdownElement)!==null&&_this2$dropdownElemen!==void 0&&_this2$dropdownElemen.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){var _this2$dropdownElemen2;_this2.isDropdownOpen=!1,(_this2$dropdownElemen2=_this2.dropdownElement)!==null&&_this2$dropdownElemen2!==void 0&&_this2$dropdownElemen2.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this2.emit("nile-".concat(t),i);}});case 3:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(m,"connectedCallback",this,3)([]),this.renderItemFunction=function(t){return t;},this.handleDocumentFocusIn=this.handleDocumentFocusIn.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.handleWindowScroll=this.handleWindowScroll.bind(this);}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(m,"disconnectedCallback",this,3)([]),this.removeOpenListeners(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this.portalManager.cleanupPortalAppend();}},{key:"updated",value:function updated(t){_superPropGet(m,"updated",this,3)([t]),t.has("allMenuItems")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.setVirtualMenuWidth(),this.portal&&this.isDropdownOpen&&this.portalManager.updatePortalOptions()),t.has("isDropdownOpen")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.handleDropdownOpenChange()),t.has("value")&&(this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.portal&&this.isDropdownOpen&&this.portalManager.updatePortalOptions()),t.has("portal")&&this.handlePortalChange();}},{key:"handlePortalChange",value:function handlePortalChange(){this.isDropdownOpen&&(this.portal?this.portalManager.setupPortalAppend():this.portalManager.cleanupPortalAppend());}},{key:"handleDropdownOpenChange",value:function handleDropdownOpenChange(){var _this$visibilityManag2,_this$visibilityManag3;this.isDropdownOpen?(this.addOpenListeners(),(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),this.portal&&this.portalManager.setupPortalAppend()):(this.removeOpenListeners(),(_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),this.portal&&this.portalManager.cleanupPortalAppend());}},{key:"addOpenListeners",value:function addOpenListeners(){document.addEventListener("focusin",this.handleDocumentFocusIn),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.portal&&(window.addEventListener("resize",this.handleWindowResize),window.addEventListener("scroll",this.handleWindowScroll,!0));}},{key:"removeOpenListeners",value:function removeOpenListeners(){document.removeEventListener("focusin",this.handleDocumentFocusIn),document.removeEventListener("mousedown",this.handleDocumentMouseDown),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("scroll",this.handleWindowScroll,!0);}},{key:"handleDocumentFocusIn",value:function handleDocumentFocusIn(t){var _this$dropdownElement;if(!this.isDropdownOpen)return;var i=t.composedPath(),e=i.includes(this),s=this.dropdownElement&&i.includes(this.dropdownElement),n=this.portal&&this.portalManager.portalContainerElement&&i.includes(this.portalManager.portalContainerElement);e||s||n||(this.isDropdownOpen=!1,(_this$dropdownElement=this.dropdownElement)===null||_this$dropdownElement===void 0?void 0:_this$dropdownElement.hide());}},{key:"handleDocumentMouseDown",value:function handleDocumentMouseDown(t){var _this$dropdownElement2;if(!this.isDropdownOpen)return;var i=t.composedPath(),e=i.includes(this),s=this.dropdownElement&&i.includes(this.dropdownElement),n=this.portal&&this.portalManager.portalContainerElement&&i.includes(this.portalManager.portalContainerElement);e||s||n||(this.isDropdownOpen=!1,(_this$dropdownElement2=this.dropdownElement)===null||_this$dropdownElement2===void 0?void 0:_this$dropdownElement2.hide());}},{key:"render",value:function render(){var t=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <nile-dropdown class=\"nile-dropdown--input\" ?open="," noOpenOnCLick exportparts=\"input, base\">\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n .disabled=","\n .value=","\n @nile-input=","\n @focus=","\n @click=","\n slot=\"trigger\"\n placeholder=","\n exportparts=\"input, base\"\n >\n ","\n </nile-input>\n ","\n </nile-dropdown>\n "])),this.isDropdownOpen,this.noBorder,this.noOutline,this.noPadding,this.disabled,this.value,this.handleSearch,this.handleFocus,this.handleClick,this.placeholder,this.loading?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"var(--nile-icon-button-loading-blue-animated, var(--ng-icon-button-loading-blue-animated))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>"]))):e,this.menuItems.length>0&&!this.loading?t:e);}},{key:"getVirtualizedContent",value:function getVirtualizedContent(){var _this3=this;return i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-menu class=\"virtualized__menu\" @nile-select="," id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\" style=",">\n ","\n </nile-menu>\n "])),this.handleSelect,this.portal?"display: none;":"",d({items:this.menuItems,renderItem:function renderItem(t){return _this3.getItemRenderFunction(t);},scroller:!0}));}},{key:"getContent",value:function getContent(){var _this4=this;return i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-menu id=\"content-menu\" @nile-select="," exportparts=\"menu__items-wrapper:options__wrapper\" style=",">\n ","\n </nile-menu>"])),this.handleSelect,this.portal?"display: none;":"",this.menuItems.map(function(t){return _this4.getItemRenderFunction(t);}));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(t){var _this5=this;var e=this.renderItemFunction(t);var s="";(e||"number"==typeof e)&&(s=e.toString());if(!(!!t.tooltip&&(!t.tooltip["for"]||"menu"===t.tooltip["for"])))return i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-menu-item value=",">","</nile-menu-item>\n "])),e,u(s));var n=null;var o=t.tooltip.content;return o instanceof Promise?(n="Loading...",o.then(function(i){t.tooltip.content=i,_this5.requestUpdate();})):n=o,i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-menu-item value=",">\n <nile-lite-tooltip allowHTML .content=",">\n <span class=\"menu-item-text\">","</span>\n </nile-lite-tooltip>\n </nile-menu-item>\n "])),e,n!==null&&n!==void 0?n:"",u(s));}},{key:"handleSelect",value:function handleSelect(t){var _this$dropdownElement3;this.value=t.detail.value,this.emit("nile-complete",{value:t.detail.value}),this.isDropdownOpen=!1,(_this$dropdownElement3=this.dropdownElement)===null||_this$dropdownElement3===void 0?void 0:_this$dropdownElement3.hide();}},{key:"setVirtualMenuWidth",value:function setVirtualMenuWidth(){var _this6=this;var t=this.menuItems.reduce(function(t,i){var e=_this6.renderItemFunction(i).length;return t>e?t:e;},0),i=9.5*t<110?110:9.5*t;this.style.setProperty("--virtual-scroll-container-width",i+"px");}},{key:"handleSearch",value:function handleSearch(t){var _this$dropdownElement4;this.value=t.detail.value.toLowerCase(),this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&((_this$dropdownElement4=this.dropdownElement)!==null&&_this$dropdownElement4!==void 0&&_this$dropdownElement4.show(),this.portal&&this.portalManager.updatePortalOptions());}},{key:"handleFocus",value:function handleFocus(){var _this$inputElement,_this7=this;this.openOnFocus&&(this.portal&&(_this$inputElement=this.inputElement)!==null&&_this$inputElement!==void 0&&_this$inputElement.focus(),setTimeout(function(){var _this7$dropdownElemen;_this7.isDropdownOpen=!0,(_this7$dropdownElemen=_this7.dropdownElement)===null||_this7$dropdownElemen===void 0?void 0:_this7$dropdownElemen.show();},300));}},{key:"handleClick",value:function handleClick(){var _this$dropdownElement5;this.isDropdownOpen=!0,(_this$dropdownElement5=this.dropdownElement)===null||_this$dropdownElement5===void 0?void 0:_this$dropdownElement5.show();}},{key:"applyFilter",value:function applyFilter(t,i){var _this8=this;if("object"!=_typeof(t))return[];var e=[];return t.forEach(function(t){return i(t,_this8.value)&&e.push(t);}),e;}}]);}(r));m.styles=l,t([s("nile-dropdown")],m.prototype,"dropdownElement",void 0),t([s("nile-input")],m.prototype,"inputElement",void 0),t([n({type:Boolean})],m.prototype,"disabled",void 0),t([n({type:Boolean})],m.prototype,"isDropdownOpen",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"portal",void 0),t([n({type:Boolean})],m.prototype,"enableVirtualScroll",void 0),t([n({type:Boolean})],m.prototype,"openOnFocus",void 0),t([n({type:String})],m.prototype,"value",void 0),t([n({type:String})],m.prototype,"placeholder",void 0),t([n({type:Boolean})],m.prototype,"noBorder",void 0),t([n({type:Boolean})],m.prototype,"noOutline",void 0),t([n({type:Boolean})],m.prototype,"noPadding",void 0),t([n({type:Boolean})],m.prototype,"loading",void 0),t([n({attribute:!1})],m.prototype,"filterFunction",void 0),t([n({attribute:!1})],m.prototype,"renderItemFunction",void 0),t([n({type:Array})],m.prototype,"allMenuItems",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"enableVisibilityEffect",void 0),t([n({type:Boolean,reflect:!0})],m.prototype,"enableTabClose",void 0),t([o()],m.prototype,"menuItems",void 0),t([a("portal",{waitUntilFirstUpdate:!0})],m.prototype,"handlePortalChange",null),_export("N",m=t([h("nile-auto-complete")],m));}};});
|
|
2
2
|
//# sourceMappingURL=nile-auto-complete.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-auto-complete.cjs.js","sources":["../../../src/nile-auto-complete/nile-auto-complete.ts"],"sourcesContent":["import {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-auto-complete.css';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport { NileDropdown } from '../nile-dropdown';\nimport { watch } from '../internal/watch';\nimport { AutoCompletePortalManager } from './portal-manager';\nimport { NileInput } from '../nile-input';\n\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\n\n// Define the custom element 'nile-auto-complete'\n@customElement('nile-auto-complete')\nexport class NileAutoComplete extends NileElement {\n\n static styles: CSSResultGroup = styles;\n private visibilityManager?: VisibilityManager;\n\n\n @query('nile-dropdown') dropdownElement: NileDropdown;\n\n @query('nile-input') inputElement: NileInput;\n\n // Define component properties\n\n @property({ type: Boolean }) disabled: boolean = false;\n\n @property({ type: Boolean }) isDropdownOpen: boolean = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n private readonly portalManager = new AutoCompletePortalManager(this);\n\n @property({ type: Boolean }) enableVirtualScroll: boolean = false;\n\n @property({ type: Boolean }) openOnFocus: boolean = false;\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) placeholder: string = 'Type here ..';\n\n @property({ type: Boolean }) noBorder: boolean = false;\n \n @property({ type: Boolean }) noOutline: boolean = false;\n\n @property({ type: Boolean }) noPadding: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\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 @property({ type: Array }) allMenuItems: any = [];\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n\n @state() menuItems: any = [];\n\n\n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n\n this.visibilityManager = new VisibilityManager({\n host: this,\n target: this.inputElement.input, \n enableVisibilityEffect: this.enableVisibilityEffect,\nenableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n connectedCallback() {\n super.connectedCallback();\n this.renderItemFunction=(item:any)=>item;\n this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n this.handleWindowResize = this.handleWindowResize.bind(this);\n this.handleWindowScroll = this.handleWindowScroll.bind(this);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeOpenListeners();\n this.visibilityManager?.cleanup();\n this.portalManager.cleanupPortalAppend();\n }\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('allMenuItems')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.setVirtualMenuWidth();\n if (this.portal && this.isDropdownOpen) {\n this.portalManager.updatePortalOptions();\n }\n }\n if (changedProperties.has('isDropdownOpen')) {\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.handleDropdownOpenChange();\n }\n if (changedProperties.has('value')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n if (this.portal && this.isDropdownOpen) {\n this.portalManager.updatePortalOptions();\n }\n }\n if (changedProperties.has('portal')) {\n this.handlePortalChange();\n }\n }\n\n @watch('portal', { waitUntilFirstUpdate: true })\n handlePortalChange(): void {\n if (this.isDropdownOpen) {\n if (this.portal) {\n this.portalManager.setupPortalAppend();\n } else {\n this.portalManager.cleanupPortalAppend();\n }\n }\n }\n\n private handleDropdownOpenChange(): void {\n if (this.isDropdownOpen) {\n this.addOpenListeners();\n this.visibilityManager?.setup();\n if (this.portal) {\n this.portalManager.setupPortalAppend();\n }\n } else {\n this.removeOpenListeners();\n this.visibilityManager?.cleanup();\n if (this.portal) {\n this.portalManager.cleanupPortalAppend();\n }\n }\n }\n\n private addOpenListeners(): void {\n document.addEventListener('focusin', this.handleDocumentFocusIn);\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n \n if (this.portal) {\n window.addEventListener('resize', this.handleWindowResize);\n window.addEventListener('scroll', this.handleWindowScroll, true);\n }\n }\n\n private removeOpenListeners(): void {\n document.removeEventListener('focusin', this.handleDocumentFocusIn);\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n window.removeEventListener('resize', this.handleWindowResize);\n window.removeEventListener('scroll', this.handleWindowScroll, true);\n }\n\n private handleDocumentFocusIn(event: FocusEvent) {\n if (!this.isDropdownOpen) return;\n const path = event.composedPath();\n const hitSelf = path.includes(this);\n const hitDropdown = this.dropdownElement && path.includes(this.dropdownElement);\n const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);\n\n if (!hitSelf && !hitDropdown && !hitPortalAppend) {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n if (!this.isDropdownOpen) return;\n \n const path = event.composedPath();\n const hitSelf = path.includes(this);\n const hitDropdown = this.dropdownElement && path.includes(this.dropdownElement);\n const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);\n \n if (!hitSelf && !hitDropdown && !hitPortalAppend) {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n }\n\n private handleWindowResize = (): void => {\n this.portalManager.updatePortalAppendPosition();\n };\n\n private handleWindowScroll = (): void => {\n this.portalManager.updatePortalAppendPosition();\n };\n\n public render(): TemplateResult {\n const content=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();\n return html`\n <nile-dropdown class=\"nile-dropdown--input\" ?open=${this.isDropdownOpen} noOpenOnCLick exportparts=\"input, base\">\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=${this.noBorder}\n ?no-outline=${this.noOutline}\n ?no-padding=${this.noPadding}\n .disabled=${this.disabled}\n .value=${this.value}\n @nile-input=${this.handleSearch}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n slot=\"trigger\"\n placeholder=${this.placeholder}\n exportparts=\"input, base\"\n >\n ${this.loading?html`<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"var(--nile-icon-button-loading-blue-animated, var(--ng-icon-button-loading-blue-animated))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>`:nothing}\n </nile-input>\n ${this.menuItems.length > 0 && !this.loading\n ? content\n : nothing}\n </nile-dropdown>\n `;\n } \n \n getVirtualizedContent():TemplateResult{\n return html`\n <nile-menu class=\"virtualized__menu\" @nile-select=${this.handleSelect} id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\" style=${this.portal ? 'display: none;' : ''}>\n ${virtualize({\n items: this.menuItems,\n renderItem: (item:any):TemplateResult=>this.getItemRenderFunction(item),\n\t\t\t\t\tscroller:true\n })}\n </nile-menu>\n `\n }\n\n getContent():TemplateResult{\n return html`\n <nile-menu id=\"content-menu\" @nile-select=${this.handleSelect} exportparts=\"menu__items-wrapper:options__wrapper\" style=${this.portal ? 'display: none;' : ''}>\n ${this.menuItems.map((item: any) => this.getItemRenderFunction(item))}\n </nile-menu>`\n }\n\n getItemRenderFunction(item: any): TemplateResult {\n const value = this.renderItemFunction(item);\n const strValue = value ? value.toString() : \"\";\n const hasTooltip = !!item.tooltip;\n const shouldShowTooltip =\n hasTooltip && (!item.tooltip.for || item.tooltip.for === 'menu');\n \n if (!shouldShowTooltip) {\n return html`\n <nile-menu-item value=${value}>${unsafeHTML(strValue)}</nile-menu-item>\n `;\n }\n \n let tooltipContent: string | null = null;\n \n const content = item.tooltip.content;\n if (content instanceof Promise) {\n tooltipContent = 'Loading...'; \n content.then((resolved: string) => {\n item.tooltip.content = resolved;\n this.requestUpdate(); \n });\n } else {\n tooltipContent = content;\n }\n \n return html`\n <nile-menu-item value=${value}>\n <nile-lite-tooltip allowHTML .content=${tooltipContent ?? \"\"}>\n <span class=\"menu-item-text\">${unsafeHTML(strValue)}</span>\n </nile-lite-tooltip>\n </nile-menu-item>\n `;\n }\n\n handleSelect(event: CustomEvent) {\n this.value = event.detail.value;\n this.emit('nile-complete', { value: event.detail.value });\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n\n private setVirtualMenuWidth() {\n const maxLengthOption = this.menuItems\n .reduce((acc: number, curr: any) => {\n const currLength = this.renderItemFunction(curr).length\n return acc > currLength ? acc : currLength\n }, 0)\n const defaultWith = 110;\n const pixelMultiplier = 9.5;\n const menuWidth = maxLengthOption * pixelMultiplier < defaultWith ? defaultWith : maxLengthOption * pixelMultiplier;\n this.style.setProperty(\"--virtual-scroll-container-width\", menuWidth + \"px\");\n }\n\n private handleSearch(event: CustomEvent) {\n this.value = event.detail.value.toLowerCase();\n\n // Filter menu items based on the search value\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n\n this.isDropdownOpen = this.menuItems.length > 0;\n if (this.isDropdownOpen) {\n this.dropdownElement?.show();\n if (this.portal) {\n this.portalManager.updatePortalOptions();\n }\n }\n }\n\n public handleFocus() {\n if (!this.openOnFocus) {\n return;\n }\n\n if(this.portal) {\n this.inputElement?.focus();\n }\n\n // Delay opening the dropdown to allow focus to take effect\n setTimeout(() => {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }, 300);\n }\n\n private handleClick() {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }\n\n applyFilter<T>(list: T[], filterFn: (item: T,searchValue?:string) => boolean): T[] {\n if(typeof(list)!=='object') return []\n const res:T[]=[]\n list.forEach( el=> filterFn(el,this.value) && res.push(el) )\n return res\n }\n\n}\n\nexport default NileAutoComplete;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-auto-complete': NileAutoComplete;\n }\n}\n"],"names":["NileAutoComplete","m","constructor","this","disabled","isDropdownOpen","portal","portalManager","AutoCompletePortalManager","enableVirtualScroll","openOnFocus","value","placeholder","noBorder","noOutline","noPadding","loading","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","allMenuItems","enableVisibilityEffect","enableTabClose","menuItems","handleWindowResize","updatePortalAppendPosition","handleWindowScroll","_this","_inherits","_r","_createClass","key","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","visibilityManager","VisibilityManager","host","target","inputElement","input","isOpen","onAnchorOutOfView","_this2$dropdownElemen","dropdownElement","hide","emit","visible","reason","onDocumentHidden","_this2$dropdownElemen2","event","detail","_context2","stop","firstUpdated","connectedCallback","super","handleDocumentFocusIn","bind","handleDocumentMouseDown","disconnectedCallback","removeOpenListeners","cleanup","cleanupPortalAppend","updated","changedProperties","has","applyFilter","setVirtualMenuWidth","updatePortalOptions","handleDropdownOpenChange","handlePortalChange","setupPortalAppend","addOpenListeners","setup","document","addEventListener","window","removeEventListener","_this$dropdownElement","path","composedPath","hitSelf","hitDropdown","hitPortalAppend","portalContainerElement","_this$dropdownElement2","render","content","getVirtualizedContent","getContent","html","_templateObject","_taggedTemplateLiteral","handleSearch","handleFocus","handleClick","_templateObject2","nothing","length","_this3","_templateObject3","handleSelect","virtualize","items","renderItem","getItemRenderFunction","scroller","_this4","_templateObject4","map","strValue","toString","tooltip","for","_templateObject5","unsafeHTML","tooltipContent","Promise","then","resolved","requestUpdate","_templateObject6","maxLengthOption","reduce","acc","curr","currLength","menuWidth","style","setProperty","show","focus","setTimeout","list","filterFn","_typeof","t","res","forEach","el","push","NileElement","styles","__decorate","query","prototype","property","type","Boolean","reflect","String","attribute","Array","state","watch","waitUntilFirstUpdate","customElement"],"mappings":"ooZAuBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAYwBC,KAAAA,CAAQC,QAAAA,CAAAA,CAAY,CAEpBD,CAAAA,KAAAA,CAAcE,cAAY,CAAA,CAAA,CAAA,CAMXF,KAAAA,CAAMG,MAAG,CAAA,CAAA,CAAA,CAEpCH,KAAAA,CAAAI,aAAAA,CAAgB,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,CAERL,CAAAA,CAAAA,KAAAA,CAAmBM,mBAAY,CAAA,CAAA,CAAA,CAE/BN,KAAAA,CAAWO,WAAAA,CAAAA,CAAY,CAExBP,CAAAA,KAAAA,CAAKQ,MAAW,EAEhBR,CAAAA,KAAAA,CAAWS,WAAW,CAAA,cAAA,CAErBT,KAAAA,CAAQU,QAAAA,CAAAA,CAAY,CAEpBV,CAAAA,KAAAA,CAASW,SAAY,CAAA,CAAA,CAAA,CAErBX,KAAAA,CAASY,SAAAA,CAAAA,CAAY,CAErBZ,CAAAA,KAAAA,CAAOa,SAAY,CAElBb,CAAAA,KAAAA,CAAcc,cAA8C,CAAA,SAACC,CAAYC,CAAAA,CAAAA,QAAuBD,CAAAA,CAAKE,CAAAA,WAAAA,CAAAA,CAAAA,CAAcC,QAASF,CAAAA,CAAAA,CAAcC,WAE1IjB,CAAAA,CAAAA,CAAAA,GAAAA,KAAAA,CAAAmB,kBAA0CJ,CAAAA,SAAAA,CAAAA,QAAWA,CAAAA,IAExDf,KAAAA,CAAYoB,YAAAA,CAAQ,EAEHpB,CAAAA,KAAAA,CAAsBqB,sBAAG,CAAA,CAAA,CAAA,CAEzBrB,KAAAA,CAAcsB,cAAAA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AA0J,UAAA,wBAAA,CAAA,IAAA,EAAA,CAAA,CAE/BF,EAAA,CAA3CG,CAAAA,CAAS,CAAEC,IAAAA,CAAMC,QAASC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B9J,EAAA0J,SAAA,CAAA,gBAAA,CAAA,IAAA,IAG1DF,CAAA,CAAA,CAARU,CAA4BlK,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA0J,UAAA,WAAA,CAAA,IAAA,EAAA,CAAA,CAwE7BF,EAAA,CADCW,CAAAA,CAAM,SAAU,CAAEC,oBAAAA,CAAAA,CAAsB,KASxCpK,CAAA0J,CAAAA,SAAAA,CAAA,qBAAA,IAnIU1J,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAgBwJ,EAAA,CAD5Ba,CAAAA,CAAc,uBACFrK"}
|
|
1
|
+
{"version":3,"file":"nile-auto-complete.cjs.js","sources":["../../../src/nile-auto-complete/nile-auto-complete.ts"],"sourcesContent":["import {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-auto-complete.css';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport { NileDropdown } from '../nile-dropdown';\nimport { watch } from '../internal/watch';\nimport { AutoCompletePortalManager } from './portal-manager';\nimport { NileInput } from '../nile-input';\n\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { VisibilityManager } from '../utilities/visibility-manager.js';\n\n\n// Define the custom element 'nile-auto-complete'\n@customElement('nile-auto-complete')\nexport class NileAutoComplete extends NileElement {\n\n static styles: CSSResultGroup = styles;\n private visibilityManager?: VisibilityManager;\n\n\n @query('nile-dropdown') dropdownElement: NileDropdown;\n\n @query('nile-input') inputElement: NileInput;\n\n // Define component properties\n\n @property({ type: Boolean }) disabled: boolean = false;\n\n @property({ type: Boolean }) isDropdownOpen: boolean = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n private readonly portalManager = new AutoCompletePortalManager(this);\n\n @property({ type: Boolean }) enableVirtualScroll: boolean = false;\n\n @property({ type: Boolean }) openOnFocus: boolean = false;\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) placeholder: string = 'Type here ..';\n\n @property({ type: Boolean }) noBorder: boolean = false;\n \n @property({ type: Boolean }) noOutline: boolean = false;\n\n @property({ type: Boolean }) noPadding: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\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 @property({ type: Array }) allMenuItems: any = [];\n\n @property({ type: Boolean, reflect: true }) enableVisibilityEffect = false;\n\n @property({ type: Boolean, reflect: true }) enableTabClose = false;\n\n\n @state() menuItems: any = [];\n\n\n protected async firstUpdated(_changed: PropertyValues) {\n await this.updateComplete;\n\n this.visibilityManager = new VisibilityManager({\n host: this,\n target: this.inputElement.input, \n enableVisibilityEffect: this.enableVisibilityEffect,\nenableTabClose: this.enableTabClose,\n isOpen: () => this.isDropdownOpen,\n onAnchorOutOfView: () => {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'anchor-out-of-view',\n });\n },\n onDocumentHidden: () => {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n this.emit('nile-visibility-change', {\n visible: false,\n reason: 'document-hidden',\n });\n },\n emit: (event, detail) => this.emit(`nile-${event}`, detail),\n });\n }\n connectedCallback() {\n super.connectedCallback();\n this.renderItemFunction=(item:any)=>item;\n this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n this.handleWindowResize = this.handleWindowResize.bind(this);\n this.handleWindowScroll = this.handleWindowScroll.bind(this);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeOpenListeners();\n this.visibilityManager?.cleanup();\n this.portalManager.cleanupPortalAppend();\n }\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('allMenuItems')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.setVirtualMenuWidth();\n if (this.portal && this.isDropdownOpen) {\n this.portalManager.updatePortalOptions();\n }\n }\n if (changedProperties.has('isDropdownOpen')) {\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.handleDropdownOpenChange();\n }\n if (changedProperties.has('value')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n if (this.portal && this.isDropdownOpen) {\n this.portalManager.updatePortalOptions();\n }\n }\n if (changedProperties.has('portal')) {\n this.handlePortalChange();\n }\n }\n\n @watch('portal', { waitUntilFirstUpdate: true })\n handlePortalChange(): void {\n if (this.isDropdownOpen) {\n if (this.portal) {\n this.portalManager.setupPortalAppend();\n } else {\n this.portalManager.cleanupPortalAppend();\n }\n }\n }\n\n private handleDropdownOpenChange(): void {\n if (this.isDropdownOpen) {\n this.addOpenListeners();\n this.visibilityManager?.setup();\n if (this.portal) {\n this.portalManager.setupPortalAppend();\n }\n } else {\n this.removeOpenListeners();\n this.visibilityManager?.cleanup();\n if (this.portal) {\n this.portalManager.cleanupPortalAppend();\n }\n }\n }\n\n private addOpenListeners(): void {\n document.addEventListener('focusin', this.handleDocumentFocusIn);\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n \n if (this.portal) {\n window.addEventListener('resize', this.handleWindowResize);\n window.addEventListener('scroll', this.handleWindowScroll, true);\n }\n }\n\n private removeOpenListeners(): void {\n document.removeEventListener('focusin', this.handleDocumentFocusIn);\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n window.removeEventListener('resize', this.handleWindowResize);\n window.removeEventListener('scroll', this.handleWindowScroll, true);\n }\n\n private handleDocumentFocusIn(event: FocusEvent) {\n if (!this.isDropdownOpen) return;\n const path = event.composedPath();\n const hitSelf = path.includes(this);\n const hitDropdown = this.dropdownElement && path.includes(this.dropdownElement);\n const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);\n\n if (!hitSelf && !hitDropdown && !hitPortalAppend) {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n if (!this.isDropdownOpen) return;\n \n const path = event.composedPath();\n const hitSelf = path.includes(this);\n const hitDropdown = this.dropdownElement && path.includes(this.dropdownElement);\n const hitPortalAppend = this.portal && this.portalManager.portalContainerElement && path.includes(this.portalManager.portalContainerElement);\n \n if (!hitSelf && !hitDropdown && !hitPortalAppend) {\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n }\n\n private handleWindowResize = (): void => {\n this.portalManager.updatePortalAppendPosition();\n };\n\n private handleWindowScroll = (): void => {\n this.portalManager.updatePortalAppendPosition();\n };\n\n public render(): TemplateResult {\n const content=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();\n return html`\n <nile-dropdown class=\"nile-dropdown--input\" ?open=${this.isDropdownOpen} noOpenOnCLick exportparts=\"input, base\">\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=${this.noBorder}\n ?no-outline=${this.noOutline}\n ?no-padding=${this.noPadding}\n .disabled=${this.disabled}\n .value=${this.value}\n @nile-input=${this.handleSearch}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n slot=\"trigger\"\n placeholder=${this.placeholder}\n exportparts=\"input, base\"\n >\n ${this.loading?html`<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"var(--nile-icon-button-loading-blue-animated, var(--ng-icon-button-loading-blue-animated))\" method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\" library=\"system\"></nile-icon>`:nothing}\n </nile-input>\n ${this.menuItems.length > 0 && !this.loading\n ? content\n : nothing}\n </nile-dropdown>\n `;\n } \n \n getVirtualizedContent():TemplateResult{\n return html`\n <nile-menu class=\"virtualized__menu\" @nile-select=${this.handleSelect} id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\" style=${this.portal ? 'display: none;' : ''}>\n ${virtualize({\n items: this.menuItems,\n renderItem: (item:any):TemplateResult=>this.getItemRenderFunction(item),\n\t\t\t\t\tscroller:true\n })}\n </nile-menu>\n `\n }\n\n getContent():TemplateResult{\n return html`\n <nile-menu id=\"content-menu\" @nile-select=${this.handleSelect} exportparts=\"menu__items-wrapper:options__wrapper\" style=${this.portal ? 'display: none;' : ''}>\n ${this.menuItems.map((item: any) => this.getItemRenderFunction(item))}\n </nile-menu>`\n }\n\n getItemRenderFunction(item: any): TemplateResult {\n const value = this.renderItemFunction(item);\n let strValue = \"\";\n if(value || typeof value === \"number\") {\n strValue = value.toString();\n }\n const hasTooltip = !!item.tooltip;\n const shouldShowTooltip =\n hasTooltip && (!item.tooltip.for || item.tooltip.for === 'menu');\n \n if (!shouldShowTooltip) {\n return html`\n <nile-menu-item value=${value}>${unsafeHTML(strValue)}</nile-menu-item>\n `;\n }\n \n let tooltipContent: string | null = null;\n \n const content = item.tooltip.content;\n if (content instanceof Promise) {\n tooltipContent = 'Loading...'; \n content.then((resolved: string) => {\n item.tooltip.content = resolved;\n this.requestUpdate(); \n });\n } else {\n tooltipContent = content;\n }\n \n return html`\n <nile-menu-item value=${value}>\n <nile-lite-tooltip allowHTML .content=${tooltipContent ?? \"\"}>\n <span class=\"menu-item-text\">${unsafeHTML(strValue)}</span>\n </nile-lite-tooltip>\n </nile-menu-item>\n `;\n }\n\n handleSelect(event: CustomEvent) {\n this.value = event.detail.value;\n this.emit('nile-complete', { value: event.detail.value });\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n\n private setVirtualMenuWidth() {\n const maxLengthOption = this.menuItems\n .reduce((acc: number, curr: any) => {\n const currLength = this.renderItemFunction(curr).length\n return acc > currLength ? acc : currLength\n }, 0)\n const defaultWith = 110;\n const pixelMultiplier = 9.5;\n const menuWidth = maxLengthOption * pixelMultiplier < defaultWith ? defaultWith : maxLengthOption * pixelMultiplier;\n this.style.setProperty(\"--virtual-scroll-container-width\", menuWidth + \"px\");\n }\n\n private handleSearch(event: CustomEvent) {\n this.value = event.detail.value.toLowerCase();\n\n // Filter menu items based on the search value\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n\n this.isDropdownOpen = this.menuItems.length > 0;\n if (this.isDropdownOpen) {\n this.dropdownElement?.show();\n if (this.portal) {\n this.portalManager.updatePortalOptions();\n }\n }\n }\n\n public handleFocus() {\n if (!this.openOnFocus) {\n return;\n }\n\n if(this.portal) {\n this.inputElement?.focus();\n }\n\n // Delay opening the dropdown to allow focus to take effect\n setTimeout(() => {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }, 300);\n }\n\n private handleClick() {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }\n\n applyFilter<T>(list: T[], filterFn: (item: T,searchValue?:string) => boolean): T[] {\n if(typeof(list)!=='object') return []\n const res:T[]=[]\n list.forEach( el=> filterFn(el,this.value) && res.push(el) )\n return res\n }\n\n}\n\nexport default NileAutoComplete;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-auto-complete': NileAutoComplete;\n }\n}\n"],"names":["NileAutoComplete","m","constructor","this","disabled","isDropdownOpen","portal","portalManager","AutoCompletePortalManager","enableVirtualScroll","openOnFocus","value","placeholder","noBorder","noOutline","noPadding","loading","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","allMenuItems","enableVisibilityEffect","enableTabClose","menuItems","handleWindowResize","updatePortalAppendPosition","handleWindowScroll","_this","_inherits","_r","_createClass","key","_firstUpdated","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_changed","updateComplete","visibilityManager","VisibilityManager","host","target","inputElement","input","isOpen","onAnchorOutOfView","_this2$dropdownElemen","dropdownElement","hide","emit","visible","reason","onDocumentHidden","_this2$dropdownElemen2","event","detail","_context2","stop","firstUpdated","connectedCallback","super","handleDocumentFocusIn","bind","handleDocumentMouseDown","disconnectedCallback","removeOpenListeners","cleanup","cleanupPortalAppend","updated","changedProperties","has","applyFilter","setVirtualMenuWidth","updatePortalOptions","handleDropdownOpenChange","handlePortalChange","setupPortalAppend","addOpenListeners","setup","document","addEventListener","window","removeEventListener","_this$dropdownElement","path","composedPath","hitSelf","hitDropdown","hitPortalAppend","portalContainerElement","_this$dropdownElement2","render","content","getVirtualizedContent","getContent","html","_templateObject","_taggedTemplateLiteral","handleSearch","handleFocus","handleClick","_templateObject2","nothing","length","_this3","_templateObject3","handleSelect","virtualize","items","renderItem","getItemRenderFunction","scroller","_this4","_templateObject4","map","_this5","strValue","toString","tooltip","_templateObject5","unsafeHTML","tooltipContent","Promise","then","resolved","requestUpdate","_templateObject6","maxLengthOption","reduce","acc","curr","currLength","menuWidth","style","setProperty","show","focus","setTimeout","list","filterFn","_typeof","t","res","forEach","el","push","NileElement","styles","__decorate","query","prototype","property","type","Boolean","reflect","String","attribute","Array","state","watch","waitUntilFirstUpdate","customElement"],"mappings":"ooZAuBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAYwBC,KAAAA,CAAQC,QAAAA,CAAAA,CAAY,CAEpBD,CAAAA,KAAAA,CAAcE,cAAY,CAAA,CAAA,CAAA,CAMXF,KAAAA,CAAMG,MAAG,CAAA,CAAA,CAAA,CAEpCH,KAAAA,CAAAI,aAAAA,CAAgB,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,CAERL,CAAAA,CAAAA,KAAAA,CAAmBM,mBAAY,CAAA,CAAA,CAAA,CAE/BN,KAAAA,CAAWO,WAAAA,CAAAA,CAAY,C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,CAD5Ba,CAAAA,CAAc,uBACFrK"}
|
|
@@ -24,7 +24,7 @@ import{__decorate as t}from"tslib";import{html as i,nothing as e}from"lit";impor
|
|
|
24
24
|
`}getContent(){return i`
|
|
25
25
|
<nile-menu id="content-menu" @nile-select=${this.handleSelect} exportparts="menu__items-wrapper:options__wrapper" style=${this.portal?"display: none;":""}>
|
|
26
26
|
${this.menuItems.map((t=>this.getItemRenderFunction(t)))}
|
|
27
|
-
</nile-menu>`}getItemRenderFunction(t){const e=this.renderItemFunction(t)
|
|
27
|
+
</nile-menu>`}getItemRenderFunction(t){const e=this.renderItemFunction(t);let s="";(e||"number"==typeof e)&&(s=e.toString());if(!(!!t.tooltip&&(!t.tooltip.for||"menu"===t.tooltip.for)))return i`
|
|
28
28
|
<nile-menu-item value=${e}>${m(s)}</nile-menu-item>
|
|
29
29
|
`;let n=null;const o=t.tooltip.content;return o instanceof Promise?(n="Loading...",o.then((i=>{t.tooltip.content=i,this.requestUpdate()}))):n=o,i`
|
|
30
30
|
<nile-menu-item value=${e}>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,h,o,l,n,a,r,p,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.state;e=_litDecoratorsJs.query;h=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){l=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_litDirectivesUnsafeHtmlJs){p=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_r){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.hasSlotController=new a(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.tooltips=[],_this.chipFocusIndex=null,_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.addOnBlur=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.portal=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.showTooltip=!1,_this.enableTagDelete=!1,_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.addOnBlur&&_this.acceptUserInput&&_this.inputValue&&_this.addChipFromInputValue(),_this.isDropdownOpen=!1);};return _this;}_inherits(d,_r);return _createClass(d,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(d,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this$renderRoot$quer,_this$autoComplete,_this$autoComplete2,_this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:i=this.noAutoComplete?(_this$renderRoot$quer=this.renderRoot.querySelector("nile-input"))===null||_this$renderRoot$quer===void 0?void 0:_this$renderRoot$quer.input:((_this$autoComplete=this.autoComplete)===null||_this$autoComplete===void 0||(_this$autoComplete=_this$autoComplete.inputElement)===null||_this$autoComplete===void 0?void 0:_this$autoComplete.input)||((_this$autoComplete2=this.autoComplete)===null||_this$autoComplete2===void 0?void 0:_this$autoComplete2.inputElement);this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 4:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){var _this4=this;_superPropGet(d,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this4.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(d,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this5=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var s=!!this.label||!!t,e=!!this.helpText,h=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":s,"form-control--has-help-text":e,"nile-chip--disabled":this.disabled}),s?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,s){var e=_this5.tooltips[s],h=_this5.enableTagDelete&&_this5.chipFocusIndex===s,o=t?t.toString():"",l=i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n aria-selected=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n ?disabled=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0,"nile-chip__tags--focused":h}),h?"true":"false",_this5.errorIndexes.includes(s)?"error":"normal",function(){return _this5.handleRemove(t);},"normal"!==_this5.tagVariant,_this5.disabled,p(o));return _this5.showTooltip&&e?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-lite-tooltip allowHTML .content=",">\n ","\n </nile-lite-tooltip>\n "])),e,l):l;}),this.noAutoComplete?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n @blur=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleBlur):i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .showTooltips=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n .readonly=","\n .portal=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-blur=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.showTooltip,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.readonly,this.portal,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleBlur,this.handleSelect),e?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",h?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){var _s$tooltip,_this6=this,_s$tooltip3;var i=t.detail.value,s=this.autoCompleteOptions.find(function(t){return t.name===i||t.id===i;});var e=null;if(this.showTooltip)if(s!==null&&s!==void 0&&(_s$tooltip=s.tooltip)!==null&&_s$tooltip!==void 0&&_s$tooltip.content){var _s$tooltip2=s.tooltip,_t2=_s$tooltip2.content,_i=_s$tooltip2["for"];if(!_i||"tag"===_i)if(_t2 instanceof Promise){this.tooltips=[].concat(_toConsumableArray(this.tooltips),["Loading..."]);var _i2=this.tooltips.length-1;_t2.then(function(t){_this6.tooltips[_i2]=t,_this6.requestUpdate();});}else e=_t2;}else e=(s===null||s===void 0?void 0:s.name)||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[].concat(_toConsumableArray(this.tags),[i]),(s===null||s===void 0||(_s$tooltip3=s.tooltip)===null||_s$tooltip3===void 0?void 0:_s$tooltip3.content)instanceof Promise||(this.tooltips=[].concat(_toConsumableArray(this.tooltips),[e])),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:"addChipFromInputValue",value:function addChipFromInputValue(){var _this$visibilityManag2;return this.noDuplicates&&this.tags.includes(this.inputValue)?(this.emit("nile-duplicates-blocked"),!1):(this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.inputValue="",(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.cleanup(),this.emit("nile-chip-change",{value:this.tags}),!0);}},{key:"handleInputKeydown",value:function handleInputKeydown(t){if(this.enableTagDelete&&("Backspace"===t.key||"Delete"===t.key)&&!this.inputValue&&!this.readonly&&!this.disabled){if(0===this.tags.length)return void(this.chipFocusIndex=null);if(t.preventDefault(),null===this.chipFocusIndex)return this.chipFocusIndex=this.tags.length-1,void this.requestUpdate();var _i3=this.chipFocusIndex;return this.tags[_i3],this.tags=this.tags.filter(function(t,s){return s!==_i3;}),this.tooltips=this.tooltips.filter(function(t,s){return s!==_i3;}),this.emit("nile-chip-change",{value:this.tags}),void(this.tags.length>0?this.chipFocusIndex=Math.max(0,_i3-1):this.chipFocusIndex=null);}if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault();}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){var _this$visibilityManag3;this.noAutoComplete||((_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.setup(),this.isDropdownOpen=!0);}},{key:"handleBlur",value:function handleBlur(){this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue();}},{key:"onTagsChanged",value:function onTagsChanged(){var _this7=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this7.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){var _this$visibilityManag4;this.inputValue="",this.isDropdownOpen=!1,(_this$visibilityManag4=this.visibilityManager)!==null&&_this$visibilityManag4!==void 0&&_this$visibilityManag4.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[l];}}]);}(r));t([s()],d.prototype,"tags",void 0),t([s()],d.prototype,"inputValue",void 0),t([s()],d.prototype,"isDropdownOpen",void 0),t([s()],d.prototype,"tooltips",void 0),t([s()],d.prototype,"chipFocusIndex",void 0),t([e("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([h({type:Boolean})],d.prototype,"warning",void 0),t([h({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([h({type:Boolean})],d.prototype,"error",void 0),t([h({type:Boolean})],d.prototype,"success",void 0),t([h({type:Boolean})],d.prototype,"noDuplicates",void 0),t([h()],d.prototype,"label",void 0),t([h({type:String})],d.prototype,"tagVariant",void 0),t([h({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([h({type:Boolean})],d.prototype,"addOnBlur",void 0),t([h({type:Boolean})],d.prototype,"clearable",void 0),t([h()],d.prototype,"placeholder",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([h({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([h({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"value",void 0),t([h({type:Boolean})],d.prototype,"noWrap",void 0),t([h({type:Boolean})],d.prototype,"loading",void 0),t([h({type:Array})],d.prototype,"errorIndexes",void 0),t([h({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([h({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([h({attribute:!1})],d.prototype,"filterFunction",void 0),t([h({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([h({type:Boolean})],d.prototype,"showTooltip",void 0),t([h({type:Boolean})],d.prototype,"enableTagDelete",void 0),_export("N",d=t([o("nile-chip")],d));}};});
|
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js","../utilities/visibility-manager.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,h,o,l,n,a,r,p,c,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.state;e=_litDecoratorsJs.query;h=_litDecoratorsJs.property;o=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){l=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_litDirectivesUnsafeHtmlJs){p=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_r){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.hasSlotController=new a(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.tooltips=[],_this.chipFocusIndex=null,_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.addOnBlur=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.portal=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.showTooltip=!1,_this.enableTagDelete=!1,_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.addOnBlur&&_this.acceptUserInput&&_this.inputValue&&_this.addChipFromInputValue(),_this.isDropdownOpen=!1);};return _this;}_inherits(d,_r);return _createClass(d,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(d,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"firstUpdated",value:function(){var _firstUpdated=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var _this$renderRoot$quer,_this$autoComplete,_this$autoComplete2,_this3=this;var i;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return this.updateComplete;case 2:i=this.noAutoComplete?(_this$renderRoot$quer=this.renderRoot.querySelector("nile-input"))===null||_this$renderRoot$quer===void 0?void 0:_this$renderRoot$quer.input:((_this$autoComplete=this.autoComplete)===null||_this$autoComplete===void 0||(_this$autoComplete=_this$autoComplete.inputElement)===null||_this$autoComplete===void 0?void 0:_this$autoComplete.input)||((_this$autoComplete2=this.autoComplete)===null||_this$autoComplete2===void 0?void 0:_this$autoComplete2.inputElement);this.visibilityManager=new c({host:this,target:i,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this3.isDropdownOpen;},onAnchorOutOfView:function onAnchorOutOfView(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){_this3.isDropdownOpen=!1,_this3.autoComplete&&(_this3.autoComplete.isDropdownOpen=!1),_this3.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this3.emit("nile-".concat(t),i);}});case 4:case"end":return _context2.stop();}},_callee,this);}));function firstUpdated(_x){return _firstUpdated.apply(this,arguments);}return firstUpdated;}()},{key:"connectedCallback",value:function connectedCallback(){var _this4=this;_superPropGet(d,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this4.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(d,"disconnectedCallback",this,3)([]),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this5=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var s=!!this.label||!!t,e=!!this.helpText,h=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":s,"form-control--has-help-text":e,"nile-chip--disabled":this.disabled}),s?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,s){var e=_this5.tooltips[s],h=_this5.enableTagDelete&&_this5.chipFocusIndex===s;var o="";(t||"number"==typeof t)&&(o=t.toString());var l=i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n aria-selected=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n ?disabled=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0,"nile-chip__tags--focused":h}),h?"true":"false",_this5.errorIndexes.includes(s)?"error":"normal",function(){return _this5.handleRemove(t);},"normal"!==_this5.tagVariant,_this5.disabled,p(o));return _this5.showTooltip&&e?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-lite-tooltip allowHTML .content=",">\n ","\n </nile-lite-tooltip>\n "])),e,l):l;}),this.noAutoComplete?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n @blur=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleBlur):i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .showTooltips=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n .readonly=","\n .portal=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-blur=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.showTooltip,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.readonly,this.portal,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleBlur,this.handleSelect),e?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",h?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){var _s$tooltip,_this6=this,_s$tooltip3;var i=t.detail.value,s=this.autoCompleteOptions.find(function(t){return t.name===i||t.id===i;});var e=null;if(this.showTooltip)if(s!==null&&s!==void 0&&(_s$tooltip=s.tooltip)!==null&&_s$tooltip!==void 0&&_s$tooltip.content){var _s$tooltip2=s.tooltip,_t2=_s$tooltip2.content,_i=_s$tooltip2["for"];if(!_i||"tag"===_i)if(_t2 instanceof Promise){this.tooltips=[].concat(_toConsumableArray(this.tooltips),["Loading..."]);var _i2=this.tooltips.length-1;_t2.then(function(t){_this6.tooltips[_i2]=t,_this6.requestUpdate();});}else e=_t2;}else e=(s===null||s===void 0?void 0:s.name)||i;this.noDuplicates&&this.tags.includes(i)||(this.tags=[].concat(_toConsumableArray(this.tags),[i]),(s===null||s===void 0||(_s$tooltip3=s.tooltip)===null||_s$tooltip3===void 0?void 0:_s$tooltip3.content)instanceof Promise||(this.tooltips=[].concat(_toConsumableArray(this.tooltips),[e])),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:"addChipFromInputValue",value:function addChipFromInputValue(){var _this$visibilityManag2;return this.noDuplicates&&this.tags.includes(this.inputValue)?(this.emit("nile-duplicates-blocked"),!1):(this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.inputValue="",(_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.cleanup(),this.emit("nile-chip-change",{value:this.tags}),!0);}},{key:"handleInputKeydown",value:function handleInputKeydown(t){if(this.enableTagDelete&&("Backspace"===t.key||"Delete"===t.key)&&!this.inputValue&&!this.readonly&&!this.disabled){if(0===this.tags.length)return void(this.chipFocusIndex=null);if(t.preventDefault(),null===this.chipFocusIndex)return this.chipFocusIndex=this.tags.length-1,void this.requestUpdate();var _i3=this.chipFocusIndex;return this.tags[_i3],this.tags=this.tags.filter(function(t,s){return s!==_i3;}),this.tooltips=this.tooltips.filter(function(t,s){return s!==_i3;}),this.emit("nile-chip-change",{value:this.tags}),void(this.tags.length>0?this.chipFocusIndex=Math.max(0,_i3-1):this.chipFocusIndex=null);}if(this.readonly){if(!["ArrowUp","ArrowDown","Enter","Tab"].includes(t.key))return void t.preventDefault();}this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.showTooltip?this.tooltips=[].concat(_toConsumableArray(this.tooltips),[this.inputValue]):this.tooltips=[].concat(_toConsumableArray(this.tooltips),[null]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){var _this$visibilityManag3;this.noAutoComplete||((_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.setup(),this.isDropdownOpen=!0);}},{key:"handleBlur",value:function handleBlur(){this.addOnBlur&&this.acceptUserInput&&this.inputValue&&this.addChipFromInputValue();}},{key:"onTagsChanged",value:function onTagsChanged(){var _this7=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this7.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){var _this$visibilityManag4;this.inputValue="",this.isDropdownOpen=!1,(_this$visibilityManag4=this.visibilityManager)!==null&&_this$visibilityManag4!==void 0&&_this$visibilityManag4.cleanup(),!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[l];}}]);}(r));t([s()],d.prototype,"tags",void 0),t([s()],d.prototype,"inputValue",void 0),t([s()],d.prototype,"isDropdownOpen",void 0),t([s()],d.prototype,"tooltips",void 0),t([s()],d.prototype,"chipFocusIndex",void 0),t([e("nile-auto-complete")],d.prototype,"autoComplete",void 0),t([h({type:Boolean})],d.prototype,"warning",void 0),t([h({type:Boolean})],d.prototype,"noAutoComplete",void 0),t([h({type:Boolean})],d.prototype,"error",void 0),t([h({type:Boolean})],d.prototype,"success",void 0),t([h({type:Boolean})],d.prototype,"noDuplicates",void 0),t([h()],d.prototype,"label",void 0),t([h({type:String})],d.prototype,"tagVariant",void 0),t([h({type:Boolean})],d.prototype,"acceptUserInput",void 0),t([h({type:Boolean})],d.prototype,"addOnBlur",void 0),t([h({type:Boolean})],d.prototype,"clearable",void 0),t([h()],d.prototype,"placeholder",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"readonly",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"portal",void 0),t([h({type:Boolean})],d.prototype,"enableVirtualScroll",void 0),t([h({type:Array})],d.prototype,"autoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"filteredAutoCompleteOptions",void 0),t([h({type:Array})],d.prototype,"value",void 0),t([h({type:Boolean})],d.prototype,"noWrap",void 0),t([h({type:Boolean})],d.prototype,"loading",void 0),t([h({type:Array})],d.prototype,"errorIndexes",void 0),t([h({attribute:"help-text",reflect:!0})],d.prototype,"helpText",void 0),t([h({attribute:"error-message",reflect:!0})],d.prototype,"errorMessage",void 0),t([h({attribute:!1})],d.prototype,"filterFunction",void 0),t([h({attribute:!1})],d.prototype,"renderItemFunction",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableVisibilityEffect",void 0),t([h({type:Boolean,reflect:!0})],d.prototype,"enableTabClose",void 0),t([h({type:Boolean})],d.prototype,"showTooltip",void 0),t([h({type:Boolean})],d.prototype,"enableTagDelete",void 0),_export("N",d=t([o("nile-chip")],d));}};});
|
|
2
2
|
//# sourceMappingURL=nile-chip.cjs.js.map
|