import ExpandIcon from './ExpandIcon.js';
import RoundedOrder from './RoundOrder.js';
import { Collapse } from 'antd';
import cs from 'classnames';
import React__default, { useMemo, useState } from 'react';

const CollapseStyle = "E_ccrbeuz";
const CollapseDisabled = "E_c1fljvag";
const ExpandableItem = props => {
  const {
    children,
    disableExpand = false,
    defaultActive = false,
    header,
    order
  } = props;
  const showExpandOnDisable = useMemo(() => {
    return disableExpand && defaultActive;
  }, [defaultActive, disableExpand]);
  const [activeKey, setActiveKey] = useState(showExpandOnDisable ? ["expandPanelKey"] : []);
  return /* @__PURE__ */React__default.createElement(Collapse, {
    className: cs(CollapseStyle, {
      [CollapseDisabled]: disableExpand
    }),
    expandIcon: ExpandIcon,
    expandIconPosition: "right",
    defaultActiveKey: showExpandOnDisable ? ["expandPanelKey"] : [],
    bordered: false,
    activeKey,
    onChange: v => {
      if (disableExpand) {
        return;
      }
      setActiveKey(v);
    }
  }, /* @__PURE__ */React__default.createElement(Collapse.Panel, {
    key: "expandPanelKey",
    header: /* @__PURE__ */React__default.createElement(RoundedOrder, {
      order
    }, header),
    showArrow: !disableExpand
  }, children));
};
var ExpandableItem$1 = ExpandableItem;

export { ExpandableItem$1 as default };
