/// <reference types="react" />
type OrderingStateProps = {
    orderBy?: string;
    isAscendingOrder?: boolean;
};
/**
 * @typedef {Object} OrderingState
 * @property {string} orderBy - property that's being used for ordering
 * @property {boolean} isAscendingOrder - is ordering ascending
 */
/**
 * @typedef {Ordering} Ordering
 * @property {string} orderBy - property that's being used for ordering
 * @property {boolean} isAscendingOrder - is ordering ascending
 * @property {function} setOrderBy - set ordering key
 * @property {function} setIsAscendingOrder - set ascending or descending order
 */
/**
 * Provides state and action for data ordering controls
 * If same key is set as `orderBy` order direction is reversed
 * Example:
 ```
  const { orderBy, isAscendingOrder, setOrderBy } = useOrderingState();
  const [data, setData] = useState(null);

  useEffect(() => {
    fetchStuff({
      orderBy,
      orderDirection: isAscendingOrder ? 'asc' : 'desc',
    }).then(setData);
  }, [orderBy, isAscendingOrder]);

  return (
    <SomeOrderedDataView
      orderBy={orderBy}
      isAscendingOrder={isAscendingOrder}
      onOrderChange={setOrderBy}
    />
  );
 ```
 * @param {OrderingState} initialState - initial values that will be applied
 * on mount
 * @returns {Ordering}
 */
export declare function useOrderingState(config: OrderingStateProps): {
    orderBy: string;
    isAscendingOrder: boolean;
    setOrderBy: (newOrderKey: string) => void;
    setIsAscendingOrder: import("react").Dispatch<import("react").SetStateAction<boolean>>;
};
/**
 * Ordering hook that provides an array of ordered objects along
 * with state of ordering and actions to change it
 * Example:
 ```
  const unorderedItems = getItemsSomehow();
  const { items, orderBy, isAscendingOrder, setOrderBy } = useOrdering(
    unorderedItems
  );
  const headers = ['title', 'subTitle'];

  return (
    <div>
      {headers.map(header => (
        <div
          onClick={() => setOrderBy(header)}
          className={orderBy === header ? 'active' : ''}
        >
          {header}
          <FontAwesomeIcon icon={isAscendingOrder ? faSortUp : faSortDown} />
        </div>
      ))}
      {items.map(item => (
        <div>
          <div>{item.title}</div>
          <div>{item.subTitle}</div>
        </div>
      ))}
    </div>
  );
 ```
 *
 * @param {[object]} items - array of objects that needs to be ordered
 * @param {OrderingState} initialState - initial values for ordering
 * @param {function} orderFunction - custom ordering function
 * @returns
 */
type OrderFunction = ((item: Record<string, unknown>, orderBy: string, isAscendingOrder: boolean) => void) | undefined;
export declare function useOrdering(items: Array<Record<string, unknown>>, initialState: OrderingStateProps, orderFunction?: OrderFunction): {
    items: Record<string, unknown>[];
    orderBy: string;
    isAscendingOrder: boolean;
    setOrderBy: (newOrderKey: string) => void;
    setIsAscendingOrder: import("react").Dispatch<import("react").SetStateAction<boolean>>;
};
export {};
