UNPKG

@wordpress/components

Version:
39 lines (33 loc) 798 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reduceMotion = reduceMotion; /** * Allows users to opt-out of animations via OS-level preferences. * * @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name * @return {string} Generated CSS code for the reduced style */ function reduceMotion(prop = 'transition') { let style; switch (prop) { case 'transition': style = 'transition-duration: 0ms;'; break; case 'animation': style = 'animation-duration: 1ms;'; break; default: style = ` animation-duration: 1ms; transition-duration: 0ms; `; } return ` @media ( prefers-reduced-motion: reduce ) { ${style}; } `; } //# sourceMappingURL=reduce-motion.js.map