Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ es
coverage
yarn.lock
package-lock.json
pnpm-lock.yaml
bun.lockb

# dumi
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/case.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/Popup/Mask.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions src/Popup/index.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 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';
Expand Down
2 changes: 1 addition & 1 deletion src/TriggerWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 '.';

Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useAlign.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useWatch.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useWinClick.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
20 changes: 10 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions src/interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CSSMotionProps } from 'rc-motion';
import type { CSSMotionProps } from '@rc-component/motion';

export type Placement =
| 'top'
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CSSMotionProps } from 'rc-motion';
import type { CSSMotionProps } from '@rc-component/motion';
import type {
AlignType,
AnimationType,
Expand Down
4 changes: 2 additions & 2 deletions tests/align.test.tsx
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/arrow.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.test.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/flip-visibleFirst.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 2 additions & 2 deletions tests/flip.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/flipShift.test.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion tests/mask.test.jsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/mobile.test.tsx
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/portal.test.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/rect.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tests/ref.test.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion tests/shadow.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Loading