@react-aria/utils
Advanced tools
Comparing version 3.0.0-nightly.680 to 3.0.0-nightly.681
@@ -223,4 +223,11 @@ var _clsx = $parcel$interopDefault(require("clsx")); | ||
let dragging = useRef(false); | ||
let prevPosition = useRef(0); | ||
let prevPosition = useRef(0); // Keep track of the current handlers in a ref so that the events can access them. | ||
let handlers = useRef({ | ||
onPositionChange, | ||
onDrag | ||
}); | ||
handlers.current.onDrag = onDrag; | ||
handlers.current.onPositionChange = onPositionChange; | ||
let onMouseDragged = e => { | ||
@@ -233,8 +240,8 @@ e.preventDefault(); | ||
if (onDrag) { | ||
onDrag(true); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(true); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -259,8 +266,8 @@ } | ||
if (onDrag) { | ||
onDrag(false); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(false); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -274,3 +281,3 @@ | ||
let onMouseDown = e => { | ||
const target = e.currentTarget; // If we're already handling dragging on a descendant with useDrag1D, then | ||
const target = e.currentTarget; // If we're already handling dragging on a descendant with useDrag1D, then | ||
// we don't want to handle the drag motion on this target as well. | ||
@@ -277,0 +284,0 @@ |
@@ -187,4 +187,11 @@ import _clsx from "clsx"; | ||
let dragging = useRef(false); | ||
let prevPosition = useRef(0); | ||
let prevPosition = useRef(0); // Keep track of the current handlers in a ref so that the events can access them. | ||
let handlers = useRef({ | ||
onPositionChange, | ||
onDrag | ||
}); | ||
handlers.current.onDrag = onDrag; | ||
handlers.current.onPositionChange = onPositionChange; | ||
let onMouseDragged = e => { | ||
@@ -197,8 +204,8 @@ e.preventDefault(); | ||
if (onDrag) { | ||
onDrag(true); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(true); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -223,8 +230,8 @@ } | ||
if (onDrag) { | ||
onDrag(false); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(false); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -238,3 +245,3 @@ | ||
let onMouseDown = e => { | ||
const target = e.currentTarget; // If we're already handling dragging on a descendant with useDrag1D, then | ||
const target = e.currentTarget; // If we're already handling dragging on a descendant with useDrag1D, then | ||
// we don't want to handle the drag motion on this target as well. | ||
@@ -241,0 +248,0 @@ |
{ | ||
"name": "@react-aria/utils", | ||
"version": "3.0.0-nightly.680+3ee5685e", | ||
"version": "3.0.0-nightly.681+1ad0f163", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,4 +21,4 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/ssr": "3.0.0-nightly.2358+3ee5685e", | ||
"@react-types/shared": "3.0.0-nightly.680+3ee5685e", | ||
"@react-aria/ssr": "3.0.0-nightly.2359+1ad0f163", | ||
"@react-types/shared": "3.0.0-nightly.681+1ad0f163", | ||
"clsx": "^1.1.1" | ||
@@ -32,3 +32,3 @@ }, | ||
}, | ||
"gitHead": "3ee5685e293447fb1995ddec4c70b56c8e3aaa8e" | ||
"gitHead": "1ad0f16354f7114e4ecfa5c75b16ec6f11ff1ec0" | ||
} |
@@ -53,2 +53,7 @@ /* | ||
// Keep track of the current handlers in a ref so that the events can access them. | ||
let handlers = useRef({onPositionChange, onDrag}); | ||
handlers.current.onDrag = onDrag; | ||
handlers.current.onPositionChange = onPositionChange; | ||
let onMouseDragged = (e: MouseEvent) => { | ||
@@ -59,7 +64,7 @@ e.preventDefault(); | ||
dragging.current = true; | ||
if (onDrag) { | ||
onDrag(true); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(true); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -80,7 +85,7 @@ } | ||
let nextOffset = getNextOffset(e); | ||
if (onDrag) { | ||
onDrag(false); | ||
if (handlers.current.onDrag) { | ||
handlers.current.onDrag(false); | ||
} | ||
if (onPositionChange) { | ||
onPositionChange(nextOffset); | ||
if (handlers.current.onPositionChange) { | ||
handlers.current.onPositionChange(nextOffset); | ||
} | ||
@@ -95,3 +100,3 @@ | ||
const target = e.currentTarget; | ||
// If we're already handling dragging on a descendant with useDrag1D, then | ||
// If we're already handling dragging on a descendant with useDrag1D, then | ||
// we don't want to handle the drag motion on this target as well. | ||
@@ -98,0 +103,0 @@ if (draggingElements.some(elt => target.contains(elt))) { |
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
166400
1748