import './demo13.css';
import Button from '../../button';
import Field from '..';
import Input from '../../input';
import React from 'react';
import ReactDOM from 'react-dom';
function App() {
    const field = Field.useField();
    const { init, getError } = field;
    function onGetValue() {
        console.log(field.getValue('input'));
    }
    function onSetValue() {
        field.setValue('input', 'xyz');
    }
    return (React.createElement("div", { className: "demo" },
        React.createElement(Input, Object.assign({}, init('input', {
            initValue: 'test',
            rules: [
                {
                    required: true,
                    pattern: /hello/,
                    message: 'must be hello',
                },
            ],
        }))),
        React.createElement("span", { style: { color: 'red' } }, getError('input')),
        React.createElement("br", null),
        React.createElement("br", null),
        React.createElement(Button, { onClick: onSetValue }, " setValue "),
        React.createElement(Button, { onClick: onGetValue }, " getValue "),
        React.createElement("br", null),
        React.createElement("br", null)));
}
ReactDOM.render(React.createElement(App, null), document.getElementById('field-demo-14'));
