Repository navigation
feat: a multiline answer and checkbox options for a question - #36
Merged
Merged
Conversation
Every string in an elicitation form was one line, however long the answer was meant to be: "what happened?" with room for 8000 characters was a field that showed about sixty of them. A string schema now takes `multiline: true`, and the field becomes a text area that grows from three lines to eight — `rows` moves where it starts. It never shares a row with another field, and the label, the limit and the required mark behave as they do on a one-line field. Without the flag nothing changes.
Multiple choice was lettered rows that behave like buttons, which reads as "pick one and move on" rather than "tick what applies". `control: "checkbox"` draws the familiar boxes instead — squares for `multi`, circles for `single` — with the same answer, the same bounds and the same previews. The lettered rows stay the default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes
Two asks from the chat team, both additive — nothing changes for a form or a question that does not use them.
A string answer that runs over several lines
Every string in an elicitation form was a one-line input, however long the answer was meant to be: "What happened?" with room for 8000 characters showed about sixty of them.
ElicitationStringSchematakesmultiline?: booleanandrows?: number.multiline: truethe field is a MantineTextareawithautosize, growing from three lines to eight;rowsmoves where it starts and is clamped to that range.maxLength,onChangeandonBlurare the ones a one-line field gets.isCompactFieldreturns false for it, so it never shares a row with another field.Question options as the boxes people know
Multiple choice was lettered rows that behave like buttons, which reads as "pick one and move on" rather than "tick what applies".
QuestionConfigtakescontrol?: 'button' | 'checkbox',buttonby default.checkboxthe options are Mantine controls — squares formulti, circles forsingle— keeping the same answer, the sameminSelections/maxSelectionsand the same option previews.Checks
yarn test(1571 tests, 6 of them new),yarn buildandyarn sizepass locally. Six new tests cover: a multiline field is aTEXTAREAwhile a plain one stays anINPUT, the line breaks reachonAcceptas typed, the limit and the required behaviour hold; squares for a multiple choice with the answer unchanged, circles for a single choice, and the lettered rows without the flag.One note on the required mark: Mantine's
withAsteriskdraws the star without setting therequiredattribute — that is how every field in the kit behaves — so the test asserts the behaviour (an empty required field is refused) rather than the attribute.The full import grew to 242.2 KB gzip; its budget moves to 243.5 KB.