Align number-field to architecture goals#182
Open
lifeiscontent wants to merge 1 commit into
Open
Conversation
|
📚 Storybook preview: https://pr-182-propel-storybook.vamsi-906.workers.dev |
- Add `magnitude` as a required prop (sm/md/lg/xl) on NumberFieldDecrement, NumberFieldIncrement, and NumberFieldInput; move the per-size geometry (button square + --node-size, input height) into cva variants instead of hard-coding size-8/h-8. - Add a NumberFieldButtonIcon part (node-slot span) that sizes its child icon to the button's --node-size, matching the AccordionTriggerIcon pattern; callers no longer pass a hardcoded className="size-4" on icons. - Thread magnitude through the components-tier NumberField and replace the hardcoded Minus/Plus className with NumberFieldButtonIcon. - Export NumberFieldMagnitude and NumberFieldButtonIcon from both index files. Closes #139
0848bae to
bdf9b21
Compare
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.
Closes #139
What changed
The number-field component was missing a size axis — the stepper buttons and input were hardcoded to 32 px (xl). This PR wires up the full magnitude system and fixes the icon sizing pattern.
Designer spec summary (from #139)
Always the same (baked in): button placement flanking the input, +/− icons for increment/decrement, center-aligned input text, min/max clamping with boundary-disabled buttons, keyboard up/down stepping, focus ring on the input, buttons visually joined to the input via shared border, linear step behavior.
Adjustable (now required props): current value, min/max boundaries, step increment, disabled state, size variant (
magnitude), whether direct keyboard input is allowed.Architecture changes
magnitudeadded as a required prop onNumberFieldDecrement,NumberFieldIncrement, andNumberFieldInput. The per-size geometry (button square,--node-sizeCSS variable, input height) lives in cva variants invariants.ts— no more hardcodedsize-8/h-8. Matches the Figma S/Base/L/XL → sm/md/lg/xl scale used by Button and IconButton.NumberFieldButtonIconadded as a new ui part (a node-slot span that reads--node-sizefrom its parent button, sizing the child icon). Follows the same pattern asAccordionTriggerIcon. Call sites no longer putclassName="size-4"directly on icon elements.Components tier updated:
NumberFieldacceptsmagnitudeand threads it to all three inner parts; usesNumberFieldButtonIconto wrapMinus/Plusinstead of passingclassNameto them directly.Stories updated to pass
magnitude="xl"(matching the previous hardcoded size), and to declareNumberFieldButtonIconinsubcomponents.Exports:
NumberFieldMagnitudeandNumberFieldButtonIconare now exported from both the ui and components index files.Notes
Needs design approval (bhaveshraja) before merge per project convention.