@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
72 lines (71 loc) • 1.13 kB
JavaScript
//#region src/base-ui/Drawer/constants.ts
const softEase = [
.32,
.72,
0,
1
];
const exitEase = [
.4,
0,
1,
1
];
const DEFAULT_CONTAINER_MAX_WIDTH = 1024;
const offscreen = {
bottom: { y: "100%" },
left: { x: "-100%" },
right: { x: "100%" },
top: { y: "-100%" }
};
const pushAxis = {
bottom: {
axis: "y",
sign: -1
},
left: {
axis: "x",
sign: 1
},
right: {
axis: "x",
sign: -1
},
top: {
axis: "y",
sign: 1
}
};
const getDrawerMotionConfig = (placement, pushOffset = 0) => {
const hidden = offscreen[placement];
const { axis, sign } = pushAxis[placement];
const shift = pushOffset === 0 ? 0 : pushOffset * sign;
return {
animate: axis === "x" ? {
x: shift,
y: 0
} : {
x: 0,
y: shift
},
exit: {
...hidden,
transition: {
duration: .22,
ease: exitEase
}
},
initial: hidden,
transition: {
duration: .3,
ease: softEase
}
};
};
const drawerBackdropTransition = {
duration: .18,
ease: softEase
};
//#endregion
export { DEFAULT_CONTAINER_MAX_WIDTH, drawerBackdropTransition, getDrawerMotionConfig, pushAxis };
//# sourceMappingURL=constants.mjs.map