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(select): pass form prop to hidden-select #4854

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from

Conversation

smozely
Copy link

@smozely smozely commented Feb 18, 2025

📝 Description

fixes an issue where the select component couldn't be when passing a form as a prop. which works for the other components exposed from Hero URI

⛳️ Current behavior (updates)

the form prop passed to a select component was just silently dropped.

🚀 New behavior

the form prop passed to a select component is now passed down to the hidden select component or the hidden input for when the list of items is greater than 300

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

No

📝 Additional Information

Summary by CodeRabbit

  • New Features
    • Enhanced form integration for selection inputs, enabling hidden selections to be explicitly linked to their corresponding form for improved submission handling.
    • Introduced a new property to facilitate better integration of hidden select components with form handling mechanisms.

@smozely smozely requested a review from jrgarciadev as a code owner February 18, 2025 10:09
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Walkthrough

The changes add a new optional property, form, to multiple interfaces and function signatures within the select components. This property is passed from parent components through hooks to the underlying hidden <input>, enabling the component to associate the input with a specific form. The update affects both the HiddenSelect component and its related hooks, ensuring that the form value is included in the rendered element and in the object returned by helper functions.

Changes

File(s) Change Summary
packages/.../hidden-select.tsx Added the optional form?: string property to interfaces (AriaHiddenSelectProps, HiddenSelectProps, and AriaHiddenSelectOptions); updated function signatures for useHiddenSelect and HiddenSelect to include and forward the form property.
packages/.../use-select.ts Added the form property extraction in getHiddenSelectProps and included it in the returned object, ensuring the hidden select component receives the form reference.
.changeset/four-terms-relax.md Added a dependency for "@heroui/select": patch and noted that the form property should be passed to a hidden select component.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant HS as HiddenSelect Component
    participant HSHook as useHiddenSelect Hook
    participant Input as Hidden <input>
    
    App->>HS: Pass props (including form)
    HS->>HSHook: Call useHiddenSelect with props & form
    HSHook-->>HS: Return selectProps containing form
    HS->>Input: Render hidden input with form attribute
Loading

Suggested reviewers

  • wingkwong
  • jrgarciadev

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bdcf3e5 and c333afc.

📒 Files selected for processing (1)
  • packages/components/select/src/use-select.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/select/src/use-select.ts

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

changeset-bot bot commented Feb 18, 2025

🦋 Changeset detected

Latest commit: c333afc

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

This PR includes changesets to release 2 packages
Name Type
@heroui/select Patch
@heroui/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 18, 2025

@smozely is attempting to deploy a commit to the HeroUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Feb 18, 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 Feb 18, 2025 3:06pm
heroui-sb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2025 3:06pm

Copy link

pkg-pr-new bot commented Feb 18, 2025

Open in Stackblitz

@heroui/accordion

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

@heroui/alert

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

@heroui/autocomplete

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

@heroui/avatar

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

@heroui/badge

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

@heroui/breadcrumbs

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

@heroui/button

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

@heroui/calendar

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

@heroui/card

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

@heroui/checkbox

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

@heroui/chip

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

@heroui/code

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

@heroui/date-input

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

@heroui/date-picker

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

@heroui/divider

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

@heroui/drawer

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

@heroui/dropdown

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

@heroui/form

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

@heroui/image

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

@heroui/input

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

@heroui/input-otp

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

@heroui/kbd

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

@heroui/link

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

@heroui/listbox

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

@heroui/menu

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

@heroui/modal

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

@heroui/navbar

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

@heroui/number-input

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

@heroui/pagination

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

@heroui/popover

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

@heroui/progress

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

@heroui/radio

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

@heroui/ripple

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

@heroui/scroll-shadow

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

@heroui/select

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

@heroui/skeleton

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

@heroui/slider

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

@heroui/snippet

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

@heroui/spacer

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

@heroui/spinner

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

@heroui/switch

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

@heroui/table

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

@heroui/tabs

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

@heroui/toast

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

@heroui/tooltip

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

@heroui/user

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

@heroui/react

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

@heroui/system

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

@heroui/system-rsc

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

@heroui/theme

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

@heroui/use-aria-accordion

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

@heroui/use-aria-accordion-item

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

@heroui/use-aria-button

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

@heroui/use-aria-link

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

@heroui/use-aria-modal-overlay

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

@heroui/use-aria-multiselect

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

@heroui/use-callback-ref

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

@heroui/use-clipboard

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

@heroui/use-data-scroll-overflow

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

@heroui/use-disclosure

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

@heroui/use-draggable

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

@heroui/use-image

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

@heroui/use-infinite-scroll

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

@heroui/use-intersection-observer

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

@heroui/use-is-mobile

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

@heroui/use-is-mounted

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

@heroui/use-measure

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

@heroui/use-pagination

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

@heroui/use-real-shape

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

@heroui/use-ref-state

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

@heroui/use-resize

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

@heroui/use-safe-layout-effect

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

@heroui/use-scroll-position

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

@heroui/use-ssr

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

@heroui/use-theme

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

@heroui/use-update-effect

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

@heroui/aria-utils

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

@heroui/dom-animation

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

@heroui/framer-utils

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

@heroui/react-rsc-utils

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

@heroui/react-utils

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

@heroui/shared-icons

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

@heroui/shared-utils

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

@heroui/stories-utils

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

@heroui/test-utils

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

commit: c333afc

@smozely smozely force-pushed the fix/select_form_link branch from 31b14ab to bdcf3e5 Compare February 18, 2025 18:18
@smozely smozely requested a review from wingkwong February 18, 2025 18:19
@wingkwong wingkwong added this to the v2.7.3 milestone Feb 20, 2025
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.

3 participants