Skip to content

Commit e4a608f

Browse files
authored
Avoid util deep imports (#689)
* chore: avoid util deep imports * Expose locale subpath exports
1 parent a85aa10 commit e4a608f

4 files changed

Lines changed: 35 additions & 9 deletions

File tree

package.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@
1212
],
1313
"main": "./lib/index",
1414
"module": "./es/index",
15+
"types": "./es/index.d.ts",
16+
"exports": {
17+
".": {
18+
"types": "./es/index.d.ts",
19+
"import": "./es/index.js",
20+
"require": "./lib/index.js"
21+
},
22+
"./assets/*": "./assets/*",
23+
"./locale/*": {
24+
"types": "./es/locale/*.d.ts",
25+
"import": "./es/locale/*.js",
26+
"require": "./lib/locale/*.js"
27+
},
28+
"./lib/locale/*": {
29+
"types": "./es/locale/*.d.ts",
30+
"import": "./es/locale/*.js",
31+
"require": "./lib/locale/*.js"
32+
},
33+
"./es/locale/*": {
34+
"types": "./es/locale/*.d.ts",
35+
"import": "./es/locale/*.js",
36+
"require": "./lib/locale/*.js"
37+
}
38+
},
1539
"files": [
1640
"assets/*.css",
1741
"assets/*.less",
@@ -42,11 +66,11 @@
4266
"prepare": "husky"
4367
},
4468
"dependencies": {
45-
"@rc-component/util": "^1.3.0",
69+
"@rc-component/util": "^1.11.1",
4670
"clsx": "^2.1.1"
4771
},
4872
"devDependencies": {
49-
"@rc-component/father-plugin": "^2.0.2",
73+
"@rc-component/father-plugin": "^2.2.0",
5074
"@rc-component/np": "^1.0.3",
5175
"@testing-library/jest-dom": "^6.1.5",
5276
"@testing-library/react": "^16.0.1",

src/Options.tsx

Lines changed: 2 additions & 2 deletions
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
import React from 'react';
33
import type { PaginationLocale } from './interface';
44

@@ -85,7 +85,7 @@ const Options: React.FC<OptionsProps> = (props) => {
8585
if (goInputText === '') {
8686
return;
8787
}
88-
if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {
88+
if (e.keyCode === KeyCode.ENTER || e.type === 'click') {
8989
setGoInputText('');
9090
quickGo?.(getValidValue);
9191
}

src/Pagination.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { clsx } from 'clsx';
2-
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
3-
import KeyCode from '@rc-component/util/lib/KeyCode';
4-
import pickAttrs from '@rc-component/util/lib/pickAttrs';
5-
import warning from '@rc-component/util/lib/warning';
2+
import {
3+
KeyCode,
4+
pickAttrs,
5+
useControlledState,
6+
warning,
7+
} from '@rc-component/util';
68
import React, { useEffect } from 'react';
79
import type { PaginationProps } from './interface';
810
import zhCN from './locale/zh_CN';

tests/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { RenderResult } from '@testing-library/react';
22
import { render, fireEvent } from '@testing-library/react';
33
import React from 'react';
44
import Pagination from '../src';
5-
import { resetWarned } from '@rc-component/util/lib/warning';
5+
import { resetWarned } from '@rc-component/util';
66
import { sizeChangerRender } from './commonUtil';
77

88
describe('Default Pagination', () => {

0 commit comments

Comments
 (0)