-
Notifications
You must be signed in to change notification settings - Fork 33
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 Bring API connector for postal code validation and autofill city #4554
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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. |
eafd475
to
93cfe81
Compare
93cfe81
to
596d93c
Compare
596d93c
to
fa36f17
Compare
fa36f17
to
8f44f2e
Compare
8f44f2e
to
6c51f9a
Compare
6c51f9a
to
dec2537
Compare
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring.mdx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring.mdx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring.mdx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors.mdx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors.mdx
Outdated
Show resolved
Hide resolved
Not super duper important, as Norwegian(4-digit postal codes) is the most important. Screen.Recording.2025-02-12.at.13.17.16.mov |
dec2537
to
2db1ea0
Compare
Yes, I also thought about it. And that's why I think, its still easier to implement with the |
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring/Examples.tsx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring/info.mdx
Outdated
Show resolved
Hide resolved
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring/Examples.tsx
Outdated
Show resolved
Hide resolved
packages/dnb-eufemia/src/extensions/forms/Connectors/Bring/postalCode.ts
Outdated
Show resolved
Hide resolved
packages/dnb-eufemia/src/extensions/forms/constants/locales/en-GB.ts
Outdated
Show resolved
Hide resolved
3ef31a0
to
4ae9ae9
Compare
9a08611
to
04de67e
Compare
04de67e
to
ef15f23
Compare
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/Bring/info.mdx
Outdated
Show resolved
Hide resolved
…rms/Connectors/Bring/info.mdx
@@ -89,6 +90,10 @@ This is useful if you want to use a custom schema keyword and `validate` functio | |||
|
|||
You can also easily generate a Ajv schema from a set of fields (JSX), by using the `log` property on the `Tools.GenerateSchema` component. I will e.gc. console log the generated schema. More info about this feature can be found [on a separate page](/uilib/extensions/forms/Form/schema-validation/#generate-schema-from-fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does e.gc.
mean?
@@ -143,6 +143,7 @@ function PostalCodeAndCity(props: Props) { | |||
inputClassName="dnb-forms-field-postal-code-and-city__postal-code-input" | |||
inputMode="numeric" | |||
autoComplete="postal-code" | |||
data-country-code={country || countryCode} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Connectors/info.mdx
Outdated
Show resolved
Hide resolved
…rms/Connectors/info.mdx
|
||
Connectors are created by returning a function that takes the `generalConfig` as an argument. | ||
|
||
Here is an example of how to create a validator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an example of how to create a validator: | |
Here is an example of how to create a validator connector: |
validator
, is that the correct word?
On the line above it says Connectors are created by returning a function that takes the generalConfig
as an argument.
Shouldn't we rather provide an example of how to create a connector rather than a validator?
Or perhaps a validator is a connector? Anyhow, it's a bit confusing when reading it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will enhance this section. Also now that we have a response resolver, I think it's worth to mention it.
In the example provided, could/should we make a new API request when changing the country? Screen.Recording.2025-02-16.at.14.38.47.mov |
Yes, that sounds smart, making it an onBlurValidator would solve this 🙏 Would be safer to execute the validation on onblur, and isn't that also what we suggest/recommend on regular input fields, to use onBlurValidator? |
It does actually make a new request when testing with a real API 👍 connector.mov |
## [10.64.0](v10.63.4...v10.64.0) (2025-02-17) ### ✨ Features * **Field.Expiry:** add month and year validation ([#4571](#4571)) ([bc4fff9](bc4fff9)) * **Forms:** add `createMinimumAgeVerifier` to Field.NationalIdentityNumber ([#4542](#4542)) ([ceb8c2d](ceb8c2d)) * **Forms:** add `insertAt` to Iterate.PushContainer ([#4555](#4555)) ([6160d78](6160d78)) * **Forms:** add `reverse` to Iterate.Array ([#4556](#4556)) ([0b9ba79](0b9ba79)) * **Forms:** add Bring API connector for postal code validation and autofill city ([#4554](#4554)) ([f2ccd5d](f2ccd5d)) * **Forms:** add feature fields Field.Address.Street & Field.Address.Postal ([#4562](#4562)) ([c546009](c546009)) * **Forms:** provide `{ props }` to the second `onChange`, `onFocus` and `onBlur` event parameter ([#4550](#4550)) ([374ff0e](374ff0e)), closes [#4344](#4344) * **Forms:** show field indicator inline without shifting content below ([#4553](#4553)) ([45347a3](45347a3)) * **icons:** add digipass_corporate, digipass_private, calendar_add, investor, goal, layout_grid, table, show_pin ([#4522](#4522)) ([c5db964](c5db964)), closes [#4527](#4527) * **PostalCodeAndCity:** deprecate `country` in favor of `countryCode` ([#4572](#4572)) ([8d0d980](8d0d980)) ### 📝 Documentation * **InfoOverlay:** display fallback content when `undefined` ([#4580](#4580)) ([9879149](9879149)) * link to base fields from their respective value components ([#4564](#4564)) ([3d71c19](3d71c19)) * link to feature fields from their respective value components ([#4563](#4563)) ([45d0e3d](45d0e3d)) * removes duplicated docs for help prop ([#4568](#4568)) ([ae46e71](ae46e71)) ### 🐛 Bug Fixes * **DatePicker:** compare `date` and `maxDate` at same time of day so `is_valid_end_date` is `true` when `date` and `maxDate` are the same date ([#4565](#4565)) ([c52a40b](c52a40b)) * **Drawer:** ensure content on very small screen sizes doesn't get cut off ([#4567](#4567)) ([1dd405f](1dd405f)) * **ePlatform:** adjust ul list style and wrapper style (`max-width` and `padding`) ([#4552](#4552)) ([44f551e](44f551e)) * **Forms:** ensure city in PostalCodeAndCity accepts non-Norwegian characters when using other country ([#4569](#4569)) ([af1bdc8](af1bdc8)) * **Forms:** reveal error only when onChangeValidator is actually the initiator ([#4570](#4570)) ([4d962df](4d962df)) * **Name:** support spacing props ([eb6a412](eb6a412)) * **TextArea:** ResizeObserver loop completed with undelivered notifications ([#4582](#4582)) ([f2f97e3](f2f97e3)) * **Wizard.Step:** use `title` as aria-label when wrapped in `Wizard.Container` ([#4573](#4573)) ([de095e7](de095e7))
🎉 This PR is included in version 10.64.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Example code: