Skip to content

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Sep 26, 2025

Summary by CodeRabbit

  • Refactor
    • 将 Tooltip/Popup 的样式语义由 body 重命名为 container,影响 classNames 与 styles 的键位与挂载元素,相关 uniqueBody → uniqueContainer。
  • Documentation
    • 更新 README 与示例文档,调整公开属性说明以反映 container 键位与新的 prop 形状(classNames/styles 的 root/container)。
  • Tests
    • 同步更新测试用例与选择器至 container,确保断言与新语义一致。
  • Chores
    • 升级触发器依赖版本以保持兼容性。

Copy link

vercel bot commented Sep 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tooltip Ready Ready Preview Comment Sep 26, 2025 9:50am

Copy link

coderabbitai bot commented Sep 26, 2025

Warning

Rate limit exceeded

@zombieJ has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6f730b2 and f0b1fc3.

📒 Files selected for processing (3)
  • package.json (2 hunks)
  • src/Tooltip.tsx (2 hunks)
  • tests/index.test.tsx (8 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

将组件样式语义键从 body 重命名为 container:更新了 README、示例、Popup 渲染和 Tooltip 的 SemanticName 类型,并同步调整了测试与相关样式/类名引用,未改变控制流或其他逻辑。

Changes

Cohort / File(s) Change Summary
文档
README.md
在 Props 文档中将 classNames / styles 的键从 body 改为 container(包括示例说明)。
示例
docs/examples/*
docs/examples/placement.tsx, docs/examples/point.tsx, docs/examples/simple.tsx
将示例中对 Tooltip/Popup 的 classNames.body / styles.body 替换为 classNames.container / styles.container,调整选择器与样式目标。
核心组件
src/Tooltip.tsx, src/Popup.tsx
Tooltip: 将 SemanticName 中的 'body'/'uniqueBody' 重命名为 'container'/'uniqueContainer',并将相关 uniqueBg 映射改为 uniqueContainer;Popup: 渲染时使用 ${prefixCls}-containerclassNames?.containerstyles?.container
测试
tests/index.test.tsx
将测试中对类名/选择器/键的引用从 body/uniqueBody 更新为 container/uniqueContainer(包括 rc-tooltip-container)。
依赖
package.json
升级 @rc-component/trigger^3.6.7^3.6.15

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • afc163

Poem

小兔轻跳报更名,body 变 container 闪;
类名样式悄迁步,示例测试同声赞;
代码不改走向静,依赖小升心欢颜。 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive 该标题虽指出进行了重构并提到“重命名”为 container,但未说明具体重命名的对象或属性名称,使得阅读者难以快速理解此 PR 的核心修改内容。 建议将标题修改为“refactor: rename classNames/styles key 'body' to 'container'”,以便明确传达此次重构将 Tooltip 和 Popup 中的 body 键重命名为 container 的具体变动。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Summary of Changes

Hello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a refactoring effort to enhance the semantic clarity and consistency of the tooltip component's internal naming. By renaming the 'body' concept to 'container', the changes aim to provide a more intuitive and accurate representation of the component's structure, impacting prop definitions, internal logic, documentation, and test coverage.

Highlights

  • Refactor Naming Convention: The primary change involves renaming the semantic term 'body' to 'container' for the main content area of the tooltip component. This affects both classNames and styles properties.
  • Documentation and Type Updates: The README.md has been updated to reflect the new container naming in the classNames and styles prop definitions. The SemanticName type in src/Tooltip.tsx was also updated accordingly.
  • Example and Test Case Adjustments: All relevant example files (docs/examples/placement.tsx, docs/examples/point.tsx, docs/examples/simple.tsx) and test cases (tests/index.test.tsx) have been modified to use the new container naming, ensuring consistency and correctness.
  • Internal Component Logic Update: The src/Popup.tsx component now applies classes and styles to the tooltip's main element using the container nomenclature instead of body.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

socket-security bot commented Sep 26, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

Copy link

codecov bot commented Sep 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0228bed) to head (f0b1fc3).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #505   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           37        37           
  Branches        15        15           
=========================================
  Hits            37        37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the component by renaming the body property to container across the codebase, including props, types, and class names. The changes are consistent and correctly applied. I've added a couple of suggestions to improve documentation and test clarity following this refactoring.

Comment on lines +95 to +96
| classNames | classNames?: { root?: string; container?: string;}; | | Semantic DOM class |
| styles | styles?: {root?: React.CSSProperties;container?: React.CSSProperties;}; | | Semantic DOM styles |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The documentation for classNames and styles is incomplete. It should also include arrow and uniqueBody as possible keys, according to the SemanticName type in src/Tooltip.tsx.

Suggested change
| classNames | classNames?: { root?: string; container?: string;}; | | Semantic DOM class |
| styles | styles?: {root?: React.CSSProperties;container?: React.CSSProperties;}; | | Semantic DOM styles |
| classNames | classNames?: { root?: string; container?: string; arrow?: string; uniqueBody?: string; }; | | Semantic DOM class |
| styles | styles?: { root?: React.CSSProperties; container?: React.CSSProperties; arrow?: React.CSSProperties; uniqueBody?: React.CSSProperties; }; | | Semantic DOM styles |

const customClassNames = {
root: 'custom-root',
body: 'custom-body',
container: 'custom-body',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The class name 'custom-body' is a remnant of the pre-refactor naming and is now misleading. For consistency and clarity, please rename it to 'custom-container'. This applies to other tests in this file as well. You'll also need to update the corresponding assertions to check for this new class name.

Suggested change
container: 'custom-body',
container: 'custom-container',


const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement;
const tooltipBodyElement = container.querySelector('.rc-tooltip-body') as HTMLElement;
const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variable name tooltipBodyElement is now misleading since it queries for .rc-tooltip-container. For better code clarity and maintainability, consider renaming it to tooltipContainerElement and updating its usages accordingly. This applies to all tests where this variable is used in this file.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/index.test.tsx (1)

442-462: 命名一致性:unique-body-class → unique-container-class

既然已从 uniqueBody 迁移为 uniqueContainer,测试类名也建议同步,避免混淆。

-              classNames={{ uniqueContainer: 'unique-body-class' }}
+              classNames={{ uniqueContainer: 'unique-container-class' }}
src/Tooltip.tsx (1)

157-160: 确认 Trigger 支持 uniqueBg 属性,并可微调书写以降噪*

当前通过 as any 透传 uniqueBgClassName/uniqueBgStyle OK,但请确认依赖版本已支持;另外可去掉多余括号,稍降可读性噪音。

建议微调为:

-      {...(({
-        uniqueBgClassName: classNames?.uniqueContainer,
-        uniqueBgStyle: styles?.uniqueContainer,
-      } as any))}
+      {...({
+        uniqueBgClassName: classNames?.uniqueContainer,
+        uniqueBgStyle: styles?.uniqueContainer,
+      } as any)}

并参考 package.json 评论确认 @rc-component/trigger 版本具备该能力。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ee6ffd and 93f89a1.

📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/Tooltip.tsx (2 hunks)
  • tests/index.test.tsx (10 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/index.test.tsx (1)
docs/examples/simple.tsx (1)
  • render (112-227)
🔇 Additional comments (10)
tests/index.test.tsx (9)

322-322: 将自定义类名从 custom-body 统一重命名为 custom-container

与“container”语义保持一致,避免遗留“body”命名混淆。

建议改成:

-        container: 'custom-body',
+        container: 'custom-container',

338-345: 变量名与查询选择器不一致:tooltipBodyElement → tooltipContainerElement

当前选择器为 .rc-tooltip-container,变量名建议同步为 container,提升可读性。

-      const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
+      const tooltipContainerElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
@@
-      expect(tooltipBodyElement).toHaveClass('custom-body');
+      expect(tooltipContainerElement).toHaveClass('custom-container');

361-367: 同上:重命名变量并同步断言

与 container 语义保持一致。

-      const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
+      const tooltipContainerElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
@@
-      expect(tooltipBodyElement).toHaveStyle({ color: 'red', fontSize: '14px' });
+      expect(tooltipContainerElement).toHaveStyle({ color: 'red', fontSize: '14px' });

373-373: 统一类名:custom-body → custom-container

保持与“container”语义一致。

-        container: 'custom-body',
+        container: 'custom-container',

396-405: 重命名变量并同步断言内容与类名

与 container 语义保持一致。

-      const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
+      const tooltipContainerElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
@@
-      expect(tooltipBodyElement).toHaveClass('custom-body');
-      expect(tooltipBodyElement).toHaveStyle({ color: 'red' });
+      expect(tooltipContainerElement).toHaveClass('custom-container');
+      expect(tooltipContainerElement).toHaveStyle({ color: 'red' });

410-410: 统一类名:custom-body → custom-container

保持与“container”语义一致。

-        container: 'custom-body',
+        container: 'custom-container',

430-436: 重命名变量并同步断言类名

与 container 语义保持一致。

-      const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
+      const tooltipContainerElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
@@
-      expect(tooltipBodyElement).toHaveClass('custom-body');
+      expect(tooltipContainerElement).toHaveClass('custom-container');

468-468: 统一类名:custom-body → custom-container

保持与“container”语义一致。

-        container: 'custom-body',
+        container: 'custom-container',

491-501: 重命名变量并同步断言类名

与 container 语义保持一致。

-      const tooltipBodyElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
+      const tooltipContainerElement = container.querySelector('.rc-tooltip-container') as HTMLElement;
@@
-      expect(tooltipBodyElement).toHaveClass('custom-body');
-      expect(tooltipBodyElement).toHaveStyle({ color: 'red' });
+      expect(tooltipContainerElement).toHaveClass('custom-container');
+      expect(tooltipContainerElement).toHaveStyle({ color: 'red' });
src/Tooltip.tsx (1)

11-11: 语义键重命名对齐:container/uniqueContainer

类型层面的改名清晰到位,便于外部 API 一致性维护。

},
"dependencies": {
"@rc-component/trigger": "^3.6.7",
"@rc-component/trigger": "^3.6.15",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

依赖升级合理,但请确认 Trigger 新增属性可用性

升级到 @rc-component/trigger@^3.6.15 看起来是为支持 uniqueBgClassName/uniqueBgStyle 映射。为避免运行期无效属性导致样式不生效,请确认该版本已正式暴露这两个属性。

请用以下 Web 查询确认属性支持与变更日志:


🌐 Web query:

Does @rc-component/trigger v3.6.15 support props `uniqueBgClassName` and `uniqueBgStyle` on Trigger? Provide release notes or code references.

💡 Result:

Short answer: No — @rc-component/trigger (v3.x) does not expose props named uniqueBgClassName or uniqueBgStyle. The component's documented props (README / API) do not list those props. [1]

References:

  • Repository README / API props list for @rc-component/trigger (does not include uniqueBgClassName / uniqueBgStyle). [1]
  • Releases / tags for react-component/trigger (v3.x series). [2]

Sources:
[1] react-component/trigger — README API (props list). (github.com)
[2] react-component/trigger — Releases / tags. (github.com)

If you want, I can search specific release (3.6.15) source files (index.tsx / prop types) and paste the exact code lines from that tag.

Citations:


移除或替换 uniqueBgClassName/uniqueBgStyle,Trigger v3.6.15 未暴露该 props
经核实,v3.x 系列 API 文档和 Release Notes 均未列出这两个属性,运行时会无效。请移除或替换为受支持的属性。

🤖 Prompt for AI Agents
package.json lines 44–44: the dependency "@rc-component/trigger": "^3.6.15"
points to a version that does not expose uniqueBgClassName/uniqueBgStyle; locate
any usages of uniqueBgClassName and uniqueBgStyle in the codebase and remove
them (or replace with supported alternatives such as applying className/style to
the trigger's child, overlay/popup container, or the library's documented
overlayClassName/overlayStyle prop), then ensure tests/build pass; do not try to
rely on those props for v3.x — if you truly need those props instead of
refactoring, change the dependency to a verified version that documents and
supports them and update package.json accordingly.

Copy link

socket-security bot commented Sep 26, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedprettier@​3.6.29910010090100

View full report

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/Tooltip.tsx (1)

11-11: 公开类型重命名可能带来破坏性变更;建议提供平滑迁移(兼容旧键)

将 'body'/'uniqueBody' 重命名为 'container'/'uniqueContainer' 会立即破坏依赖老键的使用者(运行时不会自动映射)。建议在一个小版本周期内同时兼容旧键,并做运行时规范化映射。

最小改动建议:

  • 类型暂时同时接受新旧键(便于用户升级且不阻断编译):
-export type SemanticName = 'root' | 'arrow' | 'container' | 'uniqueContainer';
+export type SemanticName =
+  | 'root'
+  | 'arrow'
+  | 'container'
+  | 'uniqueContainer'
+  | 'body'              // legacy
+  | 'uniqueBody';       // legacy
  • 在运行时归一化 classNames/styles(放在 props 解构后),以确保旧键仍能生效(支持迁移期):
const normalizedClassNames = React.useMemo(() => ({
  ...classNames,
  container: classNames?.container ?? (classNames as any)?.body,
  uniqueContainer: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
}), [classNames]);

const normalizedStyles = React.useMemo(() => ({
  ...styles,
  container: styles?.container ?? (styles as any)?.body,
  uniqueContainer: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
}), [styles]);

并在 JSX 中改为:

<Popup
  ...
  classNames={normalizedClassNames}
  styles={normalizedStyles}
>

可选:开发环境下对使用旧键打印一次性 deprecate 警告,便于用户发现和迁移。

请同时确认本 PR 的发版语义(若不做兼容,应按 semver 主版本发布并在变更日志/README 明示)。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93f89a1 and 6f730b2.

📒 Files selected for processing (2)
  • src/Tooltip.tsx (2 hunks)
  • tests/index.test.tsx (10 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/index.test.tsx (1)
docs/examples/simple.tsx (1)
  • render (112-227)
🔇 Additional comments (2)
tests/index.test.tsx (2)

320-324: 统一命名以匹配 container 语义

当前几处测试仍然把 container 的自定义 class 命名为 custom-body,与新版语义不符,容易误导后续维护者。建议顺手替换为 custom-container(以及相应断言),并同步更新测试数据,保证用例语义与实现一致。

Also applies to: 372-374, 409-412, 466-474


338-340: 变量名应反映容器语义

这些变量依旧叫 tooltipBodyElement,但现在查询的是 .rc-tooltip-container。沿用旧名会造成理解偏差,建议改成 tooltipContainerElement 并更新引用,以便测试代码更准确地表达新的 DOM 结构。

Also applies to: 361-362, 396-397, 430-431, 490-491

src/Tooltip.tsx Outdated
Comment on lines 157 to 160
{...(({
uniqueContainerClassName: classNames?.uniqueContainer,
uniqueContainerStyle: styles?.uniqueContainer,
} as any))}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

uniqueContainer 透传依赖 rc-trigger 新接口;建议临时桥接与类型增强,避免回归*

这里通过 as any 向 Trigger 透传 uniqueContainerClassName/Style。若下游 rc-trigger 尚未发布相应属性,功能会静默失效(此前的 uniqueBg* 也会随之失效)。建议:

  • 迁移期同时透传新旧两套 prop(新优先),保障双向兼容;
  • 用模块声明合并为 TriggerProps 增补类型,避免 as any。

兼容性透传最小 diff(仅替换该块):

-      {...(({
-        uniqueContainerClassName: classNames?.uniqueContainer,
-        uniqueContainerStyle: styles?.uniqueContainer,
-      } as any))}
+      {...(({
+        // New API (prefer)
+        uniqueContainerClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
+        uniqueContainerStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
+        // Back-compat for older rc-trigger
+        uniqueBgClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
+        uniqueBgStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
+      } as any))}

类型增强(新增 ambient 声明文件 types/rc-trigger-aug.d.ts):

declare module '@rc-component/trigger/lib/interface' {
  interface TriggerProps {
    uniqueContainerClassName?: string;
    uniqueContainerStyle?: React.CSSProperties;
    uniqueBgClassName?: string;
    uniqueBgStyle?: React.CSSProperties;
  }
}

核验脚本:确认仓库使用的 @rc-component/trigger 版本,并检索仓库内对相关键的使用是否一致。

如需对下游库进行在线确认,请搜索:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Package version of @rc-component/trigger:"
if [ -f package.json ]; then
  rg -nP '"@rc-component/trigger"\s*:\s*".*"' package.json || true
fi

echo
echo "Scan code for uniqueContainer*/uniqueBg* and legacy keys to ensure consistent rename:"
rg -nP -C2 --type=ts 'unique(Container|Bg)(ClassName|Style)|classNames\?\.(unique(Container|Body))|styles\?\.(unique(Container|Body))'

Length of output: 846


🌐 Web query:

Does @rc-component/trigger support props `uniqueContainerClassName` and `uniqueContainerStyle` (and were they formerly `uniqueBgClassName` / `uniqueBgStyle`)? Provide the first version that introduced the new props.

💡 Result:

I can't find evidence that @rc-component/trigger exposes props named uniqueContainerClassName / uniqueContainerStyle (or formerly uniqueBgClassName / uniqueBgStyle). The package docs/readme and published API lists do not show those props. [1][2]

If you want, I can continue searching the package source/commit history (or check specific versions) to try to find the exact PR/first version that added them. Which would you prefer?

Sources:

  • @rc-component/trigger npm README / props (package page). [1]
  • GitHub repo code search (no matches for "uniqueContainerClassName" / "uniqueBgClassName"). [2]

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Display the test around uniqueContainer mapping
sed -n '430,470p' tests/index.test.tsx

Length of output: 1646


同时透传新旧 uniqueContainer*/uniqueBg* Props,增强类型声明

  • 当前依赖的 @rc-component/trigger@^3.6.15 尚未支持 uniqueContainerClassName/uniqueContainerStyle,会被忽略
  • 建议按下述最小 diff 在 spread 中同时传递旧 API (uniqueBgClassName/uniqueBgStyle) 和新 API,优先使用新属性:
-      {...(({
-        uniqueContainerClassName: classNames?.uniqueContainer,
-        uniqueContainerStyle: styles?.uniqueContainer,
-      } as any))}
+      {...(({
+        uniqueContainerClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
+        uniqueContainerStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
+        uniqueBgClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
+        uniqueBgStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
+      } as any))}
  • 使用 module declaration 为 TriggerProps 补充四个字段,移除 as any
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{...(({
uniqueContainerClassName: classNames?.uniqueContainer,
uniqueContainerStyle: styles?.uniqueContainer,
} as any))}
{...(({
uniqueContainerClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
uniqueContainerStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
uniqueBgClassName: classNames?.uniqueContainer ?? (classNames as any)?.uniqueBody,
uniqueBgStyle: styles?.uniqueContainer ?? (styles as any)?.uniqueBody,
} as any))}
🤖 Prompt for AI Agents
In src/Tooltip.tsx around lines 157 to 160, the spread currently casts to any
and only passes new uniqueContainer* props which are ignored by older
@rc-component/trigger versions; update the spread to include both new
(uniqueContainerClassName/uniqueContainerStyle) and legacy
(uniqueBgClassName/uniqueBgStyle) props, preferring the new values when present,
and remove the "as any" cast. Also add a module declaration to augment
TriggerProps with all four fields (uniqueContainerClassName,
uniqueContainerStyle, uniqueBgClassName, uniqueBgStyle) so types are correct and
you can drop the any cast.

@zombieJ zombieJ merged commit 91ec132 into master Sep 26, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant