@aquera/nile-elements 1.2.8-beta-1.6 → 1.2.8-beta-1.8

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.
Files changed (54) hide show
  1. package/demo/index.html +52 -70
  2. package/dist/index.cjs.js +1 -1
  3. package/dist/index.esm.js +1 -1
  4. package/dist/index.js +285 -274
  5. package/dist/nile-auto-complete/index.cjs.js +1 -1
  6. package/dist/nile-auto-complete/index.esm.js +1 -1
  7. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  8. package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
  9. package/dist/nile-auto-complete/nile-auto-complete.esm.js +17 -13
  10. package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
  11. package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js.map +1 -1
  12. package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
  13. package/dist/nile-auto-complete/portal-manager.cjs.js +2 -0
  14. package/dist/nile-auto-complete/portal-manager.cjs.js.map +1 -0
  15. package/dist/nile-auto-complete/portal-manager.esm.js +1 -0
  16. package/dist/nile-auto-complete/portal-utils.cjs.js +2 -0
  17. package/dist/nile-auto-complete/portal-utils.cjs.js.map +1 -0
  18. package/dist/nile-auto-complete/portal-utils.esm.js +1 -0
  19. package/dist/nile-chip/index.cjs.js +1 -1
  20. package/dist/nile-chip/index.esm.js +1 -1
  21. package/dist/nile-chip/nile-chip.cjs.js +1 -1
  22. package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
  23. package/dist/nile-chip/nile-chip.esm.js +14 -7
  24. package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
  25. package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
  26. package/dist/nile-chip/nile-chip.test.esm.js +1 -1
  27. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
  28. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js.map +1 -1
  29. package/dist/nile-lite-tooltip/nile-lite-tooltip.esm.js +1 -1
  30. package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +18 -1
  31. package/dist/src/nile-auto-complete/nile-auto-complete.js +131 -9
  32. package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
  33. package/dist/src/nile-auto-complete/portal-manager.d.ts +41 -0
  34. package/dist/src/nile-auto-complete/portal-manager.js +308 -0
  35. package/dist/src/nile-auto-complete/portal-manager.js.map +1 -0
  36. package/dist/src/nile-auto-complete/portal-utils.d.ts +31 -0
  37. package/dist/src/nile-auto-complete/portal-utils.js +166 -0
  38. package/dist/src/nile-auto-complete/portal-utils.js.map +1 -0
  39. package/dist/src/nile-chip/nile-chip.d.ts +7 -0
  40. package/dist/src/nile-chip/nile-chip.js +53 -10
  41. package/dist/src/nile-chip/nile-chip.js.map +1 -1
  42. package/dist/src/nile-lite-tooltip/nile-lite-tooltip.d.ts +1 -0
  43. package/dist/src/nile-lite-tooltip/nile-lite-tooltip.js +41 -59
  44. package/dist/src/nile-lite-tooltip/nile-lite-tooltip.js.map +1 -1
  45. package/dist/src/version.js +1 -1
  46. package/dist/src/version.js.map +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +1 -1
  49. package/src/nile-auto-complete/nile-auto-complete.ts +148 -13
  50. package/src/nile-auto-complete/portal-manager.ts +410 -0
  51. package/src/nile-auto-complete/portal-utils.ts +221 -0
  52. package/src/nile-chip/nile-chip.ts +54 -11
  53. package/src/nile-lite-tooltip/nile-lite-tooltip.ts +56 -75
  54. package/vscode-html-custom-data.json +17 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-manager.cjs.js","sources":["../../../src/nile-auto-complete/portal-manager.ts"],"sourcesContent":["import { \n autoUpdate, \n computePosition, \n flip, \n offset, \n shift, \n size, \n platform,\n type Placement,\n type MiddlewareData,\n type ComputePositionConfig\n} from '@floating-ui/dom';\nimport { PortalUtils, PortalContentUtils, PortalEventUtils } from './portal-utils';\n\nexport class AutoCompletePortalManager {\n private portalContainer: HTMLElement | null = null;\n private originalMenuParent: HTMLElement | null = null;\n private measuredMenuHeight: number | null = null;\n private component: any;\n private clonedMenu: HTMLElement | null = null;\n private cleanupAutoUpdate: (() => void) | null = null;\n private currentPlacement: Placement = 'bottom';\n private currentMiddlewareData: MiddlewareData | null = null;\n\n constructor(component: any) {\n this.component = component;\n }\n\n private createPortalAppendContainer(): HTMLElement {\n const container = document.createElement('div');\n container.style.position = 'absolute';\n container.style.zIndex = '9999';\n container.style.pointerEvents = 'none';\n container.style.width = 'auto';\n container.style.minWidth = 'auto';\n container.className = 'nile-auto-complete-portal-append';\n return container;\n }\n\n positionPortalAppend(): void {\n if (!this.portalContainer || !this.component.dropdownElement) return;\n\n this.measureMenuHeight();\n this.computeFloatingUIPosition();\n }\n\n private measureMenuHeight(): void {\n if (this.measuredMenuHeight || !this.portalContainer) return;\n\n this.portalContainer.style.position = 'absolute';\n this.portalContainer.style.visibility = 'hidden';\n this.portalContainer.style.top = '0px';\n this.portalContainer.style.left = '0px';\n \n this.portalContainer.offsetHeight;\n \n this.measuredMenuHeight = this.portalContainer.offsetHeight;\n \n this.portalContainer.style.visibility = '';\n }\n\n private async computeFloatingUIPosition(): Promise<void> {\n if (!this.portalContainer) return;\n\n const referenceElement = this.component.inputElement || this.component;\n const floatingElement = this.portalContainer;\n\n try {\n const { x, y, placement, middlewareData } = await this.calculateFloatingUIPosition(\n referenceElement,\n floatingElement\n );\n\n this.applyFloatingUIPosition(floatingElement, referenceElement, x, y, placement, middlewareData);\n\n } catch (error) {\n console.warn('Floating UI positioning failed, falling back to simple positioning:', error);\n this.fallbackPositioning();\n }\n }\n\n private async calculateFloatingUIPosition(\n referenceElement: HTMLElement,\n floatingElement: HTMLElement\n ): Promise<{ x: number; y: number; placement: Placement; middlewareData: MiddlewareData }> {\n const boundary = PortalUtils.findBoundaryElements(referenceElement);\n // Use 'bottom-start' or 'top-start' to align left edges for auto-width menu\n const basePlacement = PortalUtils.getOptimalPlacement(referenceElement);\n const initialPlacement = basePlacement === 'top' ? 'top-start' : 'bottom-start';\n const middleware = this.createFloatingUIMiddleware(boundary);\n\n return await computePosition(referenceElement, floatingElement, {\n placement: initialPlacement,\n strategy: 'fixed',\n middleware,\n platform: this.createCustomPlatform()\n });\n }\n\n private createFloatingUIMiddleware(boundary: Element[] | undefined): ComputePositionConfig['middleware'] {\n return [\n offset(4),\n size({\n apply: this.handleSizeMiddleware.bind(this),\n padding: 10,\n boundary: boundary\n }),\n flip({\n fallbackPlacements: ['bottom-start', 'top-start', 'bottom', 'top', 'bottom-end', 'top-end'],\n fallbackStrategy: 'bestFit',\n padding: 10,\n boundary: boundary\n }),\n shift({\n padding: 10,\n crossAxis: true,\n boundary: boundary\n })\n ];\n }\n\n private handleSizeMiddleware({ availableWidth, availableHeight, elements, rects }: {\n availableWidth: number;\n availableHeight: number;\n elements: { floating: HTMLElement };\n rects: { reference: { x: number; y: number; width: number; height: number } };\n }): void {\n const maxHeight = PortalUtils.calculateOptimalHeight(\n rects.reference,\n window.innerHeight,\n this.currentPlacement\n );\n\n // elements.floating.style.maxWidth = `${availableWidth}px`;\n elements.floating.style.maxHeight = `${maxHeight}px`;\n \n elements.floating.style.setProperty('--auto-size-available-width', `${availableWidth}px`);\n elements.floating.style.setProperty('--auto-size-available-height', `${maxHeight}px`);\n }\n\n private createCustomPlatform() {\n return platform;\n }\n\n private applyFloatingUIPosition(\n floatingElement: HTMLElement,\n referenceElement: HTMLElement,\n x: number,\n y: number,\n placement: Placement,\n middlewareData: MiddlewareData\n ): void {\n // For auto-complete, align left edge with input element\n // Use reference element's left position, not Floating UI's x (which might shift)\n const referenceRect = referenceElement.getBoundingClientRect();\n \n Object.assign(floatingElement.style, {\n left: `${referenceRect.left}px`,\n top: `${y}px`,\n position: 'fixed',\n pointerEvents: 'auto',\n width: 'auto',\n minWidth: 'auto'\n });\n\n this.currentPlacement = placement;\n this.currentMiddlewareData = middlewareData;\n \n PortalUtils.applyCollisionData(floatingElement, middlewareData, placement);\n \n const placementClass = placement.split('-')[0];\n floatingElement.className = `nile-auto-complete-portal-append menu__listbox--${placementClass}`;\n }\n\n private fallbackPositioning(): void {\n if (!this.portalContainer) return;\n\n const referenceElement = this.component.inputElement || this.component;\n const rect = referenceElement.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const menuHeight = this.measuredMenuHeight || 200;\n \n const spaceBelow = viewportHeight - rect.bottom;\n const spaceAbove = rect.top;\n \n let topPosition: number;\n let placementClass: string;\n let maxHeight: number;\n \n if (spaceAbove > spaceBelow) {\n maxHeight = Math.max(spaceAbove - 20, 100);\n topPosition = Math.max(rect.top - maxHeight - 4, 10);\n placementClass = 'top';\n } else {\n maxHeight = Math.max(spaceBelow - 20, 100);\n topPosition = rect.bottom + 4;\n placementClass = 'bottom';\n }\n\n this.portalContainer.style.left = `${rect.left}px`;\n this.portalContainer.style.top = `${topPosition}px`;\n // Let the menu auto-size based on its content, don't force width to match input\n this.portalContainer.style.width = 'auto';\n this.portalContainer.style.minWidth = 'auto';\n this.portalContainer.style.maxHeight = `${maxHeight}px`;\n this.portalContainer.style.pointerEvents = 'auto';\n this.portalContainer.className = `nile-auto-complete-portal-append menu__listbox--${placementClass}`;\n \n this.calculateAndSetAutoSizeProperties(rect, topPosition, placementClass);\n }\n\n private calculateAndSetAutoSizeProperties(rect: DOMRect, topPosition: number, placementClass: string): void {\n if (!this.portalContainer) return;\n\n const viewportHeight = window.innerHeight;\n const viewportWidth = window.innerWidth;\n \n let availableHeight: number;\n if (placementClass === 'top') {\n availableHeight = rect.top - 10;\n } else {\n availableHeight = viewportHeight - rect.bottom - 10;\n }\n \n const availableWidth = Math.min(rect.width, viewportWidth - rect.left - 10);\n \n this.portalContainer.style.setProperty('--auto-size-available-height', `${Math.max(availableHeight, 100)}px`);\n this.portalContainer.style.setProperty('--auto-size-available-width', `${Math.max(availableWidth, 200)}px`);\n }\n\n updatePortalAppendPosition(): void {\n if (this.component.portal && this.portalContainer) {\n this.positionPortalAppend();\n }\n }\n\n handleWindowResize(): void {\n if (this.component.portal && this.portalContainer) {\n this.positionPortalAppend();\n }\n }\n\n private setupAutoUpdatePositioning(): void {\n if (!this.portalContainer || !this.component) return;\n\n this.cleanupAutoUpdatePositioning();\n\n this.cleanupAutoUpdate = autoUpdate(\n this.component,\n this.portalContainer,\n () => {\n this.computeFloatingUIPosition();\n },\n {\n ancestorScroll: true,\n ancestorResize: true,\n elementResize: true,\n layoutShift: true,\n animationFrame: true\n }\n );\n }\n\n private cleanupAutoUpdatePositioning(): void {\n if (this.cleanupAutoUpdate) {\n this.cleanupAutoUpdate();\n this.cleanupAutoUpdate = null;\n }\n }\n\n private injectStylesToDocument(): void {\n if (!this.portalContainer) return;\n\n const styleId = PortalUtils.generateStyleId();\n \n if (document.getElementById(styleId)) return;\n\n const componentStyles = (this.component.constructor as any).styles;\n if (!componentStyles) return;\n\n const styleElement = document.createElement('style');\n styleElement.id = styleId;\n styleElement.textContent = PortalUtils.extractStylesAsCSS(componentStyles);\n \n document.head.appendChild(styleElement);\n \n (this.portalContainer as any).__injectedStyleId = styleId;\n }\n\n private adoptStylesToPortalAppend(): void {\n if (!this.portalContainer) return;\n this.injectStylesToDocument();\n }\n\n setupPortalAppend(): void {\n if (!this.component.portal) return;\n\n this.component.updateComplete.then(() => {\n setTimeout(() => {\n // Try to find menu in shadow root first, then fallback to querySelector\n const menu = this.component.shadowRoot?.querySelector('#content-menu') as HTMLElement ||\n this.component.querySelector('#content-menu') as HTMLElement;\n if (menu && this.component.isDropdownOpen) {\n this.originalMenuParent = menu.parentElement as HTMLElement;\n \n this.clonedMenu = this.createPortalMenu();\n \n this.portalContainer = this.createPortalAppendContainer();\n this.portalContainer.appendChild(this.clonedMenu);\n document.body.appendChild(this.portalContainer);\n \n this.adoptStylesToPortalAppend();\n \n this.clonedMenu.style.display = '';\n this.positionPortalAppend();\n \n this.setupPortalEventListeners();\n \n this.setupAutoUpdatePositioning();\n \n window.addEventListener('resize', this.handleWindowResize.bind(this));\n }\n }, 10);\n });\n }\n\n private createPortalMenu(): HTMLElement {\n return PortalContentUtils.createPortalMenu(this.component);\n }\n\n private setupPortalEventListeners(): void {\n PortalEventUtils.setupPortalEventListeners(this.clonedMenu!, this.component);\n }\n\n cleanupPortalAppend(): void {\n this.cleanupAutoUpdatePositioning();\n \n if (this.portalContainer && this.portalContainer.parentNode) {\n const injectedStyleId = (this.portalContainer as any).__injectedStyleId;\n if (injectedStyleId) {\n const styleElement = document.getElementById(injectedStyleId);\n if (styleElement) {\n styleElement.remove();\n }\n }\n \n this.portalContainer.parentNode.removeChild(this.portalContainer);\n }\n \n window.removeEventListener('resize', this.handleWindowResize.bind(this));\n \n this.portalContainer = null;\n this.originalMenuParent = null;\n this.clonedMenu = null;\n this.measuredMenuHeight = null;\n this.currentPlacement = 'bottom';\n this.currentMiddlewareData = null;\n }\n\n get portalContainerElement(): HTMLElement | null {\n return this.portalContainer;\n }\n\n resetMeasuredHeight(): void {\n this.measuredMenuHeight = null;\n }\n\n updatePortalOptions(): void {\n if (this.portalContainer && this.clonedMenu) {\n PortalContentUtils.updatePortalMenuItems(this.clonedMenu, this.component);\n this.forceReposition();\n }\n }\n\n forceReposition(): void {\n if (this.portalContainer) {\n this.computeFloatingUIPosition();\n }\n }\n\n getCurrentPlacement(): Placement {\n return this.currentPlacement;\n }\n\n getCurrentMiddlewareData(): MiddlewareData | null {\n return this.currentMiddlewareData;\n }\n\n isUsingFloatingUI(): boolean {\n return this.cleanupAutoUpdate !== null;\n }\n\n isPositioningOptimal(): boolean {\n if (!this.portalContainer || !this.currentMiddlewareData) return true;\n\n const referenceElement = this.component.inputElement || this.component;\n const rect = referenceElement.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - rect.bottom;\n const spaceAbove = rect.top;\n \n const isAbove = this.currentPlacement.startsWith('top');\n const isBelow = this.currentPlacement.startsWith('bottom');\n \n if (isAbove && spaceBelow > spaceAbove) return false;\n if (isBelow && spaceAbove > spaceBelow) return false;\n \n return true;\n }\n}\n"],"names":["AutoCompletePortalManager","u","component","this","portalContainer","originalMenuParent","measuredMenuHeight","clonedMenu","cleanupAutoUpdate","currentPlacement","currentMiddlewareData","_createClass","key","value","createPortalAppendContainer","container","document","createElement","style","position","zIndex","pointerEvents","width","minWidth","className","positionPortalAppend","dropdownElement","measureMenuHeight","computeFloatingUIPosition","visibility","top","left","offsetHeight","_computeFloatingUIPosition","_asyncToGenerator","_regeneratorRuntime","mark","_callee","t","i","_yield$this$calculate","_s","_e","_o","_n","wrap","_callee$","_context2","prev","next","referenceElement","inputElement","floatingElement","calculateFloatingUIPosition","x","y","placement","middlewareData","applyFloatingUIPosition","t0","console","warn","fallbackPositioning","stop","_callee2","boundary","PortalUtils","findBoundaryElements","initialPlacement","getOptimalPlacement","middleware","createFloatingUIMiddleware","computePosition","strategy","platform","createCustomPlatform","_context3","abrupt","sent","offset","size","apply","handleSizeMiddleware","bind","padding","flip","fallbackPlacements","fallbackStrategy","shift","crossAxis","rects","availableWidth","availableHeight","elements","maxHeight","calculateOptimalHeight","reference","window","innerHeight","floating","setProperty","concat","referenceRect","getBoundingClientRect","Object","assign","applyCollisionData","placementClass","split","rect","viewportHeight","spaceBelow","bottom","spaceAbove","topPosition","Math","max","calculateAndSetAutoSizeProperties","viewportWidth","innerWidth","min","updatePortalAppendPosition","portal","handleWindowResize","setupAutoUpdatePositioning","cleanupAutoUpdatePositioning","autoUpdate","ancestorScroll","ancestorResize","elementResize","layoutShift","animationFrame","injectStylesToDocument","styleId","generateStyleId","getElementById","componentStyles","constructor","styles","styleElement","id","textContent","extractStylesAsCSS","head","appendChild","__injectedStyleId","adoptStylesToPortalAppend","setupPortalAppend","updateComplete","then","setTimeout","_this2$component$shad","menu","shadowRoot","querySelector","isDropdownOpen","parentElement","createPortalMenu","body","display","setupPortalEventListeners","addEventListener","PortalContentUtils","PortalEventUtils","cleanupPortalAppend","parentNode","injectedStyleId","remove","removeChild","removeEventListener","get","portalContainerElement","resetMeasuredHeight","updatePortalOptions","updatePortalMenuItems","forceReposition","getCurrentPlacement","getCurrentMiddlewareData","isUsingFloatingUI","isPositioningOptimal","isAbove","startsWith","isBelow"],"mappings":"wlTAcaA,CAUX,yBAAA,SAAAC,EAAYC,CAAAA,CAAAA,CAAAA,eAAAA,MAAAA,CAAAA,EATJC,IAAeC,CAAAA,eAAAA,CAAuB,KACtCD,IAAkBE,CAAAA,kBAAAA,CAAuB,IACzCF,CAAAA,IAAAA,CAAkBG,kBAAkB,CAAA,IAAA,CAEpCH,KAAUI,UAAuB,CAAA,IAAA,CACjCJ,IAAiBK,CAAAA,iBAAAA,CAAwB,IACzCL,CAAAA,IAAAA,CAAgBM,iBAAc,QAC9BN,CAAAA,IAAAA,CAAqBO,qBAA0B,CAAA,IAAA,CAGrDP,IAAKD,CAAAA,SAAAA,CAAYA,CAClB,EAEO,OAAAS,YAAA,CAAAV,CAAA,GAAAW,GAAA,+BAAAC,KAAA,UAAAC,2BAAAA,CAAAA,CACN,CAAA,GAAMC,CAAAA,CAAYC,CAAAA,QAAAA,CAASC,cAAc,KAOzC,CAAA,CAAA,MANAF,CAAAA,CAAUG,CAAAA,KAAAA,CAAMC,QAAW,CAAA,UAAA,CAC3BJ,EAAUG,KAAME,CAAAA,MAAAA,CAAS,OACzBL,CAAUG,CAAAA,KAAAA,CAAMG,cAAgB,MAChCN,CAAAA,CAAAA,CAAUG,KAAMI,CAAAA,KAAAA,CAAQ,MACxBP,CAAAA,CAAAA,CAAUG,MAAMK,QAAW,CAAA,MAAA,CAC3BR,CAAUS,CAAAA,SAAAA,CAAY,kCACfT,CAAAA,CACR,EAED,GAAAH,GAAA,wBAAAC,KAAA,UAAAY,oBAAAA,CAAAA,CAAAA,CACOtB,IAAKC,CAAAA,eAAAA,EAAoBD,IAAKD,CAAAA,SAAAA,CAAUwB,kBAE7CvB,IAAKwB,CAAAA,iBAAAA,CAAAA,CAAAA,CACLxB,IAAKyB,CAAAA,yBA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K,wBAAAA,CAAAA,EACE,MAAO9K,KAAAA,CAAKO,qBACb,EAED,GAAAE,GAAA,qBAAAC,KAAA,UAAAqK,iBAAAA,CAAAA,CAAAA,CACE,MAAkC,KAA3B/K,GAAAA,IAAAA,CAAKK,iBACb,EAED,GAAAI,GAAA,wBAAAC,KAAA,UAAAsK,oBAAAA,CAAAA,CAAAA,CACE,IAAKhL,IAAKC,CAAAA,eAAAA,EAAAA,CAAoBD,IAAKO,CAAAA,qBAAAA,CAAuB,MAAO,CAAA,CAAA,CAEjE,GACMmG,CAAAA,CADmB1G,CAAAA,CAAAA,IAAAA,CAAKD,SAAUiD,CAAAA,YAAAA,EAAgBhD,IAAKD,CAAAA,SAAAA,EAC/BqG,wBAExBQ,CADiBd,CAAAA,MAAAA,CAAOC,WACMW,CAAAA,CAAAA,CAAKG,MACnCC,CAAAA,CAAAA,CAAaJ,EAAK/E,GAElBsJ,CAAAA,CAAAA,CAAUjL,IAAKM,CAAAA,gBAAAA,CAAiB4K,UAAW,CAAA,KAAA,CAAA,CAC3CC,EAAUnL,IAAKM,CAAAA,gBAAAA,CAAiB4K,UAAW,CAAA,QAAA,CAAA,CAEjD,MAAID,EAAAA,CAAAA,EAAWrE,EAAaE,CACxBqE,CAAAA,EAAAA,EAAAA,CAAAA,EAAWrE,CAAaF,CAAAA,CAAAA,CAG7B"}
@@ -0,0 +1 @@
1
+ import{c as t,o as i,s,f as e,a as o,p as n,b as a}from"../floating-ui.dom-cc9126da.esm.js";import{P as h,a as l,b as r}from"./portal-utils.esm.js";class u{constructor(t){this.portalContainer=null,this.originalMenuParent=null,this.measuredMenuHeight=null,this.clonedMenu=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom",this.currentMiddlewareData=null,this.component=t}createPortalAppendContainer(){const t=document.createElement("div");return t.style.position="absolute",t.style.zIndex="9999",t.style.pointerEvents="none",t.style.width="auto",t.style.minWidth="auto",t.className="nile-auto-complete-portal-append",t}positionPortalAppend(){this.portalContainer&&this.component.dropdownElement&&(this.measureMenuHeight(),this.computeFloatingUIPosition())}measureMenuHeight(){!this.measuredMenuHeight&&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.measuredMenuHeight=this.portalContainer.offsetHeight,this.portalContainer.style.visibility="")}async computeFloatingUIPosition(){if(!this.portalContainer)return;const t=this.component.inputElement||this.component,i=this.portalContainer;try{const{x:s,y:e,placement:o,middlewareData:n}=await this.calculateFloatingUIPosition(t,i);this.applyFloatingUIPosition(i,t,s,e,o,n)}catch(t){console.warn("Floating UI positioning failed, falling back to simple positioning:",t),this.fallbackPositioning()}}async calculateFloatingUIPosition(i,s){const e=h.findBoundaryElements(i),o="top"===h.getOptimalPlacement(i)?"top-start":"bottom-start",n=this.createFloatingUIMiddleware(e);return await t(i,s,{placement:o,strategy:"fixed",middleware:n,platform:this.createCustomPlatform()})}createFloatingUIMiddleware(t){return[i(4),s({apply:this.handleSizeMiddleware.bind(this),padding:10,boundary:t}),e({fallbackPlacements:["bottom-start","top-start","bottom","top","bottom-end","top-end"],fallbackStrategy:"bestFit",padding:10,boundary:t}),o({padding:10,crossAxis:!0,boundary:t})]}handleSizeMiddleware({availableWidth:t,availableHeight:i,elements:s,rects:e}){const o=h.calculateOptimalHeight(e.reference,window.innerHeight,this.currentPlacement);s.floating.style.maxHeight=`${o}px`,s.floating.style.setProperty("--auto-size-available-width",`${t}px`),s.floating.style.setProperty("--auto-size-available-height",`${o}px`)}createCustomPlatform(){return n}applyFloatingUIPosition(t,i,s,e,o,n){const a=i.getBoundingClientRect();Object.assign(t.style,{left:`${a.left}px`,top:`${e}px`,position:"fixed",pointerEvents:"auto",width:"auto",minWidth:"auto"}),this.currentPlacement=o,this.currentMiddlewareData=n,h.applyCollisionData(t,n,o);const l=o.split("-")[0];t.className=`nile-auto-complete-portal-append menu__listbox--${l}`}fallbackPositioning(){if(!this.portalContainer)return;const t=(this.component.inputElement||this.component).getBoundingClientRect(),i=window.innerHeight;this.measuredMenuHeight;const s=i-t.bottom,e=t.top;let o,n,a;e>s?(a=Math.max(e-20,100),o=Math.max(t.top-a-4,10),n="top"):(a=Math.max(s-20,100),o=t.bottom+4,n="bottom"),this.portalContainer.style.left=`${t.left}px`,this.portalContainer.style.top=`${o}px`,this.portalContainer.style.width="auto",this.portalContainer.style.minWidth="auto",this.portalContainer.style.maxHeight=`${a}px`,this.portalContainer.style.pointerEvents="auto",this.portalContainer.className=`nile-auto-complete-portal-append menu__listbox--${n}`,this.calculateAndSetAutoSizeProperties(t,o,n)}calculateAndSetAutoSizeProperties(t,i,s){if(!this.portalContainer)return;const e=window.innerHeight,o=window.innerWidth;let n;n="top"===s?t.top-10:e-t.bottom-10;const a=Math.min(t.width,o-t.left-10);this.portalContainer.style.setProperty("--auto-size-available-height",`${Math.max(n,100)}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${Math.max(a,200)}px`)}updatePortalAppendPosition(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}handleWindowResize(){this.component.portal&&this.portalContainer&&this.positionPortalAppend()}setupAutoUpdatePositioning(){this.portalContainer&&this.component&&(this.cleanupAutoUpdatePositioning(),this.cleanupAutoUpdate=a(this.component,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 t=h.generateStyleId();if(document.getElementById(t))return;const i=this.component.constructor.styles;if(!i)return;const s=document.createElement("style");s.id=t,s.textContent=h.extractStylesAsCSS(i),document.head.appendChild(s),this.portalContainer.t=t}adoptStylesToPortalAppend(){this.portalContainer&&this.injectStylesToDocument()}setupPortalAppend(){this.component.portal&&this.component.updateComplete.then((()=>{setTimeout((()=>{const t=this.component.shadowRoot?.querySelector("#content-menu")||this.component.querySelector("#content-menu");t&&this.component.isDropdownOpen&&(this.originalMenuParent=t.parentElement,this.clonedMenu=this.createPortalMenu(),this.portalContainer=this.createPortalAppendContainer(),this.portalContainer.appendChild(this.clonedMenu),document.body.appendChild(this.portalContainer),this.adoptStylesToPortalAppend(),this.clonedMenu.style.display="",this.positionPortalAppend(),this.setupPortalEventListeners(),this.setupAutoUpdatePositioning(),window.addEventListener("resize",this.handleWindowResize.bind(this)))}),10)}))}createPortalMenu(){return l.createPortalMenu(this.component)}setupPortalEventListeners(){r.setupPortalEventListeners(this.clonedMenu,this.component)}cleanupPortalAppend(){if(this.cleanupAutoUpdatePositioning(),this.portalContainer&&this.portalContainer.parentNode){const t=this.portalContainer.t;if(t){const i=document.getElementById(t);i&&i.remove()}this.portalContainer.parentNode.removeChild(this.portalContainer)}window.removeEventListener("resize",this.handleWindowResize.bind(this)),this.portalContainer=null,this.originalMenuParent=null,this.clonedMenu=null,this.measuredMenuHeight=null,this.currentPlacement="bottom",this.currentMiddlewareData=null}get portalContainerElement(){return this.portalContainer}resetMeasuredHeight(){this.measuredMenuHeight=null}updatePortalOptions(){this.portalContainer&&this.clonedMenu&&(l.updatePortalMenuItems(this.clonedMenu,this.component),this.forceReposition())}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 t=(this.component.inputElement||this.component).getBoundingClientRect(),i=window.innerHeight-t.bottom,s=t.top,e=this.currentPlacement.startsWith("top"),o=this.currentPlacement.startsWith("bottom");return!(e&&i>s)&&!(o&&s>i)}}export{u as A};
@@ -0,0 +1,2 @@
1
+ System.register([],function(_export,_context){"use strict";var t,e,a;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 _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);}return{setters:[],execute:function execute(){_export("P",t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,null,[{key:"calculateAvailableSpace",value:function calculateAvailableSpace(_t){var e=_t.getBoundingClientRect(),a=window.innerHeight,s=a-e.bottom;return{spaceAbove:e.top,spaceBelow:s,viewportHeight:a};}},{key:"getOptimalPlacement",value:function getOptimalPlacement(_t2){var _this$calculateAvaila=this.calculateAvailableSpace(_t2),e=_this$calculateAvaila.spaceAbove,a=_this$calculateAvaila.spaceBelow;return a<200&&e>a?"top":"bottom";}},{key:"findBoundaryElements",value:function findBoundaryElements(_t3){var e=[];var a=_t3.parentElement;for(;a&&a!==document.body;){var _t4=window.getComputedStyle(a),s=_t4.overflow,i=_t4.overflowY,o=_t4.overflowX;"auto"!==s&&"scroll"!==s&&"auto"!==i&&"scroll"!==i&&"auto"!==o&&"scroll"!==o||e.push(a),(a.hasAttribute("data-floating-boundary")||a.classList.contains("floating-boundary")||a.classList.contains("scroll-container"))&&e.push(a),a=a.parentElement;}return e.length>0?e:void 0;}},{key:"calculateOptimalHeight",value:function calculateOptimalHeight(_t5,e,a){var s=e-(_t5.y+_t5.height),i=_t5.y;return i>s?Math.max(i-20,100):s>i?Math.max(s-20,100):Math.max(Math.min(i,s)-20,100);}},{key:"extractStylesAsCSS",value:function extractStylesAsCSS(_t6){var _this=this;return"string"==typeof _t6?_t6:Array.isArray(_t6)?_t6.map(function(_t7){return _this.extractStylesAsCSS(_t7);}).join("\n"):_t6&&"object"==_typeof(_t6)&&_t6.cssText?_t6.cssText:"";}},{key:"generateStyleId",value:function generateStyleId(){return"nile-auto-complete-styles-".concat(Math.random().toString(36).substring(2,11));}},{key:"isPositioningOptimal",value:function isPositioningOptimal(_t8,e){var _this$calculateAvaila2=this.calculateAvailableSpace(e),a=_this$calculateAvaila2.spaceAbove,s=_this$calculateAvaila2.spaceBelow,i=_t8.startsWith("top"),o=_t8.startsWith("bottom");return!(i&&s>a)&&!(o&&a>s);}},{key:"applyCollisionData",value:function applyCollisionData(_t9,e,a){if(e.flip){var s=e.flip.overflows;if(_t9.setAttribute("data-placement",a),s&&s.length>0){var _e=s.map(function(_t10){return _t10.placement;}).join(",");_t9.setAttribute("data-overflow",_e);}else _t9.removeAttribute("data-overflow");}if(e.shift){var _e$shift=e.shift,_a=_e$shift.x,_s=_e$shift.y;void 0===_a||void 0===_s||0===_a&&0===_s?_t9.removeAttribute("data-shift"):_t9.setAttribute("data-shift","".concat(_a,",").concat(_s));}if(e.size){var _e$size=e.size,_a2=_e$size.availableWidth,_s2=_e$size.availableHeight;void 0!==_a2&&_t9.setAttribute("data-available-width",_a2.toString()),void 0!==_s2&&_t9.setAttribute("data-available-height",_s2.toString());}}}]);}());_export("a",e=/*#__PURE__*/function(){function e(){_classCallCheck(this,e);}return _createClass(e,null,[{key:"createBaseMenu",value:function createBaseMenu(t){var _e2=document.createElement("nile-menu");return _e2.id="content-menu",_e2.className=t.enableVirtualScroll?"virtualized__menu":"",t.enableVirtualScroll,_e2.setAttribute("exportparts","menu__items-wrapper:options__wrapper"),_e2;}},{key:"addMenuItems",value:function addMenuItems(t,_e3){var _this2=this;(_e3.menuItems||[]).forEach(function(a){var s=_this2.createMenuItem(a,_e3);t.appendChild(s);});}},{key:"createMenuItem",value:function createMenuItem(t,_e4){var a=document.createElement("nile-menu-item"),s=_e4.renderItemFunction?_e4.renderItemFunction(t):t;return a.setAttribute("value",String(s)),a.innerHTML=String(s),a;}},{key:"createPortalMenu",value:function createPortalMenu(t){var _e5=this.createBaseMenu(t);return this.addMenuItems(_e5,t),_e5;}},{key:"updatePortalMenuItems",value:function updatePortalMenuItems(t,_e6){if(!t)return;t.querySelectorAll("nile-menu-item").forEach(function(t){return t.remove();}),this.addMenuItems(t,_e6);}}]);}());_export("b",a=/*#__PURE__*/function(){function a(){_classCallCheck(this,a);}return _createClass(a,null,[{key:"setupPortalEventListeners",value:function setupPortalEventListeners(t,e){t&&this.setupMenuSelectListeners(t,e);}},{key:"setupMenuSelectListeners",value:function setupMenuSelectListeners(t,e){t&&t.addEventListener("nile-select",function(t){var _a3=t;e.handleSelect&&e.handleSelect(_a3);});}}]);}());}};});
2
+ //# sourceMappingURL=portal-utils.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-utils.cjs.js","sources":["../../../src/nile-auto-complete/portal-utils.ts"],"sourcesContent":["import { \n type Placement,\n type MiddlewareData\n} from '@floating-ui/dom';\n\nexport class PortalUtils {\n static calculateAvailableSpace(referenceElement: HTMLElement): {\n spaceAbove: number;\n spaceBelow: number;\n viewportHeight: number;\n } {\n const rect = referenceElement.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - rect.bottom;\n const spaceAbove = rect.top;\n \n return { spaceAbove, spaceBelow, viewportHeight };\n }\n\n static getOptimalPlacement(referenceElement: HTMLElement): Placement {\n const { spaceAbove, spaceBelow } = this.calculateAvailableSpace(referenceElement);\n \n if (spaceBelow < 200 && spaceAbove > spaceBelow) {\n return 'top';\n }\n \n return 'bottom';\n }\n\n static findBoundaryElements(component: HTMLElement): Element[] | undefined {\n const boundaryElements: Element[] = [];\n \n let currentElement = component.parentElement;\n \n while (currentElement && currentElement !== document.body) {\n const computedStyle = window.getComputedStyle(currentElement);\n const overflow = computedStyle.overflow;\n const overflowY = computedStyle.overflowY;\n const overflowX = computedStyle.overflowX;\n \n if (overflow === 'auto' || overflow === 'scroll' || \n overflowY === 'auto' || overflowY === 'scroll' ||\n overflowX === 'auto' || overflowX === 'scroll') {\n boundaryElements.push(currentElement);\n }\n \n if (currentElement.hasAttribute('data-floating-boundary') ||\n currentElement.classList.contains('floating-boundary') ||\n currentElement.classList.contains('scroll-container')) {\n boundaryElements.push(currentElement);\n }\n \n currentElement = currentElement.parentElement;\n }\n \n return boundaryElements.length > 0 ? boundaryElements : undefined;\n }\n\n static calculateOptimalHeight(\n referenceRect: { x: number; y: number; width: number; height: number },\n viewportHeight: number,\n placement: Placement\n ): number {\n const spaceBelow = viewportHeight - (referenceRect.y + referenceRect.height);\n const spaceAbove = referenceRect.y;\n \n if (spaceAbove > spaceBelow) {\n return Math.max(spaceAbove - 20, 100);\n }\n else if (spaceBelow > spaceAbove) {\n return Math.max(spaceBelow - 20, 100);\n }\n \n return Math.max(Math.min(spaceAbove, spaceBelow) - 20, 100);\n }\n\n static extractStylesAsCSS(styles: any): string {\n if (typeof styles === 'string') {\n return styles;\n }\n \n if (Array.isArray(styles)) {\n return styles.map(style => this.extractStylesAsCSS(style)).join('\\n');\n }\n \n if (styles && typeof styles === 'object' && styles.cssText) {\n return styles.cssText;\n }\n \n return '';\n }\n\n static generateStyleId(): string {\n return `nile-auto-complete-styles-${Math.random().toString(36).substring(2, 11)}`;\n }\n\n static isPositioningOptimal(\n placement: Placement,\n referenceElement: HTMLElement\n ): boolean {\n const { spaceAbove, spaceBelow } = this.calculateAvailableSpace(referenceElement);\n \n const isAbove = placement.startsWith('top');\n const isBelow = placement.startsWith('bottom');\n \n if (isAbove && spaceBelow > spaceAbove) return false;\n if (isBelow && spaceAbove > spaceBelow) return false;\n \n return true;\n }\n\n static applyCollisionData(\n element: HTMLElement,\n middlewareData: MiddlewareData,\n placement: Placement\n ): void {\n if (middlewareData.flip) {\n const { overflows } = middlewareData.flip;\n \n element.setAttribute('data-placement', placement);\n \n if (overflows && overflows.length > 0) {\n const overflowPlacements = overflows.map(overflow => overflow.placement).join(',');\n element.setAttribute('data-overflow', overflowPlacements);\n } else {\n element.removeAttribute('data-overflow');\n }\n }\n\n if (middlewareData.shift) {\n const { x, y } = middlewareData.shift;\n \n if (x !== undefined && y !== undefined && (x !== 0 || y !== 0)) {\n element.setAttribute('data-shift', `${x},${y}`);\n } else {\n element.removeAttribute('data-shift');\n }\n }\n\n if (middlewareData.size) {\n const { availableWidth, availableHeight } = middlewareData.size;\n \n if (availableWidth !== undefined) {\n element.setAttribute('data-available-width', availableWidth.toString());\n }\n if (availableHeight !== undefined) {\n element.setAttribute('data-available-height', availableHeight.toString());\n }\n }\n }\n}\n\nexport class PortalContentUtils {\n static createBaseMenu(component: any): HTMLElement {\n const menu = document.createElement('nile-menu');\n menu.id = 'content-menu';\n menu.className = component.enableVirtualScroll ? 'virtualized__menu' : '';\n \n if (component.enableVirtualScroll) {\n menu.setAttribute('exportparts', 'menu__items-wrapper:options__wrapper');\n } else {\n menu.setAttribute('exportparts', 'menu__items-wrapper:options__wrapper');\n }\n \n return menu;\n }\n\n static addMenuItems(menu: HTMLElement, component: any): void {\n const menuItems = component.menuItems || [];\n \n menuItems.forEach((item: any) => {\n const menuItem = this.createMenuItem(item, component);\n menu.appendChild(menuItem);\n });\n }\n\n static createMenuItem(item: any, component: any): HTMLElement {\n const menuItem = document.createElement('nile-menu-item');\n const value = component.renderItemFunction ? component.renderItemFunction(item) : item;\n menuItem.setAttribute('value', String(value));\n menuItem.innerHTML = String(value);\n return menuItem;\n }\n\n static createPortalMenu(component: any): HTMLElement {\n const menu = this.createBaseMenu(component);\n this.addMenuItems(menu, component);\n return menu;\n }\n\n static updatePortalMenuItems(clonedMenu: HTMLElement, component: any): void {\n if (!clonedMenu) return;\n\n // Remove existing items\n const existingItems = clonedMenu.querySelectorAll('nile-menu-item');\n existingItems.forEach(item => item.remove());\n\n // Add updated items\n this.addMenuItems(clonedMenu, component);\n }\n}\n\nexport class PortalEventUtils {\n static setupPortalEventListeners(clonedMenu: HTMLElement, component: any): void {\n if (!clonedMenu) return;\n\n this.setupMenuSelectListeners(clonedMenu, component);\n }\n\n static setupMenuSelectListeners(clonedMenu: HTMLElement, component: any): void {\n if (!clonedMenu) return;\n\n clonedMenu.addEventListener('nile-select', (event: Event) => {\n const customEvent = event as CustomEvent;\n if (component.handleSelect) {\n // Call the component's handleSelect method directly\n component.handleSelect(customEvent);\n }\n });\n }\n}\n"],"names":["PortalUtils","calculateAvailableSpace","referenceElement","rect","getBoundingClientRect","viewportHeight","window","innerHeight","spaceBelow","bottom","spaceAbove","top","key","value","getOptimalPlacement","_this$calculateAvaila","this","findBoundaryElements","component","boundaryElements","currentElement","parentElement","document","body","computedStyle","getComputedStyle","overflow","overflowY","overflowX","push","hasAttribute","classList","contains","length","undefined","calculateOptimalHeight","referenceRect","placement","y","height","Math","max","min","extractStylesAsCSS","styles","Array","isArray","map","style","join","_typeof","cssText","generateStyleId","concat","random","toString","substring","isPositioningOptimal","_this$calculateAvaila2","isAbove","startsWith","isBelow","applyCollisionData","element","middlewareData","flip","overflows","setAttribute","overflowPlacements","removeAttribute","shift","_e$shift","x","size","_e$size","availableWidth","availableHeight","PortalContentUtils","createBaseMenu","menu","createElement","id","className","enableVirtualScroll","addMenuItems","menuItems","forEach","item","menuItem","createMenuItem","appendChild","renderItemFunction","String","innerHTML","createPortalMenu","updatePortalMenuItems","clonedMenu","querySelectorAll","remove","PortalEventUtils","a","_classCallCheck","_createClass","setupPortalEventListeners","setupMenuSelectListeners","addEventListener","event","customEvent","handleSelect"],"mappings":"itCAKaA,CAAAA,kCAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,UAAAA,YAAAA,CAAAA,CAAAA,QAAAA,GAAAA,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:s,viewportHeight:a}}static getOptimalPlacement(t){const{spaceAbove:e,spaceBelow:a}=this.calculateAvailableSpace(t);return a<200&&e>a?"top":"bottom"}static findBoundaryElements(t){const e=[];let a=t.parentElement;for(;a&&a!==document.body;){const t=window.getComputedStyle(a),s=t.overflow,i=t.overflowY,o=t.overflowX;"auto"!==s&&"scroll"!==s&&"auto"!==i&&"scroll"!==i&&"auto"!==o&&"scroll"!==o||e.push(a),(a.hasAttribute("data-floating-boundary")||a.classList.contains("floating-boundary")||a.classList.contains("scroll-container"))&&e.push(a),a=a.parentElement}return e.length>0?e:void 0}static calculateOptimalHeight(t,e,a){const s=e-(t.y+t.height),i=t.y;return i>s?Math.max(i-20,100):s>i?Math.max(s-20,100):Math.max(Math.min(i,s)-20,100)}static extractStylesAsCSS(t){return"string"==typeof t?t:Array.isArray(t)?t.map((t=>this.extractStylesAsCSS(t))).join("\n"):t&&"object"==typeof t&&t.cssText?t.cssText:""}static generateStyleId(){return`nile-auto-complete-styles-${Math.random().toString(36).substring(2,11)}`}static isPositioningOptimal(t,e){const{spaceAbove:a,spaceBelow:s}=this.calculateAvailableSpace(e),i=t.startsWith("top"),o=t.startsWith("bottom");return!(i&&s>a)&&!(o&&a>s)}static applyCollisionData(t,e,a){if(e.flip){const{overflows:s}=e.flip;if(t.setAttribute("data-placement",a),s&&s.length>0){const e=s.map((t=>t.placement)).join(",");t.setAttribute("data-overflow",e)}else t.removeAttribute("data-overflow")}if(e.shift){const{x:a,y:s}=e.shift;void 0===a||void 0===s||0===a&&0===s?t.removeAttribute("data-shift"):t.setAttribute("data-shift",`${a},${s}`)}if(e.size){const{availableWidth:a,availableHeight:s}=e.size;void 0!==a&&t.setAttribute("data-available-width",a.toString()),void 0!==s&&t.setAttribute("data-available-height",s.toString())}}}class e{static createBaseMenu(t){const e=document.createElement("nile-menu");return e.id="content-menu",e.className=t.enableVirtualScroll?"virtualized__menu":"",t.enableVirtualScroll,e.setAttribute("exportparts","menu__items-wrapper:options__wrapper"),e}static addMenuItems(t,e){(e.menuItems||[]).forEach((a=>{const s=this.createMenuItem(a,e);t.appendChild(s)}))}static createMenuItem(t,e){const a=document.createElement("nile-menu-item"),s=e.renderItemFunction?e.renderItemFunction(t):t;return a.setAttribute("value",String(s)),a.innerHTML=String(s),a}static createPortalMenu(t){const e=this.createBaseMenu(t);return this.addMenuItems(e,t),e}static updatePortalMenuItems(t,e){if(!t)return;t.querySelectorAll("nile-menu-item").forEach((t=>t.remove())),this.addMenuItems(t,e)}}class a{static setupPortalEventListeners(t,e){t&&this.setupMenuSelectListeners(t,e)}static setupMenuSelectListeners(t,e){t&&t.addEventListener("nile-select",(t=>{const a=t;e.handleSelect&&e.handleSelect(a)}))}}export{t as P,e as a,a as b};
@@ -1,2 +1,2 @@
1
- System.register(["./nile-chip.cjs.js","tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileChipCjsJs){_export("NileChip",_nileChipCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_nileChipCssCjsJs){},function(_litDirectivesClassMapJs){},function(_internalSlotCjsJs){},function(_internalNileElementCjsJs){}],execute:function execute(){}};});
1
+ System.register(["./nile-chip.cjs.js","tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js"],function(_export,_context){"use strict";return{setters:[function(_nileChipCjsJs){_export("NileChip",_nileChipCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_nileChipCssCjsJs){},function(_litDirectivesClassMapJs){},function(_internalSlotCjsJs){},function(_internalNileElementCjsJs){},function(_litDirectivesUnsafeHtmlJs){}],execute:function execute(){}};});
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- export{N as NileChip}from"./nile-chip.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"./nile-chip.css.esm.js";import"lit/directives/class-map.js";import"../internal/slot.esm.js";import"../internal/nile-element.esm.js";
1
+ export{N as NileChip}from"./nile-chip.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"./nile-chip.css.esm.js";import"lit/directives/class-map.js";import"../internal/slot.esm.js";import"../internal/nile-element.esm.js";import"lit/directives/unsafe-html.js";
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,o,l,h,n,r,a,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,p;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.state;s=_litDecoratorsJs.query;o=_litDecoratorsJs.property;l=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){h=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",p=/*#__PURE__*/function(_a){function p(){var _this;_classCallCheck(this,p);_this=_callSuper(this,p,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.isDropdownOpen=!1);};return _this;}_inherits(p,_a);return _createClass(p,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(p,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet(p,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this3.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(p,"disconnectedCallback",this,3)([]),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this4=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled}),e?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,e){return i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0}),_this4.errorIndexes.includes(e)?"error":"normal",function(){return _this4.handleRemove(t);},"normal"!==_this4.tagVariant,t);}),this.noAutoComplete?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus):i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject5||(_templateObject5=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[].concat(_toConsumableArray(this.tags),[t.detail.value]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput());}},{key:"handleRemove",value:function handleRemove(t){this.tags=this.tags.filter(function(i){return i!==t;}),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[].concat(_toConsumableArray(this.filteredAutoCompleteOptions),[t])),this.emit("nile-chip-change",{value:this.tags});}},{key:"handleInputChange",value:function handleInputChange(t){this.inputValue=t.detail.value;}},{key:"handleInputKeydown",value:function handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){this.noAutoComplete||(this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this5=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this5.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[h];}}]);}(a));t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),_export("N",p=t([l("nile-chip")],p));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-chip.css.cjs.js","lit/directives/class-map.js","../internal/slot.cjs.js","../internal/nile-element.cjs.js","lit/directives/unsafe-html.js"],function(_export,_context){"use strict";var t,i,e,s,o,l,h,n,r,a,p,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,c;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){e=_litDecoratorsJs.state;s=_litDecoratorsJs.query;o=_litDecoratorsJs.property;l=_litDecoratorsJs.customElement;},function(_nileChipCssCjsJs){h=_nileChipCssCjsJs.s;},function(_litDirectivesClassMapJs){n=_litDirectivesClassMapJs.classMap;},function(_internalSlotCjsJs){r=_internalSlotCjsJs.H;},function(_internalNileElementCjsJs){a=_internalNileElementCjsJs.N;},function(_litDirectivesUnsafeHtmlJs){p=_litDirectivesUnsafeHtmlJs.unsafeHTML;}],execute:function execute(){_export("N",c=/*#__PURE__*/function(_a){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.hasSlotController=new r(_assertThisInitialized(_this),"help-text","label"),_this.tags=[],_this.inputValue="",_this.isDropdownOpen=!1,_this.tooltips=[],_this.warning=!1,_this.noAutoComplete=!1,_this.error=!1,_this.success=!1,_this.noDuplicates=!1,_this.label="",_this.tagVariant="",_this.acceptUserInput=!1,_this.clearable=!1,_this.placeholder="type here...",_this.readonly=!1,_this.disabled=!1,_this.portal=!1,_this.enableVirtualScroll=!1,_this.autoCompleteOptions=[],_this.filteredAutoCompleteOptions=[],_this.value=[],_this.noWrap=!1,_this.loading=!1,_this.errorIndexes=[],_this.helpText="",_this.errorMessage="",_this.filterFunction=function(t,i){return t.toLowerCase().includes(i.toLowerCase());},_this.renderItemFunction=function(t){return t;},_this.showTooltip=!1,_this.handleDocumentClick=function(t){t.composedPath().includes(_assertThisInitialized(_this))||(_this.isDropdownOpen=!1);};return _this;}_inherits(c,_a);return _createClass(c,[{key:"updated",value:function updated(t){var _this2=this;if(_superPropGet(c,"updated",this,3)([t]),t.has("autoCompleteOptions")){var _t=this.autoCompleteOptions;if("string"==typeof _t)try{_t=JSON.parse(_t);}catch(i){_t=[];}this.filteredAutoCompleteOptions=Array.isArray(_t)?_toConsumableArray(_t):[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this2.value.includes(t);}));}t.has("value")&&(this.tags=_toConsumableArray(this.value),this.onTagsChanged()),t.has("tags")&&this.onTagsChanged();}},{key:"connectedCallback",value:function connectedCallback(){var _this3=this;_superPropGet(c,"connectedCallback",this,3)([]),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this3.value.includes(t);})),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(c,"disconnectedCallback",this,3)([]),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy");}},{key:"render",value:function render(){var _this4=this;var t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");var e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"form-control\"\n class=","\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=","\n >\n <slot name=\"label\">","</slot>\n </label>\n\n <div\n part='base' \n class=","\n >\n ","\n\n <div class=\"nile-chip__auto-complete\">\n ","\n </div>\n </div>\n ","\n ","\n </div>\n "])),n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled}),e?"false":"true",this.label,n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen}),this.tags.map(function(t,e){var s=_this4.tooltips[e],o=i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-tag\n class=","\n .variant=","\n @nile-remove=","\n removable\n ?pill=","\n >\n ","\n </nile-tag>\n "])),n({"nile-chip__tags":!0}),_this4.errorIndexes.includes(e)?"error":"normal",function(){return _this4.handleRemove(t);},"normal"!==_this4.tagVariant,p(t));return _this4.showTooltip&&s?i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-lite-tooltip allowHTML .content=",">\n ","\n </nile-lite-tooltip>\n "])),s,o):o;}),this.noAutoComplete?i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-input\n .value=","\n .placeholder=","\n .disabled=","\n ?no-border=","\n ?no-outline=","\n ?no-padding=","\n @nile-input=","\n @keydown=","\n @focus=","\n exportparts=\"input\"\n ></nile-input>\n "])),this.inputValue,this.placeholder,this.disabled,!0,!0,!0,this.handleInputChange,this.handleInputKeydown,this.handleFocus):i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-auto-complete\n .enableVirtualScroll=","\n .allMenuItems=","\n .filterFunction=","\n .renderItemFunction=","\n .showTooltips=","\n .loading=\"","\"\n .value=","\n ?isDropdownOpen=","\n .noBorder=","\n .noOutline=","\n .noPadding=","\n .disabled=","\n .portal=","\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=","\n @nile-input=","\n @keydown=","\n @nile-focus=","\n @nile-complete=","\n ></nile-auto-complete>\n "])),this.enableVirtualScroll,this.filteredAutoCompleteOptions,this.filterFunction,this.renderItemFunction,this.showTooltip,this.loading,this.inputValue,this.isDropdownOpen,!0,!0,!0,this.disabled,this.portal,this.placeholder,this.handleInputChange,this.handleInputKeydown,this.handleFocus,this.handleSelect),s?i(_templateObject6||(_templateObject6=_taggedTemplateLiteral([" <nile-form-help-text>","</nile-form-help-text> "])),this.helpText):"",o?i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-form-error-message\n >","</nile-form-error-message\n >\n "])),this.errorMessage):"");}},{key:"handleSelect",value:function handleSelect(t){var i=t.detail.value,e=this.autoCompleteOptions.find(function(t){return t.name===i||t.id===i;});var s=null;if(e!==null&&e!==void 0&&e.tooltip){var _e$tooltip=e.tooltip,_t2=_e$tooltip.content,_i=_e$tooltip["for"];_i&&"tag"!==_i||(s=_t2);}this.noDuplicates&&this.tags.includes(i)||(this.tags=[].concat(_toConsumableArray(this.tags),[i]),this.tooltips=[].concat(_toConsumableArray(this.tooltips),[s]),this.emit("nile-chip-change",{value:this.tags}),this.resetInput());}},{key:"handleRemove",value:function handleRemove(t){this.tags=this.tags.filter(function(i){return i!==t;}),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[].concat(_toConsumableArray(this.filteredAutoCompleteOptions),[t])),this.emit("nile-chip-change",{value:this.tags});}},{key:"handleInputChange",value:function handleInputChange(t){this.inputValue=t.detail.value;}},{key:"handleInputKeydown",value:function handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[].concat(_toConsumableArray(this.tags),[this.inputValue]),this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"));}},{key:"handleFocus",value:function handleFocus(){this.noAutoComplete||(this.isDropdownOpen=!0);}},{key:"onTagsChanged",value:function onTagsChanged(){var _this5=this;this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter(function(t){return!_this5.tags.includes(t);}));}},{key:"resetInput",value:function resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus());}}],[{key:"styles",get:function get(){return[h];}}]);}(a));t([e()],c.prototype,"tags",void 0),t([e()],c.prototype,"inputValue",void 0),t([e()],c.prototype,"isDropdownOpen",void 0),t([e()],c.prototype,"tooltips",void 0),t([s("nile-auto-complete")],c.prototype,"autoComplete",void 0),t([o({type:Boolean})],c.prototype,"warning",void 0),t([o({type:Boolean})],c.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],c.prototype,"error",void 0),t([o({type:Boolean})],c.prototype,"success",void 0),t([o({type:Boolean})],c.prototype,"noDuplicates",void 0),t([o()],c.prototype,"label",void 0),t([o({type:String})],c.prototype,"tagVariant",void 0),t([o({type:Boolean})],c.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],c.prototype,"clearable",void 0),t([o()],c.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"portal",void 0),t([o({type:Boolean})],c.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],c.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],c.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],c.prototype,"value",void 0),t([o({type:Boolean})],c.prototype,"noWrap",void 0),t([o({type:Boolean})],c.prototype,"loading",void 0),t([o({type:Array})],c.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],c.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([o({attribute:!1})],c.prototype,"filterFunction",void 0),t([o({attribute:!1})],c.prototype,"renderItemFunction",void 0),t([o({type:Boolean})],c.prototype,"showTooltip",void 0),_export("N",c=t([l("nile-chip")],c));}};});
2
2
  //# sourceMappingURL=nile-chip.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n if (!path.includes(this)) {\n this.isDropdownOpen = false; \n }\n };\n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map(\n (tag, index) => html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index) ? 'error' : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${tag}\n </nile-tag>\n `\n )}\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-complete=${this.handleSelect}\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n // Add the selected value to the tags array only if it doesn't already exist\n if (!this.noDuplicates || !this.tags.includes(event.detail.value)) {\n this.tags = [...this.tags, event.detail.value];\n this.emit('nile-chip-change', { value: this.tags });\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.isDropdownOpen = true;\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","p","constructor","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","handleDocumentClick","event","composedPath","_this","_inherits","_a","_createClass","key","updated","changedProperties","_this2","super","has","options","JSON","parse","e","Array","isArray","_toConsumableArray","filter","option","onTagsChanged","connectedCallback","document","addEventListener","emit","disconnectedCallback","removeEventListener","render","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","_templateObject2","handleRemove","_templateObject3","handleInputChange","handleInputKeydown","handleFocus","_templateObject4","handleSelect","_templateObject5","_templateObject6","detail","concat","resetInput","preventDefault","autoComplete","get","styles","NileElement","__decorate","state","prototype","query","property","type","Boolean","String","reflect","attribute","_export","customElement"],"mappings":"+5JAyBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,qCAKYC,KAAAA,CAAiBC,iBAAAA,CAAG,GAAIC,CAAAA,CAAAA,CAAAA,sBAAAA,CAAAA,KAAAA,EAEvC,WACA,CAAA,OAAA,CAAA,CAGOF,KAAAA,CAAIG,IAAAA,CAAa,EAEjBH,CAAAA,KAAAA,CAAUI,UAAW,CAAA,EAAA,CAErBJ,KAAAA,CAAcK,cAAAA,CAAAA,CAAY,CAKNL,CAAAA,KAAAA,CAAOM,OAAG,CAAA,CAAA,CAAA,CAEZN,KAAAA,CAAcO,cAAAA,CAAAA,CAAG,CAIfP,CAAAA,KAAAA,CAAKQ,KAAG,CAAA,CAAA,CAAA,CAGRR,KAAAA,CAAOS,OAAAA,CAAAA,CAAG,CAGVT,CAAAA,KAAAA,CAAYU,YAAG,CAAA,CAAA,CAAA,CAGhCV,KAAAA,CAAKW,KAAAA,CAAG,EAEQX,CAAAA,KAAAA,CAAAY,UAAqB,CAAA,EAAA,CAIpBZ,KAAAA,CAAea,eAAG,CAAA,CAAA,CAAA,CAGlBb,KAAAA,CAASc,SAAAA,CAAAA,CAAG,CAG7Bd,CAAAA,KAAAA,CAAWe,WAAG,CAAA,cAAA,CAGkBf,KAAAA,CAAQgB,QAAAA,CAAAA,CAAG,CAGXhB,CAAAA,KAAAA,CAAQiB,QAAG,CAAA,CAAA,CAAA,CAK1BjB,KAAAA,CAAmBkB,mBAAAA,CAAAA,CAAG,CAExBlB,CAAAA,KAAAA,CAAmBmB,mBAAU,CAAA,EAAA,CAE7BnB,KAAAA,CAA2BoB,2BAAAA,CAAU,EAErCpB,CAAAA,KAAAA,CAAKqB,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A,CAAA,CAA5BI,CAAS,CAAA,CAAEC,IAAMC,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAoCtG,CAAAkG,CAAAA,SAAAA,CAAA,cAAA,EAE3BF,CAAAA,CAAAA,CAAAA,CAAA,CAA1BI,CAAAA,CAAS,CAAEC,IAAAA,CAAMhD,SAAqCrD,CAAAkG,CAAAA,SAAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAEFF,CAAA,CAAA,CAApDI,EAAS,CAAEK,SAAAA,CAAW,WAAaD,CAAAA,OAAAA,CAAAA,CAAS,CAAsBxG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkG,UAAA,UAAA,CAAA,IAAA,EAAA,CAAA,CAEVF,CAAA,CAAA,CAAxDI,CAAS,CAAA,CAAEK,UAAW,eAAiBD,CAAAA,OAAAA,CAAAA,CAAS,CAA0BxG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkG,SAAA,CAAA,cAAA,CAAA,IAAA,IAE7CF,CAAA,CAAA,CAA7BI,CAAS,CAAA,CAAEK,SAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmKzG,EAAAkG,SAAA,CAAA,gBAAA,CAAA,IAAA,EAE3JF,CAAAA,CAAAA,CAAAA,CAAA,CAA7BI,CAAAA,CAAS,CAAEK,SAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkEzG,CAAAkG,CAAAA,SAAAA,CAAA,oBAAA,CAAA,IAAA,EAAA,CAAA,CAAAQ,OAAA,KA9E7E1G,EAAQgG,CAAA,CAAA,CADpBW,CAAc,CAAA,WAAA,CAAA,CAAA,CACF3G"}
