@yamada-ui/transitions
Version:
Yamada UI transitions components
108 lines (107 loc) • 3.41 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/scale-fade.tsx
var scale_fade_exports = {};
__export(scale_fade_exports, {
ScaleFade: () => ScaleFade,
scaleFadeProps: () => scaleFadeProps
});
module.exports = __toCommonJS(scale_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,
scale: 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,
reverse,
scale,
transition,
transitionEnd
} = {}) => ({
opacity: 0,
transition: (0, import_motion.transitionExit)(transition == null ? void 0 : transition.exit)(delay, duration),
...reverse ? { scale, transitionEnd: transitionEnd == null ? void 0 : transitionEnd.exit } : { transitionEnd: { scale, ...transitionEnd == null ? void 0 : transitionEnd.exit } },
...exit
})
};
var scaleFadeProps = {
animate: "enter",
exit: "exit",
initial: "exit",
variants
};
var ScaleFade = (0, import_motion.motionForwardRef)(
(props, ref) => {
const [style, mergedProps] = (0, import_core.useComponentStyle)("ScaleFade", props);
const {
className,
delay,
duration,
isOpen,
open = isOpen,
reverse,
scale,
transition,
transitionEnd,
unmountOnExit,
...rest
} = (0, import_core.omitThemeProps)(mergedProps);
const animate = open || unmountOnExit ? "enter" : "exit";
const custom = {
delay,
duration,
reverse,
scale,
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-scale-fade", className),
custom,
...scaleFadeProps,
animate,
__css: style,
...rest
}
) : null });
}
);
ScaleFade.displayName = "ScaleFade";
ScaleFade.__ui__ = "ScaleFade";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ScaleFade,
scaleFadeProps
});
//# sourceMappingURL=scale-fade.js.map