import { clsx } from 'clsx';
import { useId, cloneElement } from 'react';
import Body from '../../body/Body.mjs';
import Chevron from '../../chevron/Chevron.mjs';
import '../../common/theme.mjs';
import '../../common/direction.mjs';
import '@transferwise/neptune-tokens';
import '../../common/propsValues/control.mjs';
import { Size } from '../../common/propsValues/size.mjs';
import { Typography } from '../../common/propsValues/typography.mjs';
import '../../common/propsValues/width.mjs';
import '../../common/propsValues/type.mjs';
import '../../common/propsValues/dateMode.mjs';
import '../../common/propsValues/monthFormat.mjs';
import { Position } from '../../common/propsValues/position.mjs';
import '../../common/propsValues/layouts.mjs';
import '../../common/propsValues/status.mjs';
import '../../common/propsValues/sentiment.mjs';
import '../../common/propsValues/profileType.mjs';
import '../../common/propsValues/variant.mjs';
import '../../common/propsValues/scroll.mjs';
import '../../common/propsValues/markdownNodeType.mjs';
import '../../common/fileType.mjs';
import '@transferwise/formatting';
import '@transferwise/icons';
import 'react-intl';
import '../../common/closeButton/CloseButton.messages.mjs';
import { jsxs, jsx } from 'react/jsx-runtime';
import Option from '../../common/Option/Option.mjs';

const AccordionItem = ({
  'aria-label': ariaLabel,
  id,
  title,
  subtitle,
  content,
  onClick,
  open,
  icon,
  media,
  showMediaAtAllSizes,
  showMediaCircle,
  isContainerAligned,
  theme = 'light'
}) => {
  const mediaElement = icon ? /*#__PURE__*/cloneElement(icon, {
    size: 24
  }) : media;
  const fallbackId = useId();
  const accordionId = id ?? fallbackId;
  return /*#__PURE__*/jsxs("div", {
    id: accordionId,
    className: clsx('np-accordion-item', {
      'np-accordion-item--open': open,
      'np-accordion-item--with-icon': Boolean(icon),
      'np-accordion-item--with-media': Boolean(media)
    }),
    children: [/*#__PURE__*/jsx(Option, {
      "aria-label": ariaLabel,
      as: "button",
      media: mediaElement,
      title: title,
      content: subtitle,
      button: /*#__PURE__*/jsx(Chevron, {
        orientation: open ? Position.TOP : Position.BOTTOM,
        size: Size.MEDIUM
      }),
      inverseMediaCircle: false,
      "aria-expanded": open,
      "aria-controls": `${accordionId}-section`,
      id: `${accordionId}-control`,
      showMediaCircle: showMediaCircle,
      showMediaAtAllSizes: showMediaAtAllSizes,
      isContainerAligned: isContainerAligned,
      onClick: onClick
    }), open && /*#__PURE__*/jsx("div", {
      id: `${accordionId}-section`,
      role: "region",
      "aria-labelledby": `${accordionId}-control`,
      children: /*#__PURE__*/jsx(Body, {
        as: "span",
        type: Typography.BODY_LARGE,
        className: clsx('np-accordion-item__content', 'd-block', {
          'has-icon': icon
        }),
        children: content
      })
    })]
  });
};

export { AccordionItem as default };
//# sourceMappingURL=AccordionItem.mjs.map
