@aquera/nile-elements 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/demo/nxtgen-classes.css +609 -12
- package/demo/nxtgen-dark.css +254 -35
- package/demo/nxtgen-properties.css +27 -24
- package/demo/nxtgen-utilities.css +633 -36
- package/demo/nxtgen.css +70 -12
- package/demo/utilities.css +3 -0
- package/demo/variables.css +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1375 -358
- package/dist/internal/glyph.cjs.js +1 -1
- package/dist/internal/glyph.cjs.js.map +1 -1
- package/dist/internal/glyph.esm.js +6 -5
- package/dist/nile-app-shell/index.cjs.js +2 -0
- package/dist/nile-app-shell/index.cjs.js.map +1 -0
- package/dist/nile-app-shell/index.esm.js +1 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +554 -0
- package/dist/nile-app-shell/nile-app-shell.esm.js +155 -0
- package/dist/nile-app-shell/shell-controller.cjs.js +2 -0
- package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -0
- package/dist/nile-app-shell/shell-controller.esm.js +1 -0
- package/dist/nile-app-shell-main/index.cjs.js +2 -0
- package/dist/nile-app-shell-main/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/index.esm.js +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.esm.js +18 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +29 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +16 -0
- package/dist/nile-app-shell-panel/index.cjs.js +2 -0
- package/dist/nile-app-shell-panel/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/index.esm.js +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +103 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +33 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/index.esm.js +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.esm.js +55 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.esm.js +5 -0
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.esm.js +28 -15
- package/dist/nile-combobox/nile-combobox.esm.js +11 -8
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js.map +1 -1
- package/dist/nile-combobox/portal-manager.esm.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js.map +1 -1
- package/dist/nile-combobox/renderer.esm.js +31 -43
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.esm.js +46 -8
- package/dist/nile-floating-panel/nile-floating-panel.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.esm.js +32 -17
- package/dist/nile-popover/nile-popover.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -1
- package/dist/src/internal/glyph.js +8 -1
- package/dist/src/internal/glyph.js.map +1 -1
- package/dist/src/nile-app-shell/index.d.ts +7 -0
- package/dist/src/nile-app-shell/index.js +8 -0
- package/dist/src/nile-app-shell/index.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +4 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +177 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +18 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js +572 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +292 -0
- package/dist/src/nile-app-shell/nile-app-shell.js +796 -0
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +3 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js +454 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -0
- package/dist/src/nile-app-shell/shell-controller.d.ts +34 -0
- package/dist/src/nile-app-shell/shell-controller.js +80 -0
- package/dist/src/nile-app-shell/shell-controller.js.map +1 -0
- package/dist/src/nile-app-shell-main/index.d.ts +7 -0
- package/dist/src/nile-app-shell-main/index.js +8 -0
- package/dist/src/nile-app-shell-main/index.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.d.ts +9 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js +27 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +38 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js +51 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/index.d.ts +7 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js +8 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +13 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +42 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +56 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +126 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -0
- package/dist/src/nile-app-shell-panel/index.d.ts +7 -0
- package/dist/src/nile-app-shell-panel/index.js +8 -0
- package/dist/src/nile-app-shell-panel/index.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.d.ts +9 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +112 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +73 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +158 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/index.d.ts +7 -0
- package/dist/src/nile-app-shell-side-nav/index.js +8 -0
- package/dist/src/nile-app-shell-side-nav/index.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +13 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +68 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +54 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +83 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.css.js +28 -15
- package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -1
- package/dist/src/nile-combobox/nile-combobox.js +49 -10
- package/dist/src/nile-combobox/nile-combobox.js.map +1 -1
- package/dist/src/nile-combobox/portal-manager.js +2 -22
- package/dist/src/nile-combobox/portal-manager.js.map +1 -1
- package/dist/src/nile-combobox/renderer.d.ts +2 -3
- package/dist/src/nile-combobox/renderer.js +14 -45
- package/dist/src/nile-combobox/renderer.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js +46 -8
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js +13 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.css.js +30 -15
- package/dist/src/nile-popover/nile-popover.css.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.js +1 -1
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.test.js +1 -1
- package/dist/src/nile-popover/nile-popover.test.js.map +1 -1
- package/dist/src/version.d.ts +11 -1
- package/dist/src/version.js +56 -5
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.cjs.js +1 -1
- package/dist/version.cjs.js.map +1 -1
- package/dist/version.esm.js +1 -1
- package/package.json +8 -2
- package/scripts/replace-version.cjs +12 -10
- package/src/index.ts +16 -4
- package/src/internal/glyph.ts +12 -1
- package/src/nile-app-shell/index.ts +8 -0
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +215 -0
- package/src/nile-app-shell/nile-app-shell.css.ts +574 -0
- package/src/nile-app-shell/nile-app-shell.test.ts +536 -0
- package/src/nile-app-shell/nile-app-shell.ts +838 -0
- package/src/nile-app-shell/shell-controller.ts +100 -0
- package/src/nile-app-shell-main/index.ts +8 -0
- package/src/nile-app-shell-main/nile-app-shell-main.css.ts +29 -0
- package/src/nile-app-shell-main/nile-app-shell-main.ts +52 -0
- package/src/nile-app-shell-nav-toggle/index.ts +8 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +44 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +138 -0
- package/src/nile-app-shell-panel/index.ts +8 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +114 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.ts +161 -0
- package/src/nile-app-shell-side-nav/index.ts +8 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +70 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +86 -0
- package/src/nile-combobox/nile-combobox.css.ts +28 -15
- package/src/nile-combobox/nile-combobox.ts +61 -12
- package/src/nile-combobox/portal-manager.ts +4 -22
- package/src/nile-combobox/renderer.ts +26 -69
- package/src/nile-floating-panel/nile-floating-panel.css.ts +46 -8
- package/src/nile-floating-panel/nile-floating-panel.ts +19 -1
- package/src/nile-popover/nile-popover.css.ts +30 -15
- package/src/nile-popover/nile-popover.test.ts +1 -1
- package/src/nile-popover/nile-popover.ts +1 -1
- package/src/version.ts +61 -4
- package/vscode-html-custom-data.json +216 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t,o as i,s,f as o,a as e,p as a,b as n}from"../floating-ui.dom-cc9126da.esm.js";import{P as l}from"../nile-select/portal-utils.esm.js";class h{constructor(t){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom",this.component=t}get portalContainerElement(){return this.portalContainer}createPortalContainer(){const t=document.createElement("div");return t.style.position="absolute",t.style.zIndex="9999",t.style.pointerEvents="none",t.className="nile-combobox-portal",t}async computePosition(){if(!this.portalContainer)return;const n=this.component.combobox||this.component,h=this.portalContainer;try{const r=l.findBoundaryElements(n),c=l.getOptimalPlacement(n),{x:
|
|
1
|
+
import{c as t,o as i,s,f as o,a as e,p as a,b as n}from"../floating-ui.dom-cc9126da.esm.js";import{P as l}from"../nile-select/portal-utils.esm.js";class h{constructor(t){this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.cleanupAutoUpdate=null,this.currentPlacement="bottom",this.component=t}get portalContainerElement(){return this.portalContainer}createPortalContainer(){const t=document.createElement("div");return t.style.position="absolute",t.style.zIndex="9999",t.style.pointerEvents="none",t.className="nile-combobox-portal",t}async computePosition(){if(!this.portalContainer)return;const n=this.component.combobox||this.component,h=this.portalContainer;try{const r=l.findBoundaryElements(n),c=l.getOptimalPlacement(n),{x:p,y:u,placement:b}=await t(n,h,{placement:c,strategy:"fixed",middleware:[i(4),s({apply:({availableWidth:t,availableHeight:i,elements:s,rects:o})=>{const e=l.calculateOptimalHeight(o.reference,window.innerHeight,this.currentPlacement);s.floating.style.maxWidth=`${t}px`,s.floating.style.maxHeight=`${e}px`,s.floating.style.setProperty("--auto-size-available-width",`${t}px`),s.floating.style.setProperty("--auto-size-available-height",`${e}px`)},padding:10,boundary:r}),o({fallbackPlacements:["bottom","top","bottom-start","top-start"],fallbackStrategy:"bestFit",padding:10,boundary:r}),e({padding:10,crossAxis:!0,boundary:r})],platform:a}),m=n.getBoundingClientRect();Object.assign(h.style,{left:`${p}px`,top:`${u}px`,position:"fixed",pointerEvents:"auto",width:`${m.width}px`}),this.currentPlacement=b;const x=b.split("-")[0];h.className=`nile-combobox-portal combobox__listbox--${x}`}catch{this.fallbackPositioning()}}fallbackPositioning(){if(!this.portalContainer)return;const t=(this.component.combobox||this.component).getBoundingClientRect(),i=window.innerHeight-t.bottom,s=t.top;let o,e,a;s>i?(e=Math.max(s-20,100),o=Math.max(t.top-e-4,10),a="top"):(e=Math.max(i-20,100),o=t.bottom+4,a="bottom"),Object.assign(this.portalContainer.style,{left:`${t.left}px`,top:`${o}px`,width:`${t.width}px`,maxHeight:`${e}px`,pointerEvents:"auto"}),this.portalContainer.className=`nile-combobox-portal combobox__listbox--${a}`,this.portalContainer.style.setProperty("--auto-size-available-height",`${e}px`),this.portalContainer.style.setProperty("--auto-size-available-width",`${t.width}px`)}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:""}injectStyles(){if(!this.portalContainer)return;const t=`nile-combobox-styles-${Math.random().toString(36).substring(2,11)}`;if(document.getElementById(t))return;const i=this.component.constructor.styles;if(!i)return;const s=document.createElement("style");s.id=t,s.textContent=this.extractStylesAsCSS(i),document.head.appendChild(s),this.portalContainer.t=t}setupPortal(){this.component.portal&&this.component.updateComplete.then((()=>{const t=this.component.shadowRoot?.querySelector("#listbox");t&&(this.originalListboxParent=t.parentElement,this.portalContainer=this.createPortalContainer(),this.portalContainer.appendChild(t),document.body.appendChild(this.portalContainer),this.injectStyles(),t.style.display="",this.computePosition(),this.cleanupAutoUpdate=n(this.component,this.portalContainer,(()=>this.computePosition()),{ancestorScroll:!0,ancestorResize:!0,elementResize:!0,layoutShift:!0,animationFrame:!0}))}))}cleanupPortal(){if(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),this.portalContainer&&this.portalContainer.parentNode){const t=this.portalContainer.querySelector("#listbox");t&&this.originalListboxParent&&(this.originalListboxParent.appendChild(t),t.style.display=this.component.portal?"none":"");const i=this.portalContainer.t;i&&document.getElementById(i)?.remove(),this.portalContainer.parentNode.removeChild(this.portalContainer)}this.portalContainer=null,this.originalListboxParent=null,this.measuredPopupHeight=null,this.currentPlacement="bottom"}updatePosition(){this.component.portal&&this.portalContainer&&this.computePosition()}resetMeasuredHeight(){this.measuredPopupHeight=null}async resetScrollPosition(){await this.component.updateComplete,requestAnimationFrame((()=>{let t=null;if(t=this.component.portal&&this.portalContainer?this.portalContainer.querySelector("#listbox"):this.component.shadowRoot?.querySelector("#listbox"),!t||!t.isConnected)return;(t.querySelector(".combobox__options-scroll")??t).scrollTop=0}))}}export{h as C};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["lit","lit/directives/unsafe-html.js","lit/directives/class-map.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,o,i,e,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16,_templateObject17,_templateObject18,_templateObject19,_templateObject20,_templateObject21,s;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 _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}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:[function(_lit){t=_lit.html;},function(_litDirectivesUnsafeHtmlJs){o=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesClassMapJs){i=_litDirectivesClassMapJs.classMap;},function(_litDirectivesRepeatJs){e=_litDirectivesRepeatJs.repeat;}],execute:function execute(){_export("C",s=/*#__PURE__*/function(){function s(){_classCallCheck(this,s);}return _createClass(s,null,[{key:"renderGroupHeader",value:function renderGroupHeader(o){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=","\n style=","\n >\n ","\n <span class=\"combobox__group-label\">","</span>\n </div>\n "])),o.id,"--group-depth:".concat(o.depth),o.prefix?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-icon\n class=\"combobox__group-prefix\"\n name=","\n size=\"14\"\n method=\"fill\"\n ></nile-icon>"])),o.prefix):"",o.label);}},{key:"renderRowsPlain",value:function renderRowsPlain(o,i,e,r,n,l,a,d,p,c,$,v,b,u,m){return l&&!d&&0===o.length?s.renderNoResults(a,m):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div class=\"combobox__options-plain\" @scroll=",">\n ","\n </div>\n </div>\n "])),d?"loading":"",p,o.map(function(t){return"header"===t.kind?s.renderGroupHeader(t):s.renderItem(t.item,i,e,r,n,c,$,v,b,u);}));}},{key:"renderRowsVirtualized",value:function renderRowsVirtualized(o,i,r,n,l,a,d,p,c,$,v,b,u){return t(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:100%;\">\n ","\n </div>\n </div>\n "])),p?"loading":"",i,e(o,function(t){return t.key;},function(o){var i=r[o.index];if(!i)return t(_templateObject5||(_templateObject5=_taggedTemplateLiteral([""])));var e="position:absolute;top:0;left:0;right:0;transform:translateY(".concat(o.start,"px);height:").concat(o.size,"px;");return"header"===i.kind?t(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <div style="," class=\"combobox__group-header-slot\">\n ","\n </div>\n "])),e,s.renderGroupHeader(i)):t(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <div style=",">\n ","\n </div>\n "])),e,s.renderItem(i.item,n,l,a,d,c,$,v,b,u));}));}},{key:"renderVirtualizedOptions",value:function renderVirtualizedOptions(o,i,r,n,l,a,d,p,c,$,v,b,u,m){var x=o.length>0?o[0].start:0;return t(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:100%;transform:translateY(","px);\">\n ","\n </div>\n </div>\n </div>\n "])),p?"loading":"",i,x,e(o,function(t){return t.key;},function(t){var o=r[t.index];return s.renderMeasuredItem(o,t.index,n,l,a,d,c,v,b,u,m);}));}},{key:"renderPlainOptions",value:function renderPlainOptions(o,i,e,r,n,l,a,d,p,c,$,v,b,u,m){return l&&!d&&0===o.length?s.renderNoResults(a,m):t(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div class=\"combobox__options-plain\" @scroll=",">\n ","\n </div>\n </div>\n "])),d?"loading":"",p,o.map(function(t){return s.renderItem(t,i,e,r,n,c,$,v,b,u);}));}},{key:"renderNoResults",value:function renderNoResults(o,i){return t(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ","\n </div>\n ","\n </div>\n </div>\n "])),o||"No result found",i?t(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">","</div>"])),i):"");}},{key:"renderNoData",value:function renderNoData(o){return t(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ","\n </div>\n </div>\n </div>\n "])),o||"No data available");}},{key:"renderMeasuredItem",value:function renderMeasuredItem(e,_s,r,n,l,a,d,p,c,$,v){var _e$description,_e$prefix,_e$suffix;if(!e)return t(_templateObject13||(_templateObject13=_taggedTemplateLiteral([""])));var b=a(e),u=l(e),m=(e===null||e===void 0?void 0:e.disabled)||!1,x=e===null||e===void 0?void 0:e.className,_=p?p(e):(_e$description=e===null||e===void 0?void 0:e.description)!==null&&_e$description!==void 0?_e$description:"",h=c?c(e):(_e$prefix=e===null||e===void 0?void 0:e.prefix)!==null&&_e$prefix!==void 0?_e$prefix:"",g=$?$(e):(_e$suffix=e===null||e===void 0?void 0:e.suffix)!==null&&_e$suffix!==void 0?_e$suffix:"";var f=!1;return f=n?Array.isArray(r)&&r.some(function(t){return String(t)===String(b);}):String(Array.isArray(r)?r[0]:r)===String(b),t(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n <nile-option\n data-index=","\n value=","\n .selected=","\n .disabled=","\n .showCheckbox=","\n class=","\n .description=","\n .isDescriptionEnabled=","\n >\n ","\n ","\n ","\n </nile-option>\n "])),_s,b,f,m,n,i(_defineProperty({option:v!==null&&v!==void 0?v:!1},x!==null&&x!==void 0?x:"",!!x)),_,v,o(h),d?o(u):u,o(g));}},{key:"renderItem",value:function renderItem(e,_s2,r,n,l,a,d,p,c,$){var _e$description2,_e$prefix2,_e$suffix2;if(!e)return t(_templateObject15||(_templateObject15=_taggedTemplateLiteral([""])));var v=l(e),b=n(e),u=(e===null||e===void 0?void 0:e.disabled)||!1,m=e===null||e===void 0?void 0:e.className,x=d?d(e):(_e$description2=e===null||e===void 0?void 0:e.description)!==null&&_e$description2!==void 0?_e$description2:"",_=p?p(e):(_e$prefix2=e===null||e===void 0?void 0:e.prefix)!==null&&_e$prefix2!==void 0?_e$prefix2:"",h=c?c(e):(_e$suffix2=e===null||e===void 0?void 0:e.suffix)!==null&&_e$suffix2!==void 0?_e$suffix2:"";var g=!1;return g=r?Array.isArray(_s2)&&_s2.some(function(t){return String(t)===String(v);}):String(Array.isArray(_s2)?_s2[0]:_s2)===String(v),t(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <nile-option\n value=","\n .selected=","\n .disabled=","\n .showCheckbox=","\n class=","\n .description=","\n .isDescriptionEnabled=","\n >\n ","\n ","\n ","\n </nile-option>\n "])),v,g,u,r,i(_defineProperty({option:$!==null&&$!==void 0?$:!1},m!==null&&m!==void 0?m:"",!!m)),x,$,o(_),a?o(b):b,o(h));}},{key:"renderVirtualizedGrid",value:function renderVirtualizedGrid(o,i,r,n,l,a,d,p,c,$,v,b,u,m){var x=o.length>0?o[0].start:0,_=m?"repeat(".concat(a,", ").concat(m,"px)"):"repeat(".concat(a,", 1fr)");return t(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:",";min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:",";min-width:100%;transform:translateY(","px);\">\n ","\n </div>\n </div>\n </div>\n "])),c?"loading":"",i,m?"max-content":"100%",m?"max-content":"100%",x,e(o,function(t){return t.key;},function(o){var i=o.index*a,e=r.slice(i,i+a);return t(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:",";gap:4px;\">\n ","\n </div>\n "])),_,e.map(function(t){return s.renderItem(t,n,l,d,p,$,v,b,u);}));}));}},{key:"renderHorizontalGrid",value:function renderHorizontalGrid(o,i,r,n,l,a,d,p,c,$,v,b,u,m){var x=o.length>0?o[0].start:0;return t(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ","\"\n >\n <div style=\"position:relative;width:","px;height:","px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(","px);\">\n ","\n </div>\n </div>\n </div>\n "])),$?"loading":"",i,38*a,x,e(o,function(t){return t.key;},function(o){var i=o.index*a,e=r.slice(i,i+a);return t(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <div class=\"combobox__grid-col\" style=\"width:","px;flex-shrink:0;display:flex;flex-direction:column;\">\n ","\n </div>\n "])),d,e.map(function(t){return s.renderItem(t,n,l,p,c,v,b,u,m);}));}));}},{key:"renderAddCustomOption",value:function renderAddCustomOption(o,i){return t(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n <nile-option\n value=","\n class=\"combobox__add-option\"\n .showCheckbox=","\n >\n + Add \"","\"\n </nile-option>\n "])),o,i,o);}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return o>1||t.length>=5;}}]);}());}};});
|
|
1
|
+
System.register(["lit","lit/directives/unsafe-html.js","lit/directives/class-map.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,o,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16,_templateObject17,_templateObject18,_templateObject19,_templateObject20,e;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 _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}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:[function(_lit){t=_lit.html;},function(_litDirectivesUnsafeHtmlJs){o=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesClassMapJs){i=_litDirectivesClassMapJs.classMap;},function(_litDirectivesRepeatJs){s=_litDirectivesRepeatJs.repeat;}],execute:function execute(){_export("C",e=/*#__PURE__*/function(){function e(){_classCallCheck(this,e);}return _createClass(e,null,[{key:"renderGroupHeader",value:function renderGroupHeader(o){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=","\n style=","\n >\n ","\n <span class=\"combobox__group-label\">","</span>\n </div>\n "])),o.id,"--group-depth:".concat(o.depth),o.prefix?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-icon\n class=\"combobox__group-prefix\"\n name=","\n size=\"14\"\n method=\"fill\"\n ></nile-icon>"])),o.prefix):"",o.label);}},{key:"renderRowsPlain",value:function renderRowsPlain(o,i,s,r,n,l,a,d,p,c,v,$,b,u,m){return l&&!d&&0===o.length?e.renderNoResults(a,m):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div class=\"combobox__options-plain\" @scroll=",">\n ","\n </div>\n </div>\n "])),d?"loading":"",p,o.map(function(t){return"header"===t.kind?e.renderGroupHeader(t):e.renderItem(t.item,i,s,r,n,c,v,$,b,u);}));}},{key:"renderRowsVirtualized",value:function renderRowsVirtualized(o,i,r,n,l,a,d,p,c,v,$,b,u,m){var x=arguments.length>14&&arguments[14]!==undefined?arguments[14]:-1;return t(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:100%;\">\n ","\n ","\n </div>\n </div>\n "])),p?"loading":"",i,m!==null&&m!==void 0?m:"",s(o,function(t){return t.key;},function(o){var i=r[o.index];if(!i)return t(_templateObject5||(_templateObject5=_taggedTemplateLiteral([""])));var s="position:absolute;top:0;left:0;right:0;transform:translateY(".concat(o.start,"px);height:").concat(o.size,"px;");if("header"===i.kind){var _r=o.index===x?"".concat(s,"visibility:hidden;"):s;return t(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <div style="," class=\"combobox__group-header-slot\">\n ","\n </div>\n "])),_r,e.renderGroupHeader(i));}return t(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <div style=",">\n ","\n </div>\n "])),s,e.renderItem(i.item,n,l,a,d,c,v,$,b,u));}));}},{key:"renderVirtualizedOptions",value:function renderVirtualizedOptions(o,i,r,n,l,a,d,p,c,v,$,b,u){return t(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:100%;\">\n ","\n </div>\n </div>\n "])),p?"loading":"",i,s(o,function(t){return t.key;},function(o){var i=r[o.index],s="position:absolute;top:0;left:0;right:0;transform:translateY(".concat(o.start,"px);height:").concat(o.size,"px;");return t(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n <div style=",">\n ","\n </div>\n "])),s,e.renderItem(i,n,l,a,d,c,v,$,b,u));}));}},{key:"renderPlainOptions",value:function renderPlainOptions(o,i,s,r,n,l,a,d,p,c,v,$,b,u,m){return l&&!d&&0===o.length?e.renderNoResults(a,m):t(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div class=\"combobox__options-plain\" @scroll=",">\n ","\n </div>\n </div>\n "])),d?"loading":"",p,o.map(function(t){return e.renderItem(t,i,s,r,n,c,v,$,b,u);}));}},{key:"renderNoResults",value:function renderNoResults(o,i){return t(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ","\n </div>\n ","\n </div>\n </div>\n "])),o||"No result found",i?t(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">","</div>"])),i):"");}},{key:"renderNoData",value:function renderNoData(o){return t(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ","\n </div>\n </div>\n </div>\n "])),o||"No data available");}},{key:"renderItem",value:function renderItem(s,_e,r,n,l,a,d,p,c,v){var _s$description,_s$prefix,_s$suffix;if(!s)return t(_templateObject14||(_templateObject14=_taggedTemplateLiteral([""])));var $=l(s),b=n(s),u=(s===null||s===void 0?void 0:s.disabled)||!1,m=s===null||s===void 0?void 0:s.className,x=d?d(s):(_s$description=s===null||s===void 0?void 0:s.description)!==null&&_s$description!==void 0?_s$description:"",_=p?p(s):(_s$prefix=s===null||s===void 0?void 0:s.prefix)!==null&&_s$prefix!==void 0?_s$prefix:"",h=c?c(s):(_s$suffix=s===null||s===void 0?void 0:s.suffix)!==null&&_s$suffix!==void 0?_s$suffix:"";var g=!1;return g=r?Array.isArray(_e)&&_e.some(function(t){return String(t)===String($);}):String(Array.isArray(_e)?_e[0]:_e)===String($),t(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["\n <nile-option\n value=","\n .selected=","\n .disabled=","\n .showCheckbox=","\n class=","\n .description=","\n .isDescriptionEnabled=","\n >\n ","\n ","\n ","\n </nile-option>\n "])),$,g,u,r,i(_defineProperty({option:v!==null&&v!==void 0?v:!1},m!==null&&m!==void 0?m:"",!!m)),x,v,o(_),a?o(b):b,o(h));}},{key:"renderVirtualizedGrid",value:function renderVirtualizedGrid(o,i,r,n,l,a,d,p,c,v,$,b,u,m){var x=o.length>0?o[0].start:0,_=m?"repeat(".concat(a,", ").concat(m,"px)"):"repeat(".concat(a,", 1fr)");return t(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options ","\"\n >\n <div style=\"position:relative;height:","px;width:",";min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:",";min-width:100%;transform:translateY(","px);\">\n ","\n </div>\n </div>\n </div>\n "])),c?"loading":"",i,m?"max-content":"100%",m?"max-content":"100%",x,s(o,function(t){return t.key;},function(o){var i=o.index*a,s=r.slice(i,i+a);return t(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:",";gap:4px;\">\n ","\n </div>\n "])),_,s.map(function(t){return e.renderItem(t,n,l,d,p,v,$,b,u);}));}));}},{key:"renderHorizontalGrid",value:function renderHorizontalGrid(o,i,r,n,l,a,d,p,c,v,$,b,u,m){var x=o.length>0?o[0].start:0;return t(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ","\"\n >\n <div style=\"position:relative;width:","px;height:","px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(","px);\">\n ","\n </div>\n </div>\n </div>\n "])),v?"loading":"",i,38*a,x,s(o,function(t){return t.key;},function(o){var i=o.index*a,s=r.slice(i,i+a);return t(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n <div class=\"combobox__grid-col\" style=\"width:","px;flex-shrink:0;display:flex;flex-direction:column;\">\n ","\n </div>\n "])),d,s.map(function(t){return e.renderItem(t,n,l,p,c,$,b,u,m);}));}));}},{key:"renderAddCustomOption",value:function renderAddCustomOption(o,i){return t(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n <nile-option\n value=","\n class=\"combobox__add-option\"\n .showCheckbox=","\n >\n + Add \"","\"\n </nile-option>\n "])),o,i,o);}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return o>1||t.length>=5;}}]);}());}};});
|
|
2
2
|
//# sourceMappingURL=renderer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-combobox/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\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 { html, type TemplateResult } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { VirtualItem } from '@tanstack/virtual-core';\nimport type { ComboboxRow, ComboboxHeaderRow } from './types';\n\nexport class ComboboxRenderer {\n\n static renderGroupHeader(row: ComboboxHeaderRow): TemplateResult {\n return html`\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=${row.id}\n style=${`--group-depth:${row.depth}`}\n >\n ${row.prefix\n ? html`<nile-icon\n class=\"combobox__group-prefix\"\n name=${row.prefix}\n size=\"14\"\n method=\"fill\"\n ></nile-icon>`\n : ''}\n <span class=\"combobox__group-label\">${row.label}</span>\n </div>\n `;\n }\n\n static renderRowsPlain(\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && rows.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${rows.map((row) =>\n row.kind === 'header'\n ? ComboboxRenderer.renderGroupHeader(row)\n : ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderRowsVirtualized(\n virtualItems: VirtualItem[],\n totalSize: number,\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const row = rows[vItem.index];\n if (!row) return html``;\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n if (row.kind === 'header') {\n return html`\n <div style=${posStyle} class=\"combobox__group-header-slot\">\n ${ComboboxRenderer.renderGroupHeader(row)}\n </div>\n `;\n }\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderVirtualizedOptions(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n measureElement: (el: Element | null) => void,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const item = data[vItem.index];\n return ComboboxRenderer.renderMeasuredItem(\n item, vItem.index, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n );\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderPlainOptions(\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && data.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${data.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ${noResultsMessage || 'No result found'}\n </div>\n ${noResultsSubtitle\n ? html`<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">${noResultsSubtitle}</div>`\n : ''}\n </div>\n </div>\n `;\n }\n\n static renderNoData(noDataMessage: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ${noDataMessage || 'No data available'}\n </div>\n </div>\n </div>\n `;\n }\n\n private static renderMeasuredItem(\n item: any,\n index: number,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n data-index=${index}\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderItem(\n item: any,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderVirtualizedGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridColumns: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n gridColumnWidth?: number,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const colTemplate = gridColumnWidth\n ? `repeat(${gridColumns}, ${gridColumnWidth}px)`\n : `repeat(${gridColumns}, 1fr)`;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const rowStart = vItem.index * gridColumns;\n const rowItems = data.slice(rowStart, rowStart + gridColumns);\n return html`\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:${colTemplate};gap:4px;\">\n ${rowItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderHorizontalGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridRows: number,\n gridColumnWidth: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n ): TemplateResult {\n const offsetLeft = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const rowHeight = 38;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;width:${totalSize}px;height:${rowHeight * gridRows}px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${offsetLeft}px);\">\n ${repeat(\n virtualItems,\n (vCol) => vCol.key,\n (vCol) => {\n const colStart = vCol.index * gridRows;\n const colItems = data.slice(colStart, colStart + gridRows);\n return html`\n <div class=\"combobox__grid-col\" style=\"width:${gridColumnWidth}px;flex-shrink:0;display:flex;flex-direction:column;\">\n ${colItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderAddCustomOption(\n searchValue: string,\n multiple: boolean,\n ): TemplateResult {\n return html`\n <nile-option\n value=${searchValue}\n class=\"combobox__add-option\"\n .showCheckbox=${multiple}\n >\n + Add \"${searchValue}\"\n </nile-option>\n `;\n }\n\n static shouldUseVirtualizer(data: any[], gridColumns = 1): boolean {\n if (gridColumns > 1) return true;\n return data.length >= 5;\n }\n}\n"],"names":["ComboboxRenderer","s","_classCallCheck","_createClass","key","value","renderGroupHeader","row","html","_templateObject","_taggedTemplateLiteral","id","depth","prefix","_templateObject2","label","renderRowsPlain","rows","multiple","getDisplayText","getItemValue","showNoResults","noResultsMessage","isLoading","onScroll","allowHtmlLabel","getItemDescription","getItemPrefix","getItemSuffix","enableDescription","noResultsSubtitle","length","renderNoResults","_templateObject3","map","kind","renderItem","item","renderRowsVirtualized","virtualItems","totalSize","_templateObject4","repeat","vItem","index","_templateObject5","posStyle","concat","start","size","_templateObject6","_templateObject7","renderVirtualizedOptions","data","measureElement","offsetTop","_templateObject8","renderMeasuredItem","renderPlainOptions","_templateObject9","_templateObject10","_templateObject11","renderNoData","noDataMessage","_templateObject12","_templateObject13","optionValue","displayText","isDisabled","disabled","className","description","_e$description","_e$prefix","suffix","isSelected","Array","isArray","some","v","String","_templateObject14","classMap","option","unsafeHTML","_e$description2","_e$prefix2","_e$suffix2","_templateObject15","_templateObject16","renderVirtualizedGrid","gridColumns","gridColumnWidth","colTemplate","_templateObject17","rowStart","rowItems","slice","_templateObject18","renderHorizontalGrid","gridRows","offsetLeft","_templateObject19","vCol","colStart","colItems","_templateObject20","renderAddCustomOption","searchValue","_templateObject21","shouldUseVirtualizer","arguments","undefined"],"mappings":"2rEAcaA,CAEX,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,UAAAE,YAAA,CAAAF,CAAA,QAAAG,GAAA,qBAAAC,KAAA,CAAA,QAAA,CAAAC,iBAAOA,CAAkBC,CAAAA,CAAAA,CACvB,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,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qG,iBAAA,GAAAA,iBAAA,CAAAnG,sBAAA,8KAECkG,CAAAA,CAEQ1F,CAAAA,CAEP0F,CAAAA,EAGd,CAED,GAAAxG,GAAA,wBAAAC,KAAA,SAAA,CAAAyG,oBAAOA,CAAqBzD,CAAAA,CAA2B,IAAdsC,CAAAA,CAAc,CAAAoB,SAAA,CAAAhF,MAAA,IAAAgF,SAAA,MAAAC,SAAA,CAAAD,SAAA,IAAA,CAAA,CACrD,MAAIpB,CAAAA,CAAAA,CAAc,CACXtC,EAAAA,CAAAA,CAAKtB,MAAU,EAAA,CACvB"}
|
|
1
|
+
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-combobox/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\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 { html, type TemplateResult } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { VirtualItem } from '@tanstack/virtual-core';\nimport type { ComboboxRow, ComboboxHeaderRow } from './types';\n\nexport class ComboboxRenderer {\n\n static renderGroupHeader(row: ComboboxHeaderRow): TemplateResult {\n return html`\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=${row.id}\n style=${`--group-depth:${row.depth}`}\n >\n ${row.prefix\n ? html`<nile-icon\n class=\"combobox__group-prefix\"\n name=${row.prefix}\n size=\"14\"\n method=\"fill\"\n ></nile-icon>`\n : ''}\n <span class=\"combobox__group-label\">${row.label}</span>\n </div>\n `;\n }\n\n static renderRowsPlain(\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && rows.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${rows.map((row) =>\n row.kind === 'header'\n ? ComboboxRenderer.renderGroupHeader(row)\n : ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderRowsVirtualized(\n virtualItems: VirtualItem[],\n totalSize: number,\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n stickyOverlay?: TemplateResult,\n stickyIndex = -1,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${stickyOverlay ?? ''}\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const row = rows[vItem.index];\n if (!row) return html``;\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n if (row.kind === 'header') {\n const headerStyle =\n vItem.index === stickyIndex ? `${posStyle}visibility:hidden;` : posStyle;\n return html`\n <div style=${headerStyle} class=\"combobox__group-header-slot\">\n ${ComboboxRenderer.renderGroupHeader(row)}\n </div>\n `;\n }\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderVirtualizedOptions(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const item = data[vItem.index];\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderPlainOptions(\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && data.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${data.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ${noResultsMessage || 'No result found'}\n </div>\n ${noResultsSubtitle\n ? html`<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">${noResultsSubtitle}</div>`\n : ''}\n </div>\n </div>\n `;\n }\n\n static renderNoData(noDataMessage: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ${noDataMessage || 'No data available'}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderItem(\n item: any,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderVirtualizedGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridColumns: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n gridColumnWidth?: number,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const colTemplate = gridColumnWidth\n ? `repeat(${gridColumns}, ${gridColumnWidth}px)`\n : `repeat(${gridColumns}, 1fr)`;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const rowStart = vItem.index * gridColumns;\n const rowItems = data.slice(rowStart, rowStart + gridColumns);\n return html`\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:${colTemplate};gap:4px;\">\n ${rowItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderHorizontalGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridRows: number,\n gridColumnWidth: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n ): TemplateResult {\n const offsetLeft = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const rowHeight = 38;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;width:${totalSize}px;height:${rowHeight * gridRows}px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${offsetLeft}px);\">\n ${repeat(\n virtualItems,\n (vCol) => vCol.key,\n (vCol) => {\n const colStart = vCol.index * gridRows;\n const colItems = data.slice(colStart, colStart + gridRows);\n return html`\n <div class=\"combobox__grid-col\" style=\"width:${gridColumnWidth}px;flex-shrink:0;display:flex;flex-direction:column;\">\n ${colItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderAddCustomOption(\n searchValue: string,\n multiple: boolean,\n ): TemplateResult {\n return html`\n <nile-option\n value=${searchValue}\n class=\"combobox__add-option\"\n .showCheckbox=${multiple}\n >\n + Add \"${searchValue}\"\n </nile-option>\n `;\n }\n\n static shouldUseVirtualizer(data: any[], gridColumns = 1): boolean {\n if (gridColumns > 1) return true;\n return data.length >= 5;\n }\n}\n"],"names":["ComboboxRenderer","e","_classCallCheck","_createClass","key","value","renderGroupHeader","row","html","_templateObject","_taggedTemplateLiteral","id","depth","prefix","_templateObject2","label","renderRowsPlain","rows","multiple","getDisplayText","getItemValue","showNoResults","noResultsMessage","isLoading","onScroll","allowHtmlLabel","getItemDescription","getItemPrefix","getItemSuffix","enableDescription","noResultsSubtitle","length","renderNoResults","_templateObject3","map","kind","renderItem","item","renderRowsVirtualized","virtualItems","totalSize","stickyOverlay","stickyIndex","arguments","undefined","_templateObject4","repeat","vItem","index","_templateObject5","posStyle","concat","start","size","headerStyle","_templateObject6","_templateObject7","renderVirtualizedOptions","data","_templateObject8","_templateObject9","renderPlainOptions","_templateObject10","_templateObject11","_templateObject12","renderNoData","noDataMessage","_templateObject13","_s$description","_s$prefix","_s$suffix","_templateObject14","optionValue","displayText","isDisabled","disabled","className","description","suffix","isSelected","Array","isArray","some","v","String","_templateObject15","classMap","option","unsafeHTML","renderVirtualizedGrid","gridColumns","gridColumnWidth","offsetTop","colTemplate","_templateObject16","rowStart","rowItems","slice","_templateObject17","renderHorizontalGrid","gridRows","offsetLeft","_templateObject18","vCol","colStart","colItems","_templateObject19","renderAddCustomOption","searchValue","_templateObject20","shouldUseVirtualizer"],"mappings":"yqEAcaA,CAEX,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,UAAAE,YAAA,CAAAF,CAAA,QAAAG,GAAA,qBAAAC,KAAA,CAAA,QAAA,CAAAC,iBAAOA,CAAkBC,CAAAA,CAAAA,CACvB,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,8QAKSH,CAAII,CAAAA,EAAAA,kBAAAA,MAAAA,CACKJ,CAAIK,CAAAA,KAAAA,EAE3BL,CAAAA,CAAIM,OACFL,CAAI,CAAAM,gBAAA,GAAAA,gBAAA,CAAAJ,sBAAA,+KAEKH,CAAIM,CAAAA,MAAAA,EAIb,EAAA,CACkCN,CAAIQ,CAAAA,KAAAA,EAG/C,CAED,GAAAX,GAAA,mBAAAC,KAAA,SAAA,CAAAW,eAAOA,CACLC,CAAAA,CACAZ,CACAa,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,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AOa,CAAAA,CAAAA,CAAUC,CAAgBC,CAAAA,CAAAA,CACvCK,CAAgBC,CAAAA,CAAAA,CAAoBC,CACpCC,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAIP,CAAA,CAAA,EAOd,CAED,GAAAxB,GAAA,yBAAAC,KAAA,SAAOsG,CAAAA,qBAAAA,CACLC,CACA1F,CAAAA,CAAAA,CAAAA,CAEA,MAAOV,CAAAA,CAAI,CAAAqG,iBAAA,GAAAA,iBAAA,CAAAnG,sBAAA,8KAECkG,CAAAA,CAEQ1F,CAAAA,CAEP0F,CAAAA,EAGd,CAED,GAAAxG,GAAA,wBAAAC,KAAA,SAAA,CAAAyG,oBAAOA,CAAqBpD,CAAAA,CAA2B,IAAdgC,CAAAA,CAAc,CAAA/C,SAAA,CAAAZ,MAAA,IAAAY,SAAA,MAAAC,SAAA,CAAAD,SAAA,IAAA,CAAA,CACrD,MAAI+C,CAAAA,CAAAA,CAAc,CACXhC,EAAAA,CAAAA,CAAK3B,MAAU,EAAA,CACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{html as t}from"lit";import{unsafeHTML as o}from"lit/directives/unsafe-html.js";import{classMap as i}from"lit/directives/class-map.js";import{repeat as
|
|
1
|
+
import{html as t}from"lit";import{unsafeHTML as o}from"lit/directives/unsafe-html.js";import{classMap as i}from"lit/directives/class-map.js";import{repeat as s}from"lit/directives/repeat.js";class e{static renderGroupHeader(o){return t`
|
|
2
2
|
<div
|
|
3
3
|
part="group-header"
|
|
4
4
|
class="combobox__group-header"
|
|
@@ -14,50 +14,53 @@ import{html as t}from"lit";import{unsafeHTML as o}from"lit/directives/unsafe-htm
|
|
|
14
14
|
></nile-icon>`:""}
|
|
15
15
|
<span class="combobox__group-label">${o.label}</span>
|
|
16
16
|
</div>
|
|
17
|
-
`}static renderRowsPlain(o,i,
|
|
17
|
+
`}static renderRowsPlain(o,i,s,r,n,l,a,d,p,c,v,$,b,u,m){return l&&!d&&0===o.length?e.renderNoResults(a,m):t`
|
|
18
18
|
<div
|
|
19
19
|
part="select-options"
|
|
20
20
|
class="combobox__options ${d?"loading":""}"
|
|
21
21
|
>
|
|
22
22
|
<div class="combobox__options-plain" @scroll=${p}>
|
|
23
|
-
${o.map((t=>"header"===t.kind?
|
|
23
|
+
${o.map((t=>"header"===t.kind?e.renderGroupHeader(t):e.renderItem(t.item,i,s,r,n,c,v,$,b,u)))}
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
|
-
`}static renderRowsVirtualized(o,i,r,n,l,a,d,p,c,$,
|
|
26
|
+
`}static renderRowsVirtualized(o,i,r,n,l,a,d,p,c,v,$,b,u,m,x=-1){return t`
|
|
27
27
|
<div
|
|
28
28
|
part="select-options"
|
|
29
29
|
class="combobox__options ${p?"loading":""}"
|
|
30
30
|
>
|
|
31
31
|
<div style="position:relative;height:${i}px;width:100%;">
|
|
32
|
-
${
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
${m??""}
|
|
33
|
+
${s(o,(t=>t.key),(o=>{const i=r[o.index];if(!i)return t``;const s=`position:absolute;top:0;left:0;right:0;transform:translateY(${o.start}px);height:${o.size}px;`;if("header"===i.kind){const r=o.index===x?`${s}visibility:hidden;`:s;return t`
|
|
34
|
+
<div style=${r} class="combobox__group-header-slot">
|
|
35
|
+
${e.renderGroupHeader(i)}
|
|
35
36
|
</div>
|
|
36
|
-
|
|
37
|
-
<div style=${
|
|
38
|
-
${
|
|
37
|
+
`}return t`
|
|
38
|
+
<div style=${s}>
|
|
39
|
+
${e.renderItem(i.item,n,l,a,d,c,v,$,b,u)}
|
|
39
40
|
</div>
|
|
40
41
|
`}))}
|
|
41
42
|
</div>
|
|
42
43
|
</div>
|
|
43
|
-
`}static renderVirtualizedOptions(o,i,r,n,l,a,d,p,c,$,
|
|
44
|
+
`}static renderVirtualizedOptions(o,i,r,n,l,a,d,p,c,v,$,b,u){return t`
|
|
44
45
|
<div
|
|
45
46
|
part="select-options"
|
|
46
47
|
class="combobox__options ${p?"loading":""}"
|
|
47
48
|
>
|
|
48
49
|
<div style="position:relative;height:${i}px;width:100%;">
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
${s(o,(t=>t.key),(o=>{const i=r[o.index],s=`position:absolute;top:0;left:0;right:0;transform:translateY(${o.start}px);height:${o.size}px;`;return t`
|
|
51
|
+
<div style=${s}>
|
|
52
|
+
${e.renderItem(i,n,l,a,d,c,v,$,b,u)}
|
|
53
|
+
</div>
|
|
54
|
+
`}))}
|
|
52
55
|
</div>
|
|
53
56
|
</div>
|
|
54
|
-
`}static renderPlainOptions(o,i,
|
|
57
|
+
`}static renderPlainOptions(o,i,s,r,n,l,a,d,p,c,v,$,b,u,m){return l&&!d&&0===o.length?e.renderNoResults(a,m):t`
|
|
55
58
|
<div
|
|
56
59
|
part="select-options"
|
|
57
60
|
class="combobox__options ${d?"loading":""}"
|
|
58
61
|
>
|
|
59
62
|
<div class="combobox__options-plain" @scroll=${p}>
|
|
60
|
-
${o.map((t=>
|
|
63
|
+
${o.map((t=>e.renderItem(t,i,s,r,n,c,v,$,b,u)))}
|
|
61
64
|
</div>
|
|
62
65
|
</div>
|
|
63
66
|
`}static renderNoResults(o,i){return t`
|
|
@@ -77,60 +80,45 @@ import{html as t}from"lit";import{unsafeHTML as o}from"lit/directives/unsafe-htm
|
|
|
77
80
|
</div>
|
|
78
81
|
</div>
|
|
79
82
|
</div>
|
|
80
|
-
`}static
|
|
83
|
+
`}static renderItem(s,e,r,n,l,a,d,p,c,v){if(!s)return t``;const $=l(s),b=n(s),u=s?.disabled||!1,m=s?.className,x=d?d(s):s?.description??"",_=p?p(s):s?.prefix??"",h=c?c(s):s?.suffix??"";let g=!1;return g=r?Array.isArray(e)&&e.some((t=>String(t)===String($))):String(Array.isArray(e)?e[0]:e)===String($),t`
|
|
81
84
|
<nile-option
|
|
82
|
-
|
|
83
|
-
value=${b}
|
|
84
|
-
.selected=${f}
|
|
85
|
-
.disabled=${m}
|
|
86
|
-
.showCheckbox=${n}
|
|
87
|
-
class=${i({option:v??!1,[x??""]:!!x})}
|
|
88
|
-
.description=${_}
|
|
89
|
-
.isDescriptionEnabled=${v}
|
|
90
|
-
>
|
|
91
|
-
${o(h)}
|
|
92
|
-
${d?o(u):u}
|
|
93
|
-
${o(g)}
|
|
94
|
-
</nile-option>
|
|
95
|
-
`}static renderItem(e,s,r,n,l,a,d,p,c,$){if(!e)return t``;const v=l(e),b=n(e),u=e?.disabled||!1,m=e?.className,x=d?d(e):e?.description??"",_=p?p(e):e?.prefix??"",h=c?c(e):e?.suffix??"";let g=!1;return g=r?Array.isArray(s)&&s.some((t=>String(t)===String(v))):String(Array.isArray(s)?s[0]:s)===String(v),t`
|
|
96
|
-
<nile-option
|
|
97
|
-
value=${v}
|
|
85
|
+
value=${$}
|
|
98
86
|
.selected=${g}
|
|
99
87
|
.disabled=${u}
|
|
100
88
|
.showCheckbox=${r}
|
|
101
|
-
class=${i({option
|
|
89
|
+
class=${i({option:v??!1,[m??""]:!!m})}
|
|
102
90
|
.description=${x}
|
|
103
|
-
.isDescriptionEnabled=${
|
|
91
|
+
.isDescriptionEnabled=${v}
|
|
104
92
|
>
|
|
105
93
|
${o(_)}
|
|
106
94
|
${a?o(b):b}
|
|
107
95
|
${o(h)}
|
|
108
96
|
</nile-option>
|
|
109
|
-
`}static renderVirtualizedGrid(o,i,r,n,l,a,d,p,c,$,
|
|
97
|
+
`}static renderVirtualizedGrid(o,i,r,n,l,a,d,p,c,v,$,b,u,m){const x=o.length>0?o[0].start:0,_=m?`repeat(${a}, ${m}px)`:`repeat(${a}, 1fr)`;return t`
|
|
110
98
|
<div
|
|
111
99
|
part="select-options"
|
|
112
100
|
class="combobox__options ${c?"loading":""}"
|
|
113
101
|
>
|
|
114
102
|
<div style="position:relative;height:${i}px;width:${m?"max-content":"100%"};min-width:100%;">
|
|
115
103
|
<div style="position:absolute;top:0;left:0;width:${m?"max-content":"100%"};min-width:100%;transform:translateY(${x}px);">
|
|
116
|
-
${
|
|
104
|
+
${s(o,(t=>t.key),(o=>{const i=o.index*a,s=r.slice(i,i+a);return t`
|
|
117
105
|
<div class="combobox__grid-row" style="display:grid;grid-template-columns:${_};gap:4px;">
|
|
118
|
-
${
|
|
106
|
+
${s.map((t=>e.renderItem(t,n,l,d,p,v,$,b,u)))}
|
|
119
107
|
</div>
|
|
120
108
|
`}))}
|
|
121
109
|
</div>
|
|
122
110
|
</div>
|
|
123
111
|
</div>
|
|
124
|
-
`}static renderHorizontalGrid(o,i,r,n,l,a,d,p,c,$,
|
|
112
|
+
`}static renderHorizontalGrid(o,i,r,n,l,a,d,p,c,v,$,b,u,m){const x=o.length>0?o[0].start:0;return t`
|
|
125
113
|
<div
|
|
126
114
|
part="select-options"
|
|
127
|
-
class="combobox__options combobox__options--horizontal ${
|
|
115
|
+
class="combobox__options combobox__options--horizontal ${v?"loading":""}"
|
|
128
116
|
>
|
|
129
117
|
<div style="position:relative;width:${i}px;height:${38*a}px;">
|
|
130
118
|
<div style="position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${x}px);">
|
|
131
|
-
${
|
|
119
|
+
${s(o,(t=>t.key),(o=>{const i=o.index*a,s=r.slice(i,i+a);return t`
|
|
132
120
|
<div class="combobox__grid-col" style="width:${d}px;flex-shrink:0;display:flex;flex-direction:column;">
|
|
133
|
-
${
|
|
121
|
+
${s.map((t=>e.renderItem(t,n,l,p,c,$,b,u,m)))}
|
|
134
122
|
</div>
|
|
135
123
|
`}))}
|
|
136
124
|
</div>
|
|
@@ -144,4 +132,4 @@ import{html as t}from"lit";import{unsafeHTML as o}from"lit/directives/unsafe-htm
|
|
|
144
132
|
>
|
|
145
133
|
+ Add "${o}"
|
|
146
134
|
</nile-option>
|
|
147
|
-
`}static shouldUseVirtualizer(t,o=1){return o>1||t.length>=5}}export{
|
|
135
|
+
`}static shouldUseVirtualizer(t,o=1){return o>1||t.length>=5}}export{e as C};
|
|
@@ -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/decorators.js","./nile-floating-panel.css.cjs.js","../internal/nile-element.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js","lit","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,h,o,r,l,a,c,_d,p;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(_litDecoratorsJs){i=_litDecoratorsJs.property;e=_litDecoratorsJs.customElement;},function(_nileFloatingPanelCssCjsJs){s=_nileFloatingPanelCssCjsJs.s;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_tippyEsm009CjsJs){h=_tippyEsm009CjsJs.R;o=_tippyEsm009CjsJs.f;r=_tippyEsm009CjsJs.t;},function(_nileLiteTooltipUtilsCjsJs){l=_nileLiteTooltipUtilsCjsJs.p;a=_nileLiteTooltipUtilsCjsJs.a;},function(_utilitiesVisibilityManagerCjsJs){c=_utilitiesVisibilityManagerCjsJs.V;},function(_lit){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){}],execute:function execute(){_export("N",p=_d=/*#__PURE__*/function(_n){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.placement="bottom",_this.trigger="click",_this.distance=12,_this.skidding=0,_this.arrow="round",_this.animation="fade",_this.duration=200,_this.delay=0,_this.interactive=!0,_this.interactiveBorder=2,_this.maxWidth="none",_this.zIndex=9999,_this.followCursor=!1,_this.hideOnClick=!0,_this.inertia=!1,_this.allowHTML=!1,_this.flip=!0,_this["for"]=null,_this.open=!1,_this.preventOverlayClose=!1,_this.title="",_this.disabled=!1,_this.group=null,_this.closeOnEscape=!0,_this.panelClass="",_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.tippyInstance=null,_this.panelContainer=null,_this.anchorEl=null,_this._suppressOpenWatch=!1,_this._panelId="nile-fp-".concat(Math.random().toString(36).slice(2,9)),_this._boundEscHandler=_this._handleEscapeKey.bind(_assertThisInitialized(_this)),_this._pendingShowListener=null,_this._pendingHideListener=null;return _this;}_inherits(d,_n);return _createClass(d,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"firstUpdated",value:function firstUpdated(){var _this2=this;this._buildDOM(),this._attachTippy(),this._joinGroup(),this.visibilityManager=new c({host:this,target:this.anchorEl||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this2.open;},onAnchorOutOfView:function onAnchorOutOfView(){var _this2$tippyInstance;_this2._setOpen(!1),(_this2$tippyInstance=_this2.tippyInstance)!==null&&_this2$tippyInstance!==void 0&&_this2$tippyInstance.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){var _this2$tippyInstance2;_this2._setOpen(!1),(_this2$tippyInstance2=_this2.tippyInstance)!==null&&_this2$tippyInstance2!==void 0&&_this2$tippyInstance2.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this2.emit("nile-".concat(t),i);}}),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(d,"disconnectedCallback",this,3)([]),this._cleanupPendingShowListener(),this._cleanupPendingHideListener(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this._leaveGroup(),this._removeEscListener(),this._destroyTippy(),this.emit("nile-destroy");}},{key:"updated",value:function updated(t){var _this$visibilityManag2,_this3=this,_this$visibilityManag3,_this$tippyInstance;if(_superPropGet(d,"updated",this,3)([t]),!this.panelContainer)return;t.has("open")&&!this._suppressOpenWatch&&(this.open?((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),queueMicrotask(function(){var _this3$tippyInstance;return(_this3$tippyInstance=_this3.tippyInstance)===null||_this3$tippyInstance===void 0?void 0:_this3$tippyInstance.show();})):((_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),(_this$tippyInstance=this.tippyInstance)===null||_this$tippyInstance===void 0?void 0:_this$tippyInstance.hide())),t.has("group")&&(this._leaveGroup(t.get("group")),this._joinGroup());["placement","trigger","distance","skidding","arrow","animation","duration","delay","interactive","interactiveBorder","maxWidth","zIndex","followCursor","hideOnClick","inertia","allowHTML","flip","preventOverlayClose","disabled","width","height","panelClass"].some(function(i){return t.has(i);})&&this._attachTippy();}},{key:"show",value:function show(){var _this4=this;return this.open=!0,new Promise(function(t){_this4._cleanupPendingShowListener();var i=function i(){_this4._pendingShowListener=null,t();};_this4._pendingShowListener=i,_this4.addEventListener("nile-after-show",i,{once:!0});});}},{key:"hide",value:function hide(){var _this5=this;return this.open=!1,new Promise(function(t){_this5._cleanupPendingHideListener();var i=function i(){_this5._pendingHideListener=null,t();};_this5._pendingHideListener=i,_this5.addEventListener("nile-after-hide",i,{once:!0});});}},{key:"_cleanupPendingShowListener",value:function _cleanupPendingShowListener(){this._pendingShowListener&&(this.removeEventListener("nile-after-show",this._pendingShowListener),this._pendingShowListener=null);}},{key:"_cleanupPendingHideListener",value:function _cleanupPendingHideListener(){this._pendingHideListener&&(this.removeEventListener("nile-after-hide",this._pendingHideListener),this._pendingHideListener=null);}},{key:"toggle",value:function toggle(){this.open=!this.open;}},{key:"refresh",value:function refresh(){this._attachTippy();}},{key:"reposition",value:function reposition(){var _this$tippyInstance2;(_this$tippyInstance2=this.tippyInstance)===null||_this$tippyInstance2===void 0||(_this$tippyInstance2=_this$tippyInstance2.popperInstance)===null||_this$tippyInstance2===void 0||_this$tippyInstance2.update();}},{key:"getCurrentPlacement",value:function getCurrentPlacement(){var _this$tippyInstance3,_i$dataset$placement;var t=(_this$tippyInstance3=this.tippyInstance)===null||_this$tippyInstance3===void 0?void 0:_this$tippyInstance3.popper,i=t===null||t===void 0?void 0:t.querySelector(".tippy-box");return(_i$dataset$placement=i===null||i===void 0?void 0:i.dataset.placement)!==null&&_i$dataset$placement!==void 0?_i$dataset$placement:this.placement;}},{key:"isPositioningOptimal",value:function isPositioningOptimal(){return this.getCurrentPlacement()===this.placement;}},{key:"_joinGroup",value:function _joinGroup(){if(!this.group)return;var t=_d._groups.get(this.group);t||(t=new Set(),_d._groups.set(this.group,t)),t.add(this);}},{key:"_leaveGroup",value:function _leaveGroup(t){var i=t!==null&&t!==void 0?t:this.group;if(!i)return;var e=_d._groups.get(i);e&&(e["delete"](this),0===e.size&&_d._groups["delete"](i));}},{key:"_hideGroupSiblings",value:function _hideGroupSiblings(){var _this6=this;if(!this.group)return;var t=_d._groups.get(this.group);t&&t.forEach(function(t){var _t$tippyInstance;t!==_this6&&t.open&&(t._setOpen(!1),(_t$tippyInstance=t.tippyInstance)===null||_t$tippyInstance===void 0?void 0:_t$tippyInstance.hide());});}},{key:"_addEscListener",value:function _addEscListener(){this.closeOnEscape&&document.addEventListener("keydown",this._boundEscHandler);}},{key:"_removeEscListener",value:function _removeEscListener(){document.removeEventListener("keydown",this._boundEscHandler);}},{key:"_handleEscapeKey",value:function _handleEscapeKey(t){var _this$tippyInstance4;"Escape"===t.key&&this.open&&(this._setOpen(!1),(_this$tippyInstance4=this.tippyInstance)===null||_this$tippyInstance4===void 0?void 0:_this$tippyInstance4.hide());}},{key:"_applyAria",value:function _applyAria(){this.anchorEl&&this.panelContainer&&(this.panelContainer.setAttribute("role","dialog"),this.panelContainer.id=this._panelId,this.anchorEl.setAttribute("aria-haspopup","dialog"),this._syncAriaExpanded());}},{key:"_syncAriaExpanded",value:function _syncAriaExpanded(){var _this$anchorEl,_this$anchorEl2,_this$anchorEl3;(_this$anchorEl=this.anchorEl)!==null&&_this$anchorEl!==void 0&&_this$anchorEl.setAttribute("aria-expanded",String(this.open)),this.open?(_this$anchorEl2=this.anchorEl)===null||_this$anchorEl2===void 0?void 0:_this$anchorEl2.setAttribute("aria-describedby",this._panelId):(_this$anchorEl3=this.anchorEl)===null||_this$anchorEl3===void 0?void 0:_this$anchorEl3.removeAttribute("aria-describedby");}},{key:"_buildDOM",value:function _buildDOM(){var t=Array.from(this.childNodes);this.anchorEl=null;var i=[],e=[],s=[];var n=!1;for(var _i=0,_t=t;_i<_t.length;_i++){var _h=_t[_i];if(_h instanceof HTMLElement){var _t2=_h.getAttribute("slot");if("title"===_t2){_h.removeAttribute("slot"),i.push(_h);continue;}if("action"===_t2){_h.removeAttribute("slot"),e.push(_h);continue;}if(!n&&!this["for"]){this.anchorEl=_h,n=!0;continue;}}s.push(_h);}if(this["for"]){var _t3=document.getElementById(this["for"]);_t3&&(this.anchorEl=_t3);}for(;this.firstChild;)this.removeChild(this.firstChild);this.anchorEl&&!this["for"]&&this.appendChild(this.anchorEl),this.panelContainer=document.createElement("div"),this.panelContainer.className="nile-floating-panel__content",this.panelContainer.style.display="none";var h=document.createElement("div");if(h.className="nile-floating-panel__body",i.length>0||this.title){var _t4=document.createElement("div");_t4.className="nile-floating-panel__title",this.title?_t4.textContent=this.title:i.forEach(function(i){return _t4.appendChild(i);}),h.appendChild(_t4);}if(s.length>0){var _t5=document.createElement("div");_t5.className="nile-floating-panel__main",s.forEach(function(i){return _t5.appendChild(i);}),h.appendChild(_t5);}if(e.length>0){var _t6=document.createElement("div");_t6.className="nile-floating-panel__action",e.forEach(function(i){return _t6.appendChild(i);}),h.appendChild(_t6);}this.panelContainer.appendChild(h),this.appendChild(this.panelContainer),this._applyAria();}},{key:"_resolveArrow",value:function _resolveArrow(){switch(this.arrow){case"round":return h;case"none":return!1;default:return!0;}}},{key:"_setOpen",value:function _setOpen(t){this._suppressOpenWatch=!0,this.open=t,this._syncAriaExpanded(),this._suppressOpenWatch=!1;}},{key:"_getEffectiveDuration",value:function _getEffectiveDuration(){return _d.prefersReducedMotion?0:l(this.duration);}},{key:"_getEffectiveAnimation",value:function _getEffectiveAnimation(){return!_d.prefersReducedMotion&&this.animation;}},{key:"_attachTippy",value:function _attachTippy(){var _this7=this;if(this._destroyTippy(),this.disabled||!this.anchorEl||!this.panelContainer)return;var t=a(this.followCursor),i=!this.preventOverlayClose&&this.hideOnClick,e={content:this.panelContainer,placement:this.placement,trigger:this.trigger,offset:[this.skidding,this.distance],theme:"floating-panel",animation:this._getEffectiveAnimation(),interactive:this.interactive,arrow:this._resolveArrow(),duration:this._getEffectiveDuration(),allowHTML:this.allowHTML,delay:this.delay,maxWidth:this.maxWidth,zIndex:this.zIndex,hideOnClick:i,inertia:!_d.prefersReducedMotion&&this.inertia,interactiveBorder:this.interactiveBorder,appendTo:document.body,followCursor:t,plugins:t?[o]:[],popperOptions:{modifiers:[{name:"flip",enabled:this.flip}]},onMount:function onMount(t){_this7.panelContainer&&(_this7.panelContainer.style.display=""),_this7.panelClass&&_this7.panelClass.split(/\s+/).filter(Boolean).forEach(function(i){t.popper.classList.add(i);});},onShow:function onShow(t){_this7.panelContainer&&(_this7.panelContainer.style.display="");var i=t.popper.querySelector(".tippy-content");i&&(_this7.width&&(i.style.width=_this7.width),_this7.height&&(i.style.height=_this7.height,i.style.overflow="auto")),_this7._hideGroupSiblings(),_this7._setOpen(!0),_this7._addEscListener(),_this7.dispatchEvent(new CustomEvent("nile-show",{detail:{instance:t,target:t.reference}})),_this7.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!0,instance:t,target:t.reference}}));},onShown:function onShown(t){_this7.dispatchEvent(new CustomEvent("nile-after-show",{detail:{instance:t,target:t.reference}}));},onHide:function onHide(t){_this7._setOpen(!1),_this7._removeEscListener(),_this7.dispatchEvent(new CustomEvent("nile-hide",{detail:{instance:t,target:t.reference}})),_this7.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!1,instance:t,target:t.reference}}));},onHidden:function onHidden(t){_this7.panelContainer&&(_this7.panelContainer.style.display="none"),_this7.dispatchEvent(new CustomEvent("nile-after-hide",{detail:{instance:t,target:t.reference}}));}};this.tippyInstance=r(this.anchorEl,e),this.open&&queueMicrotask(function(){var _this7$tippyInstance;return(_this7$tippyInstance=_this7.tippyInstance)===null||_this7$tippyInstance===void 0?void 0:_this7$tippyInstance.show();});}},{key:"_destroyTippy",value:function _destroyTippy(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.panelContainer&&(this.panelContainer.style.display="none",this.panelContainer.parentElement!==this&&this.appendChild(this.panelContainer));}}],[{key:"prefersReducedMotion",get:function get(){return _d._reducedMotionQuery||(_d._reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)")),_d._reducedMotionQuery.matches;}},{key:"styles",get:function get(){return[s];}}]);}(n));p._groups=new Map(),p._reducedMotionQuery=null,t([i({type:String})],p.prototype,"placement",void 0),t([i({type:String})],p.prototype,"trigger",void 0),t([i({type:Number})],p.prototype,"distance",void 0),t([i({type:Number})],p.prototype,"skidding",void 0),t([i({type:String,reflect:!0})],p.prototype,"arrow",void 0),t([i({type:String,reflect:!0})],p.prototype,"animation",void 0),t([i({type:String,reflect:!0})],p.prototype,"duration",void 0),t([i({type:String,reflect:!0})],p.prototype,"delay",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"interactive",void 0),t([i({type:Number,reflect:!0})],p.prototype,"interactiveBorder",void 0),t([i({type:String,reflect:!0})],p.prototype,"maxWidth",void 0),t([i({type:Number,reflect:!0})],p.prototype,"zIndex",void 0),t([i({type:String,reflect:!0})],p.prototype,"followCursor",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"hideOnClick",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"inertia",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"allowHTML",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"flip",void 0),t([i({type:String,attribute:"for"})],p.prototype,"for",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"open",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"preventOverlayClose",void 0),t([i({type:String,reflect:!0})],p.prototype,"title",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),t([i({type:String,reflect:!0})],p.prototype,"width",void 0),t([i({type:String,reflect:!0})],p.prototype,"height",void 0),t([i({type:String,reflect:!0})],p.prototype,"group",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"closeOnEscape",void 0),t([i({type:String,reflect:!0,attribute:!0})],p.prototype,"panelClass",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"enableVisibilityEffect",void 0),t([i({type:Boolean,reflect:!0})],p.prototype,"enableTabClose",void 0),_export("N",p=_d=t([e("nile-floating-panel")],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/decorators.js","./nile-floating-panel.css.cjs.js","../internal/nile-element.cjs.js","../tippy.esm-78baa8f2.cjs.js","../nile-lite-tooltip/utils.cjs.js","../utilities/visibility-manager.cjs.js","lit","../internal/accessibility/a11y.state.enum.cjs.js","../internal/accessibility/a11y.property.enum.cjs.js","../internal/accessibility/role.enum.cjs.js"],function(_export,_context){"use strict";var t,i,e,s,n,h,o,r,l,a,d,_c,p,u,f;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);}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure 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 _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 _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;e=_litDecoratorsJs.customElement;},function(_nileFloatingPanelCssCjsJs){s=_nileFloatingPanelCssCjsJs.s;},function(_internalNileElementCjsJs){n=_internalNileElementCjsJs.N;},function(_tippyEsm009CjsJs){h=_tippyEsm009CjsJs.f;o=_tippyEsm009CjsJs.t;r=_tippyEsm009CjsJs.R;},function(_nileLiteTooltipUtilsCjsJs){l=_nileLiteTooltipUtilsCjsJs.p;a=_nileLiteTooltipUtilsCjsJs.a;},function(_utilitiesVisibilityManagerCjsJs){d=_utilitiesVisibilityManagerCjsJs.V;},function(_lit){},function(_internalAccessibilityA11yStateEnumCjsJs){},function(_internalAccessibilityA11yPropertyEnumCjsJs){},function(_internalAccessibilityRoleEnumCjsJs){}],execute:function execute(){p=/^<svg width="(\d+)" height="(\d+)"[^>]*><path d="(.+?)H0z"/.exec(r),u=function(){if(!p)return r;var _p=_slicedToArray(p,4),t=_p[1],i=_p[2],e=_p[3],s=Number(t),n=Number(i)+1;return"<svg width=\"".concat(s,"\" height=\"").concat(n,"\" viewBox=\"0 0 ").concat(s," ").concat(n,"\" aria-hidden=\"true\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"").concat(e,"V").concat(n,"H0Z\"></path><path class=\"nile-floating-panel__arrow-outline\" d=\"").concat(e,"\"></path></svg>");}();_export("N",f=_c=/*#__PURE__*/function(_n){function c(){var _this;_classCallCheck(this,c);_this=_callSuper(this,c,arguments),_this.placement="bottom",_this.trigger="click",_this.distance=12,_this.skidding=0,_this.arrow="round",_this.animation="fade",_this.duration=200,_this.delay=0,_this.interactive=!0,_this.interactiveBorder=2,_this.maxWidth="none",_this.zIndex=9999,_this.followCursor=!1,_this.hideOnClick=!0,_this.inertia=!1,_this.allowHTML=!1,_this.flip=!0,_this["for"]=null,_this.open=!1,_this.preventOverlayClose=!1,_this.title="",_this.disabled=!1,_this.group=null,_this.closeOnEscape=!0,_this.panelClass="",_this.enableVisibilityEffect=!1,_this.enableTabClose=!1,_this.tippyInstance=null,_this.panelContainer=null,_this.anchorEl=null,_this._suppressOpenWatch=!1,_this._panelId="nile-fp-".concat(Math.random().toString(36).slice(2,9)),_this._boundEscHandler=_this._handleEscapeKey.bind(_assertThisInitialized(_this)),_this._pendingShowListener=null,_this._pendingHideListener=null;return _this;}_inherits(c,_n);return _createClass(c,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"firstUpdated",value:function firstUpdated(){var _this2=this;this._buildDOM(),this._attachTippy(),this._joinGroup(),this.visibilityManager=new d({host:this,target:this.anchorEl||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:function isOpen(){return _this2.open;},onAnchorOutOfView:function onAnchorOutOfView(){var _this2$tippyInstance;_this2._setOpen(!1),(_this2$tippyInstance=_this2.tippyInstance)!==null&&_this2$tippyInstance!==void 0&&_this2$tippyInstance.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"});},onDocumentHidden:function onDocumentHidden(){var _this2$tippyInstance2;_this2._setOpen(!1),(_this2$tippyInstance2=_this2.tippyInstance)!==null&&_this2$tippyInstance2!==void 0&&_this2$tippyInstance2.hide(),_this2.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"});},emit:function emit(t,i){return _this2.emit("nile-".concat(t),i);}}),this.emit("nile-init");}},{key:"disconnectedCallback",value:function disconnectedCallback(){var _this$visibilityManag;_superPropGet(c,"disconnectedCallback",this,3)([]),this._cleanupPendingShowListener(),this._cleanupPendingHideListener(),(_this$visibilityManag=this.visibilityManager)!==null&&_this$visibilityManag!==void 0&&_this$visibilityManag.cleanup(),this._leaveGroup(),this._removeEscListener(),this._destroyTippy(),this.emit("nile-destroy");}},{key:"updated",value:function updated(t){var _this$visibilityManag2,_this3=this,_this$visibilityManag3,_this$tippyInstance;if(_superPropGet(c,"updated",this,3)([t]),!this.panelContainer)return;t.has("open")&&!this._suppressOpenWatch&&(this.open?((_this$visibilityManag2=this.visibilityManager)!==null&&_this$visibilityManag2!==void 0&&_this$visibilityManag2.setup(),queueMicrotask(function(){var _this3$tippyInstance;return(_this3$tippyInstance=_this3.tippyInstance)===null||_this3$tippyInstance===void 0?void 0:_this3$tippyInstance.show();})):((_this$visibilityManag3=this.visibilityManager)!==null&&_this$visibilityManag3!==void 0&&_this$visibilityManag3.cleanup(),(_this$tippyInstance=this.tippyInstance)===null||_this$tippyInstance===void 0?void 0:_this$tippyInstance.hide())),t.has("group")&&(this._leaveGroup(t.get("group")),this._joinGroup());["placement","trigger","distance","skidding","arrow","animation","duration","delay","interactive","interactiveBorder","maxWidth","zIndex","followCursor","hideOnClick","inertia","allowHTML","flip","preventOverlayClose","disabled","width","height","panelClass"].some(function(i){return t.has(i);})&&this._attachTippy();}},{key:"show",value:function show(){var _this4=this;return this.open=!0,new Promise(function(t){_this4._cleanupPendingShowListener();var i=function i(){_this4._pendingShowListener=null,t();};_this4._pendingShowListener=i,_this4.addEventListener("nile-after-show",i,{once:!0});});}},{key:"hide",value:function hide(){var _this5=this;return this.open=!1,new Promise(function(t){_this5._cleanupPendingHideListener();var i=function i(){_this5._pendingHideListener=null,t();};_this5._pendingHideListener=i,_this5.addEventListener("nile-after-hide",i,{once:!0});});}},{key:"_cleanupPendingShowListener",value:function _cleanupPendingShowListener(){this._pendingShowListener&&(this.removeEventListener("nile-after-show",this._pendingShowListener),this._pendingShowListener=null);}},{key:"_cleanupPendingHideListener",value:function _cleanupPendingHideListener(){this._pendingHideListener&&(this.removeEventListener("nile-after-hide",this._pendingHideListener),this._pendingHideListener=null);}},{key:"toggle",value:function toggle(){this.open=!this.open;}},{key:"refresh",value:function refresh(){this._attachTippy();}},{key:"reposition",value:function reposition(){var _this$tippyInstance2;(_this$tippyInstance2=this.tippyInstance)===null||_this$tippyInstance2===void 0||(_this$tippyInstance2=_this$tippyInstance2.popperInstance)===null||_this$tippyInstance2===void 0||_this$tippyInstance2.update();}},{key:"getCurrentPlacement",value:function getCurrentPlacement(){var _this$tippyInstance3,_i$dataset$placement;var t=(_this$tippyInstance3=this.tippyInstance)===null||_this$tippyInstance3===void 0?void 0:_this$tippyInstance3.popper,i=t===null||t===void 0?void 0:t.querySelector(".tippy-box");return(_i$dataset$placement=i===null||i===void 0?void 0:i.dataset.placement)!==null&&_i$dataset$placement!==void 0?_i$dataset$placement:this.placement;}},{key:"isPositioningOptimal",value:function isPositioningOptimal(){return this.getCurrentPlacement()===this.placement;}},{key:"_joinGroup",value:function _joinGroup(){if(!this.group)return;var t=_c._groups.get(this.group);t||(t=new Set(),_c._groups.set(this.group,t)),t.add(this);}},{key:"_leaveGroup",value:function _leaveGroup(t){var i=t!==null&&t!==void 0?t:this.group;if(!i)return;var e=_c._groups.get(i);e&&(e["delete"](this),0===e.size&&_c._groups["delete"](i));}},{key:"_hideGroupSiblings",value:function _hideGroupSiblings(){var _this6=this;if(!this.group)return;var t=_c._groups.get(this.group);t&&t.forEach(function(t){var _t$tippyInstance;t!==_this6&&t.open&&(t._setOpen(!1),(_t$tippyInstance=t.tippyInstance)===null||_t$tippyInstance===void 0?void 0:_t$tippyInstance.hide());});}},{key:"_addEscListener",value:function _addEscListener(){this.closeOnEscape&&document.addEventListener("keydown",this._boundEscHandler);}},{key:"_removeEscListener",value:function _removeEscListener(){document.removeEventListener("keydown",this._boundEscHandler);}},{key:"_handleEscapeKey",value:function _handleEscapeKey(t){var _this$tippyInstance4;"Escape"===t.key&&this.open&&(this._setOpen(!1),(_this$tippyInstance4=this.tippyInstance)===null||_this$tippyInstance4===void 0?void 0:_this$tippyInstance4.hide());}},{key:"_applyAria",value:function _applyAria(){this.anchorEl&&this.panelContainer&&(this.panelContainer.setAttribute("role","dialog"),this.panelContainer.id=this._panelId,this.anchorEl.setAttribute("aria-haspopup","dialog"),this._syncAriaExpanded());}},{key:"_syncAriaExpanded",value:function _syncAriaExpanded(){var _this$anchorEl,_this$anchorEl2,_this$anchorEl3;(_this$anchorEl=this.anchorEl)!==null&&_this$anchorEl!==void 0&&_this$anchorEl.setAttribute("aria-expanded",String(this.open)),this.open?(_this$anchorEl2=this.anchorEl)===null||_this$anchorEl2===void 0?void 0:_this$anchorEl2.setAttribute("aria-describedby",this._panelId):(_this$anchorEl3=this.anchorEl)===null||_this$anchorEl3===void 0?void 0:_this$anchorEl3.removeAttribute("aria-describedby");}},{key:"_buildDOM",value:function _buildDOM(){var t=Array.from(this.childNodes);this.anchorEl=null;var i=[],e=[],s=[];var n=!1;for(var _i=0,_t=t;_i<_t.length;_i++){var _h=_t[_i];if(_h instanceof HTMLElement){var _t2=_h.getAttribute("slot");if("title"===_t2){_h.removeAttribute("slot"),i.push(_h);continue;}if("action"===_t2){_h.removeAttribute("slot"),e.push(_h);continue;}if(!n&&!this["for"]){this.anchorEl=_h,n=!0;continue;}}s.push(_h);}if(this["for"]){var _t3=document.getElementById(this["for"]);_t3&&(this.anchorEl=_t3);}for(;this.firstChild;)this.removeChild(this.firstChild);this.anchorEl&&!this["for"]&&this.appendChild(this.anchorEl),this.panelContainer=document.createElement("div"),this.panelContainer.className="nile-floating-panel__content",this.panelContainer.style.display="none";var h=document.createElement("div");if(h.className="nile-floating-panel__body",i.length>0||this.title){var _t4=document.createElement("div");_t4.className="nile-floating-panel__title",this.title?_t4.textContent=this.title:i.forEach(function(i){return _t4.appendChild(i);}),h.appendChild(_t4);}if(s.length>0){var _t5=document.createElement("div");_t5.className="nile-floating-panel__main",s.forEach(function(i){return _t5.appendChild(i);}),h.appendChild(_t5);}if(e.length>0){var _t6=document.createElement("div");_t6.className="nile-floating-panel__action",e.forEach(function(i){return _t6.appendChild(i);}),h.appendChild(_t6);}this.panelContainer.appendChild(h),this.appendChild(this.panelContainer),this._applyAria();}},{key:"_resolveArrow",value:function _resolveArrow(){switch(this.arrow){case"round":return u;case"none":return!1;default:return!0;}}},{key:"_setOpen",value:function _setOpen(t){this._suppressOpenWatch=!0,this.open=t,this._syncAriaExpanded(),this._suppressOpenWatch=!1;}},{key:"_getEffectiveDuration",value:function _getEffectiveDuration(){return _c.prefersReducedMotion?0:l(this.duration);}},{key:"_getEffectiveAnimation",value:function _getEffectiveAnimation(){return!_c.prefersReducedMotion&&this.animation;}},{key:"_attachTippy",value:function _attachTippy(){var _this7=this;if(this._destroyTippy(),this.disabled||!this.anchorEl||!this.panelContainer)return;var t=a(this.followCursor),i=!this.preventOverlayClose&&this.hideOnClick,e={content:this.panelContainer,placement:this.placement,trigger:this.trigger,offset:[this.skidding,this.distance],theme:"floating-panel",animation:this._getEffectiveAnimation(),interactive:this.interactive,arrow:this._resolveArrow(),duration:this._getEffectiveDuration(),allowHTML:this.allowHTML,delay:this.delay,maxWidth:this.maxWidth,zIndex:this.zIndex,hideOnClick:i,inertia:!_c.prefersReducedMotion&&this.inertia,interactiveBorder:this.interactiveBorder,appendTo:document.body,followCursor:t,plugins:t?[h]:[],popperOptions:{modifiers:[{name:"flip",enabled:this.flip}]},onMount:function onMount(t){_this7.panelContainer&&(_this7.panelContainer.style.display=""),_this7.panelClass&&_this7.panelClass.split(/\s+/).filter(Boolean).forEach(function(i){t.popper.classList.add(i);});},onShow:function onShow(t){_this7.panelContainer&&(_this7.panelContainer.style.display="");var i=t.popper.querySelector(".tippy-content");i&&(_this7.width&&(i.style.width=_this7.width),_this7.height&&(i.style.height=_this7.height,i.style.overflow="auto")),_this7._hideGroupSiblings(),_this7._setOpen(!0),_this7._addEscListener(),_this7.dispatchEvent(new CustomEvent("nile-show",{detail:{instance:t,target:t.reference}})),_this7.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!0,instance:t,target:t.reference}}));},onShown:function onShown(t){_this7.dispatchEvent(new CustomEvent("nile-after-show",{detail:{instance:t,target:t.reference}}));},onHide:function onHide(t){_this7._setOpen(!1),_this7._removeEscListener(),_this7.dispatchEvent(new CustomEvent("nile-hide",{detail:{instance:t,target:t.reference}})),_this7.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!1,instance:t,target:t.reference}}));},onHidden:function onHidden(t){_this7.panelContainer&&(_this7.panelContainer.style.display="none"),_this7.dispatchEvent(new CustomEvent("nile-after-hide",{detail:{instance:t,target:t.reference}}));}};this.tippyInstance=o(this.anchorEl,e),this.open&&queueMicrotask(function(){var _this7$tippyInstance;return(_this7$tippyInstance=_this7.tippyInstance)===null||_this7$tippyInstance===void 0?void 0:_this7$tippyInstance.show();});}},{key:"_destroyTippy",value:function _destroyTippy(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.panelContainer&&(this.panelContainer.style.display="none",this.panelContainer.parentElement!==this&&this.appendChild(this.panelContainer));}}],[{key:"prefersReducedMotion",get:function get(){return _c._reducedMotionQuery||(_c._reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)")),_c._reducedMotionQuery.matches;}},{key:"styles",get:function get(){return[s];}}]);}(n));f._groups=new Map(),f._reducedMotionQuery=null,t([i({type:String})],f.prototype,"placement",void 0),t([i({type:String})],f.prototype,"trigger",void 0),t([i({type:Number})],f.prototype,"distance",void 0),t([i({type:Number})],f.prototype,"skidding",void 0),t([i({type:String,reflect:!0})],f.prototype,"arrow",void 0),t([i({type:String,reflect:!0})],f.prototype,"animation",void 0),t([i({type:String,reflect:!0})],f.prototype,"duration",void 0),t([i({type:String,reflect:!0})],f.prototype,"delay",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"interactive",void 0),t([i({type:Number,reflect:!0})],f.prototype,"interactiveBorder",void 0),t([i({type:String,reflect:!0})],f.prototype,"maxWidth",void 0),t([i({type:Number,reflect:!0})],f.prototype,"zIndex",void 0),t([i({type:String,reflect:!0})],f.prototype,"followCursor",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"hideOnClick",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"inertia",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"allowHTML",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"flip",void 0),t([i({type:String,attribute:"for"})],f.prototype,"for",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"open",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"preventOverlayClose",void 0),t([i({type:String,reflect:!0})],f.prototype,"title",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"disabled",void 0),t([i({type:String,reflect:!0})],f.prototype,"width",void 0),t([i({type:String,reflect:!0})],f.prototype,"height",void 0),t([i({type:String,reflect:!0})],f.prototype,"group",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"closeOnEscape",void 0),t([i({type:String,reflect:!0,attribute:!0})],f.prototype,"panelClass",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"enableVisibilityEffect",void 0),t([i({type:Boolean,reflect:!0})],f.prototype,"enableTabClose",void 0),_export("N",f=_c=t([e("nile-floating-panel")],f));}};});
|
|
2
2
|
//# sourceMappingURL=nile-floating-panel.cjs.js.map
|