How to use the @material/menu.DefaultFocusState.FIRST_ITEM function in @material/menu

To help you get started, we’ve selected a few @material/menu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trimox / angular-mdc-web / packages / menu / menu.ts View on Github external
import {cssClasses, strings, DefaultFocusState, MDCMenuFoundation} from '@material/menu';

export class MdcMenuSelectedEvent {
  constructor(
    public index: number,
    public source: MdcListItem) {}
}

let nextUniqueId = 0;

export type MdcMenuFocusState = 'none' | 'list' | 'firstItem' | 'lastItem';

const DEFAULT_FOCUS_STATE_MAP = {
  none: DefaultFocusState.NONE,
  list: DefaultFocusState.LIST_ROOT,
  firstItem: DefaultFocusState.FIRST_ITEM,
  lastItem: DefaultFocusState.LAST_ITEM
};

@Directive({
  selector: '[mdcMenuSelectionGroup], mdc-menu-selection-group',
  host: {'class': 'mdc-menu__selection-group'},
  exportAs: 'mdcMenuSelectionGroup'
})
export class MdcMenuSelectionGroup {
  constructor(public elementRef: ElementRef) {}
}

@Directive({
  selector: '[mdcMenuSelectionGroupIcon], mdc-menu-selection-group-icon',
  host: {'class': 'mdc-menu__selection-group-icon'},
  exportAs: 'mdcMenuSelectionGroupIcon'