@react-aria/slider
Advanced tools
Comparing version 3.0.0-nightly-4baa1b08e-241029 to 3.0.0-nightly-4dd0993da-241224
@@ -54,5 +54,6 @@ var $28db8d634be2fa58$exports = require("./utils.main.js"); | ||
onMove ({ deltaX: deltaX, deltaY: deltaY }) { | ||
if (!trackRef.current) return; | ||
let { height: height, width: width } = trackRef.current.getBoundingClientRect(); | ||
let size = isVertical ? height : width; | ||
if (currentPosition.current == null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; | ||
if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; | ||
let delta = isVertical ? deltaY : deltaX; | ||
@@ -59,0 +60,0 @@ if (isVertical || reverseX) delta = -delta; |
@@ -48,5 +48,6 @@ import {getSliderThumbId as $aa519ee6cf463259$export$68e648cbec363a18, sliderData as $aa519ee6cf463259$export$d6c8d9636a3dc49c} from "./utils.module.js"; | ||
onMove ({ deltaX: deltaX, deltaY: deltaY }) { | ||
if (!trackRef.current) return; | ||
let { height: height, width: width } = trackRef.current.getBoundingClientRect(); | ||
let size = isVertical ? height : width; | ||
if (currentPosition.current == null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; | ||
if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null) currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; | ||
let delta = isVertical ? deltaY : deltaX; | ||
@@ -53,0 +54,0 @@ if (isVertical || reverseX) delta = -delta; |
@@ -86,2 +86,3 @@ var $28db8d634be2fa58$exports = require("./utils.main.js"); | ||
const { getThumbPercent: getThumbPercent, setThumbPercent: setThumbPercent, decrementThumb: decrementThumb, incrementThumb: incrementThumb, step: step, pageSize: pageSize } = state; | ||
if (!trackRef.current) return; | ||
let { width: width, height: height } = trackRef.current.getBoundingClientRect(); | ||
@@ -88,0 +89,0 @@ let size = isVertical ? height : width; |
@@ -80,2 +80,3 @@ import {getSliderThumbId as $aa519ee6cf463259$export$68e648cbec363a18, sliderData as $aa519ee6cf463259$export$d6c8d9636a3dc49c} from "./utils.module.js"; | ||
const { getThumbPercent: getThumbPercent, setThumbPercent: setThumbPercent, decrementThumb: decrementThumb, incrementThumb: incrementThumb, step: step, pageSize: pageSize } = state; | ||
if (!trackRef.current) return; | ||
let { width: width, height: height } = trackRef.current.getBoundingClientRect(); | ||
@@ -82,0 +83,0 @@ let size = isVertical ? height : width; |
{ | ||
"name": "@react-aria/slider", | ||
"version": "3.0.0-nightly-4baa1b08e-241029", | ||
"version": "3.0.0-nightly-4dd0993da-241224", | ||
"description": "Slider", | ||
@@ -25,19 +25,18 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/i18n": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/interactions": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/label": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/utils": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-stately/slider": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-types/shared": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-types/slider": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/focus": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/i18n": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/interactions": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/label": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/utils": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-stately/slider": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-types/shared": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-types/slider": "3.0.0-nightly-4dd0993da-241224", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"stableVersion": "3.7.13" | ||
} | ||
} |
@@ -58,3 +58,3 @@ /* | ||
sliderData.set(state, { | ||
id: labelProps.id ?? fieldProps.id, | ||
id: (labelProps.id ?? fieldProps.id)!, | ||
'aria-describedby': props['aria-describedby'], | ||
@@ -75,3 +75,3 @@ 'aria-details': props['aria-details'] | ||
const reverseX = direction === 'rtl'; | ||
const currentPosition = useRef<number>(null); | ||
const currentPosition = useRef<number | null>(null); | ||
const {moveProps} = useMove({ | ||
@@ -82,6 +82,9 @@ onMoveStart() { | ||
onMove({deltaX, deltaY}) { | ||
if (!trackRef.current) { | ||
return; | ||
} | ||
let {height, width} = trackRef.current.getBoundingClientRect(); | ||
let size = isVertical ? height : width; | ||
if (currentPosition.current == null) { | ||
if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null) { | ||
currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; | ||
@@ -95,6 +98,6 @@ } | ||
currentPosition.current += delta; | ||
currentPosition.current! += delta; | ||
if (realTimeTrackDraggingIndex.current != null && trackRef.current) { | ||
const percent = clamp(currentPosition.current / size, 0, 1); | ||
const percent = clamp(currentPosition.current! / size, 0, 1); | ||
state.setThumbPercent(realTimeTrackDraggingIndex.current, percent); | ||
@@ -112,3 +115,3 @@ } | ||
let currentPointer = useRef<number | null | undefined>(undefined); | ||
let onDownTrack = (e: React.UIEvent, id: number, clientX: number, clientY: number) => { | ||
let onDownTrack = (e: React.UIEvent, id: number | undefined, clientX: number, clientY: number) => { | ||
// We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged. | ||
@@ -155,3 +158,3 @@ if (trackRef.current && !props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) { | ||
state.setThumbDragging(realTimeTrackDraggingIndex.current, true); | ||
state.setThumbDragging(realTimeTrackDraggingIndex.current!, true); | ||
state.setThumbValue(closestThumb, value); | ||
@@ -158,0 +161,0 @@ |
@@ -64,3 +64,3 @@ import {AriaSliderThumbProps} from '@react-types/slider'; | ||
let data = sliderData.get(state); | ||
let data = sliderData.get(state)!; | ||
const {labelProps, fieldProps} = useLabel({ | ||
@@ -143,2 +143,5 @@ ...opts, | ||
} = state; | ||
if (!trackRef.current) { | ||
return; | ||
} | ||
let {width, height} = trackRef.current.getBoundingClientRect(); | ||
@@ -145,0 +148,0 @@ let size = isVertical ? height : width; |
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
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
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
143911
1649
+ Added@internationalized/date@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@internationalized/message@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@internationalized/number@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@internationalized/string@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/focus@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/i18n@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/interactions@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/label@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/ssr@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/utils@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/slider@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/utils@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-types/shared@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-types/slider@3.0.0-nightly-4dd0993da-241224(transitive)
- Removed@internationalized/date@3.7.0(transitive)
- Removed@internationalized/message@3.1.6(transitive)
- Removed@internationalized/number@3.6.0(transitive)
- Removed@internationalized/string@3.2.5(transitive)
- Removed@react-aria/focus@3.19.1(transitive)
- Removed@react-aria/i18n@3.12.5(transitive)
- Removed@react-aria/interactions@3.23.0(transitive)
- Removed@react-aria/label@3.7.14(transitive)
- Removed@react-aria/ssr@3.9.7(transitive)
- Removed@react-aria/utils@3.27.0(transitive)
- Removed@react-stately/slider@3.6.1(transitive)
- Removed@react-stately/utils@3.10.5(transitive)
- Removed@react-types/shared@3.27.0(transitive)
- Removed@react-types/slider@3.7.8(transitive)
Updated@react-aria/interactions@3.0.0-nightly-4dd0993da-241224