"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _radio = _interopRequireDefault(require("../../../radio"));
var _wauField = _interopRequireDefault(require("../../../wau-field"));
var _createField = _interopRequireDefault(require("../../create-field"));
var _jsxRuntime = require("react/jsx-runtime");
const RadioGroup = /*#__PURE__*/_react.default.forwardRef(({
  fieldProps,
  options,
  radioType,
  layout,
  proFieldProps
}, ref) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_wauField.default, {
    mode: "edit",
    valueType: radioType === 'button' ? 'radioButton' : 'radio',
    ref: ref,
    fieldProps: {
      options,
      layout,
      ...fieldProps
    },
    ...proFieldProps
  });
});

/**
 * Radio
 *
 * @param
 */
const ProFormRadio = /*#__PURE__*/_react.default.forwardRef(({
  fieldProps,
  children
}, ref) => {
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_radio.default, {
    ...fieldProps,
    ref: ref,
    children: children
  });
});
const Group = (0, _createField.default)(RadioGroup, {
  customLightMode: true
});

// @ts-expect-error
const WrappedProFormRadio = (0, _createField.default)(ProFormRadio, {
  valuePropName: 'checked'
});
WrappedProFormRadio.Group = Group;
WrappedProFormRadio.Button = _radio.default.Button;
var _default = WrappedProFormRadio;
exports.default = _default;