"use strict";

require("core-js/modules/es.object.define-property.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FcrSwitch = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
require("./index.css");
var _jsxRuntime = require("react/jsx-runtime");
var FcrSwitch = exports.FcrSwitch = function FcrSwitch(_ref) {
  var _labels$on, _labels$off;
  var labels = _ref.labels,
    value = _ref.value,
    _ref$onChange = _ref.onChange,
    onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
  var cls = (0, _classnames["default"])('fcr-switch', {
    'fcr-switch--on': value,
    'fcr-switch--off': !value
  });
  var handleClick = function handleClick() {
    onChange(!value);
  };
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: cls,
    onClick: handleClick,
    children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
      className: "fcr-switch__labels",
      children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
        children: (_labels$on = labels === null || labels === void 0 ? void 0 : labels.on) !== null && _labels$on !== void 0 ? _labels$on : 'ON'
      }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
        children: (_labels$off = labels === null || labels === void 0 ? void 0 : labels.off) !== null && _labels$off !== void 0 ? _labels$off : 'OFF'
      })]
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "fcr-switch__slider"
    })]
  });
};