import { createBEM } from '@zarm-design/bem';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import Popup from '../popup';
import SafeArea from '../safe-area';
import { noop } from '../utils';
var PickerContainer = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var className = props.className,
      style = props.style,
      visible = props.visible,
      title = props.title,
      confirmText = props.confirmText,
      cancelText = props.cancelText,
      maskClosable = props.maskClosable,
      forceRender = props.forceRender,
      destroy = props.destroy,
      safeArea = props.safeArea,
      mountContainer = props.mountContainer,
      onConfirm = props.onConfirm,
      onCancel = props.onCancel,
      onClose = props.onClose,
      afterOpen = props.afterOpen,
      afterClose = props.afterClose,
      children = props.children;

  var _React$useContext = React.useContext(ConfigContext),
      prefixCls = _React$useContext.prefixCls,
      locale = _React$useContext.locale,
      globalSafeArea = _React$useContext.safeArea;

  var bem = createBEM('picker', {
    prefixCls: prefixCls
  });
  return /*#__PURE__*/React.createElement(Popup, {
    ref: ref,
    visible: visible,
    onMaskClick: maskClosable ? onClose : noop,
    mountContainer: mountContainer,
    forceRender: forceRender,
    destroy: destroy,
    afterOpen: afterOpen,
    afterClose: afterClose
  }, /*#__PURE__*/React.createElement("div", {
    className: bem('', [className]),
    style: style,
    onClick: function onClick(event) {
      event.stopPropagation();
    }
  }, /*#__PURE__*/React.createElement("div", {
    className: bem('header')
  }, /*#__PURE__*/React.createElement("div", {
    className: bem('cancel'),
    onClick: function onClick() {
      return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
    }
  }, cancelText || (locale === null || locale === void 0 ? void 0 : locale.Picker.cancelText)), /*#__PURE__*/React.createElement("div", {
    className: bem('title')
  }, title || (locale === null || locale === void 0 ? void 0 : locale.Picker.title)), /*#__PURE__*/React.createElement("div", {
    className: bem('confirm'),
    onClick: function onClick() {
      return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
    }
  }, confirmText || (locale === null || locale === void 0 ? void 0 : locale.Picker.confirmText))), /*#__PURE__*/React.createElement("div", {
    className: bem('body')
  }, children), (safeArea !== null && safeArea !== void 0 ? safeArea : globalSafeArea) && /*#__PURE__*/React.createElement(SafeArea, {
    position: "bottom"
  })));
});
export default PickerContainer;