Skip to content

Align number-field to architecture goals#182

Open
lifeiscontent wants to merge 1 commit into
mainfrom
align/number-field
Open

Align number-field to architecture goals#182
lifeiscontent wants to merge 1 commit into
mainfrom
align/number-field

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

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

  • magnitude added as a required prop on NumberFieldDecrement, NumberFieldIncrement, and NumberFieldInput. The per-size geometry (button square, --node-size CSS variable, input height) lives in cva variants in variants.ts — no more hardcoded size-8/h-8. Matches the Figma S/Base/L/XL → sm/md/lg/xl scale used by Button and IconButton.

  • NumberFieldButtonIcon added as a new ui part (a node-slot span that reads --node-size from its parent button, sizing the child icon). Follows the same pattern as AccordionTriggerIcon. Call sites no longer put className="size-4" directly on icon elements.

  • Components tier updated: NumberField accepts magnitude and threads it to all three inner parts; uses NumberFieldButtonIcon to wrap Minus/Plus instead of passing className to them directly.

  • Stories updated to pass magnitude="xl" (matching the previous hardcoded size), and to declare NumberFieldButtonIcon in subcomponents.

  • Exports: NumberFieldMagnitude and NumberFieldButtonIcon are now exported from both the ui and components index files.

Notes

Needs design approval (bhaveshraja) before merge per project convention.

@github-actions

Copy link
Copy Markdown

📚 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number stepper: what should always look the same, and what should be adjustable?

1 participant