import { extend, mergeData } from '../../vue';
import { NAME_FORM_TEXT } from '../../constants/components';
import { PROP_TYPE_STRING, PROP_TYPE_BOOLEAN } from '../../constants/props';
import { makePropsConfigurable, makeProp } from '../../utils/props';

// --- Props ---

const props = makePropsConfigurable({
  id: makeProp(PROP_TYPE_STRING),
  inline: makeProp(PROP_TYPE_BOOLEAN, false),
  tag: makeProp(PROP_TYPE_STRING, 'small'),
  textVariant: makeProp(PROP_TYPE_STRING, 'muted')
}, NAME_FORM_TEXT);

// --- Main component ---

// @vue/component
const BFormText = /*#__PURE__*/extend({
  name: NAME_FORM_TEXT,
  functional: true,
  props,
  render(h, _ref) {
    let {
      props,
      data,
      children
    } = _ref;
    return h(props.tag, mergeData(data, {
      class: {
        'form-text': !props.inline,
        [`text-${props.textVariant}`]: props.textVariant
      },
      attrs: {
        id: props.id
      }
    }), children);
  }
});

export { BFormText, props };
