"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.props = void 0;

var _react = _interopRequireDefault(require("react"));

var _react2 = require("@storybook/react");

var _addonKnobs = require("@storybook/addon-knobs");

var _configureStore2 = _interopRequireDefault(require("../../../storybook/configureStore"));

var _other = require("../../../storybook/reducers/other");

var _component = _interopRequireDefault(require("./component"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var _configureStore = (0, _configureStore2.default)(),
    getState = _configureStore.getState,
    dispatch = _configureStore.dispatch; // const RangeRF = reduxForm({
//   form: 'range',
// })(Range);


var props = function props() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      _ref$checked = _ref.checked,
      checked = _ref$checked === void 0 ? undefined : _ref$checked,
      _ref$id = _ref.id,
      id = _ref$id === void 0 ? undefined : _ref$id,
      _ref$value = _ref.value,
      value = _ref$value === void 0 ? undefined : _ref$value,
      _ref$name = _ref.name,
      name = _ref$name === void 0 ? undefined : _ref$name,
      _ref$label = _ref.label,
      label = _ref$label === void 0 ? undefined : _ref$label;

  var groupId = arguments.length > 1 ? arguments[1] : undefined;
  return {
    checked: (0, _addonKnobs.boolean)('checked', checked, groupId),
    id: (0, _addonKnobs.text)('id', id, groupId),
    value: (0, _addonKnobs.text)('value', value, groupId),
    name: (0, _addonKnobs.text)('name', name, groupId),
    label: (0, _addonKnobs.text)('label', label, groupId)
  };
};

exports.props = props;

var onClick = function onClick() {
  dispatch((0, _other.updateRadio)());
  (0, _react2.forceReRender)();
};

(0, _react2.storiesOf)('Web|form/Radio').add('Default', function () {
  return _react.default.createElement(_component.default, _extends({}, props({
    checked: getState().other.formRadio.checked
  }), {
    // {...props()}
    onClick: onClick
  }));
}); // .add('Example with redux form', () => (
//   <RadioRF
//     {...props({ value: getState().other.formRadio.value, isRFFWrap: true })}
//     onClick={onClick}
//   />
// ), { info: 'redux-form lib, reduxForm() parent' });