Restrictors
I have a use case where I'd like essentially the same functionality as validators but in a restriction sense. The main difference I'm after is that rather than setting an invalid flag and thus giving the user visual and textual feedback, I'd like the text to just not show up. I've been using Textual for about 6 hours so if I'm way off base here in my solution I won't take offense. As I was writing the tests I came across the Function validator and thought that the existing restrict capabilities like type, max_length, and the restrict regex could probably be Restrictors and the Restrictor I wrote could be the Function restrictor, mirroring the validation pattern. I haven't implemented that latter part here but rather just a Restrictor class that essentially acts as a hybrid of the Function validator (in that you can define your own arbitrary predicate) and restrict regex (in that the text simply doesn't show up in the Input).
Please review the following checklist.
- [X] Docstrings on all new or modified functions / classes
- [X] Updated documentation
- [X] Existing tests pass
- [X] New tests pass
- [x] Updated CHANGELOG.md (where appropriate)