import React from 'react';
import SortableTableTh from './sortable-table-th';
import { jsx as _jsx } from "react/jsx-runtime";
export default function withTableDataSorting(BaseTable) {
  function WithTableDataSorting({
    forwardRef,
    onSortChange,
    sortColumnName,
    sortDirection,
    thProps,
    ThComponent,
    ...props
  }) {
    return /*#__PURE__*/_jsx(BaseTable, {
      ref: forwardRef,
      ...props,
      ThComponent: SortableTableTh,
      thProps: {
        ...thProps,
        onSortChange,
        sortColumnName,
        sortDirection,
        ThComponent
      }
    });
  }
  const WithRefTableDataSorting = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/_jsx(WithTableDataSorting, {
    ...props,
    forwardRef: ref
  }));
  WithRefTableDataSorting.displayName = 'WithTableDataSorting';
  return WithRefTableDataSorting;
}