"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.WholeRowExpandableTable = exports.OnlyExpandableOnMobileTable = exports.HiddenExpandItemOnDesktop = exports.ExpandedTableDifferentFontSizeOnMobile = exports.ExpandedTable = exports.ControlledWholeRowExpandableTable = exports.ControlledExpandedTable = exports.ControlledExpandableTableWithClickableRows = void 0;
var _react = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _FlexTable = _interopRequireDefault(require("../FlexTable.mdx"));
var _2 = require("../../..");
var _excluded = ["children"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var _default = exports.default = {
  title: 'Molecules / FlexTable / With expandable rows',
  parameters: {
    component: _2.FlexTable,
    docs: {
      page: _FlexTable.default
    }
  }
};
var expandedItemsGenerator = function expandedItemsGenerator() {
  var renderComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  return _toConsumableArray(Array(20)).reduce(function (acc, _, itemIndex) {
    if (itemIndex === 0) {
      var _label = 'This is a reaaaallllyyy loooong label demonstrating truncation';
      var _value = 'These values are super long to also demonstrate truncation';
      return [].concat(_toConsumableArray(acc), [{
        label: _label,
        value: _value
      }]);
    }
    var keyName = "".concat(itemIndex + 1);
    var labelText = "Label ".concat(keyName);
    var label = renderComponent ? function () {
      return _react.default.createElement(_2.FlexTable.ExpandItem.TextWrapper, {
        isLabel: true
      }, labelText);
    } : labelText;
    var valueText = Math.floor(Math.pow(10, 20 - Math.ceil(Math.random() * 20)) * Math.random());
    var value = renderComponent ? function () {
      return _react.default.createElement(_2.FlexTable.ExpandItem.TextWrapper, null, _react.default.createElement(_2.Number, {
        value: valueText
      }));
    } : valueText.toString();
    return [].concat(_toConsumableArray(acc), [{
      label: label,
      value: value
    }]);
  }, []);
};
var expandChildrenComponents = _react.default.createElement(_2.Flexbox, {
  container: true,
  justifyContent: "center",
  gap: 2
}, _react.default.createElement(_2.Flexbox, {
  item: true
}, _react.default.createElement(_2.Button, {
  size: "l",
  variant: "primary"
}, "Buy")), _react.default.createElement(_2.Flexbox, {
  item: true
}, _react.default.createElement(_2.Button, {
  size: "l",
  variant: "secondary"
}, "Sell")));
var ExpandedTable = exports.ExpandedTable = function ExpandedTable() {
  var expandItemsText = expandedItemsGenerator();
  var expandItemsComponents = expandedItemsGenerator(true);
  return _react.default.createElement(_2.FlexTable, {
    expandable: true
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Header 3"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column4",
    hidden: true
  }, "Header 4")), _react.default.createElement(_2.FlexTable.Row, null, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true
  }, "Hidden")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true
  }, "Hidden")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    initiallyExpanded: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable with initial state"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable with initial state"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Expandable with initial state"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true
  }, "Hidden")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsComponents
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable component items"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable component items"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Expandable component items"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true
  }, "Hidden")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    expandChildren: expandChildrenComponents
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable with children"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable with children"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3",
    justifyContent: "flex-end"
  }, "Expandable with children"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true
  }, "Hidden")));
};
var OnlyExpandableOnMobileTable = exports.OnlyExpandableOnMobileTable = function OnlyExpandableOnMobileTable() {
  var columnData = [{
    label: 'Header 4',
    value: 'Expandable 4'
  }, {
    label: 'Header 5',
    value: 'Expandable 5'
  }, {
    label: 'Header 6',
    value: 'Expandable 6'
  }, {
    label: 'Header 7',
    value: 'Expandable 7'
  }];
  return _react.default.createElement(_2.FlexTable, {
    expandable: true,
    md: {
      expandable: false
    }
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3"
  }, "Header 3"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column4",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Header 4"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column5",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Header 5"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column6",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Header 6"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column7",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Header 7")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: columnData
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column4",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Expandable 4"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column5",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Expandable 5"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column6",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Expandable 6"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column7",
    hidden: true,
    md: {
      hidden: false
    }
  }, "Expandable 7")));
};
var ControlledExpandedTable = exports.ControlledExpandedTable = function ControlledExpandedTable() {
  var expandItemsText = expandedItemsGenerator();
  var expandItemsComponents = expandedItemsGenerator(true);
  var ControlledExpandedTableExample = function ControlledExpandedTableExample() {
    var _useState = (0, _react.useState)(['row3']),
      _useState2 = _slicedToArray(_useState, 2),
      expandedRows = _useState2[0],
      setExpandedRows = _useState2[1];
    var isExpanded = function isExpanded(rowId) {
      return expandedRows.includes(rowId);
    };
    var onExpandClick = function onExpandClick(rowId) {
      return function (newExpanded) {
        return newExpanded ? setExpandedRows([].concat(_toConsumableArray(expandedRows), [rowId])) : setExpandedRows(expandedRows.filter(function (row) {
          return row !== rowId;
        }));
      };
    };
    return _react.default.createElement(_2.FlexTable, {
      expandable: true
    }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column1"
    }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column2"
    }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column3"
    }, "Header 3")), _react.default.createElement(_2.FlexTable.Row, null, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Disabled")), _react.default.createElement(_2.FlexTable.Row, {
      expandItems: expandItemsText,
      expanded: isExpanded('row2'),
      onExpandToggle: onExpandClick('row2')
    }, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Expandable")), _react.default.createElement(_2.FlexTable.Row, {
      expandItems: expandItemsText,
      expanded: isExpanded('row3'),
      onExpandToggle: onExpandClick('row3')
    }, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Expandable with initial state"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Expandable with initial state"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Expandable with initial state")), _react.default.createElement(_2.FlexTable.Row, {
      expandItems: expandItemsComponents,
      expanded: isExpanded('row4'),
      onExpandToggle: onExpandClick('row4')
    }, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Expandable component items"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Expandable component items"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Expandable component items")), _react.default.createElement(_2.FlexTable.Row, {
      expandItems: expandItemsText,
      expandChildren: expandChildrenComponents,
      expanded: isExpanded('row5'),
      onExpandToggle: onExpandClick('row5')
    }, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Expandable with children"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Expandable with children"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Expandable with children")));
  };
  return _react.default.createElement(ControlledExpandedTableExample, null);
};
var RowWithPointer = (0, _styledComponents.default)(_2.FlexTable.Row).withConfig({
  displayName: "WithExpandableRowsstories__RowWithPointer",
  componentId: "sc-1e1fiux-0"
})([":hover{cursor:pointer;}"]);
var ControlledExpandableTableWithClickableRows = exports.ControlledExpandableTableWithClickableRows = function ControlledExpandableTableWithClickableRows() {
  var expandItems = [{
    label: 'Expand item 1',
    value: 123
  }, {
    label: 'Expand item 2',
    value: 456
  }, {
    label: 'Expand item 3',
    value: 789
  }];
  var ControlledExpandedTableExample = function ControlledExpandedTableExample() {
    var _useState3 = (0, _react.useState)([]),
      _useState4 = _slicedToArray(_useState3, 2),
      expandedRows = _useState4[0],
      setExpandedRows = _useState4[1];
    var isExpanded = function isExpanded(rowId) {
      return expandedRows.includes(rowId);
    };
    var onExpandClick = function onExpandClick(rowId) {
      return function (newExpanded) {
        return newExpanded ? setExpandedRows([].concat(_toConsumableArray(expandedRows), [rowId])) : setExpandedRows(expandedRows.filter(function (row) {
          return row !== rowId;
        }));
      };
    };
    return _react.default.createElement(_2.FlexTable, {
      expandable: true
    }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column1"
    }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column2"
    }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
      columnId: "column3"
    }, "Header 3")), _react.default.createElement(_2.FlexTable.Row, null, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "Disabled"), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "Disabled")), _react.default.createElement(RowWithPointer, {
      expandItems: expandItems,
      expanded: isExpanded('row2'),
      onClick: function onClick() {
        return onExpandClick('row2')(!isExpanded('row2'));
      }
    }, _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column1"
    }, "Entire..."), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column2"
    }, "...row..."), _react.default.createElement(_2.FlexTable.Cell, {
      columnId: "column3"
    }, "...clickable")));
  };
  return _react.default.createElement(ControlledExpandedTableExample, null);
};
var ExpandedTableDifferentFontSizeOnMobile = exports.ExpandedTableDifferentFontSizeOnMobile = function ExpandedTableDifferentFontSizeOnMobile() {
  var expandItemsText = expandedItemsGenerator();
  return _react.default.createElement(_2.FlexTable, {
    fontSize: "m",
    md: {
      fontSize: 's'
    },
    expandable: true
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3"
  }, "Header 3")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    initiallyExpanded: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Expandable"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "Expandable")));
};
var HiddenExpandItemOnDesktop = exports.HiddenExpandItemOnDesktop = function HiddenExpandItemOnDesktop() {
  return _react.default.createElement(_2.FlexTable, {
    expandable: true
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3"
  }, "Header 3")), _react.default.createElement(_2.FlexTable.Row, {
    initiallyExpanded: true,
    expandItems: [{
      label: 'Always visible',
      value: 123
    }, {
      label: 'Hidden on desktop',
      value: 1000,
      md: {
        hidden: true
      }
    }]
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Value 1"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Value 2"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "Value 3")));
};
var WholeRowExpandableTable = exports.WholeRowExpandableTable = function WholeRowExpandableTable() {
  var expandItemsText = expandedItemsGenerator();
  return _react.default.createElement(_2.FlexTable, {
    expandable: true
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3"
  }, "Header 3")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    clickRowToExpand: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Click anywhere"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "on this row"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "to toggle expand")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    expandChildren: expandChildrenComponents,
    clickRowToExpand: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Click anywhere"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "on this row"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "to toggle expand")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    clickRowToExpand: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Click anywhere"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "on this row"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "to toggle expand")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    expandChildren: expandChildrenComponents,
    clickRowToExpand: true
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "Click anywhere"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "on this row"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "to toggle expand")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "This row is NOT clickable!"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Except for on"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "the chevron...")), _react.default.createElement(_2.FlexTable.Row, {
    expandItems: expandItemsText,
    expandChildren: expandChildrenComponents
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "This row is NOT clickable!"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "Except for on"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "the chevron...")));
};
var ControlledWholeRowExpandableTable = exports.ControlledWholeRowExpandableTable = function ControlledWholeRowExpandableTable() {
  var ControlledRow = function ControlledRow(_ref) {
    var children = _ref.children,
      rowProps = _objectWithoutProperties(_ref, _excluded);
    var _useState5 = (0, _react.useState)(false),
      _useState6 = _slicedToArray(_useState5, 2),
      expanded = _useState6[0],
      setExpanded = _useState6[1];
    return _react.default.createElement(_2.FlexTable.Row, _extends({}, rowProps, {
      expanded: expanded,
      onExpandToggle: function onExpandToggle() {
        return setExpanded(!expanded);
      },
      clickRowToExpand: true
    }), children);
  };
  var expandItemsText = expandedItemsGenerator();
  return _react.default.createElement(_2.FlexTable, {
    expandable: true
  }, _react.default.createElement(_2.FlexTable.HeaderRow, null, _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column1"
  }, "Header 1"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column2"
  }, "Header 2"), _react.default.createElement(_2.FlexTable.Header, {
    columnId: "column3"
  }, "Header 3")), _react.default.createElement(ControlledRow, {
    expandItems: expandItemsText,
    expandChildren: expandChildrenComponents
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "This row is"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "a controlled example"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "that handles the expansion")), _react.default.createElement(ControlledRow, {
    expandItems: expandItemsText
  }, _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column1"
  }, "This row is"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column2"
  }, "a controlled example"), _react.default.createElement(_2.FlexTable.Cell, {
    columnId: "column3"
  }, "that handles the expansion")));
};