@react-aria/table 3.16.1 → 3.17.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.
@@ -29,15 +29,13 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
29
29
  // If focus was on a column, then focus the first child column if any,
30
30
  // or find the corresponding cell in the first row.
31
31
  if (startItem.type === 'column') {
32
- var _getNthItem;
33
32
  let child = (0, $heEpC$reactstatelycollections.getFirstItem)((0, $heEpC$reactstatelycollections.getChildNodes)(startItem, this.collection));
34
33
  if (child) return child.key;
35
34
  let firstKey = this.getFirstKey();
36
35
  if (firstKey == null) return null;
37
36
  let firstItem = this.collection.getItem(firstKey);
38
37
  if (!firstItem) return null;
39
- var _getNthItem_key;
40
- return (_getNthItem_key = (_getNthItem = (0, $heEpC$reactstatelycollections.getNthItem)((0, $heEpC$reactstatelycollections.getChildNodes)(firstItem, this.collection), startItem.index)) === null || _getNthItem === void 0 ? void 0 : _getNthItem.key) !== null && _getNthItem_key !== void 0 ? _getNthItem_key : null;
38
+ return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
41
39
  }
42
40
  return super.getKeyBelow(key);
43
41
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAOM,MAAM,kDAAiC,CAAA,GAAA,yCAAmB;IAErD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK,UAAU,KAAK,IAAI,KAAK,eAAe,KAAK,IAAI,KAAK;IAC5E;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WACH,OAAO;QAGT,sEAAsE;QACtE,mDAAmD;QACnD,IAAI,UAAU,IAAI,KAAK,UAAU;gBAexB;YAdP,IAAI,QAAQ,CAAA,GAAA,2CAAW,EAAE,CAAA,GAAA,4CAAY,EAAE,WAAW,IAAI,CAAC,U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YACF;YAEA,MAAM,IAAI,CAAC,WAAW,CAAC;YAEvB,sDAAsD;YACtD,IAAI,OAAO,QAAQ,CAAC,YAAY;gBAC9B,MAAM,IAAI,CAAC,WAAW;gBACtB,aAAa;YACf;QACF;QAEA,OAAO;IACT;AACF","sources":["packages/@react-aria/table/src/TableKeyboardDelegate.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 {getChildNodes, getFirstItem, getNthItem} from '@react-stately/collections';\nimport {GridKeyboardDelegate} from '@react-aria/grid';\nimport {Key, Node} from '@react-types/shared';\nimport {TableCollection} from '@react-types/table';\n\nexport class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableCollection<T>> {\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';\n }\n\n getKeyBelow(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, then focus the first child column if any,\n // or find the corresponding cell in the first row.\n if (startItem.type === 'column') {\n let child = getFirstItem(getChildNodes(startItem, this.collection));\n if (child) {\n return child.key;\n }\n\n let firstKey = this.getFirstKey();\n if (firstKey == null) {\n return null;\n }\n\n let firstItem = this.collection.getItem(firstKey);\n if (!firstItem) {\n return null;\n }\n return getNthItem(getChildNodes(firstItem, this.collection), startItem.index)?.key ?? null;\n }\n\n return super.getKeyBelow(key);\n }\n\n getKeyAbove(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, focus the parent column if any\n if (startItem.type === 'column') {\n let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;\n if (parent && parent.type === 'column') {\n return parent.key;\n }\n\n return null;\n }\n\n // only return above row key if not header row\n let superKey = super.getKeyAbove(key);\n let superItem = superKey != null ? this.collection.getItem(superKey) : null;\n if (superItem && superItem.type !== 'headerrow') {\n return superKey;\n }\n\n // If no item was found, and focus was on a cell, then focus the\n // corresponding column header.\n if (this.isCell(startItem)) {\n return this.collection.columns[startItem.index].key;\n }\n\n // If focus was on a row, then focus the first column header.\n return this.collection.columns[0].key;\n }\n\n private findNextColumnKey(column: Node<T>) {\n // Search following columns\n let key = this.findNextKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the first column\n let row = this.collection.headerRows[column.level];\n for (let item of getChildNodes(row, this.collection)) {\n if (item.type === 'column') {\n return item.key;\n }\n }\n\n return null;\n }\n\n private findPreviousColumnKey(column: Node<T>) {\n // Search previous columns\n let key = this.findPreviousKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the last column\n let row = this.collection.headerRows[column.level];\n let childNodes = [...getChildNodes(row, this.collection)];\n for (let i = childNodes.length - 1; i >= 0; i--) {\n let item = childNodes[i];\n if (item.type === 'column') {\n return item.key;\n }\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 was on a column, then focus the next column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findPreviousColumnKey(item)\n : this.findNextColumnKey(item);\n }\n\n return super.getKeyRightOf(key);\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus was on a column, then focus the previous column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findNextColumnKey(item)\n : this.findPreviousColumnKey(item);\n }\n\n return super.getKeyLeftOf(key);\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let 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?.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 each of the row header cells in this row for a match\n for (let cell of getChildNodes(item, this.collection)) {\n let column = collection.columns[cell.index];\n if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n let substring = cell.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n // If we started on a cell, end on the matching cell. Otherwise, end on the row.\n let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;\n return fromItem?.type === 'cell'\n ? cell.key\n : item.key;\n }\n }\n }\n\n key = this.getKeyBelow(key);\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"],"names":[],"version":3,"file":"TableKeyboardDelegate.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAOM,MAAM,kDAAiC,CAAA,GAAA,yCAAmB;IAErD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK,UAAU,KAAK,IAAI,KAAK,eAAe,KAAK,IAAI,KAAK;IAC5E;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WACH,OAAO;QAGT,sEAAsE;QACtE,mDAAmD;QACnD,IAAI,UAAU,IAAI,KAAK,UAAU;YAC/B,IAAI,QAAQ,CAAA,GAAA,2CAAW,EAAE,CAAA,GAAA,4CAAY,EAAE,WAAW,IAAI,CAAC,UAAU;YACjE,IAAI,OACF,OAAO,MAAM,GAAG;YAGlB,IAAI,WAAW,IAAI,CAAC,WAAW;YAC/B,IAAI,YAAY,MACd,OAAO;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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 {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {GridKeyboardDelegate} from '@react-aria/grid';\nimport {Key, Node} from '@react-types/shared';\nimport {TableCollection} from '@react-types/table';\n\nexport class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableCollection<T>> {\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';\n }\n\n getKeyBelow(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, then focus the first child column if any,\n // or find the corresponding cell in the first row.\n if (startItem.type === 'column') {\n let child = getFirstItem(getChildNodes(startItem, this.collection));\n if (child) {\n return child.key;\n }\n\n let firstKey = this.getFirstKey();\n if (firstKey == null) {\n return null;\n }\n\n let firstItem = this.collection.getItem(firstKey);\n if (!firstItem) {\n return null;\n }\n\n return super.getKeyForItemInRowByIndex(firstKey, startItem.index);\n }\n\n return super.getKeyBelow(key);\n }\n\n getKeyAbove(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, focus the parent column if any\n if (startItem.type === 'column') {\n let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;\n if (parent && parent.type === 'column') {\n return parent.key;\n }\n\n return null;\n }\n\n // only return above row key if not header row\n let superKey = super.getKeyAbove(key);\n let superItem = superKey != null ? this.collection.getItem(superKey) : null;\n if (superItem && superItem.type !== 'headerrow') {\n return superKey;\n }\n\n // If no item was found, and focus was on a cell, then focus the\n // corresponding column header.\n if (this.isCell(startItem)) {\n return this.collection.columns[startItem.index].key;\n }\n\n // If focus was on a row, then focus the first column header.\n return this.collection.columns[0].key;\n }\n\n private findNextColumnKey(column: Node<T>) {\n // Search following columns\n let key = this.findNextKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the first column\n let row = this.collection.headerRows[column.level];\n for (let item of getChildNodes(row, this.collection)) {\n if (item.type === 'column') {\n return item.key;\n }\n }\n\n return null;\n }\n\n private findPreviousColumnKey(column: Node<T>) {\n // Search previous columns\n let key = this.findPreviousKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the last column\n let row = this.collection.headerRows[column.level];\n let childNodes = [...getChildNodes(row, this.collection)];\n for (let i = childNodes.length - 1; i >= 0; i--) {\n let item = childNodes[i];\n if (item.type === 'column') {\n return item.key;\n }\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 was on a column, then focus the next column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findPreviousColumnKey(item)\n : this.findNextColumnKey(item);\n }\n\n return super.getKeyRightOf(key);\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus was on a column, then focus the previous column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findNextColumnKey(item)\n : this.findPreviousColumnKey(item);\n }\n\n return super.getKeyLeftOf(key);\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let 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?.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 each of the row header cells in this row for a match\n for (let cell of getChildNodes(item, this.collection)) {\n let column = collection.columns[cell.index];\n if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n let substring = cell.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n // If we started on a cell, end on the matching cell. Otherwise, end on the row.\n let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;\n return fromItem?.type === 'cell'\n ? cell.key\n : item.key;\n }\n }\n }\n\n key = this.getKeyBelow(key);\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"],"names":[],"version":3,"file":"TableKeyboardDelegate.main.js.map"}
@@ -1,4 +1,4 @@
1
- import {getFirstItem as $eIXPM$getFirstItem, getChildNodes as $eIXPM$getChildNodes, getNthItem as $eIXPM$getNthItem} from "@react-stately/collections";
1
+ import {getFirstItem as $eIXPM$getFirstItem, getChildNodes as $eIXPM$getChildNodes} from "@react-stately/collections";
2
2
  import {GridKeyboardDelegate as $eIXPM$GridKeyboardDelegate} from "@react-aria/grid";
3
3
 
4
4
  /*
@@ -23,15 +23,13 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
23
23
  // If focus was on a column, then focus the first child column if any,
24
24
  // or find the corresponding cell in the first row.
25
25
  if (startItem.type === 'column') {
26
- var _getNthItem;
27
26
  let child = (0, $eIXPM$getFirstItem)((0, $eIXPM$getChildNodes)(startItem, this.collection));
28
27
  if (child) return child.key;
29
28
  let firstKey = this.getFirstKey();
30
29
  if (firstKey == null) return null;
31
30
  let firstItem = this.collection.getItem(firstKey);
32
31
  if (!firstItem) return null;
33
- var _getNthItem_key;
34
- return (_getNthItem_key = (_getNthItem = (0, $eIXPM$getNthItem)((0, $eIXPM$getChildNodes)(firstItem, this.collection), startItem.index)) === null || _getNthItem === void 0 ? void 0 : _getNthItem.key) !== null && _getNthItem_key !== void 0 ? _getNthItem_key : null;
32
+ return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
35
33
  }
36
34
  return super.getKeyBelow(key);
37
35
  }
@@ -1,4 +1,4 @@
1
- import {getFirstItem as $eIXPM$getFirstItem, getChildNodes as $eIXPM$getChildNodes, getNthItem as $eIXPM$getNthItem} from "@react-stately/collections";
1
+ import {getFirstItem as $eIXPM$getFirstItem, getChildNodes as $eIXPM$getChildNodes} from "@react-stately/collections";
2
2
  import {GridKeyboardDelegate as $eIXPM$GridKeyboardDelegate} from "@react-aria/grid";
3
3
 
4
4
  /*
@@ -23,15 +23,13 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
23
23
  // If focus was on a column, then focus the first child column if any,
24
24
  // or find the corresponding cell in the first row.
25
25
  if (startItem.type === 'column') {
26
- var _getNthItem;
27
26
  let child = (0, $eIXPM$getFirstItem)((0, $eIXPM$getChildNodes)(startItem, this.collection));
28
27
  if (child) return child.key;
29
28
  let firstKey = this.getFirstKey();
30
29
  if (firstKey == null) return null;
31
30
  let firstItem = this.collection.getItem(firstKey);
32
31
  if (!firstItem) return null;
33
- var _getNthItem_key;
34
- return (_getNthItem_key = (_getNthItem = (0, $eIXPM$getNthItem)((0, $eIXPM$getChildNodes)(firstItem, this.collection), startItem.index)) === null || _getNthItem === void 0 ? void 0 : _getNthItem.key) !== null && _getNthItem_key !== void 0 ? _getNthItem_key : null;
32
+ return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
35
33
  }
36
34
  return super.getKeyBelow(key);
37
35
  }
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAOM,MAAM,kDAAiC,CAAA,GAAA,2BAAmB;IAErD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK,UAAU,KAAK,IAAI,KAAK,eAAe,KAAK,IAAI,KAAK;IAC5E;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WAC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BAClD,gFAAgF;wBAChF,IAAI,WAAW,WAAW,OAAO,WAAW,OAAO,CAAC,WAAW;wBAC/D,OAAO,CAAA,qBAAA,+BAAA,SAAU,IAAI,MAAK,SACtB,KAAK,GAAG,GACR,KAAK,GAAG;oBACd;gBACF;YACF;YAEA,MAAM,IAAI,CAAC,WAAW,CAAC;YAEvB,sDAAsD;YACtD,IAAI,OAAO,QAAQ,CAAC,YAAY;gBAC9B,MAAM,IAAI,CAAC,WAAW;gBACtB,aAAa;YACf;QACF;QAEA,OAAO;IACT;AACF","sources":["packages/@react-aria/table/src/TableKeyboardDelegate.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 {getChildNodes, getFirstItem, getNthItem} from '@react-stately/collections';\nimport {GridKeyboardDelegate} from '@react-aria/grid';\nimport {Key, Node} from '@react-types/shared';\nimport {TableCollection} from '@react-types/table';\n\nexport class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableCollection<T>> {\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';\n }\n\n getKeyBelow(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, then focus the first child column if any,\n // or find the corresponding cell in the first row.\n if (startItem.type === 'column') {\n let child = getFirstItem(getChildNodes(startItem, this.collection));\n if (child) {\n return child.key;\n }\n\n let firstKey = this.getFirstKey();\n if (firstKey == null) {\n return null;\n }\n\n let firstItem = this.collection.getItem(firstKey);\n if (!firstItem) {\n return null;\n }\n return getNthItem(getChildNodes(firstItem, this.collection), startItem.index)?.key ?? null;\n }\n\n return super.getKeyBelow(key);\n }\n\n getKeyAbove(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, focus the parent column if any\n if (startItem.type === 'column') {\n let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;\n if (parent && parent.type === 'column') {\n return parent.key;\n }\n\n return null;\n }\n\n // only return above row key if not header row\n let superKey = super.getKeyAbove(key);\n let superItem = superKey != null ? this.collection.getItem(superKey) : null;\n if (superItem && superItem.type !== 'headerrow') {\n return superKey;\n }\n\n // If no item was found, and focus was on a cell, then focus the\n // corresponding column header.\n if (this.isCell(startItem)) {\n return this.collection.columns[startItem.index].key;\n }\n\n // If focus was on a row, then focus the first column header.\n return this.collection.columns[0].key;\n }\n\n private findNextColumnKey(column: Node<T>) {\n // Search following columns\n let key = this.findNextKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the first column\n let row = this.collection.headerRows[column.level];\n for (let item of getChildNodes(row, this.collection)) {\n if (item.type === 'column') {\n return item.key;\n }\n }\n\n return null;\n }\n\n private findPreviousColumnKey(column: Node<T>) {\n // Search previous columns\n let key = this.findPreviousKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the last column\n let row = this.collection.headerRows[column.level];\n let childNodes = [...getChildNodes(row, this.collection)];\n for (let i = childNodes.length - 1; i >= 0; i--) {\n let item = childNodes[i];\n if (item.type === 'column') {\n return item.key;\n }\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 was on a column, then focus the next column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findPreviousColumnKey(item)\n : this.findNextColumnKey(item);\n }\n\n return super.getKeyRightOf(key);\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus was on a column, then focus the previous column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findNextColumnKey(item)\n : this.findPreviousColumnKey(item);\n }\n\n return super.getKeyLeftOf(key);\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let 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?.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 each of the row header cells in this row for a match\n for (let cell of getChildNodes(item, this.collection)) {\n let column = collection.columns[cell.index];\n if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n let substring = cell.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n // If we started on a cell, end on the matching cell. Otherwise, end on the row.\n let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;\n return fromItem?.type === 'cell'\n ? cell.key\n : item.key;\n }\n }\n }\n\n key = this.getKeyBelow(key);\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"],"names":[],"version":3,"file":"TableKeyboardDelegate.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAOM,MAAM,kDAAiC,CAAA,GAAA,2BAAmB;IAErD,OAAO,IAAa,EAAE;QAC9B,OAAO,KAAK,IAAI,KAAK,UAAU,KAAK,IAAI,KAAK,eAAe,KAAK,IAAI,KAAK;IAC5E;IAEA,YAAY,GAAQ,EAAE;QACpB,IAAI,YAAY,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACxC,IAAI,CAAC,WACH,OAAO;QAGT,sEAAsE;QACtE,mDAAmD;QACnD,IAAI,UAAU,IAAI,KAAK,UAAU;YAC/B,IAAI,QAAQ,CAAA,GAAA,mB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QAAQ,CAAC,YAAY;gBAC9B,MAAM,IAAI,CAAC,WAAW;gBACtB,aAAa;YACf;QACF;QAEA,OAAO;IACT;AACF","sources":["packages/@react-aria/table/src/TableKeyboardDelegate.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 {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {GridKeyboardDelegate} from '@react-aria/grid';\nimport {Key, Node} from '@react-types/shared';\nimport {TableCollection} from '@react-types/table';\n\nexport class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableCollection<T>> {\n\n protected isCell(node: Node<T>) {\n return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';\n }\n\n getKeyBelow(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, then focus the first child column if any,\n // or find the corresponding cell in the first row.\n if (startItem.type === 'column') {\n let child = getFirstItem(getChildNodes(startItem, this.collection));\n if (child) {\n return child.key;\n }\n\n let firstKey = this.getFirstKey();\n if (firstKey == null) {\n return null;\n }\n\n let firstItem = this.collection.getItem(firstKey);\n if (!firstItem) {\n return null;\n }\n\n return super.getKeyForItemInRowByIndex(firstKey, startItem.index);\n }\n\n return super.getKeyBelow(key);\n }\n\n getKeyAbove(key: Key) {\n let startItem = this.collection.getItem(key);\n if (!startItem) {\n return null;\n }\n\n // If focus was on a column, focus the parent column if any\n if (startItem.type === 'column') {\n let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;\n if (parent && parent.type === 'column') {\n return parent.key;\n }\n\n return null;\n }\n\n // only return above row key if not header row\n let superKey = super.getKeyAbove(key);\n let superItem = superKey != null ? this.collection.getItem(superKey) : null;\n if (superItem && superItem.type !== 'headerrow') {\n return superKey;\n }\n\n // If no item was found, and focus was on a cell, then focus the\n // corresponding column header.\n if (this.isCell(startItem)) {\n return this.collection.columns[startItem.index].key;\n }\n\n // If focus was on a row, then focus the first column header.\n return this.collection.columns[0].key;\n }\n\n private findNextColumnKey(column: Node<T>) {\n // Search following columns\n let key = this.findNextKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the first column\n let row = this.collection.headerRows[column.level];\n for (let item of getChildNodes(row, this.collection)) {\n if (item.type === 'column') {\n return item.key;\n }\n }\n\n return null;\n }\n\n private findPreviousColumnKey(column: Node<T>) {\n // Search previous columns\n let key = this.findPreviousKey(column.key, item => item.type === 'column');\n if (key != null) {\n return key;\n }\n\n // Wrap around to the last column\n let row = this.collection.headerRows[column.level];\n let childNodes = [...getChildNodes(row, this.collection)];\n for (let i = childNodes.length - 1; i >= 0; i--) {\n let item = childNodes[i];\n if (item.type === 'column') {\n return item.key;\n }\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 was on a column, then focus the next column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findPreviousColumnKey(item)\n : this.findNextColumnKey(item);\n }\n\n return super.getKeyRightOf(key);\n }\n\n getKeyLeftOf(key: Key) {\n let item = this.collection.getItem(key);\n if (!item) {\n return null;\n }\n\n // If focus was on a column, then focus the previous column\n if (item.type === 'column') {\n return this.direction === 'rtl'\n ? this.findNextColumnKey(item)\n : this.findPreviousColumnKey(item);\n }\n\n return super.getKeyLeftOf(key);\n }\n\n getKeyForSearch(search: string, fromKey?: Key) {\n if (!this.collator) {\n return null;\n }\n\n let collection = this.collection;\n let 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?.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 each of the row header cells in this row for a match\n for (let cell of getChildNodes(item, this.collection)) {\n let column = collection.columns[cell.index];\n if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n let substring = cell.textValue.slice(0, search.length);\n if (this.collator.compare(substring, search) === 0) {\n // If we started on a cell, end on the matching cell. Otherwise, end on the row.\n let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;\n return fromItem?.type === 'cell'\n ? cell.key\n : item.key;\n }\n }\n }\n\n key = this.getKeyBelow(key);\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"],"names":[],"version":3,"file":"TableKeyboardDelegate.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;AEyBA,+BAAgC,SAAQ,SAAS;IAC/C,4GAA4G;IAC5G,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED;IACE,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,oBAAoB,CAAC;IAC9C,cAAc,IAAI,IAAI,CAAC;IACvB,WAAW,EAAE,qBAAqB,CAAA;CACnC;AAED;IACE,IAAI,EAAE,IAAI,CAAA;CACX;AAED;IACE,WAAW,EAAE,IAAI,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,yBAAyB,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,QAAQ,CAoExI;ACjGD,4CAA4C,CAAC;IAC3C,2KAA2K;IAC3K,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClB,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,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAoN9K;AC3PD,oCAAoC,gBAAgB,CAEnD;AAGD,YAAY,EAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC","sources":["packages/@react-aria/table/src/packages/@react-aria/table/src/utils.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/TableKeyboardDelegate.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTable.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnHeader.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableHeaderRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableCell.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableSelectionCheckbox.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnResize.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/index.ts","packages/@react-aria/table/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 {useTable} from './useTable';\nexport {useTableColumnHeader} from './useTableColumnHeader';\nexport {useTableRow} from './useTableRow';\nexport {useTableHeaderRow} from './useTableHeaderRow';\nexport {useTableCell} from './useTableCell';\nexport {useTableSelectionCheckbox, useTableSelectAllCheckbox} from './useTableSelectionCheckbox';\nexport {useTableColumnResize} from './useTableColumnResize';\n\n// Workaround for a Parcel bug where re-exports don't work in the CommonJS output format...\n// export {useGridRowGroup as useTableRowGroup} from '@react-aria/grid';\nimport {GridRowGroupAria, useGridRowGroup} from '@react-aria/grid';\nexport function useTableRowGroup(): GridRowGroupAria {\n return useGridRowGroup();\n}\n\nexport type {AriaTableProps} from './useTable';\nexport type {GridAria, GridRowAria, GridRowProps} from '@react-aria/grid';\nexport type {AriaTableColumnHeaderProps, TableColumnHeaderAria} from './useTableColumnHeader';\nexport type {AriaTableCellProps, TableCellAria} from './useTableCell';\nexport type {TableHeaderRowAria} from './useTableHeaderRow';\nexport type {AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria, TableSelectAllCheckboxAria} from './useTableSelectionCheckbox';\nexport type {AriaTableColumnResizeProps, TableColumnResizeAria} from './useTableColumnResize';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;AEyBA,+BAAgC,SAAQ,SAAS;IAC/C,4GAA4G;IAC5G,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED;IACE,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,oBAAoB,CAAC;IAC9C,cAAc,IAAI,IAAI,CAAC;IACvB,WAAW,EAAE,qBAAqB,CAAA;CACnC;AAED;IACE,IAAI,EAAE,IAAI,CAAA;CACX;AAED;IACE,WAAW,EAAE,IAAI,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,yBAAyB,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,QAAQ,CAoExI;AClGD,4CAA4C,CAAC;IAC3C,2KAA2K;IAC3K,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClB,wHAAwH;IACxH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;IACE,+FAA+F;IAC/F,iBAAiB,EAAE,aAAa,CAAA;CACjC;AA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,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC","sources":["packages/@react-aria/table/src/packages/@react-aria/table/src/utils.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/TableKeyboardDelegate.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTable.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnHeader.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableHeaderRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableCell.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableSelectionCheckbox.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnResize.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/index.ts","packages/@react-aria/table/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 {useTable} from './useTable';\nexport {useTableColumnHeader} from './useTableColumnHeader';\nexport {useTableRow} from './useTableRow';\nexport {useTableHeaderRow} from './useTableHeaderRow';\nexport {useTableCell} from './useTableCell';\nexport {useTableSelectionCheckbox, useTableSelectAllCheckbox} from './useTableSelectionCheckbox';\nexport {useTableColumnResize} from './useTableColumnResize';\n\n// Workaround for a Parcel bug where re-exports don't work in the CommonJS output format...\n// export {useGridRowGroup as useTableRowGroup} from '@react-aria/grid';\nimport {GridRowGroupAria, useGridRowGroup} from '@react-aria/grid';\nexport function useTableRowGroup(): GridRowGroupAria {\n return useGridRowGroup();\n}\n\nexport type {AriaTableProps} from './useTable';\nexport type {GridAria, GridRowAria, GridRowProps} from '@react-aria/grid';\nexport type {AriaTableColumnHeaderProps, TableColumnHeaderAria} from './useTableColumnHeader';\nexport type {AriaTableCellProps, TableCellAria} from './useTableCell';\nexport type {TableHeaderRowAria} from './useTableHeaderRow';\nexport type {AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria, TableSelectAllCheckboxAria} from './useTableSelectionCheckbox';\nexport type {AriaTableColumnResizeProps, TableColumnResizeAria} from './useTableColumnResize';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -2,10 +2,9 @@ var $6acf696f746f932c$exports = require("./utils.main.js");
2
2
  var $7ff3f66df3873a5e$exports = require("./intlStrings.main.js");
3
3
  var $33PgG$reactariautils = require("@react-aria/utils");
4
4
  var $33PgG$react = require("react");
5
- var $33PgG$reactariafocus = require("@react-aria/focus");
5
+ var $33PgG$reactariainteractions = require("@react-aria/interactions");
6
6
  var $33PgG$reactariagrid = require("@react-aria/grid");
7
7
  var $33PgG$reactariai18n = require("@react-aria/i18n");
8
- var $33PgG$reactariainteractions = require("@react-aria/interactions");
9
8
 
10
9
 
11
10
  function $parcel$interopDefault(a) {
@@ -34,7 +33,6 @@ $parcel$export(module.exports, "useTableColumnHeader", () => $7669c34a63ef0113$e
34
33
 
35
34
 
36
35
 
37
-
38
36
  function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
39
37
  var _state_sortDescriptor, _state_sortDescriptor1;
40
38
  let { node: node } = props;
@@ -53,7 +51,7 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
53
51
  ref: ref
54
52
  });
55
53
  // Needed to pick up the focusable context, enabling things like Tooltips for example
56
- let { focusableProps: focusableProps } = (0, $33PgG$reactariafocus.useFocusable)({}, ref);
54
+ let { focusableProps: focusableProps } = (0, $33PgG$reactariainteractions.useFocusable)({}, ref);
57
55
  let ariaSort = undefined;
58
56
  let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
59
57
  let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
@@ -77,13 +75,13 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
77
75
  ]);
78
76
  return {
79
77
  columnHeaderProps: {
80
- ...(0, $33PgG$reactariautils.mergeProps)(gridCellProps, pressProps, focusableProps, descriptionProps, // If the table is empty, make all column headers untabbable
78
+ ...(0, $33PgG$reactariautils.mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
81
79
  shouldDisableFocus ? {
82
80
  tabIndex: -1
83
81
  } : null),
84
82
  role: 'columnheader',
85
83
  id: (0, $6acf696f746f932c$exports.getColumnHeaderId)(state, node.key),
86
- 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,
84
+ 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
87
85
  'aria-sort': ariaSort
88
86
  }
89
87
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,SAAS,0CAAwB,KAAoC,EAAE,KAAoB,EAAE,GAAuC;QAoBpH,uBACD;IApBpB,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,gBAAgB,KAAK,KAAK,CAAC,aAAa;IAC5C,4EAA4E;IAC5E,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,gCAAU,EAAE;QAAC,GAAG,KAAK;QAAE,WAAW;IAAO,GAAG,OAAO;IAEzE,IAAI,0BAA0B,KAAK,KAAK,CAAC,eAAe,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK;IAErG,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,YAAY,CAAC,iBAAiB;QAC9B;YACE,MAAM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KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable} from '@react-aria/focus';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n gridCellProps,\n pressProps,\n focusableProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,\n 'aria-sort': ariaSort\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;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,CAAA,GAAA,oCAAa,EAAE;IAEtC,IAAI,qBAAqB,MAAM,UAAU,CAAC,IAAI,KAAK;IACnD,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,sBAAsB,MAAM,gBAAgB,CAAC,UAAU,KAAK,KAAK,GAAG,EACtE,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC,GAAG;QAAC;QAAoB,MAAM,gBAAgB;QAAE,KAAK,GAAG;KAAC;IAEzD,OAAO;QACL,mBAAmB;YACjB,GAAG,CAAA,GAAA,gCAAS,EACV,gBACA,eACA,YACA,kBACA,4DAA4D;YAC5D,qBAAqB;gBAAC,UAAU;YAAE,IAAI,KACvC;YACD,MAAM;YACN,IAAI,CAAA,GAAA,2CAAgB,EAAE,OAAO,KAAK,GAAG;YACrC,gBAAgB,KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n focusableProps,\n gridCellProps,\n pressProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,\n 'aria-sort': ariaSort\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.main.js.map"}
@@ -2,10 +2,9 @@ import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./
2
2
  import $cjB6b$intlStringsmodulejs from "./intlStrings.mjs";
3
3
  import {isAndroid as $cjB6b$isAndroid, useDescription as $cjB6b$useDescription, mergeProps as $cjB6b$mergeProps} from "@react-aria/utils";
4
4
  import {useEffect as $cjB6b$useEffect} from "react";
5
- import {useFocusable as $cjB6b$useFocusable} from "@react-aria/focus";
5
+ import {usePress as $cjB6b$usePress, useFocusable as $cjB6b$useFocusable} from "@react-aria/interactions";
6
6
  import {useGridCell as $cjB6b$useGridCell} from "@react-aria/grid";
7
7
  import {useLocalizedStringFormatter as $cjB6b$useLocalizedStringFormatter} from "@react-aria/i18n";
8
- import {usePress as $cjB6b$usePress} from "@react-aria/interactions";
9
8
 
10
9
 
11
10
  function $parcel$interopDefault(a) {
@@ -28,7 +27,6 @@ function $parcel$interopDefault(a) {
28
27
 
29
28
 
30
29
 
31
-
32
30
  function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
33
31
  var _state_sortDescriptor, _state_sortDescriptor1;
34
32
  let { node: node } = props;
@@ -71,13 +69,13 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
71
69
  ]);
72
70
  return {
73
71
  columnHeaderProps: {
74
- ...(0, $cjB6b$mergeProps)(gridCellProps, pressProps, focusableProps, descriptionProps, // If the table is empty, make all column headers untabbable
72
+ ...(0, $cjB6b$mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
75
73
  shouldDisableFocus ? {
76
74
  tabIndex: -1
77
75
  } : null),
78
76
  role: 'columnheader',
79
77
  id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
80
- 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,
78
+ 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
81
79
  'aria-sort': ariaSort
82
80
  }
83
81
  };
@@ -2,10 +2,9 @@ import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./
2
2
  import $cjB6b$intlStringsmodulejs from "./intlStrings.module.js";
3
3
  import {isAndroid as $cjB6b$isAndroid, useDescription as $cjB6b$useDescription, mergeProps as $cjB6b$mergeProps} from "@react-aria/utils";
4
4
  import {useEffect as $cjB6b$useEffect} from "react";
5
- import {useFocusable as $cjB6b$useFocusable} from "@react-aria/focus";
5
+ import {usePress as $cjB6b$usePress, useFocusable as $cjB6b$useFocusable} from "@react-aria/interactions";
6
6
  import {useGridCell as $cjB6b$useGridCell} from "@react-aria/grid";
7
7
  import {useLocalizedStringFormatter as $cjB6b$useLocalizedStringFormatter} from "@react-aria/i18n";
8
- import {usePress as $cjB6b$usePress} from "@react-aria/interactions";
9
8
 
10
9
 
11
10
  function $parcel$interopDefault(a) {
@@ -28,7 +27,6 @@ function $parcel$interopDefault(a) {
28
27
 
29
28
 
30
29
 
31
-
32
30
  function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
33
31
  var _state_sortDescriptor, _state_sortDescriptor1;
34
32
  let { node: node } = props;
@@ -71,13 +69,13 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
71
69
  ]);
72
70
  return {
73
71
  columnHeaderProps: {
74
- ...(0, $cjB6b$mergeProps)(gridCellProps, pressProps, focusableProps, descriptionProps, // If the table is empty, make all column headers untabbable
72
+ ...(0, $cjB6b$mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
75
73
  shouldDisableFocus ? {
76
74
  tabIndex: -1
77
75
  } : null),
78
76
  role: 'columnheader',
79
77
  id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
80
- 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,
78
+ 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
81
79
  'aria-sort': ariaSort
82
80
  }
83
81
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiCM,SAAS,0CAAwB,KAAoC,EAAE,KAAoB,EAAE,GAAuC;QAoBpH,uBACD;IApBpB,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,gBAAgB,KAAK,KAAK,CAAC,aAAa;IAC5C,4EAA4E;IAC5E,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAAC,GAAG,KAAK;QAAE,WAAW;IAAO,GAAG,OAAO;IAEzE,IAAI,0BAA0B,KAAK,KAAK,CAAC,eAAe,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK;IAErG,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,YAAY,CAAC,iBAAiB;QAC9B;YACE,MAAM,IAAI,CAAC,KAAK,GAAG;QACrB;aACA;IACF;IAEA,qFAAqF;IACrF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,CAAC,GAAG;IAExC,IAAI,WAAmD;IACvD,IAAI,iBAAiB,EAAA,wBAAA,MAAM,cAAc,cAApB,4CAAA,sBAAsB,MAAM,MAAK,KAAK,GAAG;IAC9D,IAAI,iBAAgB,yBAAA,MAAM,cAAc,cAApB,6CAAA,uBAAsB,SAAS;IACnD,8CAA8C;IAC9C,IAAI,KAAK,KAAK,CAAC,aAAa,IAAI,CAAC,CAAA,GAAA,gBAAQ,KACvC,WAAW,iBAAiB,gBAAgB;IAG9C,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI;IACJ,IAAI,eAAe;QACjB,kBAAkB,GAAG,gBAAgB,MAAM,CAAC,aAAa;QACzD,wGAAwG;QACxG,IAAI,kBAAkB,iBAAiB,CAAA,GAAA,gBAAQ,KAC7C,kBAAkB,GAAG,gBAAgB,EAAE,EAAE,gBAAgB,MAAM,CAAC,gBAAgB;IAEpF;IAEA,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IAEtC,IAAI,qBAAqB,MAAM,UAAU,CAAC,IAAI,KAAK;IACnD,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,sBAAsB,MAAM,gBAAgB,CAAC,UAAU,KAAK,KAAK,GAAG,EACtE,MAAM,gBAAgB,CAAC,aAAa,CAAC;IAEzC,GAAG;QAAC;QAAoB,MAAM,gBAAgB;QAAE,KAAK,GAAG;KAAC;IAEzD,OAAO;QACL,mBAAmB;YACjB,GAAG,CAAA,GAAA,iBAAS,EACV,eACA,YACA,gBACA,kBACA,4DAA4D;YAC5D,qBAAqB;gBAAC,UAAU;YAAE,IAAI,KACvC;YACD,MAAM;YACN,IAAI,CAAA,GAAA,yCAAgB,EAAE,OAAO,KAAK,GAAG;YACrC,gBAAgB,KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable} from '@react-aria/focus';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n gridCellProps,\n pressProps,\n focusableProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,\n 'aria-sort': ariaSort\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgCM,SAAS,0CAAwB,KAAoC,EAAE,KAAoB,EAAE,GAAuC;QAoBpH,uBACD;IApBpB,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,gBAAgB,KAAK,KAAK,CAAC,aAAa;IAC5C,4EAA4E;IAC5E,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAAC,GAAG,K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AC;IAEzD,OAAO;QACL,mBAAmB;YACjB,GAAG,CAAA,GAAA,iBAAS,EACV,gBACA,eACA,YACA,kBACA,4DAA4D;YAC5D,qBAAqB;gBAAC,UAAU;YAAE,IAAI,KACvC;YACD,MAAM;YACN,IAAI,CAAA,GAAA,yCAAgB,EAAE,OAAO,KAAK,GAAG;YACrC,gBAAgB,KAAK,OAAO,IAAI,KAAK,OAAO,GAAG,IAAI,KAAK,OAAO,GAAG;YAClE,aAAa;QACf;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnHeader.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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, mergeProps, useDescription} from '@react-aria/utils';\nimport {TableState} from '@react-stately/table';\nimport {useEffect} from 'react';\nimport {useFocusable, usePress} from '@react-aria/interactions';\nimport {useGridCell} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableColumnHeaderProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n node: GridNode<T>,\n /** Whether the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) is contained in a virtual scroller. */\n isVirtualized?: boolean\n}\n\nexport interface TableColumnHeaderAria {\n /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */\n columnHeaderProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a column header in a table.\n * @param props - Props for the column header.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the column header element.\n */\nexport function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableColumnHeaderAria {\n let {node} = props;\n let allowsSorting = node.props.allowsSorting;\n // if there are no focusable children, the column header will focus the cell\n let {gridCellProps} = useGridCell({...props, focusMode: 'child'}, state, ref);\n\n let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';\n\n let {pressProps} = usePress({\n isDisabled: !allowsSorting || isSelectionCellDisabled,\n onPress() {\n state.sort(node.key);\n },\n ref\n });\n\n // Needed to pick up the focusable context, enabling things like Tooltips for example\n let {focusableProps} = useFocusable({}, ref);\n\n let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;\n let isSortedColumn = state.sortDescriptor?.column === node.key;\n let sortDirection = state.sortDescriptor?.direction;\n // aria-sort not supported in Android Talkback\n if (node.props.allowsSorting && !isAndroid()) {\n ariaSort = isSortedColumn ? sortDirection : 'none';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription;\n if (allowsSorting) {\n sortDescription = `${stringFormatter.format('sortable')}`;\n // Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here\n if (isSortedColumn && sortDirection && isAndroid()) {\n sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;\n }\n }\n\n let descriptionProps = useDescription(sortDescription);\n\n let shouldDisableFocus = state.collection.size === 0;\n useEffect(() => {\n if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) {\n state.selectionManager.setFocusedKey(null);\n }\n }, [shouldDisableFocus, state.selectionManager, node.key]);\n\n return {\n columnHeaderProps: {\n ...mergeProps(\n focusableProps,\n gridCellProps,\n pressProps,\n descriptionProps,\n // If the table is empty, make all column headers untabbable\n shouldDisableFocus ? {tabIndex: -1} : null\n ),\n role: 'columnheader',\n id: getColumnHeaderId(state, node.key),\n 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,\n 'aria-sort': ariaSort\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.module.js.map"}
@@ -1,9 +1,8 @@
1
1
  var $6acf696f746f932c$exports = require("./utils.main.js");
2
2
  var $7ff3f66df3873a5e$exports = require("./intlStrings.main.js");
3
3
  var $gDW2h$react = require("react");
4
- var $gDW2h$reactariafocus = require("@react-aria/focus");
5
- var $gDW2h$reactariautils = require("@react-aria/utils");
6
4
  var $gDW2h$reactariainteractions = require("@react-aria/interactions");
5
+ var $gDW2h$reactariautils = require("@react-aria/utils");
7
6
  var $gDW2h$reactariai18n = require("@react-aria/i18n");
8
7
  var $gDW2h$reactariavisuallyhidden = require("@react-aria/visually-hidden");
9
8
 
@@ -34,7 +33,6 @@ $parcel$export(module.exports, "useTableColumnResize", () => $16d645f9e2153641$e
34
33
 
35
34
 
36
35
 
37
-
38
36
  function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
39
37
  let { column: item, triggerRef: triggerRef, isDisabled: isDisabled, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, 'aria-label': ariaLabel } = props;
40
38
  const stringFormatter = (0, $gDW2h$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), '@react-aria/table');
@@ -81,7 +79,7 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
81
79
  onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd(lastSize.current);
82
80
  isResizingRef.current = false;
83
81
  if ((triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) && !wasFocusedOnResizeStart.current) // switch focus back to the column header unless the resizer was already focused when resizing started.
84
- (0, $gDW2h$reactariafocus.focusSafely)(triggerRef.current);
82
+ (0, $gDW2h$reactariainteractions.focusSafely)(triggerRef.current);
85
83
  }
86
84
  lastSize.current = null;
87
85
  });
@@ -139,7 +137,7 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
139
137
  ...descriptionProps
140
138
  };
141
139
  const focusInput = (0, $gDW2h$react.useCallback)(()=>{
142
- if (ref.current) (0, $gDW2h$reactariafocus.focusSafely)(ref.current);
140
+ if (ref.current) (0, $gDW2h$reactariainteractions.focusSafely)(ref.current);
143
141
  }, [
144
142
  ref
145
143
  ]);
@@ -174,6 +172,7 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
174
172
  resize(item, nextValue);
175
173
  };
176
174
  let { pressProps: pressProps } = (0, $gDW2h$reactariainteractions.usePress)({
175
+ preventFocusOnPress: true,
177
176
  onPressStart: (e)=>{
178
177
  if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') return;
179
178
  if (e.pointerType === 'virtual' && state.resizingColumn != null) {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc,SAAS,EAAC,GAAG;IAC5G,MAAM,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAClE,IAAI,KAAK,CAAA,GAAA,2BAAI;IACb,IAAI,aAAa,MAAM,cAAc,KAAK,KAAK,GAAG;IAClD,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAE;IAC3B,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA+B;IACnD,IAAI,0BAA0B,CAAA,GAAA,mBAAK,EAAE;IACrC,IAAI,kBAAkB,MAAM,UAAU,CAAC,4BAA4B;IAEnE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,iB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Y,cACd,YAAY,eAAe;aAE3B,YAAY,eAAe;QAE7B,OAAO,MAAM;IACf;IAEA,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,cAAc,CAAC;YACb,IAAI,EAAE,OAAO,IAAI,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,QAAQ,IAAI,EAAE,WAAW,KAAK,YACxE;YAEF,IAAI,EAAE,WAAW,KAAK,aAAa,MAAM,cAAc,IAAI,MAAM;gBAC/D,UAAU;gBACV;YACF;YAEA,0GAA0G;YAC1G,iCAAiC;YACjC;YAEA,gIAAgI;YAChI,kDAAkD;YAClD,IAAI,EAAE,WAAW,KAAK,WACpB,YAAY;QAEhB;QACA,SAAS,CAAC;YACR,IAAI,AAAC,CAAA,AAAC,EAAE,WAAW,KAAK,WAAW,wBAAwB,OAAO,IAAK,EAAE,WAAW,KAAK,OAAM,KAAM,MAAM,cAAc,IAAI,MAC3H,UAAU;QAEd;IACF;IACA,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,gDAAgB;IAE5C,OAAO;QACL,cAAc,CAAA,GAAA,gCAAS,EACrB,eACA;YAAC,GAAG,SAAS;uBAAE;QAAS,GACxB,YACA;YAAC,OAAO;gBAAC,aAAa;YAAM;QAAC;QAE/B,YAAY,CAAA,GAAA,gCAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.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 {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n let startResize = useEffectEvent((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n });\n\n let resize = useEffectEvent((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n });\n\n let endResize = useEffectEvent((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"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,IAAK,EAAE,WAAW,KAAK,OAAM,KAAM,MAAM,cAAc,IAAI,MAC3H,UAAU;QAEd;IACF;IACA,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,gDAAgB;IAE5C,OAAO;QACL,cAAc,CAAA,GAAA,gCAAS,EACrB,eACA;YAAC,GAAG,SAAS;uBAAE;QAAS,GACxB,YACA;YAAC,OAAO;gBAAC,aAAa;YAAM;QAAC;QAE/B,YAAY,CAAA,GAAA,gCAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.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 {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely, useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n let startResize = useEffectEvent((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n });\n\n let resize = useEffectEvent((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n });\n\n let endResize = useEffectEvent((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n preventFocusOnPress: true,\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.main.js.map"}
@@ -1,9 +1,8 @@
1
1
  import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./utils.mjs";
2
2
  import $d9Rqy$intlStringsmodulejs from "./intlStrings.mjs";
3
3
  import {useRef as $d9Rqy$useRef, useCallback as $d9Rqy$useCallback, useEffect as $d9Rqy$useEffect} from "react";
4
- import {focusSafely as $d9Rqy$focusSafely} from "@react-aria/focus";
4
+ import {useKeyboard as $d9Rqy$useKeyboard, focusSafely as $d9Rqy$focusSafely, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
5
5
  import {useId as $d9Rqy$useId, useEffectEvent as $d9Rqy$useEffectEvent, useDescription as $d9Rqy$useDescription, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
6
- import {useKeyboard as $d9Rqy$useKeyboard, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
7
6
  import {useLocalizedStringFormatter as $d9Rqy$useLocalizedStringFormatter, useLocale as $d9Rqy$useLocale} from "@react-aria/i18n";
8
7
  import {useVisuallyHidden as $d9Rqy$useVisuallyHidden} from "@react-aria/visually-hidden";
9
8
 
@@ -28,7 +27,6 @@ function $parcel$interopDefault(a) {
28
27
 
29
28
 
30
29
 
31
-
32
30
  function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
33
31
  let { column: item, triggerRef: triggerRef, isDisabled: isDisabled, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, 'aria-label': ariaLabel } = props;
34
32
  const stringFormatter = (0, $d9Rqy$useLocalizedStringFormatter)((0, ($parcel$interopDefault($d9Rqy$intlStringsmodulejs))), '@react-aria/table');
@@ -168,6 +166,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
168
166
  resize(item, nextValue);
169
167
  };
170
168
  let { pressProps: pressProps } = (0, $d9Rqy$usePress)({
169
+ preventFocusOnPress: true,
171
170
  onPressStart: (e)=>{
172
171
  if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') return;
173
172
  if (e.pointerType === 'virtual' && state.resizingColumn != null) {
@@ -1,9 +1,8 @@
1
1
  import {getColumnHeaderId as $2140fb2337097f2d$export$37cd4213f2ad742e} from "./utils.module.js";
2
2
  import $d9Rqy$intlStringsmodulejs from "./intlStrings.module.js";
3
3
  import {useRef as $d9Rqy$useRef, useCallback as $d9Rqy$useCallback, useEffect as $d9Rqy$useEffect} from "react";
4
- import {focusSafely as $d9Rqy$focusSafely} from "@react-aria/focus";
4
+ import {useKeyboard as $d9Rqy$useKeyboard, focusSafely as $d9Rqy$focusSafely, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
5
5
  import {useId as $d9Rqy$useId, useEffectEvent as $d9Rqy$useEffectEvent, useDescription as $d9Rqy$useDescription, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
6
- import {useKeyboard as $d9Rqy$useKeyboard, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
7
6
  import {useLocalizedStringFormatter as $d9Rqy$useLocalizedStringFormatter, useLocale as $d9Rqy$useLocale} from "@react-aria/i18n";
8
7
  import {useVisuallyHidden as $d9Rqy$useVisuallyHidden} from "@react-aria/visually-hidden";
9
8
 
@@ -28,7 +27,6 @@ function $parcel$interopDefault(a) {
28
27
 
29
28
 
30
29
 
31
-
32
30
  function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
33
31
  let { column: item, triggerRef: triggerRef, isDisabled: isDisabled, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, 'aria-label': ariaLabel } = props;
34
32
  const stringFormatter = (0, $d9Rqy$useLocalizedStringFormatter)((0, ($parcel$interopDefault($d9Rqy$intlStringsmodulejs))), '@react-aria/table');
@@ -168,6 +166,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
168
166
  resize(item, nextValue);
169
167
  };
170
168
  let { pressProps: pressProps } = (0, $d9Rqy$usePress)({
169
+ preventFocusOnPress: true,
171
170
  onPressStart: (e)=>{
172
171
  if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') return;
173
172
  if (e.pointerType === 'virtual' && state.resizingColumn != null) {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc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AE/B,YAAY,CAAA,GAAA,iBAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.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 {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n let startResize = useEffectEvent((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n });\n\n let resize = useEffectEvent((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n });\n\n let endResize = useEffectEvent((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc,SAAS,EAAC,GAAG;IAC5G,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAClE,IAAI,KAAK,CAAA,GAAA,YAAI;IACb,IAAI,aAAa,MAAM,cAAc,KAAK,KAAK,GAAG;IAClD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,WAAW,CAAA,GAAA,aAAK,EAA+B;IACnD,IAAI,0BAA0B,CAAA,GAAA,aAAK,EAAE;IACrC,IAAI,kBAAkB,MAAM,UAAU,CAAC,4BAA4B;IAEnE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAChC,WAAW,CAAC;YACV,IAAI,iBACF;gBAAA,IAAI,EAAE,GAAG,KAAK,YAAY,EAAE,GAAG,KAA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ACrB,cAAc,CAAC;YACb,IAAI,EAAE,OAAO,IAAI,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,QAAQ,IAAI,EAAE,WAAW,KAAK,YACxE;YAEF,IAAI,EAAE,WAAW,KAAK,aAAa,MAAM,cAAc,IAAI,MAAM;gBAC/D,UAAU;gBACV;YACF;YAEA,0GAA0G;YAC1G,iCAAiC;YACjC;YAEA,gIAAgI;YAChI,kDAAkD;YAClD,IAAI,EAAE,WAAW,KAAK,WACpB,YAAY;QAEhB;QACA,SAAS,CAAC;YACR,IAAI,AAAC,CAAA,AAAC,EAAE,WAAW,KAAK,WAAW,wBAAwB,OAAO,IAAK,EAAE,WAAW,KAAK,OAAM,KAAM,MAAM,cAAc,IAAI,MAC3H,UAAU;QAEd;IACF;IACA,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,OAAO;QACL,cAAc,CAAA,GAAA,iBAAS,EACrB,eACA;YAAC,GAAG,SAAS;uBAAE;QAAS,GACxB,YACA;YAAC,OAAO;gBAAC,aAAa;YAAM;QAAC;QAE/B,YAAY,CAAA,GAAA,iBAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.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 {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely, useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n let startResize = useEffectEvent((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n });\n\n let resize = useEffectEvent((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n });\n\n let endResize = useEffectEvent((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n preventFocusOnPress: true,\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/table",
3
- "version": "3.16.1",
3
+ "version": "3.17.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,20 +22,20 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.19.1",
26
- "@react-aria/grid": "^3.11.1",
27
- "@react-aria/i18n": "^3.12.5",
28
- "@react-aria/interactions": "^3.23.0",
25
+ "@react-aria/focus": "^3.20.0",
26
+ "@react-aria/grid": "^3.12.0",
27
+ "@react-aria/i18n": "^3.12.6",
28
+ "@react-aria/interactions": "^3.24.0",
29
29
  "@react-aria/live-announcer": "^3.4.1",
30
- "@react-aria/utils": "^3.27.0",
31
- "@react-aria/visually-hidden": "^3.8.19",
32
- "@react-stately/collections": "^3.12.1",
33
- "@react-stately/flags": "^3.0.5",
34
- "@react-stately/table": "^3.13.1",
35
- "@react-types/checkbox": "^3.9.1",
36
- "@react-types/grid": "^3.2.11",
37
- "@react-types/shared": "^3.27.0",
38
- "@react-types/table": "^3.10.4",
30
+ "@react-aria/utils": "^3.28.0",
31
+ "@react-aria/visually-hidden": "^3.8.20",
32
+ "@react-stately/collections": "^3.12.2",
33
+ "@react-stately/flags": "^3.1.0",
34
+ "@react-stately/table": "^3.14.0",
35
+ "@react-types/checkbox": "^3.9.2",
36
+ "@react-types/grid": "^3.3.0",
37
+ "@react-types/shared": "^3.28.0",
38
+ "@react-types/table": "^3.11.0",
39
39
  "@swc/helpers": "^0.5.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
48
+ "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
49
49
  }
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {getChildNodes, getFirstItem, getNthItem} from '@react-stately/collections';
13
+ import {getChildNodes, getFirstItem} from '@react-stately/collections';
14
14
  import {GridKeyboardDelegate} from '@react-aria/grid';
15
15
  import {Key, Node} from '@react-types/shared';
16
16
  import {TableCollection} from '@react-types/table';
@@ -44,7 +44,8 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
44
44
  if (!firstItem) {
45
45
  return null;
46
46
  }
47
- return getNthItem(getChildNodes(firstItem, this.collection), startItem.index)?.key ?? null;
47
+
48
+ return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
48
49
  }
49
50
 
50
51
  return super.getKeyBelow(key);
@@ -18,10 +18,9 @@ import intlMessages from '../intl/*.json';
18
18
  import {isAndroid, mergeProps, useDescription} from '@react-aria/utils';
19
19
  import {TableState} from '@react-stately/table';
20
20
  import {useEffect} from 'react';
21
- import {useFocusable} from '@react-aria/focus';
21
+ import {useFocusable, usePress} from '@react-aria/interactions';
22
22
  import {useGridCell} from '@react-aria/grid';
23
23
  import {useLocalizedStringFormatter} from '@react-aria/i18n';
24
- import {usePress} from '@react-aria/interactions';
25
24
 
26
25
  export interface AriaTableColumnHeaderProps<T> {
27
26
  /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */
@@ -90,16 +89,16 @@ export function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, st
90
89
  return {
91
90
  columnHeaderProps: {
92
91
  ...mergeProps(
92
+ focusableProps,
93
93
  gridCellProps,
94
94
  pressProps,
95
- focusableProps,
96
95
  descriptionProps,
97
96
  // If the table is empty, make all column headers untabbable
98
97
  shouldDisableFocus ? {tabIndex: -1} : null
99
98
  ),
100
99
  role: 'columnheader',
101
100
  id: getColumnHeaderId(state, node.key),
102
- 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,
101
+ 'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
103
102
  'aria-sort': ariaSort
104
103
  }
105
104
  };
@@ -13,14 +13,13 @@
13
13
  import {ChangeEvent, useCallback, useEffect, useRef} from 'react';
14
14
  import {ColumnSize} from '@react-types/table';
15
15
  import {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';
16
- import {focusSafely} from '@react-aria/focus';
16
+ import {focusSafely, useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';
17
17
  import {getColumnHeaderId} from './utils';
18
18
  import {GridNode} from '@react-types/grid';
19
19
  // @ts-ignore
20
20
  import intlMessages from '../intl/*.json';
21
21
  import {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';
22
22
  import {TableColumnResizeState} from '@react-stately/table';
23
- import {useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';
24
23
  import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
25
24
  import {useVisuallyHidden} from '@react-aria/visually-hidden';
26
25
 
@@ -224,6 +223,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
224
223
  };
225
224
 
226
225
  let {pressProps} = usePress({
226
+ preventFocusOnPress: true,
227
227
  onPressStart: (e) => {
228
228
  if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {
229
229
  return;