"use strict";

require("./demo13.css");

var _button = _interopRequireDefault(require("../../button"));

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

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

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

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

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

function App() {
  var field = _["default"].useField();

  var init = field.init,
      getError = field.getError;

  function onGetValue() {
    console.log(field.getValue('input'));
  }

  function onSetValue() {
    field.setValue('input', 'xyz');
  }

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "demo"
  }, /*#__PURE__*/_react["default"].createElement(_input["default"], init('input', {
    initValue: 'test',
    rules: [{
      required: true,
      pattern: /hello/,
      message: 'must be hello'
    }]
  })), /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      color: 'red'
    }
  }, getError('input')), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_button["default"], {
    onClick: onSetValue
  }, " setValue "), /*#__PURE__*/_react["default"].createElement(_button["default"], {
    onClick: onGetValue
  }, " getValue "), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("br", null));
}

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