@lumx/react 4.2.0 → 4.2.1-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/moving-focus/utils/createGridMap.ts","../../src/utils/moving-focus/utils/tabStopIsEnabled.ts","../../src/utils/moving-focus/constants.ts","../../src/utils/moving-focus/utils/buildLoopAroundObject.ts","../../src/utils/moving-focus/utils/getCell.ts","../../src/utils/moving-focus/utils/getCellCoordinates.ts","../../src/utils/moving-focus/utils/shouldLoopListVertically.ts","../../src/utils/moving-focus/utils/shouldLoopListHorizontally.ts","../../src/utils/moving-focus/utils/getPointerTypeFromEvent.ts","../../src/utils/moving-focus/ducks/keyboard-navigation.ts","../../src/utils/moving-focus/ducks/tab-stop.ts","../../src/utils/moving-focus/ducks/slice.ts","../../src/utils/moving-focus/components/MovingFocusProvider/context.ts","../../src/utils/moving-focus/components/MovingFocusProvider/index.tsx","../../src/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocus.ts","../../src/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocusParent.ts","../../src/utils/moving-focus/hooks/useRovingTabIndex/useRovingTabIndex.ts"],"sourcesContent":["import groupBy from 'lodash/groupBy';\nimport isNil from 'lodash/isNil';\n\nimport { GridMap, TabStop, TabStopRowKey } from '../types';\n\n/**\n * Create a map from the given tab stop to sort them by rowKey;\n */\nexport function createGridMap(tabStops: readonly TabStop[]): GridMap {\n /** Group all tabStop by rows to easily access them by their row keys */\n const tabStopsByRowKey = groupBy(tabStops, 'rowKey');\n /**\n * An array with each row key in the order set in the tabStops array.\n * Each rowKey will only appear once.\n */\n const rowKeys = tabStops.reduce<TabStopRowKey[]>((acc, { rowKey }) => {\n if (!isNil(rowKey) && !acc.includes(rowKey)) {\n return [...acc, rowKey];\n }\n return acc;\n }, []);\n\n return {\n tabStopsByRowKey,\n rowKeys,\n };\n}\n","import { TabStop } from '../types';\n\n/** Check if the given tab stop is enabled */\nexport const tabStopIsEnabled = (tabStop: TabStop) => !tabStop.disabled;\n","export const LOOP_AROUND_TYPES = {\n /**\n * Will continue navigation to the next row or column and loop back to the start\n * when the last tab stop is reached\n */\n nextLoop: 'next-loop',\n /**\n * Will continue navigation to the next row or column until\n * the last tab stop is reached\n */\n nextEnd: 'next-end',\n /**\n * Will loop within the current row or column\n */\n inside: 'inside',\n} as const;\n\nexport const CELL_SEARCH_DIRECTION = {\n /** Look ahead of the given position */\n asc: 'asc',\n /** Look before the given position */\n desc: 'desc',\n} as const;\n","import { LOOP_AROUND_TYPES } from '../constants';\nimport { LoopAround, LoopAroundByAxis } from '../types';\n\n/**\n * Build a loopAround configuration to ensure both row and col behavior are set.\n *\n * Setting a boolean will set the following behaviors:\n *\n * * true => { row: 'next-loop', col: 'next-loop' }\n * * false => { row: 'next-end', col: 'next-end' }\n */\nexport function buildLoopAroundObject(loopAround?: LoopAround): LoopAroundByAxis {\n if (typeof loopAround === 'boolean' || loopAround === undefined) {\n const newLoopAround: LoopAround = loopAround\n ? { row: LOOP_AROUND_TYPES.nextLoop, col: LOOP_AROUND_TYPES.nextLoop }\n : { row: LOOP_AROUND_TYPES.nextEnd, col: LOOP_AROUND_TYPES.nextEnd };\n\n return newLoopAround;\n }\n return loopAround;\n}\n","import find from 'lodash/find';\nimport findLast from 'lodash/findLast';\n\nimport { CELL_SEARCH_DIRECTION } from '../constants';\nimport { CellSelector, CoordsType, DirectionCoords, GridMap, TabStop } from '../types';\n\nimport { tabStopIsEnabled } from './tabStopIsEnabled';\n\n/**\n * Check that the given coordinate is a simple number\n */\nconst isNumberCoords = (coords: CoordsType): coords is number => typeof coords === 'number';\n\n/**\n * Check that the given coordinate is a direction\n */\nfunction isDirectionCoords(coords: CoordsType): coords is DirectionCoords {\n return Boolean(typeof coords !== 'number' && typeof coords?.from === 'number');\n}\n\n/**\n * Search the given column of a grid map for a cell.\n */\nfunction findCellInCol(\n gridMap: GridMap,\n col: number,\n rowCoords: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n /** The rowIndex might not be strictly successive, so we need to use the actual row index keys. */\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const lastIndex = rowKeys.length - 1;\n /**\n * If the rowCoords.from is set at -1, it means we should search from the start/end.\n */\n let searchIndex = rowCoords.from;\n if (searchIndex === -1) {\n searchIndex = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? lastIndex : 0;\n }\n\n const searchCellFunc = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;\n const rowKeyWithEnabledCell = searchCellFunc(rowKeys, (rowKey, index) => {\n const row = tabStopsByRowKey[rowKey];\n const cell = row[col];\n const hasCell = Boolean(cell);\n const cellRowIndex = index;\n\n /** Check that the target row index is in the right direction of the search */\n const correctRowIndex =\n rowCoords.direction === CELL_SEARCH_DIRECTION.desc\n ? cellRowIndex <= searchIndex\n : cellRowIndex >= searchIndex;\n\n if (cell && correctRowIndex) {\n return cellSelector ? hasCell && cellSelector(cell) : hasCell;\n }\n return false;\n });\n const row = rowKeyWithEnabledCell !== undefined ? tabStopsByRowKey[rowKeyWithEnabledCell] : undefined;\n return row?.[col];\n}\n\n/**\n * Search the given column of a grid map for a cell.\n */\nfunction findCellInRow(\n gridMap: GridMap,\n row: number,\n colCoords: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n const { direction, from } = colCoords || {};\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const rowKey = rowKeys[row];\n const currentRow = tabStopsByRowKey[rowKey];\n if (!currentRow) {\n return undefined;\n }\n\n const searchCellFunc = direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;\n const cell = searchCellFunc(currentRow, cellSelector, from);\n return cell;\n}\n\n/**\n * Parse each column of the given gridMap to find the first cell matching the selector.\n * The direction and starting point of the search can be set using the coordinates attribute.\n */\nfunction parseColsForCell(\n /** The gridMap to search */\n gridMap: GridMap,\n /** The coordinate to search */\n { direction = CELL_SEARCH_DIRECTION.asc, from }: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n if (from === undefined) {\n return undefined;\n }\n\n const { rowKeys, tabStopsByRowKey } = gridMap;\n\n /** As we cannot know for certain when to stop, we need to know which column is the last column */\n const maxColIndex = rowKeys.reduce<number>((maxLength, rowIndex) => {\n const rowLength = tabStopsByRowKey[rowIndex].length;\n return rowLength > maxLength ? rowLength - 1 : maxLength;\n }, 0);\n\n /** If \"from\" is set as -1, start from the end. */\n const fromIndex = from === -1 ? maxColIndex : from || 0;\n\n for (\n let index = fromIndex;\n direction === CELL_SEARCH_DIRECTION.desc ? index > -1 : index <= maxColIndex;\n direction === CELL_SEARCH_DIRECTION.desc ? (index -= 1) : (index += 1)\n ) {\n const rowWithEnabledCed = findCellInCol(\n gridMap,\n index,\n { direction, from: direction === CELL_SEARCH_DIRECTION.desc ? -1 : 0 },\n cellSelector,\n );\n\n if (rowWithEnabledCed) {\n return rowWithEnabledCed;\n }\n }\n\n return undefined;\n}\n\n/**\n * Search for a cell in a gridMap\n *\n * This allows you to\n * * Select a cell at a specific coordinate\n * * Search for a cell from a specific column in any direction\n * * Search for a cell from a specific row in any direction\n *\n * If no cell is found, returns undefined\n */\nexport function getCell(\n /** The gridMap object to search in. */\n gridMap: GridMap,\n /** The coordinates of the cell to select */\n coords: {\n /** The row on or from witch to look for */\n row: CoordsType;\n /** The column on or from witch to look for */\n col: CoordsType;\n },\n /**\n * A selector function to select the cell.\n * Selects enabled cells by default.\n */\n cellSelector: CellSelector = tabStopIsEnabled,\n): TabStop | undefined {\n const { row, col } = coords || {};\n const { rowKeys, tabStopsByRowKey } = gridMap || {};\n\n /** Defined row and col */\n if (isNumberCoords(row) && isNumberCoords(col)) {\n const rowKey = rowKeys[row];\n return tabStopsByRowKey[rowKey][col];\n }\n\n /** Defined row but variable col */\n if (isDirectionCoords(col) && isNumberCoords(row)) {\n return findCellInRow(gridMap, row, col, cellSelector);\n }\n\n if (isDirectionCoords(row)) {\n if (isDirectionCoords(col)) {\n return parseColsForCell(gridMap, col, cellSelector);\n }\n return findCellInCol(gridMap, col, row, cellSelector);\n }\n\n return undefined;\n}\n","import isNil from 'lodash/isNil';\n\nimport { GridMap, TabStop } from '../types';\n\nexport function getCellCoordinates(gridMap: GridMap, tabStop: TabStop) {\n const currentRowKey = tabStop.rowKey;\n if (isNil(currentRowKey)) {\n return undefined;\n }\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const rowIndex = rowKeys.findIndex((rowKey) => rowKey === currentRowKey);\n const row = tabStopsByRowKey[currentRowKey];\n const columnOffset = row.findIndex((ts) => ts.id === tabStop.id);\n\n return {\n rowIndex,\n row,\n columnOffset,\n };\n}\n","import { KeyDirection, LoopAroundByAxis } from '../types';\n\n/** Check whether the list should vertically loop with the given configuration */\nexport function shouldLoopListVertically(direction: KeyDirection, loopAround: Pick<LoopAroundByAxis, 'col'>): boolean {\n return (\n (direction === 'vertical' && loopAround?.col !== 'next-end') ||\n (direction === 'both' && loopAround?.col !== 'next-end')\n );\n}\n","import { KeyDirection, LoopAroundByAxis } from '../types';\n\n/** Check whether the list should horizontally loop with the given configuration */\nexport function shouldLoopListHorizontally(\n direction: KeyDirection,\n loopAround: Pick<LoopAroundByAxis, 'row'>,\n): boolean {\n return (\n (direction === 'horizontal' && loopAround?.row !== 'next-end') ||\n (direction === 'both' && loopAround?.row !== 'next-end')\n );\n}\n","/**\n * Get the correct pointer type from the given event.\n * This is used when a tab stop is selected, to check if is has been selected using a keyboard or a pointer\n * (pen / mouse / touch)\n */\nexport function getPointerTypeFromEvent(event?: PointerEvent | Event) {\n return event && 'pointerType' in event && Boolean(event.pointerType) ? 'pointer' : 'keyboard';\n}\n","import find from 'lodash/find';\nimport findLast from 'lodash/findLast';\nimport findLastIndex from 'lodash/findLastIndex';\nimport isNil from 'lodash/isNil';\n\nimport { LOOP_AROUND_TYPES } from '../constants';\nimport { KeyDirection, KeyNavAction, Navigation, Reducer, State, TabStop } from '../types';\nimport {\n createGridMap,\n getCell,\n getCellCoordinates,\n shouldLoopListHorizontally,\n shouldLoopListVertically,\n tabStopIsEnabled,\n} from '../utils';\n\n// Event keys used for keyboard navigation.\nexport const VERTICAL_NAV_KEYS = ['ArrowUp', 'ArrowDown', 'Home', 'End'] as const;\nexport const HORIZONTAL_NAV_KEYS = ['ArrowLeft', 'ArrowRight', 'Home', 'End'] as const;\nexport const KEY_NAV_KEYS = [...HORIZONTAL_NAV_KEYS, ...VERTICAL_NAV_KEYS] as const;\nexport const NAV_KEYS: { [direction in KeyDirection]: ReadonlyArray<string> } = {\n both: KEY_NAV_KEYS,\n vertical: VERTICAL_NAV_KEYS,\n horizontal: HORIZONTAL_NAV_KEYS,\n};\n\n// Event keys union type\nexport type EventKey = (typeof KEY_NAV_KEYS)[number];\n\n// Handle all navigation moves resulting in a new state.\nconst MOVES: {\n [N in Navigation]: (state: State, currentTabStop: TabStop, index: number) => State;\n} = {\n // Move to the next item.\n // The grid is flatten so the item after the last of a row will be the\n // first item of the next row.\n NEXT(state, _, index) {\n for (let i = index + 1; i < state.tabStops.length; ++i) {\n const tabStop = state.tabStops[i];\n\n if (!tabStop.disabled) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n }\n return state;\n },\n\n // Move to the previous item.\n // The grid is flatten so the item before the first of a row will be the\n // last item of the previous row.\n PREVIOUS(state, _, index) {\n for (let i = index - 1; i >= 0; --i) {\n const tabStop = state.tabStops[i];\n\n if (!tabStop.disabled) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n }\n return state;\n },\n\n // Moving to the next row\n // We move to the next row, and we stay in the same column.\n // If we are in the last row, then we move to the first not disabled item of the next column.\n NEXT_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n const nextRow = rowIndex + 1;\n\n /** First try to get the next cell in the current column */\n let tabStop = getCell(gridMap, {\n row: {\n from: nextRow,\n direction: 'asc',\n },\n col: columnOffset,\n });\n\n // If none were found, search for the next cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.col) {\n /**\n * If columns are configured to be looped inside,\n * get the first enabled cell of the current column\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: 0,\n direction: 'asc',\n },\n });\n break;\n /**\n * If columns are configured to be go to the next,\n * search for the next enabled cell from the next column\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n tabStop = getCell(gridMap, {\n row: {\n from: 0,\n direction: 'asc',\n },\n col: {\n from: columnOffset + 1,\n direction: 'asc',\n },\n });\n break;\n }\n }\n\n /**\n * If still none is found and the columns are configured to loop\n * search starting from the start\n */\n if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = getCell(gridMap, {\n row: {\n from: 0,\n direction: 'asc',\n },\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n }\n\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n gridMap,\n };\n }\n\n return { ...state, allowFocusing: true, gridMap };\n },\n\n // Moving to the previous row\n // We move to the previous row, and we stay in the same column.\n // If we are in the first row, then we move to the last not disabled item of the previous column.\n PREVIOUS_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n const previousRow = rowIndex - 1;\n let tabStop;\n /** Search for the previous enabled cell in the current column */\n if (previousRow >= 0) {\n tabStop = getCell(gridMap, {\n row: {\n from: previousRow,\n direction: 'desc',\n },\n col: columnOffset,\n });\n }\n\n // If none were found, search for the previous cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.col) {\n /**\n * If columns are configured to be looped inside,\n * get the last enabled cell of the current column\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: -1,\n direction: 'desc',\n },\n });\n break;\n /**\n * If columns are configured to be go to the previous,\n * search for the last enabled cell from the previous column\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n if (columnOffset - 1 >= 0) {\n tabStop = getCell(gridMap, {\n row: {\n from: -1,\n direction: 'desc',\n },\n col: {\n from: columnOffset - 1,\n direction: 'desc',\n },\n });\n break;\n }\n }\n }\n /**\n * If still none is found and the columns are configured to loop\n * search starting from the end\n */\n if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = getCell(gridMap, {\n row: {\n from: -1,\n direction: 'desc',\n },\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n }\n\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n gridMap,\n };\n }\n\n return { ...state, allowFocusing: true, gridMap };\n },\n // Moving to the very first not disabled item of the list\n VERY_FIRST(state) {\n // The very first not disabled item' index.\n const tabStop = state.tabStops.find(tabStopIsEnabled);\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n return state;\n },\n // Moving to the very last not disabled item of the list\n VERY_LAST(state) {\n // The very last not disabled item' index.\n const tabStop = findLast(state.tabStops, tabStopIsEnabled);\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n return state;\n },\n NEXT_COLUMN(state, currentTabStop, index) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n // Parse the current row and look for the next enabled cell\n let tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: columnOffset + 1,\n direction: 'asc',\n },\n });\n\n // If none were found, search for the next cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.row) {\n /**\n * If rows are configured to be looped inside,\n * get the first enabled cell of the current rows\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n break;\n /**\n * If rows are configured to be go to the next,\n * search for the next enabled cell from the next row\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n tabStop = find(state.tabStops, tabStopIsEnabled, index + 1);\n break;\n }\n }\n /**\n * If still none is found and the row are configured to loop\n * search starting from the start\n */\n if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = find(state.tabStops, tabStopIsEnabled);\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n PREVIOUS_COLUMN(state, currentTabStop, index) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n\n const previousColumn = columnOffset - 1;\n let tabStop;\n\n if (previousColumn >= 0) {\n // Parse the current row and look for the next enable cell\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: previousColumn,\n direction: 'desc',\n },\n });\n }\n if (!tabStop) {\n switch (state.loopAround.row) {\n /**\n * If rows are configured to be looped inside,\n * get the last enabled cell of the current row\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n break;\n /**\n * If rows are configured to be go to the next,\n * search for the previous enabled cell from the previous row\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n if (index - 1 >= 0) {\n tabStop = findLast(state.tabStops, tabStopIsEnabled, index - 1);\n }\n break;\n }\n }\n /**\n * If still none is found and the rows are configured to loop\n * search starting from the end\n */\n if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = findLast(state.tabStops, tabStopIsEnabled);\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n FIRST_IN_COLUMN(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { columnOffset } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: 0,\n direction: 'asc',\n },\n });\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n LAST_IN_COLUMN(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { columnOffset } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: -1,\n direction: 'desc',\n },\n });\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n // Moving to the first item in row\n FIRST_IN_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n // Moving to the last item in row\n LAST_IN_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n};\n\n/** Handle `KEY_NAV` action to update */\nexport const KEY_NAV: Reducer<KeyNavAction> = (state, action) => {\n const { id = state.selectedId || state.tabStops[0]?.id, key, ctrlKey } = action.payload;\n const index = state.tabStops.findIndex((tabStop) => tabStop.id === id);\n if (index === -1) {\n // tab stop not registered\n return state;\n }\n const currentTabStop = state.tabStops[index];\n if (currentTabStop.disabled) {\n return state;\n }\n\n const isGrid = currentTabStop.rowKey !== null;\n const isFirst = index === state.tabStops.findIndex(tabStopIsEnabled);\n const isLast = index === findLastIndex(state.tabStops, tabStopIsEnabled);\n // Translates the user key down event info into a navigation instruction.\n let navigation: Navigation | null = null;\n // eslint-disable-next-line default-case\n switch (key) {\n case 'ArrowLeft':\n if (isGrid) {\n navigation = 'PREVIOUS_COLUMN';\n } else if (state.direction === 'horizontal' || state.direction === 'both') {\n navigation =\n shouldLoopListHorizontally(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';\n }\n break;\n case 'ArrowRight':\n if (isGrid) {\n navigation = 'NEXT_COLUMN';\n } else if (state.direction === 'horizontal' || state.direction === 'both') {\n navigation =\n shouldLoopListHorizontally(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';\n }\n break;\n case 'ArrowUp':\n if (isGrid) {\n navigation = 'PREVIOUS_ROW';\n } else if (state.direction === 'vertical' || state.direction === 'both') {\n navigation =\n shouldLoopListVertically(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';\n }\n break;\n case 'ArrowDown':\n if (isGrid) {\n navigation = 'NEXT_ROW';\n } else if (state.direction === 'vertical' || state.direction === 'both') {\n navigation =\n shouldLoopListVertically(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';\n }\n break;\n case 'Home':\n if (isGrid && !ctrlKey) {\n navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'FIRST_IN_COLUMN' : 'FIRST_IN_ROW';\n } else {\n navigation = 'VERY_FIRST';\n }\n break;\n case 'End':\n if (isGrid && !ctrlKey) {\n navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'LAST_IN_COLUMN' : 'LAST_IN_ROW';\n } else {\n navigation = 'VERY_LAST';\n }\n break;\n }\n\n if (!navigation) {\n return state;\n }\n\n const newState = MOVES[navigation](state, currentTabStop, index);\n\n return { ...newState, isUsingKeyboard: true };\n};\n","import findLast from 'lodash/findLast';\nimport findLastIndex from 'lodash/findLastIndex';\n\nimport {\n Reducer,\n RegisterAction,\n ResetSelectedTabStopAction,\n SelectTabStopAction,\n SetAllowFocusingAction,\n State,\n UnregisterAction,\n UpdateTabStopAction,\n} from '../types';\nimport { tabStopIsEnabled } from '../utils';\n\n/** Determine the updated value for selectedId: */\nexport const getUpdatedSelectedId = (\n tabStops: State['tabStops'],\n currentSelectedId: State['selectedId'],\n defaultSelectedId: State['selectedId'] = null,\n): State['selectedId'] => {\n // Get tab stop by id\n const tabStop = currentSelectedId && tabStops.find((ts) => ts.id === currentSelectedId && !ts.disabled);\n if (!tabStop) {\n // Fallback to default selected id if available, or first enabled tab stop if not\n return tabStops.find((ts) => ts.id === defaultSelectedId)?.id || tabStops.find(tabStopIsEnabled)?.id || null;\n }\n return tabStop?.id || defaultSelectedId;\n};\n\n/** Handle `REGISTER_TAB_STOP` action registering a new tab stop. */\nexport const REGISTER_TAB_STOP: Reducer<RegisterAction> = (state, action) => {\n const newTabStop = action.payload;\n const newTabStopElement = newTabStop.domElementRef.current;\n\n if (!newTabStopElement) {\n return state;\n }\n\n // Find index of tab stop that\n const indexToInsertAt = findLastIndex(state.tabStops, (tabStop) => {\n if (tabStop.id === newTabStop.id) {\n // tab stop already registered\n return false;\n }\n const domTabStop = tabStop.domElementRef.current;\n\n // New tab stop is following the current tab stop\n return domTabStop?.compareDocumentPosition(newTabStopElement) === Node.DOCUMENT_POSITION_FOLLOWING;\n });\n const insertIndex = indexToInsertAt + 1;\n\n // Insert new tab stop at position `indexToInsertAt`.\n const newTabStops = [...state.tabStops];\n newTabStops.splice(insertIndex, 0, newTabStop);\n\n // Handle autofocus if needed\n let { selectedId, allowFocusing } = state;\n if (\n (state.autofocus === 'first' && insertIndex === 0) ||\n (state.autofocus === 'last' && insertIndex === newTabStops.length - 1) ||\n newTabStop.autofocus\n ) {\n allowFocusing = true;\n selectedId = newTabStop.id;\n }\n\n const newSelectedId =\n newTabStop.id === state.defaultSelectedId && !newTabStop.disabled\n ? newTabStop.id\n : getUpdatedSelectedId(newTabStops, selectedId, state.defaultSelectedId);\n\n return {\n ...state,\n /**\n * If the tab currently being registered is enabled and set as default selected,\n * set as selected.\n *\n */\n selectedId: newSelectedId,\n tabStops: newTabStops,\n gridMap: null,\n allowFocusing,\n };\n};\n\n/** Handle `UNREGISTER_TAB_STOP` action un-registering a new tab stop. */\nexport const UNREGISTER_TAB_STOP: Reducer<UnregisterAction> = (state, action) => {\n const { id } = action.payload;\n const newTabStops = state.tabStops.filter((tabStop) => tabStop.id !== id);\n if (newTabStops.length === state.tabStops.length) {\n // tab stop already unregistered\n return state;\n }\n\n /** Get the previous enabled tab stop */\n const previousTabStopIndex = state.tabStops.findIndex(\n (tabStop) => tabStop.id === state.selectedId && tabStopIsEnabled(tabStop),\n );\n\n const newLocal = previousTabStopIndex - 1 > -1;\n const previousTabStop = newLocal ? findLast(newTabStops, tabStopIsEnabled, previousTabStopIndex - 1) : undefined;\n\n return {\n ...state,\n /** Set the focus on either the previous tab stop if found or the one set as default */\n selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, previousTabStop?.id || state.defaultSelectedId),\n tabStops: newTabStops,\n gridMap: null,\n };\n};\n\n/** Handle `UPDATE_TAB_STOP` action updating properties of a tab stop. */\nexport const UPDATE_TAB_STOP: Reducer<UpdateTabStopAction> = (state, action) => {\n const { id, rowKey, disabled } = action.payload;\n const index = state.tabStops.findIndex((tabStop) => tabStop.id === id);\n if (index === -1) {\n // tab stop not registered\n return state;\n }\n\n const tabStop = state.tabStops[index];\n if (tabStop.disabled === disabled && tabStop.rowKey === rowKey) {\n // Nothing to do so short-circuit.\n return state;\n }\n\n const newTabStop = { ...tabStop, rowKey, disabled };\n const newTabStops = [...state.tabStops];\n newTabStops.splice(index, 1, newTabStop);\n\n return {\n ...state,\n selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, state.defaultSelectedId),\n tabStops: newTabStops,\n gridMap: null,\n };\n};\n\n/** Handle `SELECT_TAB_STOP` action selecting a tab stop. */\nexport const SELECT_TAB_STOP: Reducer<SelectTabStopAction> = (state, action) => {\n const { id, type } = action.payload;\n\n const tabStop = state.tabStops.find((ts) => ts.id === id);\n if (!tabStop || tabStop.disabled) {\n return state;\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n isUsingKeyboard: type === 'keyboard',\n };\n};\n\nexport const SET_ALLOW_FOCUSING: Reducer<SetAllowFocusingAction> = (state, action) => {\n return {\n ...state,\n selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n allowFocusing: action.payload.allow,\n isUsingKeyboard: Boolean(action.payload.isKeyboardNavigation),\n };\n};\n\n/** Handle `RESET_SELECTED_TAB_STOP` action reseting the selected tab stop. */\nexport const RESET_SELECTED_TAB_STOP: Reducer<ResetSelectedTabStopAction> = (state) => {\n return {\n ...state,\n allowFocusing: false,\n selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n defaultSelectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n isUsingKeyboard: false,\n };\n};\n","import findLast from 'lodash/findLast';\n\nimport { Action, OptionsUpdatedAction, Reducer, State } from '../types';\nimport { buildLoopAroundObject, tabStopIsEnabled } from '../utils';\nimport { KEY_NAV } from './keyboard-navigation';\nimport {\n REGISTER_TAB_STOP,\n UNREGISTER_TAB_STOP,\n UPDATE_TAB_STOP,\n SELECT_TAB_STOP,\n SET_ALLOW_FOCUSING,\n RESET_SELECTED_TAB_STOP,\n} from './tab-stop';\n\nexport const INITIAL_STATE: State = {\n selectedId: null,\n allowFocusing: false,\n tabStops: [],\n direction: 'horizontal',\n loopAround: buildLoopAroundObject(false),\n gridMap: null,\n defaultSelectedId: null,\n autofocus: undefined,\n isUsingKeyboard: false,\n};\n\nconst OPTIONS_UPDATED: Reducer<OptionsUpdatedAction> = (state, action) => {\n const { autofocus } = action.payload;\n let { selectedId, allowFocusing } = state;\n\n // Update selectedId when updating the `autofocus` option.\n if (!state.autofocus && autofocus) {\n if (autofocus === 'first') {\n selectedId = state.tabStops.find(tabStopIsEnabled)?.id || null;\n } else if (autofocus === 'last') {\n selectedId = findLast(state.tabStops, tabStopIsEnabled)?.id || null;\n }\n allowFocusing = true;\n }\n\n return {\n ...state,\n ...action.payload,\n selectedId,\n allowFocusing: action.payload.allowFocusing || allowFocusing,\n loopAround: buildLoopAroundObject(action.payload.loopAround),\n };\n};\n\n/** Reducers for each action type: */\nconst REDUCERS: { [Type in Action['type']]: Reducer<Extract<Action, { type: Type }>> } = {\n REGISTER_TAB_STOP,\n UNREGISTER_TAB_STOP,\n UPDATE_TAB_STOP,\n SELECT_TAB_STOP,\n OPTIONS_UPDATED,\n KEY_NAV,\n SET_ALLOW_FOCUSING,\n RESET_SELECTED_TAB_STOP,\n};\n\n/** Main reducer */\nexport const reducer: Reducer<Action> = (state, action) => {\n return REDUCERS[action.type]?.(state, action as any) || state;\n};\n","import React from 'react';\n\nimport noop from 'lodash/noop';\n\nimport { INITIAL_STATE } from '../../ducks/slice';\nimport { Action, State } from '../../types';\n\nexport type MovingFocusContext = Readonly<{\n state: State;\n dispatch: React.Dispatch<Action>;\n}>;\n\nexport const MovingFocusContext = React.createContext<MovingFocusContext>({\n state: INITIAL_STATE,\n dispatch: noop,\n});\n","import React from 'react';\n\nimport { INITIAL_STATE, reducer } from '../../ducks/slice';\nimport { MovingFocusOptions } from '../../types';\nimport { buildLoopAroundObject } from '../../utils';\nimport { MovingFocusContext } from './context';\n\nexport interface MovingFocusProviderProps {\n /**\n * The child content, which will include the DOM elements to rove between using the tab key.\n */\n children: React.ReactNode;\n /**\n * An optional object to customize the behaviour of the moving focus. It is fine to pass a new object every time\n * the containing component is rendered, and the options can be updated at any time.\n */\n options?: Partial<MovingFocusOptions>;\n}\n\n/**\n * Creates a roving tabindex context.\n */\nexport const MovingFocusProvider: React.FC<MovingFocusProviderProps> = ({ children, options }) => {\n const [state, dispatch] = React.useReducer(reducer, INITIAL_STATE, (st) => ({\n ...st,\n ...options,\n direction: options?.direction || st.direction,\n loopAround: buildLoopAroundObject(options?.loopAround),\n selectedId: options?.defaultSelectedId || INITIAL_STATE.selectedId,\n }));\n const isMounted = React.useRef(false);\n\n // Update the options whenever they change:\n React.useEffect(() => {\n // Skip update on mount (already up to date)\n if (!isMounted.current) {\n isMounted.current = true;\n return;\n }\n dispatch({\n type: 'OPTIONS_UPDATED',\n payload: {\n direction: options?.direction || INITIAL_STATE.direction,\n loopAround: buildLoopAroundObject(options?.loopAround || INITIAL_STATE.loopAround),\n defaultSelectedId: options?.defaultSelectedId || INITIAL_STATE.defaultSelectedId,\n autofocus: options?.autofocus || INITIAL_STATE.autofocus,\n allowFocusing: options?.allowFocusing || INITIAL_STATE.allowFocusing,\n listKey: options?.listKey || INITIAL_STATE.listKey,\n firstFocusDirection: options?.firstFocusDirection || INITIAL_STATE.firstFocusDirection,\n gridJumpToShortcutDirection:\n options?.gridJumpToShortcutDirection || INITIAL_STATE.gridJumpToShortcutDirection,\n },\n });\n }, [\n isMounted,\n options?.allowFocusing,\n options?.autofocus,\n options?.defaultSelectedId,\n options?.direction,\n options?.loopAround,\n options?.listKey,\n options?.firstFocusDirection,\n options?.gridJumpToShortcutDirection,\n ]);\n\n // Create a cached object to use as the context value:\n const context = React.useMemo(() => ({ state, dispatch }), [state]);\n\n return <MovingFocusContext.Provider value={context}>{children}</MovingFocusContext.Provider>;\n};\n","import React, { useEffect } from 'react';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { BaseHookOptions } from '../../types';\nimport { getPointerTypeFromEvent } from '../../utils';\n\n/**\n * Hook options\n */\ntype Options = [\n /** The DOM id of the tab stop. */\n id: string,\n ...baseOptions: BaseHookOptions,\n];\n\n/**\n * Hook to use in tab stop element of a virtual focus (ex: options of a listbox in a combobox).\n *\n * @returns true if the current tab stop has virtual focus\n */\nexport const useVirtualFocus: (...args: Options) => boolean = (\n id,\n domElementRef,\n disabled = false,\n rowKey = null,\n autofocus = false,\n) => {\n const isMounted = React.useRef(false);\n const { state, dispatch } = React.useContext(MovingFocusContext);\n\n // Register the tab stop on mount and unregister it on unmount:\n React.useEffect(\n () => {\n const { current: domElement } = domElementRef;\n if (!domElement) {\n return undefined;\n }\n // Select tab stop on click\n const onClick = (event?: PointerEvent | Event) => {\n dispatch({\n type: 'SELECT_TAB_STOP',\n payload: { id, type: getPointerTypeFromEvent(event) },\n });\n };\n domElement.addEventListener('click', onClick);\n\n // Register tab stop in context\n dispatch({ type: 'REGISTER_TAB_STOP', payload: { id, domElementRef, rowKey, disabled, autofocus } });\n\n return () => {\n domElement.removeEventListener('click', onClick);\n dispatch({ type: 'UNREGISTER_TAB_STOP', payload: { id } });\n };\n },\n /**\n * Pass the list key as dependency to make tab stops\n * re-register when it changes.\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state.listKey],\n );\n\n /*\n * Update the tab stop data if `rowKey` or `disabled` change.\n * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the\n * REGISTER_TAB_STOP action would have just been dispatched).\n */\n React.useEffect(\n () => {\n if (isMounted.current) {\n dispatch({ type: 'UPDATE_TAB_STOP', payload: { id, rowKey, disabled } });\n } else {\n isMounted.current = true;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [disabled, rowKey],\n );\n\n const isActive = id === state.selectedId;\n\n // Scroll element into view when highlighted\n useEffect(() => {\n const { current } = domElementRef;\n if (isActive && current && current.scrollIntoView) {\n /**\n * In some cases, the selected item is contained in a popover\n * that won't be immediately set in the correct position.\n * Setting a small timeout before scroll the item into view\n * leaves it time to settle at the correct position.\n */\n const timeout = setTimeout(() => {\n current.scrollIntoView({ block: 'nearest' });\n }, 10);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n\n return undefined;\n }, [domElementRef, isActive]);\n\n const focused = isActive && state.allowFocusing;\n\n // Determine if the current tab stop is the currently active one:\n return focused;\n};\n","import React from 'react';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { NAV_KEYS } from '../../ducks/keyboard-navigation';\n\n/**\n * Hook to use in a virtual focus parent (ex: `aria-activedescendant` on the input of a combobox).\n * * @returns the id of the currently active tab stop (virtual focus)\n */\nexport const useVirtualFocusParent = (ref: React.RefObject<HTMLElement>): string | undefined => {\n const { state, dispatch } = React.useContext(MovingFocusContext);\n\n React.useEffect(() => {\n const { current: element } = ref;\n if (!element) {\n return undefined;\n }\n\n function handleKeyDown(evt: KeyboardEvent) {\n const eventKey = evt.key as any;\n if (\n // Don't move if the current direction doesn't allow key\n !NAV_KEYS[state.direction].includes(eventKey) ||\n // Don't move if alt key is pressed\n evt.altKey ||\n // Don't move the focus if it hasn't been set yet and `firstFocusDirection` doesn't allow key\n (!state.allowFocusing &&\n state.firstFocusDirection &&\n !NAV_KEYS[state.firstFocusDirection].includes(eventKey))\n ) {\n return;\n }\n // If focus isn't allowed yet, simply enable it to stay on first item\n if (!state.allowFocusing && eventKey === 'ArrowDown') {\n dispatch({ type: 'SET_ALLOW_FOCUSING', payload: { allow: true, isKeyboardNavigation: true } });\n } else {\n dispatch({ type: 'KEY_NAV', payload: { key: eventKey, ctrlKey: evt.ctrlKey } });\n }\n\n evt.preventDefault();\n }\n element.addEventListener('keydown', handleKeyDown);\n return () => {\n element.removeEventListener('keydown', handleKeyDown);\n };\n }, [dispatch, ref, state.allowFocusing, state.direction, state.firstFocusDirection]);\n const focused = (state.allowFocusing && state.selectedId) || undefined;\n return focused;\n};\n","import React from 'react';\n\nimport isNil from 'lodash/isNil';\nimport uniqueId from 'lodash/uniqueId';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { NAV_KEYS } from '../../ducks/keyboard-navigation';\nimport { BaseHookOptions } from '../../types';\nimport { getPointerTypeFromEvent } from '../../utils';\n\n/**\n * A tuple of values to be applied by the containing component for the roving tabindex to work correctly.\n */\ntype Output = [\n /** The tabIndex value to apply to the tab stop element. */\n tabIndex: number,\n /** Whether focus() should be invoked on the tab stop element. */\n focused: boolean,\n /**\n * The onKeyDown callback to apply to the tab stop element. If the key press is relevant to the hook then\n * event.preventDefault() will be invoked on the event.\n */\n handleKeyDown: (event: React.KeyboardEvent) => void,\n /** The onClick callback to apply to the tab stop element. */\n handleClick: () => void,\n];\n\n/**\n * Includes the given DOM element in the current roving tabindex.\n */\nexport const useRovingTabIndex: (...args: BaseHookOptions) => Output = (\n ref,\n disabled = false,\n rowKey = null,\n autofocus = false,\n) => {\n // Create a stable ID for the lifetime of the component:\n const idRef = React.useRef<string | null>(null);\n\n function getId() {\n if (!idRef.current) {\n idRef.current = uniqueId('rti_');\n }\n return idRef.current;\n }\n\n const isMounted = React.useRef(false);\n const { dispatch, state } = React.useContext(MovingFocusContext);\n const { direction } = state;\n\n // Register the tab stop on mount and unregister it on unmount:\n React.useEffect(\n () => {\n const id = getId();\n dispatch({ type: 'REGISTER_TAB_STOP', payload: { id, domElementRef: ref, rowKey, disabled, autofocus } });\n return () => {\n dispatch({ type: 'UNREGISTER_TAB_STOP', payload: { id } });\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state.listKey],\n );\n\n /*\n * Update the tab stop data if `rowIndex` or `disabled` change.\n * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the\n * REGISTER_TAB_STOP action would have just been dispatched).\n */\n React.useEffect(\n () => {\n if (isMounted.current) {\n dispatch({ type: 'UPDATE_TAB_STOP', payload: { id: getId(), rowKey, disabled } });\n } else {\n isMounted.current = true;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [rowKey, disabled],\n );\n\n // Create a stable callback function for handling key down events:\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler>(\n (evt) => {\n const trueDirection = !isNil(rowKey) ? 'both' : direction;\n if (!NAV_KEYS[trueDirection].includes(evt.key as any)) {\n return;\n }\n dispatch({ type: 'KEY_NAV', payload: { id: getId(), key: evt.key, ctrlKey: evt.ctrlKey } });\n evt.preventDefault();\n evt.stopPropagation();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Create a stable callback function for handling click events:\n const handleClick = React.useCallback(\n (event?: PointerEvent | Event) => {\n dispatch({\n type: 'SELECT_TAB_STOP',\n payload: {\n id: getId(),\n type: getPointerTypeFromEvent(event),\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Determine if the current tab stop is the currently active one:\n const selected = getId() === state.selectedId;\n\n const tabIndex = selected ? 0 : -1;\n const focused = selected && state.allowFocusing;\n\n return [tabIndex, focused, handleKeyDown, handleClick];\n};\n"],"names":["createGridMap","tabStops","tabStopsByRowKey","groupBy","rowKeys","reduce","acc","rowKey","isNil","includes","tabStopIsEnabled","tabStop","disabled","LOOP_AROUND_TYPES","nextLoop","nextEnd","inside","CELL_SEARCH_DIRECTION","asc","desc","buildLoopAroundObject","loopAround","undefined","newLoopAround","row","col","isNumberCoords","coords","isDirectionCoords","Boolean","from","findCellInCol","gridMap","rowCoords","cellSelector","lastIndex","length","searchIndex","direction","searchCellFunc","findLast","find","rowKeyWithEnabledCell","index","cell","hasCell","cellRowIndex","correctRowIndex","findCellInRow","colCoords","currentRow","parseColsForCell","maxColIndex","maxLength","rowIndex","rowLength","fromIndex","rowWithEnabledCed","getCell","getCellCoordinates","currentRowKey","findIndex","columnOffset","ts","id","shouldLoopListVertically","shouldLoopListHorizontally","getPointerTypeFromEvent","event","pointerType","VERTICAL_NAV_KEYS","HORIZONTAL_NAV_KEYS","KEY_NAV_KEYS","NAV_KEYS","both","vertical","horizontal","MOVES","NEXT","state","_","i","allowFocusing","selectedId","PREVIOUS","NEXT_ROW","currentTabStop","cellCoordinates","nextRow","PREVIOUS_ROW","previousRow","VERY_FIRST","VERY_LAST","NEXT_COLUMN","PREVIOUS_COLUMN","previousColumn","FIRST_IN_COLUMN","LAST_IN_COLUMN","FIRST_IN_ROW","LAST_IN_ROW","KEY_NAV","action","key","ctrlKey","payload","isGrid","isFirst","isLast","findLastIndex","navigation","gridJumpToShortcutDirection","newState","isUsingKeyboard","getUpdatedSelectedId","currentSelectedId","defaultSelectedId","REGISTER_TAB_STOP","newTabStop","newTabStopElement","domElementRef","current","indexToInsertAt","domTabStop","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","insertIndex","newTabStops","splice","autofocus","newSelectedId","UNREGISTER_TAB_STOP","filter","previousTabStopIndex","newLocal","previousTabStop","UPDATE_TAB_STOP","SELECT_TAB_STOP","type","SET_ALLOW_FOCUSING","allow","isKeyboardNavigation","RESET_SELECTED_TAB_STOP","INITIAL_STATE","OPTIONS_UPDATED","REDUCERS","reducer","MovingFocusContext","React","createContext","dispatch","noop","MovingFocusProvider","children","options","useReducer","st","isMounted","useRef","useEffect","listKey","firstFocusDirection","context","useMemo","_jsx","Provider","value","useVirtualFocus","useContext","domElement","onClick","addEventListener","removeEventListener","isActive","scrollIntoView","timeout","setTimeout","block","clearTimeout","focused","useVirtualFocusParent","ref","element","handleKeyDown","evt","eventKey","altKey","preventDefault","useRovingTabIndex","idRef","getId","uniqueId","useCallback","trueDirection","stopPropagation","handleClick","selected","tabIndex"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,QAA4B,EAAW;AACjE;AACA,EAAA,MAAMC,gBAAgB,GAAGC,OAAO,CAACF,QAAQ,EAAE,QAAQ,CAAC;AACpD;AACJ;AACA;AACA;EACI,MAAMG,OAAO,GAAGH,QAAQ,CAACI,MAAM,CAAkB,CAACC,GAAG,EAAE;AAAEC,IAAAA;AAAO,GAAC,KAAK;AAClE,IAAA,IAAI,CAACC,KAAK,CAACD,MAAM,CAAC,IAAI,CAACD,GAAG,CAACG,QAAQ,CAACF,MAAM,CAAC,EAAE;AACzC,MAAA,OAAO,CAAC,GAAGD,GAAG,EAAEC,MAAM,CAAC;AAC3B,IAAA;AACA,IAAA,OAAOD,GAAG;EACd,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHJ,gBAAgB;AAChBE,IAAAA;GACH;AACL;;ACxBA;AACO,MAAMM,gBAAgB,GAAIC,OAAgB,IAAK,CAACA,OAAO,CAACC,QAAQ;;ACHhE,MAAMC,iBAAiB,GAAG;AAC7B;AACJ;AACA;AACA;AACIC,EAAAA,QAAQ,EAAE,WAAW;AACrB;AACJ;AACA;AACA;AACIC,EAAAA,OAAO,EAAE,UAAU;AACnB;AACJ;AACA;AACIC,EAAAA,MAAM,EAAE;AACZ,CAAU;AAEH,MAAMC,qBAAqB,GAAG;AACjC;AACAC,EAAAA,GAAG,EAAE,KAAK;AACV;AACAC,EAAAA,IAAI,EAAE;AACV,CAAU;;ACnBV;AACA;AACA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InfiniteScroll/InfiniteScroll.tsx","../../src/utils/A11YLiveMessage/index.tsx","../../src/utils/moving-focus/utils/createGridMap.ts","../../src/utils/moving-focus/utils/tabStopIsEnabled.ts","../../src/utils/moving-focus/constants.ts","../../src/utils/moving-focus/utils/buildLoopAroundObject.ts","../../src/utils/moving-focus/utils/getCell.ts","../../src/utils/moving-focus/utils/getCellCoordinates.ts","../../src/utils/moving-focus/utils/shouldLoopListVertically.ts","../../src/utils/moving-focus/utils/shouldLoopListHorizontally.ts","../../src/utils/moving-focus/utils/getPointerTypeFromEvent.ts","../../src/utils/moving-focus/ducks/keyboard-navigation.ts","../../src/utils/moving-focus/ducks/tab-stop.ts","../../src/utils/moving-focus/ducks/slice.ts","../../src/utils/moving-focus/components/MovingFocusProvider/context.ts","../../src/utils/moving-focus/components/MovingFocusProvider/index.tsx","../../src/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocus.ts","../../src/utils/moving-focus/hooks/useVirtualFocus/useVirtualFocusParent.ts","../../src/utils/moving-focus/hooks/useRovingTabIndex/useRovingTabIndex.ts"],"sourcesContent":["import React, { useEffect } from 'react';\n\ntype EventCallback = (evt?: Event) => void;\n\n// The error margin in px we want to have for triggering infinite scroll\nconst CLASSNAME = 'lumx-infinite-scroll-anchor';\n\nexport interface InfiniteScrollProps {\n callback: EventCallback;\n options?: IntersectionObserverInit;\n}\n\n/**\n * Handles basic callback pattern by using intersection observers.\n *\n * @param {Function} callback The callback to execute once the element is in the viewport or is intersecting\n * with its root element.\n * @param {Object} options The set of options we want to set to the intersection observer.\n * @return {Element} The Infinite scroll element.\n */\nexport const InfiniteScroll: React.FC<InfiniteScrollProps> = ({ callback, options }) => {\n const elementRef = React.useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n const observer = new IntersectionObserver((entries = []) => {\n const hasIntersection = entries.some((entry) => entry.isIntersecting);\n\n // Make sure at least one target element has intersected with the root element.\n if (!hasIntersection) {\n return;\n }\n\n callback();\n }, options);\n\n const currentRef = elementRef.current;\n if (elementRef && elementRef.current) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n observer.observe(elementRef.current);\n }\n\n return () => {\n if (currentRef) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n observer.unobserve(currentRef);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [elementRef.current, callback]);\n\n // In order to avoid issues when a zoom is added to the browser, we add a small height to the div so that\n // the intersection has a higher chance of working correctly.\n return <div ref={elementRef} aria-hidden=\"true\" className={CLASSNAME} style={{ height: '4px' }} />;\n};\n","import React, { AriaAttributes, ReactNode } from 'react';\n\nimport { visuallyHidden, join } from '@lumx/core/js/utils/classNames';\n\nexport interface A11YLiveMessageProps {\n /** The message that will be read. */\n children?: ReactNode;\n /** Whether the message should be hidden */\n hidden?: boolean;\n /**\n * The type of message.\n * Default to \"polite\"\n * Assertive should only be used for messages than need immediate attention.\n */\n type?: AriaAttributes['aria-live'];\n /**\n * Indicates whether assistive technologies will present all, or only parts of, the changed region based on\n * the change notifications defined by the aria-relevant attribute.\n */\n atomic?: AriaAttributes['aria-atomic'];\n /**\n * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.\n * @see atomic.\n */\n relevant?: AriaAttributes['aria-relevant'];\n /**\n * Whether the live region reads a current status or\n * raises an alert.\n * Only use `alert` for time sensitive information that should be read immediately\n * as it will interrupt anything being currently read.\n */\n role?: 'status' | 'alert';\n /** Scope, for tracking purposes */\n scope?: string;\n /** Optionnal classname */\n className?: string;\n}\n\n/**\n * Live region to read a message to screen readers.\n * Messages can be \"polite\" and be read when possible or\n * \"assertive\" and interrupt any message currently be read. (To be used sparingly)\n *\n * More information here: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions\n *\n * @family A11Y\n * @param A11YLiveMessageProps\n * @returns A11YLiveMessage\n */\nexport const A11YLiveMessage: React.FC<A11YLiveMessageProps> = ({\n type = 'polite',\n atomic,\n role,\n hidden,\n relevant,\n children,\n className,\n ...forwardedProps\n}) => {\n return (\n <div\n {...forwardedProps}\n className={join(hidden ? visuallyHidden() : undefined, className)}\n role={role}\n aria-live={type}\n aria-atomic={atomic}\n aria-relevant={relevant}\n >\n {children}\n </div>\n );\n};\n","import groupBy from 'lodash/groupBy';\nimport isNil from 'lodash/isNil';\n\nimport { GridMap, TabStop, TabStopRowKey } from '../types';\n\n/**\n * Create a map from the given tab stop to sort them by rowKey;\n */\nexport function createGridMap(tabStops: readonly TabStop[]): GridMap {\n /** Group all tabStop by rows to easily access them by their row keys */\n const tabStopsByRowKey = groupBy(tabStops, 'rowKey');\n /**\n * An array with each row key in the order set in the tabStops array.\n * Each rowKey will only appear once.\n */\n const rowKeys = tabStops.reduce<TabStopRowKey[]>((acc, { rowKey }) => {\n if (!isNil(rowKey) && !acc.includes(rowKey)) {\n return [...acc, rowKey];\n }\n return acc;\n }, []);\n\n return {\n tabStopsByRowKey,\n rowKeys,\n };\n}\n","import { TabStop } from '../types';\n\n/** Check if the given tab stop is enabled */\nexport const tabStopIsEnabled = (tabStop: TabStop) => !tabStop.disabled;\n","export const LOOP_AROUND_TYPES = {\n /**\n * Will continue navigation to the next row or column and loop back to the start\n * when the last tab stop is reached\n */\n nextLoop: 'next-loop',\n /**\n * Will continue navigation to the next row or column until\n * the last tab stop is reached\n */\n nextEnd: 'next-end',\n /**\n * Will loop within the current row or column\n */\n inside: 'inside',\n} as const;\n\nexport const CELL_SEARCH_DIRECTION = {\n /** Look ahead of the given position */\n asc: 'asc',\n /** Look before the given position */\n desc: 'desc',\n} as const;\n","import { LOOP_AROUND_TYPES } from '../constants';\nimport { LoopAround, LoopAroundByAxis } from '../types';\n\n/**\n * Build a loopAround configuration to ensure both row and col behavior are set.\n *\n * Setting a boolean will set the following behaviors:\n *\n * * true => { row: 'next-loop', col: 'next-loop' }\n * * false => { row: 'next-end', col: 'next-end' }\n */\nexport function buildLoopAroundObject(loopAround?: LoopAround): LoopAroundByAxis {\n if (typeof loopAround === 'boolean' || loopAround === undefined) {\n const newLoopAround: LoopAround = loopAround\n ? { row: LOOP_AROUND_TYPES.nextLoop, col: LOOP_AROUND_TYPES.nextLoop }\n : { row: LOOP_AROUND_TYPES.nextEnd, col: LOOP_AROUND_TYPES.nextEnd };\n\n return newLoopAround;\n }\n return loopAround;\n}\n","import find from 'lodash/find';\nimport findLast from 'lodash/findLast';\n\nimport { CELL_SEARCH_DIRECTION } from '../constants';\nimport { CellSelector, CoordsType, DirectionCoords, GridMap, TabStop } from '../types';\n\nimport { tabStopIsEnabled } from './tabStopIsEnabled';\n\n/**\n * Check that the given coordinate is a simple number\n */\nconst isNumberCoords = (coords: CoordsType): coords is number => typeof coords === 'number';\n\n/**\n * Check that the given coordinate is a direction\n */\nfunction isDirectionCoords(coords: CoordsType): coords is DirectionCoords {\n return Boolean(typeof coords !== 'number' && typeof coords?.from === 'number');\n}\n\n/**\n * Search the given column of a grid map for a cell.\n */\nfunction findCellInCol(\n gridMap: GridMap,\n col: number,\n rowCoords: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n /** The rowIndex might not be strictly successive, so we need to use the actual row index keys. */\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const lastIndex = rowKeys.length - 1;\n /**\n * If the rowCoords.from is set at -1, it means we should search from the start/end.\n */\n let searchIndex = rowCoords.from;\n if (searchIndex === -1) {\n searchIndex = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? lastIndex : 0;\n }\n\n const searchCellFunc = rowCoords.direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;\n const rowKeyWithEnabledCell = searchCellFunc(rowKeys, (rowKey, index) => {\n const row = tabStopsByRowKey[rowKey];\n const cell = row[col];\n const hasCell = Boolean(cell);\n const cellRowIndex = index;\n\n /** Check that the target row index is in the right direction of the search */\n const correctRowIndex =\n rowCoords.direction === CELL_SEARCH_DIRECTION.desc\n ? cellRowIndex <= searchIndex\n : cellRowIndex >= searchIndex;\n\n if (cell && correctRowIndex) {\n return cellSelector ? hasCell && cellSelector(cell) : hasCell;\n }\n return false;\n });\n const row = rowKeyWithEnabledCell !== undefined ? tabStopsByRowKey[rowKeyWithEnabledCell] : undefined;\n return row?.[col];\n}\n\n/**\n * Search the given column of a grid map for a cell.\n */\nfunction findCellInRow(\n gridMap: GridMap,\n row: number,\n colCoords: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n const { direction, from } = colCoords || {};\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const rowKey = rowKeys[row];\n const currentRow = tabStopsByRowKey[rowKey];\n if (!currentRow) {\n return undefined;\n }\n\n const searchCellFunc = direction === CELL_SEARCH_DIRECTION.desc ? findLast : find;\n const cell = searchCellFunc(currentRow, cellSelector, from);\n return cell;\n}\n\n/**\n * Parse each column of the given gridMap to find the first cell matching the selector.\n * The direction and starting point of the search can be set using the coordinates attribute.\n */\nfunction parseColsForCell(\n /** The gridMap to search */\n gridMap: GridMap,\n /** The coordinate to search */\n { direction = CELL_SEARCH_DIRECTION.asc, from }: DirectionCoords,\n cellSelector: CellSelector = tabStopIsEnabled,\n) {\n if (from === undefined) {\n return undefined;\n }\n\n const { rowKeys, tabStopsByRowKey } = gridMap;\n\n /** As we cannot know for certain when to stop, we need to know which column is the last column */\n const maxColIndex = rowKeys.reduce<number>((maxLength, rowIndex) => {\n const rowLength = tabStopsByRowKey[rowIndex].length;\n return rowLength > maxLength ? rowLength - 1 : maxLength;\n }, 0);\n\n /** If \"from\" is set as -1, start from the end. */\n const fromIndex = from === -1 ? maxColIndex : from || 0;\n\n for (\n let index = fromIndex;\n direction === CELL_SEARCH_DIRECTION.desc ? index > -1 : index <= maxColIndex;\n direction === CELL_SEARCH_DIRECTION.desc ? (index -= 1) : (index += 1)\n ) {\n const rowWithEnabledCed = findCellInCol(\n gridMap,\n index,\n { direction, from: direction === CELL_SEARCH_DIRECTION.desc ? -1 : 0 },\n cellSelector,\n );\n\n if (rowWithEnabledCed) {\n return rowWithEnabledCed;\n }\n }\n\n return undefined;\n}\n\n/**\n * Search for a cell in a gridMap\n *\n * This allows you to\n * * Select a cell at a specific coordinate\n * * Search for a cell from a specific column in any direction\n * * Search for a cell from a specific row in any direction\n *\n * If no cell is found, returns undefined\n */\nexport function getCell(\n /** The gridMap object to search in. */\n gridMap: GridMap,\n /** The coordinates of the cell to select */\n coords: {\n /** The row on or from witch to look for */\n row: CoordsType;\n /** The column on or from witch to look for */\n col: CoordsType;\n },\n /**\n * A selector function to select the cell.\n * Selects enabled cells by default.\n */\n cellSelector: CellSelector = tabStopIsEnabled,\n): TabStop | undefined {\n const { row, col } = coords || {};\n const { rowKeys, tabStopsByRowKey } = gridMap || {};\n\n /** Defined row and col */\n if (isNumberCoords(row) && isNumberCoords(col)) {\n const rowKey = rowKeys[row];\n return tabStopsByRowKey[rowKey][col];\n }\n\n /** Defined row but variable col */\n if (isDirectionCoords(col) && isNumberCoords(row)) {\n return findCellInRow(gridMap, row, col, cellSelector);\n }\n\n if (isDirectionCoords(row)) {\n if (isDirectionCoords(col)) {\n return parseColsForCell(gridMap, col, cellSelector);\n }\n return findCellInCol(gridMap, col, row, cellSelector);\n }\n\n return undefined;\n}\n","import isNil from 'lodash/isNil';\n\nimport { GridMap, TabStop } from '../types';\n\nexport function getCellCoordinates(gridMap: GridMap, tabStop: TabStop) {\n const currentRowKey = tabStop.rowKey;\n if (isNil(currentRowKey)) {\n return undefined;\n }\n const { rowKeys, tabStopsByRowKey } = gridMap;\n const rowIndex = rowKeys.findIndex((rowKey) => rowKey === currentRowKey);\n const row = tabStopsByRowKey[currentRowKey];\n const columnOffset = row.findIndex((ts) => ts.id === tabStop.id);\n\n return {\n rowIndex,\n row,\n columnOffset,\n };\n}\n","import { KeyDirection, LoopAroundByAxis } from '../types';\n\n/** Check whether the list should vertically loop with the given configuration */\nexport function shouldLoopListVertically(direction: KeyDirection, loopAround: Pick<LoopAroundByAxis, 'col'>): boolean {\n return (\n (direction === 'vertical' && loopAround?.col !== 'next-end') ||\n (direction === 'both' && loopAround?.col !== 'next-end')\n );\n}\n","import { KeyDirection, LoopAroundByAxis } from '../types';\n\n/** Check whether the list should horizontally loop with the given configuration */\nexport function shouldLoopListHorizontally(\n direction: KeyDirection,\n loopAround: Pick<LoopAroundByAxis, 'row'>,\n): boolean {\n return (\n (direction === 'horizontal' && loopAround?.row !== 'next-end') ||\n (direction === 'both' && loopAround?.row !== 'next-end')\n );\n}\n","/**\n * Get the correct pointer type from the given event.\n * This is used when a tab stop is selected, to check if is has been selected using a keyboard or a pointer\n * (pen / mouse / touch)\n */\nexport function getPointerTypeFromEvent(event?: PointerEvent | Event) {\n return event && 'pointerType' in event && Boolean(event.pointerType) ? 'pointer' : 'keyboard';\n}\n","import find from 'lodash/find';\nimport findLast from 'lodash/findLast';\nimport findLastIndex from 'lodash/findLastIndex';\nimport isNil from 'lodash/isNil';\n\nimport { LOOP_AROUND_TYPES } from '../constants';\nimport { KeyDirection, KeyNavAction, Navigation, Reducer, State, TabStop } from '../types';\nimport {\n createGridMap,\n getCell,\n getCellCoordinates,\n shouldLoopListHorizontally,\n shouldLoopListVertically,\n tabStopIsEnabled,\n} from '../utils';\n\n// Event keys used for keyboard navigation.\nexport const VERTICAL_NAV_KEYS = ['ArrowUp', 'ArrowDown', 'Home', 'End'] as const;\nexport const HORIZONTAL_NAV_KEYS = ['ArrowLeft', 'ArrowRight', 'Home', 'End'] as const;\nexport const KEY_NAV_KEYS = [...HORIZONTAL_NAV_KEYS, ...VERTICAL_NAV_KEYS] as const;\nexport const NAV_KEYS: { [direction in KeyDirection]: ReadonlyArray<string> } = {\n both: KEY_NAV_KEYS,\n vertical: VERTICAL_NAV_KEYS,\n horizontal: HORIZONTAL_NAV_KEYS,\n};\n\n// Event keys union type\nexport type EventKey = (typeof KEY_NAV_KEYS)[number];\n\n// Handle all navigation moves resulting in a new state.\nconst MOVES: {\n [N in Navigation]: (state: State, currentTabStop: TabStop, index: number) => State;\n} = {\n // Move to the next item.\n // The grid is flatten so the item after the last of a row will be the\n // first item of the next row.\n NEXT(state, _, index) {\n for (let i = index + 1; i < state.tabStops.length; ++i) {\n const tabStop = state.tabStops[i];\n\n if (!tabStop.disabled) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n }\n return state;\n },\n\n // Move to the previous item.\n // The grid is flatten so the item before the first of a row will be the\n // last item of the previous row.\n PREVIOUS(state, _, index) {\n for (let i = index - 1; i >= 0; --i) {\n const tabStop = state.tabStops[i];\n\n if (!tabStop.disabled) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n }\n return state;\n },\n\n // Moving to the next row\n // We move to the next row, and we stay in the same column.\n // If we are in the last row, then we move to the first not disabled item of the next column.\n NEXT_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n const nextRow = rowIndex + 1;\n\n /** First try to get the next cell in the current column */\n let tabStop = getCell(gridMap, {\n row: {\n from: nextRow,\n direction: 'asc',\n },\n col: columnOffset,\n });\n\n // If none were found, search for the next cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.col) {\n /**\n * If columns are configured to be looped inside,\n * get the first enabled cell of the current column\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: 0,\n direction: 'asc',\n },\n });\n break;\n /**\n * If columns are configured to be go to the next,\n * search for the next enabled cell from the next column\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n tabStop = getCell(gridMap, {\n row: {\n from: 0,\n direction: 'asc',\n },\n col: {\n from: columnOffset + 1,\n direction: 'asc',\n },\n });\n break;\n }\n }\n\n /**\n * If still none is found and the columns are configured to loop\n * search starting from the start\n */\n if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = getCell(gridMap, {\n row: {\n from: 0,\n direction: 'asc',\n },\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n }\n\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n gridMap,\n };\n }\n\n return { ...state, allowFocusing: true, gridMap };\n },\n\n // Moving to the previous row\n // We move to the previous row, and we stay in the same column.\n // If we are in the first row, then we move to the last not disabled item of the previous column.\n PREVIOUS_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n const previousRow = rowIndex - 1;\n let tabStop;\n /** Search for the previous enabled cell in the current column */\n if (previousRow >= 0) {\n tabStop = getCell(gridMap, {\n row: {\n from: previousRow,\n direction: 'desc',\n },\n col: columnOffset,\n });\n }\n\n // If none were found, search for the previous cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.col) {\n /**\n * If columns are configured to be looped inside,\n * get the last enabled cell of the current column\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: -1,\n direction: 'desc',\n },\n });\n break;\n /**\n * If columns are configured to be go to the previous,\n * search for the last enabled cell from the previous column\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n if (columnOffset - 1 >= 0) {\n tabStop = getCell(gridMap, {\n row: {\n from: -1,\n direction: 'desc',\n },\n col: {\n from: columnOffset - 1,\n direction: 'desc',\n },\n });\n break;\n }\n }\n }\n /**\n * If still none is found and the columns are configured to loop\n * search starting from the end\n */\n if (!tabStop && state.loopAround.col === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = getCell(gridMap, {\n row: {\n from: -1,\n direction: 'desc',\n },\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n }\n\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n gridMap,\n };\n }\n\n return { ...state, allowFocusing: true, gridMap };\n },\n // Moving to the very first not disabled item of the list\n VERY_FIRST(state) {\n // The very first not disabled item' index.\n const tabStop = state.tabStops.find(tabStopIsEnabled);\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n return state;\n },\n // Moving to the very last not disabled item of the list\n VERY_LAST(state) {\n // The very last not disabled item' index.\n const tabStop = findLast(state.tabStops, tabStopIsEnabled);\n if (tabStop) {\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n };\n }\n return state;\n },\n NEXT_COLUMN(state, currentTabStop, index) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n // Parse the current row and look for the next enabled cell\n let tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: columnOffset + 1,\n direction: 'asc',\n },\n });\n\n // If none were found, search for the next cell depending on the loop around parameter\n if (!tabStop) {\n switch (state.loopAround.row) {\n /**\n * If rows are configured to be looped inside,\n * get the first enabled cell of the current rows\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n break;\n /**\n * If rows are configured to be go to the next,\n * search for the next enabled cell from the next row\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n tabStop = find(state.tabStops, tabStopIsEnabled, index + 1);\n break;\n }\n }\n /**\n * If still none is found and the row are configured to loop\n * search starting from the start\n */\n if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = find(state.tabStops, tabStopIsEnabled);\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n PREVIOUS_COLUMN(state, currentTabStop, index) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex, columnOffset } = cellCoordinates;\n\n const previousColumn = columnOffset - 1;\n let tabStop;\n\n if (previousColumn >= 0) {\n // Parse the current row and look for the next enable cell\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: previousColumn,\n direction: 'desc',\n },\n });\n }\n if (!tabStop) {\n switch (state.loopAround.row) {\n /**\n * If rows are configured to be looped inside,\n * get the last enabled cell of the current row\n */\n case LOOP_AROUND_TYPES.inside:\n tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n break;\n /**\n * If rows are configured to be go to the next,\n * search for the previous enabled cell from the previous row\n */\n case LOOP_AROUND_TYPES.nextEnd:\n case LOOP_AROUND_TYPES.nextLoop:\n default:\n if (index - 1 >= 0) {\n tabStop = findLast(state.tabStops, tabStopIsEnabled, index - 1);\n }\n break;\n }\n }\n /**\n * If still none is found and the rows are configured to loop\n * search starting from the end\n */\n if (!tabStop && state.loopAround.row === LOOP_AROUND_TYPES.nextLoop) {\n tabStop = findLast(state.tabStops, tabStopIsEnabled);\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n FIRST_IN_COLUMN(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { columnOffset } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: 0,\n direction: 'asc',\n },\n });\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n LAST_IN_COLUMN(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { columnOffset } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n col: columnOffset,\n row: {\n from: -1,\n direction: 'desc',\n },\n });\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n // Moving to the first item in row\n FIRST_IN_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: 0,\n direction: 'asc',\n },\n });\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n // Moving to the last item in row\n LAST_IN_ROW(state, currentTabStop) {\n const currentRowKey = currentTabStop.rowKey;\n if (isNil(currentRowKey)) {\n return state;\n }\n const gridMap = state.gridMap || createGridMap(state.tabStops);\n const cellCoordinates = getCellCoordinates(gridMap, currentTabStop);\n if (!cellCoordinates) {\n return state;\n }\n const { rowIndex } = cellCoordinates;\n\n const tabStop = getCell(gridMap, {\n row: rowIndex,\n col: {\n from: -1,\n direction: 'desc',\n },\n });\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop?.id || state.selectedId,\n gridMap,\n };\n },\n};\n\n/** Handle `KEY_NAV` action to update */\nexport const KEY_NAV: Reducer<KeyNavAction> = (state, action) => {\n const { id = state.selectedId || state.tabStops[0]?.id, key, ctrlKey } = action.payload;\n const index = state.tabStops.findIndex((tabStop) => tabStop.id === id);\n if (index === -1) {\n // tab stop not registered\n return state;\n }\n const currentTabStop = state.tabStops[index];\n if (currentTabStop.disabled) {\n return state;\n }\n\n const isGrid = currentTabStop.rowKey !== null;\n const isFirst = index === state.tabStops.findIndex(tabStopIsEnabled);\n const isLast = index === findLastIndex(state.tabStops, tabStopIsEnabled);\n // Translates the user key down event info into a navigation instruction.\n let navigation: Navigation | null = null;\n // eslint-disable-next-line default-case\n switch (key) {\n case 'ArrowLeft':\n if (isGrid) {\n navigation = 'PREVIOUS_COLUMN';\n } else if (state.direction === 'horizontal' || state.direction === 'both') {\n navigation =\n shouldLoopListHorizontally(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';\n }\n break;\n case 'ArrowRight':\n if (isGrid) {\n navigation = 'NEXT_COLUMN';\n } else if (state.direction === 'horizontal' || state.direction === 'both') {\n navigation =\n shouldLoopListHorizontally(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';\n }\n break;\n case 'ArrowUp':\n if (isGrid) {\n navigation = 'PREVIOUS_ROW';\n } else if (state.direction === 'vertical' || state.direction === 'both') {\n navigation =\n shouldLoopListVertically(state.direction, state.loopAround) && isFirst ? 'VERY_LAST' : 'PREVIOUS';\n }\n break;\n case 'ArrowDown':\n if (isGrid) {\n navigation = 'NEXT_ROW';\n } else if (state.direction === 'vertical' || state.direction === 'both') {\n navigation =\n shouldLoopListVertically(state.direction, state.loopAround) && isLast ? 'VERY_FIRST' : 'NEXT';\n }\n break;\n case 'Home':\n if (isGrid && !ctrlKey) {\n navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'FIRST_IN_COLUMN' : 'FIRST_IN_ROW';\n } else {\n navigation = 'VERY_FIRST';\n }\n break;\n case 'End':\n if (isGrid && !ctrlKey) {\n navigation = state.gridJumpToShortcutDirection === 'vertical' ? 'LAST_IN_COLUMN' : 'LAST_IN_ROW';\n } else {\n navigation = 'VERY_LAST';\n }\n break;\n }\n\n if (!navigation) {\n return state;\n }\n\n const newState = MOVES[navigation](state, currentTabStop, index);\n\n return { ...newState, isUsingKeyboard: true };\n};\n","import findLast from 'lodash/findLast';\nimport findLastIndex from 'lodash/findLastIndex';\n\nimport {\n Reducer,\n RegisterAction,\n ResetSelectedTabStopAction,\n SelectTabStopAction,\n SetAllowFocusingAction,\n State,\n UnregisterAction,\n UpdateTabStopAction,\n} from '../types';\nimport { tabStopIsEnabled } from '../utils';\n\n/** Determine the updated value for selectedId: */\nexport const getUpdatedSelectedId = (\n tabStops: State['tabStops'],\n currentSelectedId: State['selectedId'],\n defaultSelectedId: State['selectedId'] = null,\n): State['selectedId'] => {\n // Get tab stop by id\n const tabStop = currentSelectedId && tabStops.find((ts) => ts.id === currentSelectedId && !ts.disabled);\n if (!tabStop) {\n // Fallback to default selected id if available, or first enabled tab stop if not\n return tabStops.find((ts) => ts.id === defaultSelectedId)?.id || tabStops.find(tabStopIsEnabled)?.id || null;\n }\n return tabStop?.id || defaultSelectedId;\n};\n\n/** Handle `REGISTER_TAB_STOP` action registering a new tab stop. */\nexport const REGISTER_TAB_STOP: Reducer<RegisterAction> = (state, action) => {\n const newTabStop = action.payload;\n const newTabStopElement = newTabStop.domElementRef.current;\n\n if (!newTabStopElement) {\n return state;\n }\n\n // Find index of tab stop that\n const indexToInsertAt = findLastIndex(state.tabStops, (tabStop) => {\n if (tabStop.id === newTabStop.id) {\n // tab stop already registered\n return false;\n }\n const domTabStop = tabStop.domElementRef.current;\n\n // New tab stop is following the current tab stop\n return domTabStop?.compareDocumentPosition(newTabStopElement) === Node.DOCUMENT_POSITION_FOLLOWING;\n });\n const insertIndex = indexToInsertAt + 1;\n\n // Insert new tab stop at position `indexToInsertAt`.\n const newTabStops = [...state.tabStops];\n newTabStops.splice(insertIndex, 0, newTabStop);\n\n // Handle autofocus if needed\n let { selectedId, allowFocusing } = state;\n if (\n (state.autofocus === 'first' && insertIndex === 0) ||\n (state.autofocus === 'last' && insertIndex === newTabStops.length - 1) ||\n newTabStop.autofocus\n ) {\n allowFocusing = true;\n selectedId = newTabStop.id;\n }\n\n const newSelectedId =\n newTabStop.id === state.defaultSelectedId && !newTabStop.disabled\n ? newTabStop.id\n : getUpdatedSelectedId(newTabStops, selectedId, state.defaultSelectedId);\n\n return {\n ...state,\n /**\n * If the tab currently being registered is enabled and set as default selected,\n * set as selected.\n *\n */\n selectedId: newSelectedId,\n tabStops: newTabStops,\n gridMap: null,\n allowFocusing,\n };\n};\n\n/** Handle `UNREGISTER_TAB_STOP` action un-registering a new tab stop. */\nexport const UNREGISTER_TAB_STOP: Reducer<UnregisterAction> = (state, action) => {\n const { id } = action.payload;\n const newTabStops = state.tabStops.filter((tabStop) => tabStop.id !== id);\n if (newTabStops.length === state.tabStops.length) {\n // tab stop already unregistered\n return state;\n }\n\n /** Get the previous enabled tab stop */\n const previousTabStopIndex = state.tabStops.findIndex(\n (tabStop) => tabStop.id === state.selectedId && tabStopIsEnabled(tabStop),\n );\n\n const newLocal = previousTabStopIndex - 1 > -1;\n const previousTabStop = newLocal ? findLast(newTabStops, tabStopIsEnabled, previousTabStopIndex - 1) : undefined;\n\n return {\n ...state,\n /** Set the focus on either the previous tab stop if found or the one set as default */\n selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, previousTabStop?.id || state.defaultSelectedId),\n tabStops: newTabStops,\n gridMap: null,\n };\n};\n\n/** Handle `UPDATE_TAB_STOP` action updating properties of a tab stop. */\nexport const UPDATE_TAB_STOP: Reducer<UpdateTabStopAction> = (state, action) => {\n const { id, rowKey, disabled } = action.payload;\n const index = state.tabStops.findIndex((tabStop) => tabStop.id === id);\n if (index === -1) {\n // tab stop not registered\n return state;\n }\n\n const tabStop = state.tabStops[index];\n if (tabStop.disabled === disabled && tabStop.rowKey === rowKey) {\n // Nothing to do so short-circuit.\n return state;\n }\n\n const newTabStop = { ...tabStop, rowKey, disabled };\n const newTabStops = [...state.tabStops];\n newTabStops.splice(index, 1, newTabStop);\n\n return {\n ...state,\n selectedId: getUpdatedSelectedId(newTabStops, state.selectedId, state.defaultSelectedId),\n tabStops: newTabStops,\n gridMap: null,\n };\n};\n\n/** Handle `SELECT_TAB_STOP` action selecting a tab stop. */\nexport const SELECT_TAB_STOP: Reducer<SelectTabStopAction> = (state, action) => {\n const { id, type } = action.payload;\n\n const tabStop = state.tabStops.find((ts) => ts.id === id);\n if (!tabStop || tabStop.disabled) {\n return state;\n }\n\n return {\n ...state,\n allowFocusing: true,\n selectedId: tabStop.id,\n isUsingKeyboard: type === 'keyboard',\n };\n};\n\nexport const SET_ALLOW_FOCUSING: Reducer<SetAllowFocusingAction> = (state, action) => {\n return {\n ...state,\n selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n allowFocusing: action.payload.allow,\n isUsingKeyboard: Boolean(action.payload.isKeyboardNavigation),\n };\n};\n\n/** Handle `RESET_SELECTED_TAB_STOP` action reseting the selected tab stop. */\nexport const RESET_SELECTED_TAB_STOP: Reducer<ResetSelectedTabStopAction> = (state) => {\n return {\n ...state,\n allowFocusing: false,\n selectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n defaultSelectedId: getUpdatedSelectedId(state.tabStops, null, state.defaultSelectedId),\n isUsingKeyboard: false,\n };\n};\n","import findLast from 'lodash/findLast';\n\nimport { Action, OptionsUpdatedAction, Reducer, State } from '../types';\nimport { buildLoopAroundObject, tabStopIsEnabled } from '../utils';\nimport { KEY_NAV } from './keyboard-navigation';\nimport {\n REGISTER_TAB_STOP,\n UNREGISTER_TAB_STOP,\n UPDATE_TAB_STOP,\n SELECT_TAB_STOP,\n SET_ALLOW_FOCUSING,\n RESET_SELECTED_TAB_STOP,\n} from './tab-stop';\n\nexport const INITIAL_STATE: State = {\n selectedId: null,\n allowFocusing: false,\n tabStops: [],\n direction: 'horizontal',\n loopAround: buildLoopAroundObject(false),\n gridMap: null,\n defaultSelectedId: null,\n autofocus: undefined,\n isUsingKeyboard: false,\n};\n\nconst OPTIONS_UPDATED: Reducer<OptionsUpdatedAction> = (state, action) => {\n const { autofocus } = action.payload;\n let { selectedId, allowFocusing } = state;\n\n // Update selectedId when updating the `autofocus` option.\n if (!state.autofocus && autofocus) {\n if (autofocus === 'first') {\n selectedId = state.tabStops.find(tabStopIsEnabled)?.id || null;\n } else if (autofocus === 'last') {\n selectedId = findLast(state.tabStops, tabStopIsEnabled)?.id || null;\n }\n allowFocusing = true;\n }\n\n return {\n ...state,\n ...action.payload,\n selectedId,\n allowFocusing: action.payload.allowFocusing || allowFocusing,\n loopAround: buildLoopAroundObject(action.payload.loopAround),\n };\n};\n\n/** Reducers for each action type: */\nconst REDUCERS: { [Type in Action['type']]: Reducer<Extract<Action, { type: Type }>> } = {\n REGISTER_TAB_STOP,\n UNREGISTER_TAB_STOP,\n UPDATE_TAB_STOP,\n SELECT_TAB_STOP,\n OPTIONS_UPDATED,\n KEY_NAV,\n SET_ALLOW_FOCUSING,\n RESET_SELECTED_TAB_STOP,\n};\n\n/** Main reducer */\nexport const reducer: Reducer<Action> = (state, action) => {\n return REDUCERS[action.type]?.(state, action as any) || state;\n};\n","import React from 'react';\n\nimport noop from 'lodash/noop';\n\nimport { INITIAL_STATE } from '../../ducks/slice';\nimport { Action, State } from '../../types';\n\nexport type MovingFocusContext = Readonly<{\n state: State;\n dispatch: React.Dispatch<Action>;\n}>;\n\nexport const MovingFocusContext = React.createContext<MovingFocusContext>({\n state: INITIAL_STATE,\n dispatch: noop,\n});\n","import React from 'react';\n\nimport { INITIAL_STATE, reducer } from '../../ducks/slice';\nimport { MovingFocusOptions } from '../../types';\nimport { buildLoopAroundObject } from '../../utils';\nimport { MovingFocusContext } from './context';\n\nexport interface MovingFocusProviderProps {\n /**\n * The child content, which will include the DOM elements to rove between using the tab key.\n */\n children: React.ReactNode;\n /**\n * An optional object to customize the behaviour of the moving focus. It is fine to pass a new object every time\n * the containing component is rendered, and the options can be updated at any time.\n */\n options?: Partial<MovingFocusOptions>;\n}\n\n/**\n * Creates a roving tabindex context.\n */\nexport const MovingFocusProvider: React.FC<MovingFocusProviderProps> = ({ children, options }) => {\n const [state, dispatch] = React.useReducer(reducer, INITIAL_STATE, (st) => ({\n ...st,\n ...options,\n direction: options?.direction || st.direction,\n loopAround: buildLoopAroundObject(options?.loopAround),\n selectedId: options?.defaultSelectedId || INITIAL_STATE.selectedId,\n }));\n const isMounted = React.useRef(false);\n\n // Update the options whenever they change:\n React.useEffect(() => {\n // Skip update on mount (already up to date)\n if (!isMounted.current) {\n isMounted.current = true;\n return;\n }\n dispatch({\n type: 'OPTIONS_UPDATED',\n payload: {\n direction: options?.direction || INITIAL_STATE.direction,\n loopAround: buildLoopAroundObject(options?.loopAround || INITIAL_STATE.loopAround),\n defaultSelectedId: options?.defaultSelectedId || INITIAL_STATE.defaultSelectedId,\n autofocus: options?.autofocus || INITIAL_STATE.autofocus,\n allowFocusing: options?.allowFocusing || INITIAL_STATE.allowFocusing,\n listKey: options?.listKey || INITIAL_STATE.listKey,\n firstFocusDirection: options?.firstFocusDirection || INITIAL_STATE.firstFocusDirection,\n gridJumpToShortcutDirection:\n options?.gridJumpToShortcutDirection || INITIAL_STATE.gridJumpToShortcutDirection,\n },\n });\n }, [\n isMounted,\n options?.allowFocusing,\n options?.autofocus,\n options?.defaultSelectedId,\n options?.direction,\n options?.loopAround,\n options?.listKey,\n options?.firstFocusDirection,\n options?.gridJumpToShortcutDirection,\n ]);\n\n // Create a cached object to use as the context value:\n const context = React.useMemo(() => ({ state, dispatch }), [state]);\n\n return <MovingFocusContext.Provider value={context}>{children}</MovingFocusContext.Provider>;\n};\n","import React, { useEffect } from 'react';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { BaseHookOptions } from '../../types';\nimport { getPointerTypeFromEvent } from '../../utils';\n\n/**\n * Hook options\n */\ntype Options = [\n /** The DOM id of the tab stop. */\n id: string,\n ...baseOptions: BaseHookOptions,\n];\n\n/**\n * Hook to use in tab stop element of a virtual focus (ex: options of a listbox in a combobox).\n *\n * @returns true if the current tab stop has virtual focus\n */\nexport const useVirtualFocus: (...args: Options) => boolean = (\n id,\n domElementRef,\n disabled = false,\n rowKey = null,\n autofocus = false,\n) => {\n const isMounted = React.useRef(false);\n const { state, dispatch } = React.useContext(MovingFocusContext);\n\n // Register the tab stop on mount and unregister it on unmount:\n React.useEffect(\n () => {\n const { current: domElement } = domElementRef;\n if (!domElement) {\n return undefined;\n }\n // Select tab stop on click\n const onClick = (event?: PointerEvent | Event) => {\n dispatch({\n type: 'SELECT_TAB_STOP',\n payload: { id, type: getPointerTypeFromEvent(event) },\n });\n };\n domElement.addEventListener('click', onClick);\n\n // Register tab stop in context\n dispatch({ type: 'REGISTER_TAB_STOP', payload: { id, domElementRef, rowKey, disabled, autofocus } });\n\n return () => {\n domElement.removeEventListener('click', onClick);\n dispatch({ type: 'UNREGISTER_TAB_STOP', payload: { id } });\n };\n },\n /**\n * Pass the list key as dependency to make tab stops\n * re-register when it changes.\n */\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state.listKey],\n );\n\n /*\n * Update the tab stop data if `rowKey` or `disabled` change.\n * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the\n * REGISTER_TAB_STOP action would have just been dispatched).\n */\n React.useEffect(\n () => {\n if (isMounted.current) {\n dispatch({ type: 'UPDATE_TAB_STOP', payload: { id, rowKey, disabled } });\n } else {\n isMounted.current = true;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [disabled, rowKey],\n );\n\n const isActive = id === state.selectedId;\n\n // Scroll element into view when highlighted\n useEffect(() => {\n const { current } = domElementRef;\n if (isActive && current && current.scrollIntoView) {\n /**\n * In some cases, the selected item is contained in a popover\n * that won't be immediately set in the correct position.\n * Setting a small timeout before scroll the item into view\n * leaves it time to settle at the correct position.\n */\n const timeout = setTimeout(() => {\n current.scrollIntoView({ block: 'nearest' });\n }, 10);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n\n return undefined;\n }, [domElementRef, isActive]);\n\n const focused = isActive && state.allowFocusing;\n\n // Determine if the current tab stop is the currently active one:\n return focused;\n};\n","import React from 'react';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { NAV_KEYS } from '../../ducks/keyboard-navigation';\n\n/**\n * Hook to use in a virtual focus parent (ex: `aria-activedescendant` on the input of a combobox).\n * * @returns the id of the currently active tab stop (virtual focus)\n */\nexport const useVirtualFocusParent = (ref: React.RefObject<HTMLElement>): string | undefined => {\n const { state, dispatch } = React.useContext(MovingFocusContext);\n\n React.useEffect(() => {\n const { current: element } = ref;\n if (!element) {\n return undefined;\n }\n\n function handleKeyDown(evt: KeyboardEvent) {\n const eventKey = evt.key as any;\n if (\n // Don't move if the current direction doesn't allow key\n !NAV_KEYS[state.direction].includes(eventKey) ||\n // Don't move if alt key is pressed\n evt.altKey ||\n // Don't move the focus if it hasn't been set yet and `firstFocusDirection` doesn't allow key\n (!state.allowFocusing &&\n state.firstFocusDirection &&\n !NAV_KEYS[state.firstFocusDirection].includes(eventKey))\n ) {\n return;\n }\n // If focus isn't allowed yet, simply enable it to stay on first item\n if (!state.allowFocusing && eventKey === 'ArrowDown') {\n dispatch({ type: 'SET_ALLOW_FOCUSING', payload: { allow: true, isKeyboardNavigation: true } });\n } else {\n dispatch({ type: 'KEY_NAV', payload: { key: eventKey, ctrlKey: evt.ctrlKey } });\n }\n\n evt.preventDefault();\n }\n element.addEventListener('keydown', handleKeyDown);\n return () => {\n element.removeEventListener('keydown', handleKeyDown);\n };\n }, [dispatch, ref, state.allowFocusing, state.direction, state.firstFocusDirection]);\n const focused = (state.allowFocusing && state.selectedId) || undefined;\n return focused;\n};\n","import React from 'react';\n\nimport isNil from 'lodash/isNil';\nimport uniqueId from 'lodash/uniqueId';\n\nimport { MovingFocusContext } from '../../components/MovingFocusProvider/context';\nimport { NAV_KEYS } from '../../ducks/keyboard-navigation';\nimport { BaseHookOptions } from '../../types';\nimport { getPointerTypeFromEvent } from '../../utils';\n\n/**\n * A tuple of values to be applied by the containing component for the roving tabindex to work correctly.\n */\ntype Output = [\n /** The tabIndex value to apply to the tab stop element. */\n tabIndex: number,\n /** Whether focus() should be invoked on the tab stop element. */\n focused: boolean,\n /**\n * The onKeyDown callback to apply to the tab stop element. If the key press is relevant to the hook then\n * event.preventDefault() will be invoked on the event.\n */\n handleKeyDown: (event: React.KeyboardEvent) => void,\n /** The onClick callback to apply to the tab stop element. */\n handleClick: () => void,\n];\n\n/**\n * Includes the given DOM element in the current roving tabindex.\n */\nexport const useRovingTabIndex: (...args: BaseHookOptions) => Output = (\n ref,\n disabled = false,\n rowKey = null,\n autofocus = false,\n) => {\n // Create a stable ID for the lifetime of the component:\n const idRef = React.useRef<string | null>(null);\n\n function getId() {\n if (!idRef.current) {\n idRef.current = uniqueId('rti_');\n }\n return idRef.current;\n }\n\n const isMounted = React.useRef(false);\n const { dispatch, state } = React.useContext(MovingFocusContext);\n const { direction } = state;\n\n // Register the tab stop on mount and unregister it on unmount:\n React.useEffect(\n () => {\n const id = getId();\n dispatch({ type: 'REGISTER_TAB_STOP', payload: { id, domElementRef: ref, rowKey, disabled, autofocus } });\n return () => {\n dispatch({ type: 'UNREGISTER_TAB_STOP', payload: { id } });\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [state.listKey],\n );\n\n /*\n * Update the tab stop data if `rowIndex` or `disabled` change.\n * The isMounted flag is used to prevent this effect running on mount, which is benign but redundant (as the\n * REGISTER_TAB_STOP action would have just been dispatched).\n */\n React.useEffect(\n () => {\n if (isMounted.current) {\n dispatch({ type: 'UPDATE_TAB_STOP', payload: { id: getId(), rowKey, disabled } });\n } else {\n isMounted.current = true;\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [rowKey, disabled],\n );\n\n // Create a stable callback function for handling key down events:\n const handleKeyDown = React.useCallback<React.KeyboardEventHandler>(\n (evt) => {\n const trueDirection = !isNil(rowKey) ? 'both' : direction;\n if (!NAV_KEYS[trueDirection].includes(evt.key as any)) {\n return;\n }\n dispatch({ type: 'KEY_NAV', payload: { id: getId(), key: evt.key, ctrlKey: evt.ctrlKey } });\n evt.preventDefault();\n evt.stopPropagation();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Create a stable callback function for handling click events:\n const handleClick = React.useCallback(\n (event?: PointerEvent | Event) => {\n dispatch({\n type: 'SELECT_TAB_STOP',\n payload: {\n id: getId(),\n type: getPointerTypeFromEvent(event),\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Determine if the current tab stop is the currently active one:\n const selected = getId() === state.selectedId;\n\n const tabIndex = selected ? 0 : -1;\n const focused = selected && state.allowFocusing;\n\n return [tabIndex, focused, handleKeyDown, handleClick];\n};\n"],"names":["CLASSNAME","InfiniteScroll","callback","options","elementRef","React","useRef","useEffect","observer","IntersectionObserver","entries","hasIntersection","some","entry","isIntersecting","currentRef","current","observe","unobserve","_jsx","ref","className","style","height","A11YLiveMessage","type","atomic","role","hidden","relevant","children","forwardedProps","join","visuallyHidden","undefined","createGridMap","tabStops","tabStopsByRowKey","groupBy","rowKeys","reduce","acc","rowKey","isNil","includes","tabStopIsEnabled","tabStop","disabled","LOOP_AROUND_TYPES","nextLoop","nextEnd","inside","CELL_SEARCH_DIRECTION","asc","desc","buildLoopAroundObject","loopAround","newLoopAround","row","col","isNumberCoords","coords","isDirectionCoords","Boolean","from","findCellInCol","gridMap","rowCoords","cellSelector","lastIndex","length","searchIndex","direction","searchCellFunc","findLast","find","rowKeyWithEnabledCell","index","cell","hasCell","cellRowIndex","correctRowIndex","findCellInRow","colCoords","currentRow","parseColsForCell","maxColIndex","maxLength","rowIndex","rowLength","fromIndex","rowWithEnabledCed","getCell","getCellCoordinates","currentRowKey","findIndex","columnOffset","ts","id","shouldLoopListVertically","shouldLoopListHorizontally","getPointerTypeFromEvent","event","pointerType","VERTICAL_NAV_KEYS","HORIZONTAL_NAV_KEYS","KEY_NAV_KEYS","NAV_KEYS","both","vertical","horizontal","MOVES","NEXT","state","_","i","allowFocusing","selectedId","PREVIOUS","NEXT_ROW","currentTabStop","cellCoordinates","nextRow","PREVIOUS_ROW","previousRow","VERY_FIRST","VERY_LAST","NEXT_COLUMN","PREVIOUS_COLUMN","previousColumn","FIRST_IN_COLUMN","LAST_IN_COLUMN","FIRST_IN_ROW","LAST_IN_ROW","KEY_NAV","action","key","ctrlKey","payload","isGrid","isFirst","isLast","findLastIndex","navigation","gridJumpToShortcutDirection","newState","isUsingKeyboard","getUpdatedSelectedId","currentSelectedId","defaultSelectedId","REGISTER_TAB_STOP","newTabStop","newTabStopElement","domElementRef","indexToInsertAt","domTabStop","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","insertIndex","newTabStops","splice","autofocus","newSelectedId","UNREGISTER_TAB_STOP","filter","previousTabStopIndex","newLocal","previousTabStop","UPDATE_TAB_STOP","SELECT_TAB_STOP","SET_ALLOW_FOCUSING","allow","isKeyboardNavigation","RESET_SELECTED_TAB_STOP","INITIAL_STATE","OPTIONS_UPDATED","REDUCERS","reducer","MovingFocusContext","createContext","dispatch","noop","MovingFocusProvider","useReducer","st","isMounted","listKey","firstFocusDirection","context","useMemo","Provider","value","useVirtualFocus","useContext","domElement","onClick","addEventListener","removeEventListener","isActive","scrollIntoView","timeout","setTimeout","block","clearTimeout","focused","useVirtualFocusParent","element","handleKeyDown","evt","eventKey","altKey","preventDefault","useRovingTabIndex","idRef","getId","uniqueId","useCallback","trueDirection","stopPropagation","handleClick","selected","tabIndex"],"mappings":";;;;;;;;;;;;AAIA;AACA,MAAMA,SAAS,GAAG,6BAA6B;AAO/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAA6C,GAAGA,CAAC;EAAEC,QAAQ;AAAEC,EAAAA;AAAQ,CA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