Skip to content

Commit

Permalink
Fix: correcting default validation state text color - fixes #751
Browse files Browse the repository at this point in the history
  • Loading branch information
stevematney committed May 4, 2023
1 parent 978cc6d commit 7242000
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/es-components-via-theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ const theme = {
success: success,
warning: warning,
danger: danger,
default: gray3,
default: gray9,
},
validationInputColor: {
success: {
Expand Down
15 changes: 7 additions & 8 deletions packages/es-components/src/components/controls/AdditionalHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,19 @@ function AdditionalHelp({ children, hasValidationIcon, ...props }) {

return (
<HelpText {...props}>
{hasValidationIcon &&
children &&
validationState !== 'default' && (
<ValidationIcon
aria-hidden="true"
name={theme.validationIconName[validationState]}
/>
)}
{hasValidationIcon && children && validationState !== 'default' && (
<ValidationIcon
aria-hidden="true"
name={theme.validationIconName[validationState]}
/>
)}
{children}
</HelpText>
);
}

AdditionalHelp.propTypes = {
...HelpText.propTypes,
children: PropTypes.any,
/** use to show or hide an associated validation icon */
hasValidationIcon: PropTypes.bool
Expand Down
5 changes: 4 additions & 1 deletion packages/es-components/src/components/controls/Control.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ function Control(props) {
} = props;
const theme = useTheme();
const extraFormContext = isBool(flat) ? { flat } : {};
const textColor = theme.validationTextColor[validationState];
const textColor =
theme.validationTextColor[validationState] ||
theme.validationTextColor['default'];

return (
<OrientationContext.Provider value={orientation}>
Expand All @@ -77,6 +79,7 @@ function Control(props) {
}

Control.propTypes = {
...FlexControl.propTypes,
orientation: PropTypes.oneOf(['stacked', 'inline']),
validationState: PropTypes.oneOf(['default', 'success', 'warning', 'danger']),
/** Apply a top/bottom validation border to a control (usually checkbox/radios) */
Expand Down

0 comments on commit 7242000

Please sign in to comment.