Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { clientWidth: bodyWidth } = useWindowSize()
const transform = () => {
if ( isShowingUI ) {
return 'translateX( 0% )'
} else {
if ( 'end' === alignment ) {
return 'translateX( 100% )'
} else {
return 'translateX( -100% )'
}
}
}
const springConfig = {
...config.default,
tension: 400,
friction: 33,
clamp: true,
}
const springProps = useSpring( {
width: width + 1/* account for inside edge border */,
height,
right: 'end' === alignment ? 0 : bodyWidth - width,
transform: transform(),
immediate: shouldReduceMotion,
config: springConfig,
} )
const insideBorder = '1px solid var(--fl-line-color)'
const insideEdge = 'end' === alignment ? 'borderLeft' : 'borderRight'
render() {
const { children, className, config, expanded, ...rest } = this.props
return (
{style => (
{children}
)}
)
}
}
in="SourceGraphic"
in2={`goo-${uid}`}
operator="atop"
/>
};
const onMouseOver = () => {
clearTimer();
setMouseover(true);
};
const onMouseOut = () => {
setMouseover(false);
setupTimer();
};
const progressBarProps = useSpring({
from: { width: '0%' },
to: { width: mouseover || Boolean(!error && !success && notification.promise) ? '0%' : '100%' },
config: mouseover ? config.default : { ...config.default, duration: notification.duration }
});
return (
};
}
case 'transitTranslate': {
return {
tension: 95,
friction: 25,
};
}
case 'transitOpacity': {
return {
tension: 170,
friction: 22,
};
}
default: {
return config.default;
}
}
};
onClick: e => {
setValue( ! value )
onChange( ! value, e )
},
role: 'switch',
'aria-checked': value ? "true" : "false",
'aria-label': label
} )
delete mergedProps.value
const thumbProps = useSpring( {
transform: value ? 'translateX(30px)' : 'translateX(0px)',
background: value ? 'var(--fl-accent-color)' : 'transparent',
borderColor: value ? 'transparent' : '',
config: {
...config.default,
tension: 700,
friction: 25,
},
immediate: shouldReduceMotion
} )
return (
<button>
</button>
)
}
const springConfig = key =>
key === 'sidebarOffsetPercentage'
? {
tension: 200,
friction: 20,
precision: 0.75,
}
: config.default;
const [{ x }, set] = useSpring(() => ({
x: 0,
config: { ...config.default, tension: 200, friction: 30 }
}))
let ref = useRef(null)