"use strict";

var _field = _interopRequireDefault(require("../../field"));

var _ = _interopRequireDefault(require(".."));

var _input = _interopRequireDefault(require("../../input"));

var _radio = _interopRequireDefault(require("../../radio"));

var _react = _interopRequireDefault(require("react"));

var _reactDom = _interopRequireDefault(require("react-dom"));

var _switch = _interopRequireDefault(require("../../switch"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function handleSubmit(v) {
  console.log(v);
}

var formItemLayout = {
  labelCol: {
    span: 4
  },
  wrapperCol: {
    span: 14
  }
};

var App = function App() {
  var field = _field["default"].useField({
    autoUnmount: false,
    values: {
      inline: false,
      labelAlign: 'left'
    }
  });

  var inline = field.getValue('inline');
  var labelAlign = inline ? 'left' : field.getValue('labelAlign');
  var layout = inline ? {} : formItemLayout;
  return /*#__PURE__*/_react["default"].createElement(_["default"], _extends({
    field: field,
    inline: inline,
    labelAlign: labelAlign
  }, layout), /*#__PURE__*/_react["default"].createElement(_["default"].Item, {
    label: "Inline Layout"
  }, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
    name: "inline"
  })), inline ? null : /*#__PURE__*/_react["default"].createElement(_["default"].Item, {
    label: "Label align"
  }, /*#__PURE__*/_react["default"].createElement(_radio["default"].Group, {
    shape: "button",
    name: "labelAlign"
  }, /*#__PURE__*/_react["default"].createElement(_radio["default"], {
    value: "left"
  }, "left"), /*#__PURE__*/_react["default"].createElement(_radio["default"], {
    value: "top"
  }, "top"), /*#__PURE__*/_react["default"].createElement(_radio["default"], {
    value: "inset"
  }, "inset"))), /*#__PURE__*/_react["default"].createElement(_["default"].Item, {
    label: "Username:"
  }, /*#__PURE__*/_react["default"].createElement(_input["default"], {
    name: "inlineUser",
    placeholder: "first"
  })), /*#__PURE__*/_react["default"].createElement(_["default"].Item, {
    label: "Password:",
    hasFeedback: false
  }, /*#__PURE__*/_react["default"].createElement(_input["default"].Password, {
    name: "inlinePass",
    placeholder: "Please enter your password!"
  })), /*#__PURE__*/_react["default"].createElement(_["default"].Item, {
    label: " "
  }, /*#__PURE__*/_react["default"].createElement(_["default"].Submit, {
    onClick: handleSubmit
  }, "Submit")));
};

_reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(App, null), document.getElementById('form-demo-2'));