GoScrobble/web/node_modules/react-bootstrap/esm/FormCheckLabel.js

31 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["bsPrefix", "bsCustomPrefix", "className", "htmlFor"];
import classNames from 'classnames';
import React, { useContext } from 'react';
import FormContext from './FormContext';
import { useBootstrapPrefix } from './ThemeProvider';
var FormCheckLabel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var bsPrefix = _ref.bsPrefix,
bsCustomPrefix = _ref.bsCustomPrefix,
className = _ref.className,
htmlFor = _ref.htmlFor,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useContext = useContext(FormContext),
controlId = _useContext.controlId,
custom = _useContext.custom;
var _ref2 = custom ? [bsCustomPrefix, 'custom-control-label'] : [bsPrefix, 'form-check-label'],
prefix = _ref2[0],
defaultPrefix = _ref2[1];
bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);
return /*#__PURE__*/React.createElement("label", _extends({}, props, {
ref: ref,
htmlFor: htmlFor || controlId,
className: classNames(className, bsPrefix)
}));
});
FormCheckLabel.displayName = 'FormCheckLabel';
export default FormCheckLabel;