Skip to content

Commit b537679

Browse files
authored
Avoid rc package deep imports (#519)
* fix: avoid rc package deep imports * chore: simplify offset type * fix: expose tooltip props and placements * fix: trim public exports
1 parent 4202bd6 commit b537679

3 files changed

Lines changed: 23 additions & 18 deletions

File tree

docs/examples/simple.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { ActionType } from '@rc-component/trigger';
2-
import type { OffsetType } from '@rc-component/trigger/lib/interface';
32
import Tooltip from 'rc-tooltip';
43
import type { CSSProperties } from 'react';
54
import React, { Component } from 'react';
65
import '../../assets/bootstrap.less';
76
import { placements } from '../../src/placements';
87

8+
type OffsetType = string | number;
9+
910
interface TestState {
1011
destroyOnHidden: boolean;
1112
destroyTooltipOptions: { name: string; value: number }[];

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
},
4343
"dependencies": {
4444
"@rc-component/trigger": "^3.7.1",
45-
"@rc-component/util": "^1.3.0",
45+
"@rc-component/util": "^1.11.1",
4646
"clsx": "^2.1.1"
4747
},
4848
"devDependencies": {
49-
"@rc-component/father-plugin": "^2.0.1",
49+
"@rc-component/father-plugin": "^2.2.0",
5050
"@rc-component/np": "^1.0.3",
5151
"@testing-library/jest-dom": "^6.9.1",
5252
"@testing-library/react": "^16.3.0",

src/Tooltip.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
import type { ArrowType, TriggerProps, TriggerRef } from '@rc-component/trigger';
1+
import type {
2+
ActionType,
3+
AlignType,
4+
ArrowType,
5+
TriggerProps,
6+
TriggerRef,
7+
} from '@rc-component/trigger';
28
import Trigger from '@rc-component/trigger';
3-
import type { ActionType, AlignType } from '@rc-component/trigger/lib/interface';
4-
import useId from '@rc-component/util/lib/hooks/useId';
9+
import { useId } from '@rc-component/util';
510
import { clsx } from 'clsx';
611
import * as React from 'react';
712
import { useImperativeHandle, useRef } from 'react';
@@ -10,18 +15,17 @@ import Popup from './Popup';
1015

1116
export type SemanticName = 'root' | 'arrow' | 'container' | 'uniqueContainer';
1217

13-
export interface TooltipProps
14-
extends Pick<
15-
TriggerProps,
16-
| 'onPopupAlign'
17-
| 'builtinPlacements'
18-
| 'fresh'
19-
| 'mouseLeaveDelay'
20-
| 'mouseEnterDelay'
21-
| 'prefixCls'
22-
| 'forceRender'
23-
| 'popupVisible'
24-
> {
18+
export interface TooltipProps extends Pick<
19+
TriggerProps,
20+
| 'onPopupAlign'
21+
| 'builtinPlacements'
22+
| 'fresh'
23+
| 'mouseLeaveDelay'
24+
| 'mouseEnterDelay'
25+
| 'prefixCls'
26+
| 'forceRender'
27+
| 'popupVisible'
28+
> {
2529
children: React.ReactElement;
2630
// Style
2731
classNames?: Partial<Record<SemanticName, string>>;

0 commit comments

Comments
 (0)