"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BookingOption = void 0;
var _locale = require("@mirai/locale");
var _ui = require("@mirai/ui");
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireDefault(require("react"));
var style = _interopRequireWildcard(require("./Filters.module.css"));
const _excluded = ["caption", "checked", "field", "title", "onChange"];
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
const BookingOption = _ref => {
  let {
      caption,
      checked,
      field,
      title,
      onChange = () => {}
    } = _ref,
    others = _objectWithoutProperties(_ref, _excluded);
  const {
    translate
  } = (0, _locale.useLocale)();
  return /*#__PURE__*/_react.default.createElement(_ui.View, {
    row: true,
    className: style.spaceBetween
  }, /*#__PURE__*/_react.default.createElement(_ui.View, null, /*#__PURE__*/_react.default.createElement(_ui.Text, {
    action: true
  }, translate(title, others)), caption && /*#__PURE__*/_react.default.createElement(_ui.Text, {
    light: true,
    small: true
  }, caption)), /*#__PURE__*/_react.default.createElement(_ui.Switch, {
    checked: checked,
    name: "switch:".concat(field),
    onChange: value => onChange(field, value),
    "aria-label": translate(title, others)
  }));
};
exports.BookingOption = BookingOption;
BookingOption.displayName = 'Mirai:Core:Rates:Filters.BookingOption';
BookingOption.propTypes = {
  caption: _propTypes.default.any,
  checked: _propTypes.default.bool,
  field: _propTypes.default.string,
  title: _propTypes.default.any,
  onChange: _propTypes.default.func
};
//# sourceMappingURL=Filters.BookingOption.js.map