[Bug]: Fix error and warning states in fluid range
Description
While reviewing the Code Connect Template API migration in #23505, we noticed an inconsistency in the Fluid Date Picker range component.
The Figma range variant contains:
- The parent
Date picker - Range calendar - Fluidcomponent - Two nested
Date picker - Single calendar - Fluidcomponents
All three components expose their own State property. This allows the parent
and the two nested inputs to have different Error or Warning states at the same
time.
For example, the parent can be set to Error while one nested input is Enabled and the other is Warning. This produces a visual result that cannot be mapped consistently to the Carbon component APIs or represented accurately in Code Connect.
Component API differences
In React, FluidDatePicker supports invalid, invalidText, warn, and
warnText at the parent level, while its inputs can also expose their own
states.
In Web Components, Error and Warning states are exposed by
cds-fluid-date-picker-input, but not by the parent
cds-fluid-date-picker.
Because of this difference, Code Connect cannot apply the parent and nested Figma states consistently across React and Web Components.
Steps to reproduce
- Add a Fluid Date Picker range instance in Figma.
- Set the parent range component
Stateto Error or Warning. - Set each nested single-calendar component to a different state.
- Inspect the generated React and Web Components code in Dev Mode.
Expected behavior
The Figma component should have a clear source of truth for Error and Warning states that can be mapped consistently to the supported Carbon APIs.
Possible approaches include:
- Managing the state only at the range component level and synchronizing both nested inputs.
- Managing each input state independently and removing the duplicate state from the parent.
- Defining explicit precedence when the parent and nested states differ.
Acceptance criteria
- Error and Warning state ownership is clearly defined for the range variant.
- The parent and nested inputs cannot produce conflicting states.
- Error and Warning messages are associated with the correct component level.
- The resulting structure can be mapped consistently in Code Connect for React and Web Components.
Related
- carbon-design-system/carbon#23505
- carbon-design-system/carbon-design-kit#973
Source: carbon-design-system/carbon