1 | import classNames from 'classnames';
|
2 | import * as React from 'react';
|
3 | import { useContext } from 'react';
|
4 | import FormContext from './FormContext';
|
5 | import { useBootstrapPrefix } from './ThemeProvider';
|
6 | import { jsx as _jsx } from "react/jsx-runtime";
|
7 | const FormCheckInput = React.forwardRef(({
|
8 | id,
|
9 | bsPrefix,
|
10 | className,
|
11 | type = 'checkbox',
|
12 | isValid = false,
|
13 | isInvalid = false,
|
14 |
|
15 | as: Component = 'input',
|
16 | ...props
|
17 | }, ref) => {
|
18 | const {
|
19 | controlId
|
20 | } = useContext(FormContext);
|
21 | bsPrefix = useBootstrapPrefix(bsPrefix, 'form-check-input');
|
22 | return _jsx(Component, { ...props,
|
23 | ref: ref,
|
24 | type: type,
|
25 | id: id || controlId,
|
26 | className: classNames(className, bsPrefix, isValid && 'is-valid', isInvalid && 'is-invalid')
|
27 | });
|
28 | });
|
29 | FormCheckInput.displayName = 'FormCheckInput';
|
30 | export default FormCheckInput; |
\ | No newline at end of file |