@react-aria/table 3.15.4 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +201 -0
  2. package/dist/TableKeyboardDelegate.main.js +19 -11
  3. package/dist/TableKeyboardDelegate.main.js.map +1 -1
  4. package/dist/TableKeyboardDelegate.mjs +19 -11
  5. package/dist/TableKeyboardDelegate.module.js +19 -11
  6. package/dist/TableKeyboardDelegate.module.js.map +1 -1
  7. package/dist/ar-AE.main.js.map +1 -1
  8. package/dist/ar-AE.module.js.map +1 -1
  9. package/dist/bg-BG.main.js.map +1 -1
  10. package/dist/bg-BG.module.js.map +1 -1
  11. package/dist/cs-CZ.main.js.map +1 -1
  12. package/dist/cs-CZ.module.js.map +1 -1
  13. package/dist/da-DK.main.js.map +1 -1
  14. package/dist/da-DK.module.js.map +1 -1
  15. package/dist/de-DE.main.js.map +1 -1
  16. package/dist/de-DE.module.js.map +1 -1
  17. package/dist/el-GR.main.js.map +1 -1
  18. package/dist/el-GR.module.js.map +1 -1
  19. package/dist/en-US.main.js.map +1 -1
  20. package/dist/en-US.module.js.map +1 -1
  21. package/dist/es-ES.main.js.map +1 -1
  22. package/dist/es-ES.module.js.map +1 -1
  23. package/dist/et-EE.main.js.map +1 -1
  24. package/dist/et-EE.module.js.map +1 -1
  25. package/dist/fi-FI.main.js.map +1 -1
  26. package/dist/fi-FI.module.js.map +1 -1
  27. package/dist/fr-FR.main.js.map +1 -1
  28. package/dist/fr-FR.module.js.map +1 -1
  29. package/dist/he-IL.main.js.map +1 -1
  30. package/dist/he-IL.module.js.map +1 -1
  31. package/dist/hr-HR.main.js.map +1 -1
  32. package/dist/hr-HR.module.js.map +1 -1
  33. package/dist/hu-HU.main.js.map +1 -1
  34. package/dist/hu-HU.module.js.map +1 -1
  35. package/dist/it-IT.main.js.map +1 -1
  36. package/dist/it-IT.module.js.map +1 -1
  37. package/dist/ja-JP.main.js.map +1 -1
  38. package/dist/ja-JP.module.js.map +1 -1
  39. package/dist/ko-KR.main.js.map +1 -1
  40. package/dist/ko-KR.module.js.map +1 -1
  41. package/dist/lt-LT.main.js.map +1 -1
  42. package/dist/lt-LT.module.js.map +1 -1
  43. package/dist/lv-LV.main.js.map +1 -1
  44. package/dist/lv-LV.module.js.map +1 -1
  45. package/dist/nb-NO.main.js.map +1 -1
  46. package/dist/nb-NO.module.js.map +1 -1
  47. package/dist/nl-NL.main.js.map +1 -1
  48. package/dist/nl-NL.module.js.map +1 -1
  49. package/dist/pl-PL.main.js.map +1 -1
  50. package/dist/pl-PL.module.js.map +1 -1
  51. package/dist/pt-BR.main.js.map +1 -1
  52. package/dist/pt-BR.module.js.map +1 -1
  53. package/dist/pt-PT.main.js.map +1 -1
  54. package/dist/pt-PT.module.js.map +1 -1
  55. package/dist/ro-RO.main.js.map +1 -1
  56. package/dist/ro-RO.module.js.map +1 -1
  57. package/dist/ru-RU.main.js.map +1 -1
  58. package/dist/ru-RU.module.js.map +1 -1
  59. package/dist/sk-SK.main.js.map +1 -1
  60. package/dist/sk-SK.module.js.map +1 -1
  61. package/dist/sl-SI.main.js.map +1 -1
  62. package/dist/sl-SI.module.js.map +1 -1
  63. package/dist/sr-SP.main.js.map +1 -1
  64. package/dist/sr-SP.module.js.map +1 -1
  65. package/dist/sv-SE.main.js.map +1 -1
  66. package/dist/sv-SE.module.js.map +1 -1
  67. package/dist/tr-TR.main.js.map +1 -1
  68. package/dist/tr-TR.module.js.map +1 -1
  69. package/dist/types.d.ts.map +1 -1
  70. package/dist/uk-UA.main.js.map +1 -1
  71. package/dist/uk-UA.module.js.map +1 -1
  72. package/dist/useTable.main.js +3 -2
  73. package/dist/useTable.main.js.map +1 -1
  74. package/dist/useTable.mjs +3 -2
  75. package/dist/useTable.module.js +3 -2
  76. package/dist/useTable.module.js.map +1 -1
  77. package/dist/useTableCell.main.js +3 -2
  78. package/dist/useTableCell.main.js.map +1 -1
  79. package/dist/useTableCell.mjs +3 -2
  80. package/dist/useTableCell.module.js +3 -2
  81. package/dist/useTableCell.module.js.map +1 -1
  82. package/dist/useTableColumnHeader.main.js +4 -4
  83. package/dist/useTableColumnHeader.main.js.map +1 -1
  84. package/dist/useTableColumnHeader.mjs +4 -4
  85. package/dist/useTableColumnHeader.module.js +4 -4
  86. package/dist/useTableColumnHeader.module.js.map +1 -1
  87. package/dist/useTableColumnResize.main.js +2 -1
  88. package/dist/useTableColumnResize.main.js.map +1 -1
  89. package/dist/useTableColumnResize.mjs +2 -1
  90. package/dist/useTableColumnResize.module.js +2 -1
  91. package/dist/useTableColumnResize.module.js.map +1 -1
  92. package/dist/useTableRow.main.js +4 -3
  93. package/dist/useTableRow.main.js.map +1 -1
  94. package/dist/useTableRow.mjs +4 -3
  95. package/dist/useTableRow.module.js +4 -3
  96. package/dist/useTableRow.module.js.map +1 -1
  97. package/dist/useTableSelectionCheckbox.main.js.map +1 -1
  98. package/dist/useTableSelectionCheckbox.module.js.map +1 -1
  99. package/dist/utils.main.js.map +1 -1
  100. package/dist/utils.module.js.map +1 -1
  101. package/dist/zh-CN.main.js.map +1 -1
  102. package/dist/zh-CN.module.js.map +1 -1
  103. package/dist/zh-TW.main.js.map +1 -1
  104. package/dist/zh-TW.module.js.map +1 -1
  105. package/package.json +20 -19
  106. package/src/TableKeyboardDelegate.ts +23 -12
  107. package/src/useTable.ts +4 -2
  108. package/src/useTableCell.ts +3 -3
  109. package/src/useTableColumnHeader.ts +3 -3
  110. package/src/useTableColumnResize.ts +4 -4
  111. package/src/useTableRow.ts +3 -3
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc,SAAS,EAAC,GAAG;IAC5G,MAAM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AQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef(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 = 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(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoDM,SAAS,0CAAwB,KAAoC,EAAE,KAAgC,EAAE,GAAuC;IACrJ,IAAI,EAAC,QAAQ,IAAI,cAAE,UAAU,cAAE,UAAU,iBAAE,aAAa,YAAE,QAAQ,eAAE,WAAW,EAAE,cAAc,SAAS,EAAC,GAAG;IAC5G,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAClE,IAAI,KAAK,CAAA,GAAA,YAAI;IACb,IAAI,aAAa,MAAM,cAAc,KAAK,KAAK,GAAG;IAClD,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAE;IAC3B,IAAI,WAAW,CAAA,GAAA,aAAK,EAA+B;IACnD,IAAI,0BAA0B,CAAA,GAAA,aAAK,EAAE;IACrC,IAAI,kBAAkB,MAAM,UAAU,CAAC,4BAA4B;IAEnE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;QAChC,WAAW,CAAC;YACV,IAAI,iBACF;gBAAA,IAAI,EAAE,GAAG,KAAK,YAAY,EAAE,GAAG,KAAK,WAAW,EAAE,GAAG,KAAK,OAAO,EAAE,GAAG,KAAK,OAAO;oBAC/E,EAAE,cAAc;oBAChB,UA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EAAE,WAAW,KAAK,YACxE;YAEF,IAAI,EAAE,WAAW,KAAK,aAAa,MAAM,cAAc,IAAI,MAAM;gBAC/D,UAAU;gBACV;YACF;YAEA,0GAA0G;YAC1G,iCAAiC;YACjC;YAEA,gIAAgI;YAChI,kDAAkD;YAClD,IAAI,EAAE,WAAW,KAAK,WACpB,YAAY;QAEhB;QACA,SAAS,CAAC;YACR,IAAI,AAAC,CAAA,AAAC,EAAE,WAAW,KAAK,WAAW,wBAAwB,OAAO,IAAK,EAAE,WAAW,KAAK,OAAM,KAAM,MAAM,cAAc,IAAI,MAC3H,UAAU;QAEd;IACF;IACA,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,OAAO;QACL,cAAc,CAAA,GAAA,iBAAS,EACrB,eACA;YAAC,GAAG,SAAS;uBAAE;QAAS,GACxB,YACA;YAAC,OAAO;gBAAC,aAAa;YAAM;QAAC;QAE/B,YAAY,CAAA,GAAA,iBAAS,EACnB,qBACA;gBACE;YACA,QAAQ;gBACN,UAAU;YACZ;sBACA;YACA,UAAU;QACZ,GACA;oBAEF;IACF;AACF","sources":["packages/@react-aria/table/src/useTableColumnResize.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ChangeEvent, useCallback, useEffect, useRef} from 'react';\nimport {ColumnSize} from '@react-types/table';\nimport {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';\nimport {focusSafely} from '@react-aria/focus';\nimport {getColumnHeaderId} from './utils';\nimport {GridNode} from '@react-types/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useDescription, useEffectEvent, useId} from '@react-aria/utils';\nimport {TableColumnResizeState} from '@react-stately/table';\nimport {useInteractionModality, useKeyboard, useMove, usePress} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport interface TableColumnResizeAria {\n /** Props for the visually hidden input element. */\n inputProps: DOMAttributes,\n /** Props for the resizer element. */\n resizerProps: DOMAttributes,\n /** Whether this column is currently being resized. */\n isResizing: boolean\n}\n\nexport interface AriaTableColumnResizeProps<T> {\n /** An object representing the [column header](https://www.w3.org/TR/wai-aria-1.1/#columnheader). Contains all the relevant information that makes up the column header. */\n column: GridNode<T>,\n /** Aria label for the hidden input. Gets read when resizing. */\n 'aria-label': string,\n /**\n * Ref to the trigger if resizing was started from a column header menu. If it's provided,\n * focus will be returned there when resizing is done. If it isn't provided, it is assumed that the resizer is\n * visible at all time and keyboard resizing is started via pressing Enter on the resizer and not on focus.\n * */\n triggerRef?: RefObject<FocusableElement | null>,\n /** If resizing is disabled. */\n isDisabled?: boolean,\n /** Called when resizing starts. */\n onResizeStart?: (widths: Map<Key, ColumnSize>) => void,\n /** Called for every resize event that results in new column sizes. */\n onResize?: (widths: Map<Key, ColumnSize>) => void,\n /** Called when resizing ends. */\n onResizeEnd?: (widths: Map<Key, ColumnSize>) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table column resizer element.\n * @param props - Props for the resizer.\n * @param state - State for the table's resizable columns, as returned by `useTableColumnResizeState`.\n * @param ref - The ref attached to the resizer's visually hidden input element.\n */\nexport function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, state: TableColumnResizeState<T>, ref: RefObject<HTMLInputElement | null>): TableColumnResizeAria {\n let {column: item, triggerRef, isDisabled, onResizeStart, onResize, onResizeEnd, 'aria-label': ariaLabel} = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let id = useId();\n let isResizing = state.resizingColumn === item.key;\n let isResizingRef = useRef(isResizing);\n let lastSize = useRef<Map<Key, ColumnSize> | null>(null);\n let wasFocusedOnResizeStart = useRef(false);\n let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;\n\n let {direction} = useLocale();\n let {keyboardProps} = useKeyboard({\n onKeyDown: (e) => {\n if (editModeEnabled) {\n if (e.key === 'Escape' || e.key === 'Enter' || e.key === ' ' || e.key === 'Tab') {\n e.preventDefault();\n endResize(item);\n }\n } else {\n // Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there\n e.continuePropagation();\n\n if (e.key === 'Enter') {\n startResize(item);\n }\n }\n }\n });\n\n let startResize = useEffectEvent((item) => {\n if (!isResizingRef.current) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n state.startResize(item.key);\n state.tableState.setKeyboardNavigationDisabled(true);\n onResizeStart?.(lastSize.current);\n }\n isResizingRef.current = true;\n });\n\n let resize = useEffectEvent((item, newWidth) => {\n let sizes = state.updateResizedColumns(item.key, newWidth);\n onResize?.(sizes);\n lastSize.current = sizes;\n });\n\n let endResize = useEffectEvent((item) => {\n if (isResizingRef.current) {\n if (lastSize.current == null) {\n lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));\n }\n\n state.endResize();\n state.tableState.setKeyboardNavigationDisabled(false);\n onResizeEnd?.(lastSize.current);\n isResizingRef.current = false;\n\n if (triggerRef?.current && !wasFocusedOnResizeStart.current) {\n // switch focus back to the column header unless the resizer was already focused when resizing started.\n focusSafely(triggerRef.current);\n }\n }\n lastSize.current = null;\n });\n\n const columnResizeWidthRef = useRef<number>(0);\n const {moveProps} = useMove({\n onMoveStart() {\n columnResizeWidthRef.current = state.getColumnWidth(item.key);\n startResize(item);\n },\n onMove(e) {\n let {deltaX, deltaY, pointerType} = e;\n if (direction === 'rtl') {\n deltaX *= -1;\n }\n if (pointerType === 'keyboard') {\n if (deltaY !== 0 && deltaX === 0) {\n deltaX = deltaY * -1;\n }\n deltaX *= 10;\n }\n // if moving up/down only, no need to resize\n if (deltaX !== 0) {\n columnResizeWidthRef.current += deltaX;\n resize(item, columnResizeWidthRef.current);\n }\n },\n onMoveEnd(e) {\n let {pointerType} = e;\n columnResizeWidthRef.current = 0;\n if (pointerType === 'mouse' || (pointerType === 'touch' && wasFocusedOnResizeStart.current)) {\n endResize(item);\n }\n }\n });\n\n let onKeyDown = useCallback((e) => {\n if (editModeEnabled) {\n moveProps.onKeyDown?.(e);\n }\n }, [editModeEnabled, moveProps]);\n\n\n let min = Math.floor(state.getColumnMinWidth(item.key));\n let max = Math.floor(state.getColumnMaxWidth(item.key));\n if (max === Infinity) {\n max = Number.MAX_SAFE_INTEGER;\n }\n let value = Math.floor(state.getColumnWidth(item.key));\n let modality: string | null = useInteractionModality();\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n let description = triggerRef?.current == null && (modality === 'keyboard' || modality === 'virtual') && !isResizing ? stringFormatter.format('resizerDescription') : undefined;\n let descriptionProps = useDescription(description);\n let ariaProps = {\n 'aria-label': ariaLabel,\n 'aria-orientation': 'horizontal' as 'horizontal',\n 'aria-labelledby': `${id} ${getColumnHeaderId(state.tableState, item.key)}`,\n 'aria-valuetext': stringFormatter.format('columnSize', {value}),\n 'type': 'range',\n min,\n max,\n value,\n ...descriptionProps\n };\n\n const focusInput = useCallback(() => {\n if (ref.current) {\n focusSafely(ref.current);\n }\n }, [ref]);\n\n let resizingColumn = state.resizingColumn;\n let prevResizingColumn = useRef<Key | null>(null);\n useEffect(() => {\n if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {\n wasFocusedOnResizeStart.current = document.activeElement === ref.current;\n startResize(item);\n // Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073\n let timeout = setTimeout(() => focusInput(), 0);\n // VoiceOver on iOS has problems focusing the input from a menu.\n let VOTimeout = setTimeout(focusInput, 400);\n return () => {\n clearTimeout(timeout);\n clearTimeout(VOTimeout);\n };\n }\n prevResizingColumn.current = resizingColumn;\n }, [resizingColumn, item, focusInput, ref, startResize]);\n\n let onChange = (e: ChangeEvent<HTMLInputElement>) => {\n let currentWidth = state.getColumnWidth(item.key);\n let nextValue = parseFloat(e.target.value);\n\n if (nextValue > currentWidth) {\n nextValue = currentWidth + 10;\n } else {\n nextValue = currentWidth - 10;\n }\n resize(item, nextValue);\n };\n\n let {pressProps} = usePress({\n onPressStart: (e) => {\n if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === 'keyboard') {\n return;\n }\n if (e.pointerType === 'virtual' && state.resizingColumn != null) {\n endResize(item);\n return;\n }\n\n // Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away\n // can cancel resize mode for us.\n focusInput();\n\n // If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need\n // to handle a virtual click to start the resizer.\n if (e.pointerType !== 'virtual') {\n startResize(item);\n }\n },\n onPress: (e) => {\n if (((e.pointerType === 'touch' && wasFocusedOnResizeStart.current) || e.pointerType === 'mouse') && state.resizingColumn != null) {\n endResize(item);\n }\n }\n });\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n return {\n resizerProps: mergeProps(\n keyboardProps,\n {...moveProps, onKeyDown},\n pressProps,\n {style: {touchAction: 'none'}}\n ),\n inputProps: mergeProps(\n visuallyHiddenProps,\n {\n id,\n onBlur: () => {\n endResize(item);\n },\n onChange,\n disabled: isDisabled\n },\n ariaProps\n ),\n isResizing\n };\n}\n"],"names":[],"version":3,"file":"useTableColumnResize.module.js.map"}
@@ -47,8 +47,9 @@ function $10b2115217af7c93$export$7f2f6ae19e707aa5(props, state, ref) {
47
47
  if ((0, $6RVcf$reactstatelyflags.tableNestedRows)() && 'expandedKeys' in state) {
48
48
  let treeNode = state.keyMap.get(node.key);
49
49
  if (treeNode != null) {
50
- var _treeNode_props, _treeNode_props_children, _treeNode_props1;
50
+ var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
51
51
  let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
52
+ var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
52
53
  treeGridRowProps = {
53
54
  onKeyDown: (e)=>{
54
55
  if (e.key === $10b2115217af7c93$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
@@ -61,8 +62,8 @@ function $10b2115217af7c93$export$7f2f6ae19e707aa5(props, state, ref) {
61
62
  },
62
63
  'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
63
64
  'aria-level': treeNode.level,
64
- 'aria-posinset': treeNode.indexOfType + 1,
65
- 'aria-setsize': treeNode.level > 1 ? (0, $6RVcf$reactstatelycollections.getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $6RVcf$reactstatelycollections.getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
65
+ 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
66
+ 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $6RVcf$reactstatelycollections.getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $6RVcf$reactstatelycollections.getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
66
67
  };
67
68
  }
68
69
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAuC;IACrI,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,+BAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAE1B,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,wCAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,2BAA2B;SAE5G,OAAO,QAAQ,CAAC,gBAAgB;IAGlC,IAAI,mBAAgD,CAAC;IACrD,IAAI,CAAA,GAAA,wCAAc,OAAO,kBAAkB,OAAO;QAChD,IAAI,WAAW,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG;QACxC,IAAI,YAAY,MAAM;gBACD,iBAAuC,0BAAA;YAA1D,IAAI,eAAe,EAAA,kBAAA,SAAS,KAAK,cAAd,sCAAA,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B,EAAE,KAAK,KAAK;IACzD,IAAI,YAAY,OAAO,SAAS,GAAG,qBAAqB,CAAC;IACzD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': treeNode.indexOfType + 1,\n 'aria-setsize': treeNode.level > 1 ?\n (getLastItem(state.keyMap.get(treeNode?.parentKey).childNodes) as GridNode<T>).indexOfType + 1 :\n (getLastItem(state.keyMap.get(state.collection.body.key).childNodes) as GridNode<T>).indexOfType + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;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mBAAmB,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': (treeNode.indexOfType ?? 0) + 1,\n 'aria-setsize': treeNode.level > 1 ?\n ((getLastItem(state.keyMap.get(treeNode.parentKey!)?.childNodes ?? []) as GridNode<T>)?.indexOfType ?? 0) + 1 :\n ((getLastItem(state.collection.body.childNodes) as GridNode<T>)?.indexOfType ?? 0) + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.main.js.map"}
@@ -41,8 +41,9 @@ function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
41
41
  if ((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state) {
42
42
  let treeNode = state.keyMap.get(node.key);
43
43
  if (treeNode != null) {
44
- var _treeNode_props, _treeNode_props_children, _treeNode_props1;
44
+ var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
45
45
  let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
46
+ var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
46
47
  treeGridRowProps = {
47
48
  onKeyDown: (e)=>{
48
49
  if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
@@ -55,8 +56,8 @@ function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
55
56
  },
56
57
  'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
57
58
  'aria-level': treeNode.level,
58
- 'aria-posinset': treeNode.indexOfType + 1,
59
- 'aria-setsize': treeNode.level > 1 ? (0, $2K6sg$getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $2K6sg$getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
59
+ 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
60
+ 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $2K6sg$getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $2K6sg$getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
60
61
  };
61
62
  }
62
63
  }
@@ -41,8 +41,9 @@ function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
41
41
  if ((0, $2K6sg$tableNestedRows)() && 'expandedKeys' in state) {
42
42
  let treeNode = state.keyMap.get(node.key);
43
43
  if (treeNode != null) {
44
- var _treeNode_props, _treeNode_props_children, _treeNode_props1;
44
+ var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
45
45
  let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
46
+ var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
46
47
  treeGridRowProps = {
47
48
  onKeyDown: (e)=>{
48
49
  if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS['expand'][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {
@@ -55,8 +56,8 @@ function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
55
56
  },
56
57
  'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,
57
58
  'aria-level': treeNode.level,
58
- 'aria-posinset': treeNode.indexOfType + 1,
59
- 'aria-setsize': treeNode.level > 1 ? (0, $2K6sg$getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $2K6sg$getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
59
+ 'aria-posinset': ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
60
+ 'aria-setsize': treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = (0, $2K6sg$getLastItem)((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = (0, $2K6sg$getLastItem)(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
60
61
  };
61
62
  }
62
63
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAuC;IACrI,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,iBAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAE1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M,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI;gBACnG,cAAc,SAAS,KAAK;gBAC5B,iBAAiB,SAAS,WAAW,GAAG;gBACxC,gBAAgB,SAAS,KAAK,GAAG,IAC/B,AAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAA,+BAAA,SAAU,SAAS,EAAE,UAAU,EAAkB,WAAW,GAAG,IAC7F,AAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAkB,WAAW,GAAG;YACvG;QACF;IACF;IAEA,IAAI,qBAAqB,CAAA,GAAA,4BAAoB,EAAE,KAAK,KAAK;IACzD,IAAI,YAAY,OAAO,SAAS,GAAG,qBAAqB,CAAC;IACzD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': treeNode.indexOfType + 1,\n 'aria-setsize': treeNode.level > 1 ?\n (getLastItem(state.keyMap.get(treeNode?.parentKey).childNodes) as GridNode<T>).indexOfType + 1 :\n (getLastItem(state.keyMap.get(state.collection.body.key).childNodes) as GridNode<T>).indexOfType + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAuC;IACrI,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,iBAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAE1B,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,sBAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,2BAA2B;SAE5G,OAAO,QAAQ,CAAC,gBAAgB;IAGlC,IAAI,mBAAgD,CAAC;IACrD,IAAI,CAAA,GAAA,sBAAc,OAAO,kBAAkB,OAAO;QAChD,IAAI,WAAW,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG;QACxC,IAAI,YAAY,MAAM;gBACD,iBAAuC,0BAAA,kBAepD,cAAY,mBACZ;YAhBN,IA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AAnE,mCAAD,AAAC,aAAsF,WAAW,cAAlG,sCAAA,2BAAsG,CAAA,IAAK,IAC5G,AAAC,CAAA,CAAA,6BAAC,gBAAA,CAAA,GAAA,kBAAU,EAAE,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,eAA5C,oCAAD,AAAC,cAA+D,WAAW,cAA3E,uCAAA,4BAA+E,CAAA,IAAK;YACzF;QACF;IACF;IAEA,IAAI,qBAAqB,CAAA,GAAA,4BAAoB,EAAE,KAAK,KAAK;IACzD,IAAI,YAAY,OAAO,SAAS,GAAG,qBAAqB,CAAC;IACzD,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement, RefObject} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes} from 'react';\nimport {mergeProps, useSyntheticLinkProps} from '@react-aria/utils';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement | null>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': (treeNode.indexOfType ?? 0) + 1,\n 'aria-setsize': treeNode.level > 1 ?\n ((getLastItem(state.keyMap.get(treeNode.parentKey!)?.childNodes ?? []) as GridNode<T>)?.indexOfType ?? 0) + 1 :\n ((getLastItem(state.collection.body.childNodes) as GridNode<T>)?.indexOfType ?? 0) + 1\n };\n }\n }\n\n let syntheticLinkProps = useSyntheticLinkProps(node.props);\n let linkProps = states.hasAction ? syntheticLinkProps : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,6CAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,CAAC;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,6CAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,GAAG,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,0CAAe,EAAE,OAAO,MAAM;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,+BAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,CAAC;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.module.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,+BAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,GAAG,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,wCAAe,EAAE,OAAO,MAAM;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,WAAW,CAAC;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,WAAW,CAAC;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,GAAG,OAAO,CAAC,EAAE,mCAAa,YAAY;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,GAAG,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,YAAY;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,WAAW,CAAC;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,WAAW,CAAC;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,GAAG,OAAO,CAAC,EAAE,mCAAa,YAAY;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,GAAG,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,YAAY;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACvD,cAAc,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACxD,sBAAsB,CAAC,wGAAa,CAAC;IACrC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-CN.json"],"sourcesContent":["{\n \"ascending\": \"升序\",\n \"ascendingSort\": \"按列 {columnName} 升序排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"降序\",\n \"descendingSort\": \"按列 {columnName} 降序排序\",\n \"resizerDescription\": \"按“输入”键开始调整大小。\",\n \"select\": \"选择\",\n \"selectAll\": \"全选\",\n \"sortable\": \"可排序的列\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
1
+ {"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACvD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACxD,sBAAsB,CAAC,wGAAa,CAAC;IACrC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-CN.json"],"sourcesContent":["{\n \"ascending\": \"升序\",\n \"ascendingSort\": \"按列 {columnName} 升序排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"降序\",\n \"descendingSort\": \"按列 {columnName} 降序排序\",\n \"resizerDescription\": \"按“输入”键开始调整大小。\",\n \"select\": \"选择\",\n \"selectAll\": \"全选\",\n \"sortable\": \"可排序的列\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACvD,cAAc,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACxD,sBAAsB,CAAC,wGAAa,CAAC;IACrC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-CN.json"],"sourcesContent":["{\n \"ascending\": \"升序\",\n \"ascendingSort\": \"按列 {columnName} 升序排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"降序\",\n \"descendingSort\": \"按列 {columnName} 降序排序\",\n \"resizerDescription\": \"按“输入”键开始调整大小。\",\n \"select\": \"选择\",\n \"selectAll\": \"全选\",\n \"sortable\": \"可排序的列\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
1
+ {"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACvD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,iBAAG,EAAE,KAAK,UAAU,CAAC,iCAAK,CAAC;IACxD,sBAAsB,CAAC,wGAAa,CAAC;IACrC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-CN.json"],"sourcesContent":["{\n \"ascending\": \"升序\",\n \"ascendingSort\": \"按列 {columnName} 升序排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"降序\",\n \"descendingSort\": \"按列 {columnName} 降序排序\",\n \"resizerDescription\": \"按“输入”键开始调整大小。\",\n \"select\": \"选择\",\n \"selectAll\": \"全选\",\n \"sortable\": \"可排序的列\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IACzD,cAAc,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IAC1D,sBAAsB,CAAC,+EAAgB,CAAC;IACxC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-TW.json"],"sourcesContent":["{\n \"ascending\": \"遞增\",\n \"ascendingSort\": \"已依據「{columnName}」欄遞增排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"遞減\",\n \"descendingSort\": \"已依據「{columnName}」欄遞減排序\",\n \"resizerDescription\": \"按 Enter 鍵以開始調整大小\",\n \"select\": \"選取\",\n \"selectAll\": \"全選\",\n \"sortable\": \"可排序的欄\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
1
+ {"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IACzD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IAC1D,sBAAsB,CAAC,+EAAgB,CAAC;IACxC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-TW.json"],"sourcesContent":["{\n \"ascending\": \"遞增\",\n \"ascendingSort\": \"已依據「{columnName}」欄遞增排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"遞減\",\n \"descendingSort\": \"已依據「{columnName}」欄遞減排序\",\n \"resizerDescription\": \"按 Enter 鍵以開始調整大小\",\n \"select\": \"選取\",\n \"selectAll\": \"全選\",\n \"sortable\": \"可排序的欄\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IACzD,cAAc,CAAC,OAAS,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IAC1D,sBAAsB,CAAC,+EAAgB,CAAC;IACxC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-TW.json"],"sourcesContent":["{\n \"ascending\": \"遞增\",\n \"ascendingSort\": \"已依據「{columnName}」欄遞增排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"遞減\",\n \"descendingSort\": \"已依據「{columnName}」欄遞減排序\",\n \"resizerDescription\": \"按 Enter 鍵以開始調整大小\",\n \"select\": \"選取\",\n \"selectAll\": \"全選\",\n \"sortable\": \"可排序的欄\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
1
+ {"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IACzD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IAC1D,sBAAsB,CAAC,+EAAgB,CAAC;IACxC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-TW.json"],"sourcesContent":["{\n \"ascending\": \"遞增\",\n \"ascendingSort\": \"已依據「{columnName}」欄遞增排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"遞減\",\n \"descendingSort\": \"已依據「{columnName}」欄遞減排序\",\n \"resizerDescription\": \"按 Enter 鍵以開始調整大小\",\n \"select\": \"選取\",\n \"selectAll\": \"全選\",\n \"sortable\": \"可排序的欄\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/table",
3
- "version": "3.15.4",
3
+ "version": "3.16.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,27 +22,28 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.18.3",
26
- "@react-aria/grid": "^3.10.4",
27
- "@react-aria/i18n": "^3.12.3",
28
- "@react-aria/interactions": "^3.22.3",
29
- "@react-aria/live-announcer": "^3.4.0",
30
- "@react-aria/utils": "^3.25.3",
31
- "@react-aria/visually-hidden": "^3.8.16",
32
- "@react-stately/collections": "^3.11.0",
33
- "@react-stately/flags": "^3.0.4",
34
- "@react-stately/table": "^3.12.3",
35
- "@react-types/checkbox": "^3.8.4",
36
- "@react-types/grid": "^3.2.9",
37
- "@react-types/shared": "^3.25.0",
38
- "@react-types/table": "^3.10.2",
25
+ "@react-aria/focus": "^3.19.0",
26
+ "@react-aria/grid": "^3.11.0",
27
+ "@react-aria/i18n": "^3.12.4",
28
+ "@react-aria/interactions": "^3.22.5",
29
+ "@react-aria/live-announcer": "^3.4.1",
30
+ "@react-aria/utils": "^3.26.0",
31
+ "@react-aria/visually-hidden": "^3.8.18",
32
+ "@react-stately/collections": "^3.12.0",
33
+ "@react-stately/flags": "^3.0.5",
34
+ "@react-stately/table": "^3.13.0",
35
+ "@react-types/checkbox": "^3.9.0",
36
+ "@react-types/grid": "^3.2.10",
37
+ "@react-types/shared": "^3.26.0",
38
+ "@react-types/table": "^3.10.3",
39
39
  "@swc/helpers": "^0.5.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
43
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
42
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
43
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
47
- }
48
- }
47
+ },
48
+ "gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
49
+ }
@@ -24,7 +24,7 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
24
24
  getKeyBelow(key: Key) {
25
25
  let startItem = this.collection.getItem(key);
26
26
  if (!startItem) {
27
- return;
27
+ return null;
28
28
  }
29
29
 
30
30
  // If focus was on a column, then focus the first child column if any,
@@ -37,11 +37,14 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
37
37
 
38
38
  let firstKey = this.getFirstKey();
39
39
  if (firstKey == null) {
40
- return;
40
+ return null;
41
41
  }
42
42
 
43
43
  let firstItem = this.collection.getItem(firstKey);
44
- return getNthItem(getChildNodes(firstItem, this.collection), startItem.index).key;
44
+ if (!firstItem) {
45
+ return null;
46
+ }
47
+ return getNthItem(getChildNodes(firstItem, this.collection), startItem.index)?.key ?? null;
45
48
  }
46
49
 
47
50
  return super.getKeyBelow(key);
@@ -50,22 +53,23 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
50
53
  getKeyAbove(key: Key) {
51
54
  let startItem = this.collection.getItem(key);
52
55
  if (!startItem) {
53
- return;
56
+ return null;
54
57
  }
55
58
 
56
59
  // If focus was on a column, focus the parent column if any
57
60
  if (startItem.type === 'column') {
58
- let parent = this.collection.getItem(startItem.parentKey);
61
+ let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;
59
62
  if (parent && parent.type === 'column') {
60
63
  return parent.key;
61
64
  }
62
65
 
63
- return;
66
+ return null;
64
67
  }
65
68
 
66
69
  // only return above row key if not header row
67
70
  let superKey = super.getKeyAbove(key);
68
- if (superKey != null && this.collection.getItem(superKey).type !== 'headerrow') {
71
+ let superItem = superKey != null ? this.collection.getItem(superKey) : null;
72
+ if (superItem && superItem.type !== 'headerrow') {
69
73
  return superKey;
70
74
  }
71
75
 
@@ -93,6 +97,8 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
93
97
  return item.key;
94
98
  }
95
99
  }
100
+
101
+ return null;
96
102
  }
97
103
 
98
104
  private findPreviousColumnKey(column: Node<T>) {
@@ -111,12 +117,14 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
111
117
  return item.key;
112
118
  }
113
119
  }
120
+
121
+ return null;
114
122
  }
115
123
 
116
124
  getKeyRightOf(key: Key) {
117
125
  let item = this.collection.getItem(key);
118
126
  if (!item) {
119
- return;
127
+ return null;
120
128
  }
121
129
 
122
130
  // If focus was on a column, then focus the next column
@@ -132,7 +140,7 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
132
140
  getKeyLeftOf(key: Key) {
133
141
  let item = this.collection.getItem(key);
134
142
  if (!item) {
135
- return;
143
+ return null;
136
144
  }
137
145
 
138
146
  // If focus was on a column, then focus the previous column
@@ -158,13 +166,16 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
158
166
 
159
167
  // If the starting key is a cell, search from its parent row.
160
168
  let startItem = collection.getItem(key);
161
- if (startItem.type === 'cell') {
162
- key = startItem.parentKey;
169
+ if (startItem?.type === 'cell') {
170
+ key = startItem.parentKey ?? null;
163
171
  }
164
172
 
165
173
  let hasWrapped = false;
166
174
  while (key != null) {
167
175
  let item = collection.getItem(key);
176
+ if (!item) {
177
+ return null;
178
+ }
168
179
 
169
180
  // Check each of the row header cells in this row for a match
170
181
  for (let cell of getChildNodes(item, this.collection)) {
@@ -174,7 +185,7 @@ export class TableKeyboardDelegate<T> extends GridKeyboardDelegate<T, TableColle
174
185
  if (this.collator.compare(substring, search) === 0) {
175
186
  // If we started on a cell, end on the matching cell. Otherwise, end on the row.
176
187
  let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
177
- return fromItem.type === 'cell'
188
+ return fromItem?.type === 'cell'
178
189
  ? cell.key
179
190
  : item.key;
180
191
  }
package/src/useTable.ts CHANGED
@@ -96,7 +96,7 @@ export function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGr
96
96
  let {column, direction: sortDirection} = state.sortDescriptor || {};
97
97
  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');
98
98
  let sortDescription = useMemo(() => {
99
- let columnName = state.collection.columns.find(c => c.key === column)?.textValue;
99
+ let columnName = state.collection.columns.find(c => c.key === column)?.textValue ?? '';
100
100
  return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {columnName}) : undefined;
101
101
  // eslint-disable-next-line react-hooks/exhaustive-deps
102
102
  }, [sortDirection, column, state.collection.columns]);
@@ -105,7 +105,9 @@ export function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGr
105
105
 
106
106
  // Only announce after initial render, tabbing to the table will tell you the initial sort info already
107
107
  useUpdateEffect(() => {
108
- announce(sortDescription, 'assertive', 500);
108
+ if (sortDescription) {
109
+ announce(sortDescription, 'assertive', 500);
110
+ }
109
111
  }, [sortDescription]);
110
112
 
111
113
  return {
@@ -46,10 +46,10 @@ export interface TableCellAria {
46
46
  */
47
47
  export function useTableCell<T>(props: AriaTableCellProps, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableCellAria {
48
48
  let {gridCellProps, isPressed} = useGridCell(props, state, ref);
49
- let columnKey = props.node.column.key;
50
- if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
49
+ let columnKey = props.node.column?.key;
50
+ if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
51
51
  gridCellProps.role = 'rowheader';
52
- gridCellProps.id = getCellId(state, props.node.parentKey, columnKey);
52
+ gridCellProps.id = getCellId(state, props.node.parentKey!, columnKey);
53
53
  }
54
54
 
55
55
  return {
@@ -60,7 +60,7 @@ export function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, st
60
60
  // Needed to pick up the focusable context, enabling things like Tooltips for example
61
61
  let {focusableProps} = useFocusable({}, ref);
62
62
 
63
- let ariaSort: DOMAttributes['aria-sort'] = null;
63
+ let ariaSort: DOMAttributes['aria-sort'] | undefined = undefined;
64
64
  let isSortedColumn = state.sortDescriptor?.column === node.key;
65
65
  let sortDirection = state.sortDescriptor?.direction;
66
66
  // aria-sort not supported in Android Talkback
@@ -95,11 +95,11 @@ export function useTableColumnHeader<T>(props: AriaTableColumnHeaderProps<T>, st
95
95
  focusableProps,
96
96
  descriptionProps,
97
97
  // If the table is empty, make all column headers untabbable
98
- shouldDisableFocus && {tabIndex: -1}
98
+ shouldDisableFocus ? {tabIndex: -1} : null
99
99
  ),
100
100
  role: 'columnheader',
101
101
  id: getColumnHeaderId(state, node.key),
102
- 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : null,
102
+ 'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : undefined,
103
103
  'aria-sort': ariaSort
104
104
  }
105
105
  };
@@ -66,7 +66,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
66
66
  let id = useId();
67
67
  let isResizing = state.resizingColumn === item.key;
68
68
  let isResizingRef = useRef(isResizing);
69
- let lastSize = useRef(null);
69
+ let lastSize = useRef<Map<Key, ColumnSize> | null>(null);
70
70
  let wasFocusedOnResizeStart = useRef(false);
71
71
  let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
72
72
 
@@ -158,7 +158,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
158
158
 
159
159
  let onKeyDown = useCallback((e) => {
160
160
  if (editModeEnabled) {
161
- moveProps.onKeyDown(e);
161
+ moveProps.onKeyDown?.(e);
162
162
  }
163
163
  }, [editModeEnabled, moveProps]);
164
164
 
@@ -169,7 +169,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
169
169
  max = Number.MAX_SAFE_INTEGER;
170
170
  }
171
171
  let value = Math.floor(state.getColumnWidth(item.key));
172
- let modality: string = useInteractionModality();
172
+ let modality: string | null = useInteractionModality();
173
173
  if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {
174
174
  modality = 'touch';
175
175
  }
@@ -194,7 +194,7 @@ export function useTableColumnResize<T>(props: AriaTableColumnResizeProps<T>, st
194
194
  }, [ref]);
195
195
 
196
196
  let resizingColumn = state.resizingColumn;
197
- let prevResizingColumn = useRef(null);
197
+ let prevResizingColumn = useRef<Key | null>(null);
198
198
  useEffect(() => {
199
199
  if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
200
200
  wasFocusedOnResizeStart.current = document.activeElement === ref.current;