LITE-29837: Add input validation to Textfield and Select + other fixes #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



This PR adds input validation to
TextfieldandSelectcomponents, plus other fixes:useFieldValidationcomposable to validate input fields against rulesTextfieldandSelectcomponentsTextfieldfixes: fixed focused and label styles, added hint, fixed focus behaviourSelectfixes: fixed focused styles, added customisation to option rendering, addmenuProps"opened"and"closed"whenMenuwidget is toggledTextfieldandSelectValidation works the same way as in the SPA:
rulesis an array of functions, and validation is only successful if the rule returns explicitlytrue. If the rule fails, it should return an error message string.Example of a rule:
I added examples of rules validation in the Storybook as well.
You can check the storybook build if you want to check it in real time, but I also attach these screenshots (already verified styles with Max Tiumin).
Some text fields: field with error, filled field, field with error and focused:

Select, open, with an option selected:

Some mix of fields:
