npm package diff
Package: @chakra-ui/react
Versions: 2.10.1 - 2.10.2
File: package/dist/esm/slider/slider-utils.mjs
Index: package/dist/esm/slider/slider-utils.mjs
===================================================================
--- package/dist/esm/slider/slider-utils.mjs
+++ package/dist/esm/slider/slider-utils.mjs
@@ -13,14 +13,11 @@
function orient(options) {
const { orientation, vertical, horizontal } = options;
return orientation === "vertical" ? vertical : horizontal;
}
-const zeroSize = { width: 0, height: 0 };
-const normalize = (a) => a || zeroSize;
function getStyles(options) {
- const { orientation, thumbPercents, thumbRects, isReversed } = options;
+ const { orientation, thumbPercents, isReversed } = options;
const getThumbStyle = (i) => {
- const rect = thumbRects[i] ?? zeroSize;
return {
position: "absolute",
userSelect: "none",
WebkitUserSelect: "none",
@@ -29,40 +26,22 @@
touchAction: "none",
...orient({
orientation,
vertical: {
- bottom: `calc(${thumbPercents[i]}% - ${rect.height / 2}px)`
+ bottom: `${thumbPercents[i]}%`
},
horizontal: {
- left: `calc(${thumbPercents[i]}% - ${rect.width / 2}px)`
+ left: `${thumbPercents[i]}%`
}
})
};
};
- const size = orientation === "vertical" ? thumbRects.reduce(
- (a, b) => normalize(a).height > normalize(b).height ? a : b,
- zeroSize
- ) : thumbRects.reduce(
- (a, b) => normalize(a).width > normalize(b).width ? a : b,
- zeroSize
- );
const rootStyle = {
position: "relative",
touchAction: "none",
WebkitTapHighlightColor: "rgba(0,0,0,0)",
userSelect: "none",
- outline: 0,
- ...orient({
- orientation,
- vertical: size ? {
- paddingLeft: size.width / 2,
- paddingRight: size.width / 2
- } : {},
- horizontal: size ? {
- paddingTop: size.height / 2,
- paddingBottom: size.height / 2
- } : {}
- })
+ outline: 0
};
const trackStyle = {
position: "absolute",
...orient({