{"name":"@rc-component/trigger","version":"3.6.2","keywords":["react","react-component","react-trigger","trigger"],"author":"","license":"MIT","_id":"@rc-component/trigger@3.6.2","maintainers":[{"name":"zombiej","email":"smith3816@gmail.com"},{"name":"afc163","email":"afc163@gmail.com"},{"name":"madccc","email":"1075746765@qq.com"},{"name":"peachscript","email":"scdzwyxst@gmail.com"},{"name":"chenshuai2144","email":"wasd2144@hotmail.com"}],"homepage":"https://github.com/react-component/trigger","bugs":{"url":"https://github.com/react-component/trigger/issues"},"dist":{"shasum":"e7b37f69968e779ed461f7f1ebb3edd62bca47f0","tarball":"http://registry-npm.ywwl.com/@rc-component/trigger/download/@rc-component/trigger-3.6.2.tgz","fileCount":83,"integrity":"sha512-SQNCmmfEhIruHsLFNDi1MrzS8Zekz+OEUc64nieCOZjtqpAuYe94pOy3aFZt7YPtLr0qijXVi7NQkGy1/7CWIw==","signatures":[{"sig":"MEUCIHFCyiBSanfG0Cm6EAtc02vGqDJaIvO2vf6EVkZpyDciAiEA/75ZqTgQu+ZBpHTDx0OCFzi6GBvwee6y+8mm72+S8+4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":205997,"size":34615,"noattachment":false,"key":"/@rc-component/trigger/-/@rc-component/trigger-3.6.2.tgz"},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","engines":{"node":">=8.x"},"gitHead":"22d4f010d344ff9ae77673a0a2d74f3b2bac6376","scripts":{"lint":"eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js","test":"rc-test","build":"dumi build","start":"dumi dev","compile":"father build && lessc assets/index.less assets/index.css","coverage":"rc-test --coverage","prettier":"prettier --write .","now-build":"npm run build","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+https://github.com/react-component/trigger.git","type":"git"},"_npmVersion":"10.9.2","description":"base abstract trigger component for react","directories":{},"_nodeVersion":"22.15.1","dependencies":{"classnames":"^2.3.2","@rc-component/util":"^1.2.1","@rc-component/motion":"^1.1.4","@rc-component/portal":"^2.0.0","@rc-component/resize-observer":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.1.0","less":"^4.2.0","react":"^19.1.0","eslint":"^8.51.0","father":"^4.0.0","rc-test":"^7.0.13","prettier":"^3.3.3","cross-env":"^7.0.1","react-dom":"^19.1.0","typescript":"~5.1.6","@types/jest":"^29.5.2","@types/node":"^24.0.3","@types/react":"^19.1.2","@umijs/fabric":"^4.0.1","@rc-component/np":"^1.0.3","@types/react-dom":"^19.1.2","@types/classnames":"^2.2.10","regenerator-runtime":"^0.14.0","@testing-library/react":"^16.0.0","@testing-library/jest-dom":"^6.1.4","@rc-component/father-plugin":"^2.0.0"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/trigger_3.6.2_1758100252539_0.7087244231496983","host":"s3://npm-registry-packages-npm-production"},"readme":"<div align=\"center\">\n  <h1>@rc-component/trigger</h1>\n  <p><sub><a href=\"https://ant.design\"><img alt=\"Ant Design\" height=\"14\" src=\"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg\" style=\"vertical-align: -0.125em;\" /></a> Ant Design 生态的一部分。</sub></p>\n  <p>🎯 React 弹层触发基础组件，支持定位、对齐、动画和事件触发。</p>\n\n  <p>\n    <a href=\"https://npmjs.org/package/@rc-component/trigger\"><img alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@rc-component/trigger.svg?style=flat-square\"></a>\n    <a href=\"https://npmjs.org/package/@rc-component/trigger\"><img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/@rc-component/trigger.svg?style=flat-square\"></a>\n    <a href=\"https://github.com/react-component/trigger/actions/workflows/react-component-ci.yml\"><img alt=\"build status\" src=\"https://github.com/react-component/trigger/actions/workflows/react-component-ci.yml/badge.svg\"></a>\n    <a href=\"https://app.codecov.io/gh/react-component/trigger\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/react-component/trigger/master.svg?style=flat-square\"></a>\n    <a href=\"https://bundlephobia.com/package/@rc-component/trigger\"><img alt=\"bundle size\" src=\"https://img.shields.io/bundlephobia/minzip/@rc-component/trigger?style=flat-square\"></a>\n    <a href=\"https://github.com/umijs/dumi\"><img alt=\"dumi\" src=\"https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square\"></a>\n  </p>\n</div>\n\n<p align=\"center\"><a href=\"./README.md\">English</a> | 简体中文</p>\n\n\n## 特性\n\n- 面向 React 构建，并由 rc-component 团队维护。\n- 被 Ant Design 使用和其他 React 组件库使用。\n- 提供 TypeScript 类型声明，同时输出 ES module 和 CommonJS 产物。\n- 示例、测试和预览构建与包源码保持一致。\n\n## 安装\n\n```bash\nnpm install @rc-component/trigger\n```\n\n## 使用\n\n```tsx\nimport Trigger from '@rc-component/trigger';\nimport '@rc-component/trigger/assets/index.css';\n\nexport default () => (\n  <Trigger\n    action={['click']}\n    popup={<span>Popup content</span>}\n    popupAlign={{\n      points: ['tl', 'bl'],\n      offset: [0, 4],\n    }}\n  >\n    <button type=\"button\">Open</button>\n  </Trigger>\n);\n```\n\n## 示例\n\n运行本地 dumi 站点：\n\n```bash\nnpm install\nnpm start\n```\n\n然后打开 `http://localhost:8000`。\n\n## API\n\n### Trigger\n\n| 属性 | 说明 | 类型 | 默认值 |\n| -------------------------- | ------------------------------------------------------------------------- | ----------------------------------------- | ------------------ |\n| action                     | 控制弹层显示状态的触发行为。                                    | `ActionType` \\| `ActionType[]`            | `hover`            |\n| afterOpenChange            | 弹层窗口可见性更改后调用。                                    | `(visible) => void`                       | -                  |\n| afterPopupVisibleChange    | 已废弃。请使用 `afterOpenChange`。                                | `(visible) => void`                       | -                  |\n| alignPoint                 | 将弹层对齐到 `click`、`hover` 和 `context menu` 行为的鼠标位置。 | `boolean`                                 | `false`            |\n| arrow                      | 渲染弹层箭头。                                                       | `boolean` \\| `ArrowType`                  | -                  |\n| autoDestroy                | 弹层隐藏时销毁弹层 DOM。                                      | `boolean`                                 | `false`            |\n| blurDelay                  | `blur` 后隐藏前的延迟，单位为秒。                                  | `number`                                  | -                  |\n| builtinPlacements          | 命名位置预设。                                                  | `BuildInPlacements`                       | `{}`               |\n| defaultPopupVisible        | 非受控初始显示状态。                                          | `boolean`                                 | `false`            |\n| disabled                   | 临时隐藏弹层，但不主动重置当前打开状态。                       | `boolean`                                 | `false`            |\n| focusDelay                 | `focus` 后显示前的延迟，单位为秒。                                | `number`                                  | -                  |\n| forceRender                | 首次显示前渲染弹层。                                    | `boolean`                                 | `false`            |\n| fresh                      | 关闭时仍保持弹层内容更新。                                  | `boolean`                                 | -                  |\n| getPopupClassNameFromAlign | 根据当前对齐信息返回弹层 className。                     | `(align) => string`                       | -                  |\n| getPopupContainer          | 返回弹层挂载容器元素。                         | `(node) => HTMLElement`                   | -                  |\n| hideAction                 | 隐藏弹层的触发行为。                                       | `ActionType[]`                            | -                  |\n| mask                       | 在弹层后渲染遮罩。                                           | `boolean`                                 | `false`            |\n| maskClosable               | 点击遮罩时关闭。                                             | `boolean`                                 | `true`             |\n| maskMotion                 | 遮罩动画配置。                                               | `CSSMotionProps`                          | -                  |\n| mouseEnterDelay            | mouse enter 后显示前的延迟，单位为秒。                          | `number`                                  | -                  |\n| mouseLeaveDelay            | 鼠标离开后隐藏前的延迟，单位为秒。                           | `number`                                  | `0.1`              |\n| popup                      | 弹层内容。                                                            | `ReactNode` \\| `() => ReactNode`          | -                  |\n| popupAlign                 | 与 dom-align 兼容的对齐配置。                               | `AlignType`                               | -                  |\n| popupClassName             | 添加到弹层的 className。                                                | `string`                                  | -                  |\n| popupMotion                | 弹层动画配置。                                              | `CSSMotionProps`                          | -                  |\n| popupPlacement             | 来自 `builtinPlacements` 的位置 key。                                   | `string`                                  | -                  |\n| popupStyle                 | 弹层内联样式。                                                       | `React.CSSProperties`                     | -                  |\n| popupVisible               | 受控的弹层窗口可见性。                                              | `boolean`                                 | -                  |\n| prefixCls                  | 弹层 className 前缀。                                                  | `string`                                  | `rc-trigger-popup` |\n| showAction                 | 显示弹层的触发行为。                                       | `ActionType[]`                            | -                  |\n| stretch                    | 根据目标拉伸弹层宽度和/或高度。                            | `string`                                  | -                  |\n| unique                     | 通过 `UniqueProvider` 共享弹层容器。                           | `boolean`                                 | -                  |\n| uniqueContainerClassName   | 传给 `UniqueProvider` 容器的 className。                          | `string`                                  | -                  |\n| uniqueContainerStyle       | 传给 `UniqueProvider` 容器的样式。                               | `React.CSSProperties`                     | -                  |\n| zIndex                     | 弹层 z 索引。                                                            | `number`                                  | -                  |\n| onOpenChange               | 当可见性发生变化时调用。                                           | `(visible) => void`                       | -                  |\n| onPopupAlign               | 弹层完成对齐时调用。                                         | `(element, align) => void`                | -                  |\n| onPopupClick               | 点击弹层时调用。                                             | `React.MouseEventHandler<HTMLDivElement>` | -                  |\n| onPopupVisibleChange       | 已废弃。请使用 `onOpenChange`。                                   | `(visible) => void`                       | -                  |\n\n## 本地开发\n\n```bash\nnpm install\nnpm start\nnpm test\nnpm run build\n```\n\ndumi 站点默认运行在 `http://localhost:8000`。\n\n## 发布\n\n```bash\nnpm run prepublishOnly\n```\n\n包构建完成后，发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。\n\n## 许可证\n\n@rc-component/trigger 基于 [MIT](./LICENSE) 许可证发布。\n","publish_time":1758100252701,"_cnpm_publish_time":1758100252701,"dist-tags":{"latest":"3.10.1","legacy":"2.3.1"}}