"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _useNumberRangeFilter = require("./useNumberRangeFilter");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/NumberRangeFilter/NumberRangeFilter.tsx";
function NumberRangeFilter({
  filter,
  decimal = false,
  min,
  max
}) {
  const {
    fromValue,
    toValue,
    fromError,
    toError,
    handleInputChange,
    placeholder,
    commonInputProps,
    t
  } = (0, _useNumberRangeFilter.useNumberRangeFilter)({
    filter,
    decimal,
    min,
    max
  });
  return /*#__PURE__*/_react.default.createElement(_designSystem.FieldSet, (0, _extends2.default)({
    dataHook: `number-range-filter-${filter.name}`,
    direction: "horizontal",
    gap: "medium",
    columns: "1fr 1fr",
    legend: `Number range filter - ${filter.name}`,
    legendPlacement: "none"
  }, fromError ? {
    status: 'error',
    statusMessage: fromError
  } : {}, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 37,
      columnNumber: 5
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.FormField, (0, _extends2.default)({
    dataHook: "number-range-filter-from-form-field",
    label: t('cairo.filtersPanel.numRange.min-from')
  }, fromError ? {
    status: 'error'
  } : {}, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 46,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.NumberInput, (0, _extends2.default)({}, commonInputProps, {
    placeholder: placeholder.min,
    value: fromValue ?? '',
    onChange: value => handleInputChange({
      from: value,
      isFrom: true
    }),
    dataHook: "number-range-filter-from-input",
    size: "medium",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 51,
      columnNumber: 9
    }
  }))), /*#__PURE__*/_react.default.createElement(_designSystem.FormField, (0, _extends2.default)({
    dataHook: "number-range-filter-to-form-field",
    label: t('cairo.filtersPanel.numRange.maxRange-to')
  }, toError ? {
    status: 'error',
    statusMessage: toError
  } : {}, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 60,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.NumberInput, (0, _extends2.default)({}, commonInputProps, {
    placeholder: placeholder.max,
    value: toValue ?? '',
    onChange: value => handleInputChange({
      to: value,
      isFrom: false
    }),
    dataHook: "number-range-filter-to-input",
    size: "medium",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 65,
      columnNumber: 9
    }
  }))));
}
var _default = exports.default = (0, _mobxReactLite.observer)(NumberRangeFilter);
//# sourceMappingURL=NumberRangeFilter.js.map