'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _FieldWrapper = require('../fields/FieldWrapper');

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

var ActionFields = _styledComponents2.default.div.withConfig({
  displayName: 'ActionFields__ActionFields'
})(['display: flex;flex-direction: row;', ';margin-top: ', 'px;margin-bottom: ', 'px;flex: 1 0 100%;& > ', ' {margin: auto ', 'px;}& > ', ':last-child {margin-', ': 0;}'], function (_ref) {
  var align = _ref.align;

  switch (align) {
    case 'right':
      return 'justify-content: flex-end;';
    case 'left':
      return 'justify-content: flex-end; flex-direction: row-reverse;';
    case 'center':
      return 'justify-content: center;';
    case 'outside':
      return 'justify-content: space-between;';
  }
}, function (_ref2) {
  var theme = _ref2.theme;
  return theme.form.elementVerticalSpacing / 2;
}, function (_ref3) {
  var theme = _ref3.theme;
  return theme.form.elementVerticalSpacing / 2;
}, _FieldWrapper.Container, function (_ref4) {
  var theme = _ref4.theme;
  return theme.form.elementHorizontalSpacing / 2;
}, _FieldWrapper.Container, function (_ref5) {
  var align = _ref5.align;
  return align;
});

ActionFields.defaultProps = {
  align: 'right'
};

ActionFields.usage = '\n# ActionFields\n\nActionFields is a layout container for that last row of buttons and links in a form. You know the one. They\'re all aligned in a particular way. You could achieve this with some fiddling and a FieldGroup, but why not just include a more convenient component for it?\n\nYou can pass `left|right|center|outside` to the `\'align\'` prop to switch the alignment.\n\nAlignment `\'left\'` will reverse the order of elements, so you can switch easily between left and right.\n\n```\n<Form>\n  <Field component={TextField} label="name" />\n  <ActionFields>\n    <LinkField>Cancel</LinkField>\n    <ButtonField type="submit">Save</ButtonField>\n  </ActionFields>\n</Form>\n```\n';

exports.default = ActionFields;