function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { Badge, BADGE_COLOR_VARIANT, BADGE_COLOR } from '../Badge';
import { Table, TableColumn } from '.';
export default {
  component: Table,
  subcomponents: {
    TableColumn: TableColumn
  },
  title: 'Table',
  parameters: {
    actions: {
      argTypesRegex: '^on.*'
    },
    layout: 'fullscreen'
  }
};
var tableData = [{
  id: 'a',
  first: 'Row 1 cell 1',
  second: 'Row 1 cell 2',
  third: 'Row 1 cell 3',
  fourth: 'Row 1 cell 4',
  fifth: 'Row 1 cell 5'
}, {
  id: 'b',
  first: 'Row 2 cell 1',
  second: 'Row 2 cell 2',
  third: 'Row 2 cell 3',
  fourth: 'Row 2 cell 4',
  fifth: 'Row 2 cell 5'
}];
export var Default = function Default(props) {
  return /*#__PURE__*/React.createElement(Table, props, /*#__PURE__*/React.createElement(TableColumn, {
    field: "first"
  }, "First column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "second"
  }, "Second column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "third"
  }, "Third column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "fourth"
  }, "Fourth column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "fifth"
  }, "Fifth column"));
};
Default.args = {
  data: tableData
};
var tableDataArbitraryCellContent = [{
  id: 'a',
  first: 'Row 1 cell 1',
  second: /*#__PURE__*/React.createElement(Badge, {
    colorVariant: BADGE_COLOR_VARIANT.FADED,
    color: BADGE_COLOR.SUCCESS
  }, "Online")
}, {
  id: 'b',
  first: 'Row 2 cell 1',
  second: /*#__PURE__*/React.createElement(Badge, {
    colorVariant: BADGE_COLOR_VARIANT.FADED,
    color: BADGE_COLOR.DANGER
  }, "Offline")
}];
export var ArbitraryCellContent = function ArbitraryCellContent(props) {
  return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
    data: tableDataArbitraryCellContent
  }), /*#__PURE__*/React.createElement(TableColumn, {
    field: "first"
  }, "First column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "second"
  }, "Status"));
};
ArbitraryCellContent.storyName = 'Arbitrary cell content';
export var Sortable = function Sortable(props) {
  var tableDataSortable = [{
    id: 'a',
    first: 'Row 1 cell 1',
    second: 'Row 1 cell 2',
    third: 'Row 1 cell 3'
  }, {
    id: 'b',
    first: 'Row 2 cell 1',
    second: 'Row 2 cell 2',
    third: 'Row 2 cell 3'
  }, {
    id: 'c',
    first: 'Row 3 cell 1',
    second: 'Row 3 cell 2',
    third: 'Row 3 cell 3'
  }];
  return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
    data: tableDataSortable
  }), /*#__PURE__*/React.createElement(TableColumn, {
    field: "first",
    isSortable: true
  }, "First column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "second",
    isSortable: true
  }, "Second column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "third",
    isSortable: true
  }, "Third column"));
};
Sortable.storyName = 'Sortable';
export var WithCaption = function WithCaption(props) {
  var tableDataWithCaption = [{
    id: 'a',
    first: 'Row 1 cell 1',
    second: 'Row 1 cell 2',
    third: 'Row 1 cell 3'
  }, {
    id: 'b',
    first: 'Row 2 cell 1',
    second: 'Row 2 cell 2',
    third: 'Row 2 cell 3'
  }];
  return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
    data: tableDataWithCaption,
    caption: "Example caption"
  }), /*#__PURE__*/React.createElement(TableColumn, {
    field: "first"
  }, "First column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "second"
  }, "Second column"), /*#__PURE__*/React.createElement(TableColumn, {
    field: "third"
  }, "Third column"));
};
WithCaption.storyName = 'With caption';