"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;
};
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 pokedex_1 = require("./assets/pokedex");
var Container = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  margin: 30px;\n"], ["\n  margin: 30px;\n"])));
var prefixNum = function (num) { return (num.toString().length === 1 ? "0" + num : num); };
var columns = [
    {
        field: 'Name',
        sortable: true
    },
    {
        field: 'pokedex_number',
        label: 'National Pokedex Number',
        sortable: true,
        render: function (value) { return React.createElement("code", null, value); }
    },
    {
        field: 'Category',
        sortable: true
    },
    {
        field: 'first_seen',
        label: 'First Seen',
        sortable: true,
        render: function (value) {
            if (value == null) {
                return null;
            }
            var d = new Date(value);
            return (React.createElement("span", null,
                d.getFullYear(),
                "-",
                prefixNum(d.getMonth() + 1),
                "-",
                prefixNum(d.getDay() + 1)));
        }
    }
];
react_1.storiesOf('Table', module)
    .addWithInfo('Standard', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default })));
})
    .addWithInfo('Checkboxes', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default, rowKey: 'pokedex_number', onCheck: react_1.action('items-selected') })));
})
    .addWithInfo('Row Click', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default, rowKey: 'pokedex_number', onRowClick: react_1.action('row-clicked') })));
})
    .addWithInfo('Row Prefix', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default, tbodyPrefix: React.createElement("tr", null,
                React.createElement("td", { colSpan: columns.length },
                    React.createElement("p", { style: { textAlign: 'center' } }, "This row will always appear at the top of the table"))) })));
})
    .addWithInfo('Multiple Row Prefix', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default, tbodyPrefix: [
                React.createElement("tr", null,
                    React.createElement("td", { colSpan: columns.length },
                        React.createElement("p", { style: { textAlign: 'center' } }, "Row 1"))),
                React.createElement("tr", null,
                    React.createElement("td", { colSpan: columns.length },
                        React.createElement("p", { style: { textAlign: 'center' } }, "Row 2")))
            ] })));
})
    .addWithInfo('Anchor Rows', function () {
    return (React.createElement(Container, null,
        React.createElement(_1.Table, { columns: columns, data: pokedex_1.default, getRowHref: function (row) { return "https://www.pokemon.com/uk/pokedex/" + row.Name; }, rowAnchorAttributes: { target: '_blank' } })));
});
var templateObject_1;
