@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
55 lines • 2.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var typestyle_1 = require("typestyle");
var fadeInKeyframes = typestyle_1.keyframes({
from: { opacity: 0 },
to: { opacity: 1 }
});
var fadeOutKeyframes = 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 typestyle_1.keyframes({
from: tslib_1.__assign((_a = {}, _a[FadeDirection[fadeDirection]] = '100%', _a), getFromOpacity(fadeType)),
to: tslib_1.__assign((_b = {}, _b[FadeDirection[fadeDirection]] = '0', _b), getToOpacity(fadeType))
});
};
exports.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.fadeInAnimation = function (duration, fadeMode) {
if (duration === void 0) { duration = 1; }
if (fadeMode === void 0) { fadeMode = 'ease'; }
return ({
animation: fadeInKeyframes + " " + duration + "s " + fadeMode
});
};
exports.fadeOutAnimation = function (duration, fadeMode) {
if (duration === void 0) { duration = 1; }
if (fadeMode === void 0) { fadeMode = 'ease'; }
return ({
animation: fadeOutKeyframes + " " + duration + "s " + fadeMode
});
};
//# sourceMappingURL=animations.js.map