UNPKG

1.18 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import React from 'react';
4import PropTypes from 'prop-types';
5import classNames from 'classnames';
6import { mapToCssModules, tagPropType } from './utils';
7var propTypes = {
8 children: PropTypes.node,
9 inline: PropTypes.bool,
10 tag: tagPropType,
11 color: PropTypes.string,
12 className: PropTypes.string,
13 cssModule: PropTypes.object
14};
15var defaultProps = {
16 tag: 'small',
17 color: 'muted'
18};
19
20var FormText = function FormText(props) {
21 var className = props.className,
22 cssModule = props.cssModule,
23 inline = props.inline,
24 color = props.color,
25 Tag = props.tag,
26 attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "inline", "color", "tag"]);
27
28 var classes = mapToCssModules(classNames(className, !inline ? 'form-text' : false, color ? "text-" + color : false), cssModule);
29 return React.createElement(Tag, _extends({}, attributes, {
30 className: classes
31 }));
32};
33
34FormText.propTypes = propTypes;
35FormText.defaultProps = defaultProps;
36export default FormText;
\No newline at end of file