feat(inputs): add statusVariant to the bordered input family (#4187)#4200
Draft
cixzhang wants to merge 1 commit into
Draft
feat(inputs): add statusVariant to the bordered input family (#4187)#4200cixzhang wants to merge 1 commit into
cixzhang wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
Self-review — against the Component Build Protocol (Quick Self-Review for updates)This is a plumbing/convention change (exposing an existing
Spec-compliance notes
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsDateInput · View in Storybook
DateRangeInput · View in Storybook
FileInput · View in Storybook
MultiSelector · View in Storybook
NumberInput · View in Storybook
PowerSearch · View in Storybook
Selector · View in Storybook
TextArea · View in Storybook
TextInput · View in Storybook
TimeInput · View in Storybook
Tokenizer · View in Storybook
Typeahead · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 6 accessibility violation(s) found — 2 critical, 4 serious. DateRangeInput - 1 issue(s)
FileInput - 3 issue(s)
PowerSearch - 1 issue(s)
Tokenizer - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Summary
Adds a single optional prop —
statusVariant?: 'attached' | 'detached'(default'attached') — to the bordered input family, forwarding it verbatim to theFieldeach input already renders.Field/FieldStatushave implemented both placements for a while; the bordered inputs just never exposed the knob, so they were locked to the implicitattacheddefault. This threads it through.attached(default) — the status message sits directly below the input with an overlapping treatment. This is exactly today's behavior for these inputs.detached— the status message floats below as a separate element with spacing.Closes #4187.
Why
The placement behavior already exists at the primitive layer (
Field.statusVariant→FieldStatus), but the bordered inputs couldn't reach it. Consumers who wanted a floated (detached) status under a bordered input had no supported way to get one. This is pure plumbing of an existing capability — no new infrastructure.What changed
Gets the prop — bordered family (12):
TextInput,TextArea,NumberInput,DateInput,DateRangeInput,TimeInput,Selector,MultiSelector,Typeahead,Tokenizer,FileInput, andPowerSearch(which forwards to the bordered input it renders internally).Each one:
statusVariant?: FieldStatusVariantto its props interface (JSDoc mirroringField's).'attached'.statusVariant={statusVariant}, to theFieldit renders.Deliberately NOT touched — borderless / grouped controls (7):
DateTimeInput,CheckboxList,RadioList,Slider,InputGroup,Switch,CheckboxInput.These keep their hardcoded
detachedand get no public prop.attachedis an overlap treatment designed for a full-width bordered input box; borderless and grouped controls have no such box to overlap, soattachedrenders wrong on them. Exposing a prop whose only non-default value is broken on those controls would be a footgun, so the prop is offered only where both values are valid. Their existingdetachedliteral is left exactly as-is — zero source change.Non-breaking
The default
'attached'matches what these inputs already produced (they renderedFieldwith nostatusVariant, andField's own default is'attached'). Existing code compiles and renders identically; opting intodetachedis the only behavior change, and it's explicit.Type reuse
The prop reuses the existing
FieldStatusVarianttype (imported throughField's barrel). The union is not redefined per component — one type, extensible in one place, no drift. No changes toFieldorFieldStatus.Testing
data-variant="attached";statusVariant="detached"renders it withdata-variant="detached".StatusVariantComparisonStorybook story to each component showing attached vs detached side by side.pnpm lint(0 errors on changed files),@astryxdesign/coretypecheck +typecheck:docs, storybook typecheck,pnpm build,sync-exports --check,verify-exports,generate-token-docs --check, and changeset validation — all green..doc.mjsprop table (all locale/dense variants present) with the new prop.