-
-
Notifications
You must be signed in to change notification settings - Fork 198
feat: semantic add uniqueBody #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Note Other AI code review bot(s) detectedCodeRabbit 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将 Tooltip 的语义名集合扩展为包含 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Consumer
participant UniqueProvider
participant Tooltip
participant Trigger
participant DOM
Consumer->>UniqueProvider: 包裹 Tooltip(unique 场景)
UniqueProvider->>Tooltip: 提供 unique 上下文
Consumer->>Tooltip: 传入 classNames/styles(含 uniqueBody)
Tooltip->>Trigger: 透传 uniqueBgClassName = classNames.uniqueBody
Tooltip->>Trigger: 透传 uniqueBgStyle = styles.uniqueBody
Trigger->>DOM: 渲染带有 unique 背景的内容
note right of DOM: 渲染结果包含 `uniqueBody` 样式与类名
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
此拉取请求为 Tooltip
组件引入了一个新的 uniqueBody
语义配置选项,允许开发者将特定的类名和样式应用于工具提示主体的独特部分。此增强功能为自定义工具提示的外观提供了更大的灵活性,特别适用于需要独特样式或 CSS 变量集成的场景。更改包括组件类型定义、属性转发的更新以及一个新的测试用例以确保功能正常。
Highlights
- 新增语义名称: 为
Tooltip
组件引入了uniqueBody
语义名称,以增强对特定主体部分的样式控制。 - 属性转发: 将
uniqueBgClassName
和uniqueBgStyle
属性转发至内部Popup
组件,允许外部传入类名和样式。 - 依赖更新: 更新了
@rc-component/trigger
依赖至^3.6.7
版本。 - 测试覆盖: 添加了新的测试用例,以验证
uniqueBody
属性的正确传递和应用。
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
-
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. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #503 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 37 37
Branches 15 15
=========================================
Hits 37 37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次变更通过为 Tooltip
组件添加 uniqueBody
语义化名称,实现了对额外滑动容器的样式和类名配置。这增强了组件在过渡动画场景下的可定制性。相关依赖 @rc-component/trigger
也已更新以支持此功能。代码实现清晰,并且添加了相应的单元测试。我只发现了一个小问题,即测试代码中遗留了调试语句,建议在合并前移除。
tests/index.test.tsx
Outdated
console.log(document.body.innerHTML); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
There was a problem hiding this 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 (3)
tests/__mocks__/@rc-component/trigger.js (1)
1-4
: 给 UniqueProvider 增加兜底以提升 mock 的鲁棒性当前从内部路径
@rc-component/trigger/lib/mock
直连导出,若后续包结构微调会导致用例破裂。建议在 mock 中为UniqueProvider
增加 fallback,至少回退为透传 children 的空 Provider。应用如下 diff:
-import Trigger, { UniqueProvider } from '@rc-component/trigger/lib/mock'; +import Trigger, { UniqueProvider as InternalUniqueProvider } from '@rc-component/trigger/lib/mock'; +const FallbackUniqueProvider = ({ children }) => children; +const UniqueProvider = InternalUniqueProvider ?? FallbackUniqueProvider; export default Trigger; -export { UniqueProvider }; +export { UniqueProvider };tests/index.test.tsx (1)
442-465
: 移除调试日志并补一条可见性断言
console.log(document.body.innerHTML)
会噪声化测试输出,建议删除;同时可补充一个基础可见性断言,提升用例信噪比。应用如下 diff:
); - console.log(document.body.innerHTML); - // Test that uniqueBody doesn't break the normal tooltip functionality + // Tooltip 渲染应可见 + expect(document.querySelector('.rc-tooltip')).toBeTruthy(); expect(document.querySelector('.unique-body-class')).toHaveStyle({ color: 'red', });src/Tooltip.tsx (1)
157-159
: 仅在需要时透传 unique 背景样式(可选)当前无条件传递
uniqueBgClassName
/uniqueBgStyle
,虽然安全但会增加噪声。可按存在性条件传递,避免多余 props。应用如下 diff:
arrow={mergedArrow} - uniqueBgClassName={classNames?.uniqueBody} - uniqueBgStyle={styles?.uniqueBody} + {...(classNames?.uniqueBody ? { uniqueBgClassName: classNames.uniqueBody } : {})} + {...(styles?.uniqueBody ? { uniqueBgStyle: styles.uniqueBody } : {})}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
package.json
(1 hunks)src/Tooltip.tsx
(2 hunks)tests/__mocks__/@rc-component/trigger.js
(1 hunks)tests/index.test.tsx
(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/index.test.tsx (2)
docs/examples/simple.tsx (1)
render
(112-227)docs/examples/formError.tsx (1)
render
(26-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (5)
tests/index.test.tsx (4)
1-1
: 引入 UniqueProvider 以覆盖 unique 场景导入位置与用途合理。
355-355
: 样例格式化变更仅为排版调整,不影响断言与行为。
433-440
: 补充“未配置语义不应生效”的负向断言合理有助于防回归,保持语义隔离清晰。
497-497
: 在不显示箭头时的行为断言正确覆盖了
showArrow={false}
的关键路径。src/Tooltip.tsx (1)
11-11
: 扩展语义名至 'uniqueBody'类型扩展与本次特性匹配;请同步在 API 文档中说明新增语义及依赖的最小 Trigger 版本。
}, | ||
"dependencies": { | ||
"@rc-component/trigger": "^3.6.4", | ||
"@rc-component/trigger": "^3.6.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
依赖升级至 @rc-component/trigger@^3.6.7:请核实导出与新 props 一致
为确保与本 PR 新增的 UniqueProvider
、uniqueBgClassName
/uniqueBgStyle
对齐,请确认 3.6.7 起确已导出/支持并有对应类型声明;否则会出现类型或运行时不匹配。
🌐 Web query:
@rc-component/trigger@^3.6.7 是否导出名为 UniqueProvider?<Trigger> 是否支持 uniqueBgClassName 与 uniqueBgStyle 两个 props?
💡 Result:
短答:不支持。
- @rc-component/trigger 的公开导出/文档里没有名为 UniqueProvider 的导出。官方仓库/README 与包文档均只暴露 Trigger(或默认组件)等常规接口,未见 UniqueProvider。 [1][2]
- 的 props 文档(npm/jsdocs/README 列表)中也不存在 uniqueBgClassName 与 uniqueBgStyle 这两个 props。当前公开 API 使用的是诸如 popupClassName、popupStyle、prefixCls、popupAlign 等标准属性。 [2][3]
参考:
- react-component/trigger 仓库 README(组件与导出说明)。[1]
- @rc-component/trigger / rc-trigger 包说明与 props 列表(npm / README / jsDocs)。[2][3]
(如果你需要,我可以为你在某个具体版本的包构建产物或 unpkg 上打开对应版本的 index 文件并截取导出符号以做进一步确认。)
@rc-component/trigger@^3.6.7 不包含 UniqueProvider,且 不支持 uniqueBgClassName/uniqueBgStyle — 需修复
- 验证:@rc-component/trigger v3.6.7 官方导出/文档中无 UniqueProvider, 也不包含 uniqueBgClassName 或 uniqueBgStyle(仍使用 popupClassName/popupStyle 等)。
- 要求(选一):回退或换成提供这些 API 的包/版本;或移除/替换代码中对 UniqueProvider 与 uniqueBgClassName/uniqueBgStyle 的使用;或新增本地适配层并补充类型声明。影响点:package.json(第44行 @rc-component/trigger 升级)及 PR 中新增的 UniqueProvider/props 使用处,请在这些位置修正。
🤖 Prompt for AI Agents
In package.json at line 44 (the @rc-component/trigger dependency) the pinned
version ^3.6.7 does not export UniqueProvider nor does <Trigger> accept
uniqueBgClassName/uniqueBgStyle; fix by either 1) changing package.json to a
version/package that provides UniqueProvider and those props, 2) or
removing/replacing all uses of UniqueProvider and
uniqueBgClassName/uniqueBgStyle in the PR code to use the existing API (e.g.,
popupClassName/popupStyle or another supported provider), or 3) add a local
adapter component named UniqueProvider that wraps the existing Trigger API and
maps uniqueBgClassName/uniqueBgStyle to popupClassName/popupStyle and add
appropriate TypeScript declarations; then update package.json and the PR files
accordingly and run the build/tests to verify.
语义化结构添加额外的滑动容器配置,支持上游 css var 传递。
Summary by CodeRabbit