import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["expanded", "variant", "onChange", "children", "className"];

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

import React from "react";
import PropTypes from "prop-types";
import cx from "classnames";
import createComponent from "../../system/createComponent";
import getClasses from "./styles";
var Accordion = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var _cx;

  var expanded = props.expanded,
      variant = props.variant,
      onChange = props.onChange,
      children = props.children,
      className = props.className,
      htmlProps = _objectWithoutProperties(props, _excluded);

  var classes = getClasses();
  var headerClasses = cx(className, classes.accordion, (_cx = {}, _defineProperty(_cx, classes.accordionExpanded, expanded), _defineProperty(_cx, classes.accordionOutlined, variant === "outlined"), _cx));
  return /*#__PURE__*/React.createElement("div", {
    ref: ref,
    className: headerClasses
    /* TransitionProps={{ unmountOnExit }}  */

  }, React.Children.map(children, function (child) {
    return /*#__PURE__*/React.cloneElement(child, _objectSpread({
      onChange: onChange,
      expanded: expanded,
      variant: variant
    }, child.props));
  }));
});
Accordion.propTypes = {
  className: PropTypes.string,
  expanded: PropTypes.bool,
  variant: PropTypes.oneOf(["default", "outlined"])
};
Accordion.defaultProps = {
  expanded: false,
  variant: "default"
};

if (process.env.NODE_ENV !== "production") {
  Accordion.displayName = "LabAccordion";
}

export default createComponent(Accordion);