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(Forms): add support for minItems/maxItems error messages to Field.ArraySelection #4120

Conversation

boyum
Copy link
Contributor

@boyum boyum commented Oct 12, 2024

With the use of JSON Schema and ajv's validation, ArraySelection supports setting minItems and maxItems to control how many items the user can select. The validation error message types are however not exposed, thus TypeScript won't let you override them.

Copy link

vercel bot commented Oct 12, 2024

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

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 7:54am

Copy link

codesandbox-ci bot commented Oct 12, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@boyum boyum changed the title feat(ArrowSelection): override error messages feat(ArrowSelection): override minItems/maxItems error messages Oct 12, 2024
@tujoworker tujoworker self-requested a review October 14, 2024 12:08
@boyum boyum changed the title feat(ArrowSelection): override minItems/maxItems error messages feat(ArrowSelection): expose minItems/maxItems error messages Oct 14, 2024
@tujoworker tujoworker changed the title feat(ArrowSelection): expose minItems/maxItems error messages feat(Forms): add support for minItems/maxItems error messages to Field.ArraySelection Oct 16, 2024
Copy link
Member

@tujoworker tujoworker left a comment

Choose a reason for hiding this comment

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

Thank you for adding this enhancement 🫶

I will take this further and add compatibility for properties, appearance of the validaiton and translation messages.

@tujoworker tujoworker merged commit 29ebe55 into dnbexperience:main Oct 18, 2024
4 checks passed
tujoworker pushed a commit that referenced this pull request Oct 18, 2024
## [10.53.0](v10.52.1...v10.53.0) (2024-10-18)

### 🐛 Bug Fixes

* **Forms:** keep Iterate.Array in sync with the data context and call onChange when `countPath` changes ([#4147](#4147)) ([095ddaa](095ddaa))
* **Forms:** UI alignments of the ChildrenWithAge block ([#4137](#4137)) ([3db7201](3db7201))
* **Upload:** handle file extensions with case insensitivity ([#4138](#4138)) ([fd9d9ba](fd9d9ba))

### ✨ Features

* add `renderMessage` to useTranslation hook for line-break support ([#4125](#4125)) ([5b07bec](5b07bec))
* **Forms:** add `country` prop to Field.PostalCodeAndCity to support other countries than Norway ([#4109](#4109)) ([5095bea](5095bea))
* **Forms:** add `Form.useTranslation` hook ([#4123](#4123)) ([6f40922](6f40922)), closes [#4121](#4121)
* **Forms:** add support for `minItems`/`maxItems` error messages to Field.ArraySelection ([#4120](#4120)) ([29ebe55](29ebe55))
* **Forms:** add support to set a custom `width` to fields and values ([#4142](#4142)) ([07b257f](07b257f))
* **Forms:** add validation to Field.BankAccountNumber ([#4119](#4119)) ([f70ba3d](f70ba3d))
* **Forms:** warn when a field path is declared more than one time ([#4127](#4127)) ([ca15887](ca15887))
@tujoworker
Copy link
Member

🎉 This PR is included in version 10.53.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants