@react-aria/grid
Advanced tools
Comparing version 3.0.1-nightly.2949 to 3.0.1-nightly.2960
var { | ||
isFocusVisible | ||
} = require("@react-aria/interactions"); | ||
var { | ||
focusSafely, | ||
@@ -7,7 +11,2 @@ getFocusableTreeWalker | ||
var { | ||
usePress, | ||
isFocusVisible | ||
} = require("@react-aria/interactions"); | ||
var { | ||
useSelectableCollection, | ||
@@ -642,3 +641,5 @@ useSelectableItem | ||
useUpdateEffect(() => { | ||
if (!state.selectionManager.isFocused) { | ||
// Do not do this when using selectionBehavior = 'replace' to avoid selection announcements | ||
// every time the user presses the arrow keys. | ||
if (!state.selectionManager.isFocused || state.selectionManager.selectionBehavior === 'replace') { | ||
return; | ||
@@ -730,3 +731,4 @@ } | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -740,17 +742,11 @@ let { | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
let isSelected = state.selectionManager.isSelected(node.key); | ||
let isDisabled = state.disabledKeys.has(node.key); // TODO: move into useSelectableItem? | ||
let { | ||
pressProps | ||
} = usePress(_babelRuntimeHelpersExtends({}, itemProps, { | ||
isDisabled | ||
})); | ||
let rowProps = _babelRuntimeHelpersExtends({ | ||
role: 'row', | ||
'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined | ||
}, pressProps); | ||
}, itemProps); | ||
@@ -778,3 +774,4 @@ if (isVirtualized) { | ||
focusMode = 'child', | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -812,12 +809,6 @@ let { | ||
focus, | ||
shouldSelectOnPressUp | ||
}); // TODO: move into useSelectableItem? | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
let isDisabled = state.disabledKeys.has(node.key) || state.disabledKeys.has(node.parentKey); | ||
let { | ||
pressProps | ||
} = usePress(_babelRuntimeHelpersExtends({}, itemProps, { | ||
isDisabled | ||
})); | ||
let onKeyDown = e => { | ||
@@ -850,3 +841,2 @@ if (!e.currentTarget.contains(e.target)) { | ||
// same as this one. In that case we need to handle focusing either the cell or the first/last | ||
// child, depending on the focus mode. | ||
let prev = keyboardDelegate.getKeyLeftOf(node.key); | ||
@@ -954,3 +944,3 @@ | ||
let gridCellProps = mergeProps(pressProps, { | ||
let gridCellProps = mergeProps(itemProps, { | ||
role: 'gridcell', | ||
@@ -957,0 +947,0 @@ onKeyDownCapture: onKeyDown, |
@@ -0,3 +1,3 @@ | ||
import { isFocusVisible } from "@react-aria/interactions"; | ||
import { focusSafely, getFocusableTreeWalker } from "@react-aria/focus"; | ||
import { usePress, isFocusVisible } from "@react-aria/interactions"; | ||
import { useSelectableCollection, useSelectableItem } from "@react-aria/selection"; | ||
@@ -600,3 +600,5 @@ import { useCollator, useLocale, useMessageFormatter } from "@react-aria/i18n"; | ||
useUpdateEffect(() => { | ||
if (!state.selectionManager.isFocused) { | ||
// Do not do this when using selectionBehavior = 'replace' to avoid selection announcements | ||
// every time the user presses the arrow keys. | ||
if (!state.selectionManager.isFocused || state.selectionManager.selectionBehavior === 'replace') { | ||
return; | ||
@@ -684,3 +686,4 @@ } | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -694,17 +697,11 @@ let { | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
let isSelected = state.selectionManager.isSelected(node.key); | ||
let isDisabled = state.disabledKeys.has(node.key); // TODO: move into useSelectableItem? | ||
let { | ||
pressProps | ||
} = usePress(_babelRuntimeHelpersEsmExtends({}, itemProps, { | ||
isDisabled | ||
})); | ||
let rowProps = _babelRuntimeHelpersEsmExtends({ | ||
role: 'row', | ||
'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined | ||
}, pressProps); | ||
}, itemProps); | ||
@@ -730,3 +727,4 @@ if (isVirtualized) { | ||
focusMode = 'child', | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -764,12 +762,6 @@ let { | ||
focus, | ||
shouldSelectOnPressUp | ||
}); // TODO: move into useSelectableItem? | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
let isDisabled = state.disabledKeys.has(node.key) || state.disabledKeys.has(node.parentKey); | ||
let { | ||
pressProps | ||
} = usePress(_babelRuntimeHelpersEsmExtends({}, itemProps, { | ||
isDisabled | ||
})); | ||
let onKeyDown = e => { | ||
@@ -802,3 +794,2 @@ if (!e.currentTarget.contains(e.target)) { | ||
// same as this one. In that case we need to handle focusing either the cell or the first/last | ||
// child, depending on the focus mode. | ||
let prev = keyboardDelegate.getKeyLeftOf(node.key); | ||
@@ -906,3 +897,3 @@ | ||
let gridCellProps = mergeProps(pressProps, { | ||
let gridCellProps = mergeProps(itemProps, { | ||
role: 'gridcell', | ||
@@ -909,0 +900,0 @@ onKeyDownCapture: onKeyDown, |
@@ -89,2 +89,4 @@ import { Direction, KeyboardDelegate, Node, AriaLabelingProps, DOMProps } from "@react-types/shared"; | ||
shouldSelectOnPressUp?: boolean; | ||
/** Handler that is called when a user performs an action on the row. */ | ||
onAction?: () => void; | ||
} | ||
@@ -110,2 +112,4 @@ export interface GridRowAria { | ||
shouldSelectOnPressUp?: boolean; | ||
/** Handler that is called when a user performs an action on the cell. */ | ||
onAction?: () => void; | ||
} | ||
@@ -112,0 +116,0 @@ interface GridCellAria { |
{ | ||
"name": "@react-aria/grid", | ||
"version": "3.0.1-nightly.2949+ab0323af3", | ||
"version": "3.0.1-nightly.2960+e3e6db065", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,13 +21,13 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/focus": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-aria/i18n": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-aria/interactions": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-aria/live-announcer": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-aria/selection": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-aria/utils": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-stately/grid": "3.0.1-nightly.2949+ab0323af3", | ||
"@react-stately/virtualizer": "3.1.6-nightly.2949+ab0323af3", | ||
"@react-types/checkbox": "3.0.0-nightly.1263+ab0323af3", | ||
"@react-types/grid": "3.0.1-nightly.2949+ab0323af3", | ||
"@react-types/shared": "3.0.0-nightly.1263+ab0323af3" | ||
"@react-aria/focus": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-aria/i18n": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-aria/interactions": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-aria/live-announcer": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-aria/selection": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-aria/utils": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-stately/grid": "3.0.1-nightly.2960+e3e6db065", | ||
"@react-stately/virtualizer": "3.1.6-nightly.2960+e3e6db065", | ||
"@react-types/checkbox": "3.0.0-nightly.1274+e3e6db065", | ||
"@react-types/grid": "3.0.1-nightly.2960+e3e6db065", | ||
"@react-types/shared": "3.0.0-nightly.1274+e3e6db065" | ||
}, | ||
@@ -41,3 +41,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "ab0323af3512117c9607304a66a33faf026929c9" | ||
"gitHead": "e3e6db06554d632e6edef831002fa3fda0cef1c2" | ||
} |
@@ -117,3 +117,5 @@ /* | ||
useUpdateEffect(() => { | ||
if (!state.selectionManager.isFocused) { | ||
// Do not do this when using selectionBehavior = 'replace' to avoid selection announcements | ||
// every time the user presses the arrow keys. | ||
if (!state.selectionManager.isFocused || state.selectionManager.selectionBehavior === 'replace') { | ||
return; | ||
@@ -120,0 +122,0 @@ } |
@@ -18,3 +18,3 @@ /* | ||
import {HTMLAttributes, KeyboardEvent as ReactKeyboardEvent, RefObject} from 'react'; | ||
import {isFocusVisible, usePress} from '@react-aria/interactions'; | ||
import {isFocusVisible} from '@react-aria/interactions'; | ||
import {mergeProps} from '@react-aria/utils'; | ||
@@ -33,3 +33,5 @@ import {Node as RSNode} from '@react-types/shared'; | ||
/** Whether selection should occur on press up instead of press down. */ | ||
shouldSelectOnPressUp?: boolean | ||
shouldSelectOnPressUp?: boolean, | ||
/** Handler that is called when a user performs an action on the cell. */ | ||
onAction?: () => void | ||
} | ||
@@ -52,3 +54,4 @@ | ||
focusMode = 'child', | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -84,9 +87,6 @@ | ||
focus, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
// TODO: move into useSelectableItem? | ||
let isDisabled = state.disabledKeys.has(node.key) || state.disabledKeys.has(node.parentKey); | ||
let {pressProps} = usePress({...itemProps, isDisabled}); | ||
let onKeyDown = (e: ReactKeyboardEvent) => { | ||
@@ -219,3 +219,3 @@ if (!e.currentTarget.contains(e.target as HTMLElement)) { | ||
let gridCellProps: HTMLAttributes<HTMLElement> = mergeProps(pressProps, { | ||
let gridCellProps: HTMLAttributes<HTMLElement> = mergeProps(itemProps, { | ||
role: 'gridcell', | ||
@@ -222,0 +222,0 @@ onKeyDownCapture: onKeyDown, |
@@ -17,3 +17,2 @@ /* | ||
import {Node} from '@react-types/shared'; | ||
import {usePress} from '@react-aria/interactions'; | ||
import {useSelectableItem} from '@react-aria/selection'; | ||
@@ -27,3 +26,5 @@ | ||
/** Whether selection should occur on press up instead of press down. */ | ||
shouldSelectOnPressUp?: boolean | ||
shouldSelectOnPressUp?: boolean, | ||
/** Handler that is called when a user performs an action on the row. */ | ||
onAction?: () => void | ||
} | ||
@@ -45,3 +46,4 @@ | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
} = props; | ||
@@ -54,15 +56,12 @@ | ||
isVirtualized, | ||
shouldSelectOnPressUp | ||
shouldSelectOnPressUp, | ||
onAction | ||
}); | ||
let isSelected = state.selectionManager.isSelected(node.key); | ||
let isDisabled = state.disabledKeys.has(node.key); | ||
// TODO: move into useSelectableItem? | ||
let {pressProps} = usePress({...itemProps, isDisabled}); | ||
let rowProps: HTMLAttributes<HTMLElement> = { | ||
role: 'row', | ||
'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined, | ||
...pressProps | ||
...itemProps | ||
}; | ||
@@ -69,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
290960
2714