feat(forms): rating-family field types (stars, NPS, slider, emoji) — slice 9a#61
Merged
Merged
Conversation
…slice 9a First batch of Phase 2 field types. All four answer with a number on a bounded scale resolved by a single shared `scaleBounds` helper, so the renderer widgets, server-side validation, and answer formatter stay in sync. - shared: `scaleBounds`, `EMOJI_SCALE`, `SCALE_FIELD_TYPES`, NPS constants; add `step` to field validation; `buildAnswerSchema` enforces per-type scale bounds (NPS 0–10 incl. 0, emoji 1–5, stars 1–max default 5, slider min/max default 0–100); `formatAnswerValue` renders stars/NPS/emoji with their scale. - web: renderer widgets (`StarRating`, `ScaleButtons`, `SliderInput`); wire the four cases in `FieldInput`; builder offers the new types with star-max and slider min/max/step config; DE/EN labels + builder strings. - tests: scale validation for all four types + formatter output. Follow-ups: matrix (9b), signature (9c).
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.
First Phase 2 slice — new field types. Adds star rating, NPS (0–10), slider, and emoji scale.
Approach
All four answer with a number on a bounded scale resolved by one shared helper
scaleBounds(field)in@msk-forms/shared, so the renderer widgets, server-side validation, and the answer formatter can't drift.Changes
scaleBounds,EMOJI_SCALE,SCALE_FIELD_TYPES,NPS_MIN/MAX; addedstepto field validation.buildAnswerSchemaenforces per-type bounds (NPS 0–10 incl. 0, emoji 1–5, stars 1–max [default 5], slider min/max [default 0–100]).formatAnswerValuerenders stars/NPS/emoji with their scale.StarRating/ScaleButtons/SliderInput; wired the four cases inFieldInput; builder offers the new types with star-max and slider min/max/step config; DE/EN field-type labels + builder strings.Validation
pnpm typecheck,pnpm lint,pnpm test,pnpm build— all green.Follow-ups in this slice: matrix (9b), signature (9c).