Skip to content

Create a useValue Controller for Form Components #12278

Open
@eriklharper

Description

@eriklharper

This issue will look at crafting a useValue Lumina controller that will handle getting and setting value properties for Calcite form components. There are many form components that are duplicating a lot of the same logic for managing the currently stored value, the previously emitted value, and managing whether or not the value changed as the result of a user interaction via keyboard or mouse vs. direct value changes that happen via javascript (setting the .value property directly, usually on initial mount or as part of something like a form reset).

This new useValue controller will handle all of this for any form component, and will be able to be tested in isolation so that all form components can consistently handle value change event emitting in the proper way.

List of components that can potentially benefit from a useValue controller:

  • autocomplete
  • checkbox
  • combobox
  • input
  • input-date-picker
  • input-number
  • input-text
  • input-time-picker
  • input-time-zone
  • meter
  • radio-button
  • rating
  • segmented-control
  • select
  • slider
  • switch
  • text-area
  • time-picker

Putting a note in here to remind us to look at this. The idea is that we can create a Controller to handle value setting functionality, such as ensuring that change events only fire when a) the user interacts with the form component resulting in b) the value actually changing from the prior emitted value. This controller would be able to differentiate between direct value changes made from code, such as on hostConnected or as the result of another property changing that affects the value.

Originally posted by @eriklharper in #11305

Metadata

Metadata

Assignees

Labels

1 - assignedIssues that are assigned to a sprint and a team member.epicLarge scale issues to be broken up into sub-issues and tracked via sprints and/or project.estimate - 8Requires input from team, consider smaller steps.p - mediumIssue is non core or affecting less that 60% of people using the libraryrefactorIssues tied to code that needs to be significantly reworked.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions