diff --git a/.gitignore b/.gitignore index f44d17fe..584bc34c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ es coverage yarn.lock package-lock.json +pnpm-lock.yaml bun.lockb # dumi diff --git a/docs/examples/case.tsx b/docs/examples/case.tsx index 74e8740d..e7dcb190 100644 --- a/docs/examples/case.tsx +++ b/docs/examples/case.tsx @@ -1,7 +1,7 @@ /* eslint no-console:0 */ import React from 'react'; -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; import type { ActionType, BuildInPlacements } from 'rc-trigger'; import Trigger from 'rc-trigger'; import './case.less'; diff --git a/package.json b/package.json index 65e1c995..93cb387a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rc-component/trigger", - "version": "2.2.6", + "version": "3.0.0", "description": "base abstract trigger component for react", "engines": { "node": ">=8.x" @@ -65,11 +65,11 @@ }, "dependencies": { "@babel/runtime": "^7.23.2", + "@rc-component/motion": "^1.0.0", "@rc-component/portal": "^1.1.0", - "classnames": "^2.3.2", - "rc-motion": "^2.0.0", - "rc-resize-observer": "^1.3.1", - "rc-util": "^5.44.0" + "@rc-component/resize-observer": "^1.0.0", + "@rc-component/util": "^1.2.0", + "classnames": "^2.3.2" }, "peerDependencies": { "react": ">=16.9.0", diff --git a/src/Popup/Mask.tsx b/src/Popup/Mask.tsx index 86429ee4..125fe458 100644 --- a/src/Popup/Mask.tsx +++ b/src/Popup/Mask.tsx @@ -1,6 +1,6 @@ import classNames from 'classnames'; -import type { CSSMotionProps } from 'rc-motion'; -import CSSMotion from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; +import CSSMotion from '@rc-component/motion'; import * as React from 'react'; export interface MaskProps { diff --git a/src/Popup/index.tsx b/src/Popup/index.tsx index 47666c19..167a4aa5 100644 --- a/src/Popup/index.tsx +++ b/src/Popup/index.tsx @@ -1,9 +1,9 @@ import classNames from 'classnames'; -import type { CSSMotionProps } from 'rc-motion'; -import CSSMotion from 'rc-motion'; -import ResizeObserver from 'rc-resize-observer'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import { composeRef } from 'rc-util/lib/ref'; +import type { CSSMotionProps } from '@rc-component/motion'; +import CSSMotion from '@rc-component/motion'; +import ResizeObserver from '@rc-component/resize-observer'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import { composeRef } from '@rc-component/util/lib/ref'; import * as React from 'react'; import type { TriggerProps } from '../'; import type { AlignType, ArrowPos, ArrowTypeOuter } from '../interface'; diff --git a/src/TriggerWrapper.tsx b/src/TriggerWrapper.tsx index 0facc9ad..f6c34610 100644 --- a/src/TriggerWrapper.tsx +++ b/src/TriggerWrapper.tsx @@ -3,7 +3,7 @@ import { getNodeRef, supportRef, useComposeRef, -} from 'rc-util/lib/ref'; +} from '@rc-component/util/lib/ref'; import * as React from 'react'; import type { TriggerProps } from '.'; diff --git a/src/hooks/useAlign.ts b/src/hooks/useAlign.ts index 8af82525..f352a33d 100644 --- a/src/hooks/useAlign.ts +++ b/src/hooks/useAlign.ts @@ -1,7 +1,7 @@ -import { isDOM } from 'rc-util/lib/Dom/findDOMNode'; -import isVisible from 'rc-util/lib/Dom/isVisible'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import { isDOM } from '@rc-component/util/lib/Dom/findDOMNode'; +import isVisible from '@rc-component/util/lib/Dom/isVisible'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import * as React from 'react'; import type { TriggerProps } from '..'; import type { diff --git a/src/hooks/useWatch.ts b/src/hooks/useWatch.ts index eba0fd80..d5d3fd66 100644 --- a/src/hooks/useWatch.ts +++ b/src/hooks/useWatch.ts @@ -1,4 +1,4 @@ -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import { collectScroller, getWin } from '../util'; export default function useWatch( diff --git a/src/hooks/useWinClick.ts b/src/hooks/useWinClick.ts index 9e44fe2f..e14bb482 100644 --- a/src/hooks/useWinClick.ts +++ b/src/hooks/useWinClick.ts @@ -1,5 +1,5 @@ -import { getShadowRoot } from 'rc-util/lib/Dom/shadow'; -import { warning } from 'rc-util/lib/warning'; +import { getShadowRoot } from '@rc-component/util/lib/Dom/shadow'; +import { warning } from '@rc-component/util/lib/warning'; import * as React from 'react'; import { getWin } from '../util'; diff --git a/src/index.tsx b/src/index.tsx index ac4b841e..b1da5c0d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,13 +1,13 @@ import Portal from '@rc-component/portal'; import classNames from 'classnames'; -import type { CSSMotionProps } from 'rc-motion'; -import ResizeObserver from 'rc-resize-observer'; -import { isDOM } from 'rc-util/lib/Dom/findDOMNode'; -import { getShadowRoot } from 'rc-util/lib/Dom/shadow'; -import useEvent from 'rc-util/lib/hooks/useEvent'; -import useId from 'rc-util/lib/hooks/useId'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import isMobile from 'rc-util/lib/isMobile'; +import type { CSSMotionProps } from '@rc-component/motion'; +import ResizeObserver from '@rc-component/resize-observer'; +import { isDOM } from '@rc-component/util/lib/Dom/findDOMNode'; +import { getShadowRoot } from '@rc-component/util/lib/Dom/shadow'; +import useEvent from '@rc-component/util/lib/hooks/useEvent'; +import useId from '@rc-component/util/lib/hooks/useId'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; +import isMobile from '@rc-component/util/lib/isMobile'; import * as React from 'react'; import Popup from './Popup'; import TriggerWrapper from './TriggerWrapper'; @@ -80,9 +80,9 @@ export interface TriggerProps { maskClosable?: boolean; // =================== Motion ==================== - /** Set popup motion. You can ref `rc-motion` for more info. */ + /** Set popup motion. You can ref `@rc-component/motion` for more info. */ popupMotion?: CSSMotionProps; - /** Set mask motion. You can ref `rc-motion` for more info. */ + /** Set mask motion. You can ref `@rc-component/motion` for more info. */ maskMotion?: CSSMotionProps; /** @deprecated Please us `popupMotion` instead. */ diff --git a/src/interface.ts b/src/interface.ts index ddb27eec..d34856dc 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -1,4 +1,4 @@ -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; export type Placement = | 'top' @@ -120,7 +120,7 @@ export interface CommonEventHandler { } export interface MobileConfig { - /** Set popup motion. You can ref `rc-motion` for more info. */ + /** Set popup motion. You can ref `@rc-component/motion` for more info. */ popupMotion?: CSSMotionProps; popupClassName?: string; popupStyle?: React.CSSProperties; diff --git a/src/util.ts b/src/util.ts index 5170d86b..58bdfb22 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,4 +1,4 @@ -import type { CSSMotionProps } from 'rc-motion'; +import type { CSSMotionProps } from '@rc-component/motion'; import type { AlignType, AnimationType, diff --git a/tests/align.test.tsx b/tests/align.test.tsx index 945b132e..1ef62f02 100644 --- a/tests/align.test.tsx +++ b/tests/align.test.tsx @@ -1,11 +1,11 @@ import { act, cleanup, fireEvent, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import type { TriggerProps, TriggerRef } from '../src'; import Trigger from '../src'; import { awaitFakeTimer } from './util'; -import { _rs } from 'rc-resize-observer'; +import { _rs } from '@rc-component/resize-observer'; export const triggerResize = (target: Element) => { act(() => { diff --git a/tests/arrow.test.jsx b/tests/arrow.test.jsx index 24df7055..19c53b9f 100644 --- a/tests/arrow.test.jsx +++ b/tests/arrow.test.jsx @@ -4,7 +4,7 @@ import { act, cleanup, render } from '@testing-library/react'; import { spyElementPrototype, spyElementPrototypes, -} from 'rc-util/lib/test/domHook'; +} from '@rc-component/util/lib/test/domHook'; import Trigger from '../src'; describe('Trigger.Arrow', () => { diff --git a/tests/basic.test.jsx b/tests/basic.test.jsx index 071878b6..fa4254d0 100644 --- a/tests/basic.test.jsx +++ b/tests/basic.test.jsx @@ -1,7 +1,7 @@ /* eslint-disable max-classes-per-file */ import { act, cleanup, fireEvent, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React, { StrictMode, createRef } from 'react'; import ReactDOM, { createPortal } from 'react-dom'; import Trigger from '../src'; diff --git a/tests/flip-visibleFirst.test.tsx b/tests/flip-visibleFirst.test.tsx index f44c530f..83194a5e 100644 --- a/tests/flip-visibleFirst.test.tsx +++ b/tests/flip-visibleFirst.test.tsx @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-invalid-this */ import { act, cleanup, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import * as React from 'react'; import type { AlignType, TriggerProps, TriggerRef } from '../src'; import Trigger from '../src'; diff --git a/tests/flip.test.tsx b/tests/flip.test.tsx index 853ec980..bc1efec6 100644 --- a/tests/flip.test.tsx +++ b/tests/flip.test.tsx @@ -1,6 +1,6 @@ import { act, cleanup, render } from '@testing-library/react'; -import { _rs } from 'rc-resize-observer'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { _rs } from '@rc-component/resize-observer'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import * as React from 'react'; import type { AlignType, TriggerProps } from '../src'; import Trigger from '../src'; diff --git a/tests/flipShift.test.tsx b/tests/flipShift.test.tsx index d9e02a03..57e88e77 100644 --- a/tests/flipShift.test.tsx +++ b/tests/flipShift.test.tsx @@ -1,5 +1,5 @@ import { act, cleanup, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import Trigger from '../src'; diff --git a/tests/mask.test.jsx b/tests/mask.test.jsx index f4e9e129..487a5032 100644 --- a/tests/mask.test.jsx +++ b/tests/mask.test.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; import Trigger from '../src'; -import CSSMotion from 'rc-motion'; +import CSSMotion from '@rc-component/motion'; import { placementAlignMap } from './util'; describe('Trigger.Mask', () => { diff --git a/tests/mobile.test.tsx b/tests/mobile.test.tsx index b7abaed3..a3269c2b 100644 --- a/tests/mobile.test.tsx +++ b/tests/mobile.test.tsx @@ -1,10 +1,10 @@ import { act, fireEvent, render } from '@testing-library/react'; -import isMobile from 'rc-util/lib/isMobile'; +import isMobile from '@rc-component/util/lib/isMobile'; import React from 'react'; import Trigger from '../src'; import { placementAlignMap } from './util'; -jest.mock('rc-util/lib/isMobile'); +jest.mock('@rc-component/util/lib/isMobile'); describe('Trigger.Mobile', () => { beforeAll(() => { diff --git a/tests/portal.test.jsx b/tests/portal.test.jsx index 699dc06a..79b37351 100644 --- a/tests/portal.test.jsx +++ b/tests/portal.test.jsx @@ -1,7 +1,7 @@ /* eslint-disable max-classes-per-file */ import { act, cleanup, fireEvent, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import ReactDOM from 'react-dom'; import Trigger from '../src'; diff --git a/tests/rect.test.tsx b/tests/rect.test.tsx index 596689f0..ae26a5b8 100644 --- a/tests/rect.test.tsx +++ b/tests/rect.test.tsx @@ -1,5 +1,5 @@ import { cleanup, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import Trigger from '../src'; import { awaitFakeTimer } from './util'; diff --git a/tests/ref.test.tsx b/tests/ref.test.tsx index 2d0179e6..bdea4570 100644 --- a/tests/ref.test.tsx +++ b/tests/ref.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable max-classes-per-file */ import { cleanup, render } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import React from 'react'; import Trigger, { type TriggerRef } from '../src'; diff --git a/tests/shadow.test.tsx b/tests/shadow.test.tsx index b7e05802..ac4109f6 100644 --- a/tests/shadow.test.tsx +++ b/tests/shadow.test.tsx @@ -1,5 +1,5 @@ import { act, fireEvent } from '@testing-library/react'; -import { resetWarned } from 'rc-util/lib/warning'; +import { resetWarned } from '@rc-component/util/lib/warning'; import React from 'react'; import { createRoot } from 'react-dom/client'; import Trigger from '../src';