1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import classNames from 'classnames';
|
4 | import React, { useContext } from 'react';
|
5 | import FormContext from './FormContext';
|
6 | import { useBootstrapPrefix } from './ThemeProvider';
|
7 | var FormCheckLabel = React.forwardRef(function (_ref, ref) {
|
8 | var bsPrefix = _ref.bsPrefix,
|
9 | bsCustomPrefix = _ref.bsCustomPrefix,
|
10 | className = _ref.className,
|
11 | htmlFor = _ref.htmlFor,
|
12 | props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "bsCustomPrefix", "className", "htmlFor"]);
|
13 |
|
14 | var _useContext = useContext(FormContext),
|
15 | controlId = _useContext.controlId,
|
16 | custom = _useContext.custom;
|
17 |
|
18 | var _ref2 = custom ? [bsCustomPrefix, 'custom-control-label'] : [bsPrefix, 'form-check-label'],
|
19 | prefix = _ref2[0],
|
20 | defaultPrefix = _ref2[1];
|
21 |
|
22 | bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);
|
23 | return React.createElement("label", _extends({}, props, {
|
24 | ref: ref,
|
25 | htmlFor: htmlFor || controlId,
|
26 | className: classNames(className, bsPrefix)
|
27 | }));
|
28 | });
|
29 | FormCheckLabel.displayName = 'FormCheckLabel';
|
30 | export default FormCheckLabel; |
\ | No newline at end of file |