Skip to content

Commit 627fa3b

Browse files
committed
fix: avoid rc package deep imports
1 parent 6fe40e3 commit 627fa3b

23 files changed

Lines changed: 57 additions & 51 deletions

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
"dependencies": {
5252
"@rc-component/overflow": "^1.0.0",
5353
"@rc-component/trigger": "^3.0.0",
54-
"@rc-component/util": "^1.3.0",
55-
"@rc-component/virtual-list": "^1.0.1",
54+
"@rc-component/util": "^1.11.1",
55+
"@rc-component/virtual-list": "^1.2.0",
5656
"clsx": "^2.1.1"
5757
},
5858
"devDependencies": {
59-
"@rc-component/father-plugin": "^2.0.2",
59+
"@rc-component/father-plugin": "^2.2.0",
6060
"@rc-component/np": "^1.0.0",
6161
"@testing-library/jest-dom": "^6.4.5",
6262
"@testing-library/react": "^15.0.6",

src/BaseSelect/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface';
1+
import type { AlignType, BuildInPlacements } from '@rc-component/trigger';
22
import { clsx } from 'clsx';
3-
import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode';
4-
import type { ScrollConfig, ScrollTo } from '@rc-component/virtual-list/lib/List';
3+
import { getDOM, useEvent } from '@rc-component/util';
4+
import type { ScrollConfig, ScrollTo } from '@rc-component/virtual-list';
55
import * as React from 'react';
66
import { useAllowClear } from '../hooks/useAllowClear';
77
import { BaseSelectContext } from '../hooks/useBaseProps';
@@ -22,7 +22,6 @@ import SelectTrigger from '../SelectTrigger';
2222
import { getSeparatedContent, isValidCount } from '../utils/valueUtil';
2323
import Polite from './Polite';
2424
import useOpen, { macroTask } from '../hooks/useOpen';
25-
import { useEvent } from '@rc-component/util';
2625
import type { SelectInputRef } from '../SelectInput';
2726
import SelectInput from '../SelectInput';
2827
import type { ComponentsConfig } from '../hooks/useComponents';

src/OptionList.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { clsx } from 'clsx';
2-
import KeyCode from '@rc-component/util/lib/KeyCode';
3-
import useMemo from '@rc-component/util/lib/hooks/useMemo';
4-
import omit from '@rc-component/util/lib/omit';
5-
import pickAttrs from '@rc-component/util/lib/pickAttrs';
6-
import type { ListRef } from '@rc-component/virtual-list';
7-
import List from '@rc-component/virtual-list';
8-
import type { ScrollConfig } from '@rc-component/virtual-list/lib/List';
2+
import { KeyCode, omit, pickAttrs, useMemo } from '@rc-component/util';
3+
import List, { type ListRef, type ScrollConfig } from '@rc-component/virtual-list';
94
import * as React from 'react';
105
import { useEffect } from 'react';
116
import type { BaseOptionType, RawValueType } from './Select';

src/Select.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
* - `combobox` mode not support `optionLabelProp`
3030
*/
3131

32-
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
33-
import warning from '@rc-component/util/lib/warning';
32+
import { useControlledState, useId, warning } from '@rc-component/util';
3433
import * as React from 'react';
3534
import type {
3635
BaseSelectProps,
@@ -49,7 +48,6 @@ import SelectContext from './SelectContext';
4948
import type { SelectContextProps } from './SelectContext';
5049
import useCache from './hooks/useCache';
5150
import useFilterOptions from './hooks/useFilterOptions';
52-
import useId from '@rc-component/util/lib/hooks/useId';
5351
import useOptions from './hooks/useOptions';
5452
import useRefFunc from './hooks/useRefFunc';
5553
import type { FlattenOptionData } from './interface';

src/SelectInput/Content/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import pickAttrs from '@rc-component/util/lib/pickAttrs';
2+
import { pickAttrs } from '@rc-component/util';
33
import SingleContent from './SingleContent';
44
import MultipleContent from './MultipleContent';
55
import { useSelectInputContext } from '../context';

src/SelectInput/Input.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react';
22
import { clsx } from 'clsx';
33
import { useSelectInputContext } from './context';
4-
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
4+
import { composeRef, useLayoutEffect } from '@rc-component/util';
55
import useBaseProps from '../hooks/useBaseProps';
6-
import { composeRef } from '@rc-component/util/lib/ref';
76

87
export interface InputProps {
98
id?: string;

src/SelectInput/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ import SelectContent from './Content';
44
import SelectInputContext from './context';
55
import type { DisplayValueType, Mode, RenderNode } from '../interface';
66
import useBaseProps from '../hooks/useBaseProps';
7-
import { omit, useEvent } from '@rc-component/util';
8-
import KeyCode from '@rc-component/util/lib/KeyCode';
7+
import { composeRef, getDOM, KeyCode, omit, pickAttrs, useEvent } from '@rc-component/util';
98
import { isValidateOpenKey } from '../utils/keyUtil';
109
import { clsx } from 'clsx';
1110
import type { ComponentsConfig } from '../hooks/useComponents';
12-
import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode';
13-
import { composeRef } from '@rc-component/util/lib/ref';
14-
import pickAttrs from '@rc-component/util/lib/pickAttrs';
1511

1612
export interface SelectInputRef {
1713
focus: (options?: FocusOptions) => void;

src/SelectTrigger.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import Trigger, { type TriggerRef } from '@rc-component/trigger';
2-
import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface';
1+
import Trigger, {
2+
type AlignType,
3+
type BuildInPlacements,
4+
type TriggerRef,
5+
} from '@rc-component/trigger';
36
import { clsx } from 'clsx';
47
import * as React from 'react';
58
import type { Placement, RenderDOMFunc } from './BaseSelect';

src/index.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
import Select from './Select';
22
import Option from './Option';
33
import OptGroup from './OptGroup';
4-
import type { SelectProps } from './Select';
4+
import type { BaseOptionType, DefaultOptionType, SearchConfig, SelectProps } from './Select';
55
import BaseSelect from './BaseSelect';
6-
import type { BaseSelectProps, BaseSelectRef, BaseSelectPropsWithoutPrivate } from './BaseSelect';
6+
import type {
7+
BaseSelectProps,
8+
BaseSelectPropsWithoutPrivate,
9+
BaseSelectRef,
10+
BaseSelectSemanticName,
11+
DisplayValueType,
12+
RefOptionListProps,
13+
} from './BaseSelect';
714
import useBaseProps from './hooks/useBaseProps';
15+
import type { OptionFC, OptionProps } from './Option';
16+
import type { Placement } from './interface';
817

918
export { Option, OptGroup, BaseSelect, useBaseProps };
10-
export type { SelectProps, BaseSelectProps, BaseSelectRef, BaseSelectPropsWithoutPrivate };
19+
export type {
20+
BaseOptionType,
21+
BaseSelectProps,
22+
BaseSelectPropsWithoutPrivate,
23+
BaseSelectRef,
24+
BaseSelectSemanticName,
25+
DefaultOptionType,
26+
DisplayValueType,
27+
OptionFC,
28+
OptionProps,
29+
Placement,
30+
RefOptionListProps,
31+
SearchConfig,
32+
SelectProps,
33+
};
1134

1235
export default Select;

src/utils/keyUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import KeyCode from '@rc-component/util/lib/KeyCode';
1+
import { KeyCode } from '@rc-component/util';
22

33
/** keyCode Judgment function */
44
export function isValidateOpenKey(currentKeyCode: number): boolean {

0 commit comments

Comments
 (0)