@momentum-design/components 0.133.21 → 0.133.22

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.
@@ -2726,7 +2726,7 @@
2726
2726
  border-top-right-radius: var(--mdc-popover-arrow-border-radius);
2727
2727
  border-bottom-left-radius: 100%;
2728
2728
  }
2729
- `,kg=[QA];var Id=z.constructTagName("popoverportal"),Sd=class extends Z{connectedCallback(){super.connectedCallback(),this.ariaHidden="true",this.style.display="none"}disconnectedCallback(){var o;super.disconnectedCallback(),(o=this.onDisconnect)==null||o.call(this)}};var Cd=class{constructor(o){this.portalElement=null;this.disconnectAfterAppendTo=!1;this.arrowPixelChange=!1;this.popover=o}setupDelay(){try{let[o,t]=this.popover.delay.split(",").map(e=>{let i=parseInt(e,10);if(Number.isNaN(i)||i<0)throw new Error(`Invalid delay value: ${e}`);return i});return[o,t]}catch{return this.popover.delay="0,0",[0,0]}}setupHoverBridge(o){let t=this.popover.renderRoot.querySelector('div[part="popover-hover-bridge"]');Object.assign(t.style,{top:"",left:"",right:"",bottom:""});let e=this.popover.triggerElement;if(t&&e){let i=this.popover.getBoundingClientRect(),l=e.getBoundingClientRect(),c=0;if(!l)return;let f=this.popover.offsetHeight||0,y=this.popover.offsetWidth||0,A=o.split("-")[0];switch(A==="top"||A==="bottom"?c=Math.max(0,Math.max(i.top-l.bottom,l.top-i.bottom)):(A==="left"||A==="right")&&(c=Math.max(0,Math.max(l.left-i.right,i.left-l.right))),c+=1,A){case"top":t.style.height=`${c}px`,t.style.bottom=`calc(-1 * (${c}px))`,t.style.left="50%",t.style.width=`${y}px`;break;case"left":t.style.height=`${f}px`,t.style.width=`${c}px`,t.style.right=`calc(-1.5 * (${c}px))`;break;case"right":t.style.height=`${f}px`,t.style.width=`${c}px`,t.style.left=`calc(-0.5 * (${c}px))`;break;case"bottom":default:t.style.height=`${c}px`,t.style.top=`calc(-1 * (${c}px))`,t.style.left="50%",t.style.width=`${y}px`;break}}}setupAppendTo(){var o,t;if(this.popover.appendTo){let e=document.getElementById(this.popover.appendTo);e&&!Array.from(e.children).includes(this.popover)&&(this.disconnectAfterAppendTo=!0,this.portalElement=document.createElement(Id),this.portalElement.onDisconnect=()=>{this.popover.remove(),this.portalElement=null},(t=(o=this.popover.parentElement)==null?void 0:o.appendChild)==null||t.call(o,this.portalElement),e.appendChild(this.popover))}}cleanupAppendTo(){!this.disconnectAfterAppendTo&&this.portalElement&&this.portalElement.remove(),this.disconnectAfterAppendTo=!1}updateAriaLabels(){var o,t,e;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.ariaLabel&&(this.popover.ariaLabelledby=((e=this.popover.triggerElement)==null?void 0:e.id)||""))}updateAriaModal(){this.popover.role===et.DIALOG||this.popover.role===et.ALERTDIALOG?this.popover.setAttribute("aria-modal","true"):this.popover.removeAttribute("aria-modal")}updateAriaExpandedAttribute(){var o,t,e;this.popover.disableAriaExpanded||((o=this.popover.triggerElement)==null||o.setAttribute("aria-expanded",`${this.popover.visible}`),(e=this.popover.triggerElement)==null||e.setAttribute("aria-haspopup",((t=this.popover.triggerElement)==null?void 0:t.getAttribute("aria-haspopup"))||this.popover.role||"dialog"))}updateArrowStyle(o,t){var F;if(!this.popover.arrowElement)return;let e=t.split("-")[0],i={top:"bottom",right:"left",bottom:"top",left:"right"}[e],{x:l,y:c}=o,f=this.popover.arrowElement.getBoundingClientRect(),y=(F=this.popover.arrowElement.offsetParent)==null?void 0:F.getBoundingClientRect();if(!this.arrowPixelChange){let U=y!=null&&y[i]?12-Math.abs(f[i]-y[i]):0;Math.round(U)===1?this.arrowPixelChange=!0:this.arrowPixelChange=!1}let A=this.arrowPixelChange?.5:0;this.popover.arrowElement.setAttribute("data-side",e),Object.assign(this.popover.arrowElement.style,{left:l!=null?`${l}px`:"",top:c!=null?`${c}px`:"",[i]:`${-this.popover.arrowElement.offsetHeight/2-A}px`})}updatePopoverStyle(o,t){Object.assign(this.popover.style,{left:`${o}px`,top:`${t}px`})}};var _t=class extends Lt(Nt(Xl(Wl(Kl(Z))))){constructor(){super();this.depthManager=new lo(this);this.id="";this.triggerID="";this.trigger=bt.TRIGGER;this.placement=bt.PLACEMENT;this.color=bt.COLOR;this.visible=bt.VISIBLE;this.offset=bt.OFFSET;this.boundary=bt.BOUNDARY;this.boundaryRoot=bt.BOUNDARY_ROOT;this.focusTrap=bt.FOCUS_TRAP;this.preventScroll=bt.PREVENT_SCROLL;this.showArrow=bt.ARROW;this.closeButton=bt.CLOSE_BUTTON;this.interactive=bt.INTERACTIVE;this.delay=bt.DELAY;this.hideOnEscape=bt.HIDE_ON_ESCAPE;this.propagateEventOnEscape=bt.PROPAGATE_EVENT_ON_ESCAPE;this.hideOnBlur=bt.HIDE_ON_BLUR;this.hideOnOutsideClick=bt.HIDE_ON_CLICK_OUTSIDE;this.focusBackToTrigger=bt.FOCUS_BACK;this.backdrop=bt.BACKDROP;this.isBackdropInvisible=bt.IS_BACKDROP_INVISIBLE;this.disableFlip=bt.DISABLE_FLIP;this.size=bt.SIZE;this.closeButtonAriaLabel=null;this.strategy=bt.STRATEGY;this.role=bt.ROLE;this.ariaLabelledby=null;this.ariaDescribedby=null;this.disableAriaExpanded=bt.DISABLE_ARIA_EXPANDED;this.keepConnectedTooltipOpen=bt.KEEP_CONNECTED_TOOLTIP_OPEN;this.animationFrame=bt.ANIMATION_FRAME;this.inline=bt.INLINE;this.elementIndexToReceiveFocus=null;this.stackGroupName="";this.arrowElement=null;this.isHovered=!1;this.openDelay=0;this.closeDelay=0;this.floatingUICleanupFunction=null;this.shouldSuppressOpening=!1;this.timers=new Ad(this);this.parseTrigger=()=>{var l;let i=(((l=this.trigger)==null?void 0:l.split(" "))||[]).filter(c=>Object.values(ke).includes(c)).length>0?this.trigger:bt.TRIGGER;i==="mouseenter"&&(this.interactive?i="mouseenter click":i="mouseenter focusin"),this.trigger=i};this.setupTriggerListeners=()=>{if(this.trigger.includes("click")&&(document.addEventListener("click",this.togglePopoverVisible,{capture:!0}),this.hideOnBlur&&document.addEventListener("focusout",this.handleFocusOut,{capture:!0})),this.trigger.includes("mouseenter")){let t=this.renderRoot.querySelector('div[part="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('div[part="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)),this.hideOnBlur&&this.removeEventListener("focusout",this.onPopoverFocusOut)};this.onOutsidePopoverClick=t=>{if(!this.depthManager.isHostOnTop())return;let e=t.composedPath(),i=this.contains(t.target)||e.includes(this.triggerElement)||e.includes(this),l=this.backdropElement?e.includes(this.backdropElement):!1;(!i||l)&&(this.hide(),Di.onClickOutside(this),l&&t.stopPropagation())};this.onEscapeKeydown=t=>{!this.visible||this.getActionForKeyEvent(t)!==Y.ESCAPE||!this.depthManager.isHostOnTop()||(this.propagateEventOnEscape||t.stopPropagation(),t.preventDefault(),this.hide(),Di.onEscapeKeyPressed(this),this.keyDownEventHandled())};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=>{if(this.isEventFromTrigger(t)){if(this.hideOnBlur){let{relatedTarget:e}=t;this.contains(e)||this.hide();return}this.isHovered||this.hide()}};this.handleFocusIn=t=>{var e,i,l,c;this.isEventFromTrigger(t)&&((e=this.triggerElement)!=null&&e.matches(":focus-visible")||(c=(l=(i=this.triggerElement)==null?void 0:i.shadowRoot)==null?void 0:l.querySelector(".mdc-focus-ring"))!=null&&c.matches(":focus-visible")||this.isHovered)&&this.show()};this.cancelOpenDelay=()=>{this.timers.clearTimeout(Li.OPEN)};this.startCloseDelay=()=>{this.cancelOpenDelay(),this.interactive?this.timers.setTimeout(Li.HOVER,()=>{this.visible=!1},this.closeDelay):this.hide()};this.cancelCloseDelay=()=>{this.timers.clearTimeout(Li.HOVER),this.timers.clearTimeout(Li.CLOSE)};this.hide=()=>{this.cancelOpenDelay();let t=()=>{this.visible=!1};this.closeDelay>0?this.timers.setTimeout(Li.CLOSE,t,this.closeDelay):(this.timers.clearTimeout(Li.CLOSE),t())};this.togglePopoverVisible=t=>{this.isEventFromTrigger(t)&&(this.visible?this.hide():this.show())};this.positionPopover=()=>{let{triggerElement:t}=this;if(!t)return;let e=!this.boundary||this.boundary==="clippingAncestors"?"clippingAncestors":Array.from(document.querySelectorAll(this.boundary)),i=this.boundaryRoot,l=[];if(this.inline&&l.push(Cg()),l.push(xg({boundary:e,rootBoundary:i,padding:this.boundaryPadding})),this.disableFlip||l.push(Ag({boundary:e,rootBoundary:i})),this.size){let f=A=>{this.style.setProperty("--mdc-popover-internal-available-height",`${A}px`)},y=this.renderRoot.querySelector('[part="popover-content"]');l.push(Sg({boundary:e,rootBoundary:i,apply({availableHeight:A}){y&&(Object.assign(y.style,{maxHeight:`${A}px`,overflowY:"auto"}),f(A))},padding:50}))}let c=0;if(this.showArrow&&(this.arrowElement=this.renderRoot.querySelector('div[part="popover-arrow"]'),this.arrowElement)){let f=this.arrowElement.offsetHeight;c=Math.sqrt(2*f**2)/2,l.push(Ig({element:this.arrowElement,padding:12}))}l.push(Tg(typeof this.offset=="number"?this.offset+c:this.offset)),this.floatingUICleanupFunction=Eg(t,this,async()=>{let{triggerElement:f}=this;if(!f)return;let y=this.adjustPlacementForRtl(this.placement),{x:A,y:F,middlewareData:U,placement:Q}=await _g(f,this,{placement:y,middleware:l,strategy:this.strategy});this.utils.updatePopoverStyle(A,F),U.arrow&&this.arrowElement&&this.utils.updateArrowStyle(U.arrow,Q),this.trigger.includes("mouseenter")&&this.utils.setupHoverBridge(Q)},{animationFrame:this.animationFrame})};this.show=this.show.bind(this),this.utils=new Cd(this),this.parseTrigger(),[this.openDelay,this.closeDelay]=this.utils.setupDelay()}get zIndex(){return Number.isInteger(this.internalZIndex)?this.internalZIndex:this.depthManager.getHostZIndex()}set zIndex(t){this.internalZIndex=t}get connectedTooltip(){let t=this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);return Array.from(t).find(e=>e!==this)}get triggerElement(){return this.getRootNode().querySelector(`[id="${this.triggerID}"]`)}async firstUpdated(t){super.firstUpdated(t),Di.onCreatedPopover(this)}connectedCallback(){super.connectedCallback(),this.utils.setupAppendTo(),this.setupTriggerListeners()}async disconnectedCallback(){var t,e;super.disconnectedCallback(),this.removeAllListeners(),(t=this.deactivateFocusTrap)==null||t.call(this),this.deactivatePreventScroll(),this.moveElementBackAfterBackdropRemoval(this.triggerElement),this.removeBackdrop(),(e=this.floatingUICleanupFunction)==null||e.call(this),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),this.utils.cleanupAppendTo(),Di.onDestroyedPopover(this)}async updated(t){if(super.updated(t),t.has("visible")){let e=t.get("visible")||!1;await this.isOpenUpdated(e,this.visible),this.utils.updateAriaExpandedAttribute()}t.has("trigger")&&(this.parseTrigger(),this.removeTriggerListeners(),this.setupTriggerListeners()),t.has("placement")&&this.setAttribute("placement",Object.values(Mt).includes(this.placement)?this.placement:bt.PLACEMENT),t.has("delay")&&([this.openDelay,this.closeDelay]=this.utils.setupDelay()),t.has("color")&&this.setAttribute("color",Object.values(Qo).includes(this.color)?this.color:bt.COLOR),t.has("appendTo")&&(this.appendTo?this.utils.setupAppendTo():this.utils.cleanupAppendTo()),(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())}onComponentStackChanged(t){t==="removed"?this.hide():t==="moved"&&this.requestUpdate("zIndex")}async isOpenUpdated(t,e){var l,c;let{triggerElement:i}=this;t===e||!i||(e&&!this.shouldSuppressOpening?(this.depthManager.pushHost()&&this.requestUpdate("zIndex"),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.visible=!1,this.connectedTooltip.shouldSuppressOpening=!0),this.backdrop&&!this.backdropElement&&(this.createBackdrop("popover"),this.keepElementAboveBackdrop(i)),this.positionPopover(),this.hideOnBlur&&(this.addEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(i.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 f,y,A;this.interactive&&this.focusTrap&&((f=this.activateFocusTrap)==null||f.call(this),(A=this.setInitialFocus)==null||A.call(this,(y=this.elementIndexToReceiveFocus)!=null?y:0))},0),Di.onShowPopover(this)):(this.depthManager.popHost(),(l=this.floatingUICleanupFunction)==null||l.call(this),this.backdrop&&(this.moveElementBackAfterBackdropRemoval(i),this.removeBackdrop()),this.hideOnBlur&&(this.removeEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(i.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(),(c=this.deactivateFocusTrap)==null||c.call(this),this.focusBackToTrigger&&(i==null||i.focus()),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),Di.onHidePopover(this)))}show(){if(this.shouldSuppressOpening||(this.cancelCloseDelay(),this.visible))return;let t=()=>{this.visible=!0};this.openDelay>0?this.timers.setTimeout(Li.OPEN,t,this.openDelay):(this.timers.clearTimeout(Li.OPEN),t())}isEventFromTrigger(t){var e;return this.triggerID?t.composed?t.composedPath().some(i=>(i==null?void 0:i.id)===this.triggerID):((e=t.target)==null?void 0:e.id)===this.triggerID:!1}isRtl(){return window.getComputedStyle(this).direction==="rtl"}adjustPlacementForRtl(t){if(!this.isRtl())return t;switch(t){case Mt.LEFT:return Mt.RIGHT;case Mt.LEFT_START:return Mt.RIGHT_START;case Mt.LEFT_END:return Mt.RIGHT_END;case Mt.RIGHT:return Mt.LEFT;case Mt.RIGHT_START:return Mt.LEFT_START;case Mt.RIGHT_END:return Mt.LEFT_END;default:return t}}render(){return this.style.zIndex=`${this.zIndex}`,S`
2729
+ `,kg=[QA];var Id=z.constructTagName("popoverportal"),Sd=class extends Z{connectedCallback(){super.connectedCallback(),this.ariaHidden="true",this.style.display="none"}disconnectedCallback(){var o;super.disconnectedCallback(),(o=this.onDisconnect)==null||o.call(this)}};var Cd=class{constructor(o){this.portalElement=null;this.disconnectAfterAppendTo=!1;this.arrowPixelChange=!1;this.popover=o}setupDelay(){try{let[o,t]=this.popover.delay.split(",").map(e=>{let i=parseInt(e,10);if(Number.isNaN(i)||i<0)throw new Error(`Invalid delay value: ${e}`);return i});return[o,t]}catch{return this.popover.delay="0,0",[0,0]}}setupHoverBridge(o){let t=this.popover.renderRoot.querySelector('div[part="popover-hover-bridge"]');Object.assign(t.style,{top:"",left:"",right:"",bottom:""});let e=this.popover.triggerElement;if(t&&e){let i=this.popover.getBoundingClientRect(),l=e.getBoundingClientRect(),c=0;if(!l)return;let f=this.popover.offsetHeight||0,y=this.popover.offsetWidth||0,A=o.split("-")[0];switch(A==="top"||A==="bottom"?c=Math.max(0,Math.max(i.top-l.bottom,l.top-i.bottom)):(A==="left"||A==="right")&&(c=Math.max(0,Math.max(l.left-i.right,i.left-l.right))),c+=1,A){case"top":t.style.height=`${c}px`,t.style.bottom=`calc(-1 * (${c}px))`,t.style.left="50%",t.style.width=`${y}px`;break;case"left":t.style.height=`${f}px`,t.style.width=`${c}px`,t.style.right=`calc(-1.5 * (${c}px))`;break;case"right":t.style.height=`${f}px`,t.style.width=`${c}px`,t.style.left=`calc(-0.5 * (${c}px))`;break;case"bottom":default:t.style.height=`${c}px`,t.style.top=`calc(-1 * (${c}px))`,t.style.left="50%",t.style.width=`${y}px`;break}}}setupAppendTo(){var o,t;if(this.popover.appendTo){let e=document.getElementById(this.popover.appendTo);e&&!Array.from(e.children).includes(this.popover)&&(this.disconnectAfterAppendTo=!0,this.portalElement=document.createElement(Id),this.portalElement.onDisconnect=()=>{this.popover.remove(),this.portalElement=null},(t=(o=this.popover.parentElement)==null?void 0:o.appendChild)==null||t.call(o,this.portalElement),e.appendChild(this.popover))}}cleanupAppendTo(){!this.disconnectAfterAppendTo&&this.portalElement&&this.portalElement.remove(),this.disconnectAfterAppendTo=!1}updateAriaLabels(){var o,t,e;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.ariaLabel&&(this.popover.ariaLabelledby=((e=this.popover.triggerElement)==null?void 0:e.id)||""))}updateAriaModal(){this.popover.role===et.DIALOG||this.popover.role===et.ALERTDIALOG?this.popover.setAttribute("aria-modal","true"):this.popover.removeAttribute("aria-modal")}updateAriaExpandedAttribute(){var o,t,e;this.popover.disableAriaExpanded||((o=this.popover.triggerElement)==null||o.setAttribute("aria-expanded",`${this.popover.visible}`),(e=this.popover.triggerElement)==null||e.setAttribute("aria-haspopup",((t=this.popover.triggerElement)==null?void 0:t.getAttribute("aria-haspopup"))||this.popover.role||"dialog"))}updateArrowStyle(o,t){var F;if(!this.popover.arrowElement)return;let e=t.split("-")[0],i={top:"bottom",right:"left",bottom:"top",left:"right"}[e],{x:l,y:c}=o,f=this.popover.arrowElement.getBoundingClientRect(),y=(F=this.popover.arrowElement.offsetParent)==null?void 0:F.getBoundingClientRect();if(!this.arrowPixelChange){let U=y!=null&&y[i]?12-Math.abs(f[i]-y[i]):0;Math.round(U)===1?this.arrowPixelChange=!0:this.arrowPixelChange=!1}let A=this.arrowPixelChange?.5:0;this.popover.arrowElement.setAttribute("data-side",e),Object.assign(this.popover.arrowElement.style,{left:l!=null?`${l}px`:"",top:c!=null?`${c}px`:"",[i]:`${-this.popover.arrowElement.offsetHeight/2-A}px`})}updatePopoverStyle(o,t){Object.assign(this.popover.style,{left:`${o}px`,top:`${t}px`})}};var _t=class extends Lt(Nt(Xl(Wl(Kl(Z))))){constructor(){super();this.depthManager=new lo(this);this.id="";this.triggerID="";this.trigger=bt.TRIGGER;this.placement=bt.PLACEMENT;this.color=bt.COLOR;this.visible=bt.VISIBLE;this.offset=bt.OFFSET;this.boundary=bt.BOUNDARY;this.boundaryRoot=bt.BOUNDARY_ROOT;this.focusTrap=bt.FOCUS_TRAP;this.preventScroll=bt.PREVENT_SCROLL;this.showArrow=bt.ARROW;this.closeButton=bt.CLOSE_BUTTON;this.interactive=bt.INTERACTIVE;this.delay=bt.DELAY;this.hideOnEscape=bt.HIDE_ON_ESCAPE;this.propagateEventOnEscape=bt.PROPAGATE_EVENT_ON_ESCAPE;this.hideOnBlur=bt.HIDE_ON_BLUR;this.hideOnOutsideClick=bt.HIDE_ON_CLICK_OUTSIDE;this.focusBackToTrigger=bt.FOCUS_BACK;this.backdrop=bt.BACKDROP;this.isBackdropInvisible=bt.IS_BACKDROP_INVISIBLE;this.disableFlip=bt.DISABLE_FLIP;this.size=bt.SIZE;this.closeButtonAriaLabel=null;this.strategy=bt.STRATEGY;this.role=bt.ROLE;this.ariaLabelledby=null;this.ariaDescribedby=null;this.disableAriaExpanded=bt.DISABLE_ARIA_EXPANDED;this.keepConnectedTooltipOpen=bt.KEEP_CONNECTED_TOOLTIP_OPEN;this.animationFrame=bt.ANIMATION_FRAME;this.inline=bt.INLINE;this.elementIndexToReceiveFocus=null;this.stackGroupName="";this.arrowElement=null;this.isHovered=!1;this.openDelay=0;this.closeDelay=0;this.floatingUICleanupFunction=null;this.shouldSuppressOpening=!1;this.timers=new Ad(this);this.parseTrigger=()=>{var l;let i=(((l=this.trigger)==null?void 0:l.split(" "))||[]).filter(c=>Object.values(ke).includes(c)).length>0?this.trigger:bt.TRIGGER;i==="mouseenter"&&(this.interactive?i="mouseenter click":i="mouseenter focusin"),this.trigger=i};this.setupTriggerListeners=()=>{if(this.trigger.includes("click")&&(document.addEventListener("click",this.togglePopoverVisible,{capture:!0}),this.hideOnBlur&&document.addEventListener("focusout",this.handleFocusOut,{capture:!0})),this.trigger.includes("mouseenter")){let t=this.renderRoot.querySelector('div[part="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('div[part="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)),this.hideOnBlur&&this.removeEventListener("focusout",this.onPopoverFocusOut)};this.onOutsidePopoverClick=t=>{if(!this.depthManager.isHostOnTop())return;let e=t.composedPath(),i=this.contains(t.target)||e.includes(this.triggerElement)||e.includes(this),l=this.backdropElement?e.includes(this.backdropElement):!1;(!i||l)&&(this.hide(),Di.onClickOutside(this),l&&t.stopPropagation())};this.onEscapeKeydown=t=>{!this.visible||this.getActionForKeyEvent(t)!==Y.ESCAPE||!this.depthManager.isHostOnTop()||(this.propagateEventOnEscape||t.stopPropagation(),t.preventDefault(),this.hide(),Di.onEscapeKeyPressed(this),this.keyDownEventHandled())};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=>{if(this.isEventFromTrigger(t)){if(this.hideOnBlur){let{relatedTarget:e}=t;this.contains(e)||this.hide();return}this.isHovered||this.hide()}};this.handleFocusIn=t=>{var e,i,l,c;this.isEventFromTrigger(t)&&((e=this.triggerElement)!=null&&e.matches(":focus-visible")||(c=(l=(i=this.triggerElement)==null?void 0:i.shadowRoot)==null?void 0:l.querySelector(".mdc-focus-ring"))!=null&&c.matches(":focus-visible")||this.isHovered)&&this.show()};this.cancelOpenDelay=()=>{this.timers.clearTimeout(Li.OPEN)};this.startCloseDelay=()=>{this.cancelOpenDelay(),this.interactive?this.timers.setTimeout(Li.HOVER,()=>{this.visible=!1},this.closeDelay):this.hide()};this.cancelCloseDelay=()=>{this.timers.clearTimeout(Li.HOVER),this.timers.clearTimeout(Li.CLOSE)};this.hide=()=>{this.cancelOpenDelay();let t=()=>{this.visible=!1};this.closeDelay>0?this.timers.setTimeout(Li.CLOSE,t,this.closeDelay):(this.timers.clearTimeout(Li.CLOSE),t())};this.togglePopoverVisible=t=>{this.isEventFromTrigger(t)&&(this.visible?this.hide():this.show())};this.positionPopover=()=>{let{triggerElement:t}=this;if(!t)return;let e=!this.boundary||this.boundary==="clippingAncestors"?"clippingAncestors":Array.from(document.querySelectorAll(this.boundary)),i=this.boundaryRoot,l=[];if(this.inline&&l.push(Cg()),l.push(xg({boundary:e,rootBoundary:i,padding:this.boundaryPadding})),this.disableFlip||l.push(Ag({boundary:e,rootBoundary:i})),this.size){let f=A=>{this.style.setProperty("--mdc-popover-internal-available-height",`${A}px`)},y=this.renderRoot.querySelector('[part="popover-content"]');l.push(Sg({boundary:e,rootBoundary:i,apply({availableHeight:A}){y&&(Object.assign(y.style,{maxHeight:`${A}px`,overflowY:"auto"}),f(A))},padding:50}))}let c=0;if(this.showArrow&&(this.arrowElement=this.renderRoot.querySelector('div[part="popover-arrow"]'),this.arrowElement)){let f=this.arrowElement.offsetHeight;c=Math.sqrt(2*f**2)/2,l.push(Ig({element:this.arrowElement,padding:12}))}l.push(Tg(typeof this.offset=="number"?this.offset+c:this.offset)),this.floatingUICleanupFunction=Eg(t,this,async()=>{let{triggerElement:f}=this;if(!f)return;let y=this.adjustPlacementForRtl(this.placement),{x:A,y:F,middlewareData:U,placement:Q}=await _g(f,this,{placement:y,middleware:l,strategy:this.strategy});this.utils.updatePopoverStyle(A,F),U.arrow&&this.arrowElement&&this.utils.updateArrowStyle(U.arrow,Q),this.trigger.includes("mouseenter")&&this.utils.setupHoverBridge(Q)},{animationFrame:this.animationFrame})};this.show=this.show.bind(this),this.utils=new Cd(this),this.parseTrigger(),[this.openDelay,this.closeDelay]=this.utils.setupDelay()}get zIndex(){return Number.isInteger(this.internalZIndex)?this.internalZIndex:this.depthManager.getHostZIndex()}set zIndex(t){this.internalZIndex=t}get connectedTooltip(){let t=this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);return Array.from(t).find(e=>e!==this)}get triggerElement(){return this.getRootNode().querySelector(`[id="${this.triggerID}"]`)}async firstUpdated(t){super.firstUpdated(t),Di.onCreatedPopover(this)}connectedCallback(){super.connectedCallback(),this.utils.setupAppendTo(),this.setupTriggerListeners()}async disconnectedCallback(){var t,e;super.disconnectedCallback(),this.removeAllListeners(),(t=this.deactivateFocusTrap)==null||t.call(this),this.deactivatePreventScroll(),this.moveElementBackAfterBackdropRemoval(this.triggerElement),this.removeBackdrop(),(e=this.floatingUICleanupFunction)==null||e.call(this),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),this.utils.cleanupAppendTo(),Di.onDestroyedPopover(this)}async updated(t){if(super.updated(t),t.has("visible")){let e=t.get("visible")||!1;await this.isOpenUpdated(e,this.visible),this.utils.updateAriaExpandedAttribute()}t.has("trigger")&&(this.parseTrigger(),this.removeTriggerListeners(),this.setupTriggerListeners()),t.has("placement")&&this.setAttribute("placement",Object.values(Mt).includes(this.placement)?this.placement:bt.PLACEMENT),t.has("delay")&&([this.openDelay,this.closeDelay]=this.utils.setupDelay()),t.has("color")&&this.setAttribute("color",Object.values(Qo).includes(this.color)?this.color:bt.COLOR),t.has("appendTo")&&(this.appendTo&&this.isConnected?this.utils.setupAppendTo():this.utils.cleanupAppendTo()),(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())}onComponentStackChanged(t){t==="removed"?this.hide():t==="moved"&&this.requestUpdate("zIndex")}async isOpenUpdated(t,e){var l,c;let{triggerElement:i}=this;t===e||!i||(e&&!this.shouldSuppressOpening?(this.depthManager.pushHost()&&this.requestUpdate("zIndex"),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.visible=!1,this.connectedTooltip.shouldSuppressOpening=!0),this.backdrop&&!this.backdropElement&&(this.createBackdrop("popover"),this.keepElementAboveBackdrop(i)),this.positionPopover(),this.hideOnBlur&&(this.addEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(i.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 f,y,A;this.interactive&&this.focusTrap&&((f=this.activateFocusTrap)==null||f.call(this),(A=this.setInitialFocus)==null||A.call(this,(y=this.elementIndexToReceiveFocus)!=null?y:0))},0),Di.onShowPopover(this)):(this.depthManager.popHost(),(l=this.floatingUICleanupFunction)==null||l.call(this),this.backdrop&&(this.moveElementBackAfterBackdropRemoval(i),this.removeBackdrop()),this.hideOnBlur&&(this.removeEventListener("focusout",this.onPopoverFocusOut),this.trigger==="click"&&(i.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(),(c=this.deactivateFocusTrap)==null||c.call(this),this.focusBackToTrigger&&(i==null||i.focus()),this.keepConnectedTooltipOpen||this.connectedTooltip&&(this.connectedTooltip.shouldSuppressOpening=!1),Di.onHidePopover(this)))}show(){if(this.shouldSuppressOpening||(this.cancelCloseDelay(),this.visible))return;let t=()=>{this.visible=!0};this.openDelay>0?this.timers.setTimeout(Li.OPEN,t,this.openDelay):(this.timers.clearTimeout(Li.OPEN),t())}isEventFromTrigger(t){var e;return this.triggerID?t.composed?t.composedPath().some(i=>(i==null?void 0:i.id)===this.triggerID):((e=t.target)==null?void 0:e.id)===this.triggerID:!1}isRtl(){return window.getComputedStyle(this).direction==="rtl"}adjustPlacementForRtl(t){if(!this.isRtl())return t;switch(t){case Mt.LEFT:return Mt.RIGHT;case Mt.LEFT_START:return Mt.RIGHT_START;case Mt.LEFT_END:return Mt.RIGHT_END;case Mt.RIGHT:return Mt.LEFT;case Mt.RIGHT_START:return Mt.LEFT_START;case Mt.RIGHT_END:return Mt.LEFT_END;default:return t}}render(){return this.style.zIndex=`${this.zIndex}`,S`
2730
2730
  <div part="popover-hover-bridge"></div>
2731
2731
  ${this.closeButton?S` <mdc-button
2732
2732
  part="popover-close"