Skip to content

[FormField]: clearable set once on the form field, shared by DateField and TimeField #572

Description

@ly-tempel-bitweb

Problem

clearable exists twice for the same visible affordance. tedi-form-field has one (default false) that renders .tedi-form-field__clear, and tedi-time-field has its own (default true) that renders .tedi-time-field__clear in its action row. A consumer wrapping a time field in <tedi-form-field clearable> gets two clear buttons in the same box, and there is no single place to turn the affordance on or off.

Solution

  • Add clearable to FieldContext, so the control reads the wrapper's setting instead of declaring its own.
  • tedi-form-field's clearable defaults to true and accepts a bare clearable attribute.
  • Date and time fields resolve clearable() ?? fieldContext?.clearable() ?? true, the same pattern fix(form-field): wrapper is not required by controls anymore #612 #617 uses for size. Inside a form field, set it on the wrapper; the control's own input exists for standalone use and overrides the wrapper when set.
  • Add optional ownsClearButton to FormFieldControl. Date and time set it, so the field skips its generic clear button — their button cannot move into form-field, because the picker button beside it is the overlay's anchor and the design puts clear before it in the action row.
  • Storybook: group size and clearable under Form Field inputs for both fields, matching TextField, so wrapper-owned args read separately from the control's own.

BREAKING CHANGE: tedi-form-field's clearable now defaults to true, so fields that previously showed no clear button now show one once they have a value, and the form field renders its own surface box around text fields and textareas. Pass [clearable]="false" to opt out.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

tedi-readyTEDI-Ready component issue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions