@yamada-ui/transitions
Version:
Yamada UI transitions components
88 lines (87 loc) • 2.99 kB
JavaScript
"use client"
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/fade.tsx
var fade_exports = {};
__export(fade_exports, {
Fade: () => Fade,
fadeProps: () => fadeProps
});
module.exports = __toCommonJS(fade_exports);
var import_core = require("@yamada-ui/core");
var import_motion = require("@yamada-ui/motion");
var import_utils = require("@yamada-ui/utils");
var import_jsx_runtime = require("react/jsx-runtime");
var variants = {
enter: ({ delay, duration, enter, transition, transitionEnd } = {}) => ({
opacity: 1,
transition: (0, import_motion.transitionEnter)(transition == null ? void 0 : transition.enter)(delay, duration),
transitionEnd: transitionEnd == null ? void 0 : transitionEnd.enter,
...enter
}),
exit: ({ delay, duration, exit, transition, transitionEnd } = {}) => ({
opacity: 0,
transition: (0, import_motion.transitionExit)(transition == null ? void 0 : transition.exit)(delay, duration),
transitionEnd: transitionEnd == null ? void 0 : transitionEnd.exit,
...exit
})
};
var fadeProps = {
animate: "enter",
exit: "exit",
initial: "exit",
variants
};
var Fade = (0, import_motion.motionForwardRef)((props, ref) => {
const [style, mergedProps] = (0, import_core.useComponentStyle)("Fade", props);
const {
className,
delay,
duration,
isOpen,
open = isOpen,
transition,
transitionEnd,
unmountOnExit,
...rest
} = (0, import_core.omitThemeProps)(mergedProps);
const animate = open || unmountOnExit ? "enter" : "exit";
const custom = { delay, duration, transition, transitionEnd };
const resolvedOpen = unmountOnExit ? open && unmountOnExit : true;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion.AnimatePresence, { custom, children: resolvedOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_motion.motion.div,
{
ref,
className: (0, import_utils.cx)("ui-fade", className),
custom,
...fadeProps,
animate,
__css: style,
...rest
}
) : null });
});
Fade.displayName = "Fade";
Fade.__ui__ = "Fade";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Fade,
fadeProps
});
//# sourceMappingURL=fade.js.map