"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.SearchOrCustomFilter = void 0;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _SearchOrCustomFilterStCss = require("./SearchOrCustomFilter.st.css.js");
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _mobxReactLite = require("mobx-react-lite");
var _useIsMobile = require("../../hooks/useIsMobile");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionToolbar/SearchOrCustomFilter.tsx";
function _SearchOrCustomFilter(props) {
  const {
    search
  } = props;
  const {
    toolbar: {
      responsive
    }
  } = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  const {
    _nextToShrink,
    search: searchResponsive,
    responsiveDisabled
  } = responsive;
  const isMobile = (0, _useIsMobile.useIsMobile)();
  if (responsiveDisabled || isMobile) {
    return /*#__PURE__*/_react.default.createElement(_designSystem.TableToolbar.Item, {
      className: (0, _SearchOrCustomFilterStCss.st)(isMobile ? _SearchOrCustomFilterStCss.classes.searchMobile : _SearchOrCustomFilterStCss.classes.search),
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 29,
        columnNumber: 7
      }
    }, search);
  }
  const shouldShrink = _nextToShrink._count >= searchResponsive._count && searchResponsive._shouldShrink;
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    direction: "horizontal",
    maxWidth: "240px",
    minWidth: shouldShrink ? '139px' : '140px',
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 42,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    width: shouldShrink ? '140px' : '240px',
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 47,
      columnNumber: 7
    }
  }, search));
}
const SearchOrCustomFilter = exports.SearchOrCustomFilter = (0, _mobxReactLite.observer)(_SearchOrCustomFilter);
//# sourceMappingURL=SearchOrCustomFilter.js.map