"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = withTableDataSorting;
var _react = _interopRequireDefault(require("react"));
var _sortableTableTh = _interopRequireDefault(require("./sortable-table-th"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function withTableDataSorting(BaseTable) {
  function WithTableDataSorting({
    forwardRef,
    onSortChange,
    sortColumnName,
    sortDirection,
    thProps,
    ThComponent,
    ...props
  }) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(BaseTable, {
      ref: forwardRef,
      ...props,
      ThComponent: _sortableTableTh.default,
      thProps: {
        ...thProps,
        onSortChange,
        sortColumnName,
        sortDirection,
        ThComponent
      }
    });
  }
  const WithRefTableDataSorting = /*#__PURE__*/_react.default.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(WithTableDataSorting, {
    ...props,
    forwardRef: ref
  }));
  WithRefTableDataSorting.displayName = 'WithTableDataSorting';
  return WithRefTableDataSorting;
}