@aquera/nile-elements 1.6.8 → 1.6.9
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 +8 -0
- package/dist/index.js +7 -10
- 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-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +0 -3
- package/dist/nile-calendar/nile-calendar.esm.js +2 -2
- package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.cjs.js.map +1 -1
- package/dist/nile-dropdown/nile-dropdown.esm.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.cjs.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.cjs.js.map +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.esm.js +13 -13
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.cjs.js +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.cjs.js.map +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.esm.js +1 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.js +1 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +0 -3
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.js +2 -2
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-dropdown/nile-dropdown.d.ts +2 -0
- package/dist/src/nile-dropdown/nile-dropdown.js +21 -5
- package/dist/src/nile-dropdown/nile-dropdown.js.map +1 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.js +1 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.js.map +1 -1
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.js +1 -1
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.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 +2 -2
- package/src/nile-auto-complete/nile-auto-complete.ts +1 -1
- package/src/nile-calendar/nile-calendar.css.ts +0 -3
- package/src/nile-calendar/nile-calendar.ts +2 -2
- package/src/nile-dropdown/nile-dropdown.ts +23 -5
- package/src/nile-stepper-item/nile-stepper-item.ts +1 -1
- package/src/nile-vertical-stepper-item/nile-vertical-stepper-item.ts +1 -1
- package/vscode-html-custom-data.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,14 @@ 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.6.9 (April 6, 2026)
|
|
83
|
+
- Nile Stepper: Added parts to Stepper Item (UIF-1167)
|
|
84
|
+
- Nile Calendar: Disabled Not Working Properly (UIF-1171)
|
|
85
|
+
- Nile AutoComplete: Added reflect true to the disabled property (UIF-1172)
|
|
86
|
+
|
|
87
|
+
#### Version 1.6.4-patch-1 (April 2, 2026)
|
|
88
|
+
- Nile Dropdown: Fixed behavior where the component remained disabled after being programmatically re-enabled (UIF-1170)
|
|
89
|
+
|
|
82
90
|
#### Version 1.6.8 (April 1, 2026)
|
|
83
91
|
- Nile Nav Tab: Created New Component (UIF-1093)
|
|
84
92
|
- Nile Inline Sidebar: Added Rich Variant (UIF-1166)
|
package/dist/index.js
CHANGED
|
@@ -6547,7 +6547,7 @@ class Mn{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
6547
6547
|
max-width: var(--auto-size-available-width) !important;
|
|
6548
6548
|
max-height: var(--auto-size-available-height) !important;
|
|
6549
6549
|
}
|
|
6550
|
-
`;let En=class{static calculateAvailableSpace(e){const t=e.getBoundingClientRect(),i=window.innerHeight,M=window.innerWidth,n=i-t.bottom,o=t.top,r=M-t.right;return{spaceAbove:o,spaceBelow:n,spaceLeft:t.left,spaceRight:r,viewportHeight:i,viewportWidth:M}}static getOptimalPlacement(e){const{spaceAbove:t,spaceBelow:i,spaceLeft:M,spaceRight:n}=this.calculateAvailableSpace(e);return i>=200&&i>=t?"bottom":t>=200&&t>i?"top":n>=200&&n>=M?"right":M>=200?"left":"bottom"}static findBoundaryElements(e){const t=[];let i=e.parentElement;for(;i&&i!==document.body;){const e=window.getComputedStyle(i),M=e.overflow,n=e.overflowY,o=e.overflowX;"auto"!==M&&"scroll"!==M&&"auto"!==n&&"scroll"!==n&&"auto"!==o&&"scroll"!==o||t.push(i),(i.hasAttribute("data-floating-boundary")||i.classList.contains("floating-boundary")||i.classList.contains("scroll-container"))&&t.push(i),i=i.parentElement}return t.length>0?t:void 0}static calculateOptimalHeight(e,t,i){const M=t-(e.y+e.height),n=e.y;return i.startsWith("top")?Math.max(n-20,100):i.startsWith("bottom")?Math.max(M-20,100):(i.startsWith("left")||i.startsWith("right"),Math.max(Math.min(n,M)-20,100))}static extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}static generateStyleId(){return`nile-dropdown-styles-${Math.random().toString(36).substring(2,11)}`}static isPositioningOptimal(e,t){const{spaceAbove:i,spaceBelow:M,spaceLeft:n,spaceRight:o}=this.calculateAvailableSpace(t),r=e.startsWith("top"),a=e.startsWith("bottom"),s=e.startsWith("left"),l=e.startsWith("right");return!(r&&M>i)&&(!(a&&i>M)&&(!(s&&o>n)&&!(l&&n>o)))}static applyCollisionData(e,t,i){if(t.flip){const{overflows:M}=t.flip;if(e.setAttribute("data-placement",i),M&&M.length>0){const t=M.map((e=>e.placement)).join(",");e.setAttribute("data-overflow",t)}else e.removeAttribute("data-overflow")}if(t.shift){const{x:i,y:M}=t.shift;void 0===i||void 0===M||0===i&&0===M?e.removeAttribute("data-shift"):e.setAttribute("data-shift",`${i},${M}`)}if(t.size){const{availableWidth:i,availableHeight:M}=t.size;void 0!==i&&e.setAttribute("data-available-width",i.toString()),void 0!==M&&e.setAttribute("data-available-height",M.toString())}}},wn=class{static createPortalPanel(e){const t=e.shadowRoot?.querySelector(".dropdown__panel");if(!t){const t=e.querySelector("[slot]");if(!t||"trigger"===t.getAttribute("slot"))return document.createElement("div")}let i=t?.assignedElements({flatten:!0})||[];if(0===i.length){i=Array.from(e.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}const M=document.createElement("div");return M.className="dropdown__panel",M.setAttribute("part","panel"),M.setAttribute("aria-hidden","false"),M.setAttribute("aria-labelledby","dropdown"),i.forEach((e=>{const t=e.cloneNode(!0);this.processInlineEventHandlers(t),M.appendChild(t)})),M}static updatePortalPanel(e,t){if(!e)return;e.innerHTML="";const i=t.shadowRoot?.querySelector(".dropdown__panel");let M=i?.assignedElements({flatten:!0})||[];if(0===M.length){M=Array.from(t.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}M.forEach((t=>{const i=t.cloneNode(!0);this.processInlineEventHandlers(i),e.appendChild(i)}))}static processInlineEventHandlers(e){["onclick","onchange","oninput","onsubmit","onfocus","onblur","onkeydown","onkeyup"].forEach((t=>{e.removeAttribute(t),e.querySelectorAll(`[${t}]`).forEach((e=>{e.removeAttribute(t)}))}))}},kn=class{static setupPortalEventListeners(e,t){e&&(this.setupMenuSelectListeners(e,t),this.setupKeyDownListeners(e,t),this.setupEventForwarding(e,t))}static setupMenuSelectListeners(e,t){e&&e.addEventListener("nile-select",(e=>{const i=e;t.handlePanelSelect&&t.handlePanelSelect(i)}))}static setupKeyDownListeners(e,t){e&&e.addEventListener("keydown",(e=>{t.handleKeyDown&&t.handleKeyDown(e)}))}static setupEventForwarding(e,t){if(!e)return;const i=t.shadowRoot?.querySelector(".dropdown__panel");if(!i)return;let M=i.assignedElements({flatten:!0})||[];if(0===M.length){M=Array.from(t.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}const n=M[0];if(!n)return;const o=t=>{const i=t.closest("nile-menu-item");if(i){const M=Array.from(e.querySelectorAll("nile-menu-item")),o=Array.from(n.querySelectorAll("nile-menu-item"))[M.indexOf(i)];if(o){if(t===i)return o;const e=t.tagName.toLowerCase(),M=Array.from(i.querySelectorAll(e)),n=Array.from(o.querySelectorAll(e)),r=M.indexOf(t);return r>=0&&n[r]?n[r]:o}}return null},r=(e,t)=>{const i=e;let M;M=i instanceof MouseEvent?new MouseEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,metaKey:i.metaKey}):i instanceof KeyboardEvent?new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,key:i.key,code:i.code,keyCode:i.keyCode,which:i.which,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,metaKey:i.metaKey}):i instanceof CustomEvent?new CustomEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,detail:i.detail}):new Event(e.type,{bubbles:!0,cancelable:!0,composed:!0}),t.dispatchEvent(M)},a=(e,t)=>{if("nile-checkbox"===e.tagName.toLowerCase()&&"nile-checkbox"===t.tagName.toLowerCase()){const i=e,M=t;"checked"in M&&"checked"in i&&(i.checked=M.checked),"indeterminate"in M&&"indeterminate"in i&&(i.indeterminate=M.indeterminate)}};["click","change","input","submit","focus","blur","keydown","keyup","mousedown","mouseup"].forEach((t=>{e.addEventListener(t,(e=>{const i=e.target;if(!i)return;const M=o(i);if(M)if("click"===t)if("nile-checkbox"===i.tagName.toLowerCase()){e.stopImmediatePropagation(),e.preventDefault();const t=M;t&&"function"==typeof t.click?(t.click(),setTimeout((()=>{a(i,M)}),10)):(r(e,M),setTimeout((()=>{a(i,M)}),10))}else e.stopImmediatePropagation(),e.preventDefault(),r(e,M);else r(e,M)}),!0)}));const s=Array.from(e.querySelectorAll("nile-checkbox")),l=Array.from(n.querySelectorAll("nile-checkbox"));s.forEach(((e,t)=>{const i=l[t];i&&i.addEventListener("nile-change",(()=>{a(e,i)}))})),e.addEventListener("nile-change",(e=>{const t=e.target;if(!t)return;const i=o(t);if(i){const M=e;if("nile-checkbox"===t.tagName.toLowerCase()&&void 0!==M.detail?.checked){t.checked=M.detail.checked}const n=new CustomEvent("nile-change",{bubbles:!0,cancelable:!0,composed:!0,detail:M.detail});i.dispatchEvent(n)}}),!0)}},bn=class{constructor(e){this.portalContainer=null,this.measuredPanelHeight=null,this.clonedPanel=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom-start",this.currentMiddlewareData=null,this.boundHandleWindowResize=null,this.component=e}createPortalAppendContainer(){const e=document.createElement("div");return e.style.position="absolute",e.style.zIndex="9999",e.style.pointerEvents="none",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="auto",e.className="nile-dropdown-portal-append",e}positionPortalAppend(){this.portalContainer&&this.component.open&&(this.measurePanelHeight(),this.computeFloatingUIPosition())}measurePanelHeight(){!this.measuredPanelHeight&&this.portalContainer&&(this.portalContainer.style.position="absolute",this.portalContainer.style.visibility="hidden",this.portalContainer.style.top="0px",this.portalContainer.style.left="0px",this.portalContainer.offsetHeight,this.measuredPanelHeight=this.portalContainer.offsetHeight,this.portalContainer.style.visibility="")}async computeFloatingUIPosition(){if(!this.portalContainer)return;const e=this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component,t=this.portalContainer;try{const{x:i,y:M,placement:n,middlewareData:o}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,M,n,o)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=En.findBoundaryElements(e),M=this.getInitialPlacement(),n=this.createFloatingUIMiddleware(i);return await zM(e,t,{placement:M,strategy:"fixed",middleware:n,platform:this.createCustomPlatform()})}getInitialPlacement(){return this.component.placement||"bottom-start"}createFloatingUIMiddleware(e){const t=[uM(this.component.distance||0)];return this.component.sync&&t.push(jM({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e})),t.push(dM({fallbackPlacements:this.getFallbackPlacements(),fallbackStrategy:"bestFit",padding:10,boundary:e})),t.push(DM({padding:10,crossAxis:!0,boundary:e})),t}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:M}){const n=En.calculateOptimalHeight(M.reference,window.innerHeight,this.currentPlacement);"width"!==this.component.sync&&"both"!==this.component.sync||(i.floating.style.width=`${M.reference.width}px`),"height"!==this.component.sync&&"both"!==this.component.sync||(i.floating.style.height=`${M.reference.height}px`),i.floating.style.maxHeight=`${n}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${n}px`)}getFallbackPlacements(){const e=this.component.placement||"bottom-start",t=[];return e.startsWith("top")?t.push("bottom-start","bottom","bottom-end","top","top-end","right-start","left-start"):e.startsWith("bottom")?t.push("top-start","top","top-end","bottom","bottom-end","right-start","left-start"):e.startsWith("left")?t.push("right-start","right","right-end","left","left-end","top-start","bottom-start"):e.startsWith("right")&&t.push("left-start","left","left-end","right","right-end","top-start","bottom-start"),t}createCustomPlatform(){return NM}applyFloatingUIPosition(e,t,i,M,n,o){const r=t.getBoundingClientRect();Object.assign(e.style,{left:`${i}px`,top:`${M}px`,position:"fixed",pointerEvents:"auto",width:"auto",minWidth:"auto"}),"width"!==this.component.sync&&"both"!==this.component.sync||(e.style.width=`${r.width}px`),this.currentPlacement=n,this.currentMiddlewareData=o,En.applyCollisionData(e,o,n);const a=n.split("-")[0];e.className=`nile-dropdown-portal-append dropdown--open dropdown__panel--${a}`}fallbackPositioning(){if(!this.portalContainer)return;const e=(this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component).getBoundingClientRect(),t=window.innerHeight,i=window.innerWidth,M=t-e.bottom,n=e.top,o=i-e.right,r=e.left;let a,s,l,N=e.left;const g=this.component.placement||"bottom-start";g.startsWith("bottom")?(l=Math.max(M-20,100),a=e.bottom+(this.component.distance||0),s="bottom"):g.startsWith("top")?(l=Math.max(n-20,100),a=Math.max(e.top-l-(this.component.distance||0),10),s="top"):g.startsWith("right")?(l=Math.max(Math.min(o,M,n)-20,100),a=e.top,N=e.right+(this.component.distance||0),s="right"):(l=Math.max(Math.min(r,M,n)-20,100),a=e.top,N=Math.max(e.left-200-(this.component.distance||0),10),s="left"),this.portalContainer.style.left=`${N}px`,this.portalContainer.style.top=`${a}px`,this.portalContainer.style.maxHeight=`${l}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.style.width="auto",this.portalContainer.style.minWidth="auto","width"!==this.component.sync&&"both"!==this.component.sync||(this.portalContainer.style.width=`${e.width}px`),this.portalContainer.className=`nile-dropdown-portal-append dropdown__panel--${s}`,this.calculateAndSetAutoSizeProperties(e,a,s)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const M=window.innerHeight,n=window.innerWidth;let o,r=n-e.left-10;"top"===i?o=e.top-10:"bottom"===i?o=M-e.bottom-10:"left"===i?(o=Math.min(M-e.top,e.bottom),r=e.left-10):(o=Math.min(M-e.top,e.bottom),r=n-e.right-10),this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(o,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(r,200)}px`)}updatePortalAppendPosition(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}handleWindowResize(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}setupAutoUpdatePositioning(){if(!this.portalContainer||!this.component)return;this.cleanupAutoUpdatePositioning();const e=this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component;this.cleanupAutoUpdate=cM(e,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0})}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}injectStylesToDocument(){if(!this.portalContainer)return;const e=En.generateStyleId();if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=En.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{setTimeout((()=>{this.component.open&&(this.clonedPanel=this.createPortalPanel(),this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(this.clonedPanel),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),this.clonedPanel.style.display="",this.positionPortalAppend(),this.setupPortalEventListeners(),this.setupAutoUpdatePositioning(),this.boundHandleWindowResize=this.handleWindowResize.bind(this),window.addEventListener("resize",this.boundHandleWindowResize))}),10)}))}createPortalPanel(){return wn.createPortalPanel(this.component)}setupPortalEventListeners(){kn.setupPortalEventListeners(this.clonedPanel,this.component)}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.__injectedStyleId;if(e){const t=document.getElementById(e);t&&t.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}this.boundHandleWindowResize&&(window.removeEventListener("resize",this.boundHandleWindowResize),this.boundHandleWindowResize=null),this.portalContainer=null,this.clonedPanel=null,this.measuredPanelHeight=null,this.currentPlacement="bottom-start",this.currentMiddlewareData=null}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPanelHeight=null}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}isPositioningOptimal(){if(!this.portalContainer||!this.currentMiddlewareData)return!0;const e=(this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component).getBoundingClientRect(),t=window.innerHeight-e.bottom,i=e.top,M=this.currentPlacement.startsWith("top"),n=this.currentPlacement.startsWith("bottom");return!(M&&t>i)&&!(n&&i>t)}updatePortalPanel(){this.portalContainer&&this.clonedPanel&&(wn.updatePortalPanel(this.clonedPanel,this.component),this.setupPortalEventListeners(),this.forceReposition())}},Qn=class extends Fe{constructor(){super(...arguments),this.open=!1,this.placement="bottom-start",this.disabled=!1,this.stayOpenOnSelect=!1,this.distance=0,this.noOpenOnClick=!1,this.skidding=0,this.hoist=!1,this.portal=!1,this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.portalManager=null}connectedCallback(){super.connectedCallback(),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this),this.emit("nile-init"),requestAnimationFrame((()=>{this.portal&&!this.portalManager&&(this.portalManager=new bn(this))}))}async firstUpdated(e){this.panel.hidden=!this.open,this.open&&(this.addOpenListeners(),this.popup.active=!0),await this.updateComplete;const t=this.trigger.assignedElements({flatten:!0})[0];this.visibilityManager=new OM({host:this,target:t||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(e,t)=>this.emit(`nile-${e}`,t)})}disconnectedCallback(){super.disconnectedCallback(),this.visibilityManager?.cleanup(),this.removeOpenListeners(),this.hide(),this.emit("nile-destroy"),this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null)}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof e?.focus&&e.focus()}getMenu(){return this.panel.assignedElements({flatten:!0}).find((e=>"nile-menu"===e.tagName.toLowerCase()))}handleKeyDown(e){this.open&&"Escape"===e.key&&(e.stopPropagation(),this.hide(),this.focusOnTrigger())}handleDocumentKeyDown(e){if("Escape"===e.key&&this.open)return e.stopPropagation(),this.focusOnTrigger(),void this.hide();if("Tab"===e.key){if(this.open&&"nile-menu-item"===document.activeElement?.tagName.toLowerCase())return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{const e=this.containingElement?.getRootNode()instanceof ShadowRoot?document.activeElement?.shadowRoot?.activeElement:document.activeElement,t=this.containingElement&&e?.closest(this.containingElement.tagName.toLowerCase())===this.containingElement,i=this.portal&&this.portalManager?.portalContainerElement&&(e===this.portalManager.portalContainerElement||e?.closest(".nile-dropdown-portal-append")===this.portalManager.portalContainerElement);t||i||this.hide()}))}}handleDocumentMouseDown(e){const t=e.composedPath(),i=this.containingElement&&t.includes(this.containingElement),M=this.portal&&this.portalManager?.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||this.hide()}handlePanelSelect(e){const t=e.target;this.stayOpenOnSelect||"nile-menu"!==t.tagName.toLowerCase()?this.stayOpenOnSelect&&"nile-menu"===t.tagName.toLowerCase()&&(this.show(),this.focusOnTrigger()):(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.noOpenOnClick||(this.open?this.hide():(this.show(),this.focusOnTrigger()))}handleTriggerKeyDown(e){const t=this.getMenu();if(t){const i=t.getAllItems(),M=i[0],n=i[i.length-1];["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),this.open||this.show(),i.length>0&&this.updateComplete.then((()=>{"ArrowDown"!==e.key&&"Home"!==e.key||(t.setCurrentItem(M),M.focus()),"ArrowUp"!==e.key&&"End"!==e.key||(t.setCurrentItem(n),n.focus())})))}}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:!0}).find((e=>$t(e).start));let t;if(e){switch(e.tagName.toLowerCase()){case"nile-button":case"nile-icon-button":t=e.button;break;default:t=e}t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded",this.open?"true":"false")}}async show(){if(!this.open)return this.open=!0,Ht(this,"nile-after-show")}async hide(){if(this.open)return this.open=!1,Ht(this,"nile-after-hide")}reposition(){this.popup.reposition()}addOpenListeners(){this.panel.addEventListener("nile-select",this.handlePanelSelect),this.panel.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){this.panel&&(this.panel.removeEventListener("nile-select",this.handlePanelSelect),this.panel.removeEventListener("keydown",this.handleKeyDown)),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}updated(e){super.updated(e),e.has("portal")&&(this.portal&&!this.portalManager?(this.portalManager=new bn(this),this.open&&this.portalManager.setupPortalAppend()):!this.portal&&this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null)),e.has("disabled")&&this.updateTriggerDisabledState()}updateTriggerDisabledState(){const e=this.querySelector('[slot="trigger"]');if(!e)return;const t=e.hasAttribute("disabled");(this.disabled||t)&&(e.disabled=!0,this.disabled=!0)}async handleOpenChange(){if(this.visibilityManager?.setup(),this.disabled)this.open=!1;else if(this.updateAccessibleTrigger(),this.open){if(this.emit("nile-show"),this.addOpenListeners(),this.portal&&this.portalManager?this.portalManager.setupPortalAppend():this.portal&&!this.portalManager&&(this.portalManager=new bn(this),this.portalManager.setupPortalAppend()),await ft(this),!this.portal){this.panel.hidden=!1,this.popup.active=!0;const{keyframes:e,options:t}=Pt(this,"dropdown.show",{dir:""});await Qt(this.popup.popup,e,t)}this.emit("nile-after-show")}else{if(this.emit("nile-hide"),this.removeOpenListeners(),this.visibilityManager?.cleanup(),this.portal&&this.portalManager&&this.portalManager.cleanupPortalAppend(),await ft(this),!this.portal){const{keyframes:e,options:t}=Pt(this,"dropdown.hide",{dir:""});await Qt(this.popup.popup,e,t),this.panel.hidden=!0,this.popup.active=!1}this.emit("nile-after-hide")}}render(){return R`
|
|
6550
|
+
`;let En=class{static calculateAvailableSpace(e){const t=e.getBoundingClientRect(),i=window.innerHeight,M=window.innerWidth,n=i-t.bottom,o=t.top,r=M-t.right;return{spaceAbove:o,spaceBelow:n,spaceLeft:t.left,spaceRight:r,viewportHeight:i,viewportWidth:M}}static getOptimalPlacement(e){const{spaceAbove:t,spaceBelow:i,spaceLeft:M,spaceRight:n}=this.calculateAvailableSpace(e);return i>=200&&i>=t?"bottom":t>=200&&t>i?"top":n>=200&&n>=M?"right":M>=200?"left":"bottom"}static findBoundaryElements(e){const t=[];let i=e.parentElement;for(;i&&i!==document.body;){const e=window.getComputedStyle(i),M=e.overflow,n=e.overflowY,o=e.overflowX;"auto"!==M&&"scroll"!==M&&"auto"!==n&&"scroll"!==n&&"auto"!==o&&"scroll"!==o||t.push(i),(i.hasAttribute("data-floating-boundary")||i.classList.contains("floating-boundary")||i.classList.contains("scroll-container"))&&t.push(i),i=i.parentElement}return t.length>0?t:void 0}static calculateOptimalHeight(e,t,i){const M=t-(e.y+e.height),n=e.y;return i.startsWith("top")?Math.max(n-20,100):i.startsWith("bottom")?Math.max(M-20,100):(i.startsWith("left")||i.startsWith("right"),Math.max(Math.min(n,M)-20,100))}static extractStylesAsCSS(e){return"string"==typeof e?e:Array.isArray(e)?e.map((e=>this.extractStylesAsCSS(e))).join("\n"):e&&"object"==typeof e&&e.cssText?e.cssText:""}static generateStyleId(){return`nile-dropdown-styles-${Math.random().toString(36).substring(2,11)}`}static isPositioningOptimal(e,t){const{spaceAbove:i,spaceBelow:M,spaceLeft:n,spaceRight:o}=this.calculateAvailableSpace(t),r=e.startsWith("top"),a=e.startsWith("bottom"),s=e.startsWith("left"),l=e.startsWith("right");return!(r&&M>i)&&(!(a&&i>M)&&(!(s&&o>n)&&!(l&&n>o)))}static applyCollisionData(e,t,i){if(t.flip){const{overflows:M}=t.flip;if(e.setAttribute("data-placement",i),M&&M.length>0){const t=M.map((e=>e.placement)).join(",");e.setAttribute("data-overflow",t)}else e.removeAttribute("data-overflow")}if(t.shift){const{x:i,y:M}=t.shift;void 0===i||void 0===M||0===i&&0===M?e.removeAttribute("data-shift"):e.setAttribute("data-shift",`${i},${M}`)}if(t.size){const{availableWidth:i,availableHeight:M}=t.size;void 0!==i&&e.setAttribute("data-available-width",i.toString()),void 0!==M&&e.setAttribute("data-available-height",M.toString())}}},wn=class{static createPortalPanel(e){const t=e.shadowRoot?.querySelector(".dropdown__panel");if(!t){const t=e.querySelector("[slot]");if(!t||"trigger"===t.getAttribute("slot"))return document.createElement("div")}let i=t?.assignedElements({flatten:!0})||[];if(0===i.length){i=Array.from(e.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}const M=document.createElement("div");return M.className="dropdown__panel",M.setAttribute("part","panel"),M.setAttribute("aria-hidden","false"),M.setAttribute("aria-labelledby","dropdown"),i.forEach((e=>{const t=e.cloneNode(!0);this.processInlineEventHandlers(t),M.appendChild(t)})),M}static updatePortalPanel(e,t){if(!e)return;e.innerHTML="";const i=t.shadowRoot?.querySelector(".dropdown__panel");let M=i?.assignedElements({flatten:!0})||[];if(0===M.length){M=Array.from(t.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}M.forEach((t=>{const i=t.cloneNode(!0);this.processInlineEventHandlers(i),e.appendChild(i)}))}static processInlineEventHandlers(e){["onclick","onchange","oninput","onsubmit","onfocus","onblur","onkeydown","onkeyup"].forEach((t=>{e.removeAttribute(t),e.querySelectorAll(`[${t}]`).forEach((e=>{e.removeAttribute(t)}))}))}},kn=class{static setupPortalEventListeners(e,t){e&&(this.setupMenuSelectListeners(e,t),this.setupKeyDownListeners(e,t),this.setupEventForwarding(e,t))}static setupMenuSelectListeners(e,t){e&&e.addEventListener("nile-select",(e=>{const i=e;t.handlePanelSelect&&t.handlePanelSelect(i)}))}static setupKeyDownListeners(e,t){e&&e.addEventListener("keydown",(e=>{t.handleKeyDown&&t.handleKeyDown(e)}))}static setupEventForwarding(e,t){if(!e)return;const i=t.shadowRoot?.querySelector(".dropdown__panel");if(!i)return;let M=i.assignedElements({flatten:!0})||[];if(0===M.length){M=Array.from(t.children).filter((e=>{const t=e.getAttribute("slot");return!t||"trigger"!==t}))}const n=M[0];if(!n)return;const o=t=>{const i=t.closest("nile-menu-item");if(i){const M=Array.from(e.querySelectorAll("nile-menu-item")),o=Array.from(n.querySelectorAll("nile-menu-item"))[M.indexOf(i)];if(o){if(t===i)return o;const e=t.tagName.toLowerCase(),M=Array.from(i.querySelectorAll(e)),n=Array.from(o.querySelectorAll(e)),r=M.indexOf(t);return r>=0&&n[r]?n[r]:o}}return null},r=(e,t)=>{const i=e;let M;M=i instanceof MouseEvent?new MouseEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,metaKey:i.metaKey}):i instanceof KeyboardEvent?new KeyboardEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,key:i.key,code:i.code,keyCode:i.keyCode,which:i.which,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,altKey:i.altKey,metaKey:i.metaKey}):i instanceof CustomEvent?new CustomEvent(e.type,{bubbles:!0,cancelable:!0,composed:!0,detail:i.detail}):new Event(e.type,{bubbles:!0,cancelable:!0,composed:!0}),t.dispatchEvent(M)},a=(e,t)=>{if("nile-checkbox"===e.tagName.toLowerCase()&&"nile-checkbox"===t.tagName.toLowerCase()){const i=e,M=t;"checked"in M&&"checked"in i&&(i.checked=M.checked),"indeterminate"in M&&"indeterminate"in i&&(i.indeterminate=M.indeterminate)}};["click","change","input","submit","focus","blur","keydown","keyup","mousedown","mouseup"].forEach((t=>{e.addEventListener(t,(e=>{const i=e.target;if(!i)return;const M=o(i);if(M)if("click"===t)if("nile-checkbox"===i.tagName.toLowerCase()){e.stopImmediatePropagation(),e.preventDefault();const t=M;t&&"function"==typeof t.click?(t.click(),setTimeout((()=>{a(i,M)}),10)):(r(e,M),setTimeout((()=>{a(i,M)}),10))}else e.stopImmediatePropagation(),e.preventDefault(),r(e,M);else r(e,M)}),!0)}));const s=Array.from(e.querySelectorAll("nile-checkbox")),l=Array.from(n.querySelectorAll("nile-checkbox"));s.forEach(((e,t)=>{const i=l[t];i&&i.addEventListener("nile-change",(()=>{a(e,i)}))})),e.addEventListener("nile-change",(e=>{const t=e.target;if(!t)return;const i=o(t);if(i){const M=e;if("nile-checkbox"===t.tagName.toLowerCase()&&void 0!==M.detail?.checked){t.checked=M.detail.checked}const n=new CustomEvent("nile-change",{bubbles:!0,cancelable:!0,composed:!0,detail:M.detail});i.dispatchEvent(n)}}),!0)}},bn=class{constructor(e){this.portalContainer=null,this.measuredPanelHeight=null,this.clonedPanel=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom-start",this.currentMiddlewareData=null,this.boundHandleWindowResize=null,this.component=e}createPortalAppendContainer(){const e=document.createElement("div");return e.style.position="absolute",e.style.zIndex="9999",e.style.pointerEvents="none",e.style.width="auto",e.style.maxWidth="none",e.style.minWidth="auto",e.className="nile-dropdown-portal-append",e}positionPortalAppend(){this.portalContainer&&this.component.open&&(this.measurePanelHeight(),this.computeFloatingUIPosition())}measurePanelHeight(){!this.measuredPanelHeight&&this.portalContainer&&(this.portalContainer.style.position="absolute",this.portalContainer.style.visibility="hidden",this.portalContainer.style.top="0px",this.portalContainer.style.left="0px",this.portalContainer.offsetHeight,this.measuredPanelHeight=this.portalContainer.offsetHeight,this.portalContainer.style.visibility="")}async computeFloatingUIPosition(){if(!this.portalContainer)return;const e=this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component,t=this.portalContainer;try{const{x:i,y:M,placement:n,middlewareData:o}=await this.calculateFloatingUIPosition(e,t);this.applyFloatingUIPosition(t,e,i,M,n,o)}catch(e){console.warn("Floating UI positioning failed, falling back to simple positioning:",e),this.fallbackPositioning()}}async calculateFloatingUIPosition(e,t){const i=En.findBoundaryElements(e),M=this.getInitialPlacement(),n=this.createFloatingUIMiddleware(i);return await zM(e,t,{placement:M,strategy:"fixed",middleware:n,platform:this.createCustomPlatform()})}getInitialPlacement(){return this.component.placement||"bottom-start"}createFloatingUIMiddleware(e){const t=[uM(this.component.distance||0)];return this.component.sync&&t.push(jM({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:e})),t.push(dM({fallbackPlacements:this.getFallbackPlacements(),fallbackStrategy:"bestFit",padding:10,boundary:e})),t.push(DM({padding:10,crossAxis:!0,boundary:e})),t}handleSizeMiddleware({availableWidth:e,availableHeight:t,elements:i,rects:M}){const n=En.calculateOptimalHeight(M.reference,window.innerHeight,this.currentPlacement);"width"!==this.component.sync&&"both"!==this.component.sync||(i.floating.style.width=`${M.reference.width}px`),"height"!==this.component.sync&&"both"!==this.component.sync||(i.floating.style.height=`${M.reference.height}px`),i.floating.style.maxHeight=`${n}px`,i.floating.style.setProperty("--auto-size-available-width",`${e}px`),i.floating.style.setProperty("--auto-size-available-height",`${n}px`)}getFallbackPlacements(){const e=this.component.placement||"bottom-start",t=[];return e.startsWith("top")?t.push("bottom-start","bottom","bottom-end","top","top-end","right-start","left-start"):e.startsWith("bottom")?t.push("top-start","top","top-end","bottom","bottom-end","right-start","left-start"):e.startsWith("left")?t.push("right-start","right","right-end","left","left-end","top-start","bottom-start"):e.startsWith("right")&&t.push("left-start","left","left-end","right","right-end","top-start","bottom-start"),t}createCustomPlatform(){return NM}applyFloatingUIPosition(e,t,i,M,n,o){const r=t.getBoundingClientRect();Object.assign(e.style,{left:`${i}px`,top:`${M}px`,position:"fixed",pointerEvents:"auto",width:"auto",minWidth:"auto"}),"width"!==this.component.sync&&"both"!==this.component.sync||(e.style.width=`${r.width}px`),this.currentPlacement=n,this.currentMiddlewareData=o,En.applyCollisionData(e,o,n);const a=n.split("-")[0];e.className=`nile-dropdown-portal-append dropdown--open dropdown__panel--${a}`}fallbackPositioning(){if(!this.portalContainer)return;const e=(this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component).getBoundingClientRect(),t=window.innerHeight,i=window.innerWidth,M=t-e.bottom,n=e.top,o=i-e.right,r=e.left;let a,s,l,N=e.left;const g=this.component.placement||"bottom-start";g.startsWith("bottom")?(l=Math.max(M-20,100),a=e.bottom+(this.component.distance||0),s="bottom"):g.startsWith("top")?(l=Math.max(n-20,100),a=Math.max(e.top-l-(this.component.distance||0),10),s="top"):g.startsWith("right")?(l=Math.max(Math.min(o,M,n)-20,100),a=e.top,N=e.right+(this.component.distance||0),s="right"):(l=Math.max(Math.min(r,M,n)-20,100),a=e.top,N=Math.max(e.left-200-(this.component.distance||0),10),s="left"),this.portalContainer.style.left=`${N}px`,this.portalContainer.style.top=`${a}px`,this.portalContainer.style.maxHeight=`${l}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.style.width="auto",this.portalContainer.style.minWidth="auto","width"!==this.component.sync&&"both"!==this.component.sync||(this.portalContainer.style.width=`${e.width}px`),this.portalContainer.className=`nile-dropdown-portal-append dropdown__panel--${s}`,this.calculateAndSetAutoSizeProperties(e,a,s)}calculateAndSetAutoSizeProperties(e,t,i){if(!this.portalContainer)return;const M=window.innerHeight,n=window.innerWidth;let o,r=n-e.left-10;"top"===i?o=e.top-10:"bottom"===i?o=M-e.bottom-10:"left"===i?(o=Math.min(M-e.top,e.bottom),r=e.left-10):(o=Math.min(M-e.top,e.bottom),r=n-e.right-10),this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(o,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(r,200)}px`)}updatePortalAppendPosition(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}handleWindowResize(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}setupAutoUpdatePositioning(){if(!this.portalContainer||!this.component)return;this.cleanupAutoUpdatePositioning();const e=this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component;this.cleanupAutoUpdate=cM(e,this.portalContainer,(()=>{this.computeFloatingUIPosition()}),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0})}cleanupAutoUpdatePositioning(){this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null)}injectStylesToDocument(){if(!this.portalContainer)return;const e=En.generateStyleId();if(document.getElementById(e))return;const t=this.component.constructor.styles;if(!t)return;const i=document.createElement("style");i.id=e,i.textContent=En.extractStylesAsCSS(t),document.head.appendChild(i),this.portalContainer.__injectedStyleId=e}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{setTimeout((()=>{this.component.open&&(this.clonedPanel=this.createPortalPanel(),this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(this.clonedPanel),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),this.clonedPanel.style.display="",this.positionPortalAppend(),this.setupPortalEventListeners(),this.setupAutoUpdatePositioning(),this.boundHandleWindowResize=this.handleWindowResize.bind(this),window.addEventListener("resize",this.boundHandleWindowResize))}),10)}))}createPortalPanel(){return wn.createPortalPanel(this.component)}setupPortalEventListeners(){kn.setupPortalEventListeners(this.clonedPanel,this.component)}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const e=this.portalContainer.__injectedStyleId;if(e){const t=document.getElementById(e);t&&t.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}this.boundHandleWindowResize&&(window.removeEventListener("resize",this.boundHandleWindowResize),this.boundHandleWindowResize=null),this.portalContainer=null,this.clonedPanel=null,this.measuredPanelHeight=null,this.currentPlacement="bottom-start",this.currentMiddlewareData=null}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredPanelHeight=null}forceReposition(){this.portalContainer&&this.computeFloatingUIPosition()}getCurrentPlacement(){return this.currentPlacement}getCurrentMiddlewareData(){return this.currentMiddlewareData}isUsingFloatingUI(){return null!==this.cleanupAutoUpdate}isPositioningOptimal(){if(!this.portalContainer||!this.currentMiddlewareData)return!0;const e=(this.component.shadowRoot?.querySelector('[slot="anchor"]')?.assignedElements({flatten:!0})[0]||this.component.querySelector('[slot="trigger"]')?.assignedElements({flatten:!0})[0]||this.component).getBoundingClientRect(),t=window.innerHeight-e.bottom,i=e.top,M=this.currentPlacement.startsWith("top"),n=this.currentPlacement.startsWith("bottom");return!(M&&t>i)&&!(n&&i>t)}updatePortalPanel(){this.portalContainer&&this.clonedPanel&&(wn.updatePortalPanel(this.clonedPanel,this.component),this.setupPortalEventListeners(),this.forceReposition())}},Qn=class extends Fe{constructor(){super(...arguments),this.open=!1,this.placement="bottom-start",this.disabled=!1,this.stayOpenOnSelect=!1,this.distance=0,this.noOpenOnClick=!1,this.skidding=0,this.hoist=!1,this.portal=!1,this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.portalManager=null,this._triggerDisabledByDropdown=!1}connectedCallback(){super.connectedCallback(),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.containingElement||(this.containingElement=this),this.emit("nile-init"),requestAnimationFrame((()=>{this.portal&&!this.portalManager&&(this.portalManager=new bn(this))}))}async firstUpdated(e){this.panel.hidden=!this.open,this.open&&(this.addOpenListeners(),this.popup.active=!0),await this.updateComplete;const t=this.trigger.assignedElements({flatten:!0})[0];this.visibilityManager=new OM({host:this,target:t||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(e,t)=>this.emit(`nile-${e}`,t)})}disconnectedCallback(){super.disconnectedCallback(),this.visibilityManager?.cleanup(),this.removeOpenListeners(),this.hide(),this.emit("nile-destroy"),this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null)}focusOnTrigger(){const e=this.trigger.assignedElements({flatten:!0})[0];"function"==typeof e?.focus&&e.focus()}getMenu(){return this.panel.assignedElements({flatten:!0}).find((e=>"nile-menu"===e.tagName.toLowerCase()))}handleKeyDown(e){this.open&&"Escape"===e.key&&(e.stopPropagation(),this.hide(),this.focusOnTrigger())}handleDocumentKeyDown(e){if("Escape"===e.key&&this.open)return e.stopPropagation(),this.focusOnTrigger(),void this.hide();if("Tab"===e.key){if(this.open&&"nile-menu-item"===document.activeElement?.tagName.toLowerCase())return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{const e=this.containingElement?.getRootNode()instanceof ShadowRoot?document.activeElement?.shadowRoot?.activeElement:document.activeElement,t=this.containingElement&&e?.closest(this.containingElement.tagName.toLowerCase())===this.containingElement,i=this.portal&&this.portalManager?.portalContainerElement&&(e===this.portalManager.portalContainerElement||e?.closest(".nile-dropdown-portal-append")===this.portalManager.portalContainerElement);t||i||this.hide()}))}}handleDocumentMouseDown(e){const t=e.composedPath(),i=this.containingElement&&t.includes(this.containingElement),M=this.portal&&this.portalManager?.portalContainerElement&&t.includes(this.portalManager.portalContainerElement);i||M||this.hide()}handlePanelSelect(e){const t=e.target;this.stayOpenOnSelect||"nile-menu"!==t.tagName.toLowerCase()?this.stayOpenOnSelect&&"nile-menu"===t.tagName.toLowerCase()&&(this.show(),this.focusOnTrigger()):(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.noOpenOnClick||this.disabled||this.isTriggerDisabled()||(this.open?this.hide():(this.show(),this.focusOnTrigger()))}handleTriggerKeyDown(e){const t=this.getMenu();if(t){const i=t.getAllItems(),M=i[0],n=i[i.length-1];["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),this.open||this.show(),i.length>0&&this.updateComplete.then((()=>{"ArrowDown"!==e.key&&"Home"!==e.key||(t.setCurrentItem(M),M.focus()),"ArrowUp"!==e.key&&"End"!==e.key||(t.setCurrentItem(n),n.focus())})))}}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}isTriggerDisabled(){const e=this.querySelector('[slot="trigger"]');return e?.hasAttribute?.("disabled")}updateAccessibleTrigger(){const e=this.trigger.assignedElements({flatten:!0}).find((e=>$t(e).start));let t;if(e){switch(e.tagName.toLowerCase()){case"nile-button":case"nile-icon-button":t=e.button;break;default:t=e}t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded",this.open?"true":"false")}}async show(){if(!(this.open||this.disabled||this.isTriggerDisabled()))return this.open=!0,Ht(this,"nile-after-show")}async hide(){if(this.open)return this.open=!1,Ht(this,"nile-after-hide")}reposition(){this.popup.reposition()}addOpenListeners(){this.panel.addEventListener("nile-select",this.handlePanelSelect),this.panel.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}removeOpenListeners(){this.panel&&(this.panel.removeEventListener("nile-select",this.handlePanelSelect),this.panel.removeEventListener("keydown",this.handleKeyDown)),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}updated(e){super.updated(e),e.has("portal")&&(this.portal&&!this.portalManager?(this.portalManager=new bn(this),this.open&&this.portalManager.setupPortalAppend()):!this.portal&&this.portalManager&&(this.portalManager.cleanupPortalAppend(),this.portalManager=null)),e.has("disabled")&&(this.disabled&&this.open&&this.hide(),this.updateTriggerDisabledState())}updateTriggerDisabledState(){const e=this.querySelector('[slot="trigger"]');e&&(this.disabled?(e.disabled||(this._triggerDisabledByDropdown=!0),e.disabled=!0):this._triggerDisabledByDropdown&&(e.disabled=!1,this._triggerDisabledByDropdown=!1))}async handleOpenChange(){if(this.visibilityManager?.setup(),this.open&&(this.disabled||this.isTriggerDisabled()))this.open=!1;else if(this.updateAccessibleTrigger(),this.open){if(this.emit("nile-show"),this.addOpenListeners(),this.portal&&this.portalManager?this.portalManager.setupPortalAppend():this.portal&&!this.portalManager&&(this.portalManager=new bn(this),this.portalManager.setupPortalAppend()),await ft(this),!this.portal){this.panel.hidden=!1,this.popup.active=!0;const{keyframes:e,options:t}=Pt(this,"dropdown.show",{dir:""});await Qt(this.popup.popup,e,t)}this.emit("nile-after-show")}else{if(this.emit("nile-hide"),this.removeOpenListeners(),this.visibilityManager?.cleanup(),this.portal&&this.portalManager&&this.portalManager.cleanupPortalAppend(),await ft(this),!this.portal){const{keyframes:e,options:t}=Pt(this,"dropdown.hide",{dir:""});await Qt(this.popup.popup,e,t),this.panel.hidden=!0,this.popup.active=!1}this.emit("nile-after-hide")}}render(){return R`
|
|
6551
6551
|
<nile-popup
|
|
6552
6552
|
part="base"
|
|
6553
6553
|
id="dropdown"
|
|
@@ -6671,7 +6671,7 @@ class Mn{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
6671
6671
|
<span class="menu-item-text">${me(i)}</span>
|
|
6672
6672
|
</nile-lite-tooltip>
|
|
6673
6673
|
</nile-menu-item>
|
|
6674
|
-
`}handleSelect(e){this.value=e.detail.value,this.emit("nile-complete",{value:e.detail.value}),this.noDropdownClose?(this.isDropdownOpen=!0,this.dropdownElement?.show()):(this.isDropdownOpen=!1,this.dropdownElement?.hide())}setVirtualMenuWidth(){const e=this.menuItems.reduce(((e,t)=>{const i=this.renderItemFunction(t).length;return e>i?e:i}),0),t=9.5*e<110?110:9.5*e;this.style.setProperty("--virtual-scroll-container-width",t+"px")}handleSearch(e){this.value=e.detail.value,this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&(this.dropdownElement?.show(),this.portal&&this.portalManager.updatePortalOptions())}handleFocus(){this.openOnFocus&&(this.portal&&this.inputElement?.focus(),setTimeout((()=>{this.isDropdownOpen=!0,this.dropdownElement?.show()}),300))}handleClick(){this.isDropdownOpen=!0,this.dropdownElement?.show()}applyFilter(e,t){if("object"!=typeof e)return[];const i=[];return e.forEach((e=>t(e,this.value)&&i.push(e))),i}};Zn.styles=vn,e([je("nile-dropdown")],Zn.prototype,"dropdownElement",void 0),e([je("nile-input")],Zn.prototype,"inputElement",void 0),e([ue({type:Boolean})],Zn.prototype,"disabled",void 0),e([ue({type:Boolean})],Zn.prototype,"isDropdownOpen",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"portal",void 0),e([ue({type:Boolean})],Zn.prototype,"enableVirtualScroll",void 0),e([ue({type:Boolean})],Zn.prototype,"openOnFocus",void 0),e([ue({type:String})],Zn.prototype,"value",void 0),e([ue({type:String})],Zn.prototype,"placeholder",void 0),e([ue({type:Boolean})],Zn.prototype,"noBorder",void 0),e([ue({type:Boolean})],Zn.prototype,"noOutline",void 0),e([ue({type:Boolean})],Zn.prototype,"noPadding",void 0),e([ue({type:Boolean})],Zn.prototype,"loading",void 0),e([ue({attribute:!1})],Zn.prototype,"filterFunction",void 0),e([ue({attribute:!1})],Zn.prototype,"renderItemFunction",void 0),e([ue({type:Array})],Zn.prototype,"allMenuItems",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"enableVisibilityEffect",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"enableTabClose",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],Zn.prototype,"noDropdownClose",void 0),e([ue({type:String})],Zn.prototype,"label",void 0),e([De()],Zn.prototype,"menuItems",void 0),e([Pe("portal",{waitUntilFirstUpdate:!0})],Zn.prototype,"handlePortalChange",null),Zn=e([Ne("nile-auto-complete")],Zn);const Vn=r`
|
|
6674
|
+
`}handleSelect(e){this.value=e.detail.value,this.emit("nile-complete",{value:e.detail.value}),this.noDropdownClose?(this.isDropdownOpen=!0,this.dropdownElement?.show()):(this.isDropdownOpen=!1,this.dropdownElement?.hide())}setVirtualMenuWidth(){const e=this.menuItems.reduce(((e,t)=>{const i=this.renderItemFunction(t).length;return e>i?e:i}),0),t=9.5*e<110?110:9.5*e;this.style.setProperty("--virtual-scroll-container-width",t+"px")}handleSearch(e){this.value=e.detail.value,this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&(this.dropdownElement?.show(),this.portal&&this.portalManager.updatePortalOptions())}handleFocus(){this.openOnFocus&&(this.portal&&this.inputElement?.focus(),setTimeout((()=>{this.isDropdownOpen=!0,this.dropdownElement?.show()}),300))}handleClick(){this.isDropdownOpen=!0,this.dropdownElement?.show()}applyFilter(e,t){if("object"!=typeof e)return[];const i=[];return e.forEach((e=>t(e,this.value)&&i.push(e))),i}};Zn.styles=vn,e([je("nile-dropdown")],Zn.prototype,"dropdownElement",void 0),e([je("nile-input")],Zn.prototype,"inputElement",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"disabled",void 0),e([ue({type:Boolean})],Zn.prototype,"isDropdownOpen",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"portal",void 0),e([ue({type:Boolean})],Zn.prototype,"enableVirtualScroll",void 0),e([ue({type:Boolean})],Zn.prototype,"openOnFocus",void 0),e([ue({type:String})],Zn.prototype,"value",void 0),e([ue({type:String})],Zn.prototype,"placeholder",void 0),e([ue({type:Boolean})],Zn.prototype,"noBorder",void 0),e([ue({type:Boolean})],Zn.prototype,"noOutline",void 0),e([ue({type:Boolean})],Zn.prototype,"noPadding",void 0),e([ue({type:Boolean})],Zn.prototype,"loading",void 0),e([ue({attribute:!1})],Zn.prototype,"filterFunction",void 0),e([ue({attribute:!1})],Zn.prototype,"renderItemFunction",void 0),e([ue({type:Array})],Zn.prototype,"allMenuItems",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"enableVisibilityEffect",void 0),e([ue({type:Boolean,reflect:!0})],Zn.prototype,"enableTabClose",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],Zn.prototype,"noDropdownClose",void 0),e([ue({type:String})],Zn.prototype,"label",void 0),e([De()],Zn.prototype,"menuItems",void 0),e([Pe("portal",{waitUntilFirstUpdate:!0})],Zn.prototype,"handlePortalChange",null),Zn=e([Ne("nile-auto-complete")],Zn);const Vn=r`
|
|
6675
6675
|
:host {
|
|
6676
6676
|
box-sizing: border-box;
|
|
6677
6677
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
@@ -8104,9 +8104,6 @@ class Mn{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
8104
8104
|
}
|
|
8105
8105
|
:host([disabled]) .duration__value {
|
|
8106
8106
|
cursor: not-allowed;
|
|
8107
|
-
background: var(--nile-colors-dark-200, var(--ng-colors-bg-disabled-subtle));
|
|
8108
|
-
color: var(--nile-colors-dark-500, var(--ng-colors-fg-disabled));
|
|
8109
|
-
border-color: var(--nile-colors-neutral-400, var(--ng-colors-border-disabled));
|
|
8110
8107
|
}
|
|
8111
8108
|
`;var Xn;!function(e){e.Single="single",e.Range="range",e.Relative="relative"}(Xn||(Xn={}));let qn=class extends Fe{constructor(){super(...arguments),this.valueAttribute=null,this.allowedDates=JSON.stringify({}),this.range=!1,this.hideTypes=!1,this.doubleClickUnselect=!1,this.allowClear=!1,this.type="absolute",this.hideDurationFields=[],this.showManualInputs=!1,this.showMonthDropdown=!1,this.showYearDropdown=!1,this.dateFormat="MM/DD/YYYY",this.startDate=null,this.endDate=null,this.isSelectingStart=!0,this.hideInput=!1,this.currentMonth=(new Date).getMonth(),this.currentYear=(new Date).getFullYear(),this.allowedDatesLocal=null,this.disabled=!1}static get styles(){return[$n]}connectedCallback(){super.connectedCallback(),this.initializeValue(),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this.emit("nile-destroy")}updated(e){if(super.updated(e),e.has("valueAttribute")){this.valueAttribute||(this.value=null,this.startDate=null,this.endDate=null,this.isSelectingStart=!0);const e=new Date(this.valueAttribute||"");if(!isNaN(e.getTime())){const t=e.getTimezoneOffset();this.value=new Date(e.getTime()-60*t*1e3),this.currentMonth=this.value.getMonth(),this.currentYear=this.value.getFullYear()}this.initializeValue()}}get monthNames(){return Array.from({length:12},((e,t)=>new Date(0,t).toLocaleString("default",{month:"long"})))}get yearOptions(){const e=this.startYear??2e3,t=this.endYear??2050;return e>t?[]:Array.from({length:t-e+1},((t,i)=>e+i))}onMonthSelected(e){this.currentMonth=e,this.emit("nile-month-change",{month:e})}onYearSelected(e){this.currentYear=e,this.emit("nile-year-change",{year:e})}checkValidAllowedDate(){let e;try{e=JSON.parse(this.allowedDates)}catch(t){e=null}if(!e||0==Object.keys(e).length)return void(this.allowedDatesLocal=null);this.hideInput=!0;this.getUTCDate(e.startDate)>this.getUTCDate(e.endDate)?console.error("StartDate must be greater than endDate"):this.allowedDatesLocal=e}isPrevDisabled(){return 0===this.currentMonth&&void 0!==this.startYear&&this.currentYear<=this.startYear}isNextDisabled(){return 11===this.currentMonth&&void 0!==this.endYear&&this.currentYear>=this.endYear}formatDate(e){if(!e)return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),M=String(e.getDate()).padStart(2,"0");let n=this.dateFormat;return n=n.replace(/YYYY/g,String(t)),n=n.replace(/MM/g,i),n=n.replace(/DD/g,M),n=n.replace(/YY/g,String(t).slice(-2)),n}parseDate(e,t){if(!e||!this.dateFormat)return null;const i=this.dateFormat.replace(/YYYY/,"(?<year>\\d{4})").replace(/YY/,"(?<year>\\d{2})").replace(/MM/,"(?<month>\\d{1,2})").replace(/DD/,"(?<day>\\d{1,2})"),M=new RegExp(`^${i}$`),n=e.match(M);if(!n||!n.groups)return null;const o=2===n.groups.year.length?Number(`20${n.groups.year}`):Number(n.groups.year),r=Number(n.groups.month)-1,a=Number(n.groups.day),s=new Date(o,r,a);return t?s.setHours(t.getHours(),t.getMinutes(),t.getSeconds()):s.setHours(0,0,0),s}handleStartDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.startDate);t&&(t.setHours(0,0,0),this.startDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}handleEndDateInput(e){e.stopPropagation();const t=this.parseDate(e.detail.value,this.endDate);t&&(t.setHours(23,59,59),this.endDate=t,this.currentMonth=t.getMonth(),this.currentYear=t.getFullYear(),this.requestUpdate())}render(){return R`
|
|
8112
8109
|
<div
|
|
@@ -8132,14 +8129,14 @@ class Mn{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
8132
8129
|
class="clear-button"
|
|
8133
8130
|
variant="secondary"
|
|
8134
8131
|
role="button"
|
|
8135
|
-
?disabled="${!this.startDate||!this.endDate}"
|
|
8132
|
+
?disabled="${!this.startDate||!this.endDate||this.disabled}"
|
|
8136
8133
|
@keydown="${e=>{"Enter"!==e.key&&" "!==e.key||this.clearDate()}}"
|
|
8137
8134
|
@click="${this.clearDate}"
|
|
8138
8135
|
|
|
8139
8136
|
> Reset</nile-button>`:_}
|
|
8140
8137
|
<nile-button
|
|
8141
8138
|
class="apply-button"
|
|
8142
|
-
?disabled="${!this.startDate||!this.endDate}"
|
|
8139
|
+
?disabled="${!this.startDate||!this.endDate||this.disabled}"
|
|
8143
8140
|
@click="${this.confimRange}"
|
|
8144
8141
|
@keydown="${e=>{"Enter"!==e.key&&" "!==e.key||this.confimRange()}}"
|
|
8145
8142
|
> Apply</nile-button>
|
|
@@ -11787,7 +11784,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const M of e)yield t(M,i++)}}
|
|
|
11787
11784
|
`:_}
|
|
11788
11785
|
</div>
|
|
11789
11786
|
`}getSvg(){let e="sm"==this.size?20:"lg"==this.size?24:28;return R`
|
|
11790
|
-
<svg width="${e}" height="${e}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11787
|
+
<svg part="bulletin-svg" width="${e}" height="${e}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11791
11788
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7953 9.85334L13.2487 19.0667L10.7153 16.36C10.2487 15.92 9.51534 15.8933 8.982 16.2667C8.462 16.6533 8.31534 17.3333 8.63534 17.88L11.6353 22.76C11.9287 23.2133 12.4353 23.4933 13.0087 23.4933C13.5553 23.4933 14.0753 23.2133 14.3687 22.76C14.8487 22.1333 24.0087 11.2133 24.0087 11.2133C25.2087 9.98668 23.7553 8.90668 22.7953 9.84001V9.85334Z" fill="white"/>
|
|
11792
11789
|
</svg>
|
|
11793
11790
|
`}};e([je(".stepper__item__content--above .stepper__content__title")],mx.prototype,"absoluteTitle",void 0),e([je(".stepper__item__content--above .stepper__content__subtitle")],mx.prototype,"absoluteSubtitle",void 0),e([ue({attribute:!0,reflect:!0})],mx.prototype,"title",void 0),e([ue({attribute:!0,reflect:!0})],mx.prototype,"subtitle",void 0),e([ue({attribute:!0,reflect:!0})],mx.prototype,"completed",void 0),e([ue({attribute:!0,reflect:!0})],mx.prototype,"current",void 0),e([De()],mx.prototype,"contentBelow",void 0),e([De()],mx.prototype,"size",void 0),e([De()],mx.prototype,"icon",void 0),e([De()],mx.prototype,"isFirst",void 0),e([De()],mx.prototype,"isLast",void 0),e([De()],mx.prototype,"isComplete",void 0),e([De()],mx.prototype,"isCurrent",void 0),e([De()],mx.prototype,"isManualMode",void 0),e([De()],mx.prototype,"currentStepValue",void 0),e([De()],mx.prototype,"completedStepValue",void 0),e([De()],mx.prototype,"calculatedCompletedStepValue",void 0),e([De()],mx.prototype,"value",void 0),e([De()],mx.prototype,"haveFlex",void 0),mx=e([Ne("nile-stepper-item")],mx);const Sx=r`
|
|
@@ -12021,7 +12018,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const M of e)yield t(M,i++)}}
|
|
|
12021
12018
|
</div>
|
|
12022
12019
|
</div>
|
|
12023
12020
|
`}getSvg(){let e="sm"==this.size?20:"lg"==this.size?24:28;return R`
|
|
12024
|
-
<svg width="${e}" height="${e}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12021
|
+
<svg part="bulletin-svg" width="${e}" height="${e}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12025
12022
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7953 9.85334L13.2487 19.0667L10.7153 16.36C10.2487 15.92 9.51534 15.8933 8.982 16.2667C8.462 16.6533 8.31534 17.3333 8.63534 17.88L11.6353 22.76C11.9287 23.2133 12.4353 23.4933 13.0087 23.4933C13.5553 23.4933 14.0753 23.2133 14.3687 22.76C14.8487 22.1333 24.0087 11.2133 24.0087 11.2133C25.2087 9.98668 23.7553 8.90668 22.7953 9.84001V9.85334Z" fill="white"/>
|
|
12026
12023
|
</svg>
|
|
12027
12024
|
`}};e([ue({attribute:!0,reflect:!0})],Qx.prototype,"title",void 0),e([ue({attribute:!0,reflect:!0})],Qx.prototype,"subtitle",void 0),e([ue({attribute:!0,reflect:!0})],Qx.prototype,"completed",void 0),e([ue({attribute:!0,reflect:!0})],Qx.prototype,"current",void 0),e([De()],Qx.prototype,"contentBelow",void 0),e([De()],Qx.prototype,"size",void 0),e([De()],Qx.prototype,"icon",void 0),e([De()],Qx.prototype,"isFirst",void 0),e([De()],Qx.prototype,"isLast",void 0),e([De()],Qx.prototype,"isComplete",void 0),e([De()],Qx.prototype,"isCurrent",void 0),e([De()],Qx.prototype,"isManualMode",void 0),e([De()],Qx.prototype,"currentStepValue",void 0),e([De()],Qx.prototype,"completedStepValue",void 0),e([De()],Qx.prototype,"calculatedCompletedStepValue",void 0),e([De()],Qx.prototype,"value",void 0),e([De()],Qx.prototype,"haveFlex",void 0),Qx=e([Ne("nile-vertical-stepper-item")],Qx);const vx=r`
|
|
@@ -16280,7 +16277,7 @@ nile-rich-text-editor[disabled] .editor a {
|
|
|
16280
16277
|
|
|
16281
16278
|
|
|
16282
16279
|
|
|
16283
|
-
`,sS={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"},lS=["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"];let NS=class extends se{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.disabled=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.whitelist=[],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.linkEl=null,this.mentionsEl=null,this.onEditorClick=e=>{if(this.disabled)return void e.preventDefault();const t=e.target.closest?.("a");t&&e.preventDefault()},this.onEditorPaste=e=>{this.disabled&&e.preventDefault()},this.onEditorDrop=e=>{this.disabled&&e.preventDefault()},this.onEditorInput=()=>{this.disabled||(this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState())},this.onEditorMouseup=()=>{this.saveSelection(),this.updateToolbarState()},this.onEditorKeyup=e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()},this.onEditorKeydown=e=>{if(this.disabled)return void e.preventDefault();if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),Km(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(aS.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))}firstUpdated(e){if(super.firstUpdated(e),this.editorEl){/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.editorEl.classList.add("safari")}}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){this.unwireEditor(),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)),e.has("disabled")&&this.editorEl&&(this.editorEl.setAttribute("contenteditable",this.disabled?"false":"true"),this.editorEl.tabIndex=this.disabled?-1:0,this.linkEl&&(this.linkEl.disabled=this.disabled)),e.has("placeholder")&&this.editorEl&&(this.placeholder?this.editorEl.dataset.placeholder=this.placeholder:delete this.editorEl.dataset.placeholder)}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable",this.disabled?"false":"true"),e.tabIndex=this.disabled?-1:0,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("click",this.onEditorClick),this.editorEl.addEventListener("input",this.onEditorInput),this.editorEl.addEventListener("mouseup",this.onEditorMouseup),this.editorEl.addEventListener("keyup",this.onEditorKeyup),this.editorEl.addEventListener("keydown",this.onEditorKeydown),this.editorEl.addEventListener("paste",this.onEditorPaste),this.editorEl.addEventListener("drop",this.onEditorDrop)}unwireEditor(){this.editorEl&&(this.editorEl.removeEventListener("click",this.onEditorClick),this.editorEl.removeEventListener("input",this.onEditorInput),this.editorEl.removeEventListener("mouseup",this.onEditorMouseup),this.editorEl.removeEventListener("keyup",this.onEditorKeyup),this.editorEl.removeEventListener("keydown",this.onEditorKeydown),this.editorEl.removeEventListener("paste",this.onEditorPaste),this.editorEl.removeEventListener("drop",this.onEditorDrop))}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"))return e.disabled=this.disabled,void e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;qm(this.editorEl,t),this.updateContent(),this.updateToolbarState()}));if("nile-rte-link"===t)return e.editorEl=this.editorEl,e.disabled=this.disabled,this.linkEl=e,void e.addEventListener("nile-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"),t.disabled=this.disabled,n)t.innerHTML=`<nile-icon name="${n}" color="${this.disabled?"var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))":"var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))"}" ></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=sS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="${this.disabled?"var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))":"var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))"}" ></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected)if(this.disabled)e.appendChild(t);else{const i=document.createElement("nile-lite-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?MS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){MS(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=Xm(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&&tS(this.editorEl,i),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){e.innerHTML="<p><br></p>";const t=e.querySelector("p");if(t){const e=document.createRange();e.setStart(t,0),e.collapse(!0);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(e))}return}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){if(!this.disabled){switch(this.focusAndRestore(),e){case"bold":Km(this.editorEl,"strong");break;case"italic":Km(this.editorEl,"em");break;case"underline":Km(this.editorEl,"u");break;case"left":qm(this.editorEl,"left");break;case"center":qm(this.editorEl,"center");break;case"right":qm(this.editorEl,"right");break;case"justify":qm(this.editorEl,"justify");break;case"ul":rS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":rS(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=Xm(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})(),a=(()=>{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})(),s=!!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",a),this.setBtnActive("link",s),this.linkEl){const e=this.linkEl.querySelector("nile-button");e&&e.toggleAttribute("data-active",s)}if(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=eS(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=eS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}getComputedImportantProps(){return Array.from(new Set([...lS,...this.whitelist??[]]))}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=window.getSelection(),i=t&&t.rangeCount>0&&this.editorEl.contains(t.getRangeAt(0).startContainer)?t.getRangeAt(0).cloneRange():null,M=this.editorEl.cloneNode(!0);if(this.noStyles)M.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=document.createTreeWalker(M,NodeFilter.SHOW_ELEMENT),i=this.getComputedImportantProps();for(;e.nextNode()&&t.nextNode();){const M=e.currentNode,n=t.currentNode,o=window.getComputedStyle(M),r=i.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}i&&t&&this.editorEl.contains(i.startContainer)&&(t.removeAllRanges(),t.addRange(i)),this.content=M.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ue({type:String,attribute:!0,reflect:!0})],NS.prototype,"value",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],NS.prototype,"noStyles",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],NS.prototype,"disabled",void 0),e([ue({type:Boolean,attribute:"singlelineeditor",reflect:!0})],NS.prototype,"singleLineEditor",void 0),e([ue({type:String})],NS.prototype,"placeholder",void 0),e([ue({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)}})],NS.prototype,"mentions",void 0),e([ue({attribute:"whitelist",reflect:!1,converter:{fromAttribute:e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t.filter((e=>"string"==typeof e)):[]}catch{return[]}}}})],NS.prototype,"whitelist",void 0),e([De()],NS.prototype,"content",void 0),NS=e([Ne("nile-rich-text-editor")],NS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.6.8"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const gS=r`
|
|
16280
|
+
`,sS={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"},lS=["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"];let NS=class extends se{constructor(){super(...arguments),this.value="",this.noStyles=!1,this.disabled=!1,this.singleLineEditor=!1,this.placeholder="",this.mentions={},this.whitelist=[],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.linkEl=null,this.mentionsEl=null,this.onEditorClick=e=>{if(this.disabled)return void e.preventDefault();const t=e.target.closest?.("a");t&&e.preventDefault()},this.onEditorPaste=e=>{this.disabled&&e.preventDefault()},this.onEditorDrop=e=>{this.disabled&&e.preventDefault()},this.onEditorInput=()=>{this.disabled||(this.ensureAtLeastOneParagraph(),this.scrubBrokenMentions(),this.updateContent(),this.updateToolbarState())},this.onEditorMouseup=()=>{this.saveSelection(),this.updateToolbarState()},this.onEditorKeyup=e=>{this.saveSelection(),["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)&&this.updateToolbarState()},this.onEditorKeydown=e=>{if(this.disabled)return void e.preventDefault();if(this.singleLineEditor&&"Enter"===e.key&&e.shiftKey)return void e.preventDefault();if(e.ctrlKey&&"i"===e.key.toLowerCase()&&(e.preventDefault(),Km(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(aS.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))}firstUpdated(e){if(super.firstUpdated(e),this.editorEl){/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&this.editorEl.classList.add("safari")}}updateContentWithMention(e){this.updateContent(),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content,mention:e},bubbles:!0,composed:!0}))}disconnectedCallback(){this.unwireEditor(),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)),e.has("disabled")&&this.editorEl&&(this.editorEl.setAttribute("contenteditable",this.disabled?"false":"true"),this.editorEl.tabIndex=this.disabled?-1:0,this.linkEl&&(this.linkEl.disabled=this.disabled)),e.has("placeholder")&&this.editorEl&&(this.placeholder?this.editorEl.dataset.placeholder=this.placeholder:delete this.editorEl.dataset.placeholder)}ensureEditor(){if(this.editorEl=this.querySelector(".editor"),!this.editorEl){const e=document.createElement("article");e.className="editor",e.setAttribute("contenteditable",this.disabled?"false":"true"),e.tabIndex=this.disabled?-1:0,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("click",this.onEditorClick),this.editorEl.addEventListener("input",this.onEditorInput),this.editorEl.addEventListener("mouseup",this.onEditorMouseup),this.editorEl.addEventListener("keyup",this.onEditorKeyup),this.editorEl.addEventListener("keydown",this.onEditorKeydown),this.editorEl.addEventListener("paste",this.onEditorPaste),this.editorEl.addEventListener("drop",this.onEditorDrop)}unwireEditor(){this.editorEl&&(this.editorEl.removeEventListener("click",this.onEditorClick),this.editorEl.removeEventListener("input",this.onEditorInput),this.editorEl.removeEventListener("mouseup",this.onEditorMouseup),this.editorEl.removeEventListener("keyup",this.onEditorKeyup),this.editorEl.removeEventListener("keydown",this.onEditorKeydown),this.editorEl.removeEventListener("paste",this.onEditorPaste),this.editorEl.removeEventListener("drop",this.onEditorDrop))}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"))return e.disabled=this.disabled,void e.addEventListener("change",(e=>{this.focusAndRestore();const t=e.detail;qm(this.editorEl,t),this.updateContent(),this.updateToolbarState()}));if("nile-rte-link"===t)return e.editorEl=this.editorEl,e.disabled=this.disabled,this.linkEl=e,void e.addEventListener("nile-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"),t.disabled=this.disabled,n)t.innerHTML=`<nile-icon name="${n}" color="${this.disabled?"var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))":"var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))"}" ></nile-icon>`,e.innerHTML="";else if(o)t.innerHTML=e.innerHTML,e.innerHTML="";else{const n=sS[i];n?t.innerHTML=`<nile-icon name="${n}" size="20" color="${this.disabled?"var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))":"var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))"}" ></nile-icon>`:t.textContent=M||i,e.innerHTML=""}if(!t.isConnected)if(this.disabled)e.appendChild(t);else{const i=document.createElement("nile-lite-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?MS(this.editorEl,"backgroundColor",i,"data-rte-bg"):function(e,t){MS(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=Xm(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&&tS(this.editorEl,i),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){e.innerHTML="<p><br></p>";const t=e.querySelector("p");if(t){const e=document.createRange();e.setStart(t,0),e.collapse(!0);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(e))}return}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){if(!this.disabled){switch(this.focusAndRestore(),e){case"bold":Km(this.editorEl,"strong");break;case"italic":Km(this.editorEl,"em");break;case"underline":Km(this.editorEl,"u");break;case"left":qm(this.editorEl,"left");break;case"center":qm(this.editorEl,"center");break;case"right":qm(this.editorEl,"right");break;case"justify":qm(this.editorEl,"justify");break;case"ul":rS(this.editorEl,"ul"),this.updateContent(),this.updateToolbarState();break;case"ol":rS(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=Xm(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})(),a=(()=>{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})(),s=!!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",a),this.setBtnActive("link",s),this.linkEl){const e=this.linkEl.querySelector("nile-button");e&&e.toggleAttribute("data-active",s)}if(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=eS(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=eS(e);t&&this.bgColorInput.value.toLowerCase()!==t.toLowerCase()&&(this.bgColorInput.value=t)}this.bgSwatchEl&&(this.bgSwatchEl.style.backgroundColor=this.bgColorInput.value)}}syncPreview(){this.updateContent()}getComputedImportantProps(){return Array.from(new Set([...lS,...this.whitelist??[]]))}updateContent(){if(!this.editorEl)return;this.ensureAtLeastOneParagraph();const e=""===(this.editorEl.textContent??"").trim();this.editorEl.classList.toggle("empty",e);const t=window.getSelection(),i=t&&t.rangeCount>0&&this.editorEl.contains(t.getRangeAt(0).startContainer)?t.getRangeAt(0).cloneRange():null,M=this.editorEl.cloneNode(!0);if(this.noStyles)M.querySelectorAll("[style]").forEach((e=>e.removeAttribute("style")));else{const e=document.createTreeWalker(this.editorEl,NodeFilter.SHOW_ELEMENT),t=document.createTreeWalker(M,NodeFilter.SHOW_ELEMENT),i=this.getComputedImportantProps();for(;e.nextNode()&&t.nextNode();){const M=e.currentNode,n=t.currentNode,o=window.getComputedStyle(M),r=i.map((e=>`${e}:${o.getPropertyValue(e)}`)).join(";");r.trim()&&n.setAttribute("style",r)}}i&&t&&this.editorEl.contains(i.startContainer)&&(t.removeAllRanges(),t.addRange(i)),this.content=M.innerHTML,this.previewEl&&(this.previewEl.innerHTML=this.content),this.dispatchEvent(new CustomEvent("nile-change",{detail:{content:this.content},bubbles:!0,composed:!0}))}};e([ue({type:String,attribute:!0,reflect:!0})],NS.prototype,"value",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],NS.prototype,"noStyles",void 0),e([ue({type:Boolean,attribute:!0,reflect:!0})],NS.prototype,"disabled",void 0),e([ue({type:Boolean,attribute:"singlelineeditor",reflect:!0})],NS.prototype,"singleLineEditor",void 0),e([ue({type:String})],NS.prototype,"placeholder",void 0),e([ue({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)}})],NS.prototype,"mentions",void 0),e([ue({attribute:"whitelist",reflect:!1,converter:{fromAttribute:e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t.filter((e=>"string"==typeof e)):[]}catch{return[]}}}})],NS.prototype,"whitelist",void 0),e([De()],NS.prototype,"content",void 0),NS=e([Ne("nile-rich-text-editor")],NS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.6.9"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const gS=r`
|
|
16284
16281
|
:host {
|
|
16285
16282
|
|
|
16286
16283
|
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","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.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,c,u,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,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){c=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){u=_utilitiesVisibilityManagerCjsJs.V;},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},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.noDropdownClose=!1,_this.label="",_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 u({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 ","\n <nile-dropdown ?disabled="," class=\"nile-dropdown--input\" ?open="," ?stay-open-on-select="," 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.label?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <label class=\"nile-auto-complete__label\">","</label>\n "])),this.label):e,this.disabled,this.isDropdownOpen,this.noDropdownClose,this.noBorder,this.noOutline,this.noPadding,this.disabled,this.value,this.handleSearch,this.handleFocus,this.handleClick,this.placeholder,this.loading?i(_templateObject3||(_templateObject3=_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(_templateObject4||(_templateObject4=_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(_templateObject5||(_templateObject5=_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(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-menu-item value=",">","</nile-menu-item>\n "])),e,c(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(_templateObject7||(_templateObject7=_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:"",c(s));}},{key:"handleSelect",value:function handleSelect(t){var _this$dropdownElement3,_this$dropdownElement4;this.value=t.detail.value,this.emit("nile-complete",{value:t.detail.value}),this.noDropdownClose?(this.isDropdownOpen=!0,(_this$dropdownElement3=this.dropdownElement)===null||_this$dropdownElement3===void 0?void 0:_this$dropdownElement3.show()):(this.isDropdownOpen=!1,(_this$dropdownElement4=this.dropdownElement)===null||_this$dropdownElement4===void 0?void 0:_this$dropdownElement4.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$dropdownElement5;this.value=t.detail.value,this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&((_this$dropdownElement5=this.dropdownElement)!==null&&_this$dropdownElement5!==void 0&&_this$dropdownElement5.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$dropdownElement6;this.isDropdownOpen=!0,(_this$dropdownElement6=this.dropdownElement)===null||_this$dropdownElement6===void 0?void 0:_this$dropdownElement6.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([n({type:Boolean,reflect:!0,attribute:!0})],m.prototype,"noDropdownClose",void 0),t([n({type:String})],m.prototype,"label",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","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.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,c,u,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,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){c=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_utilitiesVisibilityManagerCjsJs){u=_utilitiesVisibilityManagerCjsJs.V;},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){},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.noDropdownClose=!1,_this.label="",_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 u({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 ","\n <nile-dropdown ?disabled="," class=\"nile-dropdown--input\" ?open="," ?stay-open-on-select="," 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.label?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <label class=\"nile-auto-complete__label\">","</label>\n "])),this.label):e,this.disabled,this.isDropdownOpen,this.noDropdownClose,this.noBorder,this.noOutline,this.noPadding,this.disabled,this.value,this.handleSearch,this.handleFocus,this.handleClick,this.placeholder,this.loading?i(_templateObject3||(_templateObject3=_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(_templateObject4||(_templateObject4=_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(_templateObject5||(_templateObject5=_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(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-menu-item value=",">","</nile-menu-item>\n "])),e,c(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(_templateObject7||(_templateObject7=_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:"",c(s));}},{key:"handleSelect",value:function handleSelect(t){var _this$dropdownElement3,_this$dropdownElement4;this.value=t.detail.value,this.emit("nile-complete",{value:t.detail.value}),this.noDropdownClose?(this.isDropdownOpen=!0,(_this$dropdownElement3=this.dropdownElement)===null||_this$dropdownElement3===void 0?void 0:_this$dropdownElement3.show()):(this.isDropdownOpen=!1,(_this$dropdownElement4=this.dropdownElement)===null||_this$dropdownElement4===void 0?void 0:_this$dropdownElement4.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$dropdownElement5;this.value=t.detail.value,this.menuItems=this.applyFilter(this.allMenuItems,this.filterFunction),this.isDropdownOpen=this.menuItems.length>0,this.isDropdownOpen&&((_this$dropdownElement5=this.dropdownElement)!==null&&_this$dropdownElement5!==void 0&&_this$dropdownElement5.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$dropdownElement6;this.isDropdownOpen=!0,(_this$dropdownElement6=this.dropdownElement)===null||_this$dropdownElement6===void 0?void 0:_this$dropdownElement6.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,reflect:!0})],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([n({type:Boolean,reflect:!0,attribute:!0})],m.prototype,"noDropdownClose",void 0),t([n({type:String})],m.prototype,"label",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
|