diff --git a/.changeset/tall-dancers-wonder.md b/.changeset/tall-dancers-wonder.md new file mode 100644 index 0000000000..195190b52b --- /dev/null +++ b/.changeset/tall-dancers-wonder.md @@ -0,0 +1,5 @@ +--- +'react-select': minor +--- + +Move files around to as to be compatible with version 2 of `@preconstruct/cli` diff --git a/docs/PropTypes/Select.ts b/docs/PropTypes/Select.ts index 0c8fd9fa64..b6784caf79 100644 --- a/docs/PropTypes/Select.ts +++ b/docs/PropTypes/Select.ts @@ -1,6 +1,6 @@ import { Component } from 'react'; -import { Props, defaultProps } from 'react-select/src/Select'; +import { Props, defaultProps } from 'react-select/src/base'; import { GroupBase } from 'react-select'; export default class Select extends Component< diff --git a/docs/generate-magical-types/generate/package.json b/docs/generate-magical-types/generate/package.json index fc99df9b47..c8cade72a6 100644 --- a/docs/generate-magical-types/generate/package.json +++ b/docs/generate-magical-types/generate/package.json @@ -1,6 +1,3 @@ { - "main": "dist/generate-magical-types.cjs.js", - "preconstruct": { - "source": "../src/generate" - } + "main": "dist/react-select-generate-magical-types-generate.cjs.js" } diff --git a/docs/generate-magical-types/package.json b/docs/generate-magical-types/package.json index 29b35c8069..9af9564a97 100644 --- a/docs/generate-magical-types/package.json +++ b/docs/generate-magical-types/package.json @@ -12,8 +12,8 @@ }, "preconstruct": { "entrypoints": [ - "generate", - "serialize" + "generate.ts", + "serialize.ts" ] } } diff --git a/docs/generate-magical-types/serialize/package.json b/docs/generate-magical-types/serialize/package.json index edbc5569c0..2b2d88a1f4 100644 --- a/docs/generate-magical-types/serialize/package.json +++ b/docs/generate-magical-types/serialize/package.json @@ -1,6 +1,3 @@ { - "main": "dist/generate-magical-types.cjs.js", - "preconstruct": { - "source": "../src/serialize" - } + "main": "dist/react-select-generate-magical-types-serialize.cjs.js" } diff --git a/package.json b/package.json index b1924e9ef7..92495b5010 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@emotion/babel-plugin": "^11.0.0", "@emotion/jest": "^11.1.0", "@manypkg/cli": "^0.19.2", - "@preconstruct/cli": "^1.0.0", + "@preconstruct/cli": "^2.2.2", "@testing-library/dom": "7.0.4", "@testing-library/jest-dom": "5.1.1", "@testing-library/react": "10.0.1", diff --git a/packages/react-select/animated/package.json b/packages/react-select/animated/package.json index b2af8543d0..480f66dd01 100644 --- a/packages/react-select/animated/package.json +++ b/packages/react-select/animated/package.json @@ -1,8 +1,5 @@ { - "main": "dist/react-select.cjs.js", - "module": "dist/react-select.esm.js", - "types": "dist/react-select.cjs.d.ts", - "preconstruct": { - "source": "../src/animated" - } + "main": "dist/react-select-animated.cjs.js", + "module": "dist/react-select-animated.esm.js", + "types": "dist/react-select-animated.cjs.d.ts" } diff --git a/packages/react-select/async-creatable/package.json b/packages/react-select/async-creatable/package.json index 3117f827dc..0a3bddde09 100644 --- a/packages/react-select/async-creatable/package.json +++ b/packages/react-select/async-creatable/package.json @@ -1,8 +1,5 @@ { - "main": "dist/react-select.cjs.js", - "module": "dist/react-select.esm.js", - "types": "dist/react-select.cjs.d.ts", - "preconstruct": { - "source": "../src/AsyncCreatable" - } + "main": "dist/react-select-async-creatable.cjs.js", + "module": "dist/react-select-async-creatable.esm.js", + "types": "dist/react-select-async-creatable.cjs.d.ts" } diff --git a/packages/react-select/async/package.json b/packages/react-select/async/package.json index 69034f9131..b58d5d1e27 100644 --- a/packages/react-select/async/package.json +++ b/packages/react-select/async/package.json @@ -1,8 +1,5 @@ { - "main": "dist/react-select.cjs.js", - "module": "dist/react-select.esm.js", - "types": "dist/react-select.cjs.d.ts", - "preconstruct": { - "source": "../src/Async" - } + "main": "dist/react-select-async.cjs.js", + "module": "dist/react-select-async.esm.js", + "types": "dist/react-select-async.cjs.d.ts" } diff --git a/packages/react-select/base/package.json b/packages/react-select/base/package.json index f538122b58..957568d890 100644 --- a/packages/react-select/base/package.json +++ b/packages/react-select/base/package.json @@ -1,8 +1,5 @@ { - "main": "dist/react-select.cjs.js", - "module": "dist/react-select.esm.js", - "types": "dist/react-select.cjs.d.ts", - "preconstruct": { - "source": "../src/Select" - } + "main": "dist/react-select-base.cjs.js", + "module": "dist/react-select-base.esm.js", + "types": "dist/react-select-base.cjs.d.ts" } diff --git a/packages/react-select/creatable/package.json b/packages/react-select/creatable/package.json index 0be16fc266..347a42cf5c 100644 --- a/packages/react-select/creatable/package.json +++ b/packages/react-select/creatable/package.json @@ -1,8 +1,5 @@ { - "main": "dist/react-select.cjs.js", - "module": "dist/react-select.esm.js", - "types": "dist/react-select.cjs.d.ts", - "preconstruct": { - "source": "../src/Creatable" - } + "main": "dist/react-select-creatable.cjs.js", + "module": "dist/react-select-creatable.esm.js", + "types": "dist/react-select-creatable.cjs.d.ts" } diff --git a/packages/react-select/package.json b/packages/react-select/package.json index 10d73e3648..a676dbe02c 100644 --- a/packages/react-select/package.json +++ b/packages/react-select/package.json @@ -52,12 +52,12 @@ ], "preconstruct": { "entrypoints": [ - ".", - "base", - "animated", - "async", - "creatable", - "async-creatable" + "index.ts", + "base/index.ts", + "animated/index.ts", + "async/index.ts", + "creatable/index.ts", + "async-creatable/index.ts" ] } } diff --git a/packages/react-select/src/__tests__/AsyncCreatable.test.tsx b/packages/react-select/src/__tests__/AsyncCreatable.test.tsx index d855717bd7..08309cc9d3 100644 --- a/packages/react-select/src/__tests__/AsyncCreatable.test.tsx +++ b/packages/react-select/src/__tests__/AsyncCreatable.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import AsyncCreatable from '../AsyncCreatable'; +import AsyncCreatable from '../async-creatable'; import { Option, OPTIONS } from './constants'; import { render, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; diff --git a/packages/react-select/src/__tests__/Select.test.tsx b/packages/react-select/src/__tests__/Select.test.tsx index b48171c1a2..3e77a322f8 100644 --- a/packages/react-select/src/__tests__/Select.test.tsx +++ b/packages/react-select/src/__tests__/Select.test.tsx @@ -13,7 +13,7 @@ import { OptionNumberValue, OptionBooleanValue, } from './constants'; -import Select, { FormatOptionLabelMeta } from '../Select'; +import Select, { FormatOptionLabelMeta } from '../base'; import { FilterOptionOption } from '../filters'; import { matchers } from '@emotion/jest'; diff --git a/packages/react-select/src/AsyncCreatable.tsx b/packages/react-select/src/async-creatable/AsyncCreatable.tsx similarity index 81% rename from packages/react-select/src/AsyncCreatable.tsx rename to packages/react-select/src/async-creatable/AsyncCreatable.tsx index e2b0d700cb..9b55f6952b 100644 --- a/packages/react-select/src/AsyncCreatable.tsx +++ b/packages/react-select/src/async-creatable/AsyncCreatable.tsx @@ -5,11 +5,11 @@ import { ReactElement, RefAttributes, } from 'react'; -import Select from './Select'; -import { GroupBase } from './types'; -import useAsync, { AsyncAdditionalProps } from './useAsync'; -import useStateManager, { StateManagerProps } from './useStateManager'; -import useCreatable, { CreatableAdditionalProps } from './useCreatable'; +import Select from '../base'; +import { GroupBase } from '../types'; +import useAsync, { AsyncAdditionalProps } from '../useAsync'; +import useStateManager, { StateManagerProps } from '../useStateManager'; +import useCreatable, { CreatableAdditionalProps } from '../useCreatable'; export type AsyncCreatableProps< Option, diff --git a/packages/react-select/src/async-creatable/index.ts b/packages/react-select/src/async-creatable/index.ts new file mode 100644 index 0000000000..d537c06d1f --- /dev/null +++ b/packages/react-select/src/async-creatable/index.ts @@ -0,0 +1,2 @@ +export * from './AsyncCreatable'; +export { default } from './AsyncCreatable'; diff --git a/packages/react-select/src/Async.tsx b/packages/react-select/src/async/Async.tsx similarity index 82% rename from packages/react-select/src/Async.tsx rename to packages/react-select/src/async/Async.tsx index 35a1de7055..052d082cb6 100644 --- a/packages/react-select/src/Async.tsx +++ b/packages/react-select/src/async/Async.tsx @@ -5,11 +5,11 @@ import { ReactElement, RefAttributes, } from 'react'; -import Select from './Select'; -import { GroupBase } from './types'; -import useStateManager from './useStateManager'; -import useAsync from './useAsync'; -import type { AsyncProps } from './useAsync'; +import Select from '../base'; +import { GroupBase } from '../types'; +import useStateManager from '../useStateManager'; +import useAsync from '../useAsync'; +import type { AsyncProps } from '../useAsync'; export type { AsyncProps }; type AsyncSelect = < diff --git a/packages/react-select/src/async/index.ts b/packages/react-select/src/async/index.ts new file mode 100644 index 0000000000..49352feab0 --- /dev/null +++ b/packages/react-select/src/async/index.ts @@ -0,0 +1,2 @@ +export * from './Async'; +export { default } from './Async'; diff --git a/packages/react-select/src/Select.tsx b/packages/react-select/src/base/Select.tsx similarity index 99% rename from packages/react-select/src/Select.tsx rename to packages/react-select/src/base/Select.tsx index 361226a011..d6b5672129 100644 --- a/packages/react-select/src/Select.tsx +++ b/packages/react-select/src/base/Select.tsx @@ -10,12 +10,12 @@ import { RefCallback, TouchEventHandler, } from 'react'; -import { MenuPlacer } from './components/Menu'; -import LiveRegion from './components/LiveRegion'; +import { MenuPlacer } from '../components/Menu'; +import LiveRegion from '../components/LiveRegion'; -import { createFilter, FilterOptionOption } from './filters'; -import { DummyInput, ScrollManager } from './internal/index'; -import { AriaLiveMessages, AriaSelection } from './accessibility/index'; +import { createFilter, FilterOptionOption } from '../filters'; +import { DummyInput, ScrollManager } from '../internal/index'; +import { AriaLiveMessages, AriaSelection } from '../accessibility/index'; import { classNames, @@ -29,19 +29,19 @@ import { valueTernary, multiValueAsValue, singleValueAsValue, -} from './utils'; +} from '../utils'; import { formatGroupLabel as formatGroupLabelBuiltin, getOptionLabel as getOptionLabelBuiltin, getOptionValue as getOptionValueBuiltin, isOptionDisabled as isOptionDisabledBuiltin, -} from './builtins'; +} from '../builtins'; -import { defaultComponents, SelectComponentsConfig } from './components/index'; +import { defaultComponents, SelectComponentsConfig } from '../components/index'; -import { defaultStyles, StylesConfig, StylesProps } from './styles'; -import { defaultTheme, ThemeConfig } from './theme'; +import { defaultStyles, StylesConfig, StylesProps } from '../styles'; +import { defaultTheme, ThemeConfig } from '../theme'; import { ActionMeta, @@ -57,7 +57,7 @@ import { OptionsOrGroups, PropsValue, SetValueAction, -} from './types'; +} from '../types'; export type FormatOptionLabelContext = 'menu' | 'value'; export interface FormatOptionLabelMeta