Skip to content

chore: update dependencies and import paths to @rc-component packages dependencies #756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"proseWrap": "never",
"trailingComma": "all",
"arrowParens": "avoid"
}
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

React Menu Component. port from https://github.com/kissyteam/menu

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-menu.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-menu
Expand Down Expand Up @@ -172,7 +167,7 @@ ReactDOM.render(
<td>openAnimation</td>
<td>{enter:function,leave:function}|String</td>
<th></th>
<td>animate when sub menu open or close. see rc-motion for object type.</td>
<td>animate when sub menu open or close. see @rc-component/motion for object type.</td>
</tr>
<tr>
<td>openTransition</td>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/antd.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console, react/require-default-props, no-param-reassign */

import React from 'react';
import type { CSSMotionProps } from 'rc-motion';
import type { CSSMotionProps } from '@rc-component/motion';
import Menu, { SubMenu, Item as MenuItem, Divider, MenuProps } from '../../src';
import '../../assets/index.less';

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/debug.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React, { useRef } from 'react';
import type { CSSMotionProps } from 'rc-motion';
import type { CSSMotionProps } from '@rc-component/motion';
import Menu, { ItemGroup as MenuItemGroup, MenuItem } from '../../src';
import type { MenuProps } from '../../src';
import '../../assets/index.less';
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/fragment.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Menu, { SubMenu, Item as MenuItem, Divider } from 'rc-menu';
import Menu, { SubMenu, Item as MenuItem, Divider } from '@rc-component/menu';
import '../../assets/index.less';

export default () => (
Expand Down
18 changes: 12 additions & 6 deletions docs/examples/inlineCollapsed.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React, { useState } from 'react';
import Menu from 'rc-menu';
import Menu from '@rc-component/menu';
import './inlineCollapsed.less';

const App = () => {
const [collapsed, setCollapsed] = useState(false);
return (
<>
<label>
<input type="checkbox" checked={collapsed} onChange={e => setCollapsed(e.target.checked)} />
<input
type="checkbox"
checked={collapsed}
onChange={e => setCollapsed(e.target.checked)}
/>
inlineCollapsed: {collapsed.toString()}
</label>
<Menu
Expand All @@ -24,18 +28,20 @@ const App = () => {
{ key: '3', label: 'item 2' },
{ key: '4', label: 'item 3' },
{
key: '5', label: 'SubMenu', children: [
key: '5',
label: 'SubMenu',
children: [
{ key: '6', label: 'item 4' },
{ key: '7', label: 'item 5' },
{ key: '8', label: 'item 6' },
]
}
],
},
],
},
]}
/>
</>
);
}
};

export default App;
2 changes: 1 addition & 1 deletion docs/examples/keyPath.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';
import Menu, { SubMenu, Item as MenuItem } from '@rc-component/menu';

import '../../assets/index.less';

Expand Down
10 changes: 8 additions & 2 deletions docs/examples/menuItemGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { Item as MenuItem, ItemGroup as MenuItemGroup } from 'rc-menu';
import Menu, {
Item as MenuItem,
ItemGroup as MenuItemGroup,
} from '@rc-component/menu';

import '../../assets/index.less';

export default () => (
<div>
<h2>menu item group</h2>
<Menu style={{ margin: 20, width: 300 }} onClick={() => console.log('click')}>
<Menu
style={{ margin: 20, width: 300 }}
onClick={() => console.log('click')}
>
<MenuItemGroup title="group 1" key="2">
<MenuItem key="21">2</MenuItem>
<MenuItem key="22">3</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/multiple.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { SubMenu, Item as MenuItem, Divider } from 'rc-menu';
import Menu, { SubMenu, Item as MenuItem, Divider } from '@rc-component/menu';

import '../../assets/index.less';

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/openKeys.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';
import Menu, { SubMenu, Item as MenuItem } from '@rc-component/menu';

import '../../assets/index.less';

Expand Down
13 changes: 9 additions & 4 deletions docs/examples/rtl-antd.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* eslint-disable no-console, react/require-default-props, no-param-reassign */

import React from 'react';
import type { CSSMotionProps } from 'rc-motion';
import Menu, { SubMenu, Item as MenuItem, Divider, MenuProps } from 'rc-menu';
import type { CSSMotionProps } from '@rc-component/motion';
import Menu, {
SubMenu,
Item as MenuItem,
Divider,
MenuProps,
} from '@rc-component/menu';
import '../../assets/index.less';

function handleClick(info) {
Expand Down Expand Up @@ -122,8 +127,8 @@ const children2 = [
const customizeIndicator = <span>Add More Items</span>;

interface CommonMenuState {
children: React.ReactNode;
overflowedIndicator?: React.ReactNode;
children: React.ReactNode;
overflowedIndicator?: React.ReactNode;
}

class CommonMenu extends React.Component<any, CommonMenuState> {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/scrollable.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { Item as MenuItem } from 'rc-menu';
import Menu, { Item as MenuItem } from '@rc-component/menu';

import '../../assets/index.less';

Expand Down
10 changes: 5 additions & 5 deletions docs/examples/selectedKeys.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint no-console:0 */

import React from 'react';
import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';
import Menu, { SubMenu, Item as MenuItem } from '@rc-component/menu';

import '../../assets/index.less';

interface TestState {
destroyed: boolean;
selectedKeys: string[];
openKeys: string[];
}
destroyed: boolean;
selectedKeys: string[];
openKeys: string[];
}

class Test extends React.Component<any, TestState> {
state = {
Expand Down
50 changes: 25 additions & 25 deletions docs/examples/single.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
/* eslint no-console:0 */

import React from 'react';
import Menu from 'rc-menu';
import Menu from '@rc-component/menu';
import '../../assets/index.less';

const menu1List = [
{
titleLocalKey: "Properties",
key: "Properties"
titleLocalKey: 'Properties',
key: 'Properties',
},
{
titleLocalKey: "Resources",
key: "Resources",
titleLocalKey: 'Resources',
key: 'Resources',
children: [
{
titleLocalKey: "FAQ",
key: "Faq",
isSub: true
titleLocalKey: 'FAQ',
key: 'Faq',
isSub: true,
},
{
titleLocalKey: "Learn",
key: "Learn",
isSub: true
}
]
titleLocalKey: 'Learn',
key: 'Learn',
isSub: true,
},
],
},
{
titleLocalKey: "About Us",
key: "AboutUs"
}
titleLocalKey: 'About Us',
key: 'AboutUs',
},
];

const menu1Items = (values) => {
const menu1Items = values => {
if (!values) {
return undefined;
}
return values.map((item, index) => {
return {
label: <div>{item.titleLocalKey}</div>,
key: item.key,
children: menu1Items(item.children)
children: menu1Items(item.children),
};
});
};
Expand All @@ -48,10 +48,10 @@ console.log(menu1Items(menu1List));

export default () => (
<Menu
selectable={false}
mode="inline"
defaultOpenKeys={['Resources']}
style={{ width: "100%" }}
items={menu1Items(menu1List)}
/>
)
selectable={false}
mode="inline"
defaultOpenKeys={['Resources']}
style={{ width: '100%' }}
items={menu1Items(menu1List)}
/>
);
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rc-menu",
"version": "9.16.1",
"name": "@rc-component/menu",
"version": "1.0.0",
"description": "menu ui component for react",
"keywords": [
"react",
Expand Down Expand Up @@ -37,22 +37,22 @@
"docs:deploy": "gh-pages -d .doc",
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
"now-build": "npm run build",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "tnpm sync rc-menu",
"prepublishOnly": "npm run compile && rc-np",
"postpublish": "tnpm sync @rc-component/menu",
"start": "dumi dev",
"test": "rc-test",
"prepare": "husky && dumi setup"
},
"dependencies": {
"@babel/runtime": "^7.10.1",
"@rc-component/trigger": "^2.0.0",
"@rc-component/motion": "^1.1.4",
"@rc-component/trigger": "^3.0.0",
"@rc-component/util": "^1.0.0",
"classnames": "2.x",
"rc-motion": "^2.4.3",
"rc-overflow": "^1.3.1",
"rc-util": "^5.27.0"
"rc-overflow": "^1.3.1"
},
"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.1.5",
"@testing-library/react": "^16.0.0",
"@types/jest": "^29.5.2",
Expand All @@ -70,7 +70,6 @@
"husky": "^9.1.6",
"less": "^4.1.3",
"lint-staged": "^15.2.10",
"np": "^10.0.5",
"prettier": "^3.3.3",
"rc-test": "^7.0.14",
"react": "^18.3.1",
Expand Down
8 changes: 4 additions & 4 deletions src/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import classNames from 'classnames';
import type { CSSMotionProps } from 'rc-motion';
import type { CSSMotionProps } from '@rc-component/motion';
import Overflow from 'rc-overflow';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import isEqual from 'rc-util/lib/isEqual';
import warning from 'rc-util/lib/warning';
import useMergedState from '@rc-component/util/lib/hooks/useMergedState';
import isEqual from '@rc-component/util/lib/isEqual';
import warning from '@rc-component/util/lib/warning';
import * as React from 'react';
import { useImperativeHandle } from 'react';
import { flushSync } from 'react-dom';
Expand Down
8 changes: 4 additions & 4 deletions src/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import classNames from 'classnames';
import Overflow from 'rc-overflow';
import KeyCode from 'rc-util/lib/KeyCode';
import omit from 'rc-util/lib/omit';
import { useComposeRef } from 'rc-util/lib/ref';
import warning from 'rc-util/lib/warning';
import KeyCode from '@rc-component/util/lib/KeyCode';
import omit from '@rc-component/util/lib/omit';
import { useComposeRef } from '@rc-component/util/lib/ref';
import warning from '@rc-component/util/lib/warning';
import * as React from 'react';
import { useMenuId } from './context/IdContext';
import { MenuContext } from './context/MenuContext';
Expand Down
2 changes: 1 addition & 1 deletion src/MenuItemGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import omit from 'rc-util/lib/omit';
import omit from '@rc-component/util/lib/omit';
import * as React from 'react';
import { MenuContext } from './context/MenuContext';
import { useFullPath, useMeasure } from './context/PathContext';
Expand Down
11 changes: 3 additions & 8 deletions src/SubMenu/InlineSubMenuList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import CSSMotion from 'rc-motion';
import CSSMotion from '@rc-component/motion';
import { getMotion } from '../utils/motionUtil';
import MenuContextProvider, { MenuContext } from '../context/MenuContext';
import SubMenuList from './SubMenuList';
Expand All @@ -20,13 +20,8 @@ export default function InlineSubMenuList({
}: InlineSubMenuListProps) {
const fixedMode: MenuMode = 'inline';

const {
prefixCls,
forceSubMenuRender,
motion,
defaultMotions,
mode,
} = React.useContext(MenuContext);
const { prefixCls, forceSubMenuRender, motion, defaultMotions, mode } =
React.useContext(MenuContext);

// Always use latest mode check
const sameModeRef = React.useRef(false);
Expand Down
Loading
Loading