Skip to content

Conversation

li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Sep 28, 2025

Summary by CodeRabbit

  • 新功能

  • 重构

    • 全面改用 clsx 组装样式类名,提升一致性与体积;不影响功能或外观。
  • 杂务

    • 依赖调整:移除 classnames,新增 clsx。
    • 开发依赖:移除 @types/classnames,新增 @types/node。
    • 配置优化:调整 engines 字段位置与格式,微调条目格式。

Copy link

vercel bot commented Sep 28, 2025

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

Project Deployment Preview Comments Updated (UTC)
picker Ready Ready Preview Comment Sep 28, 2025 3:36am

Copy link

coderabbitai bot commented Sep 28, 2025

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

在整个代码库中将 classNames 替换为 clsx:更新多处组件的 import 与 className 拼接调用;在一个输入组件中将 ref 初始值改为 null;同时更新 package.json 依赖与 engines 段位置与内容。

Changes

Cohort / File(s) Change Summary
Dependencies
package.json
依赖调整:移除 "classnames" 与其类型包,新增 "clsx" 与 "@types/node";engines 段移至文件末尾并规范为 {"node": ">=8.x"};轻微格式调整。
PickerInput · Popup
src/PickerInput/Popup/Footer.tsx, src/PickerInput/Popup/index.tsx
将 classNames 调用替换为 clsx;更新对应 import;仅影响 className 组合。
PickerInput · Selector
src/PickerInput/Selector/Icon.tsx, src/PickerInput/Selector/Input.tsx, src/PickerInput/Selector/RangeSelector.tsx, src/PickerInput/Selector/SingleSelector/index.tsx, src/PickerInput/Selector/SingleSelector/MultipleDates.tsx
统一用 clsx 组合类名并更新 import;Input.tsx 中 holderRef 与 inputRef 初始值由 undefined 调整为 null。
PickerInput · Root
src/PickerInput/RangePicker.tsx, src/PickerInput/SinglePicker.tsx
用 clsx 替换 classNames 进行类名合并;无行为变更。
PickerPanel · Core
src/PickerPanel/index.tsx, src/PickerPanel/PanelBody.tsx, src/PickerPanel/PanelHeader.tsx
将 classNames 替换为 clsx;仅更新类名组合与 import。
PickerPanel · Date & Week
src/PickerPanel/DatePanel/index.tsx, src/PickerPanel/WeekPanel/index.tsx
用 clsx 处理条件类名;更新 import;无其他变更。
PickerPanel · Time
src/PickerPanel/TimePanel/index.tsx, src/PickerPanel/TimePanel/TimePanelBody/index.tsx, src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx
全部改用 clsx 进行类名拼接;结构与逻辑不变。
PickerTrigger
src/PickerTrigger/index.tsx
使用 clsx 合并 popupClassName 与条件类;更新 import。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • zombieJ
  • afc163

Poem

我把绒耳竖一竖,跳过 classnames 的路,
轻点键帽敲句符,clsx 悄然入。
引擎尾行排队住,依赖清爽不含糊。
咔哒——样式齐步走,胡萝卜也点头胡🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed 该标题使用了标准的“perf”前缀,并明确指出从 classnames 切换到 clsx 的核心改动,与 PR 的主要内容完全一致,短小精悍且无冗余信息,方便团队快速理解改动意图。
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clsx-update

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 @li-jia-nan, 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 performance enhancement by migrating the project's class name utility from classnames to clsx. This change involves updating the project dependencies and refactoring numerous React components to utilize the more performant clsx function for dynamic class assignments. Additionally, React useRef hooks have been updated to explicitly initialize with null, contributing to improved code clarity and type safety.

Highlights

  • Dependency Migration: The classnames package has been uninstalled and replaced with clsx for managing CSS classes across the project.
  • Performance Optimization: The switch to clsx is a performance improvement, as clsx is known to be a faster and smaller utility for conditionally joining class names, leading to more efficient rendering.
  • Codebase Refactor: All instances where classnames was used across various React components have been updated to use the new clsx utility, ensuring consistency and leveraging its benefits.
  • Ref Initialization Improvement: React useRef hooks are now explicitly initialized with null in src/PickerInput/Selector/Input.tsx, which improves type safety and consistency.
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

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedclsx@​2.1.11001009678100

