Skip to content

feat(cascader): [cascader,tree] dark theme adaptation #3136

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

Merged
merged 7 commits into from
Mar 19, 2025
Merged

Conversation

lcy0620
Copy link
Collaborator

@lcy0620 lcy0620 commented Mar 17, 2025

PR

PR Checklist

feat(cascader): [cascader,transfer,tree] dark theme adaptation
解决穿梭框选中背景色,级联选择自定义高度面板样式
Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style
    • Enhanced the Cascader Node visual experience with refined hover backgrounds, updated icon sizing, and clarified active state styling.
    • Improved Cascader component presentation by adding a panel border and streamlining menu appearances.
    • Updated styling variables for more consistent border and text colors.
    • Enhanced the Transfer panel with a distinct active state highlight.
    • Standardized Tree component icon colors and optimized SVG icon layout.
    • Refined custom rendered element colors for a more precise visual tone.
    • Adjusted vertical spacing for the "no data" message in Cascader components.
    • Increased the minimum height of the Cascader menu for improved layout.

@lcy0620 lcy0620 requested a review from shenjunjian March 17, 2025 12:36
Copy link

coderabbitai bot commented Mar 17, 2025

Walkthrough

The changes update CSS styling across various components. The Cascader and Cascader Node components now use updated hover background colors, refined border definitions, and adjusted icon sizes and colors. New CSS variables are introduced, and existing ones are updated or renamed. The Transfer and Tree components also receive styling enhancements, including active state backgrounds and SVG adjustments. Vue demo examples reflect corresponding color updates. No modifications were made to the exported public APIs.

Changes

Files Change Summary
packages/theme/.../cascader-node/index.less
packages/theme/.../cascader-node/vars.less
Updated hover background colors, font sizes for prefix/postfix, and SVG fill rules in active states; renamed --tv-CascaderNode-icon-font-size to --tv-CascaderNode-icon-size.
packages/theme/.../cascader/index.less
packages/theme/.../cascader/vars.less
Added border styling to cascader panels; removed border and margin-left from cascader menus; added new CSS variable for border color and updated the empty text color variable.
packages/theme/.../transfer/index.less
packages/theme/.../transfer/vars.less
Added a new rule for active table row background in transfer panels and introduced a variable to define this active background color.
packages/theme/.../tree/index.less Modified SVG selector to target direct children and added properties for font-size and margin adjustments for icons.
examples/sites/demos/pc/app/tree/icons-composition-api.vue
examples/sites/demos/pc/app/tree/icons.vue
Changed both expand and shrink icon colors to #5291FF for consistency in tree components.
examples/sites/demos/pc/app/transfer/custom-render-composition-api.vue
examples/sites/demos/pc/app/transfer/custom-render.vue
Updated the .red class color from red to #d94838 in transfer demo examples.
examples/sites/demos/pc/app/cascader/filterable-composition-api.vue
examples/sites/demos/pc/app/cascader/filterable.vue
Adjusted the line-height of the .no-data class from 240px to 200px in the filterable components.
packages/theme/.../cascader-menu/index.less Increased the min-height of the & &__wrap class from 204px to 208px.

Possibly related PRs

Poem

I'm a rabbit with hops so spry,
Admiring the changes as I twirl by.
CSS colors now brightly shine,
Borders and icons all align.
In a world of styles smooth and neat,
I munch on carrots to the rhythmic beat.
Hoppy updates make our design complete!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/sites/demos/pc/app/cascader/filterable.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/cascader/filterable-composition-api.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 880562f and cba4ca2.

