import _extends from "@babel/runtime/helpers/extends";
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
import React, { useContext } from 'react';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import DistractionFreeModeContext from '../DistractionFreeModeContext';

/**
 * `ToolbarExpander` is a part of the [Toolbar](#!/Toolbar) component.
 * It is used to split all toolbar controls into two groups:
 * all controls before ToolbarExpander are aligned left, and all controls after ToolbarExpander are aligned right.
 * @since 0.0.57
 */
const ToolbarExpander = ({
  baseClassName = "".concat(CLS_PREFIX, "toolbar__expander"),
  className,
  children,
  ...props
}) => {
  const distractionFreeMode = useContext(DistractionFreeModeContext);

  if (distractionFreeMode && distractionFreeMode.enabled) {
    return null;
  }

  return /*#__PURE__*/React.createElement("div", _extends({
    className: classNames(baseClassName, className)
  }, props), children);
};

export default ToolbarExpander;