View full report

Copy link

codecov bot commented Sep 28, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #944      +/-   ##
==========================================
- Coverage   98.80%   98.80%   -0.01%     
==========================================
  Files          65       65              
  Lines        2682     2680       -2     
  Branches      746      744       -2     
==========================================
- Hits         2650     2648       -2     
  Misses         29       29              
  Partials        3        3              

☔ 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 successfully replaces the classnames library with clsx for performance improvements. The changes are applied consistently across the codebase. I've also noticed a small, unrelated improvement regarding useRef initialization, which is good but could be in a separate PR for better commit history. Overall, the changes are solid and well-executed.

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: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between baa94f3 and a72b2f9.

📒 Files selected for processing (19)
  • package.json (2 hunks)
  • src/PickerInput/Popup/Footer.tsx (3 hunks)
  • src/PickerInput/Popup/index.tsx (3 hunks)
  • src/PickerInput/RangePicker.tsx (3 hunks)
  • src/PickerInput/Selector/Icon.tsx (2 hunks)
  • src/PickerInput/Selector/Input.tsx (3 hunks)
  • src/PickerInput/Selector/RangeSelector.tsx (3 hunks)
  • src/PickerInput/Selector/SingleSelector/MultipleDates.tsx (2 hunks)
  • src/PickerInput/Selector/SingleSelector/index.tsx (3 hunks)
  • src/PickerInput/SinglePicker.tsx (3 hunks)
  • src/PickerPanel/DatePanel/index.tsx (3 hunks)
  • src/PickerPanel/PanelBody.tsx (3 hunks)
  • src/PickerPanel/PanelHeader.tsx (5 hunks)
  • src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx (2 hunks)
  • src/PickerPanel/TimePanel/TimePanelBody/index.tsx (2 hunks)
  • src/PickerPanel/TimePanel/index.tsx (2 hunks)
  • src/PickerPanel/WeekPanel/index.tsx (2 hunks)
  • src/PickerPanel/index.tsx (2 hunks)
  • src/PickerTrigger/index.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/PickerPanel/TimePanel/index.tsx (1)
src/utils/dateUtil.ts (1)
  • formatValue (229-248)
src/PickerInput/Selector/SingleSelector/index.tsx (2)
docs/examples/time.tsx (1)
  • div (17-70)
docs/examples/debug.tsx (1)
  • div (45-110)
src/PickerInput/Selector/RangeSelector.tsx (2)
docs/examples/time.tsx (1)
  • div (17-70)
docs/examples/debug.tsx (1)
  • div (45-110)
🔇 Additional comments (5)
src/PickerPanel/TimePanel/TimePanelBody/index.tsx (1)

7-7: 切换至 clsx 保持样式组合逻辑

改用 clsx 后仍然兼容字符串与可选 classNames.content 的组合,行为与原 classnames 版本一致。

Also applies to: 274-274

src/PickerTrigger/index.tsx (1)

3-3: clsx 替换符合预期

clsx 与原 classnames 在处理字符串与布尔映射时保持同样的输出,popupClassName 的拼接逻辑无功能差异。

Also applies to: 96-99

src/PickerInput/Selector/RangeSelector.tsx (1)

1-1: 范围选择器样式组合迁移正确

clsx 调用覆盖了外层容器和 prefix 区域,依旧支持条件 class 与传入 className/样式对象,逻辑一致。

Also applies to: 214-224, 242-244

src/PickerPanel/TimePanel/index.tsx (1)

1-1: 面板容器切换 clsx 无行为差异

类名组合仍然只输出 panelPrefixCls,header 渲染逻辑未变。

Also applies to: 32-35

src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx (1)

1-1: 单元格样式组合保持一致

clsx 继续按选中/禁用状态附加修饰类,classNames.item 透传也没有变化。

Also applies to: 107-110

@li-jia-nan li-jia-nan merged commit 14c2211 into master Sep 28, 2025
13 checks passed
@li-jia-nan li-jia-nan deleted the clsx-update branch September 28, 2025 06:47
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