Skip to content
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

fix(input): support both endContent and isClearable at the same time #2305

Conversation

kght6123
Copy link
Contributor

@kght6123 kght6123 commented Feb 1, 2024

📝 Description

Improved UI when both endContent and isClearable are specified.

⛳️ Current behavior (updates)

endContent replaces the Clear button.

🚀 New behavior

Both endContent and Clear buttons are visible.

💣 Is this a breaking change (Yes/No):

No.

Currently, both endContent and isClearable do not work as desired.
It's confusing that endContent is replaced by a Clear button, and I don't think there's any use for it.

📝 Additional Information

スクリーンショット 2024-02-02 0 04 17

スクリーンショット 2024-02-02 0 04 45

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced input component to display both Clear button and end content simultaneously for improved user experience.
    • Introduced dynamic styling for the clear button based on the width of end content.
    • Added a new story for the input component showcasing clearable functionality with visual enhancements.
  • Bug Fixes

    • Improved responsiveness and visual consistency of the input component, particularly when clearable.

@kght6123 kght6123 requested a review from jrgarciadev as a code owner February 1, 2024 15:07
Copy link

changeset-bot bot commented Feb 1, 2024

🦋 Changeset detected

Latest commit: 6b7fb88

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@nextui-org/input Patch
@nextui-org/theme Patch
@nextui-org/autocomplete Patch
@nextui-org/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 6, 2024 2:49pm

Copy link

vercel bot commented Feb 1, 2024

@kght6123 is attempting to deploy a commit to the NextUI Team on Vercel.

A member of the Team first needs to authorize it.

@jrgarciadev
Copy link
Member

Hi @kght6123, thank you for submitting this pull request (PR). I will review it shortly

Copy link
Contributor

coderabbitai bot commented Sep 13, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (5)
  • main
  • canary
  • fix/.*
  • chore/.*
  • feat/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update modifies the input component to allow simultaneous use of the endContent and isClearable properties. The changes ensure that both elements are displayed together, enhancing user interaction.

Changes

Files Change Summary
.changeset/eight-moose-dance.md Introduced simultaneous display of endContent and Clear button in the input component.
packages/components/input/src/input.tsx Added functionality to manage the display of endContent alongside the clear button.
packages/components/input/stories/input.stories.tsx Added a new story ClearableAndEndContent to demonstrate the combined use of endContent and isClearable.
packages/core/theme/src/components/input.ts Modified styles to improve padding and positioning of the clear button based on input state.

Assessment against linked issues

Objective Addressed Explanation
Show endContent and make isClearable work simultaneously (#[2254], #[2145])

Possibly related PRs

Suggested labels

👀 Status: In Review

Suggested reviewers

  • wingkwong

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>, 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 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.

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
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

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

  1. please resolve conflicts
  2. please handle RTL as well. The clear button should be on the left hand side in RTL.

image

.changeset/eight-moose-dance.md Outdated Show resolved Hide resolved
@wingkwong wingkwong assigned kght6123 and unassigned wingkwong Sep 27, 2024
@wingkwong wingkwong changed the title fix(components): improvements for cases where both end content and is clearable are specified fix(input): support both endContent and isClearable at the same time Oct 16, 2024
@wingkwong
Copy link
Member

@kght6123 please resolve conflicts and follow up those comments. thanks.

@jrgarciadev
Copy link
Member

Hey @kght6123 please update this PR, handle RTL and fix the conflicts 🙏🏻

@jrgarciadev jrgarciadev changed the base branch from canary to beta/release-next November 5, 2024 19:11
Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
.changeset/eight-moose-dance.md (1)

6-6: Consider enhancing the changeset description.

While the description explains the change, it could be more informative by including:

  • The motivation behind the change
  • The benefit to users
  • Any potential considerations for usage

Here's a suggested enhancement:

-I have made a change so that when both endContent and isClearable are specified, endContent no longer replaces the Clear button. Now, both endContent and the Clear button will be displayed.
+Enhanced Input component to support simultaneous display of endContent and Clear button when both endContent and isClearable props are specified. This improvement allows users to maintain custom end content while retaining the clear functionality, providing a more versatile input experience. Previously, the Clear button would replace endContent, limiting component customization options.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a7c348b and 8d36a82.

📒 Files selected for processing (1)
  • .changeset/eight-moose-dance.md (1 hunks)
🔇 Additional comments (1)
.changeset/eight-moose-dance.md (1)

1-4: LGTM! Version bump type is correctly set.

The patch version bump is appropriate as this change enhances functionality without breaking existing behavior.

@kght6123
Copy link
Contributor Author

kght6123 commented Nov 6, 2024

@jrgarciadev @wingkwong
I fixed the conflict and am currently working on it.

I don't have much experience with RTL so I'm learning as I go.

I understand that I need to support bidirectional text and that the clear button should appear on the left side when right-to-left (RTL).

Currently it's on the right, so I'd like to fix this so that it appears on the left side when RTL.

Copy link
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

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

please try to follow the select one. (ref: pr3746)

@kght6123
Copy link
Contributor Author

kght6123 commented Nov 7, 2024

@wingkwong
In RTL mode, the clear button is now on the other side.
スクリーンショット 2024-11-08 0 52 12

please try to follow the select one. (ref: pr3746)

Where in PR 3746 should I refer to? Can you give me more details?

@wingkwong
Copy link
Member

@kght6123 that PR does the same thing but in select component. I would prefer the same approach rather maintaining two sets of implementations.

@wingkwong
Copy link
Member

@kght6123 any update?

@jrgarciadev jrgarciadev deleted the branch heroui-inc:beta/release-next November 29, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants