diff --git a/.dumirc.ts b/.dumirc.ts index 7e0b586..594242f 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -3,8 +3,8 @@ import path from 'path'; export default defineConfig({ alias: { - 'rc-notification$': path.resolve('src'), - 'rc-notification/es': path.resolve('src'), + '@rc-component/notification$': path.resolve('src'), + '@rc-component/notification/es': path.resolve('src'), }, favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { diff --git a/README.md b/README.md index 69d446b..60a9631 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,44 @@ -# rc-notification +# @rc-component/notification React Notification UI Component [![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] -[npm-image]: http://img.shields.io/npm/v/rc-notification.svg?style=flat-square -[npm-url]: http://npmjs.org/package/rc-notification +[npm-image]: http://img.shields.io/npm/v/@rc-component/notification.svg?style=flat-square +[npm-url]: http://npmjs.org/package/@rc-component/notification [github-actions-image]: https://github.com/react-component/notification/workflows/CI/badge.svg [github-actions-url]: https://github.com/react-component/notification/actions [coveralls-image]: https://img.shields.io/coveralls/react-component/notification.svg?style=flat-square [coveralls-url]: https://coveralls.io/r/react-component/notification?branch=master -[download-image]: https://img.shields.io/npm/dm/rc-notification.svg?style=flat-square -[download-url]: https://npmjs.org/package/rc-notification -[bundlephobia-url]: https://bundlephobia.com/result?p=rc-notification -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-notification +[download-image]: https://img.shields.io/npm/dm/@rc-component/notification.svg?style=flat-square +[download-url]: https://npmjs.org/package/@rc-component/notification +[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/notification +[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/notification ## Install -[![rc-notification](https://nodei.co/npm/rc-notification.png)](https://npmjs.org/package/rc-notification) +[![@rc-component/notification](https://nodei.co/npm/@rc-component/notification.png)](https://npmjs.org/package/@rc-component/notification) ## Usage ```js -import Notification from 'rc-notification'; +import Notification from '@rc-component/notification'; -Notification.newInstance({}, notification => { +Notification.newInstance({}, (notification) => { notification.notice({ - content: 'content' + content: 'content', }); }); ``` ## Compatibility -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | -| --- | --- | --- | --- | --- | -| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | +| Browser | Supported Version | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | +| [![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png)
Firefox](http://godban.github.io/browsers-support-badges/) | last 2 versions | +| [![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png)
Chrome](http://godban.github.io/browsers-support-badges/) | last 2 versions | +| [![Safari](https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png)
Safari](http://godban.github.io/browsers-support-badges/) | last 2 versions | +| [![Electron](https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png)
Electron](http://godban.github.io/browsers-support-badges/) | last 2 versions | ## Example @@ -188,4 +191,4 @@ open coverage/ dir ## License -rc-notification is released under the MIT license. +@rc-component/notification is released under the MIT license. diff --git a/docs/examples/motion.ts b/docs/examples/motion.ts index c6f0d98..4a5be33 100644 --- a/docs/examples/motion.ts +++ b/docs/examples/motion.ts @@ -1,4 +1,4 @@ -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; const motion: CSSMotionProps = { motionName: 'rc-notification-fade', diff --git a/package.json b/package.json index 3ac6010..c023fe6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "rc-notification", - "version": "5.6.3", + "name": "@rc-component/notification", + "version": "1.0.0", "description": "notification ui component for react", "engines": { "node": ">=8.x" @@ -39,7 +39,7 @@ "build": "dumi build", "docs:deploy": "gh-pages -d .doc", "compile": "father build && lessc assets/index.less assets/index.css", - "prepublishOnly": "npm run compile && np --yolo --no-publish", + "prepublishOnly": "npm run compile && rc-np", "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "test": "vitest --watch=false", "test:watch": "vitest", @@ -52,7 +52,7 @@ "react-dom": ">=16.9.0" }, "devDependencies": { - "@rc-component/father-plugin": "^1.0.2", + "@rc-component/father-plugin": "^2.0.4", "@testing-library/jest-dom": "^6.0.0", "@testing-library/react": "^15.0.7", "@types/classnames": "^2.2.10", @@ -70,7 +70,6 @@ "jsdom": "^24.0.0", "less": "^4.2.0", "lint-staged": "^14.0.1", - "np": "^10.0.5", "prettier": "^3.0.2", "react": "^18.0.0", "react-dom": "^18.0.0", @@ -78,10 +77,10 @@ "vitest": "^0.34.2" }, "dependencies": { - "@babel/runtime": "^7.10.1", - "classnames": "2.x", - "rc-motion": "^2.9.0", - "rc-util": "^5.20.1" + "@rc-component/motion": "^1.1.4", + "@rc-component/np": "^1.0.3", + "@rc-component/util": "^1.2.1", + "classnames": "2.x" }, "lint-staged": { "**/*.{js,jsx,tsx,ts,md,json}": [ diff --git a/src/Notice.tsx b/src/Notice.tsx index 5cf4180..d191126 100644 --- a/src/Notice.tsx +++ b/src/Notice.tsx @@ -1,8 +1,8 @@ import classNames from 'classnames'; -import KeyCode from 'rc-util/lib/KeyCode'; +import KeyCode from '@rc-component/util/lib/KeyCode'; import * as React from 'react'; import type { NoticeConfig } from './interface'; -import pickAttrs from 'rc-util/lib/pickAttrs'; +import pickAttrs from '@rc-component/util/lib/pickAttrs'; export interface NoticeProps extends Omit { prefixCls: string; diff --git a/src/NoticeList.tsx b/src/NoticeList.tsx index 1965100..1edb31a 100644 --- a/src/NoticeList.tsx +++ b/src/NoticeList.tsx @@ -1,8 +1,8 @@ import type { CSSProperties, FC } from 'react'; import React, { useContext, useEffect, useRef, useState } from 'react'; import clsx from 'classnames'; -import type { CSSMotionProps } from 'rc-motion'; -import { CSSMotionList } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; +import { CSSMotionList } from '@rc-component/motion'; import type { InnerOpenConfig, NoticeConfig, diff --git a/src/Notifications.tsx b/src/Notifications.tsx index cdd81bb..f990764 100644 --- a/src/Notifications.tsx +++ b/src/Notifications.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import type { ReactElement } from 'react'; import { createPortal } from 'react-dom'; -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; import type { InnerOpenConfig, OpenConfig, Placement, Placements, StackConfig } from './interface'; import NoticeList from './NoticeList'; diff --git a/src/hooks/useNotification.tsx b/src/hooks/useNotification.tsx index c64f94f..a7940ff 100644 --- a/src/hooks/useNotification.tsx +++ b/src/hooks/useNotification.tsx @@ -1,9 +1,9 @@ -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; import * as React from 'react'; import type { NotificationsProps, NotificationsRef } from '../Notifications'; import Notifications from '../Notifications'; import type { OpenConfig, Placement, StackConfig } from '../interface'; -import { useEvent } from 'rc-util'; +import { useEvent } from '@rc-component/util'; const defaultGetContainer = () => document.body;