@react-aria/grid 3.12.0 → 3.13.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
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoBM,MAAM;IAsBD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK;IACvB;IAEU,MAAM,IAAa,EAAE;QAC7B,OAAO,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK;IAC9C;IAEQ,WAAW,IAAmB,EAAE;YACK;QAA3C,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAU,CAAA,EAAA,cAAA,KAAK,KAAK,cAAV,kCAAA,YAAY,UAAU,KAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;IACrG;IAEU,gBAAgB,OAAa,EAAE,IAAiC,EAAE;QAC1E,IAAI,MAAM,WAAW,OACjB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAC7B,IAAI,CAAC,UAAU,CAAC,UAAU;QAE9B,MAAO,OAAO,KAAM;YAClB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,MACH,OAAO;YAET,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAU,CAAA,CAAC,QAAQ,KAAK,KAAI,GAC/C,OAAO;YAGT,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QACrC;QACA,OAAO;IACT;IAEU,YAAY,OAAa,EAAE,IAAiC,EAAE;QACtE,IAAI,MAAM,WAAW,OACjB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAC5B,IAAI,CAAC,UAAU,CAAC,WAAW;QAE/B,MAAO,OAAO,KAAM;YAClB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,MACH,OAAO;YAET,IAAI,CAAC,IAAI,CAAC,UAAU,CA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,IAAI,CAAC,MAAM,GAAG;IAChB;AAaF","sources":["packages/@react-aria/grid/src/GridKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction, DisabledBehavior, Key, KeyboardDelegate, LayoutDelegate, Node, Rect, RefObject, Size} from '@react-types/shared';\nimport {DOMLayoutDelegate} from '@react-aria/selection';\nimport {getChildNodes, getFirstItem, getLastItem, getNthItem} from '@react-stately/collections';\nimport {GridCollection, GridNode} from '@react-types/grid';\n\nexport interface GridKeyboardDelegateOptions<C> {\n collection: C,\n disabledKeys: Set<Key>,\n disabledBehavior?: DisabledBehavior,\n ref?: RefObject<HTMLElement | null>,\n direction: Direction,\n collator?: Intl.Collator,\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout,\n focusMode?: 'row' | 'cell'\n}\n\nexport class GridKeyboardDelegate<T, C extends GridCollection<T>> implements KeyboardDelegate {\n collection: C;\n protected disabledKeys: Set<Key>;\n protected disabledBehavior: DisabledBehavior;\n protected direction: Direction;\n protected collator: Intl.Collator | undefined;\n protected layoutDelegate: LayoutDelegate;\n protected focusMode;\n\n constructor(options: GridKeyboardDelegateOptions<C>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.disabledBehavior = options.disabledBehavior || 'all';\n this.direction = options.direction;\n this.collator = options.collator;\n if (!options.layout && !options.ref) {\n throw new Error('Either a layout or a ref must be specified.');\n }\n this.layoutDelegate = options.layoutDelegate || (options.layout ? new DeprecatedLayoutDelegate(options.layout) : new DOMLayoutDelegate(options.ref!));\n this.focusMode = options.focusMode || 'row';\n }\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell';\n }\n\n protected isRow(node: Node<T>) {\n return node.type === 'row' || node.type === 'item';\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {\n let key = fromKey != null\n ? this.collection.getKeyBefore(fromKey)\n : this.collection.getLastKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n return null;\n }\n\n protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {\n let key = fromKey != null\n ? this.collection.getKeyAfter(fromKey)\n : this.collection.getFirstKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n return null;\n }\n }\n return null;\n }\n\n protected getKeyForItemInRowByIndex(key: Key, index: number = 0): Key | null {\n if (index < 0) {\n return null;\n }\n\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n let i = 0;\n for (let child of getChildNodes(item, this.collection) as Iterable<GridNode<T>>) {\n if (child.colSpan && child.colSpan + i > index) {\n return child.key ?? null;\n }\n\n if (child.colSpan) {\n i = i + child.colSpan - 1;\n }\n\n if (i === index) {\n return child.key ?? null;\n }\n\n i++;\n }\n return null;\n }\n\n getKeyBelow(fromKey: Key) {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the next item\n key = this.findNextKey(key, (item => item.type === 'item'));\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the next row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyAbove(fromKey: Key) {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus is on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the previous item\n key = this.findPreviousKey(key, item => item.type === 'item');\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the previous row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyRightOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the first child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getLastItem(children)?.key\n : getFirstItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the next cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let next = (this.direction === 'rtl'\n ? getNthItem(children, item.index - 1)\n : getNthItem(children, item.index + 1)) ?? null;\n\n if (next) {\n return next.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key)) ?? null;\n }\n return null;\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the last child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getFirstItem(children)?.key\n : getLastItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the previous cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let prev = (this.direction === 'rtl'\n ? getNthItem(children, item.index + 1)\n : getNthItem(children, item.index - 1)) ?? null;\n\n if (prev) {\n return prev.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key)) ?? null;\n }\n return null;\n }\n\n getFirstKey(fromKey?: Key, global?: boolean) {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the first cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n return getFirstItem(getChildNodes(parent, this.collection))?.key ?? null;\n }\n }\n\n // Find the first row\n key = this.findNextKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the first cell in the first row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n key = getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getLastKey(fromKey?: Key, global?: boolean) {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the last cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n return getLastItem(children)?.key ?? null;\n }\n }\n\n // Find the last row\n key = this.findPreviousKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the last cell in the last row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n let children = getChildNodes(item, this.collection);\n key = getLastItem(children)?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getKeyPageAbove(fromKey: Key) {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y > pageY && key != null) {\n key = this.getKeyAbove(key) ?? null;\n if (key == null) {\n break;\n }\n itemRect = this.layoutDelegate.getItemRect(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(fromKey: Key) {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n\n if (!itemRect) {\n return null;\n }\n\n let pageHeight = this.layoutDelegate.getVisibleRect().height;\n let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);\n\n while (itemRect && (itemRect.y + itemRect.height) < pageY) {\n let nextKey = this.getKeyBelow(key);\n // If nextKey is undefined, we've reached the last row already\n if (nextKey == null) {\n break;\n }\n\n itemRect = this.layoutDelegate.getItemRect(nextKey);\n key = nextKey;\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n let key: Key | null = fromKey ?? null;\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n key = fromKey ?? this.getFirstKey();\n if (key == null) {\n return null;\n }\n\n // If the starting key is a cell, search from its parent row.\n let startItem = collection.getItem(key);\n if (!startItem) {\n return null;\n }\n if (startItem.type === 'cell') {\n key = startItem.parentKey ?? null;\n }\n\n let hasWrapped = false;\n while (key != null) {\n let item = collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // check row text value for match\n if (item.textValue) {\n let substring = item.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n if (this.isRow(item) && this.focusMode === 'cell') {\n return getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n return item.key;\n }\n }\n\n key = this.findNextKey(key, item => item.type === 'item');\n\n // Wrap around when reaching the end of the collection\n if (key == null && !hasWrapped) {\n key = this.getFirstKey();\n hasWrapped = true;\n }\n }\n\n return null;\n }\n}\n\n/* Backward compatibility for old Virtualizer Layout interface. */\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\nclass DeprecatedLayoutDelegate implements LayoutDelegate {\n layout: DeprecatedLayout;\n\n constructor(layout: DeprecatedLayout) {\n this.layout = layout;\n }\n\n getContentSize(): Size {\n return this.layout.getContentSize();\n }\n\n getItemRect(key: Key): Rect | null {\n return this.layout.getLayoutInfo(key)?.rect || null;\n }\n\n getVisibleRect(): Rect {\n return this.layout.virtualizer.visibleRect;\n }\n}\n"],"names":[],"version":3,"file":"GridKeyboardDelegate.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoBM,MAAM;IAsBD,OAAO,IAAa,EAAW;QACvC,OAAO,KAAK,IAAI,KAAK;IACvB;IAEU,MAAM,IAAa,EAAW;QACtC,OAAO,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK;IAC9C;IAEQ,WAAW,IAAmB,EAAE;YACK;QAA3C,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAU,CAAA,EAAA,cAAA,K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AC,YAAY,GAAG,QAAQ,YAAY;QACxC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,gBAAgB,IAAI;QACpD,IAAI,CAAC,SAAS,GAAG,QAAQ,SAAS;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ;QAChC,IAAI,CAAC,QAAQ,MAAM,IAAI,CAAC,QAAQ,GAAG,EACjC,MAAM,IAAI,MAAM;QAElB,IAAI,CAAC,cAAc,GAAG,QAAQ,cAAc,IAAK,CAAA,QAAQ,MAAM,GAAG,IAAI,+CAAyB,QAAQ,MAAM,IAAI,IAAI,CAAA,GAAA,2CAAgB,EAAE,QAAQ,GAAG,CAAC;QACnJ,IAAI,CAAC,SAAS,GAAG,QAAQ,SAAS,IAAI;IACxC;AA8YF;AAiBA,MAAM;IAOJ,iBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc;IACnC;IAEA,YAAY,GAAQ,EAAe;YAC1B;QAAP,OAAO,EAAA,6BAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,kBAA1B,iDAAA,2BAAgC,IAAI,KAAI;IACjD;IAEA,iBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW;IAC5C;IAdA,YAAY,MAAwB,CAAE;QACpC,IAAI,CAAC,MAAM,GAAG;IAChB;AAaF","sources":["packages/@react-aria/grid/src/GridKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction, DisabledBehavior, Key, KeyboardDelegate, LayoutDelegate, Node, Rect, RefObject, Size} from '@react-types/shared';\nimport {DOMLayoutDelegate} from '@react-aria/selection';\nimport {getChildNodes, getFirstItem, getLastItem, getNthItem} from '@react-stately/collections';\nimport {GridCollection, GridNode} from '@react-types/grid';\n\nexport interface GridKeyboardDelegateOptions<C> {\n collection: C,\n disabledKeys: Set<Key>,\n disabledBehavior?: DisabledBehavior,\n ref?: RefObject<HTMLElement | null>,\n direction: Direction,\n collator?: Intl.Collator,\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout,\n focusMode?: 'row' | 'cell'\n}\n\nexport class GridKeyboardDelegate<T, C extends GridCollection<T>> implements KeyboardDelegate {\n collection: C;\n protected disabledKeys: Set<Key>;\n protected disabledBehavior: DisabledBehavior;\n protected direction: Direction;\n protected collator: Intl.Collator | undefined;\n protected layoutDelegate: LayoutDelegate;\n protected focusMode;\n\n constructor(options: GridKeyboardDelegateOptions<C>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.disabledBehavior = options.disabledBehavior || 'all';\n this.direction = options.direction;\n this.collator = options.collator;\n if (!options.layout && !options.ref) {\n throw new Error('Either a layout or a ref must be specified.');\n }\n this.layoutDelegate = options.layoutDelegate || (options.layout ? new DeprecatedLayoutDelegate(options.layout) : new DOMLayoutDelegate(options.ref!));\n this.focusMode = options.focusMode || 'row';\n }\n\n protected isCell(node: Node<T>): boolean {\n return node.type === 'cell';\n }\n\n protected isRow(node: Node<T>): boolean {\n return node.type === 'row' || node.type === 'item';\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {\n let key = fromKey != null\n ? this.collection.getKeyBefore(fromKey)\n : this.collection.getLastKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n return null;\n }\n\n protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {\n let key = fromKey != null\n ? this.collection.getKeyAfter(fromKey)\n : this.collection.getFirstKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n return null;\n }\n }\n return null;\n }\n\n protected getKeyForItemInRowByIndex(key: Key, index: number = 0): Key | null {\n if (index < 0) {\n return null;\n }\n\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n let i = 0;\n for (let child of getChildNodes(item, this.collection) as Iterable<GridNode<T>>) {\n if (child.colSpan && child.colSpan + i > index) {\n return child.key ?? null;\n }\n\n if (child.colSpan) {\n i = i + child.colSpan - 1;\n }\n\n if (i === index) {\n return child.key ?? null;\n }\n\n i++;\n }\n return null;\n }\n\n getKeyBelow(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the next item\n key = this.findNextKey(key, (item => item.type === 'item'));\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the next row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyAbove(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus is on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the previous item\n key = this.findPreviousKey(key, item => item.type === 'item');\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the previous row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyRightOf(key: Key): Key | null {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the first child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getLastItem(children)?.key\n : getFirstItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the next cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let next = (this.direction === 'rtl'\n ? getNthItem(children, item.index - 1)\n : getNthItem(children, item.index + 1)) ?? null;\n\n if (next) {\n return next.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key)) ?? null;\n }\n return null;\n }\n\n getKeyLeftOf(key: Key): Key | null {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the last child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getFirstItem(children)?.key\n : getLastItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the previous cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let prev = (this.direction === 'rtl'\n ? getNthItem(children, item.index + 1)\n : getNthItem(children, item.index - 1)) ?? null;\n\n if (prev) {\n return prev.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key)) ?? null;\n }\n return null;\n }\n\n getFirstKey(fromKey?: Key, global?: boolean): Key | null {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the first cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n return getFirstItem(getChildNodes(parent, this.collection))?.key ?? null;\n }\n }\n\n // Find the first row\n key = this.findNextKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the first cell in the first row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n key = getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getLastKey(fromKey?: Key, global?: boolean): Key | null {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the last cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n return getLastItem(children)?.key ?? null;\n }\n }\n\n // Find the last row\n key = this.findPreviousKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the last cell in the last row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n let children = getChildNodes(item, this.collection);\n key = getLastItem(children)?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getKeyPageAbove(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y > pageY && key != null) {\n key = this.getKeyAbove(key) ?? null;\n if (key == null) {\n break;\n }\n itemRect = this.layoutDelegate.getItemRect(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n\n if (!itemRect) {\n return null;\n }\n\n let pageHeight = this.layoutDelegate.getVisibleRect().height;\n let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);\n\n while (itemRect && (itemRect.y + itemRect.height) < pageY) {\n let nextKey = this.getKeyBelow(key);\n // If nextKey is undefined, we've reached the last row already\n if (nextKey == null) {\n break;\n }\n\n itemRect = this.layoutDelegate.getItemRect(nextKey);\n key = nextKey;\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key): Key | null {\n let key: Key | null = fromKey ?? null;\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n key = fromKey ?? this.getFirstKey();\n if (key == null) {\n return null;\n }\n\n // If the starting key is a cell, search from its parent row.\n let startItem = collection.getItem(key);\n if (!startItem) {\n return null;\n }\n if (startItem.type === 'cell') {\n key = startItem.parentKey ?? null;\n }\n\n let hasWrapped = false;\n while (key != null) {\n let item = collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // check row text value for match\n if (item.textValue) {\n let substring = item.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n if (this.isRow(item) && this.focusMode === 'cell') {\n return getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n return item.key;\n }\n }\n\n key = this.findNextKey(key, item => item.type === 'item');\n\n // Wrap around when reaching the end of the collection\n if (key == null && !hasWrapped) {\n key = this.getFirstKey();\n hasWrapped = true;\n }\n }\n\n return null;\n }\n}\n\n/* Backward compatibility for old Virtualizer Layout interface. */\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\nclass DeprecatedLayoutDelegate implements LayoutDelegate {\n layout: DeprecatedLayout;\n\n constructor(layout: DeprecatedLayout) {\n this.layout = layout;\n }\n\n getContentSize(): Size {\n return this.layout.getContentSize();\n }\n\n getItemRect(key: Key): Rect | null {\n return this.layout.getLayoutInfo(key)?.rect || null;\n }\n\n getVisibleRect(): Rect {\n return this.layout.virtualizer.visibleRect;\n }\n}\n"],"names":[],"version":3,"file":"GridKeyboardDelegate.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAoBM,MAAM;IAsBD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK;IACvB;IAEU,MAAM,IAAa,EAAE;QAC7B,OAAO,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK;IAC9C;IAEQ,WAAW,IAAmB,EAAE;YACK;QAA3C,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAU,CAAA,EAAA,cAAA,KAAK,KAAK,cAAV,kCAAA,YAAY,UAAU,KAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;IACrG;IAEU,gBAAgB,OAAa,EAAE,IAAiC,EAAE;QAC1E,IAAI,MAAM,WAAW,OACjB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAC7B,IAAI,CAAC,UAAU,CAAC,UAAU;QAE9B,MAAO,OAAO,KAAM;YAClB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,MACH,OAAO;YAET,IAAI,CA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IAAI,CAAA,GAAA,wBAAgB,EAAE,QAAQ,GAAG,CAAC;QACnJ,IAAI,CAAC,SAAS,GAAG,QAAQ,SAAS,IAAI;IACxC;AA8YF;AAiBA,MAAM;IAOJ,iBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc;IACnC;IAEA,YAAY,GAAQ,EAAe;YAC1B;QAAP,OAAO,EAAA,6BAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,kBAA1B,iDAAA,2BAAgC,IAAI,KAAI;IACjD;IAEA,iBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW;IAC5C;IAdA,YAAY,MAAwB,CAAE;QACpC,IAAI,CAAC,MAAM,GAAG;IAChB;AAaF","sources":["packages/@react-aria/grid/src/GridKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction, DisabledBehavior, Key, KeyboardDelegate, LayoutDelegate, Node, Rect, RefObject, Size} from '@react-types/shared';\nimport {DOMLayoutDelegate} from '@react-aria/selection';\nimport {getChildNodes, getFirstItem, getLastItem, getNthItem} from '@react-stately/collections';\nimport {GridCollection, GridNode} from '@react-types/grid';\n\nexport interface GridKeyboardDelegateOptions<C> {\n collection: C,\n disabledKeys: Set<Key>,\n disabledBehavior?: DisabledBehavior,\n ref?: RefObject<HTMLElement | null>,\n direction: Direction,\n collator?: Intl.Collator,\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout,\n focusMode?: 'row' | 'cell'\n}\n\nexport class GridKeyboardDelegate<T, C extends GridCollection<T>> implements KeyboardDelegate {\n collection: C;\n protected disabledKeys: Set<Key>;\n protected disabledBehavior: DisabledBehavior;\n protected direction: Direction;\n protected collator: Intl.Collator | undefined;\n protected layoutDelegate: LayoutDelegate;\n protected focusMode;\n\n constructor(options: GridKeyboardDelegateOptions<C>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.disabledBehavior = options.disabledBehavior || 'all';\n this.direction = options.direction;\n this.collator = options.collator;\n if (!options.layout && !options.ref) {\n throw new Error('Either a layout or a ref must be specified.');\n }\n this.layoutDelegate = options.layoutDelegate || (options.layout ? new DeprecatedLayoutDelegate(options.layout) : new DOMLayoutDelegate(options.ref!));\n this.focusMode = options.focusMode || 'row';\n }\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell';\n }\n\n protected isRow(node: Node<T>) {\n return node.type === 'row' || node.type === 'item';\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {\n let key = fromKey != null\n ? this.collection.getKeyBefore(fromKey)\n : this.collection.getLastKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n return null;\n }\n\n protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {\n let key = fromKey != null\n ? this.collection.getKeyAfter(fromKey)\n : this.collection.getFirstKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n return null;\n }\n }\n return null;\n }\n\n protected getKeyForItemInRowByIndex(key: Key, index: number = 0): Key | null {\n if (index < 0) {\n return null;\n }\n\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n let i = 0;\n for (let child of getChildNodes(item, this.collection) as Iterable<GridNode<T>>) {\n if (child.colSpan && child.colSpan + i > index) {\n return child.key ?? null;\n }\n\n if (child.colSpan) {\n i = i + child.colSpan - 1;\n }\n\n if (i === index) {\n return child.key ?? null;\n }\n\n i++;\n }\n return null;\n }\n\n getKeyBelow(fromKey: Key) {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the next item\n key = this.findNextKey(key, (item => item.type === 'item'));\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the next row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyAbove(fromKey: Key) {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus is on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the previous item\n key = this.findPreviousKey(key, item => item.type === 'item');\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the previous row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyRightOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the first child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getLastItem(children)?.key\n : getFirstItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the next cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let next = (this.direction === 'rtl'\n ? getNthItem(children, item.index - 1)\n : getNthItem(children, item.index + 1)) ?? null;\n\n if (next) {\n return next.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key)) ?? null;\n }\n return null;\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the last child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getFirstItem(children)?.key\n : getLastItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the previous cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let prev = (this.direction === 'rtl'\n ? getNthItem(children, item.index + 1)\n : getNthItem(children, item.index - 1)) ?? null;\n\n if (prev) {\n return prev.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key)) ?? null;\n }\n return null;\n }\n\n getFirstKey(fromKey?: Key, global?: boolean) {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the first cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n return getFirstItem(getChildNodes(parent, this.collection))?.key ?? null;\n }\n }\n\n // Find the first row\n key = this.findNextKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the first cell in the first row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n key = getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getLastKey(fromKey?: Key, global?: boolean) {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the last cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n return getLastItem(children)?.key ?? null;\n }\n }\n\n // Find the last row\n key = this.findPreviousKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the last cell in the last row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n let children = getChildNodes(item, this.collection);\n key = getLastItem(children)?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getKeyPageAbove(fromKey: Key) {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y > pageY && key != null) {\n key = this.getKeyAbove(key) ?? null;\n if (key == null) {\n break;\n }\n itemRect = this.layoutDelegate.getItemRect(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(fromKey: Key) {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n\n if (!itemRect) {\n return null;\n }\n\n let pageHeight = this.layoutDelegate.getVisibleRect().height;\n let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);\n\n while (itemRect && (itemRect.y + itemRect.height) < pageY) {\n let nextKey = this.getKeyBelow(key);\n // If nextKey is undefined, we've reached the last row already\n if (nextKey == null) {\n break;\n }\n\n itemRect = this.layoutDelegate.getItemRect(nextKey);\n key = nextKey;\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n let key: Key | null = fromKey ?? null;\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n key = fromKey ?? this.getFirstKey();\n if (key == null) {\n return null;\n }\n\n // If the starting key is a cell, search from its parent row.\n let startItem = collection.getItem(key);\n if (!startItem) {\n return null;\n }\n if (startItem.type === 'cell') {\n key = startItem.parentKey ?? null;\n }\n\n let hasWrapped = false;\n while (key != null) {\n let item = collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // check row text value for match\n if (item.textValue) {\n let substring = item.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n if (this.isRow(item) && this.focusMode === 'cell') {\n return getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n return item.key;\n }\n }\n\n key = this.findNextKey(key, item => item.type === 'item');\n\n // Wrap around when reaching the end of the collection\n if (key == null && !hasWrapped) {\n key = this.getFirstKey();\n hasWrapped = true;\n }\n }\n\n return null;\n }\n}\n\n/* Backward compatibility for old Virtualizer Layout interface. */\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\nclass DeprecatedLayoutDelegate implements LayoutDelegate {\n layout: DeprecatedLayout;\n\n constructor(layout: DeprecatedLayout) {\n this.layout = layout;\n }\n\n getContentSize(): Size {\n return this.layout.getContentSize();\n }\n\n getItemRect(key: Key): Rect | null {\n return this.layout.getLayoutInfo(key)?.rect || null;\n }\n\n getVisibleRect(): Rect {\n return this.layout.virtualizer.visibleRect;\n }\n}\n"],"names":[],"version":3,"file":"GridKeyboardDelegate.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAoBM,MAAM;IAsBD,OAAO,IAAa,EAAW;QACvC,OAAO,KAAK,IAAI,KAAK;IACvB;IAEU,MAAM,IAAa,EAAW;QACtC,OAAO,KAAK,IAAI,KAAK,SAAS,KAAK,IAAI,KAAK;IAC9C;IAEQ,WAAW,IAAmB,EAAE;YACK;QAA3C,OAAO,IAAI,CAAC,gBAAgB,KAAK,SAAU,CAAA,EAAA,cAAA,KAAK,KAAK,cAAV,kCAAA,YAAY,UAAU,KAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;IACrG;IAEU,gBAAgB,OAAa,EAAE,IAAiC,EAAc;QACtF,IAAI,MAAM,WAAW,OACjB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAC7B,IAAI,CAAC,UAAU,CAAC,UAAU;QAE9B,MAAO,OAAO,KAAM;YAClB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,MACH,OAAO;YAET,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAU,CAAA,CAAC,QAAQ,KAAK,KAAI,GAC/C,OAAO;YAGT,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QACrC;QACA,OAAO;IACT;IAEU,YAAY,OAAa,EAAE,IAAiC,EAAc;QAClF,IAAI,MAAM,WAAW,OACjB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAC5B,IAAI,CAAC,UAAU,CAAC,WAAW;QAE/B,MAAO,OAAO,KAAM;YAClB,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACnC,IAAI,CAAC,MACH,OAAO;YAET,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,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AC,MAAM,GAAG;IAChB;AAaF","sources":["packages/@react-aria/grid/src/GridKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction, DisabledBehavior, Key, KeyboardDelegate, LayoutDelegate, Node, Rect, RefObject, Size} from '@react-types/shared';\nimport {DOMLayoutDelegate} from '@react-aria/selection';\nimport {getChildNodes, getFirstItem, getLastItem, getNthItem} from '@react-stately/collections';\nimport {GridCollection, GridNode} from '@react-types/grid';\n\nexport interface GridKeyboardDelegateOptions<C> {\n collection: C,\n disabledKeys: Set<Key>,\n disabledBehavior?: DisabledBehavior,\n ref?: RefObject<HTMLElement | null>,\n direction: Direction,\n collator?: Intl.Collator,\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout,\n focusMode?: 'row' | 'cell'\n}\n\nexport class GridKeyboardDelegate<T, C extends GridCollection<T>> implements KeyboardDelegate {\n collection: C;\n protected disabledKeys: Set<Key>;\n protected disabledBehavior: DisabledBehavior;\n protected direction: Direction;\n protected collator: Intl.Collator | undefined;\n protected layoutDelegate: LayoutDelegate;\n protected focusMode;\n\n constructor(options: GridKeyboardDelegateOptions<C>) {\n this.collection = options.collection;\n this.disabledKeys = options.disabledKeys;\n this.disabledBehavior = options.disabledBehavior || 'all';\n this.direction = options.direction;\n this.collator = options.collator;\n if (!options.layout && !options.ref) {\n throw new Error('Either a layout or a ref must be specified.');\n }\n this.layoutDelegate = options.layoutDelegate || (options.layout ? new DeprecatedLayoutDelegate(options.layout) : new DOMLayoutDelegate(options.ref!));\n this.focusMode = options.focusMode || 'row';\n }\n\n protected isCell(node: Node<T>): boolean {\n return node.type === 'cell';\n }\n\n protected isRow(node: Node<T>): boolean {\n return node.type === 'row' || node.type === 'item';\n }\n\n private isDisabled(item: Node<unknown>) {\n return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));\n }\n\n protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {\n let key = fromKey != null\n ? this.collection.getKeyBefore(fromKey)\n : this.collection.getLastKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyBefore(key);\n }\n return null;\n }\n\n protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {\n let key = fromKey != null\n ? this.collection.getKeyAfter(fromKey)\n : this.collection.getFirstKey();\n\n while (key != null) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n if (!this.isDisabled(item) && (!pred || pred(item))) {\n return key;\n }\n\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n return null;\n }\n }\n return null;\n }\n\n protected getKeyForItemInRowByIndex(key: Key, index: number = 0): Key | null {\n if (index < 0) {\n return null;\n }\n\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n let i = 0;\n for (let child of getChildNodes(item, this.collection) as Iterable<GridNode<T>>) {\n if (child.colSpan && child.colSpan + i > index) {\n return child.key ?? null;\n }\n\n if (child.colSpan) {\n i = i + child.colSpan - 1;\n }\n\n if (i === index) {\n return child.key ?? null;\n }\n\n i++;\n }\n return null;\n }\n\n getKeyBelow(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the next item\n key = this.findNextKey(key, (item => item.type === 'item'));\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the next row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the next row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyAbove(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus is on a cell, start searching from the parent row\n if (this.isCell(startItem)) {\n key = startItem.parentKey ?? null;\n }\n if (key == null) {\n return null;\n }\n\n // Find the previous item\n key = this.findPreviousKey(key, item => item.type === 'item');\n if (key != null) {\n // If focus was on a cell, focus the cell with the same index in the previous row.\n if (this.isCell(startItem)) {\n let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;\n return this.getKeyForItemInRowByIndex(key, startIndex);\n }\n\n // Otherwise, focus the previous row\n if (this.focusMode === 'row') {\n return key;\n }\n }\n return null;\n }\n\n getKeyRightOf(key: Key): Key | null {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the first child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getLastItem(children)?.key\n : getFirstItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the next cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let next = (this.direction === 'rtl'\n ? getNthItem(children, item.index - 1)\n : getNthItem(children, item.index + 1)) ?? null;\n\n if (next) {\n return next.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key)) ?? null;\n }\n return null;\n }\n\n getKeyLeftOf(key: Key): Key | null {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus is on a row, focus the last child cell.\n if (this.isRow(item)) {\n let children = getChildNodes(item, this.collection);\n return (this.direction === 'rtl'\n ? getFirstItem(children)?.key\n : getLastItem(children)?.key) ?? null;\n }\n\n // If focus is on a cell, focus the previous cell if any,\n // otherwise focus the parent row.\n if (this.isCell(item) && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n let prev = (this.direction === 'rtl'\n ? getNthItem(children, item.index + 1)\n : getNthItem(children, item.index - 1)) ?? null;\n\n if (prev) {\n return prev.key ?? null;\n }\n\n // focus row only if focusMode is set to row\n if (this.focusMode === 'row') {\n return item.parentKey ?? null;\n }\n\n return (this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key)) ?? null;\n }\n return null;\n }\n\n getFirstKey(fromKey?: Key, global?: boolean): Key | null {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the first cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n return getFirstItem(getChildNodes(parent, this.collection))?.key ?? null;\n }\n }\n\n // Find the first row\n key = this.findNextKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the first cell in the first row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n key = getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getLastKey(fromKey?: Key, global?: boolean): Key | null {\n let key: Key | null = fromKey ?? null;\n let item: Node<T> | undefined | null;\n if (key != null) {\n item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If global flag is not set, and a cell is currently focused,\n // move focus to the last cell in the parent row.\n if (this.isCell(item) && !global && item.parentKey != null) {\n let parent = this.collection.getItem(item.parentKey);\n if (!parent) {\n return null;\n }\n let children = getChildNodes(parent, this.collection);\n return getLastItem(children)?.key ?? null;\n }\n }\n\n // Find the last row\n key = this.findPreviousKey(undefined, item => item.type === 'item');\n\n // If global flag is set (or if focus mode is cell), focus the last cell in the last row.\n if (key != null && ((item && this.isCell(item) && global) || this.focusMode === 'cell')) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n let children = getChildNodes(item, this.collection);\n key = getLastItem(children)?.key ?? null;\n }\n\n // Otherwise, focus the row itself.\n return key;\n }\n\n getKeyPageAbove(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n if (!itemRect) {\n return null;\n }\n\n let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);\n\n while (itemRect && itemRect.y > pageY && key != null) {\n key = this.getKeyAbove(key) ?? null;\n if (key == null) {\n break;\n }\n itemRect = this.layoutDelegate.getItemRect(key);\n }\n\n return key;\n }\n\n getKeyPageBelow(fromKey: Key): Key | null {\n let key: Key | null = fromKey;\n let itemRect = this.layoutDelegate.getItemRect(key);\n\n if (!itemRect) {\n return null;\n }\n\n let pageHeight = this.layoutDelegate.getVisibleRect().height;\n let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);\n\n while (itemRect && (itemRect.y + itemRect.height) < pageY) {\n let nextKey = this.getKeyBelow(key);\n // If nextKey is undefined, we've reached the last row already\n if (nextKey == null) {\n break;\n }\n\n itemRect = this.layoutDelegate.getItemRect(nextKey);\n key = nextKey;\n }\n\n return key;\n }\n\n getKeyForSearch(search: string, fromKey?: Key): Key | null {\n let key: Key | null = fromKey ?? null;\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n key = fromKey ?? this.getFirstKey();\n if (key == null) {\n return null;\n }\n\n // If the starting key is a cell, search from its parent row.\n let startItem = collection.getItem(key);\n if (!startItem) {\n return null;\n }\n if (startItem.type === 'cell') {\n key = startItem.parentKey ?? null;\n }\n\n let hasWrapped = false;\n while (key != null) {\n let item = collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // check row text value for match\n if (item.textValue) {\n let substring = item.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n if (this.isRow(item) && this.focusMode === 'cell') {\n return getFirstItem(getChildNodes(item, this.collection))?.key ?? null;\n }\n\n return item.key;\n }\n }\n\n key = this.findNextKey(key, item => item.type === 'item');\n\n // Wrap around when reaching the end of the collection\n if (key == null && !hasWrapped) {\n key = this.getFirstKey();\n hasWrapped = true;\n }\n }\n\n return null;\n }\n}\n\n/* Backward compatibility for old Virtualizer Layout interface. */\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\nclass DeprecatedLayoutDelegate implements LayoutDelegate {\n layout: DeprecatedLayout;\n\n constructor(layout: DeprecatedLayout) {\n this.layout = layout;\n }\n\n getContentSize(): Size {\n return this.layout.getContentSize();\n }\n\n getItemRect(key: Key): Rect | null {\n return this.layout.getLayoutInfo(key)?.rect || null;\n }\n\n getVisibleRect(): Rect {\n return this.layout.virtualizer.visibleRect;\n }\n}\n"],"names":[],"version":3,"file":"GridKeyboardDelegate.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -107,6 +107,15 @@ export interface GridProps extends DOMProps, AriaLabelingProps {
107
107
  onRowAction?: (key: Key) => void;
108
108
  /** Handler that is called when a user performs an action on the cell. */
109
109
  onCellAction?: (key: Key) => void;
110
+ /**
111
+ * Whether pressing the escape key should clear selection in the grid or not.
112
+ *
113
+ * Most experiences should not modify this option as it eliminates a keyboard user's ability to
114
+ * easily clear selection. Only use if the escape key is being handled externally or should not
115
+ * trigger selection clearing contextually.
116
+ * @default 'clearSelection'
117
+ */
118
+ escapeKeyBehavior?: 'clearSelection' | 'none';
110
119
  }
111
120
  export interface GridAria {
112
121
  /** Props for the grid element. */
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAiBA,6CAA6C,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC;IACd,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,GAAG,CAAC,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAC3B;AAED,kCAAkC,CAAC,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,CAAE,YAAW,gBAAgB;IAC3F,UAAU,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAC/B,SAAS,CAAC,QAAQ,EAAE,KAAK,QAAQ,GAAG,SAAS,CAAC;IAC9C,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IACzC,SAAS,CAAC,SAAS,MAAC;gBAER,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAanD,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAI9B,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAQ7B,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAA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AG,YAAY,CAwO/J;ACrRD;IACE,qCAAqC;IACrC,GAAG,EAAE,GAAG,CAAA;CACT;AAED;IACE,oDAAoD;IACpD,aAAa,EAAE,iBAAiB,CAAA;CACjC;AAGD;;;;GAIG;AACH,yCAAyC,CAAC,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,yBAAyB,CAsBjK","sources":["packages/@react-aria/grid/src/packages/@react-aria/grid/src/GridKeyboardDelegate.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/utils.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useHighlightSelectionDescription.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGrid.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridRowGroup.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridRow.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridCell.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridSelectionCheckbox.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/index.ts","packages/@react-aria/grid/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nexport {useGrid} from './useGrid';\nexport {useGridRowGroup} from './useGridRowGroup';\nexport {useGridRow} from './useGridRow';\nexport {useGridCell} from './useGridCell';\nexport {useGridSelectionCheckbox} from './useGridSelectionCheckbox';\nexport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nexport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\n\nexport type {GridProps, GridAria} from './useGrid';\nexport type {GridCellAria, GridCellProps} from './useGridCell';\nexport type {GridRowGroupAria} from './useGridRowGroup';\nexport type {GridRowProps, GridRowAria} from './useGridRow';\nexport type {GridKeyboardDelegateOptions} from './GridKeyboardDelegate';\nexport type {AriaGridSelectionCheckboxProps, GridSelectionCheckboxAria} from './useGridSelectionCheckbox';\nexport type {HighlightSelectionDescriptionProps} from './useHighlightSelectionDescription';\nexport type {GridSelectionAnnouncementProps} from './useGridSelectionAnnouncement';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;AAiBA,6CAA6C,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC;IACd,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,GAAG,CAAC,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IACzB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAC3B;AAED,kCAAkC,CAAC,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,CAAE,YAAW,gBAAgB;IAC3F,UAAU,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC7C,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAC/B,SAAS,CAAC,QAAQ,EAAE,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G,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,WAAW,CAqC5K;AC5DD;IACE,+GAA+G;IAC/G,IAAI,EAAE,SAAS,OAAO,CAAC,CAAC;IACxB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,6GAA6G;IAC7G,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,wEAAwE;IACxE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;QAII;IACJ,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB;AAED;IACE,uCAAuC;IACvC,aAAa,EAAE,aAAa,CAAC;IAC7B,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,4BAA4B,CAAC,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,YAAY,CAwO/J;ACrRD;IACE,qCAAqC;IACrC,GAAG,EAAE,GAAG,CAAA;CACT;AAED;IACE,oDAAoD;IACpD,aAAa,EAAE,iBAAiB,CAAA;CACjC;AAGD;;;;GAIG;AACH,yCAAyC,CAAC,EAAE,CAAC,SAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,yBAAyB,CAsBjK","sources":["packages/@react-aria/grid/src/packages/@react-aria/grid/src/GridKeyboardDelegate.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/utils.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useHighlightSelectionDescription.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGrid.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridRowGroup.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridRow.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridCell.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/useGridSelectionCheckbox.ts","packages/@react-aria/grid/src/packages/@react-aria/grid/src/index.ts","packages/@react-aria/grid/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nexport {useGrid} from './useGrid';\nexport {useGridRowGroup} from './useGridRowGroup';\nexport {useGridRow} from './useGridRow';\nexport {useGridCell} from './useGridCell';\nexport {useGridSelectionCheckbox} from './useGridSelectionCheckbox';\nexport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nexport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\n\nexport type {GridProps, GridAria} from './useGrid';\nexport type {GridCellAria, GridCellProps} from './useGridCell';\nexport type {GridRowGroupAria} from './useGridRowGroup';\nexport type {GridRowProps, GridRowAria} from './useGridRow';\nexport type {GridKeyboardDelegateOptions} from './GridKeyboardDelegate';\nexport type {AriaGridSelectionCheckboxProps, GridSelectionCheckboxAria} from './useGridSelectionCheckbox';\nexport type {HighlightSelectionDescriptionProps} from './useHighlightSelectionDescription';\nexport type {GridSelectionAnnouncementProps} from './useGridSelectionAnnouncement';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -34,7 +34,7 @@ $parcel$export(module.exports, "useGrid", () => $11d770dfabe45077$export$f6b86a0
34
34
 
35
35
 
36
36
  function $11d770dfabe45077$export$f6b86a04e5d66d90(props, state, ref) {
37
- let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
37
+ let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction, escapeKeyBehavior: escapeKeyBehavior = 'clearSelection' } = props;
38
38
  let { selectionManager: manager } = state;
39
39
  if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
40
40
  // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
@@ -69,7 +69,8 @@ function $11d770dfabe45077$export$f6b86a04e5d66d90(props, state, ref) {
69
69
  keyboardDelegate: delegate,
70
70
  isVirtualized: isVirtualized,
71
71
  scrollRef: scrollRef,
72
- disallowTypeAhead: disallowTypeAhead
72
+ disallowTypeAhead: disallowTypeAhead,
73
+ escapeKeyBehavior: escapeKeyBehavior
73
74
  });
74
75
  let id = (0, $lBaOG$reactariautils.useId)(props.id);
75
76
  (0, $8ee34951196858d0$exports.gridMap).set(state, {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA4DM,SAAS,0CAAW,KAAgB,EAAE,KAAsC,EAAE,GAAkC;IACrH,IAAI,iBACF,aAAa,qBACb,iBAAiB,oBACjB,gBAAgB,aAChB,SAAS,aACT,SAAS,cACT,UAAU,eACV,WAAW,gBACX,YAAY,EACb,GAAG;IACJ,IAAI,EAAC,kBAAkB,OAAO,EAAC,GAAG;IAElC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KA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CAAC,EAAE,MAAM,GACpC;QAGF,QAAQ,UAAU,CAAC;IACrB,GAAG;QAAC;KAAQ;IAEZ,qFAAqF;IACrF,IAAI,sBAAsB,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YACvC,QAAQ,gBAAgB,MAAM;qBAC9B;QACF,CAAA,GAAI;QAAC;QAAS,gBAAgB,MAAM;KAAC;IAErC,IAAI,mBAAmB,CAAA,GAAA,yCAAkB,EAAE,KAAK;QAC9C,YAAY,MAAM,UAAU,CAAC,IAAI,KAAK;IACxC;IAEA,IAAI,YAA2B,CAAA,GAAA,gCAAS,EACtC,UACA;QACE,MAAM;YACN;QACA,wBAAwB,QAAQ,aAAa,KAAK,aAAa,SAAS;IAC1E,GACA,MAAM,4BAA4B,GAAG,sBAAsB,iBAE3D,AADA,mGAAmG;IAClG,MAAM,UAAU,CAAC,IAAI,KAAK,KAAK;QAAC,UAAU,mBAAmB,KAAK;IAAC,KAAM,WAC1E;IAGF,IAAI,eAAe;QACjB,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI;QAClD,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,WAAW;IAC3D;IAEA,CAAA,GAAA,sDAA2B,EAAE;oBAAC;IAAU,GAAG;IAC3C,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/grid/src/useGrid.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Key, KeyboardDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nimport {gridMap} from './utils';\nimport {GridState} from '@react-stately/grid';\nimport {useCallback, useMemo} from 'react';\nimport {useCollator, useLocale} from '@react-aria/i18n';\nimport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface GridProps extends DOMProps, AriaLabelingProps {\n /** Whether the grid uses virtual scrolling. */\n isVirtualized?: boolean,\n /**\n * Whether typeahead navigation is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether initial grid focus should be placed on the grid row or grid cell.\n * @default 'row'\n */\n focusMode?: 'row' | 'cell',\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string,\n /**\n * The ref attached to the scrollable body. Used to provided automatic scrolling on item focus for non-virtualized grids.\n */\n scrollRef?: RefObject<HTMLElement | null>,\n /** Handler that is called when a user performs an action on the row. */\n onRowAction?: (key: Key) => void,\n /** Handler that is called when a user performs an action on the cell. */\n onCellAction?: (key: Key) => void\n}\n\nexport interface GridAria {\n /** Props for the grid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a grid component.\n * A grid displays data in one or more rows and columns and enables a user to navigate its contents via directional navigation keys.\n * @param props - Props for the grid.\n * @param state - State for the grid, as returned by `useGridState`.\n * @param ref - The ref attached to the grid element.\n */\nexport function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<T>>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n isVirtualized,\n disallowTypeAhead,\n keyboardDelegate,\n focusMode,\n scrollRef,\n getRowText,\n onRowAction,\n onCellAction\n } = props;\n let {selectionManager: manager} = state;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new GridKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n focusMode\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, focusMode]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n isVirtualized,\n scrollRef,\n disallowTypeAhead\n });\n\n let id = useId(props.id);\n gridMap.set(state, {keyboardDelegate: delegate, actions: {onRowAction, onCellAction}});\n\n let descriptionProps = useHighlightSelectionDescription({\n selectionManager: manager,\n hasItemActions: !!(onRowAction || onCellAction)\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let onFocus = useCallback((e) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n }, [manager]);\n\n // Continue to track collection focused state even if keyboard navigation is disabled\n let navDisabledHandlers = useMemo(() => ({\n onBlur: collectionProps.onBlur,\n onFocus\n }), [onFocus, collectionProps.onBlur]);\n\n let hasTabbableChild = useHasTabbableChild(ref, {\n isDisabled: state.collection.size !== 0\n });\n\n let gridProps: DOMAttributes = mergeProps(\n domProps,\n {\n role: 'grid',\n id,\n 'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined\n },\n state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,\n // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.\n (state.collection.size === 0 && {tabIndex: hasTabbableChild ? -1 : 0}) || undefined,\n descriptionProps\n );\n\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size;\n gridProps['aria-colcount'] = state.collection.columnCount;\n }\n\n useGridSelectionAnnouncement({getRowText}, state);\n return {\n gridProps\n };\n}\n"],"names":[],"version":3,"file":"useGrid.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAqEM,SAAS,0CAAW,KAAgB,EAAE,KAAsC,EAAE,GAAkC;IACrH,IAAI,iBACF,aAAa,qBACb,iBAAiB,oBACjB,gBAAgB,aAChB,SAAS,aACT,SAAS,cACT,UAAU,eACV,WAAW,gBACX,YAAY,qBACZ,oBAAoB,kBACrB,GAAG;IACJ,IAAI,EAAC,kBAAkB,OAAO,EAAC,GAAG;IAElC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACnD,QAAQ,IAAI,CAAC;IAGf,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,gCAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAM,oBAAoB,IAAI,CAAA,GAAA,8CAAmB,EAAE;YACxE,YAAY,MAAM,UAAU;YAC5B,cAAc,MAAM,YAAY;8BAChC;iBACA;uBACA;sBACA;uBACA;QACF,IAAI;QAAC;QAAkB,MAAM,UAAU;QAAE,MAAM,YAAY;QAAE;QAAkB;QAAK;QAAW;QAAU;KAAU;IAEnH,IAAI,mBAAC,eAAe,EAAC,GAAG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;QAAC,UAAU,mBAAmB,KAAK;IAAC,KAAM,WAC1E;IAGF,IAAI,eAAe;QACjB,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI;QAClD,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,WAAW;IAC3D;IAEA,CAAA,GAAA,sDAA2B,EAAE;oBAAC;IAAU,GAAG;IAC3C,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/grid/src/useGrid.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Key, KeyboardDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nimport {gridMap} from './utils';\nimport {GridState} from '@react-stately/grid';\nimport {useCallback, useMemo} from 'react';\nimport {useCollator, useLocale} from '@react-aria/i18n';\nimport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface GridProps extends DOMProps, AriaLabelingProps {\n /** Whether the grid uses virtual scrolling. */\n isVirtualized?: boolean,\n /**\n * Whether typeahead navigation is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether initial grid focus should be placed on the grid row or grid cell.\n * @default 'row'\n */\n focusMode?: 'row' | 'cell',\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string,\n /**\n * The ref attached to the scrollable body. Used to provided automatic scrolling on item focus for non-virtualized grids.\n */\n scrollRef?: RefObject<HTMLElement | null>,\n /** Handler that is called when a user performs an action on the row. */\n onRowAction?: (key: Key) => void,\n /** Handler that is called when a user performs an action on the cell. */\n onCellAction?: (key: Key) => void,\n /**\n * Whether pressing the escape key should clear selection in the grid or not.\n *\n * Most experiences should not modify this option as it eliminates a keyboard user's ability to\n * easily clear selection. Only use if the escape key is being handled externally or should not\n * trigger selection clearing contextually.\n * @default 'clearSelection'\n */\n escapeKeyBehavior?: 'clearSelection' | 'none'\n}\n\nexport interface GridAria {\n /** Props for the grid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a grid component.\n * A grid displays data in one or more rows and columns and enables a user to navigate its contents via directional navigation keys.\n * @param props - Props for the grid.\n * @param state - State for the grid, as returned by `useGridState`.\n * @param ref - The ref attached to the grid element.\n */\nexport function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<T>>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n isVirtualized,\n disallowTypeAhead,\n keyboardDelegate,\n focusMode,\n scrollRef,\n getRowText,\n onRowAction,\n onCellAction,\n escapeKeyBehavior = 'clearSelection'\n } = props;\n let {selectionManager: manager} = state;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new GridKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n focusMode\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, focusMode]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n isVirtualized,\n scrollRef,\n disallowTypeAhead,\n escapeKeyBehavior\n });\n\n let id = useId(props.id);\n gridMap.set(state, {keyboardDelegate: delegate, actions: {onRowAction, onCellAction}});\n\n let descriptionProps = useHighlightSelectionDescription({\n selectionManager: manager,\n hasItemActions: !!(onRowAction || onCellAction)\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let onFocus = useCallback((e) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n }, [manager]);\n\n // Continue to track collection focused state even if keyboard navigation is disabled\n let navDisabledHandlers = useMemo(() => ({\n onBlur: collectionProps.onBlur,\n onFocus\n }), [onFocus, collectionProps.onBlur]);\n\n let hasTabbableChild = useHasTabbableChild(ref, {\n isDisabled: state.collection.size !== 0\n });\n\n let gridProps: DOMAttributes = mergeProps(\n domProps,\n {\n role: 'grid',\n id,\n 'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined\n },\n state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,\n // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.\n (state.collection.size === 0 && {tabIndex: hasTabbableChild ? -1 : 0}) || undefined,\n descriptionProps\n );\n\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size;\n gridProps['aria-colcount'] = state.collection.columnCount;\n }\n\n useGridSelectionAnnouncement({getRowText}, state);\n return {\n gridProps\n };\n}\n"],"names":[],"version":3,"file":"useGrid.main.js.map"}
package/dist/useGrid.mjs CHANGED
@@ -28,7 +28,7 @@ import {useSelectableCollection as $eV0xE$useSelectableCollection} from "@react-
28
28
 
29
29
 
30
30
  function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
31
- let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
31
+ let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction, escapeKeyBehavior: escapeKeyBehavior = 'clearSelection' } = props;
32
32
  let { selectionManager: manager } = state;
