Sha256: 71b7cd4b61c72f6a1a1d88f550c54112e6b363a57b47ea2b23ea6d54e9bcd295

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

import React from 'react';
import { Field } from 'redux-form';
import PropTypes from 'prop-types';

import RenderField from './RenderField';

const TextButtonField = ({
  item = {},
  label,
  name,
  className,
  inputClassName,
  blank,
  buttonAttrs,
  fieldSelector,
  validate,
  disabled,
  fieldRequired,
  tooltipHelp,
}) => (
  <Field
    name={name}
    label={label}
    fieldSelector={fieldSelector}
    tooltipHelp={tooltipHelp}
    component={RenderField}
    buttonAttrs={buttonAttrs}
    blank={blank}
    item={item}
    disabled={disabled}
    validate={item.validate}
    fieldRequired={fieldRequired}
  />
);

TextButtonField.propTypes = {
  item: PropTypes.object,
  label: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired,
  className: PropTypes.string,
  inputClassName: PropTypes.string,
  blank: PropTypes.shape({
    label: PropTypes.string,
    value: PropTypes.string,
  }),
  buttonAttrs: PropTypes.shape({
    buttonText: PropTypes.node,
    buttonAction: PropTypes.func,
  }).isRequired,
  fieldSelector: PropTypes.func,
  validate: PropTypes.array,
  disabled: PropTypes.bool,
  fieldRequired: PropTypes.bool,
  tooltipHelp: PropTypes.node,
};

TextButtonField.defaultProps = {
  blank: { label: 'Choose one...', value: '' },
  className: '',
  inputClassName: 'col-md-6',
  validate: [],
  disabled: false,
  fieldRequired: false,
  tooltipHelp: null,
  fieldSelector: () => 'text',
  item: {},
};

export default TextButtonField;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_templates-7.0.7 webpack/components/NewTemplateSync/components/TextButtonField/index.js
foreman_templates-7.0.6 webpack/components/NewTemplateSync/components/TextButtonField/index.js
foreman_templates-7.0.5 webpack/components/NewTemplateSync/components/TextButtonField/index.js
foreman_templates-7.0.4 webpack/components/NewTemplateSync/components/TextButtonField/index.js
foreman_templates-7.0.3 webpack/components/NewTemplateSync/components/TextButtonField/index.js
foreman_templates-7.0.2 webpack/components/NewTemplateSync/components/TextButtonField/index.js