@img-comparison-slider/react
Advanced tools
Comparing version 8.0.1 to 8.0.2
@@ -27,9 +27,9 @@ "use strict"; | ||
} | ||
exports.ImgComparisonSlider = (0, react_1.forwardRef)(({ children, onSlide, ...props }, ref) => { | ||
exports.ImgComparisonSlider = (0, react_1.forwardRef)(({ children, onSlide, value, className, ...props }, ref) => { | ||
const sliderRef = (0, react_1.useRef)(); | ||
(0, react_1.useEffect)(() => { | ||
if (props.value !== undefined) { | ||
sliderRef.current.value = parseFloat(props.value.toString()); | ||
if (value !== undefined) { | ||
sliderRef.current.value = parseFloat(value.toString()); | ||
} | ||
}, [props.value, sliderRef]); | ||
}, [value, sliderRef]); | ||
(0, react_1.useEffect)(() => { | ||
@@ -43,3 +43,3 @@ if (onSlide) { | ||
return (0, react_1.createElement)('img-comparison-slider', Object.assign({ | ||
class: props.className ? `${props.className} rendered` : 'rendered', | ||
class: className ? `${className} rendered` : 'rendered', | ||
// Align tabIndex between the web and React components | ||
@@ -46,0 +46,0 @@ // this code could be removed when |
{ | ||
"name": "@img-comparison-slider/react", | ||
"version": "8.0.1", | ||
"version": "8.0.2", | ||
"description": "React wrapper for img-comparison-slider", | ||
@@ -5,0 +5,0 @@ "homepage": "https://img-comparison-slider.sneas.io", |
Sorry, the diff of this file is not supported yet
7475