UNPKG

@empathyco/x-components

Version:
28 lines (25 loc) 812 B
import { inject, ref, computed } from 'vue'; import { DISABLE_ANIMATIONS_KEY } from '../decorators/injection.consts.js'; /** * Composable to ease disabling animations. * * @param animationName - The name of the animation. * @returns Composable with the computed name of the animation. * * @public */ function useDisableAnimation(animationName) { /** * Flag to disable the animation. */ const disableAnimation = inject(DISABLE_ANIMATIONS_KEY, ref(false)); /** * The animation's name based on the DISABLE_ANIMATIONS_KEY flag. * * @returns The animation name. */ const name = computed(() => (disableAnimation.value ? '__no-animation__' : animationName)); return { name }; } export { useDisableAnimation }; //# sourceMappingURL=use-disable-animation.js.map