"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_1 = require("@storybook/react");
var storybook_chrome_screenshot_1 = require("storybook-chrome-screenshot");
var with_readme_1 = require("storybook-readme/with-readme");
var _1 = require("../");
var Readme = require("./README/Textarea.md");
var TextareaHOC = (function (_super) {
    __extends(TextareaHOC, _super);
    function TextareaHOC(props) {
        var _this = _super.call(this, props) || this;
        _this.state = {
            value: _this.props.value || ''
        };
        return _this;
    }
    TextareaHOC.prototype.render = function () {
        var _this = this;
        return (React.createElement(_1.Textarea, __assign({}, this.props, { autoRows: true, value: this.state.value, onChange: function (e) { return _this.setState({ value: e.target.value }); } })));
    };
    return TextareaHOC;
}(React.Component));
react_1.storiesOf('Core/Textarea', module)
    .addDecorator(with_readme_1.default(Readme))
    .addDecorator(storybook_chrome_screenshot_1.withScreenshot())
    .add('Standard', function () {
    return (React.createElement(_1.Provider, null,
        React.createElement(_1.Box, { m: 3 },
            React.createElement(_1.Textarea, { placeholder: 'Placeholder text' }))));
})
    .add('Monospace', function () {
    return (React.createElement(_1.Provider, null,
        React.createElement(_1.Box, { m: 3 },
            React.createElement(_1.Textarea, { monospace: true, placeholder: 'Placeholder text' }))));
})
    .add('AutoRows', function () {
    return (React.createElement(_1.Provider, null,
        React.createElement(_1.Box, { m: 3 },
            React.createElement(TextareaHOC, { placeholder: 'This input will grow to match the text it contains' }))));
})
    .add('MinRows', function () {
    var rows = 4;
    return (React.createElement(_1.Provider, null,
        React.createElement(_1.Box, { m: 3 },
            React.createElement(TextareaHOC, { minRows: rows, placeholder: "This input has a minimum size of " + rows + " rows" }))));
})
    .add('MaxRows', function () {
    var rows = 8;
    return (React.createElement(_1.Provider, null,
        React.createElement(_1.Box, { m: 3 },
            React.createElement(TextareaHOC, { maxRows: 8, placeholder: "This input has a maxiumum size of " + rows + " rows" }))));
});
