-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement form.io email component type #17
Conversation
3186194
to
52e954f
Compare
Centralized common schema validation such as label + key, in preparation for complexer component.type specific validations, using zod unions and intersections.
This allows for re-using the error list between wrapper and 'atomic' components, especially for the multiple: true variant. NOTE: form.io itself always displays the errors at the wrapper level, but it should be better UX/a11y to display the errors precisely with the invalid input. There is definitely more to gain in terms of a11y here, e.g. with aria-describedby etc.
* Added stories for configuration + preview * Implemented defaultValue builder form schema validation, taking into account the 'multiple' flag. * Added email to the supported components registry TODO (later) * validation in preview component * update preview when value of defaultValue in builder form changes
a094d15
to
4d06d35
Compare
Centralized common schema validation such as label + key, in preparation for complexer component.type specific validations, using zod unions and intersections.
This allows for re-using the error list between wrapper and 'atomic' components, especially for the multiple: true variant. NOTE: form.io itself always displays the errors at the wrapper level, but it should be better UX/a11y to display the errors precisely with the invalid input. There is definitely more to gain in terms of a11y here, e.g. with aria-describedby etc.
* Added stories for configuration + preview * Implemented defaultValue builder form schema validation, taking into account the 'multiple' flag. * Added email to the supported components registry TODO (later) * validation in preview component * update preview when value of defaultValue in builder form changes
779732e
to
90ed545
Compare
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.
show: undefined, | ||
when: '', |
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 think these are both null
to start with in Formio? Not sure if it is a problem
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.
yeah, but their own type definitions don't allow for null and using null
violates the typescript types, which breaks compilation. A typical example of form.io not sticking to their own semantics 😬
return ( | ||
<TextField | ||
name={name} | ||
multiple={!!multiple} |
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.
Isn't multiple already a bool? 🤔
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.
it can also be undefined as it's an optional prop for the preview
Yep, it's a known issue and tracked in #21 |
6c35f8c
to
bee7fb9
Compare
Back to draft - I'll get the refactors in a separate PR and sort out adding the typescript types first. |
bee7fb9
to
a02ba2e
Compare
* Added stories for configuration + preview * Implemented defaultValue builder form schema validation, taking into account the 'multiple' flag. * Added email to the supported components registry TODO (later) * validation in preview component * update preview when value of defaultValue in builder form changes
a02ba2e
to
b5a7b1b
Compare
<Tabs> | ||
<TabList> | ||
<Tab | ||
hasErrors={hasAnyError( |
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 don't find this particularly elegant, but I don't know how to fix it either. The field name
(and thus the error key) is deeply nested, and the field itself does not know in which tab it's being displayed.
47de2ec
to
941ea59
Compare
Closes #18
design decisions to make/think about
-> pushed preview validation to separate issue #19
tasks