Skip to content

fix(input-otp): variants on segment background#5179

Merged
jrgarciadev merged 2 commits into
canaryfrom
fix/eng-2393
Apr 19, 2025
Merged

fix(input-otp): variants on segment background#5179
jrgarciadev merged 2 commits into
canaryfrom
fix/eng-2393

Conversation

@wingkwong
Copy link
Copy Markdown
Member

@wingkwong wingkwong commented Apr 10, 2025

Closes #5168

📝 Description

Text is not visible in bordered and underlined if the container has a black background in light mode.

import { InputOtp } from "@heroui/react";

export default function App() {
  const variants = ["flat", "bordered", "underlined", "faded"];

  return (
    <div className="w-full flex flex-wrap gap-4 bg-black">
      {variants.map((variant) => (
        <div key={variant}>
          <div className="text-default-500">variant: {variant}</div>
          <InputOtp length={4} variant={variant} />
        </div>
      ))}
    </div>
  );
}

⛳️ Current behavior (updates)

image

image

🚀 New behavior

image

image

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

📝 Additional Information

Summary by CodeRabbit

  • Bug Fixes

    • Resolved a display issue with the OTP input segment background.
  • Style

    • Enhanced the appearance of OTP input fields by adding improved background styling to both bordered and underlined designs.
  • Chores

    • Updated dependency requirements to ensure optimal compatibility between OTP input components and theming enhancements.

@wingkwong wingkwong requested a review from jrgarciadev as a code owner April 10, 2025 12:50
@linear
Copy link
Copy Markdown

linear Bot commented Apr 10, 2025

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 10, 2025

🦋 Changeset detected

Latest commit: 73969d9

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

This PR includes changesets to release 13 packages
Name Type
@heroui/input-otp Patch
@heroui/theme Patch
@heroui/react Patch
@heroui/autocomplete Patch
@heroui/checkbox Patch
@heroui/date-input Patch
@heroui/date-picker Patch
@heroui/form Patch
@heroui/input Patch
@heroui/number-input Patch
@heroui/radio Patch
@heroui/select Patch
@heroui/table 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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 10, 2025

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

Name Status Preview Comments Updated (UTC)
heroui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 0:50am
heroui-sb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 0:50am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2025

Walkthrough

This pull request introduces a new changeset file documenting patches to the @heroui/input-otp and @heroui/theme packages. It updates the peer dependency version for the @heroui/input-otp package and modifies the styling for the inputOtp component. The variants “bordered” and “underlined” now include an extra background class ("bg-background") to address visibility issues on dark backgrounds.

Changes

File(s) Change Summary
.changeset/small-cougars-watch.md New markdown file documenting the applied patches to the @heroui/input-otp and @heroui/theme packages and a fix in the input-otp variant segment background.
packages/components/input-otp/package.json Updated peer dependency for @heroui/theme from >=2.4.6 to >=2.4.13.
packages/core/theme/src/components/input-otp.ts Modified styling for inputOtp component variants: For “bordered”, added "bg-background" before "border-medium"; for “underlined”, added a new "bg-background" class to the segment’s class list.

Sequence Diagram(s)

(No sequence diagrams generated as changes are limited to styling and dependency updates without modifications to control flow.)

Assessment against linked issues

Objective Addressed Explanation
Fix InputOtp variant visibility on dark backgrounds (#5168)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

@wingkwong wingkwong added this to the v2.7.7 milestone Apr 10, 2025
Copy link
Copy Markdown
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

🧹 Nitpick comments (1)
packages/core/theme/src/components/input-otp.ts (1)

30-30: Consider reviewing the hover styling.

While not part of the current changes, I noticed that line 30 includes hover:bg-danger in the base segment styling. This would cause all segments to display a danger/red background on hover regardless of their variant or color setting. You might want to review if this is the intended behavior or if it should be moved to specific variant or color compound variants.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b865356 and 73969d9.

📒 Files selected for processing (3)
  • .changeset/small-cougars-watch.md (1 hunks)
  • packages/components/input-otp/package.json (1 hunks)
  • packages/core/theme/src/components/input-otp.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: TypeScript
  • GitHub Check: Build
  • GitHub Check: Continuous Release
🔇 Additional comments (4)
.changeset/small-cougars-watch.md (1)

1-7: The changeset file correctly documents the patches.

This changeset properly indicates that patches have been applied to both the @heroui/input-otp and @heroui/theme packages, with a clear description of the fix related to input-otp variants and their segment backgrounds.

packages/components/input-otp/package.json (1)

39-39: Appropriate peer dependency update.

Updating the minimum required version of @heroui/theme to >=2.4.13 is appropriate since this fix relies on the styling changes made to the theme package. This ensures that consumers of the input-otp component will use a theme version that includes the fixed styling for proper display on dark backgrounds.

packages/core/theme/src/components/input-otp.ts (2)

60-60: Good fix for background visibility in the bordered variant.

Adding the bg-background class to the segment styling for the bordered variant addresses the visibility issue when the component is displayed against a dark background in light mode. This ensures proper contrast between the text and background.


64-64: Good fix for background visibility in the underlined variant.

Similarly, adding the bg-background class to the underlined variant's segment styling ensures text visibility on dark backgrounds. This consistent approach to both variants maintains design coherence while solving the reported issue.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 10, 2025

Open in StackBlitz

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@5179

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@5179

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@5179

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@5179

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@5179

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@5179

@heroui/button

npm i https://pkg.pr.new/@heroui/button@5179

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@5179

@heroui/card

npm i https://pkg.pr.new/@heroui/card@5179

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@5179

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@5179

@heroui/code

npm i https://pkg.pr.new/@heroui/code@5179

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@5179

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@5179

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@5179

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@5179

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@5179

@heroui/form

npm i https://pkg.pr.new/@heroui/form@5179

@heroui/image

npm i https://pkg.pr.new/@heroui/image@5179

@heroui/input

npm i https://pkg.pr.new/@heroui/input@5179

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@5179

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@5179

@heroui/link

npm i https://pkg.pr.new/@heroui/link@5179

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@5179

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@5179

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@5179

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@5179

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@5179

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@5179

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@5179

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@5179

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@5179

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@5179

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@5179

@heroui/select

npm i https://pkg.pr.new/@heroui/select@5179

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@5179

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@5179

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@5179

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@5179

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@5179

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@5179

@heroui/table

npm i https://pkg.pr.new/@heroui/table@5179

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@5179

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@5179

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@5179

@heroui/user

npm i https://pkg.pr.new/@heroui/user@5179

@heroui/react

npm i https://pkg.pr.new/@heroui/react@5179

@heroui/system

npm i https://pkg.pr.new/@heroui/system@5179

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@5179

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@5179

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@5179

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@5179

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@5179

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@5179

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@5179

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@5179

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@5179

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@5179

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@5179

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@5179

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@5179

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@5179

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@5179

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@5179

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@5179

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@5179

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@5179

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@5179

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@5179

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@5179

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@5179

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@5179

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@5179

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@5179

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@5179

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@5179

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@5179

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@5179

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@5179

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@5179

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@5179

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@5179

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@5179

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@5179

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@5179

commit: 73969d9

@jrgarciadev jrgarciadev merged commit 99a5bc2 into canary Apr 19, 2025
10 checks passed
@jrgarciadev jrgarciadev deleted the fix/eng-2393 branch April 19, 2025 15:27
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.

[BUG] - Input-otp variants

2 participants