@momentum-design/components 0.112.4 → 0.112.5
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/dist/browser/index.js
CHANGED
@@ -2362,7 +2362,7 @@
|
|
2362
2362
|
border-top-right-radius: var(--mdc-popover-arrow-border-radius);
|
2363
2363
|
border-bottom-left-radius: 100%;
|
2364
2364
|
}
|
2365
|
-
`,Bu=[TE];var bl=class{constructor(o){this.arrowPixelChange=!1;this.popover=o}setupDelay(){try{let[o,t]=this.popover.delay.split(",").map(i=>{let a=parseInt(i,10);if(Number.isNaN(a)||a<0)throw new Error(`Invalid delay value: ${i}`);return a});return[o,t]}catch{return this.popover.delay="0,0",[0,0]}}setupHoverBridge(o){let t=this.popover.renderRoot.querySelector(".popover-hover-bridge");Object.assign(t.style,{top:"",left:"",right:"",bottom:""});let i=`calc(${this.popover.showArrow?"0.75rem + ":""}${this.popover.offset}px)`,a=this.popover.offsetHeight||0,h=this.popover.offsetWidth||0;if(t)switch(o.split("-")[0]){case"top":t.style.height=i,t.style.bottom=`calc(-1 * (${i}))`,t.style.left="50%",t.style.width=`${h}px`;break;case"left":t.style.height=`${a}px`,t.style.width=i,t.style.right=`calc(-1.5 * (${i}))`;break;case"right":t.style.height=`${a}px`,t.style.width=i,t.style.left=`calc(-0.5 * (${i}))`;break;case"bottom":default:t.style.height=i,t.style.top=`calc(-1 * (${i}))`,t.style.left="50%",t.style.width=`${h}px`;break}}setupAppendTo(){if(this.popover.appendTo){let o=document.getElementById(this.popover.appendTo);o&&o.appendChild(this.popover)}}updateAriaLabels(){var o,t,i;this.popover.interactive&&this.popover.role&&(this.popover.ariaLabel||(this.popover.ariaLabel=((o=this.popover.triggerElement)==null?void 0:o.ariaLabel)||((t=this.popover.triggerElement)==null?void 0:t.textContent)||""),this.popover.ariaLabelledby||(this.popover.ariaLabelledby=((i=this.popover.triggerElement)==null?void 0:i.id)||""))}updateAriaModal(){this.popover.role===it.DIALOG||this.popover.role===it.ALERTDIALOG?this.popover.setAttribute("aria-modal","true"):this.popover.removeAttribute("aria-modal")}updateAriaExpandedAttribute(){var o,t,i;this.popover.disableAriaExpanded||((o=this.popover.triggerElement)==null||o.setAttribute("aria-expanded",`${this.popover.visible}`),(i=this.popover.triggerElement)==null||i.setAttribute("aria-haspopup",((t=this.popover.triggerElement)==null?void 0:t.getAttribute("aria-haspopup"))||this.popover.role||"dialog"))}updateArrowStyle(o,t){var j;if(!this.popover.arrowElement)return;let i=t.split("-")[0],a={top:"bottom",right:"left",bottom:"top",left:"right"}[i],{x:h,y:m}=o,b=this.popover.arrowElement.getBoundingClientRect(),C=(j=this.popover.arrowElement.offsetParent)==null?void 0:j.getBoundingClientRect();if(!this.arrowPixelChange){let q=C!=null&&C[a]?12-Math.abs(b[a]-C[a]):0;Math.round(q)===1?this.arrowPixelChange=!0:this.arrowPixelChange=!1}let O=this.arrowPixelChange?.5:0;this.popover.arrowElement.setAttribute("data-side",i),Object.assign(this.popover.arrowElement.style,{left:h!=null?`${h}px`:"",top:m!=null?`${m}px`:"",[a]:`${-this.popover.arrowElement.offsetHeight/2-O}px`})}updatePopoverStyle(o,t){Object.assign(this.popover.style,{left:`${o}px`,top:`${t}px`})}};var _t=class extends fl(gl(vl(K))){constructor(){super();this.id="";this.triggerID="";this.trigger=Ct.TRIGGER;this.placement=Ct.PLACEMENT;this.color=Ct.COLOR;this.visible=Ct.VISIBLE;this.offset=Ct.OFFSET;this.boundary=Ct.BOUNDARY;this.boundaryRoot=Ct.BOUNDARY_ROOT;this.focusTrap=Ct.FOCUS_TRAP;this.preventScroll=Ct.PREVENT_SCROLL;this.showArrow=Ct.ARROW;this.closeButton=Ct.CLOSE_BUTTON;this.interactive=Ct.INTERACTIVE;this.delay=Ct.DELAY;this.hideOnEscape=Ct.HIDE_ON_ESCAPE;this.propagateEventOnEscape=Ct.PROPAGATE_EVENT_ON_ESCAPE;this.hideOnBlur=Ct.HIDE_ON_BLUR;this.hideOnOutsideClick=Ct.HIDE_ON_CLICK_OUTSIDE;this.focusBackToTrigger=Ct.FOCUS_BACK;this.backdrop=Ct.BACKDROP;this.isBackdropInvisible=Ct.IS_BACKDROP_INVISIBLE;this.flip=Ct.FLIP;this.size=Ct.SIZE;this.zIndex=Ct.Z_INDEX;this.closeButtonAriaLabel=null;this.strategy=Ct.STRATEGY;this.role=Ct.ROLE;this.ariaLabelledby=null;this.ariaDescribedby=null;this.disableAriaExpanded=Ct.DISABLE_ARIA_EXPANDED;this.keepConnectedTooltipClosed=Ct.KEEP_CONNECTED_TOOLTIP_CLOSED;this.arrowElement=null;this.hoverTimer=null;this.isHovered=!1;this.openDelay=0;this.closeDelay=0;this.floatingUICleanupFunction=null;this.shouldSuppressOpening=!1;this.parseTrigger=()=>{var h;let a=(((h=this.trigger)==null?void 0:h.split(" "))||[]).filter(m=>Object.values(mo).includes(m)).length>0?this.trigger:Ct.TRIGGER;a==="mouseenter"&&(this.interactive?a="mouseenter click":a="mouseenter focusin"),this.trigger=a};this.setupTriggerListeners=()=>{if(this.trigger.includes("click")&&document.addEventListener("click",this.togglePopoverVisible,{capture:!0}),this.trigger.includes("mouseenter")){let t=this.renderRoot.querySelector(".popover-hover-bridge");t==null||t.addEventListener("mouseenter",this.show),document.addEventListener("mouseenter",this.handleMouseEnter,{capture:!0}),document.addEventListener("mouseleave",this.handleMouseLeave,{capture:!0}),this.addEventListener("mouseenter",this.cancelCloseDelay),this.addEventListener("mouseleave",this.startCloseDelay)}this.trigger.includes("focusin")&&(document.addEventListener("focusin",this.handleFocusIn,{capture:!0}),this.interactive||document.addEventListener("focusout",this.handleFocusOut,{capture:!0}))};this.removeTriggerListeners=()=>{document.removeEventListener("click",this.togglePopoverVisible,{capture:!0});let t=this.renderRoot.querySelector(".popover-hover-bridge");t==null||t.removeEventListener("mouseenter",this.show),document.removeEventListener("mouseenter",this.handleMouseEnter,{capture:!0}),document.removeEventListener("mouseleave",this.handleMouseLeave,{capture:!0}),this.removeEventListener("mouseenter",this.cancelCloseDelay),this.removeEventListener("mouseleave",this.startCloseDelay),document.removeEventListener("focusin",this.handleFocusIn,{capture:!0}),document.removeEventListener("focusout",this.handleFocusOut,{capture:!0})};this.removeAllListeners=()=>{this.removeTriggerListeners(),this.hideOnOutsideClick&&document.removeEventListener("click",this.onOutsidePopoverClick,{capture:!0}),this.hideOnEscape&&(this.removeEventListener("keydown",this.onEscapeKeydown),document.removeEventListener("keydown",this.onEscapeKeydown,{capture:!0})),this.hideOnBlur&&this.removeEventListener("focusout",this.onPopoverFocusOut)};this.onOutsidePopoverClick=t=>{if(xe.peek()!==this)return;let i=t.composedPath(),a=this.contains(t.target)||i.includes(this.triggerElement)||i.includes(this),h=this.backdropElement?i.includes(this.backdropElement):!1;(!a||h)&&(this.hide(),oi.onClickOutside(this))};this.onEscapeKeydown=t=>{!this.visible||t.code!=="Escape"||(this.propagateEventOnEscape||t.stopPropagation(),t.preventDefault(),this.hide(),oi.onEscapeKeyPressed(this))};this.onPopoverFocusOut=t=>{this.contains(t.relatedTarget)||this.hide()};this.handleMouseEnter=t=>{this.isEventFromTrigger(t)&&(this.isHovered=!0,this.show())};this.handleMouseLeave=t=>{this.isEventFromTrigger(t)&&(this.isHovered=!1,this.startCloseDelay())};this.handleFocusOut=t=>{this.isEventFromTrigger(t)&&(this.isHovered||this.hide())};this.handleFocusIn=t=>{var i;this.isEventFromTrigger(t)&&((i=this.triggerElement)!=null&&i.matches(":focus-visible")||this.isHovered)&&this.show()};this.startCloseDelay=()=>{this.interactive?this.hoverTimer=window.setTimeout(()=>{this.visible=!1},this.closeDelay):this.hide()};this.cancelCloseDelay=()=>{this.hoverTimer&&(window.clearTimeout(this.hoverTimer),this.hoverTimer=null)};this.show=()=>{this.visible||this.shouldSuppressOpening||(this.cancelCloseDelay(),this.openDelay>0?setTimeout(()=>{this.visible=!0},this.openDelay):this.visible=!0)};this.hide=()=>{this.closeDelay?setTimeout(()=>{this.visible=!1},this.closeDelay):this.visible=!1};this.togglePopoverVisible=t=>{this.isEventFromTrigger(t)&&(this.visible?this.hide():this.show())};this.positionPopover=()=>{let{triggerElement:t}=this;if(!t)return;let i=!this.boundary||this.boundary==="clippingAncestors"?"clippingAncestors":Array.from(document.querySelectorAll(this.boundary)),a=this.boundaryRoot,h=[Pu({boundary:i,rootBoundary:a,padding:this.boundaryPadding})],m=this.offset;if(this.flip&&h.push(Du({boundary:i,rootBoundary:a})),this.size){let b=O=>{this.style.setProperty("--mdc-popover-internal-available-height",`${O}px`)},C=this.renderRoot.querySelector('[part="popover-content"]');h.push($u({boundary:i,rootBoundary:a,apply({availableHeight:O}){C&&(Object.assign(C.style,{maxHeight:`${O}px`,overflowY:"auto"}),b(O))},padding:50}))}if(this.showArrow&&(this.arrowElement=this.renderRoot.querySelector(".popover-arrow"),this.arrowElement)){let b=this.arrowElement.offsetHeight,C=Math.sqrt(2*b**2)/2;m+=C,h.push(Fu({element:this.arrowElement,padding:12}))}h.push(Ou(m)),this.floatingUICleanupFunction=Ru(t,this,async()=>{let{triggerElement:b}=this;if(!b)return;let{x:C,y:O,middlewareData:j,placement:q}=await zu(b,this,{placement:this.placement,middleware:h,strategy:this.strategy});this.utils.updatePopoverStyle(C,O),j.arrow&&this.arrowElement&&this.utils.updateArrowStyle(j.arrow,q),this.trigger.includes("mouseenter")&&this.interactive&&this.utils.setupHoverBridge(q)})};this.utils=new bl(this),this.parseTrigger(),[this.openDelay,this.closeDelay]=this.utils.setupDelay()}get connectedTooltip(){let t=this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);return Array.from(t).find(i=>i!==this)}get triggerElement(){return this.getRootNode().querySelector(`[id="${this.triggerID}"]`)}async firstUpdated(t){super.firstUpdated(t),this.style.zIndex=`${this.zIndex}`,this.utils.setupAppendTo(),oi.onCreatedPopover(this)}connectedCallback(){super.connectedCallback(),this.setupTriggerListeners()}async disconnectedCallback(){var t,i;super.disconnectedCallback(),this.removeAllListeners(),(t=this.deactivateFocusTrap)==null||t.call(this),this.deactivatePreventScroll(),this.moveElementBackAfterBackdropRemoval(this.triggerElement),this.removeBackdrop(),(i=this.floatingUICleanupFunction)==null||i.call(this),this.cancelCloseDelay(),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),oi.onDestroyedPopover(this),xe.remove(this)}async updated(t){if(super.updated(t),t.has("visible")){let i=t.get("visible")||!1;await this.isOpenUpdated(i,this.visible),this.utils.updateAriaExpandedAttribute()}t.has("trigger")&&(this.parseTrigger(),this.removeTriggerListeners(),this.setupTriggerListeners()),t.has("placement")&&this.setAttribute("placement",Object.values(Qt).includes(this.placement)?this.placement:Ct.PLACEMENT),t.has("delay")&&([this.openDelay,this.closeDelay]=this.utils.setupDelay()),t.has("color")&&this.setAttribute("color",Object.values(uo).includes(this.color)?this.color:Ct.COLOR),t.has("zIndex")&&this.setAttribute("z-index",`${this.zIndex}`),t.has("append-to")&&this.utils.setupAppendTo(),(t.has("interactive")||t.has("aria-label")||t.has("aria-labelledby"))&&this.utils.updateAriaLabels(),t.has("role")&&(this.role===""&&(this.role=null),this.utils.updateAriaModal()),t.has("disableAriaExpanded")&&this.utils.updateAriaExpandedAttribute(),t.has("focusTrap")&&!this.focusTrap&&this.visible&&this.deactivateFocusTrap(),t.has("preventScroll")&&(!this.preventScroll&&this.visible?this.deactivatePreventScroll():this.preventScroll&&this.visible&&this.activatePreventScroll())}async isOpenUpdated(t,i){var h,m;let{triggerElement:a}=this;t===i||!a||(i&&!this.shouldSuppressOpening?(xe.peek()!==this&&xe.push(this),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.visible=!1,this.connectedTooltip.shouldSuppressOpening=!0),this.backdrop&&!this.backdropElement&&(this.createBackdrop("popover"),this.keepElementAboveBackdrop(a)),this.positionPopover(),this.hideOnBlur&&(this.addEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(a.style.pointerEvents="none")),this.hideOnEscape&&(this.addEventListener("keydown",this.onEscapeKeydown),document.addEventListener("keydown",this.onEscapeKeydown)),this.activatePreventScroll(),this.hideOnOutsideClick&&document.addEventListener("click",this.onOutsidePopoverClick,{capture:!0}),setTimeout(()=>{var b,C;this.interactive&&this.focusTrap&&((b=this.activateFocusTrap)==null||b.call(this),(C=this.setInitialFocus)==null||C.call(this))},0),oi.onShowPopover(this)):(xe.peek()===this&&xe.pop(),(h=this.floatingUICleanupFunction)==null||h.call(this),this.backdrop&&(this.moveElementBackAfterBackdropRemoval(a),this.removeBackdrop()),this.hideOnBlur&&(this.removeEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(a.style.pointerEvents="")),this.hideOnOutsideClick&&document.removeEventListener("click",this.onOutsidePopoverClick,{capture:!0}),this.hideOnEscape&&(this.removeEventListener("keydown",this.onEscapeKeydown),document.removeEventListener("keydown",this.onEscapeKeydown)),this.deactivatePreventScroll(),(m=this.deactivateFocusTrap)==null||m.call(this),this.focusBackToTrigger&&(a==null||a.focus()),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),oi.onHidePopover(this)))}isEventFromTrigger(t){var i;return t.composed?t.composedPath().some(a=>(a==null?void 0:a.id)===this.triggerID):((i=t.target)==null?void 0:i.id)===this.triggerID}render(){return I`
|
2365
|
+
`,Bu=[TE];var bl=class{constructor(o){this.arrowPixelChange=!1;this.popover=o}setupDelay(){try{let[o,t]=this.popover.delay.split(",").map(i=>{let a=parseInt(i,10);if(Number.isNaN(a)||a<0)throw new Error(`Invalid delay value: ${i}`);return a});return[o,t]}catch{return this.popover.delay="0,0",[0,0]}}setupHoverBridge(o){let t=this.popover.renderRoot.querySelector(".popover-hover-bridge");Object.assign(t.style,{top:"",left:"",right:"",bottom:""});let i=`calc(${this.popover.showArrow?"0.75rem + ":""}${this.popover.offset}px)`,a=this.popover.offsetHeight||0,h=this.popover.offsetWidth||0;if(t)switch(o.split("-")[0]){case"top":t.style.height=i,t.style.bottom=`calc(-1 * (${i}))`,t.style.left="50%",t.style.width=`${h}px`;break;case"left":t.style.height=`${a}px`,t.style.width=i,t.style.right=`calc(-1.5 * (${i}))`;break;case"right":t.style.height=`${a}px`,t.style.width=i,t.style.left=`calc(-0.5 * (${i}))`;break;case"bottom":default:t.style.height=i,t.style.top=`calc(-1 * (${i}))`,t.style.left="50%",t.style.width=`${h}px`;break}}setupAppendTo(){if(this.popover.appendTo){let o=document.getElementById(this.popover.appendTo);o&&o.appendChild(this.popover)}}updateAriaLabels(){var o,t,i;this.popover.interactive&&this.popover.role&&(this.popover.ariaLabel||(this.popover.ariaLabel=((o=this.popover.triggerElement)==null?void 0:o.ariaLabel)||((t=this.popover.triggerElement)==null?void 0:t.textContent)||""),this.popover.ariaLabelledby||(this.popover.ariaLabelledby=((i=this.popover.triggerElement)==null?void 0:i.id)||""))}updateAriaModal(){this.popover.role===it.DIALOG||this.popover.role===it.ALERTDIALOG?this.popover.setAttribute("aria-modal","true"):this.popover.removeAttribute("aria-modal")}updateAriaExpandedAttribute(){var o,t,i;this.popover.disableAriaExpanded||((o=this.popover.triggerElement)==null||o.setAttribute("aria-expanded",`${this.popover.visible}`),(i=this.popover.triggerElement)==null||i.setAttribute("aria-haspopup",((t=this.popover.triggerElement)==null?void 0:t.getAttribute("aria-haspopup"))||this.popover.role||"dialog"))}updateArrowStyle(o,t){var j;if(!this.popover.arrowElement)return;let i=t.split("-")[0],a={top:"bottom",right:"left",bottom:"top",left:"right"}[i],{x:h,y:m}=o,b=this.popover.arrowElement.getBoundingClientRect(),C=(j=this.popover.arrowElement.offsetParent)==null?void 0:j.getBoundingClientRect();if(!this.arrowPixelChange){let q=C!=null&&C[a]?12-Math.abs(b[a]-C[a]):0;Math.round(q)===1?this.arrowPixelChange=!0:this.arrowPixelChange=!1}let O=this.arrowPixelChange?.5:0;this.popover.arrowElement.setAttribute("data-side",i),Object.assign(this.popover.arrowElement.style,{left:h!=null?`${h}px`:"",top:m!=null?`${m}px`:"",[a]:`${-this.popover.arrowElement.offsetHeight/2-O}px`})}updatePopoverStyle(o,t){Object.assign(this.popover.style,{left:`${o}px`,top:`${t}px`})}};var _t=class extends fl(gl(vl(K))){constructor(){super();this.id="";this.triggerID="";this.trigger=Ct.TRIGGER;this.placement=Ct.PLACEMENT;this.color=Ct.COLOR;this.visible=Ct.VISIBLE;this.offset=Ct.OFFSET;this.boundary=Ct.BOUNDARY;this.boundaryRoot=Ct.BOUNDARY_ROOT;this.focusTrap=Ct.FOCUS_TRAP;this.preventScroll=Ct.PREVENT_SCROLL;this.showArrow=Ct.ARROW;this.closeButton=Ct.CLOSE_BUTTON;this.interactive=Ct.INTERACTIVE;this.delay=Ct.DELAY;this.hideOnEscape=Ct.HIDE_ON_ESCAPE;this.propagateEventOnEscape=Ct.PROPAGATE_EVENT_ON_ESCAPE;this.hideOnBlur=Ct.HIDE_ON_BLUR;this.hideOnOutsideClick=Ct.HIDE_ON_CLICK_OUTSIDE;this.focusBackToTrigger=Ct.FOCUS_BACK;this.backdrop=Ct.BACKDROP;this.isBackdropInvisible=Ct.IS_BACKDROP_INVISIBLE;this.flip=Ct.FLIP;this.size=Ct.SIZE;this.zIndex=Ct.Z_INDEX;this.closeButtonAriaLabel=null;this.strategy=Ct.STRATEGY;this.role=Ct.ROLE;this.ariaLabelledby=null;this.ariaDescribedby=null;this.disableAriaExpanded=Ct.DISABLE_ARIA_EXPANDED;this.keepConnectedTooltipClosed=Ct.KEEP_CONNECTED_TOOLTIP_CLOSED;this.arrowElement=null;this.hoverTimer=null;this.isHovered=!1;this.openDelay=0;this.closeDelay=0;this.floatingUICleanupFunction=null;this.shouldSuppressOpening=!1;this.parseTrigger=()=>{var h;let a=(((h=this.trigger)==null?void 0:h.split(" "))||[]).filter(m=>Object.values(mo).includes(m)).length>0?this.trigger:Ct.TRIGGER;a==="mouseenter"&&(this.interactive?a="mouseenter click":a="mouseenter focusin"),this.trigger=a};this.setupTriggerListeners=()=>{if(this.trigger.includes("click")&&document.addEventListener("click",this.togglePopoverVisible,{capture:!0}),this.trigger.includes("mouseenter")){let t=this.renderRoot.querySelector(".popover-hover-bridge");t==null||t.addEventListener("mouseenter",this.show),document.addEventListener("mouseenter",this.handleMouseEnter,{capture:!0}),document.addEventListener("mouseleave",this.handleMouseLeave,{capture:!0}),this.addEventListener("mouseenter",this.cancelCloseDelay),this.addEventListener("mouseleave",this.startCloseDelay)}this.trigger.includes("focusin")&&(document.addEventListener("focusin",this.handleFocusIn,{capture:!0}),this.interactive||document.addEventListener("focusout",this.handleFocusOut,{capture:!0}))};this.removeTriggerListeners=()=>{document.removeEventListener("click",this.togglePopoverVisible,{capture:!0});let t=this.renderRoot.querySelector(".popover-hover-bridge");t==null||t.removeEventListener("mouseenter",this.show),document.removeEventListener("mouseenter",this.handleMouseEnter,{capture:!0}),document.removeEventListener("mouseleave",this.handleMouseLeave,{capture:!0}),this.removeEventListener("mouseenter",this.cancelCloseDelay),this.removeEventListener("mouseleave",this.startCloseDelay),document.removeEventListener("focusin",this.handleFocusIn,{capture:!0}),document.removeEventListener("focusout",this.handleFocusOut,{capture:!0})};this.removeAllListeners=()=>{this.removeTriggerListeners(),this.hideOnOutsideClick&&document.removeEventListener("click",this.onOutsidePopoverClick,{capture:!0}),this.hideOnEscape&&(this.removeEventListener("keydown",this.onEscapeKeydown),document.removeEventListener("keydown",this.onEscapeKeydown,{capture:!0})),this.hideOnBlur&&this.removeEventListener("focusout",this.onPopoverFocusOut)};this.onOutsidePopoverClick=t=>{if(xe.peek()!==this)return;let i=t.composedPath(),a=this.contains(t.target)||i.includes(this.triggerElement)||i.includes(this),h=this.backdropElement?i.includes(this.backdropElement):!1;(!a||h)&&(this.hide(),oi.onClickOutside(this))};this.onEscapeKeydown=t=>{!this.visible||t.code!=="Escape"||(this.propagateEventOnEscape||t.stopPropagation(),t.preventDefault(),this.hide(),oi.onEscapeKeyPressed(this))};this.onPopoverFocusOut=t=>{this.contains(t.relatedTarget)||this.hide()};this.handleMouseEnter=t=>{this.isEventFromTrigger(t)&&(this.isHovered=!0,this.show())};this.handleMouseLeave=t=>{this.isEventFromTrigger(t)&&(this.isHovered=!1,this.startCloseDelay())};this.handleFocusOut=t=>{this.isEventFromTrigger(t)&&(this.isHovered||this.hide())};this.handleFocusIn=t=>{var i;this.isEventFromTrigger(t)&&((i=this.triggerElement)!=null&&i.matches(":focus-visible")||this.isHovered)&&this.show()};this.startCloseDelay=()=>{this.interactive?this.hoverTimer=window.setTimeout(()=>{this.visible=!1},this.closeDelay):this.hide()};this.cancelCloseDelay=()=>{this.hoverTimer&&(window.clearTimeout(this.hoverTimer),this.hoverTimer=null)};this.show=()=>{this.visible||this.shouldSuppressOpening||(this.cancelCloseDelay(),this.openDelay>0?setTimeout(()=>{this.visible=!0},this.openDelay):this.visible=!0)};this.hide=()=>{this.closeDelay?setTimeout(()=>{this.visible=!1},this.closeDelay):this.visible=!1};this.togglePopoverVisible=t=>{this.isEventFromTrigger(t)&&(this.visible?this.hide():this.show())};this.positionPopover=()=>{let{triggerElement:t}=this;if(!t)return;let i=!this.boundary||this.boundary==="clippingAncestors"?"clippingAncestors":Array.from(document.querySelectorAll(this.boundary)),a=this.boundaryRoot,h=[Pu({boundary:i,rootBoundary:a,padding:this.boundaryPadding})],m=this.offset;if(this.flip&&h.push(Du({boundary:i,rootBoundary:a})),this.size){let b=O=>{this.style.setProperty("--mdc-popover-internal-available-height",`${O}px`)},C=this.renderRoot.querySelector('[part="popover-content"]');h.push($u({boundary:i,rootBoundary:a,apply({availableHeight:O}){C&&(Object.assign(C.style,{maxHeight:`${O}px`,overflowY:"auto"}),b(O))},padding:50}))}if(this.showArrow&&(this.arrowElement=this.renderRoot.querySelector(".popover-arrow"),this.arrowElement)){let b=this.arrowElement.offsetHeight,C=Math.sqrt(2*b**2)/2;m+=C,h.push(Fu({element:this.arrowElement,padding:12}))}h.push(Ou(m)),this.floatingUICleanupFunction=Ru(t,this,async()=>{let{triggerElement:b}=this;if(!b)return;let{x:C,y:O,middlewareData:j,placement:q}=await zu(b,this,{placement:this.placement,middleware:h,strategy:this.strategy});this.utils.updatePopoverStyle(C,O),j.arrow&&this.arrowElement&&this.utils.updateArrowStyle(j.arrow,q),this.trigger.includes("mouseenter")&&this.interactive&&this.utils.setupHoverBridge(q)})};this.utils=new bl(this),this.parseTrigger(),[this.openDelay,this.closeDelay]=this.utils.setupDelay()}get connectedTooltip(){let t=this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);return Array.from(t).find(i=>i!==this)}get triggerElement(){return this.getRootNode().querySelector(`[id="${this.triggerID}"]`)}async firstUpdated(t){super.firstUpdated(t),this.style.zIndex=`${this.zIndex}`,this.utils.setupAppendTo(),oi.onCreatedPopover(this)}connectedCallback(){super.connectedCallback(),this.setupTriggerListeners()}async disconnectedCallback(){var t,i;super.disconnectedCallback(),this.removeAllListeners(),(t=this.deactivateFocusTrap)==null||t.call(this),this.deactivatePreventScroll(),this.moveElementBackAfterBackdropRemoval(this.triggerElement),this.removeBackdrop(),(i=this.floatingUICleanupFunction)==null||i.call(this),this.cancelCloseDelay(),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),oi.onDestroyedPopover(this),xe.remove(this)}async updated(t){if(super.updated(t),t.has("visible")){let i=t.get("visible")||!1;await this.isOpenUpdated(i,this.visible),this.utils.updateAriaExpandedAttribute()}t.has("trigger")&&(this.parseTrigger(),this.removeTriggerListeners(),this.setupTriggerListeners()),t.has("placement")&&this.setAttribute("placement",Object.values(Qt).includes(this.placement)?this.placement:Ct.PLACEMENT),t.has("delay")&&([this.openDelay,this.closeDelay]=this.utils.setupDelay()),t.has("color")&&this.setAttribute("color",Object.values(uo).includes(this.color)?this.color:Ct.COLOR),t.has("zIndex")&&this.setAttribute("z-index",`${this.zIndex}`),t.has("append-to")&&this.utils.setupAppendTo(),(t.has("interactive")||t.has("aria-label")||t.has("aria-labelledby"))&&this.utils.updateAriaLabels(),t.has("role")&&(this.role===""&&(this.role=null),this.utils.updateAriaModal()),t.has("disableAriaExpanded")&&this.utils.updateAriaExpandedAttribute(),t.has("focusTrap")&&!this.focusTrap&&this.visible&&this.deactivateFocusTrap(),t.has("preventScroll")&&(!this.preventScroll&&this.visible?this.deactivatePreventScroll():this.preventScroll&&this.visible&&this.activatePreventScroll())}async isOpenUpdated(t,i){var h,m;let{triggerElement:a}=this;t===i||!a||(i&&!this.shouldSuppressOpening?(xe.peek()!==this&&xe.push(this),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.visible=!1,this.connectedTooltip.shouldSuppressOpening=!0),this.backdrop&&!this.backdropElement&&(this.createBackdrop("popover"),this.keepElementAboveBackdrop(a)),this.positionPopover(),this.hideOnBlur&&(this.addEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(a.style.pointerEvents="none")),this.hideOnEscape&&(this.addEventListener("keydown",this.onEscapeKeydown),document.addEventListener("keydown",this.onEscapeKeydown)),this.activatePreventScroll(),this.hideOnOutsideClick&&document.addEventListener("click",this.onOutsidePopoverClick,{capture:!0}),setTimeout(()=>{var b,C;this.interactive&&this.focusTrap&&((b=this.activateFocusTrap)==null||b.call(this),(C=this.setInitialFocus)==null||C.call(this))},0),oi.onShowPopover(this)):(xe.peek()===this&&xe.pop(),(h=this.floatingUICleanupFunction)==null||h.call(this),this.backdrop&&(this.moveElementBackAfterBackdropRemoval(a),this.removeBackdrop()),this.hideOnBlur&&(this.removeEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(a.style.pointerEvents="")),this.hideOnOutsideClick&&document.removeEventListener("click",this.onOutsidePopoverClick,{capture:!0}),this.hideOnEscape&&(this.removeEventListener("keydown",this.onEscapeKeydown),document.removeEventListener("keydown",this.onEscapeKeydown)),this.deactivatePreventScroll(),(m=this.deactivateFocusTrap)==null||m.call(this),this.focusBackToTrigger&&(a==null||a.focus()),this.keepConnectedTooltipClosed&&this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),oi.onHidePopover(this)))}isEventFromTrigger(t){var i;return this.triggerID?t.composed?t.composedPath().some(a=>(a==null?void 0:a.id)===this.triggerID):((i=t.target)==null?void 0:i.id)===this.triggerID:!1}render(){return I`
|
2366
2366
|
<div class="popover-hover-bridge"></div>
|
2367
2367
|
${this.closeButton?I` <mdc-button
|
2368
2368
|
class="popover-close"
|