Add form component
📝 Description
Added a Form component and upgraded the entire react-aria version to resolve typecheck errors from version mismatches. The details of the react-aria update are provided in the inline comments of the following PR. https://github.com/nextui-org/nextui/pull/3732
⛳️ Current behavior (updates)
Currently, there is no Form component available, and the version of react-aria does not support the latest features related to form handling.
🚀 New behavior
The new Form component has been added, allowing users to utilize features such as validation behavior switching and error handling through serverErrors. Additionally, the react-aria version has been updated to incorporate the latest form-related improvements.
https://github.com/user-attachments/assets/40f6fff6-68a0-4b92-8273-eebd7a52ae1f
💣 Is this a breaking change (Yes/No):
No.
📝 Additional Information
A guideline on how to use the new Form component will be added in a separate PR.
It will be based on the following reference.
React Aria Forms Guide
Test
Please verify the following in each story.
- The
Formcomponent allows toggling ofvalidationBehavior. - Error messages are correctly displayed based on the
namefield when provided viaserverErrors.
Summary by CodeRabbit
-
New Features
- Introduced a new form component in the
@nextui-org/formpackage for easier form management and validation. - Added support for server-side validation in components like
Autocomplete,CheckboxGroup,DatePicker, andRadioGroup, enhancing validation capabilities.
- Introduced a new form component in the
-
Bug Fixes
- Removed the
layoutNodeprop from the@nextui-org/tablepackage to align with updates in the underlying library.
- Removed the
-
Chores
- Updated multiple package versions across the
NextUIlibrary for improved functionality and compatibility.
- Updated multiple package versions across the
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nextui-docs-v2 | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 27, 2024 7:56pm |
| nextui-storybook-v2 | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 27, 2024 7:56pm |
🦋 Changeset detected
Latest commit: 1aab6281339e9f951a81510eb9eb7d04a379d7a8
The changes in this PR will be included in the next version bump.
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
[!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.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
This pull request includes extensive updates to the package.json files across multiple packages in the @nextui-org project. The updates primarily focus on incrementing dependency versions for various @react-aria, @react-stately, and @react-types packages, as well as adding new dependencies like @nextui-org/form in several components. Additionally, some files introduce modifications to testing suites and type definitions, particularly enhancing type safety in the useDropdown hook.
Changes
| File Path | Change Summary |
|---|---|
| apps/docs/package.json | Updated versions for dependencies, including @internationalized/date and several @react-aria packages. |
| package.json | Updated to version 2.0.0, modified devDependencies for @react-types/link and @react-types/shared. |
| packages/components/checkbox/package.json | Added dependency @nextui-org/form, updated several @react-aria and @react-stately packages. |
| packages/components/date-picker/tests/date-picker.test.tsx | Added validation tests for the DatePicker component, including server-side validation checks. |
| packages/components/date-picker/package.json | Updated @internationalized/date, added @nextui-org/form, and updated several @react-aria and @react-stately packages. |
| packages/components/date-picker/src/use-date-picker.ts | Enhanced useDatePicker hook with new validation behavior and optional classNames property. |
| packages/components/date-picker/src/use-date-range-picker.ts | Enhanced useDateRangePicker hook with new validation behavior and optional classNames property. |
| packages/components/date-picker/stories/date-picker.stories.tsx | Added a new story for server-side validation in the DatePicker. |
| packages/components/date-picker/stories/date-range-picker.stories.tsx | Added a new story for server-side validation in the DateRangePicker. |
| packages/core/react/package.json | Added @nextui-org/form, restored @nextui-org/alert, removed @nextui-org/drawer, updated @react-aria/visually-hidden. |
| packages/core/react/src/index.ts | Added export for @nextui-org/form. |
| packages/core/system/package.json | Updated @internationalized/date, added @react-aria/i18n, and updated several other dependencies. |
| ... | ... (similar updates for other packages like accordion, alert, button, etc.) |
| packages/hooks/use-draggable/package.json | Updated @react-aria/interactions from ^3.21.1 to 3.22.4. |
| packages/hooks/use-intersection-observer/package.json | Updated versions for @react-aria/utils, @react-aria/ssr, and @react-types/shared. |
| packages/hooks/use-pagination/package.json | Updated @react-aria/i18n from 3.12.2 to 3.12.3. |
| packages/utilities/aria-utils/package.json | Updated several dependencies, including @react-aria/utils, @react-stately/collections, and @react-types/shared. |
| .vscode/settings.json | Fixed JSON syntax for Tailwind CSS configuration. |
| packages/components/dropdown/src/use-dropdown.ts | Updated return type of useDropdown function to UseDropdownReturn, enhancing type clarity. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant DatePicker
participant Form
User->>Form: Submit with DatePicker
Form->>DatePicker: Validate input
DatePicker-->>Form: Return validation result
Form-->>User: Display validation feedback
Possibly related PRs
- #3302: This PR introduces month and year pickers to the
DateRangePickerandRangeCalendarcomponents, which is directly related to the updates in thepackage.jsonfor the@nextui-org/date-pickerand@nextui-org/calendarpackages in the main PR, as both involve enhancements to date selection functionalities. - #3501: This PR adds
@react-types/sharedto the dependencies of thesystem-rscpackage, which is relevant as it reflects ongoing maintenance and updates to dependencies that may also affect the components in the main PR. - #3843: Although this PR focuses on fixing image URLs, it is part of the broader documentation and component updates that may relate to the overall maintenance and enhancement efforts reflected in the main PR.
Suggested labels
📋 Scope : Docs
Suggested reviewers
- jrgarciadev
- 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?
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere 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.
@ryo-manba please pull the changes from canary
@ryo-manba fix conflicts
@jrgarciadev I've fixed it.
When merging, please close the related issue in this PR.
- https://github.com/nextui-org/nextui/pull/3732
Thank you for your contribution, I have been looking forward to this update for a long time!
Because in nextjs, collection controls will fail in server-side components, which is painful for me.
👀👀 🙏
@ryo-manba I uninstalled react-aria-components and moved only the needed types and functions to the form package this helps with decreasing the package size https://github.com/nextui-org/nextui/pull/3036/commits/3cf79887508b64e6a3efd4d319b51823598ee003, all tests passed