"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
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 styled_components_1 = require("styled-components");
var _1 = require("../");
var Container = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  margin: 30px;\n"], ["\n  margin: 30px;\n"])));
var actionHandler = react_1.action('Data changed');
var PineTypeDemo = (function (_super) {
    __extends(PineTypeDemo, _super);
    function PineTypeDemo(props) {
        var _this = _super.call(this, props) || this;
        _this.state = {
            data: props.data
        };
        return _this;
    }
    PineTypeDemo.prototype.handleChange = function (data) {
        actionHandler(data);
        this.setState({ data: data });
    };
    PineTypeDemo.prototype.render = function () {
        var _this = this;
        return (React.createElement(Container, null,
            React.createElement("h2", null, "Edit"),
            React.createElement(this.props.Type.Edit, __assign({ value: this.state.data, onChange: function (val) { return _this.handleChange(val); } }, this.props)),
            React.createElement("h2", null, "Display"),
            React.createElement(this.props.Type.Display, { data: this.state.data })));
    };
    return PineTypeDemo;
}(React.Component));
react_1.storiesOf('PineTypes', module)
    .addWithInfo('Boolean', function () {
    return React.createElement(PineTypeDemo, { data: true, Type: _1.PineTypes.Boolean });
})
    .addWithInfo('Case Insensitive Text', function () {
    return (React.createElement(PineTypeDemo, { data: 'Lorem ipsum dolor sit amet', Type: _1.PineTypes['Case Insensitive Text'] }));
})
    .addWithInfo('Date', function () {
    return React.createElement(PineTypeDemo, { data: '2017-09-14', Type: _1.PineTypes.Date });
})
    .addWithInfo('Date Time', function () {
    return (React.createElement(PineTypeDemo, { data: '2017-09-14T12:00', Type: _1.PineTypes['Date Time'] }));
})
    .addWithInfo('Enum', function () {
    return (React.createElement(PineTypeDemo, { data: 'a', Type: _1.PineTypes.Enum, schema: { values: ['a', 'b', 'c'] } }));
})
    .addWithInfo('Integer', function () {
    return React.createElement(PineTypeDemo, { data: 1234, Type: _1.PineTypes.Integer });
})
    .addWithInfo('Real', function () {
    return React.createElement(PineTypeDemo, { data: 56.78, Type: _1.PineTypes.Real });
})
    .addWithInfo('Semver', function () {
    return React.createElement(PineTypeDemo, { data: '1.56.12', Type: _1.PineTypes.Semver });
})
    .addWithInfo('Semver Range', function () {
    return React.createElement(PineTypeDemo, { data: '> 1.56.12', Type: _1.PineTypes['Semver Range'] });
})
    .addWithInfo('Short Text', function () {
    return React.createElement(PineTypeDemo, { data: 'Lorem ipsum', Type: _1.PineTypes['Short Text'] });
})
    .addWithInfo('Text', function () {
    return (React.createElement(PineTypeDemo, { data: 'Lorem ipsum dolor sit amet', Type: _1.PineTypes.Text }));
})
    .addWithInfo('Time', function () {
    return React.createElement(PineTypeDemo, { data: '12:33', Type: _1.PineTypes.Time });
});
var templateObject_1;
