import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
import { Iconfont } from "@pisell/materials";
import classNames from "classnames";
import "./index.less";
//#region src/components/eventBooking/components/OpenCard/index.tsx
const OpenCard = ({ children, title, className, scrollErrorId, initOpen = true, extra, isClick = true, showArrow = true, showBorder = false, showHeader = true }, ref) => {
	const [isOpen, setIsOpen] = useState(true);
	useEffect(() => {
		if (initOpen === false) setIsOpen(false);
	}, [initOpen]);
	useImperativeHandle(ref, () => {
		return { open: () => setIsOpen(true) };
	});
	return /* @__PURE__ */ React.createElement("div", {
		id: scrollErrorId,
		className: classNames("open-card", {
			open: isOpen,
			"open-card-border": showBorder
		}, className)
	}, showHeader ? /* @__PURE__ */ React.createElement("div", {
		className: "header",
		onClick: () => isClick ? setIsOpen(!isOpen) : null
	}, /* @__PURE__ */ React.createElement("div", { className: "title" }, title), /* @__PURE__ */ React.createElement("div", { className: "right" }, extra, showArrow ? /* @__PURE__ */ React.createElement(Iconfont, {
		type: !isOpen ? "pisell2-chevron-up" : "pisell2-chevron-down",
		className: classNames("icon")
	}) : null)) : null, children ? /* @__PURE__ */ React.createElement("div", { className: "content" }, children) : null);
};
var OpenCard_default = forwardRef(OpenCard);
//#endregion
export { OpenCard_default as default };
