import { extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import { jsx } from '@emotion/core';
import { createContext, useContext } from 'react';
import _pt from 'prop-types';
import { MdClose } from 'react-icons/md';
import { Heading } from '../Heading/Heading.esm.js';
import { headerCss, titleCss, closeButtonCss, closeIconCss, bodyCss, bodyVariantCss, actionsCss } from './StyledModal.styles.esm.js';

var StyledModalContext = createContext({
  variant: "DEFAULT"
});
function useStyledModalContext() {
  return useContext(StyledModalContext);
}
function StyledModal(_ref) {
  var children = _ref.children,
      _ref$variant = _ref.variant,
      variant = _ref$variant === void 0 ? "DEFAULT" : _ref$variant;
  return jsx(StyledModalContext.Provider, {
    value: {
      variant: variant
    }
  }, children);
}
StyledModal.propTypes = {
  children: _pt.node.isRequired,
  variant: _pt.oneOf(["DEFAULT", "SUCCESS", "WARNING", "ERROR", "ACTION", "RETAKE"])
};
function StyledModalHeader(_ref2) {
  var children = _ref2.children,
      onCloseButtonClick = _ref2.onCloseButtonClick,
      _ref2$closeButtonLabe = _ref2.closeButtonLabel,
      closeButtonLabel = _ref2$closeButtonLabe === void 0 ? "Close modal" : _ref2$closeButtonLabe;
  return jsx("div", {
    css: headerCss
  }, jsx(Heading, {
    css: titleCss
  }, children), jsx(StyledModalCloseButton, {
    onClick: onCloseButtonClick,
    "aria-label": closeButtonLabel
  }));
}
StyledModalHeader.propTypes = {
  children: _pt.node.isRequired,
  onCloseButtonClick: _pt.func,
  closeButtonLabel: _pt.string
};
function StyledModalCloseButton(props) {
  return jsx("button", _extends({
    css: closeButtonCss
  }, props), jsx(MdClose, {
    css: closeIconCss
  }));
}
function StyledModalBody(_ref3) {
  var children = _ref3.children;

  var _useStyledModalContex = useStyledModalContext(),
      variant = _useStyledModalContex.variant;

  return jsx("div", {
    css: function css(theme) {
      return [bodyCss(theme), bodyVariantCss[variant](theme)];
    }
  }, children);
}
StyledModalBody.propTypes = {
  children: _pt.node.isRequired
};
function StyledModalActions(_ref4) {
  var children = _ref4.children;
  return jsx("div", {
    css: actionsCss
  }, children);
}
StyledModalActions.propTypes = {
  children: _pt.node.isRequired
};
StyledModal.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "StyledModal",
  "props": {
    "variant": {
      "defaultValue": {
        "value": "`DEFAULT`",
        "computed": false
      },
      "required": false,
      "tsType": {
        "name": "union",
        "raw": "`DEFAULT`\n| `SUCCESS`\n| `WARNING`\n| `ERROR`\n| `ACTION`\n| `RETAKE`",
        "elements": [{
          "name": "literal",
          "value": "undefined"
        }, {
          "name": "literal",
          "value": "undefined"
        }, {
          "name": "literal",
          "value": "undefined"
        }, {
          "name": "literal",
          "value": "undefined"
        }, {
          "name": "literal",
          "value": "undefined"
        }, {
          "name": "literal",
          "value": "undefined"
        }]
      },
      "description": ""
    },
    "children": {
      "required": true,
      "tsType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    }
  }
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Modal/StyledModal.tsx"] = {
    name: "StyledModal",
    docgenInfo: StyledModal.__docgenInfo,
    path: "src/components/Modal/StyledModal.tsx"
  };
}

StyledModalHeader.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "StyledModalHeader",
  "props": {
    "closeButtonLabel": {
      "defaultValue": {
        "value": "`Close modal`",
        "computed": false
      },
      "required": false,
      "tsType": {
        "name": "string"
      },
      "description": ""
    },
    "children": {
      "required": true,
      "tsType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    },
    "onCloseButtonClick": {
      "required": false,
      "tsType": {
        "name": "signature",
        "type": "function",
        "raw": "() => void",
        "signature": {
          "arguments": [],
          "return": {
            "name": "void"
          }
        }
      },
      "description": ""
    }
  }
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Modal/StyledModal.tsx"] = {
    name: "StyledModalHeader",
    docgenInfo: StyledModalHeader.__docgenInfo,
    path: "src/components/Modal/StyledModal.tsx"
  };
}

StyledModalCloseButton.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "StyledModalCloseButton"
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Modal/StyledModal.tsx"] = {
    name: "StyledModalCloseButton",
    docgenInfo: StyledModalCloseButton.__docgenInfo,
    path: "src/components/Modal/StyledModal.tsx"
  };
}

StyledModalBody.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "StyledModalBody",
  "props": {
    "children": {
      "required": true,
      "tsType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    }
  }
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Modal/StyledModal.tsx"] = {
    name: "StyledModalBody",
    docgenInfo: StyledModalBody.__docgenInfo,
    path: "src/components/Modal/StyledModal.tsx"
  };
}

StyledModalActions.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "StyledModalActions",
  "props": {
    "children": {
      "required": true,
      "tsType": {
        "name": "ReactReactNode",
        "raw": "React.ReactNode"
      },
      "description": ""
    }
  }
};

if (typeof STORYBOOK_REACT_CLASSES !== "undefined") {
  STORYBOOK_REACT_CLASSES["src/components/Modal/StyledModal.tsx"] = {
    name: "StyledModalActions",
    docgenInfo: StyledModalActions.__docgenInfo,
    path: "src/components/Modal/StyledModal.tsx"
  };
}

export { StyledModal, StyledModalActions, StyledModalBody, StyledModalCloseButton, StyledModalHeader, useStyledModalContext };
//# sourceMappingURL=StyledModal.esm.js.map
