import { extend, mergeData } from '../../vue';
import { NAME_CARD_TITLE } from '../../constants/components';
import { PROP_TYPE_STRING } from '../../constants/props';
import { makePropsConfigurable, makeProp } from '../../utils/props';
import { toString } from '../../utils/string';

// --- Props ---

const props = makePropsConfigurable({
  title: makeProp(PROP_TYPE_STRING),
  titleTag: makeProp(PROP_TYPE_STRING, 'h4')
}, NAME_CARD_TITLE);

// --- Main component ---

// @vue/component
const BCardTitle = /*#__PURE__*/extend({
  name: NAME_CARD_TITLE,
  functional: true,
  props,
  render(h, _ref) {
    let {
      props,
      data,
      children
    } = _ref;
    return h(props.titleTag, mergeData(data, {
      staticClass: 'card-title'
    }), children || toString(props.title));
  }
});

export { BCardTitle, props };
