"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/atoms/collapse.tsx
var collapse_exports = {};
__export(collapse_exports, {
  Collapse: () => Collapse
});
module.exports = __toCommonJS(collapse_exports);
var import_react = require("react");
var import_jsx_runtime = require("react/jsx-runtime");
function Collapse(props) {
  const { children, closedHeight = "0" } = props;
  const [open, setOpen] = (0, import_react.useState)(() => {
    return props.open || props.defaultOpen || false;
  });
  (0, import_react.useEffect)(() => {
    if (props.open === void 0)
      return;
    setOpen(props.open);
  }, [props.open]);
  const ref = (0, import_react.useRef)(null);
  (0, import_react.useEffect)(() => {
    if (!ref.current)
      return;
    ref.current.style.maxHeight = open ? `${ref.current.scrollHeight}px` : closedHeight;
  }, [closedHeight, open]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tipp-collapse", ref, children });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Collapse
});
//# sourceMappingURL=collapse.cjs.map