Skip to content

Align input to architecture goals#185

Open
lifeiscontent wants to merge 2 commits into
mainfrom
align/input
Open

Align input to architecture goals#185
lifeiscontent wants to merge 2 commits into
mainfrom
align/input

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

Closes #132

What the spec says

From bhaveshraja's comment on #132, the input component has two categories of behavior:

Always the same (baked in): border style/radius, height per size step, padding, placeholder text color, focus border color, error border color, disabled state (muted background, reduced opacity, cursor not-allowed), caret color, font size and family per size step, addon alignment.

Depends (adjustable): size variant (magnitude), placeholder text, value, leading/trailing addons, error/disabled/read-only state, input type.

What was missing

Two "always the same" items were not yet baked into inputVariants in packages/propel/src/ui/input/variants.ts:

  1. Caret color — the text cursor was inheriting the browser default instead of tracking the brand accent color. Fixed with caret-(--border-color-accent-strong), the same design token the field box already uses for its focus-ring border.

  2. Disabled opacity — the spec says the disabled state includes "reduced opacity". The existing disabled styles covered cursor and text color but not opacity. Fixed with disabled:opacity-60, matching the pattern used by accordion, collapsible, toggle, and field-item across the rest of the design system.

Architecture alignment

  • Both additions go into inputVariants in variants.ts — styling stays in cva, not scattered across component files.
  • No defaultVariants added; magnitude remains a required prop.
  • No visual changes to any story or test; the stories already correctly drive magnitude as a required prop.

Notes

This is a narrow change touching only packages/propel/src/ui/input/variants.ts. The leading/trailing addon slots (also "depends/adjustable" per spec) are a larger anatomy question — they need a wrapper element and named parts — so they're left for a follow-up rather than speculated here.

Needs design approval from @bhaveshraja before merge.

@github-actions

Copy link
Copy Markdown

📚 Storybook preview: https://pr-185-propel-storybook.vamsi-906.workers.dev

The designer's spec marks caret color and disabled-state opacity as
"always the same" — they should be baked in, not left to the consumer.

- Add `caret-(--border-color-accent-strong)` so the text cursor matches
  the brand focus-ring color (same token the field box uses for its
  focus border).
- Add `disabled:opacity-60` alongside the existing disabled styles so a
  disabled input dims to match the rest of the design system (accordion,
  collapsible, field item, toggle all use opacity-60 for disabled).
…nts tier

The components-tier input index re-exported inputFieldBoxVariants (a cva) and
both stories framed the bare Input with that cva applied as a raw className.
Compose the single-element InputFieldBox / InputFieldIconSlot ui parts instead
so the box/border and the leading/trailing icon addons (the Figma adjustable
axes) come from styled ui parts, and the components tier holds no styling.
Register the framing parts as story subcomponents and add a WithIconSlots
story exercising the addon anatomy.
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.

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

1 participant