openedx / paragon

💎 An accessible, theme-ready design system built for learning applications and Open edX.

Home Page:https://paragon-openedx.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expose `FormControlFeedback` (props?) in `Form.Autosuggest`

brian-smith-tcril opened this issue · comments

from openedx/frontend-app-authn#1133 (comment)

In addition to the missing onErrorStateChange, the reason for not using the internal error state provided by Form.Autosuggest is the way it renders error. It is prefixed with "x" icon with no way to remove it. All other errors on Authn don't have it and this makes the form errors inconsistent.

This is happening because we are using default props for FormControlFeedback in Form.Autosuggest, meaning hasIcon is always set to true

{helpMessage && isValid && (
<FormControlFeedback type="default">
{helpMessage}
</FormControlFeedback>
)}
{!isValid && (
<FormControlFeedback type="invalid" feedback-for={controlProps.name}>
{errorMessage}
</FormControlFeedback>
)}

FormControlFeedback.defaultProps = {
hasIcon: true,
type: undefined,
icon: undefined,
className: undefined,
muted: false,
};

The simplest solution to this exact use case would be to just expose hasIcon, but it's worth exploring how/how much of FormControlFeedback we want to expose here.

https://paragon-openedx.netlify.app/components/datatable/#paginated-selection example of bulk actions components being passed in was discussed in Paragon WG. I will try following that pattern to implement this