import React from "react";
import useCommonReducer from "../../libraries/reducerHandler";
import AccordionContext from "./AccordionContext";
import { handleToggle } from "./Accordion.actions";
import reducer from "./Accordion.reducer";
import componentCategories from "../../docs-utils/componentCategories";
import componentGroups from "../../docs-utils/componentGroups";
export default function Accordion(_ref) {
  let {
    children,
    customReducer = (state, action) => state,
    position = "bottom",
    opened = []
  } = _ref;
  let {
    state: accordionState,
    dispatch
  } = useCommonReducer(reducer, customReducer, opened);
  return /*#__PURE__*/React.createElement(AccordionContext.Provider, {
    value: {
      accordionState,
      handleClick: index => {
        dispatch(handleToggle(index));
      },
      position
    }
  }, /*#__PURE__*/React.createElement("div", null, children));
}

if (false) {
  Accordion.docs = {
    componentGroup: componentGroups.Components,
    folderName: componentCategories.UCL
  };
}