Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage with esModuleInterop disabled #4928

Merged
merged 3 commits into from Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-rats-kick.md
@@ -0,0 +1,5 @@
---
'react-select': patch
---

Fix usage with esModuleInterop disabled
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -124,7 +124,7 @@
"test": "npm run test:jest && npm run test:cypress",
"test:jest": "jest --coverage",
"e2e": "concurrently --kill-others --success=first --names 'SERVER,E2E' 'yarn start:test --progress=false --no-info' 'yarn test:cypress'",
"type-check": "tsc --build packages/react-select/tsconfig.json && tsc --build docs/tsconfig.json && tsc --build cypress/tsconfig.json",
"type-check": "tsc --build packages/react-select/tsconfig.json && tsc --build packages/react-select/src/__tests__/tsconfig.json && tsc --build docs/tsconfig.json && tsc --build cypress/tsconfig.json",
"precommit": "yarn run type-check",
"postinstall": "preconstruct dev",
"test:cypress": "yarn test:cypress:chrome && yarn test:cypress:firefox",
Expand Down
10 changes: 8 additions & 2 deletions packages/react-select/src/Async.tsx
@@ -1,4 +1,10 @@
import React, { MutableRefObject, ReactElement, RefAttributes } from 'react';
import * as React from 'react';
import {
forwardRef,
MutableRefObject,
ReactElement,
RefAttributes,
} from 'react';
import Select from './Select';
import { GroupBase } from './types';
import useStateManager from './useStateManager';
Expand All @@ -15,7 +21,7 @@ type AsyncSelect = <
RefAttributes<Select<Option, IsMulti, Group>>
) => ReactElement;

const AsyncSelect = React.forwardRef(
const AsyncSelect = forwardRef(
<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
props: AsyncProps<Option, IsMulti, Group>,
ref:
Expand Down
10 changes: 8 additions & 2 deletions packages/react-select/src/AsyncCreatable.tsx
@@ -1,6 +1,12 @@
import * as React from 'react';
import {
forwardRef,
MutableRefObject,
ReactElement,
RefAttributes,
} from 'react';
import Select from './Select';
import { GroupBase } from './types';
import React, { MutableRefObject, ReactElement, RefAttributes } from 'react';
import useAsync, { AsyncAdditionalProps } from './useAsync';
import useStateManager, { StateManagerProps } from './useStateManager';
import useCreatable, { CreatableAdditionalProps } from './useCreatable';
Expand All @@ -22,7 +28,7 @@ type AsyncCreatableSelect = <
RefAttributes<Select<Option, IsMulti, Group>>
) => ReactElement;

const AsyncCreatableSelect = React.forwardRef(
const AsyncCreatableSelect = forwardRef(
<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
props: AsyncCreatableProps<Option, IsMulti, Group>,
ref:
Expand Down
10 changes: 8 additions & 2 deletions packages/react-select/src/Creatable.tsx
@@ -1,4 +1,10 @@
import React, { MutableRefObject, ReactElement, RefAttributes } from 'react';
import * as React from 'react';
import {
forwardRef,
MutableRefObject,
ReactElement,
RefAttributes,
} from 'react';
import Select from './Select';
import { GroupBase } from './types';
import useStateManager, { StateManagerProps } from './useStateManager';
Expand All @@ -20,7 +26,7 @@ type CreatableSelect = <
RefAttributes<Select<Option, IsMulti, Group>>
) => ReactElement;

const CreatableSelect = React.forwardRef(
const CreatableSelect = forwardRef(
<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
props: CreatableProps<Option, IsMulti, Group>,
ref:
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/NonceProvider.tsx
@@ -1,4 +1,5 @@
import React, { Component, ReactNode } from 'react';
import * as React from 'react';
import { Component, ReactNode } from 'react';
import { CacheProvider } from '@emotion/react';
import createCache from '@emotion/cache';
import memoizeOne from 'memoize-one';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/Select.tsx
@@ -1,4 +1,5 @@
import React, {
import * as React from 'react';
import {
Component,
FocusEventHandler,
FormEventHandler,
Expand Down
12 changes: 12 additions & 0 deletions packages/react-select/src/__tests__/tsconfig.json
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"jsx": "react",
"noEmit": true,
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
}
}
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/Input.tsx
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import * as React from 'react';
import { ReactElement } from 'react';
import { TransitionProps } from 'react-transition-group/Transition';
import { InputProps } from '../components/Input';
import { GroupBase } from '../types';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/MultiValue.tsx
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import * as React from 'react';
import { ReactElement } from 'react';
import { TransitionProps } from 'react-transition-group/Transition';
import { MultiValueProps } from '../components/MultiValue';
import { Collapse } from './transitions';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/Placeholder.tsx
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import * as React from 'react';
import { ReactElement } from 'react';
import { PlaceholderProps } from '../components/Placeholder';
import { Fade, collapseDuration } from './transitions';
import { GroupBase } from '../types';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/SingleValue.tsx
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import * as React from 'react';
import { ReactElement } from 'react';
import { SingleValueProps } from '../components/SingleValue';
import { Fade } from './transitions';
import { GroupBase } from '../types';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/ValueContainer.tsx
@@ -1,4 +1,5 @@
import React, { useEffect, useState, ReactElement, ReactNode } from 'react';
import * as React from 'react';
import { useEffect, useState, ReactElement, ReactNode } from 'react';
import { TransitionGroup } from 'react-transition-group';
import { ValueContainerProps } from '../components/containers';
import { GroupBase } from '../types';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-select/src/animated/transitions.tsx
@@ -1,4 +1,5 @@
import React, {
import * as React from 'react';
import {
Component,
ComponentType,
createRef,
Expand Down
10 changes: 5 additions & 5 deletions packages/react-select/src/components/LiveRegion.tsx
@@ -1,5 +1,5 @@
/** @jsx jsx */
import React, { ReactNode, useMemo } from 'react';
import { Fragment, ReactNode, useMemo } from 'react';
import { jsx } from '@emotion/react';
import A11yText from '../internal/A11yText';
import { defaultAriaLiveMessages, AriaSelection } from '../accessibility';
Expand Down Expand Up @@ -189,16 +189,16 @@ const LiveRegion = <
const ariaContext = `${ariaFocused} ${ariaResults} ${ariaGuidance}`;

const ScreenReaderText = (
<React.Fragment>
<Fragment>
<span id="aria-selection">{ariaSelected}</span>
<span id="aria-context">{ariaContext}</span>
</React.Fragment>
</Fragment>
);

const isInitialFocus = ariaSelection?.action === 'initial-input-focus';

return (
<React.Fragment>
<Fragment>
{/* We use 'aria-describedby' linked to this component for the initial focus */}
{/* action, then for all other actions we use the live region below */}
<A11yText id={id}>{isInitialFocus && ScreenReaderText}</A11yText>
Expand All @@ -209,7 +209,7 @@ const LiveRegion = <
>
{isFocused && !isInitialFocus && ScreenReaderText}
</A11yText>
</React.Fragment>
</Fragment>
);
};

Expand Down
6 changes: 3 additions & 3 deletions packages/react-select/src/internal/ScrollManager.tsx
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { jsx } from '@emotion/react';
import React, { ReactElement, RefCallback } from 'react';
import { Fragment, ReactElement, RefCallback } from 'react';
import useScrollCapture from './useScrollCapture';
import useScrollLock from './useScrollLock';

Expand Down Expand Up @@ -41,14 +41,14 @@ export default function ScrollManager({
};

return (
<React.Fragment>
<Fragment>
{lockEnabled && (
<div
onClick={blurSelectInput}
css={{ position: 'fixed', left: 0, bottom: 0, right: 0, top: 0 }}
/>
)}
{children(targetRef)}
</React.Fragment>
</Fragment>
);
}
10 changes: 8 additions & 2 deletions packages/react-select/src/stateManager.tsx
@@ -1,4 +1,10 @@
import React, { MutableRefObject, ReactElement, RefAttributes } from 'react';
import * as React from 'react';
import {
forwardRef,
MutableRefObject,
ReactElement,
RefAttributes,
} from 'react';

import { GroupBase } from './types';
import Select from './Select';
Expand All @@ -15,7 +21,7 @@ type StateManagedSelect = <
RefAttributes<Select<Option, IsMulti, Group>>
) => ReactElement;

const StateManagedSelect = React.forwardRef(
const StateManagedSelect = forwardRef(
<Option, IsMulti extends boolean, Group extends GroupBase<Option>>(
props: StateManagerProps<Option, IsMulti, Group>,
ref:
Expand Down
4 changes: 2 additions & 2 deletions packages/react-select/tsconfig.json
Expand Up @@ -5,8 +5,8 @@
"jsx": "react",
"noEmit": true,
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
}
},
"exclude": ["src/__tests__"]
}