{"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group-token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item-state.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.ts"],"sourcesContent":["import { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { inject, signal, Signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { controlled, createPrimitive, injectInheritedState } from 'ng-primitives/state';\nimport type { NgpRovingFocusItemState } from '../roving-focus-item/roving-focus-item-state';\n\nexport interface NgpRovingFocusGroupState {\n  /**\n   * The orientation of the roving focus group.\n   */\n  readonly orientation: Signal<NgpOrientation>;\n  /**\n   * Whether the roving focus group should wrap around.\n   */\n  readonly wrap: Signal<boolean>;\n  /**\n   * Whether the Home and End keys are enabled.\n   */\n  readonly homeEnd: Signal<boolean>;\n  /**\n   * Whether the roving focus group is disabled.\n   */\n  readonly disabled: Signal<boolean>;\n  /**\n   * The id of the currently active item.\n   */\n  readonly activeItem: Signal<string | null>;\n  /**\n   * Handle keyboard navigation.\n   * @param event The keyboard event\n   */\n  onKeydown(event: KeyboardEvent): void;\n  /**\n   * Set the active item by id.\n   * @param id The id of the item to activate\n   * @param origin The origin of the focus change\n   */\n  setActiveItem(id: string | null, origin?: FocusOrigin): void;\n  /**\n   * Set which item holds the tab stop without moving focus. Used by items that\n   * declare themselves active (e.g. the selected tab) to claim the tab stop\n   * without stealing focus.\n   * @param id The id of the item that should hold the tab stop.\n   */\n  setTabStop(id: string | null): void;\n  /**\n   * Register an item with the roving focus group.\n   * @param item The item to register\n   */\n  register(item: NgpRovingFocusItemState): void;\n  /**\n   * Unregister an item from the roving focus group.\n   * @param item The item to unregister\n   * @internal\n   */\n  unregister(item: NgpRovingFocusItemState): void;\n  /**\n   * Set the orientation of the roving focus group.\n   * @param orientation The orientation value\n   */\n  setOrientation(orientation: NgpOrientation): void;\n  /**\n   * Activate the first item in the roving focus group.\n   * @param origin The origin of the focus change\n   */\n  activateFirst(origin?: FocusOrigin): void;\n  /**\n   * Activate the last item in the roving focus group.\n   * @param origin The origin of the focus change\n   */\n  activateLast(origin?: FocusOrigin): void;\n}\n\nexport interface NgpRovingFocusGroupProps {\n  /**\n   * The orientation of the roving focus group.\n   */\n  readonly orientation?: Signal<NgpOrientation>;\n  /**\n   * Whether the roving focus group should wrap around.\n   */\n  readonly wrap?: Signal<boolean>;\n  /**\n   * Whether the Home and End keys are enabled.\n   */\n  readonly homeEnd?: Signal<boolean>;\n  /**\n   * Whether the roving focus group is disabled.\n   */\n  readonly disabled?: Signal<boolean>;\n  /**\n   * Whether to inherit state from a parent roving focus group.\n   */\n  readonly inherit?: boolean;\n}\n\nexport const [\n  NgpRovingFocusGroupStateToken,\n  ngpRovingFocusGroup,\n  injectRovingFocusGroupState,\n  provideRovingFocusGroupState,\n] = createPrimitive(\n  'NgpRovingFocusGroup',\n  ({\n    orientation: _orientation = signal('vertical'),\n    wrap = signal(false),\n    homeEnd = signal(true),\n    disabled = signal(false),\n    inherit = true,\n  }: NgpRovingFocusGroupProps): NgpRovingFocusGroupState => {\n    const parentGroup = inherit\n      ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()\n      : null;\n\n    if (parentGroup) {\n      return parentGroup;\n    }\n\n    const directionality = inject(Directionality);\n    const items = signal<NgpRovingFocusItemState[]>([]);\n    const orientation = controlled(_orientation);\n\n    /**\n     * Get the items in the roving focus group sorted by order.\n     */\n    function getSortedItems() {\n      return items().sort((a, b) => {\n        // sort the items by their position in the document\n        return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &\n          Node.DOCUMENT_POSITION_FOLLOWING\n          ? -1\n          : 1;\n      });\n    }\n\n    /**\n     * Store the active item in the roving focus group. This is the single source\n     * of truth for the tab stop; items push to it via setActiveItem when they\n     * become active (e.g. the selected tab), and roving navigation updates it too.\n     */\n    const activeItem = signal<string | null>(null);\n\n    /**\n     * Activate an item in the roving focus group.\n     * @param item The item to activate\n     * @param origin The origin of the focus change\n     */\n    function setActiveItem(id: string | null, origin: FocusOrigin = 'program'): void {\n      activeItem.set(id);\n      const item = items().find(i => i.id() === id) ?? null;\n\n      if (item) {\n        item.focus(origin);\n      }\n    }\n\n    // set the tab stop without moving focus (see interface docs)\n    function setTabStop(id: string | null): void {\n      activeItem.set(id);\n    }\n\n    /**\n     * Activate the first item in the roving focus group.\n     * @param origin The origin of the focus change\n     */\n    function activateFirstItem(origin: FocusOrigin): void {\n      // find the first item that is not disabled\n      const item = getSortedItems().find(i => !i.disabled()) ?? null;\n\n      // set the first item as the active item\n      if (item) {\n        setActiveItem(item.id(), origin);\n      }\n    }\n\n    /**\n     * Activate the last item in the roving focus group.\n     * @param origin The origin of the focus change\n     */\n    function activateLastItem(origin: FocusOrigin): void {\n      // find the last item that is not disabled\n      const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;\n\n      // set the last item as the active item\n      if (item) {\n        setActiveItem(item.id(), origin);\n      }\n    }\n\n    /**\n     * Activate the next item in the roving focus group.\n     * @param origin The origin of the focus change\n     */\n    function activateNextItem(origin: FocusOrigin): void {\n      const currentActiveItem = activeItem();\n\n      // if there is no active item, activate the first item\n      if (!currentActiveItem) {\n        activateFirstItem(origin);\n        return;\n      }\n\n      // find the index of the active item\n      const sortedItems = getSortedItems();\n      const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n      // find the next item that is not disabled\n      const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n      // if we are at the end of the list, wrap to the beginning\n      if (!item && wrap()) {\n        activateFirstItem(origin);\n        return;\n      }\n\n      // if there is no next item, do nothing\n      if (!item) {\n        return;\n      }\n\n      // set the next item as the active item\n      setActiveItem(item.id(), origin);\n    }\n\n    /**\n     * Activate the previous item in the roving focus group.\n     * @param origin The origin of the focus change\n     */\n    function activatePreviousItem(origin: FocusOrigin): void {\n      const currentActiveItem = activeItem();\n\n      // if there is no active item, activate the last item\n      if (!currentActiveItem) {\n        activateLastItem(origin);\n        return;\n      }\n\n      // find the index of the active item\n      const sortedItems = getSortedItems();\n      const index = sortedItems.findIndex(i => i.id() === currentActiveItem);\n\n      // find the previous item that is not disabled\n      const item =\n        sortedItems\n          .slice(0, index)\n          .reverse()\n          .find(i => !i.disabled()) ?? null;\n\n      // if we are at the beginning of the list, wrap to the end\n      if (!item && wrap()) {\n        activateLastItem(origin);\n        return;\n      }\n\n      // if there is no previous item, do nothing\n      if (!item) {\n        return;\n      }\n\n      // set the previous item as the active item\n      setActiveItem(item.id(), origin);\n    }\n\n    /**\n     * Handle keyboard navigation for the roving focus group.\n     * @param event The keyboard event\n     */\n    function onKeydown(event: KeyboardEvent): void {\n      if (disabled()) {\n        return;\n      }\n\n      switch (event.key) {\n        case 'ArrowUp':\n          if (orientation() === 'vertical') {\n            event.preventDefault();\n            activatePreviousItem('keyboard');\n          }\n          break;\n        case 'ArrowDown':\n          if (orientation() === 'vertical') {\n            event.preventDefault();\n            activateNextItem('keyboard');\n          }\n          break;\n        case 'ArrowLeft':\n          if (orientation() === 'horizontal') {\n            event.preventDefault();\n\n            if (directionality.value === 'ltr') {\n              activatePreviousItem('keyboard');\n            } else {\n              activateNextItem('keyboard');\n            }\n          }\n          break;\n        case 'ArrowRight':\n          if (orientation() === 'horizontal') {\n            event.preventDefault();\n\n            if (directionality.value === 'ltr') {\n              activateNextItem('keyboard');\n            } else {\n              activatePreviousItem('keyboard');\n            }\n          }\n          break;\n        case 'Home':\n          if (homeEnd()) {\n            event.preventDefault();\n            activateFirstItem('keyboard');\n          }\n          break;\n        case 'End':\n          if (homeEnd()) {\n            event.preventDefault();\n            activateLastItem('keyboard');\n          }\n          break;\n      }\n    }\n\n    function register(item: NgpRovingFocusItemState): void {\n      items.update(items => [...items, item]);\n\n      // seed the first non-disabled item as the tab stop; an active item (e.g. the\n      // selected tab) overrides this by pushing to setActiveItem once it registers.\n      if (item.disabled()) {\n        return;\n      }\n      if (!activeItem()) {\n        activeItem.set(item.id());\n      }\n    }\n\n    /**\n     * Unregister an item with the roving focus group.\n     * @param item The item to unregister\n     * @internal\n     */\n    function unregister(item: NgpRovingFocusItemState): void {\n      items.update(items => items.filter(i => i !== item));\n\n      // check if the unregistered item is the active item\n      if (activeItem() === item.id()) {\n        // if the active item is unregistered, activate the first item\n        activeItem.set(items()[0]?.id() ?? null);\n      }\n    }\n\n    /**\n     * Set the orientation of the roving focus group.\n     * @param value The orientation value\n     */\n    function setOrientation(value: NgpOrientation): void {\n      orientation.set(value);\n    }\n\n    return {\n      orientation: orientation.asReadonly(),\n      wrap,\n      homeEnd,\n      disabled,\n      activeItem,\n      setActiveItem,\n      setTabStop,\n      setOrientation,\n      onKeydown,\n      register,\n      unregister,\n      activateFirst: activateFirstItem,\n      activateLast: activateLastItem,\n    } satisfies NgpRovingFocusGroupState;\n  },\n);\n","import { FactoryProvider, InjectionToken, Type, inject } from '@angular/core';\nimport { NgpRovingFocusGroup } from './roving-focus-group';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n  'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n  return inject(NgpRovingFocusGroupToken);\n}\n\nexport interface NgpRovingFocusGroupOptions {\n  /**\n   * Whether we should inherit the focus group from the parent\n   * @default true\n   */\n  inherit?: boolean;\n}\n\n/**\n * Provide the RovingFocusGroup directive instance\n * @param type The RovingFocusGroup directive type\n * @returns The RovingFocusGroup token\n */\nexport function provideRovingFocusGroup(\n  type: Type<NgpRovingFocusGroup>,\n  { inherit = true }: NgpRovingFocusGroupOptions = {},\n): FactoryProvider {\n  return {\n    provide: NgpRovingFocusGroupToken,\n    // Roving focus groups may be nested, in this case, the parent group should be used\n    useFactory: () => {\n      if (!inherit) {\n        return inject(type, { self: true });\n      }\n\n      // If the parent group is not found, return the current group\n      // This is useful for nested groups\n      return (\n        inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??\n        inject(type, { self: true })\n      );\n    },\n  };\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, signal } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item';\nimport { ngpRovingFocusGroup, provideRovingFocusGroupState } from './roving-focus-group-state';\nimport { provideRovingFocusGroup } from './roving-focus-group-token';\n\n/**\n * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.\n */\n@Directive({\n  selector: '[ngpRovingFocusGroup]',\n  exportAs: 'ngpRovingFocusGroup',\n  providers: [\n    provideRovingFocusGroup(NgpRovingFocusGroup),\n    provideRovingFocusGroupState({ inherit: true }),\n  ],\n})\nexport class NgpRovingFocusGroup {\n  /**\n   * Determine the orientation of the roving focus group.\n   * @default 'vertical'\n   */\n  readonly orientation = input<NgpOrientation>('vertical', {\n    alias: 'ngpRovingFocusGroupOrientation',\n  });\n\n  /**\n   * Determine if focus should wrap when the end or beginning is reached.\n   */\n  readonly wrap = input<boolean, BooleanInput>(true, {\n    alias: 'ngpRovingFocusGroupWrap',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Determine if the home and end keys should navigate to the first and last items.\n   */\n  readonly homeEnd = input<boolean, BooleanInput>(true, {\n    alias: 'ngpRovingFocusGroupHomeEnd',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Determine if the roving focus group is disabled.\n   */\n  readonly disabled = input<boolean, BooleanInput>(false, {\n    alias: 'ngpRovingFocusGroupDisabled',\n    transform: booleanAttribute,\n  });\n\n  /**\n   * Store the active item in the roving focus group.\n   * @internal\n   */\n  readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n  /**\n   * The state of the roving focus group.\n   */\n  readonly state = ngpRovingFocusGroup({\n    orientation: this.orientation,\n    wrap: this.wrap,\n    homeEnd: this.homeEnd,\n    disabled: this.disabled,\n  });\n\n  /**\n   * Activate an item in the roving focus group.\n   * @param item The item to activate\n   * @param origin The origin of the focus change\n   */\n  setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n    if (item) {\n      this.state.setActiveItem(item.id(), origin);\n    }\n  }\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { computed, effect, ElementRef, inject, signal, Signal, untracked } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, listener } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectRovingFocusGroupState } from '../roving-focus-group/roving-focus-group-state';\n\n/**\n * The state interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemState {\n  /**\n   * The unique id of the roving focus item.\n   */\n  readonly id: Signal<string>;\n  /**\n   * Whether the item is disabled.\n   */\n  readonly disabled: Signal<boolean>;\n  /**\n   * The tabindex of the roving focus item.\n   */\n  readonly tabindex: Signal<number>;\n  /**\n   * The element reference of the roving focus item.\n   */\n  readonly element: ElementRef<HTMLElement>;\n  /**\n   * Focus the roving focus item.\n   * @param origin The focus origin\n   */\n  focus(origin: FocusOrigin): void;\n}\n\n/**\n * The props interface for the RovingFocusItem pattern.\n */\nexport interface NgpRovingFocusItemProps {\n  /**\n   * Whether the item is disabled.\n   */\n  readonly disabled: Signal<boolean>;\n}\n\nexport const [\n  NgpRovingFocusItemStateToken,\n  ngpRovingFocusItem,\n  injectRovingFocusItemState,\n  provideRovingFocusItemState,\n] = createPrimitive(\n  'NgpRovingFocusItem',\n  ({ disabled = signal(false) }: NgpRovingFocusItemProps) => {\n    const element = injectElementRef();\n    const group = injectRovingFocusGroupState();\n    const focusMonitor = inject(FocusMonitor);\n\n    // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier\n    const id = uniqueId('ngp-roving-focus-item');\n\n    /**\n     * Derive the tabindex of the roving focus item.\n     */\n    const tabindex = computed(() =>\n      !group()?.disabled() && group()?.activeItem() === id ? 0 : -1,\n    );\n\n    // Setup host attribute bindings\n    attrBinding(element, 'tabindex', () => tabindex().toString());\n\n    // Setup keyboard event listener\n    listener(element, 'keydown', (event: KeyboardEvent) => {\n      if (disabled()) {\n        return;\n      }\n      group()?.onKeydown(event);\n    });\n\n    // Setup click event listener\n    listener(element, 'click', () => {\n      if (disabled()) {\n        return;\n      }\n      group()?.setActiveItem(id, 'mouse');\n    });\n\n    function focus(origin: FocusOrigin): void {\n      focusMonitor.focusVia(element, origin);\n    }\n\n    const state: NgpRovingFocusItemState = {\n      id: signal(id),\n      disabled,\n      tabindex,\n      focus,\n      element,\n    };\n\n    // Projected items may construct before the parent populates the shared group signal,\n    // so register reactively once it becomes available.\n    // See https://github.com/ng-primitives/ng-primitives/issues/735\n    effect(onCleanup => {\n      const groupState = group();\n      if (!groupState) return;\n      untracked(() => groupState.register(state));\n      onCleanup(() => groupState.unregister(state));\n    });\n\n    return state satisfies NgpRovingFocusItemState;\n  },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input } from '@angular/core';\nimport { ngpRovingFocusItem, provideRovingFocusItemState } from './roving-focus-item-state';\n\n/**\n * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.\n */\n@Directive({\n  selector: '[ngpRovingFocusItem]',\n  exportAs: 'ngpRovingFocusItem',\n  providers: [provideRovingFocusItemState()],\n})\nexport class NgpRovingFocusItem {\n  /**\n   * Define if the item is disabled.\n   */\n  readonly disabled = input<boolean, BooleanInput>(false, {\n    alias: 'ngpRovingFocusItemDisabled',\n    transform: booleanAttribute,\n  });\n\n  private readonly state = ngpRovingFocusItem({ disabled: this.disabled });\n\n  /**\n   * Expose the internal id of the roving focus item.\n   * @internal\n   */\n  readonly id = computed(() => this.state.id());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAiGO,MAAM,CACX,6BAA6B,EAC7B,mBAAmB,EACnB,2BAA2B,EAC3B,4BAA4B,EAC7B,GAAG,eAAe,CACjB,qBAAqB,EACrB,CAAC,EACC,WAAW,EAAE,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,EAC9C,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EACpB,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,EACtB,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,EACxB,OAAO,GAAG,IAAI,GACW,KAA8B;IACvD,MAAM,WAAW,GAAG;UAChB,oBAAoB,CAAC,MAAM,6BAA6B,CAAC;UACzD,IAAI;IAER,IAAI,WAAW,EAAE;AACf,QAAA,OAAO,WAAW;IACpB;AAEA,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;AAC7C,IAAA,MAAM,KAAK,GAAG,MAAM,CAA4B,EAAE,4EAAC;AACnD,IAAA,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,CAAC;AAE5C;;AAEG;AACH,IAAA,SAAS,cAAc,GAAA;QACrB,OAAO,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAI;;AAE3B,YAAA,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;AAC7E,gBAAA,IAAI,CAAC;kBACH,CAAC;kBACD,CAAC;AACP,QAAA,CAAC,CAAC;IACJ;AAEA;;;;AAIG;AACH,IAAA,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,iFAAC;AAE9C;;;;AAIG;AACH,IAAA,SAAS,aAAa,CAAC,EAAiB,EAAE,SA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