Skip to content

Commit 3bf86cb

Browse files
fix: restoring react imports needed for buid docs process
1 parent e450889 commit 3bf86cb

File tree

10 files changed

+27
-8
lines changed

10 files changed

+27
-8
lines changed

src/Dropdown/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { forwardRef, useState } from 'react';
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React, { forwardRef, useState } from 'react';
23
import classNames from 'classnames';
34
import PropTypes from 'prop-types';
45
import BaseDropdown from 'react-bootstrap/Dropdown';

src/Form/FormCheckbox.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React, {
23
forwardRef, useRef, useEffect, createElement,
34
} from 'react';
45
import PropTypes from 'prop-types';

src/Form/FormControl.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React, {
23
forwardRef, useRef, useCallback, useEffect,
34
} from 'react';
45
import PropTypes from 'prop-types';

src/Form/FormControlDecoratorGroup.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React from 'react';
13
import PropTypes from 'prop-types';
24
import classNames from 'classnames';
35
import { useFormGroupContext } from './FormGroupContext';

src/Form/FormGroup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ElementType, ReactNode, ComponentPropsWithoutRef } from 'react';
2-
import { createElement } from 'react';
2+
// React import needed to support build-docs, if removed the build-docs will break
3+
import React, { createElement } from 'react';
34
import PropTypes from 'prop-types';
45
import classNames from 'classnames';
56
import { FormGroupContextProvider } from './FormGroupContext';

src/Form/FormGroupContext.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
2-
import {
2+
// React import needed to support build-docs, if removed the build-docs will break
3+
import React, {
34
createContext, useContext, useState, useEffect, useMemo, useCallback,
45
} from 'react';
56
import classNames from 'classnames';

src/Form/FormRadio.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { forwardRef } from 'react';
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React, { forwardRef } from 'react';
23
import PropTypes from 'prop-types';
34
import classNames from 'classnames';
45
import { useRadioSetContext } from './FormRadioSetContext';

src/Form/FormRadioSet.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React from 'react';
13
import PropTypes from 'prop-types';
24
import { useFormGroupContext } from './FormGroupContext';
35
import { FormRadioSetContextProvider } from './FormRadioSetContext';

src/Form/FormRadioSetContext.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createContext, useContext } from 'react';
1+
// React import needed to support build-docs, if removed the build-docs will break
2+
import React, { createContext, useContext } from 'react';
23
import PropTypes from 'prop-types';
34
import { callAllHandlers } from './fieldUtils';
45

src/Form/tests/FormControl.test.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ const ref = {
1010

1111
let unmaskedInputValue;
1212

13+
jest.mock('react', () => {
14+
const actualReact = jest.requireActual('react');
15+
return {
16+
...actualReact,
17+
useRef: jest.fn(() => ref),
18+
};
19+
});
20+
1321
// eslint-disable-next-line react/prop-types
1422
function Component({ isClearValue }) {
1523
const [inputValue, setInputValue] = useState('');
@@ -30,7 +38,7 @@ function Component({ isClearValue }) {
3038
describe('FormControl', () => {
3139
it('textarea changes its height with autoResize prop', async () => {
3240
const user = userEvent.setup();
33-
const useReferenceSpy = jest.spyOn(React, 'useRef').mockReturnValue(ref);
41+
const useReferenceSpy = React.useRef;
3442
const onChangeFunc = jest.fn();
3543
const inputText = 'new text';
3644
render(

0 commit comments

Comments
 (0)