@momentum-ui/web-components 2.9.10 → 2.9.11

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.
@@ -1,15 +1,15 @@
1
- (window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[16],{32:function(e,t,r){"use strict";r.r(t),r.d(t,"OverlaySizes",(function(){return i})),r.d(t,"menuOverlaySize",(function(){return w})),r.d(t,"menuOverlayPlacement",(function(){return x})),r.d(t,"menuOverlayRole",(function(){return L})),r.d(t,"MenuOverlay",(function(){return C}));var i,o=r(1),n=r(6),s=r(34),a=r(18),l=r(25),d=r.n(l),h=r(26),p=r.n(h),c=r(27),v=r.n(c),u=r(28),m=r.n(u),g=r(21),y=r(0),b=y.css`:host{--vw-padding:16px}.md-menu-overlay{box-sizing:border-box;color:var(--md-primary-text-color);position:relative}.md-menu-overlay *{box-sizing:inherit}.md-menu-overlay .overlay-content{background-color:var(--md-secondary-white-bg-color);border:1px solid var(--md-menu-overlay-border-color,--gray-20);border-radius:.5rem;display:flex;justify-content:space-around;max-width:calc(100vw - var(--vw-padding)*2);overflow-y:auto}.md-menu-overlay .overlay-container{border-radius:.5rem;box-shadow:0 8px 16px rgba(0,0,0,.16),0 0 1px rgba(0,0,0,.14);box-sizing:border-box;display:none;position:absolute;z-index:1000}.md-menu-overlay .overlay-container[data-show]{display:block}.overlay-arrow{filter:drop-shadow(0 0 5px rgba(0, 0, 0, .16));height:0;visibility:hidden;width:0;z-index:-1}.overlay-arrow[data-show]{visibility:visible}.overlay-container[data-popper-placement^=top]>.overlay-arrow{border-left:solid 1rem transparent;border-right:solid 1rem transparent;border-top:solid 1rem var(--md-tertiary-white-bg-color);bottom:-.875rem}.overlay-container[data-popper-placement^=bottom]>.overlay-arrow{border-bottom:solid 1rem var(--md-tertiary-white-bg-color);border-left:solid 1rem transparent;border-right:solid 1rem transparent;top:-.875rem}.overlay-container[data-popper-placement^=right]>.overlay-arrow{border-bottom:solid 1rem transparent;border-right:solid 1rem var(--md-tertiary-white-bg-color);border-top:solid 1rem transparent;left:-.875rem}.overlay-container[data-popper-placement^=left]>.overlay-arrow{border-bottom:solid 1rem transparent;border-left:solid 1rem var(--md-tertiary-white-bg-color);border-top:solid 1rem transparent;right:-.875rem}`,O=r(3),E=function(e,t,r,i){var o,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(n<3?o(s):n>3?o(t,r,s):o(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s},f=function(e,t,r,i){return new(r||(r=Promise))((function(o,n){function s(e){try{l(i.next(e))}catch(e){n(e)}}function a(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.small="260px",e.large="370px"}(i||(i={}));const w=["small","large"],x=["left-start","left","left-end","right-start","right","right-end","top-start","top","top-end","bottom-start","bottom","bottom-end"],L=["menu","dialog"];var C;!function(e){let t=class extends(Object(s.a)(y.LitElement)){constructor(){super(...arguments),this._isOpen=!1,this.size="large",this.maxHeight="",this.customWidth="",this.showArrow=!1,this.disabled=!1,this.placement="bottom",this.allowHoverToggle=!1,this.ariaRole="menu",this.ariaLabel="",this.popperInstance=null,this.triggerElement=null,this.updateActiveMenuOverlayOpened=t=>{var r;this===t.target&&(null===(r=e.ELEMENT.activeOverlay)||void 0===r||r.push(t.target))},this.updateActiveMenuOverlayClosed=t=>{var r;let i=e.ELEMENT.activeOverlay.indexOf(t.target);this===t.target&&-1!==i&&(e.ELEMENT.activeOverlay.splice(i),e.ELEMENT.activeOverlay.length>0?null===(r=e.ELEMENT.activeOverlay[e.ELEMENT.activeOverlay.length-1])||void 0===r||r.setFocusableElements():(this.setFocusableElements(),this.focusOnTrigger()))},this.handleTriggerClick=e=>{this.toggleOverlay()},this.setOverlay=Object(a.b)(e=>{this.disabled||(this.isOpen=e)},100),this.expandPopup=()=>{this.setOverlay(!0)},this.collapsePopup=()=>{this.setOverlay(!1)},this.handleOutsideOverlayKeydown=t=>f(this,void 0,void 0,(function*(){let r=!1;const i=t.composedPath();if((!i.length||(r=!!i.find(e=>e===this),r))&&this.overlayContainer&&t.code===o.b.Escape){t.preventDefault(),(e.ELEMENT.activeOverlay.length>0?e.ELEMENT.activeOverlay[e.ELEMENT.activeOverlay.length-1]:void 0)===this&&(this.isOpen=!1,yield this.updateComplete,this.focusOnTrigger())}})),this.handleTriggerKeyDown=e=>f(this,void 0,void 0,(function*(){switch(e.code){case o.b.Space:case o.b.Enter:e.preventDefault(),this.toggleOverlay(),this.isOpen||(yield this.updateComplete,this.focusOnTrigger())}})),this.handleOutsideOverlayClick=e=>{let t=!1;const r=e.composedPath();r.length&&(t=!!r.find(e=>e===this),t||this.preventClickOutside||(this.isOpen=!1))}}get isOpen(){return this._isOpen}set isOpen(e){const t=this._isOpen;this._isOpen=e,this.handleInstance(e),this.overlayContainer&&this.overlayContainer.toggleAttribute("data-show",e),this.requestUpdate("isOpen",t)}renderMaxHeight(){return this.maxHeight?`max-height: ${this.maxHeight};`:"max-height: calc(100vh - 48px);"}renderWidth(){return this.customWidth?`width: ${this.customWidth};`:"small"===this.size?`width: ${i.small};`:`width: ${i.large};`}getStyles(){return y.html`
1
+ (window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[16],{32:function(e,t,r){"use strict";r.r(t),r.d(t,"OverlaySizes",(function(){return i})),r.d(t,"menuOverlaySize",(function(){return w})),r.d(t,"menuOverlayPlacement",(function(){return x})),r.d(t,"menuOverlayRole",(function(){return L})),r.d(t,"MenuOverlay",(function(){return C}));var i,o=r(1),n=r(6),a=r(34),s=r(18),l=r(25),d=r.n(l),h=r(26),p=r.n(h),c=r(27),v=r.n(c),u=r(28),m=r.n(u),g=r(21),y=r(0),b=y.css`:host{--vw-padding:16px}.md-menu-overlay{box-sizing:border-box;color:var(--md-primary-text-color);position:relative}.md-menu-overlay *{box-sizing:inherit}.md-menu-overlay .overlay-content{background-color:var(--md-secondary-white-bg-color);border:1px solid var(--md-menu-overlay-border-color,--gray-20);border-radius:.5rem;display:flex;justify-content:space-around;max-width:calc(100vw - var(--vw-padding)*2);overflow-y:auto}.md-menu-overlay .overlay-container{border-radius:.5rem;box-shadow:0 8px 16px rgba(0,0,0,.16),0 0 1px rgba(0,0,0,.14);box-sizing:border-box;display:none;position:absolute;z-index:1000}.md-menu-overlay .overlay-container[data-show]{display:block}.overlay-arrow{filter:drop-shadow(0 0 5px rgba(0, 0, 0, .16));height:0;visibility:hidden;width:0;z-index:-1}.overlay-arrow[data-show]{visibility:visible}.overlay-container[data-popper-placement^=top]>.overlay-arrow{border-left:solid 1rem transparent;border-right:solid 1rem transparent;border-top:solid 1rem var(--md-tertiary-white-bg-color);bottom:-.875rem}.overlay-container[data-popper-placement^=bottom]>.overlay-arrow{border-bottom:solid 1rem var(--md-tertiary-white-bg-color);border-left:solid 1rem transparent;border-right:solid 1rem transparent;top:-.875rem}.overlay-container[data-popper-placement^=right]>.overlay-arrow{border-bottom:solid 1rem transparent;border-right:solid 1rem var(--md-tertiary-white-bg-color);border-top:solid 1rem transparent;left:-.875rem}.overlay-container[data-popper-placement^=left]>.overlay-arrow{border-bottom:solid 1rem transparent;border-left:solid 1rem var(--md-tertiary-white-bg-color);border-top:solid 1rem transparent;right:-.875rem}`,O=r(3),E=function(e,t,r,i){var o,n=arguments.length,a=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(n<3?o(a):n>3?o(t,r,a):o(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a},f=function(e,t,r,i){return new(r||(r=Promise))((function(o,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function s(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))};!function(e){e.small="260px",e.large="370px"}(i||(i={}));const w=["small","large"],x=["left-start","left","left-end","right-start","right","right-end","top-start","top","top-end","bottom-start","bottom","bottom-end"],L=["menu","dialog"];var C;!function(e){let t=class extends(Object(a.a)(y.LitElement)){constructor(){super(...arguments),this._isOpen=!1,this.size="large",this.maxHeight="",this.customWidth="",this.showArrow=!1,this.disabled=!1,this.placement="bottom",this.allowHoverToggle=!1,this.ariaRole="menu",this.ariaLabel="",this.popperInstance=null,this.triggerElement=null,this.updateActiveMenuOverlayOpened=t=>{var r;this===t.target&&(null===(r=e.ELEMENT.activeOverlay)||void 0===r||r.push(t.target))},this.updateActiveMenuOverlayClosed=t=>{var r,i;let o=e.ELEMENT.activeOverlay.indexOf(t.target);this===t.target&&-1!==o&&(e.ELEMENT.activeOverlay.splice(o),e.ELEMENT.activeOverlay.length>0?(null===(r=e.ELEMENT.activeOverlay[e.ELEMENT.activeOverlay.length-1])||void 0===r||r.setFocusableElements(),null===(i=e.ELEMENT.activeOverlay[e.ELEMENT.activeOverlay.length-1])||void 0===i||i.focusOnNestedTrigger(this.triggerElement)):(this.setFocusableElements(),this.focusOnTrigger()))},this.handleTriggerClick=e=>{this.toggleOverlay()},this.setOverlay=Object(s.b)(e=>{this.disabled||(this.isOpen=e)},100),this.expandPopup=()=>{this.setOverlay(!0)},this.collapsePopup=()=>{this.setOverlay(!1)},this.handleOutsideOverlayKeydown=t=>f(this,void 0,void 0,(function*(){let r=!1;const i=t.composedPath();if((!i.length||(r=!!i.find(e=>e===this),r))&&this.overlayContainer&&t.code===o.b.Escape){t.preventDefault(),(e.ELEMENT.activeOverlay.length>0?e.ELEMENT.activeOverlay[e.ELEMENT.activeOverlay.length-1]:void 0)===this&&(this.isOpen=!1,yield this.updateComplete,this.focusOnTrigger())}})),this.handleTriggerKeyDown=e=>f(this,void 0,void 0,(function*(){switch(e.code){case o.b.Space:case o.b.Enter:e.preventDefault(),this.toggleOverlay(),this.isOpen||(yield this.updateComplete,this.focusOnTrigger())}})),this.handleOutsideOverlayClick=e=>{let t=!1;const r=e.composedPath();r.length&&(t=!!r.find(e=>e===this),t||this.preventClickOutside||(this.isOpen=!1))}}get isOpen(){return this._isOpen}set isOpen(e){const t=this._isOpen;this._isOpen=e,this.handleInstance(e),this.overlayContainer&&this.overlayContainer.toggleAttribute("data-show",e),this.requestUpdate("isOpen",t)}renderMaxHeight(){return this.maxHeight?`max-height: ${this.maxHeight};`:"max-height: calc(100vh - 48px);"}renderWidth(){return this.customWidth?`width: ${this.customWidth};`:"small"===this.size?`width: ${i.small};`:`width: ${i.large};`}getStyles(){return y.html`
2
2
  <style>
3
3
  :host .md-menu-overlay .overlay-content {
4
4
  ${this.renderMaxHeight()};
5
5
  ${this.renderWidth()};
6
6
  }
7
7
  </style>
8
- `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleOutsideOverlayClick),document.addEventListener("keydown",this.handleOutsideOverlayKeydown),this.addEventListener("menu-overlay-open",this.updateActiveMenuOverlayOpened),this.addEventListener("menu-overlay-close",this.updateActiveMenuOverlayClosed)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleOutsideOverlayClick),document.removeEventListener("keydown",this.handleOutsideOverlayKeydown),this.removeEventListener("menu-overlay-open",this.updateActiveMenuOverlayOpened),this.removeEventListener("menu-overlay-close",this.updateActiveMenuOverlayClosed),this.triggerElement&&(this.triggerElement.removeEventListener("click",this.handleTriggerClick),this.triggerElement.removeEventListener("keydown",this.handleTriggerKeyDown),this.allowHoverToggle&&(this.triggerElement.removeEventListener("mouseenter",this.expandPopup),this.triggerElement.removeEventListener("mouseleave",this.collapsePopup),this.overlayContainer.removeEventListener("mouseenter",this.expandPopup),this.overlayContainer.removeEventListener("mouseleave",this.collapsePopup)),this.triggerElement=null)}checkIsInputField(e){return!(!e||!e.tagName||"md-input"!==e.tagName.toLowerCase())}firstUpdated(e){const t=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return f(this,void 0,void 0,(function*(){t.firstUpdated.call(this,e),yield new Promise(e=>setTimeout(e,0)),this.trigger&&(this.triggerElement=this.trigger[0],this.triggerElement.addEventListener("click",this.handleTriggerClick),this.allowHoverToggle&&(this.triggerElement.addEventListener("mouseenter",this.expandPopup),this.triggerElement.addEventListener("mouseleave",this.collapsePopup),this.overlayContainer.addEventListener("mouseenter",this.expandPopup),this.overlayContainer.addEventListener("mouseleave",this.collapsePopup)),this.checkIsInputField(this.triggerElement)||this.triggerElement.addEventListener("keydown",this.handleTriggerKeyDown),this.triggerElement.setAttribute("aria-haspopup","true")),this.overlayContainer&&this.isOpen&&(this.handleInstance(!0),this.overlayContainer.toggleAttribute("data-show",!0)),this.arrow&&this.showArrow&&this.arrow.toggleAttribute("data-show",!0)}))}update(e){super.update(e),e.has("isOpen")&&(this.isOpen?(this.activateFocusTrap(),document.addEventListener("menu-item-click",this.handleTriggerClick)):(this.deactivateFocusTrap(),document.removeEventListener("menu-item-click",this.handleTriggerClick)))}updated(e){super.updated(e),e.has("isOpen")&&(this.isOpen?(this.dispatchMenuOpen(),this.triggerElement&&this.triggerElement.setAttribute("aria-expanded","true")):(this.dispatchMenuClose(),this.triggerElement&&this.triggerElement.removeAttribute("aria-expanded")))}dispatchMenuOpen(){this.dispatchEvent(new CustomEvent("menu-overlay-open",{composed:!0,bubbles:!0}))}dispatchMenuClose(){this.dispatchEvent(new CustomEvent("menu-overlay-close",{composed:!0,bubbles:!0}))}handleInstance(e){e?this.create():this.destroy()}create(){this.triggerElement&&(this.popperInstance=Object(g.createPopper)(this.triggerElement,this.overlayContainer,{onFirstUpdate:()=>f(this,void 0,void 0,(function*(){this.isOpen&&(this.setFocusableElements(),yield this.updateComplete,this.focusInsideOverlay())})),placement:this.placement,modifiers:[...g.defaultModifiers,p.a,v.a,m.a,d.a,{name:"preventOverflow",options:{padding:16}},{name:"offset",options:{offset:({placement:e,reference:t})=>"left-end"===e||"right-end"===e?[t.height+t.y+3,14]:[0,15]}},{name:"arrow",options:{element:this.arrow,padding:5}},{name:"computeStyles",options:{adaptive:!1}}]}))}destroy(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}toggleOverlay(){this.disabled||(this.isOpen=!this.isOpen)}focusOnTrigger(){requestAnimationFrame(()=>{this.focusableElements&&this.focusableElements.length&&this.focusableElements[0].focus()})}focusInsideOverlay(){this.focusableElements&&(this.focusableElements.length>1?this.setInitialFocus(1):this.focusableElements.length&&this.setInitialFocus())}static get styles(){return[b]}render(){return y.html`
8
+ `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.handleOutsideOverlayClick),document.addEventListener("keydown",this.handleOutsideOverlayKeydown),this.addEventListener("menu-overlay-open",this.updateActiveMenuOverlayOpened),this.addEventListener("menu-overlay-close",this.updateActiveMenuOverlayClosed)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleOutsideOverlayClick),document.removeEventListener("keydown",this.handleOutsideOverlayKeydown),this.removeEventListener("menu-overlay-open",this.updateActiveMenuOverlayOpened),this.removeEventListener("menu-overlay-close",this.updateActiveMenuOverlayClosed),this.triggerElement&&(this.triggerElement.removeEventListener("click",this.handleTriggerClick),this.triggerElement.removeEventListener("keydown",this.handleTriggerKeyDown),this.allowHoverToggle&&(this.triggerElement.removeEventListener("mouseenter",this.expandPopup),this.triggerElement.removeEventListener("mouseleave",this.collapsePopup),this.overlayContainer.removeEventListener("mouseenter",this.expandPopup),this.overlayContainer.removeEventListener("mouseleave",this.collapsePopup)),this.triggerElement=null)}checkIsInputField(e){return!(!e||!e.tagName||"md-input"!==e.tagName.toLowerCase())}firstUpdated(e){const t=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return f(this,void 0,void 0,(function*(){t.firstUpdated.call(this,e),yield new Promise(e=>setTimeout(e,0)),this.trigger&&(this.triggerElement=this.trigger[0],this.triggerElement.addEventListener("click",this.handleTriggerClick),this.allowHoverToggle&&(this.triggerElement.addEventListener("mouseenter",this.expandPopup),this.triggerElement.addEventListener("mouseleave",this.collapsePopup),this.overlayContainer.addEventListener("mouseenter",this.expandPopup),this.overlayContainer.addEventListener("mouseleave",this.collapsePopup)),this.checkIsInputField(this.triggerElement)||this.triggerElement.addEventListener("keydown",this.handleTriggerKeyDown),this.triggerElement.setAttribute("aria-haspopup","true")),this.overlayContainer&&this.isOpen&&(this.handleInstance(!0),this.overlayContainer.toggleAttribute("data-show",!0)),this.arrow&&this.showArrow&&this.arrow.toggleAttribute("data-show",!0)}))}update(e){super.update(e),e.has("isOpen")&&(this.isOpen?(this.activateFocusTrap(),document.addEventListener("menu-item-click",this.handleTriggerClick)):(this.deactivateFocusTrap(),document.removeEventListener("menu-item-click",this.handleTriggerClick)))}updated(e){super.updated(e),e.has("isOpen")&&(this.isOpen?(this.dispatchMenuOpen(),this.triggerElement&&(this.triggerElement.setAttribute("aria-expanded","true"),this.triggerElement.hasAttribute("ariaexpanded")&&this.triggerElement.setAttribute("ariaexpanded","true"))):(this.dispatchMenuClose(),this.triggerElement&&(this.triggerElement.removeAttribute("aria-expanded"),this.triggerElement.hasAttribute("ariaexpanded")&&this.triggerElement.setAttribute("ariaexpanded","false"))))}dispatchMenuOpen(){this.dispatchEvent(new CustomEvent("menu-overlay-open",{composed:!0,bubbles:!0}))}dispatchMenuClose(){this.dispatchEvent(new CustomEvent("menu-overlay-close",{composed:!0,bubbles:!0}))}handleInstance(e){e?this.create():this.destroy()}create(){this.triggerElement&&(this.popperInstance=Object(g.createPopper)(this.triggerElement,this.overlayContainer,{onFirstUpdate:()=>f(this,void 0,void 0,(function*(){this.isOpen&&(this.setFocusableElements(),yield this.updateComplete,this.focusInsideOverlay())})),placement:this.placement,modifiers:[...g.defaultModifiers,p.a,v.a,m.a,d.a,{name:"preventOverflow",options:{padding:16}},{name:"offset",options:{offset:({placement:e,reference:t})=>"left-end"===e||"right-end"===e?[t.height+t.y+3,14]:[0,15]}},{name:"arrow",options:{element:this.arrow,padding:5}},{name:"computeStyles",options:{adaptive:!1}}]}))}destroy(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}toggleOverlay(){this.disabled||(this.isOpen=!this.isOpen)}focusOnTrigger(){requestAnimationFrame(()=>{this.focusableElements&&this.focusableElements.length&&this.focusableElements[0].focus()})}focusInsideOverlay(){this.focusableElements&&(this.focusableElements.length>1?this.setInitialFocus(1):this.focusableElements.length&&this.setInitialFocus())}focusOnNestedTrigger(e){this.setFocusOnTrigger(e)}static get styles(){return[b]}render(){return y.html`
9
9
  ${this.getStyles()}
10
10
  <div aria-expanded=${this.isOpen} class="md-menu-overlay">
11
11
  <slot name="menu-trigger"></slot>
12
- <div part="overlay" class="overlay-container" role=${this.ariaRole}
12
+ <div part="overlay" class="overlay-container" role=${this.ariaRole}
13
13
  aria-modal=${Object(O.ifDefined)("dialog"===this.ariaRole?"true":void 0)}
14
14
  aria-label=${Object(O.ifDefined)(this.ariaLabel||void 0)}
15
15
  >
@@ -1 +1 @@
1
- (window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[5],{34:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var i=s(1),n=s(0),o=s(16),a=s(33),c=function(e,t,s,i){var n,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(a=(o<3?n(a):o>3?n(t,s,a):n(t,s))||a);return o>3&&a&&Object.defineProperty(t,s,a),a},l=function(e,t,s,i){return new(s||(s=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function c(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(a,c)}l((i=i.apply(e,t||[])).next())}))};n.LitElement;const r=e=>{if(Object(o.b)(r,e))return e;class t extends(Object(a.a)(e)){constructor(){super(...arguments),this.focusableElements=[],this.initialFocusComplete=!1,this.focusableTimer=[],this.activeFocusTrap=!1,this.preventClickOutside=!1,this.focusTrapIndex=-1,this.preventScroll=!1,this.handleOutsideTrapClick=e=>{let t=!1;const s=e.composedPath();s.length&&(t=!!s.find(e=>e===this),t||this.preventClickOutside||!this.activeFocusTrap?t&&this.activeFocusTrap&&this.initialFocusComplete&&this.handleClickInsideTrap(e):this.deactivateFocusTrap())},this.updateFocusableElements=()=>{this.focusableTimer&&(clearTimeout(this.focusableTimer),this.focusableElements=[]),this.focusableTimer=setTimeout(()=>{this.setFocusableElements()},10)},this.handleChildFocusTrap=e=>{e.target!==this&&(e.stopPropagation(),this.deactivateFocusTrap(!1))},this.handleChildFocusUntrap=e=>{e.target!==this&&(e.stopPropagation(),this.activateFocusTrap(!1))}}updated(e){if(super.updated(e),e.has("focusTrapIndex")){const t=e.get("focusTrapIndex"),s=this.focusableElements[t];s&&(s.blur(),s.toggleAttribute("focus-visible",!1));const i=this.focusableElements[this.focusTrapIndex];i&&this.tryFocus(i)}}tryFocus(e){requestAnimationFrame(()=>l(this,void 0,void 0,(function*(){this.isElementFocused(e)&&e.focus({preventScroll:this.preventScroll}),void 0!==e.updateComplete&&(yield e.updateComplete),document.hasFocus()&&this.isElementFocused(e)&&e.focus({preventScroll:this.preventScroll}),this.initialFocusComplete||(this.initialFocusComplete=!0)})))}domRectCollection(e){return 0===e.getClientRects().length}viewportPosition(e){const{width:t,height:s}=e.getBoundingClientRect(),{offsetWidth:i,offsetHeight:n}=e;return i+n+s+t===0}isNotVisible(e){return"SLOT"!==e.tagName&&(this.viewportPosition(e)||this.domRectCollection(e))}isHidden(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"true"===e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility||this.isNotVisible(e)||"hidden"===getComputedStyle(e).visibility||"0"===getComputedStyle(e).height}isDisabled(e){return e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled")}isNotTabbable(e){return"-1"===e.getAttribute("tabindex")}isInteractiveElement(e){return e instanceof HTMLButtonElement||e instanceof HTMLDetailsElement||e instanceof HTMLEmbedElement||e instanceof HTMLIFrameElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||(!!(e instanceof HTMLAnchorElement&&e.hasAttribute("href"))||(e instanceof HTMLInputElement&&"hidden"!==e.type||(!(!(e instanceof HTMLAudioElement||e instanceof HTMLVideoElement)||!e.hasAttribute("controls"))||(!(!(e instanceof HTMLImageElement||e instanceof HTMLObjectElement)||!e.hasAttribute("usemap"))||!!(e.hasAttribute("tabindex")&&e.tabIndex>-1)))))}isFocusable(e){return!(this.isDisabled(e)||this.isHidden(e)||this.isNotTabbable(e))&&!!this.isInteractiveElement(e)}shouldSkipFocus(e){return!!(e.id&&e.id.split&&e.id.split(" ").indexOf("md-combobox-listbox")>-1)}findFocusable(e,t){const s=Array.from(e.children);for(const e of s)if(!this.isHidden(e)){if(this.shouldSkipFocus(e))break;if(this.isFocusable(e)&&t.add(e),e.shadowRoot)this.findFocusable(e.shadowRoot,t);else if("SLOT"===e.tagName){const s=e.assignedNodes().filter(e=>e.nodeType===e.ELEMENT_NODE);if(s.length){const e=s[0].parentElement;e&&this.findFocusable(e,t)}}else this.findFocusable(e,t)}return[...t]}isEqualFocusNode(e,t){return e.nodeType>=0&&(t.isEqualNode(e)&&t==e)}findElement(e){return this.focusableElements.findIndex(t=>this.isEqualFocusNode(e,t))}focusTrap(e){const t=this.getDeepActiveElement(),s=this.findElement(t);if(e)-1===s&&this.focusTrapIndex-1>0?this.focusTrapIndex--:this.focusTrapIndex=s>0?s-1:this.focusableElements.length-1;else if(-1===s&&this.focusTrapIndex+1<this.focusableElements.length)this.focusTrapIndex++;else if(s===this.focusableElements.length-1&&0===this.focusTrapIndex){const e=this.focusableElements[this.focusTrapIndex];e&&this.tryFocus(e)}else this.focusTrapIndex=s+1<this.focusableElements.length?s+1:0}hasAutofocus(e){return e.hasAttribute("autofocus")}setInitialFocus(e=0,t=!1){let s=-1;this.initialFocusComplete=!1,this.focusableElements.length&&!t&&(s=this.focusableElements.findIndex(this.hasAutofocus)),this.focusableElements.length&&-1===s&&("object"==typeof e?s=this.findElement(e):"number"==typeof e&&(s=e)),this.focusableElements[s]&&(this.focusTrapIndex=s)}setFocusableElements(){this.focusableElements=this.findFocusable(this.shadowRoot,new Set)}firstUpdated(e){const t=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return l(this,void 0,void 0,(function*(){t.firstUpdated.call(this,e),yield new Promise(e=>setTimeout(e,0)),this.setFocusableElements()}))}handleKeydownFocusTrap(e){e.code!==i.b.Tab||e.shiftKey&&e.code!==i.b.Tab||this.activeFocusTrap&&this.focusableElements.length&&(e.shiftKey?(e.preventDefault(),this.focusTrap(!0)):(e.preventDefault(),this.focusTrap(!1)))}activateFocusTrap(e=!0){e&&this.dispatchEvent(new CustomEvent("on-focus-trap",{bubbles:!0,composed:!0,cancelable:!0})),this.activeFocusTrap=!0}deactivateFocusTrap(e=!0){this.activeFocusTrap=!1,this.focusTrapIndex=-1,this.removeAttribute("focus-trap-index"),e&&this.dispatchEvent(new CustomEvent("on-focus-untrap",{bubbles:!0,composed:!0,cancelable:!0}))}handleClickInsideTrap(e){const t=e.composedPath(),s=t.findIndex(e=>-1!==this.findElement(e));if(-1!==s){const e=t[s],i=this.findElement(e);-1!==i&&(this.focusTrapIndex=i)}}manageNewElement(e){requestAnimationFrame(()=>{this.setFocusableElements();const t=this.findElement(e);-1!==t&&(this.focusTrapIndex=t)})}handleFocusVisible(e){const t=(e.detail?e.detail.sourceEvent:e).composedPath()[0];-1===(e.detail?this.findElement(t):-1)&&t!==this&&this.manageNewElement(t)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydownFocusTrap),this.addEventListener("focus-visible",this.handleFocusVisible),this.addEventListener("on-focus-trap",this.handleChildFocusTrap),this.addEventListener("on-focus-untrap",this.handleChildFocusUntrap),document.addEventListener("click",this.handleOutsideTrapClick),document.addEventListener("on-widget-update",this.updateFocusableElements)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydownFocusTrap),this.removeEventListener("focus-visible",this.handleFocusVisible),this.removeEventListener("on-focus-trap",this.handleChildFocusTrap),this.removeEventListener("on-focus-untrap",this.handleChildFocusUntrap),document.removeEventListener("click",this.handleOutsideTrapClick),document.removeEventListener("on-widget-update",this.updateFocusableElements),this.focusableTimer&&clearTimeout(this.focusableTimer)}}return c([Object(n.internalProperty)()],t.prototype,"focusableElements",void 0),c([Object(n.internalProperty)()],t.prototype,"initialFocusComplete",void 0),c([Object(n.internalProperty)()],t.prototype,"focusableTimer",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"active-focus-trap"})],t.prototype,"activeFocusTrap",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"prevent-click-outside"})],t.prototype,"preventClickOutside",void 0),c([Object(n.property)({type:Number,reflect:!0,attribute:"focus-trap-index"})],t.prototype,"focusTrapIndex",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"prevent-scroll"})],t.prototype,"preventScroll",void 0),Object(o.a)(r,t),t}}}]);
1
+ (window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[5],{34:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var i=s(1),n=s(0),o=s(16),a=s(33),c=function(e,t,s,i){var n,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(a=(o<3?n(a):o>3?n(t,s,a):n(t,s))||a);return o>3&&a&&Object.defineProperty(t,s,a),a},l=function(e,t,s,i){return new(s||(s=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function c(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(a,c)}l((i=i.apply(e,t||[])).next())}))};n.LitElement;const r=e=>{if(Object(o.b)(r,e))return e;class t extends(Object(a.a)(e)){constructor(){super(...arguments),this.focusableElements=[],this.initialFocusComplete=!1,this.focusableTimer=[],this.activeFocusTrap=!1,this.preventClickOutside=!1,this.focusTrapIndex=-1,this.preventScroll=!1,this.handleOutsideTrapClick=e=>{let t=!1;const s=e.composedPath();s.length&&(t=!!s.find(e=>e===this),t||this.preventClickOutside||!this.activeFocusTrap?t&&this.activeFocusTrap&&this.initialFocusComplete&&this.handleClickInsideTrap(e):this.deactivateFocusTrap())},this.updateFocusableElements=()=>{this.focusableTimer&&(clearTimeout(this.focusableTimer),this.focusableElements=[]),this.focusableTimer=setTimeout(()=>{this.setFocusableElements()},10)},this.handleChildFocusTrap=e=>{e.target!==this&&(e.stopPropagation(),this.deactivateFocusTrap(!1))},this.handleChildFocusUntrap=e=>{e.target!==this&&(e.stopPropagation(),this.activateFocusTrap(!1))}}updated(e){if(super.updated(e),e.has("focusTrapIndex")){const t=e.get("focusTrapIndex"),s=this.focusableElements[t];s&&(s.blur(),s.toggleAttribute("focus-visible",!1));const i=this.focusableElements[this.focusTrapIndex];i&&this.tryFocus(i)}}tryFocus(e){requestAnimationFrame(()=>l(this,void 0,void 0,(function*(){this.isElementFocused(e)&&e.focus({preventScroll:this.preventScroll}),void 0!==e.updateComplete&&(yield e.updateComplete),document.hasFocus()&&this.isElementFocused(e)&&e.focus({preventScroll:this.preventScroll}),this.initialFocusComplete||(this.initialFocusComplete=!0)})))}domRectCollection(e){return 0===e.getClientRects().length}viewportPosition(e){const{width:t,height:s}=e.getBoundingClientRect(),{offsetWidth:i,offsetHeight:n}=e;return i+n+s+t===0}isNotVisible(e){return"SLOT"!==e.tagName&&(this.viewportPosition(e)||this.domRectCollection(e))}isHidden(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"true"===e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility||this.isNotVisible(e)||"hidden"===getComputedStyle(e).visibility||"0"===getComputedStyle(e).height}isDisabled(e){return e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled")}isNotTabbable(e){return"-1"===e.getAttribute("tabindex")}isInteractiveElement(e){return e instanceof HTMLButtonElement||e instanceof HTMLDetailsElement||e instanceof HTMLEmbedElement||e instanceof HTMLIFrameElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||(!!(e instanceof HTMLAnchorElement&&e.hasAttribute("href"))||(e instanceof HTMLInputElement&&"hidden"!==e.type||(!(!(e instanceof HTMLAudioElement||e instanceof HTMLVideoElement)||!e.hasAttribute("controls"))||(!(!(e instanceof HTMLImageElement||e instanceof HTMLObjectElement)||!e.hasAttribute("usemap"))||!!(e.hasAttribute("tabindex")&&e.tabIndex>-1)))))}isFocusable(e){return!(this.isDisabled(e)||this.isHidden(e)||this.isNotTabbable(e))&&!!this.isInteractiveElement(e)}shouldSkipFocus(e){return!!(e.id&&e.id.split&&e.id.split(" ").indexOf("md-combobox-listbox")>-1)}findFocusable(e,t){const s=Array.from(e.children);for(const e of s)if(!this.isHidden(e)){if(this.shouldSkipFocus(e))break;if(this.isFocusable(e)&&t.add(e),e.shadowRoot)this.findFocusable(e.shadowRoot,t);else if("SLOT"===e.tagName){const s=e.assignedNodes().filter(e=>e.nodeType===e.ELEMENT_NODE);if(s.length){const e=s[0].parentElement;e&&this.findFocusable(e,t)}}else this.findFocusable(e,t)}return[...t]}isEqualFocusNode(e,t){return e.nodeType>=0&&(t.isEqualNode(e)&&t==e)}findElement(e){return this.focusableElements.findIndex(t=>this.isEqualFocusNode(e,t))}focusTrap(e){const t=this.getDeepActiveElement(),s=this.findElement(t);if(e)-1===s&&this.focusTrapIndex-1>0?this.focusTrapIndex--:this.focusTrapIndex=s>0?s-1:this.focusableElements.length-1;else if(-1===s&&this.focusTrapIndex+1<this.focusableElements.length)this.focusTrapIndex++;else if(s===this.focusableElements.length-1&&0===this.focusTrapIndex){const e=this.focusableElements[this.focusTrapIndex];e&&this.tryFocus(e)}else this.focusTrapIndex=s+1<this.focusableElements.length?s+1:0}hasAutofocus(e){return e.hasAttribute("autofocus")}setInitialFocus(e=0,t=!1){let s=-1;this.initialFocusComplete=!1,this.focusableElements.length&&!t&&(s=this.focusableElements.findIndex(this.hasAutofocus)),this.focusableElements.length&&-1===s&&("object"==typeof e?s=this.findElement(e):"number"==typeof e&&(s=e)),this.focusableElements[s]&&(this.focusTrapIndex=s)}setFocusOnTrigger(e){let t;if(t=e.shadowRoot?this.findFocusable(e.shadowRoot,new Set):this.isFocusable(e)?[e]:this.findFocusable(e,new Set),t[0]){const e=this.findElement(t[0]);this.focusTrapIndex=e}}setFocusableElements(){this.focusableElements=this.findFocusable(this.shadowRoot,new Set)}firstUpdated(e){const t=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return l(this,void 0,void 0,(function*(){t.firstUpdated.call(this,e),yield new Promise(e=>setTimeout(e,0)),this.setFocusableElements()}))}handleKeydownFocusTrap(e){e.code!==i.b.Tab||e.shiftKey&&e.code!==i.b.Tab||this.activeFocusTrap&&this.focusableElements.length&&(e.shiftKey?(e.preventDefault(),this.focusTrap(!0)):(e.preventDefault(),this.focusTrap(!1)))}activateFocusTrap(e=!0){e&&this.dispatchEvent(new CustomEvent("on-focus-trap",{bubbles:!0,composed:!0,cancelable:!0})),this.activeFocusTrap=!0}deactivateFocusTrap(e=!0){this.activeFocusTrap=!1,this.focusTrapIndex=-1,this.removeAttribute("focus-trap-index"),e&&this.dispatchEvent(new CustomEvent("on-focus-untrap",{bubbles:!0,composed:!0,cancelable:!0}))}handleClickInsideTrap(e){const t=e.composedPath(),s=t.findIndex(e=>-1!==this.findElement(e));if(-1!==s){const e=t[s],i=this.findElement(e);-1!==i&&(this.focusTrapIndex=i)}}manageNewElement(e){requestAnimationFrame(()=>{this.setFocusableElements();const t=this.findElement(e);-1!==t&&(this.focusTrapIndex=t)})}handleFocusVisible(e){const t=(e.detail?e.detail.sourceEvent:e).composedPath()[0];-1===(e.detail?this.findElement(t):-1)&&t!==this&&this.manageNewElement(t)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeydownFocusTrap),this.addEventListener("focus-visible",this.handleFocusVisible),this.addEventListener("on-focus-trap",this.handleChildFocusTrap),this.addEventListener("on-focus-untrap",this.handleChildFocusUntrap),document.addEventListener("click",this.handleOutsideTrapClick),document.addEventListener("on-widget-update",this.updateFocusableElements)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeydownFocusTrap),this.removeEventListener("focus-visible",this.handleFocusVisible),this.removeEventListener("on-focus-trap",this.handleChildFocusTrap),this.removeEventListener("on-focus-untrap",this.handleChildFocusUntrap),document.removeEventListener("click",this.handleOutsideTrapClick),document.removeEventListener("on-widget-update",this.updateFocusableElements),this.focusableTimer&&clearTimeout(this.focusableTimer)}}return c([Object(n.internalProperty)()],t.prototype,"focusableElements",void 0),c([Object(n.internalProperty)()],t.prototype,"initialFocusComplete",void 0),c([Object(n.internalProperty)()],t.prototype,"focusableTimer",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"active-focus-trap"})],t.prototype,"activeFocusTrap",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"prevent-click-outside"})],t.prototype,"preventClickOutside",void 0),c([Object(n.property)({type:Number,reflect:!0,attribute:"focus-trap-index"})],t.prototype,"focusTrapIndex",void 0),c([Object(n.property)({type:Boolean,reflect:!0,attribute:"prevent-scroll"})],t.prototype,"preventScroll",void 0),Object(o.a)(r,t),t}}}]);
@@ -164,7 +164,7 @@ export declare namespace ComboBox {
164
164
  checkForVirtualScroll(): boolean;
165
165
  rangeChanged(): void;
166
166
  getCustomErrorContent(): DocumentFragment;
167
- getCustomContent(option: string | OptionMember): DocumentFragment | import("lit-element").TemplateResult;
167
+ getCustomContent(option: string | OptionMember): import("lit-element").TemplateResult | DocumentFragment;
168
168
  renderGroupLabelHeader(option: OptionMember, optionIndex: number): import("lit-element").TemplateResult;
169
169
  renderWithoutVirtualScroll(): import("lit-html").DirectiveFn;
170
170
  highlightingSearchedText(option: OptionMember | string): import("lit-element").TemplateResult[];
@@ -62,6 +62,7 @@ export declare namespace MenuOverlay {
62
62
  handleTriggerKeyDown: (event: KeyboardEvent) => Promise<void>;
63
63
  private focusOnTrigger;
64
64
  private focusInsideOverlay;
65
+ private focusOnNestedTrigger;
65
66
  handleOutsideOverlayClick: (event: MouseEvent) => void;
66
67
  static get styles(): import("lit-element").CSSResult[];
67
68
  render(): import("lit-element").TemplateResult;
@@ -36,7 +36,7 @@ export declare namespace TimePicker {
36
36
  handleTimeBlur(event: CustomEvent, unit: TimePicker.TimeUnit): void;
37
37
  static get styles(): import("lit-element").CSSResult[];
38
38
  formatTimeUnit: (unit: TimePicker.TimeUnit) => void;
39
- messageType: (isValid: boolean) => "error" | "";
39
+ messageType: (isValid: boolean) => "" | "error";
40
40
  generateTimeBox: (unit: TimePicker.TimeUnit) => import("lit-element").TemplateResult;
41
41
  generateAmPmComboBox: () => import("lit-element").TemplateResult;
42
42
  render(): import("lit-element").TemplateResult;
@@ -8,6 +8,7 @@ export declare abstract class FocusTrapClass extends LitElement {
8
8
  protected initialFocusComplete?: boolean;
9
9
  protected setFocusableElements?(): void;
10
10
  protected setInitialFocus?(prefferableElement?: HTMLElement | number, ignoreAutoFocus?: boolean): void;
11
+ protected setFocusOnTrigger?(triggerEleement?: HTMLElement): void;
11
12
  }
12
13
  export interface FocusTrapInterface {
13
14
  activeFocusTrap: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentum-ui/web-components",
3
- "version": "2.9.10",
3
+ "version": "2.9.11",
4
4
  "author": "Yana Harris",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/momentum-design/momentum-ui.git",