Gazebo_simulation-Frontend/node_modules/react-bootstrap/esm/FormCheckInput.js
2020-12-21 10:29:31 -05:00

35 lines
1.5 KiB
JavaScript

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import classNames from 'classnames';
import React, { useContext } from 'react';
import FormContext from './FormContext';
import { useBootstrapPrefix } from './ThemeProvider';
var defaultProps = {
type: 'checkbox'
};
var FormCheckInput = React.forwardRef(function (_ref, ref) {
var id = _ref.id,
bsPrefix = _ref.bsPrefix,
bsCustomPrefix = _ref.bsCustomPrefix,
className = _ref.className,
isValid = _ref.isValid,
isInvalid = _ref.isInvalid,
isStatic = _ref.isStatic,
_ref$as = _ref.as,
Component = _ref$as === void 0 ? 'input' : _ref$as,
props = _objectWithoutPropertiesLoose(_ref, ["id", "bsPrefix", "bsCustomPrefix", "className", "isValid", "isInvalid", "isStatic", "as"]);
var _useContext = useContext(FormContext),
controlId = _useContext.controlId,
custom = _useContext.custom;
bsPrefix = custom ? useBootstrapPrefix(bsCustomPrefix, 'custom-control-input') : useBootstrapPrefix(bsPrefix, 'form-check-input');
return React.createElement(Component, _extends({}, props, {
ref: ref,
id: id || controlId,
className: classNames(className, bsPrefix, isValid && 'is-valid', isInvalid && 'is-invalid', isStatic && 'position-static')
}));
});
FormCheckInput.displayName = 'FormCheckInput';
FormCheckInput.defaultProps = defaultProps;
export default FormCheckInput;