From 33e8ff14f2146d859e68602b7abec8cfd1864fc0 Mon Sep 17 00:00:00 2001
From: afc163 🎯 Popup trigger and alignment primitive for React.
+
+ Part of the Ant Design ecosystem.@rc-component/trigger
+
+
+
](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 |
-
-## Example
-
-http://localhost:9001
-
-## Development
+Run the local dumi site to explore the examples:
-```
+```bash
npm install
npm start
```
## API
-### props
-
-
-
-
+### Trigger
+
+| Prop | Description | Type | Default |
+| -------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------- | ----------- |
+| action | Actions that control popup visibility. | `Array<'hover' \| 'click' \| 'focus' \| 'contextMenu'>` | `['hover']` |
+| alignPoint | Align popup to mouse position for click, hover, and context menu actions. | `boolean` | `false` |
+| autoDestroy | Destroy popup DOM when it is hidden. | `boolean` | `false` |
+| builtinPlacements | Named placement presets. | `BuildInPlacements` | - |
+| defaultPopupVisible | Initial uncontrolled visibility. | `boolean` | `false` |
+| destroyPopupOnHide | Destroy popup when it hides. | `boolean` | `false` |
+| forceRender | Render popup before it is first shown. | `boolean` | `false` |
+| getPopupContainer | Return the element that should contain the popup. | `() => HTMLElement` | - |
+| mask | Render a mask behind the popup. | `boolean` | `false` |
+| maskClosable | Close when clicking the mask. | `boolean` | `true` |
+| popup | Popup content. | `ReactNode` \| `() => ReactNode` | - |
+| popupAlign | Alignment config compatible with dom-align. | `AlignType` | - |
+| popupClassName | Class name added to popup. | `string` | - |
+| popupPlacement | Placement key from `builtinPlacements`. | `string` | - |
+| popupRender | Customize popup node before render. | `(node) => ReactNode` | - |
+| popupStyle | Inline popup style. | `React.CSSProperties` | - |
+| popupVisible | Controlled popup visibility. | `boolean` | - |
+| stretch | Stretch popup width and/or height from target. | `'width'` \| `'minWidth'` \| `'height'` \| `'minHeight'` | - |
+| zIndex | Popup z-index. | `number` | - |
+| onPopupAlign | Called when the popup is aligned. | `(element, align) => void` | - |
+| onPopupVisibleChange | Called when visibility changes. | `(visible) => void` | - |
-## Test Case
+## Development
-```
+```bash
+npm install
+npm start
npm test
-npm run coverage
+npm run tsc
+npm run compile
+npm run build
```
-open coverage/ dir
+## Release
+
+The release flow is handled by `@rc-component/np` from the `prepublishOnly` script:
+
+```bash
+npm publish
+```
## License
-rc-trigger is released under the MIT license.
+@rc-component/trigger is released under the MIT license.
diff --git a/docs/index.md b/docs/index.md
index 6e9e0db6..ba7bad47 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,7 +1,5 @@
---
-hero:
- title: rc-trigger
- description: React Trigger Component
+title: '@rc-component/trigger'
---
diff --git a/now.json b/now.json
deleted file mode 100644
index 716cff0a..00000000
--- a/now.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "version": 2,
- "name": "rc-trigger",
- "builds": [
- {
- "src": "package.json",
- "use": "@now/static-build",
- "config": { "distDir": ".doc" }
- }
- ]
-}
diff --git a/package.json b/package.json
index 14261ed3..231feeba 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rc-component/trigger",
"version": "3.9.1",
- "description": "base abstract trigger component for react",
+ "description": "Popup trigger and alignment primitive for React.",
"engines": {
"node": ">=8.x"
},
@@ -30,15 +30,19 @@
"main": "./lib/index",
"module": "./es/index",
"scripts": {
- "start": "dumi dev",
- "build": "dumi build",
+ "build": "npm run compile && npm run docs:build",
"compile": "father build && lessc assets/index.less assets/index.css",
- "prepublishOnly": "npm run compile && rc-np",
+ "coverage": "rc-test --coverage",
+ "docs:build": "dumi build",
+ "docs:deploy": "gh-pages -d docs-dist",
+ "deploy": "npm run gh-pages",
+ "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
+ "prepublishOnly": "npm run compile && rc-np",
+ "prettier": "prettier --write --ignore-unknown .",
+ "start": "dumi dev",
"test": "rc-test",
- "prettier": "prettier --write .",
- "coverage": "rc-test --coverage",
- "now-build": "npm run build"
+ "tsc": "tsc --noEmit"
},
"dependencies": {
"@rc-component/motion": "^1.3.3",
@@ -67,7 +71,8 @@
"react": "^19.2.7",
"react-dom": "^19.2.7",
"regenerator-runtime": "^0.14.1",
- "typescript": "~5.9.3"
+ "typescript": "~5.9.3",
+ "gh-pages": "^6.3.0"
},
"peerDependencies": {
"react": ">=18.0.0",
diff --git a/tsconfig.json b/tsconfig.json
index c5605081..6a1a20fa 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,7 +12,12 @@
"paths": {
"@/*": ["src/*"],
"@@/*": [".dumi/tmp/*"],
- "@rc-component/trigger": ["src/index.tsx"]
+ "@rc-component/trigger": ["src/index.tsx"],
+ "@rc-component/trigger/es": ["src"],
+ "@rc-component/trigger/es/*": ["src/*"],
+ "@rc-component/trigger/assets/*": ["assets/*"]
}
- }
+ },
+ "include": [".dumirc.ts", "src", "tests", "docs/examples"],
+ "exclude": ["docs-dist", "lib", "es"]
}
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 00000000..5f9139ef
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,6 @@
+{
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist"
+}
From 482a3e93bcf03103aa5f834ac50f89fc850f349c Mon Sep 17 00:00:00 2001
From: afc163
-
-
-
- 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')
-
Part of the Ant Design ecosystem.
+Part of the Ant Design ecosystem.
Part of the Ant Design ecosystem. 🎯 Popup trigger and alignment primitive for React.
-
- Part of the Ant Design ecosystem.
From 25271df1f204813c8fef5fe20c19b0991e4fec0f Mon Sep 17 00:00:00 2001
From: afc163
@rc-component/trigger
+
-
-
English | 简体中文
+ ## Highlights diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 00000000..c287bcb0 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,124 @@ + + +English | 简体中文
+ + +## 特性 + +- Built for React and maintained by the rc-component team. +- 被 Ant Design 使用和其他 React 组件库使用。 +- 提供 TypeScript declarations with both ES module and CommonJS outputs. +- 保留 examples, tests, and preview builds aligned with the package source. + +## 安装 + +```bash +npm install @rc-component/trigger +``` + +## 使用 + +```tsx +import Trigger from '@rc-component/trigger'; +import '@rc-component/trigger/assets/index.css'; + +export default () => ( +Part of the Ant Design ecosystem.
+🎯 Popup trigger and alignment primitive for React.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index c287bcb0..11a5fd8c 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,6 +1,7 @@
Ant Design 生态的一部分。
+🎯 React 弹层触发基础组件,支持定位、对齐、动画和事件触发。
Part of the Ant Design ecosystem. 🎯 Popup trigger and alignment primitive for React.
Ant Design 生态的一部分。 🎯 React 弹层触发基础组件,支持定位、对齐、动画和事件触发。
🎯 Popup trigger and alignment primitive for React. 🎯 React 弹层触发基础组件,支持定位、对齐、动画和事件触发。
From 41000720af3dd662ac0bd36d6d4d9d7cad52c055 Mon Sep 17 00:00:00 2001
From: afc163
@rc-component/trigger
-
+
Part of the Ant Design ecosystem.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 11a5fd8c..4bf47864 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,7 +1,6 @@
@rc-component/trigger
-
+
Ant Design 生态的一部分。
@@ -18,10 +17,10 @@
## 特性
-- Built for React and maintained by the rc-component team.
+- 面向 React 构建,并由 rc-component 团队维护。
- 被 Ant Design 使用和其他 React 组件库使用。
-- 提供 TypeScript declarations with both ES module and CommonJS outputs.
-- 保留 examples, tests, and preview builds aligned with the package source.
+- 提供 TypeScript 类型声明,同时输出 ES module 和 CommonJS 产物。
+- 示例、测试和预览构建与包源码保持一致。
## 安装
@@ -51,7 +50,7 @@ export default () => (
## 示例
-Run the local dumi site to explore the examples:
+运行本地 dumi 站点查看示例:
```bash
npm install
@@ -64,44 +63,44 @@ npm start
| 属性 | 说明 | 类型 | 默认值 |
| -------------------------- | ------------------------------------------------------------------------- | ----------------------------------------- | ------------------ |
-| 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
@rc-component/trigger
Part of the Ant Design ecosystem.
@rc-component/trigger
Ant Design 生态的一部分。