-[npm-image]: https://img.shields.io/npm/v/@rc-component/trigger.svg?style=flat-square
-[npm-url]: https://npmjs.org/package/@rc-component/trigger
-[github-actions-image]: https://github.com/react-component/trigger/actions/workflows/main.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/trigger/actions/workflows/main.yml
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/trigger/master.svg?style=flat-square
-[codecov-url]: https://codecov.io/gh/react-component/trigger/branch/master
-[david-url]: https://david-dm.org/react-component/trigger
-[david-image]: https://david-dm.org/react-component/trigger/status.svg?style=flat-square
-[david-dev-url]: https://david-dm.org/react-component/trigger?type=dev
-[david-dev-image]: https://david-dm.org/react-component/trigger/dev-status.svg?style=flat-square
-[download-image]: https://img.shields.io/npm/dm/@rc-component/trigger.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/trigger
-[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/trigger
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/trigger
-[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
-[dumi-url]: https://github.com/umijs/dumi
+
+## Highlights
+
+- Built for React and maintained by the rc-component team.
+- Used by Ant Design and other React component libraries.
+- Ships TypeScript declarations with both ES module and CommonJS outputs.
+- Keeps examples, tests, and preview builds aligned with the package source.
## Install
-[](https://npmjs.org/package/@rc-component/trigger)
+```bash
+npm install @rc-component/trigger
+```
## Usage
-Include the default [styling](https://github.com/react-component/trigger/blob/master/assets/index.less#L4:L11) and then:
-
-```js
-import React from 'react';
-import ReactDOM from 'react-dom';
+```tsx
import Trigger from '@rc-component/trigger';
+import '@rc-component/trigger/assets/index.css';
-ReactDOM.render(
+export default () => (
popup}
+ popup={Popup content}
popupAlign={{
points: ['tl', 'bl'],
- offset: [0, 3],
+ offset: [0, 4],
}}
>
- hover
- ,
- container,
+
+
);
```
-## Compatibility
+## Examples
-| [](http://godban.github.io/browsers-support-badges/) IE / Edge | [](http://godban.github.io/browsers-support-badges/) Firefox | [](http://godban.github.io/browsers-support-badges/) Chrome | [](http://godban.github.io/browsers-support-badges/) Safari | [](http://godban.github.io/browsers-support-badges/) Electron |
-| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
+Run the local dumi site:
-## Example
+```bash
+npm install
+npm start
+```
-http://localhost:9001
+Then open `http://localhost:8000`.
+
+## API
+
+### Trigger
+
+| Prop | Description | Type | Default |
+| -------------------------- | ------------------------------------------------------------------------- | ----------------------------------------- | ------------------ |
+| action | Actions that control popup visibility. | `ActionType` \| `ActionType[]` | `hover` |
+| afterOpenChange | Called after popup visibility changes. | `(visible) => void` | - |
+| afterPopupVisibleChange | Deprecated. Use `afterOpenChange` instead. | `(visible) => void` | - |
+| alignPoint | Align popup to mouse position for click, hover, and context menu actions. | `boolean` | `false` |
+| arrow | Render popup arrow. | `boolean` \| `ArrowType` | - |
+| autoDestroy | Destroy popup DOM when it is hidden. | `boolean` | `false` |
+| blurDelay | Delay before hiding on blur, in seconds. | `number` | - |
+| builtinPlacements | Named placement presets. | `BuildInPlacements` | `{}` |
+| defaultPopupVisible | Initial uncontrolled visibility. | `boolean` | `false` |
+| focusDelay | Delay before showing on focus, in seconds. | `number` | - |
+| forceRender | Render popup before it is first shown. | `boolean` | `false` |
+| fresh | Keep popup content updated while closed. | `boolean` | - |
+| getPopupClassNameFromAlign | Return a popup class name from the current alignment. | `(align) => string` | - |
+| getPopupContainer | Return the element that should contain the popup. | `(node) => HTMLElement` | - |
+| hideAction | Actions that hide popup visibility. | `ActionType[]` | - |
+| mask | Render a mask behind the popup. | `boolean` | `false` |
+| maskClosable | Close when clicking the mask. | `boolean` | `true` |
+| maskMotion | Motion config for the mask. | `CSSMotionProps` | - |
+| mouseEnterDelay | Delay before showing on mouse enter, in seconds. | `number` | - |
+| mouseLeaveDelay | Delay before hiding on mouse leave, in seconds. | `number` | `0.1` |
+| popup | Popup content. | `ReactNode` \| `() => ReactNode` | - |
+| popupAlign | Alignment config compatible with dom-align. | `AlignType` | - |
+| popupClassName | Class name added to popup. | `string` | - |
+| popupMotion | Motion config for the popup. | `CSSMotionProps` | - |
+| popupPlacement | Placement key from `builtinPlacements`. | `string` | - |
+| popupStyle | Inline popup style. | `React.CSSProperties` | - |
+| popupVisible | Controlled popup visibility. | `boolean` | - |
+| prefixCls | Popup class name prefix. | `string` | `rc-trigger-popup` |
+| showAction | Actions that show popup visibility. | `ActionType[]` | - |
+| stretch | Stretch popup width and/or height from target. | `string` | - |
+| unique | Share popup container through `UniqueProvider`. | `boolean` | - |
+| uniqueContainerClassName | Class name passed to `UniqueProvider` container. | `string` | - |
+| uniqueContainerStyle | Style passed to `UniqueProvider` container. | `React.CSSProperties` | - |
+| zIndex | Popup z-index. | `number` | - |
+| onOpenChange | Called when visibility changes. | `(visible) => void` | - |
+| onPopupAlign | Called when the popup is aligned. | `(element, align) => void` | - |
+| onPopupClick | Called when popup is clicked. | `React.MouseEventHandler` | - |
+| onPopupVisibleChange | Deprecated. Use `onOpenChange` instead. | `(visible) => void` | - |
## Development
-```
+```bash
npm install
npm start
+npm test
+npm run build
```
-## API
-
-### props
-
-
-
-
-
name
-
type
-
default
-
description
-
-
-
-
-
alignPoint
-
bool
-
false
-
Popup will align with mouse position (support action of 'click', 'hover' and 'contextMenu')
-
-
-
popupClassName
-
string
-
-
additional className added to popup
-
-
-
forceRender
-
boolean
-
false
-
whether render popup before first show
-
-
-
destroyPopupOnHide
-
boolean
-
false
-
whether destroy popup when hide
-
-
-
getPopupClassNameFromAlign
-
getPopupClassNameFromAlign(align: Object):String
-
-
additional className added to popup according to align
-
-
-
action
-
string[]
-
['hover']
-
which actions cause popup shown. enum of 'hover','click','focus','contextMenu'
-
-
-
mouseEnterDelay
-
number
-
0
-
delay time to show when mouse enter. unit: s.
-
-
-
mouseLeaveDelay
-
number
-
0.1
-
delay time to hide when mouse leave. unit: s.
-
-
-
popupStyle
-
Object
-
-
additional style of popup
-
-
-
prefixCls
-
String
-
rc-trigger-popup
-
prefix class name
-
-
-
popupTransitionName
-
String|Object
-
-
https://github.com/react-component/animate
-
-
-
maskTransitionName
-
String|Object
-
-
https://github.com/react-component/animate
-
-
-
onPopupVisibleChange
-
Function
-
-
call when popup visible is changed
-
-
-
mask
-
boolean
-
false
-
whether to support mask
-
-
-
maskClosable
-
boolean
-
true
-
whether to support click mask to hide
-
-
-
popupVisible
-
boolean
-
-
whether popup is visible
-
-
-
zIndex
-
number
-
-
popup's zIndex
-
-
-
defaultPopupVisible
-
boolean
-
-
whether popup is visible initially
-
-
-
popupAlign
-
Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align)
-
-
popup 's align config
-
-
-
onPopupAlign
-
function(popupDomNode, align)
-
-
callback when popup node is aligned
-
-
-
popup
-
React.Element | function() => React.Element
-
-
popup content
-
-
-
getPopupContainer
-
getPopupContainer(): HTMLElement
-
-
function returning html node which will act as popup container
-
-
-
getDocument
-
getDocument(): HTMLElement
-
-
function returning document node which will be attached click event to close trigger
-
-
-
popupPlacement
-
string
-
-
use preset popup align config from builtinPlacements, can be merged by popupAlign prop
-
-
-
builtinPlacements
-
object
-
-
builtin placement align map. used by placement prop
-
-
-
stretch
-
string
-
-
Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth')
-
-
-
+The dumi site runs at `http://localhost:8000` by default.
-## Test Case
+## Release
-```
-npm test
-npm run coverage
+```bash
+npm run prepublishOnly
```
-open coverage/ dir
+The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.
## License
-rc-trigger is released under the MIT license.
+@rc-component/trigger is released under the [MIT](./LICENSE) license.
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 00000000..4d82ce87
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,129 @@
+