@react-aria/table 3.17.8 → 3.17.9

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.
package/dist/types.d.ts CHANGED
@@ -39,6 +39,8 @@ export interface AriaTableColumnHeaderProps<T> {
39
39
  export interface TableColumnHeaderAria {
40
40
  /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */
41
41
  columnHeaderProps: DOMAttributes;
42
+ /** Whether the column is currently in a pressed state. */
43
+ isPressed: boolean;
42
44
  }
43
45
  /**
44
46
  * Provides the behavior and accessibility implementation for a column header in a table.
@@ -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;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;AAED;;;;;GAKG;AACH,qCAAqC,CAAC,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,KA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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,CAAC;IACjC,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;;GAKG;AACH,qCAAqC,CAAC,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG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C,GAAG,0BAA0B,CAUrI;AAED;;;;GAIG;AACH,0CAA0C,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,0BAA0B,CAa7F;AC9CD;IACE,mDAAmD;IACnD,UAAU,EAAE,aAAa,CAAC;IAC1B,qCAAqC;IACrC,YAAY,EAAE,aAAa,CAAC;IAC5B,sDAAsD;IACtD,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,4CAA4C,CAAC;IAC3C,2KAA2K;IAC3K,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACpB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;SAIK;IACL,UAAU,CAAC,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAChD,+BAA+B;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACvD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD,iCAAiC;IACjC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;CACrD;AAED;;;;;GAKG;AACH,qCAAqC,CAAC,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAuN9K;AC7PD,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"}
@@ -43,7 +43,7 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
43
43
  focusMode: 'child'
44
44
  }, state, ref);
45
45
  let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
46
- let { pressProps: pressProps } = (0, $33PgG$reactariainteractions.usePress)({
46
+ let { pressProps: pressProps, isPressed: isPressed } = (0, $33PgG$reactariainteractions.usePress)({
47
47
  isDisabled: !allowsSorting || isSelectionCellDisabled,
48
48
  onPress () {
49
49
  state.sort(node.key);
@@ -83,7 +83,8 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
83
83
  id: (0, $6acf696f746f932c$exports.getColumnHeaderId)(state, node.key),
84
84
  'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
85
85
  'aria-sort': ariaSort
86
- }
86
+ },
87
+ isPressed: isPressed
87
88
  };
88
89
  }
89
90
 
@@ -1 +1 @@
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,gCAAU,EAAE;QAAC,GAAG,KAAK;QAAE,WAAW;IAAO,GAAG,OAAO;IAEzE,IAAI,0BAA0B,KAAK,KAAK,CAAC,eAAe,IAAI,MAAM,gBAAgB,CAAC,aAAa,KAAK;IA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AAU;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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,KAC7C,kBAAkB,GAAG,gBAAgB,EAAE,EAAE,gBAAgB,MAAM,CAAC,gBAAgB;IAEpF;IAEA,IAAI,mBAAmB,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;mBACA;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 /** Whether the column is currently in a pressed state. */\n isPressed: boolean\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, isPressed} = 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 isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.main.js.map"}
@@ -37,7 +37,7 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
37
37
  focusMode: 'child'
38
38
  }, state, ref);
39
39
  let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
40
- let { pressProps: pressProps } = (0, $cjB6b$usePress)({
40
+ let { pressProps: pressProps, isPressed: isPressed } = (0, $cjB6b$usePress)({
41
41
  isDisabled: !allowsSorting || isSelectionCellDisabled,
42
42
  onPress () {
43
43
  state.sort(node.key);
@@ -77,7 +77,8 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
77
77
  id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
78
78
  'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
79
79
  'aria-sort': ariaSort
80
- }
80
+ },
81
+ isPressed: isPressed
81
82
  };
82
83
  }
83
84
 
@@ -37,7 +37,7 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
37
37
  focusMode: 'child'
38
38
  }, state, ref);
39
39
  let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
40
- let { pressProps: pressProps } = (0, $cjB6b$usePress)({
40
+ let { pressProps: pressProps, isPressed: isPressed } = (0, $cjB6b$usePress)({
41
41
  isDisabled: !allowsSorting || isSelectionCellDisabled,
42
42
  onPress () {
43
43
  state.sort(node.key);
@@ -77,7 +77,8 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
77
77
  id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
78
78
  'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
79
79
  'aria-sort': ariaSort
80
- }
80
+ },
81
+ isPressed: isPressed
81
82
  };
82
83
  }
83
84
 
@@ -1 +1 @@
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,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,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
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkCM,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,GAA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AG;QAAC;QAAoB,MAAM,gBAAgB;QAAE,KAAK,GAAG;KAAC;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;mBACA;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 /** Whether the column is currently in a pressed state. */\n isPressed: boolean\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, isPressed} = 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 isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnHeader.module.js.map"}
@@ -43,21 +43,7 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
43
43
  let wasFocusedOnResizeStart = (0, $gDW2h$react.useRef)(false);
44
44
  let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
45
45
  let { direction: direction } = (0, $gDW2h$reactariai18n.useLocale)();
46
- let { keyboardProps: keyboardProps } = (0, $gDW2h$reactariainteractions.useKeyboard)({
47
- onKeyDown: (e)=>{
48
- if (editModeEnabled) {
49
- if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
50
- e.preventDefault();
51
- endResize(item);
52
- }
53
- } else {
54
- // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
55
- e.continuePropagation();
56
- if (e.key === 'Enter') startResize(item);
57
- }
58
- }
59
- });
60
- let startResize = (0, $gDW2h$reactariautils.useEffectEvent)((item)=>{
46
+ let startResize = (0, $gDW2h$react.useCallback)((item)=>{
61
47
  if (!isResizingRef.current) {
62
48
  lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
63
49
  state.startResize(item.key);
@@ -65,13 +51,19 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
65
51
  onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(lastSize.current);
66
52
  }
67
53
  isResizingRef.current = true;
68
- });
69
- let resize = (0, $gDW2h$reactariautils.useEffectEvent)((item, newWidth)=>{
54
+ }, [
55
+ state,
56
+ onResizeStart
57
+ ]);
58
+ let resize = (0, $gDW2h$react.useCallback)((item, newWidth)=>{
70
59
  let sizes = state.updateResizedColumns(item.key, newWidth);
71
60
  onResize === null || onResize === void 0 ? void 0 : onResize(sizes);
72
61
  lastSize.current = sizes;
73
- });
74
- let endResize = (0, $gDW2h$reactariautils.useEffectEvent)((item)=>{
62
+ }, [
63
+ state,
64
+ onResize
65
+ ]);
66
+ let endResize = (0, $gDW2h$react.useCallback)((item)=>{
75
67
  if (isResizingRef.current) {
76
68
  if (lastSize.current == null) lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
77
69
  state.endResize();
@@ -82,6 +74,24 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
82
74
  (0, $gDW2h$reactariainteractions.focusSafely)(triggerRef.current);
83
75
  }
84
76
  lastSize.current = null;
77
+ }, [
78
+ state,
79
+ triggerRef,
80
+ onResizeEnd
81
+ ]);
82
+ let { keyboardProps: keyboardProps } = (0, $gDW2h$reactariainteractions.useKeyboard)({
83
+ onKeyDown: (e)=>{
84
+ if (editModeEnabled) {
85
+ if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
86
+ e.preventDefault();
87
+ endResize(item);
88
+ }
89
+ } else {
90
+ // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
91
+ e.continuePropagation();
92
+ if (e.key === 'Enter') startResize(item);
93
+ }
94
+ }
85
95
  });
86
96
  const columnResizeWidthRef = (0, $gDW2h$react.useRef)(0);
87
97
  const { moveProps: moveProps } = (0, $gDW2h$reactariainteractions.useMove)({
@@ -143,10 +153,11 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
143
153
  ]);
144
154
  let resizingColumn = state.resizingColumn;
145
155
  let prevResizingColumn = (0, $gDW2h$react.useRef)(null);
156
+ let startResizeEvent = (0, $gDW2h$reactariautils.useEffectEvent)(startResize);
146
157
  (0, $gDW2h$react.useEffect)(()=>{
147
158
  if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
148
159
  wasFocusedOnResizeStart.current = document.activeElement === ref.current;
149
- startResize(item);
160
+ startResizeEvent(item);
150
161
  // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
151
162
  let timeout = setTimeout(()=>focusInput(), 0);
152
163
  // VoiceOver on iOS has problems focusing the input from a menu.
@@ -161,8 +172,7 @@ function $16d645f9e2153641$export$52994e973806c219(props, state, ref) {
161
172
  resizingColumn,
162
173
  item,
163
174
  focusInput,
164
- ref,
165
- startResize
175
+ ref
166
176
  ]);
167
177
  let onChange = (e)=>{
168
178
  let currentWidth = state.getColumnWidth(item.key);
@@ -1 +1 @@
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,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,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,wCAAU,EAAE;QAChC,WAAW,CAAC;YACV,IAAI,iBACF;gBAAA,IAAI,EAAE,GAAG,KAAK,YAAY,EAAE,GAAG,KAAK,WAAW,EAAE,GAAG,KAAK,OAAO,EAAE,GA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AO,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, 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
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAmDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QA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AAM,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\n let startResize = useCallback((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 }, [state, onResizeStart]);\n\n let resize = useCallback((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n }, [state, onResize]);\n\n let endResize = useCallback((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 }, [state, triggerRef, onResizeEnd]);\n\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 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 let startResizeEvent = useEffectEvent(startResize);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResizeEvent(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]);\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,8 +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 {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
- import {useId as $d9Rqy$useId, useEffectEvent as $d9Rqy$useEffectEvent, useDescription as $d9Rqy$useDescription, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
4
+ import {focusSafely as $d9Rqy$focusSafely, useKeyboard as $d9Rqy$useKeyboard, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
5
+ import {useId as $d9Rqy$useId, useDescription as $d9Rqy$useDescription, useEffectEvent as $d9Rqy$useEffectEvent, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
6
6
  import {useLocalizedStringFormatter as $d9Rqy$useLocalizedStringFormatter, useLocale as $d9Rqy$useLocale} from "@react-aria/i18n";
7
7
  import {useVisuallyHidden as $d9Rqy$useVisuallyHidden} from "@react-aria/visually-hidden";
8
8
 
@@ -37,21 +37,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
37
37
  let wasFocusedOnResizeStart = (0, $d9Rqy$useRef)(false);
38
38
  let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
39
39
  let { direction: direction } = (0, $d9Rqy$useLocale)();
40
- let { keyboardProps: keyboardProps } = (0, $d9Rqy$useKeyboard)({
41
- onKeyDown: (e)=>{
42
- if (editModeEnabled) {
43
- if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
44
- e.preventDefault();
45
- endResize(item);
46
- }
47
- } else {
48
- // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
49
- e.continuePropagation();
50
- if (e.key === 'Enter') startResize(item);
51
- }
52
- }
53
- });
54
- let startResize = (0, $d9Rqy$useEffectEvent)((item)=>{
40
+ let startResize = (0, $d9Rqy$useCallback)((item)=>{
55
41
  if (!isResizingRef.current) {
56
42
  lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
57
43
  state.startResize(item.key);
@@ -59,13 +45,19 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
59
45
  onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(lastSize.current);
60
46
  }
61
47
  isResizingRef.current = true;
62
- });
63
- let resize = (0, $d9Rqy$useEffectEvent)((item, newWidth)=>{
48
+ }, [
49
+ state,
50
+ onResizeStart
51
+ ]);
52
+ let resize = (0, $d9Rqy$useCallback)((item, newWidth)=>{
64
53
  let sizes = state.updateResizedColumns(item.key, newWidth);
65
54
  onResize === null || onResize === void 0 ? void 0 : onResize(sizes);
66
55
  lastSize.current = sizes;
67
- });
68
- let endResize = (0, $d9Rqy$useEffectEvent)((item)=>{
56
+ }, [
57
+ state,
58
+ onResize
59
+ ]);
60
+ let endResize = (0, $d9Rqy$useCallback)((item)=>{
69
61
  if (isResizingRef.current) {
70
62
  if (lastSize.current == null) lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
71
63
  state.endResize();
@@ -76,6 +68,24 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
76
68
  (0, $d9Rqy$focusSafely)(triggerRef.current);
77
69
  }
78
70
  lastSize.current = null;
71
+ }, [
72
+ state,
73
+ triggerRef,
74
+ onResizeEnd
75
+ ]);
76
+ let { keyboardProps: keyboardProps } = (0, $d9Rqy$useKeyboard)({
77
+ onKeyDown: (e)=>{
78
+ if (editModeEnabled) {
79
+ if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
80
+ e.preventDefault();
81
+ endResize(item);
82
+ }
83
+ } else {
84
+ // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
85
+ e.continuePropagation();
86
+ if (e.key === 'Enter') startResize(item);
87
+ }
88
+ }
79
89
  });
80
90
  const columnResizeWidthRef = (0, $d9Rqy$useRef)(0);
81
91
  const { moveProps: moveProps } = (0, $d9Rqy$useMove)({
@@ -137,10 +147,11 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
137
147
  ]);
138
148
  let resizingColumn = state.resizingColumn;
139
149
  let prevResizingColumn = (0, $d9Rqy$useRef)(null);
150
+ let startResizeEvent = (0, $d9Rqy$useEffectEvent)(startResize);
140
151
  (0, $d9Rqy$useEffect)(()=>{
141
152
  if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
142
153
  wasFocusedOnResizeStart.current = document.activeElement === ref.current;
143
- startResize(item);
154
+ startResizeEvent(item);
144
155
  // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
145
156
  let timeout = setTimeout(()=>focusInput(), 0);
146
157
  // VoiceOver on iOS has problems focusing the input from a menu.
@@ -155,8 +166,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
155
166
  resizingColumn,
156
167
  item,
157
168
  focusInput,
158
- ref,
159
- startResize
169
+ ref
160
170
  ]);
161
171
  let onChange = (e)=>{
162
172
  let currentWidth = state.getColumnWidth(item.key);
@@ -1,8 +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 {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
- import {useId as $d9Rqy$useId, useEffectEvent as $d9Rqy$useEffectEvent, useDescription as $d9Rqy$useDescription, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
4
+ import {focusSafely as $d9Rqy$focusSafely, useKeyboard as $d9Rqy$useKeyboard, useMove as $d9Rqy$useMove, useInteractionModality as $d9Rqy$useInteractionModality, usePress as $d9Rqy$usePress} from "@react-aria/interactions";
5
+ import {useId as $d9Rqy$useId, useDescription as $d9Rqy$useDescription, useEffectEvent as $d9Rqy$useEffectEvent, mergeProps as $d9Rqy$mergeProps} from "@react-aria/utils";
6
6
  import {useLocalizedStringFormatter as $d9Rqy$useLocalizedStringFormatter, useLocale as $d9Rqy$useLocale} from "@react-aria/i18n";
7
7
  import {useVisuallyHidden as $d9Rqy$useVisuallyHidden} from "@react-aria/visually-hidden";
8
8
 
@@ -37,21 +37,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
37
37
  let wasFocusedOnResizeStart = (0, $d9Rqy$useRef)(false);
38
38
  let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
39
39
  let { direction: direction } = (0, $d9Rqy$useLocale)();
40
- let { keyboardProps: keyboardProps } = (0, $d9Rqy$useKeyboard)({
41
- onKeyDown: (e)=>{
42
- if (editModeEnabled) {
43
- if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
44
- e.preventDefault();
45
- endResize(item);
46
- }
47
- } else {
48
- // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
49
- e.continuePropagation();
50
- if (e.key === 'Enter') startResize(item);
51
- }
52
- }
53
- });
54
- let startResize = (0, $d9Rqy$useEffectEvent)((item)=>{
40
+ let startResize = (0, $d9Rqy$useCallback)((item)=>{
55
41
  if (!isResizingRef.current) {
56
42
  lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
57
43
  state.startResize(item.key);
@@ -59,13 +45,19 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
59
45
  onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(lastSize.current);
60
46
  }
61
47
  isResizingRef.current = true;
62
- });
63
- let resize = (0, $d9Rqy$useEffectEvent)((item, newWidth)=>{
48
+ }, [
49
+ state,
50
+ onResizeStart
51
+ ]);
52
+ let resize = (0, $d9Rqy$useCallback)((item, newWidth)=>{
64
53
  let sizes = state.updateResizedColumns(item.key, newWidth);
65
54
  onResize === null || onResize === void 0 ? void 0 : onResize(sizes);
66
55
  lastSize.current = sizes;
67
- });
68
- let endResize = (0, $d9Rqy$useEffectEvent)((item)=>{
56
+ }, [
57
+ state,
58
+ onResize
59
+ ]);
60
+ let endResize = (0, $d9Rqy$useCallback)((item)=>{
69
61
  if (isResizingRef.current) {
70
62
  if (lastSize.current == null) lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
71
63
  state.endResize();
@@ -76,6 +68,24 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
76
68
  (0, $d9Rqy$focusSafely)(triggerRef.current);
77
69
  }
78
70
  lastSize.current = null;
71
+ }, [
72
+ state,
73
+ triggerRef,
74
+ onResizeEnd
75
+ ]);
76
+ let { keyboardProps: keyboardProps } = (0, $d9Rqy$useKeyboard)({
77
+ onKeyDown: (e)=>{
78
+ if (editModeEnabled) {
79
+ if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
80
+ e.preventDefault();
81
+ endResize(item);
82
+ }
83
+ } else {
84
+ // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
85
+ e.continuePropagation();
86
+ if (e.key === 'Enter') startResize(item);
87
+ }
88
+ }
79
89
  });
80
90
  const columnResizeWidthRef = (0, $d9Rqy$useRef)(0);
81
91
  const { moveProps: moveProps } = (0, $d9Rqy$useMove)({
@@ -137,10 +147,11 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
137
147
  ]);
138
148
  let resizingColumn = state.resizingColumn;
139
149
  let prevResizingColumn = (0, $d9Rqy$useRef)(null);
150
+ let startResizeEvent = (0, $d9Rqy$useEffectEvent)(startResize);
140
151
  (0, $d9Rqy$useEffect)(()=>{
141
152
  if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
142
153
  wasFocusedOnResizeStart.current = document.activeElement === ref.current;
143
- startResize(item);
154
+ startResizeEvent(item);
144
155
  // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
145
156
  let timeout = setTimeout(()=>focusInput(), 0);
146
157
  // VoiceOver on iOS has problems focusing the input from a menu.
@@ -155,8 +166,7 @@ function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
155
166
  resizingColumn,
156
167
  item,
157
168
  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C;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"}
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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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\n let startResize = useCallback((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 }, [state, onResizeStart]);\n\n let resize = useCallback((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n }, [state, onResize]);\n\n let endResize = useCallback((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 }, [state, triggerRef, onResizeEnd]);\n\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 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 let startResizeEvent = useEffectEvent(startResize);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResizeEvent(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]);\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.17.8",
3
+ "version": "3.17.9",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -26,16 +26,16 @@
26
26
  "url": "https://github.com/adobe/react-spectrum"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/focus": "^3.21.2",
30
- "@react-aria/grid": "^3.14.5",
31
- "@react-aria/i18n": "^3.12.13",
32
- "@react-aria/interactions": "^3.25.6",
29
+ "@react-aria/focus": "^3.21.3",
30
+ "@react-aria/grid": "^3.14.6",
31
+ "@react-aria/i18n": "^3.12.14",
32
+ "@react-aria/interactions": "^3.26.0",
33
33
  "@react-aria/live-announcer": "^3.4.4",
34
- "@react-aria/utils": "^3.31.0",
35
- "@react-aria/visually-hidden": "^3.8.28",
34
+ "@react-aria/utils": "^3.32.0",
35
+ "@react-aria/visually-hidden": "^3.8.29",
36
36
  "@react-stately/collections": "^3.12.8",
37
37
  "@react-stately/flags": "^3.1.2",
38
- "@react-stately/table": "^3.15.1",
38
+ "@react-stately/table": "^3.15.2",
39
39
  "@react-types/checkbox": "^3.10.2",
40
40
  "@react-types/grid": "^3.3.6",
41
41
  "@react-types/shared": "^3.32.1",
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
52
+ "gitHead": "4d838da5bfe36abb35aed166995a9ef63825370f"
53
53
  }
@@ -31,7 +31,9 @@ export interface AriaTableColumnHeaderProps<T> {
31
31
 
32
32
  export interface TableColumnHeaderAria {
33
33
  /** Props for the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader) element. */
34
- columnHeaderProps: DOMAttributes
34
+ columnHeaderProps: DOMAttributes,
35
+ /** Whether the column is currently in a pressed state. */
36
+ isPressed: boolean
35
37
  }
36
38
 
37
39
  /**
@@ -48,7 +50,7 @@ export function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, st
48
50
 
49
51
  let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
50
52
 
51
- let {pressProps} = usePress({
53
+ let {pressProps, isPressed} = usePress({
52
54
  isDisabled: !allowsSorting || isSelectionCellDisabled,
53
55
  onPress() {
54
56
  state.sort(node.key);
@@ -100,6 +102,7 @@ export function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, st
100
102
  id: getColumnHeaderId(state, node.key),
101
103
  'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
102
104
  'aria-sort': ariaSort
103
- }
105
+ },
106
+ isPressed
104
107
  };
105
108
  }
@@ -70,25 +70,8 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
70
70
  let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
71
71
 
72
72
  let {direction} = useLocale();
73
- let {keyboardProps} = useKeyboard({
74
- onKeyDown: (e) => {
75
- if (editModeEnabled) {
76
- if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
77
- e.preventDefault();
78
- endResize(item);
79
- }
80
- } else {
81
- // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
82
- e.continuePropagation();
83
73
 
84
- if (e.key === 'Enter') {
85
- startResize(item);
86
- }
87
- }
88
- }
89
- });
90
-
91
- let startResize = useEffectEvent((item) => {
74
+ let startResize = useCallback((item) => {
92
75
  if (!isResizingRef.current) {
93
76
  lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
94
77
  state.startResize(item.key);
@@ -96,15 +79,15 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
96
79
  onResizeStart?.(lastSize.current);
97
80
  }
98
81
  isResizingRef.current = true;
99
- });
82
+ }, [state, onResizeStart]);
100
83
 
101
- let resize = useEffectEvent((item, newWidth) => {
84
+ let resize = useCallback((item, newWidth) => {
102
85
  let sizes = state.updateResizedColumns(item.key, newWidth);
103
86
  onResize?.(sizes);
104
87
  lastSize.current = sizes;
105
- });
88
+ }, [state, onResize]);
106
89
 
107
- let endResize = useEffectEvent((item) => {
90
+ let endResize = useCallback((item) => {
108
91
  if (isResizingRef.current) {
109
92
  if (lastSize.current == null) {
110
93
  lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
@@ -121,6 +104,24 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
121
104
  }
122
105
  }
123
106
  lastSize.current = null;
107
+ }, [state, triggerRef, onResizeEnd]);
108
+
109
+ let {keyboardProps} = useKeyboard({
110
+ onKeyDown: (e) => {
111
+ if (editModeEnabled) {
112
+ if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {
113
+ e.preventDefault();
114
+ endResize(item);
115
+ }
116
+ } else {
117
+ // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
118
+ e.continuePropagation();
119
+
120
+ if (e.key === 'Enter') {
121
+ startResize(item);
122
+ }
123
+ }
124
+ }
124
125
  });
125
126
 
126
127
  const columnResizeWidthRef = useRef<number>(0);
@@ -194,10 +195,11 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
194
195
 
195
196
  let resizingColumn = state.resizingColumn;
196
197
  let prevResizingColumn = useRef<Key | null>(null);
198
+ let startResizeEvent = useEffectEvent(startResize);
197
199
  useEffect(() => {
198
200
  if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
199
201
  wasFocusedOnResizeStart.current = document.activeElement === ref.current;
200
- startResize(item);
202
+ startResizeEvent(item);
201
203
  // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
202
204
  let timeout = setTimeout(() => focusInput(), 0);
203
205
  // VoiceOver on iOS has problems focusing the input from a menu.
@@ -208,7 +210,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
208
210
  };
209
211
  }
210
212
  prevResizingColumn.current = resizingColumn;
211
- }, [resizingColumn, item, focusInput, ref, startResize]);
213
+ }, [resizingColumn, item, focusInput, ref]);
212
214
 
213
215
  let onChange = (e: ChangeEvent<HTMLInputElement>) => {
214
216
  let currentWidth = state.getColumnWidth(item.key);