1
+ {"version":3,"file":"nile-chip.cjs.js","sources":["../../../src/nile-chip/nile-chip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n PropertyValues,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-chip.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { HasSlotController } from '../internal/slot';\nimport NileElement, { NileFormControl } from '../internal/nile-element';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\n\ninterface CustomEventDetail {\n value: string;\n}\n\n@customElement('nile-chip')\nexport class NileChip extends NileElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'help-text',\n 'label'\n );\n\n @state() tags: string[] = [];\n\n @state() inputValue: string = '';\n\n @state() isDropdownOpen: boolean = false;\n @state() tooltips: (string | null)[] = [];\n\n @query('nile-auto-complete') autoComplete!: any;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n@property({ type: Boolean }) noAutoComplete = false;\n\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Disables the duplicate entries. */\n @property({ type: Boolean }) noDuplicates = false;\n\n /** The input's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n @property({ type: String }) tagVariant: string = ''; // can be '', 'normal', 'success', etc.\n\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) acceptUserInput = false;\n\n /** Adds a clear button when the input is not empty. */\n @property({ type: Boolean }) clearable = false;\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = 'type here...';\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When true, the dropdown menu will be appended to the document body instead of the parent container.\n * This is useful when the parent has overflow: hidden, clip-path, or transform applied.\n */\n @property({ type: Boolean, reflect: true }) portal = false;\n\n // AUTO-COMPLETE-OPTIONS\n\n /** Virtual scroll in dropdown options. */\n @property({ type: Boolean }) enableVirtualScroll = false;\n\n @property({ type: Array }) autoCompleteOptions: any[] = [];\n\n @property({ type: Array }) filteredAutoCompleteOptions: any[] = [];\n\n @property({ type: Array }) value: any[] = [];\n\n @property({ type: Boolean }) noWrap: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ type: Array }) errorIndexes: number[] = [];\n\n @property({ attribute: 'help-text', reflect: true }) helpText = '';\n\n @property({ attribute: 'error-message', reflect: true }) errorMessage = '';\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean = (item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n\n @property({ type: Boolean }) showTooltip: boolean = false;\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('autoCompleteOptions')) {\n let options = this.autoCompleteOptions;\n if (typeof options === 'string') {\n try {\n options = JSON.parse(options);\n } catch (e) {\n options = [];\n }\n }\n this.filteredAutoCompleteOptions = Array.isArray(options) ? [...options] : [];\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n }\n if (changedProperties.has('value')){\n this.tags = [...this.value];\n this.onTagsChanged();\n }\n if (changedProperties.has('tags')){\n this.onTagsChanged();\n }\n }\n \n private handleDocumentClick = (event: MouseEvent) => {\n const path = event.composedPath();\n if (!path.includes(this)) {\n this.isDropdownOpen = false; \n }\n };\n \n connectedCallback() {\n super.connectedCallback();\n document.addEventListener('click', this.handleDocumentClick);\n if (this.noDuplicates) {\n this.filteredAutoCompleteOptions =\n this.filteredAutoCompleteOptions.filter(\n option => !this.value.includes(option)\n );\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener('click', this.handleDocumentClick);\n this.emit('nile-destroy');\n }\n\n render() {\n // Check if slots are present\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n\n // Check if label and help text are present\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': true,\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText,\n 'nile-chip--disabled': this.disabled,\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div\n part='base' \n class=${classMap({\n 'nile-chip': true,\n 'nile-chip--warning': this.warning,\n 'nile-chip--error': this.error,\n 'nile-chip--success': this.success,\n 'nile-chip--no-wrap': this.noWrap,\n 'nile-chip--open': this.isDropdownOpen, \n })}\n >\n ${this.tags.map((tag, index) => {\n const tooltipContent = this.tooltips[index];\n const tagTemplate = html`\n <nile-tag\n class=${classMap({\n 'nile-chip__tags': true,\n })}\n .variant=${this.errorIndexes.includes(index)\n ? 'error'\n : 'normal'}\n @nile-remove=${() => this.handleRemove(tag)}\n removable\n ?pill=${this.tagVariant !== 'normal'}\n >\n ${unsafeHTML(tag)}\n </nile-tag>\n `;\n\n if (this.showTooltip && tooltipContent) {\n return html`\n <nile-lite-tooltip allowHTML .content=${tooltipContent}>\n ${tagTemplate}\n </nile-lite-tooltip>\n `;\n }\n\n return tagTemplate;\n })}\n\n <div class=\"nile-chip__auto-complete\">\n ${this.noAutoComplete\n ? html`\n <nile-input\n .value=${this.inputValue}\n .placeholder=${this.placeholder}\n .disabled=${this.disabled}\n ?no-border=${true}\n ?no-outline=${true}\n ?no-padding=${true}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @focus=${this.handleFocus}\n exportparts=\"input\"\n ></nile-input>\n `\n : html`\n <nile-auto-complete\n .enableVirtualScroll=${this.enableVirtualScroll}\n .allMenuItems=${this.filteredAutoCompleteOptions}\n .filterFunction=${this.filterFunction}\n .renderItemFunction=${this.renderItemFunction}\n .showTooltips=${this.showTooltip}\n .loading=\"${this.loading}\"\n .value=${this.inputValue}\n ?isDropdownOpen=${this.isDropdownOpen}\n .noBorder=${true}\n .noOutline=${true}\n .noPadding=${true}\n .disabled=${this.disabled}\n .portal=${this.portal}\n openOnFocus\n exportparts=\"options__wrapper, input, base\"\n .placeholder=${this.placeholder}\n @nile-input=${this.handleInputChange}\n @keydown=${this.handleInputKeydown}\n @nile-focus=${this.handleFocus}\n @nile-complete=${this.handleSelect}\n ></nile-auto-complete>\n `}\n </div>\n </div>\n ${hasHelpText\n ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `\n : ``}\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}\n </div>\n `;\n }\n\n private handleSelect(event: CustomEvent<CustomEventDetail>) {\n // Add the selected value to the tags array only if it doesn't already exist\n const selectedValue = event.detail.value;\n const selectedOption = this.autoCompleteOptions.find(\n (opt) => opt.name === selectedValue || opt.id === selectedValue\n );\n\n let tooltipContent: string | null = null;\n\n if (selectedOption?.tooltip) {\n const { content, for: showFor } = selectedOption.tooltip;\n if (!showFor || showFor === 'tag') {\n tooltipContent = content;\n }\n }\n\n if (!this.noDuplicates || !this.tags.includes(selectedValue)) {\n this.tags = [...this.tags, selectedValue];\n this.tooltips = [...this.tooltips, tooltipContent];\n\n this.emit('nile-chip-change', { value: this.tags});\n this.resetInput();\n }\n }\n\n private handleRemove(value: string) {\n // Remove the tag from the tags array\n this.tags = this.tags.filter(tag => tag !== value);\n\n if (this.noDuplicates && this.autoCompleteOptions.includes(value)) {\n this.filteredAutoCompleteOptions = [\n ...this.filteredAutoCompleteOptions,\n value,\n ];\n }\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n private handleInputChange(event: CustomEvent<CustomEventDetail>) {\n // Update the input value\n this.inputValue = event.detail.value;\n }\n\n private handleInputKeydown(event: KeyboardEvent) {\n if (!this.acceptUserInput) {\n return;\n }\n\n if(event.key === 'Tab'){\n event.preventDefault()\n }\n \n if (\n (event.key === 'Enter' || event.key === 'Tab' ) \n && this.inputValue \n && (!this.noDuplicates || !this.tags.includes(this.inputValue))\n ) {\n event.preventDefault()\n this.tags = [...this.tags, this.inputValue];\n this.resetInput();\n this.emit('nile-chip-change', { value: this.tags });\n }\n\n if(\n (event.key === 'Enter'|| event.key === 'Tab' ) \n && this.inputValue \n && (this.noDuplicates || this.tags.includes(this.inputValue))\n ){\n this.emit('nile-duplicates-blocked');\n }\n }\n\n private handleFocus() {\n if (this.noAutoComplete) {\n return;\n }\n this.isDropdownOpen = true;\n }\n\n onTagsChanged() {\n if (this.noDuplicates)\n this.filteredAutoCompleteOptions = this.filteredAutoCompleteOptions.filter(option => !this.tags.includes(option));\n }\n\n\n private resetInput() {\n // Reset the input-related properties\n this.inputValue = '';\n this.isDropdownOpen = false;\n if (!this.noAutoComplete && this.autoComplete) {\n this.autoComplete.value = '';\n this.autoComplete.handleFocus();\n }\n } \n}\n\nexport default NileChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-chip': NileChip;\n }\n}\n"],"names":["NileChip","_a","c","this","hasSlotController","HasSlotController","tags","inputValue","isDropdownOpen","tooltips","warning","noAutoComplete","error","success","noDuplicates","label","tagVariant","acceptUserInput","clearable","placeholder","readonly","disabled","portal","enableVirtualScroll","autoCompleteOptions","filteredAutoCompleteOptions","value","noWrap","loading","errorIndexes","helpText","errorMessage","filterFunction","item","searchedValue","toLowerCase","includes","renderItemFunction","showTooltip","handleDocumentClick","event","composedPath","_this","_inherits","_createClass","key","updated","changedProperties","super","has","options","JSON","parse","e","Array","isArray","_toConsumableArray","filter","option","onTagsChanged","connectedCallback","document","addEventListener","emit","disconnectedCallback","removeEventListener","render","_this4","hasLabelSlot","test","hasLabel","hasHelpText","hasErrorMessage","html","_templateObject","_taggedTemplateLiteral","classMap","map","tag","index","tooltipContent","tagTemplate","_templateObject2","handleRemove","unsafeHTML","_templateObject3","_templateObject4","handleInputChange","handleInputKeydown","handleFocus","_templateObject5","handleSelect","_templateObject6","_templateObject7","selectedValue","detail","selectedOption","find","opt","name","id","tooltip","_e$tooltip","content","showFor","resetInput","concat","preventDefault","autoComplete","__decorate","get","styles","NileElement","state","prototype","query","property","type","Boolean","String","reflect","attribute","customElement"],"mappings":"iiKA0BaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,qEAKYC,EAAAA,KAAAA,CAAiBC,iBAAG,CAAA,GAAIC,CAAAA,gCAEvC,WAAA,CACA,OAGOF,CAAAA,CAAAA,KAAAA,CAAIG,IAAa,CAAA,EAAA,CAEjBH,KAAAA,CAAUI,UAAAA,CAAW,EAErBJ,CAAAA,KAAAA,CAAcK,cAAY,CAAA,CAAA,CAAA,CAC1BL,KAAAA,CAAQM,QAAAA,CAAsB,EAKVN,CAAAA,KAAAA,CAAOO,SAAG,CAEZP,CAAAA,KAAAA,CAAcQ,cAAG,CAAA,CAAA,CAAA,CAIfR,KAAAA,CAAKS,KAAAA,CAAAA,CAAG,CAGRT,CAAAA,KAAAA,CAAOU,SAAG,CAGVV,CAAAA,KAAAA,CAAYW,YAAG,CAAA,CAAA,CAAA,CAGhCX,KAAAA,CAAKY,KAAAA,CAAG,EAEQZ,CAAAA,KAAAA,CAAAa,WAAqB,EAIpBb,CAAAA,KAAAA,CAAec,eAAG,CAAA,CAAA,CAAA,CAGlBd,KAAAA,CAASe,SAAAA,CAAAA,CAAG,CAG7Bf,CAAAA,KAAAA,CAAWgB,WAAG,CAAA,cAAA,CAGkBhB,KAAAA,CAAQiB,QAAAA,CAAAA,CAAG,CAGXjB,CAAAA,KAAAA,CAAQkB,QAAG,CAAA,CAAA,CAAA,CAMXlB,KAAAA,CAAMmB,MAAG,CAAA,CAAA,CAAA,CAKxBnB,KAAAA,CAAmBoB,mBAAAA,C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A,CAAW,eAAiBD,CAAAA,OAAAA,CAAAA,CAAS,CAA0BxH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkH,SAAA,CAAA,cAAA,CAAA,IAAA,EAE7CL,CAAAA,CAAAA,CAAAA,CAAA,CAA7BO,CAAAA,CAAS,CAAEK,SAAAA,CAAAA,CAAU,CAAmKzH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkH,SAAA,CAAA,gBAAA,CAAA,IAAA,EAE3JL,CAAAA,CAAAA,CAAAA,CAAA,CAA7BO,CAAAA,CAAS,CAAEK,SAAAA,CAAAA,CAAU,CAAkEzH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkH,SAAA,CAAA,oBAAA,CAAA,IAAA,EAG3DL,CAAAA,CAAAA,CAAAA,CAAA,CAA5BO,CAAAA,CAAS,CAAEC,IAAAA,CAAMC,OAAwCtH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAkH,SAAA,CAAA,aAAA,CAAA,IAAA,EAxF/ClH,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAQ6G,CAAA,CAAA,CADpBa,CAAc,CAAA,WAAA,CAAA,CAAA,CACF1H"}
@@ -1,4 +1,4 @@
1
- import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,query as s,property as o,customElement as l}from"lit/decorators.js";import{s as h}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as r}from"../internal/slot.esm.js";import{N as a}from"../internal/nile-element.esm.js";let p=class extends a{constructor(){super(...arguments),this.hasSlotController=new r(this,"help-text","label"),this.tags=[],this.inputValue="",this.isDropdownOpen=!1,this.warning=!1,this.noAutoComplete=!1,this.error=!1,this.success=!1,this.noDuplicates=!1,this.label="",this.tagVariant="",this.acceptUserInput=!1,this.clearable=!1,this.placeholder="type here...",this.readonly=!1,this.disabled=!1,this.enableVirtualScroll=!1,this.autoCompleteOptions=[],this.filteredAutoCompleteOptions=[],this.value=[],this.noWrap=!1,this.loading=!1,this.errorIndexes=[],this.helpText="",this.errorMessage="",this.filterFunction=(t,i)=>t.toLowerCase().includes(i.toLowerCase()),this.renderItemFunction=t=>t,this.handleDocumentClick=t=>{t.composedPath().includes(this)||(this.isDropdownOpen=!1)}}static get styles(){return[h]}updated(t){if(super.updated(t),t.has("autoCompleteOptions")){let t=this.autoCompleteOptions;if("string"==typeof t)try{t=JSON.parse(t)}catch(i){t=[]}this.filteredAutoCompleteOptions=Array.isArray(t)?[...t]:[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t))))}t.has("value")&&(this.tags=[...this.value],this.onTagsChanged()),t.has("tags")&&this.onTagsChanged()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t)))),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy")}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i`
1
+ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,query as s,property as o,customElement as l}from"lit/decorators.js";import{s as h}from"./nile-chip.css.esm.js";import{classMap as n}from"lit/directives/class-map.js";import{H as r}from"../internal/slot.esm.js";import{N as a}from"../internal/nile-element.esm.js";import{unsafeHTML as p}from"lit/directives/unsafe-html.js";let c=class extends a{constructor(){super(...arguments),this.hasSlotController=new r(this,"help-text","label"),this.tags=[],this.inputValue="",this.isDropdownOpen=!1,this.tooltips=[],this.warning=!1,this.noAutoComplete=!1,this.error=!1,this.success=!1,this.noDuplicates=!1,this.label="",this.tagVariant="",this.acceptUserInput=!1,this.clearable=!1,this.placeholder="type here...",this.readonly=!1,this.disabled=!1,this.portal=!1,this.enableVirtualScroll=!1,this.autoCompleteOptions=[],this.filteredAutoCompleteOptions=[],this.value=[],this.noWrap=!1,this.loading=!1,this.errorIndexes=[],this.helpText="",this.errorMessage="",this.filterFunction=(t,i)=>t.toLowerCase().includes(i.toLowerCase()),this.renderItemFunction=t=>t,this.showTooltip=!1,this.handleDocumentClick=t=>{t.composedPath().includes(this)||(this.isDropdownOpen=!1)}}static get styles(){return[h]}updated(t){if(super.updated(t),t.has("autoCompleteOptions")){let t=this.autoCompleteOptions;if("string"==typeof t)try{t=JSON.parse(t)}catch(i){t=[]}this.filteredAutoCompleteOptions=Array.isArray(t)?[...t]:[],this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t))))}t.has("value")&&(this.tags=[...this.value],this.onTagsChanged()),t.has("tags")&&this.onTagsChanged()}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleDocumentClick),this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.value.includes(t)))),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleDocumentClick),this.emit("nile-destroy")}render(){const t=this.hasSlotController.test("label");this.hasSlotController.test("help-text");const e=!!this.label||!!t,s=!!this.helpText,o=!!this.errorMessage;return i`
2
2
  <div
3
3
  part="form-control"
4
4
  class=${n({"form-control":!0,"form-control--medium":!0,"form-control--has-label":e,"form-control--has-help-text":s,"nile-chip--disabled":this.disabled})}
@@ -16,17 +16,22 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
16
16
  part='base'
17
17
  class=${n({"nile-chip":!0,"nile-chip--warning":this.warning,"nile-chip--error":this.error,"nile-chip--success":this.success,"nile-chip--no-wrap":this.noWrap,"nile-chip--open":this.isDropdownOpen})}
18
18
  >
19
- ${this.tags.map(((t,e)=>i`
19
+ ${this.tags.map(((t,e)=>{const s=this.tooltips[e],o=i`
20
20
  <nile-tag
21
21
  class=${n({"nile-chip__tags":!0})}
22
22
  .variant=${this.errorIndexes.includes(e)?"error":"normal"}
23
23
  @nile-remove=${()=>this.handleRemove(t)}
24
- removable
25
- ?pill=${"normal"!==this.tagVariant}
24
+ removable
25
+ ?pill=${"normal"!==this.tagVariant}
26
26
  >
27
- ${t}
27
+ ${p(t)}
28
28
  </nile-tag>
29
- `))}
29
+ `;return this.showTooltip&&s?i`
30
+ <nile-lite-tooltip allowHTML .content=${s}>
31
+ ${o}
32
+ </nile-lite-tooltip>
33
+ `:o}))}
34
+
30
35
  <div class="nile-chip__auto-complete">
31
36
  ${this.noAutoComplete?i`
32
37
  <nile-input
@@ -47,6 +52,7 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
47
52
  .allMenuItems=${this.filteredAutoCompleteOptions}
48
53
  .filterFunction=${this.filterFunction}
49
54
  .renderItemFunction=${this.renderItemFunction}
55
+ .showTooltips=${this.showTooltip}
50
56
  .loading="${this.loading}"
51
57
  .value=${this.inputValue}
52
58
  ?isDropdownOpen=${this.isDropdownOpen}
@@ -54,6 +60,7 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
54
60
  .noOutline=${!0}
55
61
  .noPadding=${!0}
56
62
  .disabled=${this.disabled}
63
+ .portal=${this.portal}
57
64
  openOnFocus
58
65
  exportparts="options__wrapper, input, base"
59
66
  .placeholder=${this.placeholder}
@@ -72,4 +79,4 @@ import{__decorate as t}from"tslib";import{html as i}from"lit";import{state as e,
72
79
  >
73
80
  `:""}
74
81
  </div>
75
- `}handleSelect(t){this.noDuplicates&&this.tags.includes(t.detail.value)||(this.tags=[...this.tags,t.detail.value],this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],p.prototype,"tags",void 0),t([e()],p.prototype,"inputValue",void 0),t([e()],p.prototype,"isDropdownOpen",void 0),t([s("nile-auto-complete")],p.prototype,"autoComplete",void 0),t([o({type:Boolean})],p.prototype,"warning",void 0),t([o({type:Boolean})],p.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],p.prototype,"error",void 0),t([o({type:Boolean})],p.prototype,"success",void 0),t([o({type:Boolean})],p.prototype,"noDuplicates",void 0),t([o()],p.prototype,"label",void 0),t([o({type:String})],p.prototype,"tagVariant",void 0),t([o({type:Boolean})],p.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],p.prototype,"clearable",void 0),t([o()],p.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([o({type:Boolean})],p.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],p.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],p.prototype,"value",void 0),t([o({type:Boolean})],p.prototype,"noWrap",void 0),t([o({type:Boolean})],p.prototype,"loading",void 0),t([o({type:Array})],p.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],p.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],p.prototype,"errorMessage",void 0),t([o({attribute:!1})],p.prototype,"filterFunction",void 0),t([o({attribute:!1})],p.prototype,"renderItemFunction",void 0),p=t([l("nile-chip")],p);export{p as N};
82
+ `}handleSelect(t){const i=t.detail.value,e=this.autoCompleteOptions.find((t=>t.name===i||t.id===i));let s=null;if(e?.tooltip){const{content:t,for:i}=e.tooltip;i&&"tag"!==i||(s=t)}this.noDuplicates&&this.tags.includes(i)||(this.tags=[...this.tags,i],this.tooltips=[...this.tooltips,s],this.emit("nile-chip-change",{value:this.tags}),this.resetInput())}handleRemove(t){this.tags=this.tags.filter((i=>i!==t)),this.noDuplicates&&this.autoCompleteOptions.includes(t)&&(this.filteredAutoCompleteOptions=[...this.filteredAutoCompleteOptions,t]),this.emit("nile-chip-change",{value:this.tags})}handleInputChange(t){this.inputValue=t.detail.value}handleInputKeydown(t){this.acceptUserInput&&("Tab"===t.key&&t.preventDefault(),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||this.noDuplicates&&this.tags.includes(this.inputValue)||(t.preventDefault(),this.tags=[...this.tags,this.inputValue],this.resetInput(),this.emit("nile-chip-change",{value:this.tags})),"Enter"!==t.key&&"Tab"!==t.key||!this.inputValue||!this.noDuplicates&&!this.tags.includes(this.inputValue)||this.emit("nile-duplicates-blocked"))}handleFocus(){this.noAutoComplete||(this.isDropdownOpen=!0)}onTagsChanged(){this.noDuplicates&&(this.filteredAutoCompleteOptions=this.filteredAutoCompleteOptions.filter((t=>!this.tags.includes(t))))}resetInput(){this.inputValue="",this.isDropdownOpen=!1,!this.noAutoComplete&&this.autoComplete&&(this.autoComplete.value="",this.autoComplete.handleFocus())}};t([e()],c.prototype,"tags",void 0),t([e()],c.prototype,"inputValue",void 0),t([e()],c.prototype,"isDropdownOpen",void 0),t([e()],c.prototype,"tooltips",void 0),t([s("nile-auto-complete")],c.prototype,"autoComplete",void 0),t([o({type:Boolean})],c.prototype,"warning",void 0),t([o({type:Boolean})],c.prototype,"noAutoComplete",void 0),t([o({type:Boolean})],c.prototype,"error",void 0),t([o({type:Boolean})],c.prototype,"success",void 0),t([o({type:Boolean})],c.prototype,"noDuplicates",void 0),t([o()],c.prototype,"label",void 0),t([o({type:String})],c.prototype,"tagVariant",void 0),t([o({type:Boolean})],c.prototype,"acceptUserInput",void 0),t([o({type:Boolean})],c.prototype,"clearable",void 0),t([o()],c.prototype,"placeholder",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"readonly",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"disabled",void 0),t([o({type:Boolean,reflect:!0})],c.prototype,"portal",void 0),t([o({type:Boolean})],c.prototype,"enableVirtualScroll",void 0),t([o({type:Array})],c.prototype,"autoCompleteOptions",void 0),t([o({type:Array})],c.prototype,"filteredAutoCompleteOptions",void 0),t([o({type:Array})],c.prototype,"value",void 0),t([o({type:Boolean})],c.prototype,"noWrap",void 0),t([o({type:Boolean})],c.prototype,"loading",void 0),t([o({type:Array})],c.prototype,"errorIndexes",void 0),t([o({attribute:"help-text",reflect:!0})],c.prototype,"helpText",void 0),t([o({attribute:"error-message",reflect:!0})],c.prototype,"errorMessage",void 0),t([o({attribute:!1})],c.prototype,"filterFunction",void 0),t([o({attribute:!1})],c.prototype,"renderItemFunction",void 0),t([o({type:Boolean})],c.prototype,"showTooltip",void 0),c=t([l("nile-chip")],c);export{c as N};