mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
* rebase to master * use bit-menu in product switcher; add focusStrategy to bit-menu * recommit locales after rebase * add light style to iconButton, use in product-switcher * move out of component library * add buttonType input * gate behind sm flag * update aria-label * add role input to bit-menu * style changes * simplify partition logic * split into two components for Storybook * update focus styles; update grid sizing to relative * fix underline on hover * update attribute binding * move to layouts dir * add bitLink; update grid gap * reorder loose components * move orgs mock * move a11y module * fix aria role bug; add aria label to menu * update colors * update ring color * simplify colors * remove duplicate link module
38 lines
927 B
TypeScript
38 lines
927 B
TypeScript
import { FocusKeyManager } from "@angular/cdk/a11y";
|
|
import {
|
|
Component,
|
|
Output,
|
|
TemplateRef,
|
|
ViewChild,
|
|
EventEmitter,
|
|
ContentChildren,
|
|
QueryList,
|
|
AfterContentInit,
|
|
Input,
|
|
} from "@angular/core";
|
|
|
|
import { MenuItemDirective } from "./menu-item.directive";
|
|
|
|
@Component({
|
|
selector: "bit-menu",
|
|
templateUrl: "./menu.component.html",
|
|
exportAs: "menuComponent",
|
|
})
|
|
export class MenuComponent implements AfterContentInit {
|
|
@ViewChild(TemplateRef) templateRef: TemplateRef<any>;
|
|
@Output() closed = new EventEmitter<void>();
|
|
@ContentChildren(MenuItemDirective, { descendants: true })
|
|
menuItems: QueryList<MenuItemDirective>;
|
|
keyManager?: FocusKeyManager<MenuItemDirective>;
|
|
|
|
@Input() ariaRole: "menu" | "dialog" = "menu";
|
|
|
|
@Input() ariaLabel: string;
|
|
|
|
ngAfterContentInit() {
|
|
if (this.ariaRole === "menu") {
|
|
this.keyManager = new FocusKeyManager(this.menuItems).withWrap();
|
|
}
|
|
}
|
|
}
|