UNPKG

@up-group-ui/react-controls

Version:
58 lines 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fadeOutAnimation = exports.fadeInAnimation = exports.fullAnimationProp = void 0; var tslib_1 = require("tslib"); var typestyle_1 = require("typestyle"); var fadeInKeyframes = (0, typestyle_1.keyframes)({ from: { opacity: 0 }, to: { opacity: 1 }, }); var fadeOutKeyframes = (0, typestyle_1.keyframes)({ from: { opacity: 1 }, to: { opacity: 0 }, }); var getFromOpacity = function (fadeType) { return fadeType === 'fadeIn' ? { opacity: 0 } : fadeType === 'fadeOut' ? { opacity: 1 } : {}; }; var getToOpacity = function (fadeType) { return fadeType === 'fadeIn' ? { opacity: 1 } : fadeType === 'fadeOut' ? { opacity: 0 } : {}; }; var FadeDirection; (function (FadeDirection) { FadeDirection["fromTop"] = "marginBottom"; FadeDirection["fromBottom"] = "marginTop"; FadeDirection["fromLeft"] = "marginRight"; FadeDirection["fromRight"] = "marginLeft"; })(FadeDirection || (FadeDirection = {})); var animationKeyframes = function (fadeType, fadeDirection) { var _a, _b; return (0, typestyle_1.keyframes)({ from: (0, tslib_1.__assign)((_a = {}, _a[FadeDirection[fadeDirection]] = '100%', _a), getFromOpacity(fadeType)), to: (0, tslib_1.__assign)((_b = {}, _b[FadeDirection[fadeDirection]] = '0', _b), getToOpacity(fadeType)), }); }; var fullAnimationProp = function (duration, fadeMode, fadeType, fadeDirection) { if (duration === void 0) { duration = 1; } if (fadeMode === void 0) { fadeMode = 'ease'; } return ({ animation: animationKeyframes(fadeType, fadeDirection) + " " + duration + "s " + fadeMode, }); }; exports.fullAnimationProp = fullAnimationProp; var fadeInAnimation = function (duration, fadeMode) { if (duration === void 0) { duration = 1; } if (fadeMode === void 0) { fadeMode = 'ease'; } return ({ animation: fadeInKeyframes + " " + duration + "s " + fadeMode, }); }; exports.fadeInAnimation = fadeInAnimation; var fadeOutAnimation = function (duration, fadeMode) { if (duration === void 0) { duration = 1; } if (fadeMode === void 0) { fadeMode = 'ease'; } return ({ animation: fadeOutKeyframes + " " + duration + "s " + fadeMode, }); }; exports.fadeOutAnimation = fadeOutAnimation; //# sourceMappingURL=animations.js.map