UNPKG

@talend/react-bootstrap

Version:

Bootstrap 3 components built with React

46 lines (45 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _classnames = _interopRequireDefault(require("classnames")); var _react = _interopRequireDefault(require("react")); var _bootstrapUtils = require("./utils/bootstrapUtils"); var _StyleConfig = require("./utils/StyleConfig"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } class Label extends _react.default.Component { hasContent(children) { let result = false; _react.default.Children.forEach(children, child => { if (result) { return; } if (child || child === 0) { result = true; } }); return result; } render() { const { className, children, ...props } = this.props; const [bsProps, elementProps] = (0, _bootstrapUtils.splitBsProps)(props); const classes = { ...(0, _bootstrapUtils.getClassSet)(bsProps), // Hack for collapsing on IE8. hidden: !this.hasContent(children) }; return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", { ...elementProps, className: (0, _classnames.default)(className, classes), children: children }); } } var _default = exports.default = (0, _bootstrapUtils.bsClass)('label', (0, _bootstrapUtils.bsStyles)([...Object.values(_StyleConfig.State), _StyleConfig.Style.DEFAULT, _StyleConfig.Style.PRIMARY], _StyleConfig.Style.DEFAULT, Label)); //# sourceMappingURL=Label.js.map