1 | var _excluded = ["className", "cssModule", "inline", "color", "tag"];
|
2 | function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5 | import React from 'react';
|
6 | import PropTypes from 'prop-types';
|
7 | import classNames from 'classnames';
|
8 | import { mapToCssModules, tagPropType } from './utils';
|
9 | var propTypes = {
|
10 | children: PropTypes.node,
|
11 | inline: PropTypes.bool,
|
12 | tag: tagPropType,
|
13 | color: PropTypes.string,
|
14 | className: PropTypes.string,
|
15 | cssModule: PropTypes.object
|
16 | };
|
17 | function FormText(props) {
|
18 | var className = props.className,
|
19 | cssModule = props.cssModule,
|
20 | inline = props.inline,
|
21 | _props$color = props.color,
|
22 | color = _props$color === void 0 ? 'muted' : _props$color,
|
23 | _props$tag = props.tag,
|
24 | Tag = _props$tag === void 0 ? 'small' : _props$tag,
|
25 | attributes = _objectWithoutProperties(props, _excluded);
|
26 | var classes = mapToCssModules(classNames(className, !inline ? 'form-text' : false, color ? "text-".concat(color) : false), cssModule);
|
27 | return React.createElement(Tag, _extends({}, attributes, {
|
28 | className: classes
|
29 | }));
|
30 | }
|
31 | FormText.propTypes = propTypes;
|
32 | export default FormText; |
\ | No newline at end of file |