diff --git a/.dumirc.ts b/.dumirc.ts index c38b374..6896d91 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -6,7 +6,7 @@ const name = 'mentions'; export default defineConfig({ favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { - name: 'rc-mentions', + name: '@rc-component/mentions', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, outputPath: '.doc', diff --git a/README.md b/README.md index 9b3563e..257267f 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ /** * inline: true */ -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; // Import the default styles import './index.less'; diff --git a/docs/examples/allowClear.tsx b/docs/examples/allowClear.tsx index 4d2f682..bd662b1 100644 --- a/docs/examples/allowClear.tsx +++ b/docs/examples/allowClear.tsx @@ -1,4 +1,4 @@ -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import React, { useState } from 'react'; export default function App() { diff --git a/docs/examples/basic.tsx b/docs/examples/basic.tsx index 067f260..b104de1 100644 --- a/docs/examples/basic.tsx +++ b/docs/examples/basic.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; const onSelect = (option, prefix) => { diff --git a/docs/examples/debug.tsx b/docs/examples/debug.tsx index 7f7cfdd..2ae6f1c 100644 --- a/docs/examples/debug.tsx +++ b/docs/examples/debug.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; export default () => ( diff --git a/docs/examples/dynamic.tsx b/docs/examples/dynamic.tsx index a87e7dc..ba1ebb4 100644 --- a/docs/examples/dynamic.tsx +++ b/docs/examples/dynamic.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; import './dynamic.less'; diff --git a/docs/examples/filter.tsx b/docs/examples/filter.tsx index 851dfd6..9737450 100644 --- a/docs/examples/filter.tsx +++ b/docs/examples/filter.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; function filterOption(input, { key }) { diff --git a/docs/examples/multiple-prefix.tsx b/docs/examples/multiple-prefix.tsx index 6bd9703..798f7d0 100644 --- a/docs/examples/multiple-prefix.tsx +++ b/docs/examples/multiple-prefix.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; const OPTIONS = { diff --git a/docs/examples/onScroll.tsx b/docs/examples/onScroll.tsx index 21c6da2..1274fec 100644 --- a/docs/examples/onScroll.tsx +++ b/docs/examples/onScroll.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; import './onScroll.less'; diff --git a/docs/examples/split.tsx b/docs/examples/split.tsx index 5997f1a..8685e5d 100644 --- a/docs/examples/split.tsx +++ b/docs/examples/split.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; const { Option } = Mentions; diff --git a/docs/examples/textarea.tsx b/docs/examples/textarea.tsx index e1665e9..a7ef4a6 100644 --- a/docs/examples/textarea.tsx +++ b/docs/examples/textarea.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import Mentions from 'rc-mentions'; +import Mentions from '@rc-component/mentions'; import '../../assets/index.less'; import './textarea.less'; diff --git a/jest.config.js b/jest.config.js index b2c0b05..0071028 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,5 @@ module.exports = { + setupFiles: ['./tests/setup.ts'], setupFilesAfterEnv: ['./tests/setupFilesAfterEnv.ts'], collectCoverageFrom: ['./src/**/*.{ts,tsx}'], }; diff --git a/package.json b/package.json index 33557c3..eab0546 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "rc-mentions", - "version": "2.19.1", + "name": "@rc-component/mentions", + "version": "1.0.0", "description": "React Mentions", "keywords": [ "react", @@ -33,7 +33,7 @@ "gh-pages": "npm run docs:build && npm run docs:deploy", "lint": "eslint src/ --ext .tsx,.ts", "prepare": "husky install", - "prepublishOnly": "npm run compile && np --yolo --no-publish", + "prepublishOnly": "npm run compile && rc-np", "postpublish": "npm run gh-pages", "start": "dumi dev", "test": "rc-test" @@ -45,16 +45,16 @@ ] }, "dependencies": { - "@babel/runtime": "^7.22.5", "@rc-component/trigger": "^2.0.0", "classnames": "^2.2.6", - "rc-input": "~1.7.1", + "@rc-component/input": "~1.0.0", "rc-menu": "~9.16.0", - "rc-textarea": "~1.9.0", - "rc-util": "^5.34.1" + "@rc-component/textarea": "~1.0.0", + "@rc-component/util": "^1.2.0" }, "devDependencies": { - "@rc-component/father-plugin": "^1.0.0", + "@rc-component/father-plugin": "^2.0.2", + "@rc-component/np": "^1.0.3", "@testing-library/jest-dom": "^6.4.6", "@testing-library/react": "^16.0.0", "@types/classnames": "^2.2.6", @@ -68,7 +68,6 @@ "gh-pages": "^5.0.0", "husky": "^9.1.6", "lint-staged": "^15.2.7", - "np": "^10.0.0", "prettier": "^3.3.2", "rc-test": "^7.0.14", "react": "^18.0.0", diff --git a/src/Mentions.tsx b/src/Mentions.tsx index 0dd6a48..f4ae6d8 100644 --- a/src/Mentions.tsx +++ b/src/Mentions.tsx @@ -1,13 +1,13 @@ import classNames from 'classnames'; -import { BaseInput } from 'rc-input'; -import type { HolderRef } from 'rc-input/lib/BaseInput'; -import type { CommonInputProps } from 'rc-input/lib/interface'; -import type { TextAreaProps, TextAreaRef } from 'rc-textarea'; -import TextArea from 'rc-textarea'; -import toArray from 'rc-util/lib/Children/toArray'; -import useMergedState from 'rc-util/lib/hooks/useMergedState'; -import KeyCode from 'rc-util/lib/KeyCode'; -import warning from 'rc-util/lib/warning'; +import { BaseInput } from '@rc-component/input'; +import type { HolderRef } from '@rc-component/input/lib/BaseInput'; +import type { CommonInputProps } from '@rc-component/input/lib/interface'; +import type { TextAreaProps, TextAreaRef } from '@rc-component/textarea'; +import TextArea from '@rc-component/textarea'; +import toArray from '@rc-component/util/lib/Children/toArray'; +import useMergedState from '@rc-component/util/lib/hooks/useMergedState'; +import KeyCode from '@rc-component/util/lib/KeyCode'; +import warning from '@rc-component/util/lib/warning'; import React, { forwardRef, useEffect, diff --git a/tests/FullProcess.spec.tsx b/tests/FullProcess.spec.tsx index b202fb9..61ebbb3 100644 --- a/tests/FullProcess.spec.tsx +++ b/tests/FullProcess.spec.tsx @@ -1,5 +1,5 @@ import { fireEvent, render } from '@testing-library/react'; -import KeyCode from 'rc-util/lib/KeyCode'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import React from 'react'; import type { MentionsProps } from '../src'; import Mentions from '../src'; diff --git a/tests/Mentions.spec.tsx b/tests/Mentions.spec.tsx index 2c60d60..25146d0 100644 --- a/tests/Mentions.spec.tsx +++ b/tests/Mentions.spec.tsx @@ -1,5 +1,5 @@ import { fireEvent, render } from '@testing-library/react'; -import KeyCode from 'rc-util/lib/KeyCode'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import React, { createRef } from 'react'; import { act } from 'react-dom/test-utils'; import type { MentionsProps } from '../src'; diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 0000000..d44227c --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1,6 @@ +// Mock empty ResizeObserver +global.ResizeObserver = class ResizeObserver { + observe() {} + unobserve() {} + disconnect() {} +}; diff --git a/tsconfig.json b/tsconfig.json index bb1d5d7..67a05c8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "paths": { "@/*": ["src/*"], "@@/*": [".dumi/tmp/*"], - "rc-mentions": ["src/index.ts"] + "@rc-component/mentions": ["src/index.ts"] } }, "include": [".dumirc.ts", "**/*.ts", "**/*.tsx"]