"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const useBoundingClientRect = require("../../hooks/useBoundingClientRect.cjs");
const classNames = require("../../utils/classNames.cjs");
require("./expandable.theme.css.cjs");
function _interopNamespaceDefault(e) {
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
  if (e) {
    for (const k in e) {
      if (k !== "default") {
        const d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: () => e[k]
        });
      }
    }
  }
  n.default = e;
  return Object.freeze(n);
}
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
const Expandable = React__namespace.forwardRef(({ className, children, style, animate, isOpen, ...nativeProps }, ref) => {
  const contentRef = React__namespace.useRef(null);
  const [{ height }] = useBoundingClientRect.useBoundingClientRect(contentRef);
  return jsxRuntime.jsx("div", { ...nativeProps, className: classNames.concat("arm-expandable", className), style: {
    ...animate ? { "--arm-expandable-height": `${height}px` } : {},
    ...style || {}
  }, "data-animate": !!animate, "data-is-open": !!isOpen, ref, children: jsxRuntime.jsx("div", { ref: contentRef, className: "arm-expandable-content", children }) });
});
Expandable.displayName = "Expandable";
Expandable.defaultProps = {
  animate: true
};
exports.Expandable = Expandable;
//# sourceMappingURL=expandable.component.cjs.map
