208 lines
4.9 KiB
Plaintext
208 lines
4.9 KiB
Plaintext
"use client";
|
|
"use strict";
|
|
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/index.ts
|
|
var src_exports = {};
|
|
__export(src_exports, {
|
|
ResizablePanel: () => ResizablePanel,
|
|
TRANSITION_DEFAULTS: () => TRANSITION_DEFAULTS,
|
|
TRANSITION_EASINGS: () => TRANSITION_EASINGS,
|
|
TRANSITION_VARIANTS: () => TRANSITION_VARIANTS
|
|
});
|
|
module.exports = __toCommonJS(src_exports);
|
|
|
|
// src/transition-utils.ts
|
|
var TRANSITION_EASINGS = {
|
|
ease: [0.36, 0.66, 0.4, 1],
|
|
easeIn: [0.4, 0, 1, 1],
|
|
easeOut: [0, 0, 0.2, 1],
|
|
easeInOut: [0.4, 0, 0.2, 1],
|
|
spring: [0.155, 1.105, 0.295, 1.12],
|
|
springOut: [0.57, -0.15, 0.62, 0.07],
|
|
softSpring: [0.16, 1.11, 0.3, 1.02]
|
|
};
|
|
var TRANSITION_DEFAULTS = {
|
|
enter: {
|
|
duration: 0.2,
|
|
ease: TRANSITION_EASINGS.easeOut
|
|
},
|
|
exit: {
|
|
duration: 0.1,
|
|
ease: TRANSITION_EASINGS.easeIn
|
|
}
|
|
};
|
|
var TRANSITION_VARIANTS = {
|
|
scaleSpring: {
|
|
enter: {
|
|
transform: "scale(1)",
|
|
opacity: 1,
|
|
transition: {
|
|
type: "spring",
|
|
bounce: 0,
|
|
duration: 0.2
|
|
}
|
|
},
|
|
exit: {
|
|
transform: "scale(0.85)",
|
|
opacity: 0,
|
|
transition: {
|
|
type: "easeOut",
|
|
duration: 0.15
|
|
}
|
|
}
|
|
},
|
|
scaleSpringOpacity: {
|
|
initial: {
|
|
opacity: 0,
|
|
transform: "scale(0.8)"
|
|
},
|
|
enter: {
|
|
opacity: 1,
|
|
transform: "scale(1)",
|
|
transition: {
|
|
type: "spring",
|
|
bounce: 0,
|
|
duration: 0.3
|
|
}
|
|
},
|
|
exit: {
|
|
opacity: 0,
|
|
transform: "scale(0.96)",
|
|
transition: {
|
|
type: "easeOut",
|
|
bounce: 0,
|
|
duration: 0.15
|
|
}
|
|
}
|
|
},
|
|
scale: {
|
|
enter: { scale: 1 },
|
|
exit: { scale: 0.95 }
|
|
},
|
|
scaleFadeIn: {
|
|
enter: {
|
|
transform: "scale(1)",
|
|
opacity: 1,
|
|
transition: {
|
|
duration: 0.25,
|
|
ease: TRANSITION_EASINGS.easeIn
|
|
}
|
|
},
|
|
exit: {
|
|
transform: "scale(0.95)",
|
|
opacity: 0,
|
|
transition: {
|
|
duration: 0.2,
|
|
ease: TRANSITION_EASINGS.easeOut
|
|
}
|
|
}
|
|
},
|
|
scaleInOut: {
|
|
enter: {
|
|
transform: "scale(1)",
|
|
opacity: 1,
|
|
transition: {
|
|
duration: 0.4,
|
|
ease: TRANSITION_EASINGS.ease
|
|
}
|
|
},
|
|
exit: {
|
|
transform: "scale(1.03)",
|
|
opacity: 0,
|
|
transition: {
|
|
duration: 0.3,
|
|
ease: TRANSITION_EASINGS.ease
|
|
}
|
|
}
|
|
},
|
|
fade: {
|
|
enter: {
|
|
opacity: 1,
|
|
transition: {
|
|
duration: 0.4,
|
|
ease: TRANSITION_EASINGS.ease
|
|
}
|
|
},
|
|
exit: {
|
|
opacity: 0,
|
|
transition: {
|
|
duration: 0.3,
|
|
ease: TRANSITION_EASINGS.ease
|
|
}
|
|
}
|
|
},
|
|
collapse: {
|
|
enter: {
|
|
opacity: 1,
|
|
height: "auto",
|
|
transition: {
|
|
height: {
|
|
type: "spring",
|
|
bounce: 0,
|
|
duration: 0.3
|
|
},
|
|
opacity: {
|
|
easings: "ease",
|
|
duration: 0.4
|
|
}
|
|
}
|
|
},
|
|
exit: {
|
|
opacity: 0,
|
|
height: 0,
|
|
transition: {
|
|
easings: "ease",
|
|
duration: 0.3
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
// src/resizable-panel.tsx
|
|
var import_react = require("react");
|
|
var import_framer_motion = require("framer-motion");
|
|
var import_use_measure = require("@heroui/use-measure");
|
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
var ResizablePanel = (0, import_react.forwardRef)(
|
|
(originalProps, ref) => {
|
|
const { children, ...props } = originalProps;
|
|
let [measureRef, bounds] = (0, import_use_measure.useMeasure)();
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.LazyMotion, { features: import_framer_motion.domAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
import_framer_motion.m.div,
|
|
{
|
|
ref,
|
|
animate: {
|
|
width: bounds.width && (bounds == null ? void 0 : bounds.width) > 0 ? bounds.width : "auto",
|
|
height: bounds.height && bounds.height > 0 ? bounds.height : "auto"
|
|
},
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: measureRef, ...props, children })
|
|
}
|
|
) });
|
|
}
|
|
);
|
|
ResizablePanel.displayName = "HeroUI - ResizablePanel";
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
ResizablePanel,
|
|
TRANSITION_DEFAULTS,
|
|
TRANSITION_EASINGS,
|
|
TRANSITION_VARIANTS
|
|
});
|