Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

FormCheckLabel.js 1.2 KiB

3 anni fa
123456789101112131415161718192021222324252627282930
  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. var _useContext = useContext(FormContext),
  14. controlId = _useContext.controlId,
  15. custom = _useContext.custom;
  16. var _ref2 = custom ? [bsCustomPrefix, 'custom-control-label'] : [bsPrefix, 'form-check-label'],
  17. prefix = _ref2[0],
  18. defaultPrefix = _ref2[1];
  19. bsPrefix = useBootstrapPrefix(prefix, defaultPrefix);
  20. return /*#__PURE__*/React.createElement("label", _extends({}, props, {
  21. ref: ref,
  22. htmlFor: htmlFor || controlId,
  23. className: classNames(className, bsPrefix)
  24. }));
  25. });
  26. FormCheckLabel.displayName = 'FormCheckLabel';
  27. export default FormCheckLabel;