text: "use strict";
  
  var _react = _interopRequireDefault(require("react"));
  
  var _react2 = require("@storybook/react");
  
  var _addonInfo = require("@storybook/addon-info");
  
  var _formik = require("formik");
  
  var _GuideExample = _interopRequireDefault(require("../../../stories/GuideExample"));
  
  var _Radio = _interopRequireDefault(require("./Radio.md"));
  
  var _ = _interopRequireDefault(require("../"));
  
  var _Form = _interopRequireWildcard(require("../../Form"));
  
  var _Button = _interopRequireDefault(require("../../Button"));
  
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  (0, _react2.storiesOf)('Radio', module).add('Basic', (0, _addonInfo.withInfo)(_Radio.default)(function () {
    return _react.default.createElement("div", null, _react.default.createElement(_GuideExample.default, null, _react.default.createElement(_Form.default, null, _react.default.createElement(_Form.FormControl, null, _react.default.createElement(_Form.Fieldset, {
      name: "storyRadioGroup"
    }, _react.default.createElement(_Form.Legend, null, "Some Radios:"), _react.default.createElement(_.default, null, "Radio 1"), _react.default.createElement(_.default, null, "Radio 2"))))), _react.default.createElement(_GuideExample.default, {
      label: "horizontal"
    }, _react.default.createElement(_Form.default, null, _react.default.createElement(_Form.FormControl, null, _react.default.createElement(_Form.Fieldset, {
      name: "storyRadioGroup2",
      horizontal: true
    }, _react.default.createElement(_Form.Legend, null, "Horizontal Radio List:"), _react.default.createElement(_.default, {
      defaultChecked: true
    }, "Radio 1"), _react.default.createElement(_.default, null, "Radio 2"))))), _react.default.createElement(_GuideExample.default, {
      label: "error"
    }, _react.default.createElement(_Form.default, null, _react.default.createElement(_Form.FormControl, {
      error: true
    }, _react.default.createElement(_Form.Fieldset, {
      name: "storyRadioGroup3"
    }, _react.default.createElement(_Form.Legend, null, "Radios with Error:"), _react.default.createElement(_.default, null, "Radio 1"), _react.default.createElement(_.default, null, "Radio 2"), _react.default.createElement(_.default, null, "Radio 3"), _react.default.createElement(_.default, null, "Radio 4"), _react.default.createElement(_Form.FormHelperText, null, "You can display an error too!"))))));
  })).add('with Formik', (0, _addonInfo.withInfo)(_Radio.default)(function () {
    var formValues = {
      subscription: 'user'
    };
    var subscriptionOptions = [{
      name: 'User',
      value: 'user'
    }, {
      name: 'Developer',
      value: 'dev'
    }, {
      name: 'Administrator',
      value: 'admin'
    }];
  
    var onSubmit = function onSubmit(values, actions) {
      setTimeout(function () {
        console.log(values);
        actions.setSubmitting(false);
      }, 1000);
    };
  
    var onValidate = function onValidate(values) {
      var errors = {}; // No validation logic for for this form...
  
      return errors;
    };
  
    return _react.default.createElement(_formik.Formik, {
      initialValues: formValues,
      validate: onValidate,
      onSubmit: onSubmit
    }, function (_ref) {
      var values = _ref.values,
          errors = _ref.errors,
          touched = _ref.touched,
          handleSubmit = _ref.handleSubmit,
          isSubmitting = _ref.isSubmitting;
      return _react.default.createElement(_GuideExample.default, null, _react.default.createElement(_Form.default, {
        onSubmit: handleSubmit
      }, _react.default.createElement(_Form.FormControl, {
        success: touched.subscription && !errors.subscription ? true : false,
        error: touched.subscription && errors.subscription ? true : false
      }, _react.default.createElement(_Form.FormControlLabel, {
        htmlFor: "subscription"
      }, "Subscription Type:"), subscriptionOptions.map(function (subscription) {
        return _react.default.createElement(_formik.Field, {
          key: subscription.value,
          component: _.default,
          name: "subscription",
          value: subscription.value
        }, subscription.name);
      }), _react.default.createElement(_Form.FormHelperText, null, touched.subscription && errors.subscription || null)), _react.default.createElement(_Form.FormControl, null, _react.default.createElement(_Button.default, {
        type: "submit",
        disabled: isSubmitting
      }, isSubmitting ? 'Submitting.......' : 'Submit')), _react.default.createElement("pre", null, JSON.stringify(values, null, 2))));
    });
  }));