Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(input,autocomplete): [input,autocomplete] update input&autocompl… #1950

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 4 commits into from
Aug 21, 2024

Conversation

zzcr
Copy link
Member

@zzcr zzcr commented Aug 19, 2024

…ete x-design style

PR

PR Checklist

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

  • New Features

    • Introduced configuration options for input components, enhancing their customization.
    • Added a new theme configuration for autocomplete, allowing future styling adjustments.
  • Improvements

    • Simplified and modernized styles for autocomplete dropdowns, improving readability and layout.
    • Enhanced loading indicators with updated visuals for a better user experience.
    • Improved layout capabilities for input components with new padding options.
  • Bug Fixes

    • Adjusted styles to ensure consistent display across different browsers and improved visual feedback on hover states.
  • Style

    • Refined styles for input and autocomplete components to enhance usability and maintainability.
    • Updated scrollbar aesthetics and hover states for textarea, improving overall accessibility.

Copy link

coderabbitai bot commented Aug 19, 2024

Walkthrough

The recent updates enhance the styling and functionality of autocomplete and input components across the project. Key changes include the removal of outdated styles, the introduction of new customization options for rendering, and improvements to loading indicators. These modifications aim to modernize the user interface, providing a more consistent and visually appealing experience.

Changes

Files Change Summary
examples/.../autocomplete/popper-class-composition-api.vue
examples/.../autocomplete/popper-class.vue
Simplified styling for .my-autocomplete; removed specific styles for list items; adjusted .addr class properties for better readability.
packages/design/.../input/index.ts
packages/design/.../saas/src/input/index.ts
Added options object with isCloseIconHide property to enhance component rendering configuration.
packages/renderless/.../input/vue.ts Introduced designConfig parameter in initState and renderless functions to improve design customization and responsiveness.
packages/theme/.../autocomplete/index.less Removed IE-specific styles, updated styles using CSS variables for maintainability; simplified loading state styles with a new SVG animation.
packages/theme/.../autocomplete/smb-theme.js Introduced tinyAutocompleteSmbTheme constant for future theme customization.
packages/theme/.../autocomplete/vars.less Added new CSS variables for padding and dropdown gap; updated list item height to a fixed value for better layout control.
packages/theme/.../input/index.less Enhanced input component styling with new hover states and adjusted spacing for improved user interaction.
packages/theme/.../input/smb-theme.js Removed ti-input-disabled-bg-color property, simplifying the input theme configuration.
packages/theme/.../input/vars.less Standardized icon colors and adjusted padding/margin properties for improved visual consistency across input components.
packages/theme/.../smb-theme/index.js Added new color properties for better visual feedback on errors and warnings; modified dropdown gap property for improved layout spacing.
packages/vue/.../autocomplete/src/pc.vue Updated loading indicator logic and styling; replaced IconLoading with IconLoadingShadow for improved user feedback.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Autocomplete
    participant Input

    User->>Input: Focus on input field
    Input->>Autocomplete: Show suggestions
    User->>Autocomplete: Select suggestion
    Autocomplete->>Input: Populate input with selected value
    Input->>User: Display updated value
    Note over Input: If loading, show loading indicator
Loading

🐰 In fields of green, I hop with glee,
New styles and tweaks, how lovely to see!
A close icon hides, a dropdown now spreads,
With colors that sing, and padding that treads.
So let's celebrate, with a jump and a cheer,
For changes so bright, I hold dear! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 21618ea and dde583e.

Files selected for processing (13)
  • examples/sites/demos/pc/app/autocomplete/popper-class-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/autocomplete/popper-class.vue (1 hunks)
  • packages/design/aurora/src/input/index.ts (1 hunks)
  • packages/design/saas/src/input/index.ts (1 hunks)
  • packages/renderless/src/input/vue.ts (4 hunks)
  • packages/theme/src/autocomplete/index.less (3 hunks)
  • packages/theme/src/autocomplete/smb-theme.js (1 hunks)
  • packages/theme/src/autocomplete/vars.less (2 hunks)
  • packages/theme/src/input/index.less (6 hunks)
  • packages/theme/src/input/smb-theme.js (1 hunks)
  • packages/theme/src/input/vars.less (4 hunks)
  • packages/theme/src/theme/smb-theme/index.js (2 hunks)
  • packages/vue/src/autocomplete/src/pc.vue (2 hunks)
Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/autocomplete/popper-class.vue
  • packages/theme/src/autocomplete/smb-theme.js
Additional comments not posted (23)
packages/design/aurora/src/input/index.ts (1)

2-4: Verify usage and documentation of options.

The addition of the options object with isCloseIconHide enhances configuration flexibility. Ensure that this new property is documented and used appropriately in the component logic.

packages/design/saas/src/input/index.ts (1)

2-4: Verify usage and documentation of options.

The addition of the options object with isCloseIconHide enhances configuration flexibility. Ensure that this new property is documented and used appropriately in the component logic.

packages/theme/src/input/smb-theme.js (1)

Line range hint 1-18: Verify impact of removing 'ti-input-disabled-bg-color'.

The removal of 'ti-input-disabled-bg-color' may affect the appearance of disabled input elements. Ensure this change aligns with design guidelines and does not negatively impact the UI.

examples/sites/demos/pc/app/autocomplete/popper-class-composition-api.vue (1)

78-81: Verify visual impact of CSS changes.

The CSS modifications for the .addr class aim to improve readability. Ensure these changes align with the overall design and enhance the visual presentation.

packages/theme/src/autocomplete/vars.less (1)

Line range hint 20-41: Verify usage and documentation of new CSS variables.

The introduction of new CSS variables enhances layout flexibility. Ensure these variables are used consistently and documented properly.

packages/theme/src/autocomplete/index.less (3)

48-48: Use of CSS Variables for Padding.

The use of CSS variables for padding enhances flexibility and maintainability. This approach allows for easier theming and customization.


83-86: Simplification of Loading State Styles.

The loading state styles have been simplified with the introduction of an SVG element and a rotating animation. This change improves the visual feedback during loading and reduces CSS complexity.


97-97: Refinement of Margin for Dropdown Elements.

The margin for dropdown elements has been adjusted to use a CSS variable, which provides better control over layout and consistency across different themes.

packages/theme/src/input/vars.less (4)

37-37: Standardization of Suffix Icon Color.

The suffix icon color is now standardized using var(--ti-common-color-icon-normal), which enhances consistency across different UI components.


59-59: Consistent Close Icon Text Color.

The close icon's text color is now consistent with the standardized icon color, improving visual coherence.


71-71: Removal of Pixel Unit in Vertical Padding.

The pixel unit has been removed from the vertical padding, which may affect rendering. Ensure that this change does not introduce layout issues in different environments.


83-83: Adjustment of Suffix Icon Right Margin.

The right margin for the suffix icon has been adjusted to var(--ti-common-space-3x, 8px), potentially altering the spacing around the icon. Verify that this change aligns with the intended design.

packages/vue/src/autocomplete/src/pc.vue (2)

108-114: Updated Import for Loading Icon.

The import statement has been updated to use IconLoadingShadow. Verify that this change is consistent across all relevant components and does not break functionality.

Verification successful

Consistent Import of IconLoadingShadow Across Components

The import of IconLoadingShadow is consistent across multiple components and files. The change in pc.vue does not appear to break functionality. Here are the relevant locations:

  • packages/vue/src/autocomplete/src/pc.vue
  • packages/vue-icon/index.ts
  • packages/vue-icon-saas/index.ts
  • Definition in packages/vue-icon/src/loading-shadow/index.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistency of the `IconLoadingShadow` import across components.

# Test: Check for consistent usage of `IconLoadingShadow` in imports.
rg --type ts --type vue --word-regexp --fixed-strings 'IconLoadingShadow'

Length of output: 101


Script:

#!/bin/bash
# Description: Verify consistency of the `IconLoadingShadow` import across components.

# Test: Check for consistent usage of `IconLoadingShadow` in .ts and .vue files.
rg --glob '*.ts' --glob '*.vue' --word-regexp --fixed-strings 'IconLoadingShadow'

Length of output: 901


73-77: Enhanced Loading Indicator with New Icon.

The loading indicator now uses IconLoadingShadow, providing a more visually appealing loading state. Ensure that this new icon is correctly integrated and functions as expected.

Verification successful

Integration of IconLoadingShadow Verified

The IconLoadingShadow component is imported and used within the codebase, indicating its integration. Ensure that the component functions correctly within the application.

  • Import Statement: import { IconLoadingShadow } from '@opentiny/vue-icon'

This confirms that the new loading icon is correctly integrated into the project.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration and functionality of the new loading icon `IconLoadingShadow`.

# Test: Check the usage and references of `IconLoadingShadow`.
rg --type vue --word-regexp --fixed-strings 'IconLoadingShadow'

Length of output: 91


Script:

#!/bin/bash
# Description: Verify the integration and functionality of the new loading icon `IconLoadingShadow`.

# Find all .vue files and search for `IconLoadingShadow` within them.
fd --extension vue --exec rg --word-regexp --fixed-strings 'IconLoadingShadow' {}

Length of output: 181

packages/theme/src/input/index.less (4)

104-108: Improved Hover State for Input.

The hover state for input components now changes the border color, enhancing user interaction feedback. This change aligns with modern UI design practices.


114-117: Clear Icon Hover Effect.

The clear icon now changes fill color on hover, providing a clearer visual cue for users. This improvement enhances usability.


187-187: Consistent Icon Fill Color.

The fill color for icons is now consistent, improving visual coherence across components.


222-225: Adjustment of Prefix Positioning.

The left positioning of the prefix has been adjusted from 8px to 12px, which may affect layout. Verify that this change aligns with the intended design specifications.

packages/renderless/src/input/vue.ts (3)

108-109: Introduction of designConfig Parameter.

The designConfig parameter enhances configurability, allowing for design-specific behavior. Ensure that this parameter is utilized consistently across the component.


Line range hint 386-395: Enhanced Renderless Function with designConfig.

The renderless function now includes designConfig, allowing for more adaptable rendering logic. Ensure that this change is consistently applied and does not introduce regressions.

Verification successful

Consistent Integration of designConfig in Renderless Functions

The designConfig parameter is consistently applied across multiple renderless functions in the codebase, confirming the change is well-integrated and does not introduce regressions.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistent application of `designConfig` in the renderless function.

# Test: Check for usage and integration of `designConfig` in renderless functions.
rg --type ts --word-regexp --fixed-strings 'renderless'

Length of output: 47419


Script:

#!/bin/bash
# Description: Check for the usage of `designConfig` in renderless functions across the codebase.

# Test: Search for `designConfig` in renderless function definitions.
rg --type ts 'renderless' -A 5 | rg 'designConfig'

Length of output: 3578


135-135: Conditional Logic with designConfig.

The conditional logic now incorporates designConfig?.options?.isCloseIconHide, enhancing responsiveness to design configurations. Verify that this logic is correctly implemented and tested.

packages/theme/src/theme/smb-theme/index.js (2)

53-53: New color properties added for improved visual feedback.

The addition of new color properties for error, warning, and prompt states enhances the theme's visual feedback mechanisms.

Ensure these properties are consistently applied across the application to maintain a cohesive design.


304-304: Dropdown gap increased from 4px to 8px.

The increase in ti-common-dropdown-gap may affect the layout and spacing of dropdown elements.

Verify that this change improves the layout without causing any negative impact on the user interface.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dde583e and df837d0.

Files ignored due to path filters (1)
  • packages/theme-saas/src/svgs/loading-shadow.svg is excluded by !**/*.svg
Files selected for processing (4)
  • packages/theme/src/autocomplete/index.less (3 hunks)
  • packages/theme/src/autocomplete/smb-theme.js (1 hunks)
  • packages/theme/src/autocomplete/vars.less (2 hunks)
  • packages/theme/src/textarea/index.less (7 hunks)
Files skipped from review due to trivial changes (1)
  • packages/theme/src/autocomplete/index.less
Files skipped from review as they are similar to previous changes (2)
  • packages/theme/src/autocomplete/smb-theme.js
  • packages/theme/src/autocomplete/vars.less
Additional comments not posted (5)
packages/theme/src/textarea/index.less (5)

41-41: LGTM! Enhanced visual feedback for disabled state.

The additional spacing in the .is-disabled class for hover effects enhances accessibility by providing better visual feedback.


54-54: LGTM! Improved focus indication.

The reinforcement of the border color change on focus enhances accessibility by providing a clearer indication of focus.


101-101: LGTM! Consistent focus state styling.

The focus state styling aligns with best practices for accessibility, ensuring that users can easily identify focused elements.


126-126: LGTM! Enhanced scrollbar usability.

Increasing the scrollbar width from 12px to 16px improves usability by making it more prominent and easier to interact with.


130-132: LGTM! Improved scrollbar thumb aesthetics.

Modifying the border-radius from 5px to 8px provides a smoother and more aesthetically pleasing appearance for the scrollbar thumb.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df837d0 and 02f4bbf.

Files selected for processing (1)
  • packages/theme/src/input/smb-theme.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/theme/src/input/smb-theme.js

@kagol kagol added the enhancement New feature or request (功能增强) label Aug 21, 2024
@kagol kagol merged commit 3371aee into dev Aug 21, 2024
5 checks passed
@kagol kagol deleted the update-input-smb-style-0819 branch November 4, 2024 03:55
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.

2 participants