@ifsworld/granite-components 2.1.2 → 2.2.0
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/bundles/ifsworld-granite-components.umd.js +1 -1
- package/bundles/ifsworld-granite-components.umd.min.js +1 -1
- package/bundles/ifsworld-granite-components.umd.min.js.map +1 -1
- package/esm2015/lib/menu/menu.component.js +1 -1
- package/esm2015/lib/menu/menu.component.metadata.json +1 -1
- package/fesm2015/ifsworld-granite-components.js +1 -1
- package/ifsworld-granite-components.metadata.json +1 -1
- package/package.json +1 -1
- package/src/lib/core/style/_mixins.scss +5 -17
|
@@ -1502,7 +1502,7 @@
|
|
|
1502
1502
|
providers: [
|
|
1503
1503
|
{ provide: GRANITE_MENU_PANEL, useExisting: GraniteMenuComponent },
|
|
1504
1504
|
],
|
|
1505
|
-
styles: [".granite-menu:not(.granite-device-output-touch){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));min-width:calc(var(--granite-spacing-m) * 7)}.granite-menu:not(.granite-device-output-touch).ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs);max-height:calc(100% - var(--granite-spacing-m) * 7)}.granite-menu.granite-device-output-touch.ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch .header-container{position:-webkit-sticky;position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{position:-webkit-sticky;position:sticky;bottom:0;height:0}.close:not(:empty){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}.close:not(:empty).ng-animating{pointer-events:none}"]
|
|
1505
|
+
styles: [".granite-menu:not(.granite-device-output-touch){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));min-width:calc(var(--granite-spacing-m) * 7);overflow-x:hidden;overflow-y:hidden}.granite-menu:not(.granite-device-output-touch).ng-animating{pointer-events:none}.granite-menu:not(.granite-device-output-touch):hover{overflow-y:auto}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar{width:var(--granite-spacing-xs)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-thumb{background-color:var(--granite-color-border-hard);border-radius:calc(var(--granite-spacing-m) * .125)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-track{background-color:var(--granite-color-background-hover)}.granite-menu.granite-device-output-touch{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs);max-height:calc(100% - var(--granite-spacing-m) * 7)}.granite-menu.granite-device-output-touch.ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch .header-container{position:-webkit-sticky;position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{position:-webkit-sticky;position:sticky;bottom:0;height:0}.close:not(:empty){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}.close:not(:empty).ng-animating{pointer-events:none}"]
|
|
1506
1506
|
},] }
|
|
1507
1507
|
];
|
|
1508
1508
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
var w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function k(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function x(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))}function M(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function C(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function O(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(S(arguments[e]));return t}Object.create;function I(t,e,n){var o;n&&n.style&&null!=e&&n.style.setProperty(t,(o=e)&&(o.startsWith("granite-")||o.startsWith("fnd-"))?"var(--"+e+")":e)}var T=function(){function t(t){this.elementRef=t,this.pill=!1}return t.prototype.ngOnChanges=function(t){t.backgroundColor&&t.backgroundColor.previousValue!==t.backgroundColor.currentValue&&I("background-color",t.backgroundColor.currentValue,this.elementRef.nativeElement),t.color&&t.color.previousValue!==t.color.currentValue&&I("color",t.color.currentValue,this.elementRef.nativeElement)},t}();T.decorators=[{type:e.Component,args:[{selector:"granite-badge",exportAs:"graniteBadge",host:{class:"granite-badge","[class.granite-badge-pill]":"pill"},template:"<ng-content></ng-content>",changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:-moz-inline-flex;display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;align-items:center;background-color:var(--granite-color-signal-neutral);color:var(--granite-color-text-static-light);padding:5px;border-radius:5px;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}:host(.granite-badge-pill){border-radius:25px}"]}]}],T.ctorParameters=function(){return[{type:e.ElementRef}]},T.propDecorators={backgroundColor:[{type:e.Input}],color:[{type:e.Input}],pill:[{type:e.Input}]};var P=function(){};P.decorators=[{type:e.NgModule,args:[{declarations:[T],imports:[n.CommonModule],exports:[T]}]}];var E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.with=function(t){var n=this;void 0===t&&(t={});var o=new a.HarnessPredicate(e,t);return o.addOption("text",t.text,(function(t,e){return a.HarnessPredicate.stringMatches(t.getText(),e)})),o.addOption("pill",t.pill,(function(t,e){return x(n,void 0,void 0,(function(){return M(this,(function(n){switch(n.label){case 0:return[4,t.isPill()];case 1:return[2,n.sent()===e]}}))}))})),o},e.prototype.getText=function(){return x(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().text()]}}))}))},e.prototype.isPill=function(){return x(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("granite-badge-pill")]}}))}))},e}(a.ComponentHarness);E.hostSelector="granite-badge";var D=new e.InjectionToken("GRANITE_MENU_PANEL"),A=function(){function t(t,e,n){this._elementRef=t,this._focusMonitor=e,this._parentMenu=n,this.role="menuitem",this._hovered=new r.Subject,this._focused=new r.Subject,this._triggersSubmenu=!1,this._highlighted=!1,e.monitor(this._elementRef,!1)}return t.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef),this._hovered.complete(),this._focused.complete()},t.prototype.focus=function(t,e){void 0===t&&(t="program"),this._focusMonitor.focusVia(this._getHostElement(),t,e),this._focused.next(this)},t.prototype._getHostElement=function(){return this._elementRef.nativeElement},t}();function R(t,e){return t+"ms "+(void 0!==e?" "+e+"ms ":"")+"cubic-bezier(0, 0, 0.2, 1)"}function B(t,e){return t+"ms "+(void 0!==e?" "+e+"ms ":"")+"linear"}A.decorators=[{type:e.Component,args:[{selector:"[graniteMenuItem]",template:'<ng-content></ng-content>\n <ng-container *ngIf="_triggersSubmenu">\n <granite-icon class="caret-left">caret-left</granite-icon>\n <granite-icon class="caret-right">caret-right</granite-icon>\n </ng-container>',exportAs:"graniteMenuItem",host:{"[attr.role]":"role","[class.granite-menu-item]":"true","[class.granite-menu-item-highlighted]":"_highlighted","[class.granite-menu-item-submenu-trigger]":"_triggersSubmenu","[class.granite-device-output-touch]":'_clientOutput?.device === "touch"',"(mouseenter)":"_hovered.next(this)"},styles:[":host{display:block;position:relative;line-height:var(--granite-spacing-xl);height:var(--granite-spacing-xl);padding:0 var(--granite-spacing-s);width:100%;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start;text-decoration:none;background-color:var(--granite-color-background-variant);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small);font-family:inherit}@media (hover:hover) and (pointer:fine){:host:hover{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}@media (hover:none) and (pointer:coarse){:host:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host.cdk-keyboard-focused,:host.cdk-program-focused,:host.granite-menu-item-highlighted{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}:host granite-icon{position:absolute;font-size:var(--granite-font-size-body-small);color:inherit;top:50%;transform:translateY(-50%)}:host.granite-menu-item-submenu-trigger{-webkit-padding-end:var(--granite-spacing-l);padding-inline-end:var(--granite-spacing-l)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-xs)}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left,[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}:host.granite-divider-top{border-top:var(--granite-border-width-regular) solid var(--granite-color-border-soft)}:host.granite-divider-bottom{border-bottom:var(--granite-border-width-regular) solid var(--granite-color-border-soft)}:host.granite-device-output-touch{height:var(--granite-spacing-xl);line-height:var(--granite-spacing-xl);font-size:var(--granite-font-size-body-small);text-align:center}:host.granite-device-output-touch,:host.granite-device-output-touch.granite-menu-item-back-trigger,:host.granite-device-output-touch.granite-menu-item-submenu-trigger{padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-menu-item-title{line-height:var(--granite-spacing-xl);height:var(--granite-spacing-xl);font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}@media (hover:none) and (pointer:coarse){:host.granite-device-output-touch.granite-menu-item-title:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-xs)}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right,[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}"]}]}],A.ctorParameters=function(){return[{type:e.ElementRef},{type:u.FocusMonitor},{type:void 0,decorators:[{type:e.Inject,args:[D]},{type:e.Optional}]}]},A.propDecorators={role:[{type:e.Input}]};var z=R(120),X={transformMenuDesktop:g.trigger("transformMenuDesktop",[g.state("void",g.style({opacity:0,transform:"scale(0.9)"})),g.transition("void => enter",g.group([g.query(".granite-menu-content",g.animate(B(100),g.style({opacity:1}))),g.animate(z,g.style({transform:"scale(1)"}))])),g.transition("* => void",g.animate(B(100,25),g.style({opacity:0})))])},G=300,L=R(G),j=B(G),F=B(G,200),Y="1ms linear",H=g.style({transform:"translateX(0) translateY(100%)",opacity:0}),N=g.style({opacity:1,transform:"translateX(0) translateY(0)"}),V=g.style({opacity:0,transform:"translateX(100vw) translateY(0)"}),q=g.style({opacity:1,transform:"translateX(-100vw) translateY(0)"}),$=g.style({transform:"translateX({{ xOffset }}px)"}),U=g.style({transform:"translateX(calc(-100vw + {{ xOffset }}px))"}),K=g.style({opacity:0,transform:"translateX(0) translateY(0)"}),W={transformMenuTouch:g.trigger("transformMenuTouch",[g.state("void",V),g.state("enter, enter-from-below",N),g.state("pan-hidden",U,{params:{xOffset:0}}),g.state("pan",$,{params:{xOffset:0}}),g.state("below-with-delay",H),g.state("hide",q),g.transition("pan => enter, pan => enter-from-below, pan => void, enter <=> hide, enter-from-below <=> hide, pan-hidden => hide, pan-hidden => enter",g.animate(L)),g.transition("void => enter-from-below",g.sequence([g.animate(Y,H),g.animate(L,N)])),g.transition("void => enter",g.sequence([g.animate(Y,V),g.animate(L,N)])),g.transition("enter => void",g.animate(L,V)),g.transition("hide => below",g.animate(j,q)),g.transition("hide => below-with-delay",g.sequence([g.animate(Y,q),g.animate(F,q)])),g.transition("enter => below, enter-from-below => below",g.sequence([g.animate(Y,N),g.animate(j,H)])),g.transition("enter => below-with-delay, enter-from-below => below-with-delay",g.sequence([g.animate(Y,N),g.animate(F,H)]))]),transformCloseButton:g.trigger("transformCloseButton",[g.state("void, below, below-with-delay",K),g.state("enter, enter-from-below, pan-hidden, pan, hide",N),g.transition("void => enter-from-below",g.sequence([g.animate(Y,K),g.animate(B(50,150),N)])),g.transition("enter => below, enter-from-below => below",g.sequence([g.animate(Y,N),g.animate(B(25),K)])),g.transition("enter => below-with-delay, enter-from-below => below-with-delay",g.sequence([g.animate(Y,N),g.animate(B(50,200),K)]))])};var Q=0,J={value:"void",params:{xOffset:0}},Z=function(){function t(t){this._changeDetectorRef=t,this.closed=new e.EventEmitter,this.panelId="granite-menu-panel-"+Q++,this.showBackButton=!1,this.showTitle=!1,this.showCloseButton=!1,this._transformMenu=new r.BehaviorSubject(J),this._animationDone=new r.Subject,this._directDescendantItems=new e.QueryList,this._tabSubscription=r.Subscription.EMPTY,this._xPosition="after",this._yPosition="below",this.xOffset=0}return Object.defineProperty(t.prototype,"xPosition",{get:function(){return this._xPosition},set:function(t){"before"!==t&&"after"!==t&&function(){throw Error('xPosition value must be either \'before\' or after\'.\n Example: <granite-menu xPosition="before" #menu="graniteMenu"></granite-menu>')}(),this._xPosition=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yPosition",{get:function(){return this._yPosition},set:function(t){"above"!==t&&"below"!==t&&function(){throw Error('yPosition value must be either \'above\' or below\'.\n Example: <granite-menu yPosition="above" #menu="graniteMenu"></granite-menu>')}(),this._yPosition=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_panelAnimationState",{set:function(t){this._transformMenu.next({value:t,params:{xOffset:this.xOffset}})},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var t=this;this._updateDirectDescendants(),this._keyManager=new u.FocusKeyManager(this._directDescendantItems).withWrap(),this._tabSubscription=this._keyManager.tabOut.subscribe((function(){t.closed.emit("tab")})),this._directDescendantItems.changes.pipe(i.startWith(this._directDescendantItems),i.switchMap((function(t){return r.merge.apply(void 0,O(t.map((function(t){return t._focused}))))}))).subscribe((function(e){return t._keyManager.updateActiveItem(e)}))},t.prototype.ngOnDestroy=function(){this._directDescendantItems.destroy(),this._tabSubscription.unsubscribe(),this.closed.complete()},t.prototype._hovered=function(){var t=this;return this._directDescendantItems.changes.pipe(i.startWith(this._directDescendantItems),i.filter((function(){var e;return"touch"!==(null===(e=t._clientOutput)||void 0===e?void 0:e.device)})),i.switchMap((function(t){return r.merge.apply(void 0,O(t.map((function(t){return t._hovered}))))})))},t.prototype._handleKeydown=function(t){var e=t.key,n=this._keyManager;switch(e){case"Escape":l.hasModifierKey(t)||(t.preventDefault(),this.closed.emit("keydown"));break;case"ArrowLeft":this.parentMenu&&"ltr"===this.direction&&this.closed.emit("keydown");break;case"ArrowRight":this.parentMenu&&"rtl"===this.direction&&this.closed.emit("keydown");break;case"Home":case"End":l.hasModifierKey(t)||("Home"===e?n.setFirstItemActive():n.setLastItemActive(),t.preventDefault());break;default:"ArrowUp"!==e&&"ArrowDown"!==e||n.setFocusOrigin("keyboard"),n.onKeydown(t)}},t.prototype.focusFirstItem=function(t){void 0===t&&(t="program"),this._keyManager.setFocusOrigin(t).setFirstItemActive()},t.prototype._updateShowTitle=function(){this.showTitle=!!this.title||this.showBackButton},t.prototype._startAnimation=function(){this._panelAnimationState="enter"},t.prototype._resetAnimation=function(){this._panelAnimationState="void"},t.prototype._startTouchCloseDownAnimation=function(){this._panelAnimationState="below"},t.prototype._startTouchCloseDownAnimationWithDelay=function(){this._panelAnimationState="below-with-delay"},t.prototype._startTouchCloseSideAnimation=function(){this._resetAnimation()},t.prototype._startTouchRootEnterAnimation=function(){this._panelAnimationState="enter-from-below",this.xOffset=0},t.prototype._startTouchSubmenuEnterAnimation=function(){this._panelAnimationState="enter",this.xOffset=0},t.prototype._startTouchPanAnimation=function(t){this._panelAnimationState="pan",this.xOffset=t},t.prototype._startTouchHidePanAnimation=function(t){this._panelAnimationState="pan-hidden",this.xOffset=t},t.prototype._startTouchHideAnimation=function(){this._panelAnimationState="hide",this.xOffset=0},t.prototype._onAnimationDone=function(t){this._animationDone.next(t),this._isAnimating=!1},t.prototype._onAnimationStart=function(t){this._isAnimating=!0,"enter"!==t.toState&&"enter-from-below"!==t.toState||0!==this._keyManager.activeItemIndex||(t.element.scrollTop=0)},t.prototype._handleClick=function(){this.closed.emit("click")},t.prototype._handleCloseClick=function(){this.closed.emit()},t.prototype._handleBackClick=function(t){this.showBackButton&&this.closed.emit("keydown"),t.stopPropagation()},t.prototype._setDevice=function(t,e){this._clientInput=t,this._clientOutput=e,this._directDescendantItems.forEach((function(n){n._clientInput=t,n._clientOutput=e})),this._changeDetectorRef.markForCheck()},t.prototype.resetActiveItem=function(){this._keyManager.setActiveItem(-1)},t.prototype._updateDirectDescendants=function(){var t=this;this._allItems.changes.pipe(i.startWith(this._allItems)).subscribe((function(e){t._directDescendantItems.reset(e.filter((function(e){return e._parentMenu===t}))),t._directDescendantItems.notifyOnChanges()}))},t}();Z.decorators=[{type:e.Directive}],Z.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},Z.propDecorators={xPosition:[{type:e.Input}],yPosition:[{type:e.Input}],title:[{type:e.Input}],closeLabel:[{type:e.Input}],templateRef:[{type:e.ViewChild,args:[e.TemplateRef]}],_allItems:[{type:e.ContentChildren,args:[A,{descendants:!0}]}],closed:[{type:e.Output}]};var tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e}(Z);tt.decorators=[{type:e.Component,args:[{selector:"granite-menu",template:'\x3c!--\n Using separate template part for desktop and touch output, because of\n animation triggers and slightly different content.\n--\x3e\n<ng-template>\n \x3c!-- Desktop --\x3e\n <ng-container *ngIf="_clientOutput.device === \'desktop\'">\n <div\n #menu\n class="granite-menu"\n tabindex="-1"\n [id]="panelId"\n [@transformMenuDesktop]="_transformMenu | async"\n (@transformMenuDesktop.start)="_onAnimationStart($event)"\n (@transformMenuDesktop.done)="_onAnimationDone($event)"\n (click)="_handleClick()"\n (keydown)="_handleKeydown($event)"\n >\n <div class="granite-menu-content">\n <ng-container [ngTemplateOutlet]="content"></ng-container>\n </div>\n </div>\n </ng-container>\n\n \x3c!-- Touch --\x3e\n <ng-container *ngIf="_clientOutput?.device === \'touch\'">\n <div\n #menu\n class="granite-menu granite-device-output-touch"\n tabindex="-1"\n [id]="panelId"\n [@transformMenuTouch]="_transformMenu | async"\n (@transformMenuTouch.start)="_onAnimationStart($event)"\n (@transformMenuTouch.done)="_onAnimationDone($event)"\n (click)="_handleClick()"\n (keydown)="_handleKeydown($event)"\n >\n <div class="granite-menu-content">\n <div *ngIf="showTitle" class="header-container">\n <button\n [disabled]="!showBackButton"\n graniteMenuTouchTitleItem\n (click)="_handleBackClick($event)"\n >\n {{ title }}\n </button>\n </div>\n\n <ng-container [ngTemplateOutlet]="content"></ng-container>\n\n <div class="footer-container"></div>\n </div>\n </div>\n\n \x3c!-- Close button --\x3e\n <div class="close" [@transformCloseButton]="_transformMenu | async">\n <button\n *ngIf="showCloseButton"\n graniteMenuTouchCloseItem\n (click)="_handleCloseClick()"\n >\n {{ closeLabel }}\n </button>\n </div>\n </ng-container>\n\n \x3c!--\n Content template shared between desktop and touch parts, as <ng-content>\n can\'t be used in two places in the same template\n --\x3e\n <ng-template #content>\n <ng-content></ng-content>\n </ng-template>\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,exportAs:"graniteMenu",animations:[X.transformMenuDesktop,W.transformMenuTouch,W.transformCloseButton],providers:[{provide:D,useExisting:tt}],styles:[".granite-menu:not(.granite-device-output-touch){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));min-width:calc(var(--granite-spacing-m) * 7)}.granite-menu:not(.granite-device-output-touch).ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs);max-height:calc(100% - var(--granite-spacing-m) * 7)}.granite-menu.granite-device-output-touch.ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch .header-container{position:-webkit-sticky;position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{position:-webkit-sticky;position:sticky;bottom:0;height:0}.close:not(:empty){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}.close:not(:empty).ng-animating{pointer-events:none}"]}]}];var et=new e.InjectionToken("GRANITE_CLIENT_INPUT"),nt=new e.InjectionToken("GRANITE_CLIENT_OUTPUT"),ot={input:{devices:["mouse","keyboard"]},output:{device:"desktop"}},rt={input:{devices:["touch","onscreen-keyboard"]},output:{device:"touch"}},it=d.normalizePassiveListenerOptions({passive:!0}),at=function(){function t(t,e,n,o,i,a,s,c,u,l){var g=this;this._overlay=t,this._element=e,this._viewContainerRef=n,this._parentMenu=o,this._clientInput=i,this._clientOutput=a,this._menuItemInstance=s,this._dir=c,this._focusMonitor=u,this._isMenuOpen=!1,this._openedBy=null,this._hoverSubscription=r.Subscription.EMPTY,this._menuCloseSubscription=r.Subscription.EMPTY,this._closingActionsSubscription=r.Subscription.EMPTY,this._portal=null,this._overlayRef=null,this._touchTouchingElement=!1,this._handleTouchStart=function(){g._openedBy="touch"},this._handleOverlayTouchStart=function(t){g.menu._isAnimating||(g._touchStartTime=(new Date).getTime(),g._touchStartX=t.changedTouches[0].clientX,g._touchStartY=t.changedTouches[0].clientY,g._touchCurrentX=g._touchStartX,g._touchCurrentY=g._touchStartY,g._touchTranslateX=0,g._touchMaxX=g._overlayRef.hostElement.getBoundingClientRect().width,g._touchLockedX=null,g._touchTouchingElement=!0)},this._handleOverlayTouchMove=function(t){if(g._touchTouchingElement&&!g.menu._isAnimating&&!g._touchLockedX){if(g._touchCurrentX=t.changedTouches[0].clientX,g._touchCurrentY=t.changedTouches[0].clientY,null===g._touchLockedX){var e=Math.abs(g._touchCurrentY-g._touchStartY),n=Math.abs(g._touchCurrentX-g._touchStartX);if(n>10||e>10)return void(g._touchLockedX=e>n)}g._touchTranslateX=g._touchCurrentX-g._touchStartX,g._touchTranslateX<0?g._touchTranslateX=g.easeOutExpo(g._touchTranslateX,0,-8,-4*g._touchMaxX):g._parentMenu?g._touchTranslateX>g._touchMaxX&&(g._touchTranslateX=g.easeOutExpo(g._touchTranslateX-g._touchMaxX,g._touchMaxX,8,4*g._touchMaxX)):g._touchTranslateX=g.easeOutExpo(g._touchTranslateX,0,8,4*g._touchMaxX),g.animateSetMenuPosition(g._touchTranslateX)}},this._handleOverlayTouchEnd=function(){if(g._touchTouchingElement&&!g.menu._isAnimating&&(g._touchTranslateX=g._touchCurrentX-g._touchStartX,0!==g._touchTranslateX)){g._touchTouchingElement=!1,g._touchTimeTaken=(new Date).getTime()-g._touchStartTime;var t=g._touchTranslateX>g._touchMaxX/2,e=g._touchTranslateX>g._touchMaxX/10&&g._touchTimeTaken>50&&g._touchTimeTaken<300;g._parentMenu&&(e||t)?g.menu.closed.emit("keydown"):g.animateOpenMenu()}},e.nativeElement.addEventListener("touchstart",this._handleTouchStart,it),s&&(s._triggersSubmenu=this.triggersSubmenu()),this._document=l}return t.prototype.ngOnChanges=function(t){t.menu&&this._handleMenuChange()},t.prototype.ngAfterContentInit=function(){this._checkMenu(),this._handleHover()},t.prototype.ngOnDestroy=function(){this._overlayRef&&(this.removeOverlayListeners(),this._overlayRef.dispose(),this._overlayRef=null),this._element.nativeElement.removeEventListener("touchstart",this._handleTouchStart,it),this._hoverSubscription.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe()},t.prototype._handleMenuChange=function(){var t=this;if(this._menuCloseSubscription.unsubscribe(),this.menu){var e=this.menu.closed;this._menuCloseSubscription=e.subscribe((function(e){if(!t.menu._isClosing){if(t.menu._isClosing=!0,"touch"===t._clientOutput.device)(t.menu._isAnimating?t.menu._animationDone:r.of([null])).pipe(i.take(1),i.delay(0,r.asapScheduler)).subscribe((function(){t.animateCloseMenu("keydown"!==e,"click"===e),t.menu._animationDone.pipe(i.take(1),i.delay(0,r.asapScheduler)).subscribe((function(){return t._destroyMenu()}))}));else t._destroyMenu();"click"!==e&&"tab"!==e||!t._parentMenu||t._parentMenu.closed.emit(e)}}))}},t.prototype.openMenu=function(){var t,e=this;if(!this._isMenuOpen){this._checkMenu(),this.menu.parentMenu=this.triggersSubmenu()?this._parentMenu:void 0,this.menu.direction="rtl"===this._dir.value?"rtl":"ltr",this._parentMenu&&(this._clientInput=this._parentMenu._clientInput,this._clientOutput=this._parentMenu._clientOutput),this.menu._setDevice(this._clientInput,this._clientOutput),"touch"===this._clientOutput.device&&(this.menu.showBackButton=!!this._parentMenu,this.menu._updateShowTitle(),this.menu.closeLabel||(this.menu.closeLabel=null===(t=this._parentMenu)||void 0===t?void 0:t.closeLabel),this.menu.showCloseButton=!!this.menu.closeLabel),this.menu._isClosing=!1;var n=[];"touch"===this._clientOutput.device&&n.push("granite-overlay-pane-fill-width-bottom");var o="touch"!==this._clientOutput.device?this._overlay.scrollStrategies.reposition():void 0,r="touch"===this._clientOutput.device&&!this.triggersSubmenu();if(this._overlayRef)"touch"===this._clientOutput.device&&(this.menu._panelAnimationState="void");else{var i=new s.OverlayConfig({positionStrategy:this._positionStrategy(),backdropClass:"granite-overlay-dark-glass-backdrop",scrollStrategy:o,direction:this._dir,panelClass:n,hasBackdrop:r});this._overlayRef=this._overlay.create(i),"touch"===this._clientOutput.device&&this.addOverlayListeners()}this._portal&&this._portal.templateRef===this.menu.templateRef||(this._portal=new c.TemplatePortal(this.menu.templateRef,this._viewContainerRef)),this._overlayRef.attach(this._portal),this._closingActionsSubscription=this._menuClosingActions().subscribe((function(){return e.closeMenu()})),this.animateOpenMenu(),this._setIsMenuOpen(!0),this.menu.focusFirstItem(this._openedBy||"program")}},t.prototype.triggersSubmenu=function(){return!(!this._menuItemInstance||!this._parentMenu)},t.prototype.toggleMenu=function(){this._isMenuOpen?this.closeMenu():this.openMenu()},t.prototype.closeMenu=function(){this.menu.closed.emit()},t.prototype.focus=function(t,e){void 0===t&&(t="program"),this._focusMonitor?this._focusMonitor.focusVia(this._element,t,e):this._element.nativeElement.focus(e)},t.prototype._destroyMenu=function(){this._overlayRef&&this._isMenuOpen&&(this._closingActionsSubscription.unsubscribe(),this._overlayRef.detach(),this._restoreFocus(),this.menu._resetAnimation(),this._setIsMenuOpen(!1))},t.prototype._handleMousedown=function(t){u.isFakeMousedownFromScreenReader(t)||("touch"!==this._openedBy&&(this._openedBy=0===t.button?"mouse":null),this.triggersSubmenu()&&!this._toggleOnSubmenuClick()&&t.preventDefault())},t.prototype._handleKeydown=function(t){var e=t.key;this.triggersSubmenu()&&("ArrowRight"===e&&"ltr"===this._dir.value||"ArrowLeft"===e&&"rtl"===this._dir.value)&&this.openMenu()},t.prototype._handleClick=function(t){this.triggersSubmenu()?(t.stopPropagation(),this._toggleOnSubmenuClick()?this.toggleMenu():this.openMenu()):this.toggleMenu()},t.prototype._handleHover=function(){var t=this;this.triggersSubmenu()&&this._parentMenu&&(this._hoverSubscription=this._parentMenu._hovered().pipe(i.filter((function(){return t._openOnHover()})),i.filter((function(e){return e===t._menuItemInstance})),i.delay(0,r.asapScheduler)).subscribe((function(){t._openedBy="mouse",t.menu instanceof Z&&t.menu._isAnimating?t.menu._animationDone.pipe(i.take(1),i.delay(0,r.asapScheduler),i.takeUntil(t._parentMenu._hovered())).subscribe((function(){return t.openMenu()})):t.openMenu()})))},t.prototype._restoreFocus=function(){this._openedBy?this.triggersSubmenu()||this.focus(this._openedBy):this.focus(),this._openedBy=null},t.prototype._setIsMenuOpen=function(t){this._isMenuOpen=t,this.triggersSubmenu()&&(this._menuItemInstance._highlighted=t&&"touch"!==this._clientOutput.device)},t.prototype._checkMenu=function(){this.menu||
|
|
16
|
+
var w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function k(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function x(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))}function M(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}Object.create;function C(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function O(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(S(arguments[e]));return t}Object.create;function I(t,e,n){var o;n&&n.style&&null!=e&&n.style.setProperty(t,(o=e)&&(o.startsWith("granite-")||o.startsWith("fnd-"))?"var(--"+e+")":e)}var T=function(){function t(t){this.elementRef=t,this.pill=!1}return t.prototype.ngOnChanges=function(t){t.backgroundColor&&t.backgroundColor.previousValue!==t.backgroundColor.currentValue&&I("background-color",t.backgroundColor.currentValue,this.elementRef.nativeElement),t.color&&t.color.previousValue!==t.color.currentValue&&I("color",t.color.currentValue,this.elementRef.nativeElement)},t}();T.decorators=[{type:e.Component,args:[{selector:"granite-badge",exportAs:"graniteBadge",host:{class:"granite-badge","[class.granite-badge-pill]":"pill"},template:"<ng-content></ng-content>",changeDetection:e.ChangeDetectionStrategy.OnPush,styles:[":host{display:-moz-inline-flex;display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;align-items:center;background-color:var(--granite-color-signal-neutral);color:var(--granite-color-text-static-light);padding:5px;border-radius:5px;-webkit-padding-start:10px;padding-inline-start:10px;-webkit-padding-end:10px;padding-inline-end:10px}:host(.granite-badge-pill){border-radius:25px}"]}]}],T.ctorParameters=function(){return[{type:e.ElementRef}]},T.propDecorators={backgroundColor:[{type:e.Input}],color:[{type:e.Input}],pill:[{type:e.Input}]};var P=function(){};P.decorators=[{type:e.NgModule,args:[{declarations:[T],imports:[n.CommonModule],exports:[T]}]}];var E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e.with=function(t){var n=this;void 0===t&&(t={});var o=new a.HarnessPredicate(e,t);return o.addOption("text",t.text,(function(t,e){return a.HarnessPredicate.stringMatches(t.getText(),e)})),o.addOption("pill",t.pill,(function(t,e){return x(n,void 0,void 0,(function(){return M(this,(function(n){switch(n.label){case 0:return[4,t.isPill()];case 1:return[2,n.sent()===e]}}))}))})),o},e.prototype.getText=function(){return x(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().text()]}}))}))},e.prototype.isPill=function(){return x(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("granite-badge-pill")]}}))}))},e}(a.ComponentHarness);E.hostSelector="granite-badge";var D=new e.InjectionToken("GRANITE_MENU_PANEL"),A=function(){function t(t,e,n){this._elementRef=t,this._focusMonitor=e,this._parentMenu=n,this.role="menuitem",this._hovered=new r.Subject,this._focused=new r.Subject,this._triggersSubmenu=!1,this._highlighted=!1,e.monitor(this._elementRef,!1)}return t.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef),this._hovered.complete(),this._focused.complete()},t.prototype.focus=function(t,e){void 0===t&&(t="program"),this._focusMonitor.focusVia(this._getHostElement(),t,e),this._focused.next(this)},t.prototype._getHostElement=function(){return this._elementRef.nativeElement},t}();function R(t,e){return t+"ms "+(void 0!==e?" "+e+"ms ":"")+"cubic-bezier(0, 0, 0.2, 1)"}function B(t,e){return t+"ms "+(void 0!==e?" "+e+"ms ":"")+"linear"}A.decorators=[{type:e.Component,args:[{selector:"[graniteMenuItem]",template:'<ng-content></ng-content>\n <ng-container *ngIf="_triggersSubmenu">\n <granite-icon class="caret-left">caret-left</granite-icon>\n <granite-icon class="caret-right">caret-right</granite-icon>\n </ng-container>',exportAs:"graniteMenuItem",host:{"[attr.role]":"role","[class.granite-menu-item]":"true","[class.granite-menu-item-highlighted]":"_highlighted","[class.granite-menu-item-submenu-trigger]":"_triggersSubmenu","[class.granite-device-output-touch]":'_clientOutput?.device === "touch"',"(mouseenter)":"_hovered.next(this)"},styles:[":host{display:block;position:relative;line-height:var(--granite-spacing-xl);height:var(--granite-spacing-xl);padding:0 var(--granite-spacing-s);width:100%;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start;text-decoration:none;background-color:var(--granite-color-background-variant);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small);font-family:inherit}@media (hover:hover) and (pointer:fine){:host:hover{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}@media (hover:none) and (pointer:coarse){:host:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host.cdk-keyboard-focused,:host.cdk-program-focused,:host.granite-menu-item-highlighted{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}:host granite-icon{position:absolute;font-size:var(--granite-font-size-body-small);color:inherit;top:50%;transform:translateY(-50%)}:host.granite-menu-item-submenu-trigger{-webkit-padding-end:var(--granite-spacing-l);padding-inline-end:var(--granite-spacing-l)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-xs)}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left,[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}:host.granite-divider-top{border-top:var(--granite-border-width-regular) solid var(--granite-color-border-soft)}:host.granite-divider-bottom{border-bottom:var(--granite-border-width-regular) solid var(--granite-color-border-soft)}:host.granite-device-output-touch{height:var(--granite-spacing-xl);line-height:var(--granite-spacing-xl);font-size:var(--granite-font-size-body-small);text-align:center}:host.granite-device-output-touch,:host.granite-device-output-touch.granite-menu-item-back-trigger,:host.granite-device-output-touch.granite-menu-item-submenu-trigger{padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-menu-item-title{line-height:var(--granite-spacing-xl);height:var(--granite-spacing-xl);font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}@media (hover:none) and (pointer:coarse){:host.granite-device-output-touch.granite-menu-item-title:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-xs)}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right,[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}"]}]}],A.ctorParameters=function(){return[{type:e.ElementRef},{type:u.FocusMonitor},{type:void 0,decorators:[{type:e.Inject,args:[D]},{type:e.Optional}]}]},A.propDecorators={role:[{type:e.Input}]};var z=R(120),X={transformMenuDesktop:g.trigger("transformMenuDesktop",[g.state("void",g.style({opacity:0,transform:"scale(0.9)"})),g.transition("void => enter",g.group([g.query(".granite-menu-content",g.animate(B(100),g.style({opacity:1}))),g.animate(z,g.style({transform:"scale(1)"}))])),g.transition("* => void",g.animate(B(100,25),g.style({opacity:0})))])},G=300,L=R(G),j=B(G),F=B(G,200),Y="1ms linear",H=g.style({transform:"translateX(0) translateY(100%)",opacity:0}),N=g.style({opacity:1,transform:"translateX(0) translateY(0)"}),V=g.style({opacity:0,transform:"translateX(100vw) translateY(0)"}),q=g.style({opacity:1,transform:"translateX(-100vw) translateY(0)"}),$=g.style({transform:"translateX({{ xOffset }}px)"}),U=g.style({transform:"translateX(calc(-100vw + {{ xOffset }}px))"}),K=g.style({opacity:0,transform:"translateX(0) translateY(0)"}),W={transformMenuTouch:g.trigger("transformMenuTouch",[g.state("void",V),g.state("enter, enter-from-below",N),g.state("pan-hidden",U,{params:{xOffset:0}}),g.state("pan",$,{params:{xOffset:0}}),g.state("below-with-delay",H),g.state("hide",q),g.transition("pan => enter, pan => enter-from-below, pan => void, enter <=> hide, enter-from-below <=> hide, pan-hidden => hide, pan-hidden => enter",g.animate(L)),g.transition("void => enter-from-below",g.sequence([g.animate(Y,H),g.animate(L,N)])),g.transition("void => enter",g.sequence([g.animate(Y,V),g.animate(L,N)])),g.transition("enter => void",g.animate(L,V)),g.transition("hide => below",g.animate(j,q)),g.transition("hide => below-with-delay",g.sequence([g.animate(Y,q),g.animate(F,q)])),g.transition("enter => below, enter-from-below => below",g.sequence([g.animate(Y,N),g.animate(j,H)])),g.transition("enter => below-with-delay, enter-from-below => below-with-delay",g.sequence([g.animate(Y,N),g.animate(F,H)]))]),transformCloseButton:g.trigger("transformCloseButton",[g.state("void, below, below-with-delay",K),g.state("enter, enter-from-below, pan-hidden, pan, hide",N),g.transition("void => enter-from-below",g.sequence([g.animate(Y,K),g.animate(B(50,150),N)])),g.transition("enter => below, enter-from-below => below",g.sequence([g.animate(Y,N),g.animate(B(25),K)])),g.transition("enter => below-with-delay, enter-from-below => below-with-delay",g.sequence([g.animate(Y,N),g.animate(B(50,200),K)]))])};var Q=0,J={value:"void",params:{xOffset:0}},Z=function(){function t(t){this._changeDetectorRef=t,this.closed=new e.EventEmitter,this.panelId="granite-menu-panel-"+Q++,this.showBackButton=!1,this.showTitle=!1,this.showCloseButton=!1,this._transformMenu=new r.BehaviorSubject(J),this._animationDone=new r.Subject,this._directDescendantItems=new e.QueryList,this._tabSubscription=r.Subscription.EMPTY,this._xPosition="after",this._yPosition="below",this.xOffset=0}return Object.defineProperty(t.prototype,"xPosition",{get:function(){return this._xPosition},set:function(t){"before"!==t&&"after"!==t&&function(){throw Error('xPosition value must be either \'before\' or after\'.\n Example: <granite-menu xPosition="before" #menu="graniteMenu"></granite-menu>')}(),this._xPosition=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yPosition",{get:function(){return this._yPosition},set:function(t){"above"!==t&&"below"!==t&&function(){throw Error('yPosition value must be either \'above\' or below\'.\n Example: <granite-menu yPosition="above" #menu="graniteMenu"></granite-menu>')}(),this._yPosition=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_panelAnimationState",{set:function(t){this._transformMenu.next({value:t,params:{xOffset:this.xOffset}})},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var t=this;this._updateDirectDescendants(),this._keyManager=new u.FocusKeyManager(this._directDescendantItems).withWrap(),this._tabSubscription=this._keyManager.tabOut.subscribe((function(){t.closed.emit("tab")})),this._directDescendantItems.changes.pipe(i.startWith(this._directDescendantItems),i.switchMap((function(t){return r.merge.apply(void 0,O(t.map((function(t){return t._focused}))))}))).subscribe((function(e){return t._keyManager.updateActiveItem(e)}))},t.prototype.ngOnDestroy=function(){this._directDescendantItems.destroy(),this._tabSubscription.unsubscribe(),this.closed.complete()},t.prototype._hovered=function(){var t=this;return this._directDescendantItems.changes.pipe(i.startWith(this._directDescendantItems),i.filter((function(){var e;return"touch"!==(null===(e=t._clientOutput)||void 0===e?void 0:e.device)})),i.switchMap((function(t){return r.merge.apply(void 0,O(t.map((function(t){return t._hovered}))))})))},t.prototype._handleKeydown=function(t){var e=t.key,n=this._keyManager;switch(e){case"Escape":l.hasModifierKey(t)||(t.preventDefault(),this.closed.emit("keydown"));break;case"ArrowLeft":this.parentMenu&&"ltr"===this.direction&&this.closed.emit("keydown");break;case"ArrowRight":this.parentMenu&&"rtl"===this.direction&&this.closed.emit("keydown");break;case"Home":case"End":l.hasModifierKey(t)||("Home"===e?n.setFirstItemActive():n.setLastItemActive(),t.preventDefault());break;default:"ArrowUp"!==e&&"ArrowDown"!==e||n.setFocusOrigin("keyboard"),n.onKeydown(t)}},t.prototype.focusFirstItem=function(t){void 0===t&&(t="program"),this._keyManager.setFocusOrigin(t).setFirstItemActive()},t.prototype._updateShowTitle=function(){this.showTitle=!!this.title||this.showBackButton},t.prototype._startAnimation=function(){this._panelAnimationState="enter"},t.prototype._resetAnimation=function(){this._panelAnimationState="void"},t.prototype._startTouchCloseDownAnimation=function(){this._panelAnimationState="below"},t.prototype._startTouchCloseDownAnimationWithDelay=function(){this._panelAnimationState="below-with-delay"},t.prototype._startTouchCloseSideAnimation=function(){this._resetAnimation()},t.prototype._startTouchRootEnterAnimation=function(){this._panelAnimationState="enter-from-below",this.xOffset=0},t.prototype._startTouchSubmenuEnterAnimation=function(){this._panelAnimationState="enter",this.xOffset=0},t.prototype._startTouchPanAnimation=function(t){this._panelAnimationState="pan",this.xOffset=t},t.prototype._startTouchHidePanAnimation=function(t){this._panelAnimationState="pan-hidden",this.xOffset=t},t.prototype._startTouchHideAnimation=function(){this._panelAnimationState="hide",this.xOffset=0},t.prototype._onAnimationDone=function(t){this._animationDone.next(t),this._isAnimating=!1},t.prototype._onAnimationStart=function(t){this._isAnimating=!0,"enter"!==t.toState&&"enter-from-below"!==t.toState||0!==this._keyManager.activeItemIndex||(t.element.scrollTop=0)},t.prototype._handleClick=function(){this.closed.emit("click")},t.prototype._handleCloseClick=function(){this.closed.emit()},t.prototype._handleBackClick=function(t){this.showBackButton&&this.closed.emit("keydown"),t.stopPropagation()},t.prototype._setDevice=function(t,e){this._clientInput=t,this._clientOutput=e,this._directDescendantItems.forEach((function(n){n._clientInput=t,n._clientOutput=e})),this._changeDetectorRef.markForCheck()},t.prototype.resetActiveItem=function(){this._keyManager.setActiveItem(-1)},t.prototype._updateDirectDescendants=function(){var t=this;this._allItems.changes.pipe(i.startWith(this._allItems)).subscribe((function(e){t._directDescendantItems.reset(e.filter((function(e){return e._parentMenu===t}))),t._directDescendantItems.notifyOnChanges()}))},t}();Z.decorators=[{type:e.Directive}],Z.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},Z.propDecorators={xPosition:[{type:e.Input}],yPosition:[{type:e.Input}],title:[{type:e.Input}],closeLabel:[{type:e.Input}],templateRef:[{type:e.ViewChild,args:[e.TemplateRef]}],_allItems:[{type:e.ContentChildren,args:[A,{descendants:!0}]}],closed:[{type:e.Output}]};var tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return k(e,t),e}(Z);tt.decorators=[{type:e.Component,args:[{selector:"granite-menu",template:'\x3c!--\n Using separate template part for desktop and touch output, because of\n animation triggers and slightly different content.\n--\x3e\n<ng-template>\n \x3c!-- Desktop --\x3e\n <ng-container *ngIf="_clientOutput.device === \'desktop\'">\n <div\n #menu\n class="granite-menu"\n tabindex="-1"\n [id]="panelId"\n [@transformMenuDesktop]="_transformMenu | async"\n (@transformMenuDesktop.start)="_onAnimationStart($event)"\n (@transformMenuDesktop.done)="_onAnimationDone($event)"\n (click)="_handleClick()"\n (keydown)="_handleKeydown($event)"\n >\n <div class="granite-menu-content">\n <ng-container [ngTemplateOutlet]="content"></ng-container>\n </div>\n </div>\n </ng-container>\n\n \x3c!-- Touch --\x3e\n <ng-container *ngIf="_clientOutput?.device === \'touch\'">\n <div\n #menu\n class="granite-menu granite-device-output-touch"\n tabindex="-1"\n [id]="panelId"\n [@transformMenuTouch]="_transformMenu | async"\n (@transformMenuTouch.start)="_onAnimationStart($event)"\n (@transformMenuTouch.done)="_onAnimationDone($event)"\n (click)="_handleClick()"\n (keydown)="_handleKeydown($event)"\n >\n <div class="granite-menu-content">\n <div *ngIf="showTitle" class="header-container">\n <button\n [disabled]="!showBackButton"\n graniteMenuTouchTitleItem\n (click)="_handleBackClick($event)"\n >\n {{ title }}\n </button>\n </div>\n\n <ng-container [ngTemplateOutlet]="content"></ng-container>\n\n <div class="footer-container"></div>\n </div>\n </div>\n\n \x3c!-- Close button --\x3e\n <div class="close" [@transformCloseButton]="_transformMenu | async">\n <button\n *ngIf="showCloseButton"\n graniteMenuTouchCloseItem\n (click)="_handleCloseClick()"\n >\n {{ closeLabel }}\n </button>\n </div>\n </ng-container>\n\n \x3c!--\n Content template shared between desktop and touch parts, as <ng-content>\n can\'t be used in two places in the same template\n --\x3e\n <ng-template #content>\n <ng-content></ng-content>\n </ng-template>\n</ng-template>\n',changeDetection:e.ChangeDetectionStrategy.OnPush,exportAs:"graniteMenu",animations:[X.transformMenuDesktop,W.transformMenuTouch,W.transformCloseButton],providers:[{provide:D,useExisting:tt}],styles:[".granite-menu:not(.granite-device-output-touch){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));min-width:calc(var(--granite-spacing-m) * 7);overflow-x:hidden;overflow-y:hidden}.granite-menu:not(.granite-device-output-touch).ng-animating{pointer-events:none}.granite-menu:not(.granite-device-output-touch):hover{overflow-y:auto}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar{width:var(--granite-spacing-xs)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-thumb{background-color:var(--granite-color-border-hard);border-radius:calc(var(--granite-spacing-m) * .125)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-track{background-color:var(--granite-color-background-hover)}.granite-menu.granite-device-output-touch{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs);max-height:calc(100% - var(--granite-spacing-m) * 7)}.granite-menu.granite-device-output-touch.ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch .header-container{position:-webkit-sticky;position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{position:-webkit-sticky;position:sticky;bottom:0;height:0}.close:not(:empty){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;min-height:var(--granite-spacing-xl);max-height:calc(100vh - var(--granite-spacing-xl));outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;filter:drop-shadow(0 16px 16px rgba(0,0,0,.08)) drop-shadow(0 4px 20px rgba(0,0,0,.1));border-radius:calc(var(--granite-radius-m) / 2);-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}.close:not(:empty).ng-animating{pointer-events:none}"]}]}];var et=new e.InjectionToken("GRANITE_CLIENT_INPUT"),nt=new e.InjectionToken("GRANITE_CLIENT_OUTPUT"),ot={input:{devices:["mouse","keyboard"]},output:{device:"desktop"}},rt={input:{devices:["touch","onscreen-keyboard"]},output:{device:"touch"}},it=d.normalizePassiveListenerOptions({passive:!0}),at=function(){function t(t,e,n,o,i,a,s,c,u,l){var g=this;this._overlay=t,this._element=e,this._viewContainerRef=n,this._parentMenu=o,this._clientInput=i,this._clientOutput=a,this._menuItemInstance=s,this._dir=c,this._focusMonitor=u,this._isMenuOpen=!1,this._openedBy=null,this._hoverSubscription=r.Subscription.EMPTY,this._menuCloseSubscription=r.Subscription.EMPTY,this._closingActionsSubscription=r.Subscription.EMPTY,this._portal=null,this._overlayRef=null,this._touchTouchingElement=!1,this._handleTouchStart=function(){g._openedBy="touch"},this._handleOverlayTouchStart=function(t){g.menu._isAnimating||(g._touchStartTime=(new Date).getTime(),g._touchStartX=t.changedTouches[0].clientX,g._touchStartY=t.changedTouches[0].clientY,g._touchCurrentX=g._touchStartX,g._touchCurrentY=g._touchStartY,g._touchTranslateX=0,g._touchMaxX=g._overlayRef.hostElement.getBoundingClientRect().width,g._touchLockedX=null,g._touchTouchingElement=!0)},this._handleOverlayTouchMove=function(t){if(g._touchTouchingElement&&!g.menu._isAnimating&&!g._touchLockedX){if(g._touchCurrentX=t.changedTouches[0].clientX,g._touchCurrentY=t.changedTouches[0].clientY,null===g._touchLockedX){var e=Math.abs(g._touchCurrentY-g._touchStartY),n=Math.abs(g._touchCurrentX-g._touchStartX);if(n>10||e>10)return void(g._touchLockedX=e>n)}g._touchTranslateX=g._touchCurrentX-g._touchStartX,g._touchTranslateX<0?g._touchTranslateX=g.easeOutExpo(g._touchTranslateX,0,-8,-4*g._touchMaxX):g._parentMenu?g._touchTranslateX>g._touchMaxX&&(g._touchTranslateX=g.easeOutExpo(g._touchTranslateX-g._touchMaxX,g._touchMaxX,8,4*g._touchMaxX)):g._touchTranslateX=g.easeOutExpo(g._touchTranslateX,0,8,4*g._touchMaxX),g.animateSetMenuPosition(g._touchTranslateX)}},this._handleOverlayTouchEnd=function(){if(g._touchTouchingElement&&!g.menu._isAnimating&&(g._touchTranslateX=g._touchCurrentX-g._touchStartX,0!==g._touchTranslateX)){g._touchTouchingElement=!1,g._touchTimeTaken=(new Date).getTime()-g._touchStartTime;var t=g._touchTranslateX>g._touchMaxX/2,e=g._touchTranslateX>g._touchMaxX/10&&g._touchTimeTaken>50&&g._touchTimeTaken<300;g._parentMenu&&(e||t)?g.menu.closed.emit("keydown"):g.animateOpenMenu()}},e.nativeElement.addEventListener("touchstart",this._handleTouchStart,it),s&&(s._triggersSubmenu=this.triggersSubmenu()),this._document=l}return t.prototype.ngOnChanges=function(t){t.menu&&this._handleMenuChange()},t.prototype.ngAfterContentInit=function(){this._checkMenu(),this._handleHover()},t.prototype.ngOnDestroy=function(){this._overlayRef&&(this.removeOverlayListeners(),this._overlayRef.dispose(),this._overlayRef=null),this._element.nativeElement.removeEventListener("touchstart",this._handleTouchStart,it),this._hoverSubscription.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe()},t.prototype._handleMenuChange=function(){var t=this;if(this._menuCloseSubscription.unsubscribe(),this.menu){var e=this.menu.closed;this._menuCloseSubscription=e.subscribe((function(e){if(!t.menu._isClosing){if(t.menu._isClosing=!0,"touch"===t._clientOutput.device)(t.menu._isAnimating?t.menu._animationDone:r.of([null])).pipe(i.take(1),i.delay(0,r.asapScheduler)).subscribe((function(){t.animateCloseMenu("keydown"!==e,"click"===e),t.menu._animationDone.pipe(i.take(1),i.delay(0,r.asapScheduler)).subscribe((function(){return t._destroyMenu()}))}));else t._destroyMenu();"click"!==e&&"tab"!==e||!t._parentMenu||t._parentMenu.closed.emit(e)}}))}},t.prototype.openMenu=function(){var t,e=this;if(!this._isMenuOpen){this._checkMenu(),this.menu.parentMenu=this.triggersSubmenu()?this._parentMenu:void 0,this.menu.direction="rtl"===this._dir.value?"rtl":"ltr",this._parentMenu&&(this._clientInput=this._parentMenu._clientInput,this._clientOutput=this._parentMenu._clientOutput),this.menu._setDevice(this._clientInput,this._clientOutput),"touch"===this._clientOutput.device&&(this.menu.showBackButton=!!this._parentMenu,this.menu._updateShowTitle(),this.menu.closeLabel||(this.menu.closeLabel=null===(t=this._parentMenu)||void 0===t?void 0:t.closeLabel),this.menu.showCloseButton=!!this.menu.closeLabel),this.menu._isClosing=!1;var n=[];"touch"===this._clientOutput.device&&n.push("granite-overlay-pane-fill-width-bottom");var o="touch"!==this._clientOutput.device?this._overlay.scrollStrategies.reposition():void 0,r="touch"===this._clientOutput.device&&!this.triggersSubmenu();if(this._overlayRef)"touch"===this._clientOutput.device&&(this.menu._panelAnimationState="void");else{var i=new s.OverlayConfig({positionStrategy:this._positionStrategy(),backdropClass:"granite-overlay-dark-glass-backdrop",scrollStrategy:o,direction:this._dir,panelClass:n,hasBackdrop:r});this._overlayRef=this._overlay.create(i),"touch"===this._clientOutput.device&&this.addOverlayListeners()}this._portal&&this._portal.templateRef===this.menu.templateRef||(this._portal=new c.TemplatePortal(this.menu.templateRef,this._viewContainerRef)),this._overlayRef.attach(this._portal),this._closingActionsSubscription=this._menuClosingActions().subscribe((function(){return e.closeMenu()})),this.animateOpenMenu(),this._setIsMenuOpen(!0),this.menu.focusFirstItem(this._openedBy||"program")}},t.prototype.triggersSubmenu=function(){return!(!this._menuItemInstance||!this._parentMenu)},t.prototype.toggleMenu=function(){this._isMenuOpen?this.closeMenu():this.openMenu()},t.prototype.closeMenu=function(){this.menu.closed.emit()},t.prototype.focus=function(t,e){void 0===t&&(t="program"),this._focusMonitor?this._focusMonitor.focusVia(this._element,t,e):this._element.nativeElement.focus(e)},t.prototype._destroyMenu=function(){this._overlayRef&&this._isMenuOpen&&(this._closingActionsSubscription.unsubscribe(),this._overlayRef.detach(),this._restoreFocus(),this.menu._resetAnimation(),this._setIsMenuOpen(!1))},t.prototype._handleMousedown=function(t){u.isFakeMousedownFromScreenReader(t)||("touch"!==this._openedBy&&(this._openedBy=0===t.button?"mouse":null),this.triggersSubmenu()&&!this._toggleOnSubmenuClick()&&t.preventDefault())},t.prototype._handleKeydown=function(t){var e=t.key;this.triggersSubmenu()&&("ArrowRight"===e&&"ltr"===this._dir.value||"ArrowLeft"===e&&"rtl"===this._dir.value)&&this.openMenu()},t.prototype._handleClick=function(t){this.triggersSubmenu()?(t.stopPropagation(),this._toggleOnSubmenuClick()?this.toggleMenu():this.openMenu()):this.toggleMenu()},t.prototype._handleHover=function(){var t=this;this.triggersSubmenu()&&this._parentMenu&&(this._hoverSubscription=this._parentMenu._hovered().pipe(i.filter((function(){return t._openOnHover()})),i.filter((function(e){return e===t._menuItemInstance})),i.delay(0,r.asapScheduler)).subscribe((function(){t._openedBy="mouse",t.menu instanceof Z&&t.menu._isAnimating?t.menu._animationDone.pipe(i.take(1),i.delay(0,r.asapScheduler),i.takeUntil(t._parentMenu._hovered())).subscribe((function(){return t.openMenu()})):t.openMenu()})))},t.prototype._restoreFocus=function(){this._openedBy?this.triggersSubmenu()||this.focus(this._openedBy):this.focus(),this._openedBy=null},t.prototype._setIsMenuOpen=function(t){this._isMenuOpen=t,this.triggersSubmenu()&&(this._menuItemInstance._highlighted=t&&"touch"!==this._clientOutput.device)},t.prototype._checkMenu=function(){this.menu||
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
19
19
|
* Copyright Google LLC All Rights Reserved.
|