Skip to content
Open
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"@rc-component/motion": "^1.1.4",
"@rc-component/overflow": "^1.0.0",
"@rc-component/trigger": "^3.0.0",
"@rc-component/util": "^1.3.0",
"@rc-component/util": "^1.11.1",
"clsx": "^2.1.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^2.0.2",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.3",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^16.0.0",
Expand Down
5 changes: 1 addition & 4 deletions src/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { clsx } from 'clsx';
import type { CSSMotionProps } from '@rc-component/motion';
import Overflow from '@rc-component/overflow';
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
import useId from '@rc-component/util/lib/hooks/useId';
import isEqual from '@rc-component/util/lib/isEqual';
import warning from '@rc-component/util/lib/warning';
import { isEqual, useControlledState, useId, warning } from '@rc-component/util';
import * as React from 'react';
import { useImperativeHandle } from 'react';
import { flushSync } from 'react-dom';
Expand Down
5 changes: 1 addition & 4 deletions src/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { clsx } from 'clsx';
import Overflow from '@rc-component/overflow';
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 { KeyCode, omit, useComposeRef, warning } from '@rc-component/util';
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 { clsx } from 'clsx';
import omit from '@rc-component/util/lib/omit';
import { omit } from '@rc-component/util';
import * as React from 'react';
import { MenuContext } from './context/MenuContext';
import { useFullPath, useMeasure } from './context/PathContext';
Expand Down
2 changes: 1 addition & 1 deletion src/SubMenu/PopupTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Trigger from '@rc-component/trigger';
import { clsx } from 'clsx';
import raf from '@rc-component/util/lib/raf';
import { raf } from '@rc-component/util';
import type { CSSMotionProps } from '@rc-component/motion';
import { MenuContext } from '../context/MenuContext';
import { placements, placementsRtl } from '../placements';
Expand Down
2 changes: 1 addition & 1 deletion src/SubMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { clsx } from 'clsx';
import Overflow from '@rc-component/overflow';
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';
import SubMenuList from './SubMenuList';
import { parseChildren } from '../utils/commonUtil';
import type { MenuInfo, SubMenuType } from '../interface';
Expand Down
3 changes: 1 addition & 2 deletions src/context/MenuContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import type { CSSMotionProps } from '@rc-component/motion';
import useMemo from '@rc-component/util/lib/hooks/useMemo';
import isEqual from '@rc-component/util/lib/isEqual';
import { isEqual, useMemo } from '@rc-component/util';
import type {
BuiltinPlacements,
MenuClickEventHandler,
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/useAccessibility.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { getFocusNodeList } from '@rc-component/util/lib/Dom/focus';
import KeyCode from '@rc-component/util/lib/KeyCode';
import raf from '@rc-component/util/lib/raf';
import { getFocusNodeList, KeyCode, raf } from '@rc-component/util';
import * as React from 'react';
import { getMenuId } from '../context/IdContext';
import type { MenuMode } from '../interface';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useKeyRecords.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useRef, useCallback } from 'react';
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';
import { nextSlice } from '../utils/timeUtil';

const PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__';
Expand Down
12 changes: 11 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import type { MenuProps } from './Menu';
import type { MenuItemProps } from './MenuItem';
import type { SubMenuProps } from './SubMenu';
import type { MenuItemGroupProps } from './MenuItemGroup';
import type { MenuRef } from './interface';
import type {
MenuDividerType,
MenuItemGroupType,
MenuItemType,
MenuRef,
SubMenuType,
} from './interface';

export {
SubMenu,
Expand All @@ -26,7 +32,11 @@ export type {
SubMenuProps,
MenuItemProps,
MenuItemGroupProps,
MenuDividerType,
MenuItemGroupType,
MenuItemType,
MenuRef,
SubMenuType,
};

type MenuType = typeof Menu & {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/commonUtil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import toArray from '@rc-component/util/lib/Children/toArray';
import { toArray } from '@rc-component/util';
import * as React from 'react';

export function parseChildren(children: React.ReactNode | undefined, keyPath: string[]) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/warnUtil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import warning from '@rc-component/util/lib/warning';
import { warning } from '@rc-component/util';

/**
* `onClick` event return `info.item` which point to react node directly.
Expand Down
2 changes: 1 addition & 1 deletion tests/Focus.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */
import { act, fireEvent, render } from '@testing-library/react';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import Menu, { MenuItem, MenuItemGroup, MenuRef, SubMenu } from '../src';

Expand Down
3 changes: 1 addition & 2 deletions tests/Keyboard.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-undef, react/no-multi-comp, react/jsx-curly-brace-presence, max-classes-per-file */
import { fireEvent, render } from '@testing-library/react';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';
import { KeyCode, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import { act } from 'react-dom/test-utils';
import Menu, { MenuItem, SubMenu } from '../src';
Expand Down
4 changes: 1 addition & 3 deletions tests/Menu.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* eslint-disable no-undef, react/no-multi-comp, react/jsx-curly-brace-presence, max-classes-per-file */
import type { MenuMode } from '@/interface';
import { fireEvent, render } from '@testing-library/react';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { resetWarned } from '@rc-component/util/lib/warning';
import { KeyCode, resetWarned, spyElementPrototypes } from '@rc-component/util';
import React from 'react';
import { act } from 'react-dom/test-utils';
import type { MenuRef } from '../src';
import Menu, { Divider, MenuItem, MenuItemGroup, SubMenu } from '../src';
import { isActive, last } from './util';
import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook';

jest.mock('@rc-component/trigger', () => {
const react = require('react');
Expand Down
2 changes: 1 addition & 1 deletion tests/MenuItem.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */
import { fireEvent, render } from '@testing-library/react';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { KeyCode } from '@rc-component/util';
import React from 'react';
import Menu, { MenuItem, MenuItemGroup, SubMenu } from '../src';

Expand Down
3 changes: 1 addition & 2 deletions tests/Responsive.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable no-undef, react/no-multi-comp, react/jsx-curly-brace-presence, max-classes-per-file */
import { act, fireEvent, render } from '@testing-library/react';
import ResizeObserver from '@rc-component/resize-observer';
import KeyCode from '@rc-component/util/lib/KeyCode';
import { spyElementPrototype } from '@rc-component/util/lib/test/domHook';
import { KeyCode, spyElementPrototype } from '@rc-component/util';
import React from 'react';
import Menu, { MenuItem, SubMenu } from '../src';
import { OVERFLOW_KEY } from '../src/hooks/useKeyRecords';
Expand Down
2 changes: 1 addition & 1 deletion tests/SubMenu.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */
import { act, fireEvent, render } from '@testing-library/react';
import { resetWarned } from '@rc-component/util/lib/warning';
import { resetWarned } from '@rc-component/util';
import React from 'react';
import Menu, { MenuItem, SubMenu } from '../src';
import { isActive, last } from './util';
Expand Down
Loading