@react-stately/slider
Advanced tools
Comparing version 3.5.8 to 3.6.0
@@ -38,4 +38,4 @@ var $1NNdE$reactstatelyutils = require("@react-stately/utils"); | ||
let restrictValues = (0, $1NNdE$react.useCallback)((values)=>values === null || values === void 0 ? void 0 : values.map((val, idx)=>{ | ||
let min = idx === 0 ? minValue : val[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : val[idx + 1]; | ||
let min = idx === 0 ? minValue : values[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : values[idx + 1]; | ||
return (0, $1NNdE$reactstatelyutils.snapValueToStep)(val, min, max, step); | ||
@@ -42,0 +42,0 @@ }), [ |
@@ -32,4 +32,4 @@ import {snapValueToStep as $BT4Uh$snapValueToStep, useControlledState as $BT4Uh$useControlledState, clamp as $BT4Uh$clamp} from "@react-stately/utils"; | ||
let restrictValues = (0, $BT4Uh$useCallback)((values)=>values === null || values === void 0 ? void 0 : values.map((val, idx)=>{ | ||
let min = idx === 0 ? minValue : val[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : val[idx + 1]; | ||
let min = idx === 0 ? minValue : values[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : values[idx + 1]; | ||
return (0, $BT4Uh$snapValueToStep)(val, min, max, step); | ||
@@ -36,0 +36,0 @@ }), [ |
{ | ||
"name": "@react-stately/slider", | ||
"version": "3.5.8", | ||
"version": "3.6.0", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,13 +25,14 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/utils": "^3.10.4", | ||
"@react-types/shared": "^3.25.0", | ||
"@react-types/slider": "^3.7.6", | ||
"@react-stately/utils": "^3.10.5", | ||
"@react-types/shared": "^3.26.0", | ||
"@react-types/slider": "^3.7.7", | ||
"@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" | ||
} | ||
} | ||
}, | ||
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849" | ||
} |
@@ -179,5 +179,5 @@ /* | ||
let restrictValues = useCallback((values: number[]) => values?.map((val, idx) => { | ||
let min = idx === 0 ? minValue : val[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : val[idx + 1]; | ||
let restrictValues = useCallback((values: number[] | undefined) => values?.map((val, idx) => { | ||
let min = idx === 0 ? minValue : values[idx - 1]; | ||
let max = idx === values.length - 1 ? maxValue : values[idx + 1]; | ||
return snapValueToStep(val, min, max, step); | ||
@@ -187,3 +187,3 @@ }), [minValue, maxValue, step]); | ||
let value = useMemo(() => restrictValues(convertValue(props.value)), [props.value]); | ||
let defaultValue = useMemo(() => restrictValues(convertValue(props.defaultValue) ?? [minValue]), [props.defaultValue, minValue]); | ||
let defaultValue = useMemo(() => restrictValues(convertValue(props.defaultValue) ?? [minValue])!, [props.defaultValue, minValue]); | ||
let onChange = createOnChange(props.value, props.defaultValue, props.onChange); | ||
@@ -326,3 +326,3 @@ let onChangeEnd = createOnChange(props.value, props.defaultValue, props.onChangeEnd); | ||
function convertValue(value: number | number[]) { | ||
function convertValue(value?: number | number[]) { | ||
if (value == null) { | ||
@@ -329,0 +329,0 @@ return undefined; |
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
87220
17
Updated@react-stately/utils@^3.10.5
Updated@react-types/shared@^3.26.0
Updated@react-types/slider@^3.7.7