📒 Files selected for processing (3)
  • examples/sites/demos/pc/app/cascader/filterable-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/cascader/filterable.vue (1 hunks)
  • packages/theme/src/cascader-menu/index.less (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/cascader/filterable.vue
  • examples/sites/demos/pc/app/cascader/filterable-composition-api.vue
🔇 Additional comments (1)
packages/theme/src/cascader-menu/index.less (1)

35-37: Review the Updated Minimum Height in the Cascader Panel

The change increases the min-height from its previous value to 208px within the & &__wrap block. Please verify that this 4px increment aligns with the dark theme design requirements and overall layout consistency. Ensure that this new height does not cause any visual misalignments—especially if the same style applies across both dark and light themes—and that it works harmoniously with other components in the cascader module.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Mar 17, 2025
Copy link

Walkthrough

This pull request introduces dark theme adaptations for the cascader, transfer, and tree components. It addresses issues with selected background colors in the transfer box and custom height panel styles in the cascader.

Changes

Files Summary
packages/theme/src/cascader-node/index.less Added styles for SVG elements to adapt to dark theme.
packages/theme/src/cascader/index.less Updated border and background styles for cascader menu and panel.
packages/theme/src/cascader/vars.less Introduced new variables for border color and updated text color variables.
packages/theme/src/transfer/index.less Added styles for active background color in transfer panel.
packages/theme/src/transfer/vars.less Introduced a new variable for active background color in transfer panel.
packages/theme/src/tree/vars.less Updated hover background color for tree nodes.

@@ -99,7 +102,10 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

svg {
font-size: var(--tv-CascaderNode-icon-font-size);

Choose a reason for hiding this comment

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

Ensure that the SVG styles are compatible with all supported browsers, especially older versions that might not fully support CSS variables.

@@ -153,7 +153,9 @@
text-align: left;
padding-right: var(--tv-Transfer-panel-body-padding-right);
padding-left: var(--tv-Transfer-panel-body-padding-left);

.tiny-table.simple table tbody tr:has(td svg.is-check) {
background-color: var(--tv-Transfer-panel-item-active-bg-color);

Choose a reason for hiding this comment

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

Check compatibility of the ':has()' pseudo-class as it may not be supported in all browsers. Consider using an alternative approach for broader compatibility.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49d190c and 5a3afd0.

📒 Files selected for processing (3)
  • examples/sites/demos/pc/app/tree/icons-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/tree/icons.vue (1 hunks)
  • packages/vue/src/transfer/__tests__/transfer.test.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/tree/icons.vue
  • examples/sites/demos/pc/app/tree/icons-composition-api.vue
🧰 Additional context used
🪛 GitHub Check: PR Unit Test
packages/vue/src/transfer/__tests__/transfer.test.tsx

[failure] 120-120:
ReferenceError: nextTick is not defined
❯ ../../packages/vue/src/transfer/tests/transfer.test.tsx:120:5

🪛 GitHub Actions: Unit Test PR--feat(cascader): [cascader,transfer,tree] dark theme adaptation
packages/vue/src/transfer/__tests__/transfer.test.tsx

[error] 120-120: FAIL PC Mode > left change event: ReferenceError: nextTick is not defined

@lcy0620 lcy0620 changed the title feat(cascader): [cascader,transfer,tree] dark theme adaptation feat(cascader): [cascader,tree] dark theme adaptation Mar 18, 2025
zzcr
zzcr previously approved these changes Mar 18, 2025
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: 0

🧹 Nitpick comments (2)
packages/theme/src/cascader-node/vars.less (1)

29-29: Consistent Variable Rename for Icon Size
The variable has been renamed from --tv-CascaderNode-icon-font-size to --tv-CascaderNode-icon-size, which clarifies that it controls icon dimensions rather than text font size. Ensure that all references in related files (for example, in index.less if applicable) are updated to maintain consistency across the project.

packages/theme/src/tree/index.less (1)

363-367: Enhanced SVG Styling in Tree Component
The adjustments applied to the direct child SVG elements of the tree node content—setting the fill, font-size, and margin-right via CSS variables—improve precise control over the icons in the dark theme context. Please verify that the variable --tv-Tree-node-operate-icon-font-size is defined appropriately in your theme variables and is conceptually distinct from the cascader icons’ sizing (now using --tv-CascaderNode-icon-size). Consistency in naming conventions across similar components helps prevent confusion in future maintenance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a443747 and 880562f.

📒 Files selected for processing (5)
  • examples/sites/demos/pc/app/transfer/custom-render-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/transfer/custom-render.vue (1 hunks)
  • packages/theme/src/cascader-node/index.less (4 hunks)
  • packages/theme/src/cascader-node/vars.less (1 hunks)
  • packages/theme/src/tree/index.less (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/transfer/custom-render-composition-api.vue
  • examples/sites/demos/pc/app/transfer/custom-render.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/src/cascader-node/index.less

@lcy0620 lcy0620 requested a review from MomoPoppy March 18, 2025 09:32
@lcy0620 lcy0620 requested a review from zzcr March 19, 2025 02:44
@zzcr zzcr merged commit bbdf32f into dev Mar 19, 2025
10 checks passed
@kagol kagol deleted the fix_theme/317 branch April 14, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request (功能增强)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants