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

feat(Form): new component #439

Merged
merged 43 commits into from
Jul 31, 2023
Merged

feat(Form): new component #439

merged 43 commits into from
Jul 31, 2023

Conversation

romhml
Copy link
Collaborator

@romhml romhml commented Jul 20, 2023

Resolves #433

Fixes #438

The goal of this PR is to implement a Form component to validate and manage input error states. It currently features:

  • Schema validation using Yup, Zod or a custom function
  • Form group error injection
  • Triggering validation on Input blur or change

WDYT?

@nuxt-studio
Copy link

nuxt-studio bot commented Jul 20, 2023

Live Preview ready!

Name Edit Preview Latest Commit
ui Edit on Studio ↗︎ View Live Preview aa5a2c7

@vercel
Copy link

vercel bot commented Jul 20, 2023

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

Name Status Preview Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview Jul 31, 2023 1:24pm

@menthol
Copy link

menthol commented Jul 21, 2023

I'm very interested in this PR, but adding a dependency to 'zod' and 'Yup' seems out of context.

Currently, I'm using Laravel as a backend, and I'd love to use that with Precognition.

The dependencies, as set, will be present in the final build, even if we don't use them.

@romhml
Copy link
Collaborator Author

romhml commented Jul 21, 2023

@menthol Zod and Yup are only installed as dev dependencies in the main packages, and I used type only imports to make sure they won't be present in the final build.

@romhml
Copy link
Collaborator Author

romhml commented Jul 26, 2023

@benjamincanac the PR is ready to be reviewed. Let me know if you need additional information.

Copy link
Member

@romhml I'll try to review this asap. I was just wondering like in the previous comments, do we really need to depend on zod and yup? What if someone wants to use another library?

@menthol
Copy link

menthol commented Jul 26, 2023

@romhml I'll try to review this asap. I was just wondering like in the previous comments, do we really need to depend on zod and yup? What if someone wants to use another library?

@romhml already responsed, this pr use only type import, and we can do custom validation

Copy link
Member

How so? The schema prop passed to the Form component supports only zod and yup: https://github.com/nuxtlabs/ui/pull/439/files#diff-ec19701062113ef084150c6bb1888377fc973410a6597bee1529e7a1e884b710R113

@benjamincanac benjamincanac changed the title feat(Form): implement form component feat(Form): new component Jul 26, 2023
@romhml
Copy link
Collaborator Author

romhml commented Jul 28, 2023

Thanks! I'll have another go at it and improve the docs today or tomorrow

@romhml
Copy link
Collaborator Author

romhml commented Jul 28, 2023

Found it! I simply forgot to import defineComponent 🧑‍🎨

@benjamincanac benjamincanac merged commit a3aba1a into nuxt:dev Jul 31, 2023
1 of 2 checks passed
@benjamincanac
Copy link
Member

@romhml Thanks a lot for this PR, great work ! 😊

@romhml
Copy link
Collaborator Author

romhml commented Jul 31, 2023

You're welcome! I'm genuinely passionate about the ecosystem and the incredible work your team is doing! Looking forward to contribute again 😊

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.

USelectMenu @change event [Component] Form
3 participants