33
33
  if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
34
34
  // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
@@ -63,7 +63,8 @@ function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
63
63
  keyboardDelegate: delegate,
64
64
  isVirtualized: isVirtualized,
65
65
  scrollRef: scrollRef,
66
- disallowTypeAhead: disallowTypeAhead
66
+ disallowTypeAhead: disallowTypeAhead,
67
+ escapeKeyBehavior: escapeKeyBehavior
67
68
  });
68
69
  let id = (0, $eV0xE$useId)(props.id);
69
70
  (0, $1af922eb41e03c8f$export$e6235c0d09b995d0).set(state, {
@@ -28,7 +28,7 @@ import {useSelectableCollection as $eV0xE$useSelectableCollection} from "@react-
28
28
 
29
29
 
30
30
  function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
31
- let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
31
+ let { isVirtualized: isVirtualized, disallowTypeAhead: disallowTypeAhead, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction, escapeKeyBehavior: escapeKeyBehavior = 'clearSelection' } = props;
32
32
  let { selectionManager: manager } = state;
33
33
  if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
34
34
  // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
@@ -63,7 +63,8 @@ function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
63
63
  keyboardDelegate: delegate,
64
64
  isVirtualized: isVirtualized,
65
65
  scrollRef: scrollRef,
66
- disallowTypeAhead: disallowTypeAhead
66
+ disallowTypeAhead: disallowTypeAhead,
67
+ escapeKeyBehavior: escapeKeyBehavior
67
68
  });
68
69
  let id = (0, $eV0xE$useId)(props.id);
69
70
  (0, $1af922eb41e03c8f$export$e6235c0d09b995d0).set(state, {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA4DM,SAAS,0CAAW,KAAgB,EAAE,KAAsC,EAAE,GAAkC;IACrH,IAAI,iBACF,aAAa,qBACb,iBAAiB,oBACjB,gBAAgB,aAChB,SAAS,aACT,SAAS,cACT,UAAU,eACV,WAAW,gBACX,YAAY,EACb,GAAG;IACJ,IAAI,EAAC,kBAAkB,OAAO,EAAC,GAAG;IAElC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACnD,QAAQ,IAAI,CAAC;IAGf,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,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C9C,YAAY,MAAM,UAAU,CAAC,IAAI,KAAK;IACxC;IAEA,IAAI,YAA2B,CAAA,GAAA,iBAAS,EACtC,UACA;QACE,MAAM;YACN;QACA,wBAAwB,QAAQ,aAAa,KAAK,aAAa,SAAS;IAC1E,GACA,MAAM,4BAA4B,GAAG,sBAAsB,iBAE3D,AADA,mGAAmG;IAClG,MAAM,UAAU,CAAC,IAAI,KAAK,KAAK;QAAC,UAAU,mBAAmB,KAAK;IAAC,KAAM,WAC1E;IAGF,IAAI,eAAe;QACjB,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI;QAClD,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,WAAW;IAC3D;IAEA,CAAA,GAAA,yCAA2B,EAAE;oBAAC;IAAU,GAAG;IAC3C,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/grid/src/useGrid.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Key, KeyboardDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nimport {gridMap} from './utils';\nimport {GridState} from '@react-stately/grid';\nimport {useCallback, useMemo} from 'react';\nimport {useCollator, useLocale} from '@react-aria/i18n';\nimport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface GridProps extends DOMProps, AriaLabelingProps {\n /** Whether the grid uses virtual scrolling. */\n isVirtualized?: boolean,\n /**\n * Whether typeahead navigation is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether initial grid focus should be placed on the grid row or grid cell.\n * @default 'row'\n */\n focusMode?: 'row' | 'cell',\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string,\n /**\n * The ref attached to the scrollable body. Used to provided automatic scrolling on item focus for non-virtualized grids.\n */\n scrollRef?: RefObject<HTMLElement | null>,\n /** Handler that is called when a user performs an action on the row. */\n onRowAction?: (key: Key) => void,\n /** Handler that is called when a user performs an action on the cell. */\n onCellAction?: (key: Key) => void\n}\n\nexport interface GridAria {\n /** Props for the grid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a grid component.\n * A grid displays data in one or more rows and columns and enables a user to navigate its contents via directional navigation keys.\n * @param props - Props for the grid.\n * @param state - State for the grid, as returned by `useGridState`.\n * @param ref - The ref attached to the grid element.\n */\nexport function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<T>>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n isVirtualized,\n disallowTypeAhead,\n keyboardDelegate,\n focusMode,\n scrollRef,\n getRowText,\n onRowAction,\n onCellAction\n } = props;\n let {selectionManager: manager} = state;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new GridKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n focusMode\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, focusMode]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n isVirtualized,\n scrollRef,\n disallowTypeAhead\n });\n\n let id = useId(props.id);\n gridMap.set(state, {keyboardDelegate: delegate, actions: {onRowAction, onCellAction}});\n\n let descriptionProps = useHighlightSelectionDescription({\n selectionManager: manager,\n hasItemActions: !!(onRowAction || onCellAction)\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let onFocus = useCallback((e) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n }, [manager]);\n\n // Continue to track collection focused state even if keyboard navigation is disabled\n let navDisabledHandlers = useMemo(() => ({\n onBlur: collectionProps.onBlur,\n onFocus\n }), [onFocus, collectionProps.onBlur]);\n\n let hasTabbableChild = useHasTabbableChild(ref, {\n isDisabled: state.collection.size !== 0\n });\n\n let gridProps: DOMAttributes = mergeProps(\n domProps,\n {\n role: 'grid',\n id,\n 'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined\n },\n state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,\n // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.\n (state.collection.size === 0 && {tabIndex: hasTabbableChild ? -1 : 0}) || undefined,\n descriptionProps\n );\n\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size;\n gridProps['aria-colcount'] = state.collection.columnCount;\n }\n\n useGridSelectionAnnouncement({getRowText}, state);\n return {\n gridProps\n };\n}\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sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Key, KeyboardDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nimport {gridMap} from './utils';\nimport {GridState} from '@react-stately/grid';\nimport {useCallback, useMemo} from 'react';\nimport {useCollator, useLocale} from '@react-aria/i18n';\nimport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface GridProps extends DOMProps, AriaLabelingProps {\n /** Whether the grid uses virtual scrolling. */\n isVirtualized?: boolean,\n /**\n * Whether typeahead navigation is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether initial grid focus should be placed on the grid row or grid cell.\n * @default 'row'\n */\n focusMode?: 'row' | 'cell',\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string,\n /**\n * The ref attached to the scrollable body. Used to provided automatic scrolling on item focus for non-virtualized grids.\n */\n scrollRef?: RefObject<HTMLElement | null>,\n /** Handler that is called when a user performs an action on the row. */\n onRowAction?: (key: Key) => void,\n /** Handler that is called when a user performs an action on the cell. */\n onCellAction?: (key: Key) => void,\n /**\n * Whether pressing the escape key should clear selection in the grid or not.\n *\n * Most experiences should not modify this option as it eliminates a keyboard user's ability to\n * easily clear selection. Only use if the escape key is being handled externally or should not\n * trigger selection clearing contextually.\n * @default 'clearSelection'\n */\n escapeKeyBehavior?: 'clearSelection' | 'none'\n}\n\nexport interface GridAria {\n /** Props for the grid element. */\n gridProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a grid component.\n * A grid displays data in one or more rows and columns and enables a user to navigate its contents via directional navigation keys.\n * @param props - Props for the grid.\n * @param state - State for the grid, as returned by `useGridState`.\n * @param ref - The ref attached to the grid element.\n */\nexport function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<T>>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n isVirtualized,\n disallowTypeAhead,\n keyboardDelegate,\n focusMode,\n scrollRef,\n getRowText,\n onRowAction,\n onCellAction,\n escapeKeyBehavior = 'clearSelection'\n } = props;\n let {selectionManager: manager} = state;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new GridKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n focusMode\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, focusMode]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n isVirtualized,\n scrollRef,\n disallowTypeAhead,\n escapeKeyBehavior\n });\n\n let id = useId(props.id);\n gridMap.set(state, {keyboardDelegate: delegate, actions: {onRowAction, onCellAction}});\n\n let descriptionProps = useHighlightSelectionDescription({\n selectionManager: manager,\n hasItemActions: !!(onRowAction || onCellAction)\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let onFocus = useCallback((e) => {\n if (manager.isFocused) {\n // If a focus event bubbled through a portal, reset focus state.\n if (!e.currentTarget.contains(e.target)) {\n manager.setFocused(false);\n }\n\n return;\n }\n\n // Focus events can bubble through portals. Ignore these events.\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n\n manager.setFocused(true);\n }, [manager]);\n\n // Continue to track collection focused state even if keyboard navigation is disabled\n let navDisabledHandlers = useMemo(() => ({\n onBlur: collectionProps.onBlur,\n onFocus\n }), [onFocus, collectionProps.onBlur]);\n\n let hasTabbableChild = useHasTabbableChild(ref, {\n isDisabled: state.collection.size !== 0\n });\n\n let gridProps: DOMAttributes = mergeProps(\n domProps,\n {\n role: 'grid',\n id,\n 'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined\n },\n state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,\n // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.\n (state.collection.size === 0 && {tabIndex: hasTabbableChild ? -1 : 0}) || undefined,\n descriptionProps\n );\n\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size;\n gridProps['aria-colcount'] = state.collection.columnCount;\n }\n\n useGridSelectionAnnouncement({getRowText}, state);\n return {\n gridProps\n };\n}\n"],"names":[],"version":3,"file":"useGrid.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BM,SAAS,0CAAgC,KAAqC,EAAE,KAA4B;IACjH,IAAI,cACF,aAAa,CAAC;YAAQ,gCAAA,mBAAwC;YAAxC;eAAA,CAAA,mCAAA,iCAAA,CAAA,oBAAA,MAAM,UAAU,EAAC,YAAY,cAA7B,qDAAA,oCAAA,mBAAgC,kBAAhC,6CAAA,mCAAwC,4BAAA,MAAM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Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {Collection, Key, Node, Selection} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SelectionManager} from '@react-stately/selection';\nimport {useEffectEvent, useUpdateEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useRef} from 'react';\n\nexport interface GridSelectionAnnouncementProps {\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string\n}\n\ninterface GridSelectionState<T> {\n /** A collection of items in the grid. */\n collection: Collection<Node<T>>,\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\nexport function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>) {\n let {\n getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n // Many screen readers do not announce when items in a grid are selected/deselected.\n // We do this using an ARIA live region.\n let selection = state.selectionManager.rawSelection;\n let lastSelection = useRef(selection);\n let announceSelectionChange = useEffectEvent(() => {\n if (!state.selectionManager.isFocused || selection === lastSelection.current) {\n lastSelection.current = selection;\n\n return;\n }\n\n let addedKeys = diffSelection(selection, lastSelection.current);\n let removedKeys = diffSelection(lastSelection.current, selection);\n\n // If adding or removing a single row from the selection, announce the name of that item.\n let isReplace = state.selectionManager.selectionBehavior === 'replace';\n let messages: string[] = [];\n\n if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {\n if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {\n let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);\n if (currentSelectionText) {\n messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));\n }\n }\n } else if (addedKeys.size === 1 && removedKeys.size === 0) {\n let addedText = getRowText(addedKeys.keys().next().value);\n if (addedText) {\n messages.push(stringFormatter.format('selectedItem', {item: addedText}));\n }\n } else if (removedKeys.size === 1 && addedKeys.size === 0) {\n if (state.collection.getItem(removedKeys.keys().next().value)) {\n let removedText = getRowText(removedKeys.keys().next().value);\n if (removedText) {\n messages.push(stringFormatter.format('deselectedItem', {item: removedText}));\n }\n }\n }\n\n // Announce how many items are selected, except when selecting the first item.\n if (state.selectionManager.selectionMode === 'multiple') {\n if (messages.length === 0 || selection === 'all' || selection.size > 1 || lastSelection.current === 'all' || lastSelection.current?.size > 1) {\n messages.push(selection === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selectedCount', {count: selection.size})\n );\n }\n }\n\n if (messages.length > 0) {\n announce(messages.join(' '));\n }\n\n lastSelection.current = selection;\n });\n\n useUpdateEffect(() => {\n if (state.selectionManager.isFocused) {\n announceSelectionChange();\n } else {\n // Wait a frame in case the collection is about to become focused (e.g. on mouse down).\n let raf = requestAnimationFrame(announceSelectionChange);\n return () => cancelAnimationFrame(raf);\n }\n }, [selection, state.selectionManager.isFocused]);\n}\n\nfunction diffSelection(a: Selection, b: Selection): Set<Key> {\n let res = new Set<Key>();\n if (a === 'all' || b === 'all') {\n return res;\n }\n\n for (let key of a.keys()) {\n if (!b.has(key)) {\n res.add(key);\n }\n }\n\n return res;\n}\n"],"names":[],"version":3,"file":"useGridSelectionAnnouncement.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BM,SAAS,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AAI,MAAM,SAAS,MAAM,OACvB,OAAO;IAGT,KAAK,IAAI,OAAO,EAAE,IAAI,GACpB,IAAI,CAAC,EAAE,GAAG,CAAC,MACT,IAAI,GAAG,CAAC;IAIZ,OAAO;AACT","sources":["packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {Collection, Key, Node, Selection} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SelectionManager} from '@react-stately/selection';\nimport {useEffectEvent, useUpdateEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useRef} from 'react';\n\nexport interface GridSelectionAnnouncementProps {\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string\n}\n\ninterface GridSelectionState<T> {\n /** A collection of items in the grid. */\n collection: Collection<Node<T>>,\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\nexport function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>): void {\n let {\n getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n // Many screen readers do not announce when items in a grid are selected/deselected.\n // We do this using an ARIA live region.\n let selection = state.selectionManager.rawSelection;\n let lastSelection = useRef(selection);\n let announceSelectionChange = useEffectEvent(() => {\n if (!state.selectionManager.isFocused || selection === lastSelection.current) {\n lastSelection.current = selection;\n\n return;\n }\n\n let addedKeys = diffSelection(selection, lastSelection.current);\n let removedKeys = diffSelection(lastSelection.current, selection);\n\n // If adding or removing a single row from the selection, announce the name of that item.\n let isReplace = state.selectionManager.selectionBehavior === 'replace';\n let messages: string[] = [];\n\n if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {\n if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {\n let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);\n if (currentSelectionText) {\n messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));\n }\n }\n } else if (addedKeys.size === 1 && removedKeys.size === 0) {\n let addedText = getRowText(addedKeys.keys().next().value);\n if (addedText) {\n messages.push(stringFormatter.format('selectedItem', {item: addedText}));\n }\n } else if (removedKeys.size === 1 && addedKeys.size === 0) {\n if (state.collection.getItem(removedKeys.keys().next().value)) {\n let removedText = getRowText(removedKeys.keys().next().value);\n if (removedText) {\n messages.push(stringFormatter.format('deselectedItem', {item: removedText}));\n }\n }\n }\n\n // Announce how many items are selected, except when selecting the first item.\n if (state.selectionManager.selectionMode === 'multiple') {\n if (messages.length === 0 || selection === 'all' || selection.size > 1 || lastSelection.current === 'all' || lastSelection.current?.size > 1) {\n messages.push(selection === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selectedCount', {count: selection.size})\n );\n }\n }\n\n if (messages.length > 0) {\n announce(messages.join(' '));\n }\n\n lastSelection.current = selection;\n });\n\n useUpdateEffect(() => {\n if (state.selectionManager.isFocused) {\n announceSelectionChange();\n } else {\n // Wait a frame in case the collection is about to become focused (e.g. on mouse down).\n let raf = requestAnimationFrame(announceSelectionChange);\n return () => cancelAnimationFrame(raf);\n }\n }, [selection, state.selectionManager.isFocused]);\n}\n\nfunction diffSelection(a: Selection, b: Selection): Set<Key> {\n let res = new Set<Key>();\n if (a === 'all' || b === 'all') {\n return res;\n }\n\n for (let key of a.keys()) {\n if (!b.has(key)) {\n res.add(key);\n }\n }\n\n return res;\n}\n"],"names":[],"version":3,"file":"useGridSelectionAnnouncement.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BM,SAAS,0CAAgC,KAAqC,EAAE,KAA4B;IACjH,IAAI,cACF,aAAa,CAAC;YAAQ,gCAAA,mBAAwC;YAAxC;eAAA,CAAA,mCAAA,iCAAA,CAAA,oBAAA,MAAM,UAAU,EAAC,YAAY,cAA7B,qDAAA,oCAAA,mBAAgC,kBAAhC,6CAAA,mCAAwC,4BAAA,MAAM,UAAU,CAAC,OAAO,CAAC,kBAAzB,gDAAA,0BAA+B,SAAS;OACvG,GAAG;IACJ,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,oFAAoF;IACpF,wCAAwC;IACxC,IAAI,YAAY,MAAM,gBAAgB,CAAC,YAAY;IACnD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,0BAA0B,CAAA,GAAA,qBAAa,EAAE;YAqCoE;QApC/G,IAAI,CAAC,MAAM,gBAAgB,CAAC,SAAS,IAAI,cAAc,cAAc,OAAO,EAAE;YAC5E,cAAc,OAAO,GAAG;YAExB;QACF;QAEA,IAAI,YAAY,oCAAc,WAAW,cAAc,OAAO;QAC9D,IAAI,cAAc,oCAAc,cAAc,OAAO,EAAE;QAEvD,yFAAyF;QACzF,IAAI,YAAY,MAAM,gBAAgB,CAAC,iBAAiB,KAAK;QAC7D,IAAI,WAAqB,EAAE;QAE3B,IAAK,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,KAAK,KAAK,WACrD;YAAA,IAAI,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,gBAAgB,CAAC,YAAY,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG;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AC,SAAS,EAClC;aACK;YACL,uFAAuF;YACvF,IAAI,MAAM,sBAAsB;YAChC,OAAO,IAAM,qBAAqB;QACpC;IACF,GAAG;QAAC;QAAW,MAAM,gBAAgB,CAAC,SAAS;KAAC;AAClD;AAEA,SAAS,oCAAc,CAAY,EAAE,CAAY;IAC/C,IAAI,MAAM,IAAI;IACd,IAAI,MAAM,SAAS,MAAM,OACvB,OAAO;IAGT,KAAK,IAAI,OAAO,EAAE,IAAI,GACpB,IAAI,CAAC,EAAE,GAAG,CAAC,MACT,IAAI,GAAG,CAAC;IAIZ,OAAO;AACT","sources":["packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {Collection, Key, Node, Selection} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SelectionManager} from '@react-stately/selection';\nimport {useEffectEvent, useUpdateEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useRef} from 'react';\n\nexport interface GridSelectionAnnouncementProps {\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string\n}\n\ninterface GridSelectionState<T> {\n /** A collection of items in the grid. */\n collection: Collection<Node<T>>,\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\nexport function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>) {\n let {\n getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n // Many screen readers do not announce when items in a grid are selected/deselected.\n // We do this using an ARIA live region.\n let selection = state.selectionManager.rawSelection;\n let lastSelection = useRef(selection);\n let announceSelectionChange = useEffectEvent(() => {\n if (!state.selectionManager.isFocused || selection === lastSelection.current) {\n lastSelection.current = selection;\n\n return;\n }\n\n let addedKeys = diffSelection(selection, lastSelection.current);\n let removedKeys = diffSelection(lastSelection.current, selection);\n\n // If adding or removing a single row from the selection, announce the name of that item.\n let isReplace = state.selectionManager.selectionBehavior === 'replace';\n let messages: string[] = [];\n\n if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {\n if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {\n let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);\n if (currentSelectionText) {\n messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));\n }\n }\n } else if (addedKeys.size === 1 && removedKeys.size === 0) {\n let addedText = getRowText(addedKeys.keys().next().value);\n if (addedText) {\n messages.push(stringFormatter.format('selectedItem', {item: addedText}));\n }\n } else if (removedKeys.size === 1 && addedKeys.size === 0) {\n if (state.collection.getItem(removedKeys.keys().next().value)) {\n let removedText = getRowText(removedKeys.keys().next().value);\n if (removedText) {\n messages.push(stringFormatter.format('deselectedItem', {item: removedText}));\n }\n }\n }\n\n // Announce how many items are selected, except when selecting the first item.\n if (state.selectionManager.selectionMode === 'multiple') {\n if (messages.length === 0 || selection === 'all' || selection.size > 1 || lastSelection.current === 'all' || lastSelection.current?.size > 1) {\n messages.push(selection === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selectedCount', {count: selection.size})\n );\n }\n }\n\n if (messages.length > 0) {\n announce(messages.join(' '));\n }\n\n lastSelection.current = selection;\n });\n\n useUpdateEffect(() => {\n if (state.selectionManager.isFocused) {\n announceSelectionChange();\n } else {\n // Wait a frame in case the collection is about to become focused (e.g. on mouse down).\n let raf = requestAnimationFrame(announceSelectionChange);\n return () => cancelAnimationFrame(raf);\n }\n }, [selection, state.selectionManager.isFocused]);\n}\n\nfunction diffSelection(a: Selection, b: Selection): Set<Key> {\n let res = new Set<Key>();\n if (a === 'all' || b === 'all') {\n return res;\n }\n\n for (let key of a.keys()) {\n if (!b.has(key)) {\n res.add(key);\n }\n }\n\n return res;\n}\n"],"names":[],"version":3,"file":"useGridSelectionAnnouncement.module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BM,SAAS,0CAAgC,KAAqC,EAAE,KAA4B;IACjH,IAAI,cACF,aAAa,CAAC;YAAQ,gCAAA,mBAAwC;YAAxC;eAAA,CAAA,mCAAA,iCAAA,CAAA,oBAAA,MAAM,UAAU,EAAC,YAAY,cAA7B,qDAAA,oCAAA,mBAAgC,kBAAhC,6CAAA,mCAAwC,4BAAA,MAAM,UAAU,CAAC,OAAO,CAAC,kBAAzB,gDAAA,0BAA+B,SAAS;OACvG,GAAG;IACJ,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAEhE,oFAAoF;IACpF,wCAAwC;IACxC,IAAI,YAAY,MAAM,gBAAgB,CAAC,YAAY;IACnD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,0BAA0B,CAAA,GAAA,qBAAa,EAAE;YAqCoE;QApC/G,IAAI,CAAC,MAAM,gBAAgB,CAAC,SAAS,IAAI,cAAc,cAAc,OAAO,EAAE;YAC5E,cAAc,OAAO,GAAG;YAExB;QACF;QAEA,IAAI,YAAY,oCAAc,WAAW,cAAc,OAAO;QAC9D,IAAI,cAAc,oCAAc,cAAc,OAAO,EAAE;QAEvD,yFAAyF;QACzF,IAAI,YAAY,MAAM,gBAAgB,CAAC,iBAAiB,KAAK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gBAAC,OAAO,UAAU,IAAI;YAAA;QAEpE;QAGF,IAAI,SAAS,MAAM,GAAG,GACpB,CAAA,GAAA,eAAO,EAAE,SAAS,IAAI,CAAC;QAGzB,cAAc,OAAO,GAAG;IAC1B;IAEA,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,MAAM,gBAAgB,CAAC,SAAS,EAClC;aACK;YACL,uFAAuF;YACvF,IAAI,MAAM,sBAAsB;YAChC,OAAO,IAAM,qBAAqB;QACpC;IACF,GAAG;QAAC;QAAW,MAAM,gBAAgB,CAAC,SAAS;KAAC;AAClD;AAEA,SAAS,oCAAc,CAAY,EAAE,CAAY;IAC/C,IAAI,MAAM,IAAI;IACd,IAAI,MAAM,SAAS,MAAM,OACvB,OAAO;IAGT,KAAK,IAAI,OAAO,EAAE,IAAI,GACpB,IAAI,CAAC,EAAE,GAAG,CAAC,MACT,IAAI,GAAG,CAAC;IAIZ,OAAO;AACT","sources":["packages/@react-aria/grid/src/useGridSelectionAnnouncement.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {Collection, Key, Node, Selection} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {SelectionManager} from '@react-stately/selection';\nimport {useEffectEvent, useUpdateEffect} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useRef} from 'react';\n\nexport interface GridSelectionAnnouncementProps {\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string\n}\n\ninterface GridSelectionState<T> {\n /** A collection of items in the grid. */\n collection: Collection<Node<T>>,\n /** A set of items that are disabled. */\n disabledKeys: Set<Key>,\n /** A selection manager to read and update multiple selection state. */\n selectionManager: SelectionManager\n}\n\nexport function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>): void {\n let {\n getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue\n } = props;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n\n // Many screen readers do not announce when items in a grid are selected/deselected.\n // We do this using an ARIA live region.\n let selection = state.selectionManager.rawSelection;\n let lastSelection = useRef(selection);\n let announceSelectionChange = useEffectEvent(() => {\n if (!state.selectionManager.isFocused || selection === lastSelection.current) {\n lastSelection.current = selection;\n\n return;\n }\n\n let addedKeys = diffSelection(selection, lastSelection.current);\n let removedKeys = diffSelection(lastSelection.current, selection);\n\n // If adding or removing a single row from the selection, announce the name of that item.\n let isReplace = state.selectionManager.selectionBehavior === 'replace';\n let messages: string[] = [];\n\n if ((state.selectionManager.selectedKeys.size === 1 && isReplace)) {\n if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {\n let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);\n if (currentSelectionText) {\n messages.push(stringFormatter.format('selectedItem', {item: currentSelectionText}));\n }\n }\n } else if (addedKeys.size === 1 && removedKeys.size === 0) {\n let addedText = getRowText(addedKeys.keys().next().value);\n if (addedText) {\n messages.push(stringFormatter.format('selectedItem', {item: addedText}));\n }\n } else if (removedKeys.size === 1 && addedKeys.size === 0) {\n if (state.collection.getItem(removedKeys.keys().next().value)) {\n let removedText = getRowText(removedKeys.keys().next().value);\n if (removedText) {\n messages.push(stringFormatter.format('deselectedItem', {item: removedText}));\n }\n }\n }\n\n // Announce how many items are selected, except when selecting the first item.\n if (state.selectionManager.selectionMode === 'multiple') {\n if (messages.length === 0 || selection === 'all' || selection.size > 1 || lastSelection.current === 'all' || lastSelection.current?.size > 1) {\n messages.push(selection === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selectedCount', {count: selection.size})\n );\n }\n }\n\n if (messages.length > 0) {\n announce(messages.join(' '));\n }\n\n lastSelection.current = selection;\n });\n\n useUpdateEffect(() => {\n if (state.selectionManager.isFocused) {\n announceSelectionChange();\n } else {\n // Wait a frame in case the collection is about to become focused (e.g. on mouse down).\n let raf = requestAnimationFrame(announceSelectionChange);\n return () => cancelAnimationFrame(raf);\n }\n }, [selection, state.selectionManager.isFocused]);\n}\n\nfunction diffSelection(a: Selection, b: Selection): Set<Key> {\n let res = new Set<Key>();\n if (a === 'all' || b === 'all') {\n return res;\n }\n\n for (let key of a.keys()) {\n if (!b.has(key)) {\n res.add(key);\n }\n }\n\n return res;\n}\n"],"names":[],"version":3,"file":"useGridSelectionAnnouncement.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/grid",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,18 +22,18 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.20.0",
26
- "@react-aria/i18n": "^3.12.6",
27
- "@react-aria/interactions": "^3.24.0",
28
- "@react-aria/live-announcer": "^3.4.1",
29
- "@react-aria/selection": "^3.23.0",
30
- "@react-aria/utils": "^3.28.0",
31
- "@react-stately/collections": "^3.12.2",
32
- "@react-stately/grid": "^3.11.0",
33
- "@react-stately/selection": "^3.20.0",
34
- "@react-types/checkbox": "^3.9.2",
35
- "@react-types/grid": "^3.3.0",
36
- "@react-types/shared": "^3.28.0",
25
+ "@react-aria/focus": "^3.20.2",
26
+ "@react-aria/i18n": "^3.12.8",
27
+ "@react-aria/interactions": "^3.25.0",
28
+ "@react-aria/live-announcer": "^3.4.2",
29
+ "@react-aria/selection": "^3.24.0",
30
+ "@react-aria/utils": "^3.28.2",
31
+ "@react-stately/collections": "^3.12.3",
32
+ "@react-stately/grid": "^3.11.1",
33
+ "@react-stately/selection": "^3.20.1",
34
+ "@react-types/checkbox": "^3.9.3",
35
+ "@react-types/grid": "^3.3.1",
36
+ "@react-types/shared": "^3.29.0",
37
37
  "@swc/helpers": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
46
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
47
47
  }
@@ -50,11 +50,11 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
50
50
  this.focusMode = options.focusMode || 'row';
51
51
  }
52
52
 
53
- protected isCell(node: Node<T>) {
53
+ protected isCell(node: Node<T>): boolean {
54
54
  return node.type === 'cell';
55
55
  }
56
56
 
57
- protected isRow(node: Node<T>) {
57
+ protected isRow(node: Node<T>): boolean {
58
58
  return node.type === 'row' || node.type === 'item';
59
59
  }
60
60
 
@@ -62,7 +62,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
62
62
  return this.disabledBehavior === 'all' && (item.props?.isDisabled || this.disabledKeys.has(item.key));
63
63
  }
64
64
 
65
- protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {
65
+ protected findPreviousKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {
66
66
  let key = fromKey != null
67
67
  ? this.collection.getKeyBefore(fromKey)
68
68
  : this.collection.getLastKey();
@@ -81,7 +81,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
81
81
  return null;
82
82
  }
83
83
 
84
- protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean) {
84
+ protected findNextKey(fromKey?: Key, pred?: (item: Node<T>) => boolean): Key | null {
85
85
  let key = fromKey != null
86
86
  ? this.collection.getKeyAfter(fromKey)
87
87
  : this.collection.getFirstKey();
@@ -132,7 +132,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
132
132
  return null;
133
133
  }
134
134
 
135
- getKeyBelow(fromKey: Key) {
135
+ getKeyBelow(fromKey: Key): Key | null {
136
136
  let key: Key | null = fromKey;
137
137
  let startItem = this.collection.getItem(key);
138
138
  if (!startItem) {
@@ -164,7 +164,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
164
164
  return null;
165
165
  }
166
166
 
167
- getKeyAbove(fromKey: Key) {
167
+ getKeyAbove(fromKey: Key): Key | null {
168
168
  let key: Key | null = fromKey;
169
169
  let startItem = this.collection.getItem(key);
170
170
  if (!startItem) {
@@ -196,7 +196,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
196
196
  return null;
197
197
  }
198
198
 
199
- getKeyRightOf(key: Key) {
199
+ getKeyRightOf(key: Key): Key | null {
200
200
  let item = this.collection.getItem(key);
201
201
  if (!item) {
202
202
  return null;
@@ -236,7 +236,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
236
236
  return null;
237
237
  }
238
238
 
239
- getKeyLeftOf(key: Key) {
239
+ getKeyLeftOf(key: Key): Key | null {
240
240
  let item = this.collection.getItem(key);
241
241
  if (!item) {
242
242
  return null;
@@ -276,7 +276,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
276
276
  return null;
277
277
  }
278
278
 
279
- getFirstKey(fromKey?: Key, global?: boolean) {
279
+ getFirstKey(fromKey?: Key, global?: boolean): Key | null {
280
280
  let key: Key | null = fromKey ?? null;
281
281
  let item: Node<T> | undefined | null;
282
282
  if (key != null) {
@@ -312,7 +312,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
312
312
  return key;
313
313
  }
314
314
 
315
- getLastKey(fromKey?: Key, global?: boolean) {
315
+ getLastKey(fromKey?: Key, global?: boolean): Key | null {
316
316
  let key: Key | null = fromKey ?? null;
317
317
  let item: Node<T> | undefined | null;
318
318
  if (key != null) {
@@ -350,7 +350,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
350
350
  return key;
351
351
  }
352
352
 
353
- getKeyPageAbove(fromKey: Key) {
353
+ getKeyPageAbove(fromKey: Key): Key | null {
354
354
  let key: Key | null = fromKey;
355
355
  let itemRect = this.layoutDelegate.getItemRect(key);
356
356
  if (!itemRect) {
@@ -370,7 +370,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
370
370
  return key;
371
371
  }
372
372
 
373
- getKeyPageBelow(fromKey: Key) {
373
+ getKeyPageBelow(fromKey: Key): Key | null {
374
374
  let key: Key | null = fromKey;
375
375
  let itemRect = this.layoutDelegate.getItemRect(key);
376
376
 
@@ -395,7 +395,7 @@ export class GridKeyboardDelegate<T, C extends GridCollection<T>> implements Key
395
395
  return key;
396
396
  }
397
397
 
398
- getKeyForSearch(search: string, fromKey?: Key) {
398
+ getKeyForSearch(search: string, fromKey?: Key): Key | null {
399
399
  let key: Key | null = fromKey ?? null;
400
400
  if (!this.collator) {
401
401
  return null;
package/src/useGrid.ts CHANGED
@@ -53,7 +53,16 @@ export interface GridProps extends DOMProps, AriaLabelingProps {
53
53
  /** Handler that is called when a user performs an action on the row. */
54
54
  onRowAction?: (key: Key) => void,
55
55
  /** Handler that is called when a user performs an action on the cell. */
56
- onCellAction?: (key: Key) => void
56
+ onCellAction?: (key: Key) => void,
57
+ /**
58
+ * Whether pressing the escape key should clear selection in the grid or not.
59
+ *
60
+ * Most experiences should not modify this option as it eliminates a keyboard user's ability to
61
+ * easily clear selection. Only use if the escape key is being handled externally or should not
62
+ * trigger selection clearing contextually.
63
+ * @default 'clearSelection'
64
+ */
65
+ escapeKeyBehavior?: 'clearSelection' | 'none'
57
66
  }
58
67
 
59
68
  export interface GridAria {
@@ -77,7 +86,8 @@ export function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<
77
86
  scrollRef,
78
87
  getRowText,
79
88
  onRowAction,
80
- onCellAction
89
+ onCellAction,
90
+ escapeKeyBehavior = 'clearSelection'
81
91
  } = props;
82
92
  let {selectionManager: manager} = state;
83
93
 
@@ -106,7 +116,8 @@ export function useGrid<T>(props: GridProps, state: GridState<T, GridCollection<
106
116
  keyboardDelegate: delegate,
107
117
  isVirtualized,
108
118
  scrollRef,
109
- disallowTypeAhead
119
+ disallowTypeAhead,
120
+ escapeKeyBehavior
110
121
  });
111
122
 
112
123
  let id = useId(props.id);
@@ -36,7 +36,7 @@ interface GridSelectionState<T> {
36
36
  selectionManager: SelectionManager
37
37
  }
38
38
 
39
- export function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>) {
39
+ export function useGridSelectionAnnouncement<T>(props: GridSelectionAnnouncementProps, state: GridSelectionState<T>): void {
40
40
  let {
41
41
  getRowText = (key) => state.collection.getTextValue?.(key) ?? state.collection.getItem(key)?.textValue
42
42
  } = props;